Debian Codegraph @

src/pydata_sphinx_theme/assets/styles/components/_search.scss

raw
1 /**
2 * Search field
3 **/
4 .bd-search {
5 position: relative;
6 padding-left: 0.5rem;
7 gap: 0.5rem;
8 background-color: var(--pst-color-background);
9 border-radius: $admonition-border-radius;
10 border: 1px solid var(--pst-color-border);
11 color: var(--pst-color-text-base);
12
13 // Background should always be same color regardless of active or not
14 &:active {
15 background-color: var(--pst-color-background);
16 color: var(--pst-color-text-muted);
17 }
18
19 // Hoist the focus ring from the input field to its parent
20 &:focus-within {
21 box-shadow: $focus-ring-box-shadow;
22
23 input:focus {
24 box-shadow: none;
25 }
26 }
27
28 .icon {
29 position: absolute;
30 color: var(--pst-color-border);
31 left: 25px;
32 }
33
34 .fa-solid.fa-magnifying-glass {
35 position: absolute;
36 left: calc((2.5rem - 0.7em) / 2);
37 color: var(--pst-color-text-muted);
38 }
39
40 input.form-control {
41 background-color: var(--pst-color-background);
42 color: var(--pst-color-text-base);
43 border: none;
44
45 // Inner-text of the search bar
46 &::placeholder {
47 color: var(--pst-color-text-muted);
48 }
49
50 // Remove the little "x" that pops up when you start typing
51 &::-webkit-search-cancel-button,
52 &::-webkit-search-decoration {
53 appearance: none;
54 }
55
56 &:focus,
57 &:focus-visible {
58 color: var(--pst-color-text-muted);
59 }
60 }
61
62 // Shows off the keyboard shortcuts for the button
63 .search-button__kbd-shortcut {
64 display: none;
65 margin-inline-end: 0.5rem;
66 color: var(--pst-color-border);
67
68 @include media-breakpoint-up(md) {
69 display: flex;
70 }
71 }
72 }
73
74 /**
75 * Search button - located in the navbar
76 */
77 .search-button i {
78 // Search link icon should be a bit bigger since it is separate from icon links
79 font-size: 1.3rem;
80 }
81
82 /**
83 * The search modal <dialog>
84 */
85 #pst-search-dialog[open] {
86 margin: 15vh auto 0; // an open modal dialog has a fixed position, so these margins bring it 15% down the viewport height and center it horizontally
87 width: 90%;
88 max-width: 800px;
89 max-height: 80vh; // when we display search-as-you-type results in the modal, it needs to be able to expand in height
90 background-color: transparent;
91 padding: $focus-ring-width;
92 border: none;
93
94 &::backdrop {
95 background-color: black;
96 opacity: 0.5;
97 }
98
99 form.bd-search {
100 flex-grow: 0;
101
102 // Font and input text a bit bigger
103 svg,
104 input {
105 font-size: var(--pst-font-size-icon);
106 }
107 }
108
109 /* In pydata-sphinx-theme.js this container is appended below
110 * the query input node after the user types their search query.
111 * Search results are populated into this container using Sphinx's
112 * built-in, JS-powered local search tools. */
113 #search-results {
114 overflow-y: scroll;
115 background-color: var(--pst-color-background);
116 padding: 1em;
117
118 a {
119 color: var(--pst-color-link);
120 }
121
122 &.empty {
123 display: none;
124 }
125 }
126 }
127
128 /**
129 * The search button component that looks like a field.
130 * Lives at components/search-button-field.html
131 */
132 .search-button-field {
133 $search-button-border-radius: 1.5em;
134
135 display: inline-flex;
136 align-items: center;
137 border: var(--pst-color-border) solid 1px;
138 border-radius: $search-button-border-radius;
139 color: var(--pst-color-text-muted);
140 padding: 0.5em;
141 background-color: var(--pst-color-surface);
142
143 &:hover {
144 box-shadow: 0 0 0 $focus-ring-width var(--pst-color-link-hover);
145 }
146
147 &:focus-visible {
148 border-radius: $search-button-border-radius;
149 }
150
151 // The keyboard shortcut text
152 .search-button__default-text {
153 font-size: var(--bs-nav-link-font-size);
154 font-weight: var(--bs-nav-link-font-weight);
155 margin-right: 0.5em;
156 margin-left: 0.5em;
157 }
158
159 .kbd-shortcut__modifier {
160 font-size: 0.75em;
161 }
162
163 // Ensures that all the text lines up in the middle
164 > * {
165 align-items: center;
166 }
167
168 // Only the icon should be visible on narrow screens
169 > :not(svg) {
170 display: none;
171
172 @include media-breakpoint-up(lg) {
173 display: flex;
174 }
175 }
176 }