File tree 4 files changed +35
-39
lines changed
packages/calcite-components/src/components
4 files changed +35
-39
lines changed Original file line number Diff line number Diff line change @@ -71,25 +71,22 @@ ul:focus {
71
71
@apply cursor-default ;
72
72
}
73
73
74
- // selected state
75
- .label--selected {
76
- @apply text-color- 1;
77
-
78
- .title {
79
- @apply font-medium ;
80
- }
81
- }
82
-
83
74
.label--active {
84
75
@apply focus-inset ;
85
76
}
86
77
87
- .label :hover ,
78
+ :host ([ selected ]) .label ,
88
79
.label :active {
89
- @apply text-color- 1
90
- bg-foreground- 2
91
- no-underline
92
- shadow-none ;
80
+ @apply text-color- 1;
81
+
82
+ .description ,
83
+ .short-text {
84
+ @apply text-color- 2;
85
+ }
86
+ }
87
+
88
+ .label :hover {
89
+ @apply text-color-1 bg-foreground- 2;
93
90
}
94
91
95
92
.label :active {
@@ -101,22 +98,17 @@ ul:focus {
101
98
opacity- 0
102
99
duration- 150
103
100
ease-in-out ;
104
- color : theme (" borderColor.color.1" );
105
- }
106
-
107
- .icon--custom {
108
- margin-block-start : -1px ;
109
- }
110
-
111
- .icon--selected {
112
- @apply text-color- 1;
113
101
}
114
102
115
- .label-- selected .icon {
103
+ :host ([ selected ]) .icon {
116
104
@apply opacity- 100;
117
105
color : theme (" backgroundColor.brand" );
118
106
}
119
107
108
+ .icon--custom {
109
+ margin-block-start : -1px ;
110
+ }
111
+
120
112
.center-content {
121
113
display : flex ;
122
114
flex-direction : column ;
@@ -128,22 +120,28 @@ ul:focus {
128
120
font-size : var (--calcite-internal-combobox-item-description-font-size );
129
121
}
130
122
131
- :host ([selected ]),
132
- :host (:hover ) {
133
- .description {
134
- color : var (--calcite-color-text-2 );
135
- }
136
- }
137
-
138
123
.short-text {
139
- color : var (--calcite-color-text-3 );
140
124
white-space : nowrap ;
141
125
}
142
126
143
127
.title {
144
128
color : var (--calcite-color-text-1 );
145
129
}
146
130
131
+ :host ([selected ]) {
132
+ .title {
133
+ @apply font-medium ;
134
+ }
135
+ }
136
+
137
+ .label ,
138
+ .label :hover {
139
+ .description ,
140
+ .short-text {
141
+ @apply text-color- 3;
142
+ }
143
+ }
144
+
147
145
.title ,
148
146
.description ,
149
147
.short-text {
Original file line number Diff line number Diff line change @@ -236,7 +236,6 @@ export class ComboboxItem extends LitElement implements InteractiveComponent {
236
236
< calcite-icon
237
237
class = { {
238
238
[ CSS . custom ] : ! ! this . icon ,
239
- [ CSS . iconSelected ] : this . icon && this . selected ,
240
239
} }
241
240
flipRtl = { this . iconFlipRtl }
242
241
icon = { this . icon || iconPath }
@@ -251,7 +250,6 @@ export class ComboboxItem extends LitElement implements InteractiveComponent {
251
250
< calcite-icon
252
251
class = { {
253
252
[ CSS . icon ] : true ,
254
- [ CSS . iconSelected ] : this . selected ,
255
253
} }
256
254
flipRtl = { this . iconFlipRtl }
257
255
icon = { icon }
@@ -288,7 +286,6 @@ export class ComboboxItem extends LitElement implements InteractiveComponent {
288
286
289
287
const classes = {
290
288
[ CSS . label ] : true ,
291
- [ CSS . selected ] : this . selected ,
292
289
[ CSS . active ] : this . active ,
293
290
[ CSS . single ] : isSingleSelect ,
294
291
} ;
Original file line number Diff line number Diff line change @@ -7,10 +7,8 @@ export const CSS = {
7
7
custom : "icon--custom" ,
8
8
description : "description" ,
9
9
icon : "icon" ,
10
- iconSelected : "icon--selected" ,
11
10
label : "label" ,
12
11
scale : ( scale : Scale ) => `scale--${ scale } ` as const ,
13
- selected : "label--selected" ,
14
12
shortText : "short-text" ,
15
13
single : "label--single" ,
16
14
textContainer : "text-container" ,
Original file line number Diff line number Diff line change @@ -2099,12 +2099,15 @@ describe("calcite-combobox", () => {
2099
2099
it ( "after click interaction with listbox, user can transition to using keyboard “enter” to toggle selected on/off" , async ( ) => {
2100
2100
expect ( itemNestedLi ) . toHaveClass ( ComboboxItemCSS . active ) ;
2101
2101
2102
+ const selectedItem = await page . find ( "calcite-combobox-item#PineNested" ) ;
2103
+ expect ( await selectedItem . getProperty ( "selected" ) ) . toBe ( true ) ;
2104
+
2102
2105
await itemNestedLi . press ( "Enter" ) ;
2103
- expect ( itemNestedLi ) . not . toHaveClass ( ComboboxItemCSS . selected ) ;
2106
+ expect ( await selectedItem . getProperty ( " selected" ) ) . toBe ( false ) ;
2104
2107
expect ( itemNestedLi ) . toHaveClass ( ComboboxItemCSS . active ) ;
2105
2108
2106
2109
await itemNestedLi . press ( "Enter" ) ;
2107
- expect ( itemNestedLi ) . toHaveClass ( ComboboxItemCSS . selected ) ;
2110
+ expect ( await selectedItem . getProperty ( " selected" ) ) . toBe ( true ) ;
2108
2111
expect ( itemNestedLi ) . toHaveClass ( ComboboxItemCSS . active ) ;
2109
2112
2110
2113
await element . press ( "Tab" ) ;
You can’t perform that action at this time.
0 commit comments