@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,18 @@
1
+ import { FyLibService } from '../services/fylib.service';
2
+ import { ComponentSelector, UIEventKey, EffectName } from '@fylib/config';
3
+ export interface FyComponentBaseInputs {
4
+ activeAnimations?: boolean | null;
5
+ activeEffects?: boolean | null;
6
+ customStyles?: Record<string, string> | null;
7
+ }
8
+ export declare abstract class BaseFyComponent<TSelector extends ComponentSelector> {
9
+ protected fylib: FyLibService;
10
+ protected selector: TSelector;
11
+ protected constructor(fylib: FyLibService, selector: TSelector);
12
+ protected isAnimationsActive(instanceFlag: boolean | null | undefined): boolean;
13
+ protected getHostStyles(style: Record<string, string> | null | undefined): string;
14
+ protected resolveAnim(event: string, instanceOverride?: string, definitionFallback?: string): string | undefined;
15
+ protected composeAnimClasses(...names: Array<string | undefined>): string;
16
+ protected triggerByEvent(eventKey: UIEventKey, effectName?: EffectName, instanceFlag?: boolean | null): void;
17
+ protected triggerDirect(effectName?: EffectName, instanceFlag?: boolean | null): void;
18
+ }
@@ -0,0 +1,36 @@
1
+ import { resolveAnimationsActive, resolveAnimationName, animationClasses, triggerEffectForEvent, styleString } from './interaction.utils';
2
+ export class BaseFyComponent {
3
+ constructor(fylib, selector) {
4
+ this.fylib = fylib;
5
+ this.selector = selector;
6
+ }
7
+ isAnimationsActive(instanceFlag) {
8
+ return resolveAnimationsActive(this.fylib, this.selector, instanceFlag);
9
+ }
10
+ getHostStyles(style) {
11
+ return styleString(style || null);
12
+ }
13
+ resolveAnim(event, instanceOverride, definitionFallback) {
14
+ return resolveAnimationName(this.fylib, this.selector, event, instanceOverride, definitionFallback);
15
+ }
16
+ composeAnimClasses(...names) {
17
+ return animationClasses(...names);
18
+ }
19
+ triggerByEvent(eventKey, effectName, instanceFlag) {
20
+ if (instanceFlag === false)
21
+ return;
22
+ if (effectName) {
23
+ this.fylib.triggerEffect(effectName);
24
+ }
25
+ else {
26
+ triggerEffectForEvent(this.fylib, eventKey, this.selector, instanceFlag ?? null);
27
+ }
28
+ }
29
+ triggerDirect(effectName, instanceFlag) {
30
+ if (!effectName)
31
+ return;
32
+ if (instanceFlag === false)
33
+ return;
34
+ this.fylib.triggerEffect(effectName);
35
+ }
36
+ }
@@ -0,0 +1,7 @@
1
+ import { FyLibService } from '../services/fylib.service';
2
+ import { ComponentSelector, UIEventKey } from '@fylib/config';
3
+ export declare function resolveAnimationsActive(fylib: FyLibService, selector: ComponentSelector, instanceFlag: boolean | null | undefined): boolean;
4
+ export declare function resolveAnimationName(fylib: FyLibService, selector: ComponentSelector, event: string, instanceOverride?: string | undefined, definitionFallback?: string | undefined): string | undefined;
5
+ export declare function animationClasses(...names: Array<string | undefined>): string;
6
+ export declare function triggerEffectForEvent(fylib: FyLibService, eventKey: UIEventKey, selector?: ComponentSelector, instanceFlag?: boolean | null): void;
7
+ export declare function styleString(style: Record<string, string> | null | undefined): string;
@@ -0,0 +1,34 @@
1
+ export function resolveAnimationsActive(fylib, selector, instanceFlag) {
2
+ const globalEnabledForComponent = fylib.isAnimationsEnabledFor(selector);
3
+ if (instanceFlag === false)
4
+ return false;
5
+ if (instanceFlag === true)
6
+ return globalEnabledForComponent;
7
+ return globalEnabledForComponent;
8
+ }
9
+ export function resolveAnimationName(fylib, selector, event, instanceOverride, definitionFallback) {
10
+ if (instanceOverride)
11
+ return instanceOverride;
12
+ const fromTheme = fylib.getComponentAnimation(selector, event);
13
+ if (fromTheme)
14
+ return fromTheme;
15
+ return definitionFallback;
16
+ }
17
+ export function animationClasses(...names) {
18
+ const classes = [];
19
+ for (const n of names) {
20
+ if (n)
21
+ classes.push(` fy-anim-${n}`);
22
+ }
23
+ return classes.join('');
24
+ }
25
+ export function triggerEffectForEvent(fylib, eventKey, selector, instanceFlag) {
26
+ fylib.triggerEffectForEvent(eventKey, selector, instanceFlag ?? null);
27
+ }
28
+ export function styleString(style) {
29
+ if (!style)
30
+ return '';
31
+ return Object.entries(style)
32
+ .map(([k, v]) => `${k}: ${v}`)
33
+ .join('; ');
34
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { animationClasses, styleString } from './interaction.utils';
3
+ describe('interaction.utils', () => {
4
+ describe('animationClasses', () => {
5
+ it('should return empty string for no names', () => {
6
+ expect(animationClasses()).toBe('');
7
+ });
8
+ it('should compose animation classes with prefix', () => {
9
+ expect(animationClasses('fade-in', 'slide-up')).toBe(' fy-anim-fade-in fy-anim-slide-up');
10
+ });
11
+ it('should ignore undefined or empty names', () => {
12
+ expect(animationClasses('fade-in', undefined, '')).toBe(' fy-anim-fade-in');
13
+ });
14
+ });
15
+ describe('styleString', () => {
16
+ it('should return empty string for null/undefined', () => {
17
+ expect(styleString(null)).toBe('');
18
+ expect(styleString(undefined)).toBe('');
19
+ });
20
+ it('should convert object to style string', () => {
21
+ const styles = { color: 'red', 'font-size': '12px' };
22
+ expect(styleString(styles)).toBe('color: red; font-size: 12px');
23
+ });
24
+ });
25
+ });
@@ -0,0 +1,32 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { AccordionProps, AccordionItem, AccordionExpandMode } from '@fylib/catalog';
3
+ import { BaseFyComponent, FyComponentBaseInputs } from '../base/base-component';
4
+ export declare class FyAccordionComponent extends BaseFyComponent<'fy-accordion'> implements AccordionProps, FyComponentBaseInputs {
5
+ constructor();
6
+ items: AccordionItem[];
7
+ activeIndex?: number | number[];
8
+ expandMode: AccordionExpandMode;
9
+ size: AccordionProps['size'];
10
+ status: AccordionProps['status'];
11
+ bordered: boolean;
12
+ flush: boolean;
13
+ animated: boolean;
14
+ lazy: boolean;
15
+ iconPosition: 'left' | 'right';
16
+ disabled: boolean;
17
+ onOpen?: (index: number) => void;
18
+ onClose?: (index: number) => void;
19
+ onChange?: (activeIndex: number | number[]) => void;
20
+ activeAnimations: boolean | null;
21
+ activeEffects: boolean | null;
22
+ customStyles: Record<string, string> | null;
23
+ fyOpen: EventEmitter<number>;
24
+ fyClose: EventEmitter<number>;
25
+ fyChange: EventEmitter<number | number[]>;
26
+ get animationsDisabled(): boolean;
27
+ get hostStyles(): string;
28
+ getPanelClasses(i: number): Record<string, boolean | string | undefined>;
29
+ isActive(i: number): boolean;
30
+ handleKeyDown(event: KeyboardEvent, index: number): void;
31
+ toggle(i: number): void;
32
+ }
@@ -0,0 +1,337 @@
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 { AccordionDefinition } from '@fylib/catalog';
13
+ import { BaseFyComponent } from '../base/base-component';
14
+ import { FyLibService } from '../services/fylib.service';
15
+ let FyAccordionComponent = class FyAccordionComponent extends BaseFyComponent {
16
+ constructor() {
17
+ super(inject(FyLibService), 'fy-accordion');
18
+ this.items = AccordionDefinition.defaultProps.items;
19
+ this.expandMode = AccordionDefinition.defaultProps.expandMode;
20
+ this.size = AccordionDefinition.defaultProps.size;
21
+ this.status = AccordionDefinition.defaultProps.status;
22
+ this.bordered = AccordionDefinition.defaultProps.bordered;
23
+ this.flush = AccordionDefinition.defaultProps.flush;
24
+ this.animated = AccordionDefinition.defaultProps.animated;
25
+ this.lazy = AccordionDefinition.defaultProps.lazy;
26
+ this.iconPosition = AccordionDefinition.defaultProps.iconPosition;
27
+ this.disabled = AccordionDefinition.defaultProps.disabled;
28
+ this.activeAnimations = null;
29
+ this.activeEffects = null;
30
+ this.customStyles = null;
31
+ this.fyOpen = new EventEmitter();
32
+ this.fyClose = new EventEmitter();
33
+ this.fyChange = new EventEmitter();
34
+ }
35
+ get animationsDisabled() { return !this.isAnimationsActive(this.activeAnimations); }
36
+ get hostStyles() { return this.getHostStyles(this.customStyles); }
37
+ getPanelClasses(i) {
38
+ const active = this.isActive(i);
39
+ const animClass = active
40
+ ? this.resolveAnim('expand', undefined, 'accordion-expand')
41
+ : this.resolveAnim('collapse', undefined, 'accordion-collapse');
42
+ const classes = {
43
+ 'fy-accordion__panel-wrapper--active': active
44
+ };
45
+ if (animClass) {
46
+ classes[animClass] = true;
47
+ }
48
+ return classes;
49
+ }
50
+ isActive(i) {
51
+ const val = this.activeIndex;
52
+ if (this.expandMode === 'multiple') {
53
+ if (Array.isArray(val)) {
54
+ return val.includes(i);
55
+ }
56
+ return val === i;
57
+ }
58
+ return val === i;
59
+ }
60
+ handleKeyDown(event, index) {
61
+ if (event.key === 'Enter' || event.key === ' ') {
62
+ event.preventDefault();
63
+ this.toggle(index);
64
+ }
65
+ }
66
+ toggle(i) {
67
+ if (this.disabled || this.items[i]?.disabled)
68
+ return;
69
+ const wasActive = this.isActive(i);
70
+ if (this.expandMode === 'single') {
71
+ this.activeIndex = wasActive ? undefined : i;
72
+ }
73
+ else {
74
+ const current = Array.isArray(this.activeIndex)
75
+ ? [...this.activeIndex]
76
+ : (this.activeIndex !== undefined ? [this.activeIndex] : []);
77
+ const idx = current.indexOf(i);
78
+ if (idx >= 0) {
79
+ current.splice(idx, 1);
80
+ }
81
+ else {
82
+ current.push(i);
83
+ }
84
+ this.activeIndex = current;
85
+ }
86
+ if (this.isAnimationsActive(this.activeAnimations) && this.animated) {
87
+ const event = wasActive ? 'collapse' : 'expand';
88
+ const name = this.resolveAnim(event, undefined, AccordionDefinition.features?.animations?.[event]);
89
+ if (name)
90
+ this.fylib.playAnimation(name);
91
+ }
92
+ if (!wasActive) {
93
+ if (this.onOpen)
94
+ this.onOpen(i);
95
+ this.fyOpen.emit(i);
96
+ }
97
+ else {
98
+ if (this.onClose)
99
+ this.onClose(i);
100
+ this.fyClose.emit(i);
101
+ }
102
+ const emitValue = this.activeIndex ?? (this.expandMode === 'single' ? -1 : []);
103
+ if (this.onChange)
104
+ this.onChange(emitValue);
105
+ this.fyChange.emit(emitValue);
106
+ }
107
+ };
108
+ __decorate([
109
+ Input(),
110
+ __metadata("design:type", Array)
111
+ ], FyAccordionComponent.prototype, "items", void 0);
112
+ __decorate([
113
+ Input(),
114
+ __metadata("design:type", Object)
115
+ ], FyAccordionComponent.prototype, "activeIndex", void 0);
116
+ __decorate([
117
+ Input(),
118
+ __metadata("design:type", String)
119
+ ], FyAccordionComponent.prototype, "expandMode", void 0);
120
+ __decorate([
121
+ Input(),
122
+ __metadata("design:type", Object)
123
+ ], FyAccordionComponent.prototype, "size", void 0);
124
+ __decorate([
125
+ Input(),
126
+ __metadata("design:type", Object)
127
+ ], FyAccordionComponent.prototype, "status", void 0);
128
+ __decorate([
129
+ Input(),
130
+ __metadata("design:type", Boolean)
131
+ ], FyAccordionComponent.prototype, "bordered", void 0);
132
+ __decorate([
133
+ Input(),
134
+ __metadata("design:type", Boolean)
135
+ ], FyAccordionComponent.prototype, "flush", void 0);
136
+ __decorate([
137
+ Input(),
138
+ __metadata("design:type", Boolean)
139
+ ], FyAccordionComponent.prototype, "animated", void 0);
140
+ __decorate([
141
+ Input(),
142
+ __metadata("design:type", Boolean)
143
+ ], FyAccordionComponent.prototype, "lazy", void 0);
144
+ __decorate([
145
+ Input(),
146
+ __metadata("design:type", String)
147
+ ], FyAccordionComponent.prototype, "iconPosition", void 0);
148
+ __decorate([
149
+ Input(),
150
+ __metadata("design:type", Boolean)
151
+ ], FyAccordionComponent.prototype, "disabled", void 0);
152
+ __decorate([
153
+ Input(),
154
+ __metadata("design:type", Function)
155
+ ], FyAccordionComponent.prototype, "onOpen", void 0);
156
+ __decorate([
157
+ Input(),
158
+ __metadata("design:type", Function)
159
+ ], FyAccordionComponent.prototype, "onClose", void 0);
160
+ __decorate([
161
+ Input(),
162
+ __metadata("design:type", Function)
163
+ ], FyAccordionComponent.prototype, "onChange", void 0);
164
+ __decorate([
165
+ Input(),
166
+ __metadata("design:type", Object)
167
+ ], FyAccordionComponent.prototype, "activeAnimations", void 0);
168
+ __decorate([
169
+ Input(),
170
+ __metadata("design:type", Object)
171
+ ], FyAccordionComponent.prototype, "activeEffects", void 0);
172
+ __decorate([
173
+ Input(),
174
+ __metadata("design:type", Object)
175
+ ], FyAccordionComponent.prototype, "customStyles", void 0);
176
+ __decorate([
177
+ Output(),
178
+ __metadata("design:type", Object)
179
+ ], FyAccordionComponent.prototype, "fyOpen", void 0);
180
+ __decorate([
181
+ Output(),
182
+ __metadata("design:type", Object)
183
+ ], FyAccordionComponent.prototype, "fyClose", void 0);
184
+ __decorate([
185
+ Output(),
186
+ __metadata("design:type", Object)
187
+ ], FyAccordionComponent.prototype, "fyChange", void 0);
188
+ __decorate([
189
+ HostBinding('class.fy-animations-disabled'),
190
+ __metadata("design:type", Object),
191
+ __metadata("design:paramtypes", [])
192
+ ], FyAccordionComponent.prototype, "animationsDisabled", null);
193
+ __decorate([
194
+ HostBinding('style'),
195
+ __metadata("design:type", String),
196
+ __metadata("design:paramtypes", [])
197
+ ], FyAccordionComponent.prototype, "hostStyles", null);
198
+ FyAccordionComponent = __decorate([
199
+ Component({
200
+ selector: 'fy-accordion',
201
+ standalone: true,
202
+ imports: [CommonModule],
203
+ template: `
204
+ <div class="fy-accordion"
205
+ [class.fy-accordion--bordered]="bordered"
206
+ [class.fy-accordion--flush]="flush"
207
+ role="presentation">
208
+ @for (it of items; track it.id; let i = $index) {
209
+ <section class="fy-accordion__item"
210
+ [class.fy-accordion__item--active]="isActive(i)"
211
+ [class.fy-accordion__item--disabled]="it.disabled">
212
+ <header class="fy-accordion__header"
213
+ (click)="toggle(i)"
214
+ (keydown)="handleKeyDown($event, i)"
215
+ [attr.aria-expanded]="isActive(i)"
216
+ [attr.aria-controls]="'fy-accordion-panel-' + it.id"
217
+ [attr.aria-disabled]="it.disabled || disabled"
218
+ [attr.id]="'fy-accordion-header-' + it.id"
219
+ [tabindex]="it.disabled || disabled ? -1 : 0"
220
+ role="button">
221
+ <div class="fy-accordion__header-main">
222
+ <h4 class="fy-accordion__title">{{ it.title }}</h4>
223
+ @if (it.subtitle) { <p class="fy-accordion__subtitle">{{ it.subtitle }}</p> }
224
+ </div>
225
+ <span class="fy-accordion__indicator"
226
+ [class.fy-accordion__indicator--open]="isActive(i)"
227
+ aria-hidden="true">▾</span>
228
+ </header>
229
+
230
+ <div
231
+ class="fy-accordion__panel-wrapper"
232
+ [ngClass]="getPanelClasses(i)"
233
+ [attr.id]="'fy-accordion-panel-' + it.id"
234
+ [attr.aria-labelledby]="'fy-accordion-header-' + it.id"
235
+ [attr.aria-hidden]="!isActive(i)"
236
+ role="region"
237
+ >
238
+ <div class="fy-accordion__panel">
239
+ @if (!lazy || isActive(i)) {
240
+ @if (it.content) {
241
+ <div class="fy-accordion__content">{{ it.content }}</div>
242
+ } @else {
243
+ <ng-content select="[fy-accordion-item-content={{it.id}}]"></ng-content>
244
+ }
245
+ }
246
+ </div>
247
+ </div>
248
+ </section>
249
+ }
250
+ </div>
251
+ `,
252
+ styles: [`
253
+ .fy-accordion {
254
+ display: flex;
255
+ flex-direction: column;
256
+ gap: 8px;
257
+ }
258
+ .fy-accordion--bordered {
259
+ border: 1px solid var(--fy-effects-accordion-borderColor, rgba(0,0,0,0.1));
260
+ border-radius: var(--fy-effects-accordion-borderRadius, var(--fy-borderRadius-md));
261
+ padding: 4px;
262
+ background: var(--fy-effects-accordion-background, #fff);
263
+ box-shadow: var(--fy-effects-accordion-shadow, none);
264
+ }
265
+ .fy-accordion--flush { border: none; padding: 0; }
266
+
267
+ .fy-accordion__item {
268
+ background: var(--fy-effects-accordion-background, #fff);
269
+ border: 1px solid var(--fy-effects-accordion-borderColor, rgba(0,0,0,0.1));
270
+ border-radius: var(--fy-effects-accordion-borderRadius, var(--fy-borderRadius-md));
271
+ overflow: hidden;
272
+ }
273
+ .fy-accordion--flush .fy-accordion__item {
274
+ border: none;
275
+ border-radius: 0;
276
+ background: transparent;
277
+ }
278
+
279
+ .fy-accordion__header {
280
+ display: flex;
281
+ align-items: center;
282
+ justify-content: space-between;
283
+ gap: 8px;
284
+ padding: 10px 12px;
285
+ background: var(--fy-effects-accordion-headerBackground, transparent);
286
+ cursor: pointer;
287
+ user-select: none;
288
+ }
289
+ .fy-accordion__title {
290
+ margin: 0;
291
+ font-size: var(--fy-typography-fontSize-md, 14px);
292
+ font-weight: var(--fy-typography-fontWeight-bold, 600);
293
+ }
294
+ .fy-accordion__subtitle {
295
+ margin: 0;
296
+ font-size: var(--fy-typography-fontSize-sm, 11px);
297
+ opacity: .7;
298
+ }
299
+ .fy-accordion__header-main {
300
+ display: flex;
301
+ flex-direction: column;
302
+ gap: 2px;
303
+ }
304
+ .fy-accordion__indicator {
305
+ transition: transform .2s ease;
306
+ }
307
+ .fy-accordion__indicator--open { transform: rotate(180deg); }
308
+
309
+ .fy-accordion__panel-wrapper {
310
+ display: grid;
311
+ grid-template-rows: 0fr;
312
+ transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
313
+ opacity: 0;
314
+ overflow: hidden;
315
+ }
316
+
317
+ .fy-accordion__panel-wrapper--active {
318
+ grid-template-rows: 1fr;
319
+ opacity: 1;
320
+ }
321
+
322
+ .fy-accordion__panel {
323
+ min-height: 0;
324
+ border-top: 1px solid var(--fy-effects-accordion-dividerColor, rgba(0,0,0,0.08));
325
+ padding: 0 12px;
326
+ transition: padding 0.3s ease;
327
+ }
328
+
329
+ .fy-accordion__panel-wrapper--active .fy-accordion__panel {
330
+ padding: 12px;
331
+ }
332
+ `],
333
+ encapsulation: ViewEncapsulation.None
334
+ }),
335
+ __metadata("design:paramtypes", [])
336
+ ], FyAccordionComponent);
337
+ export { FyAccordionComponent };
@@ -0,0 +1,10 @@
1
+ export declare class FyBadgeComponent {
2
+ private fylib;
3
+ text?: string;
4
+ background?: string | null;
5
+ textColor?: string | null;
6
+ borderRadius?: string | null;
7
+ shine?: boolean | null;
8
+ badgeStyle: import("@angular/core").Signal<Record<string, string>>;
9
+ shineClass: import("@angular/core").Signal<boolean>;
10
+ }
@@ -0,0 +1,112 @@
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
+ let FyBadgeComponent = class FyBadgeComponent {
14
+ constructor() {
15
+ this.fylib = inject(FyLibService);
16
+ this.badgeStyle = computed(() => {
17
+ const style = {};
18
+ const tokens = this.fylib.tokens();
19
+ const badgeTokens = tokens?.effects?.badge || tokens?.badge || {};
20
+ const bg = this.background ?? badgeTokens.background ?? null;
21
+ const fg = this.textColor ?? badgeTokens.textColor ?? null;
22
+ const br = this.borderRadius ?? badgeTokens.borderRadius ?? null;
23
+ if (bg)
24
+ style['--fy-badge-background'] = bg;
25
+ if (fg)
26
+ style['--fy-badge-textColor'] = fg;
27
+ if (br)
28
+ style['border-radius'] = br;
29
+ return style;
30
+ });
31
+ this.shineClass = computed(() => {
32
+ const tokens = this.fylib.tokens();
33
+ const badgeTokens = tokens?.effects?.badge || tokens?.badge || {};
34
+ const shineToken = badgeTokens.animation === 'shine';
35
+ return this.shine ?? shineToken;
36
+ });
37
+ }
38
+ };
39
+ __decorate([
40
+ Input(),
41
+ __metadata("design:type", String)
42
+ ], FyBadgeComponent.prototype, "text", void 0);
43
+ __decorate([
44
+ Input(),
45
+ __metadata("design:type", Object)
46
+ ], FyBadgeComponent.prototype, "background", void 0);
47
+ __decorate([
48
+ Input(),
49
+ __metadata("design:type", Object)
50
+ ], FyBadgeComponent.prototype, "textColor", void 0);
51
+ __decorate([
52
+ Input(),
53
+ __metadata("design:type", Object)
54
+ ], FyBadgeComponent.prototype, "borderRadius", void 0);
55
+ __decorate([
56
+ Input(),
57
+ __metadata("design:type", Object)
58
+ ], FyBadgeComponent.prototype, "shine", void 0);
59
+ FyBadgeComponent = __decorate([
60
+ Component({
61
+ selector: 'fy-badge',
62
+ standalone: true,
63
+ imports: [CommonModule],
64
+ template: `
65
+ <span class="fy-badge" [class.fy-badge--shine]="shineClass()" [ngStyle]="badgeStyle()" >
66
+ <ng-content></ng-content>
67
+ @if (text) {
68
+ <span>{{ text }}</span>
69
+ }
70
+ </span>
71
+ `,
72
+ styles: [`
73
+ .fy-badge {
74
+ display: inline-flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ padding: 0 6px;
78
+ min-width: 16px;
79
+ height: 16px;
80
+ font-size: 10px;
81
+ font-weight: 700;
82
+ line-height: 1;
83
+ border-radius: 8px;
84
+ background-color: var(--fy-badge-background, #ff4757);
85
+ color: var(--fy-badge-textColor, #fff);
86
+ box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
87
+ white-space: nowrap;
88
+ }
89
+ .fy-badge.fy-badge--shine {
90
+ position: relative;
91
+ overflow: hidden;
92
+ }
93
+ .fy-badge.fy-badge--shine::after {
94
+ content: '';
95
+ position: absolute;
96
+ top: 0;
97
+ bottom: 0;
98
+ left: -150%;
99
+ width: 50%;
100
+ background: linear-gradient(120deg, transparent, rgba(255,255,255,0.6), transparent);
101
+ transform: skewX(-20deg);
102
+ animation: fy-badge-shine 2.4s linear infinite;
103
+ }
104
+ @keyframes fy-badge-shine {
105
+ 0% { left: -150%; }
106
+ 100% { left: 200%; }
107
+ }
108
+ `],
109
+ encapsulation: ViewEncapsulation.None
110
+ })
111
+ ], FyBadgeComponent);
112
+ export { FyBadgeComponent };
@@ -0,0 +1,33 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import { ButtonProps } from '@fylib/catalog';
3
+ import { ButtonHoverAnimationName, ButtonClickAnimationName, ButtonStateAnimationName } from '@fylib/animation';
4
+ import { EffectName } from '@fylib/config';
5
+ import { BaseFyComponent, FyComponentBaseInputs } from '../base/base-component';
6
+ export declare class FyButtonComponent extends BaseFyComponent<'fy-button'> implements ButtonProps, FyComponentBaseInputs {
7
+ constructor();
8
+ label: string | undefined;
9
+ variant: ButtonProps['variant'];
10
+ size: ButtonProps['size'];
11
+ disabled: boolean;
12
+ loading: boolean;
13
+ icon?: string;
14
+ iconName?: string;
15
+ iconSet?: 'ph' | 'fa' | 'mdi';
16
+ activeAnimations: boolean | null;
17
+ activeEffects: boolean | null;
18
+ customStyles: Record<string, string> | null;
19
+ hoverAnimation?: ButtonHoverAnimationName;
20
+ clickAnimation?: ButtonClickAnimationName;
21
+ successAnimation?: ButtonStateAnimationName;
22
+ errorAnimation?: ButtonStateAnimationName;
23
+ hoverEffect?: EffectName;
24
+ clickEffect?: EffectName;
25
+ successEffect?: EffectName;
26
+ errorEffect?: EffectName;
27
+ fyClick: EventEmitter<MouseEvent>;
28
+ get animationsDisabled(): boolean;
29
+ get hostStyles(): string;
30
+ get animationClassSuffix(): string;
31
+ handleClick(event: MouseEvent): void;
32
+ handleHover(): void;
33
+ }