@servicetitan/navigation 10.7.0 → 11.0.0-canary.237.4786284.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 (149) hide show
  1. package/dist/components/header-navigation/header-navigation-extra.stories.d.ts.map +1 -1
  2. package/dist/components/header-navigation/header-navigation-extra.stories.js +5 -5
  3. package/dist/components/header-navigation/header-navigation-extra.stories.js.map +1 -1
  4. package/dist/components/header-navigation/header-navigation-links.d.ts.map +1 -1
  5. package/dist/components/header-navigation/header-navigation-links.js +2 -2
  6. package/dist/components/header-navigation/header-navigation-links.js.map +1 -1
  7. package/dist/components/header-navigation/header-navigation-stacked.stories.d.ts.map +1 -1
  8. package/dist/components/header-navigation/header-navigation-stacked.stories.js +1 -1
  9. package/dist/components/header-navigation/header-navigation-stacked.stories.js.map +1 -1
  10. package/dist/components/header-navigation/header-navigation.stories.d.ts.map +1 -1
  11. package/dist/components/header-navigation/header-navigation.stories.js +2 -2
  12. package/dist/components/header-navigation/header-navigation.stories.js.map +1 -1
  13. package/dist/components/header-navigation/with-tooltip.d.ts +1 -1
  14. package/dist/components/header-navigation/with-tooltip.d.ts.map +1 -1
  15. package/dist/components/left-navigation/header-navigation-tiny.stories.d.ts.map +1 -1
  16. package/dist/components/left-navigation/header-navigation-tiny.stories.js +2 -2
  17. package/dist/components/left-navigation/header-navigation-tiny.stories.js.map +1 -1
  18. package/dist/components/links.d.ts.map +1 -1
  19. package/dist/components/links.js +7 -7
  20. package/dist/components/links.js.map +1 -1
  21. package/dist/components/logo/logo-company-title.d.ts +1 -0
  22. package/dist/components/logo/logo-company-title.d.ts.map +1 -1
  23. package/dist/components/logo/logo-company-title.js +2 -2
  24. package/dist/components/logo/logo-company-title.js.map +1 -1
  25. package/dist/components/profile-dropdown/profile-dropdown.d.ts +15 -9
  26. package/dist/components/profile-dropdown/profile-dropdown.d.ts.map +1 -1
  27. package/dist/components/profile-dropdown/profile-dropdown.js +7 -8
  28. package/dist/components/profile-dropdown/profile-dropdown.js.map +1 -1
  29. package/dist/components/profile-dropdown/profile-dropdown.module.less +4 -0
  30. package/dist/components/profile-dropdown/profile-dropdown.stories.js +2 -2
  31. package/dist/components/profile-dropdown/profile-dropdown.stories.js.map +1 -1
  32. package/dist/components/titan-layout/index.d.ts +6 -0
  33. package/dist/components/titan-layout/index.d.ts.map +1 -0
  34. package/dist/components/titan-layout/index.js +6 -0
  35. package/dist/components/titan-layout/index.js.map +1 -0
  36. package/dist/components/titan-layout/interface-internal.d.ts +6 -0
  37. package/dist/components/titan-layout/interface-internal.d.ts.map +1 -0
  38. package/dist/components/titan-layout/interface-internal.js +2 -0
  39. package/dist/components/titan-layout/interface-internal.js.map +1 -0
  40. package/dist/components/titan-layout/interface.d.ts +21 -0
  41. package/dist/components/titan-layout/interface.d.ts.map +1 -0
  42. package/dist/components/titan-layout/interface.js +2 -0
  43. package/dist/components/titan-layout/interface.js.map +1 -0
  44. package/dist/components/titan-layout/layout-context.d.ts +20 -0
  45. package/dist/components/titan-layout/layout-context.d.ts.map +1 -0
  46. package/dist/components/titan-layout/layout-context.js +12 -0
  47. package/dist/components/titan-layout/layout-context.js.map +1 -0
  48. package/dist/components/titan-layout/layout-header-links.d.ts +7 -0
  49. package/dist/components/titan-layout/layout-header-links.d.ts.map +1 -0
  50. package/dist/components/titan-layout/layout-header-links.js +32 -0
  51. package/dist/components/titan-layout/layout-header-links.js.map +1 -0
  52. package/dist/components/titan-layout/layout-header.d.ts +20 -0
  53. package/dist/components/titan-layout/layout-header.d.ts.map +1 -0
  54. package/dist/components/titan-layout/layout-header.js +11 -0
  55. package/dist/components/titan-layout/layout-header.js.map +1 -0
  56. package/dist/components/titan-layout/layout-header.module.less +174 -0
  57. package/dist/components/titan-layout/layout-logo.d.ts +12 -0
  58. package/dist/components/titan-layout/layout-logo.d.ts.map +1 -0
  59. package/dist/components/titan-layout/layout-logo.js +15 -0
  60. package/dist/components/titan-layout/layout-logo.js.map +1 -0
  61. package/dist/components/titan-layout/layout-logo.stories.d.ts +13 -0
  62. package/dist/components/titan-layout/layout-logo.stories.d.ts.map +1 -0
  63. package/dist/components/titan-layout/layout-logo.stories.js +17 -0
  64. package/dist/components/titan-layout/layout-logo.stories.js.map +1 -0
  65. package/dist/components/titan-layout/layout-profile.d.ts +9 -0
  66. package/dist/components/titan-layout/layout-profile.d.ts.map +1 -0
  67. package/dist/components/titan-layout/layout-profile.js +54 -0
  68. package/dist/components/titan-layout/layout-profile.js.map +1 -0
  69. package/dist/components/titan-layout/layout-profile.stories.d.ts +13 -0
  70. package/dist/components/titan-layout/layout-profile.stories.d.ts.map +1 -0
  71. package/dist/components/titan-layout/layout-profile.stories.js +13 -0
  72. package/dist/components/titan-layout/layout-profile.stories.js.map +1 -0
  73. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts +46 -0
  74. package/dist/components/titan-layout/layout-sidebar-links-internal.d.ts.map +1 -0
  75. package/dist/components/titan-layout/layout-sidebar-links-internal.js +61 -0
  76. package/dist/components/titan-layout/layout-sidebar-links-internal.js.map +1 -0
  77. package/dist/components/titan-layout/layout-sidebar-links.d.ts +6 -0
  78. package/dist/components/titan-layout/layout-sidebar-links.d.ts.map +1 -0
  79. package/dist/components/titan-layout/layout-sidebar-links.js +21 -0
  80. package/dist/components/titan-layout/layout-sidebar-links.js.map +1 -0
  81. package/dist/components/titan-layout/layout-sidebar.d.ts +17 -0
  82. package/dist/components/titan-layout/layout-sidebar.d.ts.map +1 -0
  83. package/dist/components/titan-layout/layout-sidebar.js +65 -0
  84. package/dist/components/titan-layout/layout-sidebar.js.map +1 -0
  85. package/dist/components/titan-layout/layout-sidebar.module.less +516 -0
  86. package/dist/components/titan-layout/titan-layout.d.ts +38 -0
  87. package/dist/components/titan-layout/titan-layout.d.ts.map +1 -0
  88. package/dist/components/titan-layout/titan-layout.js +143 -0
  89. package/dist/components/titan-layout/titan-layout.js.map +1 -0
  90. package/dist/components/titan-layout/titan-layout.module.less +116 -0
  91. package/dist/components/titan-layout/titan-layout.stories.d.ts +20 -0
  92. package/dist/components/titan-layout/titan-layout.stories.d.ts.map +1 -0
  93. package/dist/components/titan-layout/titan-layout.stories.js +80 -0
  94. package/dist/components/titan-layout/titan-layout.stories.js.map +1 -0
  95. package/dist/components/titan-layout/with-tooltip.d.ts +4 -0
  96. package/dist/components/titan-layout/with-tooltip.d.ts.map +1 -0
  97. package/dist/components/titan-layout/with-tooltip.js +4 -0
  98. package/dist/components/titan-layout/with-tooltip.js.map +1 -0
  99. package/dist/index.d.ts +2 -1
  100. package/dist/index.d.ts.map +1 -1
  101. package/dist/index.js +2 -1
  102. package/dist/index.js.map +1 -1
  103. package/dist/test/data.d.ts.map +1 -1
  104. package/dist/test/data.js +3 -3
  105. package/dist/test/data.js.map +1 -1
  106. package/dist/utils/navigation-legacy.d.ts +3 -1
  107. package/dist/utils/navigation-legacy.d.ts.map +1 -1
  108. package/dist/utils/use-breakpoint.d.ts +7 -0
  109. package/dist/utils/use-breakpoint.d.ts.map +1 -0
  110. package/dist/utils/use-breakpoint.js +13 -0
  111. package/dist/utils/use-breakpoint.js.map +1 -0
  112. package/package.json +5 -6
  113. package/src/components/header-navigation/header-navigation-extra.stories.tsx +7 -0
  114. package/src/components/header-navigation/header-navigation-links.tsx +2 -0
  115. package/src/components/header-navigation/header-navigation-stacked.stories.tsx +5 -1
  116. package/src/components/header-navigation/header-navigation.stories.tsx +6 -1
  117. package/src/components/left-navigation/header-navigation-tiny.stories.tsx +8 -2
  118. package/src/components/left-navigation/side-navigation-links.tsx +1 -1
  119. package/src/components/links.tsx +33 -13
  120. package/src/components/logo/logo-company-title.tsx +8 -6
  121. package/src/components/profile-dropdown/profile-dropdown.module.less +4 -0
  122. package/src/components/profile-dropdown/profile-dropdown.stories.tsx +4 -4
  123. package/src/components/profile-dropdown/profile-dropdown.tsx +55 -51
  124. package/src/components/titan-layout/index.ts +5 -0
  125. package/src/components/titan-layout/interface-internal.ts +6 -0
  126. package/src/components/titan-layout/interface.ts +26 -0
  127. package/src/components/titan-layout/layout-context.tsx +30 -0
  128. package/src/components/titan-layout/layout-header-links.tsx +144 -0
  129. package/src/components/titan-layout/layout-header.module.less +174 -0
  130. package/src/components/titan-layout/layout-header.module.less.d.ts +16 -0
  131. package/src/components/titan-layout/layout-header.tsx +90 -0
  132. package/src/components/titan-layout/layout-logo.stories.tsx +31 -0
  133. package/src/components/titan-layout/layout-logo.tsx +57 -0
  134. package/src/components/titan-layout/layout-profile.stories.tsx +46 -0
  135. package/src/components/titan-layout/layout-profile.tsx +132 -0
  136. package/src/components/titan-layout/layout-sidebar-links-internal.tsx +275 -0
  137. package/src/components/titan-layout/layout-sidebar-links.tsx +59 -0
  138. package/src/components/titan-layout/layout-sidebar.module.less +516 -0
  139. package/src/components/titan-layout/layout-sidebar.module.less.d.ts +48 -0
  140. package/src/components/titan-layout/layout-sidebar.tsx +295 -0
  141. package/src/components/titan-layout/titan-layout.module.less +116 -0
  142. package/src/components/titan-layout/titan-layout.module.less.d.ts +16 -0
  143. package/src/components/titan-layout/titan-layout.stories.tsx +332 -0
  144. package/src/components/titan-layout/titan-layout.tsx +355 -0
  145. package/src/components/titan-layout/with-tooltip.tsx +16 -0
  146. package/src/index.ts +2 -1
  147. package/src/test/data.tsx +3 -2
  148. package/src/utils/navigation-legacy.ts +3 -1
  149. package/src/utils/use-breakpoint.ts +19 -0
@@ -0,0 +1,516 @@
1
+ /* stylelint-disable no-descending-specificity */
2
+ @import (reference) '@servicetitan/tokens/core/tokens.less';
3
+
4
+ @text-color: var(--colorsTextInverted, @color-white);
5
+ @text-color-active: var(--colorsTextPrimarySubdued, @color-blue-300);
6
+ @border-color: var(--colorsTextOnGrey, @color-neutral-200);
7
+ @bg-color: #0f1d26;
8
+ @bg-color-hover: rgba(255, 255, 255, 0.08);
9
+ @bg-color-active: rgba(120, 187, 250, 0.2);
10
+
11
+ .nav {
12
+ background-color: @bg-color;
13
+ display: flex;
14
+ flex-direction: column;
15
+ align-items: stretch;
16
+ }
17
+
18
+ // mobile version
19
+ .nav-drawer {
20
+ display: none;
21
+ position: fixed;
22
+ max-width: 400px;
23
+ width: 0;
24
+ top: 0;
25
+ bottom: 0;
26
+ left: 0;
27
+ z-index: 991;
28
+
29
+ .nav-main {
30
+ padding-left: @spacing-2;
31
+ padding-right: @spacing-2;
32
+ }
33
+ .nav-close-wrapper {
34
+ display: flex;
35
+ justify-content: flex-end;
36
+ margin-right: -@spacing-2;
37
+
38
+ .nav-close {
39
+ padding-top: @spacing-2;
40
+ padding-left: @spacing-2;
41
+ padding-right: @spacing-2;
42
+ }
43
+ }
44
+
45
+ .nav-item {
46
+ margin-bottom: @spacing-half;
47
+ }
48
+ .nav-top {
49
+ margin-bottom: @spacing-half;
50
+ }
51
+ .nav-bottom {
52
+ .divider {
53
+ margin-bottom: @spacing-half;
54
+ }
55
+ }
56
+
57
+ .submenu {
58
+ .submenu-item {
59
+ margin-bottom: @spacing-half;
60
+ }
61
+ }
62
+ }
63
+
64
+ // mobile version opened
65
+ .nav-drawer-opened {
66
+ display: flex;
67
+ width: 90vw;
68
+ }
69
+
70
+ @media only screen and (min-width: 361px) {
71
+ width: 85vw;
72
+ }
73
+ @media only screen and (min-width: 481px) {
74
+ width: 80vw;
75
+ }
76
+
77
+ // desktop version collapsed
78
+ .nav-slim {
79
+ width: 64px;
80
+
81
+ .toggle {
82
+ width: 64px;
83
+ margin-top: @spacing-1;
84
+ margin-bottom: 12px;
85
+ display: flex;
86
+ justify-content: center;
87
+
88
+ .toggle-icon-wrapper {
89
+ padding-left: @spacing-half;
90
+ padding-right: @spacing-half;
91
+ }
92
+ }
93
+
94
+ .nav-item {
95
+ flex-direction: column;
96
+ width: 64px;
97
+ overflow-x: hidden;
98
+ padding-top: @spacing-1;
99
+
100
+ &:not(:first-child) {
101
+ margin-top: @spacing-half;
102
+ }
103
+
104
+ .nav-item-counter[data-anv][data-anv] {
105
+ position: absolute;
106
+ right: 0;
107
+ top: 4px;
108
+ z-index: auto;
109
+
110
+ &.nav-item-counter-long {
111
+ right: 2px;
112
+ }
113
+ }
114
+
115
+ .nav-item-icon-wrapper {
116
+ flex: 1;
117
+ padding: @spacing-half;
118
+ }
119
+
120
+ .nav-item-text-expanded {
121
+ display: none;
122
+ }
123
+ .nav-item-text-collapsed {
124
+ font-family: @base-font-family;
125
+ font-size: 11px;
126
+ line-height: 11px;
127
+ margin: 2px @spacing-half @spacing-0;
128
+ text-align: center;
129
+ }
130
+
131
+ .nav-item-text-collapsed.nav-item-text-small {
132
+ font-size: 10.5px;
133
+ }
134
+ }
135
+
136
+ .nav-top .divider {
137
+ margin-top: @spacing-1;
138
+ }
139
+ }
140
+
141
+ // desktop version expanded
142
+ .nav-wide {
143
+ width: var(--nav-offset-left);
144
+
145
+ .toggle {
146
+ .toggle-content {
147
+ margin: @spacing-2;
148
+
149
+ .toggle-icon-wrapper {
150
+ padding-left: @spacing-half;
151
+ padding-right: @spacing-half;
152
+ }
153
+
154
+ .toggle-text {
155
+ padding-left: @spacing-0 !important;
156
+ }
157
+ }
158
+ }
159
+
160
+ .nav-top .divider {
161
+ margin-top: @spacing-1;
162
+ margin-bottom: @spacing-1;
163
+ }
164
+
165
+ .nav-main {
166
+ padding-top: @spacing-1;
167
+ }
168
+ }
169
+
170
+ .nav-drawer,
171
+ .nav-wide {
172
+ .nav-item {
173
+ flex-direction: row;
174
+ margin-left: @spacing-1;
175
+ margin-right: @spacing-1;
176
+
177
+ .nav-item-icon-wrapper {
178
+ flex: 1;
179
+ padding: @spacing-1 @spacing-half;
180
+ }
181
+
182
+ .nav-item-text-expanded {
183
+ font-family: @base-font-family;
184
+ font-size: @typescale-3;
185
+ padding-left: @spacing-1;
186
+ flex: 1;
187
+ }
188
+
189
+ .nav-item-text-collapsed {
190
+ display: none;
191
+ }
192
+
193
+ .nav-item-counter[data-anv][data-anv] {
194
+ margin-right: @spacing-1;
195
+ position: relative;
196
+ transform: unset;
197
+ }
198
+ }
199
+ }
200
+ .divider {
201
+ border-top: 1px solid @border-color;
202
+ }
203
+
204
+ .nav-main {
205
+ position: relative;
206
+ overflow-y: auto;
207
+ padding-bottom: @spacing-1;
208
+ flex-grow: 1;
209
+ flex-basis: 0;
210
+
211
+ &::-webkit-scrollbar {
212
+ width: 0;
213
+ height: 0;
214
+ }
215
+ }
216
+
217
+ .nav-top {
218
+ display: flex;
219
+ flex-direction: column;
220
+ align-items: stretch;
221
+ }
222
+
223
+ .nav-bottom {
224
+ display: flex;
225
+ flex-direction: column;
226
+ }
227
+
228
+ .nav-footer {
229
+ display: flex;
230
+ flex-direction: column;
231
+ align-items: stretch;
232
+ background-color: @bg-color;
233
+
234
+ .toggle-wrapper {
235
+ display: block;
236
+
237
+ .toggle {
238
+ font-family: @base-font-family;
239
+ color: @text-color;
240
+ position: relative;
241
+ cursor: pointer;
242
+ outline: none;
243
+
244
+ &:hover {
245
+ .toggle-content {
246
+ background-color: @bg-color-hover;
247
+ }
248
+ }
249
+
250
+ .toggle-content {
251
+ display: flex;
252
+ justify-content: flex-start;
253
+ align-items: center;
254
+ flex-wrap: nowrap;
255
+ text-wrap: nowrap;
256
+ height: 32px;
257
+
258
+ border-radius: @border-radius-2;
259
+ }
260
+
261
+ .toggle-icon-wrapper {
262
+ height: 24px;
263
+ width: 24px;
264
+
265
+ .toggle-icon[data-anv][data-anv] > svg {
266
+ height: 24px;
267
+ width: 24px;
268
+ color: @text-color;
269
+ }
270
+ }
271
+
272
+ .toggle-text {
273
+ font-family: @base-font-family;
274
+ font-size: @typescale-3;
275
+ flex: 1;
276
+ }
277
+ }
278
+ }
279
+ }
280
+
281
+ .nav-item {
282
+ font-family: @base-font-family;
283
+ color: @text-color;
284
+ position: relative;
285
+ display: flex;
286
+ flex-direction: row;
287
+ justify-content: flex-start;
288
+ align-items: center;
289
+ outline: none;
290
+ overflow: hidden;
291
+
292
+ .nav-item-icon-wrapper {
293
+ border-radius: @border-radius-2;
294
+ display: flex;
295
+ justify-content: flex-start;
296
+ align-items: center;
297
+ flex-wrap: nowrap;
298
+ text-wrap: nowrap;
299
+ position: relative;
300
+ }
301
+
302
+ &.nav-item-active {
303
+ color: @text-color-active;
304
+
305
+ .nav-item-icon-wrapper {
306
+ background-color: @bg-color-active;
307
+ }
308
+ }
309
+
310
+ &.nav-item-icon-switch {
311
+ &.nav-item-active {
312
+ .nav-icon-inactive[data-anv][data-anv] {
313
+ display: none;
314
+ }
315
+ .nav-icon-active[data-anv][data-anv] {
316
+ display: block;
317
+ }
318
+ }
319
+ &:not(.nav-item-active) {
320
+ .nav-icon-inactive[data-anv][data-anv] {
321
+ display: block;
322
+ }
323
+ .nav-icon-active[data-anv][data-anv] {
324
+ display: none;
325
+ }
326
+ }
327
+ }
328
+
329
+ .nav-item-counter {
330
+ min-width: 12px !important;
331
+ min-height: 12px !important;
332
+ }
333
+
334
+ .nav-item-group-toggle-wrapper {
335
+ position: relative;
336
+ display: flex;
337
+ justify-content: center;
338
+ align-items: center;
339
+
340
+ .nav-item-group-toggle[data-anv][data-anv] {
341
+ color: inherit;
342
+ font-weight: @font-weight-semibold;
343
+ }
344
+
345
+ .nav-item-group-toggle-click {
346
+ position: absolute;
347
+ left: -@spacing-2;
348
+ right: -@spacing-half;
349
+ top: -@spacing-1;
350
+ bottom: -@spacing-1;
351
+ }
352
+ }
353
+
354
+ .nav-icon[data-anv][data-anv] {
355
+ height: 24px;
356
+ width: 24px;
357
+ color: inherit;
358
+
359
+ & > svg {
360
+ height: 24px;
361
+ width: 24px;
362
+ }
363
+ }
364
+ }
365
+
366
+ .nav-link {
367
+ cursor: pointer;
368
+
369
+ &:hover:not(.nav-item-active) .nav-item-icon-wrapper {
370
+ background-color: @bg-color-hover;
371
+ }
372
+ }
373
+ .nav-group-wrapper {
374
+ .nav-group-item {
375
+ position: relative;
376
+ }
377
+
378
+ .submenu-wrapper:not(.submenu-wrapper-collapsed) {
379
+ max-height: 2000px;
380
+ transition: max-height 0.7s ease-in-out;
381
+ }
382
+ }
383
+
384
+ .submenu-wrapper {
385
+ max-height: 0;
386
+ overflow: hidden;
387
+ transition: max-height unset;
388
+ }
389
+
390
+ .submenu {
391
+ margin-left: @spacing-3;
392
+
393
+ padding-left: @spacing-1;
394
+ padding-right: @spacing-1;
395
+ margin-bottom: @spacing-1;
396
+ position: relative;
397
+ font-family: @base-font-family;
398
+
399
+ .submenu-group-header[data-anv][data-anv] {
400
+ padding-top: @spacing-2;
401
+ padding-bottom: @spacing-half;
402
+ }
403
+ .submenu-group-header.submenu-group-header-empty[data-anv][data-anv] {
404
+ padding-top: @spacing-1;
405
+ }
406
+
407
+ .submenu-item {
408
+ padding: @spacing-1;
409
+ }
410
+
411
+ .submenu-link-active {
412
+ position: relative;
413
+ }
414
+
415
+ .submenu-link-active:before {
416
+ content: '';
417
+ position: absolute;
418
+ background-color: @text-color-active;
419
+ width: 3px;
420
+ top: @spacing-1;
421
+ bottom: @spacing-1;
422
+ left: -12px;
423
+ }
424
+
425
+ .submenu-item:before:not(.submenu-link-active) {
426
+ background-color: @bg-color-hover;
427
+ }
428
+
429
+ .divider + .divider {
430
+ display: none;
431
+ }
432
+
433
+ .divider:last-child {
434
+ display: none;
435
+ }
436
+
437
+ > *,
438
+ > *[data-anv][data-anv] {
439
+ border-left: 3px solid transparent;
440
+ padding-left: @spacing-1;
441
+ }
442
+
443
+ > *:last-child {
444
+ margin-bottom: @spacing-0;
445
+ }
446
+ }
447
+
448
+ .submenu-popover {
449
+ margin-left: -@spacing-1;
450
+ margin-right: -@spacing-1;
451
+ min-width: 240px;
452
+
453
+ .submenu-group-header[data-anv][data-anv] {
454
+ margin-top: @spacing-2;
455
+ padding-bottom: @spacing-half;
456
+ }
457
+
458
+ .submenu-group-header.submenu-group-header-empty[data-anv][data-anv] {
459
+ margin-top: @spacing-1;
460
+ }
461
+
462
+ .submenu-item {
463
+ padding-top: @spacing-1;
464
+ padding-bottom: @spacing-1;
465
+ }
466
+
467
+ .submenu-link-active {
468
+ background-color: @bg-color-active;
469
+ }
470
+ .submenu-link:hover:not(.submenu-link-active) {
471
+ background-color: @bg-color-hover;
472
+ }
473
+
474
+ > *,
475
+ > *[data-anv][data-anv] {
476
+ padding-left: @spacing-1;
477
+ padding-right: @spacing-1;
478
+ }
479
+ }
480
+
481
+ .submenu,
482
+ .submenu-popover {
483
+ display: flex;
484
+ flex-direction: column;
485
+
486
+ .submenu-group-header[data-anv][data-anv] {
487
+ color: @color-neutral-70;
488
+ }
489
+
490
+ .submenu-item {
491
+ color: @text-color;
492
+ font-size: @typescale-2;
493
+ border-radius: @border-radius-2;
494
+ display: flex;
495
+ flex-direction: row;
496
+ justify-content: space-between;
497
+ align-items: center;
498
+ }
499
+
500
+ .submenu-link {
501
+ cursor: pointer;
502
+ }
503
+
504
+ .submenu-link-active {
505
+ color: @text-color-active;
506
+ }
507
+
508
+ .submenu-link-counter {
509
+ position: relative !important;
510
+ transform: unset !important;
511
+ }
512
+
513
+ .submenu-link:hover:not(.submenu-link-active) {
514
+ background-color: @bg-color-hover;
515
+ }
516
+ }
@@ -0,0 +1,38 @@
1
+ import { ComponentPropsWithoutRef, FC, ReactElement, ReactNode } from 'react';
2
+ import { NavigationItemData } from '../../utils/navigation';
3
+ import { NavLinkComponentProps } from '../../utils/navigation-context';
4
+ import { TitanLayoutState } from './interface';
5
+ import { TitanLayoutLogoProps } from './layout-logo';
6
+ import { TitanLayoutSidebarLink, TitanLayoutSidebarTrigger } from './layout-sidebar-links';
7
+ type TitanLayoutChild = ReactElement<TitanLayoutContentProps> | ReactElement<TitanLayoutLogoProps>;
8
+ export type TitanLayoutProps = Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'style'> & {
9
+ empty?: boolean;
10
+ appearance?: 'legacy' | 'anvil1' | 'anvil2';
11
+ /** component used for navigation */
12
+ navigationComponent?: FC<NavLinkComponentProps>;
13
+ /** data for main navigation links */
14
+ navigationMainItems?: NavigationItemData[];
15
+ /** layout's content */
16
+ children?: TitanLayoutChild | TitanLayoutChild[];
17
+ state?: TitanLayoutState;
18
+ onStateChange?: (state: TitanLayoutState) => void;
19
+ header?: ReactElement;
20
+ top?: ReactElement;
21
+ sideTop?: ReactElement[];
22
+ profile?: ReactElement;
23
+ extraLinks?: ReactElement;
24
+ extraLinksTop?: ReactElement;
25
+ extraText?: string;
26
+ minContentWidth?: number;
27
+ };
28
+ export interface TitanLayoutContentProps {
29
+ children: ReactNode;
30
+ }
31
+ export declare const TitanLayout: FC<TitanLayoutProps> & {
32
+ Content: FC<TitanLayoutContentProps>;
33
+ Logo: FC<TitanLayoutLogoProps>;
34
+ Link: typeof TitanLayoutSidebarLink;
35
+ Trigger: typeof TitanLayoutSidebarTrigger;
36
+ };
37
+ export {};
38
+ //# sourceMappingURL=titan-layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"titan-layout.d.ts","sourceRoot":"","sources":["../../../src/components/titan-layout/titan-layout.tsx"],"names":[],"mappings":"AACA,OAAO,EAGH,wBAAwB,EACxB,EAAE,EAEF,YAAY,EACZ,SAAS,EAOZ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAA2B,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAQ/C,OAAO,EAAmB,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAI3F,KAAK,gBAAgB,GAAG,YAAY,CAAC,uBAAuB,CAAC,GAAG,YAAY,CAAC,oBAAoB,CAAC,CAAC;AAEnG,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IACzF,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAE5C,oCAAoC;IACpC,mBAAmB,CAAC,EAAE,EAAE,CAAC,qBAAqB,CAAC,CAAC;IAEhD,qCAAqC;IACrC,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAE3C,uBAAuB;IACvB,QAAQ,CAAC,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAAC;IAEjD,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAElD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAyPF,MAAM,WAAW,uBAAuB;IACpC,QAAQ,EAAE,SAAS,CAAC;CACvB;AAsCD,eAAO,MAAM,WAAW;;;;;CAKtB,CAAC"}
@@ -0,0 +1,143 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { Children, Fragment, isValidElement, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
4
+ import { DefaultNavLinkComponent } from '../../utils/navigation-context';
5
+ import { useTitanBreakpoint } from '../../utils/use-breakpoint';
6
+ import { LayoutContext, LayoutPlacementContext, } from './layout-context';
7
+ import { LayoutHeader } from './layout-header';
8
+ import { TitanLayoutLogo } from './layout-logo';
9
+ import { LayoutSidebar } from './layout-sidebar';
10
+ import { TitanLayoutSidebarLink, TitanLayoutSidebarTrigger } from './layout-sidebar-links';
11
+ import { InternalSideNavigationTrigger } from './layout-sidebar-links-internal';
12
+ import * as Styles from './titan-layout.module.less';
13
+ const defaultSidebarContext = {
14
+ styles: {
15
+ popoverContent: {
16
+ '--background-color-strong': '#24323C',
17
+ 'color': 'var(--color-white)',
18
+ },
19
+ },
20
+ };
21
+ const useVariant = (appearance) => useMemo(() => {
22
+ const isLegacy = appearance === 'legacy';
23
+ const isAnvil1 = appearance === 'anvil1';
24
+ const isAnvil2 = appearance === 'anvil2';
25
+ return {
26
+ isLegacy,
27
+ isAnvil1,
28
+ isAnvil2,
29
+ isSequent: isLegacy || isAnvil2,
30
+ };
31
+ }, [appearance]);
32
+ const useLayoutChildren = (children) => useMemo(() => Children.toArray(children).reduce((out, item) => {
33
+ if (item &&
34
+ isValidElement(item) &&
35
+ item.type &&
36
+ typeof item.type !== 'string') {
37
+ if (item.type.name === TitanLayoutContent.name) {
38
+ out.content = item;
39
+ }
40
+ else if (item.type.name === TitanLayoutLogo.name) {
41
+ out.logo = item;
42
+ }
43
+ }
44
+ return out;
45
+ }, {
46
+ logo: _jsx(TitanLayoutLogo, {}),
47
+ }), [children]);
48
+ const TitanLayoutComponent = ({ appearance = 'anvil2', id, children, navigationComponent, header, top, profile, state, onStateChange, navigationMainItems, extraLinks, extraLinksTop, extraText, minContentWidth, sideTop, }) => {
49
+ const breakpoint = useTitanBreakpoint();
50
+ const isMobile = breakpoint.isMobile;
51
+ const context = useMemo(() => ({
52
+ NavigationComponent: navigationComponent !== null && navigationComponent !== void 0 ? navigationComponent : DefaultNavLinkComponent,
53
+ breakpoint,
54
+ isTitanLayout: true,
55
+ sidebar: defaultSidebarContext,
56
+ }), [navigationComponent, breakpoint]);
57
+ const variant = useVariant(appearance);
58
+ const [mobileDrawerOpened, setMobileDrawerOpened] = useState(false);
59
+ const { content, logo } = useLayoutChildren(children);
60
+ useEffect(() => {
61
+ if (!isMobile) {
62
+ setMobileDrawerOpened(false);
63
+ return;
64
+ }
65
+ const listener = () => {
66
+ setMobileDrawerOpened(false);
67
+ };
68
+ document.addEventListener('click', listener);
69
+ return () => document.removeEventListener('click', listener);
70
+ }, [isMobile]);
71
+ useEffect(() => {
72
+ if (variant.isAnvil1) {
73
+ document.body.classList.add('of-hidden-i');
74
+ return () => document.body.classList.remove('of-hidden');
75
+ }
76
+ }, [variant.isAnvil1]);
77
+ const onBurgerClick = useCallback((e) => {
78
+ setMobileDrawerOpened(true);
79
+ e.stopPropagation();
80
+ }, []);
81
+ const onBarExpandChange = useCallback((expanded) => {
82
+ if (isMobile) {
83
+ setMobileDrawerOpened(false);
84
+ }
85
+ else {
86
+ onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange({ navCollapsed: !expanded });
87
+ }
88
+ }, [onStateChange, isMobile]);
89
+ const onSubmenuExpandChange = useCallback((id, expanded) => {
90
+ var _a;
91
+ onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange({
92
+ navCollapsed: (_a = state === null || state === void 0 ? void 0 : state.navCollapsed) !== null && _a !== void 0 ? _a : false,
93
+ submenuExpanded: expanded ? id : undefined,
94
+ });
95
+ }, [state, onStateChange]);
96
+ const layoutClass = variant.isLegacy
97
+ ? Styles.layoutLegacy
98
+ : variant.isAnvil1
99
+ ? Styles.layoutAnvil1
100
+ : Styles.layoutAnvil2;
101
+ return (_jsx(LayoutContext.Provider, { value: context, children: _jsx(LayoutPlacementContext.Provider, { value: "unset", children: _jsxs("div", { id: id, className: classNames(Styles.layout, isMobile ? Styles.layoutMobile : Styles.layoutDesktop, !isMobile && (state === null || state === void 0 ? void 0 : state.navCollapsed)
102
+ ? Styles.layoutNavSlim
103
+ : Styles.layoutNavWide, layoutClass), children: [variant.isSequent && _jsx("div", { className: Styles.topPlaceholder }), _jsx(LayoutHeader, { className: Styles.top, logo: logo, profile: isMobile ? undefined : profile, center: top, rightText: isMobile ? undefined : extraText, right: _jsxs(Fragment, { children: [extraLinksTop, !isMobile && extraLinks] }), onBurgerClick: onBurgerClick }), _jsx(LayoutSidebar, { className: Styles.side, mobile: breakpoint.isMobile, barExpanded: isMobile ? mobileDrawerOpened : !(state === null || state === void 0 ? void 0 : state.navCollapsed), submenuExpanded: state === null || state === void 0 ? void 0 : state.submenuExpanded, onBarExpandChange: onBarExpandChange, onSubmenuExpandChange: onSubmenuExpandChange, top: sideTop, mainItems: navigationMainItems, navigationComponent: context.NavigationComponent, bottom: isMobile ? (_jsxs(Fragment, { children: [profile, extraLinks, !!extraText && (_jsx(InternalSideNavigationTrigger, { id: "__extra_text", title: extraText, submenuExpanded: undefined, dataPrefix: "navigation-extra-text", tag: undefined, icon: undefined, iconActive: undefined }))] })) : undefined }), _jsx(LayoutContent, { header: header, anvil2: variant.isAnvil2, anvil1: variant.isAnvil1, minWidth: minContentWidth, children: content })] }) }) }));
104
+ };
105
+ const TitanLayoutHeaderObserved = ({ children, heightChange }) => {
106
+ const ref = useRef(null);
107
+ useEffect(() => {
108
+ if (ref.current) {
109
+ const updatePosition = () => {
110
+ if (ref.current && heightChange) {
111
+ const pos = ref.current.getBoundingClientRect();
112
+ heightChange(pos.height);
113
+ }
114
+ };
115
+ const observer = new ResizeObserver(updatePosition);
116
+ observer.observe(ref.current);
117
+ updatePosition();
118
+ return () => observer.disconnect();
119
+ }
120
+ }, [heightChange]);
121
+ useEffect(() => {
122
+ return () => {
123
+ heightChange === null || heightChange === void 0 ? void 0 : heightChange(0);
124
+ };
125
+ }, [heightChange]);
126
+ return (_jsx("div", { ref: ref, className: Styles.header, children: children }));
127
+ };
128
+ const TitanLayoutContent = ({ children }) => children;
129
+ const LayoutContent = ({ anvil1, anvil2, children, header }) => {
130
+ const [anvil2Styles, setAnvil2Styles] = useState({});
131
+ const updateIndicatorsHeight = useCallback((offset) => {
132
+ setAnvil2Styles({ '--offset': `calc(var(--nav-offset-top) + ${offset}px)` });
133
+ }, []);
134
+ return (_jsxs(Fragment, { children: [!!header &&
135
+ (anvil2 ? (_jsx(TitanLayoutHeaderObserved, { heightChange: updateIndicatorsHeight, children: header })) : (_jsx("div", { className: Styles.header, children: header }))), _jsx("div", { className: Styles.content, style: anvil2Styles, "data-cy": "layout-content", children: anvil1 ? (_jsx("div", { className: "position-relative d-f flex-grow-1 flex-basis-0 of-hidden", children: children })) : (children) })] }));
136
+ };
137
+ export const TitanLayout = Object.assign(TitanLayoutComponent, {
138
+ Content: TitanLayoutContent,
139
+ Logo: TitanLayoutLogo,
140
+ Link: TitanLayoutSidebarLink,
141
+ Trigger: TitanLayoutSidebarTrigger,
142
+ });
143
+ //# sourceMappingURL=titan-layout.js.map