This repository has been 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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(linear-progress): Implement Linear Progress indicators (#672)
Resolves #29: Implement Linear Progress Indicator Component
- Loading branch information
1 parent
25414ac
commit c47d1c2
Showing
18 changed files
with
1,000 additions
and
2 deletions.
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.