ng-magary 0.0.1 → 0.0.3

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 (64) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +166 -32
  3. package/bun.lock +290 -0
  4. package/ng-package.json +7 -0
  5. package/package.json +11 -12
  6. package/src/lib/Button/button/button.html +29 -0
  7. package/src/lib/Button/button/button.module.ts +9 -0
  8. package/src/lib/Button/button/button.scss +196 -0
  9. package/src/lib/Button/button/button.spec.ts +18 -0
  10. package/src/lib/Button/button/button.ts +72 -0
  11. package/src/lib/Button/speed-dial/speed-dial-item.interface.ts +9 -0
  12. package/src/lib/Button/speed-dial/speed-dial.html +57 -0
  13. package/src/lib/Button/speed-dial/speed-dial.module.ts +8 -0
  14. package/src/lib/Button/speed-dial/speed-dial.scss +247 -0
  15. package/src/lib/Button/speed-dial/speed-dial.spec.ts +18 -0
  16. package/src/lib/Button/speed-dial/speed-dial.ts +106 -0
  17. package/src/lib/Form/cascade-select/cascade-select.html +1 -0
  18. package/src/lib/Form/cascade-select/cascade-select.module.ts +8 -0
  19. package/src/lib/Form/cascade-select/cascade-select.scss +0 -0
  20. package/src/lib/Form/cascade-select/cascade-select.spec.ts +18 -0
  21. package/src/lib/Form/cascade-select/cascade-select.ts +9 -0
  22. package/src/lib/Form/input/input.html +66 -0
  23. package/src/lib/Form/input/input.module.ts +9 -0
  24. package/src/lib/Form/input/input.scss +193 -0
  25. package/src/lib/Form/input/input.spec.ts +22 -0
  26. package/src/lib/Form/input/input.ts +132 -0
  27. package/src/lib/Menu/panelmenu/panelmenu.html +259 -0
  28. package/src/lib/Menu/panelmenu/panelmenu.interface.ts +13 -0
  29. package/src/lib/Menu/panelmenu/panelmenu.module.ts +9 -0
  30. package/src/lib/Menu/panelmenu/panelmenu.scss +177 -0
  31. package/src/lib/Menu/panelmenu/panelmenu.spec.ts +18 -0
  32. package/src/lib/Menu/panelmenu/panelmenu.ts +134 -0
  33. package/src/lib/Menu/sidebar/sidebar.html +85 -0
  34. package/src/lib/Menu/sidebar/sidebar.module.ts +9 -0
  35. package/src/lib/Menu/sidebar/sidebar.scss +153 -0
  36. package/src/lib/Menu/sidebar/sidebar.spec.ts +18 -0
  37. package/src/lib/Menu/sidebar/sidebar.ts +64 -0
  38. package/src/lib/Misc/avatar/avatar.html +44 -0
  39. package/src/lib/Misc/avatar/avatar.module.ts +9 -0
  40. package/src/lib/Misc/avatar/avatar.scss +167 -0
  41. package/src/lib/Misc/avatar/avatar.spec.ts +18 -0
  42. package/src/lib/Misc/avatar/avatar.ts +93 -0
  43. package/src/lib/Panel/card/card.html +58 -0
  44. package/src/lib/Panel/card/card.module.ts +9 -0
  45. package/src/lib/Panel/card/card.scss +290 -0
  46. package/src/lib/Panel/card/card.spec.ts +18 -0
  47. package/src/lib/Panel/card/card.ts +126 -0
  48. package/src/lib/Panel/tabs/tab/tab.spec.ts +18 -0
  49. package/src/lib/Panel/tabs/tab/tab.ts +12 -0
  50. package/src/lib/Panel/tabs/tabs.html +26 -0
  51. package/src/lib/Panel/tabs/tabs.module.ts +10 -0
  52. package/src/lib/Panel/tabs/tabs.scss +58 -0
  53. package/src/lib/Panel/tabs/tabs.spec.ts +18 -0
  54. package/src/lib/Panel/tabs/tabs.ts +57 -0
  55. package/src/lib/ng-magary.spec.ts +18 -0
  56. package/src/lib/ng-magary.ts +43 -0
  57. package/src/public-api.ts +5 -0
  58. package/tsconfig.lib.json +22 -0
  59. package/tsconfig.lib.prod.json +11 -0
  60. package/tsconfig.spec.json +14 -0
  61. package/fesm2022/ng-magary.mjs +0 -811
  62. package/fesm2022/ng-magary.mjs.map +0 -1
  63. package/index.d.ts +0 -422
  64. package/index.d.ts.map +0 -1
@@ -0,0 +1,9 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { Sidebar } from './sidebar';
4
+ import { RouterModule } from '@angular/router';
5
+ @NgModule({
6
+ imports: [CommonModule, Sidebar, RouterModule],
7
+ exports: [Sidebar],
8
+ })
9
+ export class SidebarModule {}
@@ -0,0 +1,153 @@
1
+ .sidebar {
2
+ display: flex;
3
+ flex-direction: column;
4
+ height: 100vh;
5
+ width: 280px;
6
+ background: #f8fafc;
7
+ border-right: 1px solid #e2e8f0;
8
+ box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
9
+ }
10
+ .sidebar-header {
11
+ display: flex;
12
+ align-items: center;
13
+ padding-left: 30px;
14
+ border-bottom: 1px solid #e2e8f0;
15
+ background: #ffffff;
16
+ height: 60px;
17
+ gap: 12px;
18
+ .logo {
19
+ width: 30px;
20
+ height: 30px;
21
+ }
22
+ .title {
23
+ font-size: 1.25rem;
24
+ font-weight: 700;
25
+ color: #1f2937;
26
+ letter-spacing: -0.025em;
27
+ }
28
+ }
29
+ .sidebar-content {
30
+ flex: 1;
31
+ display: flex;
32
+ flex-direction: column;
33
+ overflow-y: auto;
34
+ padding: 1rem;
35
+ &::-webkit-scrollbar {
36
+ width: 6px;
37
+ }
38
+ &::-webkit-scrollbar-track {
39
+ background: transparent;
40
+ }
41
+ &::-webkit-scrollbar-thumb {
42
+ background: #cbd5e1;
43
+ border-radius: 3px;
44
+ &:hover {
45
+ background: #94a3b8;
46
+ }
47
+ }
48
+ }
49
+ .menu-container {
50
+ flex: 1;
51
+ overflow-y: auto;
52
+ }
53
+ .user-section {
54
+ margin-top: auto;
55
+ padding: 1rem;
56
+ border-top: 1px solid #e2e8f0;
57
+ background: #ffffff;
58
+ border-radius: 12px;
59
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
60
+ flex-shrink: 0;
61
+ }
62
+ .user-info {
63
+ display: flex;
64
+ align-items: center;
65
+ margin-bottom: 1rem;
66
+ gap: 25px;
67
+ .avatar {
68
+ width: 40px;
69
+ height: 40px;
70
+ border-radius: 50%;
71
+ margin-right: 0.75rem;
72
+ border: 2px solid #e2e8f0;
73
+ }
74
+ .user-details {
75
+ flex: 1;
76
+ .username {
77
+ font-weight: 600;
78
+ color: #1f2937;
79
+ font-size: 0.875rem;
80
+ margin-bottom: 0.125rem;
81
+ }
82
+ .email {
83
+ color: #6b7280;
84
+ font-size: 0.75rem;
85
+ }
86
+ }
87
+ }
88
+ .logout-button {
89
+ width: 100%;
90
+ display: flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+ gap: 0.5rem;
94
+ padding: 0.75rem 1rem;
95
+ background: #ef4444;
96
+ color: white;
97
+ border: none;
98
+ border-radius: 8px;
99
+ font-size: 0.875rem;
100
+ font-weight: 500;
101
+ cursor: pointer;
102
+ transition: all 0.2s ease;
103
+ &:hover {
104
+ background: #dc2626;
105
+ transform: translateY(-1px);
106
+ box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
107
+ }
108
+ &:active {
109
+ transform: translateY(0);
110
+ }
111
+ i {
112
+ font-size: 0.875rem;
113
+ }
114
+ }
115
+ .hamburger-button {
116
+ display: none;
117
+ position: fixed;
118
+ top: 15px;
119
+ left: 15px;
120
+ z-index: 1100;
121
+ background: white;
122
+ border: 1px solid #e5e7eb;
123
+ border-radius: 8px;
124
+ padding: 0.5rem 0.75rem;
125
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
126
+ cursor: pointer;
127
+ i {
128
+ font-size: 1.25rem;
129
+ color: #1f2937;
130
+ }
131
+ }
132
+ @media (max-width: 768px) {
133
+ .hamburger-button {
134
+ display: block;
135
+ }
136
+ }
137
+ @media (max-width: 768px) {
138
+ .sidebar {
139
+ width: 100%;
140
+ position: fixed;
141
+ top: 0;
142
+ left: 0;
143
+ z-index: 1000;
144
+ transform: translateX(-100%);
145
+ transition: transform 0.3s ease;
146
+ &.open {
147
+ transform: translateX(0);
148
+ }
149
+ }
150
+ .sidebar-header{
151
+ padding: 20px 20px 20px 90px;
152
+ }
153
+ }
@@ -0,0 +1,18 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { Sidebar } from './sidebar';
3
+ describe('Sidebar', () => {
4
+ let component: Sidebar;
5
+ let fixture: ComponentFixture<Sidebar>;
6
+ beforeEach(async () => {
7
+ await TestBed.configureTestingModule({
8
+ imports: [Sidebar]
9
+ })
10
+ .compileComponents();
11
+ fixture = TestBed.createComponent(Sidebar);
12
+ component = fixture.componentInstance;
13
+ fixture.detectChanges();
14
+ });
15
+ it('should create', () => {
16
+ expect(component).toBeTruthy();
17
+ });
18
+ });
@@ -0,0 +1,64 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, input, output, signal } from '@angular/core';
3
+ import { RouterModule } from '@angular/router';
4
+ import { MagaryPanelmenu } from '../panelmenu/panelmenu';
5
+ import { MenuItem } from '../panelmenu/panelmenu.interface';
6
+ import {
7
+ MagaryAvatar,
8
+ BadgeSeverity,
9
+ AvatarSize,
10
+ AvatarShape,
11
+ } from '../../Misc/avatar/avatar';
12
+ interface SidebarSection {
13
+ title: string;
14
+ items: MenuItem[];
15
+ backgroundColor?: string;
16
+ textColor?: string;
17
+ hoverColor?: string;
18
+ }
19
+ type AvatarType = 'image' | 'label' | 'icon';
20
+ interface AvatarConfig {
21
+ type: AvatarType;
22
+ size?: AvatarSize;
23
+ shape?: AvatarShape;
24
+ image?: string;
25
+ label?: string;
26
+ icon?: string;
27
+ badgeValue?: string;
28
+ badgeSeverity?: BadgeSeverity | undefined;
29
+ }
30
+ @Component({
31
+ selector: 'magary-sidebar',
32
+ imports: [CommonModule, RouterModule, MagaryPanelmenu, MagaryAvatar],
33
+ templateUrl: './sidebar.html',
34
+ styleUrl: './sidebar.scss',
35
+ })
36
+ export class Sidebar {
37
+ public sections = input<SidebarSection[]>([]);
38
+ public menu = input<MenuItem[]>([]);
39
+ public menuTitle = input<string>('Menu');
40
+ public showUserSection = input<boolean>(false);
41
+ public userName = input<string>('John Doe');
42
+ public userEmail = input<string>('user@example.com');
43
+ public avatarConfig = input<AvatarConfig>({
44
+ type: 'label',
45
+ label: 'U',
46
+ size: 'normal',
47
+ shape: 'circle',
48
+ badgeSeverity: 'danger',
49
+ });
50
+ public logoSrc = input<string>('assets/logo.svg');
51
+ public appTitle = input<string>('PRIMENG');
52
+ public isMobileOpen = signal(false);
53
+ Logout = output<void>();
54
+ closeSidebar = output<void>();
55
+ toggleMobileSidebar() {
56
+ this.isMobileOpen.update((open) => !open);
57
+ }
58
+ closeMobileSidebar() {
59
+ this.isMobileOpen.set(false);
60
+ }
61
+ logout() {
62
+ this.Logout.emit();
63
+ }
64
+ }
@@ -0,0 +1,44 @@
1
+ <div
2
+ class="avatar-wrapper"
3
+ [ngClass]="avatarClasses()"
4
+ [ngStyle]="customStyle()"
5
+ [attr.aria-label]="alt()"
6
+ [attr.role]="clickable() ? 'button' : null"
7
+ [attr.tabindex]="clickable() && !disabled() ? '0' : null"
8
+ (click)="clickable() && onAvatarClick()"
9
+ (keydown.enter)="clickable() && onAvatarClick()"
10
+ (keydown.space)="clickable() && onAvatarClick()"
11
+ >
12
+ @if (loading()) {
13
+ <div class="avatar-loading">
14
+ <i class="fas fa-spinner fa-spin"></i>
15
+ </div>
16
+ } @else {
17
+ @if (shouldShowImage()) {
18
+ <img
19
+ [src]="image()"
20
+ [alt]="alt()"
21
+ class="avatar-img"
22
+ [ngClass]="shape()"
23
+ (error)="onImageError()"
24
+ (load)="onImageLoad()"
25
+ />
26
+ }
27
+ @if (shouldShowIcon()) {
28
+ <i [class]="'fas fa-' + icon()" class="avatar-icon"></i>
29
+ }
30
+ @if (shouldShowLabel()) {
31
+ <span class="avatar-label">{{ displayLabel() }}</span>
32
+ }
33
+ }
34
+ @if (badgeValue()) {
35
+ <div
36
+ class="badge"
37
+ [ngClass]="badgeSeverity()"
38
+ [attr.aria-label]="'Badge: ' + badgeValue()"
39
+ (click)="onBadgeClick($event)"
40
+ >
41
+ {{ badgeValue() }}
42
+ </div>
43
+ }
44
+ </div>
@@ -0,0 +1,9 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MagaryAvatar } from './avatar';
4
+ export * from './avatar';
5
+ @NgModule({
6
+ imports: [CommonModule, MagaryAvatar],
7
+ exports: [MagaryAvatar],
8
+ })
9
+ export class AvatarModule {}
@@ -0,0 +1,167 @@
1
+ .avatar-wrapper {
2
+ --avatar-bg: var(--magary-avatar-bg, #6b7280);
3
+ --avatar-color: var(--magary-avatar-color, #ffffff);
4
+ --avatar-border: var(--magary-avatar-border, transparent);
5
+ --avatar-font-weight: var(--magary-avatar-font-weight, 600);
6
+ --avatar-transition: var(--magary-avatar-transition, all 0.2s ease);
7
+ display: inline-flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ font-weight: var(--avatar-font-weight);
11
+ color: var(--avatar-color);
12
+ background-color: var(--avatar-bg);
13
+ border: 2px solid var(--avatar-border);
14
+ position: relative;
15
+ z-index: 0;
16
+ transition: var(--avatar-transition);
17
+ overflow: visible;
18
+ user-select: none;
19
+ &.circle {
20
+ border-radius: 50%;
21
+ }
22
+ &.square {
23
+ border-radius: 6px;
24
+ }
25
+ &.xsmall {
26
+ width: 24px;
27
+ height: 24px;
28
+ font-size: 10px;
29
+ .avatar-icon { font-size: 0.75rem; }
30
+ }
31
+ &.small {
32
+ width: 28px;
33
+ height: 28px;
34
+ font-size: 12px;
35
+ .avatar-icon { font-size: 0.875rem; }
36
+ }
37
+ &.normal {
38
+ width: 32px;
39
+ height: 32px;
40
+ font-size: 14px;
41
+ .avatar-icon { font-size: 1rem; }
42
+ }
43
+ &.large {
44
+ width: 48px;
45
+ height: 48px;
46
+ font-size: 18px;
47
+ .avatar-icon { font-size: 1.25rem; }
48
+ }
49
+ &.xlarge {
50
+ width: 64px;
51
+ height: 64px;
52
+ font-size: 22px;
53
+ .avatar-icon { font-size: 1.5rem; }
54
+ }
55
+ &.clickable {
56
+ cursor: pointer;
57
+ &:hover:not(.disabled) {
58
+ transform: scale(1.05);
59
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
60
+ }
61
+ &:focus {
62
+ outline: 2px solid var(--magary-focus-color, #3b82f6);
63
+ outline-offset: 2px;
64
+ }
65
+ &:active:not(.disabled) {
66
+ transform: scale(0.98);
67
+ }
68
+ }
69
+ &.loading {
70
+ opacity: 0.7;
71
+ cursor: wait;
72
+ }
73
+ &.disabled {
74
+ opacity: 0.5;
75
+ cursor: not-allowed;
76
+ pointer-events: none;
77
+ }
78
+ &.has-image .avatar-img {
79
+ opacity: 1;
80
+ }
81
+ &.has-icon .avatar-icon {
82
+ opacity: 1;
83
+ }
84
+ &.has-label .avatar-label {
85
+ opacity: 1;
86
+ }
87
+ .avatar-img {
88
+ width: 100%;
89
+ height: 100%;
90
+ object-fit: cover;
91
+ transition: opacity 0.2s ease;
92
+ overflow: hidden;
93
+ &.circle {
94
+ border-radius: 50%;
95
+ }
96
+ &.square {
97
+ border-radius: 4px;
98
+ }
99
+ }
100
+ .avatar-icon {
101
+ opacity: 0.9;
102
+ transition: opacity 0.2s ease;
103
+ }
104
+ .avatar-label {
105
+ font-weight: inherit;
106
+ letter-spacing: 0.5px;
107
+ transition: opacity 0.2s ease;
108
+ }
109
+ .avatar-loading {
110
+ display: flex;
111
+ align-items: center;
112
+ justify-content: center;
113
+ width: 100%;
114
+ height: 100%;
115
+ i {
116
+ font-size: 1rem;
117
+ opacity: 0.7;
118
+ }
119
+ }
120
+ .badge {
121
+ position: absolute;
122
+ top: -6px;
123
+ right: -6px;
124
+ background-color: #ef4444;
125
+ border: 2px solid white;
126
+ border-radius: 999px;
127
+ color: white;
128
+ padding: 0 6px;
129
+ font-size: 10px;
130
+ font-weight: bold;
131
+ min-width: 18px;
132
+ height: 18px;
133
+ display: flex;
134
+ align-items: center;
135
+ justify-content: center;
136
+ cursor: pointer;
137
+ transition: transform 0.2s ease;
138
+ z-index: 999;
139
+ &:hover {
140
+ transform: scale(1.1);
141
+ }
142
+ &.info {
143
+ background-color: #3b82f6;
144
+ }
145
+ &.success {
146
+ background-color: #10b981;
147
+ }
148
+ &.warning {
149
+ background-color: #f59e0b;
150
+ }
151
+ &.danger {
152
+ background-color: #ef4444;
153
+ }
154
+ }
155
+ @media (max-width: 640px) {
156
+ &.large {
157
+ width: 40px;
158
+ height: 40px;
159
+ font-size: 16px;
160
+ }
161
+ &.xlarge {
162
+ width: 52px;
163
+ height: 52px;
164
+ font-size: 20px;
165
+ }
166
+ }
167
+ }
@@ -0,0 +1,18 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+ import { Avatar } from './avatar';
3
+ describe('Avatar', () => {
4
+ let component: Avatar;
5
+ let fixture: ComponentFixture<Avatar>;
6
+ beforeEach(async () => {
7
+ await TestBed.configureTestingModule({
8
+ imports: [Avatar]
9
+ })
10
+ .compileComponents();
11
+ fixture = TestBed.createComponent(Avatar);
12
+ component = fixture.componentInstance;
13
+ fixture.detectChanges();
14
+ });
15
+ it('should create', () => {
16
+ expect(component).toBeTruthy();
17
+ });
18
+ });
@@ -0,0 +1,93 @@
1
+ import { CommonModule } from '@angular/common';
2
+ import { Component, input, output, signal, computed } from '@angular/core';
3
+ export type AvatarShape = 'circle' | 'square';
4
+ export type AvatarSize = 'xsmall' | 'small' | 'normal' | 'large' | 'xlarge';
5
+ export type BadgeSeverity = 'info' | 'success' | 'warning' | 'danger';
6
+ export interface AvatarClickEvent {
7
+ type: 'avatar' | 'badge';
8
+ data?: any;
9
+ }
10
+ @Component({
11
+ selector: 'magary-avatar',
12
+ imports: [CommonModule],
13
+ templateUrl: './avatar.html',
14
+ styleUrl: './avatar.scss',
15
+ })
16
+ export class MagaryAvatar {
17
+ public label = input<string>();
18
+ public image = input<string>();
19
+ public icon = input<string>();
20
+ public shape = input<AvatarShape>('square');
21
+ public size = input<AvatarSize>('normal');
22
+ public badgeValue = input<string | number>();
23
+ public badgeSeverity = input<BadgeSeverity>('danger');
24
+ public customStyle = input<Record<string, any>>();
25
+ public alt = input<string>('Avatar');
26
+ public clickable = input<boolean>(false);
27
+ public loading = input<boolean>(false);
28
+ public disabled = input<boolean>(false);
29
+ public avatarClick = output<AvatarClickEvent>();
30
+ public imageError = signal<boolean>(false);
31
+ public displayLabel = computed(() => {
32
+ const label = this.label();
33
+ if (!label) return '';
34
+ if (label.includes(' ')) {
35
+ return label
36
+ .split(' ')
37
+ .map((word) => word.charAt(0))
38
+ .join('')
39
+ .toUpperCase()
40
+ .slice(0, 2);
41
+ }
42
+ return label.toUpperCase().slice(0, 2);
43
+ });
44
+ public avatarClasses = computed(() => ({
45
+ [this.size()]: true,
46
+ [this.shape()]: true,
47
+ clickable: this.clickable(),
48
+ loading: this.loading(),
49
+ disabled: this.disabled(),
50
+ 'has-image': !!this.image() && !this.imageError(),
51
+ 'has-icon': !this.image() && !!this.icon(),
52
+ 'has-label': !this.image() && !this.icon() && !!this.label(),
53
+ }));
54
+ public shouldShowImage = computed(() => {
55
+ return this.image() && !this.imageError();
56
+ });
57
+ public shouldShowIcon = computed(() => {
58
+ return !this.shouldShowImage() && !!this.icon();
59
+ });
60
+ public shouldShowLabel = computed(() => {
61
+ return (
62
+ !this.shouldShowImage() && !this.shouldShowIcon() && !!this.displayLabel()
63
+ );
64
+ });
65
+ onImageError(): void {
66
+ this.imageError.set(true);
67
+ }
68
+ onImageLoad(): void {
69
+ this.imageError.set(false);
70
+ }
71
+ onAvatarClick(): void {
72
+ if (this.disabled() || this.loading()) return;
73
+ this.avatarClick.emit({
74
+ type: 'avatar',
75
+ data: {
76
+ label: this.label(),
77
+ image: this.image(),
78
+ icon: this.icon(),
79
+ },
80
+ });
81
+ }
82
+ onBadgeClick(event: Event): void {
83
+ if (this.disabled() || this.loading()) return;
84
+ event.stopPropagation();
85
+ this.avatarClick.emit({
86
+ type: 'badge',
87
+ data: {
88
+ value: this.badgeValue(),
89
+ severity: this.badgeSeverity(),
90
+ },
91
+ });
92
+ }
93
+ }
@@ -0,0 +1,58 @@
1
+ <article
2
+ [ngClass]="cardClasses()"
3
+ [ngStyle]="cardStyles()"
4
+ [attr.role]="clickable() ? 'button' : 'region'"
5
+ [attr.tabindex]="isInteractive() ? '0' : null"
6
+ [attr.aria-label]="
7
+ 'Card with ' +
8
+ (hasImage() ? 'image and ' : '') +
9
+ 'content' +
10
+ (clickable() ? '. Clickable' : '') +
11
+ (loading() ? '. Loading' : '') +
12
+ (disabled() ? '. Disabled' : '')
13
+ "
14
+ [attr.aria-disabled]="disabled() ? 'true' : null"
15
+ [attr.aria-busy]="loading() ? 'true' : null"
16
+ (click)="onCardClick($event)"
17
+ (keydown)="onCardKeydown($event)"
18
+ >
19
+ @if (hasImage()) {
20
+ <div class="card-image-container">
21
+ <img
22
+ [src]="img()"
23
+ [ngClass]="imageClasses()"
24
+ [ngStyle]="imageStyles()"
25
+ [alt]="altText()"
26
+ loading="lazy"
27
+ decoding="async"
28
+ />
29
+ </div>
30
+ }
31
+ <div class="card-content" [attr.aria-label]="'Card content'">
32
+ <div class="card-body">
33
+ @if (true) {
34
+ <header class="card-header" role="banner">
35
+ <ng-content select="[slot='header']"></ng-content>
36
+ </header>
37
+ }
38
+ <main class="card-main" role="main">
39
+ <ng-content></ng-content>
40
+ </main>
41
+ @if (true) {
42
+ <footer class="card-footer" role="contentinfo">
43
+ <ng-content select="[slot='footer']"></ng-content>
44
+ </footer>
45
+ }
46
+ </div>
47
+ </div>
48
+ @if (showLoadingOverlay()) {
49
+ <div
50
+ class="card-loading-overlay"
51
+ role="status"
52
+ [attr.aria-label]="loadingText()"
53
+ >
54
+ <div class="loading-spinner" aria-hidden="true"></div>
55
+ <span class="loading-text">{{ loadingText() }}</span>
56
+ </div>
57
+ }
58
+ </article>
@@ -0,0 +1,9 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MagaryCard } from './card';
4
+ @NgModule({
5
+ declarations: [],
6
+ imports: [CommonModule, MagaryCard],
7
+ exports: [MagaryCard],
8
+ })
9
+ export class CardModule {}