|
28 | 28 | // ----------------------------------------- |
29 | 29 |
|
30 | 30 | .searchbar-search-icon { |
31 | | - // Position is based on the size of the search icon. |
32 | | - @include globals.position(globals.$ion-scale-400, null, null, globals.$ion-scale-400); |
33 | | - |
34 | 31 | width: globals.$ion-scale-400; |
35 | 32 | height: globals.$ion-scale-400; |
36 | 33 | } |
|
39 | 36 | // ----------------------------------------- |
40 | 37 |
|
41 | 38 | .searchbar-input { |
42 | | - /** |
43 | | - * Padding start is based on |
44 | | - * desired padding from design, |
45 | | - * the size of the search icon, |
46 | | - * and the gap between the icon and the input. |
47 | | - * |
48 | | - * Padding end is based on |
49 | | - * desired padding from design, |
50 | | - * the size of the clear icon, |
51 | | - * and the gap between the icon and the input. |
52 | | - */ |
53 | | - @include globals.padding( |
54 | | - globals.$ion-space-300, |
55 | | - calc(globals.$ion-space-400 + globals.$ion-scale-400 + globals.$ion-space-200), |
56 | | - globals.$ion-space-300, |
57 | | - calc(globals.$ion-space-400 + globals.$ion-scale-400 + globals.$ion-space-200) |
58 | | - ); |
59 | | - |
60 | | - min-height: globals.$ion-scale-1200; |
| 39 | + @include globals.padding(globals.$ion-space-300, null); |
61 | 40 |
|
62 | 41 | contain: strict; |
63 | 42 | } |
|
66 | 45 | // ----------------------------------------- |
67 | 46 |
|
68 | 47 | .searchbar-clear-button { |
69 | | - // Position is based on the size of the clear icon. |
70 | | - @include globals.position(globals.$ion-scale-400, globals.$ion-scale-400, null, null); |
71 | | - |
72 | 48 | width: globals.$ion-scale-400; |
73 | 49 | height: globals.$ion-scale-400; |
74 | 50 |
|
|
83 | 59 | // ----------------------------------------- |
84 | 60 |
|
85 | 61 | .searchbar-cancel-button { |
86 | | - /** |
87 | | - * The left edge of the cancel button |
88 | | - * should align with the left edge |
89 | | - * of the back button if the searchbar |
90 | | - * is used in a toolbar. |
91 | | - */ |
92 | | - @include globals.position(0, null, null, 9px); |
| 62 | + width: globals.$ion-scale-400; |
| 63 | + height: globals.$ion-scale-400; |
93 | 64 |
|
94 | 65 | background-color: transparent; |
95 | 66 |
|
|
102 | 73 | .searchbar-search-icon, |
103 | 74 | .searchbar-clear-button, |
104 | 75 | .searchbar-cancel-button { |
| 76 | + @include globals.position(50%, null); |
| 77 | + |
105 | 78 | position: absolute; |
| 79 | + |
| 80 | + transform: translateY(-50%); |
106 | 81 | } |
107 | 82 |
|
108 | 83 | // Clear Icon & Cancel Icon |
|
120 | 95 | // Searchbar in Toolbar |
121 | 96 | // ----------------------------------------- |
122 | 97 |
|
123 | | -:host-context(ion-toolbar) { |
124 | | - min-height: globals.$ion-scale-1200; |
| 98 | +:host-context(ion-toolbar).searchbar-should-show-cancel .searchbar-cancel-button { |
| 99 | + /** |
| 100 | + * The left edge of the cancel button |
| 101 | + * should align with the left edge |
| 102 | + * of the back button if the searchbar |
| 103 | + * is used in a toolbar regardless of |
| 104 | + * the searchbar size. |
| 105 | + */ |
| 106 | + @include globals.position-horizontal(9px, null); |
| 107 | +} |
| 108 | + |
| 109 | +:host-context(ion-toolbar).searchbar-should-show-cancel .searchbar-input { |
| 110 | + /** |
| 111 | + * Padding start is based on |
| 112 | + * the alignment of the back button, |
| 113 | + * the size of the leading icon (search or cancel), |
| 114 | + * and the gap between the icon and the input. |
| 115 | + */ |
| 116 | + padding-inline-start: calc(9px + globals.$ion-scale-400 + globals.$ion-space-200); |
125 | 117 | } |
126 | 118 |
|
127 | 119 | // Searchbar States |
|
172 | 164 | :host(.searchbar-shape-rectangular) { |
173 | 165 | --border-radius: #{globals.$ion-border-radius-0}; |
174 | 166 | } |
| 167 | + |
| 168 | +// Searchbar Sizes |
| 169 | +// -------------------------------------------------- |
| 170 | + |
| 171 | +/* Small */ |
| 172 | +:host(.searchbar-size-small) .searchbar-input { |
| 173 | + /** |
| 174 | + * Padding start is based on |
| 175 | + * desired padding from design, |
| 176 | + * the size of the leading icon (search or cancel), |
| 177 | + * and the gap between the icon and the input. |
| 178 | + * |
| 179 | + * Padding end is based on |
| 180 | + * desired padding from design, |
| 181 | + * the size of the trailing icon (clear), |
| 182 | + * and the gap between the icon and the input. |
| 183 | + */ |
| 184 | + @include globals.padding-horizontal(calc(globals.$ion-space-300 + globals.$ion-scale-400 + globals.$ion-space-200)); |
| 185 | + |
| 186 | + height: globals.$ion-scale-1000; |
| 187 | +} |
| 188 | + |
| 189 | +:host(.searchbar-size-small) .searchbar-search-icon, |
| 190 | +:host(.searchbar-size-small) .searchbar-cancel-button { |
| 191 | + // Start is based on the desired padding start from design. |
| 192 | + @include globals.position-horizontal(globals.$ion-space-300, null); |
| 193 | +} |
| 194 | + |
| 195 | +:host(.searchbar-size-small) .searchbar-clear-button { |
| 196 | + // End is based on the desired padding end from design. |
| 197 | + @include globals.position-horizontal(null, globals.$ion-space-300); |
| 198 | +} |
| 199 | + |
| 200 | +/* Medium */ |
| 201 | +:host(.searchbar-size-medium) .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 | + * the size of the trailing icon (clear), |
| 211 | + * and the gap between the icon and the input. |
| 212 | + */ |
| 213 | + @include globals.padding-horizontal(calc(globals.$ion-space-400 + globals.$ion-scale-400 + globals.$ion-space-200)); |
| 214 | + |
| 215 | + height: globals.$ion-scale-1200; |
| 216 | +} |
| 217 | + |
| 218 | +:host(.searchbar-size-medium) .searchbar-search-icon, |
| 219 | +:host(.searchbar-size-medium) .searchbar-cancel-button { |
| 220 | + // Start is based on the desired padding start from design. |
| 221 | + @include globals.position-horizontal(globals.$ion-space-400, null); |
| 222 | +} |
| 223 | + |
| 224 | +:host(.searchbar-size-medium) .searchbar-clear-button { |
| 225 | + // End is based on the desired padding end from design. |
| 226 | + @include globals.position-horizontal(null, globals.$ion-space-400); |
| 227 | +} |
| 228 | + |
| 229 | +/* Large */ |
| 230 | +:host(.searchbar-size-large) .searchbar-search-icon, |
| 231 | +:host(.searchbar-size-large) .searchbar-cancel-button { |
| 232 | + width: globals.$ion-scale-500; |
| 233 | + height: globals.$ion-scale-500; |
| 234 | +} |
| 235 | + |
| 236 | +:host(.searchbar-size-large) .searchbar-cancel-button { |
| 237 | + font-size: globals.$ion-font-size-500; |
| 238 | +} |
| 239 | + |
| 240 | +:host-context(ion-toolbar).searchbar-size-large.searchbar-should-show-cancel .searchbar-input { |
| 241 | + /** |
| 242 | + * Padding start is based on |
| 243 | + * the alignment of the back button, |
| 244 | + * the size of the leading icon (search or cancel), |
| 245 | + * and the gap between the icon and the input. |
| 246 | + */ |
| 247 | + padding-inline-start: calc(9px + globals.$ion-scale-500 + globals.$ion-space-200); |
| 248 | +} |
| 249 | + |
| 250 | +:host(.searchbar-size-large) .searchbar-input { |
| 251 | + @include globals.padding(globals.$ion-space-400, null); |
| 252 | + |
| 253 | + /** |
| 254 | + * Padding start is based on |
| 255 | + * desired padding from design, |
| 256 | + * the size of the leading icon (search or cancel), |
| 257 | + * and the gap between the icon and the input. |
| 258 | + * |
| 259 | + * Padding end is based on |
| 260 | + * desired padding from design, |
| 261 | + * the size of the trailing icon (clear), |
| 262 | + * and the gap between the icon and the input. |
| 263 | + */ |
| 264 | + @include globals.padding-horizontal( |
| 265 | + calc(globals.$ion-space-500 + globals.$ion-scale-500 + globals.$ion-space-200), |
| 266 | + calc(globals.$ion-space-500 + globals.$ion-scale-400 + globals.$ion-space-200) |
| 267 | + ); |
| 268 | + |
| 269 | + height: globals.$ion-scale-1400; |
| 270 | +} |
| 271 | + |
| 272 | +:host(.searchbar-size-large) .searchbar-search-icon, |
| 273 | +:host(.searchbar-size-large) .searchbar-cancel-button { |
| 274 | + // Start is based on the desired padding start from design. |
| 275 | + @include globals.position-horizontal(globals.$ion-space-500, null); |
| 276 | +} |
| 277 | + |
| 278 | +:host(.searchbar-size-large) .searchbar-clear-button { |
| 279 | + // End is based on the desired padding end from design. |
| 280 | + @include globals.position-horizontal(null, globals.$ion-space-500); |
| 281 | +} |
0 commit comments