+
+ @for (star of starList(); track $index) {
+
+ }
+ @if (expandable()) {
+
{{ expandableLabel() }}
+ } @else if (showValue() && value() > 0) {
+
{{ valueLabel() }}
+ }
+ @if (pending()) {
+
+ }
+
+ }
+ `,
+ styles: `
+ .rating {
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+ gap: 2px;
+ line-height: 0;
+ }
+ .editable:has(.range:focus-visible) {
+ outline: 2px solid var(--color-primary);
+ outline-offset: 3px;
+ border-radius: 4px;
+ }
+ .star {
+ position: relative;
+ display: inline-flex;
+ width: var(--star-size);
+ height: var(--star-size);
+ line-height: 0;
+ flex-shrink: 0;
+ }
+ button.star {
+ appearance: none;
+ border: 0;
+ margin: 0;
+ padding: 0;
+ background: none;
+ color: inherit;
+ font: inherit;
+ }
+ .editable .star:not(.hidden-star):not(:disabled) {
+ cursor: pointer;
+ }
+ .star svg {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ display: block;
+ }
+ .star-base {
+ fill: var(--color-surface-hover);
+ }
+ .star-fill {
+ clip-path: inset(0 calc(100% - var(--fill, 0%)) 0 0);
+ }
+ .expandable .star {
+ overflow: hidden;
+ transition: width 0.2s ease, margin-left 0.2s ease, opacity 0.2s ease;
+ }
+ .expandable .star svg {
+ width: var(--star-size);
+ }
+ .hidden-star {
+ width: 0;
+ opacity: 0;
+ pointer-events: none;
+ }
+ .range {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ opacity: 0;
+ pointer-events: none;
+ }
+ .rating-label {
+ margin-left: 6px;
+ font-size: 13px;
+ font-variant-numeric: tabular-nums;
+ color: var(--color-text-muted);
+ white-space: nowrap;
+ line-height: 1;
+ }
+ `,
+})
+export class AppRatingComponent implements FormValueControl