@star-ng/ui 0.0.0-stage → 0.2.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 +162 -2
- 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 +786 -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 +484 -0
- package/fesm2022/star-ng-ui-core.mjs.map +1 -0
- package/fesm2022/star-ng-ui-data-display.mjs +1870 -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 +886 -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 +2547 -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 +3531 -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 +285 -3
- 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 +124 -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 +5807 -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 +373 -0
- package/types/star-ng-ui-data-display.d.ts +438 -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 +170 -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 +563 -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 +885 -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 +343 -0
- package/types/star-ng-ui-utility.d.ts +533 -0
- package/types/star-ng-ui.d.ts +51 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { _IdGenerator } from "@angular/cdk/a11y";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, Component, ElementRef, booleanAttribute, computed, inject, input, model, output } from "@angular/core";
|
|
4
|
+
var StarRadioGroup = class StarRadioGroup {
|
|
5
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
6
|
+
disabled = input(false, {
|
|
7
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
8
|
+
transform: booleanAttribute
|
|
9
|
+
});
|
|
10
|
+
readonly = input(false, {
|
|
11
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
12
|
+
transform: booleanAttribute
|
|
13
|
+
});
|
|
14
|
+
required = input(false, {
|
|
15
|
+
...ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {},
|
|
16
|
+
transform: booleanAttribute
|
|
17
|
+
});
|
|
18
|
+
invalid = input(false, {
|
|
19
|
+
...ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {},
|
|
20
|
+
transform: booleanAttribute
|
|
21
|
+
});
|
|
22
|
+
touched = input(false, {
|
|
23
|
+
...ngDevMode ? { debugName: "touched" } : /* istanbul ignore next */ {},
|
|
24
|
+
transform: booleanAttribute
|
|
25
|
+
});
|
|
26
|
+
name = input("", ...ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []);
|
|
27
|
+
orientation = input("vertical", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
|
|
28
|
+
ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
29
|
+
ariaLabelledBy = input(null, ...ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []);
|
|
30
|
+
touch = output();
|
|
31
|
+
fallbackName = inject(_IdGenerator).getId("star-radio-group-");
|
|
32
|
+
groupName = computed(() => this.name() || this.fallbackName, ...ngDevMode ? [{ debugName: "groupName" }] : /* istanbul ignore next */ []);
|
|
33
|
+
showInvalid = computed(() => this.invalid() && this.touched(), ...ngDevMode ? [{ debugName: "showInvalid" }] : /* istanbul ignore next */ []);
|
|
34
|
+
host = inject(ElementRef);
|
|
35
|
+
isSelected(value) {
|
|
36
|
+
return Object.is(this.value(), value);
|
|
37
|
+
}
|
|
38
|
+
select(value) {
|
|
39
|
+
if (this.disabled() || this.readonly()) return;
|
|
40
|
+
this.value.set(value);
|
|
41
|
+
}
|
|
42
|
+
focus(options) {
|
|
43
|
+
const inputs = [...this.host.nativeElement.querySelectorAll("input[type=radio]")];
|
|
44
|
+
(inputs.find((radio) => radio.checked) ?? inputs.find((radio) => !radio.disabled))?.focus(options);
|
|
45
|
+
}
|
|
46
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
47
|
+
minVersion: "12.0.0",
|
|
48
|
+
version: "22.2.6",
|
|
49
|
+
ngImport: i0,
|
|
50
|
+
type: StarRadioGroup,
|
|
51
|
+
deps: [],
|
|
52
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
53
|
+
});
|
|
54
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
55
|
+
minVersion: "17.1.0",
|
|
56
|
+
version: "22.2.6",
|
|
57
|
+
type: StarRadioGroup,
|
|
58
|
+
isStandalone: true,
|
|
59
|
+
selector: "star-radio-group",
|
|
60
|
+
inputs: {
|
|
61
|
+
value: {
|
|
62
|
+
classPropertyName: "value",
|
|
63
|
+
publicName: "value",
|
|
64
|
+
isSignal: true,
|
|
65
|
+
isRequired: false,
|
|
66
|
+
transformFunction: null
|
|
67
|
+
},
|
|
68
|
+
disabled: {
|
|
69
|
+
classPropertyName: "disabled",
|
|
70
|
+
publicName: "disabled",
|
|
71
|
+
isSignal: true,
|
|
72
|
+
isRequired: false,
|
|
73
|
+
transformFunction: null
|
|
74
|
+
},
|
|
75
|
+
readonly: {
|
|
76
|
+
classPropertyName: "readonly",
|
|
77
|
+
publicName: "readonly",
|
|
78
|
+
isSignal: true,
|
|
79
|
+
isRequired: false,
|
|
80
|
+
transformFunction: null
|
|
81
|
+
},
|
|
82
|
+
required: {
|
|
83
|
+
classPropertyName: "required",
|
|
84
|
+
publicName: "required",
|
|
85
|
+
isSignal: true,
|
|
86
|
+
isRequired: false,
|
|
87
|
+
transformFunction: null
|
|
88
|
+
},
|
|
89
|
+
invalid: {
|
|
90
|
+
classPropertyName: "invalid",
|
|
91
|
+
publicName: "invalid",
|
|
92
|
+
isSignal: true,
|
|
93
|
+
isRequired: false,
|
|
94
|
+
transformFunction: null
|
|
95
|
+
},
|
|
96
|
+
touched: {
|
|
97
|
+
classPropertyName: "touched",
|
|
98
|
+
publicName: "touched",
|
|
99
|
+
isSignal: true,
|
|
100
|
+
isRequired: false,
|
|
101
|
+
transformFunction: null
|
|
102
|
+
},
|
|
103
|
+
name: {
|
|
104
|
+
classPropertyName: "name",
|
|
105
|
+
publicName: "name",
|
|
106
|
+
isSignal: true,
|
|
107
|
+
isRequired: false,
|
|
108
|
+
transformFunction: null
|
|
109
|
+
},
|
|
110
|
+
orientation: {
|
|
111
|
+
classPropertyName: "orientation",
|
|
112
|
+
publicName: "orientation",
|
|
113
|
+
isSignal: true,
|
|
114
|
+
isRequired: false,
|
|
115
|
+
transformFunction: null
|
|
116
|
+
},
|
|
117
|
+
ariaLabel: {
|
|
118
|
+
classPropertyName: "ariaLabel",
|
|
119
|
+
publicName: "ariaLabel",
|
|
120
|
+
isSignal: true,
|
|
121
|
+
isRequired: false,
|
|
122
|
+
transformFunction: null
|
|
123
|
+
},
|
|
124
|
+
ariaLabelledBy: {
|
|
125
|
+
classPropertyName: "ariaLabelledBy",
|
|
126
|
+
publicName: "ariaLabelledBy",
|
|
127
|
+
isSignal: true,
|
|
128
|
+
isRequired: false,
|
|
129
|
+
transformFunction: null
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
outputs: {
|
|
133
|
+
value: "valueChange",
|
|
134
|
+
touch: "touch"
|
|
135
|
+
},
|
|
136
|
+
host: {
|
|
137
|
+
attributes: { "role": "radiogroup" },
|
|
138
|
+
properties: {
|
|
139
|
+
"class.star-radio-group--horizontal": "orientation() === 'horizontal'",
|
|
140
|
+
"attr.aria-label": "ariaLabel()",
|
|
141
|
+
"attr.aria-labelledby": "ariaLabelledBy()",
|
|
142
|
+
"attr.aria-required": "required() || null",
|
|
143
|
+
"attr.aria-invalid": "showInvalid() || null",
|
|
144
|
+
"attr.aria-disabled": "disabled() || null"
|
|
145
|
+
},
|
|
146
|
+
classAttribute: "star-radio-group"
|
|
147
|
+
},
|
|
148
|
+
ngImport: i0,
|
|
149
|
+
template: `<ng-content />`,
|
|
150
|
+
isInline: true,
|
|
151
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
152
|
+
});
|
|
153
|
+
};
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
155
|
+
minVersion: "12.0.0",
|
|
156
|
+
version: "22.2.6",
|
|
157
|
+
ngImport: i0,
|
|
158
|
+
type: StarRadioGroup,
|
|
159
|
+
decorators: [{
|
|
160
|
+
type: Component,
|
|
161
|
+
args: [{
|
|
162
|
+
selector: "star-radio-group",
|
|
163
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
164
|
+
host: {
|
|
165
|
+
class: "star-radio-group",
|
|
166
|
+
role: "radiogroup",
|
|
167
|
+
"[class.star-radio-group--horizontal]": "orientation() === 'horizontal'",
|
|
168
|
+
"[attr.aria-label]": "ariaLabel()",
|
|
169
|
+
"[attr.aria-labelledby]": "ariaLabelledBy()",
|
|
170
|
+
"[attr.aria-required]": "required() || null",
|
|
171
|
+
"[attr.aria-invalid]": "showInvalid() || null",
|
|
172
|
+
"[attr.aria-disabled]": "disabled() || null"
|
|
173
|
+
},
|
|
174
|
+
template: `<ng-content />`
|
|
175
|
+
}]
|
|
176
|
+
}],
|
|
177
|
+
propDecorators: {
|
|
178
|
+
value: [{
|
|
179
|
+
type: i0.Input,
|
|
180
|
+
args: [{
|
|
181
|
+
isSignal: true,
|
|
182
|
+
alias: "value",
|
|
183
|
+
required: false
|
|
184
|
+
}]
|
|
185
|
+
}, {
|
|
186
|
+
type: i0.Output,
|
|
187
|
+
args: ["valueChange"]
|
|
188
|
+
}],
|
|
189
|
+
disabled: [{
|
|
190
|
+
type: i0.Input,
|
|
191
|
+
args: [{
|
|
192
|
+
isSignal: true,
|
|
193
|
+
alias: "disabled",
|
|
194
|
+
required: false
|
|
195
|
+
}]
|
|
196
|
+
}],
|
|
197
|
+
readonly: [{
|
|
198
|
+
type: i0.Input,
|
|
199
|
+
args: [{
|
|
200
|
+
isSignal: true,
|
|
201
|
+
alias: "readonly",
|
|
202
|
+
required: false
|
|
203
|
+
}]
|
|
204
|
+
}],
|
|
205
|
+
required: [{
|
|
206
|
+
type: i0.Input,
|
|
207
|
+
args: [{
|
|
208
|
+
isSignal: true,
|
|
209
|
+
alias: "required",
|
|
210
|
+
required: false
|
|
211
|
+
}]
|
|
212
|
+
}],
|
|
213
|
+
invalid: [{
|
|
214
|
+
type: i0.Input,
|
|
215
|
+
args: [{
|
|
216
|
+
isSignal: true,
|
|
217
|
+
alias: "invalid",
|
|
218
|
+
required: false
|
|
219
|
+
}]
|
|
220
|
+
}],
|
|
221
|
+
touched: [{
|
|
222
|
+
type: i0.Input,
|
|
223
|
+
args: [{
|
|
224
|
+
isSignal: true,
|
|
225
|
+
alias: "touched",
|
|
226
|
+
required: false
|
|
227
|
+
}]
|
|
228
|
+
}],
|
|
229
|
+
name: [{
|
|
230
|
+
type: i0.Input,
|
|
231
|
+
args: [{
|
|
232
|
+
isSignal: true,
|
|
233
|
+
alias: "name",
|
|
234
|
+
required: false
|
|
235
|
+
}]
|
|
236
|
+
}],
|
|
237
|
+
orientation: [{
|
|
238
|
+
type: i0.Input,
|
|
239
|
+
args: [{
|
|
240
|
+
isSignal: true,
|
|
241
|
+
alias: "orientation",
|
|
242
|
+
required: false
|
|
243
|
+
}]
|
|
244
|
+
}],
|
|
245
|
+
ariaLabel: [{
|
|
246
|
+
type: i0.Input,
|
|
247
|
+
args: [{
|
|
248
|
+
isSignal: true,
|
|
249
|
+
alias: "ariaLabel",
|
|
250
|
+
required: false
|
|
251
|
+
}]
|
|
252
|
+
}],
|
|
253
|
+
ariaLabelledBy: [{
|
|
254
|
+
type: i0.Input,
|
|
255
|
+
args: [{
|
|
256
|
+
isSignal: true,
|
|
257
|
+
alias: "ariaLabelledBy",
|
|
258
|
+
required: false
|
|
259
|
+
}]
|
|
260
|
+
}],
|
|
261
|
+
touch: [{
|
|
262
|
+
type: i0.Output,
|
|
263
|
+
args: ["touch"]
|
|
264
|
+
}]
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
var StarRadio = class StarRadio {
|
|
268
|
+
group = inject(StarRadioGroup);
|
|
269
|
+
value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
270
|
+
disabled = input(false, {
|
|
271
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
272
|
+
transform: booleanAttribute
|
|
273
|
+
});
|
|
274
|
+
inputId = input(inject(_IdGenerator).getId("star-radio-"), ...ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []);
|
|
275
|
+
checked = computed(() => this.group.isSelected(this.value()), ...ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []);
|
|
276
|
+
isDisabled = computed(() => this.disabled() || this.group.disabled(), ...ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []);
|
|
277
|
+
onChange(radio) {
|
|
278
|
+
if (this.group.readonly()) {
|
|
279
|
+
radio.checked = this.checked();
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (radio.checked) this.group.select(this.value());
|
|
283
|
+
}
|
|
284
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
285
|
+
minVersion: "12.0.0",
|
|
286
|
+
version: "22.2.6",
|
|
287
|
+
ngImport: i0,
|
|
288
|
+
type: StarRadio,
|
|
289
|
+
deps: [],
|
|
290
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
291
|
+
});
|
|
292
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
293
|
+
minVersion: "17.1.0",
|
|
294
|
+
version: "22.2.6",
|
|
295
|
+
type: StarRadio,
|
|
296
|
+
isStandalone: true,
|
|
297
|
+
selector: "star-radio",
|
|
298
|
+
inputs: {
|
|
299
|
+
value: {
|
|
300
|
+
classPropertyName: "value",
|
|
301
|
+
publicName: "value",
|
|
302
|
+
isSignal: true,
|
|
303
|
+
isRequired: true,
|
|
304
|
+
transformFunction: null
|
|
305
|
+
},
|
|
306
|
+
disabled: {
|
|
307
|
+
classPropertyName: "disabled",
|
|
308
|
+
publicName: "disabled",
|
|
309
|
+
isSignal: true,
|
|
310
|
+
isRequired: false,
|
|
311
|
+
transformFunction: null
|
|
312
|
+
},
|
|
313
|
+
inputId: {
|
|
314
|
+
classPropertyName: "inputId",
|
|
315
|
+
publicName: "inputId",
|
|
316
|
+
isSignal: true,
|
|
317
|
+
isRequired: false,
|
|
318
|
+
transformFunction: null
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
host: {
|
|
322
|
+
properties: { "class.star-radio--disabled": "isDisabled()" },
|
|
323
|
+
classAttribute: "star-radio"
|
|
324
|
+
},
|
|
325
|
+
ngImport: i0,
|
|
326
|
+
template: `
|
|
327
|
+
<label class="star-radio__label">
|
|
328
|
+
<input
|
|
329
|
+
#radio
|
|
330
|
+
type="radio"
|
|
331
|
+
class="star-radio__input"
|
|
332
|
+
[id]="inputId()"
|
|
333
|
+
[name]="group.groupName()"
|
|
334
|
+
[checked]="checked()"
|
|
335
|
+
[disabled]="isDisabled()"
|
|
336
|
+
[required]="group.required()"
|
|
337
|
+
(change)="onChange(radio)"
|
|
338
|
+
(blur)="group.touch.emit()"
|
|
339
|
+
/>
|
|
340
|
+
<span class="star-radio__dot" aria-hidden="true"></span>
|
|
341
|
+
<span class="star-radio__text"><ng-content /></span>
|
|
342
|
+
</label>
|
|
343
|
+
`,
|
|
344
|
+
isInline: true,
|
|
345
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
349
|
+
minVersion: "12.0.0",
|
|
350
|
+
version: "22.2.6",
|
|
351
|
+
ngImport: i0,
|
|
352
|
+
type: StarRadio,
|
|
353
|
+
decorators: [{
|
|
354
|
+
type: Component,
|
|
355
|
+
args: [{
|
|
356
|
+
selector: "star-radio",
|
|
357
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
358
|
+
host: {
|
|
359
|
+
class: "star-radio",
|
|
360
|
+
"[class.star-radio--disabled]": "isDisabled()"
|
|
361
|
+
},
|
|
362
|
+
template: `
|
|
363
|
+
<label class="star-radio__label">
|
|
364
|
+
<input
|
|
365
|
+
#radio
|
|
366
|
+
type="radio"
|
|
367
|
+
class="star-radio__input"
|
|
368
|
+
[id]="inputId()"
|
|
369
|
+
[name]="group.groupName()"
|
|
370
|
+
[checked]="checked()"
|
|
371
|
+
[disabled]="isDisabled()"
|
|
372
|
+
[required]="group.required()"
|
|
373
|
+
(change)="onChange(radio)"
|
|
374
|
+
(blur)="group.touch.emit()"
|
|
375
|
+
/>
|
|
376
|
+
<span class="star-radio__dot" aria-hidden="true"></span>
|
|
377
|
+
<span class="star-radio__text"><ng-content /></span>
|
|
378
|
+
</label>
|
|
379
|
+
`
|
|
380
|
+
}]
|
|
381
|
+
}],
|
|
382
|
+
propDecorators: {
|
|
383
|
+
value: [{
|
|
384
|
+
type: i0.Input,
|
|
385
|
+
args: [{
|
|
386
|
+
isSignal: true,
|
|
387
|
+
alias: "value",
|
|
388
|
+
required: true
|
|
389
|
+
}]
|
|
390
|
+
}],
|
|
391
|
+
disabled: [{
|
|
392
|
+
type: i0.Input,
|
|
393
|
+
args: [{
|
|
394
|
+
isSignal: true,
|
|
395
|
+
alias: "disabled",
|
|
396
|
+
required: false
|
|
397
|
+
}]
|
|
398
|
+
}],
|
|
399
|
+
inputId: [{
|
|
400
|
+
type: i0.Input,
|
|
401
|
+
args: [{
|
|
402
|
+
isSignal: true,
|
|
403
|
+
alias: "inputId",
|
|
404
|
+
required: false
|
|
405
|
+
}]
|
|
406
|
+
}]
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
export { StarRadio, StarRadioGroup };
|
|
410
|
+
|
|
411
|
+
//# sourceMappingURL=star-ng-ui-radio.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"star-ng-ui-radio.mjs","names":[],"sources":["../../../projects/star-ng/radio/radio.ts"],"sourcesContent":["import { _IdGenerator } from '@angular/cdk/a11y';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n ElementRef,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\n/**\n * Radio group (PrimeNG `p-radiobutton` used as a group). The group owns the value; each\n * `star-radio` is a native radio input, so arrow keys move and select natively.\n *\n * ```html\n * <star-radio-group [formField]=\"form.priority\" ariaLabel=\"Priority\">\n * <star-radio value=\"low\">Low</star-radio>\n * <star-radio value=\"high\">High</star-radio>\n * </star-radio-group>\n * ```\n */\n@Component({\n selector: 'star-radio-group',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'star-radio-group',\n role: 'radiogroup',\n '[class.star-radio-group--horizontal]': \"orientation() === 'horizontal'\",\n '[attr.aria-label]': 'ariaLabel()',\n '[attr.aria-labelledby]': 'ariaLabelledBy()',\n '[attr.aria-required]': 'required() || null',\n '[attr.aria-invalid]': 'showInvalid() || null',\n '[attr.aria-disabled]': 'disabled() || null',\n },\n template: `<ng-content />`,\n})\nexport class StarRadioGroup<T = unknown> implements FormValueControl<T | null> {\n readonly value = model<T | null>(null);\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly readonly = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n readonly invalid = input(false, { transform: booleanAttribute });\n readonly touched = input(false, { transform: booleanAttribute });\n readonly name = input('');\n readonly orientation = input<'vertical' | 'horizontal'>('vertical');\n readonly ariaLabel = input<string | null>(null);\n readonly ariaLabelledBy = input<string | null>(null);\n\n readonly touch = output<void>();\n\n private readonly fallbackName = inject(_IdGenerator).getId('star-radio-group-');\n readonly groupName = computed(() => this.name() || this.fallbackName);\n protected readonly showInvalid = computed(() => this.invalid() && this.touched());\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n isSelected(value: T): boolean {\n return Object.is(this.value(), value);\n }\n\n select(value: T): void {\n if (this.disabled() || this.readonly()) return;\n this.value.set(value);\n }\n\n focus(options?: FocusOptions): void {\n const inputs = [\n ...this.host.nativeElement.querySelectorAll<HTMLInputElement>('input[type=radio]'),\n ];\n (inputs.find((radio) => radio.checked) ?? inputs.find((radio) => !radio.disabled))?.focus(\n options,\n );\n }\n}\n\n@Component({\n selector: 'star-radio',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'star-radio',\n '[class.star-radio--disabled]': 'isDisabled()',\n },\n template: `\n <label class=\"star-radio__label\">\n <input\n #radio\n type=\"radio\"\n class=\"star-radio__input\"\n [id]=\"inputId()\"\n [name]=\"group.groupName()\"\n [checked]=\"checked()\"\n [disabled]=\"isDisabled()\"\n [required]=\"group.required()\"\n (change)=\"onChange(radio)\"\n (blur)=\"group.touch.emit()\"\n />\n <span class=\"star-radio__dot\" aria-hidden=\"true\"></span>\n <span class=\"star-radio__text\"><ng-content /></span>\n </label>\n `,\n})\nexport class StarRadio<T = unknown> {\n protected readonly group = inject<StarRadioGroup<T>>(StarRadioGroup);\n\n readonly value = input.required<T>();\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly inputId = input(inject(_IdGenerator).getId('star-radio-'));\n\n protected readonly checked = computed(() => this.group.isSelected(this.value()));\n protected readonly isDisabled = computed(() => this.disabled() || this.group.disabled());\n\n protected onChange(radio: HTMLInputElement): void {\n if (this.group.readonly()) {\n radio.checked = this.checked();\n return;\n }\n if (radio.checked) this.group.select(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AAS,YAAA,CAAA;EA1BrB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,iBAAiB,wBAAwB;GACzC,MAAM;IACJ,OAAO;IACP,gCAAgC;GACjC;GACD,UAAU;;;;;;;;;;;;;;;;;;EAkBX,CAAA"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { _IdGenerator } from "@angular/cdk/a11y";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, Component, booleanAttribute, computed, inject, input, model, output, signal } from "@angular/core";
|
|
4
|
+
import { STAR_UI_TEXT } from "@star-ng/ui/core";
|
|
5
|
+
var StarRating = class StarRating {
|
|
6
|
+
text = inject(STAR_UI_TEXT);
|
|
7
|
+
groupName = inject(_IdGenerator).getId("star-rating-");
|
|
8
|
+
value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
9
|
+
count = input(5, ...ngDevMode ? [{ debugName: "count" }] : /* istanbul ignore next */ []);
|
|
10
|
+
ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
11
|
+
disabled = input(false, {
|
|
12
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
13
|
+
transform: booleanAttribute
|
|
14
|
+
});
|
|
15
|
+
readonly = input(false, {
|
|
16
|
+
...ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {},
|
|
17
|
+
transform: booleanAttribute
|
|
18
|
+
});
|
|
19
|
+
touch = output();
|
|
20
|
+
hover = signal(null, ...ngDevMode ? [{ debugName: "hover" }] : /* istanbul ignore next */ []);
|
|
21
|
+
stars = computed(() => Array.from({ length: this.count() }, (_, i) => i + 1), ...ngDevMode ? [{ debugName: "stars" }] : /* istanbul ignore next */ []);
|
|
22
|
+
shown = computed(() => this.hover() ?? this.value() ?? 0, ...ngDevMode ? [{ debugName: "shown" }] : /* istanbul ignore next */ []);
|
|
23
|
+
choose(star) {
|
|
24
|
+
if (this.disabled() || this.readonly()) return;
|
|
25
|
+
this.value.set(star);
|
|
26
|
+
}
|
|
27
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
28
|
+
minVersion: "12.0.0",
|
|
29
|
+
version: "22.2.6",
|
|
30
|
+
ngImport: i0,
|
|
31
|
+
type: StarRating,
|
|
32
|
+
deps: [],
|
|
33
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
34
|
+
});
|
|
35
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
36
|
+
minVersion: "17.0.0",
|
|
37
|
+
version: "22.2.6",
|
|
38
|
+
type: StarRating,
|
|
39
|
+
isStandalone: true,
|
|
40
|
+
selector: "star-rating",
|
|
41
|
+
inputs: {
|
|
42
|
+
value: {
|
|
43
|
+
classPropertyName: "value",
|
|
44
|
+
publicName: "value",
|
|
45
|
+
isSignal: true,
|
|
46
|
+
isRequired: false,
|
|
47
|
+
transformFunction: null
|
|
48
|
+
},
|
|
49
|
+
count: {
|
|
50
|
+
classPropertyName: "count",
|
|
51
|
+
publicName: "count",
|
|
52
|
+
isSignal: true,
|
|
53
|
+
isRequired: false,
|
|
54
|
+
transformFunction: null
|
|
55
|
+
},
|
|
56
|
+
ariaLabel: {
|
|
57
|
+
classPropertyName: "ariaLabel",
|
|
58
|
+
publicName: "ariaLabel",
|
|
59
|
+
isSignal: true,
|
|
60
|
+
isRequired: false,
|
|
61
|
+
transformFunction: null
|
|
62
|
+
},
|
|
63
|
+
disabled: {
|
|
64
|
+
classPropertyName: "disabled",
|
|
65
|
+
publicName: "disabled",
|
|
66
|
+
isSignal: true,
|
|
67
|
+
isRequired: false,
|
|
68
|
+
transformFunction: null
|
|
69
|
+
},
|
|
70
|
+
readonly: {
|
|
71
|
+
classPropertyName: "readonly",
|
|
72
|
+
publicName: "readonly",
|
|
73
|
+
isSignal: true,
|
|
74
|
+
isRequired: false,
|
|
75
|
+
transformFunction: null
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
outputs: {
|
|
79
|
+
value: "valueChange",
|
|
80
|
+
touch: "touch"
|
|
81
|
+
},
|
|
82
|
+
host: {
|
|
83
|
+
attributes: { "role": "radiogroup" },
|
|
84
|
+
listeners: { "mouseleave": "hover.set(null)" },
|
|
85
|
+
properties: {
|
|
86
|
+
"attr.aria-label": "ariaLabel() ?? text.ratingLabel",
|
|
87
|
+
"class.star-rating--readonly": "readonly() || disabled()"
|
|
88
|
+
},
|
|
89
|
+
classAttribute: "star-rating"
|
|
90
|
+
},
|
|
91
|
+
ngImport: i0,
|
|
92
|
+
template: `
|
|
93
|
+
@for (star of stars(); track star) {
|
|
94
|
+
<label
|
|
95
|
+
class="star-rating__star"
|
|
96
|
+
[class.star-rating__star--on]="star <= shown()"
|
|
97
|
+
(mouseenter)="!readonly() && hover.set(star)"
|
|
98
|
+
>
|
|
99
|
+
<input
|
|
100
|
+
type="radio"
|
|
101
|
+
class="star-sr-only"
|
|
102
|
+
[name]="groupName"
|
|
103
|
+
[value]="star"
|
|
104
|
+
[checked]="value() === star"
|
|
105
|
+
[disabled]="disabled() || readonly()"
|
|
106
|
+
[attr.aria-label]="text.ofTotal(star, stars().length)"
|
|
107
|
+
(click)="choose(star)"
|
|
108
|
+
(blur)="touch.emit()"
|
|
109
|
+
/>
|
|
110
|
+
<i class="ph-fill ph-star" aria-hidden="true"></i>
|
|
111
|
+
</label>
|
|
112
|
+
}
|
|
113
|
+
`,
|
|
114
|
+
isInline: true,
|
|
115
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
119
|
+
minVersion: "12.0.0",
|
|
120
|
+
version: "22.2.6",
|
|
121
|
+
ngImport: i0,
|
|
122
|
+
type: StarRating,
|
|
123
|
+
decorators: [{
|
|
124
|
+
type: Component,
|
|
125
|
+
args: [{
|
|
126
|
+
selector: "star-rating",
|
|
127
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
128
|
+
host: {
|
|
129
|
+
class: "star-rating",
|
|
130
|
+
role: "radiogroup",
|
|
131
|
+
"[attr.aria-label]": "ariaLabel() ?? text.ratingLabel",
|
|
132
|
+
"[class.star-rating--readonly]": "readonly() || disabled()",
|
|
133
|
+
"(mouseleave)": "hover.set(null)"
|
|
134
|
+
},
|
|
135
|
+
template: `
|
|
136
|
+
@for (star of stars(); track star) {
|
|
137
|
+
<label
|
|
138
|
+
class="star-rating__star"
|
|
139
|
+
[class.star-rating__star--on]="star <= shown()"
|
|
140
|
+
(mouseenter)="!readonly() && hover.set(star)"
|
|
141
|
+
>
|
|
142
|
+
<input
|
|
143
|
+
type="radio"
|
|
144
|
+
class="star-sr-only"
|
|
145
|
+
[name]="groupName"
|
|
146
|
+
[value]="star"
|
|
147
|
+
[checked]="value() === star"
|
|
148
|
+
[disabled]="disabled() || readonly()"
|
|
149
|
+
[attr.aria-label]="text.ofTotal(star, stars().length)"
|
|
150
|
+
(click)="choose(star)"
|
|
151
|
+
(blur)="touch.emit()"
|
|
152
|
+
/>
|
|
153
|
+
<i class="ph-fill ph-star" aria-hidden="true"></i>
|
|
154
|
+
</label>
|
|
155
|
+
}
|
|
156
|
+
`
|
|
157
|
+
}]
|
|
158
|
+
}],
|
|
159
|
+
propDecorators: {
|
|
160
|
+
value: [{
|
|
161
|
+
type: i0.Input,
|
|
162
|
+
args: [{
|
|
163
|
+
isSignal: true,
|
|
164
|
+
alias: "value",
|
|
165
|
+
required: false
|
|
166
|
+
}]
|
|
167
|
+
}, {
|
|
168
|
+
type: i0.Output,
|
|
169
|
+
args: ["valueChange"]
|
|
170
|
+
}],
|
|
171
|
+
count: [{
|
|
172
|
+
type: i0.Input,
|
|
173
|
+
args: [{
|
|
174
|
+
isSignal: true,
|
|
175
|
+
alias: "count",
|
|
176
|
+
required: false
|
|
177
|
+
}]
|
|
178
|
+
}],
|
|
179
|
+
ariaLabel: [{
|
|
180
|
+
type: i0.Input,
|
|
181
|
+
args: [{
|
|
182
|
+
isSignal: true,
|
|
183
|
+
alias: "ariaLabel",
|
|
184
|
+
required: false
|
|
185
|
+
}]
|
|
186
|
+
}],
|
|
187
|
+
disabled: [{
|
|
188
|
+
type: i0.Input,
|
|
189
|
+
args: [{
|
|
190
|
+
isSignal: true,
|
|
191
|
+
alias: "disabled",
|
|
192
|
+
required: false
|
|
193
|
+
}]
|
|
194
|
+
}],
|
|
195
|
+
readonly: [{
|
|
196
|
+
type: i0.Input,
|
|
197
|
+
args: [{
|
|
198
|
+
isSignal: true,
|
|
199
|
+
alias: "readonly",
|
|
200
|
+
required: false
|
|
201
|
+
}]
|
|
202
|
+
}],
|
|
203
|
+
touch: [{
|
|
204
|
+
type: i0.Output,
|
|
205
|
+
args: ["touch"]
|
|
206
|
+
}]
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
export { StarRating };
|
|
210
|
+
|
|
211
|
+
//# sourceMappingURL=star-ng-ui-rating.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"star-ng-ui-rating.mjs","names":[],"sources":["../../../projects/star-ng/rating/rating.ts"],"sourcesContent":["import { _IdGenerator } from '@angular/cdk/a11y';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n model,\n output,\n signal,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\nimport { STAR_UI_TEXT } from '@star-ng/ui/core';\n\n/**\n * Star rating (PrimeNG `p-rating`) as a native radio group: Arrow keys change the rating,\n * screen readers announce \"3 of 5 stars\". Hover previews the rating.\n * `<star-rating [(value)]=\"quality\" ariaLabel=\"Response quality\" />`\n */\n@Component({\n selector: 'star-rating',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'star-rating',\n role: 'radiogroup',\n '[attr.aria-label]': 'ariaLabel() ?? text.ratingLabel',\n '[class.star-rating--readonly]': 'readonly() || disabled()',\n '(mouseleave)': 'hover.set(null)',\n },\n template: `\n @for (star of stars(); track star) {\n <label\n class=\"star-rating__star\"\n [class.star-rating__star--on]=\"star <= shown()\"\n (mouseenter)=\"!readonly() && hover.set(star)\"\n >\n <input\n type=\"radio\"\n class=\"star-sr-only\"\n [name]=\"groupName\"\n [value]=\"star\"\n [checked]=\"value() === star\"\n [disabled]=\"disabled() || readonly()\"\n [attr.aria-label]=\"text.ofTotal(star, stars().length)\"\n (click)=\"choose(star)\"\n (blur)=\"touch.emit()\"\n />\n <i class=\"ph-fill ph-star\" aria-hidden=\"true\"></i>\n </label>\n }\n `,\n})\nexport class StarRating implements FormValueControl<number | null> {\n protected readonly text = inject(STAR_UI_TEXT);\n protected readonly groupName = inject(_IdGenerator).getId('star-rating-');\n readonly value = model<number | null>(null);\n readonly count = input(5);\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 protected readonly hover = signal<number | null>(null);\n protected readonly stars = computed(() => Array.from({ length: this.count() }, (_, i) => i + 1));\n protected readonly shown = computed(() => this.hover() ?? this.value() ?? 0);\n\n protected choose(star: number): void {\n if (this.disabled() || this.readonly()) return;\n this.value.set(star);\n }\n}\n"],"mappings":";;;;AAqDA,IAAa,aAAb,MAAa,WAAU;CACF,OAAO,OAAO,YAAY;CAC1B,YAAY,OAAO,YAAY,CAAC,CAAC,MAAM,cAAc;CAC/D,QAAQ,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAClC,QAAQ,MAAM,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChB,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CACtC,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAA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