Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug resolved #4224

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 6 additions & 5 deletions packages/meter/src/Meter.ts
Expand Up @@ -47,7 +47,8 @@ export class Meter extends SizedMixin(ObserveSlotText(SpectrumElement, ''), {
}

@property({ type: Number })
public progress = 0;
public value = 0;


/**
* The variant applies specific styling when set to `negative`, `positive`, `notice`
Expand Down Expand Up @@ -102,12 +103,12 @@ export class Meter extends SizedMixin(ObserveSlotText(SpectrumElement, ''), {
${new Intl.NumberFormat(this.languageResolver.language, {
style: 'percent',
unitDisplay: 'narrow',
}).format(this.progress / 100)}
}).format(this.value / 100)}
</sp-field-label>
<div class="track">
<div
class="fill"
style="transform: scaleX(calc(${this.progress} / 100));"
style="transform: scaleX(calc(${this.value} / 100));"
></div>
</div>
`;
Expand All @@ -127,8 +128,8 @@ export class Meter extends SizedMixin(ObserveSlotText(SpectrumElement, ''), {

protected override updated(changes: PropertyValues): void {
super.updated(changes);
if (changes.has('progress')) {
this.setAttribute('aria-valuenow', '' + this.progress);
if (changes.has('value')) {
this.setAttribute('aria-valuenow', '' + this.value);
}
if (changes.has('label')) {
if (this.label.length) {
Expand Down
10 changes: 5 additions & 5 deletions packages/progress-bar/src/ProgressBar.ts
Expand Up @@ -58,7 +58,7 @@ export class ProgressBar extends SizedMixin(
public sideLabel = false;

@property({ type: Number })
public progress = 0;
public value = 0;

@property({ type: String, reflect: true })
public static: 'white' | undefined;
Expand Down Expand Up @@ -93,15 +93,15 @@ export class ProgressBar extends SizedMixin(
style: 'percent',
unitDisplay: 'narrow',
}
).format(this.progress / 100)}
).format(this.value / 100)}
</sp-field-label>
`}
`
: nothing}
<div class="track">
<div
class="fill"
style="transform: scaleX(calc(${this.progress} / 100));"
style="transform: scaleX(calc(${this.value} / 100));"
></div>
</div>
`;
Expand Down Expand Up @@ -133,8 +133,8 @@ export class ProgressBar extends SizedMixin(
this.setAttribute('aria-valuemax', '100');
}
}
if (!this.indeterminate && changes.has('progress')) {
this.setAttribute('aria-valuenow', '' + this.progress);
if (!this.indeterminate && changes.has('value')) {
this.setAttribute('aria-valuenow', '' + this.value);
}
if (changes.has('label')) {
if (this.label.length) {
Expand Down
10 changes: 5 additions & 5 deletions packages/progress-circle/src/ProgressCircle.ts
Expand Up @@ -50,7 +50,7 @@ export class ProgressCircle extends SizedMixin(SpectrumElement, {
public static?: 'white';

@property({ type: Number })
public progress = 0;
public value = 0;

@query('slot')
private slotEl!: HTMLSlotElement;
Expand Down Expand Up @@ -83,9 +83,9 @@ export class ProgressCircle extends SizedMixin(SpectrumElement, {

protected override render(): TemplateResult {
const styles = [
this.makeRotation(-180 + (180 / 50) * Math.min(this.progress, 50)),
this.makeRotation(-180 + (180 / 50) * Math.min(this.value, 50)),
this.makeRotation(
-180 + (180 / 50) * Math.max(this.progress - 50, 0)
-180 + (180 / 50) * Math.max(this.value - 50, 0)
),
];
const masks = ['Mask1', 'Mask2'];
Expand Down Expand Up @@ -125,8 +125,8 @@ export class ProgressCircle extends SizedMixin(SpectrumElement, {

protected override updated(changes: PropertyValues): void {
super.updated(changes);
if (!this.indeterminate && changes.has('progress')) {
this.setAttribute('aria-valuenow', '' + this.progress);
if (!this.indeterminate && changes.has('value')) {
this.setAttribute('aria-valuenow', '' + this.value);
} else if (this.hasAttribute('aria-valuenow')) {
this.removeAttribute('aria-valuenow');
}
Expand Down