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 )} );
95
106:host {
117 --component-size : var (--ig-size , #{var-get ($theme , ' default-size' )} );
128 --input-size : var (--component-size );
139 --helper-text-top-spacer : rem (5px );
10+ --input-border-size : #{rem (1px )} ;
1411
1512 [part = ' prefix' ],
1613 [part = ' suffix' ] {
1714 font-size : rem (14px );
1815 cursor : default ;
16+ z-index : 0 ;
1917
2018 ::slotted (* ) {
2119 color : inherit ;
@@ -59,17 +57,35 @@ $focused-height: calc(var-get($theme, 'size') - #{($focused-border-width * 2)});
5957
6058 [part ^= ' container' ] {
6159 height : var-get ($theme , ' size' );
60+ background : var-get ($theme , ' border-background' );
61+ border : var (--input-border-size ) solid transparent ;
6262 border-radius : var-get ($theme , ' border-border-radius' );
63- border : #{$resting-border-width } solid var-get ($theme , ' border-color' );
6463 transition : none ;
6564 cursor : text ;
6665 grid-template-columns : auto 1fr auto ;
67- overflow : hidden ;
66+
67+ & ::before {
68+ content : ' ' ;
69+ position : absolute ;
70+ inset : calc (var (--input-border-size ) * -1 );
71+ width : calc (100% + (var (--input-border-size ) * 2 ));
72+ height : calc (100% + (var (--input-border-size ) * 2 ));
73+
74+ // The color: here is the actual box-shadow color. If we don't provide color-value to the shadow it
75+ // defaults to the css color: prop the same way as border-color: do.
76+ // We do this in order to have the shadow working correctly inside the Combo search
77+ // We can't change the var-get($theme, 'border-color') in the combo search, but we can change the shadow
78+ color : var-get ($theme , ' border-color' );
79+ box-shadow : inset 0 0 0 var (--input-border-size );
80+ border-radius : var-get ($theme , ' border-border-radius' );
81+ user-select : none ;
82+ pointer-events : none ;
83+ z-index : 1 ;
84+ }
6885 }
6986
7087 [part ~= ' input' ] {
7188 color : var-get ($theme , ' idle-text-color' );
72- height : $resting-height ;
7389 background : initial ;
7490 font-size : rem (14px );
7591 padding-inline : rem (8px );
@@ -79,47 +95,58 @@ $focused-height: calc(var-get($theme, 'size') - #{($focused-border-width * 2)});
7995 }
8096}
8197
82- :host (:not ([aria-haspopup = ' dialog' ],[role = ' combobox' ])[readonly ]) {
83- [part = ' prefix' ],
84- [part = ' suffix' ] {
85- background : transparent ;
98+ :host (:not ([readonly ], [invalid ], :focus-within ):hover ) {
99+ [part ^= ' container' ] {
100+ & ::before {
101+ // The color: here is the actual box-shadow color. If we don't provide color-value to the shadow it
102+ // defaults to the css color: prop the same way as border-color: do.
103+ // We do this in order to have the shadow working correctly inside the Combo search
104+ // We can't change the var-get($theme, 'hover-border-color') in the combo search, but we can change the shadow
105+ color : var-get ($theme , ' hover-border-color' );
106+ box-shadow : inset 0 0 0 var (--input-border-size );
107+ }
86108 }
87109}
88110
89- :host (:not ( [aria-haspopup = ' dialog ' ],[ role = ' combobox ' ])[ readonly ] :hover ) {
111+ :host ([aria-expanded ][ readonly ] :not ([ invalid ], :focus-within ) :hover ) {
90112 [part ^= ' container' ] {
91- border-color : var-get ($theme , ' border-color' );
113+ & ::before {
114+ // The color: here is the actual box-shadow color. If we don't provide color-value to the shadow it
115+ // defaults to the css color: prop the same way as border-color: do.
116+ // We do this in order to have the shadow working correctly inside the Combo search
117+ // We can't change the var-get($theme, 'hover-border-color') in the combo search, but we can change the shadow
118+ color : var-get ($theme , ' hover-border-color' );
119+ box-shadow : inset 0 0 0 var (--input-border-size );
120+ }
92121 }
93122}
94123
95- :host (:not ( [aria-haspopup = ' dialog ' ],[ role = ' combobox ' ])[ readonly ] :focus-within ) {
124+ :host ([aria-haspopup ] :not ([ readonly ], [ invalid ], :focus-within ) :hover ) {
96125 [part ^= ' container' ] {
97- border-color : var-get ($theme , ' focused-border-color' );
126+ & ::before {
127+ color : var-get ($theme , ' hover-border-color' );
128+ box-shadow : inset 0 0 0 var (--input-border-size );
129+ }
98130 }
99131}
100132
101- :host (:hover ) {
102- [part ^= ' container' ] {
103- border-color : var-get ($theme , ' hover-border-color' );
133+ :host (:not ([aria-haspopup ],[aria-expanded ])[readonly ]) {
134+ [part = ' prefix' ],
135+ [part = ' suffix' ] {
136+ background : transparent ;
104137 }
105138}
106139
107140:host (:focus-within ) {
108141 [part ^= ' container' ] {
109- border-color : var-get ($theme , ' focused-border-color' );
110- border-width : #{$focused-border-width } ;
111- }
112-
113- [part ~= ' input' ] {
114- height : $focused-height ;
115- }
116-
117- [part = ' prefix' ] {
118- margin-inline-start : rem (-1px );
119- }
120-
121- [part = ' suffix' ] {
122- margin-inline-end : rem (-1px );
142+ & ::before {
143+ // The color: here is the actual box-shadow color. If we don't provide color-value to the shadow it
144+ // defaults to the css color: prop the same way as border-color: do.
145+ // We do this in order to have the shadow working correctly inside the Combo search
146+ // We can't change the var-get($theme, 'focused-border-color') in the combo search, but we can change the shadow
147+ color : var-get ($theme , ' focused-border-color' );
148+ box-shadow : inset 0 0 0 calc (var (--input-border-size ) + #{rem (1px )} );
149+ }
123150 }
124151
125152 [name = ' prefix' ]::slotted (* ),
@@ -166,15 +193,32 @@ $focused-height: calc(var-get($theme, 'size') - #{($focused-border-width * 2)});
166193:host ([invalid ]:hover ),
167194:host ([readonly ][invalid ]:hover ),
168195:host ([readonly ][invalid ]:focus-within ) {
169- [part ^= ' container' ] {
170- border-color : var-get ($theme , ' error-secondary-color' );
196+ ::part (helper-text ) {
197+ color : var-get ($theme , ' error-secondary-color' );
198+ }
199+
200+ [part ~= ' container' ] {
201+ & ::before {
202+ box-shadow : inset 0 0 0 var (--input-border-size ) var-get ($theme , ' error-secondary-color' );
203+ }
204+ }
205+ }
206+
207+ :host ([invalid ]:focus-within ),
208+ :host ([readonly ][invalid ]:focus-within ) {
209+ [part ~= ' container' ] {
210+ & ::before {
211+ box-shadow : inset 0 0 0 calc (var (--input-border-size ) + #{rem (1px )} ) var-get ($theme , ' error-secondary-color' );
212+ }
171213 }
172214}
173215
174216:host (:disabled ),
175217:host ([disabled ]) {
176- [part ^= ' container' ] {
177- border-color : var-get ($theme , ' disabled-border-color' );
218+ [part ~= ' container' ] {
219+ & ::before {
220+ box-shadow : inset 0 0 0 var (--input-border-size ) var-get ($theme , ' disabled-border-color' );
221+ }
178222 }
179223
180224 [part ^= ' container' ],
0 commit comments