@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.
Files changed (75) hide show
  1. package/dist/base/base-component.d.ts +18 -0
  2. package/dist/base/base-component.js +36 -0
  3. package/dist/base/interaction.utils.d.ts +7 -0
  4. package/dist/base/interaction.utils.js +34 -0
  5. package/dist/base/interaction.utils.test.d.ts +1 -0
  6. package/dist/base/interaction.utils.test.js +25 -0
  7. package/dist/components/accordion.component.d.ts +32 -0
  8. package/dist/components/accordion.component.js +337 -0
  9. package/dist/components/badge.component.d.ts +10 -0
  10. package/dist/components/badge.component.js +112 -0
  11. package/dist/components/button.component.d.ts +33 -0
  12. package/dist/components/button.component.js +272 -0
  13. package/dist/components/card.component.d.ts +29 -0
  14. package/dist/components/card.component.js +236 -0
  15. package/dist/components/chart.component.d.ts +39 -0
  16. package/dist/components/chart.component.js +307 -0
  17. package/dist/components/icon.component.d.ts +18 -0
  18. package/dist/components/icon.component.js +144 -0
  19. package/dist/components/input.component.d.ts +50 -0
  20. package/dist/components/input.component.js +383 -0
  21. package/dist/components/modal.component.d.ts +46 -0
  22. package/dist/components/modal.component.js +404 -0
  23. package/dist/components/nav-link.component.d.ts +11 -0
  24. package/dist/components/nav-link.component.js +121 -0
  25. package/dist/components/notification-menu.component.d.ts +68 -0
  26. package/dist/components/notification-menu.component.js +695 -0
  27. package/dist/components/select.component.d.ts +52 -0
  28. package/dist/components/select.component.js +395 -0
  29. package/dist/components/table.component.d.ts +55 -0
  30. package/dist/components/table.component.js +643 -0
  31. package/dist/components/text.component.d.ts +8 -0
  32. package/dist/components/text.component.js +58 -0
  33. package/dist/components/toast.component.d.ts +27 -0
  34. package/dist/components/toast.component.js +260 -0
  35. package/dist/directives/animation.directive.d.ts +5 -0
  36. package/dist/directives/animation.directive.js +34 -0
  37. package/dist/directives/theme-vars.directive.d.ts +7 -0
  38. package/dist/directives/theme-vars.directive.js +70 -0
  39. package/dist/directives/wallpaper.directive.d.ts +28 -0
  40. package/dist/directives/wallpaper.directive.js +195 -0
  41. package/dist/effects/confetti.plugin.d.ts +1 -0
  42. package/dist/effects/confetti.plugin.js +151 -0
  43. package/dist/effects/extra-effects.plugin.d.ts +3 -0
  44. package/dist/effects/extra-effects.plugin.js +288 -0
  45. package/dist/effects/hearts.plugin.d.ts +1 -0
  46. package/dist/effects/hearts.plugin.js +172 -0
  47. package/dist/effects/register-all.d.ts +1 -0
  48. package/dist/effects/register-all.js +16 -0
  49. package/dist/effects/ui-effects.plugin.d.ts +1 -0
  50. package/dist/effects/ui-effects.plugin.js +134 -0
  51. package/dist/icons/providers/fontawesome.provider.d.ts +3 -0
  52. package/dist/icons/providers/fontawesome.provider.js +25 -0
  53. package/dist/icons/providers/mdi.provider.d.ts +3 -0
  54. package/dist/icons/providers/mdi.provider.js +13 -0
  55. package/dist/icons/providers/phosphor.provider.d.ts +3 -0
  56. package/dist/icons/providers/phosphor.provider.js +17 -0
  57. package/dist/icons/registry.d.ts +22 -0
  58. package/dist/icons/registry.js +12 -0
  59. package/dist/index.d.ts +29 -0
  60. package/dist/index.js +29 -0
  61. package/dist/layouts/layout.component.d.ts +24 -0
  62. package/dist/layouts/layout.component.js +255 -0
  63. package/dist/layouts/slot.component.d.ts +61 -0
  64. package/dist/layouts/slot.component.js +937 -0
  65. package/dist/providers.d.ts +12 -0
  66. package/dist/providers.js +18 -0
  67. package/dist/services/fylib.service.d.ts +31 -0
  68. package/dist/services/fylib.service.js +214 -0
  69. package/dist/services/notification.service.d.ts +27 -0
  70. package/dist/services/notification.service.js +118 -0
  71. package/dist/services/sse.service.d.ts +16 -0
  72. package/dist/services/sse.service.js +109 -0
  73. package/dist/services/webclient.service.d.ts +38 -0
  74. package/dist/services/webclient.service.js +144 -0
  75. package/package.json +43 -0
@@ -0,0 +1,383 @@
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, HostBinding, inject } from '@angular/core';
11
+ import { CommonModule } from '@angular/common';
12
+ import { InputDefinition } from '@fylib/catalog';
13
+ import { FyIconComponent } from './icon.component';
14
+ import { resolveAnimationsActive } from '../base/interaction.utils';
15
+ import { BaseFyComponent } from '../base/base-component';
16
+ import { logger } from '@fylib/logger';
17
+ let FyInputComponent = class FyInputComponent extends BaseFyComponent {
18
+ get animationsDisabled() {
19
+ return !this.isAnimationsActive(this.activeAnimations);
20
+ }
21
+ get hostStyles() {
22
+ return this.getHostStyles(this.customStyles);
23
+ }
24
+ get visibleType() {
25
+ return this._passwordVisible && this.type === 'password' ? 'text' : (this.type || 'text');
26
+ }
27
+ get animationClassSuffix() {
28
+ const focus = this.resolveAnim('focus', this.focusAnimation, InputDefinition.features?.animations?.focus);
29
+ const key = this.status === 'success' ? 'success' : (this.status === 'error' ? 'error' : undefined);
30
+ const state = key
31
+ ? this.resolveAnim(key, key === 'success' ? this.successAnimation : this.errorAnimation, InputDefinition.features?.animations?.[key])
32
+ : undefined;
33
+ return this.composeAnimClasses(focus, state);
34
+ }
35
+ constructor() {
36
+ super(inject(require('../services/fylib.service').FyLibService), 'fy-input');
37
+ this.type = InputDefinition.defaultProps.type;
38
+ this.disabled = InputDefinition.defaultProps.disabled;
39
+ this.readonly = InputDefinition.defaultProps.readonly;
40
+ this.showPasswordToggle = InputDefinition.defaultProps.showPasswordToggle;
41
+ this.size = InputDefinition.defaultProps.size;
42
+ this.status = InputDefinition.defaultProps.status;
43
+ this.activeAnimations = null;
44
+ this.activeEffects = null;
45
+ this.customStyles = null;
46
+ // Eventos Angular (não conflitam com o contrato do catálogo)
47
+ this.fyInput = new EventEmitter();
48
+ this.fyChange = new EventEmitter();
49
+ this.fyFocus = new EventEmitter();
50
+ this.fyBlur = new EventEmitter();
51
+ this._passwordVisible = false;
52
+ const t = this.fylib.tokens();
53
+ const iconsCfg = (t.effects || {}).input?.icons || {};
54
+ const name = iconsCfg.name;
55
+ const position = iconsCfg.position;
56
+ if (name) {
57
+ if (!this.iconLeftName && !this.iconRightName) {
58
+ if (position === 'right') {
59
+ this.iconRightName = name;
60
+ }
61
+ else {
62
+ this.iconLeftName = name;
63
+ }
64
+ }
65
+ }
66
+ }
67
+ togglePassword() {
68
+ this._passwordVisible = !this._passwordVisible;
69
+ }
70
+ onInputHandler(event) {
71
+ const target = event.target;
72
+ let v = target.value || '';
73
+ if (this.mask) {
74
+ v = this.applyMask(v, this.mask);
75
+ target.value = v;
76
+ }
77
+ this.value = v;
78
+ if (this.onInput)
79
+ this.onInput(v);
80
+ this.fyInput.emit(v);
81
+ }
82
+ onChangeHandler(event) {
83
+ const target = event.target;
84
+ const v = target.value || '';
85
+ if (this.onChange)
86
+ this.onChange(v);
87
+ this.fyChange.emit(v);
88
+ }
89
+ onFocusHandler() {
90
+ logger.debug('Component', 'Input focused', { placeholder: this.placeholder });
91
+ if (this.isAnimationsActive(this.activeAnimations)) {
92
+ const name = this.resolveAnim('focus', this.focusAnimation, InputDefinition.features?.animations?.focus);
93
+ if (name)
94
+ this.fylib.playAnimation(name);
95
+ if (this.focusEffect)
96
+ this.triggerDirect(this.focusEffect, this.activeEffects);
97
+ else
98
+ this.triggerByEvent('fy-input.focus', undefined, this.activeEffects);
99
+ }
100
+ if (this.onFocus)
101
+ this.onFocus();
102
+ this.fyFocus.emit();
103
+ }
104
+ onBlurHandler() {
105
+ logger.debug('Component', 'Input blurred', { value: this.value });
106
+ if (this.onBlur)
107
+ this.onBlur();
108
+ this.fyBlur.emit();
109
+ }
110
+ resolveAnimationsActive() {
111
+ return resolveAnimationsActive(this.fylib, 'fy-input', this.activeAnimations);
112
+ }
113
+ applyMask(value, mask) {
114
+ const digits = value.replace(/\D+/g, '');
115
+ let i = 0;
116
+ let out = '';
117
+ for (const ch of mask) {
118
+ if (ch === '9') {
119
+ if (i < digits.length)
120
+ out += digits[i++];
121
+ else
122
+ break;
123
+ }
124
+ else {
125
+ out += ch;
126
+ }
127
+ }
128
+ return out;
129
+ }
130
+ };
131
+ __decorate([
132
+ Input(),
133
+ __metadata("design:type", String)
134
+ ], FyInputComponent.prototype, "value", void 0);
135
+ __decorate([
136
+ Input(),
137
+ __metadata("design:type", String)
138
+ ], FyInputComponent.prototype, "placeholder", void 0);
139
+ __decorate([
140
+ Input(),
141
+ __metadata("design:type", Object)
142
+ ], FyInputComponent.prototype, "type", void 0);
143
+ __decorate([
144
+ Input(),
145
+ __metadata("design:type", Boolean)
146
+ ], FyInputComponent.prototype, "disabled", void 0);
147
+ __decorate([
148
+ Input(),
149
+ __metadata("design:type", Boolean)
150
+ ], FyInputComponent.prototype, "readonly", void 0);
151
+ __decorate([
152
+ Input(),
153
+ __metadata("design:type", String)
154
+ ], FyInputComponent.prototype, "mask", void 0);
155
+ __decorate([
156
+ Input(),
157
+ __metadata("design:type", Boolean)
158
+ ], FyInputComponent.prototype, "showPasswordToggle", void 0);
159
+ __decorate([
160
+ Input(),
161
+ __metadata("design:type", String)
162
+ ], FyInputComponent.prototype, "iconLeft", void 0);
163
+ __decorate([
164
+ Input(),
165
+ __metadata("design:type", String)
166
+ ], FyInputComponent.prototype, "iconRight", void 0);
167
+ __decorate([
168
+ Input(),
169
+ __metadata("design:type", String)
170
+ ], FyInputComponent.prototype, "iconLeftName", void 0);
171
+ __decorate([
172
+ Input(),
173
+ __metadata("design:type", String)
174
+ ], FyInputComponent.prototype, "iconRightName", void 0);
175
+ __decorate([
176
+ Input(),
177
+ __metadata("design:type", Object)
178
+ ], FyInputComponent.prototype, "size", void 0);
179
+ __decorate([
180
+ Input(),
181
+ __metadata("design:type", Object)
182
+ ], FyInputComponent.prototype, "status", void 0);
183
+ __decorate([
184
+ Input(),
185
+ __metadata("design:type", Object)
186
+ ], FyInputComponent.prototype, "activeAnimations", void 0);
187
+ __decorate([
188
+ Input(),
189
+ __metadata("design:type", Object)
190
+ ], FyInputComponent.prototype, "activeEffects", void 0);
191
+ __decorate([
192
+ Input(),
193
+ __metadata("design:type", Object)
194
+ ], FyInputComponent.prototype, "customStyles", void 0);
195
+ __decorate([
196
+ Input(),
197
+ __metadata("design:type", String)
198
+ ], FyInputComponent.prototype, "focusAnimation", void 0);
199
+ __decorate([
200
+ Input(),
201
+ __metadata("design:type", String)
202
+ ], FyInputComponent.prototype, "successAnimation", void 0);
203
+ __decorate([
204
+ Input(),
205
+ __metadata("design:type", String)
206
+ ], FyInputComponent.prototype, "errorAnimation", void 0);
207
+ __decorate([
208
+ Input(),
209
+ __metadata("design:type", String)
210
+ ], FyInputComponent.prototype, "focusEffect", void 0);
211
+ __decorate([
212
+ Input(),
213
+ __metadata("design:type", String)
214
+ ], FyInputComponent.prototype, "successEffect", void 0);
215
+ __decorate([
216
+ Input(),
217
+ __metadata("design:type", String)
218
+ ], FyInputComponent.prototype, "errorEffect", void 0);
219
+ __decorate([
220
+ Input(),
221
+ __metadata("design:type", Function)
222
+ ], FyInputComponent.prototype, "onInput", void 0);
223
+ __decorate([
224
+ Input(),
225
+ __metadata("design:type", Function)
226
+ ], FyInputComponent.prototype, "onChange", void 0);
227
+ __decorate([
228
+ Input(),
229
+ __metadata("design:type", Function)
230
+ ], FyInputComponent.prototype, "onFocus", void 0);
231
+ __decorate([
232
+ Input(),
233
+ __metadata("design:type", Function)
234
+ ], FyInputComponent.prototype, "onBlur", void 0);
235
+ __decorate([
236
+ Output(),
237
+ __metadata("design:type", Object)
238
+ ], FyInputComponent.prototype, "fyInput", void 0);
239
+ __decorate([
240
+ Output(),
241
+ __metadata("design:type", Object)
242
+ ], FyInputComponent.prototype, "fyChange", void 0);
243
+ __decorate([
244
+ Output(),
245
+ __metadata("design:type", Object)
246
+ ], FyInputComponent.prototype, "fyFocus", void 0);
247
+ __decorate([
248
+ Output(),
249
+ __metadata("design:type", Object)
250
+ ], FyInputComponent.prototype, "fyBlur", void 0);
251
+ __decorate([
252
+ HostBinding('class.fy-animations-disabled'),
253
+ __metadata("design:type", Boolean),
254
+ __metadata("design:paramtypes", [])
255
+ ], FyInputComponent.prototype, "animationsDisabled", null);
256
+ __decorate([
257
+ HostBinding('style'),
258
+ __metadata("design:type", String),
259
+ __metadata("design:paramtypes", [])
260
+ ], FyInputComponent.prototype, "hostStyles", null);
261
+ FyInputComponent = __decorate([
262
+ Component({
263
+ selector: 'fy-input',
264
+ standalone: true,
265
+ imports: [CommonModule, FyIconComponent],
266
+ template: `
267
+ <div
268
+ class="fy-input"
269
+ [class.fy-input--with-left]="iconLeft || iconLeftName"
270
+ [class.fy-input--with-right]="iconRight || iconRightName"
271
+ [class.fy-input--sm]="size === 'sm'"
272
+ [class.fy-input--lg]="size === 'lg'"
273
+ [class.fy-input--status-success]="status === 'success'"
274
+ [class.fy-input--status-error]="status === 'error'"
275
+ [class]="animationClassSuffix"
276
+ >
277
+ @if (iconLeftName) {
278
+ <fy-icon class="fy-input__icon fy-input__icon--left" [name]="iconLeftName"></fy-icon>
279
+ } @else if (iconLeft) {
280
+ <span class="fy-input__icon fy-input__icon--left" [class]="iconLeft"></span>
281
+ }
282
+ <input
283
+ class="fy-input__field"
284
+ [attr.type]="visibleType"
285
+ [attr.placeholder]="placeholder || null"
286
+ [disabled]="disabled"
287
+ [readOnly]="readonly"
288
+ [value]="value ?? ''"
289
+ [attr.aria-invalid]="status === 'error'"
290
+ [attr.aria-label]="placeholder"
291
+ (input)="onInputHandler($event)"
292
+ (change)="onChangeHandler($event)"
293
+ (focus)="onFocusHandler()"
294
+ (blur)="onBlurHandler()"
295
+ />
296
+ @if (type === 'password' && showPasswordToggle) {
297
+ <button
298
+ type="button"
299
+ class="fy-input__toggle"
300
+ (click)="togglePassword()"
301
+ [attr.aria-label]="visibleType === 'password' ? 'Mostrar senha' : 'Ocultar senha'"
302
+ ></button>
303
+ }
304
+ @if (iconRightName) {
305
+ <fy-icon class="fy-input__icon fy-input__icon--right" [name]="iconRightName"></fy-icon>
306
+ } @else if (iconRight) {
307
+ <span class="fy-input__icon fy-input__icon--right" [class]="iconRight"></span>
308
+ }
309
+ </div>
310
+ `,
311
+ styles: [`
312
+ .fy-input {
313
+ position: relative;
314
+ display: inline-flex;
315
+ align-items: center;
316
+ width: 100%;
317
+ max-width: 100%;
318
+ border: var(--fy-effects-input-borderWidth, 1px) solid var(--fy-effects-input-borderColor, rgba(0,0,0,0.15));
319
+ background: var(--fy-effects-input-background, #fff);
320
+ border-radius: var(--fy-effects-input-borderRadius, var(--fy-borderRadius-md));
321
+ box-shadow: var(--fy-effects-input-shadow, none);
322
+ transition: box-shadow .2s ease, border-color .2s ease, background-color .2s ease;
323
+ color: var(--fy-colors-textOverlay, var(--fy-colors-text));
324
+ min-height: 36px;
325
+ padding: 0 10px;
326
+ gap: 6px;
327
+ }
328
+
329
+ .fy-animations-disabled, .fy-animations-disabled * {
330
+ transition: none !important;
331
+ animation: none !important;
332
+ }
333
+
334
+ .fy-input--sm { min-height: 30px; border-radius: var(--fy-borderRadius-sm); }
335
+ .fy-input--lg { min-height: 42px; border-radius: var(--fy-borderRadius-lg); }
336
+
337
+ .fy-input--status-success {
338
+ border-color: var(--fy-colors-success, #22c55e);
339
+ background: rgba(34, 197, 94, 0.04);
340
+ }
341
+
342
+ .fy-input--status-error {
343
+ border-color: var(--fy-colors-danger, #ef4444);
344
+ background: rgba(239, 68, 68, 0.04);
345
+ }
346
+
347
+ .fy-input__field {
348
+ flex: 1 1 auto;
349
+ border: 0;
350
+ outline: 0;
351
+ background: transparent;
352
+ font: inherit;
353
+ color: inherit;
354
+ min-width: 0;
355
+ height: 100%;
356
+ }
357
+ .fy-input__field::placeholder {
358
+ color: var(--fy-effects-input-placeholderColor, #6b7280);
359
+ opacity: .8;
360
+ }
361
+
362
+ .fy-input__icon {
363
+ width: 16px;
364
+ height: 16px;
365
+ opacity: .9;
366
+ flex: 0 0 auto;
367
+ color: var(--fy-effects-input-icons-color, currentColor);
368
+ }
369
+
370
+ .fy-input__toggle {
371
+ width: 20px;
372
+ height: 20px;
373
+ border: 0;
374
+ background: transparent;
375
+ cursor: pointer;
376
+ flex: 0 0 auto;
377
+ }
378
+ `],
379
+ encapsulation: ViewEncapsulation.None
380
+ }),
381
+ __metadata("design:paramtypes", [])
382
+ ], FyInputComponent);
383
+ export { FyInputComponent };
@@ -0,0 +1,46 @@
1
+ import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
+ import { ModalProps } from '@fylib/catalog';
3
+ import { BaseFyComponent, FyComponentBaseInputs } from '../base/base-component';
4
+ export declare class FyModalComponent extends BaseFyComponent<'fy-modal'> implements ModalProps, FyComponentBaseInputs, OnChanges {
5
+ visible: boolean;
6
+ title?: string;
7
+ subtitle?: string;
8
+ content?: string;
9
+ size: NonNullable<ModalProps['size']>;
10
+ position: NonNullable<ModalProps['position']>;
11
+ status: NonNullable<ModalProps['status']>;
12
+ closable: boolean;
13
+ closeOnEscape: boolean;
14
+ closeOnBackdrop: boolean;
15
+ showHeader: boolean;
16
+ showFooter: boolean;
17
+ showConfirmButton: boolean;
18
+ showCancelButton: boolean;
19
+ confirmText?: string;
20
+ cancelText?: string;
21
+ loading: boolean;
22
+ centered: boolean;
23
+ blockScroll: boolean;
24
+ draggable: boolean;
25
+ resizable: boolean;
26
+ activeAnimations: boolean | null;
27
+ activeEffects: boolean | null;
28
+ customStyles: Record<string, string> | null;
29
+ onOpen?: () => void;
30
+ onClose?: () => void;
31
+ onConfirm?: () => void;
32
+ onCancel?: () => void;
33
+ fyOpen: EventEmitter<void>;
34
+ fyClose: EventEmitter<void>;
35
+ fyConfirm: EventEmitter<void>;
36
+ fyCancel: EventEmitter<void>;
37
+ get animationsDisabled(): boolean;
38
+ get hostStyles(): string;
39
+ constructor();
40
+ modalAnimClass: string;
41
+ ngOnChanges(changes: SimpleChanges): void;
42
+ handleConfirm(): void;
43
+ handleCancel(): void;
44
+ onBackdropClick(): void;
45
+ onKeydown(event: KeyboardEvent): void;
46
+ }