ng-magary 0.0.1 → 0.0.2

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 (63) hide show
  1. package/LICENSE.md +21 -0
  2. package/bun.lock +290 -0
  3. package/ng-package.json +7 -0
  4. package/package.json +11 -12
  5. package/src/lib/Button/button/button.html +29 -0
  6. package/src/lib/Button/button/button.module.ts +9 -0
  7. package/src/lib/Button/button/button.scss +196 -0
  8. package/src/lib/Button/button/button.spec.ts +18 -0
  9. package/src/lib/Button/button/button.ts +72 -0
  10. package/src/lib/Button/speed-dial/speed-dial-item.interface.ts +9 -0
  11. package/src/lib/Button/speed-dial/speed-dial.html +57 -0
  12. package/src/lib/Button/speed-dial/speed-dial.module.ts +8 -0
  13. package/src/lib/Button/speed-dial/speed-dial.scss +247 -0
  14. package/src/lib/Button/speed-dial/speed-dial.spec.ts +18 -0
  15. package/src/lib/Button/speed-dial/speed-dial.ts +106 -0
  16. package/src/lib/Form/cascade-select/cascade-select.html +1 -0
  17. package/src/lib/Form/cascade-select/cascade-select.module.ts +8 -0
  18. package/src/lib/Form/cascade-select/cascade-select.scss +0 -0
  19. package/src/lib/Form/cascade-select/cascade-select.spec.ts +18 -0
  20. package/src/lib/Form/cascade-select/cascade-select.ts +9 -0
  21. package/src/lib/Form/input/input.html +66 -0
  22. package/src/lib/Form/input/input.module.ts +9 -0
  23. package/src/lib/Form/input/input.scss +193 -0
  24. package/src/lib/Form/input/input.spec.ts +22 -0
  25. package/src/lib/Form/input/input.ts +132 -0
  26. package/src/lib/Menu/panelmenu/panelmenu.html +259 -0
  27. package/src/lib/Menu/panelmenu/panelmenu.interface.ts +13 -0
  28. package/src/lib/Menu/panelmenu/panelmenu.module.ts +9 -0
  29. package/src/lib/Menu/panelmenu/panelmenu.scss +177 -0
  30. package/src/lib/Menu/panelmenu/panelmenu.spec.ts +18 -0
  31. package/src/lib/Menu/panelmenu/panelmenu.ts +134 -0
  32. package/src/lib/Menu/sidebar/sidebar.html +85 -0
  33. package/src/lib/Menu/sidebar/sidebar.module.ts +9 -0
  34. package/src/lib/Menu/sidebar/sidebar.scss +153 -0
  35. package/src/lib/Menu/sidebar/sidebar.spec.ts +18 -0
  36. package/src/lib/Menu/sidebar/sidebar.ts +64 -0
  37. package/src/lib/Misc/avatar/avatar.html +44 -0
  38. package/src/lib/Misc/avatar/avatar.module.ts +9 -0
  39. package/src/lib/Misc/avatar/avatar.scss +167 -0
  40. package/src/lib/Misc/avatar/avatar.spec.ts +18 -0
  41. package/src/lib/Misc/avatar/avatar.ts +93 -0
  42. package/src/lib/Panel/card/card.html +58 -0
  43. package/src/lib/Panel/card/card.module.ts +9 -0
  44. package/src/lib/Panel/card/card.scss +290 -0
  45. package/src/lib/Panel/card/card.spec.ts +18 -0
  46. package/src/lib/Panel/card/card.ts +126 -0
  47. package/src/lib/Panel/tabs/tab/tab.spec.ts +18 -0
  48. package/src/lib/Panel/tabs/tab/tab.ts +12 -0
  49. package/src/lib/Panel/tabs/tabs.html +26 -0
  50. package/src/lib/Panel/tabs/tabs.module.ts +10 -0
  51. package/src/lib/Panel/tabs/tabs.scss +58 -0
  52. package/src/lib/Panel/tabs/tabs.spec.ts +18 -0
  53. package/src/lib/Panel/tabs/tabs.ts +57 -0
  54. package/src/lib/ng-magary.spec.ts +18 -0
  55. package/src/lib/ng-magary.ts +43 -0
  56. package/src/public-api.ts +5 -0
  57. package/tsconfig.lib.json +22 -0
  58. package/tsconfig.lib.prod.json +11 -0
  59. package/tsconfig.spec.json +14 -0
  60. package/fesm2022/ng-magary.mjs +0 -811
  61. package/fesm2022/ng-magary.mjs.map +0 -1
  62. package/index.d.ts +0 -422
  63. package/index.d.ts.map +0 -1
@@ -0,0 +1,193 @@
1
+ :host {
2
+ --input-primary: #007bff;
3
+ --input-success: #28a745;
4
+ --input-error: #dc3545;
5
+ --input-border: #ced4da;
6
+ --input-bg: #ffffff;
7
+ --input-text: #495057;
8
+ --input-placeholder: #6c757d;
9
+ --input-radius: 6px;
10
+ --input-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
11
+ }
12
+
13
+ .magary-input-container {
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 6px;
17
+ font-family: inherit;
18
+ }
19
+
20
+ .input-label {
21
+ font-weight: 500;
22
+ color: var(--input-text);
23
+ font-size: 0.875rem;
24
+ margin-bottom: 2px;
25
+
26
+ .required-asterisk {
27
+ color: var(--input-error);
28
+ margin-left: 2px;
29
+ }
30
+ }
31
+
32
+ .input-wrapper {
33
+ position: relative;
34
+ display: flex;
35
+ align-items: center;
36
+ }
37
+
38
+ .magary-input-field {
39
+ width: 100%;
40
+ border: 1px solid var(--input-border);
41
+ border-radius: var(--input-radius);
42
+ background: var(--input-bg);
43
+ color: var(--input-text);
44
+ font-size: 1rem;
45
+ transition: all 0.15s ease-in-out;
46
+ outline: none;
47
+
48
+ &::placeholder {
49
+ color: var(--input-placeholder);
50
+ }
51
+
52
+ &:focus {
53
+ border-color: var(--input-primary);
54
+ box-shadow: var(--input-shadow);
55
+ }
56
+
57
+ &.input-small {
58
+ padding: 6px 12px;
59
+ font-size: 0.875rem;
60
+ }
61
+
62
+ &.input-normal {
63
+ padding: 8px 16px;
64
+ }
65
+
66
+ &.input-large {
67
+ padding: 12px 20px;
68
+ font-size: 1.125rem;
69
+ }
70
+
71
+ &.input-outlined {
72
+ border: 2px solid var(--input-border);
73
+ background: var(--input-bg);
74
+ }
75
+
76
+ &.input-filled {
77
+ border: none;
78
+ background: #f8f9fa;
79
+ border-bottom: 2px solid var(--input-border);
80
+ border-radius: var(--input-radius) var(--input-radius) 0 0;
81
+ }
82
+
83
+ &.input-underlined {
84
+ border: none;
85
+ border-bottom: 1px solid var(--input-border);
86
+ border-radius: 0;
87
+ background: transparent;
88
+
89
+ &:focus {
90
+ border-bottom: 2px solid var(--input-primary);
91
+ box-shadow: none;
92
+ }
93
+ }
94
+
95
+ &.input-error {
96
+ border-color: var(--input-error);
97
+
98
+ &:focus {
99
+ border-color: var(--input-error);
100
+ box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
101
+ }
102
+ }
103
+
104
+ &.input-success {
105
+ border-color: var(--input-success);
106
+
107
+ &:focus {
108
+ border-color: var(--input-success);
109
+ box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
110
+ }
111
+ }
112
+
113
+ &.input-disabled {
114
+ background: #e9ecef;
115
+ color: #6c757d;
116
+ cursor: not-allowed;
117
+ opacity: 0.6;
118
+ }
119
+
120
+ &.input-readonly {
121
+ background: #f8f9fa;
122
+ cursor: default;
123
+ }
124
+ }
125
+
126
+ .has-prefix .magary-input-field {
127
+ padding-left: 40px;
128
+ }
129
+
130
+ .has-suffix .magary-input-field {
131
+ padding-right: 40px;
132
+ }
133
+
134
+ .prefix-icon,
135
+ .suffix-icon {
136
+ position: absolute;
137
+ color: var(--input-placeholder);
138
+ transition: color 0.15s ease-in-out;
139
+
140
+ &.clickable {
141
+ cursor: pointer;
142
+
143
+ &:hover {
144
+ color: var(--input-primary);
145
+ }
146
+ }
147
+ }
148
+
149
+ .prefix-icon {
150
+ left: 12px;
151
+ }
152
+
153
+ .suffix-icon {
154
+ right: 12px;
155
+ }
156
+
157
+ .password-toggle {
158
+ cursor: pointer;
159
+
160
+ &:hover {
161
+ color: var(--input-primary);
162
+ }
163
+ }
164
+
165
+ .loading-icon {
166
+ color: var(--input-primary);
167
+ }
168
+
169
+ .input-message {
170
+ margin-top: 4px;
171
+ font-size: 0.875rem;
172
+
173
+ .error-message {
174
+ color: var(--input-error);
175
+ display: flex;
176
+ align-items: center;
177
+ gap: 4px;
178
+ }
179
+
180
+ .help-message {
181
+ color: var(--input-placeholder);
182
+ }
183
+ }
184
+
185
+ @media (max-width: 480px) {
186
+ .magary-input-field {
187
+ font-size: 16px;
188
+ }
189
+
190
+ .input-label {
191
+ font-size: 14px;
192
+ }
193
+ }
@@ -0,0 +1,22 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { MagaryInput } from './input';
4
+
5
+ describe('Input', () => {
6
+ let component: MagaryInput;
7
+ let fixture: ComponentFixture<MagaryInput>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ imports: [MagaryInput],
12
+ }).compileComponents();
13
+
14
+ fixture = TestBed.createComponent(MagaryInput);
15
+ component = fixture.componentInstance;
16
+ fixture.detectChanges();
17
+ });
18
+
19
+ it('should create', () => {
20
+ expect(component).toBeTruthy();
21
+ });
22
+ });
@@ -0,0 +1,132 @@
1
+ import { Component, computed, input, output, signal } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { FormsModule } from '@angular/forms';
4
+
5
+ export type InputType =
6
+ | 'text'
7
+ | 'email'
8
+ | 'password'
9
+ | 'number'
10
+ | 'tel'
11
+ | 'url'
12
+ | 'search';
13
+
14
+ export type InputSize = 'small' | 'normal' | 'large';
15
+
16
+ export type InputVariant = 'filled' | 'outlined' | 'underlined';
17
+
18
+ @Component({
19
+ selector: 'magary-input',
20
+ imports: [CommonModule, FormsModule],
21
+ templateUrl: './input.html',
22
+ styleUrl: './input.scss',
23
+ })
24
+ export class MagaryInput {
25
+ value = input<string>('');
26
+ placeholder = input<string>('');
27
+ type = input<InputType>('text');
28
+ size = input<InputSize>('normal');
29
+ variant = input<InputVariant>('outlined');
30
+
31
+ disabled = input<boolean>(false);
32
+ readonly = input<boolean>(false);
33
+ required = input<boolean>(false);
34
+ loading = input<boolean>(false);
35
+
36
+ error = input<string>('');
37
+ success = input<boolean>(false);
38
+
39
+ label = input<string>('');
40
+ helpText = input<string>('');
41
+
42
+ prefixIcon = input<string>('');
43
+ suffixIcon = input<string>('');
44
+
45
+ width = input<string>('100%');
46
+ maxLength = input<number | undefined>(undefined);
47
+
48
+ valueChange = output<string>();
49
+ inputFocus = output<Event>();
50
+ inputBlur = output<Event>();
51
+ iconClick = output<'prefix' | 'suffix'>();
52
+
53
+ private focused = signal(false);
54
+ private showPassword = signal(false);
55
+ private readonly uniqueId = `magary-input-${Math.random().toString(36).substr(2, 9)}`;
56
+
57
+ inputClasses = computed(() => {
58
+ const classes = ['magary-input-field'];
59
+ classes.push(`input-${this.variant()}`);
60
+ classes.push(`input-${this.size()}`);
61
+
62
+ if (this.disabled()) classes.push('input-disabled');
63
+ if (this.readonly()) classes.push('input-readonly');
64
+ if (this.error()) classes.push('input-error');
65
+ if (this.success()) classes.push('input-success');
66
+ if (this.focused()) classes.push('input-focused');
67
+ if (this.loading()) classes.push('input-loading');
68
+
69
+ return classes.join(' ');
70
+ });
71
+
72
+ containerClasses = computed(() => {
73
+ const classes = ['magary-input-container'];
74
+ if (this.label()) classes.push('has-label');
75
+ if (this.prefixIcon()) classes.push('has-prefix');
76
+ if (this.suffixIcon() || this.type() === 'password')
77
+ classes.push('has-suffix');
78
+ return classes.join(' ');
79
+ });
80
+
81
+ inputStyles = computed(() => ({
82
+ width: this.width(),
83
+ }));
84
+
85
+ actualType = computed(() => {
86
+ if (this.type() === 'password') {
87
+ return this.showPassword() ? 'text' : 'password';
88
+ }
89
+ return this.type();
90
+ });
91
+
92
+ passwordIcon = computed(() => {
93
+ return this.showPassword() ? 'fas fa-eye-slash' : 'fas fa-eye';
94
+ });
95
+
96
+ onInput(event: Event): void {
97
+ const target = event.target as HTMLInputElement;
98
+ this.valueChange.emit(target.value);
99
+ }
100
+
101
+ onFocus(event: Event): void {
102
+ this.focused.set(true);
103
+ this.inputFocus.emit(event);
104
+ }
105
+
106
+ onBlur(event: Event): void {
107
+ this.focused.set(false);
108
+ this.inputBlur.emit(event);
109
+ }
110
+
111
+ onPrefixIconClick(): void {
112
+ if (!this.disabled()) {
113
+ this.iconClick.emit('prefix');
114
+ }
115
+ }
116
+
117
+ onSuffixIconClick(): void {
118
+ if (!this.disabled()) {
119
+ this.iconClick.emit('suffix');
120
+ }
121
+ }
122
+
123
+ togglePasswordVisibility(): void {
124
+ if (this.type() === 'password') {
125
+ this.showPassword.set(!this.showPassword());
126
+ }
127
+ }
128
+
129
+ getId(): string {
130
+ return this.uniqueId;
131
+ }
132
+ }
@@ -0,0 +1,259 @@
1
+ <div
2
+ class="panel-menu"
3
+ [ngClass]="['shadow-' + shadow()]"
4
+ [class.open]="isOpen()"
5
+ [ngStyle]="panelStyles()"
6
+ >
7
+ <div
8
+ class="panel-header"
9
+ [class.header-hovered]="hoveredHeader()"
10
+ (click)="toggle()"
11
+ (mouseenter)="onHeaderHover(true)"
12
+ (mouseleave)="onHeaderHover(false)"
13
+ >
14
+ {{ title() }}
15
+ <span class="arrow" [class.open]="isOpen()">
16
+ <i class="fas fa-chevron-down"></i>
17
+ </span>
18
+ </div>
19
+ <ul class="panel-items" [class.expanded]="isOpen()">
20
+ @for (item of items(); track getItemId(item, $index)) {
21
+ <li class="menu-item">
22
+ @if (hasChildren(item)) {
23
+ <div
24
+ class="category-item"
25
+ [class.item-hovered]="isItemHovered(getItemId(item, $index))"
26
+ [class.disabled]="isItemDisabled(item)"
27
+ (click)="
28
+ !isItemDisabled(item) &&
29
+ toggleSubItem(getUniqueItemKey(item), item)
30
+ "
31
+ (mouseenter)="onItemHover(getItemId(item, $index))"
32
+ (mouseleave)="onItemLeave()"
33
+ >
34
+ @if (item.icon) {
35
+ <i [class]="item.icon" class="item-icon"></i>
36
+ }
37
+ <span class="item-label">{{ item.label }}</span>
38
+ <span
39
+ class="sub-arrow"
40
+ [class.expanded]="isSubItemExpanded(getUniqueItemKey(item))"
41
+ >
42
+ <i
43
+ class="fas"
44
+ [ngClass]="
45
+ isSubItemExpanded(getUniqueItemKey(item))
46
+ ? 'fa-minus'
47
+ : 'fa-plus'
48
+ "
49
+ ></i>
50
+ </span>
51
+ </div>
52
+ <ul
53
+ class="sub-items"
54
+ [class.expanded]="isSubItemExpanded(getUniqueItemKey(item))"
55
+ >
56
+ @for (
57
+ subItem of item.children;
58
+ track subItem.label + "-" + $index
59
+ ) {
60
+ <li>
61
+ @if (hasChildren(subItem)) {
62
+ <div
63
+ class="sub-category-item"
64
+ [class.item-hovered]="
65
+ isItemHovered(subItem.label + '-sub-' + $index)
66
+ "
67
+ [class.disabled]="isItemDisabled(subItem)"
68
+ (click)="
69
+ !isItemDisabled(subItem) &&
70
+ toggleSubItem(
71
+ getUniqueItemKey(subItem, getUniqueItemKey(item)),
72
+ subItem
73
+ )
74
+ "
75
+ (mouseenter)="onItemHover(subItem.label + '-sub-' + $index)"
76
+ (mouseleave)="onItemLeave()"
77
+ >
78
+ @if (subItem.icon) {
79
+ <i [class]="subItem.icon" class="item-icon"></i>
80
+ }
81
+ <span class="item-label">{{ subItem.label }}</span>
82
+ <span
83
+ class="sub-arrow"
84
+ [class.expanded]="
85
+ isSubItemExpanded(
86
+ getUniqueItemKey(subItem, getUniqueItemKey(item))
87
+ )
88
+ "
89
+ >
90
+ <i
91
+ class="fas"
92
+ [ngClass]="
93
+ isSubItemExpanded(
94
+ getUniqueItemKey(subItem, getUniqueItemKey(item))
95
+ )
96
+ ? 'fa-minus'
97
+ : 'fa-plus'
98
+ "
99
+ ></i>
100
+ </span>
101
+ </div>
102
+ <ul
103
+ class="sub-sub-items"
104
+ [class.expanded]="
105
+ isSubItemExpanded(
106
+ getUniqueItemKey(subItem, getUniqueItemKey(item))
107
+ )
108
+ "
109
+ >
110
+ @for (
111
+ subSubItem of subItem.children;
112
+ track subSubItem.label + "-" + $index
113
+ ) {
114
+ <li>
115
+ @if (subSubItem.route) {
116
+ <a
117
+ [routerLink]="subSubItem.route"
118
+ [class.item-hovered]="
119
+ isItemHovered(
120
+ subSubItem.label + '-subsub-' + $index
121
+ )
122
+ "
123
+ [class.disabled]="isItemDisabled(subSubItem)"
124
+ (click)="
125
+ onItemClick(subSubItem, 2, [
126
+ item.label,
127
+ subItem.label,
128
+ ])
129
+ "
130
+ (mouseenter)="
131
+ onItemHover(
132
+ subSubItem.label + '-subsub-' + $index
133
+ )
134
+ "
135
+ (mouseleave)="onItemLeave()"
136
+ >
137
+ @if (subSubItem.icon) {
138
+ <i
139
+ [class]="subSubItem.icon"
140
+ class="item-icon"
141
+ ></i>
142
+ }
143
+ {{ subSubItem.label }}
144
+ </a>
145
+ } @else {
146
+ <div
147
+ class="menu-item-base"
148
+ [class.item-hovered]="
149
+ isItemHovered(
150
+ subSubItem.label + '-subsub-' + $index
151
+ )
152
+ "
153
+ [class.disabled]="isItemDisabled(subSubItem)"
154
+ (click)="
155
+ !isItemDisabled(subSubItem) &&
156
+ onItemClick(subSubItem, 2, [
157
+ item.label,
158
+ subItem.label,
159
+ ])
160
+ "
161
+ (mouseenter)="
162
+ onItemHover(
163
+ subSubItem.label + '-subsub-' + $index
164
+ )
165
+ "
166
+ (mouseleave)="onItemLeave()"
167
+ >
168
+ @if (subSubItem.icon) {
169
+ <i
170
+ [class]="subSubItem.icon"
171
+ class="item-icon"
172
+ ></i>
173
+ }
174
+ {{ subSubItem.label }}
175
+ </div>
176
+ }
177
+ </li>
178
+ }
179
+ </ul>
180
+ } @else {
181
+ @if (subItem.route) {
182
+ <a
183
+ [routerLink]="subItem.route"
184
+ [class.item-hovered]="
185
+ isItemHovered(subItem.label + '-sub-' + $index)
186
+ "
187
+ [class.disabled]="isItemDisabled(subItem)"
188
+ (click)="onItemClick(subItem, 1, [item.label])"
189
+ (mouseenter)="
190
+ onItemHover(subItem.label + '-sub-' + $index)
191
+ "
192
+ (mouseleave)="onItemLeave()"
193
+ >
194
+ @if (subItem.icon) {
195
+ <i [class]="subItem.icon" class="item-icon"></i>
196
+ }
197
+ {{ subItem.label }}
198
+ </a>
199
+ } @else {
200
+ <div
201
+ class="menu-item-base"
202
+ [class.item-hovered]="
203
+ isItemHovered(subItem.label + '-sub-' + $index)
204
+ "
205
+ [class.disabled]="isItemDisabled(subItem)"
206
+ (click)="
207
+ !isItemDisabled(subItem) &&
208
+ onItemClick(subItem, 1, [item.label])
209
+ "
210
+ (mouseenter)="
211
+ onItemHover(subItem.label + '-sub-' + $index)
212
+ "
213
+ (mouseleave)="onItemLeave()"
214
+ >
215
+ @if (subItem.icon) {
216
+ <i [class]="subItem.icon" class="item-icon"></i>
217
+ }
218
+ {{ subItem.label }}
219
+ </div>
220
+ }
221
+ }
222
+ </li>
223
+ }
224
+ </ul>
225
+ } @else {
226
+ @if (item.route) {
227
+ <a
228
+ [routerLink]="item.route"
229
+ [class.item-hovered]="isItemHovered(getItemId(item, $index))"
230
+ [class.disabled]="isItemDisabled(item)"
231
+ (click)="onItemClick(item, 0)"
232
+ (mouseenter)="onItemHover(getItemId(item, $index))"
233
+ (mouseleave)="onItemLeave()"
234
+ >
235
+ @if (item.icon) {
236
+ <i [class]="item.icon" class="item-icon"></i>
237
+ }
238
+ {{ item.label }}
239
+ </a>
240
+ } @else {
241
+ <div
242
+ class="menu-item-base"
243
+ [class.item-hovered]="isItemHovered(getItemId(item, $index))"
244
+ [class.disabled]="isItemDisabled(item)"
245
+ (click)="!isItemDisabled(item) && onItemClick(item, 0)"
246
+ (mouseenter)="onItemHover(getItemId(item, $index))"
247
+ (mouseleave)="onItemLeave()"
248
+ >
249
+ @if (item.icon) {
250
+ <i [class]="item.icon" class="item-icon"></i>
251
+ }
252
+ {{ item.label }}
253
+ </div>
254
+ }
255
+ }
256
+ </li>
257
+ }
258
+ </ul>
259
+ </div>
@@ -0,0 +1,13 @@
1
+ export interface MenuItem {
2
+ label: string;
3
+ route?: string;
4
+ icon?: string;
5
+ children?: MenuItem[];
6
+ }
7
+ export interface NavigationItem {
8
+ label: string;
9
+ route?: string;
10
+ icon?: string;
11
+ isCategory?: boolean;
12
+ children?: NavigationItem[];
13
+ }
@@ -0,0 +1,9 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { MagaryPanelmenu } from './panelmenu';
4
+ import { RouterModule } from '@angular/router';
5
+ @NgModule({
6
+ imports: [CommonModule, MagaryPanelmenu, RouterModule],
7
+ exports: [MagaryPanelmenu],
8
+ })
9
+ export class PanelmenuModule {}