@fylib/adapter-angular 0.1.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.
- package/dist/base/base-component.d.ts +18 -0
- package/dist/base/base-component.js +36 -0
- package/dist/base/interaction.utils.d.ts +7 -0
- package/dist/base/interaction.utils.js +34 -0
- package/dist/base/interaction.utils.test.d.ts +1 -0
- package/dist/base/interaction.utils.test.js +25 -0
- package/dist/components/accordion.component.d.ts +32 -0
- package/dist/components/accordion.component.js +337 -0
- package/dist/components/badge.component.d.ts +10 -0
- package/dist/components/badge.component.js +112 -0
- package/dist/components/button.component.d.ts +33 -0
- package/dist/components/button.component.js +272 -0
- package/dist/components/card.component.d.ts +29 -0
- package/dist/components/card.component.js +236 -0
- package/dist/components/chart.component.d.ts +39 -0
- package/dist/components/chart.component.js +307 -0
- package/dist/components/icon.component.d.ts +18 -0
- package/dist/components/icon.component.js +144 -0
- package/dist/components/input.component.d.ts +50 -0
- package/dist/components/input.component.js +383 -0
- package/dist/components/modal.component.d.ts +46 -0
- package/dist/components/modal.component.js +404 -0
- package/dist/components/nav-link.component.d.ts +11 -0
- package/dist/components/nav-link.component.js +121 -0
- package/dist/components/notification-menu.component.d.ts +68 -0
- package/dist/components/notification-menu.component.js +695 -0
- package/dist/components/select.component.d.ts +52 -0
- package/dist/components/select.component.js +395 -0
- package/dist/components/table.component.d.ts +55 -0
- package/dist/components/table.component.js +643 -0
- package/dist/components/text.component.d.ts +8 -0
- package/dist/components/text.component.js +58 -0
- package/dist/components/toast.component.d.ts +27 -0
- package/dist/components/toast.component.js +260 -0
- package/dist/directives/animation.directive.d.ts +5 -0
- package/dist/directives/animation.directive.js +34 -0
- package/dist/directives/theme-vars.directive.d.ts +7 -0
- package/dist/directives/theme-vars.directive.js +70 -0
- package/dist/directives/wallpaper.directive.d.ts +28 -0
- package/dist/directives/wallpaper.directive.js +195 -0
- package/dist/effects/confetti.plugin.d.ts +1 -0
- package/dist/effects/confetti.plugin.js +151 -0
- package/dist/effects/extra-effects.plugin.d.ts +3 -0
- package/dist/effects/extra-effects.plugin.js +288 -0
- package/dist/effects/hearts.plugin.d.ts +1 -0
- package/dist/effects/hearts.plugin.js +172 -0
- package/dist/effects/register-all.d.ts +1 -0
- package/dist/effects/register-all.js +16 -0
- package/dist/effects/ui-effects.plugin.d.ts +1 -0
- package/dist/effects/ui-effects.plugin.js +134 -0
- package/dist/icons/providers/fontawesome.provider.d.ts +3 -0
- package/dist/icons/providers/fontawesome.provider.js +25 -0
- package/dist/icons/providers/mdi.provider.d.ts +3 -0
- package/dist/icons/providers/mdi.provider.js +13 -0
- package/dist/icons/providers/phosphor.provider.d.ts +3 -0
- package/dist/icons/providers/phosphor.provider.js +17 -0
- package/dist/icons/registry.d.ts +22 -0
- package/dist/icons/registry.js +12 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +29 -0
- package/dist/layouts/layout.component.d.ts +24 -0
- package/dist/layouts/layout.component.js +255 -0
- package/dist/layouts/slot.component.d.ts +61 -0
- package/dist/layouts/slot.component.js +937 -0
- package/dist/providers.d.ts +12 -0
- package/dist/providers.js +18 -0
- package/dist/services/fylib.service.d.ts +31 -0
- package/dist/services/fylib.service.js +214 -0
- package/dist/services/notification.service.d.ts +27 -0
- package/dist/services/notification.service.js +118 -0
- package/dist/services/sse.service.d.ts +16 -0
- package/dist/services/sse.service.js +109 -0
- package/dist/services/webclient.service.d.ts +38 -0
- package/dist/services/webclient.service.js +144 -0
- package/package.json +43 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Component, Input, Output, EventEmitter, ViewEncapsulation, inject, ViewChild, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import { ChartDefinition } from '@fylib/catalog';
|
|
13
|
+
import { FyLibService } from '../services/fylib.service';
|
|
14
|
+
import { BaseFyComponent } from '../base/base-component';
|
|
15
|
+
import { BaseChartDirective } from 'ng2-charts';
|
|
16
|
+
let FyChartComponent = class FyChartComponent extends BaseFyComponent {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(inject(FyLibService), 'fy-chart');
|
|
19
|
+
this.type = ChartDefinition.defaultProps.type;
|
|
20
|
+
this.series = ChartDefinition.defaultProps.series;
|
|
21
|
+
this.height = '350px';
|
|
22
|
+
this.width = '100%';
|
|
23
|
+
this.showLegend = ChartDefinition.defaultProps.showLegend;
|
|
24
|
+
this.showGrid = ChartDefinition.defaultProps.showGrid;
|
|
25
|
+
this.showLabels = ChartDefinition.defaultProps.showLabels;
|
|
26
|
+
this.stacked = ChartDefinition.defaultProps.stacked;
|
|
27
|
+
this.animated = ChartDefinition.defaultProps.animated;
|
|
28
|
+
this.variant = 'default';
|
|
29
|
+
this.activeAnimations = null;
|
|
30
|
+
this.activeEffects = null;
|
|
31
|
+
this.customStyles = null;
|
|
32
|
+
this.fyDataClick = new EventEmitter();
|
|
33
|
+
this.chartData = { datasets: [] };
|
|
34
|
+
this.chartOptions = {};
|
|
35
|
+
this.chartJsType = 'line';
|
|
36
|
+
}
|
|
37
|
+
ngOnInit() {
|
|
38
|
+
this.updateChart();
|
|
39
|
+
if (this.isAnimationsActive(this.activeAnimations)) {
|
|
40
|
+
const anim = this.resolveAnim('enter', undefined, ChartDefinition.features?.animations?.enter);
|
|
41
|
+
if (anim)
|
|
42
|
+
this.fylib.playAnimation(anim);
|
|
43
|
+
this.triggerByEvent('fy-chart.enter', undefined, this.activeEffects);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
ngOnChanges(changes) {
|
|
47
|
+
if (changes['series'] || changes['categories'] || changes['type'] || changes['stacked']) {
|
|
48
|
+
this.updateChart();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
updateChart() {
|
|
52
|
+
this.chartJsType = this.mapType(this.type);
|
|
53
|
+
const tokens = this.fylib.getTokens();
|
|
54
|
+
const themeMode = this.fylib.getMode();
|
|
55
|
+
const chartTokens = tokens.effects?.chart;
|
|
56
|
+
const baseColors = this.colors || chartTokens?.colors || ['#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6'];
|
|
57
|
+
const labelColor = chartTokens?.labelColor || (themeMode === 'dark' ? '#9ca3af' : '#64748b');
|
|
58
|
+
const gridColor = chartTokens?.gridColor || (themeMode === 'dark' ? 'rgba(255,255,255,0.05)' : 'rgba(15, 23, 42, 0.05)');
|
|
59
|
+
const fontFamily = chartTokens?.fontFamily || tokens.typography?.fontFamily?.base || 'inherit';
|
|
60
|
+
// Map series to Chart.js datasets
|
|
61
|
+
this.chartData = {
|
|
62
|
+
labels: this.categories,
|
|
63
|
+
datasets: this.series.map((s, i) => ({
|
|
64
|
+
label: s.name,
|
|
65
|
+
data: s.data,
|
|
66
|
+
backgroundColor: this.type === 'pie' || this.type === 'donut' ? baseColors : baseColors[i % baseColors.length],
|
|
67
|
+
borderColor: baseColors[i % baseColors.length],
|
|
68
|
+
fill: this.type === 'area',
|
|
69
|
+
tension: 0.4
|
|
70
|
+
}))
|
|
71
|
+
};
|
|
72
|
+
this.chartOptions = {
|
|
73
|
+
responsive: true,
|
|
74
|
+
maintainAspectRatio: false,
|
|
75
|
+
animation: {
|
|
76
|
+
duration: this.animated && this.isAnimationsActive(this.activeAnimations) ? 800 : 0
|
|
77
|
+
},
|
|
78
|
+
plugins: {
|
|
79
|
+
legend: {
|
|
80
|
+
display: this.showLegend,
|
|
81
|
+
position: 'bottom',
|
|
82
|
+
labels: {
|
|
83
|
+
color: labelColor,
|
|
84
|
+
font: { family: fontFamily }
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
tooltip: {
|
|
88
|
+
enabled: true,
|
|
89
|
+
mode: 'index',
|
|
90
|
+
intersect: false,
|
|
91
|
+
backgroundColor: themeMode === 'dark' ? '#1f2937' : '#ffffff',
|
|
92
|
+
titleColor: themeMode === 'dark' ? '#f9fafb' : '#111827',
|
|
93
|
+
bodyColor: themeMode === 'dark' ? '#d1d5db' : '#4b5563',
|
|
94
|
+
borderColor: themeMode === 'dark' ? 'rgba(255,255,255,0.1)' : 'rgba(0,0,0,0.1)',
|
|
95
|
+
borderWidth: 1
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
scales: (this.type === 'pie' || this.type === 'donut' || this.type === 'radar' ? {} : {
|
|
99
|
+
x: {
|
|
100
|
+
stacked: this.stacked,
|
|
101
|
+
display: this.showLabels,
|
|
102
|
+
grid: {
|
|
103
|
+
display: false,
|
|
104
|
+
color: gridColor
|
|
105
|
+
},
|
|
106
|
+
ticks: {
|
|
107
|
+
color: labelColor,
|
|
108
|
+
font: { family: fontFamily }
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
y: {
|
|
112
|
+
stacked: this.stacked,
|
|
113
|
+
display: this.showLabels,
|
|
114
|
+
grid: {
|
|
115
|
+
display: this.showGrid,
|
|
116
|
+
color: gridColor
|
|
117
|
+
},
|
|
118
|
+
ticks: {
|
|
119
|
+
color: labelColor,
|
|
120
|
+
font: { family: fontFamily }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
};
|
|
125
|
+
if (this.chart) {
|
|
126
|
+
this.chart.update();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
mapType(type) {
|
|
130
|
+
switch (type) {
|
|
131
|
+
case 'donut': return 'doughnut';
|
|
132
|
+
case 'area': return 'line'; // Chart.js handles area as line with fill
|
|
133
|
+
default: return type;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
onChartClick({ event, active }) {
|
|
137
|
+
if (active && active.length > 0) {
|
|
138
|
+
this.fyDataClick.emit(active);
|
|
139
|
+
this.triggerByEvent('fy-chart.dataClick', undefined, this.activeEffects);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
get animationClassSuffix() {
|
|
143
|
+
const anim = this.resolveAnim('enter', undefined, ChartDefinition.features?.animations?.enter);
|
|
144
|
+
return anim ? ` fy-anim-${anim}` : '';
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
__decorate([
|
|
148
|
+
Input(),
|
|
149
|
+
__metadata("design:type", String)
|
|
150
|
+
], FyChartComponent.prototype, "type", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
Input(),
|
|
153
|
+
__metadata("design:type", Array)
|
|
154
|
+
], FyChartComponent.prototype, "series", void 0);
|
|
155
|
+
__decorate([
|
|
156
|
+
Input(),
|
|
157
|
+
__metadata("design:type", Array)
|
|
158
|
+
], FyChartComponent.prototype, "categories", void 0);
|
|
159
|
+
__decorate([
|
|
160
|
+
Input(),
|
|
161
|
+
__metadata("design:type", String)
|
|
162
|
+
], FyChartComponent.prototype, "title", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
Input(),
|
|
165
|
+
__metadata("design:type", String)
|
|
166
|
+
], FyChartComponent.prototype, "subtitle", void 0);
|
|
167
|
+
__decorate([
|
|
168
|
+
Input(),
|
|
169
|
+
__metadata("design:type", Object)
|
|
170
|
+
], FyChartComponent.prototype, "height", void 0);
|
|
171
|
+
__decorate([
|
|
172
|
+
Input(),
|
|
173
|
+
__metadata("design:type", Object)
|
|
174
|
+
], FyChartComponent.prototype, "width", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
Input(),
|
|
177
|
+
__metadata("design:type", Array)
|
|
178
|
+
], FyChartComponent.prototype, "colors", void 0);
|
|
179
|
+
__decorate([
|
|
180
|
+
Input(),
|
|
181
|
+
__metadata("design:type", Boolean)
|
|
182
|
+
], FyChartComponent.prototype, "showLegend", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
Input(),
|
|
185
|
+
__metadata("design:type", Boolean)
|
|
186
|
+
], FyChartComponent.prototype, "showGrid", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
Input(),
|
|
189
|
+
__metadata("design:type", Boolean)
|
|
190
|
+
], FyChartComponent.prototype, "showLabels", void 0);
|
|
191
|
+
__decorate([
|
|
192
|
+
Input(),
|
|
193
|
+
__metadata("design:type", Boolean)
|
|
194
|
+
], FyChartComponent.prototype, "stacked", void 0);
|
|
195
|
+
__decorate([
|
|
196
|
+
Input(),
|
|
197
|
+
__metadata("design:type", Boolean)
|
|
198
|
+
], FyChartComponent.prototype, "animated", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
Input(),
|
|
201
|
+
__metadata("design:type", String)
|
|
202
|
+
], FyChartComponent.prototype, "variant", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
Input(),
|
|
205
|
+
__metadata("design:type", Object)
|
|
206
|
+
], FyChartComponent.prototype, "activeAnimations", void 0);
|
|
207
|
+
__decorate([
|
|
208
|
+
Input(),
|
|
209
|
+
__metadata("design:type", Object)
|
|
210
|
+
], FyChartComponent.prototype, "activeEffects", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
Input(),
|
|
213
|
+
__metadata("design:type", Object)
|
|
214
|
+
], FyChartComponent.prototype, "customStyles", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
Output(),
|
|
217
|
+
__metadata("design:type", Object)
|
|
218
|
+
], FyChartComponent.prototype, "fyDataClick", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
ViewChild(BaseChartDirective),
|
|
221
|
+
__metadata("design:type", BaseChartDirective)
|
|
222
|
+
], FyChartComponent.prototype, "chart", void 0);
|
|
223
|
+
FyChartComponent = __decorate([
|
|
224
|
+
Component({
|
|
225
|
+
selector: 'fy-chart',
|
|
226
|
+
standalone: true,
|
|
227
|
+
imports: [CommonModule, BaseChartDirective],
|
|
228
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
|
|
229
|
+
template: `
|
|
230
|
+
<div
|
|
231
|
+
class="fy-chart-container"
|
|
232
|
+
[class]="'fy-chart--' + variant"
|
|
233
|
+
[class]="composeAnimClasses(animationClassSuffix)"
|
|
234
|
+
[style]="getHostStyles(customStyles)"
|
|
235
|
+
>
|
|
236
|
+
|
|
237
|
+
@if(title || subtitle) {
|
|
238
|
+
<div class="fy-chart__header">
|
|
239
|
+
@if(title) {
|
|
240
|
+
<h3 class="fy-chart__title">{{ title }}</h3>
|
|
241
|
+
}
|
|
242
|
+
@if(subtitle) {
|
|
243
|
+
<p class="fy-chart__subtitle">{{ subtitle }}</p>
|
|
244
|
+
}
|
|
245
|
+
</div>
|
|
246
|
+
}
|
|
247
|
+
@if(chartData.datasets.length > 0) {
|
|
248
|
+
<div class="fy-chart__content" [style.height]="height" [style.width]="width">
|
|
249
|
+
<canvas
|
|
250
|
+
baseChart
|
|
251
|
+
[data]="chartData"
|
|
252
|
+
[options]="chartOptions"
|
|
253
|
+
[type]="chartJsType"
|
|
254
|
+
(chartClick)="onChartClick($event)"
|
|
255
|
+
>
|
|
256
|
+
</canvas>
|
|
257
|
+
</div>
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
</div>
|
|
261
|
+
`,
|
|
262
|
+
styles: [`
|
|
263
|
+
.fy-chart-container {
|
|
264
|
+
display: flex;
|
|
265
|
+
flex-direction: column;
|
|
266
|
+
width: 100%;
|
|
267
|
+
background: var(--fy-effects-chart-background, transparent);
|
|
268
|
+
border: 1px solid var(--fy-effects-chart-borderColor, transparent);
|
|
269
|
+
border-radius: var(--fy-borderRadius-lg, 12px);
|
|
270
|
+
padding: var(--fy-spacing-md);
|
|
271
|
+
box-sizing: border-box;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.fy-chart__header {
|
|
275
|
+
margin-bottom: var(--fy-spacing-md);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.fy-chart__title {
|
|
279
|
+
margin: 0;
|
|
280
|
+
font-size: var(--fy-typography-fontSize-lg);
|
|
281
|
+
font-weight: var(--fy-typography-fontWeight-bold);
|
|
282
|
+
color: var(--fy-colors-text);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.fy-chart__subtitle {
|
|
286
|
+
margin: 4px 0 0;
|
|
287
|
+
font-size: var(--fy-typography-fontSize-sm);
|
|
288
|
+
color: var(--fy-colors-secondary);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.fy-chart__content {
|
|
292
|
+
position: relative;
|
|
293
|
+
margin: auto;
|
|
294
|
+
width: 100%;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.fy-chart--minimal {
|
|
298
|
+
padding: 0;
|
|
299
|
+
border: none;
|
|
300
|
+
background: transparent;
|
|
301
|
+
}
|
|
302
|
+
`],
|
|
303
|
+
encapsulation: ViewEncapsulation.None
|
|
304
|
+
}),
|
|
305
|
+
__metadata("design:paramtypes", [])
|
|
306
|
+
], FyChartComponent);
|
|
307
|
+
export { FyChartComponent };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IconVariant } from '../icons/registry';
|
|
2
|
+
import { IconSet } from '@fylib/config';
|
|
3
|
+
type IconSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export declare class FyIconComponent {
|
|
5
|
+
private fylib;
|
|
6
|
+
name?: string;
|
|
7
|
+
size: IconSize;
|
|
8
|
+
color?: string | null;
|
|
9
|
+
strokeWidth?: string | number | null;
|
|
10
|
+
variant?: IconVariant | null;
|
|
11
|
+
set?: IconSet;
|
|
12
|
+
wrapperStyle: import("@angular/core").Signal<Record<string, string>>;
|
|
13
|
+
get svgPath(): string | null;
|
|
14
|
+
private _svgViewBox;
|
|
15
|
+
get svgViewBox(): string;
|
|
16
|
+
get className(): string | null;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Component, Input, ViewEncapsulation, inject, computed } from '@angular/core';
|
|
11
|
+
import { CommonModule } from '@angular/common';
|
|
12
|
+
import { FyLibService } from '../services/fylib.service';
|
|
13
|
+
import { iconRegistry } from '../icons/registry';
|
|
14
|
+
let FyIconComponent = class FyIconComponent {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.fylib = inject(FyLibService);
|
|
17
|
+
this.size = 'md';
|
|
18
|
+
this.wrapperStyle = computed(() => {
|
|
19
|
+
const style = {};
|
|
20
|
+
const tokens = this.fylib.tokens();
|
|
21
|
+
const defaultColor = tokens?.icons?.color;
|
|
22
|
+
const defaultStroke = tokens?.icons?.strokeWidth;
|
|
23
|
+
const color = this.color ?? (defaultColor ? String(defaultColor) : null);
|
|
24
|
+
if (color)
|
|
25
|
+
style['color'] = color;
|
|
26
|
+
const sw = this.strokeWidth ?? (defaultStroke ? String(defaultStroke) : null);
|
|
27
|
+
if (sw != null)
|
|
28
|
+
style['--fy-icon-stroke-width'] = String(sw);
|
|
29
|
+
return style;
|
|
30
|
+
});
|
|
31
|
+
this._svgViewBox = '0 0 24 24';
|
|
32
|
+
}
|
|
33
|
+
get svgPath() {
|
|
34
|
+
const tokens = this.fylib.tokens();
|
|
35
|
+
const defaultSet = tokens?.icons?.defaultSet || null;
|
|
36
|
+
const effectiveSet = this.set || defaultSet || null;
|
|
37
|
+
if (effectiveSet) {
|
|
38
|
+
const provider = iconRegistry.getProvider(effectiveSet);
|
|
39
|
+
const v = (this.variant ?? tokens?.icons?.variant) || undefined;
|
|
40
|
+
if (provider?.resolveSvg) {
|
|
41
|
+
const res = provider.resolveSvg(String(this.name), v);
|
|
42
|
+
if (res?.svg) {
|
|
43
|
+
this._svgViewBox = res.viewBox || '0 0 24 24';
|
|
44
|
+
return res.svg;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
switch (this.name) {
|
|
49
|
+
case 'user':
|
|
50
|
+
return 'M12 12c2.761 0 5-2.239 5-5s-2.239-5-5-5S7 4.239 7 7s2.239 5 5 5zm0 2c-4.418 0-8 2.239-8 5v2h16v-2c0-2.761-3.582-5-8-5z';
|
|
51
|
+
case 'search':
|
|
52
|
+
return 'M11 4a7 7 0 105.197 12.03l3.386 3.387 1.414-1.414-3.387-3.386A7 7 0 0011 4zm0 2a5 5 0 110 10 5 5 0 010-10z';
|
|
53
|
+
case 'eye':
|
|
54
|
+
return 'M12 5c-7 0-11 7-11 7s4 7 11 7 11-7 11-7-4-7-11-7zm0 12a5 5 0 110-10 5 5 0 010 10z';
|
|
55
|
+
case 'eye-slash':
|
|
56
|
+
return 'M2 2l20 20-1.5 1.5L16.9 18.9A10.9 10.9 0 0112 19c-7 0-11-7-11-7a21.8 21.8 0 015.4-6.5L3.5 3.5 2 2zm7.7 7.7a4 4 0 005.6 5.6l-5.6-5.6zM12 5c7 0 11 7 11 7a21.8 21.8 0 01-4.3 5.1l-1.5-1.5A10.9 10.9 0 0012 7a10.9 10.9 0 00-3.4.6L7.2 6.2A21.8 21.8 0 0112 5zm-9 7s4 7 11 7a10.9 10.9 0 004.3-.9l-1.6-1.6A10.9 10.9 0 0112 17c-7 0-11-5-11-5z';
|
|
57
|
+
case 'menu':
|
|
58
|
+
return 'M3 6h18v2H3V6zm0 5h18v2H3v-2zm0 5h18v2H3v-2z';
|
|
59
|
+
default:
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
get svgViewBox() {
|
|
64
|
+
return this._svgViewBox;
|
|
65
|
+
}
|
|
66
|
+
get className() {
|
|
67
|
+
const tokens = this.fylib.tokens();
|
|
68
|
+
const defaultSet = tokens?.icons?.defaultSet || null;
|
|
69
|
+
const effectiveSet = this.set || defaultSet;
|
|
70
|
+
if (!effectiveSet)
|
|
71
|
+
return null;
|
|
72
|
+
const provider = iconRegistry.getProvider(effectiveSet);
|
|
73
|
+
const v = (this.variant ?? tokens?.icons?.variant) || undefined;
|
|
74
|
+
if (provider?.resolveClass) {
|
|
75
|
+
return provider.resolveClass(String(this.name), v);
|
|
76
|
+
}
|
|
77
|
+
const base = effectiveSet === 'ph' ? 'ph' : effectiveSet;
|
|
78
|
+
return `${base} ${base}-${this.name}`;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
__decorate([
|
|
82
|
+
Input(),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], FyIconComponent.prototype, "name", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
Input(),
|
|
87
|
+
__metadata("design:type", String)
|
|
88
|
+
], FyIconComponent.prototype, "size", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
Input(),
|
|
91
|
+
__metadata("design:type", Object)
|
|
92
|
+
], FyIconComponent.prototype, "color", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
Input(),
|
|
95
|
+
__metadata("design:type", Object)
|
|
96
|
+
], FyIconComponent.prototype, "strokeWidth", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
Input(),
|
|
99
|
+
__metadata("design:type", Object)
|
|
100
|
+
], FyIconComponent.prototype, "variant", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
Input(),
|
|
103
|
+
__metadata("design:type", String)
|
|
104
|
+
], FyIconComponent.prototype, "set", void 0);
|
|
105
|
+
FyIconComponent = __decorate([
|
|
106
|
+
Component({
|
|
107
|
+
selector: 'fy-icon',
|
|
108
|
+
standalone: true,
|
|
109
|
+
imports: [CommonModule],
|
|
110
|
+
template: `
|
|
111
|
+
<span class="fy-icon"
|
|
112
|
+
[class]="'fy-icon--' + size"
|
|
113
|
+
[ngStyle]="wrapperStyle()"
|
|
114
|
+
>
|
|
115
|
+
@if (svgPath) {
|
|
116
|
+
<svg [attr.viewBox]="svgViewBox" fill="currentColor" aria-hidden="true">
|
|
117
|
+
<path [attr.d]="svgPath"></path>
|
|
118
|
+
</svg>
|
|
119
|
+
} @else {
|
|
120
|
+
@if (className) {
|
|
121
|
+
<span [class]="className"></span>
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
</span>
|
|
125
|
+
`,
|
|
126
|
+
styles: [`
|
|
127
|
+
.fy-icon {
|
|
128
|
+
display: inline-flex;
|
|
129
|
+
align-items: center;
|
|
130
|
+
justify-content: center;
|
|
131
|
+
color: var(--fy-icons-color, currentColor);
|
|
132
|
+
}
|
|
133
|
+
.fy-icon svg {
|
|
134
|
+
width: 1em;
|
|
135
|
+
height: 1em;
|
|
136
|
+
}
|
|
137
|
+
.fy-icon--sm { font-size: var(--fy-icons-size-sm, var(--fy-typography-fontSize-sm, 12px)); }
|
|
138
|
+
.fy-icon--md { font-size: var(--fy-icons-size-md, var(--fy-typography-fontSize-md, 16px)); }
|
|
139
|
+
.fy-icon--lg { font-size: var(--fy-icons-size-lg, var(--fy-typography-fontSize-lg, 20px)); }
|
|
140
|
+
`],
|
|
141
|
+
encapsulation: ViewEncapsulation.None
|
|
142
|
+
})
|
|
143
|
+
], FyIconComponent);
|
|
144
|
+
export { FyIconComponent };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { InputProps } from '@fylib/catalog';
|
|
3
|
+
import { InputFocusAnimationName, InputStateAnimationName } from '@fylib/animation';
|
|
4
|
+
import { EffectName } from '@fylib/config';
|
|
5
|
+
import { BaseFyComponent, FyComponentBaseInputs } from '../base/base-component';
|
|
6
|
+
export declare class FyInputComponent extends BaseFyComponent<'fy-input'> implements InputProps, FyComponentBaseInputs {
|
|
7
|
+
value?: string;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
type: InputProps['type'];
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
readonly: boolean;
|
|
12
|
+
mask?: string;
|
|
13
|
+
showPasswordToggle: boolean;
|
|
14
|
+
iconLeft?: string;
|
|
15
|
+
iconRight?: string;
|
|
16
|
+
iconLeftName?: string;
|
|
17
|
+
iconRightName?: string;
|
|
18
|
+
size: NonNullable<InputProps['size']>;
|
|
19
|
+
status: NonNullable<InputProps['status']>;
|
|
20
|
+
activeAnimations: boolean | null;
|
|
21
|
+
activeEffects: boolean | null;
|
|
22
|
+
customStyles: Record<string, string> | null;
|
|
23
|
+
focusAnimation?: InputFocusAnimationName;
|
|
24
|
+
successAnimation?: InputStateAnimationName;
|
|
25
|
+
errorAnimation?: InputStateAnimationName;
|
|
26
|
+
focusEffect?: EffectName;
|
|
27
|
+
successEffect?: EffectName;
|
|
28
|
+
errorEffect?: EffectName;
|
|
29
|
+
onInput?: (value: string) => void;
|
|
30
|
+
onChange?: (value: string) => void;
|
|
31
|
+
onFocus?: () => void;
|
|
32
|
+
onBlur?: () => void;
|
|
33
|
+
fyInput: EventEmitter<string>;
|
|
34
|
+
fyChange: EventEmitter<string>;
|
|
35
|
+
fyFocus: EventEmitter<void>;
|
|
36
|
+
fyBlur: EventEmitter<void>;
|
|
37
|
+
get animationsDisabled(): boolean;
|
|
38
|
+
get hostStyles(): string;
|
|
39
|
+
get visibleType(): string;
|
|
40
|
+
get animationClassSuffix(): string;
|
|
41
|
+
private _passwordVisible;
|
|
42
|
+
constructor();
|
|
43
|
+
togglePassword(): void;
|
|
44
|
+
onInputHandler(event: Event): void;
|
|
45
|
+
onChangeHandler(event: Event): void;
|
|
46
|
+
onFocusHandler(): void;
|
|
47
|
+
onBlurHandler(): void;
|
|
48
|
+
private resolveAnimationsActive;
|
|
49
|
+
private applyMask;
|
|
50
|
+
}
|