@polymer/paper-menu-button
Advanced tools
Comparing version 3.0.0-pre.21 to 3.0.0-pre.22
@@ -18,31 +18,22 @@ { | ||
"devDependencies": { | ||
"@polymer/gen-typescript-declarations": "^1.2.2", | ||
"bower": "^1.8.0", | ||
"webmat": "^0.2.0", | ||
"@polymer/iron-component-page": "^3.0.0-pre.21", | ||
"@polymer/iron-icon": "^3.0.0-pre.21", | ||
"@polymer/iron-icons": "^3.0.0-pre.21", | ||
"@polymer/iron-image": "^3.0.0-pre.21", | ||
"@polymer/iron-demo-helpers": "^3.0.0-pre.21", | ||
"@polymer/iron-test-helpers": "^3.0.0-pre.21", | ||
"@polymer/paper-button": "^3.0.0-pre.21", | ||
"@polymer/paper-icon-button": "^3.0.0-pre.21", | ||
"@polymer/paper-item": "^3.0.0-pre.21", | ||
"@polymer/paper-listbox": "^3.0.0-pre.21", | ||
"@polymer/iron-icon": "^3.0.0-pre.20", | ||
"@polymer/iron-icons": "^3.0.0-pre.20", | ||
"@polymer/iron-image": "^3.0.0-pre.20", | ||
"@polymer/iron-demo-helpers": "^3.0.0-pre.20", | ||
"@polymer/iron-test-helpers": "^3.0.0-pre.20", | ||
"@polymer/paper-button": "^3.0.0-pre.20", | ||
"@polymer/paper-icon-button": "^3.0.0-pre.20", | ||
"@polymer/paper-item": "^3.0.0-pre.20", | ||
"@polymer/paper-listbox": "^3.0.0-pre.20", | ||
"wct-browser-legacy": "^1.0.1", | ||
"@webcomponents/webcomponentsjs": "^2.0.0", | ||
"web-animations-js": "^2.3.1" | ||
"@polymer/gen-typescript-declarations": "^1.5.0" | ||
}, | ||
"scripts": { | ||
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir .", | ||
"format": "webmat && npm run update-types" | ||
"format": "webmat", | ||
"generate-types": "gen-typescript-declarations --deleteExisting --outDir .", | ||
"prepack": "npm run generate-types" | ||
}, | ||
"version": "3.0.0-pre.21", | ||
"resolutions": { | ||
"inherits": "2.0.3", | ||
"samsam": "1.1.3", | ||
"supports-color": "3.1.2", | ||
"type-detect": "1.0.0", | ||
"@webcomponents/webcomponentsjs": "2.0.0-beta.2" | ||
}, | ||
"version": "3.0.0-pre.22", | ||
"main": "paper-menu-button.js", | ||
@@ -52,9 +43,9 @@ "author": "The Polymer Authors", | ||
"@polymer/polymer": "^3.0.0", | ||
"@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.21", | ||
"@polymer/iron-behaviors": "^3.0.0-pre.21", | ||
"@polymer/iron-dropdown": "^3.0.0-pre.21", | ||
"@polymer/iron-fit-behavior": "^3.0.0-pre.21", | ||
"@polymer/neon-animation": "^3.0.0-pre.21", | ||
"@polymer/paper-styles": "^3.0.0-pre.21" | ||
"@polymer/iron-a11y-keys-behavior": "^3.0.0-pre.20", | ||
"@polymer/iron-behaviors": "^3.0.0-pre.20", | ||
"@polymer/iron-dropdown": "^3.0.0-pre.20", | ||
"@polymer/iron-fit-behavior": "^3.0.0-pre.20", | ||
"@polymer/neon-animation": "^3.0.0-pre.20", | ||
"@polymer/paper-styles": "^3.0.0-pre.20" | ||
} | ||
} |
/** | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
This code may only be used under the BSD style license found at | ||
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at | ||
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be | ||
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as | ||
part of the polymer project is also subject to an additional IP rights grant | ||
found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import { NeonAnimationBehavior } from '@polymer/neon-animation/neon-animation-behavior.js'; | ||
import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
import {NeonAnimationBehavior} from '@polymer/neon-animation/neon-animation-behavior.js'; | ||
import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
Polymer({ | ||
@@ -15,0 +16,0 @@ is: 'paper-menu-grow-height-animation', |
/** | ||
@license | ||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | ||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt | ||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
Code distributed by Google as part of the polymer project is also | ||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt | ||
This code may only be used under the BSD style license found at | ||
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at | ||
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be | ||
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as | ||
part of the polymer project is also subject to an additional IP rights grant | ||
found at http://polymer.github.io/PATENTS.txt | ||
*/ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import '@polymer/iron-dropdown/iron-dropdown.js'; | ||
import '@polymer/neon-animation/animations/fade-in-animation.js'; | ||
import '@polymer/neon-animation/animations/fade-out-animation.js'; | ||
import '@polymer/paper-styles/default-theme.js'; | ||
import '@polymer/paper-styles/shadow.js'; | ||
import './paper-menu-button-animations.js'; | ||
import {IronA11yKeysBehavior} from '@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; | ||
import {IronControlState} from '@polymer/iron-behaviors/iron-control-state.js'; | ||
import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
import {dom} from '@polymer/polymer/lib/legacy/polymer.dom.js'; | ||
import {html} from '@polymer/polymer/lib/utils/html-tag.js'; | ||
var config = { | ||
ANIMATION_CUBIC_BEZIER: 'cubic-bezier(.3,.95,.5,1)', | ||
MAX_ANIMATION_TIME_MS: 400 | ||
}; | ||
/** | ||
Material design: [Dropdown buttons](https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons) | ||
Material design: [Dropdown | ||
buttons](https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons) | ||
@@ -18,4 +39,4 @@ `paper-menu-button` allows one to compose a designated "trigger" element with | ||
The child element assigned to the `dropdown-trigger` slot will be used as the | ||
"trigger" element. The child element assigned to the `dropdown-content` slot will be | ||
used as the "content" element. | ||
"trigger" element. The child element assigned to the `dropdown-content` slot | ||
will be used as the "content" element. | ||
@@ -29,5 +50,5 @@ The `paper-menu-button` is sensitive to its content's `iron-select` events. If | ||
<paper-menu-button> | ||
<paper-icon-button icon="menu" slot="dropdown-trigger"></paper-icon-button> | ||
<paper-listbox slot="dropdown-content"> | ||
<paper-item>Share</paper-item> | ||
<paper-icon-button icon="menu" | ||
slot="dropdown-trigger"></paper-icon-button> <paper-listbox | ||
slot="dropdown-content"> <paper-item>Share</paper-item> | ||
<paper-item>Settings</paper-item> | ||
@@ -53,27 +74,3 @@ <paper-item>Help</paper-item> | ||
*/ | ||
/* | ||
FIXME(polymer-modulizer): the above comments were extracted | ||
from HTML and may be out of place here. Review them and | ||
then delete this comment! | ||
*/ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import { IronA11yKeysBehavior } from '@polymer/iron-a11y-keys-behavior/iron-a11y-keys-behavior.js'; | ||
import { IronControlState } from '@polymer/iron-behaviors/iron-control-state.js'; | ||
import '@polymer/iron-dropdown/iron-dropdown.js'; | ||
import '@polymer/neon-animation/animations/fade-in-animation.js'; | ||
import '@polymer/neon-animation/animations/fade-out-animation.js'; | ||
import '@polymer/paper-styles/default-theme.js'; | ||
import '@polymer/paper-styles/shadow.js'; | ||
import './paper-menu-button-animations.js'; | ||
import { Polymer as Polymer$0 } from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
import { html } from '@polymer/polymer/lib/utils/html-tag.js'; | ||
import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; | ||
var config = { | ||
ANIMATION_CUBIC_BEZIER: 'cubic-bezier(.3,.95,.5,1)', | ||
MAX_ANIMATION_TIME_MS: 400 | ||
}; | ||
export const PaperMenuButton = Polymer$0({ | ||
export const PaperMenuButton = Polymer({ | ||
_template: html` | ||
@@ -313,3 +310,3 @@ <style> | ||
/** | ||
* Toggles the drowpdown content between opened and closed. | ||
* Toggles the dropdown content between opened and closed. | ||
*/ | ||
@@ -316,0 +313,0 @@ toggle: function() { |
104
README.md
@@ -0,10 +1,7 @@ | ||
[![Published on NPM](https://img.shields.io/npm/v/@polymer/paper-menu-button.svg)](https://www.npmjs.com/package/@polymer/paper-menu-button) | ||
[![Build status](https://travis-ci.org/PolymerElements/paper-menu-button.svg?branch=master)](https://travis-ci.org/PolymerElements/paper-menu-button) | ||
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://webcomponents.org/element/@polymer/paper-menu-button) | ||
_[Demo and API docs](https://elements.polymer-project.org/elements/paper-menu-button)_ | ||
## <paper-menu-button> | ||
Material design: [Dropdown buttons](https://www.google.com/design/spec/components/buttons.html#buttons-dropdown-buttons) | ||
`paper-menu-button` allows one to compose a designated "trigger" element with | ||
@@ -22,15 +19,2 @@ another element that represents "content", to create a dropdown menu that | ||
Example: | ||
```html | ||
<paper-menu-button> | ||
<paper-icon-button icon="menu" slot="dropdown-trigger"></paper-icon-button> | ||
<paper-listbox slot="dropdown-content"> | ||
<paper-item>Share</paper-item> | ||
<paper-item>Settings</paper-item> | ||
<paper-item>Help</paper-item> | ||
</paper-listbox> | ||
</paper-menu-button> | ||
``` | ||
### Styling | ||
@@ -48,3 +32,3 @@ | ||
## paper-menu-button-animations.html | ||
## paper-menu-button-animations.js | ||
@@ -57,5 +41,81 @@ Defines these animations: | ||
### Changes in 2.0 | ||
- `neon-animation 2.0` doesn't import the Web Animations polyfill, so you'll have to import it ([see example](demo/index.html)) | ||
See: [Documentation](https://www.webcomponents.org/element/@polymer/paper-menu-button), | ||
[Demo](https://www.webcomponents.org/element/@polymer/paper-menu-button/demo/demo/index.html). | ||
- Distribution is now done with the `slot="dropdown-trigger"` and `slot="dropdown-content"` attributes (replacing the classes of the same names) | ||
## Usage | ||
### Installation | ||
``` | ||
npm install --save @polymer/paper-menu-button | ||
``` | ||
### In an html file | ||
```html | ||
<html> | ||
<head> | ||
<script type="module"> | ||
import '@polymer/paper-icon-button/paper-icon-button.js'; | ||
import '@polymer/paper-item/paper-item.js'; | ||
import '@polymer/paper-listbox/paper-listbox.js'; | ||
import '@polymer/paper-menu-button/paper-menu-button.js'; | ||
</script> | ||
</head> | ||
<body> | ||
<paper-menu-button> | ||
<paper-icon-button icon="menu" slot="dropdown-trigger"></paper-icon-button> | ||
<paper-listbox slot="dropdown-content"> | ||
<paper-item>Share</paper-item> | ||
<paper-item>Settings</paper-item> | ||
<paper-item>Help</paper-item> | ||
</paper-listbox> | ||
</paper-menu-button> | ||
</body> | ||
</html> | ||
``` | ||
### In a Polymer 3 element | ||
```js | ||
import {PolymerElement, html} from '@polymer/polymer'; | ||
import '@polymer/paper-icon-button/paper-icon-button.js'; | ||
import '@polymer/paper-item/paper-item.js'; | ||
import '@polymer/paper-listbox/paper-listbox.js'; | ||
import '@polymer/paper-menu-button/paper-menu-button.js'; | ||
class SampleElement extends PolymerElement { | ||
static get template() { | ||
return html` | ||
<paper-menu-button> | ||
<paper-icon-button icon="menu" slot="dropdown-trigger"></paper-icon-button> | ||
<paper-listbox slot="dropdown-content"> | ||
<paper-item>Share</paper-item> | ||
<paper-item>Settings</paper-item> | ||
<paper-item>Help</paper-item> | ||
</paper-listbox> | ||
</paper-menu-button> | ||
`; | ||
} | ||
} | ||
customElements.define('sample-element', SampleElement); | ||
``` | ||
## Contributing | ||
If you want to send a PR to this element, here are | ||
the instructions for running the tests and demo locally: | ||
### Installation | ||
```sh | ||
git clone https://github.com/PolymerElements/paper-menu-button | ||
cd paper-menu-button | ||
npm install | ||
npm install -g polymer-cli | ||
``` | ||
### Running the demo locally | ||
```sh | ||
polymer serve --npm | ||
open http://127.0.0.1:<port>/demo/ | ||
``` | ||
### Running the tests | ||
```sh | ||
polymer test --npm | ||
``` |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
53233
13
641
119
11
1