-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
autocomplete
styles to PVC (#1609)
- Loading branch information
Showing
5 changed files
with
127 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/view-components": patch | ||
--- | ||
|
||
Move `autocomplete` styles to PVC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* autocomplete */ | ||
|
||
/* This file can be deprecated when AutoComplete is upstreamed to PVC + rolled out to dotcom https://github.com/github/primer/issues/796 | ||
** AutoComplete relies on FormControl, Overlay and ActionList CSS */ | ||
|
||
/* Stacked label (default) */ | ||
.autocomplete-label-stacked { | ||
display: block; | ||
margin-bottom: 6px; | ||
} | ||
|
||
/* Inline label (non-default) */ | ||
.autocomplete-label-inline { | ||
display: inline; | ||
margin-right: 6px; | ||
} | ||
|
||
/* Switch to stacked at smaller viewport */ | ||
@media (max-width: 543.98px) { | ||
.autocomplete-label-inline { | ||
display: block; | ||
margin-bottom: 6px; | ||
} | ||
} | ||
|
||
/* Wrapper for the input and result elements to ensure alignment */ | ||
.autocomplete-body { | ||
position: relative; | ||
display: inline; | ||
} | ||
|
||
/* Wrapper and conditional styles for when an icon is added */ | ||
.autocomplete-embedded-icon-wrap { | ||
display: inline-flex; | ||
padding: 4px 8px; | ||
align-items: center; | ||
|
||
&:focus-within { | ||
border-color: var(--color-accent-fg); | ||
|
||
@mixin focusBoxShadowInset; | ||
} | ||
|
||
& .form-control { | ||
padding: 0; | ||
margin-left: 8px; | ||
border: none; | ||
box-shadow: none; | ||
|
||
&:focus { | ||
box-shadow: none; | ||
} | ||
|
||
&:focus-visible { | ||
box-shadow: none; | ||
} | ||
} | ||
} | ||
|
||
/* A pop up list of items used to show autocompleted results */ | ||
.autocomplete-results { | ||
position: absolute; | ||
left: 0; | ||
z-index: 99; | ||
width: max-content; | ||
min-width: 100%; | ||
max-height: 20em; | ||
overflow-y: auto; | ||
font-size: 13px; | ||
list-style: none; | ||
background: var(--color-canvas-overlay); | ||
border: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default); | ||
border-radius: var(--primer-borderRadius-medium, 6px); | ||
box-shadow: var(--color-shadow-medium); | ||
} | ||
|
||
/* One of the items that appears within an autocomplete group | ||
** Bold black text on white background */ | ||
|
||
.autocomplete-item { | ||
display: block; | ||
width: 100%; | ||
padding: 4px 8px; | ||
overflow: hidden; | ||
font-weight: var(--base-text-weight-semibold, 600); | ||
color: var(--color-fg-default); | ||
text-align: left; | ||
text-decoration: none; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
cursor: pointer; | ||
background-color: var(--color-canvas-overlay); | ||
border: 0; | ||
|
||
&:hover { | ||
color: var(--color-fg-on-emphasis); | ||
text-decoration: none; | ||
background-color: var(--color-accent-emphasis); | ||
|
||
/* Inherit color on all child elements to ensure enough contrast */ | ||
& * { | ||
color: inherit !important; | ||
} | ||
} | ||
|
||
&.selected, | ||
&[aria-selected='true'], | ||
&.navigation-focus { | ||
color: var(--color-fg-on-emphasis); | ||
text-decoration: none; | ||
background-color: var(--color-accent-emphasis); | ||
|
||
/* Inherit color on all child elements to ensure enough contrast */ | ||
& * { | ||
color: inherit !important; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters