/** * Copyright Aquera Inc 2025 * * This source code is licensed under the BSD-3-Clause license found in the * LICENSE file in the root directory of this source tree. */ import {LitElement, html, CSSResultArray, TemplateResult} from 'lit'; import { customElement, property} from 'lit/decorators.js'; import {styles} from './nile-option-group.css'; import NileElement from '../internal/nile-element'; import { OptionGroupData } from './nile-option-group.interface'; @customElement('nile-option-group') export class NileOptionGroup extends NileElement { public static get styles(): CSSResultArray { return [styles]; } @property({type: String, reflect: true, attribute: true}) name: string = ""; @property({ type: Object, reflect: true, attribute: true}) data: OptionGroupData | null = null; @property({ type: Boolean, reflect: true, attribute: true}) sticky = false; private checkForImageOrIcon() { return this.data?.prefix?.icon?.name || this.data?.prefix?.image?.src || this.data?.prefix?.prefixText; } private normalizeImageDimension(value?: string | number): string { if (value === undefined || value === null || value === "") { return "20"; } const dimension = Number(value); if (isNaN(dimension) || dimension <= 0) { return "20"; } return dimension > 40 ? "25" : dimension.toString(); } public render(): TemplateResult { return html`