@primer/css 0.0.0-20220118041832 → 0.0.0-20220118183002

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.
@@ -47,7 +47,8 @@
47
47
  }
48
48
 
49
49
  &.Layout--gutter-none {
50
- --Layout-gutter: 0;
50
+ // stylelint-disable-next-line length-zero-no-unit
51
+ --Layout-gutter: 0px;
51
52
  }
52
53
 
53
54
  &.Layout--gutter-condensed {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primer/css",
3
- "version": "0.0.0-20220118041832",
3
+ "version": "0.0.0-20220118183002",
4
4
  "description": "The CSS implementation of GitHub's Primer Design System",
5
5
  "homepage": "https://primer.style/css",
6
6
  "author": "GitHub, Inc.",
@@ -24,6 +24,7 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "dist": "script/dist.js",
27
+ "dist:watch": "chokidar \"src/**/*.scss\" -c \"script/dist.js\"",
27
28
  "stylelint": "stylelint --quiet 'src/**/*.scss'",
28
29
  "eslint": "eslint deprecations.js __tests__ script",
29
30
  "prepublishOnly": "script/prepublish",
@@ -44,6 +45,7 @@
44
45
  "@koddsson/postcss-sass": "5.0.0",
45
46
  "@primer/stylelint-config": "12.2.0",
46
47
  "autoprefixer": "10.4.1",
48
+ "chokidar-cli": "3.0.0",
47
49
  "cssstats": "4.0.2",
48
50
  "eslint": "8.6.0",
49
51
  "eslint-plugin-github": "4.3.5",
@@ -1,127 +0,0 @@
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
@@ -1,204 +0,0 @@
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
- }
@@ -1,10 +0,0 @@
1
- .Button--iconOnly {
2
- display: grid;
3
- place-content: center;
4
- padding: unset;
5
- width: 32px;
6
-
7
- &.Button--small {
8
- width: 28px;
9
- }
10
- }
File without changes
@@ -1,61 +0,0 @@
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
- // }