-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into westbrook/225/search
- Loading branch information
Showing
33 changed files
with
894 additions
and
48 deletions.
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
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,19 @@ | ||
# `Actionbar` | ||
|
||
#### `loads` | ||
|
||
```html | ||
<sp-checkbox indeterminate="" tabindex="0"> | ||
228 Selected | ||
</sp-checkbox> | ||
<div class="spectrum-ButtonGroup"> | ||
<sp-action-button quiet="" tabindex="0"></sp-action-button> | ||
<sp-action-button quiet="" tabindex="0"></sp-action-button> | ||
</div> | ||
``` | ||
|
||
```html | ||
<sp-popover direction="none" id="popover" open=""> | ||
<slot></slot> | ||
</sp-popover> | ||
``` |
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
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,72 @@ | ||
## Overview | ||
|
||
A `<sp-actionbar>` delivers a floating action bar that is a convenient way to deliver stateful actions in cases like selection mode. `<sp-actionbar>` can be deployed in two variants beyond the default: `[varient="fixed"]`, to position the element in relation to the page, and `[variant=sticky]`, to position the content in relation to content that may scroll. | ||
|
||
## Example | ||
|
||
```html | ||
<sp-actionbar open> | ||
<sp-checkbox indeterminate>228 Selected</sp-checkbox> | ||
<div class="spectrum-ButtonGroup"> | ||
<sp-action-button quiet> | ||
<svg slot="icon" id="spectrum-icon-18-Edit" viewBox="0 0 36 36"> | ||
<path | ||
d="M33.567 8.2L27.8 2.432a1.215 1.215 0 0 0-.866-.353H26.9a1.371 1.371 0 0 0-.927.406L5.084 23.372a.99.99 0 0 0-.251.422L2.055 33.1c-.114.377.459.851.783.851a.251.251 0 0 0 .062-.007c.276-.063 7.866-2.344 9.311-2.778a.972.972 0 0 0 .414-.249l20.888-20.889a1.372 1.372 0 0 0 .4-.883 1.221 1.221 0 0 0-.346-.945zM11.4 29.316c-2.161.649-4.862 1.465-6.729 2.022l2.009-6.73z" | ||
></path> | ||
</svg> | ||
</sp-action-button> | ||
<sp-action-button quiet> | ||
<svg slot="icon" id="spectrum-icon-18-More" viewBox="0 0 36 36"> | ||
<circle cx="17.8" cy="18.2" r="3.4"></circle> | ||
<circle cx="29.5" cy="18.2" r="3.4"></circle> | ||
<circle cx="6.1" cy="18.2" r="3.4"></circle> | ||
</svg> | ||
</sp-action-button> | ||
</div> | ||
</sp-actionbar> | ||
``` | ||
|
||
## Variants | ||
|
||
### Fixed | ||
|
||
When using `[variant="fixed"]`, the `<sp-actionbar>` will display by default at the bottom left of the window and can be customized via CSS from the outside. | ||
|
||
```html | ||
<h4>Look down and to the left when toggling.</h4> | ||
<sp-actionbar variant="fixed"> | ||
<sp-checkbox indeterminate>228 Selected</sp-checkbox> | ||
</sp-actionbar> | ||
<sp-button | ||
onclick="javascript:this.previousElementSibling.open = !this.previousElementSibling.open;" | ||
> | ||
Toggle Fixed Actionbar | ||
</sp-button> | ||
``` | ||
|
||
### Sticky | ||
|
||
When using `[variant="sticky"]`, be sure you've spent some time touching up on [how `sticky` really works](https://medium.com/@elad/css-position-sticky-how-it-really-works-54cd01dc2d46) to ensure the most successful delivery of your content. | ||
|
||
```html | ||
<section style="position: relative; max-height: 6em; overflow: auto;"> | ||
<h4>Scroll down for toggle button</h4> | ||
<sp-actionbar variant="sticky" style="top: 0;"> | ||
<sp-checkbox indeterminate>228 Selected</sp-checkbox> | ||
</sp-actionbar> | ||
<p> | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod | ||
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim | ||
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea | ||
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate | ||
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint | ||
occaecat cupidatat non proident, sunt in culpa qui officia deserunt | ||
mollit anim id est laborum. | ||
</p> | ||
<sp-button | ||
onclick="javascript:this.previousElementSibling.previousElementSibling.open = !this.previousElementSibling.previousElementSibling.open;" | ||
> | ||
Toggle Sticky Actionbar | ||
</sp-button> | ||
</section> | ||
``` |
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,41 @@ | ||
{ | ||
"name": "@spectrum-web-components/actionbar", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/adobe/spectrum-web-components.git", | ||
"directory": "packages/actionbar" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/adobe/spectrum-web-components/issues" | ||
}, | ||
"homepage": "https://adobe.github.io/spectrum-web-components/components/actionbar", | ||
"keywords": [ | ||
"spectrum css", | ||
"web components", | ||
"lit-element", | ||
"lit-html" | ||
], | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "lib/index.js", | ||
"module": "lib/index.js", | ||
"files": [ | ||
"/lib/", | ||
"/src/" | ||
], | ||
"scripts": { | ||
"test": "karma start --coverage" | ||
}, | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"peerDependencies": { | ||
"lit-element": "^2.1.0", | ||
"lit-html": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@spectrum-css/actionbar": "^2.0.0-alpha.6" | ||
} | ||
} |
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,17 @@ | ||
/* | ||
Copyright 2019 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
|
||
@import './spectrum-actionbar.css'; | ||
|
||
:host([grows]) #popover { | ||
width: auto; | ||
} |
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,69 @@ | ||
/* | ||
Copyright 2019 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
|
||
import { | ||
html, | ||
LitElement, | ||
CSSResultArray, | ||
TemplateResult, | ||
property, | ||
} from 'lit-element'; | ||
|
||
import actionbarStyles from './actionbar.css.js'; | ||
|
||
export const actionbarVariants = ['sticky', 'fixed']; | ||
|
||
/** | ||
* Actionbar component | ||
*/ | ||
export class Actionbar extends LitElement { | ||
public static get styles(): CSSResultArray { | ||
return [actionbarStyles]; | ||
} | ||
|
||
@property({ type: Boolean, reflect: true }) | ||
public open = false; | ||
|
||
/** | ||
* The variant applies specific styling when set to `sticky` or `fixed`. | ||
* `variant` attribute is removed when not matching one of the above. | ||
* | ||
* @param {String} variant | ||
*/ | ||
@property({ type: String, reflect: true }) | ||
public set variant(variant: string) { | ||
if (variant === this.variant) { | ||
return; | ||
} | ||
if (actionbarVariants.includes(variant)) { | ||
this.setAttribute('variant', variant); | ||
this._variant = variant; | ||
return; | ||
} | ||
this.removeAttribute('variant'); | ||
this._variant = ''; | ||
} | ||
|
||
public get variant(): string { | ||
return this._variant; | ||
} | ||
|
||
private _variant = ''; | ||
|
||
public render(): TemplateResult { | ||
return html` | ||
<sp-popover open id="popover"> | ||
<slot></slot> | ||
</sp-popover> | ||
`; | ||
} | ||
} |
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,25 @@ | ||
/* | ||
Copyright 2019 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
export * from './actionbar.js'; | ||
|
||
import { Actionbar } from './actionbar.js'; | ||
|
||
/* istanbul ignore else */ | ||
if (!customElements.get('sp-actionbar')) { | ||
customElements.define('sp-actionbar', Actionbar); | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'sp-actionbar': Actionbar; | ||
} | ||
} |
Oops, something went wrong.