This repository was archived by the owner on Jan 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(linear-progress): Implement Linear Progress indicators #672
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
1eb26f3
feat(linear-progress): Implement Linear Progress indicators
lynnmercier 3805df3
Merge branch 'master' into feat/linear-progress
lynnmercier e287b70
Merge branch 'master' into feat/linear-progress
lynnmercier e2e002f
Merge branch 'feat/linear-progress' of github.com:material-components…
lynnmercier 7ae71cc
Merge branch 'master' into feat/linear-progress
lynnmercier 552aa0e
move transform properties to animation
lynnmercier a3ae66b
Merge branch 'master' into feat/linear-progress
lynnmercier ea00ba5
forEach
lynnmercier c6116ea
Merge branch 'master' into feat/linear-progress
lynnmercier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,190 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
Copyright 2017 Google Inc. All rights reserved. | ||
Licensed 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 | ||
https://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 CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License | ||
--> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Linear Progress - Material Compoonents Catalog</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<script src="assets/material-components-web.css.js" charset="utf-8"></script> | ||
<link href="demos.css" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/css?family=Roboto+Mono" rel="stylesheet"> | ||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"> | ||
<style> | ||
fieldset { | ||
margin: 24px; | ||
margin-top: 0; | ||
margin-bottom: 16px; | ||
} | ||
fieldset .mdc-linear-progress { | ||
margin: 16px 0; | ||
} | ||
|
||
fieldset legend { | ||
display: block; | ||
padding: 16px; | ||
padding-top: 64px; | ||
padding-bottom: 24px; | ||
} | ||
|
||
.linear-progress-demo { | ||
margin: 64px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<header class="mdc-toolbar mdc-toolbar--fixed"> | ||
<div class="mdc-toolbar__row"> | ||
<section class="mdc-toolbar__section mdc-toolbar__section--align-start"> | ||
<span class="catalog-back"> | ||
<a href="/"><i class="material-icons"></i></a> | ||
</span> | ||
<span class="mdc-toolbar__title catalog-title">Linear Progress Indicators</span> | ||
</section> | ||
</div> | ||
</header> | ||
<main class="mdc-toolbar-fixed-adjust"> | ||
|
||
<section class="hero"> | ||
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--indeterminate"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section> | ||
<fieldset> | ||
<legend class="mdc-typography--title">Linear Progress Indicators</legend> | ||
|
||
<figure class="linear-progress-demo"> | ||
<div role="progressbar" class="mdc-linear-progress"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
<figcaption>Determinate</figcaption> | ||
</figure> | ||
|
||
<figure class="linear-progress-demo"> | ||
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--indeterminate"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
<figcaption>Indeterminate</figcaption> | ||
</figure> | ||
|
||
<figure class="linear-progress-demo"> | ||
<div role="progressbar" class="mdc-linear-progress" data-buffer="true"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
<figcaption>Buffer</figcaption> | ||
</figure> | ||
|
||
<figure class="linear-progress-demo"> | ||
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--reversed"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
<figcaption>Reversed</figcaption> | ||
</figure> | ||
|
||
<figure class="linear-progress-demo"> | ||
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--indeterminate mdc-linear-progress--reversed"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
<figcaption>Indeterminate Reversed</figcaption> | ||
</figure> | ||
|
||
<figure class="linear-progress-demo"> | ||
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--reversed" data-buffer="true"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
<figcaption>Buffer Reversed</figcaption> | ||
</figure> | ||
|
||
<figure class="linear-progress-demo"> | ||
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--accent"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
<figcaption>Accent</figcaption> | ||
</figure> | ||
|
||
</fieldset> | ||
</section> | ||
|
||
</main> | ||
<script src="assets/material-components-web.js" charset="utf-8"></script> | ||
<script> | ||
var determinates = document.querySelectorAll('.mdc-linear-progress'); | ||
for (var i = 0, determinate; determinate = determinates[i]; i++) { | ||
const linearProgress = mdc.linearProgress.MDCLinearProgress.attachTo(determinate); | ||
linearProgress.progress = 0.5; | ||
if (determinate.dataset.buffer) { | ||
linearProgress.buffer = 0.75; | ||
} | ||
} | ||
</script> | ||
</body> | ||
</html> |
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 |
---|---|---|
|
@@ -129,6 +129,7 @@ | |
"grid-list", | ||
"icon-toggle", | ||
"layout-grid", | ||
"linear-progress", | ||
"list", | ||
"menu", | ||
"radio", | ||
|
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
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,78 @@ | ||
<!--docs: | ||
title: "Linear Progress" | ||
layout: detail | ||
section: components | ||
excerpt: "Material Design-styled linear progress indicators." | ||
iconId: linear-progress | ||
path: /catalog/linear-progress/ | ||
--> | ||
|
||
# Linear Progress | ||
|
||
<!--<div class="article__asset"> | ||
<a class="article__asset-link" | ||
href="https://material-components-web.appspot.com/linear-progress.html"> | ||
</a> | ||
</div>--> | ||
|
||
The MDC Linear Progress component is a spec-aligned linear progress indicator component adhering to the | ||
[Material Design progress & activity requirements](https://material.io/guidelines/components/progress-activity.html). | ||
|
||
## Design & API Documentation | ||
|
||
<div role="progressbar" class="mdc-linear-progress"> | ||
<div class="mdc-linear-progress__buffering-dots"></div> | ||
<div class="mdc-linear-progress__buffer"></div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"> | ||
<span class="mdc-linear-progress__bar-inner"></span> | ||
</div> | ||
</div> | ||
|
||
## Installation | ||
|
||
``` | ||
npm install --save @material/linear-progress | ||
``` | ||
|
||
## Usage | ||
|
||
### CSS Modifiers | ||
|
||
The provided modifiers are: | ||
|
||
| Class | Description | | ||
| --------------------- | ------------------------------------------------------- | | ||
| `mdc-linear-progress--indeterminate` | Puts the linear progress indicator in an indeterminate state. | | ||
| `mdc-linear-progress--reversed` | Reverses the direction of the linear progress indicator. | | ||
| `mdc-linear-progress--accent` | Colors the button with the accent color. | | ||
|
||
### Using the Foundation Class | ||
|
||
MDC Linear Progress ships with an `MDCLinearProgressFoundation` class that external frameworks and libraries can | ||
use to integrate the component. As with all foundation classes, an adapter object must be provided. | ||
The adapter for temporary drawers must provide the following functions, with correct signatures: | ||
|
||
| Method Signature | Description | | ||
| --- | --- | | ||
| `addClass(className: string) => void` | Adds a class to the root element. | | ||
| `removeClass(className: string) => void` | Removes a class from the root element. | | ||
| `hasClass(className: string) => boolean` | Returns boolean indicating whether the root element has a given class. | | ||
| `getPrimaryBar() => Element` | Returns the primary bar element. | | ||
| `getBuffer() => Element` | Returns the buffer element. | | ||
| `setTransform(el: Element, value: string) => void` | Sets the css transform property on the given element. | | ||
|
||
### MDCLinearProgress API | ||
|
||
MDC Linear Progress exposes the following methods: | ||
|
||
| Method Signature | Description | | ||
| --- | --- | | ||
| `set determinate(value: boolean) => void` | Toggles the components between the determinate and indeterminate state. | | ||
| `set progress(value: number) => void` | Sets the progress bar to this value. Value should be between [0, 1]. | | ||
| `set buffer(value: number) => void` | Sets the buffer bar to this value. Value should be between [0, 1]. | | ||
| `set reverse(value: boolean) => void` | Reverses the direction of the linear progress indicator. | | ||
| `open() => void` | Puts the component in the open state. | | ||
| `close() => void` | Puts the component in the closed state. | |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This demos look gorgeous. The only thing I might change is giving each example a little more space to breath. For a good minute I was looking at the reverse LPI thinking it was a very wrong implementation of buffer LPI. 😝