PluginProbe
Code Snippets / 3.10.0-beta.1
Code Snippets v3.10.0-beta.1
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 3.10.0-beta.1, at css/common/_wp-admin.scss

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