@shoelace-style/shoelace
Version:
A forward-thinking library of web components.
76 lines (73 loc) • 1.89 kB
JavaScript
import {
progress_bar_styles_default
} from "./chunk.HSWXQUHN.js";
import {
o as o2
} from "./chunk.FQQ5K3WY.js";
import {
LocalizeController
} from "./chunk.NH3SRVOC.js";
import {
o
} from "./chunk.2URMUHDY.js";
import {
e
} from "./chunk.UZVKBFXH.js";
import {
component_styles_default
} from "./chunk.K23QWHWK.js";
import {
ShoelaceElement,
n
} from "./chunk.QAHCGRIS.js";
import {
x
} from "./chunk.CXZZ2LVK.js";
import {
__decorateClass
} from "./chunk.625AWUY7.js";
// src/components/progress-bar/progress-bar.component.ts
var SlProgressBar = class extends ShoelaceElement {
constructor() {
super(...arguments);
this.localize = new LocalizeController(this);
this.value = 0;
this.indeterminate = false;
this.label = "";
}
render() {
return x`
<div
part="base"
class=${e({
"progress-bar": true,
"progress-bar--indeterminate": this.indeterminate,
"progress-bar--rtl": this.localize.dir() === "rtl"
})}
role="progressbar"
title=${o(this.title)}
aria-label=${this.label.length > 0 ? this.label : this.localize.term("progress")}
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow=${this.indeterminate ? 0 : this.value}
>
<div part="indicator" class="progress-bar__indicator" style=${o2({ width: `${this.value}%` })}>
${!this.indeterminate ? x` <slot part="label" class="progress-bar__label"></slot> ` : ""}
</div>
</div>
`;
}
};
SlProgressBar.styles = [component_styles_default, progress_bar_styles_default];
__decorateClass([
n({ type: Number, reflect: true })
], SlProgressBar.prototype, "value", 2);
__decorateClass([
n({ type: Boolean, reflect: true })
], SlProgressBar.prototype, "indeterminate", 2);
__decorateClass([
n()
], SlProgressBar.prototype, "label", 2);
export {
SlProgressBar
};