@primer/css 0.0.0-20220114215001 → 0.0.0-20220118041832
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 +1 -5
- package/actionlist/action-list-item.scss +11 -6
- package/base/base.scss +2 -56
- package/base/normalize.scss +52 -12
- package/button-refactor/ButtonsLinksAPI.md +127 -0
- package/button-refactor/button-styled-as-link.scss +0 -0
- package/button-refactor/button.scss +204 -0
- package/button-refactor/icon-button.scss +10 -0
- package/button-refactor/link-styled-as-button.scss +0 -0
- package/button-refactor/link.scss +61 -0
- package/buttons/button.scss +25 -0
- package/buttons/misc.scss +19 -12
- package/core/index.scss +5 -1
- package/dist/actionlist.css +1 -1
- package/dist/actionlist.css.map +1 -1
- package/dist/alerts.css.map +1 -1
- package/dist/autocomplete.css.map +1 -1
- package/dist/avatars.css.map +1 -1
- package/dist/base.css +1 -1
- package/dist/base.css.map +1 -1
- package/dist/blankslate.css.map +1 -1
- package/dist/box.css.map +1 -1
- package/dist/branch-name.css.map +1 -1
- package/dist/breadcrumb.css.map +1 -1
- package/dist/buttons.css +1 -1
- package/dist/buttons.css.map +1 -1
- package/dist/core.css +1 -1
- package/dist/core.css.map +1 -1
- package/dist/dropdown.css +1 -1
- package/dist/dropdown.css.map +1 -1
- package/dist/forms.css +1 -1
- package/dist/forms.css.map +1 -1
- package/dist/header.css.map +1 -1
- package/dist/labels.css.map +1 -1
- package/dist/layout.css.map +1 -1
- package/dist/links.css.map +1 -1
- package/dist/loaders.css.map +1 -1
- package/dist/markdown.css.map +1 -1
- package/dist/marketing-buttons.css +1 -1
- package/dist/marketing-buttons.css.map +1 -1
- package/dist/marketing-links.css +1 -1
- package/dist/marketing-links.css.map +1 -1
- package/dist/marketing-type.css.map +1 -1
- package/dist/marketing-utilities.css.map +1 -1
- package/dist/marketing.css +1 -1
- package/dist/marketing.css.map +1 -1
- package/dist/meta.json +33 -33
- package/dist/navigation.css +1 -1
- package/dist/navigation.css.map +1 -1
- package/dist/pagination.css.map +1 -1
- package/dist/popover.css.map +1 -1
- package/dist/primer.css +3 -3
- package/dist/primer.css.map +1 -1
- package/dist/product.css +1 -1
- package/dist/product.css.map +1 -1
- package/dist/progress.css.map +1 -1
- package/dist/select-menu.css.map +1 -1
- package/dist/stats/actionlist.json +1 -1
- package/dist/stats/base.json +1 -1
- package/dist/stats/buttons.json +1 -1
- package/dist/stats/core.json +1 -1
- package/dist/stats/dropdown.json +1 -1
- package/dist/stats/forms.json +1 -1
- package/dist/stats/marketing-buttons.json +1 -1
- package/dist/stats/marketing-links.json +1 -1
- package/dist/stats/marketing.json +1 -1
- package/dist/stats/navigation.json +1 -1
- package/dist/stats/primer.json +1 -1
- package/dist/stats/product.json +1 -1
- package/dist/stats/toasts.json +1 -1
- package/dist/stats/utilities.json +1 -1
- package/dist/subhead.css.map +1 -1
- package/dist/timeline.css.map +1 -1
- package/dist/toasts.css +1 -1
- package/dist/toasts.css.map +1 -1
- package/dist/tooltips.css.map +1 -1
- package/dist/truncate.css.map +1 -1
- package/dist/utilities.css +1 -1
- package/dist/utilities.css.map +1 -1
- package/dropdown/dropdown.scss +2 -0
- package/forms/form-control.scss +8 -0
- package/forms/form-group.scss +13 -38
- package/forms/input-group.scss +0 -8
- package/marketing/buttons/button.scss +30 -4
- package/marketing/links/link.scss +4 -1
- package/navigation/menu.scss +8 -6
- package/navigation/sidenav.scss +10 -1
- package/navigation/tabnav.scss +2 -6
- package/package.json +1 -1
- package/support/mixins/misc.scss +0 -7
- package/toasts/toasts.scss +4 -7
- package/utilities/details.scss +3 -40
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# @primer/css
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
4
|
-
|
|
5
|
-
### Major Changes
|
|
6
|
-
|
|
7
|
-
- [#1744](https://github.com/primer/css/pull/1744) [`d0425dcd`](https://github.com/primer/css/commit/d0425dcddb801260aaae7dbcc75acaeecdfbeb6a) Thanks [@langermank](https://github.com/langermank)! - Global CSS focus styles
|
|
3
|
+
## 0.0.0-20220118041832
|
|
8
4
|
|
|
9
5
|
### Minor Changes
|
|
10
6
|
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
// stylelint-disable max-nesting-depth, selector-max-specificity
|
|
2
2
|
|
|
3
|
+
@mixin focusOutline {
|
|
4
|
+
position: relative;
|
|
5
|
+
z-index: 1;
|
|
6
|
+
outline: none;
|
|
7
|
+
box-shadow: 0 0 0 2px var(--color-accent-fg); // this color breaks convention
|
|
8
|
+
}
|
|
9
|
+
|
|
3
10
|
@mixin activeIndicatorLine {
|
|
4
11
|
position: absolute;
|
|
5
12
|
top: calc(50% - 12px);
|
|
@@ -30,12 +37,6 @@
|
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
39
|
|
|
33
|
-
// li only: focus, a href: focus-within on li
|
|
34
|
-
&:focus,
|
|
35
|
-
&:focus-within {
|
|
36
|
-
@include focusOutline;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
40
|
// only hover li without list as children
|
|
40
41
|
&:not(.ActionList-item--hasSubItem) {
|
|
41
42
|
@media (hover: hover) {
|
|
@@ -398,6 +399,10 @@
|
|
|
398
399
|
margin-right: $spacer-2;
|
|
399
400
|
}
|
|
400
401
|
|
|
402
|
+
&:focus-visible {
|
|
403
|
+
@include focusOutline;
|
|
404
|
+
}
|
|
405
|
+
|
|
401
406
|
// sizes
|
|
402
407
|
|
|
403
408
|
&.ActionList-content--sizeMedium {
|
package/base/base.scss
CHANGED
|
@@ -77,64 +77,10 @@ button {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
details {
|
|
80
|
-
summary {
|
|
81
|
-
cursor: pointer;
|
|
82
|
-
}
|
|
80
|
+
summary { cursor: pointer; }
|
|
83
81
|
|
|
84
82
|
&:not([open]) {
|
|
85
83
|
// Set details content hidden by default for browsers that don't do this
|
|
86
|
-
> *:not(summary) {
|
|
87
|
-
display: none !important;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// global focus styles
|
|
93
|
-
|
|
94
|
-
a,
|
|
95
|
-
button,
|
|
96
|
-
[role='button'],
|
|
97
|
-
input,
|
|
98
|
-
textarea,
|
|
99
|
-
select {
|
|
100
|
-
// fallback :focus state
|
|
101
|
-
&:focus {
|
|
102
|
-
@include focusOutline;
|
|
103
|
-
|
|
104
|
-
// remove fallback :focus if :focus-visible is supported
|
|
105
|
-
&:not(:focus-visible) {
|
|
106
|
-
outline: solid 1px transparent;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// default focus state
|
|
111
|
-
&:focus-visible {
|
|
112
|
-
@include focusOutline;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
input:not([type='radio'], [type='checkbox']),
|
|
117
|
-
textarea,
|
|
118
|
-
select {
|
|
119
|
-
&:focus,
|
|
120
|
-
&:focus-visible {
|
|
121
|
-
outline-offset: 0;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// for handling focus conditionally
|
|
126
|
-
.focus {
|
|
127
|
-
@include focusOutline;
|
|
128
|
-
|
|
129
|
-
&:is(input, textarea, select) {
|
|
130
|
-
outline-offset: 0;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Windows High Contrast mode
|
|
135
|
-
@media (forced-colors: active) {
|
|
136
|
-
*:focus {
|
|
137
|
-
outline: solid 1px transparent;
|
|
138
|
-
outline-offset: 2px;
|
|
84
|
+
> *:not(summary) { display: none !important; }
|
|
139
85
|
}
|
|
140
86
|
}
|
package/base/normalize.scss
CHANGED
|
@@ -39,8 +39,7 @@ header,
|
|
|
39
39
|
main, /* 2 */
|
|
40
40
|
menu,
|
|
41
41
|
nav,
|
|
42
|
-
section {
|
|
43
|
-
/* 1 */
|
|
42
|
+
section { /* 1 */
|
|
44
43
|
display: block;
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -97,6 +96,16 @@ a {
|
|
|
97
96
|
background-color: transparent; /* 1 */
|
|
98
97
|
}
|
|
99
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Remove the outline on focused links when they are also active or hovered
|
|
101
|
+
* in all browsers (opinionated).
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
a:active,
|
|
105
|
+
a:hover {
|
|
106
|
+
outline-width: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
100
109
|
/* Text-level semantics
|
|
101
110
|
========================================================================== */
|
|
102
111
|
|
|
@@ -269,8 +278,7 @@ optgroup {
|
|
|
269
278
|
*/
|
|
270
279
|
|
|
271
280
|
button,
|
|
272
|
-
input {
|
|
273
|
-
/* 1 */
|
|
281
|
+
input { /* 1 */
|
|
274
282
|
overflow: visible;
|
|
275
283
|
}
|
|
276
284
|
|
|
@@ -280,8 +288,7 @@ input {
|
|
|
280
288
|
*/
|
|
281
289
|
|
|
282
290
|
button,
|
|
283
|
-
select {
|
|
284
|
-
/* 1 */
|
|
291
|
+
select { /* 1 */
|
|
285
292
|
text-transform: none;
|
|
286
293
|
}
|
|
287
294
|
|
|
@@ -298,6 +305,29 @@ html [type="button"], /* 1 */
|
|
|
298
305
|
-webkit-appearance: button; /* 2 */
|
|
299
306
|
}
|
|
300
307
|
|
|
308
|
+
/**
|
|
309
|
+
* Remove the inner border and padding in Firefox.
|
|
310
|
+
*/
|
|
311
|
+
|
|
312
|
+
button::-moz-focus-inner,
|
|
313
|
+
[type="button"]::-moz-focus-inner,
|
|
314
|
+
[type="reset"]::-moz-focus-inner,
|
|
315
|
+
[type="submit"]::-moz-focus-inner {
|
|
316
|
+
border-style: none;
|
|
317
|
+
padding: 0;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Restore the focus styles unset by the previous rule.
|
|
322
|
+
*/
|
|
323
|
+
|
|
324
|
+
button:-moz-focusring,
|
|
325
|
+
[type="button"]:-moz-focusring,
|
|
326
|
+
[type="reset"]:-moz-focusring,
|
|
327
|
+
[type="submit"]:-moz-focusring {
|
|
328
|
+
outline: 1px dotted ButtonText;
|
|
329
|
+
}
|
|
330
|
+
|
|
301
331
|
/**
|
|
302
332
|
* Change the border, margin, and padding in all browsers (opinionated).
|
|
303
333
|
*/
|
|
@@ -337,8 +367,8 @@ textarea {
|
|
|
337
367
|
* 2. Remove the padding in IE 10-.
|
|
338
368
|
*/
|
|
339
369
|
|
|
340
|
-
[type=
|
|
341
|
-
[type=
|
|
370
|
+
[type="checkbox"],
|
|
371
|
+
[type="radio"] {
|
|
342
372
|
box-sizing: border-box; /* 1 */
|
|
343
373
|
padding: 0; /* 2 */
|
|
344
374
|
}
|
|
@@ -347,17 +377,27 @@ textarea {
|
|
|
347
377
|
* Correct the cursor style of increment and decrement buttons in Chrome.
|
|
348
378
|
*/
|
|
349
379
|
|
|
350
|
-
[type=
|
|
351
|
-
[type=
|
|
380
|
+
[type="number"]::-webkit-inner-spin-button,
|
|
381
|
+
[type="number"]::-webkit-outer-spin-button {
|
|
352
382
|
height: auto;
|
|
353
383
|
}
|
|
354
384
|
|
|
385
|
+
/**
|
|
386
|
+
* 1. Correct the odd appearance in Chrome and Safari.
|
|
387
|
+
* 2. Correct the outline style in Safari.
|
|
388
|
+
*/
|
|
389
|
+
|
|
390
|
+
[type="search"] {
|
|
391
|
+
-webkit-appearance: textfield; /* 1 */
|
|
392
|
+
outline-offset: -2px; /* 2 */
|
|
393
|
+
}
|
|
394
|
+
|
|
355
395
|
/**
|
|
356
396
|
* Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
|
|
357
397
|
*/
|
|
358
398
|
|
|
359
|
-
[type=
|
|
360
|
-
[type=
|
|
399
|
+
[type="search"]::-webkit-search-cancel-button,
|
|
400
|
+
[type="search"]::-webkit-search-decoration {
|
|
361
401
|
-webkit-appearance: none;
|
|
362
402
|
}
|
|
363
403
|
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Button and Link component APIs
|
|
2
|
+
Button and Link has been discussed in a number of issues and discussions over past few years. I went through the list below, took note of their purpose and started compiling a new API spec. This doc is is meant to be collaborative and accompany Storybook docs while we work through a final API recommendation. Once we have a solid plan, this can move into an issue and be delegated across frameworks.
|
|
3
|
+
|
|
4
|
+
Existing issues
|
|
5
|
+
[x] https://github.com/github/primer/issues/141
|
|
6
|
+
- Accessory button component, should reconcile with reaction button (sister component to Button)
|
|
7
|
+
[x] https://github.com/github/primer/issues/220
|
|
8
|
+
- Tracking issue, mentions Button in the context of API consistency
|
|
9
|
+
[x] https://github.com/github/primer/issues/253
|
|
10
|
+
- Button audit, anatomy spec, design considerations, some button link discussion, icon buttons (this issue is very informative!)
|
|
11
|
+
[x] https://github.com/github/primer/issues/263
|
|
12
|
+
- More design discussion, particularly focused on outline button
|
|
13
|
+
[x] https://github.com/github/primer/issues/272
|
|
14
|
+
- Make icon only buttons square
|
|
15
|
+
[x] https://github.com/github/primer/issues/321
|
|
16
|
+
- Super specific button use case?
|
|
17
|
+
[x] https://github.com/github/primer/issues/350
|
|
18
|
+
- a11y audit with task list for PVC
|
|
19
|
+
[x] https://github.com/github/primer/issues/382
|
|
20
|
+
- React button refactor
|
|
21
|
+
[x] https://github.com/github/primer/issues/468
|
|
22
|
+
- Visual bugs (colors, state)
|
|
23
|
+
[x] https://github.com/github/primer/discussions/87
|
|
24
|
+
- Discussion about accessory buttons
|
|
25
|
+
[x] https://github.com/github/primer/discussions/211
|
|
26
|
+
- Open ended discussion about primary button as dropdown
|
|
27
|
+
[x] https://github.com/github/primer/discussions/459
|
|
28
|
+
- Allie's thoughts on limiting icon only buttons and working towards encouraging visual labels
|
|
29
|
+
[x] https://github.com/github/primer/discussions/477
|
|
30
|
+
- Buttons styled as links, links styled as buttons
|
|
31
|
+
|
|
32
|
+
## Specific notes from previous bugs to keep in mind
|
|
33
|
+
[] Check all button variants have shadow present
|
|
34
|
+
[] Ensure icon colors are consistent in hover states
|
|
35
|
+
[] Ensure icon colors are consistent with variants in all states
|
|
36
|
+
[] Ensure disabled colors are consistent across frameworks
|
|
37
|
+
|
|
38
|
+
## Component list
|
|
39
|
+
A few discussions were about naming and prop drilling (source here). We found that for Button to handle all of its use cases, we would need a large number of props– some conditional and dependent on one another. When that happens, it's typically a sign that the logic should be separated into another component.
|
|
40
|
+
|
|
41
|
+
| Component | Description |
|
|
42
|
+
| -- | -- |
|
|
43
|
+
| Button | standard `button` with variants, size, visual slots |
|
|
44
|
+
| IconButton | `button` with icon only (square) and required `aria-label` |
|
|
45
|
+
| ButtonStyledAsLink | `button` that visually looks like a link |
|
|
46
|
+
| ReactionButton | `button` snowflake with specific styles/interaction design |
|
|
47
|
+
| ButtonGroup | wrapper to handle grouping buttons |
|
|
48
|
+
| Link | `a` with variants, optional trailing visuals |
|
|
49
|
+
| LinkStyledAsButton | `a` with button variants, required trailing visuals |
|
|
50
|
+
|
|
51
|
+
## Component API breakdown
|
|
52
|
+
|
|
53
|
+
### Button
|
|
54
|
+
|
|
55
|
+
| prop | type | options | default | notes |
|
|
56
|
+
| -- | -- | -- | -- | -- |
|
|
57
|
+
| `variant` | one-of string | `primary` `secondary` `danger` `outline`? | `secondary` | |
|
|
58
|
+
| `size` | one-of string | `small` `default` `large` | `default | |
|
|
59
|
+
| `label` | string | button description | null | |
|
|
60
|
+
| `aria-label` | string | button description for screen readers | null | |
|
|
61
|
+
| `aria-pressed` | boolean | `true/false` | `false` | |
|
|
62
|
+
| `leadingVisual` | children (slot) | octicon | null | |
|
|
63
|
+
| `trailingVisual` | children (slot) | octicon | null | |
|
|
64
|
+
| `trailingAction` | children (slot) | octicon | null | slot for caret to maintain leading/trailing visuals if they exist |
|
|
65
|
+
| `fullWidth` | boolean | `true/false` | `false` | |
|
|
66
|
+
| `visualPosition` | one-of string | `fixed` `some-other-word` | `fixed` | lock icon to the text label or to the button container |
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### LinkStyledAsButton
|
|
70
|
+
|
|
71
|
+
| prop | type | options | default | notes |
|
|
72
|
+
| -- | -- | -- | -- | -- |
|
|
73
|
+
| `variant` | one-of string | `primary` `secondary` `danger` `outline`? | `secondary` | |
|
|
74
|
+
| `size` | one-of string | `small` `default` `large` | `default | |
|
|
75
|
+
| `label` | string | button description | null | |
|
|
76
|
+
| `leadingVisual` | children (slot) | octicon | null | |
|
|
77
|
+
| `trailingVisual` | children (slot) | octicon | null | |
|
|
78
|
+
| `trailingAction` | children (slot) | octicon | null | slot for caret to maintain leading/trailing visuals if they exist |
|
|
79
|
+
| `fullWidth` | boolean | `true/false` | `false` | |
|
|
80
|
+
| `visualPosition` | one-of string | `fixed` `some-other-word` | `fixed` | lock icon to the text label or to the button container |
|
|
81
|
+
|
|
82
|
+
### IconButton
|
|
83
|
+
|
|
84
|
+
| prop | type | options | default | notes |
|
|
85
|
+
| -- | -- | -- | -- | -- |
|
|
86
|
+
| `variant` | one-of string | `primary` `secondary` `danger` `outline`? | `secondary` | |
|
|
87
|
+
| `size` | one-of string | `small` `default` `large` | `default | |
|
|
88
|
+
| `aria-label` | string | button description for screen readers (required) | null | |
|
|
89
|
+
| `visual` | children (slot) | octicon | null | |
|
|
90
|
+
| `aria-pressed` | boolean | `true/false` | `false` | |
|
|
91
|
+
|
|
92
|
+
### Link
|
|
93
|
+
|
|
94
|
+
| prop | type | options | default | notes |
|
|
95
|
+
| -- | -- | -- | -- | -- |
|
|
96
|
+
| `variant` | one-of string | ?? we need to work on this (subtle and or muted) | |
|
|
97
|
+
| `label` | string | button description | null | |
|
|
98
|
+
| `showTrailingVisual` | boolean | specific octicon for new tab or new page (or anchor?) | null | |
|
|
99
|
+
|
|
100
|
+
### ButtonStyledAsLink
|
|
101
|
+
|
|
102
|
+
| prop | type | options | default | notes |
|
|
103
|
+
| -- | -- | -- | -- | -- |
|
|
104
|
+
| `variant` | one-of string | see above confusion | `secondary` | |
|
|
105
|
+
| `size` | one-of string | `small` `default` `large` | `default | |
|
|
106
|
+
| `label` | string | button description | null | |
|
|
107
|
+
| `aria-label` | string | button description for screen readers | null | |
|
|
108
|
+
| `aria-pressed` | boolean | `true/false` | `false` | |
|
|
109
|
+
| `leadingVisual` | children (slot) | octicon | null | |
|
|
110
|
+
| `trailingVisual` | children (slot) | octicon | null | |
|
|
111
|
+
| `fullWidth` | boolean | `true/false` | `false` | |
|
|
112
|
+
| `visualPosition` | one-of string | `fixed` `some-other-word` | `fixed` | I think this should be fixed for link styles (so maybe we dont need this prop) |
|
|
113
|
+
|
|
114
|
+
### ButtonGroup
|
|
115
|
+
|
|
116
|
+
| prop | type | options | default | notes |
|
|
117
|
+
| -- | -- | -- | -- | -- |
|
|
118
|
+
| | | | |
|
|
119
|
+
|
|
120
|
+
## Notes
|
|
121
|
+
[] Should Button have a `secondary` variant, or should it be the default with no additional class?
|
|
122
|
+
[] How granular should icon positioning be?
|
|
123
|
+
- If both trailingVisual and trailingAction exist, and visualPosition is `fixed`, the trailingVisual will "lock" to the trailingAction (unless we are more granular and specify different lock scenarios as props)
|
|
124
|
+
- One idea would be to always lock trailingAction (always affix it to the right of a button which will only be visible on full width) and maintain visualPosition prop _only_ for visuals
|
|
125
|
+
[] Thoughts on buttons with trailingAction having less margin-right?
|
|
126
|
+
[] Should we think about underlining links with this work, or is that scope creep?
|
|
127
|
+
[] Button styled as link is trickiest, and we need to decide how much logic that component can have compared to Button
|
|
File without changes
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
.Button {
|
|
2
|
+
position: relative;
|
|
3
|
+
font-size: $body-font-size;
|
|
4
|
+
font-weight: $font-weight-semibold;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
user-select: none;
|
|
7
|
+
background-color: transparent;
|
|
8
|
+
border: $border-width $border-style;
|
|
9
|
+
border-color: transparent;
|
|
10
|
+
border-radius: $border-radius;
|
|
11
|
+
color: var(--color-btn-text);
|
|
12
|
+
transition: 0.2s cubic-bezier(0.3, 0, 0.5, 1);
|
|
13
|
+
transition-property: color, background-color, border-color;
|
|
14
|
+
height: 32px;
|
|
15
|
+
padding: 0 16px;
|
|
16
|
+
|
|
17
|
+
&:not(.Button--iconOnly) {
|
|
18
|
+
display: grid;
|
|
19
|
+
grid-template-areas: 'leadingVisual text trailingVisual trailingAction';
|
|
20
|
+
grid-template-columns: min-content minmax(0, auto) min-content min-content;
|
|
21
|
+
align-items: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// column-gap persists with empty grid-areas, margin applies only when children exist
|
|
25
|
+
> :not(:last-child) {
|
|
26
|
+
margin-right: $spacer-2;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:hover,
|
|
30
|
+
&.hover,
|
|
31
|
+
[open] > & {
|
|
32
|
+
background-color: var(--color-btn-hover-bg);
|
|
33
|
+
border-color: var(--color-btn-hover-border);
|
|
34
|
+
transition-duration: 0.1s;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:active {
|
|
38
|
+
background-color: var(--color-btn-active-bg);
|
|
39
|
+
border-color: var(--color-btn-active-border);
|
|
40
|
+
transition: none;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&.Button--pressed,
|
|
44
|
+
&[aria-pressed='true'] {
|
|
45
|
+
background-color: var(--color-btn-selected-bg);
|
|
46
|
+
box-shadow: var(--color-primer-shadow-inset);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:disabled,
|
|
50
|
+
&.disabled,
|
|
51
|
+
&[aria-disabled='true'] {
|
|
52
|
+
color: var(--color-primer-fg-disabled);
|
|
53
|
+
background-color: var(--color-btn-bg);
|
|
54
|
+
border-color: var(--color-btn-border);
|
|
55
|
+
fill: var(--color-primer-fg-disabled);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&.Button--small {
|
|
59
|
+
height: 28px;
|
|
60
|
+
font-size: $font-size-small;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.Button--large {
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&.Button--fullWidth {
|
|
67
|
+
width: 100%;
|
|
68
|
+
|
|
69
|
+
.Button-trailingVisual {
|
|
70
|
+
margin-left: auto;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.Button--default {
|
|
75
|
+
color: var(--color-btn-text);
|
|
76
|
+
background-color: var(--color-btn-bg);
|
|
77
|
+
border: $border-width $border-style;
|
|
78
|
+
border-color: var(--color-btn-border);
|
|
79
|
+
box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.Button--primary {
|
|
83
|
+
color: var(--color-btn-primary-text);
|
|
84
|
+
background-color: var(--color-btn-primary-bg);
|
|
85
|
+
border-color: var(--color-btn-primary-border);
|
|
86
|
+
box-shadow: var(--color-btn-primary-shadow), var(--color-btn-primary-inset-shadow);
|
|
87
|
+
|
|
88
|
+
&:hover,
|
|
89
|
+
&.hover,
|
|
90
|
+
[open] > & {
|
|
91
|
+
background-color: var(--color-btn-primary-hover-bg);
|
|
92
|
+
border-color: var(--color-btn-primary-hover-border);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:active,
|
|
96
|
+
&.Button--pressed,
|
|
97
|
+
&[aria-pressed='true'] {
|
|
98
|
+
background-color: var(--color-btn-primary-selected-bg);
|
|
99
|
+
box-shadow: var(--color-btn-primary-selected-shadow);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&:disabled,
|
|
103
|
+
&.disabled,
|
|
104
|
+
&[aria-disabled='true'] {
|
|
105
|
+
color: var(--color-btn-primary-disabled-text);
|
|
106
|
+
background-color: var(--color-btn-primary-disabled-bg);
|
|
107
|
+
border-color: var(--color-btn-primary-disabled-border);
|
|
108
|
+
fill: var(--color-btn-primary-disabled-text);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&.Button--secondary {
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&.Button--outline {
|
|
116
|
+
color: var(--color-btn-outline-text);
|
|
117
|
+
|
|
118
|
+
&:hover,
|
|
119
|
+
[open] > & {
|
|
120
|
+
color: var(--color-btn-outline-hover-text);
|
|
121
|
+
background-color: var(--color-btn-outline-hover-bg);
|
|
122
|
+
border-color: var(--color-btn-outline-hover-border);
|
|
123
|
+
box-shadow: var(--color-btn-outline-hover-shadow), var(--color-btn-outline-hover-inset-shadow);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&:active,
|
|
127
|
+
&.Button--pressed,
|
|
128
|
+
&[aria-pressed='true'] {
|
|
129
|
+
color: var(--color-btn-outline-selected-text);
|
|
130
|
+
background-color: var(--color-btn-outline-selected-bg);
|
|
131
|
+
border-color: var(--color-btn-outline-selected-border);
|
|
132
|
+
box-shadow: var(--color-btn-outline-selected-shadow);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&:disabled,
|
|
136
|
+
&.disabled,
|
|
137
|
+
&[aria-disabled='true'] {
|
|
138
|
+
color: var(--color-btn-outline-disabled-text);
|
|
139
|
+
background-color: var(--color-btn-outline-disabled-bg);
|
|
140
|
+
border-color: var(--color-btn-border);
|
|
141
|
+
box-shadow: none;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
&.Button--danger {
|
|
146
|
+
color: var(--color-btn-danger-text);
|
|
147
|
+
|
|
148
|
+
.octicon {
|
|
149
|
+
color: var(--color-btn-danger-icon);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
&:hover,
|
|
153
|
+
[open] > & {
|
|
154
|
+
color: var(--color-btn-danger-hover-text);
|
|
155
|
+
background-color: var(--color-btn-danger-hover-bg);
|
|
156
|
+
border-color: var(--color-btn-danger-hover-border);
|
|
157
|
+
box-shadow: var(--color-btn-danger-hover-shadow), var(--color-btn-danger-hover-inset-shadow);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
&:active,
|
|
161
|
+
&.Button--pressed,
|
|
162
|
+
&[aria-pressed='true'] {
|
|
163
|
+
color: var(--color-btn-danger-selected-text);
|
|
164
|
+
background-color: var(--color-btn-danger-selected-bg);
|
|
165
|
+
border-color: var(--color-btn-danger-selected-border);
|
|
166
|
+
box-shadow: var(--color-btn-danger-selected-shadow);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&:disabled,
|
|
170
|
+
&.disabled,
|
|
171
|
+
&[aria-disabled='true'] {
|
|
172
|
+
color: var(--color-btn-danger-disabled-text);
|
|
173
|
+
background-color: var(--color-btn-danger-disabled-bg);
|
|
174
|
+
border-color: var(--color-btn-border);
|
|
175
|
+
box-shadow: none;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.Button-label {
|
|
181
|
+
grid-area: text;
|
|
182
|
+
white-space: nowrap;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
.Button-visual {
|
|
186
|
+
display: flex;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.Button-visual--fixed {
|
|
190
|
+
grid-template-columns: min-content min-content min-content min-content;
|
|
191
|
+
place-content: center;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.Button-leadingVisual {
|
|
195
|
+
grid-area: leadingVisual;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.Button-trailingVisual {
|
|
199
|
+
grid-area: trailingVisual;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.Button-trailingAction {
|
|
203
|
+
grid-area: trailingAction;
|
|
204
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Links
|
|
2
|
+
|
|
3
|
+
.Link {
|
|
4
|
+
color: var(--color-accent-fg);
|
|
5
|
+
|
|
6
|
+
&:hover {
|
|
7
|
+
text-decoration: underline;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.Link--trailingVisual {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 4px;
|
|
17
|
+
}
|
|
18
|
+
// .Link--primary {
|
|
19
|
+
// color: var(--color-fg-default) !important;
|
|
20
|
+
|
|
21
|
+
// &:hover {
|
|
22
|
+
// color: var(--color-accent-fg) !important;
|
|
23
|
+
// }
|
|
24
|
+
// }
|
|
25
|
+
|
|
26
|
+
// .Link--secondary {
|
|
27
|
+
// color: var(--color-fg-muted) !important;
|
|
28
|
+
|
|
29
|
+
// &:hover {
|
|
30
|
+
// color: var(--color-accent-fg) !important;
|
|
31
|
+
// }
|
|
32
|
+
// }
|
|
33
|
+
|
|
34
|
+
// .Link--muted {
|
|
35
|
+
// color: var(--color-fg-muted) !important;
|
|
36
|
+
|
|
37
|
+
// &:hover {
|
|
38
|
+
// color: var(--color-accent-fg) !important;
|
|
39
|
+
// text-decoration: none;
|
|
40
|
+
// }
|
|
41
|
+
// }
|
|
42
|
+
|
|
43
|
+
// // Set the link color only on hover
|
|
44
|
+
// // Useful when you want only part of a link to turn blue on hover
|
|
45
|
+
// .Link--onHover {
|
|
46
|
+
// &:hover {
|
|
47
|
+
// color: var(--color-accent-fg) !important;
|
|
48
|
+
// text-decoration: underline;
|
|
49
|
+
// cursor: pointer;
|
|
50
|
+
// }
|
|
51
|
+
// }
|
|
52
|
+
|
|
53
|
+
// // When using a color utility class inside of a link class,
|
|
54
|
+
// // color should change with link on hover.
|
|
55
|
+
// .Link--secondary,
|
|
56
|
+
// .Link--primary,
|
|
57
|
+
// .Link--muted {
|
|
58
|
+
// &:hover [class*='color-text'] {
|
|
59
|
+
// color: inherit !important;
|
|
60
|
+
// }
|
|
61
|
+
// }
|
package/buttons/button.scss
CHANGED
|
@@ -100,6 +100,14 @@
|
|
|
100
100
|
color: var(--color-primer-fg-disabled);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
// Keep :focus after :disabled. Allows to see the focus ring even on disabled buttons
|
|
105
|
+
&:focus,
|
|
106
|
+
&.focus {
|
|
107
|
+
border-color: var(--color-btn-focus-border);
|
|
108
|
+
outline: none;
|
|
109
|
+
box-shadow: var(--color-btn-focus-shadow);
|
|
110
|
+
}
|
|
103
111
|
}
|
|
104
112
|
|
|
105
113
|
// Primary button
|
|
@@ -136,6 +144,13 @@
|
|
|
136
144
|
}
|
|
137
145
|
}
|
|
138
146
|
|
|
147
|
+
&:focus,
|
|
148
|
+
&.focus {
|
|
149
|
+
background-color: var(--color-btn-primary-focus-bg);
|
|
150
|
+
border-color: var(--color-btn-primary-focus-border);
|
|
151
|
+
box-shadow: var(--color-btn-primary-focus-shadow);
|
|
152
|
+
}
|
|
153
|
+
|
|
139
154
|
.Counter {
|
|
140
155
|
color: inherit;
|
|
141
156
|
background-color: var(--color-btn-primary-counter-bg);
|
|
@@ -189,6 +204,11 @@
|
|
|
189
204
|
}
|
|
190
205
|
}
|
|
191
206
|
|
|
207
|
+
&:focus {
|
|
208
|
+
border-color: var(--color-btn-outline-focus-border);
|
|
209
|
+
box-shadow: var(--color-btn-outline-focus-shadow);
|
|
210
|
+
}
|
|
211
|
+
|
|
192
212
|
.Counter {
|
|
193
213
|
color: inherit;
|
|
194
214
|
background-color: var(--color-btn-outline-counter-bg);
|
|
@@ -246,6 +266,11 @@
|
|
|
246
266
|
}
|
|
247
267
|
}
|
|
248
268
|
|
|
269
|
+
&:focus {
|
|
270
|
+
border-color: var(--color-btn-danger-focus-border);
|
|
271
|
+
box-shadow: var(--color-btn-danger-focus-shadow);
|
|
272
|
+
}
|
|
273
|
+
|
|
249
274
|
.Counter {
|
|
250
275
|
color: inherit;
|
|
251
276
|
background-color: var(--color-btn-danger-counter-bg);
|