Skip to content

Commit 9a1475a

Browse files
authored
fix(combo-box): align invalid style and ai-label position (#20978)
1 parent b2982e8 commit 9a1475a

File tree

2 files changed

+292
-82
lines changed

2 files changed

+292
-82
lines changed

packages/web-components/src/components/combo-box/combo-box.scss

Lines changed: 82 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright IBM Corp. 2019, 2024
2+
// Copyright IBM Corp. 2019, 2025
33
//
44
// This source code is licensed under the Apache-2.0 license found in the
55
// LICENSE file in the root directory of this source tree.
@@ -41,14 +41,6 @@ $css--plex: true !default;
4141
}
4242
}
4343

44-
:host(#{$prefix}-combo-box[isClosable]) {
45-
.#{$prefix}--list-box__invalid-icon {
46-
/* stylelint-disable declaration-no-important */
47-
inset-inline-end: to-rem(66px) !important;
48-
/* stylelint-enable declaration-no-important */
49-
}
50-
}
51-
5244
:host(#{$prefix}-combo-box[disabled]),
5345
:host(#{$prefix}-combo-box[read-only]) {
5446
.#{$prefix}--list-box__selection {
@@ -126,15 +118,36 @@ $css--plex: true !default;
126118
:host(#{$prefix}-combo-box[ai-label]) {
127119
@extend .#{$prefix}--list-box__wrapper--slug;
128120

121+
.#{$prefix}--list-box__wrapper--decorator {
122+
@include ai-gradient;
123+
}
124+
129125
.#{$prefix}--list-box__field {
130126
padding: 0;
131127
}
132128

129+
.#{$prefix}--list-box__invalid-icon {
130+
/* stylelint-disable-next-line declaration-no-important */
131+
inset-inline-end: to-rem(83px) !important;
132+
}
133+
134+
::slotted(#{$prefix}-ai-label)::after,
135+
::slotted(#{$prefix}-slug)::after {
136+
position: absolute;
137+
display: block;
138+
background-color: $border-subtle-01;
139+
block-size: $spacing-05;
140+
content: '';
141+
inline-size: to-rem(1px);
142+
inset-block-start: 0;
143+
inset-inline-end: to-rem(-9px);
144+
}
145+
133146
::slotted(#{$prefix}-ai-label),
134147
::slotted(#{$prefix}-slug) {
135148
position: absolute;
136149
inset-block-start: 50%;
137-
inset-inline-end: $spacing-08;
150+
inset-inline-end: calc($spacing-08 + 9px);
138151
}
139152

140153
::slotted(#{$prefix}-ai-label:not([revert-active])),
@@ -143,25 +156,76 @@ $css--plex: true !default;
143156
}
144157
}
145158

146-
:host(#{$prefix}-combo-box[ai-label][isclosable]) {
159+
:host(#{$prefix}-combo-box[ai-label][isClosable]) {
147160
::slotted(#{$prefix}-ai-label),
148161
::slotted(#{$prefix}-slug) {
149-
inset-inline-end: $spacing-10;
162+
inset-inline-end: calc($spacing-10 + 18px);
163+
}
164+
165+
.#{$prefix}--list-box__field .#{$prefix}--text-input {
166+
padding-inline-end: to-rem(105px);
150167
}
151168
}
152169

153170
:host(#{$prefix}-combo-box[warn]),
154171
:host(#{$prefix}-combo-box[invalid]) {
155172
::slotted(#{$prefix}-ai-label),
156173
::slotted(#{$prefix}-slug) {
157-
inset-inline-end: $spacing-10;
174+
inset-inline-end: calc($spacing-08 + 9px);
175+
}
176+
177+
::slotted(#{$prefix}-ai-label)::before,
178+
::slotted(#{$prefix}-slug)::before {
179+
position: absolute;
180+
display: block;
181+
background-color: $border-subtle-01;
182+
block-size: $spacing-05;
183+
content: '';
184+
inline-size: to-rem(1px);
185+
inset-block-start: 0;
186+
inset-inline-start: to-rem(-9px);
158187
}
159188
}
160189

161-
:host(#{$prefix}-combo-box[warn][isclosable]),
162-
:host(#{$prefix}-combo-box[invalid][isclosable]) {
163-
::slotted(#{$prefix}-ai-label),
164-
::slotted(#{$prefix}-slug) {
165-
inset-inline-end: to-rem(88px);
190+
:host(#{$prefix}-combo-box[warn][isClosable]:not([ai-label])),
191+
:host(#{$prefix}-combo-box[invalid][isClosable]:not([ai-label])) {
192+
.#{$prefix}--list-box__field:has(.#{$prefix}--list-box__menu-icon)
193+
.#{$prefix}--list-box__selection::before {
194+
position: absolute;
195+
background-color: $border-subtle-01;
196+
block-size: to-rem(16px);
197+
content: '';
198+
inline-size: to-rem(1px);
199+
margin-inline-end: to-rem(33px);
200+
}
201+
}
202+
203+
:host(#{$prefix}-combo-box[isClosable]) {
204+
.#{$prefix}--list-box__invalid-icon {
205+
/* stylelint-disable-next-line declaration-no-important */
206+
inset-inline-end: calc($spacing-10 + 18px) !important;
207+
}
208+
209+
.#{$prefix}--list-box__field .#{$prefix}--text-input {
210+
padding-inline-end: to-rem(80px);
211+
}
212+
}
213+
214+
:host(#{$prefix}-combo-box[warn][isClosable]),
215+
:host(#{$prefix}-combo-box[invalid][isClosable]) {
216+
.#{$prefix}--list-box__field .#{$prefix}--text-input {
217+
padding-inline-end: to-rem(105px);
218+
}
219+
}
220+
221+
:host(#{$prefix}-combo-box[warn][ai-label][isClosable]),
222+
:host(#{$prefix}-combo-box[invalid][ai-label][isClosable]) {
223+
.#{$prefix}--list-box__field .#{$prefix}--text-input {
224+
padding-inline-end: to-rem(141px);
225+
}
226+
227+
.#{$prefix}--list-box__invalid-icon {
228+
/* stylelint-disable-next-line declaration-no-important */
229+
inset-inline-end: to-rem(116px) !important;
166230
}
167231
}

0 commit comments

Comments
 (0)