@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
|
@@ -0,0 +1,613 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, ElementRef, booleanAttribute, computed, inject, input, model, output } from "@angular/core";
|
|
3
|
+
import { optionText, readOption, starInlineKey } from "@star-ng/ui/core";
|
|
4
|
+
var StarSelectButton = class StarSelectButton {
|
|
5
|
+
host = inject(ElementRef);
|
|
6
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
7
|
+
options = input([], ...ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []);
|
|
8
|
+
optionLabel = input(null, ...ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []);
|
|
9
|
+
optionValue = input(null, ...ngDevMode ? [{ debugName: "optionValue" }] : /* istanbul ignore next */ []);
|
|
10
|
+
optionIcon = input(null, ...ngDevMode ? [{ debugName: "optionIcon" }] : /* istanbul ignore next */ []);
|
|
11
|
+
optionDisabled = input(null, ...ngDevMode ? [{ debugName: "optionDisabled" }] : /* istanbul ignore next */ []);
|
|
12
|
+
multiple = input(false, {
|
|
13
|
+
...ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {},
|
|
14
|
+
transform: booleanAttribute
|
|
15
|
+
});
|
|
16
|
+
allowEmpty = input(true, {
|
|
17
|
+
...ngDevMode ? { debugName: "allowEmpty" } : /* istanbul ignore next */ {},
|
|
18
|
+
transform: booleanAttribute
|
|
19
|
+
});
|
|
20
|
+
size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
21
|
+
ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
22
|
+
disabled = input(false, {
|
|
23
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
24
|
+
transform: booleanAttribute
|
|
25
|
+
});
|
|
26
|
+
invalid = input(false, {
|
|
27
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
28
|
+
transform: booleanAttribute
|
|
29
|
+
});
|
|
30
|
+
touched = input(false, {
|
|
31
|
+
...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
|
|
32
|
+
transform: booleanAttribute
|
|
33
|
+
});
|
|
34
|
+
touch = output();
|
|
35
|
+
selectedIndex = computed(() => this.options().findIndex((option) => this.isSelected(option)), ...ngDevMode ? [{ debugName: "selectedIndex" }] : /* istanbul ignore next */ []);
|
|
36
|
+
labelOf(option) {
|
|
37
|
+
return optionText(option, this.optionLabel());
|
|
38
|
+
}
|
|
39
|
+
iconOf(option) {
|
|
40
|
+
const key = this.optionIcon();
|
|
41
|
+
return key ? readOption(option, key) ?? null : null;
|
|
42
|
+
}
|
|
43
|
+
isDisabled(option) {
|
|
44
|
+
const key = this.optionDisabled();
|
|
45
|
+
return key ? !!readOption(option, key) : false;
|
|
46
|
+
}
|
|
47
|
+
valueOf(option) {
|
|
48
|
+
return readOption(option, this.optionValue());
|
|
49
|
+
}
|
|
50
|
+
isSelected(option) {
|
|
51
|
+
const value = this.value();
|
|
52
|
+
const optionValue = this.valueOf(option);
|
|
53
|
+
return Array.isArray(value) ? value.some((v) => Object.is(v, optionValue)) : Object.is(value, optionValue);
|
|
54
|
+
}
|
|
55
|
+
tabIndexFor(index) {
|
|
56
|
+
if (this.multiple()) return 0;
|
|
57
|
+
const selected = this.selectedIndex();
|
|
58
|
+
return index === (selected >= 0 ? selected : 0) ? 0 : -1;
|
|
59
|
+
}
|
|
60
|
+
toggle(option) {
|
|
61
|
+
if (this.disabled() || this.isDisabled(option)) return;
|
|
62
|
+
const optionValue = this.valueOf(option);
|
|
63
|
+
if (this.multiple()) {
|
|
64
|
+
const current = Array.isArray(this.value()) ? this.value() : [];
|
|
65
|
+
this.value.set(this.isSelected(option) ? current.filter((v) => !Object.is(v, optionValue)) : [...current, optionValue]);
|
|
66
|
+
} else this.value.set(this.isSelected(option) && this.allowEmpty() ? null : optionValue);
|
|
67
|
+
}
|
|
68
|
+
onKeydown(event, index) {
|
|
69
|
+
if (this.multiple()) return;
|
|
70
|
+
const step = {
|
|
71
|
+
ArrowRight: 1,
|
|
72
|
+
ArrowDown: 1,
|
|
73
|
+
ArrowLeft: -1,
|
|
74
|
+
ArrowUp: -1
|
|
75
|
+
}[starInlineKey(event)];
|
|
76
|
+
if (!step) return;
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
const options = this.options();
|
|
79
|
+
for (let i = 1; i <= options.length; i++) {
|
|
80
|
+
const next = (index + step * i + options.length) % options.length;
|
|
81
|
+
if (!this.isDisabled(options[next])) {
|
|
82
|
+
this.value.set(this.valueOf(options[next]));
|
|
83
|
+
this.host.nativeElement.querySelectorAll("button")[next]?.focus();
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
89
|
+
minVersion: "12.0.0",
|
|
90
|
+
version: "22.2.6",
|
|
91
|
+
ngImport: i0,
|
|
92
|
+
type: StarSelectButton,
|
|
93
|
+
deps: [],
|
|
94
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
95
|
+
});
|
|
96
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
97
|
+
minVersion: "17.0.0",
|
|
98
|
+
version: "22.2.6",
|
|
99
|
+
type: StarSelectButton,
|
|
100
|
+
isStandalone: true,
|
|
101
|
+
selector: "star-select-button",
|
|
102
|
+
inputs: {
|
|
103
|
+
value: {
|
|
104
|
+
classPropertyName: "value",
|
|
105
|
+
publicName: "value",
|
|
106
|
+
isSignal: true,
|
|
107
|
+
isRequired: false,
|
|
108
|
+
transformFunction: null
|
|
109
|
+
},
|
|
110
|
+
options: {
|
|
111
|
+
classPropertyName: "options",
|
|
112
|
+
publicName: "options",
|
|
113
|
+
isSignal: true,
|
|
114
|
+
isRequired: false,
|
|
115
|
+
transformFunction: null
|
|
116
|
+
},
|
|
117
|
+
optionLabel: {
|
|
118
|
+
classPropertyName: "optionLabel",
|
|
119
|
+
publicName: "optionLabel",
|
|
120
|
+
isSignal: true,
|
|
121
|
+
isRequired: false,
|
|
122
|
+
transformFunction: null
|
|
123
|
+
},
|
|
124
|
+
optionValue: {
|
|
125
|
+
classPropertyName: "optionValue",
|
|
126
|
+
publicName: "optionValue",
|
|
127
|
+
isSignal: true,
|
|
128
|
+
isRequired: false,
|
|
129
|
+
transformFunction: null
|
|
130
|
+
},
|
|
131
|
+
optionIcon: {
|
|
132
|
+
classPropertyName: "optionIcon",
|
|
133
|
+
publicName: "optionIcon",
|
|
134
|
+
isSignal: true,
|
|
135
|
+
isRequired: false,
|
|
136
|
+
transformFunction: null
|
|
137
|
+
},
|
|
138
|
+
optionDisabled: {
|
|
139
|
+
classPropertyName: "optionDisabled",
|
|
140
|
+
publicName: "optionDisabled",
|
|
141
|
+
isSignal: true,
|
|
142
|
+
isRequired: false,
|
|
143
|
+
transformFunction: null
|
|
144
|
+
},
|
|
145
|
+
multiple: {
|
|
146
|
+
classPropertyName: "multiple",
|
|
147
|
+
publicName: "multiple",
|
|
148
|
+
isSignal: true,
|
|
149
|
+
isRequired: false,
|
|
150
|
+
transformFunction: null
|
|
151
|
+
},
|
|
152
|
+
allowEmpty: {
|
|
153
|
+
classPropertyName: "allowEmpty",
|
|
154
|
+
publicName: "allowEmpty",
|
|
155
|
+
isSignal: true,
|
|
156
|
+
isRequired: false,
|
|
157
|
+
transformFunction: null
|
|
158
|
+
},
|
|
159
|
+
size: {
|
|
160
|
+
classPropertyName: "size",
|
|
161
|
+
publicName: "size",
|
|
162
|
+
isSignal: true,
|
|
163
|
+
isRequired: false,
|
|
164
|
+
transformFunction: null
|
|
165
|
+
},
|
|
166
|
+
ariaLabel: {
|
|
167
|
+
classPropertyName: "ariaLabel",
|
|
168
|
+
publicName: "ariaLabel",
|
|
169
|
+
isSignal: true,
|
|
170
|
+
isRequired: false,
|
|
171
|
+
transformFunction: null
|
|
172
|
+
},
|
|
173
|
+
disabled: {
|
|
174
|
+
classPropertyName: "disabled",
|
|
175
|
+
publicName: "disabled",
|
|
176
|
+
isSignal: true,
|
|
177
|
+
isRequired: false,
|
|
178
|
+
transformFunction: null
|
|
179
|
+
},
|
|
180
|
+
invalid: {
|
|
181
|
+
classPropertyName: "invalid",
|
|
182
|
+
publicName: "invalid",
|
|
183
|
+
isSignal: true,
|
|
184
|
+
isRequired: false,
|
|
185
|
+
transformFunction: null
|
|
186
|
+
},
|
|
187
|
+
touched: {
|
|
188
|
+
classPropertyName: "touched",
|
|
189
|
+
publicName: "touched",
|
|
190
|
+
isSignal: true,
|
|
191
|
+
isRequired: false,
|
|
192
|
+
transformFunction: null
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
outputs: {
|
|
196
|
+
value: "valueChange",
|
|
197
|
+
touch: "touch"
|
|
198
|
+
},
|
|
199
|
+
host: {
|
|
200
|
+
properties: {
|
|
201
|
+
"attr.role": "multiple() ? 'group' : 'radiogroup'",
|
|
202
|
+
"attr.aria-label": "ariaLabel()",
|
|
203
|
+
"attr.aria-disabled": "disabled() || null",
|
|
204
|
+
"class.star-segmented--invalid": "invalid() && touched()",
|
|
205
|
+
"class.star-segmented--sm": "size() === 'sm'"
|
|
206
|
+
},
|
|
207
|
+
classAttribute: "star-segmented"
|
|
208
|
+
},
|
|
209
|
+
ngImport: i0,
|
|
210
|
+
template: `
|
|
211
|
+
@for (option of options(); track $index; let i = $index) {
|
|
212
|
+
<button
|
|
213
|
+
type="button"
|
|
214
|
+
class="star-segmented__item"
|
|
215
|
+
[attr.role]="multiple() ? null : 'radio'"
|
|
216
|
+
[attr.aria-checked]="multiple() ? null : isSelected(option)"
|
|
217
|
+
[attr.aria-pressed]="multiple() ? isSelected(option) : null"
|
|
218
|
+
[attr.tabindex]="tabIndexFor(i)"
|
|
219
|
+
[class.star-segmented__item--on]="isSelected(option)"
|
|
220
|
+
[disabled]="disabled() || isDisabled(option)"
|
|
221
|
+
(click)="toggle(option)"
|
|
222
|
+
(keydown)="onKeydown($event, i)"
|
|
223
|
+
(blur)="touch.emit()"
|
|
224
|
+
>
|
|
225
|
+
@if (iconOf(option); as icon) {
|
|
226
|
+
<i [class]="icon" aria-hidden="true"></i>
|
|
227
|
+
}
|
|
228
|
+
<span>{{ labelOf(option) }}</span>
|
|
229
|
+
</button>
|
|
230
|
+
}
|
|
231
|
+
`,
|
|
232
|
+
isInline: true,
|
|
233
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
234
|
+
});
|
|
235
|
+
};
|
|
236
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
237
|
+
minVersion: "12.0.0",
|
|
238
|
+
version: "22.2.6",
|
|
239
|
+
ngImport: i0,
|
|
240
|
+
type: StarSelectButton,
|
|
241
|
+
decorators: [{
|
|
242
|
+
type: Component,
|
|
243
|
+
args: [{
|
|
244
|
+
selector: "star-select-button",
|
|
245
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
246
|
+
host: {
|
|
247
|
+
class: "star-segmented",
|
|
248
|
+
"[attr.role]": "multiple() ? 'group' : 'radiogroup'",
|
|
249
|
+
"[attr.aria-label]": "ariaLabel()",
|
|
250
|
+
"[attr.aria-disabled]": "disabled() || null",
|
|
251
|
+
"[class.star-segmented--invalid]": "invalid() && touched()",
|
|
252
|
+
"[class.star-segmented--sm]": "size() === 'sm'"
|
|
253
|
+
},
|
|
254
|
+
template: `
|
|
255
|
+
@for (option of options(); track $index; let i = $index) {
|
|
256
|
+
<button
|
|
257
|
+
type="button"
|
|
258
|
+
class="star-segmented__item"
|
|
259
|
+
[attr.role]="multiple() ? null : 'radio'"
|
|
260
|
+
[attr.aria-checked]="multiple() ? null : isSelected(option)"
|
|
261
|
+
[attr.aria-pressed]="multiple() ? isSelected(option) : null"
|
|
262
|
+
[attr.tabindex]="tabIndexFor(i)"
|
|
263
|
+
[class.star-segmented__item--on]="isSelected(option)"
|
|
264
|
+
[disabled]="disabled() || isDisabled(option)"
|
|
265
|
+
(click)="toggle(option)"
|
|
266
|
+
(keydown)="onKeydown($event, i)"
|
|
267
|
+
(blur)="touch.emit()"
|
|
268
|
+
>
|
|
269
|
+
@if (iconOf(option); as icon) {
|
|
270
|
+
<i [class]="icon" aria-hidden="true"></i>
|
|
271
|
+
}
|
|
272
|
+
<span>{{ labelOf(option) }}</span>
|
|
273
|
+
</button>
|
|
274
|
+
}
|
|
275
|
+
`
|
|
276
|
+
}]
|
|
277
|
+
}],
|
|
278
|
+
propDecorators: {
|
|
279
|
+
value: [{
|
|
280
|
+
type: i0.Input,
|
|
281
|
+
args: [{
|
|
282
|
+
isSignal: true,
|
|
283
|
+
alias: "value",
|
|
284
|
+
required: false
|
|
285
|
+
}]
|
|
286
|
+
}, {
|
|
287
|
+
type: i0.Output,
|
|
288
|
+
args: ["valueChange"]
|
|
289
|
+
}],
|
|
290
|
+
options: [{
|
|
291
|
+
type: i0.Input,
|
|
292
|
+
args: [{
|
|
293
|
+
isSignal: true,
|
|
294
|
+
alias: "options",
|
|
295
|
+
required: false
|
|
296
|
+
}]
|
|
297
|
+
}],
|
|
298
|
+
optionLabel: [{
|
|
299
|
+
type: i0.Input,
|
|
300
|
+
args: [{
|
|
301
|
+
isSignal: true,
|
|
302
|
+
alias: "optionLabel",
|
|
303
|
+
required: false
|
|
304
|
+
}]
|
|
305
|
+
}],
|
|
306
|
+
optionValue: [{
|
|
307
|
+
type: i0.Input,
|
|
308
|
+
args: [{
|
|
309
|
+
isSignal: true,
|
|
310
|
+
alias: "optionValue",
|
|
311
|
+
required: false
|
|
312
|
+
}]
|
|
313
|
+
}],
|
|
314
|
+
optionIcon: [{
|
|
315
|
+
type: i0.Input,
|
|
316
|
+
args: [{
|
|
317
|
+
isSignal: true,
|
|
318
|
+
alias: "optionIcon",
|
|
319
|
+
required: false
|
|
320
|
+
}]
|
|
321
|
+
}],
|
|
322
|
+
optionDisabled: [{
|
|
323
|
+
type: i0.Input,
|
|
324
|
+
args: [{
|
|
325
|
+
isSignal: true,
|
|
326
|
+
alias: "optionDisabled",
|
|
327
|
+
required: false
|
|
328
|
+
}]
|
|
329
|
+
}],
|
|
330
|
+
multiple: [{
|
|
331
|
+
type: i0.Input,
|
|
332
|
+
args: [{
|
|
333
|
+
isSignal: true,
|
|
334
|
+
alias: "multiple",
|
|
335
|
+
required: false
|
|
336
|
+
}]
|
|
337
|
+
}],
|
|
338
|
+
allowEmpty: [{
|
|
339
|
+
type: i0.Input,
|
|
340
|
+
args: [{
|
|
341
|
+
isSignal: true,
|
|
342
|
+
alias: "allowEmpty",
|
|
343
|
+
required: false
|
|
344
|
+
}]
|
|
345
|
+
}],
|
|
346
|
+
size: [{
|
|
347
|
+
type: i0.Input,
|
|
348
|
+
args: [{
|
|
349
|
+
isSignal: true,
|
|
350
|
+
alias: "size",
|
|
351
|
+
required: false
|
|
352
|
+
}]
|
|
353
|
+
}],
|
|
354
|
+
ariaLabel: [{
|
|
355
|
+
type: i0.Input,
|
|
356
|
+
args: [{
|
|
357
|
+
isSignal: true,
|
|
358
|
+
alias: "ariaLabel",
|
|
359
|
+
required: false
|
|
360
|
+
}]
|
|
361
|
+
}],
|
|
362
|
+
disabled: [{
|
|
363
|
+
type: i0.Input,
|
|
364
|
+
args: [{
|
|
365
|
+
isSignal: true,
|
|
366
|
+
alias: "disabled",
|
|
367
|
+
required: false
|
|
368
|
+
}]
|
|
369
|
+
}],
|
|
370
|
+
invalid: [{
|
|
371
|
+
type: i0.Input,
|
|
372
|
+
args: [{
|
|
373
|
+
isSignal: true,
|
|
374
|
+
alias: "invalid",
|
|
375
|
+
required: false
|
|
376
|
+
}]
|
|
377
|
+
}],
|
|
378
|
+
touched: [{
|
|
379
|
+
type: i0.Input,
|
|
380
|
+
args: [{
|
|
381
|
+
isSignal: true,
|
|
382
|
+
alias: "touched",
|
|
383
|
+
required: false
|
|
384
|
+
}]
|
|
385
|
+
}],
|
|
386
|
+
touch: [{
|
|
387
|
+
type: i0.Output,
|
|
388
|
+
args: ["touch"]
|
|
389
|
+
}]
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
var StarToggleButton = class StarToggleButton {
|
|
393
|
+
checked = model(false, ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
|
|
394
|
+
onLabel = input("On", ...ngDevMode ? [{ debugName: "onLabel" }] : /* istanbul ignore next */ []);
|
|
395
|
+
offLabel = input("Off", ...ngDevMode ? [{ debugName: "offLabel" }] : /* istanbul ignore next */ []);
|
|
396
|
+
onIcon = input(null, ...ngDevMode ? [{ debugName: "onIcon" }] : /* istanbul ignore next */ []);
|
|
397
|
+
offIcon = input(null, ...ngDevMode ? [{ debugName: "offIcon" }] : /* istanbul ignore next */ []);
|
|
398
|
+
ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
399
|
+
disabled = input(false, {
|
|
400
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
401
|
+
transform: booleanAttribute
|
|
402
|
+
});
|
|
403
|
+
readonly = input(false, {
|
|
404
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
405
|
+
transform: booleanAttribute
|
|
406
|
+
});
|
|
407
|
+
touch = output();
|
|
408
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
409
|
+
minVersion: "12.0.0",
|
|
410
|
+
version: "22.2.6",
|
|
411
|
+
ngImport: i0,
|
|
412
|
+
type: StarToggleButton,
|
|
413
|
+
deps: [],
|
|
414
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
415
|
+
});
|
|
416
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
417
|
+
minVersion: "17.0.0",
|
|
418
|
+
version: "22.2.6",
|
|
419
|
+
type: StarToggleButton,
|
|
420
|
+
isStandalone: true,
|
|
421
|
+
selector: "star-toggle-button",
|
|
422
|
+
inputs: {
|
|
423
|
+
checked: {
|
|
424
|
+
classPropertyName: "checked",
|
|
425
|
+
publicName: "checked",
|
|
426
|
+
isSignal: true,
|
|
427
|
+
isRequired: false,
|
|
428
|
+
transformFunction: null
|
|
429
|
+
},
|
|
430
|
+
onLabel: {
|
|
431
|
+
classPropertyName: "onLabel",
|
|
432
|
+
publicName: "onLabel",
|
|
433
|
+
isSignal: true,
|
|
434
|
+
isRequired: false,
|
|
435
|
+
transformFunction: null
|
|
436
|
+
},
|
|
437
|
+
offLabel: {
|
|
438
|
+
classPropertyName: "offLabel",
|
|
439
|
+
publicName: "offLabel",
|
|
440
|
+
isSignal: true,
|
|
441
|
+
isRequired: false,
|
|
442
|
+
transformFunction: null
|
|
443
|
+
},
|
|
444
|
+
onIcon: {
|
|
445
|
+
classPropertyName: "onIcon",
|
|
446
|
+
publicName: "onIcon",
|
|
447
|
+
isSignal: true,
|
|
448
|
+
isRequired: false,
|
|
449
|
+
transformFunction: null
|
|
450
|
+
},
|
|
451
|
+
offIcon: {
|
|
452
|
+
classPropertyName: "offIcon",
|
|
453
|
+
publicName: "offIcon",
|
|
454
|
+
isSignal: true,
|
|
455
|
+
isRequired: false,
|
|
456
|
+
transformFunction: null
|
|
457
|
+
},
|
|
458
|
+
ariaLabel: {
|
|
459
|
+
classPropertyName: "ariaLabel",
|
|
460
|
+
publicName: "ariaLabel",
|
|
461
|
+
isSignal: true,
|
|
462
|
+
isRequired: false,
|
|
463
|
+
transformFunction: null
|
|
464
|
+
},
|
|
465
|
+
disabled: {
|
|
466
|
+
classPropertyName: "disabled",
|
|
467
|
+
publicName: "disabled",
|
|
468
|
+
isSignal: true,
|
|
469
|
+
isRequired: false,
|
|
470
|
+
transformFunction: null
|
|
471
|
+
},
|
|
472
|
+
readonly: {
|
|
473
|
+
classPropertyName: "readonly",
|
|
474
|
+
publicName: "readonly",
|
|
475
|
+
isSignal: true,
|
|
476
|
+
isRequired: false,
|
|
477
|
+
transformFunction: null
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
outputs: {
|
|
481
|
+
checked: "checkedChange",
|
|
482
|
+
touch: "touch"
|
|
483
|
+
},
|
|
484
|
+
host: { classAttribute: "star-toggle-btn-host" },
|
|
485
|
+
ngImport: i0,
|
|
486
|
+
template: `
|
|
487
|
+
<button
|
|
488
|
+
type="button"
|
|
489
|
+
class="star-segmented__item star-toggle-btn"
|
|
490
|
+
[class.star-segmented__item--on]="checked()"
|
|
491
|
+
[attr.aria-pressed]="checked()"
|
|
492
|
+
[attr.aria-label]="ariaLabel()"
|
|
493
|
+
[disabled]="disabled()"
|
|
494
|
+
(click)="!readonly() && checked.set(!checked())"
|
|
495
|
+
(blur)="touch.emit()"
|
|
496
|
+
>
|
|
497
|
+
@if (checked() ? onIcon() : offIcon(); as icon) {
|
|
498
|
+
<i [class]="icon" aria-hidden="true"></i>
|
|
499
|
+
}
|
|
500
|
+
<span>{{ checked() ? onLabel() : offLabel() }}</span>
|
|
501
|
+
</button>
|
|
502
|
+
`,
|
|
503
|
+
isInline: true,
|
|
504
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
505
|
+
});
|
|
506
|
+
};
|
|
507
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
508
|
+
minVersion: "12.0.0",
|
|
509
|
+
version: "22.2.6",
|
|
510
|
+
ngImport: i0,
|
|
511
|
+
type: StarToggleButton,
|
|
512
|
+
decorators: [{
|
|
513
|
+
type: Component,
|
|
514
|
+
args: [{
|
|
515
|
+
selector: "star-toggle-button",
|
|
516
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
517
|
+
host: { class: "star-toggle-btn-host" },
|
|
518
|
+
template: `
|
|
519
|
+
<button
|
|
520
|
+
type="button"
|
|
521
|
+
class="star-segmented__item star-toggle-btn"
|
|
522
|
+
[class.star-segmented__item--on]="checked()"
|
|
523
|
+
[attr.aria-pressed]="checked()"
|
|
524
|
+
[attr.aria-label]="ariaLabel()"
|
|
525
|
+
[disabled]="disabled()"
|
|
526
|
+
(click)="!readonly() && checked.set(!checked())"
|
|
527
|
+
(blur)="touch.emit()"
|
|
528
|
+
>
|
|
529
|
+
@if (checked() ? onIcon() : offIcon(); as icon) {
|
|
530
|
+
<i [class]="icon" aria-hidden="true"></i>
|
|
531
|
+
}
|
|
532
|
+
<span>{{ checked() ? onLabel() : offLabel() }}</span>
|
|
533
|
+
</button>
|
|
534
|
+
`
|
|
535
|
+
}]
|
|
536
|
+
}],
|
|
537
|
+
propDecorators: {
|
|
538
|
+
checked: [{
|
|
539
|
+
type: i0.Input,
|
|
540
|
+
args: [{
|
|
541
|
+
isSignal: true,
|
|
542
|
+
alias: "checked",
|
|
543
|
+
required: false
|
|
544
|
+
}]
|
|
545
|
+
}, {
|
|
546
|
+
type: i0.Output,
|
|
547
|
+
args: ["checkedChange"]
|
|
548
|
+
}],
|
|
549
|
+
onLabel: [{
|
|
550
|
+
type: i0.Input,
|
|
551
|
+
args: [{
|
|
552
|
+
isSignal: true,
|
|
553
|
+
alias: "onLabel",
|
|
554
|
+
required: false
|
|
555
|
+
}]
|
|
556
|
+
}],
|
|
557
|
+
offLabel: [{
|
|
558
|
+
type: i0.Input,
|
|
559
|
+
args: [{
|
|
560
|
+
isSignal: true,
|
|
561
|
+
alias: "offLabel",
|
|
562
|
+
required: false
|
|
563
|
+
}]
|
|
564
|
+
}],
|
|
565
|
+
onIcon: [{
|
|
566
|
+
type: i0.Input,
|
|
567
|
+
args: [{
|
|
568
|
+
isSignal: true,
|
|
569
|
+
alias: "onIcon",
|
|
570
|
+
required: false
|
|
571
|
+
}]
|
|
572
|
+
}],
|
|
573
|
+
offIcon: [{
|
|
574
|
+
type: i0.Input,
|
|
575
|
+
args: [{
|
|
576
|
+
isSignal: true,
|
|
577
|
+
alias: "offIcon",
|
|
578
|
+
required: false
|
|
579
|
+
}]
|
|
580
|
+
}],
|
|
581
|
+
ariaLabel: [{
|
|
582
|
+
type: i0.Input,
|
|
583
|
+
args: [{
|
|
584
|
+
isSignal: true,
|
|
585
|
+
alias: "ariaLabel",
|
|
586
|
+
required: false
|
|
587
|
+
}]
|
|
588
|
+
}],
|
|
589
|
+
disabled: [{
|
|
590
|
+
type: i0.Input,
|
|
591
|
+
args: [{
|
|
592
|
+
isSignal: true,
|
|
593
|
+
alias: "disabled",
|
|
594
|
+
required: false
|
|
595
|
+
}]
|
|
596
|
+
}],
|
|
597
|
+
readonly: [{
|
|
598
|
+
type: i0.Input,
|
|
599
|
+
args: [{
|
|
600
|
+
isSignal: true,
|
|
601
|
+
alias: "readonly",
|
|
602
|
+
required: false
|
|
603
|
+
}]
|
|
604
|
+
}],
|
|
605
|
+
touch: [{
|
|
606
|
+
type: i0.Output,
|
|
607
|
+
args: ["touch"]
|
|
608
|
+
}]
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
export { StarSelectButton, StarToggleButton };
|
|
612
|
+
|
|
613
|
+
//# sourceMappingURL=star-ng-ui-select-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"star-ng-ui-select-button.mjs","names":[],"sources":["../../../projects/star-ng/select-button/select-button.ts"],"sourcesContent":["import {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport type { FormCheckboxControl, FormValueControl } from '@angular/forms/signals';\nimport { optionText, readOption, starInlineKey, StarOptionKey } from '@star-ng/ui/core';\n\n/**\n * Segmented choice (PrimeNG `p-selectbutton`). Single mode is a radio group (Arrow keys move and\n * select); `multiple` mode is a group of toggle buttons (`aria-pressed`).\n *\n * `<star-select-button [options]=\"views\" optionLabel=\"label\" optionValue=\"id\" [(value)]=\"view\" ariaLabel=\"View\" />`\n */\n@Component({\n selector: 'star-select-button',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'star-segmented',\n '[attr.role]': \"multiple() ? 'group' : 'radiogroup'\",\n '[attr.aria-label]': 'ariaLabel()',\n '[attr.aria-disabled]': 'disabled() || null',\n '[class.star-segmented--invalid]': 'invalid() && touched()',\n '[class.star-segmented--sm]': \"size() === 'sm'\",\n },\n template: `\n @for (option of options(); track $index; let i = $index) {\n <button\n type=\"button\"\n class=\"star-segmented__item\"\n [attr.role]=\"multiple() ? null : 'radio'\"\n [attr.aria-checked]=\"multiple() ? null : isSelected(option)\"\n [attr.aria-pressed]=\"multiple() ? isSelected(option) : null\"\n [attr.tabindex]=\"tabIndexFor(i)\"\n [class.star-segmented__item--on]=\"isSelected(option)\"\n [disabled]=\"disabled() || isDisabled(option)\"\n (click)=\"toggle(option)\"\n (keydown)=\"onKeydown($event, i)\"\n (blur)=\"touch.emit()\"\n >\n @if (iconOf(option); as icon) {\n <i [class]=\"icon\" aria-hidden=\"true\"></i>\n }\n <span>{{ labelOf(option) }}</span>\n </button>\n }\n `,\n})\nexport class StarSelectButton<TOption = unknown, TValue = TOption> implements FormValueControl<\n TValue | readonly TValue[] | null\n> {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n readonly value = model<TValue | readonly TValue[] | null>(null);\n readonly options = input<readonly TOption[]>([]);\n readonly optionLabel = input<StarOptionKey<TOption> | null>(null);\n readonly optionValue = input<StarOptionKey<TOption> | null>(null);\n readonly optionIcon = input<StarOptionKey<TOption> | null>(null);\n readonly optionDisabled = input<StarOptionKey<TOption> | null>(null);\n readonly multiple = input(false, { transform: booleanAttribute });\n /** Single mode: clicking the selected item clears it. */\n readonly allowEmpty = input(true, { transform: booleanAttribute });\n readonly size = input<'sm' | 'md'>('md');\n readonly ariaLabel = input<string | null>(null);\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly invalid = input(false, { transform: booleanAttribute });\n readonly touched = input(false, { transform: booleanAttribute });\n readonly touch = output<void>();\n\n private readonly selectedIndex = computed(() =>\n this.options().findIndex((option) => this.isSelected(option)),\n );\n\n protected labelOf(option: TOption): string {\n return optionText(option, this.optionLabel());\n }\n protected iconOf(option: TOption): string | null {\n const key = this.optionIcon();\n return key ? ((readOption(option, key) as string) ?? null) : null;\n }\n protected isDisabled(option: TOption): boolean {\n const key = this.optionDisabled();\n return key ? !!readOption(option, key) : false;\n }\n private valueOf(option: TOption): TValue {\n return readOption(option, this.optionValue()) as TValue;\n }\n\n protected isSelected(option: TOption): boolean {\n const value = this.value();\n const optionValue = this.valueOf(option);\n return Array.isArray(value)\n ? value.some((v) => Object.is(v, optionValue))\n : Object.is(value, optionValue);\n }\n\n /** Roving tabindex in single mode: the selected (or first) item is the tab stop. */\n protected tabIndexFor(index: number): number {\n if (this.multiple()) return 0;\n const selected = this.selectedIndex();\n return index === (selected >= 0 ? selected : 0) ? 0 : -1;\n }\n\n protected toggle(option: TOption): void {\n if (this.disabled() || this.isDisabled(option)) return;\n const optionValue = this.valueOf(option);\n if (this.multiple()) {\n const current = Array.isArray(this.value()) ? (this.value() as readonly TValue[]) : [];\n this.value.set(\n this.isSelected(option)\n ? current.filter((v) => !Object.is(v, optionValue))\n : [...current, optionValue],\n );\n } else {\n this.value.set(this.isSelected(option) && this.allowEmpty() ? null : optionValue);\n }\n }\n\n protected onKeydown(event: KeyboardEvent, index: number): void {\n if (this.multiple()) return;\n // The horizontal arrows follow the reading order: left is \"next\" in right-to-left.\n const step = { ArrowRight: 1, ArrowDown: 1, ArrowLeft: -1, ArrowUp: -1 }[starInlineKey(event)];\n if (!step) return;\n event.preventDefault();\n const options = this.options();\n for (let i = 1; i <= options.length; i++) {\n const next = (index + step * i + options.length) % options.length;\n if (!this.isDisabled(options[next])) {\n this.value.set(this.valueOf(options[next]));\n this.host.nativeElement.querySelectorAll<HTMLButtonElement>('button')[next]?.focus();\n return;\n }\n }\n }\n}\n\n/**\n * Two-state button (PrimeNG `p-togglebutton`): `aria-pressed`, on / off labels and icons.\n * `<star-toggle-button [(checked)]=\"starred\" onLabel=\"Starred\" offLabel=\"Star\" onIcon=\"ph-fill ph-star\" offIcon=\"ph-bold ph-star\" />`\n */\n@Component({\n selector: 'star-toggle-button',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'star-toggle-btn-host' },\n template: `\n <button\n type=\"button\"\n class=\"star-segmented__item star-toggle-btn\"\n [class.star-segmented__item--on]=\"checked()\"\n [attr.aria-pressed]=\"checked()\"\n [attr.aria-label]=\"ariaLabel()\"\n [disabled]=\"disabled()\"\n (click)=\"!readonly() && checked.set(!checked())\"\n (blur)=\"touch.emit()\"\n >\n @if (checked() ? onIcon() : offIcon(); as icon) {\n <i [class]=\"icon\" aria-hidden=\"true\"></i>\n }\n <span>{{ checked() ? onLabel() : offLabel() }}</span>\n </button>\n `,\n})\nexport class StarToggleButton implements FormCheckboxControl {\n readonly checked = model(false);\n readonly onLabel = input('On');\n readonly offLabel = input('Off');\n readonly onIcon = input<string | null>(null);\n readonly offIcon = input<string | null>(null);\n readonly ariaLabel = input<string | null>(null);\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly readonly = input(false, { transform: booleanAttribute });\n readonly touch = output<void>();\n}\n"],"mappings":";;;AAsDA,IAAa,mBAAb,MAAa,iBAAgB;CAGV,OAAO,OAAgC,UAAU;CAEzD,QAAQ,MAAyC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACtD,UAAU,MAA0B,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACvC,cAAc,MAAqC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACxD,cAAc,MAAqC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACxD,aAAa,MAAqC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,aAAA,CAAA,+BAAA,CAAA,CAAA;CACvD,iBAAiB,MAAqC,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CAC3D,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CAErD,aAAa,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,aAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACtD,OAAO,MAAmB,MAAK,GAAA,YA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