@aeris-ui/core 22.0.0-alpha.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 +189 -0
- package/fesm2022/aeris-ui-core-accordion.mjs +412 -0
- package/fesm2022/aeris-ui-core-accordion.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-animate-on-scroll.mjs +107 -0
- package/fesm2022/aeris-ui-core-animate-on-scroll.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-auto-complete.mjs +754 -0
- package/fesm2022/aeris-ui-core-auto-complete.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-auto-focus.mjs +63 -0
- package/fesm2022/aeris-ui-core-auto-focus.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-avatar.mjs +133 -0
- package/fesm2022/aeris-ui-core-avatar.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-badge.mjs +163 -0
- package/fesm2022/aeris-ui-core-badge.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-block-ui.mjs +139 -0
- package/fesm2022/aeris-ui-core-block-ui.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-breadcrumb.mjs +433 -0
- package/fesm2022/aeris-ui-core-breadcrumb.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-button-group.mjs +39 -0
- package/fesm2022/aeris-ui-core-button-group.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-button.mjs +246 -0
- package/fesm2022/aeris-ui-core-button.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-card.mjs +134 -0
- package/fesm2022/aeris-ui-core-card.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-carousel.mjs +542 -0
- package/fesm2022/aeris-ui-core-carousel.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-cascade-select.mjs +673 -0
- package/fesm2022/aeris-ui-core-cascade-select.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-chart.mjs +296 -0
- package/fesm2022/aeris-ui-core-chart.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-checkbox.mjs +220 -0
- package/fesm2022/aeris-ui-core-checkbox.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-chip.mjs +200 -0
- package/fesm2022/aeris-ui-core-chip.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-class-names.mjs +67 -0
- package/fesm2022/aeris-ui-core-class-names.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-color-picker.mjs +1192 -0
- package/fesm2022/aeris-ui-core-color-picker.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-compare.mjs +508 -0
- package/fesm2022/aeris-ui-core-compare.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-confirm-dialog.mjs +818 -0
- package/fesm2022/aeris-ui-core-confirm-dialog.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-confirm-popup.mjs +1010 -0
- package/fesm2022/aeris-ui-core-confirm-popup.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-context-menu.mjs +720 -0
- package/fesm2022/aeris-ui-core-context-menu.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-date-picker.mjs +1471 -0
- package/fesm2022/aeris-ui-core-date-picker.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-dialog.mjs +574 -0
- package/fesm2022/aeris-ui-core-dialog.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-divider.mjs +51 -0
- package/fesm2022/aeris-ui-core-divider.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-drawer.mjs +549 -0
- package/fesm2022/aeris-ui-core-drawer.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-dynamic-dialog.mjs +333 -0
- package/fesm2022/aeris-ui-core-dynamic-dialog.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-editor.mjs +1548 -0
- package/fesm2022/aeris-ui-core-editor.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-file-upload.mjs +965 -0
- package/fesm2022/aeris-ui-core-file-upload.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-filter-service.mjs +304 -0
- package/fesm2022/aeris-ui-core-filter-service.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-fluid.mjs +23 -0
- package/fesm2022/aeris-ui-core-fluid.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-focus-trap.mjs +185 -0
- package/fesm2022/aeris-ui-core-focus-trap.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-galleria.mjs +1657 -0
- package/fesm2022/aeris-ui-core-galleria.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-glass.mjs +35 -0
- package/fesm2022/aeris-ui-core-glass.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-icon-field.mjs +113 -0
- package/fesm2022/aeris-ui-core-icon-field.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-inplace.mjs +243 -0
- package/fesm2022/aeris-ui-core-inplace.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-group.mjs +110 -0
- package/fesm2022/aeris-ui-core-input-group.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-mask.mjs +343 -0
- package/fesm2022/aeris-ui-core-input-mask.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-number.mjs +497 -0
- package/fesm2022/aeris-ui-core-input-number.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-otp.mjs +361 -0
- package/fesm2022/aeris-ui-core-input-otp.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-input-text.mjs +226 -0
- package/fesm2022/aeris-ui-core-input-text.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-key-filter.mjs +208 -0
- package/fesm2022/aeris-ui-core-key-filter.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-mega-menu.mjs +835 -0
- package/fesm2022/aeris-ui-core-mega-menu.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-menu.mjs +796 -0
- package/fesm2022/aeris-ui-core-menu.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-menubar.mjs +729 -0
- package/fesm2022/aeris-ui-core-menubar.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-message.mjs +225 -0
- package/fesm2022/aeris-ui-core-message.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-meter-group.mjs +377 -0
- package/fesm2022/aeris-ui-core-meter-group.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-multi-select.mjs +1033 -0
- package/fesm2022/aeris-ui-core-multi-select.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-order-list.mjs +351 -0
- package/fesm2022/aeris-ui-core-order-list.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-organization-chart.mjs +382 -0
- package/fesm2022/aeris-ui-core-organization-chart.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-paginator.mjs +254 -0
- package/fesm2022/aeris-ui-core-paginator.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-panel.mjs +352 -0
- package/fesm2022/aeris-ui-core-panel.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-password.mjs +479 -0
- package/fesm2022/aeris-ui-core-password.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-pick-list.mjs +939 -0
- package/fesm2022/aeris-ui-core-pick-list.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-popover.mjs +535 -0
- package/fesm2022/aeris-ui-core-popover.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-progress-bar.mjs +260 -0
- package/fesm2022/aeris-ui-core-progress-bar.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-progress-spinner.mjs +218 -0
- package/fesm2022/aeris-ui-core-progress-spinner.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-radio-button.mjs +194 -0
- package/fesm2022/aeris-ui-core-radio-button.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-rating.mjs +385 -0
- package/fesm2022/aeris-ui-core-rating.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-scroll-panel.mjs +211 -0
- package/fesm2022/aeris-ui-core-scroll-panel.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-scroll-top.mjs +94 -0
- package/fesm2022/aeris-ui-core-scroll-top.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-select.mjs +1134 -0
- package/fesm2022/aeris-ui-core-select.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-skeleton.mjs +47 -0
- package/fesm2022/aeris-ui-core-skeleton.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-slider.mjs +724 -0
- package/fesm2022/aeris-ui-core-slider.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-speed-dial.mjs +589 -0
- package/fesm2022/aeris-ui-core-speed-dial.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-split-button.mjs +532 -0
- package/fesm2022/aeris-ui-core-split-button.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-splitter.mjs +488 -0
- package/fesm2022/aeris-ui-core-splitter.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-stepper.mjs +437 -0
- package/fesm2022/aeris-ui-core-stepper.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-style-class.mjs +344 -0
- package/fesm2022/aeris-ui-core-style-class.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-table.mjs +1580 -0
- package/fesm2022/aeris-ui-core-table.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tabs.mjs +438 -0
- package/fesm2022/aeris-ui-core-tabs.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-textarea.mjs +349 -0
- package/fesm2022/aeris-ui-core-textarea.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-theme-builder.mjs +1565 -0
- package/fesm2022/aeris-ui-core-theme-builder.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-theming.mjs +150 -0
- package/fesm2022/aeris-ui-core-theming.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tiered-menu.mjs +718 -0
- package/fesm2022/aeris-ui-core-tiered-menu.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-timeline.mjs +278 -0
- package/fesm2022/aeris-ui-core-timeline.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-toast.mjs +422 -0
- package/fesm2022/aeris-ui-core-toast.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-toggle-switch.mjs +202 -0
- package/fesm2022/aeris-ui-core-toggle-switch.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-toolbar.mjs +136 -0
- package/fesm2022/aeris-ui-core-toolbar.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tooltip.mjs +365 -0
- package/fesm2022/aeris-ui-core-tooltip.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tree-select.mjs +995 -0
- package/fesm2022/aeris-ui-core-tree-select.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tree-table.mjs +1600 -0
- package/fesm2022/aeris-ui-core-tree-table.mjs.map +1 -0
- package/fesm2022/aeris-ui-core-tree.mjs +962 -0
- package/fesm2022/aeris-ui-core-tree.mjs.map +1 -0
- package/fesm2022/aeris-ui-core.mjs +360 -0
- package/fesm2022/aeris-ui-core.mjs.map +1 -0
- package/package.json +432 -0
- package/schematics/aeris-setup.schema.json +52 -0
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/schema.json +64 -0
- package/schematics/runtime/package.json +3 -0
- package/schematics/runtime/schematics/ng-add/index.js +13 -0
- package/schematics/runtime/schematics/ng-add/index.js.map +1 -0
- package/schematics/runtime/schematics/ng-add/options.js +338 -0
- package/schematics/runtime/schematics/ng-add/options.js.map +1 -0
- package/schematics/runtime/schematics/ng-add/schema.js +3 -0
- package/schematics/runtime/schematics/ng-add/schema.js.map +1 -0
- package/schematics/runtime/schematics/ng-add/workspace.js +273 -0
- package/schematics/runtime/schematics/ng-add/workspace.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-color-derivation.js +12 -0
- package/schematics/runtime/theme-builder/aeris-color-derivation.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-color.js +263 -0
- package/schematics/runtime/theme-builder/aeris-color.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-contrast.js +245 -0
- package/schematics/runtime/theme-builder/aeris-contrast.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-foundation.js +47 -0
- package/schematics/runtime/theme-builder/aeris-foundation.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-semantic-tones.js +121 -0
- package/schematics/runtime/theme-builder/aeris-semantic-tones.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme-generator.js +238 -0
- package/schematics/runtime/theme-builder/aeris-theme-generator.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme-resolver.js +101 -0
- package/schematics/runtime/theme-builder/aeris-theme-resolver.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme-tokens.js +82 -0
- package/schematics/runtime/theme-builder/aeris-theme-tokens.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme-validation.js +183 -0
- package/schematics/runtime/theme-builder/aeris-theme-validation.js.map +1 -0
- package/schematics/runtime/theme-builder/aeris-theme.js +322 -0
- package/schematics/runtime/theme-builder/aeris-theme.js.map +1 -0
- package/schematics/runtime/theme-builder/public-api.js +17 -0
- package/schematics/runtime/theme-builder/public-api.js.map +1 -0
- package/styles/_index.scss +1 -0
- package/styles/_tokens.scss +13 -0
- package/styles/aeris.css +555 -0
- package/styles/controls.css +169 -0
- package/tools/aeris-theme.mjs +149 -0
- package/tools/aeris-theme.schema.json +143 -0
- package/types/aeris-ui-core-accordion.d.ts +101 -0
- package/types/aeris-ui-core-animate-on-scroll.d.ts +34 -0
- package/types/aeris-ui-core-auto-complete.d.ts +154 -0
- package/types/aeris-ui-core-auto-focus.d.ts +17 -0
- package/types/aeris-ui-core-avatar.d.ts +44 -0
- package/types/aeris-ui-core-badge.d.ts +48 -0
- package/types/aeris-ui-core-block-ui.d.ts +28 -0
- package/types/aeris-ui-core-breadcrumb.d.ts +104 -0
- package/types/aeris-ui-core-button-group.d.ts +17 -0
- package/types/aeris-ui-core-button.d.ts +71 -0
- package/types/aeris-ui-core-card.d.ts +43 -0
- package/types/aeris-ui-core-carousel.d.ts +126 -0
- package/types/aeris-ui-core-cascade-select.d.ts +130 -0
- package/types/aeris-ui-core-chart.d.ts +92 -0
- package/types/aeris-ui-core-checkbox.d.ts +55 -0
- package/types/aeris-ui-core-chip.d.ts +56 -0
- package/types/aeris-ui-core-class-names.d.ts +21 -0
- package/types/aeris-ui-core-color-picker.d.ts +149 -0
- package/types/aeris-ui-core-compare.d.ts +109 -0
- package/types/aeris-ui-core-confirm-dialog.d.ts +263 -0
- package/types/aeris-ui-core-confirm-popup.d.ts +281 -0
- package/types/aeris-ui-core-context-menu.d.ts +156 -0
- package/types/aeris-ui-core-date-picker.d.ts +226 -0
- package/types/aeris-ui-core-dialog.d.ts +124 -0
- package/types/aeris-ui-core-divider.d.ts +21 -0
- package/types/aeris-ui-core-drawer.d.ts +119 -0
- package/types/aeris-ui-core-dynamic-dialog.d.ts +148 -0
- package/types/aeris-ui-core-editor.d.ts +130 -0
- package/types/aeris-ui-core-file-upload.d.ts +199 -0
- package/types/aeris-ui-core-filter-service.d.ts +54 -0
- package/types/aeris-ui-core-fluid.d.ts +10 -0
- package/types/aeris-ui-core-focus-trap.d.ts +32 -0
- package/types/aeris-ui-core-galleria.d.ts +273 -0
- package/types/aeris-ui-core-glass.d.ts +17 -0
- package/types/aeris-ui-core-icon-field.d.ts +36 -0
- package/types/aeris-ui-core-inplace.d.ts +68 -0
- package/types/aeris-ui-core-input-group.d.ts +38 -0
- package/types/aeris-ui-core-input-mask.d.ts +73 -0
- package/types/aeris-ui-core-input-number.d.ts +87 -0
- package/types/aeris-ui-core-input-otp.d.ts +88 -0
- package/types/aeris-ui-core-input-text.d.ts +63 -0
- package/types/aeris-ui-core-key-filter.d.ts +41 -0
- package/types/aeris-ui-core-mega-menu.d.ts +130 -0
- package/types/aeris-ui-core-menu.d.ts +182 -0
- package/types/aeris-ui-core-menubar.d.ts +145 -0
- package/types/aeris-ui-core-message.d.ts +65 -0
- package/types/aeris-ui-core-meter-group.d.ts +100 -0
- package/types/aeris-ui-core-multi-select.d.ts +193 -0
- package/types/aeris-ui-core-order-list.d.ts +73 -0
- package/types/aeris-ui-core-organization-chart.d.ts +85 -0
- package/types/aeris-ui-core-paginator.d.ts +39 -0
- package/types/aeris-ui-core-panel.d.ts +85 -0
- package/types/aeris-ui-core-password.d.ts +110 -0
- package/types/aeris-ui-core-pick-list.d.ts +193 -0
- package/types/aeris-ui-core-popover.d.ts +112 -0
- package/types/aeris-ui-core-progress-bar.d.ts +81 -0
- package/types/aeris-ui-core-progress-spinner.d.ts +51 -0
- package/types/aeris-ui-core-radio-button.d.ts +51 -0
- package/types/aeris-ui-core-rating.d.ts +80 -0
- package/types/aeris-ui-core-scroll-panel.d.ts +66 -0
- package/types/aeris-ui-core-scroll-top.d.ts +29 -0
- package/types/aeris-ui-core-select.d.ts +223 -0
- package/types/aeris-ui-core-skeleton.d.ts +18 -0
- package/types/aeris-ui-core-slider.d.ts +117 -0
- package/types/aeris-ui-core-speed-dial.d.ts +119 -0
- package/types/aeris-ui-core-split-button.d.ts +122 -0
- package/types/aeris-ui-core-splitter.d.ts +113 -0
- package/types/aeris-ui-core-stepper.d.ts +99 -0
- package/types/aeris-ui-core-style-class.d.ts +73 -0
- package/types/aeris-ui-core-table.d.ts +333 -0
- package/types/aeris-ui-core-tabs.d.ts +82 -0
- package/types/aeris-ui-core-textarea.d.ts +80 -0
- package/types/aeris-ui-core-theme-builder.d.ts +499 -0
- package/types/aeris-ui-core-theming.d.ts +47 -0
- package/types/aeris-ui-core-tiered-menu.d.ts +152 -0
- package/types/aeris-ui-core-timeline.d.ts +80 -0
- package/types/aeris-ui-core-toast.d.ts +127 -0
- package/types/aeris-ui-core-toggle-switch.d.ts +52 -0
- package/types/aeris-ui-core-toolbar.d.ts +47 -0
- package/types/aeris-ui-core-tooltip.d.ts +92 -0
- package/types/aeris-ui-core-tree-select.d.ts +187 -0
- package/types/aeris-ui-core-tree-table.d.ts +311 -0
- package/types/aeris-ui-core-tree.d.ts +179 -0
- package/types/aeris-ui-core.d.ts +85 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { model, input, booleanAttribute, output, signal, computed, viewChild, forwardRef, Component } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
let nextRadioButtonId = 0;
|
|
6
|
+
class AerisRadioButton {
|
|
7
|
+
selected = model(null, /* @ts-ignore */
|
|
8
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
9
|
+
value = input.required(/* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
11
|
+
name = input('', /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
13
|
+
inputId = input('', /* @ts-ignore */
|
|
14
|
+
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
15
|
+
label = input('', /* @ts-ignore */
|
|
16
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
17
|
+
size = input('md', /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
19
|
+
labelPosition = input('end', /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "labelPosition" }] : /* istanbul ignore next */ []));
|
|
21
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
22
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
23
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
24
|
+
ariaLabel = input('', /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
26
|
+
ariaLabelledby = input('', /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
28
|
+
ariaDescribedby = input('', /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
30
|
+
selectedInput = output();
|
|
31
|
+
changed = output();
|
|
32
|
+
focused = output();
|
|
33
|
+
blurred = output();
|
|
34
|
+
touch = output();
|
|
35
|
+
generatedId = `aeris-radio-${++nextRadioButtonId}`;
|
|
36
|
+
formDisabled = signal(false, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
|
|
38
|
+
resolvedInputId = computed(() => this.inputId() || this.generatedId, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "resolvedInputId" }] : /* istanbul ignore next */ []));
|
|
40
|
+
effectiveDisabled = computed(() => this.disabled() || this.formDisabled(), /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
42
|
+
isSelected = computed(() => this.selected() === this.value(), /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "isSelected" }] : /* istanbul ignore next */ []));
|
|
44
|
+
radioInput = viewChild('radioInput', /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "radioInput" }] : /* istanbul ignore next */ []));
|
|
46
|
+
onChange = () => undefined;
|
|
47
|
+
onTouched = () => undefined;
|
|
48
|
+
writeValue(value) {
|
|
49
|
+
this.selected.set(value == null ? null : String(value));
|
|
50
|
+
}
|
|
51
|
+
registerOnChange(fn) {
|
|
52
|
+
this.onChange = fn;
|
|
53
|
+
}
|
|
54
|
+
registerOnTouched(fn) {
|
|
55
|
+
this.onTouched = fn;
|
|
56
|
+
}
|
|
57
|
+
setDisabledState(isDisabled) {
|
|
58
|
+
this.formDisabled.set(isDisabled);
|
|
59
|
+
}
|
|
60
|
+
focus(options) {
|
|
61
|
+
this.radioInput()?.nativeElement.focus(options);
|
|
62
|
+
}
|
|
63
|
+
select() {
|
|
64
|
+
if (this.effectiveDisabled() || this.isSelected()) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.updateSelection();
|
|
68
|
+
this.focus();
|
|
69
|
+
}
|
|
70
|
+
handleChange(event) {
|
|
71
|
+
if (this.effectiveDisabled()) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
this.updateSelection();
|
|
75
|
+
this.changed.emit({ originalEvent: event, value: this.value() });
|
|
76
|
+
}
|
|
77
|
+
handleBlur(event) {
|
|
78
|
+
this.onTouched();
|
|
79
|
+
this.touch.emit();
|
|
80
|
+
this.blurred.emit(event);
|
|
81
|
+
}
|
|
82
|
+
updateSelection() {
|
|
83
|
+
const value = this.value();
|
|
84
|
+
this.selected.set(value);
|
|
85
|
+
this.selectedInput.emit(value);
|
|
86
|
+
this.onChange(value);
|
|
87
|
+
}
|
|
88
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisRadioButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
89
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AerisRadioButton, isStandalone: true, selector: "aeris-radio-button", inputs: { selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, labelPosition: { classPropertyName: "labelPosition", publicName: "labelPosition", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange", selectedInput: "selectedInput", changed: "changed", focused: "focused", blurred: "blurred", touch: "touch" }, host: { properties: { "attr.data-selected": "isSelected()", "attr.data-disabled": "effectiveDisabled()" } }, providers: [
|
|
90
|
+
{
|
|
91
|
+
provide: NG_VALUE_ACCESSOR,
|
|
92
|
+
useExisting: forwardRef(() => AerisRadioButton),
|
|
93
|
+
multi: true,
|
|
94
|
+
},
|
|
95
|
+
], viewQueries: [{ propertyName: "radioInput", first: true, predicate: ["radioInput"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
96
|
+
<label
|
|
97
|
+
class="aeris-radio"
|
|
98
|
+
[class.aeris-radio--label-start]="labelPosition() === 'start'"
|
|
99
|
+
[attr.data-size]="size()"
|
|
100
|
+
[attr.data-selected]="isSelected()"
|
|
101
|
+
[attr.data-disabled]="effectiveDisabled()"
|
|
102
|
+
[attr.data-invalid]="invalid()"
|
|
103
|
+
>
|
|
104
|
+
<input
|
|
105
|
+
#radioInput
|
|
106
|
+
class="aeris-radio__input"
|
|
107
|
+
type="radio"
|
|
108
|
+
[id]="resolvedInputId()"
|
|
109
|
+
[name]="name()"
|
|
110
|
+
[value]="value()"
|
|
111
|
+
[checked]="isSelected()"
|
|
112
|
+
[disabled]="effectiveDisabled()"
|
|
113
|
+
[required]="required()"
|
|
114
|
+
[attr.aria-label]="ariaLabel() || null"
|
|
115
|
+
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
116
|
+
[attr.aria-describedby]="ariaDescribedby() || null"
|
|
117
|
+
[attr.aria-invalid]="invalid() || null"
|
|
118
|
+
[attr.aria-required]="required() || null"
|
|
119
|
+
(change)="handleChange($event)"
|
|
120
|
+
(focus)="focused.emit($event)"
|
|
121
|
+
(blur)="handleBlur($event)"
|
|
122
|
+
/>
|
|
123
|
+
<span class="aeris-radio__control" aria-hidden="true">
|
|
124
|
+
<span class="aeris-radio__dot"></span>
|
|
125
|
+
</span>
|
|
126
|
+
<span class="aeris-radio__label">
|
|
127
|
+
@if (label()) {
|
|
128
|
+
{{ label() }}
|
|
129
|
+
} @else {
|
|
130
|
+
<ng-content />
|
|
131
|
+
}
|
|
132
|
+
</span>
|
|
133
|
+
</label>
|
|
134
|
+
`, isInline: true, styles: [":host{display:inline-block;max-width:100%;color:var(--aeris-radio-label-color, var(--aeris-text-2, #4e524a));font:inherit}.aeris-radio{--aeris-radio-size: 1.125rem;--aeris-radio-dot-size: .5rem;--aeris-radio-gap: .625rem;display:inline-flex;align-items:center;gap:var(--aeris-radio-gap);max-width:100%;min-height:2rem;color:inherit;font:inherit;font-size:.875rem;line-height:1.45;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.aeris-radio[data-size=xs]{--aeris-radio-size: .875rem;--aeris-radio-dot-size: .375rem;--aeris-radio-gap: .4375rem;min-height:1.5rem;font-size:.75rem}.aeris-radio[data-size=sm]{--aeris-radio-size: 1rem;--aeris-radio-dot-size: .4375rem;--aeris-radio-gap: .5rem;min-height:1.75rem;font-size:.8125rem}.aeris-radio[data-size=lg]{--aeris-radio-size: 1.25rem;--aeris-radio-dot-size: .5625rem;--aeris-radio-gap: .6875rem;min-height:2.25rem;font-size:.9375rem}.aeris-radio--label-start{flex-direction:row-reverse}.aeris-radio__input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0}.aeris-radio__control{display:inline-grid;flex:0 0 auto;place-items:center;width:var(--aeris-radio-size);height:var(--aeris-radio-size);box-sizing:border-box;border:1.5px solid var(--aeris-radio-border, var(--aeris-border-strong, #aeb2a8));border-radius:50%;background:var(--aeris-radio-background, var(--aeris-surface, #fff));box-shadow:var(--aeris-radio-shadow, none);transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease,transform .15s ease}.aeris-radio__dot{width:var(--aeris-radio-dot-size);height:var(--aeris-radio-dot-size);border-radius:50%;background:transparent;opacity:0;transform:scale(.35);transition:opacity .14s ease,transform .16s cubic-bezier(.2,.8,.2,1)}.aeris-radio__label{min-width:0}.aeris-radio:hover .aeris-radio__control{border-color:var(--aeris-radio-hover-border, var(--aeris-primary, #768653))}.aeris-radio__input:checked+.aeris-radio__control{border:calc((var(--aeris-radio-size) - var(--aeris-radio-dot-size)) / 2) solid var(--aeris-radio-selected-color, var(--aeris-primary, #768653));background:transparent}.aeris-radio__input:checked+.aeris-radio__control .aeris-radio__dot{opacity:1;transform:scale(1)}.aeris-radio__input:focus-visible+.aeris-radio__control{outline:3px solid var(--aeris-radio-focus-ring, color-mix(in srgb, var(--aeris-focus, var(--aeris-primary, #536437)) 42%, transparent));outline-offset:2px}.aeris-radio[data-invalid=true] .aeris-radio__control{border-color:var(--aeris-danger, #c81e2a)}.aeris-radio[data-disabled=true]{opacity:var(--aeris-disabled-opacity, .5);cursor:not-allowed}.aeris-radio[data-disabled=true]:hover .aeris-radio__control{border-color:var(--aeris-radio-border, var(--aeris-border-strong, #aeb2a8))}@media(prefers-reduced-motion:reduce){.aeris-radio__control,.aeris-radio__dot{transition:none}}\n"] });
|
|
135
|
+
}
|
|
136
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisRadioButton, decorators: [{
|
|
137
|
+
type: Component,
|
|
138
|
+
args: [{ selector: 'aeris-radio-button', template: `
|
|
139
|
+
<label
|
|
140
|
+
class="aeris-radio"
|
|
141
|
+
[class.aeris-radio--label-start]="labelPosition() === 'start'"
|
|
142
|
+
[attr.data-size]="size()"
|
|
143
|
+
[attr.data-selected]="isSelected()"
|
|
144
|
+
[attr.data-disabled]="effectiveDisabled()"
|
|
145
|
+
[attr.data-invalid]="invalid()"
|
|
146
|
+
>
|
|
147
|
+
<input
|
|
148
|
+
#radioInput
|
|
149
|
+
class="aeris-radio__input"
|
|
150
|
+
type="radio"
|
|
151
|
+
[id]="resolvedInputId()"
|
|
152
|
+
[name]="name()"
|
|
153
|
+
[value]="value()"
|
|
154
|
+
[checked]="isSelected()"
|
|
155
|
+
[disabled]="effectiveDisabled()"
|
|
156
|
+
[required]="required()"
|
|
157
|
+
[attr.aria-label]="ariaLabel() || null"
|
|
158
|
+
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
159
|
+
[attr.aria-describedby]="ariaDescribedby() || null"
|
|
160
|
+
[attr.aria-invalid]="invalid() || null"
|
|
161
|
+
[attr.aria-required]="required() || null"
|
|
162
|
+
(change)="handleChange($event)"
|
|
163
|
+
(focus)="focused.emit($event)"
|
|
164
|
+
(blur)="handleBlur($event)"
|
|
165
|
+
/>
|
|
166
|
+
<span class="aeris-radio__control" aria-hidden="true">
|
|
167
|
+
<span class="aeris-radio__dot"></span>
|
|
168
|
+
</span>
|
|
169
|
+
<span class="aeris-radio__label">
|
|
170
|
+
@if (label()) {
|
|
171
|
+
{{ label() }}
|
|
172
|
+
} @else {
|
|
173
|
+
<ng-content />
|
|
174
|
+
}
|
|
175
|
+
</span>
|
|
176
|
+
</label>
|
|
177
|
+
`, providers: [
|
|
178
|
+
{
|
|
179
|
+
provide: NG_VALUE_ACCESSOR,
|
|
180
|
+
useExisting: forwardRef(() => AerisRadioButton),
|
|
181
|
+
multi: true,
|
|
182
|
+
},
|
|
183
|
+
], host: {
|
|
184
|
+
'[attr.data-selected]': 'isSelected()',
|
|
185
|
+
'[attr.data-disabled]': 'effectiveDisabled()',
|
|
186
|
+
}, styles: [":host{display:inline-block;max-width:100%;color:var(--aeris-radio-label-color, var(--aeris-text-2, #4e524a));font:inherit}.aeris-radio{--aeris-radio-size: 1.125rem;--aeris-radio-dot-size: .5rem;--aeris-radio-gap: .625rem;display:inline-flex;align-items:center;gap:var(--aeris-radio-gap);max-width:100%;min-height:2rem;color:inherit;font:inherit;font-size:.875rem;line-height:1.45;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.aeris-radio[data-size=xs]{--aeris-radio-size: .875rem;--aeris-radio-dot-size: .375rem;--aeris-radio-gap: .4375rem;min-height:1.5rem;font-size:.75rem}.aeris-radio[data-size=sm]{--aeris-radio-size: 1rem;--aeris-radio-dot-size: .4375rem;--aeris-radio-gap: .5rem;min-height:1.75rem;font-size:.8125rem}.aeris-radio[data-size=lg]{--aeris-radio-size: 1.25rem;--aeris-radio-dot-size: .5625rem;--aeris-radio-gap: .6875rem;min-height:2.25rem;font-size:.9375rem}.aeris-radio--label-start{flex-direction:row-reverse}.aeris-radio__input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0}.aeris-radio__control{display:inline-grid;flex:0 0 auto;place-items:center;width:var(--aeris-radio-size);height:var(--aeris-radio-size);box-sizing:border-box;border:1.5px solid var(--aeris-radio-border, var(--aeris-border-strong, #aeb2a8));border-radius:50%;background:var(--aeris-radio-background, var(--aeris-surface, #fff));box-shadow:var(--aeris-radio-shadow, none);transition:border-color .15s ease,background-color .15s ease,box-shadow .15s ease,transform .15s ease}.aeris-radio__dot{width:var(--aeris-radio-dot-size);height:var(--aeris-radio-dot-size);border-radius:50%;background:transparent;opacity:0;transform:scale(.35);transition:opacity .14s ease,transform .16s cubic-bezier(.2,.8,.2,1)}.aeris-radio__label{min-width:0}.aeris-radio:hover .aeris-radio__control{border-color:var(--aeris-radio-hover-border, var(--aeris-primary, #768653))}.aeris-radio__input:checked+.aeris-radio__control{border:calc((var(--aeris-radio-size) - var(--aeris-radio-dot-size)) / 2) solid var(--aeris-radio-selected-color, var(--aeris-primary, #768653));background:transparent}.aeris-radio__input:checked+.aeris-radio__control .aeris-radio__dot{opacity:1;transform:scale(1)}.aeris-radio__input:focus-visible+.aeris-radio__control{outline:3px solid var(--aeris-radio-focus-ring, color-mix(in srgb, var(--aeris-focus, var(--aeris-primary, #536437)) 42%, transparent));outline-offset:2px}.aeris-radio[data-invalid=true] .aeris-radio__control{border-color:var(--aeris-danger, #c81e2a)}.aeris-radio[data-disabled=true]{opacity:var(--aeris-disabled-opacity, .5);cursor:not-allowed}.aeris-radio[data-disabled=true]:hover .aeris-radio__control{border-color:var(--aeris-radio-border, var(--aeris-border-strong, #aeb2a8))}@media(prefers-reduced-motion:reduce){.aeris-radio__control,.aeris-radio__dot{transition:none}}\n"] }]
|
|
187
|
+
}], propDecorators: { selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], selectedInput: [{ type: i0.Output, args: ["selectedInput"] }], changed: [{ type: i0.Output, args: ["changed"] }], focused: [{ type: i0.Output, args: ["focused"] }], blurred: [{ type: i0.Output, args: ["blurred"] }], touch: [{ type: i0.Output, args: ["touch"] }], radioInput: [{ type: i0.ViewChild, args: ['radioInput', { isSignal: true }] }] } });
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Generated bundle index. Do not edit.
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
export { AerisRadioButton };
|
|
194
|
+
//# sourceMappingURL=aeris-ui-core-radio-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aeris-ui-core-radio-button.mjs","sources":["../../../projects/aeris-ui/radio-button/aeris-radio-button.ts","../../../projects/aeris-ui/radio-button/aeris-ui-core-radio-button.ts"],"sourcesContent":["import {\n Component,\n ElementRef,\n booleanAttribute,\n computed,\n forwardRef,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';\n\nexport type AerisRadioButtonSize = 'xs' | 'sm' | 'md' | 'lg';\nexport type AerisRadioButtonLabelPosition = 'start' | 'end';\n\nexport interface AerisRadioButtonChangeEvent {\n readonly originalEvent: Event;\n readonly value: string;\n}\n\nlet nextRadioButtonId = 0;\n\n@Component({\n selector: 'aeris-radio-button',\n template: `\n <label\n class=\"aeris-radio\"\n [class.aeris-radio--label-start]=\"labelPosition() === 'start'\"\n [attr.data-size]=\"size()\"\n [attr.data-selected]=\"isSelected()\"\n [attr.data-disabled]=\"effectiveDisabled()\"\n [attr.data-invalid]=\"invalid()\"\n >\n <input\n #radioInput\n class=\"aeris-radio__input\"\n type=\"radio\"\n [id]=\"resolvedInputId()\"\n [name]=\"name()\"\n [value]=\"value()\"\n [checked]=\"isSelected()\"\n [disabled]=\"effectiveDisabled()\"\n [required]=\"required()\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledby() || null\"\n [attr.aria-describedby]=\"ariaDescribedby() || null\"\n [attr.aria-invalid]=\"invalid() || null\"\n [attr.aria-required]=\"required() || null\"\n (change)=\"handleChange($event)\"\n (focus)=\"focused.emit($event)\"\n (blur)=\"handleBlur($event)\"\n />\n <span class=\"aeris-radio__control\" aria-hidden=\"true\">\n <span class=\"aeris-radio__dot\"></span>\n </span>\n <span class=\"aeris-radio__label\">\n @if (label()) {\n {{ label() }}\n } @else {\n <ng-content />\n }\n </span>\n </label>\n `,\n styleUrl: './aeris-radio-button.scss',\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AerisRadioButton),\n multi: true,\n },\n ],\n host: {\n '[attr.data-selected]': 'isSelected()',\n '[attr.data-disabled]': 'effectiveDisabled()',\n },\n})\nexport class AerisRadioButton implements ControlValueAccessor {\n readonly selected = model<string | null>(null);\n readonly value = input.required<string>();\n readonly name = input('');\n readonly inputId = input('');\n readonly label = input('');\n readonly size = input<AerisRadioButtonSize>('md');\n readonly labelPosition = input<AerisRadioButtonLabelPosition>('end');\n readonly disabled = input(false, { transform: booleanAttribute });\n readonly required = input(false, { transform: booleanAttribute });\n readonly invalid = input(false, { transform: booleanAttribute });\n readonly ariaLabel = input('');\n readonly ariaLabelledby = input('');\n readonly ariaDescribedby = input('');\n\n readonly selectedInput = output<string>();\n readonly changed = output<AerisRadioButtonChangeEvent>();\n readonly focused = output<FocusEvent>();\n readonly blurred = output<FocusEvent>();\n readonly touch = output<void>();\n\n private readonly generatedId = `aeris-radio-${++nextRadioButtonId}`;\n protected readonly formDisabled = signal(false);\n protected readonly resolvedInputId = computed(\n () => this.inputId() || this.generatedId,\n );\n protected readonly effectiveDisabled = computed(\n () => this.disabled() || this.formDisabled(),\n );\n protected readonly isSelected = computed(\n () => this.selected() === this.value(),\n );\n\n private readonly radioInput =\n viewChild<ElementRef<HTMLInputElement>>('radioInput');\n private onChange: (value: string) => void = () => undefined;\n private onTouched: () => void = () => undefined;\n\n writeValue(value: unknown): void {\n this.selected.set(value == null ? null : String(value));\n }\n\n registerOnChange(fn: (value: string) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.formDisabled.set(isDisabled);\n }\n\n focus(options?: FocusOptions): void {\n this.radioInput()?.nativeElement.focus(options);\n }\n\n select(): void {\n if (this.effectiveDisabled() || this.isSelected()) {\n return;\n }\n\n this.updateSelection();\n this.focus();\n }\n\n protected handleChange(event: Event): void {\n if (this.effectiveDisabled()) {\n return;\n }\n\n this.updateSelection();\n this.changed.emit({ originalEvent: event, value: this.value() });\n }\n\n protected handleBlur(event: FocusEvent): void {\n this.onTouched();\n this.touch.emit();\n this.blurred.emit(event);\n }\n\n private updateSelection(): void {\n const value = this.value();\n this.selected.set(value);\n this.selectedInput.emit(value);\n this.onChange(value);\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;AAsBA,IAAI,iBAAiB,GAAG,CAAC;MAyDZ,gBAAgB,CAAA;IAClB,QAAQ,GAAG,KAAK,CAAgB,IAAI;iFAAC;IACrC,KAAK,GAAG,KAAK,CAAC,QAAQ;8EAAU;IAChC,IAAI,GAAG,KAAK,CAAC,EAAE;6EAAC;IAChB,OAAO,GAAG,KAAK,CAAC,EAAE;gFAAC;IACnB,KAAK,GAAG,KAAK,CAAC,EAAE;8EAAC;IACjB,IAAI,GAAG,KAAK,CAAuB,IAAI;6EAAC;IACxC,aAAa,GAAG,KAAK,CAAgC,KAAK;sFAAC;IAC3D,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IACxD,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IACxD,OAAO,GAAG,KAAK,CAAC,KAAK,+EAAI,SAAS,EAAE,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ACF,EAAA,WAAA,EAAA,CAAA,EAAA,YAAA,EAAA,YAAA,EAAA,KAAA,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,YAAA,CAAA,EAAA,WAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EA/CS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,CAAA,m4FAAA,CAAA,EAAA,CAAA;;2FAcU,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAvD5B,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,oBAAoB,EAAA,QAAA,EACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCT,EAAA,SAAA,EAEU;AACT,wBAAA;AACE,4BAAA,OAAO,EAAE,iBAAiB;AAC1B,4BAAA,WAAW,EAAE,UAAU,CAAC,sBAAsB,CAAC;AAC/C,4BAAA,KAAK,EAAE,IAAI;AACZ,yBAAA;qBACF,EAAA,IAAA,EACK;AACJ,wBAAA,sBAAsB,EAAE,cAAc;AACtC,wBAAA,sBAAsB,EAAE,qBAAqB;AAC9C,qBAAA,EAAA,MAAA,EAAA,CAAA,m4FAAA,CAAA,EAAA;mmDAoCyC,YAAY,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;ACjHxD;;AAEG;;;;"}
|
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { model, input, numberAttribute, booleanAttribute, output, signal, computed, viewChild, contentChild, forwardRef, Component } from '@angular/core';
|
|
3
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
|
|
6
|
+
let ratingId = 0;
|
|
7
|
+
class AerisRating {
|
|
8
|
+
starPath = 'M12 2.9 14.8 8.6 21.1 9.5 16.5 14 17.6 20.3 12 17.3 6.4 20.3 7.5 14 2.9 9.5 9.2 8.6 12 2.9Z';
|
|
9
|
+
value = model(0, /* @ts-ignore */
|
|
10
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
11
|
+
max = input(5, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
12
|
+
allowHalf = input(false, { ...(ngDevMode ? { debugName: "allowHalf" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
13
|
+
allowClear = input(true, { ...(ngDevMode ? { debugName: "allowClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
14
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
15
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
16
|
+
size = input('md', /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
18
|
+
showValue = input(false, { ...(ngDevMode ? { debugName: "showValue" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
19
|
+
name = input('', /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
21
|
+
inputId = input('', /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
23
|
+
ariaLabel = input('Rating', /* @ts-ignore */
|
|
24
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
25
|
+
ariaLabelledby = input('', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
27
|
+
ariaDescribedby = input('', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
29
|
+
valueText = input(null, /* @ts-ignore */
|
|
30
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
31
|
+
valueInput = output();
|
|
32
|
+
changed = output();
|
|
33
|
+
focused = output();
|
|
34
|
+
blurred = output();
|
|
35
|
+
touch = output();
|
|
36
|
+
formDisabled = signal(false, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "formDisabled" }] : /* istanbul ignore next */ []));
|
|
38
|
+
previewValue = signal(null, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "previewValue" }] : /* istanbul ignore next */ []));
|
|
40
|
+
focusedState = signal(false, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "focusedState" }] : /* istanbul ignore next */ []));
|
|
42
|
+
effectiveDisabled = computed(() => this.disabled() || this.formDisabled(), /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
44
|
+
maxStars = computed(() => Math.max(1, Math.floor(this.max())), /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "maxStars" }] : /* istanbul ignore next */ []));
|
|
46
|
+
effectiveStep = computed(() => (this.allowHalf() ? 0.5 : 1), /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "effectiveStep" }] : /* istanbul ignore next */ []));
|
|
48
|
+
normalizedValue = computed(() => this.normalizeValue(this.value()), /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "normalizedValue" }] : /* istanbul ignore next */ []));
|
|
50
|
+
visualValue = computed(() => this.previewValue() ?? this.normalizedValue(), /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "visualValue" }] : /* istanbul ignore next */ []));
|
|
52
|
+
visualFillWidth = computed(() => this.fillWidth(this.visualValue()), /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "visualFillWidth" }] : /* istanbul ignore next */ []));
|
|
54
|
+
formattedValue = computed(() => this.valueText()?.(this.normalizedValue(), this.maxStars()) ??
|
|
55
|
+
`${this.normalizedValue()} of ${this.maxStars()}`, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "formattedValue" }] : /* istanbul ignore next */ []));
|
|
57
|
+
stars = computed(() => Array.from({ length: this.maxStars() }, (_, index) => index + 1), /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "stars" }] : /* istanbul ignore next */ []));
|
|
59
|
+
control = viewChild('ratingControl', /* @ts-ignore */
|
|
60
|
+
...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
61
|
+
activeIconTemplate = contentChild('activeIcon', /* @ts-ignore */
|
|
62
|
+
...(ngDevMode ? [{ debugName: "activeIconTemplate" }] : /* istanbul ignore next */ []));
|
|
63
|
+
inactiveIconTemplate = contentChild('inactiveIcon', /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "inactiveIconTemplate" }] : /* istanbul ignore next */ []));
|
|
65
|
+
generatedId = `aeris-rating-${++ratingId}`;
|
|
66
|
+
resolvedInputId = computed(() => this.inputId() || this.generatedId, /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "resolvedInputId" }] : /* istanbul ignore next */ []));
|
|
68
|
+
onChange = () => undefined;
|
|
69
|
+
onTouched = () => undefined;
|
|
70
|
+
writeValue(value) {
|
|
71
|
+
this.value.set(this.coerceValue(value));
|
|
72
|
+
}
|
|
73
|
+
registerOnChange(callback) {
|
|
74
|
+
this.onChange = callback;
|
|
75
|
+
}
|
|
76
|
+
registerOnTouched(callback) {
|
|
77
|
+
this.onTouched = callback;
|
|
78
|
+
}
|
|
79
|
+
setDisabledState(disabled) {
|
|
80
|
+
this.formDisabled.set(disabled);
|
|
81
|
+
}
|
|
82
|
+
focus(options) {
|
|
83
|
+
this.control()?.nativeElement.focus(options);
|
|
84
|
+
}
|
|
85
|
+
reset() {
|
|
86
|
+
this.setValue(0);
|
|
87
|
+
}
|
|
88
|
+
clear() {
|
|
89
|
+
if (!this.allowClear() || this.effectiveDisabled())
|
|
90
|
+
return;
|
|
91
|
+
this.setValue(0);
|
|
92
|
+
this.focus();
|
|
93
|
+
}
|
|
94
|
+
handlePointer(event) {
|
|
95
|
+
if (this.effectiveDisabled())
|
|
96
|
+
return;
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
const next = this.valueFromPointer(event);
|
|
99
|
+
const value = this.allowClear() && next === this.normalizedValue() ? 0 : next;
|
|
100
|
+
if (this.setValue(value)) {
|
|
101
|
+
this.changed.emit({ originalEvent: event, value: this.normalizedValue() });
|
|
102
|
+
}
|
|
103
|
+
this.focus();
|
|
104
|
+
}
|
|
105
|
+
handlePointerPreview(event) {
|
|
106
|
+
if (this.effectiveDisabled())
|
|
107
|
+
return;
|
|
108
|
+
this.previewValue.set(this.valueFromPointer(event));
|
|
109
|
+
}
|
|
110
|
+
clearPreview() {
|
|
111
|
+
this.previewValue.set(null);
|
|
112
|
+
}
|
|
113
|
+
iconContext(item, active) {
|
|
114
|
+
return {
|
|
115
|
+
$implicit: item,
|
|
116
|
+
index: item - 1,
|
|
117
|
+
active,
|
|
118
|
+
value: this.normalizedValue(),
|
|
119
|
+
max: this.maxStars(),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
handleKeydown(event) {
|
|
123
|
+
if (this.effectiveDisabled())
|
|
124
|
+
return;
|
|
125
|
+
let next = null;
|
|
126
|
+
if (event.key === 'ArrowRight' || event.key === 'ArrowUp') {
|
|
127
|
+
next = this.normalizedValue() + this.effectiveStep();
|
|
128
|
+
}
|
|
129
|
+
else if (event.key === 'ArrowLeft' || event.key === 'ArrowDown') {
|
|
130
|
+
next = this.normalizedValue() - this.effectiveStep();
|
|
131
|
+
}
|
|
132
|
+
else if (event.key === 'Home') {
|
|
133
|
+
next = this.allowClear() ? 0 : this.effectiveStep();
|
|
134
|
+
}
|
|
135
|
+
else if (event.key === 'End') {
|
|
136
|
+
next = this.maxStars();
|
|
137
|
+
}
|
|
138
|
+
else if (event.key === 'Backspace' || event.key === 'Delete') {
|
|
139
|
+
if (this.allowClear())
|
|
140
|
+
next = 0;
|
|
141
|
+
}
|
|
142
|
+
if (next === null)
|
|
143
|
+
return;
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
if (this.setValue(next)) {
|
|
146
|
+
this.changed.emit({ originalEvent: event, value: this.normalizedValue() });
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
handleFocus(event) {
|
|
150
|
+
this.focusedState.set(true);
|
|
151
|
+
this.focused.emit(event);
|
|
152
|
+
}
|
|
153
|
+
handleBlur(event) {
|
|
154
|
+
this.focusedState.set(false);
|
|
155
|
+
this.previewValue.set(null);
|
|
156
|
+
this.onTouched();
|
|
157
|
+
this.touch.emit();
|
|
158
|
+
this.blurred.emit(event);
|
|
159
|
+
}
|
|
160
|
+
valueFromPointer(event) {
|
|
161
|
+
const target = event.currentTarget;
|
|
162
|
+
const rect = target.getBoundingClientRect();
|
|
163
|
+
const ratio = Math.min(1, Math.max(0, (event.clientX - rect.left) / Math.max(1, rect.width)));
|
|
164
|
+
const raw = ratio * this.maxStars();
|
|
165
|
+
if (this.allowHalf()) {
|
|
166
|
+
return this.normalizeValue(raw);
|
|
167
|
+
}
|
|
168
|
+
return this.normalizeValue(Math.ceil(raw));
|
|
169
|
+
}
|
|
170
|
+
setValue(value) {
|
|
171
|
+
const next = this.normalizeValue(value);
|
|
172
|
+
if (next === this.normalizedValue())
|
|
173
|
+
return false;
|
|
174
|
+
this.value.set(next);
|
|
175
|
+
this.valueInput.emit(next);
|
|
176
|
+
this.onChange(next);
|
|
177
|
+
return true;
|
|
178
|
+
}
|
|
179
|
+
fillWidth(value) {
|
|
180
|
+
const normalized = Math.min(this.maxStars(), Math.max(0, value));
|
|
181
|
+
if (normalized <= 0)
|
|
182
|
+
return '0px';
|
|
183
|
+
const fullStars = Math.floor(normalized);
|
|
184
|
+
const partialStar = Number((normalized - fullStars).toFixed(1));
|
|
185
|
+
const starUnits = partialStar > 0 ? fullStars + partialStar : fullStars;
|
|
186
|
+
const gapUnits = partialStar > 0 ? fullStars : Math.max(0, fullStars - 1);
|
|
187
|
+
return `calc(${starUnits} * var(--_star-size) + ${gapUnits} * var(--_gap))`;
|
|
188
|
+
}
|
|
189
|
+
normalizeValue(value) {
|
|
190
|
+
const min = this.allowClear() ? 0 : this.effectiveStep();
|
|
191
|
+
const max = this.maxStars();
|
|
192
|
+
const clamped = Math.min(max, Math.max(min, this.coerceValue(value)));
|
|
193
|
+
const step = this.effectiveStep();
|
|
194
|
+
return Number((Math.round(clamped / step) * step).toFixed(1));
|
|
195
|
+
}
|
|
196
|
+
coerceValue(value) {
|
|
197
|
+
const number = Number(value);
|
|
198
|
+
return Number.isFinite(number) ? number : 0;
|
|
199
|
+
}
|
|
200
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisRating, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
201
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: AerisRating, isStandalone: true, selector: "aeris-rating", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, allowHalf: { classPropertyName: "allowHalf", publicName: "allowHalf", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showValue: { classPropertyName: "showValue", publicName: "showValue", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null }, valueText: { classPropertyName: "valueText", publicName: "valueText", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueInput: "valueInput", changed: "changed", focused: "focused", blurred: "blurred", touch: "touch" }, host: { properties: { "attr.data-disabled": "effectiveDisabled() || null" } }, providers: [
|
|
202
|
+
{
|
|
203
|
+
provide: NG_VALUE_ACCESSOR,
|
|
204
|
+
useExisting: forwardRef(() => AerisRating),
|
|
205
|
+
multi: true,
|
|
206
|
+
},
|
|
207
|
+
], queries: [{ propertyName: "activeIconTemplate", first: true, predicate: ["activeIcon"], descendants: true, isSignal: true }, { propertyName: "inactiveIconTemplate", first: true, predicate: ["inactiveIcon"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "control", first: true, predicate: ["ratingControl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
208
|
+
<div
|
|
209
|
+
class="aeris-rating"
|
|
210
|
+
[attr.data-size]="size()"
|
|
211
|
+
[attr.data-disabled]="effectiveDisabled() || null"
|
|
212
|
+
[attr.data-focused]="focusedState() || null"
|
|
213
|
+
[style.--aeris-rating-progress]="visualFillWidth()"
|
|
214
|
+
[style.--aeris-rating-max]="maxStars()"
|
|
215
|
+
>
|
|
216
|
+
@if (name()) {
|
|
217
|
+
<input type="hidden" [name]="name()" [value]="normalizedValue()" />
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
<button
|
|
221
|
+
#ratingControl
|
|
222
|
+
class="aeris-rating__control"
|
|
223
|
+
type="button"
|
|
224
|
+
role="slider"
|
|
225
|
+
[id]="resolvedInputId()"
|
|
226
|
+
[attr.aria-label]="ariaLabel()"
|
|
227
|
+
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
228
|
+
[attr.aria-describedby]="ariaDescribedby() || null"
|
|
229
|
+
[attr.aria-valuemin]="allowClear() ? 0 : effectiveStep()"
|
|
230
|
+
[attr.aria-valuemax]="maxStars()"
|
|
231
|
+
[attr.aria-valuenow]="normalizedValue()"
|
|
232
|
+
[attr.aria-valuetext]="formattedValue()"
|
|
233
|
+
[attr.aria-required]="required() || null"
|
|
234
|
+
[disabled]="effectiveDisabled()"
|
|
235
|
+
(pointerdown)="handlePointer($event)"
|
|
236
|
+
(pointermove)="handlePointerPreview($event)"
|
|
237
|
+
(pointerleave)="clearPreview()"
|
|
238
|
+
(keydown)="handleKeydown($event)"
|
|
239
|
+
(focus)="handleFocus($event)"
|
|
240
|
+
(blur)="handleBlur($event)"
|
|
241
|
+
>
|
|
242
|
+
<span class="aeris-rating__stars" aria-hidden="true">
|
|
243
|
+
<span class="aeris-rating__layer aeris-rating__layer--empty">
|
|
244
|
+
@for (item of stars(); track item) {
|
|
245
|
+
<span class="aeris-rating__star">
|
|
246
|
+
@if (inactiveIconTemplate(); as inactiveIcon) {
|
|
247
|
+
<ng-container
|
|
248
|
+
[ngTemplateOutlet]="inactiveIcon"
|
|
249
|
+
[ngTemplateOutletContext]="iconContext(item, false)"
|
|
250
|
+
/>
|
|
251
|
+
} @else {
|
|
252
|
+
<svg viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
253
|
+
<path [attr.d]="starPath" />
|
|
254
|
+
</svg>
|
|
255
|
+
}
|
|
256
|
+
</span>
|
|
257
|
+
}
|
|
258
|
+
</span>
|
|
259
|
+
<span class="aeris-rating__layer aeris-rating__layer--active">
|
|
260
|
+
<span class="aeris-rating__layer-inner">
|
|
261
|
+
@for (item of stars(); track item) {
|
|
262
|
+
<span class="aeris-rating__star">
|
|
263
|
+
@if (activeIconTemplate(); as activeIcon) {
|
|
264
|
+
<ng-container
|
|
265
|
+
[ngTemplateOutlet]="activeIcon"
|
|
266
|
+
[ngTemplateOutletContext]="iconContext(item, true)"
|
|
267
|
+
/>
|
|
268
|
+
} @else {
|
|
269
|
+
<svg viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
270
|
+
<path [attr.d]="starPath" />
|
|
271
|
+
</svg>
|
|
272
|
+
}
|
|
273
|
+
</span>
|
|
274
|
+
}
|
|
275
|
+
</span>
|
|
276
|
+
</span>
|
|
277
|
+
</span>
|
|
278
|
+
</button>
|
|
279
|
+
|
|
280
|
+
@if (showValue()) {
|
|
281
|
+
<span class="aeris-rating__value" aria-hidden="true">
|
|
282
|
+
{{ formattedValue() }}
|
|
283
|
+
</span>
|
|
284
|
+
}
|
|
285
|
+
</div>
|
|
286
|
+
`, isInline: true, styles: [":host{display:inline-block;color:var(--aeris-rating-text, var(--aeris-text, #222222));font:inherit}.aeris-rating{--_star-size: 1.5rem;--_gap: .25rem;display:inline-flex;align-items:center;gap:.625rem}.aeris-rating[data-size=xs]{--_star-size: 1rem;--_gap: .125rem}.aeris-rating[data-size=sm]{--_star-size: 1.25rem;--_gap: .1875rem}.aeris-rating[data-size=lg]{--_star-size: 1.875rem;--_gap: .3125rem}.aeris-rating__control{position:relative;display:block;width:calc(var(--aeris-rating-max) * var(--_star-size) + (var(--aeris-rating-max) - 1) * var(--_gap));min-width:0;padding:0;border:0;border-radius:.5rem;background:transparent;color:inherit;cursor:pointer;touch-action:manipulation}.aeris-rating__control:focus{outline:0}.aeris-rating__control:focus-visible{outline:0;box-shadow:none}.aeris-rating__control:focus-visible .aeris-rating__stars{filter:drop-shadow(0 0 .18rem var(--aeris-rating-focus, var(--aeris-focus, #536437)))}.aeris-rating__stars{position:relative;display:block;color:var(--aeris-rating-empty, var(--aeris-surface-3, #e5e5df))}.aeris-rating__layer,.aeris-rating__layer-inner{display:flex;gap:var(--_gap)}.aeris-rating__layer--empty{clip-path:inset(0 0 0 var(--aeris-rating-progress))}.aeris-rating__layer--active{position:absolute;inset:0 auto 0 0;z-index:1;width:var(--aeris-rating-progress);color:var(--aeris-rating-active, var(--aeris-primary, #879566));overflow:hidden;pointer-events:none}.aeris-rating__layer-inner{width:calc(var(--aeris-rating-max) * var(--_star-size) + (var(--aeris-rating-max) - 1) * var(--_gap))}.aeris-rating__star{width:var(--_star-size);height:var(--_star-size);display:grid;place-items:center;flex:0 0 auto;font-size:var(--_star-size);line-height:1}.aeris-rating__star svg{width:100%;height:100%;display:block;fill:currentColor}.aeris-rating__value{color:var(--aeris-rating-value-text, var(--aeris-text-2, #555555));font-size:.8125rem;font-weight:650;font-variant-numeric:tabular-nums}.aeris-rating[data-disabled]{opacity:var(--aeris-disabled-opacity, .52)}.aeris-rating[data-disabled] .aeris-rating__control,.aeris-rating__control:disabled{cursor:not-allowed}@media(prefers-reduced-motion:reduce){.aeris-rating__control{transition:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
287
|
+
}
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: AerisRating, decorators: [{
|
|
289
|
+
type: Component,
|
|
290
|
+
args: [{ selector: 'aeris-rating', imports: [NgTemplateOutlet], template: `
|
|
291
|
+
<div
|
|
292
|
+
class="aeris-rating"
|
|
293
|
+
[attr.data-size]="size()"
|
|
294
|
+
[attr.data-disabled]="effectiveDisabled() || null"
|
|
295
|
+
[attr.data-focused]="focusedState() || null"
|
|
296
|
+
[style.--aeris-rating-progress]="visualFillWidth()"
|
|
297
|
+
[style.--aeris-rating-max]="maxStars()"
|
|
298
|
+
>
|
|
299
|
+
@if (name()) {
|
|
300
|
+
<input type="hidden" [name]="name()" [value]="normalizedValue()" />
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
<button
|
|
304
|
+
#ratingControl
|
|
305
|
+
class="aeris-rating__control"
|
|
306
|
+
type="button"
|
|
307
|
+
role="slider"
|
|
308
|
+
[id]="resolvedInputId()"
|
|
309
|
+
[attr.aria-label]="ariaLabel()"
|
|
310
|
+
[attr.aria-labelledby]="ariaLabelledby() || null"
|
|
311
|
+
[attr.aria-describedby]="ariaDescribedby() || null"
|
|
312
|
+
[attr.aria-valuemin]="allowClear() ? 0 : effectiveStep()"
|
|
313
|
+
[attr.aria-valuemax]="maxStars()"
|
|
314
|
+
[attr.aria-valuenow]="normalizedValue()"
|
|
315
|
+
[attr.aria-valuetext]="formattedValue()"
|
|
316
|
+
[attr.aria-required]="required() || null"
|
|
317
|
+
[disabled]="effectiveDisabled()"
|
|
318
|
+
(pointerdown)="handlePointer($event)"
|
|
319
|
+
(pointermove)="handlePointerPreview($event)"
|
|
320
|
+
(pointerleave)="clearPreview()"
|
|
321
|
+
(keydown)="handleKeydown($event)"
|
|
322
|
+
(focus)="handleFocus($event)"
|
|
323
|
+
(blur)="handleBlur($event)"
|
|
324
|
+
>
|
|
325
|
+
<span class="aeris-rating__stars" aria-hidden="true">
|
|
326
|
+
<span class="aeris-rating__layer aeris-rating__layer--empty">
|
|
327
|
+
@for (item of stars(); track item) {
|
|
328
|
+
<span class="aeris-rating__star">
|
|
329
|
+
@if (inactiveIconTemplate(); as inactiveIcon) {
|
|
330
|
+
<ng-container
|
|
331
|
+
[ngTemplateOutlet]="inactiveIcon"
|
|
332
|
+
[ngTemplateOutletContext]="iconContext(item, false)"
|
|
333
|
+
/>
|
|
334
|
+
} @else {
|
|
335
|
+
<svg viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
336
|
+
<path [attr.d]="starPath" />
|
|
337
|
+
</svg>
|
|
338
|
+
}
|
|
339
|
+
</span>
|
|
340
|
+
}
|
|
341
|
+
</span>
|
|
342
|
+
<span class="aeris-rating__layer aeris-rating__layer--active">
|
|
343
|
+
<span class="aeris-rating__layer-inner">
|
|
344
|
+
@for (item of stars(); track item) {
|
|
345
|
+
<span class="aeris-rating__star">
|
|
346
|
+
@if (activeIconTemplate(); as activeIcon) {
|
|
347
|
+
<ng-container
|
|
348
|
+
[ngTemplateOutlet]="activeIcon"
|
|
349
|
+
[ngTemplateOutletContext]="iconContext(item, true)"
|
|
350
|
+
/>
|
|
351
|
+
} @else {
|
|
352
|
+
<svg viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
353
|
+
<path [attr.d]="starPath" />
|
|
354
|
+
</svg>
|
|
355
|
+
}
|
|
356
|
+
</span>
|
|
357
|
+
}
|
|
358
|
+
</span>
|
|
359
|
+
</span>
|
|
360
|
+
</span>
|
|
361
|
+
</button>
|
|
362
|
+
|
|
363
|
+
@if (showValue()) {
|
|
364
|
+
<span class="aeris-rating__value" aria-hidden="true">
|
|
365
|
+
{{ formattedValue() }}
|
|
366
|
+
</span>
|
|
367
|
+
}
|
|
368
|
+
</div>
|
|
369
|
+
`, providers: [
|
|
370
|
+
{
|
|
371
|
+
provide: NG_VALUE_ACCESSOR,
|
|
372
|
+
useExisting: forwardRef(() => AerisRating),
|
|
373
|
+
multi: true,
|
|
374
|
+
},
|
|
375
|
+
], host: {
|
|
376
|
+
'[attr.data-disabled]': 'effectiveDisabled() || null',
|
|
377
|
+
}, styles: [":host{display:inline-block;color:var(--aeris-rating-text, var(--aeris-text, #222222));font:inherit}.aeris-rating{--_star-size: 1.5rem;--_gap: .25rem;display:inline-flex;align-items:center;gap:.625rem}.aeris-rating[data-size=xs]{--_star-size: 1rem;--_gap: .125rem}.aeris-rating[data-size=sm]{--_star-size: 1.25rem;--_gap: .1875rem}.aeris-rating[data-size=lg]{--_star-size: 1.875rem;--_gap: .3125rem}.aeris-rating__control{position:relative;display:block;width:calc(var(--aeris-rating-max) * var(--_star-size) + (var(--aeris-rating-max) - 1) * var(--_gap));min-width:0;padding:0;border:0;border-radius:.5rem;background:transparent;color:inherit;cursor:pointer;touch-action:manipulation}.aeris-rating__control:focus{outline:0}.aeris-rating__control:focus-visible{outline:0;box-shadow:none}.aeris-rating__control:focus-visible .aeris-rating__stars{filter:drop-shadow(0 0 .18rem var(--aeris-rating-focus, var(--aeris-focus, #536437)))}.aeris-rating__stars{position:relative;display:block;color:var(--aeris-rating-empty, var(--aeris-surface-3, #e5e5df))}.aeris-rating__layer,.aeris-rating__layer-inner{display:flex;gap:var(--_gap)}.aeris-rating__layer--empty{clip-path:inset(0 0 0 var(--aeris-rating-progress))}.aeris-rating__layer--active{position:absolute;inset:0 auto 0 0;z-index:1;width:var(--aeris-rating-progress);color:var(--aeris-rating-active, var(--aeris-primary, #879566));overflow:hidden;pointer-events:none}.aeris-rating__layer-inner{width:calc(var(--aeris-rating-max) * var(--_star-size) + (var(--aeris-rating-max) - 1) * var(--_gap))}.aeris-rating__star{width:var(--_star-size);height:var(--_star-size);display:grid;place-items:center;flex:0 0 auto;font-size:var(--_star-size);line-height:1}.aeris-rating__star svg{width:100%;height:100%;display:block;fill:currentColor}.aeris-rating__value{color:var(--aeris-rating-value-text, var(--aeris-text-2, #555555));font-size:.8125rem;font-weight:650;font-variant-numeric:tabular-nums}.aeris-rating[data-disabled]{opacity:var(--aeris-disabled-opacity, .52)}.aeris-rating[data-disabled] .aeris-rating__control,.aeris-rating__control:disabled{cursor:not-allowed}@media(prefers-reduced-motion:reduce){.aeris-rating__control{transition:none}}\n"] }]
|
|
378
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], allowHalf: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowHalf", required: false }] }], allowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowClear", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], showValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "showValue", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], valueText: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueText", required: false }] }], valueInput: [{ type: i0.Output, args: ["valueInput"] }], changed: [{ type: i0.Output, args: ["changed"] }], focused: [{ type: i0.Output, args: ["focused"] }], blurred: [{ type: i0.Output, args: ["blurred"] }], touch: [{ type: i0.Output, args: ["touch"] }], control: [{ type: i0.ViewChild, args: ['ratingControl', { isSignal: true }] }], activeIconTemplate: [{ type: i0.ContentChild, args: ['activeIcon', { isSignal: true }] }], inactiveIconTemplate: [{ type: i0.ContentChild, args: ['inactiveIcon', { isSignal: true }] }] } });
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Generated bundle index. Do not edit.
|
|
382
|
+
*/
|
|
383
|
+
|
|
384
|
+
export { AerisRating };
|
|
385
|
+
//# sourceMappingURL=aeris-ui-core-rating.mjs.map
|