@servicetitan/navigation 11.0.0-canary.237.c4efaad.0 → 11.0.0-canary.237.dd4db7e.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.
Files changed (82) hide show
  1. package/dist/components/badge-tag.d.ts +1 -1
  2. package/dist/components/badge-tag.d.ts.map +1 -1
  3. package/dist/components/header-navigation/header-navigation-stacked.stories.js +1 -1
  4. package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
  5. package/dist/components/header-navigation/header-navigation.stories.js +1 -1
  6. package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
  7. package/dist/components/left-navigation/header-navigation-tiny.stories.js +2 -2
  8. package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +1 -1
  9. package/dist/components/logo/logo-titan-text.d.ts +1 -1
  10. package/dist/components/logo/logo-titan-text.d.ts.map +1 -1
  11. package/dist/components/profile-dropdown/profile-dropdown.d.ts +10 -7
  12. package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
  13. package/dist/components/profile-dropdown/profile-dropdown.js +2 -2
  14. package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
  15. package/dist/components/profile-dropdown/profile-dropdown.module.less +2 -0
  16. package/dist/components/titan-layout/layout-header.d.ts +2 -0
  17. package/dist/components/titan-layout/layout-header.d.ts.map +1 -1
  18. package/dist/components/titan-layout/layout-header.js +3 -4
  19. package/dist/components/titan-layout/layout-header.js.map +1 -1
  20. package/dist/components/titan-layout/layout-header.module.less +62 -16
  21. package/dist/components/titan-layout/layout-logo.d.ts.map +1 -1
  22. package/dist/components/titan-layout/layout-logo.js +2 -1
  23. package/dist/components/titan-layout/layout-logo.js.map +1 -1
  24. package/dist/components/titan-layout/layout-profile.d.ts.map +1 -1
  25. package/dist/components/titan-layout/layout-profile.js +32 -8
  26. package/dist/components/titan-layout/layout-profile.js.map +1 -1
  27. package/dist/components/titan-layout/layout-profile.stories.d.ts.map +1 -1
  28. package/dist/components/titan-layout/layout-profile.stories.js +1 -1
  29. package/dist/components/titan-layout/layout-profile.stories.js.map +1 -1
  30. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +2 -2
  31. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -1
  32. package/dist/components/titan-layout/layout-sidebar-links-internal.js +4 -4
  33. package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -1
  34. package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -1
  35. package/dist/components/titan-layout/layout-sidebar-links.js +11 -4
  36. package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -1
  37. package/dist/components/titan-layout/layout-sidebar.d.ts +2 -0
  38. package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -1
  39. package/dist/components/titan-layout/layout-sidebar.js +6 -4
  40. package/dist/components/titan-layout/layout-sidebar.js.map +1 -1
  41. package/dist/components/titan-layout/layout-sidebar.module.less +29 -6
  42. package/dist/components/titan-layout/notifications-context.d.ts +13 -0
  43. package/dist/components/titan-layout/notifications-context.d.ts.map +1 -0
  44. package/dist/components/titan-layout/notifications-context.js +23 -0
  45. package/dist/components/titan-layout/notifications-context.js.map +1 -0
  46. package/dist/components/titan-layout/titan-layout.d.ts +10 -6
  47. package/dist/components/titan-layout/titan-layout.d.ts.map +1 -1
  48. package/dist/components/titan-layout/titan-layout.js +73 -21
  49. package/dist/components/titan-layout/titan-layout.js.map +1 -1
  50. package/dist/components/titan-layout/titan-layout.module.less +53 -20
  51. package/dist/components/titan-layout/titan-layout.stories.d.ts +15 -11
  52. package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -1
  53. package/dist/components/titan-layout/titan-layout.stories.js +35 -14
  54. package/dist/components/titan-layout/titan-layout.stories.js.map +1 -1
  55. package/dist/test/data.d.ts +4 -1
  56. package/dist/test/data.d.ts.map +1 -1
  57. package/dist/test/data.js +2 -3
  58. package/dist/test/data.js.map +1 -1
  59. package/package.json +2 -2
  60. package/src/components/badge-tag.tsx +1 -1
  61. package/src/components/header-navigation/header-navigation-stacked.stories.tsx +1 -1
  62. package/src/components/header-navigation/header-navigation.stories.tsx +1 -1
  63. package/src/components/left-navigation/header-navigation-tiny.stories.tsx +2 -2
  64. package/src/components/logo/logo-titan-text.tsx +1 -1
  65. package/src/components/profile-dropdown/profile-dropdown.module.less +2 -0
  66. package/src/components/profile-dropdown/profile-dropdown.tsx +13 -6
  67. package/src/components/titan-layout/layout-header.module.less +62 -16
  68. package/src/components/titan-layout/layout-header.tsx +12 -5
  69. package/src/components/titan-layout/layout-logo.tsx +13 -6
  70. package/src/components/titan-layout/layout-profile.stories.tsx +10 -1
  71. package/src/components/titan-layout/layout-profile.tsx +60 -25
  72. package/src/components/titan-layout/layout-sidebar-links-internal.tsx +18 -5
  73. package/src/components/titan-layout/layout-sidebar-links.tsx +16 -4
  74. package/src/components/titan-layout/layout-sidebar.module.less +29 -6
  75. package/src/components/titan-layout/layout-sidebar.module.less.d.ts +1 -0
  76. package/src/components/titan-layout/layout-sidebar.tsx +15 -6
  77. package/src/components/titan-layout/notifications-context.tsx +44 -0
  78. package/src/components/titan-layout/titan-layout.module.less +53 -20
  79. package/src/components/titan-layout/titan-layout.module.less.d.ts +3 -0
  80. package/src/components/titan-layout/titan-layout.stories.tsx +166 -19
  81. package/src/components/titan-layout/titan-layout.tsx +193 -77
  82. package/src/test/data.tsx +2 -3
@@ -13,10 +13,12 @@
13
13
  margin-top: var(--nav-offset-top);
14
14
 
15
15
  display: flex;
16
- flex-direction: row;
16
+ flex-direction: column;
17
17
 
18
18
  .side {
19
19
  flex-basis: var(--nav-offset-left);
20
+ flex-grow: 0;
21
+ flex-shrink: 0;
20
22
  }
21
23
 
22
24
  .content {
@@ -28,47 +30,78 @@
28
30
  }
29
31
  }
30
32
 
31
- .layout-legacy,
32
33
  .layout-anvil2 {
34
+ .content-header {
35
+ position: sticky;
36
+ top: var(--nav-offset-top);
37
+ z-index: 989;
38
+ }
39
+ }
40
+
41
+ .layout-desktop {
33
42
  padding-left: var(--nav-offset-left);
34
43
 
35
- .top-placeholder {
36
- height: var(--nav-offset-top);
44
+ .side {
45
+ position: fixed;
46
+ top: var(--nav-offset-top);
47
+ bottom: 0;
48
+ left: 0;
49
+ right: 0;
50
+ z-index: @z-index-global-nav;
37
51
  }
52
+ }
38
53
 
39
- &:not(.layout-mobile) {
40
- .side {
41
- position: fixed;
42
- top: var(--nav-offset-top);
43
- bottom: 0;
44
- left: 0;
45
- right: 0;
46
- z-index: @z-index-global-nav;
47
- }
54
+ .layout-legacy,
55
+ .layout-anvil2 {
56
+ overflow-x: auto;
57
+ .top-placeholder {
58
+ height: var(--nav-offset-top);
48
59
  }
49
60
  }
50
61
 
51
62
  .layout {
52
- --nav-offset-top: 49px;
63
+ --nav-offset-top: 0;
64
+ --nav-offset-left: 0;
65
+
66
+ &.layout-desktop.layout-top {
67
+ --nav-offset-top: 48px;
68
+ }
53
69
 
54
- &.layout-mobile {
55
- --nav-offset-top: 61px;
56
- --nav-offset-left: 0;
70
+ &.layout-mobile.layout-top {
71
+ --nav-offset-top: 72px;
57
72
  }
58
73
 
59
- &.layout-nav-slim {
74
+ &.layout-desktop.layout-nav-slim {
60
75
  --nav-offset-left: 64px;
61
76
  }
62
77
 
63
- &.layout-nav-wide {
78
+ &.layout-desktop.layout-nav-wide {
64
79
  --nav-offset-left: 212px;
65
80
  }
66
81
 
67
82
  .top {
68
83
  position: fixed;
84
+ width: 100vw;
69
85
  top: 0;
70
86
  left: 0;
71
- right: 0;
72
87
  z-index: 991;
73
88
  }
89
+
90
+ .content-header {
91
+ position: sticky;
92
+ left: 0;
93
+ right: 0;
94
+ }
95
+ }
96
+
97
+ @media print {
98
+ .layout {
99
+ --nav-offset-left: 0px !important;
100
+ --nav-offset-right: 0px !important;
101
+
102
+ .side,
103
+ .top {
104
+ display: none !important;
105
+ }
106
+ }
74
107
  }
@@ -1,12 +1,15 @@
1
1
  export const __esModule: true;
2
2
  export const content: string;
3
+ export const contentHeader: string;
3
4
  export const layout: string;
4
5
  export const layoutAnvil1: string;
5
6
  export const layoutAnvil2: string;
7
+ export const layoutDesktop: string;
6
8
  export const layoutLegacy: string;
7
9
  export const layoutMobile: string;
8
10
  export const layoutNavSlim: string;
9
11
  export const layoutNavWide: string;
12
+ export const layoutTop: string;
10
13
  export const side: string;
11
14
  export const top: string;
12
15
  export const topPlaceholder: string;
@@ -1,4 +1,4 @@
1
- import { Page as Anvil2Page, Popover } from '@servicetitan/anvil2';
1
+ import { Announcement, Page as Anvil2Page, Button, Popover, TextField } from '@servicetitan/anvil2';
2
2
  import SvgSearch from '@servicetitan/anvil2/assets/icons/material/round/search.svg';
3
3
  import SvgAtlas from '@servicetitan/anvil2/assets/icons/st/atlas_logo.svg';
4
4
  import SvgSettingsActive from '@servicetitan/anvil2/assets/icons/st/gnav_settings_active.svg';
@@ -20,11 +20,32 @@ import { SideNavigationLinkWrapperProps } from '../left-navigation';
20
20
  import { HeaderNavigationLink, HeaderNavigationTrigger } from '../links';
21
21
  import { ProfileDropdown, TitanLayout, TitanLayoutProps, TitanLayoutState } from './';
22
22
 
23
+ interface LayoutContentArgs {
24
+ header: boolean;
25
+ sideTop: boolean;
26
+ extraText: boolean;
27
+ search: boolean;
28
+ longContent: boolean;
29
+ wideContent: boolean;
30
+ minWidth: boolean;
31
+ emptyNav: boolean;
32
+ }
33
+
23
34
  export default {
24
35
  title: 'Navigation/TitanLayout',
25
- component: TitanLayout,
26
36
  decorators: [withDefaultRedirects, withMemoryRouter, withAnvil],
27
37
  parameters: {},
38
+ argTypes: {},
39
+ args: {
40
+ header: true,
41
+ sideTop: true,
42
+ extraText: true,
43
+ search: true,
44
+ longContent: true,
45
+ wideContent: false,
46
+ minWidth: false,
47
+ emptyNav: false,
48
+ } as LayoutContentArgs,
28
49
  };
29
50
 
30
51
  const mainNavItems = [
@@ -51,6 +72,7 @@ const profile = (
51
72
  to="https://google.com"
52
73
  tooltip="Google it"
53
74
  target="_blank"
75
+ tag={{ value: true }}
54
76
  >
55
77
  first link
56
78
  </ProfileDropdown.Link>
@@ -131,9 +153,9 @@ const SideLinkPopoverWrapper: FC<SideNavigationLinkWrapperProps> = ({ children,
131
153
  };
132
154
 
133
155
  const sidebarTop = () => [
134
- <TitanLayout.SidebarLink key="tasks" {...items.tasks} />,
135
- <TitanLayout.SidebarLink key="calls" {...items.calls} />,
136
- <TitanLayout.SidebarTrigger
156
+ <TitanLayout.Link key="tasks" {...items.tasks} />,
157
+ <TitanLayout.Link key="calls" {...items.calls} />,
158
+ <TitanLayout.Trigger
137
159
  key="marketing"
138
160
  {...items.marketing}
139
161
  isActive={false}
@@ -142,51 +164,176 @@ const sidebarTop = () => [
142
164
  counter={50}
143
165
  />,
144
166
  ];
145
- const useLayoutProps = (): TitanLayoutProps => {
167
+ const ContentHeader = () => {
168
+ const [longInfo, setLongInfo] = useState(false);
169
+
170
+ return (
171
+ <Fragment>
172
+ <Announcement title="Some info" status="info" />
173
+ <Announcement title="Some warning" status="warning" />
174
+ <div
175
+ className="d-f justify-content-center align-items-center bg-purple-100-i"
176
+ style={{ height: longInfo ? '120px' : '48px' }}
177
+ >
178
+ <div className="d-f align-items-center gap-1">
179
+ custom content{' '}
180
+ <Button onClick={() => setLongInfo(!longInfo)} size="small" aria-label="test">
181
+ {longInfo ? '↑' : '↓'}
182
+ </Button>
183
+ </div>
184
+ </div>
185
+ </Fragment>
186
+ );
187
+ };
188
+ const SearchBar = () => (
189
+ <TextField size="small" placeholder="Search" className="w-100-i m-x-half-i" />
190
+ );
191
+
192
+ const useLayoutProps = (args: LayoutContentArgs): TitanLayoutProps => {
146
193
  const [state, setState] = useState<TitanLayoutState | undefined>(undefined);
147
194
 
148
195
  return {
149
196
  state,
150
197
  onStateChange: setState,
151
198
 
152
- navigationMainItems: mainNavItems,
199
+ navigationComponent: NavLinkMock,
200
+ navigationMainItems: args.emptyNav ? [] : mainNavItems,
201
+
153
202
  profile,
203
+ top: args.search ? <SearchBar /> : undefined,
204
+ header: args.header ? <ContentHeader /> : undefined,
205
+
154
206
  extraLinks,
155
207
  extraLinksTop,
208
+ extraText: args.extraText ? 'EST (-8 hrs)' : undefined,
156
209
 
157
- sidebarTop: sidebarTop(),
158
- navigationComponent: NavLinkMock,
159
- extraText: 'EST (-8 hrs)',
210
+ sideTop: args.sideTop && !args.emptyNav ? sidebarTop() : undefined,
211
+
212
+ minContentWidth: args.minWidth ? 900 : undefined,
160
213
  };
161
214
  };
162
215
 
163
- export const TitanLayoutLegacy = () => (
164
- <TitanLayout {...useLayoutProps()} appearance="legacy">
216
+ const Content = (args: LayoutContentArgs) => {
217
+ return (
218
+ <Fragment>
219
+ <LocationInfo className="m-b-3" />
220
+ {args.wideContent && (
221
+ <div style={{ width: '1200px' }}>
222
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
223
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
224
+ nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
225
+ Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
226
+ fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
227
+ culpa qui officia deserunt mollit anim id est laborum.
228
+ </div>
229
+ )}
230
+
231
+ {args.longContent && (
232
+ <div>
233
+ <p>Lorem</p>
234
+ <p>ipsum</p>
235
+ <p>dolor</p>
236
+ <p>sit</p>
237
+ <p>amet,</p>
238
+ <p>consectetur</p>
239
+ <p>adipiscing</p>
240
+ <p>elit,</p>
241
+ <p>sed</p>
242
+ <p>do</p>
243
+ <p>eiusmod</p>
244
+ <p>tempor</p>
245
+ <p>incididunt</p>
246
+ <p>ut</p>
247
+ <p>labore</p>
248
+ <p>et</p>
249
+ <p>dolore</p>
250
+ <p>magna</p>
251
+ <p>aliqua.</p>
252
+ <p>Ut</p>
253
+ <p>enim</p>
254
+ <p>ad</p>
255
+ <p>minim</p>
256
+ <p>veniam,</p>
257
+ <p>quis</p>
258
+ <p>nostrud</p>
259
+ <p>exercitation</p>
260
+ <p>ullamco</p>
261
+ <p>laboris</p>
262
+ <p>nisi</p>
263
+ <p>ut</p>
264
+ <p>aliquip</p>
265
+ <p>ex</p>
266
+ <p>ea</p>
267
+ <p>commodo</p>
268
+ <p>consequat.</p>
269
+ <p>Duis</p>
270
+ <p>aute</p>
271
+ <p>irure</p>
272
+ <p>dolor</p>
273
+ <p>in</p>
274
+ <p>reprehenderit</p>
275
+ <p>in</p>
276
+ <p>voluptate</p>
277
+ <p>velit</p>
278
+ <p>esse</p>
279
+ <p>cillum</p>
280
+ <p>dolore</p>
281
+ <p>eu</p>
282
+ <p>fugiat</p>
283
+ <p>nulla</p>
284
+ <p>pariatur.</p>
285
+ <p>Excepteur</p>
286
+ <p>sint</p>
287
+ <p>occaecat</p>
288
+ <p>cupidatat</p>
289
+ <p>non</p>
290
+ <p>proident,</p>
291
+ <p>sunt</p>
292
+ <p>in</p>
293
+ <p>culpa</p>
294
+ <p>qui</p>
295
+ <p>officia</p>
296
+ <p>deserunt</p>
297
+ <p>mollit</p>
298
+ <p>anim</p>
299
+ <p>id</p>
300
+ <p>est</p>
301
+ <p>laborum.</p>
302
+ </div>
303
+ )}
304
+ </Fragment>
305
+ );
306
+ };
307
+
308
+ export const TitanLayoutLegacy = (args: LayoutContentArgs) => (
309
+ <TitanLayout {...useLayoutProps(args)} appearance="legacy">
165
310
  <TitanLayout.Logo title />
166
311
  <TitanLayout.Content>
167
- <LocationInfo />
312
+ <div className="p-3">
313
+ <Content {...args} />
314
+ </div>
168
315
  </TitanLayout.Content>
169
316
  </TitanLayout>
170
317
  );
171
318
 
172
- export const TitanLayoutAnvil1 = () => (
173
- <TitanLayout {...useLayoutProps()} appearance="anvil1">
319
+ export const TitanLayoutAnvil1 = (args: LayoutContentArgs) => (
320
+ <TitanLayout {...useLayoutProps(args)} appearance="anvil1">
174
321
  <TitanLayout.Logo title />
175
322
  <TitanLayout.Content>
176
323
  <Anvil1Page>
177
- <LocationInfo />
324
+ <Content {...args} />
178
325
  </Anvil1Page>
179
326
  </TitanLayout.Content>
180
327
  </TitanLayout>
181
328
  );
182
329
 
183
- export const TitanLayoutAnvil2 = () => (
184
- <TitanLayout {...useLayoutProps()} appearance="anvil2">
330
+ export const TitanLayoutAnvil2 = (args: LayoutContentArgs) => (
331
+ <TitanLayout {...useLayoutProps(args)} appearance="anvil2">
185
332
  <TitanLayout.Logo title />
186
333
  <TitanLayout.Content>
187
334
  <Anvil2Page>
188
335
  <Anvil2Page.Content>
189
- <LocationInfo />
336
+ <Content {...args} />
190
337
  </Anvil2Page.Content>
191
338
  </Anvil2Page>
192
339
  </TitanLayout.Content>