@tacdaed/fragments 1.0.0-beta.1 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -20
- package/fesm2022/tacdaed-fragments.mjs +8928 -0
- package/fesm2022/tacdaed-fragments.mjs.map +1 -0
- package/index.d.ts +3929 -0
- package/package.json +29 -22
- package/ng-package.json +0 -25
- package/src/lib/components/accordion/accordion.component.html +0 -103
- package/src/lib/components/accordion/accordion.component.scss +0 -382
- package/src/lib/components/accordion/accordion.component.spec.ts +0 -147
- package/src/lib/components/accordion/accordion.component.ts +0 -211
- package/src/lib/components/accordion/accordion.type.ts +0 -82
- package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -43
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -112
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -33
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -103
- package/src/lib/components/breadcrumb/breadcrumb.interface.ts +0 -7
- package/src/lib/components/button/button.component.html +0 -57
- package/src/lib/components/button/button.component.scss +0 -445
- package/src/lib/components/button/button.component.spec.ts +0 -99
- package/src/lib/components/button/button.component.ts +0 -143
- package/src/lib/components/button/button.type.ts +0 -7
- package/src/lib/components/card/card.component.html +0 -44
- package/src/lib/components/card/card.component.scss +0 -114
- package/src/lib/components/card/card.component.spec.ts +0 -65
- package/src/lib/components/card/card.component.ts +0 -21
- package/src/lib/components/card/card.type.ts +0 -3
- package/src/lib/components/code-block/code-block.component.html +0 -55
- package/src/lib/components/code-block/code-block.component.scss +0 -122
- package/src/lib/components/code-block/code-block.component.spec.ts +0 -81
- package/src/lib/components/code-block/code-block.component.ts +0 -302
- package/src/lib/components/code-block/code-block.interface.ts +0 -28
- package/src/lib/components/code-block/code-block.type.ts +0 -73
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.html +0 -14
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.scss +0 -20
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.spec.ts +0 -38
- package/src/lib/components/decorative/sparkle-field/sparkle-field.component.ts +0 -181
- package/src/lib/components/input/input-base.ts +0 -187
- package/src/lib/components/input/input-calendar/input-calendar.component.html +0 -76
- package/src/lib/components/input/input-calendar/input-calendar.component.scss +0 -179
- package/src/lib/components/input/input-calendar/input-calendar.component.spec.ts +0 -44
- package/src/lib/components/input/input-calendar/input-calendar.component.ts +0 -299
- package/src/lib/components/input/input-checkbox/input-checkbox.component.html +0 -37
- package/src/lib/components/input/input-checkbox/input-checkbox.component.scss +0 -128
- package/src/lib/components/input/input-checkbox/input-checkbox.component.spec.ts +0 -43
- package/src/lib/components/input/input-checkbox/input-checkbox.component.ts +0 -112
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.html +0 -43
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.scss +0 -140
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.spec.ts +0 -62
- package/src/lib/components/input/input-checkbox-group/input-checkbox-group.component.ts +0 -136
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.html +0 -81
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.scss +0 -228
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.spec.ts +0 -62
- package/src/lib/components/input/input-clock-picker/input-clock-picker.component.ts +0 -178
- package/src/lib/components/input/input-consts.ts +0 -132
- package/src/lib/components/input/input-date/input-date-validators.ts +0 -41
- package/src/lib/components/input/input-date/input-date.component.html +0 -41
- package/src/lib/components/input/input-date/input-date.component.scss +0 -95
- package/src/lib/components/input/input-date/input-date.component.spec.ts +0 -43
- package/src/lib/components/input/input-date/input-date.component.ts +0 -359
- package/src/lib/components/input/input-date-time/input-date-time.component.html +0 -70
- package/src/lib/components/input/input-date-time/input-date-time.component.scss +0 -133
- package/src/lib/components/input/input-date-time/input-date-time.component.spec.ts +0 -36
- package/src/lib/components/input/input-date-time/input-date-time.component.ts +0 -387
- package/src/lib/components/input/input-file-upload/input-file-upload.component.html +0 -89
- package/src/lib/components/input/input-file-upload/input-file-upload.component.scss +0 -171
- package/src/lib/components/input/input-file-upload/input-file-upload.component.spec.ts +0 -43
- package/src/lib/components/input/input-file-upload/input-file-upload.component.ts +0 -351
- package/src/lib/components/input/input-interface.ts +0 -8
- package/src/lib/components/input/input-number/input-number-validators.ts +0 -0
- package/src/lib/components/input/input-number/input-number.component.html +0 -51
- package/src/lib/components/input/input-number/input-number.component.scss +0 -140
- package/src/lib/components/input/input-number/input-number.component.spec.ts +0 -44
- package/src/lib/components/input/input-number/input-number.component.ts +0 -343
- package/src/lib/components/input/input-radio-group/input-radio-group.component.html +0 -44
- package/src/lib/components/input/input-radio-group/input-radio-group.component.scss +0 -139
- package/src/lib/components/input/input-radio-group/input-radio-group.component.spec.ts +0 -58
- package/src/lib/components/input/input-radio-group/input-radio-group.component.ts +0 -132
- package/src/lib/components/input/input-slider/input-slider.component.html +0 -111
- package/src/lib/components/input/input-slider/input-slider.component.scss +0 -203
- package/src/lib/components/input/input-slider/input-slider.component.spec.ts +0 -46
- package/src/lib/components/input/input-slider/input-slider.component.ts +0 -410
- package/src/lib/components/input/input-text/input-text-validators.ts +0 -67
- package/src/lib/components/input/input-text/input-text.component.html +0 -71
- package/src/lib/components/input/input-text/input-text.component.scss +0 -118
- package/src/lib/components/input/input-text/input-text.component.spec.ts +0 -55
- package/src/lib/components/input/input-text/input-text.component.ts +0 -215
- package/src/lib/components/input/input-time/input-time-validators.ts +0 -42
- package/src/lib/components/input/input-time/input-time.component.html +0 -92
- package/src/lib/components/input/input-time/input-time.component.scss +0 -191
- package/src/lib/components/input/input-time/input-time.component.spec.ts +0 -39
- package/src/lib/components/input/input-time/input-time.component.ts +0 -691
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.html +0 -36
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.scss +0 -121
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.spec.ts +0 -54
- package/src/lib/components/input/input-toggle-switch/input-toggle-switch.component.ts +0 -117
- package/src/lib/components/input/input-type.ts +0 -18
- package/src/lib/components/input/input-validation/input-validation.component.html +0 -19
- package/src/lib/components/input/input-validation/input-validation.component.scss +0 -39
- package/src/lib/components/input/input-validation/input-validation.component.spec.ts +0 -45
- package/src/lib/components/input/input-validation/input-validation.component.ts +0 -13
- package/src/lib/components/input/input.pipe.ts +0 -14
- package/src/lib/components/layout/container/container.component.html +0 -1
- package/src/lib/components/layout/container/container.component.scss +0 -33
- package/src/lib/components/layout/container/container.component.ts +0 -32
- package/src/lib/components/layout/container/container.type.ts +0 -1
- package/src/lib/components/layout/divider/divider.component.html +0 -1
- package/src/lib/components/layout/divider/divider.component.scss +0 -60
- package/src/lib/components/layout/divider/divider.component.ts +0 -38
- package/src/lib/components/layout/divider/divider.type.ts +0 -2
- package/src/lib/components/layout/section/section.component.html +0 -21
- package/src/lib/components/layout/section/section.component.scss +0 -43
- package/src/lib/components/layout/section/section.component.ts +0 -33
- package/src/lib/components/layout/section/section.type.ts +0 -2
- package/src/lib/components/layout/separator/separator.component.html +0 -9
- package/src/lib/components/layout/separator/separator.component.scss +0 -52
- package/src/lib/components/layout/separator/separator.component.ts +0 -25
- package/src/lib/components/layout/separator/separator.type.ts +0 -1
- package/src/lib/components/loader/content-blur/content-blur.component.html +0 -13
- package/src/lib/components/loader/content-blur/content-blur.component.scss +0 -43
- package/src/lib/components/loader/content-blur/content-blur.component.spec.ts +0 -42
- package/src/lib/components/loader/content-blur/content-blur.component.ts +0 -34
- package/src/lib/components/loader/loader.type.ts +0 -2
- package/src/lib/components/loader/progress-bar/progress-bar.component.html +0 -26
- package/src/lib/components/loader/progress-bar/progress-bar.component.scss +0 -151
- package/src/lib/components/loader/progress-bar/progress-bar.component.spec.ts +0 -47
- package/src/lib/components/loader/progress-bar/progress-bar.component.ts +0 -28
- package/src/lib/components/loader/progress-bar/progress-bar.type.ts +0 -8
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.html +0 -12
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.scss +0 -202
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.spec.ts +0 -55
- package/src/lib/components/loader/pulse-loader/pulse-loader.component.ts +0 -73
- package/src/lib/components/loader/pulse-loader/pulse-loader.type.ts +0 -6
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.html +0 -13
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.scss +0 -113
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.spec.ts +0 -37
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.component.ts +0 -51
- package/src/lib/components/loader/skeleton-loader/skeleton-loader.type.ts +0 -6
- package/src/lib/components/loader/spinner/spinner.component.html +0 -20
- package/src/lib/components/loader/spinner/spinner.component.scss +0 -137
- package/src/lib/components/loader/spinner/spinner.component.spec.ts +0 -43
- package/src/lib/components/loader/spinner/spinner.component.ts +0 -32
- package/src/lib/components/loader/spinner/spinner.type.ts +0 -6
- package/src/lib/components/modal/modal.component.html +0 -47
- package/src/lib/components/modal/modal.component.scss +0 -139
- package/src/lib/components/modal/modal.component.spec.ts +0 -60
- package/src/lib/components/modal/modal.component.ts +0 -83
- package/src/lib/components/modal/modal.type.ts +0 -9
- package/src/lib/components/morph/blob-moph/blob-moprh.component.spec.ts +0 -79
- package/src/lib/components/morph/blob-moph/blob-moprh.component.ts +0 -96
- package/src/lib/components/morph/blob-moph/blob-morph.component.html +0 -34
- package/src/lib/components/morph/blob-moph/blob-morph.component.scss +0 -7
- package/src/lib/components/morph/morph.abstract.ts +0 -13
- package/src/lib/components/pagination/pagination.interface.ts +0 -4
- package/src/lib/components/pagination/small-pagination/small-pagination.component.html +0 -61
- package/src/lib/components/pagination/small-pagination/small-pagination.component.scss +0 -187
- package/src/lib/components/pagination/small-pagination/small-pagination.component.spec.ts +0 -88
- package/src/lib/components/pagination/small-pagination/small-pagination.component.ts +0 -177
- package/src/lib/components/selection-lists/multi-select/multi-select.component.html +0 -170
- package/src/lib/components/selection-lists/multi-select/multi-select.component.scss +0 -312
- package/src/lib/components/selection-lists/multi-select/multi-select.component.spec.ts +0 -61
- package/src/lib/components/selection-lists/multi-select/multi-select.component.ts +0 -372
- package/src/lib/components/selection-lists/selection-list/selection-list.component.html +0 -125
- package/src/lib/components/selection-lists/selection-list/selection-list.component.scss +0 -267
- package/src/lib/components/selection-lists/selection-list/selection-list.component.spec.ts +0 -66
- package/src/lib/components/selection-lists/selection-list/selection-list.component.ts +0 -315
- package/src/lib/components/selection-lists/selection-lists-base.ts +0 -35
- package/src/lib/components/selection-lists/selection-lists-const.ts +0 -17
- package/src/lib/components/selection-lists/selection-lists-interface.ts +0 -7
- package/src/lib/components/selection-lists/selection-lists.type.ts +0 -1
- package/src/lib/components/side-nav/side-nav.component.html +0 -101
- package/src/lib/components/side-nav/side-nav.component.scss +0 -295
- package/src/lib/components/side-nav/side-nav.component.spec.ts +0 -0
- package/src/lib/components/side-nav/side-nav.component.ts +0 -18
- package/src/lib/components/side-nav/side-nav.type.ts +0 -28
- package/src/lib/components/snackbar/snackbar.component.html +0 -33
- package/src/lib/components/snackbar/snackbar.component.scss +0 -195
- package/src/lib/components/snackbar/snackbar.component.ts +0 -112
- package/src/lib/components/snackbar/snackbar.type.ts +0 -27
- package/src/lib/components/status/chip/chip.component.html +0 -51
- package/src/lib/components/status/chip/chip.component.scss +0 -149
- package/src/lib/components/status/chip/chip.component.spec.ts +0 -62
- package/src/lib/components/status/chip/chip.component.ts +0 -83
- package/src/lib/components/status/chip/chip.type.ts +0 -42
- package/src/lib/components/status/directives/badge/badge.directive.spec.ts +0 -60
- package/src/lib/components/status/directives/badge/badge.directive.ts +0 -190
- package/src/lib/components/status/directives/badge/badge.interface.ts +0 -19
- package/src/lib/components/status/pill/pill.component.html +0 -40
- package/src/lib/components/status/pill/pill.component.scss +0 -113
- package/src/lib/components/status/pill/pill.component.spec.ts +0 -47
- package/src/lib/components/status/pill/pill.component.ts +0 -83
- package/src/lib/components/status/pill/pill.type.ts +0 -42
- package/src/lib/components/status/status.interface.ts +0 -57
- package/src/lib/components/status/status.type.ts +0 -62
- package/src/lib/components/status/tag/tag.component.html +0 -39
- package/src/lib/components/status/tag/tag.component.scss +0 -140
- package/src/lib/components/status/tag/tag.component.spec.ts +0 -47
- package/src/lib/components/status/tag/tag.component.ts +0 -83
- package/src/lib/components/status/tag/tag.type.ts +0 -42
- package/src/lib/components/stepper/stepper.component.html +0 -83
- package/src/lib/components/stepper/stepper.component.scss +0 -196
- package/src/lib/components/stepper/stepper.component.ts +0 -482
- package/src/lib/components/stepper/stepper.type.ts +0 -60
- package/src/lib/components/table/table.component.html +0 -438
- package/src/lib/components/table/table.component.scss +0 -259
- package/src/lib/components/table/table.component.spec.ts +0 -117
- package/src/lib/components/table/table.component.ts +0 -215
- package/src/lib/components/table/table.enum.ts +0 -4
- package/src/lib/components/table/table.function.ts +0 -47
- package/src/lib/components/table/table.interface.ts +0 -143
- package/src/lib/components/table/table.pipe.ts +0 -62
- package/src/lib/components/table/table.type.ts +0 -15
- package/src/lib/components/tabs/tabs.component.html +0 -88
- package/src/lib/components/tabs/tabs.component.scss +0 -305
- package/src/lib/components/tabs/tabs.component.spec.ts +0 -94
- package/src/lib/components/tabs/tabs.component.ts +0 -282
- package/src/lib/components/tabs/tabs.type.ts +0 -81
- package/src/lib/components/title-bar/title-bar.component.html +0 -21
- package/src/lib/components/title-bar/title-bar.component.scss +0 -139
- package/src/lib/components/title-bar/title-bar.component.spec.ts +0 -44
- package/src/lib/components/title-bar/title-bar.component.ts +0 -13
- package/src/lib/components/toast/toast.component.html +0 -36
- package/src/lib/components/toast/toast.component.scss +0 -241
- package/src/lib/components/toast/toast.component.ts +0 -165
- package/src/lib/components/toast/toast.type.ts +0 -37
- package/src/lib/components/toast-stack/toast-stack.component.html +0 -30
- package/src/lib/components/toast-stack/toast-stack.component.scss +0 -35
- package/src/lib/components/toast-stack/toast-stack.component.ts +0 -51
- package/src/lib/consts/country-prefix.ts +0 -244
- package/src/lib/directives/tooltip/popover.directive.ts +0 -274
- package/src/lib/directives/tooltip/tooltip.directive.spec.ts +0 -86
- package/src/lib/directives/tooltip/tooltip.directive.ts +0 -234
- package/src/lib/directives/tooltip/tooltip.interface.ts +0 -29
- package/src/lib/directives/tooltip/tooltip.type.ts +0 -9
- package/src/lib/interfaces/common.interfaces.ts +0 -4
- package/src/lib/pipes/chunk.pipe.ts +0 -16
- package/src/lib/pipes/safe-html.pipe.ts +0 -14
- package/src/lib/pipes/sanitize-html.pipe.ts +0 -23
- package/src/lib/types/base.types.ts +0 -23
- package/src/lib/types/common.types.ts +0 -98
- package/src/lib/types/form.types.ts +0 -5
- package/src/lib/utils/common.utils.ts +0 -53
- package/src/lib/utils/date.utils.ts +0 -474
- package/src/lib/utils/number.utils.ts +0 -16
- package/src/lib/utils/uuid.utils.ts +0 -39
- package/src/public-api.ts +0 -114
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -9
package/package.json
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@tacdaed/fragments",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"peerDependencies": {
|
|
5
|
-
"@angular/common": "20.2.
|
|
6
|
-
"@angular/core": "20.2.
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
},
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"tslib": "2.3.0",
|
|
15
|
-
"uuid": "11.1.0"
|
|
16
|
-
},
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@tacdaed/fragments",
|
|
3
|
+
"version": "1.0.0-beta.3",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^20.2.0",
|
|
6
|
+
"@angular/core": "^20.2.0",
|
|
7
|
+
"rxjs": "^7.8.0",
|
|
8
|
+
"@fortawesome/fontawesome-free": "^6.5.0",
|
|
9
|
+
"animejs": "^4.1.0",
|
|
10
|
+
"bootstrap": "^5.3.0",
|
|
11
|
+
"highlight.js": "^11.11.0"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"tslib": "2.3.0",
|
|
15
|
+
"uuid": "11.1.0"
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"module": "fesm2022/tacdaed-fragments.mjs",
|
|
19
|
+
"typings": "index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
"./package.json": {
|
|
22
|
+
"default": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./index.d.ts",
|
|
26
|
+
"default": "./fesm2022/tacdaed-fragments.mjs"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
package/ng-package.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
-
"dest": "../../dist/fragments",
|
|
4
|
-
"allowedNonPeerDependencies": [
|
|
5
|
-
"uuid"
|
|
6
|
-
],
|
|
7
|
-
"lib": {
|
|
8
|
-
"entryFile": "src/public-api.ts",
|
|
9
|
-
"styleIncludePaths": [
|
|
10
|
-
"projects/fragments/assets/styles/scss"
|
|
11
|
-
]
|
|
12
|
-
},
|
|
13
|
-
"assets": [
|
|
14
|
-
{
|
|
15
|
-
"glob": "**/*.*",
|
|
16
|
-
"input": "./assets/resources",
|
|
17
|
-
"output": "/assets/resources"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"glob": "**/*.scss",
|
|
21
|
-
"input": "./assets/styles/scss",
|
|
22
|
-
"output": "/assets/styles/scss"
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<div
|
|
2
|
-
class="frg-accordion"
|
|
3
|
-
[class.frg-accordion--multi]="multi"
|
|
4
|
-
[class.is-animated]="animated"
|
|
5
|
-
[attr.data-style]="styleType"
|
|
6
|
-
[attr.data-size]="size">
|
|
7
|
-
@for (item of viewItems; track item?.id; let i = $index) {
|
|
8
|
-
<div
|
|
9
|
-
class="frg-accordion__item"
|
|
10
|
-
[attr.data-style]="item?.style || styleType"
|
|
11
|
-
[attr.data-size]="item?.size || size"
|
|
12
|
-
[class.is-expanded]="isExpanded(item?.id)"
|
|
13
|
-
[class.is-disabled]="item?.disabled">
|
|
14
|
-
<button
|
|
15
|
-
type="button"
|
|
16
|
-
#headerBtn
|
|
17
|
-
class="frg-accordion__header"
|
|
18
|
-
[attr.data-size]="item?.size || size"
|
|
19
|
-
[attr.id]="headerId(item!.id!)"
|
|
20
|
-
[attr.aria-controls]="panelId(item!.id!)"
|
|
21
|
-
[attr.aria-expanded]="isExpanded(item?.id)"
|
|
22
|
-
[attr.aria-disabled]="item?.disabled || null"
|
|
23
|
-
[disabled]="item?.disabled"
|
|
24
|
-
(click)="onHeaderClick(i, $event)"
|
|
25
|
-
(keydown)="onHeaderKeydown($event, i)">
|
|
26
|
-
<span class="frg-accordion__header-content">
|
|
27
|
-
@if (item?.iconTemplate || iconTemplate || item?.icon) {
|
|
28
|
-
<span class="frg-accordion__icon" aria-hidden="true">
|
|
29
|
-
@if (item?.iconTemplate) {
|
|
30
|
-
<ng-container
|
|
31
|
-
[ngTemplateOutlet]="item?.iconTemplate"
|
|
32
|
-
[ngTemplateOutletContext]="buildContext(item!, i)">
|
|
33
|
-
</ng-container>
|
|
34
|
-
} @else if (iconTemplate) {
|
|
35
|
-
<ng-container
|
|
36
|
-
[ngTemplateOutlet]="iconTemplate"
|
|
37
|
-
[ngTemplateOutletContext]="buildContext(item!, i)">
|
|
38
|
-
</ng-container>
|
|
39
|
-
} @else if (item?.icon) {
|
|
40
|
-
<span class="frg-accordion__icon-shape">{{ item?.icon }}</span>
|
|
41
|
-
}
|
|
42
|
-
</span>
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
<span class="frg-accordion__heading">
|
|
46
|
-
@if (item?.headerTemplate || headerTemplate) {
|
|
47
|
-
<ng-container
|
|
48
|
-
[ngTemplateOutlet]="item?.headerTemplate || headerTemplate"
|
|
49
|
-
[ngTemplateOutletContext]="buildContext(item!, i)">
|
|
50
|
-
</ng-container>
|
|
51
|
-
} @else {
|
|
52
|
-
<span class="frg-accordion__title">{{ item?.title }}</span>
|
|
53
|
-
@if (item?.subtitle) {
|
|
54
|
-
<span class="frg-accordion__subtitle">{{ item?.subtitle }}</span>
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
</span>
|
|
58
|
-
</span>
|
|
59
|
-
|
|
60
|
-
<span
|
|
61
|
-
class="frg-accordion__chevron"
|
|
62
|
-
aria-hidden="true"
|
|
63
|
-
[class.is-custom]="item?.toggleIconTemplate || toggleIconTemplate"
|
|
64
|
-
[class.is-open]="isExpanded(item?.id)">
|
|
65
|
-
@if (item?.toggleIconTemplate || toggleIconTemplate) {
|
|
66
|
-
<ng-container
|
|
67
|
-
[ngTemplateOutlet]="item?.toggleIconTemplate || toggleIconTemplate"
|
|
68
|
-
[ngTemplateOutletContext]="buildContext(item!, i)">
|
|
69
|
-
</ng-container>
|
|
70
|
-
} @else {
|
|
71
|
-
<span class="frg-accordion__chevron-icon"></span>
|
|
72
|
-
}
|
|
73
|
-
</span>
|
|
74
|
-
</button>
|
|
75
|
-
|
|
76
|
-
<section
|
|
77
|
-
class="frg-accordion__panel-wrapper"
|
|
78
|
-
[class.is-open]="isExpanded(item?.id)"
|
|
79
|
-
[attr.id]="panelId(item!.id!)"
|
|
80
|
-
[attr.aria-labelledby]="headerId(item!.id!)"
|
|
81
|
-
[attr.aria-hidden]="!isExpanded(item?.id)">
|
|
82
|
-
<div
|
|
83
|
-
class="frg-accordion__panel"
|
|
84
|
-
#panelBody
|
|
85
|
-
tabindex="-1"
|
|
86
|
-
[class.is-open]="isExpanded(item?.id)">
|
|
87
|
-
@if (item?.contentTemplate || contentTemplate) {
|
|
88
|
-
<ng-container
|
|
89
|
-
[ngTemplateOutlet]="item?.contentTemplate || contentTemplate"
|
|
90
|
-
[ngTemplateOutletContext]="buildContext(item!, i)">
|
|
91
|
-
</ng-container>
|
|
92
|
-
} @else {
|
|
93
|
-
@if (item?.content) {
|
|
94
|
-
{{ item?.content }}
|
|
95
|
-
} @else if (item?.data; as payload) {
|
|
96
|
-
{{ payload }}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
</div>
|
|
100
|
-
</section>
|
|
101
|
-
</div>
|
|
102
|
-
}
|
|
103
|
-
</div>
|
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
@use "sass:color";
|
|
2
|
-
@use "sass:list";
|
|
3
|
-
@use './../../../../assets/styles/scss/variables' as *;
|
|
4
|
-
|
|
5
|
-
:host {
|
|
6
|
-
display: block;
|
|
7
|
-
font-family: $base-font;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.frg-accordion {
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-direction: column;
|
|
13
|
-
gap: 0;
|
|
14
|
-
background: transparent;
|
|
15
|
-
|
|
16
|
-
&.is-animated {
|
|
17
|
-
.frg-accordion__panel-wrapper {
|
|
18
|
-
transition: grid-template-rows 0.22s ease, opacity 0.22s ease;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.frg-accordion__panel {
|
|
22
|
-
transition: padding 0.22s ease, opacity 0.22s ease;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&__item {
|
|
27
|
-
position: relative;
|
|
28
|
-
background: transparent;
|
|
29
|
-
overflow: hidden;
|
|
30
|
-
border-bottom: 1px solid $frg-accordion-border-color;
|
|
31
|
-
transition:
|
|
32
|
-
background-color 0.2s ease,
|
|
33
|
-
box-shadow 0.2s ease;
|
|
34
|
-
|
|
35
|
-
&.is-expanded {
|
|
36
|
-
background: $frg-accordion-header-background-color;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&.is-disabled {
|
|
40
|
-
opacity: 0.65;
|
|
41
|
-
cursor: not-allowed;
|
|
42
|
-
background: color.scale($color-light, $lightness: -1%);
|
|
43
|
-
border-bottom-color: $frg-accordion-border-color;
|
|
44
|
-
|
|
45
|
-
& .frg-accordion__header {
|
|
46
|
-
cursor: not-allowed;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
&__header {
|
|
52
|
-
width: 100%;
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
justify-content: space-between;
|
|
56
|
-
border: none;
|
|
57
|
-
gap: 1rem;
|
|
58
|
-
padding: 0.9rem 1rem;
|
|
59
|
-
background: transparent;
|
|
60
|
-
color: $color-dark;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
text-align: left;
|
|
63
|
-
transition: color 0.2s ease, background-color 0.2s ease;
|
|
64
|
-
|
|
65
|
-
&:hover {
|
|
66
|
-
color: $color-dark-neutral;
|
|
67
|
-
background-color: color.scale($color-light, $lightness: -25%);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&:focus-visible {
|
|
71
|
-
outline: none;
|
|
72
|
-
box-shadow: inset 0 -2px 0 $color-primary;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.frg-accordion__header-content {
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
gap: 0.85rem;
|
|
79
|
-
flex: 1 1 auto;
|
|
80
|
-
min-width: 0;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.frg-accordion__icon {
|
|
84
|
-
display: inline-flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
justify-content: center;
|
|
87
|
-
width: 2.5rem;
|
|
88
|
-
height: 2.5rem;
|
|
89
|
-
border-radius: 0.65rem;
|
|
90
|
-
background-color: color.scale($color-light, $lightness: -4%);
|
|
91
|
-
color: $color-dark;
|
|
92
|
-
flex-shrink: 0;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.frg-accordion__icon-shape {
|
|
96
|
-
display: inline-flex;
|
|
97
|
-
align-items: center;
|
|
98
|
-
justify-content: center;
|
|
99
|
-
font-size: $font-size-lg;
|
|
100
|
-
line-height: 1;
|
|
101
|
-
width: 100%;
|
|
102
|
-
height: 100%;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.frg-accordion__heading {
|
|
106
|
-
display: flex;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
gap: 0.15rem;
|
|
109
|
-
min-width: 0;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.frg-accordion__title {
|
|
113
|
-
font-size: $font-size-md;
|
|
114
|
-
font-weight: 600;
|
|
115
|
-
line-height: 1.3;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.frg-accordion__subtitle {
|
|
119
|
-
font-size: $font-size-sm;
|
|
120
|
-
color: $color-dark-soft;
|
|
121
|
-
line-height: 1.2;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.frg-accordion__chevron {
|
|
125
|
-
width: 1.5rem;
|
|
126
|
-
height: 1.5rem;
|
|
127
|
-
display: inline-flex;
|
|
128
|
-
align-items: center;
|
|
129
|
-
justify-content: center;
|
|
130
|
-
flex-shrink: 0;
|
|
131
|
-
transition: transform 0.16s ease;
|
|
132
|
-
|
|
133
|
-
&.is-custom {
|
|
134
|
-
width: auto;
|
|
135
|
-
height: auto;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.frg-accordion__chevron-icon {
|
|
140
|
-
display: inline-block;
|
|
141
|
-
width: 0.5rem;
|
|
142
|
-
height: 0.5rem;
|
|
143
|
-
border-right: 2px solid $color-dark-neutral;
|
|
144
|
-
border-bottom: 2px solid $color-dark-neutral;
|
|
145
|
-
transform: rotate(45deg);
|
|
146
|
-
transition: transform 0.16s ease, color 0.2s ease, border-color 0.2s ease;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.frg-accordion__chevron.is-custom .frg-accordion__chevron-icon {
|
|
150
|
-
display: none;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
&__item.is-expanded {
|
|
155
|
-
.frg-accordion__chevron-icon {
|
|
156
|
-
transform: rotate(225deg);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.frg-accordion__chevron.is-custom {
|
|
160
|
-
transform: rotate(180deg);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
&__panel-wrapper {
|
|
165
|
-
display: grid;
|
|
166
|
-
grid-template-rows: 0fr;
|
|
167
|
-
opacity: 0;
|
|
168
|
-
overflow: hidden;
|
|
169
|
-
background-color: $color-light;
|
|
170
|
-
|
|
171
|
-
&.is-open {
|
|
172
|
-
grid-template-rows: 1fr;
|
|
173
|
-
opacity: 1;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
&__panel {
|
|
178
|
-
padding: 0 1rem;
|
|
179
|
-
color: $color-dark-neutral;
|
|
180
|
-
outline: none;
|
|
181
|
-
line-height: 1.5;
|
|
182
|
-
overflow: hidden;
|
|
183
|
-
opacity: 0;
|
|
184
|
-
|
|
185
|
-
&.is-open {
|
|
186
|
-
padding: 0.9rem 1rem 1rem;
|
|
187
|
-
opacity: 1;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
&:focus-visible {
|
|
191
|
-
outline: 2px solid $color-primary;
|
|
192
|
-
outline-offset: 2px;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.frg-accordion__item[data-size='medium'] {
|
|
198
|
-
.frg-accordion__header {
|
|
199
|
-
padding: 0.75rem 0.9rem;
|
|
200
|
-
gap: 0.85rem;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
.frg-accordion__icon {
|
|
204
|
-
width: 2.25rem;
|
|
205
|
-
height: 2.25rem;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.frg-accordion__title {
|
|
209
|
-
font-size: $font-size-sm;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.frg-accordion__subtitle {
|
|
213
|
-
font-size: $font-size-xs;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.frg-accordion__chevron {
|
|
217
|
-
width: 1.35rem;
|
|
218
|
-
height: 1.35rem;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.frg-accordion__panel {
|
|
222
|
-
padding: 0 0.9rem;
|
|
223
|
-
|
|
224
|
-
&.is-open {
|
|
225
|
-
padding: 0.75rem 0.9rem 0.9rem;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.frg-accordion__item[data-size='small'] {
|
|
231
|
-
.frg-accordion__header {
|
|
232
|
-
padding: 0.6rem 0.75rem;
|
|
233
|
-
gap: 0.65rem;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.frg-accordion__icon {
|
|
237
|
-
width: 2rem;
|
|
238
|
-
height: 2rem;
|
|
239
|
-
border-radius: 0.5rem;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.frg-accordion__title {
|
|
243
|
-
font-size: $font-size-xs;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.frg-accordion__subtitle {
|
|
247
|
-
font-size: $font-size-2xs;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
.frg-accordion__chevron {
|
|
251
|
-
width: 1.25rem;
|
|
252
|
-
height: 1.25rem;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.frg-accordion__chevron-icon {
|
|
256
|
-
width: 0.45rem;
|
|
257
|
-
height: 0.45rem;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
.frg-accordion__panel {
|
|
261
|
-
padding: 0 0.75rem;
|
|
262
|
-
|
|
263
|
-
&.is-open {
|
|
264
|
-
padding: 0.6rem 0.75rem 0.75rem;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
$accordion-colors: (
|
|
270
|
-
'primary': $color-primary,
|
|
271
|
-
'secondary': $color-secondary,
|
|
272
|
-
'tertiary': $color-tertiary,
|
|
273
|
-
'info': $color-info,
|
|
274
|
-
'success': $color-success,
|
|
275
|
-
'warning': $color-warning,
|
|
276
|
-
'danger': $color-danger,
|
|
277
|
-
'dark': $color-dark,
|
|
278
|
-
'light': $color-light,
|
|
279
|
-
'outline-primary': $color-primary,
|
|
280
|
-
'outline-secondary': $color-secondary,
|
|
281
|
-
'outline-tertiary': $color-tertiary,
|
|
282
|
-
'outline-info': $color-info,
|
|
283
|
-
'outline-success': $color-success,
|
|
284
|
-
'outline-warning': $color-warning,
|
|
285
|
-
'outline-danger': $color-danger,
|
|
286
|
-
'outline-dark': $color-dark,
|
|
287
|
-
'outline-light': $color-light-soft,
|
|
288
|
-
'default': $color-dark-neutral
|
|
289
|
-
);
|
|
290
|
-
|
|
291
|
-
@each $variant, $tone in $accordion-colors {
|
|
292
|
-
.frg-accordion__item[data-style="#{$variant}"] {
|
|
293
|
-
$solid-variants: ('primary', 'secondary', 'tertiary', 'dark', 'light');
|
|
294
|
-
$outline-variants: (
|
|
295
|
-
'outline-primary',
|
|
296
|
-
'outline-secondary',
|
|
297
|
-
'outline-tertiary',
|
|
298
|
-
'outline-info',
|
|
299
|
-
'outline-success',
|
|
300
|
-
'outline-warning',
|
|
301
|
-
'outline-danger',
|
|
302
|
-
'outline-dark',
|
|
303
|
-
'outline-light'
|
|
304
|
-
);
|
|
305
|
-
|
|
306
|
-
@if list.index($outline-variants, $variant) {
|
|
307
|
-
border-bottom-color: color.scale($tone, $lightness: -5%);
|
|
308
|
-
|
|
309
|
-
.frg-accordion__panel-wrapper {
|
|
310
|
-
border-top-color: color.scale($tone, $lightness: -5%);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.frg-accordion__header {
|
|
315
|
-
@if list.index($solid-variants, $variant) {
|
|
316
|
-
$header-tone: if($variant == 'dark', color.scale($tone, $lightness: 10%), $tone);
|
|
317
|
-
background-color: $header-tone;
|
|
318
|
-
color: if($variant == 'light', $color-dark, $color-light);
|
|
319
|
-
|
|
320
|
-
&:hover {
|
|
321
|
-
background-color: color.scale($header-tone, $lightness: if($variant == 'light', -6%, -4%));
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
.frg-accordion__subtitle {
|
|
325
|
-
color: if(
|
|
326
|
-
$variant == 'light',
|
|
327
|
-
color.scale($color-dark-soft, $lightness: -10%),
|
|
328
|
-
color.scale($color-light, $lightness: -8%)
|
|
329
|
-
);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
.frg-accordion__icon {
|
|
333
|
-
background-color: color.scale($header-tone, $lightness: if($variant == 'light', 8%, -8%));
|
|
334
|
-
color: if($variant == 'light', $color-dark, $color-light);
|
|
335
|
-
}
|
|
336
|
-
} @else {
|
|
337
|
-
color: if($variant == 'light', $color-dark, color.scale($tone, $lightness: -5%));
|
|
338
|
-
&:hover {
|
|
339
|
-
background-color: color.scale($tone, $lightness: 90%);
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
.frg-accordion__chevron-icon {
|
|
345
|
-
@if list.index($solid-variants, $variant) {
|
|
346
|
-
border-color: if($variant == 'light', $color-dark, $color-light);
|
|
347
|
-
} @else {
|
|
348
|
-
border-color: if($variant == 'light', $color-dark-soft, color.scale($tone, $lightness: -5%));
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
&.is-expanded {
|
|
353
|
-
box-shadow: none;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
&.is-disabled {
|
|
357
|
-
border-bottom-color: $frg-accordion-border-color;
|
|
358
|
-
|
|
359
|
-
.frg-accordion__panel-wrapper {
|
|
360
|
-
border-top-color: $frg-accordion-border-color;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
.frg-accordion__header {
|
|
364
|
-
background-color: $color-light;
|
|
365
|
-
color: $color-dark;
|
|
366
|
-
|
|
367
|
-
.frg-accordion__subtitle {
|
|
368
|
-
color: $color-dark-soft;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
.frg-accordion__icon {
|
|
372
|
-
background-color: color.scale($color-light, $lightness: -6%);
|
|
373
|
-
color: $color-dark-soft;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.frg-accordion__chevron-icon {
|
|
378
|
-
border-color: $color-dark-soft;
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
}
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
-
import { By } from '@angular/platform-browser';
|
|
4
|
-
import { AccordionComponent } from './accordion.component';
|
|
5
|
-
import { AccordionItem } from './accordion.type';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [AccordionComponent],
|
|
10
|
-
template: `
|
|
11
|
-
<frg-accordion
|
|
12
|
-
[items]="items"
|
|
13
|
-
[multi]="multi"
|
|
14
|
-
[expandedIds]="expandedIds"
|
|
15
|
-
[toggleOnHeaderClick]="toggleOnHeaderClick">
|
|
16
|
-
</frg-accordion>
|
|
17
|
-
`
|
|
18
|
-
})
|
|
19
|
-
class TestHostComponent {
|
|
20
|
-
items: AccordionItem[] = [];
|
|
21
|
-
multi = false;
|
|
22
|
-
expandedIds: string[] = [];
|
|
23
|
-
toggleOnHeaderClick = true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
describe('AccordionComponent', () => {
|
|
27
|
-
let fixture: ComponentFixture<TestHostComponent>;
|
|
28
|
-
|
|
29
|
-
const getAccordion = () =>
|
|
30
|
-
fixture.debugElement.query(By.directive(AccordionComponent)).componentInstance as AccordionComponent;
|
|
31
|
-
|
|
32
|
-
const getHeaderButtons = () =>
|
|
33
|
-
fixture.debugElement.queryAll(By.css('.frg-accordion__header'));
|
|
34
|
-
|
|
35
|
-
beforeEach(async () => {
|
|
36
|
-
await TestBed.configureTestingModule({
|
|
37
|
-
imports: [TestHostComponent]
|
|
38
|
-
}).compileComponents();
|
|
39
|
-
|
|
40
|
-
fixture = TestBed.createComponent(TestHostComponent);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('renders titles and subtitles', () => {
|
|
44
|
-
fixture.componentInstance.items = [
|
|
45
|
-
{ id: 'a1', title: 'First', subtitle: 'Alpha', content: 'Content A' },
|
|
46
|
-
{ id: 'a2', title: 'Second', content: 'Content B' }
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
fixture.detectChanges();
|
|
50
|
-
|
|
51
|
-
const titles = fixture.debugElement.queryAll(By.css('.frg-accordion__title'));
|
|
52
|
-
const subtitles = fixture.debugElement.queryAll(By.css('.frg-accordion__subtitle'));
|
|
53
|
-
|
|
54
|
-
expect(titles.length).toBe(2);
|
|
55
|
-
expect(titles[0].nativeElement.textContent).toContain('First');
|
|
56
|
-
expect(titles[1].nativeElement.textContent).toContain('Second');
|
|
57
|
-
expect(subtitles.length).toBe(1);
|
|
58
|
-
expect(subtitles[0].nativeElement.textContent).toContain('Alpha');
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('toggles an item on click and emits events', () => {
|
|
62
|
-
fixture.componentInstance.items = [
|
|
63
|
-
{ id: 'a1', title: 'First', content: 'Content A' },
|
|
64
|
-
{ id: 'a2', title: 'Second', content: 'Content B' }
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
fixture.detectChanges();
|
|
68
|
-
|
|
69
|
-
const accordion = getAccordion();
|
|
70
|
-
const emitSpy = spyOn(accordion.expandedIdsChange, 'emit');
|
|
71
|
-
const toggledSpy = spyOn(accordion.toggled, 'emit');
|
|
72
|
-
|
|
73
|
-
getHeaderButtons()[0].nativeElement.click();
|
|
74
|
-
fixture.detectChanges();
|
|
75
|
-
|
|
76
|
-
expect(emitSpy).toHaveBeenCalledWith(['a1']);
|
|
77
|
-
expect(toggledSpy).toHaveBeenCalled();
|
|
78
|
-
expect(accordion.isExpanded('a1')).toBeTrue();
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('does not toggle when the item is disabled', () => {
|
|
82
|
-
fixture.componentInstance.items = [
|
|
83
|
-
{ id: 'a1', title: 'First', content: 'Content A', disabled: true }
|
|
84
|
-
];
|
|
85
|
-
|
|
86
|
-
fixture.detectChanges();
|
|
87
|
-
|
|
88
|
-
const accordion = getAccordion();
|
|
89
|
-
const emitSpy = spyOn(accordion.expandedIdsChange, 'emit');
|
|
90
|
-
|
|
91
|
-
getHeaderButtons()[0].nativeElement.click();
|
|
92
|
-
fixture.detectChanges();
|
|
93
|
-
|
|
94
|
-
expect(emitSpy).not.toHaveBeenCalled();
|
|
95
|
-
expect(accordion.isExpanded('a1')).toBeFalse();
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it('supports multi-expand mode', () => {
|
|
99
|
-
fixture.componentInstance.items = [
|
|
100
|
-
{ id: 'a1', title: 'First', content: 'Content A' },
|
|
101
|
-
{ id: 'a2', title: 'Second', content: 'Content B' }
|
|
102
|
-
];
|
|
103
|
-
fixture.componentInstance.multi = true;
|
|
104
|
-
|
|
105
|
-
fixture.detectChanges();
|
|
106
|
-
|
|
107
|
-
const accordion = getAccordion();
|
|
108
|
-
getHeaderButtons()[0].nativeElement.click();
|
|
109
|
-
getHeaderButtons()[1].nativeElement.click();
|
|
110
|
-
fixture.detectChanges();
|
|
111
|
-
|
|
112
|
-
expect(accordion.isExpanded('a1')).toBeTrue();
|
|
113
|
-
expect(accordion.isExpanded('a2')).toBeTrue();
|
|
114
|
-
expect(accordion.expandedIds.length).toBe(2);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('ignores header clicks when toggleOnHeaderClick is false', () => {
|
|
118
|
-
fixture.componentInstance.items = [
|
|
119
|
-
{ id: 'a1', title: 'First', content: 'Content A' }
|
|
120
|
-
];
|
|
121
|
-
fixture.componentInstance.toggleOnHeaderClick = false;
|
|
122
|
-
|
|
123
|
-
fixture.detectChanges();
|
|
124
|
-
|
|
125
|
-
const accordion = getAccordion();
|
|
126
|
-
getHeaderButtons()[0].nativeElement.click();
|
|
127
|
-
fixture.detectChanges();
|
|
128
|
-
|
|
129
|
-
expect(accordion.isExpanded('a1')).toBeFalse();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('toggles on Enter key press', () => {
|
|
133
|
-
fixture.componentInstance.items = [
|
|
134
|
-
{ id: 'a1', title: 'First', content: 'Content A' }
|
|
135
|
-
];
|
|
136
|
-
|
|
137
|
-
fixture.detectChanges();
|
|
138
|
-
|
|
139
|
-
const accordion = getAccordion();
|
|
140
|
-
const header = getHeaderButtons()[0].nativeElement as HTMLButtonElement;
|
|
141
|
-
|
|
142
|
-
header.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter' }));
|
|
143
|
-
fixture.detectChanges();
|
|
144
|
-
|
|
145
|
-
expect(accordion.isExpanded('a1')).toBeTrue();
|
|
146
|
-
});
|
|
147
|
-
});
|