header-search-wide.pcss.css

Same filename in other branches
  1. 10 core/themes/olivero/css/components/header-search-wide.pcss.css
  2. 11.x core/themes/olivero/css/components/header-search-wide.pcss.css

Header Search Wide Block.

File

core/themes/olivero/css/components/header-search-wide.pcss.css

View source
  1. /**
  2. * @file
  3. * Header Search Wide Block.
  4. */
  5. @import "../base/variables.pcss.css";
  6. /* Override contextual links so we can position against .site-header. */
  7. .block-search-wide.contextual-region {
  8. position: static;
  9. }
  10. .block-search-wide__wrapper {
  11. position: absolute;
  12. z-index: 1; /* Ensure left border shows above social region in IE11. */
  13. inset-block-start: 100%;
  14. inset-inline-start: 0;
  15. display: none;
  16. visibility: hidden;
  17. overflow: hidden;
  18. width: 100vw;
  19. max-width: var(--max-bg-color);
  20. height: var(--sp8);
  21. max-height: 0;
  22. margin-block: 0;
  23. margin-inline-start: 0;
  24. margin-inline-end: 0;
  25. padding-block: 0;
  26. padding-inline-start: 0;
  27. padding-inline-end: 0;
  28. transition: all 0.2s;
  29. border-inline-start: solid var(--content-left) var(--color--gray-10);
  30. background: var(--color--black);
  31. &.is-active {
  32. visibility: visible;
  33. max-height: var(--sp8);
  34. }
  35. & form {
  36. display: flex;
  37. grid-column: 1 / 14;
  38. }
  39. & input[type="search"] {
  40. width: calc(100% + var(--sp2));
  41. height: var(--sp8);
  42. padding-block: 0;
  43. padding-inline-start: var(--sp12);
  44. padding-inline-end: 0;
  45. transition: background-size 0.4s;
  46. color: var(--color--white);
  47. border: solid 1px transparent;
  48. box-shadow: none;
  49. font-family: var(--font-serif);
  50. font-size: 32px;
  51. -webkit-appearance: none;
  52. &::-ms-clear {
  53. width: 40px;
  54. opacity: 0.5;
  55. }
  56. &:focus {
  57. outline: solid 4px transparent;
  58. outline-offset: -4px;
  59. /*
  60. We normally indicate focus by animating background-image width. This isn't
  61. available in IE11 when in Windows high contrast mode.
  62. */
  63. @media screen and (-ms-high-contrast: active) {
  64. border-bottom-width: var(--sp0-5);
  65. }
  66. }
  67. }
  68. & .form-item-keys {
  69. flex-grow: 1;
  70. margin: 0;
  71. }
  72. & .form-actions {
  73. display: flex;
  74. margin: 0;
  75. }
  76. & .search-form__submit {
  77. position: relative;
  78. overflow: hidden;
  79. align-self: stretch;
  80. width: 100px;
  81. height: auto;
  82. margin-block: 0;
  83. margin-inline-start: 0;
  84. margin-inline-end: 0;
  85. padding-block: 0;
  86. padding-inline-start: 0;
  87. padding-inline-end: 0;
  88. cursor: pointer;
  89. border-color: transparent;
  90. background-color: transparent;
  91. /*
  92. When in Windows high contrast mode, FF will not output either background
  93. images or SVGs that are nested directly within a element, so we add a .
  94. */
  95. & .icon--search {
  96. position: absolute;
  97. inset-block-start: 0;
  98. inset-inline-end: 0;
  99. display: block;
  100. width: 24px; /* Width of the SVG background image. */
  101. height: 100%;
  102. pointer-events: none;
  103. background-image: url("../../images/search--white.svg");
  104. background-repeat: no-repeat;
  105. background-position: center;
  106. background-size: contain;
  107. &:after {
  108. position: absolute;
  109. inset-block-end: 0;
  110. inset-inline-start: 0;
  111. width: 100%;
  112. height: 0;
  113. content: "";
  114. transition: transform 0.2s;
  115. transform: scaleX(0);
  116. transform-origin: left;
  117. border-block-start: solid var(--sp0-5) var(--color--blue-50);
  118. }
  119. }
  120. &:focus {
  121. outline: solid 4px transparent;
  122. outline-offset: -4px;
  123. box-shadow: none;
  124. & span:after {
  125. transform: scaleX(1);
  126. }
  127. @media screen and (-ms-high-contrast: active) {
  128. border-bottom-width: var(--sp0-5);
  129. & span:after {
  130. content: none;
  131. }
  132. }
  133. }
  134. @media screen and (-ms-high-contrast: active) {
  135. /* IE11's high contrast show will not show the background image, so we show the text. */
  136. & .visually-hidden {
  137. position: static;
  138. overflow: visible;
  139. clip: auto;
  140. width: auto;
  141. height: auto;
  142. text-align: center;
  143. }
  144. /* Edge's high contrast does show the background image, so we hide it. */
  145. & .icon--search {
  146. display: none;
  147. }
  148. }
  149. }
  150. }
  151. .block-search-wide__container {
  152. max-width: var(--max-width);
  153. padding-inline-end: var(--sp2);
  154. }
  155. .block-search-wide__grid {
  156. display: grid;
  157. grid-template-columns: repeat(var(--grid-col-count--md), 1fr);
  158. grid-column-gap: var(--grid-gap--md);
  159. }
  160. /* Override specificity from container-inline.module.css */
  161. .container-inline {
  162. & .block-search-wide__container {
  163. display: block;
  164. }
  165. & .block-search-wide__grid {
  166. display: grid;
  167. }
  168. }
  169. .block-search-wide__button {
  170. position: relative;
  171. display: none;
  172. width: var(--sp3);
  173. height: var(--sp6);
  174. cursor: pointer;
  175. color: var(--color--gray-0); /* Affects SVG search icon. */
  176. border: 0;
  177. background: transparent;
  178. -webkit-appearance: none;
  179. &:focus {
  180. position: relative;
  181. outline: 0;
  182. &:after {
  183. position: absolute;
  184. top: 50%;
  185. left: 50%;
  186. width: 80%;
  187. height: var(--sp3);
  188. content: "";
  189. transform: translate(-50%, -50%);
  190. border: solid 2px var(--color--blue-50);
  191. border-radius: 4px;
  192. }
  193. }
  194. &[aria-expanded="true"] {
  195. background: var(--color--black);
  196. &:focus:after {
  197. border-color: var(--color--white);
  198. }
  199. & .block-search-wide__button-close {
  200. &:before,
  201. &:after {
  202. position: absolute;
  203. top: 50%;
  204. left: 50%;
  205. width: var(--sp1-5);
  206. height: 0;
  207. content: "";
  208. border-block-start: solid 2px var(--color--white);
  209. }
  210. &:before {
  211. transform: translate(-50%, -50%) rotate(-45deg);
  212. }
  213. &:after {
  214. transform: translate(-50%, -50%) rotate(45deg);
  215. }
  216. }
  217. & svg {
  218. display: none;
  219. }
  220. }
  221. & svg {
  222. margin-inline-start: auto;
  223. margin-inline-end: auto;
  224. }
  225. @media (forced-colors: active) {
  226. background: ButtonFace;
  227. & path {
  228. fill: ButtonText;
  229. }
  230. }
  231. }
  232. /* Provide rudimentary access to site search if JS is disabled. */
  233. html:not(.js) .search-block-form:focus-within .block-search-wide__wrapper {
  234. visibility: visible;
  235. max-height: var(--sp8);
  236. }
  237. /* Necessary to override specificity of transpiled PostCSS properties from default input focus styling. */
  238. [dir] .block-search-wide__wrapper input[type="search"] {
  239. background-color: transparent;
  240. background-image: linear-gradient(var(--color--blue-50), var(--color--blue-50)); /* Two values are needed for IE11 support. */
  241. background-repeat: no-repeat;
  242. background-position: bottom left; /* LTR */
  243. background-size: 0% 10px;
  244. &:focus {
  245. background-size: 100% var(--sp0-5);
  246. }
  247. }
  248. [dir="rtl"] .block-search-wide__wrapper {
  249. & input[type="search"] {
  250. background-position: bottom right;
  251. }
  252. & .search-form__submit .icon--search:after {
  253. transform-origin: right;
  254. }
  255. }
  256. body:not(.is-always-mobile-nav) {
  257. & .block-search-wide__wrapper,
  258. & .block-search-wide__button {
  259. @media (--nav) {
  260. display: block;
  261. }
  262. }
  263. }

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.