From 2107de052be87b4123ef52f6736a31407d7ba0dc Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Sun, 16 Feb 2025 02:24:52 +0100 Subject: [PATCH 1/3] Readonly of select --- packages/uui-select/lib/uui-select.element.ts | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/packages/uui-select/lib/uui-select.element.ts b/packages/uui-select/lib/uui-select.element.ts index 74b0b97df..82efa0953 100644 --- a/packages/uui-select/lib/uui-select.element.ts +++ b/packages/uui-select/lib/uui-select.element.ts @@ -28,11 +28,13 @@ declare global { * @cssprop --uui-select-padding-x - Padding on the x axis * @cssprop --uui-select-border-color - Border color * @cssprop --uui-select-border-color-hover - Border color on hover + * @cssprop --uui-select-border-color-readonly - Border color when readonly * @cssprop --uui-select-selected-option-background-color - Background color of the selected option * @cssprop --uui-select-selected-option-color - Color of the selected option * @cssprop --uui-select-outline-color - Outline color * @cssprop --uui-select-background-color - Background color - * @cssprop --uui-select-disabled-background-color - Background color when disabled + * @cssprop --uui-select-background-color-disabled - Background color when disabled + * @cssprop --uui-select-background-color-readonly - Background color when readonly * @extends UUIFormControlMixin */ // TODO: Consider if this should use child items instead of an array. @@ -237,21 +239,13 @@ export class UUISelectElement extends UUIFormControlMixin(LitElement, '') { `; } - private _getDisplayValue() { - return ( - this.options.find(option => option.value === this.value)?.name || - this.value - ); - } - render() { - if (this.readonly) return html`${this._getDisplayValue()}`; - return html`