@servicetitan/navigation 3.3.0 → 4.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/header-navigation/header-navigation-content.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-content.js +3 -3
- package/dist/components/header-navigation/header-navigation-content.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts +3 -3
- package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-extra.stories.js +8 -22
- package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.d.ts +3 -30
- package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-links.js +8 -5
- package/dist/components/header-navigation/header-navigation-links.js.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts +1 -0
- package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation-stacked.stories.js +8 -26
- package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.d.ts +1 -28
- package/dist/components/header-navigation/header-navigation.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.js +5 -8
- package/dist/components/header-navigation/header-navigation.js.map +1 -1
- package/dist/components/header-navigation/header-navigation.module.less +13 -70
- package/dist/components/header-navigation/header-navigation.stories.d.ts +1 -0
- package/dist/components/header-navigation/header-navigation.stories.d.ts.map +1 -1
- package/dist/components/header-navigation/header-navigation.stories.js +9 -27
- package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
- package/dist/components/header-navigation/index.d.ts +0 -1
- package/dist/components/header-navigation/index.d.ts.map +1 -1
- package/dist/components/header-navigation/index.js +0 -1
- package/dist/components/header-navigation/index.js.map +1 -1
- package/dist/components/layout.stories.d.ts +1 -0
- package/dist/components/layout.stories.d.ts.map +1 -1
- package/dist/components/layout.stories.js +4 -2
- package/dist/components/layout.stories.js.map +1 -1
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts +16 -0
- package/dist/components/left-navigation/header-navigation-tiny-links.d.ts.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny-links.js +43 -0
- package/dist/components/left-navigation/header-navigation-tiny-links.js.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny.d.ts +23 -0
- package/dist/components/left-navigation/header-navigation-tiny.d.ts.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny.js +7 -0
- package/dist/components/left-navigation/header-navigation-tiny.js.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny.module.less +109 -0
- package/dist/components/{header-navigation → left-navigation}/header-navigation-tiny.stories.d.ts +2 -2
- package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts.map +1 -0
- package/dist/components/left-navigation/header-navigation-tiny.stories.js +30 -0
- package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +1 -0
- package/dist/components/left-navigation/index.d.ts +3 -0
- package/dist/components/left-navigation/index.d.ts.map +1 -0
- package/dist/components/left-navigation/index.js +3 -0
- package/dist/components/left-navigation/index.js.map +1 -0
- package/dist/components/{side-navigation → left-navigation}/side-navigation.d.ts +1 -12
- package/dist/components/left-navigation/side-navigation.d.ts.map +1 -0
- package/dist/components/left-navigation/side-navigation.js +23 -0
- package/dist/components/left-navigation/side-navigation.js.map +1 -0
- package/dist/components/{side-navigation → left-navigation}/side-navigation.module.less +28 -22
- package/dist/components/left-navigation/side-navigation.stories.d.ts +10 -0
- package/dist/components/left-navigation/side-navigation.stories.d.ts.map +1 -0
- package/dist/components/left-navigation/side-navigation.stories.js +31 -0
- package/dist/components/left-navigation/side-navigation.stories.js.map +1 -0
- package/dist/components/links.d.ts +5 -0
- package/dist/components/links.d.ts.map +1 -0
- package/dist/components/links.js +14 -0
- package/dist/components/links.js.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts +2 -8
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js +5 -43
- package/dist/components/profile-dropdown/profile-dropdown-stacked.stories.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts +9 -0
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.d.ts.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js +13 -0
- package/dist/components/profile-dropdown/profile-dropdown-tiny.stories.js.map +1 -0
- package/dist/components/profile-dropdown/profile-dropdown.d.ts +2 -1
- package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.js +16 -7
- package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.module.less +7 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts +9 -8
- package/dist/components/profile-dropdown/profile-dropdown.stories.d.ts.map +1 -1
- package/dist/components/profile-dropdown/profile-dropdown.stories.js +39 -39
- package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/test/data-stories.module.less +8 -0
- package/dist/test/data.stories.d.ts +26 -0
- package/dist/test/data.stories.d.ts.map +1 -0
- package/dist/test/data.stories.js +151 -0
- package/dist/test/data.stories.js.map +1 -0
- package/dist/utils/navigation-context.d.ts +2 -2
- package/dist/utils/navigation-context.d.ts.map +1 -1
- package/dist/utils/navigation-context.js +18 -5
- package/dist/utils/navigation-context.js.map +1 -1
- package/dist/utils/navigation.d.ts +47 -0
- package/dist/utils/navigation.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/components/header-navigation/header-navigation-content.tsx +3 -3
- package/src/components/header-navigation/header-navigation-extra.stories.tsx +29 -38
- package/src/components/header-navigation/header-navigation-links.tsx +19 -41
- package/src/components/header-navigation/header-navigation-stacked.stories.tsx +18 -70
- package/src/components/header-navigation/header-navigation.module.less +13 -70
- package/src/components/header-navigation/header-navigation.module.less.d.ts +0 -1
- package/src/components/header-navigation/header-navigation.stories.tsx +20 -71
- package/src/components/header-navigation/header-navigation.tsx +6 -82
- package/src/components/header-navigation/index.ts +0 -1
- package/src/components/layout.stories.tsx +4 -2
- package/src/components/left-navigation/header-navigation-tiny-links.tsx +110 -0
- package/src/components/left-navigation/header-navigation-tiny.module.less +109 -0
- package/src/components/left-navigation/header-navigation-tiny.module.less.d.ts +14 -0
- package/src/components/{header-navigation → left-navigation}/header-navigation-tiny.stories.tsx +39 -46
- package/src/components/left-navigation/header-navigation-tiny.tsx +65 -0
- package/src/components/left-navigation/index.ts +2 -0
- package/src/components/{side-navigation → left-navigation}/side-navigation.module.less +28 -22
- package/src/components/{side-navigation → left-navigation}/side-navigation.module.less.d.ts +3 -3
- package/src/components/left-navigation/side-navigation.stories.tsx +46 -0
- package/src/components/left-navigation/side-navigation.tsx +171 -0
- package/src/components/links.tsx +31 -0
- package/src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx +5 -170
- package/src/components/profile-dropdown/profile-dropdown-tiny.stories.tsx +15 -0
- package/src/components/profile-dropdown/profile-dropdown.module.less +7 -1
- package/src/components/profile-dropdown/profile-dropdown.module.less.d.ts +1 -0
- package/src/components/profile-dropdown/profile-dropdown.stories.tsx +106 -129
- package/src/components/profile-dropdown/profile-dropdown.tsx +35 -8
- package/src/index.ts +2 -1
- package/src/test/data-stories.module.less +8 -0
- package/src/test/data-stories.module.less.d.ts +3 -0
- package/src/test/data.stories.tsx +223 -0
- package/src/utils/navigation-context.tsx +10 -10
- package/src/utils/navigation.ts +54 -0
- package/dist/components/header-navigation/header-navigation-tiny.stories.d.ts.map +0 -1
- package/dist/components/header-navigation/header-navigation-tiny.stories.js +0 -25
- package/dist/components/header-navigation/header-navigation-tiny.stories.js.map +0 -1
- package/dist/components/side-navigation/icons.d.ts +0 -7
- package/dist/components/side-navigation/icons.d.ts.map +0 -1
- package/dist/components/side-navigation/icons.js +0 -5
- package/dist/components/side-navigation/icons.js.map +0 -1
- package/dist/components/side-navigation/index.d.ts +0 -2
- package/dist/components/side-navigation/index.d.ts.map +0 -1
- package/dist/components/side-navigation/index.js +0 -2
- package/dist/components/side-navigation/index.js.map +0 -1
- package/dist/components/side-navigation/side-navigation.d.ts.map +0 -1
- package/dist/components/side-navigation/side-navigation.js +0 -37
- package/dist/components/side-navigation/side-navigation.js.map +0 -1
- package/dist/components/side-navigation/side-navigation.stories.d.ts +0 -10
- package/dist/components/side-navigation/side-navigation.stories.d.ts.map +0 -1
- package/dist/components/side-navigation/side-navigation.stories.js +0 -52
- package/dist/components/side-navigation/side-navigation.stories.js.map +0 -1
- package/src/components/side-navigation/icons.tsx +0 -74
- package/src/components/side-navigation/index.ts +0 -1
- package/src/components/side-navigation/side-navigation.stories.tsx +0 -95
- package/src/components/side-navigation/side-navigation.tsx +0 -224
|
@@ -84,6 +84,16 @@
|
|
|
84
84
|
color: @text-color-active;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
&.navigation-item-icon-state.navigation-item-active {
|
|
88
|
+
.navigation-icon:not(.navigation-icon-active) {
|
|
89
|
+
display: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.navigation-icon.navigation-icon-active {
|
|
93
|
+
display: block;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
87
97
|
&:hover:not(.navigation-item-active) {
|
|
88
98
|
background-color: @bg-color-hover;
|
|
89
99
|
}
|
|
@@ -101,10 +111,19 @@
|
|
|
101
111
|
}
|
|
102
112
|
}
|
|
103
113
|
|
|
104
|
-
.navigation-icon {
|
|
114
|
+
.navigation-icon[data-anv][data-anv] {
|
|
105
115
|
height: 24px;
|
|
106
116
|
width: 24px;
|
|
107
|
-
|
|
117
|
+
color: inherit;
|
|
118
|
+
|
|
119
|
+
& > svg {
|
|
120
|
+
height: 24px;
|
|
121
|
+
width: 24px;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&.navigation-icon-active {
|
|
125
|
+
display: none;
|
|
126
|
+
}
|
|
108
127
|
}
|
|
109
128
|
|
|
110
129
|
.options-item {
|
|
@@ -127,12 +146,17 @@
|
|
|
127
146
|
background-color: @bg-color-hover;
|
|
128
147
|
}
|
|
129
148
|
|
|
130
|
-
.options-icon {
|
|
149
|
+
.options-icon-wrapper {
|
|
131
150
|
height: 24px;
|
|
132
151
|
width: 24px;
|
|
133
|
-
font-size: 24px;
|
|
134
152
|
padding-left: @spacing-1;
|
|
135
153
|
padding-right: @spacing-1;
|
|
154
|
+
|
|
155
|
+
.options-icon[data-anv][data-anv] > svg {
|
|
156
|
+
height: 24px;
|
|
157
|
+
width: 24px;
|
|
158
|
+
color: @text-color;
|
|
159
|
+
}
|
|
136
160
|
}
|
|
137
161
|
|
|
138
162
|
.options-item-text {
|
|
@@ -143,24 +167,6 @@
|
|
|
143
167
|
}
|
|
144
168
|
}
|
|
145
169
|
|
|
146
|
-
.options-popover-item-clickable {
|
|
147
|
-
cursor: pointer;
|
|
148
|
-
|
|
149
|
-
&:hover {
|
|
150
|
-
background-color: @color-neutral-60;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.options-popover-item-active {
|
|
155
|
-
background-color: @color-blue-100;
|
|
156
|
-
color: @color-blue-500;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.options-popover-item-inactive,
|
|
160
|
-
.options-popover-item-active {
|
|
161
|
-
border-radius: @border-radius-1;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
170
|
.divider {
|
|
165
171
|
border-top: 1px solid @border-color;
|
|
166
172
|
margin-left: 12px;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").FC<import("./side-navigation").SideNavigationProps>;
|
|
5
|
+
decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
|
|
6
|
+
parameters: {};
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
export declare const DefaultSideNavigation: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=side-navigation.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-navigation.stories.d.ts","sourceRoot":"","sources":["../../../src/components/left-navigation/side-navigation.stories.tsx"],"names":[],"mappings":";;;;;;;AAYA,wBAKE;AAEF,eAAO,MAAM,qBAAqB,+CA0BjC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { NavLinkMock, items, withAnvil, withMemoryRouter } from '../../test/data.stories';
|
|
4
|
+
import { SideNavigation } from './';
|
|
5
|
+
const layout = (Story) => {
|
|
6
|
+
return (_jsxs("div", { className: "d-f border", style: { height: '800px' }, children: [_jsx(Story, {}), _jsx("div", { className: "flex-grow-1 flex-basis-0" })] }));
|
|
7
|
+
};
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Navigation/SideNavigation',
|
|
10
|
+
component: SideNavigation,
|
|
11
|
+
decorators: [layout, withMemoryRouter, withAnvil],
|
|
12
|
+
parameters: {},
|
|
13
|
+
};
|
|
14
|
+
export const DefaultSideNavigation = () => {
|
|
15
|
+
const [expanded, setExpanded] = useState(false);
|
|
16
|
+
return (_jsx(SideNavigation, { navigationComponent: NavLinkMock, expanded: expanded, onExpandedChange: setExpanded, items: [
|
|
17
|
+
items.dashboard,
|
|
18
|
+
items.calendar,
|
|
19
|
+
items.calls,
|
|
20
|
+
items.accounting,
|
|
21
|
+
items.dispatch,
|
|
22
|
+
items.fleet,
|
|
23
|
+
items.followUps,
|
|
24
|
+
items.inventory,
|
|
25
|
+
items.marketing,
|
|
26
|
+
items.priceBook,
|
|
27
|
+
items.pointOfSale,
|
|
28
|
+
items.reports,
|
|
29
|
+
], itemsTop: [items.tasks] }));
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=side-navigation.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"side-navigation.stories.js","sourceRoot":"","sources":["../../../src/components/left-navigation/side-navigation.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC1F,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,EAAE,cAAc;IACzB,UAAU,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,CAAC;IACjD,UAAU,EAAE,EAAE;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACtC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,OAAO,CACH,KAAC,cAAc,IACX,mBAAmB,EAAE,WAAW,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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { HeaderNavigationLinkProps, HeaderNavigationTriggerProps } from '../utils/navigation';
|
|
3
|
+
export declare const HeaderNavigationLink: FC<HeaderNavigationLinkProps>;
|
|
4
|
+
export declare const HeaderNavigationTrigger: FC<HeaderNavigationTriggerProps>;
|
|
5
|
+
//# sourceMappingURL=links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../src/components/links.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAW9F,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC,yBAAyB,CAQ9D,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,4BAA4B,CAQpE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { NavigationLegacyContext } from '../utils/navigation-context';
|
|
4
|
+
import { HeaderNavigationLink as HeaderNavigationLinkLegacy, HeaderNavigationTrigger as HeaderNavigationTriggerLegacy, } from './header-navigation/header-navigation-links';
|
|
5
|
+
import { HeaderNavigationLink as HeaderNavigationLinkModern, HeaderNavigationTrigger as HeaderNavigationTriggerModern, } from './left-navigation/header-navigation-tiny-links';
|
|
6
|
+
export const HeaderNavigationLink = props => {
|
|
7
|
+
const isLegacy = useContext(NavigationLegacyContext);
|
|
8
|
+
return isLegacy ? (_jsx(HeaderNavigationLinkLegacy, Object.assign({}, props))) : (_jsx(HeaderNavigationLinkModern, Object.assign({}, props)));
|
|
9
|
+
};
|
|
10
|
+
export const HeaderNavigationTrigger = props => {
|
|
11
|
+
const isLegacy = useContext(NavigationLegacyContext);
|
|
12
|
+
return isLegacy ? (_jsx(HeaderNavigationTriggerLegacy, Object.assign({}, props))) : (_jsx(HeaderNavigationTriggerModern, Object.assign({}, props)));
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=links.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"links.js","sourceRoot":"","sources":["../../src/components/links.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EACH,oBAAoB,IAAI,0BAA0B,EAClD,uBAAuB,IAAI,6BAA6B,GAC3D,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACH,oBAAoB,IAAI,0BAA0B,EAClD,uBAAuB,IAAI,6BAA6B,GAC3D,MAAM,gDAAgD,CAAC;AAExD,MAAM,CAAC,MAAM,oBAAoB,GAAkC,KAAK,CAAC,EAAE;IACvE,MAAM,QAAQ,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAErD,OAAO,QAAQ,CAAC,CAAC,CAAC,CACd,KAAC,0BAA0B,oBAAK,KAAK,EAAI,CAC5C,CAAC,CAAC,CAAC,CACA,KAAC,0BAA0B,oBAAK,KAAK,EAAI,CAC5C,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAqC,KAAK,CAAC,EAAE;IAC7E,MAAM,QAAQ,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;IAErD,OAAO,QAAQ,CAAC,CAAC,CAAC,CACd,KAAC,6BAA6B,oBAAK,KAAK,EAAI,CAC/C,CAAC,CAAC,CAAC,CACA,KAAC,6BAA6B,oBAAK,KAAK,EAAI,CAC/C,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
+
export * from './profile-dropdown.stories';
|
|
1
2
|
declare const _default: {
|
|
2
3
|
title: string;
|
|
3
4
|
component: import("./profile-dropdown").ProfileDropdownType;
|
|
4
5
|
parameters: {};
|
|
6
|
+
decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
|
|
5
7
|
};
|
|
6
8
|
export default _default;
|
|
7
|
-
export declare const profileDropdownDefault: () => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare const profileDropdownWithLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export declare const profileDropdownWithErrorLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export declare const profileDropdownWithInfo: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare const profileDropdownWithCounter: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export declare const profileDropdownWithBothBadges: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export declare const profileDropdownWithHintPopup: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
export declare const profileDropdownWithHintAndInfoPopup: () => import("react/jsx-runtime").JSX.Element;
|
|
15
9
|
//# sourceMappingURL=profile-dropdown-stacked.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-dropdown-stacked.stories.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile-dropdown-stacked.stories.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx"],"names":[],"mappings":"AAEA,cAAc,4BAA4B,CAAC;;;;;;;AAK3C,wBAKE"}
|
|
@@ -1,51 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { withAnvil, withMemoryRouter } from '../../test/data.stories';
|
|
3
3
|
import { HeaderNavigationStacked } from '../header-navigation';
|
|
4
|
+
export * from './profile-dropdown.stories';
|
|
4
5
|
import { ProfileDropdown } from './profile-dropdown';
|
|
6
|
+
const withHeaderNavigationStacked = (Story) => _jsx(HeaderNavigationStacked, { right: _jsx(Story, {}) });
|
|
5
7
|
export default {
|
|
6
8
|
title: 'Navigation/ProfileDropdownStacked',
|
|
7
9
|
component: ProfileDropdown,
|
|
8
10
|
parameters: {},
|
|
11
|
+
decorators: [withMemoryRouter, withAnvil, withHeaderNavigationStacked],
|
|
9
12
|
};
|
|
10
|
-
const NavLinkMock = props => (_jsx("a", { href: props.to, target: props.target, onClick: e => {
|
|
11
|
-
e.preventDefault();
|
|
12
|
-
}, className: props.className, children: props.children }));
|
|
13
|
-
export const profileDropdownDefault = () => (_jsx(HeaderNavigationStacked, { navigationComponent: NavLinkMock, right: _jsxs(ProfileDropdown, { children: [_jsx(ProfileDropdown.Link, { id: "first", to: "https://google.com", children: "first link" }), _jsx(ProfileDropdown.Link, { id: "second", onClick: () => alert('second click'), children: "second link" }), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Section, { id: "content", children: "some content" }), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Link, { id: "third", to: "https://google.com", children: "third link" }), _jsx(ProfileDropdown.Divider, {})] }) }));
|
|
14
|
-
export const profileDropdownWithLogo = () => (_jsx(HeaderNavigationStacked, { navigationComponent: NavLinkMock, right: _jsxs(ProfileDropdown, { trigger: {
|
|
15
|
-
imageSrc: 'https://upload.wikimedia.org/wikipedia/en/1/11/Milhouse_Van_Houten.png',
|
|
16
|
-
}, children: [_jsx(ProfileDropdown.Link, { id: "first", to: "https://google.com", children: "first link" }), _jsx(ProfileDropdown.Link, { id: "second", onClick: () => alert('second click'), children: "second link" })] }) }));
|
|
17
|
-
export const profileDropdownWithErrorLogo = () => (_jsx(HeaderNavigationStacked, { right: _jsx(ProfileDropdown, { trigger: {
|
|
18
|
-
imageSrc: 'https://some.incorrect.url/logo.png',
|
|
19
|
-
} }) }));
|
|
20
|
-
export const profileDropdownWithInfo = () => (_jsx(HeaderNavigationStacked, { right: _jsx(ProfileDropdown, { trigger: {
|
|
21
|
-
info: { text: 'first', title: 'tenant user' },
|
|
22
|
-
avatarBadge: true,
|
|
23
|
-
} }) }));
|
|
24
|
-
export const profileDropdownWithCounter = () => (_jsx(HeaderNavigationStacked, { right: _jsx(ProfileDropdown, { trigger: {
|
|
25
|
-
info: { text: 'first', title: 'tenant user' },
|
|
26
|
-
avatarBadge: true,
|
|
27
|
-
badge: { content: 3, className: 'bg-red-500' },
|
|
28
|
-
} }) }));
|
|
29
|
-
export const profileDropdownWithBothBadges = () => (_jsx(HeaderNavigationStacked, { right: _jsx(ProfileDropdown, { trigger: {
|
|
30
|
-
avatarBadge: 'yellow-500',
|
|
31
|
-
badge: { className: 'bg-red-400' },
|
|
32
|
-
} }) }));
|
|
33
|
-
// eslint-disable-next-line no-console
|
|
34
|
-
const log = (text) => console.log(text);
|
|
35
|
-
export const profileDropdownWithHintPopup = () => (_jsx(HeaderNavigationStacked, { navigationComponent: NavLinkMock, right: _jsxs(ProfileDropdown, { trigger: {
|
|
36
|
-
avatarBadge: 'yellow-500',
|
|
37
|
-
badge: { className: 'bg-red-400' },
|
|
38
|
-
}, hintPopup: {
|
|
39
|
-
className: 'bg-blue-500-i c-white',
|
|
40
|
-
content: ({ openProfile }) => (_jsxs("div", { children: ["hello", ' ', _jsx(Button, { onClick: openProfile, size: "xsmall", children: "show me" })] })),
|
|
41
|
-
width: 's',
|
|
42
|
-
onClose: () => log('close profile dropdown hint'),
|
|
43
|
-
}, onOpen: () => log('open profile dropdown'), onClose: () => log('close profile dropdown'), children: [_jsx(ProfileDropdown.Link, { id: "first", to: "https://google.com", children: "first item" }), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Section, { id: "second", children: "second item" })] }) }));
|
|
44
|
-
export const profileDropdownWithHintAndInfoPopup = () => (_jsx(HeaderNavigationStacked, { navigationComponent: NavLinkMock, right: _jsx(ProfileDropdown, { trigger: {
|
|
45
|
-
avatarBadge: 'yellow-500',
|
|
46
|
-
badge: { className: 'bg-red-400' },
|
|
47
|
-
info: { title: 'some text', text: 'qq' },
|
|
48
|
-
}, hintPopup: {
|
|
49
|
-
content: () => _jsx("div", { children: "hello" }),
|
|
50
|
-
} }) }));
|
|
51
13
|
//# sourceMappingURL=profile-dropdown-stacked.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-dropdown-stacked.stories.js","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"profile-dropdown-stacked.stories.js","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown-stacked.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,2BAA2B,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,KAAC,uBAAuB,IAAC,KAAK,EAAE,KAAC,KAAK,KAAG,GAAI,CAAC;AAElG,eAAe;IACX,KAAK,EAAE,mCAAmC;IAC1C,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,2BAA2B,CAAC;CACzE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './profile-dropdown.stories';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("./profile-dropdown").ProfileDropdownType;
|
|
5
|
+
parameters: {};
|
|
6
|
+
decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
//# sourceMappingURL=profile-dropdown-tiny.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-dropdown-tiny.stories.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown-tiny.stories.tsx"],"names":[],"mappings":"AAEA,cAAc,4BAA4B,CAAC;;;;;;;AAO3C,wBAKE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { withAnvil, withMemoryRouter } from '../../test/data.stories';
|
|
3
|
+
import { HeaderNavigationTiny } from '../left-navigation';
|
|
4
|
+
export * from './profile-dropdown.stories';
|
|
5
|
+
import { ProfileDropdown } from './profile-dropdown';
|
|
6
|
+
const withHeaderNavigationTiny = (Story) => (_jsx(HeaderNavigationTiny, { className: "border", right: _jsx(Story, {}) }));
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Navigation/ProfileDropdownTiny',
|
|
9
|
+
component: ProfileDropdown,
|
|
10
|
+
parameters: {},
|
|
11
|
+
decorators: [withMemoryRouter, withAnvil, withHeaderNavigationTiny],
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=profile-dropdown-tiny.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profile-dropdown-tiny.stories.js","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown-tiny.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,wBAAwB,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CAC7C,KAAC,oBAAoB,IAAC,SAAS,EAAC,QAAQ,EAAC,KAAK,EAAE,KAAC,KAAK,KAAG,GAAI,CAChE,CAAC;AAEF,eAAe;IACX,KAAK,EAAE,gCAAgC;IACvC,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,wBAAwB,CAAC;CACtE,CAAC"}
|
|
@@ -14,6 +14,7 @@ export interface ProfileDropdownTriggerProps {
|
|
|
14
14
|
className: string;
|
|
15
15
|
};
|
|
16
16
|
hintArrow?: boolean;
|
|
17
|
+
open: boolean;
|
|
17
18
|
onClick?(e: MouseEvent): void;
|
|
18
19
|
}
|
|
19
20
|
export interface ProfileDropdownSectionPropsStrict {
|
|
@@ -45,7 +46,7 @@ export interface ProfileDropdownPropsStrict {
|
|
|
45
46
|
children?: ReactNode;
|
|
46
47
|
className?: string;
|
|
47
48
|
direction?: PopoverPropsStrict['direction'];
|
|
48
|
-
trigger?: Omit<ProfileDropdownTriggerProps, 'onClick' | 'hintArrow'>;
|
|
49
|
+
trigger?: Omit<ProfileDropdownTriggerProps, 'onClick' | 'open' | 'hintArrow'>;
|
|
49
50
|
hintPopup?: {
|
|
50
51
|
className?: string;
|
|
51
52
|
content: FC<{
|
|
@@ -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":"AAKA,OAAO,EAAqB,kBAAkB,EAAE,MAAM,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BAAsB,CAAC;CAC1C;AAED,eAAO,MAAM,eAAe,EAAE,mBAqFL,CAAC"}
|
|
@@ -10,16 +10,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import {
|
|
13
|
+
import { Icon } from '@servicetitan/anvil2';
|
|
14
|
+
import SvgExpandLess from '@servicetitan/anvil2/assets/icons/material/round/expand_less.svg';
|
|
15
|
+
import SvgExpandMore from '@servicetitan/anvil2/assets/icons/material/round/expand_more.svg';
|
|
16
|
+
import SvgAccountActive from '@servicetitan/anvil2/assets/icons/st/gnav_account_active.svg';
|
|
17
|
+
import SvgAccountInactive from '@servicetitan/anvil2/assets/icons/st/gnav_account_inactive.svg';
|
|
18
|
+
import { BodyText, Popover } from '@servicetitan/design-system';
|
|
14
19
|
import classNames from 'classnames';
|
|
15
|
-
import { useCallback, useEffect, useMemo, useState, } from 'react';
|
|
16
|
-
import {
|
|
20
|
+
import { useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
21
|
+
import { NavigationComponentContext, NavigationLegacyContext, } from '../../utils/navigation-context';
|
|
17
22
|
import { CounterTag } from '../counter-tag';
|
|
18
23
|
import * as Styles from './profile-dropdown.module.less';
|
|
19
24
|
import { ProfileLogo } from './profile-icon';
|
|
20
|
-
const ProfileDropdownTrigger = ({ avatarBadge, badge, className, hintArrow, imageSrc, info, onClick, }) => {
|
|
25
|
+
const ProfileDropdownTrigger = ({ avatarBadge, badge, className, hintArrow, imageSrc, info, onClick, open, }) => {
|
|
21
26
|
const [avatarSource, setAvatarSource] = useState(imageSrc !== null && imageSrc !== void 0 ? imageSrc : '');
|
|
22
27
|
const [avatarSourceError, setAvatarSourceError] = useState(false);
|
|
28
|
+
const isLegacy = useContext(NavigationLegacyContext);
|
|
23
29
|
useEffect(() => {
|
|
24
30
|
const src = imageSrc !== null && imageSrc !== void 0 ? imageSrc : '';
|
|
25
31
|
if (src === avatarSource) {
|
|
@@ -31,7 +37,10 @@ const ProfileDropdownTrigger = ({ avatarBadge, badge, className, hintArrow, imag
|
|
|
31
37
|
const onAvatarError = useCallback(() => {
|
|
32
38
|
setAvatarSourceError(true);
|
|
33
39
|
}, []);
|
|
34
|
-
return (_jsxs("div", { className: classNames('d-f align-items-center cursor-pointer position-relative p-x-1 p-y-half', 'profile-dropdown-trigger', Styles.triggerContainer, {
|
|
40
|
+
return (_jsxs("div", { className: classNames('d-f align-items-center cursor-pointer position-relative p-x-1 p-y-half', 'profile-dropdown-trigger', Styles.triggerContainer, {
|
|
41
|
+
[Styles.triggerContainerHintArrow]: hintArrow,
|
|
42
|
+
[Styles.triggerContainerLegacy]: isLegacy,
|
|
43
|
+
}, className), onClick: onClick, "data-cy": "profile-dropdown-trigger", "data-pendo": "profile-dropdown-trigger", children: [avatarSource && !avatarSourceError ? (_jsx("img", { src: avatarSource, className: classNames(Styles.profileImage, 'profile-dropdown-image'), onError: onAvatarError, alt: "user dropdown menu" })) : isLegacy ? (_jsx(ProfileLogo, {})) : (_jsx(Icon, { size: "large", svg: open ? SvgAccountActive : SvgAccountInactive })), !!info && (_jsxs("div", { className: Styles.info, children: [_jsx(BodyText, { bold: true, title: info.title, className: "t-truncate c-inherit", size: "xsmall", children: info.title }), _jsx(BodyText, { title: info.text, className: "t-truncate c-neutral-70 tt-uppercase", size: "xsmall", children: info.text })] })), _jsx(Icon, { svg: open ? SvgExpandLess : SvgExpandMore, className: classNames('d-f align-items-center c-inherit', { 'm-l-half': isLegacy }), size: "small" }), !!avatarBadge && (_jsx("div", { className: classNames(Styles.avatarBadge, avatarBadge === true ? 'bg-blue-500' : `bg-${avatarBadge}`) })), !!badge && (_jsx("span", { className: classNames(Styles.badge, badge.content ? Styles.badgeWithContent : Styles.badgeNoContent, badge.className), children: badge.content }))] }));
|
|
35
44
|
};
|
|
36
45
|
export const ProfileDropdownSection = (_a) => {
|
|
37
46
|
var { children, className, id, onClick } = _a, rest = __rest(_a, ["children", "className", "id", "onClick"]);
|
|
@@ -48,7 +57,7 @@ export const ProfileDropdownSection = (_a) => {
|
|
|
48
57
|
export const ProfileDropdownDivider = Popover.Divider;
|
|
49
58
|
export const ProfileDropdownLink = (_a) => {
|
|
50
59
|
var { children, className, counter, external, id, target, to, onClick } = _a, rest = __rest(_a, ["children", "className", "counter", "external", "id", "target", "to", "onClick"]);
|
|
51
|
-
const NavigationComponent =
|
|
60
|
+
const NavigationComponent = useContext(NavigationComponentContext);
|
|
52
61
|
const clickHandler = (e) => {
|
|
53
62
|
e.preventDefault();
|
|
54
63
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
@@ -80,7 +89,7 @@ export const ProfileDropdown = (({ children, className, direction, hintPopup, on
|
|
|
80
89
|
}, [open, onOpen, onClose]);
|
|
81
90
|
const hintShown = !!hintPopup && !open;
|
|
82
91
|
const HintComponent = hintPopup === null || hintPopup === void 0 ? void 0 : hintPopup.content;
|
|
83
|
-
const triggerElement = (_jsx(ProfileDropdownTrigger, Object.assign({}, trigger, { onClick: children ? onTriggerClick : undefined, hintArrow: hintShown })));
|
|
92
|
+
const triggerElement = (_jsx(ProfileDropdownTrigger, Object.assign({}, trigger, { onClick: children ? onTriggerClick : undefined, hintArrow: hintShown, open: open })));
|
|
84
93
|
return (_jsx("div", { className: className, "data-cy": "profile-dropdown", children: !!hintPopup && hintShown && HintComponent ? (_jsx(Popover, { direction: direction !== null && direction !== void 0 ? direction : 'bl', width: (_a = hintPopup.width) !== null && _a !== void 0 ? _a : 'xs', trigger: triggerElement, popoverContentClassName: Styles.hint, onClickOutside: hintPopup === null || hintPopup === void 0 ? void 0 : hintPopup.onClose, open: true, children: _jsx("div", { className: classNames(Styles.hintContent, hintPopup.className), children: _jsx(HintComponent, { openProfile: handleOpen }) }) })) : (_jsx(Popover, { direction: direction !== null && direction !== void 0 ? direction : 'bl', width: width !== null && width !== void 0 ? width : 'xs', trigger: triggerElement, open: open, portal: portal, onClickOutside: handleClose, className: Styles.dropdown, popoverContentClassName: classNames(Styles.dropdownContent, Styles.dropdownContentBottomLeft), children: _jsx("div", { className: Styles.dropdownContentWrapper, onClick: handleClose, "data-cy": "profile-dropdown-content", children: children }) })) }));
|
|
85
94
|
});
|
|
86
95
|
ProfileDropdown.Divider = ProfileDropdownDivider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-dropdown.js","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"profile-dropdown.js","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,aAAa,MAAM,kEAAkE,CAAC;AAC7F,OAAO,aAAa,MAAM,kEAAkE,CAAC;AAC7F,OAAO,gBAAgB,MAAM,8DAA8D,CAAC;AAC5F,OAAO,kBAAkB,MAAM,gEAAgE,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAsB,MAAM,6BAA6B,CAAC;AACpF,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAMH,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,GACX,MAAM,OAAO,CAAC;AAEf,OAAO,EACH,0BAA0B,EAC1B,uBAAuB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,UAAU,EAAuB,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,MAAM,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAa7C,MAAM,sBAAsB,GAAoC,CAAC,EAC7D,WAAW,EACX,KAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,IAAI,GACP,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EAAE,MAAA,SAAS,CAAC,KAAK,mCAAI,IAAI,EAC9B,OAAO,EAAE,cAAc,EACvB,uBAAuB,EAAE,MAAM,CAAC,IAAI,EACpC,cAAc,EAAE,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,EAClC,IAAI,kBAEJ,cAAK,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,SAAS,CAAC,SAAS,CAAC,YAC/D,KAAC,aAAa,IAAC,WAAW,EAAE,UAAU,GAAI,GACxC,GACA,CACb,CAAC,CAAC,CAAC,CACA,KAAC,OAAO,IACJ,SAAS,EAAE,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAI,EAC5B,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,EACpB,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,WAAW,EAC3B,SAAS,EAAE,MAAM,CAAC,QAAQ,EAC1B,uBAAuB,EAAE,UAAU,CAC/B,MAAM,CAAC,eAAe,EACtB,MAAM,CAAC,yBAAyB,CACnC,YAED,cACI,SAAS,EAAE,MAAM,CAAC,sBAAsB,EACxC,OAAO,EAAE,WAAW,aACZ,0BAA0B,YAEjC,QAAQ,GACP,GACA,CACb,GACC,CACT,CAAC;AACN,CAAC,CAAwB,CAAC;AAE1B,eAAe,CAAC,OAAO,GAAG,sBAAsB,CAAC;AACjD,eAAe,CAAC,IAAI,GAAG,mBAAmB,CAAC;AAC3C,eAAe,CAAC,OAAO,GAAG,sBAAsB,CAAC"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
.avatar-badge {
|
|
18
18
|
position: absolute;
|
|
19
19
|
top: 8px;
|
|
20
|
-
left:
|
|
20
|
+
left: 4px;
|
|
21
21
|
height: 12px;
|
|
22
22
|
width: 12px;
|
|
23
23
|
border-radius: @border-radius-circular;
|
|
@@ -50,6 +50,12 @@
|
|
|
50
50
|
border-radius: 8px;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
&.trigger-container-legacy {
|
|
54
|
+
.avatar-badge {
|
|
55
|
+
left: 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
53
59
|
&.trigger-container-hint-arrow:first-child:before {
|
|
54
60
|
display: none;
|
|
55
61
|
content: '';
|
|
@@ -2,14 +2,15 @@ declare const _default: {
|
|
|
2
2
|
title: string;
|
|
3
3
|
component: import("./profile-dropdown").ProfileDropdownType;
|
|
4
4
|
parameters: {};
|
|
5
|
+
decorators: ((Story: any) => import("react/jsx-runtime").JSX.Element)[];
|
|
5
6
|
};
|
|
6
7
|
export default _default;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
8
|
+
export declare const ProfileDropdownDefault: () => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const ProfileDropdownWithLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const ProfileDropdownWithErrorLogo: () => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const ProfileDropdownWithInfo: () => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const ProfileDropdownWithCounter: () => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const ProfileDropdownWithBothBadges: () => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const ProfileDropdownWithHintPopup: () => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const ProfileDropdownWithHintAndInfoPopup: () => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
//# sourceMappingURL=profile-dropdown.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-dropdown.stories.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile-dropdown.stories.d.ts","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown.stories.tsx"],"names":[],"mappings":";;;;;;AAWA,wBAKE;AAEF,eAAO,MAAM,sBAAsB,+CAkBlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,+CAanC,CAAC;AAEF,eAAO,MAAM,4BAA4B,+CAMxC,CAAC;AAEF,eAAO,MAAM,uBAAuB,+CAOnC,CAAC;AAEF,eAAO,MAAM,0BAA0B,+CAQtC,CAAC;AAEF,eAAO,MAAM,6BAA6B,+CAOzC,CAAC;AAKF,eAAO,MAAM,4BAA4B,+CA4BxC,CAAC;AAEF,eAAO,MAAM,mCAAmC,+CAW/C,CAAC"}
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '@servicetitan/design-system';
|
|
3
|
+
import { withAnvil, withMemoryRouter } from '../../test/data.stories';
|
|
3
4
|
import { HeaderNavigation } from '../header-navigation';
|
|
4
5
|
import { ProfileDropdown } from './profile-dropdown';
|
|
6
|
+
const withHeaderNavigation = (Story) => (_jsx(HeaderNavigation, { children: _jsx(Story, {}) }));
|
|
5
7
|
export default {
|
|
6
8
|
title: 'Navigation/ProfileDropdown',
|
|
7
9
|
component: ProfileDropdown,
|
|
8
10
|
parameters: {},
|
|
11
|
+
decorators: [withMemoryRouter, withAnvil, withHeaderNavigation],
|
|
9
12
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
avatarBadge: 'yellow-500',
|
|
31
|
-
badge: { className: 'bg-red-400' },
|
|
32
|
-
} }) }));
|
|
13
|
+
export const ProfileDropdownDefault = () => (_jsxs(ProfileDropdown, { children: [_jsx(ProfileDropdown.Link, { id: "first", to: "https://google.com", children: "first link" }), _jsx(ProfileDropdown.Link, { id: "second", onClick: () => alert('second click'), children: "second link" }), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Section, { id: "content", children: "some content" }), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Link, { id: "third", to: "third", children: "third link" }), _jsx(ProfileDropdown.Divider, {})] }));
|
|
14
|
+
export const ProfileDropdownWithLogo = () => (_jsxs(ProfileDropdown, { trigger: {
|
|
15
|
+
imageSrc: 'https://upload.wikimedia.org/wikipedia/en/1/11/Milhouse_Van_Houten.png',
|
|
16
|
+
}, children: [_jsx(ProfileDropdown.Link, { id: "first", to: "https://google.com", children: "first link" }), _jsx(ProfileDropdown.Link, { id: "second", onClick: () => alert('second click'), children: "second link" })] }));
|
|
17
|
+
export const ProfileDropdownWithErrorLogo = () => (_jsx(ProfileDropdown, { trigger: {
|
|
18
|
+
imageSrc: 'https://some.incorrect.url/logo.png',
|
|
19
|
+
} }));
|
|
20
|
+
export const ProfileDropdownWithInfo = () => (_jsx(ProfileDropdown, { trigger: {
|
|
21
|
+
info: { text: 'first', title: 'tenant user' },
|
|
22
|
+
avatarBadge: true,
|
|
23
|
+
} }));
|
|
24
|
+
export const ProfileDropdownWithCounter = () => (_jsx(ProfileDropdown, { trigger: {
|
|
25
|
+
info: { text: 'first', title: 'tenant user' },
|
|
26
|
+
avatarBadge: true,
|
|
27
|
+
badge: { content: 3, className: 'bg-red-500' },
|
|
28
|
+
} }));
|
|
29
|
+
export const ProfileDropdownWithBothBadges = () => (_jsx(ProfileDropdown, { trigger: {
|
|
30
|
+
avatarBadge: 'yellow-500',
|
|
31
|
+
badge: { className: 'bg-red-400' },
|
|
32
|
+
} }));
|
|
33
33
|
// eslint-disable-next-line no-console
|
|
34
34
|
const log = (text) => console.log(text);
|
|
35
|
-
export const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
export const ProfileDropdownWithHintPopup = () => (_jsxs(ProfileDropdown, { trigger: {
|
|
36
|
+
avatarBadge: 'yellow-500',
|
|
37
|
+
badge: { className: 'bg-red-400' },
|
|
38
|
+
}, hintPopup: {
|
|
39
|
+
className: 'bg-blue-500-i c-white',
|
|
40
|
+
content: ({ openProfile }) => (_jsxs("div", { children: ["hello", ' ', _jsx(Button, { onClick: openProfile, size: "xsmall", children: "show me" })] })),
|
|
41
|
+
width: 's',
|
|
42
|
+
onClose: () => log('close profile dropdown hint'),
|
|
43
|
+
}, onOpen: () => log('open profile dropdown'), onClose: () => log('close profile dropdown'), children: [_jsx(ProfileDropdown.Link, { id: "first", to: "https://google.com", children: "first item" }), _jsx(ProfileDropdown.Divider, {}), _jsx(ProfileDropdown.Section, { id: "second", children: "second item" })] }));
|
|
44
|
+
export const ProfileDropdownWithHintAndInfoPopup = () => (_jsx(ProfileDropdown, { trigger: {
|
|
45
|
+
avatarBadge: 'yellow-500',
|
|
46
|
+
badge: { className: 'bg-red-400' },
|
|
47
|
+
info: { title: 'some text', text: 'qq' },
|
|
48
|
+
}, hintPopup: {
|
|
49
|
+
content: () => _jsx("div", { children: "hello" }),
|
|
50
|
+
} }));
|
|
51
51
|
//# sourceMappingURL=profile-dropdown.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-dropdown.stories.js","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"profile-dropdown.stories.js","sourceRoot":"","sources":["../../../src/components/profile-dropdown/profile-dropdown.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,oBAAoB,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,CACzC,KAAC,gBAAgB,cACb,KAAC,KAAK,KAAG,GACM,CACtB,CAAC;AAEF,eAAe;IACX,KAAK,EAAE,4BAA4B;IACnC,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,EAAE;IACd,UAAU,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,oBAAoB,CAAC;CAClE,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,EAAE,CAAC,CACxC,MAAC,eAAe,eACZ,KAAC,eAAe,CAAC,IAAI,IAAC,EAAE,EAAC,OAAO,EAAC,EAAE,EAAC,oBAAoB,2BAEjC,EACvB,KAAC,eAAe,CAAC,IAAI,IAAC,EAAE,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,4BAE/C,EACvB,KAAC,eAAe,CAAC,OAAO,KAAG,EAC3B,KAAC,eAAe,CAAC,OAAO,IAAC,EAAE,EAAC,SAAS,6BAAuC,EAC5E,KAAC,eAAe,CAAC,OAAO,KAAG,EAC3B,KAAC,eAAe,CAAC,OAAO,KAAG,EAC3B,KAAC,eAAe,CAAC,OAAO,KAAG,EAC3B,KAAC,eAAe,CAAC,IAAI,IAAC,EAAE,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,2BAEpB,EACvB,KAAC,eAAe,CAAC,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