Skip to content

Commit a361fc5

Browse files
CR
1 parent bfceabd commit a361fc5

File tree

42 files changed

+127
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+127
-21
lines changed

core/src/components/searchbar/searchbar.ionic.scss

Lines changed: 125 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
// Searchbar in Toolbar
108108
// -----------------------------------------
109109

110-
:host-context(ion-toolbar).searchbar-should-show-cancel .searchbar-cancel-button {
110+
:host(.in-toolbar.searchbar-should-show-cancel) .searchbar-cancel-button {
111111
/**
112112
* The left edge of the cancel button
113113
* should align with the left edge
@@ -118,16 +118,6 @@
118118
@include globals.position-horizontal(9px, null);
119119
}
120120

121-
:host-context(ion-toolbar).searchbar-should-show-cancel .searchbar-input {
122-
/**
123-
* Padding start is based on
124-
* the alignment of the back button,
125-
* the size of the leading icon (search or cancel),
126-
* and the gap between the icon and the input.
127-
*/
128-
padding-inline-start: calc(9px + globals.$ion-scale-400 + globals.$ion-space-200);
129-
}
130-
131121
// Searchbar States
132122
// --------------------------------------------------
133123

@@ -263,6 +253,42 @@
263253

264254
/* Medium */
265255
:host(.searchbar-size-medium) .searchbar-input {
256+
/**
257+
* Padding start is based on
258+
* desired padding from design,
259+
* no leading icons.
260+
*
261+
* Padding end is based on
262+
* desired padding from design,
263+
* no trailing icons.
264+
*/
265+
@include globals.padding-horizontal(globals.$ion-space-400);
266+
267+
height: globals.$ion-scale-1200;
268+
}
269+
270+
/* Medium with Leading Icons */
271+
:host(.searchbar-size-medium.searchbar-should-show-search-icon) .searchbar-input,
272+
:host(.searchbar-size-medium.searchbar-should-show-cancel) .searchbar-input {
273+
/**
274+
* Padding start is based on
275+
* desired padding from design,
276+
* the size of the leading icon (search or cancel),
277+
* and the gap between the icon and the input.
278+
*
279+
* Padding end is based on
280+
* desired padding from design,
281+
* no trailing icons.
282+
*/
283+
@include globals.padding-horizontal(
284+
calc(globals.$ion-space-400 + globals.$ion-scale-400 + globals.$ion-space-200),
285+
globals.$ion-space-400
286+
);
287+
}
288+
289+
/* Medium with Leading Icons and Trailing Icons */
290+
:host(.searchbar-size-medium.searchbar-should-show-search-icon.searchbar-should-show-clear) .searchbar-input,
291+
:host(.searchbar-size-medium.searchbar-should-show-cancel.searchbar-should-show-clear) .searchbar-input {
266292
/**
267293
* Padding start is based on
268294
* desired padding from design,
@@ -275,8 +301,24 @@
275301
* and the gap between the icon and the input.
276302
*/
277303
@include globals.padding-horizontal(calc(globals.$ion-space-400 + globals.$ion-scale-400 + globals.$ion-space-200));
304+
}
278305

279-
height: globals.$ion-scale-1200;
306+
/* Medium with Trailing Icons */
307+
:host(.searchbar-size-medium.searchbar-should-show-clear) .searchbar-input {
308+
/**
309+
* Padding start is based on
310+
* desired padding from design,
311+
* no leading icons.
312+
*
313+
* Padding end is based on
314+
* desired padding from design,
315+
* the size of the trailing icon (clear),
316+
* and the gap between the icon and the input.
317+
*/
318+
@include globals.padding-horizontal(
319+
globals.$ion-space-400,
320+
calc(globals.$ion-space-400 + globals.$ion-scale-400 + globals.$ion-space-200)
321+
);
280322
}
281323

282324
:host(.searchbar-size-medium) .searchbar-search-icon,
@@ -290,6 +332,17 @@
290332
@include globals.position-horizontal(null, globals.$ion-space-400);
291333
}
292334

335+
:host(.in-toolbar.searchbar-size-small.searchbar-should-show-cancel) .searchbar-input,
336+
:host(.in-toolbar.searchbar-size-medium.searchbar-should-show-cancel) .searchbar-input {
337+
/**
338+
* Padding start is based on
339+
* the alignment of the back button,
340+
* the size of the leading icon (search or cancel),
341+
* and the gap between the icon and the input.
342+
*/
343+
padding-inline-start: calc(9px + globals.$ion-scale-400 + globals.$ion-space-200);
344+
}
345+
293346
/* Large */
294347
:host(.searchbar-size-large) .searchbar-search-icon,
295348
:host(.searchbar-size-large) .searchbar-cancel-button {
@@ -301,19 +354,47 @@
301354
font-size: globals.$ion-font-size-500;
302355
}
303356

304-
:host-context(ion-toolbar).searchbar-size-large.searchbar-should-show-cancel .searchbar-input {
357+
:host(.searchbar-size-large) .searchbar-input {
358+
@include globals.padding(globals.$ion-space-400, null);
359+
305360
/**
306361
* Padding start is based on
307-
* the alignment of the back button,
362+
* desired padding from design,
308363
* the size of the leading icon (search or cancel),
309364
* and the gap between the icon and the input.
365+
*
366+
* Padding end is based on
367+
* desired padding from design,
368+
* the size of the trailing icon (clear),
369+
* and the gap between the icon and the input.
310370
*/
311-
padding-inline-start: calc(9px + globals.$ion-scale-500 + globals.$ion-space-200);
371+
@include globals.padding-horizontal(globals.$ion-space-500, globals.$ion-space-500);
372+
373+
height: globals.$ion-scale-1400;
312374
}
313375

314-
:host(.searchbar-size-large) .searchbar-input {
315-
@include globals.padding(globals.$ion-space-400, null);
376+
/* Large with Leading Icons */
377+
:host(.searchbar-size-large.searchbar-should-show-search-icon) .searchbar-input,
378+
:host(.searchbar-size-large.searchbar-should-show-cancel) .searchbar-input {
379+
/**
380+
* Padding start is based on
381+
* desired padding from design,
382+
* the size of the leading icon (search or cancel),
383+
* and the gap between the icon and the input.
384+
*
385+
* Padding end is based on
386+
* desired padding from design,
387+
* no trailing icons.
388+
*/
389+
@include globals.padding-horizontal(
390+
calc(globals.$ion-space-500 + globals.$ion-scale-500 + globals.$ion-space-200),
391+
globals.$ion-space-500
392+
);
393+
}
316394

395+
/* Large with Leading Icons and Trailing Icons */
396+
:host(.searchbar-size-large.searchbar-should-show-search-icon.searchbar-should-show-clear) .searchbar-input,
397+
:host(.searchbar-size-large.searchbar-should-show-cancel.searchbar-should-show-clear) .searchbar-input {
317398
/**
318399
* Padding start is based on
319400
* desired padding from design,
@@ -329,8 +410,34 @@
329410
calc(globals.$ion-space-500 + globals.$ion-scale-500 + globals.$ion-space-200),
330411
calc(globals.$ion-space-500 + globals.$ion-scale-400 + globals.$ion-space-200)
331412
);
413+
}
332414

333-
height: globals.$ion-scale-1400;
415+
/* Large with Trailing Icons */
416+
:host(.searchbar-size-large.searchbar-should-show-clear) .searchbar-input {
417+
/**
418+
* Padding start is based on
419+
* desired padding from design,
420+
* no leading icons.
421+
*
422+
* Padding end is based on
423+
* desired padding from design,
424+
* the size of the trailing icon (clear),
425+
* and the gap between the icon and the input.
426+
*/
427+
@include globals.padding-horizontal(
428+
globals.$ion-space-500,
429+
calc(globals.$ion-space-500 + globals.$ion-scale-400 + globals.$ion-space-200)
430+
);
431+
}
432+
433+
:host(.in-toolbar.searchbar-size-large.searchbar-should-show-cancel) .searchbar-input {
434+
/**
435+
* Padding start is based on
436+
* the alignment of the back button,
437+
* the size of the leading icon (search or cancel),
438+
* and the gap between the icon and the input.
439+
*/
440+
padding-inline-start: calc(9px + globals.$ion-scale-500 + globals.$ion-space-200);
334441
}
335442

336443
:host(.searchbar-size-large) .searchbar-search-icon,

core/src/components/searchbar/searchbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Component, Element, Event, Host, Method, Prop, State, Watch, forceUpdat
66
import { debounceEvent, raf, componentOnReady, inheritAttributes } from '@utils/helpers';
77
import type { Attributes } from '@utils/helpers';
88
import { isRTL } from '@utils/rtl';
9-
import { createColorClasses } from '@utils/theme';
9+
import { createColorClasses, hostContext } from '@utils/theme';
1010
import { arrowBackSharp, closeCircle, closeSharp, searchOutline, searchSharp } from 'ionicons/icons';
1111

1212
import { config } from '../../global/config';
@@ -805,6 +805,7 @@ export class Searchbar implements ComponentInterface {
805805
'searchbar-should-show-cancel': this.shouldShowCancelButton(),
806806
[`searchbar-shape-${shape}`]: shape !== undefined,
807807
[`searchbar-size-${size}`]: size !== undefined,
808+
'in-toolbar': hostContext('ion-toolbar', this.el),
808809
})}
809810
>
810811
<div class="searchbar-input-container">

core/src/components/searchbar/test/basic/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ <h5 class="ion-padding-start ion-padding-top">Search - Name</h5>
188188
const propIsSpellcheck = dynamicProp.spellcheck === true ? false : true;
189189
dynamicProp.spellcheck = propIsSpellcheck;
190190
}
191-
192-
document.querySelector("#noCancel").searchIcon = false;
193191
</script>
194192
</ion-content>
195193
</ion-app>
298 Bytes
327 Bytes
313 Bytes
298 Bytes
319 Bytes
304 Bytes

0 commit comments

Comments
 (0)