22@use ' ../light/themes' as * ;
33
44$theme : $fluent ;
5- $resting-border-width : rem (1px );
6- $focused-border-width : rem (2px );
7- $resting-height : calc (var-get ($theme , ' size' ) - #{($resting-border-width * 2 )} );
8- $focused-height : calc (var-get ($theme , ' size' ) - #{($focused-border-width * 2 )} );
5+ $border-size : rem (1px );
96
107:host {
118 --component-size : var (--ig-size , #{var-get ($theme , ' default-size' )} );
@@ -16,6 +13,7 @@ $focused-height: calc(var-get($theme, 'size') - #{($focused-border-width * 2)});
1613 [part = ' suffix' ] {
1714 font-size : rem (14px );
1815 cursor : default ;
16+ z-index : 0 ;
1917
2018 ::slotted (* ) {
2119 color : inherit ;
@@ -56,17 +54,34 @@ $focused-height: calc(var-get($theme, 'size') - #{($focused-border-width * 2)});
5654
5755 [part ^= ' container' ] {
5856 height : var-get ($theme , ' size' );
59- border-radius : var-get ($theme , ' border-border-radius' );
60- border : #{$resting-border-width } solid var-get ($theme , ' border-color' );
57+ background : var-get ($theme , ' border-background' );
6158 transition : none ;
6259 cursor : text ;
6360 grid-template-columns : auto 1fr auto ;
6461 overflow : hidden ;
62+
63+ & ::before {
64+ content : ' ' ;
65+ position : absolute ;
66+ inset : 0 ;
67+ width : 100% ;
68+ height : 100% ;
69+
70+ // The color: here is the actual box-shadow color. If we don't provide color-value to the shadow it
71+ // defaults to the css color: prop the same way as border-color: do.
72+ // We do this in order to have the shadow working correctly inside the Combo search
73+ // We can't change the var-get($theme, 'border-color') in the combo search, but we can change the shadow
74+ color : var-get ($theme , ' border-color' );
75+ box-shadow : inset 0 0 0 $border-size ;
76+ border-radius : var-get ($theme , ' border-border-radius' );
77+ user-select : none ;
78+ pointer-events : none ;
79+ z-index : 1 ;
80+ }
6581 }
6682
6783 [part ~= ' input' ] {
6884 color : var-get ($theme , ' idle-text-color' );
69- height : $resting-height ;
7085 background : initial ;
7186 font-size : rem (14px );
7287 padding-inline : rem (8px );
@@ -78,26 +93,27 @@ $focused-height: calc(var-get($theme, 'size') - #{($focused-border-width * 2)});
7893
7994:host (:hover ) {
8095 [part ^= ' container' ] {
81- border-color : var-get ($theme , ' hover-border-color' );
96+ & ::before {
97+ // The color: here is the actual box-shadow color. If we don't provide color-value to the shadow it
98+ // defaults to the css color: prop the same way as border-color: do.
99+ // We do this in order to have the shadow working correctly inside the Combo search
100+ // We can't change the var-get($theme, 'hover-border-color') in the combo search, but we can change the shadow
101+ color : var-get ($theme , ' hover-border-color' );
102+ box-shadow : inset 0 0 0 $border-size ;
103+ }
82104 }
83105}
84106
85107:host (:focus-within ) {
86108 [part ^= ' container' ] {
87- border-color : var-get ($theme , ' focused-border-color' );
88- border-width : #{$focused-border-width } ;
89- }
90-
91- [part ~= ' input' ] {
92- height : $focused-height ;
93- }
94-
95- [part = ' prefix' ] {
96- margin-inline-start : rem (-1px );
97- }
98-
99- [part = ' suffix' ] {
100- margin-inline-end : rem (-1px );
109+ & ::before {
110+ // The color: here is the actual box-shadow color. If we don't provide color-value to the shadow it
111+ // defaults to the css color: prop the same way as border-color: do.
112+ // We do this in order to have the shadow working correctly inside the Combo search
113+ // We can't change the var-get($theme, 'focused-border-color') in the combo search, but we can change the shadow
114+ color : var-get ($theme , ' focused-border-color' );
115+ box-shadow : inset 0 0 0 calc ($border-size + #{rem (1px )} ),
116+ }
101117 }
102118
103119 [name = ' prefix' ]::slotted (* ),
@@ -134,16 +150,34 @@ $focused-height: calc(var-get($theme, 'size') - #{($focused-border-width * 2)});
134150 }
135151}
136152
137- :host ([invalid ]) {
153+ :host ([invalid ]:not (:disabled )),
154+ :host ([invalid ]:not ([disabled ])) {
155+ ::part (helper-text ) {
156+ color : var-get ($theme , ' error-secondary-color' );
157+ }
158+
159+ [part ~= ' container' ] {
160+ & ::before {
161+ box-shadow : inset 0 0 0 $border-size var-get ($theme , ' error-secondary-color' )
162+ }
163+ }
164+ }
165+
166+ :host (:not (:disabled )[invalid ]:focus-within ),
167+ :host (:not ([disabled ])[invalid ]:focus-within ) {
138168 [part ^= ' container' ] {
139- border-color : var-get ($theme , ' error-secondary-color' );
169+ & ::before {
170+ box-shadow : inset 0 0 0 calc ($border-size + #{rem (1px )} ) var-get ($theme , ' error-secondary-color' );
171+ }
140172 }
141173}
142174
143175:host (:disabled ),
144176:host ([disabled ]) {
145- [part ^= ' container' ] {
146- border-color : var-get ($theme , ' disabled-border-color' );
177+ [part ~= ' container' ] {
178+ & ::before {
179+ box-shadow : inset 0 0 0 $border-size var-get ($theme , ' disabled-border-color' );
180+ }
147181 }
148182
149183 [part ^= ' container' ],
0 commit comments