11@use " ../../themes/ionic/ionic.globals.scss" as globals ;
22@use " searchbar.common" ;
33
4- $leading-icon-padding : calc (globals .$ion-scale-400 + globals .$ion-space-200 );
5- $clear-button-padding : calc (globals .$ion-scale-400 + globals .$ion-space-200 );
6-
74// Ionic Searchbar
85// --------------------------------------------------
96
@@ -60,10 +57,6 @@ $clear-button-padding: calc(globals.$ion-scale-400 + globals.$ion-space-200);
6057 contain : strict ;
6158}
6259
63- :host (:not (.searchbar-should-show-clear )) {
64- $clear-button-padding : #{globals .$ion-scale-0 } ;
65- }
66-
6760// Searchbar Cancel Icon
6861// -----------------------------------------
6962
@@ -132,7 +125,7 @@ $clear-button-padding: calc(globals.$ion-scale-400 + globals.$ion-space-200);
132125 * the size of the leading icon (search or cancel),
133126 * and the gap between the icon and the input.
134127 */
135- padding-inline-start : calc (9px + $leading-icon-padding );
128+ padding-inline-start : calc (9px + globals . $ion-scale-400 + globals . $ion-space-200 );
136129}
137130
138131// Searchbar States
@@ -189,6 +182,42 @@ $clear-button-padding: calc(globals.$ion-scale-400 + globals.$ion-space-200);
189182
190183/* Small */
191184:host (.searchbar-size-small ) .searchbar-input {
185+ /* *
186+ * Padding start is based on
187+ * desired padding from design,
188+ * no leading icons.
189+ *
190+ * Padding end is based on
191+ * desired padding from design,
192+ * no trailing icons.
193+ */
194+ @include globals .padding-horizontal (globals .$ion-space-300 );
195+
196+ height : globals .$ion-scale-1000 ;
197+ }
198+
199+ /* Small with Leading Icons */
200+ :host (.searchbar-size-small.searchbar-should-show-search-icon ) .searchbar-input ,
201+ :host (.searchbar-size-small.searchbar-should-show-cancel ) .searchbar-input {
202+ /* *
203+ * Padding start is based on
204+ * desired padding from design,
205+ * the size of the leading icon (search or cancel),
206+ * and the gap between the icon and the input.
207+ *
208+ * Padding end is based on
209+ * desired padding from design,
210+ * no trailing icons.
211+ */
212+ @include globals .padding-horizontal (
213+ calc (globals .$ion-space-300 + globals .$ion-scale-400 + globals .$ion-space-200 ),
214+ globals .$ion-space-300
215+ );
216+ }
217+
218+ /* Small with Leading Icons and Trailing Icons */
219+ :host (.searchbar-size-small.searchbar-should-show-search-icon.searchbar-should-show-clear ) .searchbar-input ,
220+ :host (.searchbar-size-small.searchbar-should-show-cancel.searchbar-should-show-clear ) .searchbar-input {
192221 /* *
193222 * Padding start is based on
194223 * desired padding from design,
@@ -200,12 +229,25 @@ $clear-button-padding: calc(globals.$ion-scale-400 + globals.$ion-space-200);
200229 * the size of the trailing icon (clear),
201230 * and the gap between the icon and the input.
202231 */
232+ @include globals .padding-horizontal (calc (globals .$ion-space-300 + globals .$ion-scale-400 + globals .$ion-space-200 ));
233+ }
234+
235+ /* Small with Trailing Icons */
236+ :host (.searchbar-size-small.searchbar-should-show-clear ) .searchbar-input {
237+ /* *
238+ * Padding start is based on
239+ * desired padding from design,
240+ * no leading icons.
241+ *
242+ * Padding end is based on
243+ * desired padding from design,
244+ * the size of the trailing icon (clear),
245+ * and the gap between the icon and the input.
246+ */
203247 @include globals .padding-horizontal (
204- calc ( globals .$ion-space-300 + $leading-icon-padding ) ,
205- calc (globals .$ion-space-300 + $clear-button-padding )
248+ globals .$ion-space-300 ,
249+ calc (globals .$ion-space-300 + globals . $ion-scale-400 + globals . $ion-space-200 )
206250 );
207-
208- height : globals .$ion-scale-1000 ;
209251}
210252
211253:host (.searchbar-size-small ) .searchbar-search-icon ,
@@ -232,13 +274,7 @@ $clear-button-padding: calc(globals.$ion-scale-400 + globals.$ion-space-200);
232274 * the size of the trailing icon (clear),
233275 * and the gap between the icon and the input.
234276 */
235- @debug " Leading icon padding is equal to #{$leading-icon-padding } " ;
236- @debug " Clear button padding is equal to #{$clear-button-padding } " ;
237-
238- @include globals .padding-horizontal (
239- calc (globals .$ion-space-400 + $leading-icon-padding ),
240- calc (globals .$ion-space-400 + $clear-button-padding )
241- );
277+ @include globals .padding-horizontal (calc (globals .$ion-space-400 + globals .$ion-scale-400 + globals .$ion-space-200 ));
242278
243279 height : globals .$ion-scale-1200 ;
244280}
@@ -257,8 +293,6 @@ $clear-button-padding: calc(globals.$ion-scale-400 + globals.$ion-space-200);
257293/* Large */
258294:host (.searchbar-size-large ) .searchbar-search-icon ,
259295:host (.searchbar-size-large ) .searchbar-cancel-button {
260- $leading-icon-padding : #{calc (globals .$ion-scale-500 + globals .$ion-space-200 )} ;
261-
262296 width : globals .$ion-scale-500 ;
263297 height : globals .$ion-scale-500 ;
264298}
@@ -274,7 +308,7 @@ $clear-button-padding: calc(globals.$ion-scale-400 + globals.$ion-space-200);
274308 * the size of the leading icon (search or cancel),
275309 * and the gap between the icon and the input.
276310 */
277- padding-inline-start : calc (9px + $leading-icon-padding );
311+ padding-inline-start : calc (9px + globals . $ion-scale-500 + globals . $ion-space-200 );
278312}
279313
280314:host (.searchbar-size-large ) .searchbar-input {
@@ -292,8 +326,8 @@ $clear-button-padding: calc(globals.$ion-scale-400 + globals.$ion-space-200);
292326 * and the gap between the icon and the input.
293327 */
294328 @include globals .padding-horizontal (
295- calc (globals .$ion-space-500 + $leading-icon-padding ),
296- calc (globals .$ion-space-500 + $clear-button-padding )
329+ calc (globals .$ion-space-500 + globals . $ion-scale-500 + globals . $ion-space-200 ),
330+ calc (globals .$ion-space-500 + globals . $ion-scale-400 + globals . $ion-space-200 )
297331 );
298332
299333 height : globals .$ion-scale-1400 ;
0 commit comments