@star-ng/ui 0.0.0-placeholder.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +147 -3
- package/fesm2022/star-ng-ui-accordion.mjs +376 -0
- package/fesm2022/star-ng-ui-accordion.mjs.map +1 -0
- package/fesm2022/star-ng-ui-autocomplete.mjs +782 -0
- package/fesm2022/star-ng-ui-autocomplete.mjs.map +1 -0
- package/fesm2022/star-ng-ui-avatar.mjs +154 -0
- package/fesm2022/star-ng-ui-avatar.mjs.map +1 -0
- package/fesm2022/star-ng-ui-badge.mjs +153 -0
- package/fesm2022/star-ng-ui-badge.mjs.map +1 -0
- package/fesm2022/star-ng-ui-breadcrumb.mjs +199 -0
- package/fesm2022/star-ng-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/star-ng-ui-button.mjs +282 -0
- package/fesm2022/star-ng-ui-button.mjs.map +1 -0
- package/fesm2022/star-ng-ui-card.mjs +112 -0
- package/fesm2022/star-ng-ui-card.mjs.map +1 -0
- package/fesm2022/star-ng-ui-chart.mjs +1904 -0
- package/fesm2022/star-ng-ui-chart.mjs.map +1 -0
- package/fesm2022/star-ng-ui-checkbox.mjs +345 -0
- package/fesm2022/star-ng-ui-checkbox.mjs.map +1 -0
- package/fesm2022/star-ng-ui-core.mjs +392 -0
- package/fesm2022/star-ng-ui-core.mjs.map +1 -0
- package/fesm2022/star-ng-ui-data-display.mjs +1556 -0
- package/fesm2022/star-ng-ui-data-display.mjs.map +1 -0
- package/fesm2022/star-ng-ui-date-picker.mjs +2786 -0
- package/fesm2022/star-ng-ui-date-picker.mjs.map +1 -0
- package/fesm2022/star-ng-ui-dialog.mjs +948 -0
- package/fesm2022/star-ng-ui-dialog.mjs.map +1 -0
- package/fesm2022/star-ng-ui-drawer.mjs +158 -0
- package/fesm2022/star-ng-ui-drawer.mjs.map +1 -0
- package/fesm2022/star-ng-ui-editor.mjs +416 -0
- package/fesm2022/star-ng-ui-editor.mjs.map +1 -0
- package/fesm2022/star-ng-ui-field.mjs +378 -0
- package/fesm2022/star-ng-ui-field.mjs.map +1 -0
- package/fesm2022/star-ng-ui-file-upload.mjs +762 -0
- package/fesm2022/star-ng-ui-file-upload.mjs.map +1 -0
- package/fesm2022/star-ng-ui-i18n-de.mjs +179 -0
- package/fesm2022/star-ng-ui-i18n-de.mjs.map +1 -0
- package/fesm2022/star-ng-ui-i18n-es.mjs +179 -0
- package/fesm2022/star-ng-ui-i18n-es.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-group.mjs +188 -0
- package/fesm2022/star-ng-ui-input-group.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-mask.mjs +434 -0
- package/fesm2022/star-ng-ui-input-mask.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-number.mjs +691 -0
- package/fesm2022/star-ng-ui-input-number.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-otp.mjs +343 -0
- package/fesm2022/star-ng-ui-input-otp.mjs.map +1 -0
- package/fesm2022/star-ng-ui-input-tags.mjs +616 -0
- package/fesm2022/star-ng-ui-input-tags.mjs.map +1 -0
- package/fesm2022/star-ng-ui-knob.mjs +514 -0
- package/fesm2022/star-ng-ui-knob.mjs.map +1 -0
- package/fesm2022/star-ng-ui-layout.mjs +608 -0
- package/fesm2022/star-ng-ui-layout.mjs.map +1 -0
- package/fesm2022/star-ng-ui-listbox.mjs +978 -0
- package/fesm2022/star-ng-ui-listbox.mjs.map +1 -0
- package/fesm2022/star-ng-ui-media.mjs +833 -0
- package/fesm2022/star-ng-ui-media.mjs.map +1 -0
- package/fesm2022/star-ng-ui-menu.mjs +1840 -0
- package/fesm2022/star-ng-ui-menu.mjs.map +1 -0
- package/fesm2022/star-ng-ui-message.mjs +191 -0
- package/fesm2022/star-ng-ui-message.mjs.map +1 -0
- package/fesm2022/star-ng-ui-paginator.mjs +387 -0
- package/fesm2022/star-ng-ui-paginator.mjs.map +1 -0
- package/fesm2022/star-ng-ui-panel.mjs +324 -0
- package/fesm2022/star-ng-ui-panel.mjs.map +1 -0
- package/fesm2022/star-ng-ui-password.mjs +517 -0
- package/fesm2022/star-ng-ui-password.mjs.map +1 -0
- package/fesm2022/star-ng-ui-popover.mjs +241 -0
- package/fesm2022/star-ng-ui-popover.mjs.map +1 -0
- package/fesm2022/star-ng-ui-progress-bar.mjs +183 -0
- package/fesm2022/star-ng-ui-progress-bar.mjs.map +1 -0
- package/fesm2022/star-ng-ui-radio.mjs +411 -0
- package/fesm2022/star-ng-ui-radio.mjs.map +1 -0
- package/fesm2022/star-ng-ui-rating.mjs +211 -0
- package/fesm2022/star-ng-ui-rating.mjs.map +1 -0
- package/fesm2022/star-ng-ui-select-button.mjs +613 -0
- package/fesm2022/star-ng-ui-select-button.mjs.map +1 -0
- package/fesm2022/star-ng-ui-select.mjs +2523 -0
- package/fesm2022/star-ng-ui-select.mjs.map +1 -0
- package/fesm2022/star-ng-ui-skeleton.mjs +160 -0
- package/fesm2022/star-ng-ui-skeleton.mjs.map +1 -0
- package/fesm2022/star-ng-ui-slider.mjs +552 -0
- package/fesm2022/star-ng-ui-slider.mjs.map +1 -0
- package/fesm2022/star-ng-ui-spinner.mjs +148 -0
- package/fesm2022/star-ng-ui-spinner.mjs.map +1 -0
- package/fesm2022/star-ng-ui-stepper.mjs +360 -0
- package/fesm2022/star-ng-ui-stepper.mjs.map +1 -0
- package/fesm2022/star-ng-ui-table.mjs +3477 -0
- package/fesm2022/star-ng-ui-table.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tabs.mjs +464 -0
- package/fesm2022/star-ng-ui-tabs.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tag.mjs +129 -0
- package/fesm2022/star-ng-ui-tag.mjs.map +1 -0
- package/fesm2022/star-ng-ui-theme-switch.mjs +105 -0
- package/fesm2022/star-ng-ui-theme-switch.mjs.map +1 -0
- package/fesm2022/star-ng-ui-theme.mjs +98 -0
- package/fesm2022/star-ng-ui-theme.mjs.map +1 -0
- package/fesm2022/star-ng-ui-toast.mjs +298 -0
- package/fesm2022/star-ng-ui-toast.mjs.map +1 -0
- package/fesm2022/star-ng-ui-toggle-switch.mjs +316 -0
- package/fesm2022/star-ng-ui-toggle-switch.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tooltip.mjs +297 -0
- package/fesm2022/star-ng-ui-tooltip.mjs.map +1 -0
- package/fesm2022/star-ng-ui-transloco.mjs +40 -0
- package/fesm2022/star-ng-ui-transloco.mjs.map +1 -0
- package/fesm2022/star-ng-ui-tree.mjs +1446 -0
- package/fesm2022/star-ng-ui-tree.mjs.map +1 -0
- package/fesm2022/star-ng-ui-utility.mjs +2134 -0
- package/fesm2022/star-ng-ui-utility.mjs.map +1 -0
- package/fesm2022/star-ng-ui.mjs +51 -0
- package/package.json +281 -5
- package/styles/_base.scss +70 -0
- package/styles/_shared.scss +2 -0
- package/styles/_tokens.scss +190 -0
- package/styles/controls/_accordion.scss +75 -0
- package/styles/controls/_autocomplete.scss +44 -0
- package/styles/controls/_avatar.scss +39 -0
- package/styles/controls/_breadcrumb.scss +45 -0
- package/styles/controls/_button.scss +137 -0
- package/styles/controls/_card.scss +38 -0
- package/styles/controls/_chart.scss +214 -0
- package/styles/controls/_chip.scss +51 -0
- package/styles/controls/_choice.scss +153 -0
- package/styles/controls/_data-display.scss +118 -0
- package/styles/controls/_date-picker.scss +300 -0
- package/styles/controls/_dialog.scss +123 -0
- package/styles/controls/_drawer.scss +118 -0
- package/styles/controls/_editor.scss +74 -0
- package/styles/controls/_field.scss +92 -0
- package/styles/controls/_file-upload.scss +136 -0
- package/styles/controls/_input-group.scss +104 -0
- package/styles/controls/_input-mask.scss +46 -0
- package/styles/controls/_input-number.scss +125 -0
- package/styles/controls/_knob.scss +76 -0
- package/styles/controls/_layout.scss +182 -0
- package/styles/controls/_listbox.scss +38 -0
- package/styles/controls/_media.scss +222 -0
- package/styles/controls/_menu.scss +254 -0
- package/styles/controls/_message.scss +48 -0
- package/styles/controls/_org-chart.scss +128 -0
- package/styles/controls/_paginator.scss +59 -0
- package/styles/controls/_panel.scss +83 -0
- package/styles/controls/_popover.scss +40 -0
- package/styles/controls/_progress-bar.scss +74 -0
- package/styles/controls/_select-button.scss +61 -0
- package/styles/controls/_select.scss +216 -0
- package/styles/controls/_skeleton.scss +43 -0
- package/styles/controls/_slider.scss +163 -0
- package/styles/controls/_spinner.scss +34 -0
- package/styles/controls/_stepper.scss +109 -0
- package/styles/controls/_table.scss +523 -0
- package/styles/controls/_tabs.scss +93 -0
- package/styles/controls/_tag.scss +84 -0
- package/styles/controls/_toast.scss +141 -0
- package/styles/controls/_tooltip.scss +14 -0
- package/styles/controls/_tree.scss +113 -0
- package/styles/controls/_utility.scss +654 -0
- package/styles/star-ng.css +5803 -0
- package/styles/star-ng.min.css +1 -0
- package/styles/star-ng.scss +50 -0
- package/theme/star-theme-first-paint.js +1 -0
- package/types/star-ng-ui-accordion.d.ts +82 -0
- package/types/star-ng-ui-autocomplete.d.ts +171 -0
- package/types/star-ng-ui-avatar.d.ts +43 -0
- package/types/star-ng-ui-badge.d.ts +46 -0
- package/types/star-ng-ui-breadcrumb.d.ts +39 -0
- package/types/star-ng-ui-button.d.ts +79 -0
- package/types/star-ng-ui-card.d.ts +29 -0
- package/types/star-ng-ui-chart.d.ts +337 -0
- package/types/star-ng-ui-checkbox.d.ts +92 -0
- package/types/star-ng-ui-core.d.ts +310 -0
- package/types/star-ng-ui-data-display.d.ts +339 -0
- package/types/star-ng-ui-date-picker.d.ts +701 -0
- package/types/star-ng-ui-dialog.d.ts +254 -0
- package/types/star-ng-ui-drawer.d.ts +29 -0
- package/types/star-ng-ui-editor.d.ts +96 -0
- package/types/star-ng-ui-field.d.ts +146 -0
- package/types/star-ng-ui-file-upload.d.ts +192 -0
- package/types/star-ng-ui-i18n-de.d.ts +7 -0
- package/types/star-ng-ui-i18n-es.d.ts +7 -0
- package/types/star-ng-ui-input-group.d.ts +58 -0
- package/types/star-ng-ui-input-mask.d.ts +126 -0
- package/types/star-ng-ui-input-number.d.ts +193 -0
- package/types/star-ng-ui-input-otp.d.ts +86 -0
- package/types/star-ng-ui-input-tags.d.ts +159 -0
- package/types/star-ng-ui-knob.d.ts +121 -0
- package/types/star-ng-ui-layout.d.ts +154 -0
- package/types/star-ng-ui-listbox.d.ts +197 -0
- package/types/star-ng-ui-media.d.ts +161 -0
- package/types/star-ng-ui-menu.d.ts +332 -0
- package/types/star-ng-ui-message.d.ts +52 -0
- package/types/star-ng-ui-paginator.d.ts +85 -0
- package/types/star-ng-ui-panel.d.ts +65 -0
- package/types/star-ng-ui-password.d.ts +129 -0
- package/types/star-ng-ui-popover.d.ts +57 -0
- package/types/star-ng-ui-progress-bar.d.ts +49 -0
- package/types/star-ng-ui-radio.d.ts +116 -0
- package/types/star-ng-ui-rating.d.ts +52 -0
- package/types/star-ng-ui-select-button.d.ts +169 -0
- package/types/star-ng-ui-select.d.ts +540 -0
- package/types/star-ng-ui-skeleton.d.ts +47 -0
- package/types/star-ng-ui-slider.d.ts +145 -0
- package/types/star-ng-ui-spinner.d.ts +29 -0
- package/types/star-ng-ui-stepper.d.ts +89 -0
- package/types/star-ng-ui-table.d.ts +829 -0
- package/types/star-ng-ui-tabs.d.ts +109 -0
- package/types/star-ng-ui-tag.d.ts +35 -0
- package/types/star-ng-ui-theme-switch.d.ts +36 -0
- package/types/star-ng-ui-theme.d.ts +95 -0
- package/types/star-ng-ui-toast.d.ts +84 -0
- package/types/star-ng-ui-toggle-switch.d.ts +81 -0
- package/types/star-ng-ui-tooltip.d.ts +66 -0
- package/types/star-ng-ui-transloco.d.ts +14 -0
- package/types/star-ng-ui-tree.d.ts +310 -0
- package/types/star-ng-ui-utility.d.ts +533 -0
- package/types/star-ng-ui.d.ts +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ramana Reddy Chamakura
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,5 +1,149 @@
|
|
|
1
|
-
#
|
|
1
|
+
# StarNG
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@star-ng/ui)
|
|
4
|
+
[](https://github.com/ramanacr/star-ng/actions/workflows/ci.yml)
|
|
5
|
+
[](https://ramanacr.github.io/star-ng/)
|
|
6
|
+
[](LICENSE)
|
|
4
7
|
|
|
5
|
-
|
|
8
|
+
StarNG is a library of accessible Angular controls. It uses signals, Signal Forms and the Angular CDK. The npm package is `@star-ng/ui`. The selector prefix is `star-` and the CSS token prefix is `--star-`. Each control group is one entry point, for example `@star-ng/ui/button`, so an application bundles only what it imports. The library does not use Angular Material or another UI kit.
|
|
9
|
+
|
|
10
|
+
> Status: `@star-ng/ui` has `0.x` versions. The API can change between minor versions (see "Versioning and stability").
|
|
11
|
+
|
|
12
|
+
## What is in the package
|
|
13
|
+
|
|
14
|
+
About 90 controls in more than 50 entry points. Each control has a docs page with live examples and an API table.
|
|
15
|
+
|
|
16
|
+
Control groups: buttons; forms (field, input, checkbox, radio, switch, number, password, mask, one-time code, tags, slider, rating, knob, color picker, select button); selection (select, multi-select, cascade select, listbox, autocomplete, tree, tree select); date and time; table; menus; overlays (dialog, confirm, drawer, popover, tooltip, toast); panels and navigation; data display and charts; media (file upload, editor, carousel, galleria, image); utilities.
|
|
17
|
+
|
|
18
|
+
## Requirements
|
|
19
|
+
|
|
20
|
+
| Package | Version |
|
|
21
|
+
| ---------------------------------------------------- | ---------------------------------------------- |
|
|
22
|
+
| `@angular/core`, `@angular/common`, `@angular/forms` | 22 or later |
|
|
23
|
+
| `@angular/cdk` | 22 or later |
|
|
24
|
+
| `@angular/router` | 22 or later |
|
|
25
|
+
| `@phosphor-icons/web` | 2.1 or later (icons that the controls draw) |
|
|
26
|
+
| `rxjs` | 7.8 or later |
|
|
27
|
+
| `@jsverse/transloco` | 8 or later, optional (`@star-ng/ui/transloco`) |
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
Use one of these commands.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pnpm add @star-ng/ui @angular/cdk @phosphor-icons/web
|
|
35
|
+
npm install @star-ng/ui @angular/cdk @phosphor-icons/web
|
|
36
|
+
yarn add @star-ng/ui @angular/cdk @phosphor-icons/web
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Include the styles
|
|
40
|
+
|
|
41
|
+
Add the compiled CSS and two Phosphor icon weights to the `styles` of your build target in `angular.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
"styles": [
|
|
45
|
+
"@phosphor-icons/web/bold/style.css",
|
|
46
|
+
"@phosphor-icons/web/fill/style.css",
|
|
47
|
+
"@star-ng/ui/styles/star-ng.css",
|
|
48
|
+
"src/styles.scss"
|
|
49
|
+
]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
With Sass, you can use the SCSS entry instead: `@use '@star-ng/ui/styles/star-ng';`.
|
|
53
|
+
|
|
54
|
+
## Use a control
|
|
55
|
+
|
|
56
|
+
Import a control from its entry point, not from the package root.
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
60
|
+
import { StarButton } from '@star-ng/ui/button';
|
|
61
|
+
|
|
62
|
+
@Component({
|
|
63
|
+
selector: 'app-orders',
|
|
64
|
+
imports: [StarButton],
|
|
65
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
66
|
+
template: `<star-button (pressed)="create()">New order</star-button>`,
|
|
67
|
+
})
|
|
68
|
+
export class Orders {
|
|
69
|
+
create(): void {}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Forms
|
|
74
|
+
|
|
75
|
+
1. Form controls implement the Signal Forms control interfaces. Bind them with `[formField]`.
|
|
76
|
+
2. Without a form, use two-way binding, for example `[(checked)]` or `[(value)]`.
|
|
77
|
+
3. In Reactive Forms, use `SignalFormControl` from `@angular/forms/signals/compat`.
|
|
78
|
+
|
|
79
|
+
See the [forms guide](https://ramanacr.github.io/star-ng/guides/forms).
|
|
80
|
+
|
|
81
|
+
## Theme and dark mode
|
|
82
|
+
|
|
83
|
+
Override the `--star-*` tokens after the StarNG styles. Put light values on `:root` and dark values on `[data-theme='dark']`.
|
|
84
|
+
|
|
85
|
+
```css
|
|
86
|
+
:root {
|
|
87
|
+
--star-primary: #0f766e;
|
|
88
|
+
}
|
|
89
|
+
[data-theme='dark'] {
|
|
90
|
+
--star-primary: #2dd4bf;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`StarThemeService` (`@star-ng/ui/theme`) is an optional helper for a system, light or dark choice. A first-paint script avoids a flash of the wrong theme. See the guides [theming and tokens](https://ramanacr.github.io/star-ng/guides/theming) and [dark mode](https://ramanacr.github.io/star-ng/guides/dark-mode).
|
|
95
|
+
|
|
96
|
+
## Language packs
|
|
97
|
+
|
|
98
|
+
The built-in text of the controls is English. The German and Spanish packs are separate entry points. The `locale` inputs of the controls set number and date formats. They do not depend on the pack.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
import { provideStarUiText } from '@star-ng/ui/core';
|
|
102
|
+
import { STAR_UI_TEXT_DE } from '@star-ng/ui/i18n/de';
|
|
103
|
+
|
|
104
|
+
providers: [provideStarUiText(STAR_UI_TEXT_DE)];
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
A language model wrote the German and Spanish packs. Native speakers did not review them. See the [internationalisation guide](https://ramanacr.github.io/star-ng/guides/i18n) for run-time switching, your own pack and Transloco.
|
|
108
|
+
|
|
109
|
+
## Right-to-left
|
|
110
|
+
|
|
111
|
+
Set `dir="rtl"` on `<html>`. The styles use logical properties, the arrow keys follow the visual direction, and overlays follow the direction at run time. See the [right-to-left guide](https://ramanacr.github.io/star-ng/guides/right-to-left).
|
|
112
|
+
|
|
113
|
+
## Browser support
|
|
114
|
+
|
|
115
|
+
The tests run in Chromium only (Playwright). Firefox and Safari are not tested. The library uses these modern CSS and platform features. Check them against your browser targets.
|
|
116
|
+
|
|
117
|
+
- `:has()` and `:dir()`
|
|
118
|
+
- container queries
|
|
119
|
+
- `@starting-style`
|
|
120
|
+
- `field-sizing`
|
|
121
|
+
- `color-mix()`
|
|
122
|
+
- logical properties
|
|
123
|
+
- the native `<dialog>` element and popover behavior (through the Angular CDK)
|
|
124
|
+
|
|
125
|
+
## Accessibility
|
|
126
|
+
|
|
127
|
+
The target is WCAG 2.2 level AA. CI runs an automated axe scan on every docs page in the light and dark themes, and on 65 opened states. Unit tests and keyboard tests cover roles, states and key handling.
|
|
128
|
+
|
|
129
|
+
Not tested: screen-reader output, zoom and reflow, forced-colors mode. An automated scan finds only some problems. Your application must also name every control and set the page language. See the [accessibility guide](https://ramanacr.github.io/star-ng/guides/accessibility).
|
|
130
|
+
|
|
131
|
+
## Versioning and stability
|
|
132
|
+
|
|
133
|
+
The package follows semantic versioning. In `0.x` versions, the API can change between minor versions. Read the [changelog](CHANGELOG.md) before you update. The dist-tag `latest` is for releases. The dist-tag `next` is for prereleases.
|
|
134
|
+
|
|
135
|
+
## Known limits
|
|
136
|
+
|
|
137
|
+
- Chromium is the only tested browser.
|
|
138
|
+
- The German and Spanish text packs have no native-speaker review.
|
|
139
|
+
- There are no screen-reader, zoom, reflow or forced-colors tests.
|
|
140
|
+
- The editor and the file upload do not protect your server. See [SECURITY.md](SECURITY.md).
|
|
141
|
+
|
|
142
|
+
## Links
|
|
143
|
+
|
|
144
|
+
- [Documentation site](https://ramanacr.github.io/star-ng/)
|
|
145
|
+
- [Changelog](CHANGELOG.md)
|
|
146
|
+
- [Contributing](CONTRIBUTING.md)
|
|
147
|
+
- [Releasing](RELEASING.md)
|
|
148
|
+
- [Security](SECURITY.md)
|
|
149
|
+
- [License (MIT)](LICENSE)
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { _IdGenerator } from "@angular/cdk/a11y";
|
|
2
|
+
import { NgTemplateOutlet } from "@angular/common";
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
import { ChangeDetectionStrategy, Component, Directive, ElementRef, TemplateRef, booleanAttribute, computed, contentChild, contentChildren, forwardRef, inject, input, linkedSignal, model } from "@angular/core";
|
|
5
|
+
var StarAccordionContent = class StarAccordionContent {
|
|
6
|
+
template = inject(TemplateRef);
|
|
7
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
8
|
+
minVersion: "12.0.0",
|
|
9
|
+
version: "22.2.6",
|
|
10
|
+
ngImport: i0,
|
|
11
|
+
type: StarAccordionContent,
|
|
12
|
+
deps: [],
|
|
13
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
14
|
+
});
|
|
15
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
16
|
+
minVersion: "14.0.0",
|
|
17
|
+
version: "22.2.6",
|
|
18
|
+
type: StarAccordionContent,
|
|
19
|
+
isStandalone: true,
|
|
20
|
+
selector: "ng-template[starAccordionContent]",
|
|
21
|
+
ngImport: i0
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
25
|
+
minVersion: "12.0.0",
|
|
26
|
+
version: "22.2.6",
|
|
27
|
+
ngImport: i0,
|
|
28
|
+
type: StarAccordionContent,
|
|
29
|
+
decorators: [{
|
|
30
|
+
type: Directive,
|
|
31
|
+
args: [{ selector: "ng-template[starAccordionContent]" }]
|
|
32
|
+
}]
|
|
33
|
+
});
|
|
34
|
+
var StarAccordionPanel = class StarAccordionPanel {
|
|
35
|
+
accordion = inject(forwardRef(() => StarAccordion));
|
|
36
|
+
ids = inject(_IdGenerator);
|
|
37
|
+
value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
38
|
+
header = input("", ...ngDevMode ? [{ debugName: "header" }] : /* istanbul ignore next */ []);
|
|
39
|
+
icon = input(null, ...ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []);
|
|
40
|
+
disabled = input(false, {
|
|
41
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
42
|
+
transform: booleanAttribute
|
|
43
|
+
});
|
|
44
|
+
headerId = this.ids.getId("star-accordion-header-");
|
|
45
|
+
regionId = this.ids.getId("star-accordion-region-");
|
|
46
|
+
lazy = contentChild(StarAccordionContent, ...ngDevMode ? [{ debugName: "lazy" }] : /* istanbul ignore next */ []);
|
|
47
|
+
expanded = computed(() => this.accordion.isOpen(this.value()), ...ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []);
|
|
48
|
+
rendered = linkedSignal({
|
|
49
|
+
...ngDevMode ? { debugName: "rendered" } : /* istanbul ignore next */ {},
|
|
50
|
+
source: this.expanded,
|
|
51
|
+
computation: (open, previous) => open || (previous?.value ?? false)
|
|
52
|
+
});
|
|
53
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
54
|
+
minVersion: "12.0.0",
|
|
55
|
+
version: "22.2.6",
|
|
56
|
+
ngImport: i0,
|
|
57
|
+
type: StarAccordionPanel,
|
|
58
|
+
deps: [],
|
|
59
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
60
|
+
});
|
|
61
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
62
|
+
minVersion: "17.0.0",
|
|
63
|
+
version: "22.2.6",
|
|
64
|
+
type: StarAccordionPanel,
|
|
65
|
+
isStandalone: true,
|
|
66
|
+
selector: "star-accordion-panel",
|
|
67
|
+
inputs: {
|
|
68
|
+
value: {
|
|
69
|
+
classPropertyName: "value",
|
|
70
|
+
publicName: "value",
|
|
71
|
+
isSignal: true,
|
|
72
|
+
isRequired: true,
|
|
73
|
+
transformFunction: null
|
|
74
|
+
},
|
|
75
|
+
header: {
|
|
76
|
+
classPropertyName: "header",
|
|
77
|
+
publicName: "header",
|
|
78
|
+
isSignal: true,
|
|
79
|
+
isRequired: false,
|
|
80
|
+
transformFunction: null
|
|
81
|
+
},
|
|
82
|
+
icon: {
|
|
83
|
+
classPropertyName: "icon",
|
|
84
|
+
publicName: "icon",
|
|
85
|
+
isSignal: true,
|
|
86
|
+
isRequired: false,
|
|
87
|
+
transformFunction: null
|
|
88
|
+
},
|
|
89
|
+
disabled: {
|
|
90
|
+
classPropertyName: "disabled",
|
|
91
|
+
publicName: "disabled",
|
|
92
|
+
isSignal: true,
|
|
93
|
+
isRequired: false,
|
|
94
|
+
transformFunction: null
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
host: {
|
|
98
|
+
properties: {
|
|
99
|
+
"class.star-accordion__panel--open": "expanded()",
|
|
100
|
+
"class.star-accordion__panel--disabled": "disabled()"
|
|
101
|
+
},
|
|
102
|
+
classAttribute: "star-accordion__panel"
|
|
103
|
+
},
|
|
104
|
+
queries: [{
|
|
105
|
+
propertyName: "lazy",
|
|
106
|
+
first: true,
|
|
107
|
+
predicate: StarAccordionContent,
|
|
108
|
+
descendants: true,
|
|
109
|
+
isSignal: true
|
|
110
|
+
}],
|
|
111
|
+
ngImport: i0,
|
|
112
|
+
template: `
|
|
113
|
+
<h3 class="star-accordion__heading">
|
|
114
|
+
<button
|
|
115
|
+
type="button"
|
|
116
|
+
class="star-accordion__header"
|
|
117
|
+
[id]="headerId"
|
|
118
|
+
[attr.aria-expanded]="expanded()"
|
|
119
|
+
[attr.aria-controls]="regionId"
|
|
120
|
+
[disabled]="disabled()"
|
|
121
|
+
(click)="accordion.toggle(value())"
|
|
122
|
+
(keydown)="accordion.onHeaderKeydown($event)"
|
|
123
|
+
>
|
|
124
|
+
@if (icon(); as icon) {
|
|
125
|
+
<i [class]="icon" aria-hidden="true"></i>
|
|
126
|
+
}
|
|
127
|
+
<span class="star-accordion__title">{{ header() }}</span>
|
|
128
|
+
<ng-content select="[starAccordionHeader]" />
|
|
129
|
+
<i class="ph-bold ph-caret-down star-accordion__caret" aria-hidden="true"></i>
|
|
130
|
+
</button>
|
|
131
|
+
</h3>
|
|
132
|
+
<div
|
|
133
|
+
class="star-accordion__region"
|
|
134
|
+
role="region"
|
|
135
|
+
[id]="regionId"
|
|
136
|
+
[attr.aria-labelledby]="headerId"
|
|
137
|
+
[attr.inert]="expanded() ? null : ''"
|
|
138
|
+
>
|
|
139
|
+
<div class="star-accordion__inner">
|
|
140
|
+
<div class="star-accordion__body">
|
|
141
|
+
@if (lazy(); as lazyContent) {
|
|
142
|
+
@if (rendered()) {
|
|
143
|
+
<ng-container *ngTemplateOutlet="lazyContent.template" />
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
<ng-content />
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
`,
|
|
151
|
+
isInline: true,
|
|
152
|
+
dependencies: [{
|
|
153
|
+
kind: "directive",
|
|
154
|
+
type: NgTemplateOutlet,
|
|
155
|
+
selector: "[ngTemplateOutlet]",
|
|
156
|
+
inputs: [
|
|
157
|
+
"ngTemplateOutletContext",
|
|
158
|
+
"ngTemplateOutlet",
|
|
159
|
+
"ngTemplateOutletInjector"
|
|
160
|
+
]
|
|
161
|
+
}],
|
|
162
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
166
|
+
minVersion: "12.0.0",
|
|
167
|
+
version: "22.2.6",
|
|
168
|
+
ngImport: i0,
|
|
169
|
+
type: StarAccordionPanel,
|
|
170
|
+
decorators: [{
|
|
171
|
+
type: Component,
|
|
172
|
+
args: [{
|
|
173
|
+
selector: "star-accordion-panel",
|
|
174
|
+
imports: [NgTemplateOutlet],
|
|
175
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
176
|
+
host: {
|
|
177
|
+
class: "star-accordion__panel",
|
|
178
|
+
"[class.star-accordion__panel--open]": "expanded()",
|
|
179
|
+
"[class.star-accordion__panel--disabled]": "disabled()"
|
|
180
|
+
},
|
|
181
|
+
template: `
|
|
182
|
+
<h3 class="star-accordion__heading">
|
|
183
|
+
<button
|
|
184
|
+
type="button"
|
|
185
|
+
class="star-accordion__header"
|
|
186
|
+
[id]="headerId"
|
|
187
|
+
[attr.aria-expanded]="expanded()"
|
|
188
|
+
[attr.aria-controls]="regionId"
|
|
189
|
+
[disabled]="disabled()"
|
|
190
|
+
(click)="accordion.toggle(value())"
|
|
191
|
+
(keydown)="accordion.onHeaderKeydown($event)"
|
|
192
|
+
>
|
|
193
|
+
@if (icon(); as icon) {
|
|
194
|
+
<i [class]="icon" aria-hidden="true"></i>
|
|
195
|
+
}
|
|
196
|
+
<span class="star-accordion__title">{{ header() }}</span>
|
|
197
|
+
<ng-content select="[starAccordionHeader]" />
|
|
198
|
+
<i class="ph-bold ph-caret-down star-accordion__caret" aria-hidden="true"></i>
|
|
199
|
+
</button>
|
|
200
|
+
</h3>
|
|
201
|
+
<div
|
|
202
|
+
class="star-accordion__region"
|
|
203
|
+
role="region"
|
|
204
|
+
[id]="regionId"
|
|
205
|
+
[attr.aria-labelledby]="headerId"
|
|
206
|
+
[attr.inert]="expanded() ? null : ''"
|
|
207
|
+
>
|
|
208
|
+
<div class="star-accordion__inner">
|
|
209
|
+
<div class="star-accordion__body">
|
|
210
|
+
@if (lazy(); as lazyContent) {
|
|
211
|
+
@if (rendered()) {
|
|
212
|
+
<ng-container *ngTemplateOutlet="lazyContent.template" />
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
<ng-content />
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
`
|
|
220
|
+
}]
|
|
221
|
+
}],
|
|
222
|
+
propDecorators: {
|
|
223
|
+
value: [{
|
|
224
|
+
type: i0.Input,
|
|
225
|
+
args: [{
|
|
226
|
+
isSignal: true,
|
|
227
|
+
alias: "value",
|
|
228
|
+
required: true
|
|
229
|
+
}]
|
|
230
|
+
}],
|
|
231
|
+
header: [{
|
|
232
|
+
type: i0.Input,
|
|
233
|
+
args: [{
|
|
234
|
+
isSignal: true,
|
|
235
|
+
alias: "header",
|
|
236
|
+
required: false
|
|
237
|
+
}]
|
|
238
|
+
}],
|
|
239
|
+
icon: [{
|
|
240
|
+
type: i0.Input,
|
|
241
|
+
args: [{
|
|
242
|
+
isSignal: true,
|
|
243
|
+
alias: "icon",
|
|
244
|
+
required: false
|
|
245
|
+
}]
|
|
246
|
+
}],
|
|
247
|
+
disabled: [{
|
|
248
|
+
type: i0.Input,
|
|
249
|
+
args: [{
|
|
250
|
+
isSignal: true,
|
|
251
|
+
alias: "disabled",
|
|
252
|
+
required: false
|
|
253
|
+
}]
|
|
254
|
+
}],
|
|
255
|
+
lazy: [{
|
|
256
|
+
type: i0.ContentChild,
|
|
257
|
+
args: [i0.forwardRef(() => StarAccordionContent), { isSignal: true }]
|
|
258
|
+
}]
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
var StarAccordion = class StarAccordion {
|
|
262
|
+
value = model([], ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
263
|
+
multiple = input(false, {
|
|
264
|
+
...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
|
|
265
|
+
transform: booleanAttribute
|
|
266
|
+
});
|
|
267
|
+
panels = contentChildren(StarAccordionPanel, ...ngDevMode ? [{ debugName: "panels" }] : /* istanbul ignore next */ []);
|
|
268
|
+
host = inject(ElementRef);
|
|
269
|
+
isOpen(value) {
|
|
270
|
+
return this.value().includes(value);
|
|
271
|
+
}
|
|
272
|
+
toggle(value) {
|
|
273
|
+
const open = this.isOpen(value);
|
|
274
|
+
if (this.multiple()) this.value.update((values) => open ? values.filter((v) => v !== value) : [...values, value]);
|
|
275
|
+
else this.value.set(open ? [] : [value]);
|
|
276
|
+
}
|
|
277
|
+
onHeaderKeydown(event) {
|
|
278
|
+
const headers = [...this.host.nativeElement.querySelectorAll(":scope > star-accordion-panel .star-accordion__header:not(:disabled)")];
|
|
279
|
+
const index = headers.indexOf(event.target);
|
|
280
|
+
const targets = {
|
|
281
|
+
ArrowDown: (index + 1) % headers.length,
|
|
282
|
+
ArrowUp: (index - 1 + headers.length) % headers.length,
|
|
283
|
+
Home: 0,
|
|
284
|
+
End: headers.length - 1
|
|
285
|
+
};
|
|
286
|
+
if (!(event.key in targets) || index < 0) return;
|
|
287
|
+
event.preventDefault();
|
|
288
|
+
headers[targets[event.key]]?.focus();
|
|
289
|
+
}
|
|
290
|
+
count = computed(() => this.panels().length, ...ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []);
|
|
291
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
292
|
+
minVersion: "12.0.0",
|
|
293
|
+
version: "22.2.6",
|
|
294
|
+
ngImport: i0,
|
|
295
|
+
type: StarAccordion,
|
|
296
|
+
deps: [],
|
|
297
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
298
|
+
});
|
|
299
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
300
|
+
minVersion: "17.2.0",
|
|
301
|
+
version: "22.2.6",
|
|
302
|
+
type: StarAccordion,
|
|
303
|
+
isStandalone: true,
|
|
304
|
+
selector: "star-accordion",
|
|
305
|
+
inputs: {
|
|
306
|
+
value: {
|
|
307
|
+
classPropertyName: "value",
|
|
308
|
+
publicName: "value",
|
|
309
|
+
isSignal: true,
|
|
310
|
+
isRequired: false,
|
|
311
|
+
transformFunction: null
|
|
312
|
+
},
|
|
313
|
+
multiple: {
|
|
314
|
+
classPropertyName: "multiple",
|
|
315
|
+
publicName: "multiple",
|
|
316
|
+
isSignal: true,
|
|
317
|
+
isRequired: false,
|
|
318
|
+
transformFunction: null
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
outputs: { value: "valueChange" },
|
|
322
|
+
host: { classAttribute: "star-accordion" },
|
|
323
|
+
queries: [{
|
|
324
|
+
propertyName: "panels",
|
|
325
|
+
predicate: StarAccordionPanel,
|
|
326
|
+
isSignal: true
|
|
327
|
+
}],
|
|
328
|
+
ngImport: i0,
|
|
329
|
+
template: `<ng-content />`,
|
|
330
|
+
isInline: true,
|
|
331
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
335
|
+
minVersion: "12.0.0",
|
|
336
|
+
version: "22.2.6",
|
|
337
|
+
ngImport: i0,
|
|
338
|
+
type: StarAccordion,
|
|
339
|
+
decorators: [{
|
|
340
|
+
type: Component,
|
|
341
|
+
args: [{
|
|
342
|
+
selector: "star-accordion",
|
|
343
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
344
|
+
host: { class: "star-accordion" },
|
|
345
|
+
template: `<ng-content />`
|
|
346
|
+
}]
|
|
347
|
+
}],
|
|
348
|
+
propDecorators: {
|
|
349
|
+
value: [{
|
|
350
|
+
type: i0.Input,
|
|
351
|
+
args: [{
|
|
352
|
+
isSignal: true,
|
|
353
|
+
alias: "value",
|
|
354
|
+
required: false
|
|
355
|
+
}]
|
|
356
|
+
}, {
|
|
357
|
+
type: i0.Output,
|
|
358
|
+
args: ["valueChange"]
|
|
359
|
+
}],
|
|
360
|
+
multiple: [{
|
|
361
|
+
type: i0.Input,
|
|
362
|
+
args: [{
|
|
363
|
+
isSignal: true,
|
|
364
|
+
alias: "multiple",
|
|
365
|
+
required: false
|
|
366
|
+
}]
|
|
367
|
+
}],
|
|
368
|
+
panels: [{
|
|
369
|
+
type: i0.ContentChildren,
|
|
370
|
+
args: [i0.forwardRef(() => StarAccordionPanel), { isSignal: true }]
|
|
371
|
+
}]
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
export { StarAccordion, StarAccordionContent, StarAccordionPanel };
|
|
375
|
+
|
|
376
|
+
//# sourceMappingURL=star-ng-ui-accordion.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"star-ng-ui-accordion.mjs","names":[],"sources":["../../../projects/star-ng/accordion/accordion.ts"],"sourcesContent":["import { _IdGenerator } from '@angular/cdk/a11y';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n contentChild,\n contentChildren,\n Directive,\n ElementRef,\n forwardRef,\n inject,\n input,\n linkedSignal,\n model,\n TemplateRef,\n} from '@angular/core';\n\n/** Lazy panel body: `<ng-template starAccordionContent>` renders on first expand only. */\n@Directive({ selector: 'ng-template[starAccordionContent]' })\nexport class StarAccordionContent {\n readonly template = inject<TemplateRef<unknown>>(TemplateRef);\n}\n\n/** One section of `star-accordion`. */\n@Component({\n selector: 'star-accordion-panel',\n imports: [NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'star-accordion__panel',\n '[class.star-accordion__panel--open]': 'expanded()',\n '[class.star-accordion__panel--disabled]': 'disabled()',\n },\n template: `\n <h3 class=\"star-accordion__heading\">\n <button\n type=\"button\"\n class=\"star-accordion__header\"\n [id]=\"headerId\"\n [attr.aria-expanded]=\"expanded()\"\n [attr.aria-controls]=\"regionId\"\n [disabled]=\"disabled()\"\n (click)=\"accordion.toggle(value())\"\n (keydown)=\"accordion.onHeaderKeydown($event)\"\n >\n @if (icon(); as icon) {\n <i [class]=\"icon\" aria-hidden=\"true\"></i>\n }\n <span class=\"star-accordion__title\">{{ header() }}</span>\n <ng-content select=\"[starAccordionHeader]\" />\n <i class=\"ph-bold ph-caret-down star-accordion__caret\" aria-hidden=\"true\"></i>\n </button>\n </h3>\n <div\n class=\"star-accordion__region\"\n role=\"region\"\n [id]=\"regionId\"\n [attr.aria-labelledby]=\"headerId\"\n [attr.inert]=\"expanded() ? null : ''\"\n >\n <div class=\"star-accordion__inner\">\n <div class=\"star-accordion__body\">\n @if (lazy(); as lazyContent) {\n @if (rendered()) {\n <ng-container *ngTemplateOutlet=\"lazyContent.template\" />\n }\n }\n <ng-content />\n </div>\n </div>\n </div>\n `,\n})\nexport class StarAccordionPanel {\n protected readonly accordion = inject(forwardRef(() => StarAccordion));\n private readonly ids = inject(_IdGenerator);\n\n readonly value = input.required<string>();\n readonly header = input('');\n readonly icon = input<string | null>(null);\n readonly disabled = input(false, { transform: booleanAttribute });\n\n protected readonly headerId = this.ids.getId('star-accordion-header-');\n protected readonly regionId = this.ids.getId('star-accordion-region-');\n protected readonly lazy = contentChild(StarAccordionContent);\n\n readonly expanded = computed(() => this.accordion.isOpen(this.value()));\n protected readonly rendered = linkedSignal<boolean, boolean>({\n source: this.expanded,\n computation: (open, previous) => open || (previous?.value ?? false),\n });\n}\n\n/**\n * Accordion (PrimeNG `p-accordion`): `[(value)]` holds the open panel values, `multiple`\n * allows several open, lazy panel bodies, WAI-ARIA accordion keyboard (Arrow Up / Down,\n * Home / End between headers). Height animates with `grid-template-rows`.\n *\n * ```html\n * <star-accordion [(value)]=\"open\" multiple>\n * <star-accordion-panel value=\"shipping\" header=\"Shipping\">…</star-accordion-panel>\n * </star-accordion>\n * ```\n */\n@Component({\n selector: 'star-accordion',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'star-accordion' },\n template: `<ng-content />`,\n})\nexport class StarAccordion {\n readonly value = model<readonly string[]>([]);\n readonly multiple = input(false, { transform: booleanAttribute });\n\n private readonly panels = contentChildren(StarAccordionPanel);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n isOpen(value: string): boolean {\n return this.value().includes(value);\n }\n\n toggle(value: string): void {\n const open = this.isOpen(value);\n if (this.multiple()) {\n this.value.update((values) =>\n open ? values.filter((v) => v !== value) : [...values, value],\n );\n } else {\n this.value.set(open ? [] : [value]);\n }\n }\n\n onHeaderKeydown(event: KeyboardEvent): void {\n const headers = [\n ...this.host.nativeElement.querySelectorAll<HTMLButtonElement>(\n ':scope > star-accordion-panel .star-accordion__header:not(:disabled)',\n ),\n ];\n const index = headers.indexOf(event.target as HTMLButtonElement);\n const targets: Record<string, number> = {\n ArrowDown: (index + 1) % headers.length,\n ArrowUp: (index - 1 + headers.length) % headers.length,\n Home: 0,\n End: headers.length - 1,\n };\n if (!(event.key in targets) || index < 0) return;\n event.preventDefault();\n headers[targets[event.key]]?.focus();\n }\n\n /** Number of panels (used by tests and demos). */\n readonly count = computed(() => this.panels().length);\n}\n"],"mappings":";;;;AAqBA,IAAa,uBAAb,MAAa,qBAAoB;CACtB,WAAW,OAA6B,WAAW;CADjD,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAoB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAApB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAoB,cAAA;EAAA,UAAA;EAAA,UAAA;CAAA,CAAA;;AAApB,GAAA,y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