@primer/css 20.2.1-rc.1659cd9a → 20.2.2-rc.705b5cf4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/actionlist/action-list-item.scss +21 -0
- package/autocomplete/autocomplete.scss +3 -0
- package/dist/actionlist.css +1 -1
- package/dist/actionlist.css.map +1 -1
- package/dist/autocomplete.css.map +1 -1
- package/dist/core.css +1 -1
- package/dist/core.css.map +1 -1
- package/dist/forms.css +1 -1
- package/dist/forms.css.map +1 -1
- package/dist/meta.json +66 -66
- package/dist/primer.css +1 -1
- package/dist/primer.css.map +1 -1
- package/dist/stats/actionlist.json +1 -1
- package/dist/stats/core.json +1 -1
- package/dist/stats/forms.json +1 -1
- package/dist/stats/primer.json +1 -1
- package/forms/FormControl.scss +382 -0
- package/forms/index.scss +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
// stylelint-disable primer/typography, primer/borders, primer/spacing, primer/box-shadow, max-nesting-depth
|
|
2
|
+
|
|
3
|
+
// group label, field, caption and error message
|
|
4
|
+
.FormGroup {
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: var(--base-size-4, 4px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// fill container
|
|
11
|
+
.FormGroup--fullWidth {
|
|
12
|
+
display: flex;
|
|
13
|
+
|
|
14
|
+
// stretch field to fill container
|
|
15
|
+
.FormControl-fieldWrap {
|
|
16
|
+
flex-grow: 1;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// <label>
|
|
21
|
+
.FormControl-label {
|
|
22
|
+
font-size: var(--primer-text-body-size-medium, 14px);
|
|
23
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
|
24
|
+
line-height: var(--primer-text-body-lineHeight-medium, 20px);
|
|
25
|
+
user-select: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// optional caption
|
|
29
|
+
.FormControl-caption {
|
|
30
|
+
margin-bottom: 0;
|
|
31
|
+
font-size: var(--primer-text-caption-size, 12px);
|
|
32
|
+
font-weight: var(--primer-text-caption-weight, 400);
|
|
33
|
+
line-height: var(--primer-text-caption-lineHeight, 16px);
|
|
34
|
+
color: var(--color-fg-muted);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.FormControl-validation {
|
|
38
|
+
display: flex;
|
|
39
|
+
font-size: var(--primer-text-caption-size, 12px);
|
|
40
|
+
font-weight: var(--base-text-weight-semibold, 600);
|
|
41
|
+
color: var(--color-danger-fg);
|
|
42
|
+
fill: var(--color-danger-fg);
|
|
43
|
+
flex-direction: row;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: var(--base-size-4, 4px);
|
|
46
|
+
|
|
47
|
+
// stylelint-disable-next-line selector-max-type
|
|
48
|
+
p {
|
|
49
|
+
margin-bottom: 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// shared among all form control components (input, select, textarea, checkbox, radio)
|
|
54
|
+
.FormControl {
|
|
55
|
+
background-color: var(--color-canvas-default);
|
|
56
|
+
border: solid var(--primer-borderWidth-thin, 1px) var(--color-border-default);
|
|
57
|
+
|
|
58
|
+
&[disabled] {
|
|
59
|
+
color: var(--color-primer-fg-disabled);
|
|
60
|
+
background-color: var(--color-input-disabled-bg);
|
|
61
|
+
border-color: var(--color-border-default);
|
|
62
|
+
-webkit-text-fill-color: var(--color-primer-fg-disabled);
|
|
63
|
+
opacity: 1;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:not(:focus)[invalid] {
|
|
67
|
+
border-color: var(--color-danger-emphasis);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// <select> and <input>
|
|
71
|
+
&.FormControl--input,
|
|
72
|
+
&.FormControl--select {
|
|
73
|
+
height: var(--primer-control-medium-size, 32px);
|
|
74
|
+
font-size: var(--primer-text-body-size-medium, 14px);
|
|
75
|
+
line-height: var(--primer-text-body-lineHeight-medium, 20px);
|
|
76
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
|
77
|
+
padding-inline: var(--primer-control-medium-paddingInline-condensed, 8px);
|
|
78
|
+
transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
|
|
79
|
+
transition-property: color, background-color, box-shadow, border-color;
|
|
80
|
+
|
|
81
|
+
&[disabled] {
|
|
82
|
+
&::placeholder {
|
|
83
|
+
color: var(--color-primer-fg-disabled);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
::placeholder {
|
|
88
|
+
color: var(--color-fg-subtle);
|
|
89
|
+
opacity: 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// sizes
|
|
94
|
+
|
|
95
|
+
&.FormControl--small {
|
|
96
|
+
height: var(--primer-control-small-size, 28px);
|
|
97
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.FormControl--medium {
|
|
101
|
+
height: var(--primer-control-medium-size, 32px);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.FormControl--large {
|
|
105
|
+
height: var(--primer-control-large-size, 40px);
|
|
106
|
+
padding-inline: var(--primer-control-large-paddingInline-normal, 12px);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// pseudo input styles to allow for visual and action slots
|
|
111
|
+
// set input styles on -fieldWrap, remove styles from <input>
|
|
112
|
+
.FormControl-fieldWrap {
|
|
113
|
+
display: inline-grid;
|
|
114
|
+
height: var(--primer-control-medium-size, 32px);
|
|
115
|
+
background-color: var(--color-canvas-default);
|
|
116
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
|
117
|
+
box-shadow: var(--primer-borderInset-thin, 1px) var(--color-border-default);
|
|
118
|
+
grid-template-rows: auto;
|
|
119
|
+
gap: var(--primer-controlStack-medium-gap-condensed, 8px);
|
|
120
|
+
align-items: center;
|
|
121
|
+
align-content: center;
|
|
122
|
+
padding-inline: var(--primer-control-medium-paddingInline-condensed, 8px);
|
|
123
|
+
|
|
124
|
+
.FormControl {
|
|
125
|
+
padding: unset;
|
|
126
|
+
background-color: transparent;
|
|
127
|
+
border: 0;
|
|
128
|
+
|
|
129
|
+
&:focus-visible,
|
|
130
|
+
&:focus {
|
|
131
|
+
outline: none;
|
|
132
|
+
box-shadow: none;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
&:focus-within {
|
|
137
|
+
@include focusBoxShadowInset(2px, var(--color-accent-fg));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&.FormControl-fieldWrap--disabled {
|
|
141
|
+
color: var(--color-primer-fg-disabled);
|
|
142
|
+
background-color: var(--color-input-disabled-bg);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&.FormControl-fieldWrap--invalid:not(:focus-within) {
|
|
146
|
+
box-shadow: var(--primer-borderInset-thin, 1px) var(--color-danger-emphasis);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// if leadingVisual is present
|
|
150
|
+
&.FormControl-fieldWrap--input-leadingVisual {
|
|
151
|
+
grid-template-columns: var(--base-size-16, 16px) minmax(0, auto);
|
|
152
|
+
|
|
153
|
+
.FormControl--input {
|
|
154
|
+
padding-inline-start: calc(var(--base-size-16, 16px) + var(--primer-control-medium-paddingInline-condensed, 8px));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// if leadingVisual and trailingAction are present
|
|
158
|
+
&.FormControl-fieldWrap--input-trailingAction {
|
|
159
|
+
grid-template-columns: var(--base-size-16, 16px) minmax(0, auto) min-content;
|
|
160
|
+
|
|
161
|
+
.FormControl--input-trailingAction {
|
|
162
|
+
grid-column: 3 / 4;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// if trailingAction is present
|
|
168
|
+
&.FormControl-fieldWrap--input-trailingAction {
|
|
169
|
+
grid-template-columns: minmax(0, auto) min-content;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
&.FormControl-fieldWrap--input {
|
|
173
|
+
grid-template-rows: max-content;
|
|
174
|
+
|
|
175
|
+
.FormControl--input-leadingVisual {
|
|
176
|
+
grid-column: 1 / 2;
|
|
177
|
+
grid-row: 1;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// <input> spans entire grid
|
|
181
|
+
.FormControl--input {
|
|
182
|
+
grid-column: 1 / -1;
|
|
183
|
+
grid-row: 1;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// TODO: replace with new Button component
|
|
187
|
+
// trailingAction will auto fill last grid slot
|
|
188
|
+
.FormControl--input-trailingAction {
|
|
189
|
+
display: grid;
|
|
190
|
+
width: calc(var(--primer-control-medium-size, 32px) - var(--base-size-4, 4px));
|
|
191
|
+
height: calc(var(--primer-control-medium-size, 32px) - var(--base-size-4, 4px));
|
|
192
|
+
padding: 0;
|
|
193
|
+
// optically align the icon with field padding
|
|
194
|
+
margin-right: calc(calc(var(--primer-control-medium-paddingInline-condensed, 8px) - 0.125rem) * -1);
|
|
195
|
+
color: var(--color-fg-muted);
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
user-select: none;
|
|
198
|
+
background-color: transparent;
|
|
199
|
+
border: solid var(--primer-borderWidth-thin, 1px) transparent;
|
|
200
|
+
border-radius: var(--primer-borderRadius-medium, 6px);
|
|
201
|
+
transition: 0.2s cubic-bezier(0.3, 0, 0.5, 1);
|
|
202
|
+
transition-property: color, background-color, border-color;
|
|
203
|
+
grid-row: 1;
|
|
204
|
+
place-content: center;
|
|
205
|
+
place-self: center end;
|
|
206
|
+
grid-column: 2 / 3;
|
|
207
|
+
|
|
208
|
+
&:hover {
|
|
209
|
+
background-color: var(--color-btn-hover-bg);
|
|
210
|
+
border: solid var(--primer-borderWidth-thin, 1px) var(--color-btn-hover-bg);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&[disabled] {
|
|
214
|
+
color: var(--color-primer-fg-disabled);
|
|
215
|
+
pointer-events: none;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// sizes
|
|
220
|
+
|
|
221
|
+
// these selectors can be refactored to use :has()
|
|
222
|
+
&.FormControl--small {
|
|
223
|
+
height: var(--primer-control-small-size, 28px);
|
|
224
|
+
font-size: var(--primer-text-body-size-small, 12px);
|
|
225
|
+
|
|
226
|
+
.FormControl--input-trailingAction {
|
|
227
|
+
width: calc(var(--primer-control-small-size, 28px) - var(--base-size-8, 8px));
|
|
228
|
+
height: calc(var(--primer-control-small-size, 28px) - var(--base-size-8, 8px));
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
&.FormControl--medium {
|
|
233
|
+
height: var(--primer-control-medium-size, 32px);
|
|
234
|
+
|
|
235
|
+
.FormControl--input-trailingAction {
|
|
236
|
+
width: calc(var(--primer-control-medium-size, 32px) - var(--base-size-8, 8px));
|
|
237
|
+
height: calc(var(--primer-control-medium-size, 32px) - var(--base-size-8, 8px));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
&.FormControl--large {
|
|
242
|
+
height: var(--primer-control-large-size, 40px);
|
|
243
|
+
padding-inline: var(--primer-control-large-paddingInline-normal, 12px);
|
|
244
|
+
|
|
245
|
+
.FormControl--input-trailingAction {
|
|
246
|
+
width: calc(var(--primer-control-large-size, 40px) - var(--base-size-8, 8px));
|
|
247
|
+
height: calc(var(--primer-control-large-size, 40px) - var(--base-size-8, 8px));
|
|
248
|
+
margin-right: calc(calc(var(--primer-control-medium-paddingInline-normal, 12px) - 0.125rem) * -1);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.FormControl-fieldWrap--select {
|
|
255
|
+
grid-template-columns: minmax(0, auto) var(--base-size-16, 16px);
|
|
256
|
+
padding-inline-end: var(--primer-control-medium-paddingInline-condensed, 8px);
|
|
257
|
+
|
|
258
|
+
// mask allows for background-color to respect themes
|
|
259
|
+
&::after {
|
|
260
|
+
width: var(--base-size-16, 16px);
|
|
261
|
+
height: var(--base-size-16, 16px);
|
|
262
|
+
pointer-events: none;
|
|
263
|
+
content: '';
|
|
264
|
+
background-color: var(--color-fg-muted);
|
|
265
|
+
mask: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0iIzU4NjA2OSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNNC40MjcgOS40MjdsMy4zOTYgMy4zOTZhLjI1MS4yNTEgMCAwMC4zNTQgMGwzLjM5Ni0zLjM5NkEuMjUuMjUgMCAwMDExLjM5NiA5SDQuNjA0YS4yNS4yNSAwIDAwLS4xNzcuNDI3ek00LjQyMyA2LjQ3TDcuODIgMy4wNzJhLjI1LjI1IDAgMDEuMzU0IDBMMTEuNTcgNi40N2EuMjUuMjUgMCAwMS0uMTc3LjQyN0g0LjZhLjI1LjI1IDAgMDEtLjE3Ny0uNDI3eiIgLz48L3N2Zz4=');
|
|
266
|
+
mask-size: cover;
|
|
267
|
+
grid-column: 2;
|
|
268
|
+
grid-row: 1;
|
|
269
|
+
place-self: center end;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// spans entire grid below mask
|
|
273
|
+
.FormControl {
|
|
274
|
+
grid-column: 1/-1;
|
|
275
|
+
grid-row: 1;
|
|
276
|
+
appearance: none;
|
|
277
|
+
padding-right: var(--base-size-16, 16px);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.FormGroup--checkbox {
|
|
282
|
+
display: inline-grid;
|
|
283
|
+
grid-template-areas: 'field label' '. caption';
|
|
284
|
+
gap: var(--base-size-8, 8px);
|
|
285
|
+
|
|
286
|
+
.FormControl-label {
|
|
287
|
+
grid-area: label;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.FormControl-caption {
|
|
291
|
+
grid-area: caption;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// checkbox + radio specific styles
|
|
296
|
+
|
|
297
|
+
.FormControl--checkbox,
|
|
298
|
+
.FormControl--radio {
|
|
299
|
+
position: absolute;
|
|
300
|
+
width: var(--base-size-16, 16px);
|
|
301
|
+
height: var(--base-size-16, 16px);
|
|
302
|
+
opacity: 0;
|
|
303
|
+
|
|
304
|
+
&:checked {
|
|
305
|
+
+ .FormControl--checkbox-svg {
|
|
306
|
+
.FormControl--checkbox-background {
|
|
307
|
+
fill: var(--color-accent-fg);
|
|
308
|
+
stroke: var(--color-accent-fg);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.FormControl--checkbox-check {
|
|
312
|
+
fill: var(--color-fg-on-emphasis);
|
|
313
|
+
visibility: visible;
|
|
314
|
+
|
|
315
|
+
@media screen and (prefers-reduced-motion: no-preference) {
|
|
316
|
+
animation: checkmarkIn 200ms cubic-bezier(0.11, 0, 0.5, 0) forwards;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
&:indeterminate {
|
|
323
|
+
+ .FormControl--checkbox-svg {
|
|
324
|
+
.FormControl--checkbox-background {
|
|
325
|
+
fill: var(--color-accent-fg);
|
|
326
|
+
stroke: var(--color-accent-fg);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.FormControl--checkbox-indeterminate {
|
|
330
|
+
fill: var(--color-fg-on-emphasis);
|
|
331
|
+
visibility: visible;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
@keyframes checkmarkIn {
|
|
337
|
+
from {
|
|
338
|
+
clip-path: inset(16px 0 0 0);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
to {
|
|
342
|
+
clip-path: inset(0 0 0 0);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
@keyframes checkmarkOut {
|
|
347
|
+
from {
|
|
348
|
+
clip-path: inset(0 0 0 0);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
to {
|
|
352
|
+
clip-path: inset(16px 0 0 0);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.FormControl--checkbox-svg {
|
|
358
|
+
width: var(--base-size-16, 16px);
|
|
359
|
+
height: var(--base-size-16, 16px);
|
|
360
|
+
margin-top: 0.125rem;
|
|
361
|
+
cursor: pointer;
|
|
362
|
+
|
|
363
|
+
.FormControl--checkbox-background {
|
|
364
|
+
fill: var(--color-canvas-default);
|
|
365
|
+
stroke: var(--color-border-default);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.FormControl--checkbox-check {
|
|
369
|
+
visibility: hidden;
|
|
370
|
+
transition: visibility 0s linear 200ms;
|
|
371
|
+
clip-path: inset(16px 0 0 0);
|
|
372
|
+
|
|
373
|
+
@media screen and (prefers-reduced-motion: no-preference) {
|
|
374
|
+
animation: checkmarkOut 200ms cubic-bezier(0.11, 0, 0.5, 0) forwards;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.FormControl--checkbox-indeterminate {
|
|
379
|
+
fill: transparent;
|
|
380
|
+
visibility: hidden;
|
|
381
|
+
}
|
|
382
|
+
}
|
package/forms/index.scss
CHANGED
package/package.json
CHANGED