@tacdaed/fragments 1.0.0-beta.3 → 1.0.0-beta.4
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/README.md +14 -0
- package/ng-package.json +20 -0
- package/package.json +22 -29
- package/src/lib/components/accordion/accordion.component.html +103 -0
- package/src/lib/components/accordion/accordion.component.scss +382 -0
- package/src/lib/components/accordion/accordion.component.spec.ts +147 -0
- package/src/lib/components/accordion/accordion.component.ts +211 -0
- package/src/lib/components/accordion/accordion.type.ts +82 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.html +43 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +112 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +33 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +103 -0
- package/src/lib/components/breadcrumb/breadcrumb.interface.ts +7 -0
- package/src/lib/components/button/button.component.html +57 -0
- package/src/lib/components/button/button.component.scss +445 -0
- package/src/lib/components/button/button.component.spec.ts +99 -0
- package/src/lib/components/button/button.component.ts +143 -0
- package/src/lib/components/button/button.type.ts +7 -0
- package/src/lib/components/card/card.component.html +44 -0
- package/src/lib/components/card/card.component.scss +114 -0
- package/src/lib/components/card/card.component.spec.ts +65 -0
- package/src/lib/components/card/card.component.ts +21 -0
- package/src/lib/components/card/card.type.ts +3 -0
- package/src/lib/components/code-block/code-block.component.html +55 -0
- package/src/lib/components/code-block/code-block.component.scss +122 -0
- package/src/lib/components/code-block/code-block.component.spec.ts +81 -0
- package/src/lib/components/code-block/code-block.component.ts +302 -0
- package/src/lib/components/code-block/code-block.interface.ts +28 -0
- package/src/lib/components/code-block/code-block.type.ts +73 -0
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +14 -0
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +20 -0
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +38 -0
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +181 -0
- package/src/lib/components/input/input-base.ts +187 -0
- package/src/lib/components/input/input-calendar/input-calendar.component.html +76 -0
- package/src/lib/components/input/input-calendar/input-calendar.component.scss +179 -0
- package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +44 -0
- package/src/lib/components/input/input-calendar/input-calendar.component.ts +299 -0
- package/src/lib/components/input/input-checkbox/input-checkbox.component.html +37 -0
- package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +128 -0
- package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +43 -0
- package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +112 -0
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +43 -0
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +140 -0
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +62 -0
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +136 -0
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +81 -0
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +228 -0
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +62 -0
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +178 -0
- package/src/lib/components/input/input-consts.ts +132 -0
- package/src/lib/components/input/input-date/input-date-validators.ts +41 -0
- package/src/lib/components/input/input-date/input-date.component.html +41 -0
- package/src/lib/components/input/input-date/input-date.component.scss +95 -0
- package/src/lib/components/input/input-date/input-date.component.spec.ts +43 -0
- package/src/lib/components/input/input-date/input-date.component.ts +359 -0
- package/src/lib/components/input/input-date-time/input-date-time.component.html +70 -0
- package/src/lib/components/input/input-date-time/input-date-time.component.scss +133 -0
- package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +36 -0
- package/src/lib/components/input/input-date-time/input-date-time.component.ts +387 -0
- package/src/lib/components/input/input-file-upload/input-file-upload.component.html +89 -0
- package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +171 -0
- package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +43 -0
- package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +351 -0
- package/src/lib/components/input/input-interface.ts +8 -0
- package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
- package/src/lib/components/input/input-number/input-number.component.html +51 -0
- package/src/lib/components/input/input-number/input-number.component.scss +140 -0
- package/src/lib/components/input/input-number/input-number.component.spec.ts +44 -0
- package/src/lib/components/input/input-number/input-number.component.ts +343 -0
- package/src/lib/components/input/input-radio-group/input-radio-group.component.html +44 -0
- package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +139 -0
- package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +58 -0
- package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +132 -0
- package/src/lib/components/input/input-slider/input-slider.component.html +111 -0
- package/src/lib/components/input/input-slider/input-slider.component.scss +203 -0
- package/src/lib/components/input/input-slider/input-slider.component.spec.ts +46 -0
- package/src/lib/components/input/input-slider/input-slider.component.ts +410 -0
- package/src/lib/components/input/input-text/input-text-validators.ts +67 -0
- package/src/lib/components/input/input-text/input-text.component.html +71 -0
- package/src/lib/components/input/input-text/input-text.component.scss +118 -0
- package/src/lib/components/input/input-text/input-text.component.spec.ts +55 -0
- package/src/lib/components/input/input-text/input-text.component.ts +215 -0
- package/src/lib/components/input/input-time/input-time-validators.ts +42 -0
- package/src/lib/components/input/input-time/input-time.component.html +92 -0
- package/src/lib/components/input/input-time/input-time.component.scss +191 -0
- package/src/lib/components/input/input-time/input-time.component.spec.ts +39 -0
- package/src/lib/components/input/input-time/input-time.component.ts +691 -0
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +36 -0
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +121 -0
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +54 -0
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +117 -0
- package/src/lib/components/input/input-type.ts +18 -0
- package/src/lib/components/input/input-validation/input-validation.component.html +19 -0
- package/src/lib/components/input/input-validation/input-validation.component.scss +39 -0
- package/src/lib/components/input/input-validation/input-validation.component.spec.ts +45 -0
- package/src/lib/components/input/input-validation/input-validation.component.ts +13 -0
- package/src/lib/components/input/input.pipe.ts +14 -0
- package/src/lib/components/layout/container/container.component.html +1 -0
- package/src/lib/components/layout/container/container.component.scss +33 -0
- package/src/lib/components/layout/container/container.component.ts +32 -0
- package/src/lib/components/layout/container/container.type.ts +1 -0
- package/src/lib/components/layout/divider/divider.component.html +1 -0
- package/src/lib/components/layout/divider/divider.component.scss +60 -0
- package/src/lib/components/layout/divider/divider.component.ts +38 -0
- package/src/lib/components/layout/divider/divider.type.ts +2 -0
- package/src/lib/components/layout/section/section.component.html +21 -0
- package/src/lib/components/layout/section/section.component.scss +43 -0
- package/src/lib/components/layout/section/section.component.ts +33 -0
- package/src/lib/components/layout/section/section.type.ts +2 -0
- package/src/lib/components/layout/separator/separator.component.html +9 -0
- package/src/lib/components/layout/separator/separator.component.scss +52 -0
- package/src/lib/components/layout/separator/separator.component.ts +25 -0
- package/src/lib/components/layout/separator/separator.type.ts +1 -0
- package/src/lib/components/loader/content-blur/content-blur.component.html +13 -0
- package/src/lib/components/loader/content-blur/content-blur.component.scss +43 -0
- package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +42 -0
- package/src/lib/components/loader/content-blur/content-blur.component.ts +34 -0
- package/src/lib/components/loader/loader.type.ts +2 -0
- package/src/lib/components/loader/progress-bar/progress-bar.component.html +26 -0
- package/src/lib/components/loader/progress-bar/progress-bar.component.scss +151 -0
- package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +47 -0
- package/src/lib/components/loader/progress-bar/progress-bar.component.ts +28 -0
- package/src/lib/components/loader/progress-bar/progress-bar.type.ts +8 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +12 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +202 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +55 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +73 -0
- package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +6 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +13 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +113 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +37 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +51 -0
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +6 -0
- package/src/lib/components/loader/spinner/spinner.component.html +20 -0
- package/src/lib/components/loader/spinner/spinner.component.scss +137 -0
- package/src/lib/components/loader/spinner/spinner.component.spec.ts +43 -0
- package/src/lib/components/loader/spinner/spinner.component.ts +32 -0
- package/src/lib/components/loader/spinner/spinner.type.ts +6 -0
- package/src/lib/components/modal/modal.component.html +47 -0
- package/src/lib/components/modal/modal.component.scss +139 -0
- package/src/lib/components/modal/modal.component.spec.ts +60 -0
- package/src/lib/components/modal/modal.component.ts +83 -0
- package/src/lib/components/modal/modal.type.ts +9 -0
- package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +79 -0
- package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +96 -0
- package/src/lib/components/morph/blob-moph/blob-morph.component.html +34 -0
- package/src/lib/components/morph/blob-moph/blob-morph.component.scss +7 -0
- package/src/lib/components/morph/morph.abstract.ts +13 -0
- package/src/lib/components/pagination/pagination.interface.ts +4 -0
- package/src/lib/components/pagination/small-pagination/small-pagination.component.html +61 -0
- package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +187 -0
- package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +88 -0
- package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +177 -0
- package/src/lib/components/selection-lists/multi-select/multi-select.component.html +170 -0
- package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +312 -0
- package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +61 -0
- package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +372 -0
- package/src/lib/components/selection-lists/selection-list/selection-list.component.html +125 -0
- package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +267 -0
- package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +66 -0
- package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +315 -0
- package/src/lib/components/selection-lists/selection-lists-base.ts +35 -0
- package/src/lib/components/selection-lists/selection-lists-const.ts +17 -0
- package/src/lib/components/selection-lists/selection-lists-interface.ts +7 -0
- package/src/lib/components/selection-lists/selection-lists.type.ts +1 -0
- package/src/lib/components/side-nav/side-nav.component.html +101 -0
- package/src/lib/components/side-nav/side-nav.component.scss +295 -0
- package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
- package/src/lib/components/side-nav/side-nav.component.ts +18 -0
- package/src/lib/components/side-nav/side-nav.type.ts +28 -0
- package/src/lib/components/snackbar/snackbar.component.html +33 -0
- package/src/lib/components/snackbar/snackbar.component.scss +195 -0
- package/src/lib/components/snackbar/snackbar.component.ts +112 -0
- package/src/lib/components/snackbar/snackbar.type.ts +27 -0
- package/src/lib/components/status/chip/chip.component.html +51 -0
- package/src/lib/components/status/chip/chip.component.scss +149 -0
- package/src/lib/components/status/chip/chip.component.spec.ts +62 -0
- package/src/lib/components/status/chip/chip.component.ts +83 -0
- package/src/lib/components/status/chip/chip.type.ts +42 -0
- package/src/lib/components/status/directives/badge/badge.directive.spec.ts +60 -0
- package/src/lib/components/status/directives/badge/badge.directive.ts +190 -0
- package/src/lib/components/status/directives/badge/badge.interface.ts +19 -0
- package/src/lib/components/status/pill/pill.component.html +40 -0
- package/src/lib/components/status/pill/pill.component.scss +113 -0
- package/src/lib/components/status/pill/pill.component.spec.ts +47 -0
- package/src/lib/components/status/pill/pill.component.ts +83 -0
- package/src/lib/components/status/pill/pill.type.ts +42 -0
- package/src/lib/components/status/status.interface.ts +57 -0
- package/src/lib/components/status/status.type.ts +62 -0
- package/src/lib/components/status/tag/tag.component.html +39 -0
- package/src/lib/components/status/tag/tag.component.scss +140 -0
- package/src/lib/components/status/tag/tag.component.spec.ts +47 -0
- package/src/lib/components/status/tag/tag.component.ts +83 -0
- package/src/lib/components/status/tag/tag.type.ts +42 -0
- package/src/lib/components/stepper/stepper.component.html +83 -0
- package/src/lib/components/stepper/stepper.component.scss +196 -0
- package/src/lib/components/stepper/stepper.component.ts +482 -0
- package/src/lib/components/stepper/stepper.type.ts +60 -0
- package/src/lib/components/table/table.component.html +438 -0
- package/src/lib/components/table/table.component.scss +259 -0
- package/src/lib/components/table/table.component.spec.ts +117 -0
- package/src/lib/components/table/table.component.ts +215 -0
- package/src/lib/components/table/table.enum.ts +4 -0
- package/src/lib/components/table/table.function.ts +47 -0
- package/src/lib/components/table/table.interface.ts +143 -0
- package/src/lib/components/table/table.pipe.ts +62 -0
- package/src/lib/components/table/table.type.ts +15 -0
- package/src/lib/components/tabs/tabs.component.html +88 -0
- package/src/lib/components/tabs/tabs.component.scss +305 -0
- package/src/lib/components/tabs/tabs.component.spec.ts +94 -0
- package/src/lib/components/tabs/tabs.component.ts +282 -0
- package/src/lib/components/tabs/tabs.type.ts +81 -0
- package/src/lib/components/title-bar/title-bar.component.html +21 -0
- package/src/lib/components/title-bar/title-bar.component.scss +139 -0
- package/src/lib/components/title-bar/title-bar.component.spec.ts +44 -0
- package/src/lib/components/title-bar/title-bar.component.ts +13 -0
- package/src/lib/components/toast/toast.component.html +36 -0
- package/src/lib/components/toast/toast.component.scss +241 -0
- package/src/lib/components/toast/toast.component.ts +165 -0
- package/src/lib/components/toast/toast.type.ts +37 -0
- package/src/lib/components/toast-stack/toast-stack.component.html +30 -0
- package/src/lib/components/toast-stack/toast-stack.component.scss +35 -0
- package/src/lib/components/toast-stack/toast-stack.component.ts +51 -0
- package/src/lib/consts/country-prefix.ts +244 -0
- package/src/lib/directives/tooltip/popover.directive.ts +274 -0
- package/src/lib/directives/tooltip/tooltip.directive.spec.ts +86 -0
- package/src/lib/directives/tooltip/tooltip.directive.ts +234 -0
- package/src/lib/directives/tooltip/tooltip.interface.ts +29 -0
- package/src/lib/directives/tooltip/tooltip.type.ts +9 -0
- package/src/lib/interfaces/common.interfaces.ts +4 -0
- package/src/lib/pipes/chunk.pipe.ts +16 -0
- package/src/lib/pipes/safe-html.pipe.ts +14 -0
- package/src/lib/pipes/sanitize-html.pipe.ts +23 -0
- package/src/lib/types/base.types.ts +23 -0
- package/src/lib/types/common.types.ts +98 -0
- package/src/lib/types/form.types.ts +5 -0
- package/src/lib/utils/common.utils.ts +53 -0
- package/src/lib/utils/date.utils.ts +474 -0
- package/src/lib/utils/number.utils.ts +16 -0
- package/src/lib/utils/uuid.utils.ts +39 -0
- package/src/public-api.ts +114 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +9 -0
- package/fesm2022/tacdaed-fragments.mjs +0 -8928
- package/fesm2022/tacdaed-fragments.mjs.map +0 -1
- package/index.d.ts +0 -3929
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
@use './../../../../../assets/styles/scss/variables' as *;
|
|
2
|
+
|
|
3
|
+
@keyframes frg-spin {
|
|
4
|
+
to {
|
|
5
|
+
transform: rotate(360deg);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:host {
|
|
10
|
+
display: block;
|
|
11
|
+
|
|
12
|
+
.frg-spinner {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
line-height: 0;
|
|
15
|
+
vertical-align: middle;
|
|
16
|
+
|
|
17
|
+
&--center {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__circle {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
display: inline-block;
|
|
26
|
+
border-radius: 50%;
|
|
27
|
+
border-style: solid;
|
|
28
|
+
animation: frg-spin 0.8s linear infinite;
|
|
29
|
+
width: $frg-loader-size-md;
|
|
30
|
+
height: $frg-loader-size-md;
|
|
31
|
+
border-width: $frg-loader-border-width;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Varianti dimensione
|
|
35
|
+
&--xs .frg-spinner__circle {
|
|
36
|
+
width: $frg-loader-size-xs;
|
|
37
|
+
height: $frg-loader-size-xs;
|
|
38
|
+
border-width: 0.125rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--sm .frg-spinner__circle {
|
|
42
|
+
width: $frg-loader-size-sm;
|
|
43
|
+
height: $frg-loader-size-sm;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--md .frg-spinner__circle {
|
|
47
|
+
width: $frg-loader-size-md;
|
|
48
|
+
height: $frg-loader-size-md;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&--lg .frg-spinner__circle {
|
|
52
|
+
width: $frg-loader-size-lg;
|
|
53
|
+
height: $frg-loader-size-lg;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&--xl .frg-spinner__circle {
|
|
57
|
+
width: $frg-loader-size-xl;
|
|
58
|
+
height: $frg-loader-size-xl;
|
|
59
|
+
border-width: 0.25rem;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Colore
|
|
63
|
+
&--primary .frg-spinner__circle {
|
|
64
|
+
border-color: $frg-loader-color-primary;
|
|
65
|
+
border-left-color: transparent;
|
|
66
|
+
border-right-color: transparent;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
&--secondary .frg-spinner__circle {
|
|
70
|
+
border-color: $frg-loader-color-secondary;
|
|
71
|
+
border-left-color: transparent;
|
|
72
|
+
border-right-color: transparent;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&--tertiary .frg-spinner__circle {
|
|
76
|
+
border-color: $frg-loader-color-tertiary;
|
|
77
|
+
border-left-color: transparent;
|
|
78
|
+
border-right-color: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&--dark .frg-spinner__circle {
|
|
82
|
+
border-color: $frg-loader-color-dark;
|
|
83
|
+
border-left-color: transparent;
|
|
84
|
+
border-right-color: transparent;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&--light .frg-spinner__circle {
|
|
88
|
+
border-color: $frg-loader-color-light;
|
|
89
|
+
border-left-color: transparent;
|
|
90
|
+
border-right-color: transparent;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@media (prefers-reduced-motion: reduce) {
|
|
94
|
+
&__circle {
|
|
95
|
+
animation: none;
|
|
96
|
+
transform: rotate(0);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&--overlay {
|
|
101
|
+
position: fixed;
|
|
102
|
+
top: 0;
|
|
103
|
+
left: 0;
|
|
104
|
+
width: 100vw;
|
|
105
|
+
height: 100vh;
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
background: rgba($color-light-neutral, .6);
|
|
110
|
+
z-index: 9999;
|
|
111
|
+
backdrop-filter: blur(.2rem);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&--overlay-item {
|
|
115
|
+
position: absolute;
|
|
116
|
+
inset: 0;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
z-index: 1;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Accessibilità */
|
|
125
|
+
.sr-only {
|
|
126
|
+
position: absolute !important;
|
|
127
|
+
width: 1px !important;
|
|
128
|
+
height: 1px !important;
|
|
129
|
+
padding: 0 !important;
|
|
130
|
+
margin: -1px !important;
|
|
131
|
+
overflow: hidden !important;
|
|
132
|
+
clip: rect(0, 0, 0, 0) !important;
|
|
133
|
+
white-space: nowrap !important;
|
|
134
|
+
border: 0 !important;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { SimpleChange } from '@angular/core';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
import { SpinnerComponent } from './spinner.component';
|
|
5
|
+
|
|
6
|
+
describe('SpinnerComponent', () => {
|
|
7
|
+
let fixture: ComponentFixture<SpinnerComponent>;
|
|
8
|
+
let component: SpinnerComponent;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await TestBed.configureTestingModule({
|
|
12
|
+
imports: [SpinnerComponent]
|
|
13
|
+
}).compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(SpinnerComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
document.body.style.overflow = '';
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('applies overlay class when enabled', () => {
|
|
24
|
+
component.isOverlay = true;
|
|
25
|
+
|
|
26
|
+
fixture.detectChanges();
|
|
27
|
+
|
|
28
|
+
const spinner = fixture.debugElement.query(By.css('.frg-spinner'));
|
|
29
|
+
expect(spinner.nativeElement.classList).toContain('frg-spinner--overlay');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('toggles body scroll when overlay changes', () => {
|
|
33
|
+
component.isOverlay = true;
|
|
34
|
+
component.ngOnChanges({
|
|
35
|
+
isOverlay: new SimpleChange(false, true, false)
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
expect(document.body.style.overflow).toBe('hidden');
|
|
39
|
+
|
|
40
|
+
component.ngOnDestroy();
|
|
41
|
+
expect(document.body.style.overflow).toBe('');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { NgClass } from '@angular/common';
|
|
2
|
+
import { Component, Input, OnChanges, OnDestroy, SimpleChanges } from '@angular/core';
|
|
3
|
+
import { TSpinnerSize, TSpinnerType } from './spinner.type';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'frg-spinner',
|
|
7
|
+
templateUrl: './spinner.component.html',
|
|
8
|
+
styleUrls: ['./spinner.component.scss'],
|
|
9
|
+
imports: [NgClass]
|
|
10
|
+
})
|
|
11
|
+
export class SpinnerComponent implements OnChanges, OnDestroy {
|
|
12
|
+
@Input() size: TSpinnerSize = 'medium';
|
|
13
|
+
@Input() isCentered: boolean = false;
|
|
14
|
+
@Input() isOverlay = false;
|
|
15
|
+
@Input() isOverlayItem = false;
|
|
16
|
+
@Input() label = 'Loading...';
|
|
17
|
+
@Input() styleType: TSpinnerType = 'primary';
|
|
18
|
+
|
|
19
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
20
|
+
if (changes['isOverlay']) {
|
|
21
|
+
this.toggleBodyScroll(this.isOverlay);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ngOnDestroy(): void {
|
|
26
|
+
this.toggleBodyScroll(false);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private toggleBodyScroll(disable: boolean): void {
|
|
30
|
+
document.body.style.overflow = disable ? 'hidden' : '';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
@if (open) {
|
|
2
|
+
<div class="frg-modal__backdrop">
|
|
3
|
+
<button
|
|
4
|
+
type="button"
|
|
5
|
+
class="frg-modal__backdrop-btn"
|
|
6
|
+
aria-label="Close dialog"
|
|
7
|
+
(click)="onBackdropClick()"
|
|
8
|
+
></button>
|
|
9
|
+
<dialog
|
|
10
|
+
class="frg-modal"
|
|
11
|
+
[ngClass]="modalClassMap"
|
|
12
|
+
aria-modal="true"
|
|
13
|
+
[attr.aria-labelledby]="ariaLabelledBy || null"
|
|
14
|
+
[attr.aria-describedby]="ariaDescribedBy || null"
|
|
15
|
+
[attr.aria-label]="ariaLabelledBy ? null : ariaLabel"
|
|
16
|
+
open
|
|
17
|
+
>
|
|
18
|
+
@if (showHeader) {
|
|
19
|
+
<div class="frg-modal__header">
|
|
20
|
+
<div class="frg-modal__header-content">
|
|
21
|
+
<ng-content select="[frg-modal-head]"></ng-content>
|
|
22
|
+
</div>
|
|
23
|
+
@if (hasCloseButton) {
|
|
24
|
+
<button
|
|
25
|
+
type="button"
|
|
26
|
+
class="frg-modal__close-btn"
|
|
27
|
+
(click)="onCloseClick()"
|
|
28
|
+
aria-label="Close dialog"
|
|
29
|
+
>
|
|
30
|
+
×
|
|
31
|
+
</button>
|
|
32
|
+
}
|
|
33
|
+
</div>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
<div class="frg-modal__body" [ngClass]="{ 'frg-modal__body--with-footer': hasFooter }">
|
|
37
|
+
<ng-content select="[frg-modal-body]"></ng-content>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
@if (hasFooter) {
|
|
41
|
+
<div class="frg-modal__footer">
|
|
42
|
+
<ng-content select="[frg-modal-footer]"></ng-content>
|
|
43
|
+
</div>
|
|
44
|
+
}
|
|
45
|
+
</dialog>
|
|
46
|
+
</div>
|
|
47
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
@use '../../../../assets/styles/scss/variables' as *;
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
dialog {
|
|
5
|
+
padding: 0.25rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.frg-modal__backdrop {
|
|
9
|
+
position: fixed;
|
|
10
|
+
inset: 0;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
padding: 1.5rem;
|
|
15
|
+
background: rgba($color-dark, 0.45);
|
|
16
|
+
backdrop-filter: blur(6px);
|
|
17
|
+
z-index: 1050;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.frg-modal__backdrop-btn {
|
|
21
|
+
position: absolute;
|
|
22
|
+
inset: 0;
|
|
23
|
+
border: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
margin: 0;
|
|
26
|
+
background: transparent;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
z-index: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.frg-modal {
|
|
32
|
+
width: 100%;
|
|
33
|
+
gap: 1rem;
|
|
34
|
+
max-width: 5rem;
|
|
35
|
+
max-height: calc(100vh - 3rem);
|
|
36
|
+
background: $color-light;
|
|
37
|
+
color: $color-dark;
|
|
38
|
+
border-radius: 0.6rem;
|
|
39
|
+
border: 1px solid rgba($color-dark, 0.08);
|
|
40
|
+
box-shadow: 0 20px 45px rgba(0, 0, 0, 0.18);
|
|
41
|
+
overflow: hidden;
|
|
42
|
+
font-family: $base-font;
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
animation: frg-modal-enter 0.2s ease-out;
|
|
46
|
+
z-index: 1;
|
|
47
|
+
position: relative;
|
|
48
|
+
|
|
49
|
+
&__size-small {
|
|
50
|
+
max-width: 28rem;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&__size-medium {
|
|
54
|
+
max-width: 40rem;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&__size-large {
|
|
58
|
+
max-width: 56rem;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.frg-modal__header {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
gap: 1rem;
|
|
67
|
+
padding: 0.75rem 1.5rem 0.75rem;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.frg-modal__header-content {
|
|
71
|
+
min-width: 0;
|
|
72
|
+
flex: 1;
|
|
73
|
+
font-size: 0.95rem;
|
|
74
|
+
|
|
75
|
+
h1,
|
|
76
|
+
h2,
|
|
77
|
+
h3,
|
|
78
|
+
h4,
|
|
79
|
+
h5,
|
|
80
|
+
h6 {
|
|
81
|
+
font-size: 1.1rem;
|
|
82
|
+
margin-bottom: 0.25rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
p {
|
|
86
|
+
font-size: 0.9rem;
|
|
87
|
+
margin-bottom: 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.frg-modal__body {
|
|
92
|
+
padding: 0.75rem 1.5rem 0.75rem;
|
|
93
|
+
overflow-y: auto;
|
|
94
|
+
font-size: 0.95rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.frg-modal__body--with-footer {
|
|
98
|
+
border-bottom: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.frg-modal__footer {
|
|
102
|
+
padding: 0 1.5rem 0.75rem;
|
|
103
|
+
display: flex;
|
|
104
|
+
justify-content: flex-end;
|
|
105
|
+
gap: 0.75rem;
|
|
106
|
+
flex-wrap: wrap;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.frg-modal__close-btn {
|
|
110
|
+
background: transparent;
|
|
111
|
+
border: none;
|
|
112
|
+
color: $color-dark-soft;
|
|
113
|
+
font-size: 1.5rem;
|
|
114
|
+
line-height: 1;
|
|
115
|
+
padding: 0.15rem 0.4rem;
|
|
116
|
+
border-radius: 50%;
|
|
117
|
+
cursor: pointer;
|
|
118
|
+
position: absolute;
|
|
119
|
+
top: 0.65rem;
|
|
120
|
+
right: 0.75rem;
|
|
121
|
+
|
|
122
|
+
&:hover,
|
|
123
|
+
&:focus {
|
|
124
|
+
color: $color-dark;
|
|
125
|
+
outline: none;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@keyframes frg-modal-enter {
|
|
130
|
+
from {
|
|
131
|
+
opacity: 0;
|
|
132
|
+
transform: translateY(6px);
|
|
133
|
+
}
|
|
134
|
+
to {
|
|
135
|
+
opacity: 1;
|
|
136
|
+
transform: translateY(0);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
import { By } from '@angular/platform-browser';
|
|
4
|
+
import { ModalCloseEvent } from './modal.type';
|
|
5
|
+
import { ModalComponent } from './modal.component';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [ModalComponent],
|
|
10
|
+
template: `
|
|
11
|
+
<frg-modal [(open)]="open" (closed)="onClosed($event)">
|
|
12
|
+
<div frg-modal-head>
|
|
13
|
+
<h5 id="modal-title">Title</h5>
|
|
14
|
+
</div>
|
|
15
|
+
<div frg-modal-body>Body</div>
|
|
16
|
+
<div frg-modal-footer>Footer</div>
|
|
17
|
+
</frg-modal>
|
|
18
|
+
`
|
|
19
|
+
})
|
|
20
|
+
class TestHostComponent {
|
|
21
|
+
open = true;
|
|
22
|
+
closedEvent: ModalCloseEvent | null = null;
|
|
23
|
+
|
|
24
|
+
onClosed(event: ModalCloseEvent): void {
|
|
25
|
+
this.open = false;
|
|
26
|
+
this.closedEvent = event;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe('ModalComponent', () => {
|
|
31
|
+
let fixture: ComponentFixture<TestHostComponent>;
|
|
32
|
+
|
|
33
|
+
beforeEach(async () => {
|
|
34
|
+
await TestBed.configureTestingModule({
|
|
35
|
+
imports: [TestHostComponent]
|
|
36
|
+
}).compileComponents();
|
|
37
|
+
|
|
38
|
+
fixture = TestBed.createComponent(TestHostComponent);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('renders header, body, and footer slots when open', () => {
|
|
42
|
+
fixture.detectChanges();
|
|
43
|
+
|
|
44
|
+
expect(fixture.debugElement.query(By.css('.frg-modal__header'))).toBeTruthy();
|
|
45
|
+
expect(fixture.debugElement.query(By.css('.frg-modal__body'))?.nativeElement.textContent).toContain('Body');
|
|
46
|
+
expect(fixture.debugElement.query(By.css('.frg-modal__footer'))?.nativeElement.textContent).toContain('Footer');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('closes on close button click and emits reason', () => {
|
|
50
|
+
fixture.detectChanges();
|
|
51
|
+
|
|
52
|
+
const closeBtn = fixture.debugElement.query(By.css('.frg-modal__close-btn'));
|
|
53
|
+
closeBtn.nativeElement.click();
|
|
54
|
+
fixture.detectChanges();
|
|
55
|
+
|
|
56
|
+
expect(fixture.componentInstance.open).toBeFalse();
|
|
57
|
+
expect(fixture.componentInstance.closedEvent?.reason).toBe('close-button');
|
|
58
|
+
expect(fixture.debugElement.query(By.css('.frg-modal'))).toBeNull();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { NgClass } from '@angular/common';
|
|
2
|
+
import { Component, EventEmitter, HostListener, Input, OnChanges, OnDestroy, Output, SimpleChanges } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
import { ModalCloseEvent, TModalCloseReason, TModalSize } from './modal.type';
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'frg-modal',
|
|
8
|
+
imports: [NgClass],
|
|
9
|
+
templateUrl: './modal.component.html',
|
|
10
|
+
styleUrl: './modal.component.scss'
|
|
11
|
+
})
|
|
12
|
+
export class ModalComponent implements OnChanges, OnDestroy {
|
|
13
|
+
@Input() open: boolean = false;
|
|
14
|
+
@Input() size: TModalSize = 'medium';
|
|
15
|
+
@Input() closeOnBackdrop: boolean = true;
|
|
16
|
+
@Input() closeOnEscape: boolean = true;
|
|
17
|
+
@Input() hasCloseButton: boolean = true;
|
|
18
|
+
@Input() hasHeader: boolean = true;
|
|
19
|
+
@Input() hasFooter: boolean = true;
|
|
20
|
+
@Input() lockBodyScroll: boolean = true;
|
|
21
|
+
@Input() ariaLabel: string = 'Dialog';
|
|
22
|
+
@Input() ariaLabelledBy: string | null = null;
|
|
23
|
+
@Input() ariaDescribedBy: string | null = null;
|
|
24
|
+
|
|
25
|
+
@Output() closed = new EventEmitter<ModalCloseEvent>();
|
|
26
|
+
|
|
27
|
+
get modalClassMap() {
|
|
28
|
+
return {
|
|
29
|
+
'frg-modal__size-small': this.size === 'small',
|
|
30
|
+
'frg-modal__size-medium': this.size === 'medium',
|
|
31
|
+
'frg-modal__size-large': this.size === 'large',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get showHeader(): boolean {
|
|
36
|
+
return this.hasHeader || this.hasCloseButton;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public ngOnChanges(changes: SimpleChanges): void {
|
|
40
|
+
if (changes['open'] || changes['lockBodyScroll']) {
|
|
41
|
+
this.toggleBodyScroll(this.open && this.lockBodyScroll);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public ngOnDestroy(): void {
|
|
46
|
+
this.toggleBodyScroll(false);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected onBackdropClick(): void {
|
|
50
|
+
if (!this.closeOnBackdrop) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.requestClose('backdrop');
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
protected onCloseClick(): void {
|
|
57
|
+
this.requestClose('close-button');
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@HostListener('document:keydown', ['$event'])
|
|
61
|
+
onKeydown(event: KeyboardEvent): void {
|
|
62
|
+
if (!this.open || !this.closeOnEscape) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (event.key === 'Escape') {
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
this.requestClose('escape');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private requestClose(reason: TModalCloseReason): void {
|
|
73
|
+
if (!this.open) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
this.closed.emit({ reason });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private toggleBodyScroll(disable: boolean): void {
|
|
81
|
+
document.body.style.overflow = disable ? 'hidden' : '';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { By } from '@angular/platform-browser';
|
|
3
|
+
import { BlobMorphComponent } from './blob-moprh.component';
|
|
4
|
+
import { SpinnerComponent } from '../../loader/spinner/spinner.component';
|
|
5
|
+
|
|
6
|
+
describe('BlobMorphComponent', () => {
|
|
7
|
+
let fixture: ComponentFixture<BlobMorphComponent>;
|
|
8
|
+
let component: BlobMorphComponent;
|
|
9
|
+
|
|
10
|
+
beforeEach(async () => {
|
|
11
|
+
await TestBed.configureTestingModule({
|
|
12
|
+
imports: [BlobMorphComponent, SpinnerComponent]
|
|
13
|
+
}).compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(BlobMorphComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('renders an image when imageUrl is provided', () => {
|
|
20
|
+
component.imageUrl = 'https://example.com/image.jpg';
|
|
21
|
+
|
|
22
|
+
fixture.detectChanges();
|
|
23
|
+
|
|
24
|
+
const imageEl = fixture.debugElement.query(By.css('image'));
|
|
25
|
+
const rectEl = fixture.debugElement.query(By.css('rect'));
|
|
26
|
+
|
|
27
|
+
expect(imageEl).toBeTruthy();
|
|
28
|
+
expect(rectEl).toBeNull();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('renders a fallback rect when no imageUrl is provided', () => {
|
|
32
|
+
component.imageUrl = null;
|
|
33
|
+
component.fillColor = '#123456';
|
|
34
|
+
|
|
35
|
+
fixture.detectChanges();
|
|
36
|
+
|
|
37
|
+
const rectEl = fixture.debugElement.query(By.css('rect'));
|
|
38
|
+
expect(rectEl).toBeTruthy();
|
|
39
|
+
expect(rectEl.attributes['fill']).toBe('#123456');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('shows a spinner until load completes', () => {
|
|
43
|
+
component.imageUrl = 'https://example.com/image.jpg';
|
|
44
|
+
|
|
45
|
+
fixture.detectChanges();
|
|
46
|
+
|
|
47
|
+
expect(fixture.debugElement.query(By.css('frg-spinner'))).toBeTruthy();
|
|
48
|
+
|
|
49
|
+
component.onLoadEvent();
|
|
50
|
+
fixture.detectChanges();
|
|
51
|
+
|
|
52
|
+
expect((component as any).isLoaded).toBeTrue();
|
|
53
|
+
expect(fixture.debugElement.query(By.css('frg-spinner'))).toBeNull();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('emits loadEvent on image load', () => {
|
|
57
|
+
const emitSpy = spyOn(component.loadEvent, 'emit');
|
|
58
|
+
|
|
59
|
+
component.onLoadEvent();
|
|
60
|
+
|
|
61
|
+
expect(emitSpy).toHaveBeenCalled();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('does not log an error when morph paths exist', () => {
|
|
65
|
+
const errorSpy = spyOn(console, 'error');
|
|
66
|
+
component.duration = 1234;
|
|
67
|
+
component.clipId = 'test-clip';
|
|
68
|
+
|
|
69
|
+
fixture.detectChanges();
|
|
70
|
+
|
|
71
|
+
expect(errorSpy).not.toHaveBeenCalled();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('generates a valid SVG path string', () => {
|
|
75
|
+
const path = (component as any).generateRandomPath(6, 40, 10) as string;
|
|
76
|
+
expect(path.startsWith('M')).toBeTrue();
|
|
77
|
+
expect(path.trim().endsWith('Z')).toBeTrue();
|
|
78
|
+
});
|
|
79
|
+
});
|