PluginProbe
Code Snippets / 4.0.0-beta.2
Code Snippets v4.0.0-beta.2
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
code-snippets / css / common / _wp-admin.scss

_wp-admin.scss in Code Snippets 4.0.0-beta.2, at css/common/_wp-admin.scss

189 lines 7.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 @use 'checkbox';
2 @use 'theme';
3
4 // Match the active subnavigation tile so it blends into the admin canvas.
5 body.wp-admin {
6 background: var(--cs-color-surface-muted);
7 }
8
9 // Remove the WordPress core 10px top margin on the import and manage snippets containers
10 // so the subnav band sits flush against the toolbar.
11 #import-container.wrap,
12 #manage-snippets-container.wrap {
13 margin-block-start: 0;
14 }
15
16 /**
17 * Native form control styling.
18 *
19 * WordPress core ships different control metrics between versions (30/32px classic,
20 * 40px with a 2px radius in the WP 7.0 "modern" redesign) and recolours secondary
21 * buttons with the modern accent (#3858E9). These rules apply the plugin's own control
22 * tokens — 38px height, 5px radius, theme control borders and the brand accent —
23 * to native elements inside our admin pages so the layout renders consistently across
24 * WP versions. They deliberately leave the admin menu, admin bar and
25 * `@wordpress/components` React widgets untouched — only native inputs/buttons
26 * rendered inside our own markup are normalised.
27 */
28
29 // Scope to our admin page content. We intentionally keep this to a single `.wrap` class so
30 // the rules sit just above WordPress core defaults (which we must override) but below the
31 // plugin's own more-specific per-control rules, which are emitted later in each bundle and so
32 // win on equal specificity. This lets bespoke controls (conditions button, row-action links,
33 // priority input, etc.) keep their intended styling without per-element exclusions here.
34 .wrap,
35 // Modals render through a portal on `document.body`, outside the page wrapper, so
36 // the plugin's own dialogs are listed here to pick up the same control tokens.
37 .code-snippets-preview-modal,
38 .code-snippets-modal {
39 // Native single-line text controls and selects: token height + border.
40 // `@wordpress/components` inputs/selects (`.components-*`) keep their own design — they
41 // are excluded so React widgets such as the tags token field are left untouched.
42 // `.snippet-priority` (the borderless list-table priority field) is excluded so it keeps
43 // its plain transparent styling rather than gaining a bordered box.
44 input[type='text']='text']:not([class*='components-'], [id^='react-select-']),
45 input[type='search']='search']:not([class*='components-']),
46 input[type='number']='number']:not([class*='components-'], .snippet-priority),
47 input[type='email']='email']:not([class*='components-']),
48 input[type='url']='url']:not([class*='components-']),
49 input[type='password']='password']:not([class*='components-']),
50 input[type='tel']='tel']:not([class*='components-']) {
51 // `min-block-size` (not a fixed `block-size`) so controls floor at the token height but
52 // can still flex-stretch where the layout calls for it (e.g. the 54px cloud search bar).
53 min-block-size: var(--cs-control-height);
54 padding-block: 0;
55 padding-inline: 8px;
56 border: 1px solid var(--cs-color-border);
57 border-radius: var(--cs-control-radius);
58 line-height: 2;
59 color: var(--cs-color-text);
60 font-size: 14px;
61
62 &:focus {
63 border-color: var(--cs-color-accent);
64 box-shadow: 0 0 0 1px var(--cs-color-accent);
65 outline: 2px solid transparent;
66 }
67 }
68
69 // Selects: same metrics, but preserve room for the WP dropdown chevron on the inline-end
70 // side. WP 7.0 keeps the chevron as a background image; clamping both paddings to 8px (as
71 // for text inputs) would let the arrow overlap the text, so the inline-end padding is wider.
72 select:not([class*='components-']) {
73 min-inline-size: 170px;
74 field-sizing: content;
75 min-block-size: var(--cs-control-height);
76 padding-block: 0;
77 padding-inline: 8px 24px;
78 border: 1px solid var(--cs-color-border);
79 border-radius: var(--cs-control-radius);
80
81 // WP 7.0 leaves a tall (≈38px) line-height on selects, pushing the value off-centre.
82 // Pin it so the text stays vertically centred within the token height.
83 line-height: 2;
84 color: var(--cs-color-text);
85 font-size: 14px;
86
87 &:focus {
88 border-color: var(--cs-color-accent);
89 box-shadow: 0 0 0 1px var(--cs-color-accent);
90 outline: 2px solid transparent;
91 }
92 }
93
94 // Secondary buttons: token geometry, the grey fill and the brand accent border/text in
95 // place of WP 7.0's transparent + modern-blue treatment. `.button-primary` is excluded
96 // so its solid fill below is not overwritten. The line-height centres text vertically
97 // in anchor-based buttons, which lack a button element's automatic centring.
98 .button:not(.button-primary, .button-link),
99 .button-secondary,
100 .page-title-action {
101 min-block-size: var(--cs-control-height);
102 padding-block: 0;
103 padding-inline: 12px;
104 border-radius: var(--cs-control-radius);
105 line-height: 2.5715;
106 font-size: 14px;
107 font-weight: 400;
108 background: var(--cs-color-surface-subtle);
109 border-color: var(--cs-color-accent);
110 color: var(--cs-color-accent);
111
112 &:hover:not(:disabled) {
113 background: var(--cs-color-surface-muted);
114 border-color: var(--cs-color-accent-hover);
115 color: var(--cs-color-accent-hover);
116 }
117
118 &:focus:not(:disabled) {
119 border-color: #3582c4;
120 box-shadow: 0 0 0 1px #3582c4;
121 outline: 2px solid transparent;
122 }
123 }
124
125 // Primary buttons: WP 7.0 recolours these with the modern accent and drops the solid
126 // fill. Restore the classic solid brand-accent fill with white text. The `:not`
127 // matches the secondary rule's specificity so a `.button-small.button-primary`
128 // keeps the token height instead of collapsing to the 26px small size.
129 .button-primary:not(.button-link) {
130 min-block-size: var(--cs-control-height);
131 padding-block: 0;
132 padding-inline: 12px;
133 border-radius: var(--cs-control-radius);
134 line-height: 2.5715;
135 font-size: 14px;
136 font-weight: 700;
137 background: var(--cs-color-accent);
138 border-color: var(--cs-color-accent);
139 color: #fff;
140
141 &:hover:not(:disabled) {
142 background: var(--cs-color-accent-hover);
143 border-color: var(--cs-color-accent-hover);
144 color: #fff;
145 }
146
147 &:focus:not(:disabled) {
148 background: var(--cs-color-accent-hover);
149 border-color: var(--cs-color-accent-hover);
150 box-shadow: 0 0 0 1px var(--cs-color-surface), 0 0 0 3px var(--cs-color-accent);
151 outline: 2px solid transparent;
152 }
153 }
154
155 // Small buttons stay compact rather than inheriting the 40px control height.
156 .button-small {
157 min-block-size: 26px;
158 line-height: 2.1818;
159 font-size: 11px;
160 }
161 }
162
163 .wp-core-ui .wrap .button .dashicons {
164 color: inherit;
165
166 // WP 7.0's taller button line-height leaks onto dashicon glyphs inside buttons (e.g. the
167 // conditions badge icon), pushing them out of vertical alignment. Reset it so icons stay
168 // centred — mirrors the existing `.button svg` rule for SVG icons.
169 line-height: 1;
170 }
171
172 // The Screen Options panel sits outside the page wrapper, in WordPress' own
173 // screen meta region. These stylesheets are only loaded on the plugin's screens,
174 // so its checkboxes are styled to match the ones in the page below it.
175 #adv-settings {
176 input[type='checkbox']='checkbox'] {
177 @include checkbox.canonical;
178 }
179
180 // The canonical checkbox drops the margin WordPress relies on here, and the
181 // gap otherwise comes from whitespace in the markup, which differs between
182 // the fieldsets this plugin prints and the ones WordPress prints.
183 label {
184 display: inline-flex;
185 align-items: center;
186 gap: 6px;
187 }
188 }
189