|
1 | | -@use "searchbar.common"; |
2 | 1 | @use "../../themes/ionic/ionic.globals.scss" as globals; |
| 2 | +@use "searchbar.common"; |
| 3 | +@use "./searchbar.ionic.vars" as searchbarVars; |
3 | 4 |
|
4 | 5 | // Ionic Searchbar |
5 | 6 | // -------------------------------------------------- |
6 | 7 |
|
7 | 8 | :host { |
| 9 | + /** |
| 10 | + * @prop --focus-ring-color: The color of the ring around the focused element. |
| 11 | + * @prop --focus-ring-width: The width of the ring around the focused element. |
| 12 | + */ |
8 | 13 | --background: #{globals.$ionic-color-neutral-100}; |
9 | | - --border-radius: #{globals.$ionic-border-radius-800}; |
| 14 | + --border-radius: #{globals.$ionic-border-radius-400}; |
10 | 15 | --box-shadow: none; |
11 | 16 | --cancel-button-color: #{globals.$ionic-color-neutral-800}; |
12 | | - --clear-button-color: #{globals.$ionic-color-neutral-800}; |
13 | | - --color: #{globals.$ionic-color-neutral-800}; |
| 17 | + --clear-button-color: #{globals.$ionic-color-neutral-1000}; |
| 18 | + --color: #{globals.$ionic-color-neutral-1200}; |
14 | 19 | --icon-color: #{globals.$ionic-color-neutral-800}; |
| 20 | + --placeholder-color: #{globals.$ionic-color-neutral-800}; |
| 21 | + --focus-ring-color: #{globals.$ionic-state-focus-1}; |
| 22 | + --focus-ring-width: #{globals.$ionic-border-size-050}; |
15 | 23 |
|
| 24 | + @include globals.typography(globals.$ionic-body-md-regular); |
16 | 25 | @include globals.padding(0); |
17 | | - |
18 | | - min-height: globals.$ionic-scale-1000; |
19 | | - |
20 | | - contain: content; |
21 | | -} |
22 | | - |
23 | | -.searchbar-input-container { |
24 | | - min-height: globals.$ionic-scale-1000; |
25 | 26 | } |
26 | 27 |
|
27 | 28 | // Searchbar Search Icon |
28 | 29 | // ----------------------------------------- |
29 | 30 |
|
30 | 31 | .searchbar-search-icon { |
31 | | - display: none; |
| 32 | + @include globals.position( |
| 33 | + searchbarVars.$searchbar-ionic-input-search-icon-size, |
| 34 | + null, |
| 35 | + null, |
| 36 | + searchbarVars.$searchbar-ionic-input-search-icon-size |
| 37 | + ); |
| 38 | + |
| 39 | + width: searchbarVars.$searchbar-ionic-input-search-icon-size; |
| 40 | + height: searchbarVars.$searchbar-ionic-input-search-icon-size; |
32 | 41 | } |
33 | 42 |
|
34 | 43 | // Searchbar Input Field |
35 | 44 | // ----------------------------------------- |
36 | 45 |
|
37 | 46 | .searchbar-input { |
38 | | - @include globals.padding(globals.$ionic-space-300); |
39 | | - |
40 | | - height: 100%; |
| 47 | + @include globals.padding( |
| 48 | + globals.$ionic-space-300, |
| 49 | + searchbarVars.$searchbar-ionic-padding-end, |
| 50 | + globals.$ionic-space-300, |
| 51 | + searchbarVars.$searchbar-ionic-padding-start |
| 52 | + ); |
41 | 53 |
|
42 | | - font-size: globals.$ionic-font-size-350; |
43 | | - font-weight: globals.$ionic-font-weight-regular; |
| 54 | + min-height: globals.$ionic-scale-1200; |
44 | 55 |
|
45 | 56 | contain: strict; |
46 | 57 | } |
|
49 | 60 | // ----------------------------------------- |
50 | 61 |
|
51 | 62 | .searchbar-clear-button { |
52 | | - @include globals.position(50%, globals.$ionic-space-200, null, null); |
53 | | - |
54 | | - position: absolute; |
| 63 | + @include globals.position( |
| 64 | + searchbarVars.$searchbar-ionic-input-clear-icon-size, |
| 65 | + searchbarVars.$searchbar-ionic-input-clear-icon-size, |
| 66 | + null, |
| 67 | + null |
| 68 | + ); |
55 | 69 |
|
56 | | - width: globals.$ionic-scale-600; |
57 | | - height: globals.$ionic-scale-600; |
58 | | - |
59 | | - transform: translateY(-50%); |
| 70 | + width: searchbarVars.$searchbar-ionic-input-clear-icon-size; |
| 71 | + height: searchbarVars.$searchbar-ionic-input-clear-icon-size; |
60 | 72 |
|
61 | 73 | background-color: transparent; |
62 | 74 |
|
|
65 | 77 | contain: strict; |
66 | 78 | } |
67 | 79 |
|
| 80 | +// Searchbar Cancel Icon |
| 81 | +// ----------------------------------------- |
| 82 | + |
| 83 | +.searchbar-cancel-button { |
| 84 | + /** |
| 85 | + * The left edge of the cancel button |
| 86 | + * should align with the left edge |
| 87 | + * of the back button if the searchbar |
| 88 | + * is used in a toolbar. |
| 89 | + */ |
| 90 | + @include globals.position(0, null, null, 9px); |
| 91 | + |
| 92 | + font-size: globals.$ionic-font-size-400; |
| 93 | +} |
| 94 | + |
| 95 | +// Searchbar Search & Clear Icon & Cancel Icon |
| 96 | +// ----------------------------------------- |
| 97 | + |
| 98 | +.searchbar-search-icon, |
| 99 | +.searchbar-clear-button, |
| 100 | +.searchbar-cancel-button { |
| 101 | + position: absolute; |
| 102 | +} |
| 103 | + |
68 | 104 | // Searchbar in Toolbar |
69 | 105 | // ----------------------------------------- |
70 | 106 |
|
71 | 107 | :host-context(ion-toolbar) { |
72 | | - min-height: globals.$ionic-scale-1000; |
| 108 | + min-height: globals.$ionic-scale-1200; |
| 109 | +} |
| 110 | + |
| 111 | +// Searchbar States |
| 112 | +// -------------------------------------------------- |
| 113 | + |
| 114 | +/* Hover */ |
| 115 | +:host(:hover) { |
| 116 | + --icon-color: #{globals.$ionic-color-neutral-900}; |
| 117 | +} |
| 118 | + |
| 119 | +/* Focus */ |
| 120 | +:host(.searchbar-has-focus) .searchbar-input { |
| 121 | + outline: var(--focus-ring-width) globals.$ionic-border-style-solid var(--focus-ring-color); |
| 122 | +} |
| 123 | + |
| 124 | +:host(.searchbar-has-focus) .searchbar-search-icon { |
| 125 | + display: block; |
| 126 | +} |
| 127 | + |
| 128 | +:host(.searchbar-has-focus) .searchbar-cancel-button, |
| 129 | +:host(.searchbar-should-show-cancel) .searchbar-cancel-button { |
| 130 | + display: block; |
| 131 | +} |
| 132 | + |
| 133 | +:host(.searchbar-has-focus) .searchbar-cancel-button + .searchbar-search-icon, |
| 134 | +:host(.searchbar-should-show-cancel) .searchbar-cancel-button + .searchbar-search-icon { |
| 135 | + display: none; |
| 136 | +} |
| 137 | + |
| 138 | +/* Disabled */ |
| 139 | +:host(.searchbar-disabled) { |
| 140 | + --color: #{globals.$ionic-color-neutral-500}; |
| 141 | + --icon-color: #{globals.$ionic-color-neutral-500}; |
| 142 | + --placeholder-color: #{globals.$ionic-color-neutral-500}; |
| 143 | + |
| 144 | + cursor: default; |
| 145 | + pointer-events: none; |
73 | 146 | } |
0 commit comments