UNPKG

preact-material-components

Version:
46 lines 1.96 kB
import { MDCLinearProgress } from '@material/linear-progress'; import { h } from 'preact'; import MaterialComponent from '../Base/MaterialComponent'; export class LinearProgress extends MaterialComponent { constructor() { super(...arguments); this.componentName = 'linear-progress'; this.mdcProps = ['reversed', 'indeterminate']; this.themeProps = ['primary', 'secondary']; this.mdcNotifyProps = ['progress']; } componentDidMount() { super.componentDidMount(); if (this.control) { this.MDComponent = new MDCLinearProgress(this.control); this.MDComponent.determinate = !this.props.indeterminate; this.MDComponent.reverse = !!this.props.reversed; } this.afterComponentDidMount(); } componentWillReceiveProps(nextProps) { super.componentWillReceiveProps(nextProps); if (this.MDComponent) { this.MDComponent.determinate = !this.props.indeterminate; this.MDComponent.reverse = !!nextProps.reversed; } } componentWillUnmount() { super.componentWillUnmount(); if (this.MDComponent) { this.MDComponent.destroy(); } } materialDom(props) { // TODO: Fix theme props return (h("div", Object.assign({ role: "progressbar" }, props, { ref: this.setControlRef }), h("div", { className: "mdc-linear-progress__buffering-dots" }), h("div", { className: "mdc-linear-progress__buffer" }), h("div", { className: "mdc-linear-progress__bar mdc-linear-progress__primary-bar" }, h("span", { className: "mdc-linear-progress__bar-inner" })), h("div", { className: "mdc-linear-progress__bar mdc-linear-progress__secondary-bar" }, h("span", { className: "mdc-linear-progress__bar-inner" })))); } } export default LinearProgress; //# sourceMappingURL=index.js.map