sagittarius-admin-template 0.2.0 → 0.2.1

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 (25) hide show
  1. package/ng-package.json +11 -0
  2. package/package.json +3 -12
  3. package/src/lib/sagittarius-admin/drawer-component/drawer-component.html +1 -0
  4. package/src/lib/sagittarius-admin/drawer-component/drawer-component.scss +0 -0
  5. package/src/lib/sagittarius-admin/drawer-component/drawer-component.spec.ts +54 -0
  6. package/src/lib/sagittarius-admin/drawer-component/drawer-component.ts +123 -0
  7. package/src/lib/sagittarius-admin/drawer-component/drawer-content/drawer-content.html +23 -0
  8. package/src/lib/sagittarius-admin/drawer-component/drawer-content/drawer-content.scss +103 -0
  9. package/src/lib/sagittarius-admin/drawer-component/drawer-content/drawer-content.spec.ts +63 -0
  10. package/src/lib/sagittarius-admin/drawer-component/drawer-content/drawer-content.ts +67 -0
  11. package/src/lib/sagittarius-admin/drawer-ref.ts +26 -0
  12. package/src/lib/sagittarius-admin/drawer-service.ts +58 -0
  13. package/src/lib/sagittarius-admin/sagittarius-admin.html +150 -0
  14. package/src/lib/sagittarius-admin/sagittarius-admin.labels.ts +63 -0
  15. package/src/lib/sagittarius-admin/sagittarius-admin.models.ts +60 -0
  16. package/src/lib/sagittarius-admin/sagittarius-admin.scss +592 -0
  17. package/src/lib/sagittarius-admin/sagittarius-admin.spec.ts +45 -0
  18. package/src/lib/sagittarius-admin/sagittarius-admin.ts +159 -0
  19. package/src/public-api.ts +9 -0
  20. package/tsconfig.lib.json +18 -0
  21. package/tsconfig.lib.prod.json +11 -0
  22. package/tsconfig.spec.json +14 -0
  23. package/fesm2022/sagittarius-admin-template.mjs +0 -399
  24. package/fesm2022/sagittarius-admin-template.mjs.map +0 -1
  25. package/index.d.ts +0 -203
@@ -0,0 +1,592 @@
1
+ // Všetky farby a rozmery pochádzajú z CSS premenných --sg-* definovaných
2
+ // v styles/sagittarius-admin.scss (musí byť načítaný v globálnych štýloch aplikácie).
3
+
4
+ :host {
5
+ display: block;
6
+ }
7
+
8
+ * {
9
+ box-sizing: border-box;
10
+ }
11
+
12
+ .sg-admin-theme {
13
+ display: flex;
14
+ width: 100vw;
15
+ height: 100vh;
16
+ height: 100dvh;
17
+ font-family: var(--sg-font);
18
+ color: var(--sg-text);
19
+ background: var(--sg-bg);
20
+
21
+ // ─── Sidebar ──────────────────────────────────────────────────────────────
22
+ .sg-admin-theme-sidebar {
23
+ display: flex;
24
+ height: 100%;
25
+ flex-direction: column;
26
+ flex-shrink: 0;
27
+ width: var(--sg-sidebar-width);
28
+ position: relative;
29
+ z-index: 3;
30
+ // tmavý sidebar => tmavé scrollbary a Material komponenty
31
+ color-scheme: dark;
32
+
33
+ .sg-admin-theme-sidebar-wrapper {
34
+ display: flex;
35
+ height: 100%;
36
+ flex-direction: column;
37
+ width: var(--sg-sidebar-width);
38
+ position: relative;
39
+ z-index: 3;
40
+ background: var(--sg-sidebar-bg);
41
+ color: var(--sg-sidebar-text);
42
+ border-right: 1px solid var(--sg-sidebar-border);
43
+ }
44
+
45
+ &.collapsed {
46
+ width: var(--sg-sidebar-collapsed-width);
47
+
48
+ .sg-admin-theme-sidebar-wrapper {
49
+ width: var(--sg-sidebar-collapsed-width);
50
+ transition: width 250ms cubic-bezier(0.2, 0, 0, 1), box-shadow 250ms;
51
+ position: absolute;
52
+ z-index: 9;
53
+
54
+ &.hover {
55
+ width: var(--sg-sidebar-width);
56
+ box-shadow: var(--sg-shadow-lg);
57
+ }
58
+ }
59
+
60
+ .sg-admin-theme-sidebar-wrapper.no-hover {
61
+ .sg-admin-theme-sidebar-header {
62
+ padding: 0;
63
+ justify-content: center;
64
+
65
+ .sg-admin-theme-sidebar-header-logo-lg {
66
+ display: none;
67
+ }
68
+ }
69
+
70
+ .sg-admin-theme-sidebar-profile {
71
+ padding: 16px 0;
72
+
73
+ .sg-admin-theme-sidebar-profile-header-avatar {
74
+ width: 36px;
75
+ height: 36px;
76
+ font-size: 13px;
77
+ }
78
+
79
+ .sg-admin-theme-sidebar-profile-footer {
80
+ display: none;
81
+ }
82
+ }
83
+
84
+ .sg-admin-theme-sidebar-body nav {
85
+ .sg-admin-theme-sidebar-nav-item-spacer {
86
+ justify-content: center;
87
+ padding: 12px 0 8px;
88
+
89
+ .sg-admin-theme-sidebar-nav-item-icon {
90
+ display: block;
91
+ }
92
+
93
+ .sg-admin-theme-sidebar-nav-item-label {
94
+ display: none;
95
+ }
96
+ }
97
+
98
+ .sg-admin-theme-sidebar-nav-item {
99
+ justify-content: center;
100
+ padding: 0;
101
+
102
+ .sg-admin-theme-sidebar-nav-item-wrapper .sg-admin-theme-sidebar-nav-item-label,
103
+ .sg-admin-theme-sidebar-nav-item-badge {
104
+ display: none;
105
+ }
106
+ }
107
+ }
108
+ }
109
+ }
110
+
111
+ .sg-admin-theme-sidebar-header {
112
+ display: flex;
113
+ width: 100%;
114
+ flex-direction: row;
115
+ min-height: var(--sg-header-height);
116
+ max-height: var(--sg-header-height);
117
+ padding: 0 8px 0 14px;
118
+ justify-content: space-between;
119
+ align-items: center;
120
+ overflow: hidden;
121
+ border-bottom: 1px solid var(--sg-sidebar-border);
122
+ transition: padding 200ms ease-in-out;
123
+
124
+ .sg-admin-theme-sidebar-header-menu-button {
125
+ color: var(--sg-sidebar-text-muted);
126
+ flex-shrink: 0;
127
+ }
128
+ }
129
+
130
+ .sg-admin-theme-brand {
131
+ display: flex;
132
+ align-items: center;
133
+ gap: 12px;
134
+ min-width: 0;
135
+ color: var(--sg-sidebar-text-strong);
136
+ text-decoration: none;
137
+
138
+ .sg-admin-theme-brand-mark {
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ flex-shrink: 0;
143
+ width: 34px;
144
+ height: 34px;
145
+ border-radius: var(--sg-radius-sm);
146
+ background: var(--sg-sidebar-accent);
147
+ color: var(--sg-sidebar-accent-contrast);
148
+ font-weight: 700;
149
+ font-size: 14px;
150
+ letter-spacing: 0.02em;
151
+ overflow: hidden;
152
+
153
+ img {
154
+ width: 100%;
155
+ height: 100%;
156
+ object-fit: contain;
157
+ }
158
+ }
159
+
160
+ .sg-admin-theme-sidebar-header-logo-lg {
161
+ font-size: 16px;
162
+ font-weight: 600;
163
+ white-space: nowrap;
164
+ overflow: hidden;
165
+ text-overflow: ellipsis;
166
+ }
167
+ }
168
+
169
+ .sg-admin-theme-sidebar-body {
170
+ display: flex;
171
+ width: 100%;
172
+ flex-grow: 1;
173
+ flex-direction: column;
174
+ overflow-x: hidden;
175
+ overflow-y: auto;
176
+ scrollbar-width: thin;
177
+ scrollbar-color: var(--sg-sidebar-scrollbar) transparent;
178
+
179
+ nav {
180
+ display: flex;
181
+ flex-direction: column;
182
+ gap: 2px;
183
+ padding: 8px 10px;
184
+
185
+ .sg-admin-theme-sidebar-nav-item-spacer {
186
+ display: flex;
187
+ align-items: center;
188
+ padding: 16px 12px 6px;
189
+ font-size: 11px;
190
+ font-weight: 600;
191
+ letter-spacing: 0.08em;
192
+ text-transform: uppercase;
193
+ color: var(--sg-sidebar-text-muted);
194
+ white-space: nowrap;
195
+
196
+ .sg-admin-theme-sidebar-nav-item-icon {
197
+ display: none;
198
+ width: 18px;
199
+ height: 1px;
200
+ background: var(--sg-sidebar-border);
201
+ }
202
+ }
203
+
204
+ .sg-admin-theme-sidebar-nav-item {
205
+ position: relative;
206
+ width: 100%;
207
+ min-height: 40px;
208
+ display: flex;
209
+ flex-direction: row;
210
+ align-items: center;
211
+ justify-content: space-between;
212
+ padding: 0 10px 0 12px;
213
+ border-radius: var(--sg-radius-sm);
214
+ color: var(--sg-sidebar-text);
215
+ text-decoration: none;
216
+ white-space: nowrap;
217
+ transition: background-color 150ms, color 150ms;
218
+
219
+ &:hover {
220
+ background: var(--sg-sidebar-hover);
221
+ color: var(--sg-sidebar-text-strong);
222
+ }
223
+
224
+ &:focus-visible {
225
+ outline: 2px solid var(--sg-sidebar-accent);
226
+ outline-offset: -2px;
227
+ }
228
+
229
+ &.active {
230
+ background: var(--sg-sidebar-active-bg);
231
+ color: var(--sg-sidebar-text-strong);
232
+
233
+ &::before {
234
+ content: '';
235
+ position: absolute;
236
+ left: -10px;
237
+ top: 8px;
238
+ bottom: 8px;
239
+ width: 3px;
240
+ border-radius: 0 3px 3px 0;
241
+ background: var(--sg-sidebar-accent);
242
+ }
243
+
244
+ .sg-admin-theme-sidebar-nav-item-icon {
245
+ color: var(--sg-sidebar-accent);
246
+ }
247
+ }
248
+
249
+ .sg-admin-theme-sidebar-nav-item-wrapper {
250
+ display: flex;
251
+ flex-direction: row;
252
+ align-items: center;
253
+ gap: 14px;
254
+ min-width: 0;
255
+
256
+ .sg-admin-theme-sidebar-nav-item-icon {
257
+ flex-shrink: 0;
258
+ font-size: 20px;
259
+ width: 20px;
260
+ height: 20px;
261
+ }
262
+
263
+ .sg-admin-theme-sidebar-nav-item-label {
264
+ font-size: 14px;
265
+ font-weight: 500;
266
+ overflow: hidden;
267
+ text-overflow: ellipsis;
268
+ }
269
+ }
270
+
271
+ .sg-admin-theme-sidebar-nav-item-badge {
272
+ min-width: 20px;
273
+ height: 20px;
274
+ padding: 0 6px;
275
+ border-radius: 10px;
276
+ background: var(--sg-sidebar-accent);
277
+ color: var(--sg-sidebar-accent-contrast);
278
+ font-size: 11px;
279
+ font-weight: 600;
280
+ display: flex;
281
+ align-items: center;
282
+ justify-content: center;
283
+ }
284
+ }
285
+ }
286
+
287
+ .sg-admin-theme-sidebar-bottom {
288
+ margin-top: auto;
289
+ }
290
+ }
291
+
292
+ .sg-admin-theme-sidebar-profile {
293
+ padding: 20px 12px 12px;
294
+ display: flex;
295
+ flex-direction: column;
296
+ align-items: center;
297
+ width: 100%;
298
+ transition: padding 200ms;
299
+
300
+ .sg-admin-theme-sidebar-profile-header {
301
+ display: flex;
302
+ justify-content: center;
303
+ width: 100%;
304
+
305
+ .sg-admin-theme-sidebar-profile-header-avatar {
306
+ width: 56px;
307
+ height: 56px;
308
+ border-radius: 50%;
309
+ display: flex;
310
+ align-items: center;
311
+ justify-content: center;
312
+ overflow: hidden;
313
+ font-weight: 600;
314
+ font-size: 18px;
315
+ color: var(--sg-sidebar-accent-contrast);
316
+ background: linear-gradient(135deg, var(--sg-sidebar-accent), var(--sg-sidebar-accent-2));
317
+ box-shadow: 0 0 0 3px var(--sg-sidebar-bg), 0 0 0 4px var(--sg-sidebar-border);
318
+ transition: width 200ms, height 200ms;
319
+
320
+ img {
321
+ width: 100%;
322
+ height: 100%;
323
+ object-fit: cover;
324
+ }
325
+ }
326
+ }
327
+
328
+ .sg-admin-theme-sidebar-profile-footer {
329
+ display: flex;
330
+ flex-direction: column;
331
+ align-items: center;
332
+ width: 100%;
333
+ padding-top: 10px;
334
+ text-align: center;
335
+ white-space: nowrap;
336
+
337
+ .sg-admin-theme-sidebar-profile-footer-name {
338
+ font-weight: 600;
339
+ color: var(--sg-sidebar-text-strong);
340
+ }
341
+
342
+ .sg-admin-theme-sidebar-profile-footer-subtitle {
343
+ font-size: 12px;
344
+ color: var(--sg-sidebar-text-muted);
345
+ }
346
+ }
347
+ }
348
+ }
349
+
350
+ // ─── Pravá časť: header, main, footer ─────────────────────────────────────
351
+ .sg-admin-theme-body {
352
+ flex-grow: 1;
353
+ min-width: 0;
354
+ height: 100%;
355
+ display: flex;
356
+ flex-direction: column;
357
+ }
358
+
359
+ .sg-admin-theme-header {
360
+ width: 100%;
361
+ min-height: var(--sg-header-height);
362
+ max-height: var(--sg-header-height);
363
+ display: flex;
364
+ justify-content: space-between;
365
+ align-items: center;
366
+ gap: 12px;
367
+ padding: 0 16px 0 20px;
368
+ position: relative;
369
+ z-index: 2;
370
+ background: var(--sg-header-bg);
371
+ border-bottom: 1px solid var(--sg-border);
372
+
373
+ .sg-admin-theme-header-left-box,
374
+ .sg-admin-theme-header-middle-box,
375
+ .sg-admin-theme-header-right-box {
376
+ display: flex;
377
+ flex-direction: row;
378
+ align-items: center;
379
+ gap: 8px;
380
+ height: 100%;
381
+ min-width: 0;
382
+ }
383
+
384
+ .sg-admin-theme-header-middle-box {
385
+ flex: 1 1 auto;
386
+ justify-content: center;
387
+ }
388
+
389
+ .sg-admin-theme-header-left-box-menu-button {
390
+ color: var(--sg-text);
391
+ }
392
+
393
+ .sg-admin-theme-header-logo-lg {
394
+ font-weight: 600;
395
+ font-size: 16px;
396
+ color: var(--sg-text);
397
+ text-decoration: none;
398
+ white-space: nowrap;
399
+ }
400
+
401
+ .sg-admin-theme-header-right-box {
402
+ color: var(--sg-text-muted);
403
+ }
404
+
405
+ .sg-admin-theme-header-user {
406
+ display: flex;
407
+ align-items: center;
408
+ gap: 8px;
409
+ height: 40px;
410
+ padding: 0 6px 0 4px;
411
+ border: 0;
412
+ border-radius: 20px;
413
+ background: transparent;
414
+ color: var(--sg-text);
415
+ font: inherit;
416
+ cursor: pointer;
417
+ transition: background-color 150ms;
418
+
419
+ &:hover,
420
+ &[aria-expanded='true'] {
421
+ background: var(--sg-hover);
422
+ }
423
+
424
+ &:focus-visible {
425
+ outline: 2px solid var(--sg-primary);
426
+ }
427
+
428
+ .sg-admin-theme-header-user-avatar {
429
+ width: 32px;
430
+ height: 32px;
431
+ border-radius: 50%;
432
+ display: flex;
433
+ align-items: center;
434
+ justify-content: center;
435
+ overflow: hidden;
436
+ font-size: 12px;
437
+ font-weight: 600;
438
+ color: var(--sg-on-primary);
439
+ background: var(--sg-primary);
440
+
441
+ img {
442
+ width: 100%;
443
+ height: 100%;
444
+ object-fit: cover;
445
+ }
446
+ }
447
+
448
+ .sg-admin-theme-header-user-name {
449
+ font-weight: 500;
450
+ max-width: 180px;
451
+ overflow: hidden;
452
+ text-overflow: ellipsis;
453
+ white-space: nowrap;
454
+ }
455
+
456
+ mat-icon {
457
+ color: var(--sg-text-muted);
458
+ font-size: 20px;
459
+ width: 20px;
460
+ height: 20px;
461
+ }
462
+ }
463
+ }
464
+
465
+ .sg-admin-theme-main {
466
+ width: 100%;
467
+ flex-grow: 1;
468
+ min-height: 0;
469
+ display: flex;
470
+ flex-direction: column;
471
+ position: relative;
472
+ overflow: auto;
473
+ background: var(--sg-bg);
474
+
475
+ .sg-admin-theme-drawer {
476
+ position: absolute;
477
+ inset: 0 0 0 auto;
478
+ width: 100%;
479
+ height: 100%;
480
+ display: flex;
481
+ flex-direction: column;
482
+ z-index: 1;
483
+ // bez vlastného pozadia – vrstvy ho majú samé, takže pri odchode poslednej vrstvy presvitá obsah
484
+ // animácia vrstvy (translateX) nesmie vytvoriť scrollbary v main
485
+ overflow: hidden;
486
+
487
+ &.closed {
488
+ width: 0 !important;
489
+ overflow: hidden;
490
+ }
491
+ }
492
+
493
+ .sg-admin-theme-content {
494
+ width: 100%;
495
+ flex-grow: 1;
496
+ display: flex;
497
+ flex-direction: column;
498
+ position: relative;
499
+ // vlastný stacking context – sticky/z-index prvky stránky nepresvitnú cez drawer
500
+ z-index: 0;
501
+ overflow: auto;
502
+ scrollbar-width: thin;
503
+ scrollbar-color: var(--sg-scrollbar) transparent;
504
+ }
505
+ }
506
+
507
+ .sg-admin-theme-footer {
508
+ width: 100%;
509
+ display: flex;
510
+ gap: 12px;
511
+ min-height: var(--sg-footer-height);
512
+ max-height: var(--sg-footer-height);
513
+ padding: 0 20px;
514
+ justify-content: space-between;
515
+ align-items: center;
516
+ overflow: hidden;
517
+ font-size: 12px;
518
+ color: var(--sg-text-muted);
519
+ background: var(--sg-surface);
520
+ border-top: 1px solid var(--sg-border);
521
+ }
522
+ }
523
+
524
+ .mobile-only {
525
+ display: none !important;
526
+ }
527
+
528
+ .pc-only {
529
+ display: flex !important;
530
+ }
531
+
532
+ // ─── Mobil ─────────────────────────────────────────────────────────────────
533
+ @media screen and (max-width: 800px) {
534
+ .mobile-only {
535
+ display: flex !important;
536
+ }
537
+
538
+ .pc-only {
539
+ display: none !important;
540
+ }
541
+
542
+ .sg-admin-theme {
543
+ height: auto;
544
+ width: 100%;
545
+
546
+ .sg-admin-theme-header {
547
+ position: sticky;
548
+ top: 0;
549
+ padding: 0 8px 0 4px;
550
+ }
551
+
552
+ .sg-admin-theme-sidebar {
553
+ width: 0;
554
+ height: 100%;
555
+ overflow: hidden;
556
+ z-index: 99999;
557
+ position: fixed;
558
+ display: flex;
559
+ transition: width 300ms cubic-bezier(0.2, 0, 0, 1);
560
+
561
+ &.open {
562
+ width: 100%;
563
+ }
564
+
565
+ .sg-admin-theme-sidebar-wrapper {
566
+ width: 100%;
567
+ }
568
+ }
569
+
570
+ .sg-admin-theme-body {
571
+ min-height: 100vh;
572
+ min-height: 100dvh;
573
+ }
574
+
575
+ .sg-admin-theme-main {
576
+ overflow: visible;
577
+
578
+ .sg-admin-theme-drawer {
579
+ width: 100%;
580
+ position: fixed;
581
+ top: 0;
582
+ z-index: 10;
583
+ }
584
+ }
585
+ }
586
+ }
587
+
588
+ @media (prefers-reduced-motion: reduce) {
589
+ .sg-admin-theme * {
590
+ transition: none !important;
591
+ }
592
+ }
@@ -0,0 +1,45 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { provideRouter } from '@angular/router';
3
+
4
+ import { SagittariusAdmin } from './sagittarius-admin';
5
+
6
+ describe('SagittariusAdmin', () => {
7
+ let component: SagittariusAdmin;
8
+ let fixture: ComponentFixture<SagittariusAdmin>;
9
+
10
+ beforeEach(async () => {
11
+ await TestBed.configureTestingModule({
12
+ imports: [SagittariusAdmin],
13
+ providers: [provideRouter([])]
14
+ })
15
+ .compileComponents();
16
+
17
+ fixture = TestBed.createComponent(SagittariusAdmin);
18
+ component = fixture.componentInstance;
19
+ fixture.detectChanges();
20
+ });
21
+
22
+ it('should create', () => {
23
+ expect(component).toBeTruthy();
24
+ });
25
+
26
+ it('should render menu items and section spacers', () => {
27
+ fixture.componentRef.setInput('menuItems', [
28
+ { label: 'Sekcia', spacer: true },
29
+ { label: 'Prehľad', icon: 'dashboard', route: '/dashboard' },
30
+ ]);
31
+ fixture.detectChanges();
32
+ const el = fixture.nativeElement as HTMLElement;
33
+ expect(el.querySelectorAll('.sg-admin-theme-sidebar-nav-item').length).toBe(1);
34
+ expect(el.querySelector('.sg-admin-theme-sidebar-nav-item-spacer')?.textContent).toContain('Sekcia');
35
+ });
36
+
37
+ it('should toggle collapsed sidebar on desktop', () => {
38
+ fixture.componentRef.setInput('persistSidebarState', false);
39
+ component.isHandset.set(false);
40
+ component.toggleSidebar();
41
+ fixture.detectChanges();
42
+ expect(component.collapsed()).toBeTrue();
43
+ expect((fixture.nativeElement as HTMLElement).querySelector('.sg-admin-theme-sidebar.collapsed')).toBeTruthy();
44
+ });
45
+ });