Skip to content

Commit cb1ca79

Browse files
authored
Importing more styles from Primer View Components (#2326)
* Importing labels css from pvc * Fixing blankslate change so we're not deleting a file * Importing truncate * Adding breadcrumb styles * Adding toggle_switch * Adding subhead * Adding timeline_item * Adding popover * Adding dropdown * Adding flash * Adding avatar and avatar stack * Adding autocomplete * Adding border box * Adding navigation styles * Updating version to canary * Fixing popover import * Adding progress bar * Adding to docs * Update version * Fix lock file * reset lock * Rebuild lockfile * Fixing imports
1 parent 8cf13e9 commit cb1ca79

File tree

26 files changed

+105
-2319
lines changed

26 files changed

+105
-2319
lines changed

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@primer/octicons": "17.0.0",
1717
"@primer/octicons-react": "17.0.0",
1818
"@primer/primitives": "7.8.3",
19+
"@primer/view-components": "^0.0.112",
1920
"@svgr/webpack": "5.5.0",
2021
"autoprefixer": "10.4.2",
2122
"babel-preset-gatsby": "^2.14.0",

docs/yarn.lock

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,6 +1506,53 @@
15061506
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.2.tgz#30aa825f11d438671d585bd44e7fd564535fc210"
15071507
integrity sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw==
15081508

1509+
"@github/auto-complete-element@^3.3.4":
1510+
version "3.3.4"
1511+
resolved "https://registry.yarnpkg.com/@github/auto-complete-element/-/auto-complete-element-3.3.4.tgz#b762f13342b8ea5e03609f75b5a8d417080355eb"
1512+
integrity sha512-b9SBCLIQGfCI3G0pGYE8rBSUDON5iFKUgHXgAtVdgZii0dnLFxNl5tn1R/RaBEFdzBQPDl9vqu41TF/Hs3w8FA==
1513+
dependencies:
1514+
"@github/combobox-nav" "^2.0.2"
1515+
1516+
"@github/catalyst@^1.6.0":
1517+
version "1.6.0"
1518+
resolved "https://registry.yarnpkg.com/@github/catalyst/-/catalyst-1.6.0.tgz#378734d1d2b6a85af169d7e66c1a2a604bf1e82c"
1519+
integrity sha512-u8A+DameixqpeyHzvnJWTGj+wfiskQOYHzSiJscCWVfMkIT3rxnbHMtGh3lMthaRY21nbUOK71WcsCnCrXhBJQ==
1520+
1521+
"@github/clipboard-copy-element@^1.1.2":
1522+
version "1.1.2"
1523+
resolved "https://registry.yarnpkg.com/@github/clipboard-copy-element/-/clipboard-copy-element-1.1.2.tgz#7a6e8042749471504d4e7cfcc47097a781db2bdb"
1524+
integrity sha512-L6CMrcA5we0udafvoSuRCE/Ci/3xrLWKYRGup2IlhxF771bQYsQ2EB1of182pI8ZWM4oxgwzu37+igMeoZjN/A==
1525+
1526+
"@github/combobox-nav@^2.0.2":
1527+
version "2.1.5"
1528+
resolved "https://registry.yarnpkg.com/@github/combobox-nav/-/combobox-nav-2.1.5.tgz#905598cc681e016eddfcd8adcb39e4d81c907577"
1529+
integrity sha512-dmG1PuppNKHnBBEcfylWDwj9SSxd/E/qd8mC1G/klQC3s7ps5q6JZ034mwkkG0LKfI+Y+UgEua/ROD776N400w==
1530+
1531+
"@github/details-menu-element@^1.0.12":
1532+
version "1.0.13"
1533+
resolved "https://registry.yarnpkg.com/@github/details-menu-element/-/details-menu-element-1.0.13.tgz#d62263077b16bc7edc386e7b23f0ce41af1301b4"
1534+
integrity sha512-gMkii86w/oUP5dq8yOWZn1sgbgtFj3AYETxxtpsqRggZktgd8te4+npAn4Hm+936c/lxmEzXqfjARL/CzGR4+w==
1535+
1536+
"@github/image-crop-element@^5.0.0":
1537+
version "5.0.0"
1538+
resolved "https://registry.yarnpkg.com/@github/image-crop-element/-/image-crop-element-5.0.0.tgz#6ae2c31f1e7dc355c41c3140554fb76ca7a71ef7"
1539+
integrity sha512-Vgm2OwWAs1ESoib/t5sjxsAYo6YTOxxAjWDRxswX7qrqoyCejTZ3hshdo4Ep5e+Mz/GVTZC3rdMtg06dk/eT4g==
1540+
1541+
"@github/mini-throttle@^2.1.0":
1542+
version "2.1.0"
1543+
resolved "https://registry.yarnpkg.com/@github/mini-throttle/-/mini-throttle-2.1.0.tgz#583a1d5e383caa21a1c067a649f15f7ab575dccf"
1544+
integrity sha512-iEeR2OdVCPkdIPUszL8gJnKNu4MR8ANh7y0u/LPyaatYezgaWxUZEzhFntloqQq+HE6MZkFy+cl+xzCNuljOdw==
1545+
1546+
"@github/tab-container-element@^3.1.2":
1547+
version "3.2.0"
1548+
resolved "https://registry.yarnpkg.com/@github/tab-container-element/-/tab-container-element-3.2.0.tgz#d2d33da09ee3d7f4245a9f77479fe4969b137ae5"
1549+
integrity sha512-to5ZJuywKK3KX53X1ifOcWjvUTQcBGdQ6Qkhm8L97xQ3ovICag1048M3YMpc+QSdr8xWeCBMnLeMnENqotB0Og==
1550+
1551+
"@github/time-elements@^3.1.2":
1552+
version "3.6.0"
1553+
resolved "https://registry.yarnpkg.com/@github/time-elements/-/time-elements-3.6.0.tgz#c61cbab56e9defd3faa3f24bd87afac00deeccd4"
1554+
integrity sha512-MRt9TJztej6idLMvmuZbWc75TJrpl+1kgxWPFzCti4Md7kFtOFTRjXSGKmpc4vFT1NR3SgjHqTfI2Cnr9dJ7Wg==
1555+
15091556
"@graphql-tools/batch-execute@^7.1.2":
15101557
version "7.1.2"
15111558
resolved "https://registry.yarnpkg.com/@graphql-tools/batch-execute/-/batch-execute-7.1.2.tgz#35ba09a1e0f80f34f1ce111d23c40f039d4403a0"
@@ -2159,6 +2206,11 @@
21592206
resolved "https://registry.yarnpkg.com/@primer/behaviors/-/behaviors-1.1.3.tgz#4945f79c39f8b4495ec868b053264830f687c7bc"
21602207
integrity sha512-WpCcjAkXG7Lv3ZbaCUgASWKHnCi/pmuSEiyTmHHb6f5xhwk1mliixNL5ZZHtDN6RCcT3VnXUsyek4GopG2lbZQ==
21612208

2209+
"@primer/behaviors@^1.2.0":
2210+
version "1.3.1"
2211+
resolved "https://registry.yarnpkg.com/@primer/behaviors/-/behaviors-1.3.1.tgz#febae28e5f7824f1fa547389b3ff8563e171da58"
2212+
integrity sha512-aMRDUQ350lk0FxtL5gJWPFHHOSSzDbJ6uNJVIt8XSqiGe1pxuW5mVVfrEp1uvzZ0pCHkCdm9fycjnfOeMeIrOQ==
2213+
21622214
"@primer/component-metadata@^0.5.1":
21632215
version "0.5.1"
21642216
resolved "https://registry.yarnpkg.com/@primer/component-metadata/-/component-metadata-0.5.1.tgz#2f41dcc0ff9fcc9ad16c9241a20abdf86ba8468b"
@@ -2309,6 +2361,21 @@
23092361
history "^5.0.0"
23102362
styled-system "^5.1.5"
23112363

2364+
"@primer/view-components@^0.0.112":
2365+
version "0.0.112"
2366+
resolved "https://registry.yarnpkg.com/@primer/view-components/-/view-components-0.0.112.tgz#fe469883c8e2d4da3aba8e17002890b081ab6cd7"
2367+
integrity sha512-YWvZkEy6pQSfA3kcY5NVYGxR/mFmrbhufLhp/XYuXkf1Uoj1AEa4FESfiPqJhkIomZh5o2B4XAwBCqPsJie9nA==
2368+
dependencies:
2369+
"@github/auto-complete-element" "^3.3.4"
2370+
"@github/catalyst" "^1.6.0"
2371+
"@github/clipboard-copy-element" "^1.1.2"
2372+
"@github/details-menu-element" "^1.0.12"
2373+
"@github/image-crop-element" "^5.0.0"
2374+
"@github/mini-throttle" "^2.1.0"
2375+
"@github/tab-container-element" "^3.1.2"
2376+
"@github/time-elements" "^3.1.2"
2377+
"@primer/behaviors" "^1.2.0"
2378+
23122379
"@radix-ui/react-polymorphic@0.0.14", "@radix-ui/react-polymorphic@^0.0.14":
23132380
version "0.0.14"
23142381
resolved "https://registry.yarnpkg.com/@radix-ui/react-polymorphic/-/react-polymorphic-0.0.14.tgz#fc6cefee6686db8c5a7ff14c8c1b9b5abdee325b"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"dependencies": {
4545
"@primer/primitives": "^7.9.0",
46-
"@primer/view-components": "^0.0.111"
46+
"@primer/view-components": "^0.0.112"
4747
},
4848
"devDependencies": {
4949
"@changesets/changelog-github": "0.4.6",

src/alerts/flash.scss

Lines changed: 1 addition & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1 @@
1-
// stylelint-disable selector-max-type, no-duplicate-selectors
2-
3-
// Default flash
4-
.flash:not(.Banner) {
5-
position: relative;
6-
// stylelint-disable-next-line primer/spacing
7-
padding: 20px $spacer-3;
8-
border-style: $border-style;
9-
border-width: $border-width;
10-
border-radius: $border-radius;
11-
12-
p:last-child {
13-
margin-bottom: 0;
14-
}
15-
16-
.octicon {
17-
// stylelint-disable-next-line primer/spacing
18-
margin-right: 12px;
19-
}
20-
}
21-
22-
// Contain the flash messages
23-
.flash-messages {
24-
margin-bottom: $spacer-4;
25-
}
26-
27-
// Close button
28-
.flash-close:not(.Banner-close) {
29-
float: right;
30-
padding: $spacer-3;
31-
margin: -$spacer-3;
32-
text-align: center;
33-
cursor: pointer;
34-
35-
// Undo `<button>` styles
36-
background: none;
37-
border: 0;
38-
appearance: none;
39-
40-
&:hover {
41-
opacity: 0.7;
42-
}
43-
44-
&:active {
45-
opacity: 0.5;
46-
}
47-
48-
.octicon {
49-
margin-right: 0;
50-
}
51-
}
52-
53-
// Action button
54-
.flash-action:not(.Banner-actions) {
55-
float: right;
56-
// stylelint-disable-next-line primer/spacing
57-
margin-top: -3px;
58-
margin-left: $spacer-4;
59-
background-clip: padding-box;
60-
61-
&.btn .octicon {
62-
margin-right: $spacer-1;
63-
color: var(--color-fg-muted);
64-
}
65-
66-
&.btn-primary {
67-
background-clip: border-box;
68-
69-
.octicon {
70-
color: inherit;
71-
}
72-
}
73-
}
74-
75-
//
76-
// Color variations
77-
//
78-
79-
.flash:not(.Banner) {
80-
color: var(--color-fg-default);
81-
background-image: linear-gradient(var(--color-accent-subtle), var(--color-accent-subtle));
82-
border-color: var(--color-accent-muted);
83-
84-
.octicon {
85-
color: var(--color-accent-fg);
86-
}
87-
}
88-
89-
.flash-warn:not(.Banner) {
90-
color: var(--color-fg-default);
91-
background-image: linear-gradient(var(--color-attention-subtle), var(--color-attention-subtle));
92-
border-color: var(--color-attention-muted);
93-
94-
.octicon {
95-
color: var(--color-attention-fg);
96-
}
97-
}
98-
99-
.flash-error:not(.Banner) {
100-
color: var(--color-fg-default);
101-
background-image: linear-gradient(var(--color-danger-subtle), var(--color-danger-subtle));
102-
border-color: var(--color-danger-muted);
103-
104-
.octicon {
105-
color: var(--color-danger-fg);
106-
}
107-
}
108-
109-
.flash-success:not(.Banner) {
110-
color: var(--color-fg-default);
111-
background-image: linear-gradient(var(--color-success-subtle), var(--color-success-subtle));
112-
border-color: var(--color-success-muted);
113-
114-
.octicon {
115-
color: var(--color-success-fg);
116-
}
117-
}
118-
119-
//
120-
// Layout variations
121-
//
122-
123-
.flash-full:not(.Banner) {
124-
// stylelint-disable-next-line primer/spacing
125-
margin-top: -1px;
126-
border-width: $border-width 0;
127-
border-radius: 0;
128-
}
129-
130-
// A banner rendered at the top of the page.
131-
.flash-banner {
132-
position: fixed;
133-
top: 0;
134-
z-index: 90;
135-
width: 100%;
136-
border-top: 0;
137-
border-right: 0;
138-
border-left: 0;
139-
border-radius: 0;
140-
}
141-
142-
// Makes sure the background is opaque to cover any content underneath
143-
.flash-full,
144-
.flash-banner {
145-
background-color: var(--color-canvas-default);
146-
}
147-
148-
// FIXME deprecate this
149-
.warning {
150-
padding: $em-spacer-5;
151-
// stylelint-disable-next-line primer/spacing
152-
margin-bottom: 0.8em;
153-
font-weight: $font-weight-bold;
154-
background-color: var(--color-attention-subtle);
155-
}
1+
@import '@primer/view-components/app/components/primer/beta/flash';

src/autocomplete/autocomplete.scss

Lines changed: 1 addition & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,118 +1 @@
1-
// This file can be deprecated when AutoComplete is upstreamed to PVC + rolled out to dotcom https://github.com/github/primer/issues/796
2-
// AutoComplete relies on FormControl, Overlay and ActionList CSS
3-
4-
// Stacked label (default)
5-
.autocomplete-label-stacked {
6-
display: block;
7-
margin-bottom: $spacer-2 * 0.75;
8-
}
9-
10-
// Inline label (non-default)
11-
.autocomplete-label-inline {
12-
display: inline;
13-
margin-right: $spacer-2 * 0.75;
14-
}
15-
16-
// Switch to stacked at smaller viewport
17-
@media (max-width: $width-sm) {
18-
.autocomplete-label-inline {
19-
display: block;
20-
margin-bottom: $spacer-2 * 0.75;
21-
}
22-
}
23-
24-
// Wrapper for the input and result elements to ensure alignment
25-
.autocomplete-body {
26-
position: relative;
27-
display: inline;
28-
}
29-
30-
// Wrapper and conditional styles for when an icon is added
31-
.autocomplete-embedded-icon-wrap {
32-
display: inline-flex;
33-
padding: $spacer-1 $spacer-2;
34-
align-items: center;
35-
36-
&:focus-within {
37-
border-color: var(--color-accent-fg);
38-
39-
@include focusBoxShadowInset;
40-
}
41-
42-
.form-control {
43-
padding: 0;
44-
margin-left: $spacer-2;
45-
// stylelint-disable-next-line
46-
border: none;
47-
box-shadow: none;
48-
49-
&:focus {
50-
box-shadow: none;
51-
}
52-
53-
&:focus-visible {
54-
box-shadow: none;
55-
}
56-
}
57-
}
58-
59-
// A pop up list of items used to show autocompleted results
60-
.autocomplete-results {
61-
position: absolute;
62-
left: 0;
63-
z-index: 99;
64-
width: max-content;
65-
min-width: 100%;
66-
max-height: 20em;
67-
overflow-y: auto;
68-
// stylelint-disable-next-line primer/typography
69-
font-size: 13px;
70-
list-style: none;
71-
background: var(--color-canvas-overlay);
72-
border: $border-width $border-style var(--color-border-default);
73-
border-radius: $border-radius;
74-
box-shadow: var(--color-shadow-medium);
75-
}
76-
77-
// One of the items that appears within an autocomplete group
78-
// Bold black text on white background
79-
80-
.autocomplete-item {
81-
display: block;
82-
width: 100%;
83-
padding: $spacer-1 $spacer-2;
84-
overflow: hidden;
85-
font-weight: $font-weight-bold;
86-
color: var(--color-fg-default);
87-
text-align: left;
88-
text-decoration: none;
89-
text-overflow: ellipsis;
90-
white-space: nowrap;
91-
cursor: pointer;
92-
background-color: var(--color-canvas-overlay);
93-
border: 0;
94-
95-
&:hover {
96-
color: var(--color-fg-on-emphasis);
97-
text-decoration: none;
98-
background-color: var(--color-accent-emphasis);
99-
100-
// Inherit color on all child elements to ensure enough contrast
101-
* {
102-
color: inherit !important;
103-
}
104-
}
105-
106-
&.selected,
107-
&[aria-selected='true'],
108-
&.navigation-focus {
109-
color: var(--color-fg-on-emphasis);
110-
text-decoration: none;
111-
background-color: var(--color-accent-emphasis);
112-
113-
// Inherit color on all child elements to ensure enough contrast
114-
* {
115-
color: inherit !important;
116-
}
117-
}
118-
}
1+
@import '@primer/view-components/app/components/primer/alpha/auto_complete';

0 commit comments

Comments
 (0)