@@ -28,11 +28,13 @@ declare global {
28
28
* @cssprop --uui-select-padding-x - Padding on the x axis
29
29
* @cssprop --uui-select-border-color - Border color
30
30
* @cssprop --uui-select-border-color-hover - Border color on hover
31
+ * @cssprop --uui-select-border-color-readonly - Border color when readonly
31
32
* @cssprop --uui-select-selected-option-background-color - Background color of the selected option
32
33
* @cssprop --uui-select-selected-option-color - Color of the selected option
33
34
* @cssprop --uui-select-outline-color - Outline color
34
35
* @cssprop --uui-select-background-color - Background color
35
- * @cssprop --uui-select-disabled-background-color - Background color when disabled
36
+ * @cssprop --uui-select-background-color-disabled - Background color when disabled
37
+ * @cssprop --uui-select-background-color-readonly - Background color when readonly
36
38
* @extends UUIFormControlMixin
37
39
*/
38
40
// TODO: Consider if this should use child items instead of an array.
@@ -237,21 +239,13 @@ export class UUISelectElement extends UUIFormControlMixin(LitElement, '') {
237
239
` ;
238
240
}
239
241
240
- private _getDisplayValue ( ) {
241
- return (
242
- this . options . find ( option => option . value === this . value ) ?. name ||
243
- this . value
244
- ) ;
245
- }
246
-
247
242
render ( ) {
248
- if ( this . readonly ) return html `<span> ${ this . _getDisplayValue ( ) } </ span> ` ;
249
-
250
243
return html ` <select
251
244
id= "native"
252
245
aria-label = ${ this . label }
253
246
@change = ${ this . setValue }
254
247
?dis abled= ${ this . disabled }
248
+ aria- readonly = ${ this . readonly ? 'true' : 'false' }
255
249
.name = ${ this . name }
256
250
.value = ${ this . value as string } >
257
251
<option dis abled selected value= "" hidden > ${ this . placeholder } </ option>
@@ -305,9 +299,25 @@ export class UUISelectElement extends UUIFormControlMixin(LitElement, '') {
305
299
# native [disabled ] {
306
300
cursor : not-allowed;
307
301
background-color : var (
308
- --uui-select-disabled-background-color ,
302
+ --uui-select-background-color-disabled ,
303
+ var (--uui-color-disabled )
304
+ );
305
+ border-color : var (
306
+ --uui-select-border-color-disabled ,
307
+ var (--uui-color-disabled )
308
+ );
309
+ }
310
+
311
+ # native [aria-readonly = 'true' ] {
312
+ pointer-events : none;
313
+ background-color : var (
314
+ --uui-select-background-color-readonly ,
309
315
var (--uui-color-disabled )
310
316
);
317
+ border-color : var (
318
+ --uui-select-border-color-readonly ,
319
+ var (--uui-color-disabled-standalone )
320
+ );
311
321
}
312
322
313
323
# native : hover {
0 commit comments