@xui/rate 2.0.0-alpha.20 → 2.0.0-alpha.21
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/fesm2022/xui-rate.mjs +11 -0
- package/fesm2022/xui-rate.mjs.map +1 -1
- package/package.json +3 -3
- package/types/xui-rate.d.ts +11 -0
package/fesm2022/xui-rate.mjs
CHANGED
|
@@ -18,17 +18,28 @@ import { XuiIcon } from '@xui/icon';
|
|
|
18
18
|
*/
|
|
19
19
|
class XuiRate {
|
|
20
20
|
direction = injectXDirection();
|
|
21
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
21
22
|
class = input('', /* @ts-ignore */
|
|
22
23
|
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
23
24
|
/** Names the control. Defaults to "Rating" so the slider is never anonymous. */
|
|
24
25
|
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
26
|
+
/**
|
|
27
|
+
* The rating, from `0` to `count`. Halves are only reachable with `allowHalf`. Two-way bindable with `[(value)]`.
|
|
28
|
+
*/
|
|
25
29
|
value = model(0, /* @ts-ignore */
|
|
26
30
|
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
31
|
+
/** How many stars there are, and so the maximum value. */
|
|
27
32
|
count = input(5, { ...(ngDevMode ? { debugName: "count" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
33
|
+
/** Let a star be half-filled, halving the step for both clicks and arrow keys. */
|
|
28
34
|
allowHalf = input(false, { ...(ngDevMode ? { debugName: "allowHalf" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
29
35
|
/** Clicking the current value again resets it to 0. */
|
|
30
36
|
allowClear = input(true, { ...(ngDevMode ? { debugName: "allowClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
37
|
+
/**
|
|
38
|
+
* Show the rating without letting it be changed. Unlike `disabled`, it stays at full contrast — for displaying
|
|
39
|
+
* someone else's rating.
|
|
40
|
+
*/
|
|
31
41
|
readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
42
|
+
/** Block interaction and dim the stars. */
|
|
32
43
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
33
44
|
/** Star size in pixels. */
|
|
34
45
|
starSize = input(20, { ...(ngDevMode ? { debugName: "starSize" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xui-rate.mjs","sources":["../../../../../../libs/ui/rate/xui/src/lib/rate.ts","../../../../../../libs/ui/rate/xui/src/index.ts","../../../../../../libs/ui/rate/xui/src/xui-rate.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n numberAttribute,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport type { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matStarRound } from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { arrowValueDirection, injectXDirection } from '@xui/core/a11y';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiIcon } from '@xui/icon';\nimport type { ClassValue } from 'clsx';\n\n/**\n * A star-rating input. Two-way bindable `value`; supports `allowHalf`,\n * `allowClear` (click the current value to reset), `readonly`/`disabled`, hover\n * preview and arrow-key adjustment.\n *\n * ```html\n * <xui-rate [(value)]=\"score\" allowHalf />\n * ```\n */\n@Component({\n selector: 'xui-rate',\n // eslint-disable-next-line local/no-hand-z-index -- half-star hit areas layer above the star glyph inside the control\n template: `\n @for (star of stars(); track star) {\n <span class=\"relative inline-block\" [style.width.px]=\"starPx()\" [style.height.px]=\"starPx()\">\n <!-- empty base -->\n <ng-icon xui [size]=\"starPx() + 'px'\" color=\"subtle\" name=\"matStarRound\" class=\"absolute inset-0\" />\n <!-- filled overlay, clipped to the fill fraction -->\n <span class=\"absolute inset-0 overflow-hidden\" [style.width.%]=\"fillPercent(star)\">\n <ng-icon\n xui\n [size]=\"starPx() + 'px'\"\n color=\"warning\"\n name=\"matStarRound\"\n class=\"absolute inset-y-0 start-0\"\n />\n </span>\n @if (!readonly() && !isDisabled()) {\n @if (allowHalf()) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <span\n class=\"absolute inset-y-0 start-0 z-10 w-1/2 cursor-pointer\"\n (click)=\"pick(star - 0.5)\"\n (mouseenter)=\"hover.set(star - 0.5)\"\n ></span>\n }\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <span\n class=\"absolute inset-y-0 end-0 z-10 cursor-pointer\"\n [class]=\"allowHalf() ? 'w-1/2' : 'w-full'\"\n (click)=\"pick(star)\"\n (mouseenter)=\"hover.set(star)\"\n ></span>\n }\n </span>\n }\n `,\n host: {\n '[class]': 'computedClass()',\n role: 'slider',\n '[attr.aria-label]': 'effectiveAriaLabel()',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuemax]': 'count()',\n '[attr.aria-valuenow]': 'value()',\n '[attr.aria-valuetext]': 'valueText()',\n '[attr.aria-readonly]': 'readonly() || null',\n '[attr.aria-disabled]': 'isDisabled() || null',\n '[attr.tabindex]': 'readonly() || isDisabled() ? null : 0',\n '(keydown)': 'onKeydown($event)',\n '(mouseleave)': 'hover.set(null)',\n '(blur)': 'cva.markTouched()'\n },\n imports: [NgIcon, XuiIcon],\n providers: [provideXValueAccessor(() => XuiRate)],\n viewProviders: [provideIcons({ matStarRound })],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiRate implements ControlValueAccessor {\n protected readonly direction = injectXDirection();\n\n readonly class = input<ClassValue>('');\n\n /** Names the control. Defaults to \"Rating\" so the slider is never anonymous. */\n readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n\n readonly value = model<number>(0);\n readonly count = input<number, NumberInput>(5, { transform: numberAttribute });\n readonly allowHalf = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Clicking the current value again resets it to 0. */\n readonly allowClear = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Star size in pixels. */\n readonly starSize = input<number, NumberInput>(20, { transform: numberAttribute });\n\n protected readonly cva = createXValueAccessor<number>({\n onWrite: value => this.value.set(value ?? 0),\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly hover = signal<number | null>(null);\n\n protected readonly effectiveAriaLabel = computed(() => this.ariaLabel() ?? 'Rating');\n\n /** A bare number tells a screen-reader user nothing about the scale. */\n protected readonly valueText = computed(() => `${this.value()} of ${this.count()}`);\n\n protected readonly stars = computed(() => Array.from({ length: this.count() }, (_, i) => i + 1));\n protected readonly starPx = computed(() => this.starSize());\n private readonly display = computed(() => this.hover() ?? this.value());\n\n protected fillPercent(star: number): number {\n const display = this.display();\n if (display >= star) {\n return 100;\n }\n if (display >= star - 0.5) {\n return 50;\n }\n return 0;\n }\n\n protected pick(next: number): void {\n if (this.readonly() || this.isDisabled()) {\n return;\n }\n this.commit(this.allowClear() && next === this.value() ? 0 : next);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.readonly() || this.isDisabled()) {\n return;\n }\n const step = this.allowHalf() ? 0.5 : 1;\n const arrow = arrowValueDirection(event.key, this.direction());\n if (!arrow) {\n return;\n }\n\n const next = arrow === 'increase' ? Math.min(this.count(), this.value() + step) : Math.max(0, this.value() - step);\n\n event.preventDefault();\n this.commit(next);\n }\n\n /** Store and notify — the single write path for every user interaction. */\n private commit(next: number): void {\n this.value.set(next);\n this.cva.notifyChange(next);\n }\n\n protected readonly computedClass = computed(() =>\n xui(\n 'inline-flex items-center gap-1 rounded',\n (this.readonly() || this.isDisabled()) && 'cursor-default',\n this.isDisabled() && 'opacity-50',\n this.class()\n )\n );\n\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiRate } from './lib/rate';\n\nexport * from './lib/rate';\n\nexport const XuiRateImports = [XuiRate] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAqBA;;;;;;;;AAQG;MA4DU,OAAO,CAAA;IACC,SAAS,GAAG,gBAAgB,EAAE;IAExC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,SAAS,GAAG,KAAK,CAAgB,IAAI,iFAAI,KAAK,EAAE,YAAY,EAAA,CAAG;IAE/D,KAAK,GAAG,KAAK,CAAS,CAAC;8EAAC;IACxB,KAAK,GAAG,KAAK,CAAsB,CAAC,6EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;IACrE,SAAS,GAAG,KAAK,CAAwB,KAAK,iFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAEhF,UAAU,GAAG,KAAK,CAAwB,IAAI,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAChF,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAC/E,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,QAAQ,GAAG,KAAK,CAAsB,EAAE,gFAAI,SAAS,EAAE,eAAe,EAAA,CAAG;IAE/D,GAAG,GAAG,oBAAoB,CAAS;AACpD,QAAA,OAAO,EAAE,KAAK,IAAI,IAA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AAC,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;oBAC/C,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC;AAClC,iBAAA;;;ACpFM,MAAM,cAAc,GAAG,CAAC,OAAO;;ACJtC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"xui-rate.mjs","sources":["../../../../../../libs/ui/rate/xui/src/lib/rate.ts","../../../../../../libs/ui/rate/xui/src/index.ts","../../../../../../libs/ui/rate/xui/src/xui-rate.ts"],"sourcesContent":["import { BooleanInput, NumberInput } from '@angular/cdk/coercion';\nimport {\n booleanAttribute,\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n model,\n numberAttribute,\n signal,\n ViewEncapsulation\n} from '@angular/core';\nimport type { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { matStarRound } from '@ng-icons/material-icons/round';\nimport { xui } from '@xui/core';\nimport { arrowValueDirection, injectXDirection } from '@xui/core/a11y';\nimport { createXValueAccessor, provideXValueAccessor } from '@xui/core/forms';\nimport { XuiIcon } from '@xui/icon';\nimport type { ClassValue } from 'clsx';\n\n/**\n * A star-rating input. Two-way bindable `value`; supports `allowHalf`,\n * `allowClear` (click the current value to reset), `readonly`/`disabled`, hover\n * preview and arrow-key adjustment.\n *\n * ```html\n * <xui-rate [(value)]=\"score\" allowHalf />\n * ```\n */\n@Component({\n selector: 'xui-rate',\n // eslint-disable-next-line local/no-hand-z-index -- half-star hit areas layer above the star glyph inside the control\n template: `\n @for (star of stars(); track star) {\n <span class=\"relative inline-block\" [style.width.px]=\"starPx()\" [style.height.px]=\"starPx()\">\n <!-- empty base -->\n <ng-icon xui [size]=\"starPx() + 'px'\" color=\"subtle\" name=\"matStarRound\" class=\"absolute inset-0\" />\n <!-- filled overlay, clipped to the fill fraction -->\n <span class=\"absolute inset-0 overflow-hidden\" [style.width.%]=\"fillPercent(star)\">\n <ng-icon\n xui\n [size]=\"starPx() + 'px'\"\n color=\"warning\"\n name=\"matStarRound\"\n class=\"absolute inset-y-0 start-0\"\n />\n </span>\n @if (!readonly() && !isDisabled()) {\n @if (allowHalf()) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <span\n class=\"absolute inset-y-0 start-0 z-10 w-1/2 cursor-pointer\"\n (click)=\"pick(star - 0.5)\"\n (mouseenter)=\"hover.set(star - 0.5)\"\n ></span>\n }\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <span\n class=\"absolute inset-y-0 end-0 z-10 cursor-pointer\"\n [class]=\"allowHalf() ? 'w-1/2' : 'w-full'\"\n (click)=\"pick(star)\"\n (mouseenter)=\"hover.set(star)\"\n ></span>\n }\n </span>\n }\n `,\n host: {\n '[class]': 'computedClass()',\n role: 'slider',\n '[attr.aria-label]': 'effectiveAriaLabel()',\n '[attr.aria-valuemin]': '0',\n '[attr.aria-valuemax]': 'count()',\n '[attr.aria-valuenow]': 'value()',\n '[attr.aria-valuetext]': 'valueText()',\n '[attr.aria-readonly]': 'readonly() || null',\n '[attr.aria-disabled]': 'isDisabled() || null',\n '[attr.tabindex]': 'readonly() || isDisabled() ? null : 0',\n '(keydown)': 'onKeydown($event)',\n '(mouseleave)': 'hover.set(null)',\n '(blur)': 'cva.markTouched()'\n },\n imports: [NgIcon, XuiIcon],\n providers: [provideXValueAccessor(() => XuiRate)],\n viewProviders: [provideIcons({ matStarRound })],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None\n})\nexport class XuiRate implements ControlValueAccessor {\n protected readonly direction = injectXDirection();\n\n /** Extra classes, merged into the component's own rather than replacing them. */\n readonly class = input<ClassValue>('');\n\n /** Names the control. Defaults to \"Rating\" so the slider is never anonymous. */\n readonly ariaLabel = input<string | null>(null, { alias: 'aria-label' });\n\n /**\n * The rating, from `0` to `count`. Halves are only reachable with `allowHalf`. Two-way bindable with `[(value)]`.\n */\n readonly value = model<number>(0);\n /** How many stars there are, and so the maximum value. */\n readonly count = input<number, NumberInput>(5, { transform: numberAttribute });\n /** Let a star be half-filled, halving the step for both clicks and arrow keys. */\n readonly allowHalf = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Clicking the current value again resets it to 0. */\n readonly allowClear = input<boolean, BooleanInput>(true, { transform: booleanAttribute });\n /**\n * Show the rating without letting it be changed. Unlike `disabled`, it stays at full contrast — for displaying\n * someone else's rating.\n */\n readonly readonly = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Block interaction and dim the stars. */\n readonly disabled = input<boolean, BooleanInput>(false, { transform: booleanAttribute });\n /** Star size in pixels. */\n readonly starSize = input<number, NumberInput>(20, { transform: numberAttribute });\n\n protected readonly cva = createXValueAccessor<number>({\n onWrite: value => this.value.set(value ?? 0),\n disabled: this.disabled\n });\n protected readonly isDisabled = this.cva.disabled;\n\n protected readonly hover = signal<number | null>(null);\n\n protected readonly effectiveAriaLabel = computed(() => this.ariaLabel() ?? 'Rating');\n\n /** A bare number tells a screen-reader user nothing about the scale. */\n protected readonly valueText = computed(() => `${this.value()} of ${this.count()}`);\n\n protected readonly stars = computed(() => Array.from({ length: this.count() }, (_, i) => i + 1));\n protected readonly starPx = computed(() => this.starSize());\n private readonly display = computed(() => this.hover() ?? this.value());\n\n protected fillPercent(star: number): number {\n const display = this.display();\n if (display >= star) {\n return 100;\n }\n if (display >= star - 0.5) {\n return 50;\n }\n return 0;\n }\n\n protected pick(next: number): void {\n if (this.readonly() || this.isDisabled()) {\n return;\n }\n this.commit(this.allowClear() && next === this.value() ? 0 : next);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (this.readonly() || this.isDisabled()) {\n return;\n }\n const step = this.allowHalf() ? 0.5 : 1;\n const arrow = arrowValueDirection(event.key, this.direction());\n if (!arrow) {\n return;\n }\n\n const next = arrow === 'increase' ? Math.min(this.count(), this.value() + step) : Math.max(0, this.value() - step);\n\n event.preventDefault();\n this.commit(next);\n }\n\n /** Store and notify — the single write path for every user interaction. */\n private commit(next: number): void {\n this.value.set(next);\n this.cva.notifyChange(next);\n }\n\n protected readonly computedClass = computed(() =>\n xui(\n 'inline-flex items-center gap-1 rounded',\n (this.readonly() || this.isDisabled()) && 'cursor-default',\n this.isDisabled() && 'opacity-50',\n this.class()\n )\n );\n\n readonly writeValue = this.cva.writeValue;\n readonly registerOnChange = this.cva.registerOnChange;\n readonly registerOnTouched = this.cva.registerOnTouched;\n readonly setDisabledState = this.cva.setDisabledState;\n}\n","import { XuiRate } from './lib/rate';\n\nexport * from './lib/rate';\n\nexport const XuiRateImports = [XuiRate] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAqBA;;;;;;;;AAQG;MA4DU,OAAO,CAAA;IACC,SAAS,GAAG,gBAAgB,EAAE;;IAGxC,KAAK,GAAG,KAAK,CAAa,EAAE;8EAAC;;IAG7B,SAAS,GAAG,KAAK,CAAgB,IAAI,iFAAI,KAAK,EAAE,YAAY,EAAA,CAAG;AAExE;;AAEG;IACM,KAAK,GAAG,KAAK,CAAS,CAAC;8EAAC;;IAExB,KAAK,GAAG,KAAK,CAAsB,CAAC,6EAAI,SAAS,EAAE,eAAe,EAAA,CAAG;;IAErE,SAAS,GAAG,KAAK,CAAwB,KAAK,iFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAEhF,UAAU,GAAG,KAAK,CAAwB,IAAI,kFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;AACzF;;;AAGG;IACM,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,QAAQ,GAAG,KAAK,CAAwB,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAE/E,QAAQ,GAAG,KAAK,CAAsB,EAAE,gFAAI,SAAS,EAAE,eAAe,EAAA,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,SAAS,EAAE,CAAC,qBAAqB,EAAC,MAAK,OAAQ,EAAC,CAAC;oBACjD,aAAa,EAAE,CAAC,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;oBAC/C,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC;AAClC,iBAAA;;;ACpFM,MAAM,cAAc,GAAG,CAAC,OAAO;;ACJtC;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xui/rate",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.21",
|
|
4
4
|
"description": "Modern Angular 22 UI Library based on TailwindCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@angular/forms": "22",
|
|
42
42
|
"@ng-icons/core": "34",
|
|
43
43
|
"@ng-icons/material-icons": "34",
|
|
44
|
-
"@xui/core": "2.0.0-alpha.
|
|
45
|
-
"@xui/icon": "2.0.0-alpha.
|
|
44
|
+
"@xui/core": "2.0.0-alpha.21",
|
|
45
|
+
"@xui/icon": "2.0.0-alpha.21",
|
|
46
46
|
"clsx": "^2.1.1"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
package/types/xui-rate.d.ts
CHANGED
|
@@ -16,15 +16,26 @@ import { ClassValue } from 'clsx';
|
|
|
16
16
|
*/
|
|
17
17
|
declare class XuiRate implements ControlValueAccessor {
|
|
18
18
|
protected readonly direction: _angular_core.Signal<_xui_core_a11y.XDirection>;
|
|
19
|
+
/** Extra classes, merged into the component's own rather than replacing them. */
|
|
19
20
|
readonly class: _angular_core.InputSignal<ClassValue>;
|
|
20
21
|
/** Names the control. Defaults to "Rating" so the slider is never anonymous. */
|
|
21
22
|
readonly ariaLabel: _angular_core.InputSignal<string | null>;
|
|
23
|
+
/**
|
|
24
|
+
* The rating, from `0` to `count`. Halves are only reachable with `allowHalf`. Two-way bindable with `[(value)]`.
|
|
25
|
+
*/
|
|
22
26
|
readonly value: _angular_core.ModelSignal<number>;
|
|
27
|
+
/** How many stars there are, and so the maximum value. */
|
|
23
28
|
readonly count: _angular_core.InputSignalWithTransform<number, NumberInput>;
|
|
29
|
+
/** Let a star be half-filled, halving the step for both clicks and arrow keys. */
|
|
24
30
|
readonly allowHalf: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
25
31
|
/** Clicking the current value again resets it to 0. */
|
|
26
32
|
readonly allowClear: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
33
|
+
/**
|
|
34
|
+
* Show the rating without letting it be changed. Unlike `disabled`, it stays at full contrast — for displaying
|
|
35
|
+
* someone else's rating.
|
|
36
|
+
*/
|
|
27
37
|
readonly readonly: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
38
|
+
/** Block interaction and dim the stars. */
|
|
28
39
|
readonly disabled: _angular_core.InputSignalWithTransform<boolean, BooleanInput>;
|
|
29
40
|
/** Star size in pixels. */
|
|
30
41
|
readonly starSize: _angular_core.InputSignalWithTransform<number, NumberInput>;
|