10 |
11 |
12 | Tests
13 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "A material design progress bar",
3 | "keywords": [
4 | "web-components",
5 | "polymer",
6 | "progress",
7 | "loading"
8 | ],
9 | "repository": {
10 | "type": "git",
11 | "url": "git://github.com/PolymerElements/paper-progress.git"
12 | },
13 | "name": "@polymer/paper-progress",
14 | "license": "BSD-3-Clause",
15 | "devDependencies": {
16 | "webmat": "^0.2.0",
17 | "@polymer/iron-demo-helpers": "^3.0.1",
18 | "@polymer/paper-button": "^3.0.0-pre.26",
19 | "wct-browser-legacy": "^1.0.1",
20 | "@webcomponents/webcomponentsjs": "^2.0.0",
21 | "@polymer/gen-typescript-declarations": "^1.5.1"
22 | },
23 | "scripts": {
24 | "format": "webmat",
25 | "generate-types": "gen-typescript-declarations --deleteExisting --outDir . --verify",
26 | "prepare": "npm run generate-types"
27 | },
28 | "version": "3.0.1",
29 | "main": "paper-progress.js",
30 | "author": "The Polymer Authors",
31 | "dependencies": {
32 | "@polymer/iron-flex-layout": "^3.0.0-pre.26",
33 | "@polymer/iron-range-behavior": "^3.0.0-pre.26",
34 | "@polymer/paper-styles": "^3.0.0-pre.26",
35 | "@polymer/polymer": "^3.0.0"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | sudo: 'false'
3 | before_script:
4 | - npm install -g polymer-cli
5 | - git checkout package-lock.json
6 | - >-
7 | npm run format && git diff --exit-code || (echo -e '\n\033[31mERROR:\033[0m
8 | Project is not formatted. Please run "npm run format".' && false)
9 | env:
10 | global:
11 | - secure: >-
12 | X8mB1BGnbe4e5qR23gv/fjOFkK/NCzdRciYAPqy47g1PR/WUC7xUPUwBKkfTOCrSle4WWa5IxhP7N+NnOu88bFxJyxhhfONlj7O51CzJ1i7xFZx2J+CR3IvqEk8y6fvX6lMAdPfBA6vMk4ymIVa3K0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5onTlvU//YhrCkRzzO0ZSoH7L55/ESnpWgwlVsN0V6L5kZcjgWE5nLG1JaZ5JCNruOorvjmBg5MJ+iRYpWA3JCgaw49d97Gt9OulhaRD/q18F2b9cbfuFPj8RgR1wKljcvqa8XUavnjjLzP3QsB4PsGjAqYQv6SLBrGoM=
15 | node_js: node
16 | addons:
17 | firefox: latest
18 | chrome: stable
19 | script:
20 | - xvfb-run polymer test --module-resolution=node --npm
21 | - >-
22 | if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then polymer test
23 | --module-resolution=node --npm -s 'default'; fi
24 | dist: trusty
25 | cache:
26 | directories:
27 | - node_modules
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://www.npmjs.com/package/@polymer/paper-progress)
2 | [](https://travis-ci.org/PolymerElements/paper-progress)
3 | [](https://webcomponents.org/element/@polymer/paper-progress)
4 |
5 | ## <paper-progress>
6 |
7 | The progress bars are for situations where the percentage completed can be
8 | determined. They give users a quick sense of how much longer an operation
9 | will take.
10 |
11 | There is also a secondary progress which is useful for displaying intermediate
12 | progress, such as the buffer level during a streaming playback progress bar.
13 |
14 | See: [Documentation](https://www.webcomponents.org/element/@polymer/paper-progress),
15 | [Demo](https://www.webcomponents.org/element/@polymer/paper-progress/demo/demo/index.html).
16 |
17 | ## Usage
18 |
19 | ### Installation
20 | ```
21 | npm install --save @polymer/paper-progress
22 | ```
23 |
24 | ### In an html file
25 | ```html
26 |
27 |
28 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | ```
39 | ### In a Polymer 3 element
40 | ```js
41 | import {PolymerElement, html} from '@polymer/polymer';
42 | import '@polymer/paper-progress/paper-progress.js';
43 |
44 | class SampleElement extends PolymerElement {
45 | static get template() {
46 | return html`
47 |
48 |
49 |
50 | `;
51 | }
52 | }
53 | customElements.define('sample-element', SampleElement);
54 | ```
55 |
56 | ## Contributing
57 | If you want to send a PR to this element, here are
58 | the instructions for running the tests and demo locally:
59 |
60 | ### Installation
61 | ```sh
62 | git clone https://github.com/PolymerElements/paper-progress
63 | cd paper-progress
64 | npm install
65 | npm install -g polymer-cli
66 | ```
67 |
68 | ### Running the demo locally
69 | ```sh
70 | polymer serve --npm
71 | open http://127.0.0.1:/demo/
72 | ```
73 |
74 | ### Running the tests
75 | ```sh
76 | polymer test --npm
77 | ```
78 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 |
13 |
14 | # Polymer Elements
15 | ## Guide for Contributors
16 |
17 | Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
18 |
19 | ### Filing Issues
20 |
21 | **If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
22 |
23 | 1. **Who will use the feature?** _“As someone filling out a form…”_
24 | 2. **When will they use the feature?** _“When I enter an invalid value…”_
25 | 3. **What is the user’s goal?** _“I want to be visually notified that the value needs to be corrected…”_
26 |
27 | **If you are filing an issue to report a bug**, please provide:
28 |
29 | 1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
30 |
31 | ```markdown
32 | The `paper-foo` element causes the page to turn pink when clicked.
33 |
34 | ## Expected outcome
35 |
36 | The page stays the same color.
37 |
38 | ## Actual outcome
39 |
40 | The page turns pink.
41 |
42 | ## Steps to reproduce
43 |
44 | 1. Put a `paper-foo` element in the page.
45 | 2. Open the page in a web browser.
46 | 3. Click the `paper-foo` element.
47 | ```
48 |
49 | 2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output).
50 |
51 | 3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
52 |
53 | ### Submitting Pull Requests
54 |
55 | **Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
56 |
57 | When submitting pull requests, please provide:
58 |
59 | 1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax:
60 |
61 | ```markdown
62 | (For a single issue)
63 | Fixes #20
64 |
65 | (For multiple issues)
66 | Fixes #32, fixes #40
67 | ```
68 |
69 | 2. **A succinct description of the design** used to fix any related issues. For example:
70 |
71 | ```markdown
72 | This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
73 | ```
74 |
75 | 3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
76 |
77 | If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so don’t be afraid to ask us if you need help with that!
78 |
--------------------------------------------------------------------------------
/demo/index.html:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 | paper-progress demo
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
33 |
34 |
35 |
46 |
47 |
48 |
49 |
50 |
51 |
paper-progress can be imperatively controlled
52 |
53 |
54 |
Once started, loops 5 times before stopping.
55 |
56 | Start
57 |
58 |
59 |
60 |
61 |
62 |
paper-progress can be indeterminate with a custom duration
104 |
105 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/test/basic.html:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 | paper-progress test
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
164 |
165 |
166 |
167 |
--------------------------------------------------------------------------------
/paper-progress.js:
--------------------------------------------------------------------------------
1 | /**
2 | @license
3 | Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 | This code may only be used under the BSD style license found at
5 | http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
6 | http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
7 | found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
8 | part of the polymer project is also subject to an additional IP rights grant
9 | found at http://polymer.github.io/PATENTS.txt
10 | */
11 | import '@polymer/polymer/polymer-legacy.js';
12 | import '@polymer/iron-flex-layout/iron-flex-layout.js';
13 | import '@polymer/paper-styles/color.js';
14 |
15 | import {IronRangeBehavior} from '@polymer/iron-range-behavior/iron-range-behavior.js';
16 | import {Polymer} from '@polymer/polymer/lib/legacy/polymer-fn.js';
17 | import {html} from '@polymer/polymer/lib/utils/html-tag.js';
18 |
19 | /**
20 | Material design: [Progress &
21 | activity](https://www.google.com/design/spec/components/progress-activity.html)
22 |
23 | The progress bars are for situations where the percentage completed can be
24 | determined. They give users a quick sense of how much longer an operation
25 | will take.
26 |
27 | Example:
28 |
29 |
30 |
31 | There is also a secondary progress which is useful for displaying intermediate
32 | progress, such as the buffer level during a streaming playback progress bar.
33 |
34 | Example:
35 |
36 |
37 |
38 | ### Styling progress bar:
39 |
40 | To change the active progress bar color:
41 |
42 | paper-progress {
43 | --paper-progress-active-color: #e91e63;
44 | }
45 |
46 | To change the secondary progress bar color:
47 |
48 | paper-progress {
49 | --paper-progress-secondary-color: #f8bbd0;
50 | }
51 |
52 | To change the progress bar background color:
53 |
54 | paper-progress {
55 | --paper-progress-container-color: #64ffda;
56 | }
57 |
58 | Add the class `transiting` to a paper-progress to animate the progress bar when
59 | the value changed. You can also customize the transition:
60 |
61 | paper-progress {
62 | --paper-progress-transition-duration: 0.08s;
63 | --paper-progress-transition-timing-function: ease;
64 | --paper-progress-transition-delay: 0s;
65 | }
66 |
67 | To change the duration of the indeterminate cycle:
68 |
69 | paper-progress {
70 | --paper-progress-indeterminate-cycle-duration: 2s;
71 | }
72 |
73 | The following mixins are available for styling:
74 |
75 | Custom property | Description | Default
76 | ----------------|-------------|---------
77 | `--paper-progress-container` | Mixin applied to container | `{}`
78 | `--paper-progress-transition-duration` | Duration of the transition | `0.08s`
79 | `--paper-progress-transition-timing-function` | The timing function for the transition | `ease`
80 | `--paper-progress-transition-delay` | delay for the transition | `0s`
81 | `--paper-progress-container-color` | Color of the container | `--google-grey-300`
82 | `--paper-progress-active-color` | The color of the active bar | `--google-green-500`
83 | `--paper-progress-secondary-color` | The color of the secondary bar | `--google-green-100`
84 | `--paper-progress-disabled-active-color` | The color of the active bar if disabled | `--google-grey-500`
85 | `--paper-progress-disabled-secondary-color` | The color of the secondary bar if disabled | `--google-grey-300`
86 | `--paper-progress-height` | The height of the progress bar | `4px`
87 | `--paper-progress-indeterminate-cycle-duration` | Duration of an indeterminate cycle | `2s`
88 |
89 | @group Paper Elements
90 | @element paper-progress
91 | @demo demo/index.html
92 | */
93 | Polymer({
94 | /** @override */
95 | _template: html`
96 |
254 |
255 |