@testgorilla/tgo-ui 12.2.0 → 12.3.2
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/testgorilla-tgo-ui-components-ai-feedback.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-ai-feedback.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs +6 -1
- package/fesm2022/testgorilla-tgo-ui-components-alert-banner.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-audio-waveform.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs +6 -4
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete-v2.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-autocomplete.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-avatar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-button.mjs +19 -4
- package/fesm2022/testgorilla-tgo-ui-components-button.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-checklist.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-core.mjs +11 -1
- package/fesm2022/testgorilla-tgo-ui-components-core.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs +7 -1
- package/fesm2022/testgorilla-tgo-ui-components-dialog.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-dropdown.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-empty-state.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-field.mjs +8 -2
- package/fesm2022/testgorilla-tgo-ui-components-field.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-filter-button.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs +12 -3
- package/fesm2022/testgorilla-tgo-ui-components-infinite-scroll-table.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs +6 -2
- package/fesm2022/testgorilla-tgo-ui-components-inline-field.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-media-card.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-media-dialog.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs +6 -0
- package/fesm2022/testgorilla-tgo-ui-components-navbar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-overflow-menu.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-page-header.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-popover.mjs +250 -50
- package/fesm2022/testgorilla-tgo-ui-components-popover.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs +4 -0
- package/fesm2022/testgorilla-tgo-ui-components-prompt.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs +4 -1
- package/fesm2022/testgorilla-tgo-ui-components-radial-progress.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs +5 -2
- package/fesm2022/testgorilla-tgo-ui-components-radio-button.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-scale-table.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-scale.mjs +9 -2
- package/fesm2022/testgorilla-tgo-ui-components-scale.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs +89 -7
- package/fesm2022/testgorilla-tgo-ui-components-side-navigation.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-side-panel.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs +7 -4
- package/fesm2022/testgorilla-tgo-ui-components-side-sheet.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-slider.mjs +13 -4
- package/fesm2022/testgorilla-tgo-ui-components-slider.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-snackbar.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-stepper.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-table.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-table.mjs.map +1 -1
- package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs +3 -0
- package/fesm2022/testgorilla-tgo-ui-components-write-with-ai.mjs.map +1 -1
- package/mcp/catalog.json +1 -1
- package/package.json +2 -2
- package/types/testgorilla-tgo-ui-components-alert-banner.d.ts +1 -0
- package/types/testgorilla-tgo-ui-components-autocomplete-v2.d.ts +1 -1
- package/types/testgorilla-tgo-ui-components-button.d.ts +32 -0
- package/types/testgorilla-tgo-ui-components-core.d.ts +1 -0
- package/types/testgorilla-tgo-ui-components-field.d.ts +1 -0
- package/types/testgorilla-tgo-ui-components-infinite-scroll-table.d.ts +3 -3
- package/types/testgorilla-tgo-ui-components-popover.d.ts +51 -5
- package/types/testgorilla-tgo-ui-components-radio-button.d.ts +1 -0
- package/types/testgorilla-tgo-ui-components-scale.d.ts +1 -0
- package/types/testgorilla-tgo-ui-components-side-navigation.d.ts +59 -1
- package/types/testgorilla-tgo-ui-components-slider.d.ts +2 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testgorilla-tgo-ui-components-radio-button.mjs","names":[],"sources":["../../../components/radio-button/radio-button.component.ts","../../../components/radio-button/radio-button.component.html","../../../components/radio-button/radio-button.component.module.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { NgClass } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n EventEmitter,\n HostBinding,\n HostListener,\n inject,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n ProviderToken,\n SimpleChanges,\n ViewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { MatRadioButton } from '@angular/material/radio';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport { ApplicationTheme, Alignment, EllipseTextDirective } from '@testgorilla/tgo-ui/components/core';\n\nimport { RadioButtonEventType } from './radio-button.model';\n\n@Component({\n selector: 'ui-radio-button',\n templateUrl: './radio-button.component.html',\n styleUrls: ['./radio-button.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n // Needs to be removed since it causes some a11y issues (https://github.com/angular/components/issues/21266).\n '[attr.tabindex]': 'null',\n '[attr.aria-label]': 'null',\n '[attr.aria-labelledby]': 'null',\n '[attr.aria-describedby]': 'null',\n // Note: under normal conditions focus shouldn't land on this element, however it may be\n // programmatically set, for example inside of a focus trap, in this case we want to forward\n // the focus to the mat-radio-button element.\n '(focus)': 'radioElement.focus()',\n },\n imports: [NgClass, MatRadioButton, EllipseTextDirective, MatTooltip],\n})\nexport class RadioButtonComponent implements OnInit, OnChanges, ControlValueAccessor, AfterViewInit, OnDestroy {\n private _isProcessingClick = false;\n\n @HostListener('click', ['$event'])\n onHostClick(event: MouseEvent): void {\n if (this._isProcessingClick) {\n return;\n }\n const target = event.target as HTMLElement | null;\n const targetClasses: string = target?.classList?.value ?? '';\n const fromMediaArea = this.mediaCard && target?.closest?.('.media-card-wrapper');\n if (targetClasses.includes('mat-mdc-radio-button') || targetClasses.includes('mdc-form-field') || fromMediaArea) {\n this._isProcessingClick = true;\n this.radioElement._inputElement.nativeElement.click();\n this._isProcessingClick = false;\n }\n }\n /**\n * Determines whether the radio button is disabled.\n * Default: false.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() disabled = false;\n\n /**\n * Determines whether the radio button is checked.\n * Default: false.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n //@Input() selected = false;\n\n _selected = false;\n @Input()\n get selected() {\n return this._selected;\n }\n set selected(selected: boolean) {\n this._selected = selected;\n }\n\n /**\n * Determines whether the radio button can be unchecked.\n * Default: false.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() allowUnselect = false;\n\n /**\n * Determines the radio button color.\n * Default: Test Gorilla primary color.\n *\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @HostBinding('style.--color')\n @Input()\n companyColor: string | null = null;\n\n /**\n * Used to group radios for unique selection.\n *\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() name = '';\n\n /**\n * Text content will be applied to the input element if present.\n *\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() label = '';\n\n /**\n * Determines whether the radio button is a multiple choice cell.\n * Default: false\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() multiple = false;\n\n /**\n * Renders the radio button as a media card. The image/video/gif passed via\n * the `[radio-media]` content slot fills the card and the radio + label sit\n * on top, in the bottom-left, with a dark scrim for contrast.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() mediaCard = false;\n\n /**\n * Determines value of the radio button.\n * Default: false\n *\n * @type {any}\n * @memberof RadioButtonComponent\n */\n @Input() value: unknown;\n\n /**\n *\n * Defines the application theme\n *\n * @type {ApplicationTheme}\n * @memberof RadioButtonComponent\n */\n @Input() applicationTheme: ApplicationTheme = 'light';\n\n /**\n * A string representing the ARIA label for accessibility.\n * This label is used to provide an accessible name for the input element.\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() ariaLabel: string;\n\n @Input() testId: string | null = null;\n\n /**\n * A string representing the ARIA requirement for accessibility.\n * This attribute is used to indicate whether an input field is required for form submission.\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() ariaRequired = false;\n\n /**\n * Defines if checkbox has error\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() hasError = false;\n\n /**\n * A string representing the ARIA requirement for accessibility.\n * This attribute is used to indicate whether an input field is required for form submission.\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() ariaLabelledby = '';\n\n /**\n * A string representing the ARIA requirement for accessibility.\n * This attribute is used to indicate whether an input field is required for form submission.\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() ariaDescribedby = '';\n\n /**\n * Truncate text if it is too long\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() truncateText = false;\n\n /**\n * Text alignment\n * @type {'center' | 'top'}\n * @memberof RadioButtonComponent\n */\n @Input() alignment: Alignment = 'center';\n\n /**\n * Sets the tab index for the checkbox component.\n * This determines the order in which elements receive focus when the user navigates through them using the Tab key.\n * Default value is 0.\n *\n * @type {number}\n * @memberof RadioButtonComponent\n */\n @Input() tabIndex = 0;\n\n /**\n * Show tooltip when label is truncated\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() hideTooltipOnEllipsis = false;\n\n /**\n * Event emitted when the checked state of the radio button changes.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Output() changeRadio = new EventEmitter<RadioButtonEventType>();\n\n classMultiple: string;\n showTooltip = false;\n protected origin: string | null = null;\n\n @ViewChild('radio') radioElement: MatRadioButton;\n\n private appliedTestId: string | null = null;\n @ViewChild('tooltip') tooltipElement: MatTooltip;\n\n private readonly defaultAppTheme = inject(\n 'CANOPYUI_DEFAULT_APPLICATION_THEME' as unknown as ProviderToken<ApplicationTheme>,\n {\n optional: true,\n }\n );\n public ngControl = inject(NgControl, { optional: true, self: true });\n public hostNgControl = inject(NgControl, { optional: true, host: true });\n private readonly destroyRef = inject(DestroyRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly ngZone = inject(NgZone);\n private readonly cdr = inject(ChangeDetectorRef);\n\n constructor() {\n if (this.defaultAppTheme) {\n this.applicationTheme = this.defaultAppTheme;\n }\n\n if (this.ngControl !== null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngOnInit() {\n this.checkHost();\n this.classMultiple = this.setClass();\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes['selected']) {\n this.classMultiple = this.setClass();\n }\n this.setCompanyColor();\n this.applyTestId();\n }\n\n // MatRadioButton takes no attribute passthrough, so the id is set on the native input directly.\n private applyTestId(): void {\n if (!this.radioElement || this.testId === this.appliedTestId) {\n return;\n }\n const radioNativeInput = this.radioElement._inputElement.nativeElement;\n if (this.testId) {\n radioNativeInput.setAttribute('data-testid', this.testId);\n } else {\n radioNativeInput.removeAttribute('data-testid');\n }\n this.appliedTestId = this.testId;\n }\n\n ngAfterViewInit() {\n this.radioElement._inputElement.nativeElement.setAttribute('role', 'radio');\n this.applyTestId();\n this.radioElement._inputElement.nativeElement.onclick = () => {\n this.clickRadio();\n };\n\n this.focusMonitor\n .monitor(this.radioElement._inputElement.nativeElement)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(origin =>\n this.ngZone.run(() => {\n this.origin = origin;\n this.cdr.markForCheck();\n this.onFocus(origin === 'keyboard');\n })\n );\n }\n\n ngOnDestroy(): void {\n this.focusMonitor.stopMonitoring(this.radioElement._inputElement.nativeElement);\n }\n\n //Click method\n clickRadio() {\n if (this.allowUnselect) {\n this.radioElement.checked = !this.radioElement.checked;\n this._selected = this.radioElement.checked;\n this.classMultiple = this.setClass();\n this.selected = this.radioElement.checked;\n this.changeRadio?.emit({\n optionName: this.radioElement.value as string,\n optionChecked: this.radioElement.checked,\n });\n } else {\n if (!this.hostNgControl) {\n this.selected = true;\n }\n this.changeRadio.emit({ optionName: this.radioElement.value as string, optionChecked: true });\n }\n if (this.disabled) {\n this._selected = false;\n this.changeRadio.emit({ optionName: '', optionChecked: false });\n }\n this.onChange(this._selected);\n }\n\n writeValue(value: unknown): void {\n if (typeof value === 'boolean' || value === this.value) {\n this.selected = value as boolean;\n }\n // The forms API calls this from outside the component's own change\n // detection — under OnPush the view must be marked explicitly.\n this.cdr.markForCheck();\n }\n\n registerOnChange(fn: (value: boolean) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouch = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.cdr.markForCheck();\n }\n\n onChange: (value: boolean) => void = () => {};\n\n /**\n * @ignore\n */\n onTouch = () => {};\n\n //Set class for multiple radio\n setClass(): string {\n if (this.multiple) {\n return this._selected ? 'multiple-checked' : 'multiple-unchecked';\n }\n return '';\n }\n\n onLabelEllipsisChange(isEllipsis: boolean): void {\n this.showTooltip = isEllipsis && !this.hideTooltipOnEllipsis;\n }\n\n private checkHost(): void {\n if (this.hostNgControl) {\n this.selected = this.value === this.hostNgControl.value;\n this.hostNgControl.valueChanges?.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(value => {\n this.selected = value === this.value;\n this.classMultiple = this.setClass();\n });\n }\n }\n\n private setCompanyColor(): void {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- empty companyColor falls back to the theme colour\n this.companyColor = this.companyColor\n ? this.companyColor\n : this.applicationTheme === 'classic'\n ? '#46A997'\n : '#D410AA';\n }\n\n onFocus(isFocus: boolean): void {\n setTimeout(() => {\n if (this.tooltipElement) {\n if (this.showTooltip && isFocus) {\n this.tooltipElement.show();\n } else {\n this.tooltipElement.hide();\n }\n }\n }, 0);\n }\n\n focus(): void {\n this.radioElement.focus();\n }\n}\n","<div\n #radioContainer\n tabindex=\"0\"\n [class]=\"multiple ? 'radio-container' : 'radio'\"\n [class.multiple-disabled]=\"disabled && multiple\"\n [class.media-card]=\"mediaCard\"\n [class.media-card-selected]=\"mediaCard && selected\"\n [ngClass]=\"classMultiple\"\n [attr.alignment]=\"alignment\"\n [attr.truncate-text]=\"truncateText\"\n [attr.theme]=\"applicationTheme\"\n [attr.hasError]=\"hasError\"\n (keydown.enter)=\"clickRadio(); radioContainer.focus()\"\n (keydown.space)=\"clickRadio(); radioContainer.focus()\"\n>\n @if (mediaCard) {\n <div class=\"media-card-wrapper\" aria-hidden=\"true\">\n <ng-content select=\"[radio-media]\"></ng-content>\n </div>\n }\n <mat-radio-button\n #radio\n [checked]=\"selected\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n [value]=\"value\"\n class=\"radio-button\"\n [required]=\"ariaRequired\"\n [aria-label]=\"ariaLabel\"\n [aria-labelledby]=\"ariaLabelledby ? ariaLabelledby : label\"\n [aria-describedby]=\"ariaDescribedby\"\n (keydown.enter)=\"$event.preventDefault()\"\n (keydown.space)=\"$event.preventDefault()\"\n [tabIndex]=\"tabIndex\"\n >\n @if (label) {\n <span\n #tooltip=\"matTooltip\"\n class=\"label\"\n uiEllipseText\n (onChangeTextState)=\"onLabelEllipsisChange($event)\"\n [matTooltip]=\"showTooltip ? label : ''\"\n [matTooltipClass]=\"applicationTheme\"\n >{{ label }}</span\n >\n }\n <ng-content select=\"[radio-label]\"></ng-content>\n </mat-radio-button>\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatRadioModule } from '@angular/material/radio';\nimport { MatTooltipModule } from '@angular/material/tooltip';\n\nimport { FocusVisibleDirective } from '@testgorilla/tgo-ui/components/checkbox';\nimport { EllipseTextDirective } from '@testgorilla/tgo-ui/components/core';\n\nimport { RadioButtonComponent } from './radio-button.component';\n\n@NgModule({\n imports: [\n CommonModule,\n MatRadioModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule,\n EllipseTextDirective,\n MatTooltipModule,\n MatCheckboxModule,\n FocusVisibleDirective,\n RadioButtonComponent,\n ],\n exports: [RadioButtonComponent],\n})\nexport class RadioButtonComponentModule {}\n"],"mappings":";;;;;;;;;;;;AAkDA,IAAa,uBAAb,MAAa,qBAAoB;CAI/B,YAAY,OAAiB;EAC3B,IAAI,KAAK,oBACP;EAEF,MAAM,SAAS,MAAM;EACrB,MAAM,gBAAwB,QAAQ,WAAW,SAAS;EAC1D,MAAM,gBAAgB,KAAK,aAAa,QAAQ,UAAU,qBAAqB;EAC/E,IAAI,cAAc,SAAS,sBAAsB,KAAK,cAAc,SAAS,gBAAgB,KAAK,eAAe;GAC/G,KAAK,qBAAqB;GAC1B,KAAK,aAAa,cAAc,cAAc,MAAK;GACnD,KAAK,qBAAqB;EAC5B;CACF;CAoBA,IACI,WAAQ;EACV,OAAO,KAAK;CACd;CACA,IAAI,SAAS,UAAiB;EAC5B,KAAK,YAAY;CACnB;CAkLA,cAAA;EA3NQ,KAAA,qBAAqB;EAuBpB,KAAA,WAAW;EAWpB,KAAA,YAAY;EAgBH,KAAA,gBAAgB;EAWzB,KAAA,eAA8B;EAQrB,KAAA,OAAO;EAQP,KAAA,QAAQ;EASR,KAAA,WAAW;EAUX,KAAA,YAAY;EAkBZ,KAAA,mBAAqC;EAUrC,KAAA,SAAwB;EAQxB,KAAA,e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A;GACD;GACD,SAAS,CAAC,oBAAoB;EAC/B,CAAA"}
|
|
1
|
+
{"version":3,"file":"testgorilla-tgo-ui-components-radio-button.mjs","names":[],"sources":["../../../components/radio-button/radio-button.component.ts","../../../components/radio-button/radio-button.component.html","../../../components/radio-button/radio-button.component.module.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { NgClass } from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n DestroyRef,\n EventEmitter,\n HostBinding,\n HostListener,\n inject,\n Input,\n NgZone,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n ProviderToken,\n SimpleChanges,\n ViewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ControlValueAccessor, NgControl } from '@angular/forms';\nimport { MatRadioButton } from '@angular/material/radio';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nimport { ApplicationTheme, Alignment, EllipseTextDirective } from '@testgorilla/tgo-ui/components/core';\n\nimport { RadioButtonEventType } from './radio-button.model';\n\n@Component({\n selector: 'ui-radio-button',\n templateUrl: './radio-button.component.html',\n styleUrls: ['./radio-button.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n // Needs to be removed since it causes some a11y issues (https://github.com/angular/components/issues/21266).\n '[attr.tabindex]': 'null',\n '[attr.aria-label]': 'null',\n '[attr.aria-labelledby]': 'null',\n '[attr.aria-describedby]': 'null',\n // Note: under normal conditions focus shouldn't land on this element, however it may be\n // programmatically set, for example inside of a focus trap, in this case we want to forward\n // the focus to the mat-radio-button element.\n '(focus)': 'radioElement.focus()',\n },\n imports: [NgClass, MatRadioButton, EllipseTextDirective, MatTooltip],\n})\nexport class RadioButtonComponent implements OnInit, OnChanges, ControlValueAccessor, AfterViewInit, OnDestroy {\n private _isProcessingClick = false;\n\n @HostListener('click', ['$event'])\n onHostClick(event: MouseEvent): void {\n if (this._isProcessingClick) {\n return;\n }\n const target = event.target as HTMLElement | null;\n const targetClasses: string = target?.classList?.value ?? '';\n const fromMediaArea = this.mediaCard && target?.closest?.('.media-card-wrapper');\n if (targetClasses.includes('mat-mdc-radio-button') || targetClasses.includes('mdc-form-field') || fromMediaArea) {\n this._isProcessingClick = true;\n this.radioElement._inputElement.nativeElement.click();\n this._isProcessingClick = false;\n }\n }\n /**\n * Determines whether the radio button is disabled.\n * Default: false.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() disabled = false;\n\n /**\n * Determines whether the radio button is checked.\n * Default: false.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n //@Input() selected = false;\n\n _selected = false;\n @Input()\n get selected() {\n return this._selected;\n }\n set selected(selected: boolean) {\n this._selected = selected;\n }\n\n /**\n * Determines whether the radio button can be unchecked.\n * Default: false.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() allowUnselect = false;\n\n /**\n * Determines the radio button color.\n * Default: Test Gorilla primary color.\n *\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @HostBinding('style.--color')\n @Input()\n companyColor: string | null = null;\n\n /**\n * Used to group radios for unique selection.\n *\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() name = '';\n\n /**\n * Text content will be applied to the input element if present.\n *\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() label = '';\n\n /**\n * Determines whether the radio button is a multiple choice cell.\n * Default: false\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() multiple = false;\n\n /**\n * Renders the radio button as a media card. The image/video/gif passed via\n * the `[radio-media]` content slot fills the card and the radio + label sit\n * on top, in the bottom-left, with a dark scrim for contrast.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() mediaCard = false;\n\n /**\n * Determines value of the radio button.\n * Default: false\n *\n * @type {any}\n * @memberof RadioButtonComponent\n */\n @Input() value: unknown;\n\n /**\n *\n * Defines the application theme\n *\n * @type {ApplicationTheme}\n * @memberof RadioButtonComponent\n */\n @Input() applicationTheme: ApplicationTheme = 'light';\n\n /**\n * A string representing the ARIA label for accessibility.\n * This label is used to provide an accessible name for the input element.\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() ariaLabel: string;\n\n @Input() testId: string | null = null;\n\n /**\n * A string representing the ARIA requirement for accessibility.\n * This attribute is used to indicate whether an input field is required for form submission.\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() ariaRequired = false;\n\n /**\n * Defines if checkbox has error\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() hasError = false;\n\n /**\n * A string representing the ARIA requirement for accessibility.\n * This attribute is used to indicate whether an input field is required for form submission.\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() ariaLabelledby = '';\n\n /**\n * A string representing the ARIA requirement for accessibility.\n * This attribute is used to indicate whether an input field is required for form submission.\n * @type {string}\n * @memberof RadioButtonComponent\n */\n @Input() ariaDescribedby = '';\n\n /**\n * Truncate text if it is too long\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() truncateText = false;\n\n /**\n * Text alignment\n * @type {'center' | 'top'}\n * @memberof RadioButtonComponent\n */\n @Input() alignment: Alignment = 'center';\n\n /**\n * Sets the tab index for the checkbox component.\n * This determines the order in which elements receive focus when the user navigates through them using the Tab key.\n * Default value is 0.\n *\n * @type {number}\n * @memberof RadioButtonComponent\n */\n @Input() tabIndex = 0;\n\n /**\n * Show tooltip when label is truncated\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Input() hideTooltipOnEllipsis = false;\n\n /**\n * Event emitted when the checked state of the radio button changes.\n *\n * @type {boolean}\n * @memberof RadioButtonComponent\n */\n @Output() changeRadio = new EventEmitter<RadioButtonEventType>();\n\n classMultiple: string;\n showTooltip = false;\n protected origin: string | null = null;\n\n @ViewChild('radio') radioElement: MatRadioButton;\n\n private appliedTestId: string | null = null;\n @ViewChild('tooltip') tooltipElement: MatTooltip;\n\n private readonly defaultAppTheme = inject(\n 'CANOPYUI_DEFAULT_APPLICATION_THEME' as unknown as ProviderToken<ApplicationTheme>,\n {\n optional: true,\n }\n );\n public ngControl = inject(NgControl, { optional: true, self: true });\n public hostNgControl = inject(NgControl, { optional: true, host: true });\n private readonly destroyRef = inject(DestroyRef);\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly ngZone = inject(NgZone);\n private readonly cdr = inject(ChangeDetectorRef);\n\n constructor() {\n if (this.defaultAppTheme) {\n this.applicationTheme = this.defaultAppTheme;\n }\n\n if (this.ngControl !== null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n ngOnInit() {\n this.checkHost();\n this.classMultiple = this.setClass();\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes['selected']) {\n this.classMultiple = this.setClass();\n }\n this.setCompanyColor();\n this.applyTestId();\n }\n\n // MatRadioButton takes no attribute passthrough, so the id is set on the native input directly.\n private applyTestId(): void {\n if (!this.radioElement || this.testId === this.appliedTestId) {\n return;\n }\n const radioNativeInput = this.radioElement._inputElement.nativeElement;\n if (this.testId) {\n radioNativeInput.setAttribute('data-testid', this.testId);\n } else {\n radioNativeInput.removeAttribute('data-testid');\n }\n this.appliedTestId = this.testId;\n }\n\n ngAfterViewInit() {\n this.radioElement._inputElement.nativeElement.setAttribute('role', 'radio');\n this.applyTestId();\n this.radioElement._inputElement.nativeElement.onclick = () => {\n this.clickRadio();\n };\n\n this.focusMonitor\n .monitor(this.radioElement._inputElement.nativeElement)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(origin =>\n this.ngZone.run(() => {\n this.origin = origin;\n this.cdr.markForCheck();\n this.onFocus(origin === 'keyboard');\n })\n );\n }\n\n ngOnDestroy(): void {\n this.focusMonitor.stopMonitoring(this.radioElement._inputElement.nativeElement);\n }\n\n //Click method\n clickRadio() {\n if (this.allowUnselect) {\n this.radioElement.checked = !this.radioElement.checked;\n this._selected = this.radioElement.checked;\n this.classMultiple = this.setClass();\n this.selected = this.radioElement.checked;\n this.changeRadio?.emit({\n optionName: this.radioElement.value as string,\n optionChecked: this.radioElement.checked,\n });\n } else {\n if (!this.hostNgControl) {\n this.selected = true;\n }\n this.changeRadio.emit({ optionName: this.radioElement.value as string, optionChecked: true });\n }\n if (this.disabled) {\n this._selected = false;\n this.changeRadio.emit({ optionName: '', optionChecked: false });\n }\n this.onChange(this._selected);\n }\n\n writeValue(value: unknown): void {\n if (typeof value === 'boolean' || value === this.value) {\n this.selected = value as boolean;\n }\n // The forms API calls this from outside the component's own change\n // detection — under OnPush the view must be marked explicitly.\n this.cdr.markForCheck();\n }\n\n registerOnChange(fn: (value: boolean) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouch = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n this.cdr.markForCheck();\n }\n\n onChange: (value: boolean) => void = () => {};\n\n /**\n * @ignore\n */\n onTouch = () => {};\n\n //Set class for multiple radio\n setClass(): string {\n if (this.multiple) {\n return this._selected ? 'multiple-checked' : 'multiple-unchecked';\n }\n return '';\n }\n\n onLabelEllipsisChange(isEllipsis: boolean): void {\n this.showTooltip = isEllipsis && !this.hideTooltipOnEllipsis;\n }\n\n // A radio without a `value` matches nothing: an unset model (`undefined` from a template `a?.b`\n // binding since Angular 22, `null` before) must not select it.\n private matchesControlValue(controlValue: unknown): boolean {\n return this.value !== undefined && controlValue === this.value;\n }\n\n private checkHost(): void {\n if (this.hostNgControl) {\n this.selected = this.matchesControlValue(this.hostNgControl.value);\n this.hostNgControl.valueChanges?.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(value => {\n this.selected = this.matchesControlValue(value);\n this.classMultiple = this.setClass();\n });\n }\n }\n\n private setCompanyColor(): void {\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- empty companyColor falls back to the theme colour\n this.companyColor = this.companyColor\n ? this.companyColor\n : this.applicationTheme === 'classic'\n ? '#46A997'\n : '#D410AA';\n }\n\n onFocus(isFocus: boolean): void {\n setTimeout(() => {\n if (this.tooltipElement) {\n if (this.showTooltip && isFocus) {\n this.tooltipElement.show();\n } else {\n this.tooltipElement.hide();\n }\n }\n }, 0);\n }\n\n focus(): void {\n this.radioElement.focus();\n }\n}\n","<div\n #radioContainer\n tabindex=\"0\"\n [class]=\"multiple ? 'radio-container' : 'radio'\"\n [class.multiple-disabled]=\"disabled && multiple\"\n [class.media-card]=\"mediaCard\"\n [class.media-card-selected]=\"mediaCard && selected\"\n [ngClass]=\"classMultiple\"\n [attr.alignment]=\"alignment\"\n [attr.truncate-text]=\"truncateText\"\n [attr.theme]=\"applicationTheme\"\n [attr.hasError]=\"hasError\"\n (keydown.enter)=\"clickRadio(); radioContainer.focus()\"\n (keydown.space)=\"clickRadio(); radioContainer.focus()\"\n>\n @if (mediaCard) {\n <div class=\"media-card-wrapper\" aria-hidden=\"true\">\n <ng-content select=\"[radio-media]\"></ng-content>\n </div>\n }\n <mat-radio-button\n #radio\n [checked]=\"selected\"\n [disabled]=\"disabled\"\n [name]=\"name\"\n [value]=\"value\"\n class=\"radio-button\"\n [required]=\"ariaRequired\"\n [aria-label]=\"ariaLabel\"\n [aria-labelledby]=\"ariaLabelledby ? ariaLabelledby : label\"\n [aria-describedby]=\"ariaDescribedby\"\n (keydown.enter)=\"$event.preventDefault()\"\n (keydown.space)=\"$event.preventDefault()\"\n [tabIndex]=\"tabIndex\"\n >\n @if (label) {\n <span\n #tooltip=\"matTooltip\"\n class=\"label\"\n uiEllipseText\n (onChangeTextState)=\"onLabelEllipsisChange($event)\"\n [matTooltip]=\"showTooltip ? label : ''\"\n [matTooltipClass]=\"applicationTheme\"\n >{{ label }}</span\n >\n }\n <ng-content select=\"[radio-label]\"></ng-content>\n </mat-radio-button>\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { MatCheckboxModule } from '@angular/material/checkbox';\nimport { MatInputModule } from '@angular/material/input';\nimport { MatRadioModule } from '@angular/material/radio';\nimport { MatTooltipModule } from '@angular/material/tooltip';\n\nimport { FocusVisibleDirective } from '@testgorilla/tgo-ui/components/checkbox';\nimport { EllipseTextDirective } from '@testgorilla/tgo-ui/components/core';\n\nimport { RadioButtonComponent } from './radio-button.component';\n\n@NgModule({\n imports: [\n CommonModule,\n MatRadioModule,\n FormsModule,\n ReactiveFormsModule,\n MatInputModule,\n EllipseTextDirective,\n MatTooltipModule,\n MatCheckboxModule,\n FocusVisibleDirective,\n RadioButtonComponent,\n ],\n exports: [RadioButtonComponent],\n})\nexport class RadioButtonComponentModule {}\n"],"mappings":";;;;;;;;;;;;AAkDA,IAAa,uBAAb,MAAa,qBAAoB;CAI/B,YAAY,OAAiB;EAC3B,IAAI,KAAK,oBACP;EAEF,MAAM,SAAS,MAAM;EACrB,MAAM,gBAAwB,QAAQ,WAAW,SAAS;EAC1D,MAAM,gBAAgB,KAAK,aAAa,QAAQ,UAAU,qBAAqB;EAC/E,IAAI,cAAc,SAAS,sBAAsB,KAAK,cAAc,SAAS,gBAAgB,KAAK,eAAe;GAC/G,KAAK,qBAAqB;GAC1B,KAAK,aAAa,cAAc,cAAc,MAAK;GACnD,KAAK,qBAAqB;EAC5B;CACF;CAoBA,IACI,WAAQ;EACV,OAAO,KAAK;CACd;CACA,IAAI,SAAS,UAAiB;EAC5B,KAAK,YAAY;CACnB;CAkLA,cAAA;EA3NQ,KAAA,qBAAqB;EAuBpB,KAAA,WAAW;EAWpB,KAAA,YAAY;EAgBH,KAAA,gBAAgB;EAWzB,KAAA,eAA8B;EAQrB,KAAA,OAAO;EAQP,KAAA,QAAQ;EASR,KAAA,WAAW;EAUX,KAAA,YAAY;EAkBZ,KAAA,mBAAqC;EAUrC,KAAA,SAAwB;EAQxB,KAAA,eAAe;EAQf,KAAA,WAAW;EAQX,KAAA,iBAAiB;EAQjB,KAAA,kBAAkB;EAOlB,KAAA,eAAe;EAOf,KAAA,YAAuB;EAUvB,KAAA,W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BAAoB;EAC/B,CAAA"}
|
|
@@ -157,12 +157,15 @@ var ScaleTableComponent = class ScaleTableComponent {
|
|
|
157
157
|
"ariaExpanded",
|
|
158
158
|
"ariaControls",
|
|
159
159
|
"ariaPressed",
|
|
160
|
+
"ariaHasPopup",
|
|
160
161
|
"ariaRequired",
|
|
161
162
|
"ariaLabelledby",
|
|
162
163
|
"ariaDescribedby",
|
|
163
164
|
"preventDefault",
|
|
164
165
|
"hasBackground",
|
|
165
166
|
"circular",
|
|
167
|
+
"isSingleLineLabel",
|
|
168
|
+
"iconButtonShape",
|
|
166
169
|
"tooltipPosition",
|
|
167
170
|
"role",
|
|
168
171
|
"iconFilled",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testgorilla-tgo-ui-components-scale-table.mjs","names":[],"sources":["../../../components/scale-table/scale-table.component.ts","../../../components/scale-table/scale-table.component.html"],"sourcesContent":["import { AsyncPipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, input, model, output } from '@angular/core';\n\nimport { ButtonComponentModule } from '@testgorilla/tgo-ui/components/button';\nimport { ApplicationTheme, UiTranslatePipe } from '@testgorilla/tgo-ui/components/core';\nimport { IconComponentModule } from '@testgorilla/tgo-ui/components/icon';\nimport { ScaleComponentModule } from '@testgorilla/tgo-ui/components/scale';\n\nimport { ScaleItem } from './scale-table.model';\n\n@Component({\n selector: 'ui-scale-table',\n templateUrl: './scale-table.component.html',\n styleUrls: ['./scale-table.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [UiTranslatePipe, ScaleComponentModule, AsyncPipe, IconComponentModule, ButtonComponentModule],\n host: {\n '[style.--scale-count]': 'scaleCount()',\n },\n})\nexport class ScaleTableComponent {\n /**\n *\n * Defines the application theme\n *\n * @type {ApplicationTheme}\n * @memberof ScaleTableComponent\n */\n public applicationTheme = input<ApplicationTheme>('light');\n\n /**\n *\n * Defines items with their text and it's values\n *\n * @type {ScaleTable}\n * @memberof ScaleTableComponent\n */\n public scaleItems = model.required<ScaleItem[]>();\n\n /**\n *\n * Defines description of scales\n *\n * @type {string[]}\n * @memberof ScaleTableComponent\n */\n public labels = input.required<string[]>();\n public hideBetterExperience = model(false);\n public scaleItemChange = output<{\n item: ScaleItem;\n label: string;\n }>();\n scaleCount = computed(() => this.labels().length);\n\n protected readonly translationContext = 'SCALE_TABLE.';\n\n public select(scaleItemIndex: number, scaleIndex: number): void {\n this.scaleItems.update(items => {\n items[scaleItemIndex].value = scaleIndex;\n this.scaleItemChange.emit({\n item: items[scaleItemIndex],\n label: this.labels()[scaleIndex],\n });\n return [...items];\n });\n }\n}\n","<div class=\"scale-table\">\n <div class=\"better-experience\" [class.hide]=\"hideBetterExperience()\">\n <ui-icon [size]=\"'24'\" [name]=\"'Device-rotate-in-line'\" class=\"mobile-landscape-icon\" />\n <p>{{ 'SCALE_TABLE.ROTATE_DEVICE' | uiTranslate | async }}</p>\n <ui-button\n iconName=\"Close\"\n variant=\"icon-button\"\n size=\"small\"\n [justIcon]=\"true\"\n [tooltip]=\"('COMMON.CLOSE' | uiTranslate | async)!\"\n (click)=\"hideBetterExperience.set(true)\"\n />\n </div>\n <!-- Header -->\n <div tabindex=\"0\" [attr.aria-label]=\"'scale header'\" class=\"scale-table-header\">\n @for (label of labels(); track $index) {\n <div\n tabindex=\"0\"\n role=\"heading\"\n [attr.aria-level]=\"3\"\n [attr.aria-label]=\"label + ' as ' + ($index + 1)\"\n class=\"scale-size\"\n >\n {{ label }}\n </div>\n }\n </div>\n <!-- Scale Items -->\n @for (scale of scaleItems(); track scale.text) {\n <div class=\"scale-table-row\" tabindex=\"0\" role=\"radiogroup\" [attr.aria-label]=\"scale.text\">\n <div class=\"scale-text\">{{ scale.text }}</div>\n <ui-scale\n [selectedIndex]=\"scale.value ?? null\"\n [length]=\"scale.length ?? labels().length\"\n [applicationTheme]=\"applicationTheme()\"\n (selectedIndexChange)=\"select($index, $event)\"\n />\n </div>\n }\n</div>\n"],"mappings":";;;;;;;;;;AA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A;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EAV/B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAgB,iBAGT,wBAAwB;GAAM,SACtC;IAAC;IAAiB;IAAsB;IAAW;IAAqB;GAAqB;GAAC,MACjG,EACJ,yBAAyB,eAC1B;GAAA,UAAA;GAAA,QAAA,CAAA,ooIAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"testgorilla-tgo-ui-components-scale-table.mjs","names":[],"sources":["../../../components/scale-table/scale-table.component.ts","../../../components/scale-table/scale-table.component.html"],"sourcesContent":["import { AsyncPipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, computed, input, model, output } from '@angular/core';\n\nimport { ButtonComponentModule } from '@testgorilla/tgo-ui/components/button';\nimport { ApplicationTheme, UiTranslatePipe } from '@testgorilla/tgo-ui/components/core';\nimport { IconComponentModule } from '@testgorilla/tgo-ui/components/icon';\nimport { ScaleComponentModule } from '@testgorilla/tgo-ui/components/scale';\n\nimport { ScaleItem } from './scale-table.model';\n\n@Component({\n selector: 'ui-scale-table',\n templateUrl: './scale-table.component.html',\n styleUrls: ['./scale-table.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [UiTranslatePipe, ScaleComponentModule, AsyncPipe, IconComponentModule, ButtonComponentModule],\n host: {\n '[style.--scale-count]': 'scaleCount()',\n },\n})\nexport class ScaleTableComponent {\n /**\n *\n * Defines the application theme\n *\n * @type {ApplicationTheme}\n * @memberof ScaleTableComponent\n */\n public applicationTheme = input<ApplicationTheme>('light');\n\n /**\n *\n * Defines items with their text and it's values\n *\n * @type {ScaleTable}\n * @memberof ScaleTableComponent\n */\n public scaleItems = model.required<ScaleItem[]>();\n\n /**\n *\n * Defines description of scales\n *\n * @type {string[]}\n * @memberof ScaleTableComponent\n */\n public labels = input.required<string[]>();\n public hideBetterExperience = model(false);\n public scaleItemChange = output<{\n item: ScaleItem;\n label: string;\n }>();\n scaleCount = computed(() => this.labels().length);\n\n protected readonly translationContext = 'SCALE_TABLE.';\n\n public select(scaleItemIndex: number, scaleIndex: number): void {\n this.scaleItems.update(items => {\n items[scaleItemIndex].value = scaleIndex;\n this.scaleItemChange.emit({\n item: items[scaleItemIndex],\n label: this.labels()[scaleIndex],\n });\n return [...items];\n });\n }\n}\n","<div class=\"scale-table\">\n <div class=\"better-experience\" [class.hide]=\"hideBetterExperience()\">\n <ui-icon [size]=\"'24'\" [name]=\"'Device-rotate-in-line'\" class=\"mobile-landscape-icon\" />\n <p>{{ 'SCALE_TABLE.ROTATE_DEVICE' | uiTranslate | async }}</p>\n <ui-button\n iconName=\"Close\"\n variant=\"icon-button\"\n size=\"small\"\n [justIcon]=\"true\"\n [tooltip]=\"('COMMON.CLOSE' | uiTranslate | async)!\"\n (click)=\"hideBetterExperience.set(true)\"\n />\n </div>\n <!-- Header -->\n <div tabindex=\"0\" [attr.aria-label]=\"'scale header'\" class=\"scale-table-header\">\n @for (label of labels(); track $index) {\n <div\n tabindex=\"0\"\n role=\"heading\"\n [attr.aria-level]=\"3\"\n [attr.aria-label]=\"label + ' as ' + ($index + 1)\"\n class=\"scale-size\"\n >\n {{ label }}\n </div>\n }\n </div>\n <!-- Scale Items -->\n @for (scale of scaleItems(); track scale.text) {\n <div class=\"scale-table-row\" tabindex=\"0\" role=\"radiogroup\" [attr.aria-label]=\"scale.text\">\n <div class=\"scale-text\">{{ scale.text }}</div>\n <ui-scale\n [selectedIndex]=\"scale.value ?? null\"\n [length]=\"scale.length ?? labels().length\"\n [applicationTheme]=\"applicationTheme()\"\n (selectedIndexChange)=\"select($index, $event)\"\n />\n </div>\n }\n</div>\n"],"mappings":";;;;;;;;;;AAoBA,IAAa,sBAAb,MAAa,oBAAmB;CAVhC,cAAA;EAkBS,KAAA,mBAAmB,MAAwB,SAAQ,GAAA,YAAA,CAAA,EAAA,WAAA,mBAAA,CAAA,+BAAA,CAAA,CAAA;EASnD,KAAA,aAAa,MAAM,SAAuB,GA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;IAAqB;GAAqB;GAAC,MACjG,EACJ,yBAAyB,eAC1B;GAAA,UAAA;GAAA,QAAA,CAAA,ooIAAA;EAAA,CAAA"}
|
|
@@ -89,7 +89,11 @@ var ScaleComponent = class ScaleComponent {
|
|
|
89
89
|
isStandalone: true,
|
|
90
90
|
selector: "ui-scale",
|
|
91
91
|
inputs: {
|
|
92
|
-
selectedIndex:
|
|
92
|
+
selectedIndex: [
|
|
93
|
+
"selectedIndex",
|
|
94
|
+
"selectedIndex",
|
|
95
|
+
(value) => value ?? null
|
|
96
|
+
],
|
|
93
97
|
length: "length",
|
|
94
98
|
applicationTheme: "applicationTheme",
|
|
95
99
|
companyColor: "companyColor",
|
|
@@ -148,7 +152,10 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
148
152
|
type: ViewChildren,
|
|
149
153
|
args: ["scaleItem"]
|
|
150
154
|
}],
|
|
151
|
-
selectedIndex: [{
|
|
155
|
+
selectedIndex: [{
|
|
156
|
+
type: Input,
|
|
157
|
+
args: [{ transform: (value) => value ?? null }]
|
|
158
|
+
}],
|
|
152
159
|
length: [{ type: Input }],
|
|
153
160
|
applicationTheme: [{ type: Input }],
|
|
154
161
|
companyColor: [{ type: Input }],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testgorilla-tgo-ui-components-scale.mjs","names":[],"sources":["../../../components/scale/scale.component.ts","../../../components/scale/scale.component.html","../../../components/scale/scale.component.module.ts"],"sourcesContent":["import { NgStyle, NgClass } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n OnChanges,\n OnInit,\n Optional,\n Output,\n QueryList,\n signal,\n SimpleChanges,\n ViewChildren,\n} from '@angular/core';\n\nimport { ApplicationTheme, hexToRgbWithAlpha } from '@testgorilla/tgo-ui/components/core';\n\n@Component({\n selector: 'ui-scale',\n templateUrl: './scale.component.html',\n styleUrls: ['./scale.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgStyle, NgClass],\n})\nexport class ScaleComponent implements OnInit, OnChanges {\n private readonly MIN_LENGTH = 1;\n private readonly DEFAULT_LENGTH = 5;\n protected items: number[] = [];\n\n @ViewChildren('scaleItem') scaleItems!: QueryList<ElementRef<HTMLElement>>;\n\n /**\n * The value representing the selected item of the scale.\n * @type {number}\n * @memberof ScaleComponent\n */\n @Input() selectedIndex: number | null = null;\n\n /**\n * The max number of items in the scale.\n * @type {number}\n * @memberof ScaleComponent\n */\n @Input() set length(length: number) {\n this.items = Array(Math.max(length, this.MIN_LENGTH))\n .fill(0)\n .map((_, i) => i);\n }\n\n /**\n *\n * Defines the application theme\n *\n * @type {ApplicationTheme}\n * @memberof ScaleComponent\n */\n @Input() applicationTheme: ApplicationTheme = 'light';\n\n /**\n * Color of the option hover.\n * Defaults to Test Gorilla primary color.\n *\n * @type {string}\n * @memberof ScaleComponent\n */\n @Input() companyColor = '';\n\n @Input() testId: string | null = null;\n\n @Input() ariaLabel = '';\n\n itemTestId(item: number): string | null {\n return this.testId ? `${this.testId}-${item + 1}` : null;\n }\n\n @Output() selectedIndexChange = new EventEmitter<number>();\n\n styles = signal({ '--hover-color': '#FFB3EE', '--selected-color': '#D410AA' });\n\n constructor(\n @Optional() @Inject('CANOPYUI_DEFAULT_APPLICATION_THEME') private readonly defaultAppTheme: ApplicationTheme\n ) {\n if (defaultAppTheme) {\n this.applicationTheme = defaultAppTheme;\n }\n this.length = this.DEFAULT_LENGTH;\n }\n\n ngOnInit() {\n if (this.companyColor) {\n this.setCompanyColor();\n }\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes['companyColor']) {\n this.setCompanyColor();\n }\n }\n\n protected select(index: number): void {\n this.selectedIndex = index;\n this.selectedIndexChange.emit(this.selectedIndex);\n }\n\n onKeyDown(event: KeyboardEvent, index: number) {\n this.selectedIndex ??= 0;\n if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {\n // Move to the next item (wrap around)\n this.select((index + 1) % this.items.length);\n this.focusItem(this.selectedIndex);\n } else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {\n // Move to the previous item (wrap around)\n this.select((index - 1 + this.items.length) % this.items.length);\n this.focusItem(this.selectedIndex);\n } else if (event.key === ' ' || event.key === 'Enter') {\n // Select the current item\n this.select(index);\n this.focusItem(this.selectedIndex);\n }\n }\n\n focusItem(index: number) {\n const element = this.scaleItems?.toArray()[index]?.nativeElement;\n if (element) {\n element.focus();\n }\n }\n\n getAriaLabel(index: number): string {\n if (index === 0) {\n return '1 - Not at all important';\n } else if (index === 4) {\n return '5 - Very important';\n }\n return '';\n }\n\n private setCompanyColor(): void {\n const styles = this.styles();\n styles['--hover-color'] = hexToRgbWithAlpha(this.companyColor);\n styles['--selected-color'] = this.companyColor;\n this.styles.set(styles);\n }\n\n onFocus(item: number): void {\n // If no item is selected when the component receives focus, select the first item\n if (this.selectedIndex === null && item === 0) {\n this.select(0);\n }\n }\n}\n","<div\n [style.--scale-count]=\"items.length\"\n class=\"scale\"\n [ngStyle]=\"styles()\"\n [ngClass]=\"{ 'scale-classic': applicationTheme === 'classic' }\"\n [attr.data-testid]=\"testId\"\n [attr.aria-label]=\"ariaLabel || null\"\n role=\"radiogroup\"\n>\n @for (item of items; track item) {\n <div\n class=\"scale-item\"\n (click)=\"select(item)\"\n #scaleItem\n role=\"radio\"\n (keydown)=\"onKeyDown($event, item)\"\n (focus)=\"onFocus(item)\"\n [class.scale-item-focus-prev]=\"selectedIndex && selectedIndex > 0 ? item === selectedIndex - 1 : false\"\n [attr.tabindex]=\"selectedIndex === null ? (item === 0 ? '0' : '-1') : item === selectedIndex ? '0' : '-1'\"\n [attr.aria-checked]=\"\n selectedIndex === null ? (item === 0 ? 'true' : 'false') : item === selectedIndex ? 'true' : 'false'\n \"\n [attr.aria-label]=\"getAriaLabel(item)\"\n [ngClass]=\"{ 'scale-item-selected': item === selectedIndex }\"\n [attr.data-testid]=\"itemTestId(item)\"\n >\n {{ item + 1 }}\n </div>\n }\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { ScaleComponent } from './scale.component';\n\n@NgModule({\n imports: [CommonModule, ScaleComponent],\n exports: [ScaleComponent],\n})\nexport class ScaleComponentModule {}\n"],"mappings":";;;;AA2BA,IAAa,iBAAb,MAAa,eAAc;
|
|
1
|
+
{"version":3,"file":"testgorilla-tgo-ui-components-scale.mjs","names":[],"sources":["../../../components/scale/scale.component.ts","../../../components/scale/scale.component.html","../../../components/scale/scale.component.module.ts"],"sourcesContent":["import { NgStyle, NgClass } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n OnChanges,\n OnInit,\n Optional,\n Output,\n QueryList,\n signal,\n SimpleChanges,\n ViewChildren,\n} from '@angular/core';\n\nimport { ApplicationTheme, hexToRgbWithAlpha } from '@testgorilla/tgo-ui/components/core';\n\n@Component({\n selector: 'ui-scale',\n templateUrl: './scale.component.html',\n styleUrls: ['./scale.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgStyle, NgClass],\n})\nexport class ScaleComponent implements OnInit, OnChanges {\n private readonly MIN_LENGTH = 1;\n private readonly DEFAULT_LENGTH = 5;\n protected items: number[] = [];\n\n @ViewChildren('scaleItem') scaleItems!: QueryList<ElementRef<HTMLElement>>;\n\n /**\n * The value representing the selected item of the scale.\n * @type {number}\n * @memberof ScaleComponent\n */\n // A template `a?.b` binding yields `undefined` since Angular 22 (it was `null`). Both mean \"nothing selected\".\n @Input({ transform: (value: number | null | undefined): number | null => value ?? null })\n selectedIndex: number | null = null;\n\n /**\n * The max number of items in the scale.\n * @type {number}\n * @memberof ScaleComponent\n */\n @Input() set length(length: number) {\n this.items = Array(Math.max(length, this.MIN_LENGTH))\n .fill(0)\n .map((_, i) => i);\n }\n\n /**\n *\n * Defines the application theme\n *\n * @type {ApplicationTheme}\n * @memberof ScaleComponent\n */\n @Input() applicationTheme: ApplicationTheme = 'light';\n\n /**\n * Color of the option hover.\n * Defaults to Test Gorilla primary color.\n *\n * @type {string}\n * @memberof ScaleComponent\n */\n @Input() companyColor = '';\n\n @Input() testId: string | null = null;\n\n @Input() ariaLabel = '';\n\n itemTestId(item: number): string | null {\n return this.testId ? `${this.testId}-${item + 1}` : null;\n }\n\n @Output() selectedIndexChange = new EventEmitter<number>();\n\n styles = signal({ '--hover-color': '#FFB3EE', '--selected-color': '#D410AA' });\n\n constructor(\n @Optional() @Inject('CANOPYUI_DEFAULT_APPLICATION_THEME') private readonly defaultAppTheme: ApplicationTheme\n ) {\n if (defaultAppTheme) {\n this.applicationTheme = defaultAppTheme;\n }\n this.length = this.DEFAULT_LENGTH;\n }\n\n ngOnInit() {\n if (this.companyColor) {\n this.setCompanyColor();\n }\n }\n\n ngOnChanges(changes: SimpleChanges) {\n if (changes['companyColor']) {\n this.setCompanyColor();\n }\n }\n\n protected select(index: number): void {\n this.selectedIndex = index;\n this.selectedIndexChange.emit(this.selectedIndex);\n }\n\n onKeyDown(event: KeyboardEvent, index: number) {\n this.selectedIndex ??= 0;\n if (event.key === 'ArrowRight' || event.key === 'ArrowDown') {\n // Move to the next item (wrap around)\n this.select((index + 1) % this.items.length);\n this.focusItem(this.selectedIndex);\n } else if (event.key === 'ArrowLeft' || event.key === 'ArrowUp') {\n // Move to the previous item (wrap around)\n this.select((index - 1 + this.items.length) % this.items.length);\n this.focusItem(this.selectedIndex);\n } else if (event.key === ' ' || event.key === 'Enter') {\n // Select the current item\n this.select(index);\n this.focusItem(this.selectedIndex);\n }\n }\n\n focusItem(index: number) {\n const element = this.scaleItems?.toArray()[index]?.nativeElement;\n if (element) {\n element.focus();\n }\n }\n\n getAriaLabel(index: number): string {\n if (index === 0) {\n return '1 - Not at all important';\n } else if (index === 4) {\n return '5 - Very important';\n }\n return '';\n }\n\n private setCompanyColor(): void {\n const styles = this.styles();\n styles['--hover-color'] = hexToRgbWithAlpha(this.companyColor);\n styles['--selected-color'] = this.companyColor;\n this.styles.set(styles);\n }\n\n onFocus(item: number): void {\n // If no item is selected when the component receives focus, select the first item\n if (this.selectedIndex === null && item === 0) {\n this.select(0);\n }\n }\n}\n","<div\n [style.--scale-count]=\"items.length\"\n class=\"scale\"\n [ngStyle]=\"styles()\"\n [ngClass]=\"{ 'scale-classic': applicationTheme === 'classic' }\"\n [attr.data-testid]=\"testId\"\n [attr.aria-label]=\"ariaLabel || null\"\n role=\"radiogroup\"\n>\n @for (item of items; track item) {\n <div\n class=\"scale-item\"\n (click)=\"select(item)\"\n #scaleItem\n role=\"radio\"\n (keydown)=\"onKeyDown($event, item)\"\n (focus)=\"onFocus(item)\"\n [class.scale-item-focus-prev]=\"selectedIndex && selectedIndex > 0 ? item === selectedIndex - 1 : false\"\n [attr.tabindex]=\"selectedIndex === null ? (item === 0 ? '0' : '-1') : item === selectedIndex ? '0' : '-1'\"\n [attr.aria-checked]=\"\n selectedIndex === null ? (item === 0 ? 'true' : 'false') : item === selectedIndex ? 'true' : 'false'\n \"\n [attr.aria-label]=\"getAriaLabel(item)\"\n [ngClass]=\"{ 'scale-item-selected': item === selectedIndex }\"\n [attr.data-testid]=\"itemTestId(item)\"\n >\n {{ item + 1 }}\n </div>\n }\n</div>\n","import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\n\nimport { ScaleComponent } from './scale.component';\n\n@NgModule({\n imports: [CommonModule, ScaleComponent],\n exports: [ScaleComponent],\n})\nexport class ScaleComponentModule {}\n"],"mappings":";;;;AA2BA,IAAa,iBAAb,MAAa,eAAc;CAqBzB,IAAa,OAAO,QAAc;EAChC,KAAK,QAAQ,MAAM,KAAK,IAAI,QAAQ,KAAK,UAAU,CAAC,CAAC,CAClD,KAAK,CAAC,CAAC,CACP,KAAK,GAAG,MAAM,CAAC;CACpB;CAwBA,WAAW,MAAY;EACrB,OAAO,KAAK,SAAS,GAAG,KAAK,OAAM,GAAI,OAAO,MAAM;CACtD;CAMA,YAC6E,iBAAiC;EAAjC,KAAA,kBAAA;EAzD5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