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.
- package/LICENSE.md +21 -0
- package/README.md +166 -32
- package/bun.lock +290 -0
- package/ng-package.json +7 -0
- package/package.json +11 -12
- package/src/lib/Button/button/button.html +29 -0
- package/src/lib/Button/button/button.module.ts +9 -0
- package/src/lib/Button/button/button.scss +196 -0
- package/src/lib/Button/button/button.spec.ts +18 -0
- package/src/lib/Button/button/button.ts +72 -0
- package/src/lib/Button/speed-dial/speed-dial-item.interface.ts +9 -0
- package/src/lib/Button/speed-dial/speed-dial.html +57 -0
- package/src/lib/Button/speed-dial/speed-dial.module.ts +8 -0
- package/src/lib/Button/speed-dial/speed-dial.scss +247 -0
- package/src/lib/Button/speed-dial/speed-dial.spec.ts +18 -0
- package/src/lib/Button/speed-dial/speed-dial.ts +106 -0
- package/src/lib/Form/cascade-select/cascade-select.html +1 -0
- package/src/lib/Form/cascade-select/cascade-select.module.ts +8 -0
- package/src/lib/Form/cascade-select/cascade-select.scss +0 -0
- package/src/lib/Form/cascade-select/cascade-select.spec.ts +18 -0
- package/src/lib/Form/cascade-select/cascade-select.ts +9 -0
- package/src/lib/Form/input/input.html +66 -0
- package/src/lib/Form/input/input.module.ts +9 -0
- package/src/lib/Form/input/input.scss +193 -0
- package/src/lib/Form/input/input.spec.ts +22 -0
- package/src/lib/Form/input/input.ts +132 -0
- package/src/lib/Menu/panelmenu/panelmenu.html +259 -0
- package/src/lib/Menu/panelmenu/panelmenu.interface.ts +13 -0
- package/src/lib/Menu/panelmenu/panelmenu.module.ts +9 -0
- package/src/lib/Menu/panelmenu/panelmenu.scss +177 -0
- package/src/lib/Menu/panelmenu/panelmenu.spec.ts +18 -0
- package/src/lib/Menu/panelmenu/panelmenu.ts +134 -0
- package/src/lib/Menu/sidebar/sidebar.html +85 -0
- package/src/lib/Menu/sidebar/sidebar.module.ts +9 -0
- package/src/lib/Menu/sidebar/sidebar.scss +153 -0
- package/src/lib/Menu/sidebar/sidebar.spec.ts +18 -0
- package/src/lib/Menu/sidebar/sidebar.ts +64 -0
- package/src/lib/Misc/avatar/avatar.html +44 -0
- package/src/lib/Misc/avatar/avatar.module.ts +9 -0
- package/src/lib/Misc/avatar/avatar.scss +167 -0
- package/src/lib/Misc/avatar/avatar.spec.ts +18 -0
- package/src/lib/Misc/avatar/avatar.ts +93 -0
- package/src/lib/Panel/card/card.html +58 -0
- package/src/lib/Panel/card/card.module.ts +9 -0
- package/src/lib/Panel/card/card.scss +290 -0
- package/src/lib/Panel/card/card.spec.ts +18 -0
- package/src/lib/Panel/card/card.ts +126 -0
- package/src/lib/Panel/tabs/tab/tab.spec.ts +18 -0
- package/src/lib/Panel/tabs/tab/tab.ts +12 -0
- package/src/lib/Panel/tabs/tabs.html +26 -0
- package/src/lib/Panel/tabs/tabs.module.ts +10 -0
- package/src/lib/Panel/tabs/tabs.scss +58 -0
- package/src/lib/Panel/tabs/tabs.spec.ts +18 -0
- package/src/lib/Panel/tabs/tabs.ts +57 -0
- package/src/lib/ng-magary.spec.ts +18 -0
- package/src/lib/ng-magary.ts +43 -0
- package/src/public-api.ts +5 -0
- package/tsconfig.lib.json +22 -0
- package/tsconfig.lib.prod.json +11 -0
- package/tsconfig.spec.json +14 -0
- package/fesm2022/ng-magary.mjs +0 -811
- package/fesm2022/ng-magary.mjs.map +0 -1
- package/index.d.ts +0 -422
- package/index.d.ts.map +0 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<button
|
|
2
|
+
type="button"
|
|
3
|
+
[disabled]="isDisabled()"
|
|
4
|
+
[ngStyle]="buttonStyles()"
|
|
5
|
+
[ngClass]="buttonClasses()"
|
|
6
|
+
[attr.aria-label]="effectiveAriaLabel()"
|
|
7
|
+
[attr.aria-busy]="loading() ? 'true' : null"
|
|
8
|
+
[attr.aria-disabled]="isDisabled() ? 'true' : null"
|
|
9
|
+
(click)="onButtonClick($event)"
|
|
10
|
+
>
|
|
11
|
+
@if (loading()) {
|
|
12
|
+
<span
|
|
13
|
+
class="p-button-loading-icon fas fa-spinner fa-spin"
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
>
|
|
16
|
+
</span>
|
|
17
|
+
}
|
|
18
|
+
@if (icon() && !loading() && iconPos() === "left") {
|
|
19
|
+
<span class="p-button-icon" [ngClass]="icon()" aria-hidden="true"> </span>
|
|
20
|
+
}
|
|
21
|
+
@if (label()) {
|
|
22
|
+
<span class="p-button-label">{{ label() }}</span>
|
|
23
|
+
} @else if (!icon()) {
|
|
24
|
+
<span class="p-button-label"> </span>
|
|
25
|
+
}
|
|
26
|
+
@if (icon() && !loading() && iconPos() === "right") {
|
|
27
|
+
<span class="p-button-icon" [ngClass]="icon()" aria-hidden="true"> </span>
|
|
28
|
+
}
|
|
29
|
+
</button>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { MagaryButton } from './button';
|
|
4
|
+
@NgModule({
|
|
5
|
+
declarations: [],
|
|
6
|
+
imports: [CommonModule, MagaryButton],
|
|
7
|
+
exports: [MagaryButton],
|
|
8
|
+
})
|
|
9
|
+
export class ButtonModule {}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
$button-variants: (
|
|
3
|
+
primary: (#020617, #3b3c3d),
|
|
4
|
+
secondary: (#d2d3d4, #d8dbdd),
|
|
5
|
+
success: (#22c55e, #54cc80),
|
|
6
|
+
danger: (#ef4444, #ce3c3c),
|
|
7
|
+
info: (#0ea5e9, #3d97c0),
|
|
8
|
+
warning: (#e7c52d, #c4aa3a),
|
|
9
|
+
help: (#a855f7, #854dbd),
|
|
10
|
+
);
|
|
11
|
+
.p-button {
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
padding: 0.75rem 1.25rem;
|
|
16
|
+
border-radius: 6px;
|
|
17
|
+
border: 1px solid transparent;
|
|
18
|
+
font-weight: bold;
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
|
|
21
|
+
gap: 0.5rem;
|
|
22
|
+
background-color: #007bff;
|
|
23
|
+
color: #ffffff;
|
|
24
|
+
min-height: 44px;
|
|
25
|
+
font-size: 1rem;
|
|
26
|
+
&:hover {
|
|
27
|
+
background-color: #0056b3;
|
|
28
|
+
}
|
|
29
|
+
&:disabled {
|
|
30
|
+
opacity: 0.6;
|
|
31
|
+
cursor: not-allowed;
|
|
32
|
+
}
|
|
33
|
+
&.p-button-icon-right {
|
|
34
|
+
flex-direction: row-reverse;
|
|
35
|
+
}
|
|
36
|
+
&.p-button-icon-only {
|
|
37
|
+
padding: 10px;
|
|
38
|
+
min-width: 44px;
|
|
39
|
+
}
|
|
40
|
+
&.p-button-loading {
|
|
41
|
+
position: relative;
|
|
42
|
+
.p-button-label,
|
|
43
|
+
.p-button-icon {
|
|
44
|
+
visibility: hidden;
|
|
45
|
+
}
|
|
46
|
+
.p-button-loading-icon {
|
|
47
|
+
position: absolute;
|
|
48
|
+
font-size: 1.2rem;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
&.p-button-text {
|
|
52
|
+
background-color: transparent;
|
|
53
|
+
border-color: transparent;
|
|
54
|
+
color: #007bff;
|
|
55
|
+
&:hover {
|
|
56
|
+
background-color: rgba(0, 123, 255, 0.05);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
&.p-button-outlined {
|
|
60
|
+
background-color: transparent;
|
|
61
|
+
border: 2px solid;
|
|
62
|
+
color: #007bff;
|
|
63
|
+
&:hover {
|
|
64
|
+
background-color: #007bff;
|
|
65
|
+
color: #ffffff;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
&.p-button-small {
|
|
69
|
+
padding: 0.5rem 0.875rem;
|
|
70
|
+
font-size: 0.875rem;
|
|
71
|
+
min-height: 36px;
|
|
72
|
+
gap: 0.375rem;
|
|
73
|
+
&.p-button-icon-only {
|
|
74
|
+
padding: 6px;
|
|
75
|
+
min-width: 36px;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
&.p-button-normal {
|
|
79
|
+
padding: 0.75rem 1.25rem;
|
|
80
|
+
font-size: 1rem;
|
|
81
|
+
min-height: 44px;
|
|
82
|
+
gap: 0.5rem;
|
|
83
|
+
&.p-button-icon-only {
|
|
84
|
+
padding: 10px;
|
|
85
|
+
min-width: 44px;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
&.p-button-large {
|
|
89
|
+
padding: 1rem 1.75rem;
|
|
90
|
+
font-size: 1.125rem;
|
|
91
|
+
min-height: 52px;
|
|
92
|
+
gap: 0.625rem;
|
|
93
|
+
&.p-button-icon-only {
|
|
94
|
+
padding: 14px;
|
|
95
|
+
min-width: 52px;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
@media (max-width: 768px) {
|
|
99
|
+
&.p-button-small {
|
|
100
|
+
padding: 0.375rem 0.75rem;
|
|
101
|
+
font-size: 0.8rem;
|
|
102
|
+
min-height: 32px;
|
|
103
|
+
&.p-button-icon-only {
|
|
104
|
+
padding: 5px;
|
|
105
|
+
min-width: 32px;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
&.p-button-normal {
|
|
109
|
+
padding: 0.625rem 1rem;
|
|
110
|
+
font-size: 0.9rem;
|
|
111
|
+
min-height: 40px;
|
|
112
|
+
&.p-button-icon-only {
|
|
113
|
+
padding: 8px;
|
|
114
|
+
min-width: 40px;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
&.p-button-large {
|
|
118
|
+
padding: 0.875rem 1.5rem;
|
|
119
|
+
font-size: 1rem;
|
|
120
|
+
min-height: 48px;
|
|
121
|
+
&.p-button-icon-only {
|
|
122
|
+
padding: 12px;
|
|
123
|
+
min-width: 48px;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
@media (max-width: 480px) {
|
|
128
|
+
&.p-button-small {
|
|
129
|
+
padding: 0.25rem 0.625rem;
|
|
130
|
+
font-size: 0.75rem;
|
|
131
|
+
min-height: 28px;
|
|
132
|
+
&.p-button-icon-only {
|
|
133
|
+
padding: 4px;
|
|
134
|
+
min-width: 28px;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
&.p-button-normal {
|
|
138
|
+
padding: 0.5rem 0.875rem;
|
|
139
|
+
font-size: 0.85rem;
|
|
140
|
+
min-height: 36px;
|
|
141
|
+
&.p-button-icon-only {
|
|
142
|
+
padding: 6px;
|
|
143
|
+
min-width: 36px;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
&.p-button-large {
|
|
147
|
+
padding: 0.75rem 1.25rem;
|
|
148
|
+
font-size: 0.95rem;
|
|
149
|
+
min-height: 44px;
|
|
150
|
+
&.p-button-icon-only {
|
|
151
|
+
padding: 10px;
|
|
152
|
+
min-width: 44px;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
@each $name, $colors in $button-variants {
|
|
157
|
+
$bg: list.nth($colors, 1);
|
|
158
|
+
$hover: list.nth($colors, 2);
|
|
159
|
+
&.p-button-#{$name} {
|
|
160
|
+
background-color: $bg;
|
|
161
|
+
color: #ffffff;
|
|
162
|
+
&:hover {
|
|
163
|
+
background-color: $hover;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
&.p-button-text.p-button-#{$name} {
|
|
167
|
+
background-color: transparent;
|
|
168
|
+
color: $bg;
|
|
169
|
+
&:hover {
|
|
170
|
+
background-color: rgba($bg, 0.1);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
&.p-button-outlined.p-button-#{$name} {
|
|
174
|
+
background-color: transparent;
|
|
175
|
+
border-color: $bg;
|
|
176
|
+
color: $bg;
|
|
177
|
+
&:hover {
|
|
178
|
+
background-color: rgba($bg, 0.1);
|
|
179
|
+
color: $bg;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
.pi-spin {
|
|
185
|
+
animation: pi-spin 1s linear infinite;
|
|
186
|
+
}
|
|
187
|
+
@keyframes pi-spin {
|
|
188
|
+
100% {
|
|
189
|
+
transform: rotate(360deg);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
@for $i from 1 through 7 {
|
|
193
|
+
.shadow-#{$i} {
|
|
194
|
+
box-shadow: 0 #{2 + $i * 2}px #{4 + $i * 2}px rgba(0, 0, 0, 0.1 + $i * 0.05);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { Button } from './button';
|
|
3
|
+
describe('Button', () => {
|
|
4
|
+
let component: Button;
|
|
5
|
+
let fixture: ComponentFixture<Button>;
|
|
6
|
+
beforeEach(async () => {
|
|
7
|
+
await TestBed.configureTestingModule({
|
|
8
|
+
imports: [Button]
|
|
9
|
+
})
|
|
10
|
+
.compileComponents();
|
|
11
|
+
fixture = TestBed.createComponent(Button);
|
|
12
|
+
component = fixture.componentInstance;
|
|
13
|
+
fixture.detectChanges();
|
|
14
|
+
});
|
|
15
|
+
it('should create', () => {
|
|
16
|
+
expect(component).toBeTruthy();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
Component,
|
|
4
|
+
computed,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
input,
|
|
7
|
+
output,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
type ButtonSeverity =
|
|
10
|
+
| 'primary'
|
|
11
|
+
| 'secondary'
|
|
12
|
+
| 'success'
|
|
13
|
+
| 'info'
|
|
14
|
+
| 'warning'
|
|
15
|
+
| 'danger'
|
|
16
|
+
| 'help';
|
|
17
|
+
type ButtonVariant = 'solid' | 'text' | 'outlined';
|
|
18
|
+
type ButtonSize = 'small' | 'normal' | 'large';
|
|
19
|
+
type IconPosition = 'left' | 'right';
|
|
20
|
+
type ShadowLevel = 0 | 1 | 2 | 3 | 4 | 5;
|
|
21
|
+
@Component({
|
|
22
|
+
selector: 'magary-button',
|
|
23
|
+
imports: [CommonModule],
|
|
24
|
+
templateUrl: './button.html',
|
|
25
|
+
styleUrl: './button.scss',
|
|
26
|
+
})
|
|
27
|
+
export class MagaryButton {
|
|
28
|
+
readonly label = input<string>();
|
|
29
|
+
readonly icon = input<string>();
|
|
30
|
+
readonly shadow = input<ShadowLevel>(0);
|
|
31
|
+
readonly rounded = input<boolean>(false);
|
|
32
|
+
readonly customBackgroundColor = input<string>();
|
|
33
|
+
readonly iconPos = input<IconPosition>('left');
|
|
34
|
+
readonly severity = input<ButtonSeverity>();
|
|
35
|
+
readonly loading = input<boolean>(false);
|
|
36
|
+
readonly disabled = input<boolean>(false);
|
|
37
|
+
readonly variant = input<ButtonVariant>('solid');
|
|
38
|
+
readonly size = input<ButtonSize>('normal');
|
|
39
|
+
readonly ariaLabel = input<string>();
|
|
40
|
+
readonly buttonClick = output<Event>();
|
|
41
|
+
readonly isDisabled = computed(() => this.disabled() || this.loading());
|
|
42
|
+
readonly buttonClasses = computed(() =>
|
|
43
|
+
[
|
|
44
|
+
'p-button',
|
|
45
|
+
`shadow-${this.shadow()}`,
|
|
46
|
+
`p-button-${this.size()}`,
|
|
47
|
+
this.severity() ? `p-button-${this.severity()}` : '',
|
|
48
|
+
this.variant() === 'text' ? 'p-button-text' : '',
|
|
49
|
+
this.variant() === 'outlined' ? 'p-button-outlined' : '',
|
|
50
|
+
this.icon() && !this.label() ? 'p-button-icon-only' : '',
|
|
51
|
+
this.icon() && this.label() && this.iconPos() === 'left'
|
|
52
|
+
? 'p-button-icon-left'
|
|
53
|
+
: '',
|
|
54
|
+
this.icon() && this.label() && this.iconPos() === 'right'
|
|
55
|
+
? 'p-button-icon-right'
|
|
56
|
+
: '',
|
|
57
|
+
this.loading() ? 'p-button-loading' : '',
|
|
58
|
+
].filter(Boolean),
|
|
59
|
+
);
|
|
60
|
+
readonly buttonStyles = computed(() => ({
|
|
61
|
+
'border-radius': this.rounded() ? '22px' : '8px',
|
|
62
|
+
background: this.customBackgroundColor() || undefined,
|
|
63
|
+
}));
|
|
64
|
+
readonly effectiveAriaLabel = computed(
|
|
65
|
+
() => this.ariaLabel() || this.label() || 'Button',
|
|
66
|
+
);
|
|
67
|
+
onButtonClick(event: Event): void {
|
|
68
|
+
if (!this.isDisabled()) {
|
|
69
|
+
this.buttonClick.emit(event);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<div [ngClass]="containerClasses()" [ngStyle]="triggerStyles()">
|
|
2
|
+
@if (showMask() && isOpen()) {
|
|
3
|
+
<div class="speed-dial-mask" (click)="closeMask()" aria-hidden="true"></div>
|
|
4
|
+
}
|
|
5
|
+
<ul
|
|
6
|
+
class="speed-dial-items"
|
|
7
|
+
[attr.data-direction]="direction()"
|
|
8
|
+
[ngStyle]="itemsStyles()"
|
|
9
|
+
role="menu"
|
|
10
|
+
[attr.aria-expanded]="isOpen()"
|
|
11
|
+
[attr.aria-label]="ariaLabel()"
|
|
12
|
+
>
|
|
13
|
+
@for (item of items(); track trackByItem($index, item)) {
|
|
14
|
+
<li
|
|
15
|
+
[style.--i]="$index"
|
|
16
|
+
[style.--radius.px]="radius()"
|
|
17
|
+
[style.transition-delay]="isOpen() ? $index * 50 + 'ms' : '0ms'"
|
|
18
|
+
[class]="'item-' + type()"
|
|
19
|
+
role="presentation"
|
|
20
|
+
>
|
|
21
|
+
@if (item.tooltip) {
|
|
22
|
+
<div
|
|
23
|
+
class="action-tooltip"
|
|
24
|
+
role="tooltip"
|
|
25
|
+
[attr.id]="'tooltip-' + $index"
|
|
26
|
+
>
|
|
27
|
+
{{ item.tooltip }}
|
|
28
|
+
</div>
|
|
29
|
+
}
|
|
30
|
+
<button
|
|
31
|
+
type="button"
|
|
32
|
+
class="action-button"
|
|
33
|
+
role="menuitem"
|
|
34
|
+
[disabled]="item.disabled"
|
|
35
|
+
[attr.aria-label]="
|
|
36
|
+
item.ariaLabel || item.tooltip || 'Speed dial action'
|
|
37
|
+
"
|
|
38
|
+
[attr.aria-describedby]="item.tooltip ? 'tooltip-' + $index : null"
|
|
39
|
+
[style.background-color]="item.backgroundColor"
|
|
40
|
+
(click)="onItemClick($event, item)"
|
|
41
|
+
>
|
|
42
|
+
<i [ngClass]="item.icon" aria-hidden="true"> </i>
|
|
43
|
+
</button>
|
|
44
|
+
</li>
|
|
45
|
+
}
|
|
46
|
+
</ul>
|
|
47
|
+
<button
|
|
48
|
+
type="button"
|
|
49
|
+
class="trigger-button"
|
|
50
|
+
[attr.aria-label]="ariaLabel() + (isOpen() ? ' - Cerrar' : ' - Abrir')"
|
|
51
|
+
[attr.aria-expanded]="isOpen()"
|
|
52
|
+
[attr.aria-haspopup]="'menu'"
|
|
53
|
+
(click)="toggleSpeedDial($event)"
|
|
54
|
+
>
|
|
55
|
+
<i [ngClass]="currentIcon()" aria-hidden="true"> </i>
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { MagarySpeedDial } from './speed-dial';
|
|
4
|
+
@NgModule({
|
|
5
|
+
imports: [CommonModule, MagarySpeedDial],
|
|
6
|
+
exports: [MagarySpeedDial],
|
|
7
|
+
})
|
|
8
|
+
export class SpeedDialModule {}
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
--speed-dial-trigger-size: 56px;
|
|
3
|
+
--speed-dial-item-size: 40px;
|
|
4
|
+
--speed-dial-item-gap: 55px;
|
|
5
|
+
--speed-dial-transition: 0.3s ease;
|
|
6
|
+
--speed-dial-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
7
|
+
--speed-dial-shadow-item: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
8
|
+
--speed-dial-mask-bg: rgba(0, 0, 0, 0.4);
|
|
9
|
+
background: transparent;
|
|
10
|
+
display: inline-block;
|
|
11
|
+
}
|
|
12
|
+
.speed-dial-container {
|
|
13
|
+
position: relative;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
background: transparent;
|
|
16
|
+
&.is-open .trigger-button {
|
|
17
|
+
transform: rotate(45deg);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
.trigger-button {
|
|
21
|
+
width: var(--speed-dial-trigger-size);
|
|
22
|
+
height: var(--speed-dial-trigger-size);
|
|
23
|
+
border-radius: 50%;
|
|
24
|
+
background-color: var(--trigger-bg, #007bff);
|
|
25
|
+
color: white;
|
|
26
|
+
border: none;
|
|
27
|
+
box-shadow: var(--speed-dial-shadow);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
font-size: 1.5rem;
|
|
33
|
+
z-index: 1001;
|
|
34
|
+
transition: transform var(--speed-dial-transition), box-shadow var(--speed-dial-transition);
|
|
35
|
+
min-height: 44px;
|
|
36
|
+
&:hover {
|
|
37
|
+
box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
|
|
38
|
+
}
|
|
39
|
+
&:focus-visible {
|
|
40
|
+
outline: 2px solid #0066cc;
|
|
41
|
+
outline-offset: 2px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.speed-dial-mask {
|
|
45
|
+
position: fixed;
|
|
46
|
+
top: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
width: 100vw;
|
|
49
|
+
height: 100vh;
|
|
50
|
+
background: var(--speed-dial-mask-bg);
|
|
51
|
+
z-index: 999;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
.speed-dial-items {
|
|
55
|
+
list-style: none;
|
|
56
|
+
padding: 0;
|
|
57
|
+
margin: 0;
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: 20%;
|
|
60
|
+
left: 16%;
|
|
61
|
+
transform: translate(-50%, -50%);
|
|
62
|
+
z-index: 1000;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
li {
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: 0;
|
|
67
|
+
left: 0;
|
|
68
|
+
transform-origin: center;
|
|
69
|
+
transition: transform var(--speed-dial-transition),
|
|
70
|
+
opacity var(--speed-dial-transition);
|
|
71
|
+
opacity: 0;
|
|
72
|
+
}
|
|
73
|
+
.action-button {
|
|
74
|
+
width: var(--speed-dial-item-size);
|
|
75
|
+
height: var(--speed-dial-item-size);
|
|
76
|
+
border-radius: 50%;
|
|
77
|
+
background-color: #6c757d;
|
|
78
|
+
color: white;
|
|
79
|
+
border: none;
|
|
80
|
+
box-shadow: var(--speed-dial-shadow-item);
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
display: flex;
|
|
83
|
+
align-items: center;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
font-size: 1rem;
|
|
86
|
+
transition: background-color 0.2s, transform 0.2s;
|
|
87
|
+
min-height: 44px;
|
|
88
|
+
min-width: 44px;
|
|
89
|
+
&:hover:not(:disabled) {
|
|
90
|
+
background-color: #5a6268;
|
|
91
|
+
transform: scale(1.1);
|
|
92
|
+
}
|
|
93
|
+
&:focus-visible {
|
|
94
|
+
outline: 2px solid #0066cc;
|
|
95
|
+
outline-offset: 2px;
|
|
96
|
+
}
|
|
97
|
+
&:disabled {
|
|
98
|
+
opacity: 0.4;
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
background-color: #adb5bd;
|
|
101
|
+
&:hover {
|
|
102
|
+
transform: none;
|
|
103
|
+
background-color: #adb5bd;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
.action-tooltip {
|
|
108
|
+
position: absolute;
|
|
109
|
+
background-color: #333;
|
|
110
|
+
color: white;
|
|
111
|
+
padding: 4px 8px;
|
|
112
|
+
border-radius: 4px;
|
|
113
|
+
font-size: 0.8rem;
|
|
114
|
+
white-space: nowrap;
|
|
115
|
+
opacity: 0;
|
|
116
|
+
transition: opacity 0.2s;
|
|
117
|
+
pointer-events: none;
|
|
118
|
+
right: 120%;
|
|
119
|
+
top: 50%;
|
|
120
|
+
transform: translateY(-50%);
|
|
121
|
+
z-index: 1002;
|
|
122
|
+
&::after {
|
|
123
|
+
content: '';
|
|
124
|
+
position: absolute;
|
|
125
|
+
left: 100%;
|
|
126
|
+
top: 50%;
|
|
127
|
+
transform: translateY(-50%);
|
|
128
|
+
border: 4px solid transparent;
|
|
129
|
+
border-left-color: #333;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
li:hover .action-tooltip {
|
|
133
|
+
opacity: 1;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
.is-open .speed-dial-items {
|
|
137
|
+
pointer-events: auto;
|
|
138
|
+
li {
|
|
139
|
+
opacity: 1;
|
|
140
|
+
}
|
|
141
|
+
&[data-direction="up"] li {
|
|
142
|
+
transform: translateY(calc(var(--speed-dial-item-gap) * (var(--i) + 1) * -1));
|
|
143
|
+
}
|
|
144
|
+
&[data-direction="down"] li {
|
|
145
|
+
transform: translateY(calc(var(--speed-dial-item-gap) * (var(--i) + 1)));
|
|
146
|
+
}
|
|
147
|
+
&[data-direction="left"] li {
|
|
148
|
+
transform: translateX(calc(var(--speed-dial-item-gap) * (var(--i) + 1) * -1));
|
|
149
|
+
}
|
|
150
|
+
&[data-direction="right"] li {
|
|
151
|
+
transform: translateX(calc(var(--speed-dial-item-gap) * (var(--i) + 1)));
|
|
152
|
+
}
|
|
153
|
+
.item-circle {
|
|
154
|
+
--angle: calc(var(--i) * (360deg / var(--item-count)));
|
|
155
|
+
transform: rotate(var(--angle))
|
|
156
|
+
translateY(calc(var(--radius) * -1))
|
|
157
|
+
rotate(calc(var(--angle) * -1));
|
|
158
|
+
}
|
|
159
|
+
&[data-direction="left"] .item-semicircle {
|
|
160
|
+
--angle: calc(var(--i) * (180deg / (var(--item-count) - 1)));
|
|
161
|
+
transform: rotate(calc(var(--angle) - 180deg))
|
|
162
|
+
translateY(calc(var(--radius) * -1))
|
|
163
|
+
rotate(calc((var(--angle) - 180deg) * -1));
|
|
164
|
+
}
|
|
165
|
+
&[data-direction="right"] .item-semicircle {
|
|
166
|
+
--angle: calc(var(--i) * (180deg / (var(--item-count) - 1)));
|
|
167
|
+
transform: rotate(var(--angle))
|
|
168
|
+
translateY(calc(var(--radius) * -1))
|
|
169
|
+
rotate(calc(var(--angle) * -1));
|
|
170
|
+
}
|
|
171
|
+
&[data-direction="down"] .item-semicircle {
|
|
172
|
+
--angle: calc(var(--i) * (180deg / (var(--item-count) - 1)));
|
|
173
|
+
transform: rotate(calc(var(--angle) + 90deg))
|
|
174
|
+
translateY(calc(var(--radius) * -1))
|
|
175
|
+
rotate(calc((var(--angle) + 90deg) * -1));
|
|
176
|
+
}
|
|
177
|
+
&[data-direction="up"] .item-semicircle {
|
|
178
|
+
--angle: calc(var(--i) * (180deg / (var(--item-count) - 1)));
|
|
179
|
+
transform: rotate(calc(var(--angle) - 90deg))
|
|
180
|
+
translateY(calc(var(--radius) * -1))
|
|
181
|
+
rotate(calc((var(--angle) - 90deg) * -1));
|
|
182
|
+
}
|
|
183
|
+
&[data-direction="up-right"] .item-quartercircle {
|
|
184
|
+
--angle: calc(var(--i) * (90deg / (var(--item-count) - 1)));
|
|
185
|
+
transform: rotate(var(--angle))
|
|
186
|
+
translateY(calc(var(--radius) * -1))
|
|
187
|
+
rotate(calc(var(--angle) * -1));
|
|
188
|
+
}
|
|
189
|
+
&[data-direction="down-right"] .item-quartercircle {
|
|
190
|
+
--angle: calc(var(--i) * (90deg / (var(--item-count) - 1)));
|
|
191
|
+
transform: rotate(calc(var(--angle) + 90deg))
|
|
192
|
+
translateY(calc(var(--radius) * -1))
|
|
193
|
+
rotate(calc((var(--angle) + 90deg) * -1));
|
|
194
|
+
}
|
|
195
|
+
&[data-direction="down-left"] .item-quartercircle {
|
|
196
|
+
--angle: calc(var(--i) * (90deg / (var(--item-count) - 1)));
|
|
197
|
+
transform: rotate(calc(var(--angle) + 180deg))
|
|
198
|
+
translateY(calc(var(--radius) * -1))
|
|
199
|
+
rotate(calc((var(--angle) + 180deg) * -1));
|
|
200
|
+
}
|
|
201
|
+
&[data-direction="up-left"] .item-quartercircle {
|
|
202
|
+
--angle: calc(var(--i) * (90deg / (var(--item-count) - 1)));
|
|
203
|
+
transform: rotate(calc(var(--angle) + 270deg))
|
|
204
|
+
translateY(calc(var(--radius) * -1))
|
|
205
|
+
rotate(calc((var(--angle) + 270deg) * -1));
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
@media (max-width: 768px) {
|
|
209
|
+
:host {
|
|
210
|
+
--speed-dial-trigger-size: 52px;
|
|
211
|
+
--speed-dial-item-size: 36px;
|
|
212
|
+
--speed-dial-item-gap: 48px;
|
|
213
|
+
}
|
|
214
|
+
.trigger-button {
|
|
215
|
+
font-size: 1.25rem;
|
|
216
|
+
}
|
|
217
|
+
.speed-dial-items .action-button {
|
|
218
|
+
font-size: 0.9rem;
|
|
219
|
+
}
|
|
220
|
+
.speed-dial-items .action-tooltip {
|
|
221
|
+
font-size: 0.75rem;
|
|
222
|
+
padding: 3px 6px;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
@media (max-width: 480px) {
|
|
226
|
+
:host {
|
|
227
|
+
--speed-dial-trigger-size: 48px;
|
|
228
|
+
--speed-dial-item-size: 32px;
|
|
229
|
+
--speed-dial-item-gap: 44px;
|
|
230
|
+
}
|
|
231
|
+
.trigger-button {
|
|
232
|
+
font-size: 1.1rem;
|
|
233
|
+
}
|
|
234
|
+
.speed-dial-items .action-button {
|
|
235
|
+
font-size: 0.8rem;
|
|
236
|
+
}
|
|
237
|
+
.speed-dial-items .action-tooltip {
|
|
238
|
+
font-size: 0.7rem;
|
|
239
|
+
padding: 2px 4px;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
@media (min-width: 1200px) {
|
|
243
|
+
.speed-dial-items .action-tooltip {
|
|
244
|
+
font-size: 0.85rem;
|
|
245
|
+
padding: 6px 10px;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { SpeedDial } from './speed-dial';
|
|
3
|
+
describe('SpeedDial', () => {
|
|
4
|
+
let component: SpeedDial;
|
|
5
|
+
let fixture: ComponentFixture<SpeedDial>;
|
|
6
|
+
beforeEach(async () => {
|
|
7
|
+
await TestBed.configureTestingModule({
|
|
8
|
+
imports: [SpeedDial]
|
|
9
|
+
})
|
|
10
|
+
.compileComponents();
|
|
11
|
+
fixture = TestBed.createComponent(SpeedDial);
|
|
12
|
+
component = fixture.componentInstance;
|
|
13
|
+
fixture.detectChanges();
|
|
14
|
+
});
|
|
15
|
+
it('should create', () => {
|
|
16
|
+
expect(component).toBeTruthy();
|
|
17
|
+
});
|
|
18
|
+
});
|