Skip to content

Commit

Permalink
feat(search): support "quiet" variant
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook committed Oct 7, 2019
1 parent 8014345 commit d0f85f1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/search/src/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ export class Search extends Textfield {
@submit=${this.handleSubmit}
>
<sp-icons-medium></sp-icons-medium>
${super.render()}
<sp-icon
id="icon"
class="icon magnifier"
size="s"
name="ui:Magnifier"
></sp-icon>
${super.render()}
<button id="button" type="reset" aria-label="Reset">
<sp-icon
class="icon cross-medium"
Expand Down
11 changes: 11 additions & 0 deletions packages/search/src/spectrum-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ module.exports = {
selector: '.spectrum-Search',
},
focus: '#input',
attributes: [
{
type: 'boolean',
selector: '.spectrum-Textfield--quiet',
name: 'quiet',
},
],
ids: [
{
selector: '.spectrum-Search-input',
Expand All @@ -32,6 +39,10 @@ module.exports = {
selector: '.spectrum-ClearButton',
name: 'button',
},
{
selector: '.spectrum-Search-clear',
name: 'button',
},
],
classes: [
{
Expand Down
8 changes: 4 additions & 4 deletions packages/search/src/spectrum-search.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
* .spectrum-Search-input::-webkit-search-decoration */
-webkit-appearance: none;
}
#input.spectrum-Textfield--quiet {
:host([quiet]) #input {
/* .spectrum-Search-input.spectrum-Textfield--quiet */
padding-left: var(--spectrum-search-quiet-padding-left, 24px);
padding-right: var(--spectrum-search-quiet-padding-right, 20px);
}
#input.spectrum-Textfield--quiet ~ #icon {
:host([quiet]) #input ~ #icon {
/* .spectrum-Search-input.spectrum-Textfield--quiet ~ .spectrum-Search-icon */
left: 0;
}
#input.spectrum-Textfield--quiet ~ .spectrum-Search-clear {
:host([quiet]) #input ~ #button {
/* .spectrum-Search-input.spectrum-Textfield--quiet ~ .spectrum-Search-clear */
right: -8px;
}
#input.spectrum-Textfield--quiet ~ .spectrum-Search-rightIcon {
:host([quiet]) #input ~ .spectrum-Search-rightIcon {
/* .spectrum-Search-input.spectrum-Textfield--quiet ~ .spectrum-Search-rightIcon */
right: 0;
}
Expand Down

0 comments on commit d0f85f1

Please sign in to comment.