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

Progress Bar and Radial transition prop added #2196

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/warm-mirrors-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@skeletonlabs/skeleton": patch
---

chore: Progress Bar and Progress Radial now include dedicated `transition` props
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
export let height: CssClasses = 'h-2';
/** Provide classes to set rounded styles. */
export let rounded: CssClasses = 'rounded-token';
/** Provide classes to set the meter transition styles. */
export let transition: CssClasses = 'transition-[width]';

// Props (elements)
/** Provide arbitrary classes to style the meter element. */
/** Sets the base classes of the meter element. */
export let meter: CssClasses = 'bg-surface-900-50-token';
/** Provide arbitrary classes to style the track element. */
/** Sets the base classes of the track element. */
export let track: CssClasses = 'bg-surface-200-700-token';

// Props A11y
Expand All @@ -38,8 +40,8 @@
$: indeterminate = value === undefined || value < 0;
$: classesIndeterminate = indeterminate ? 'animIndeterminate' : '';
// Reactive Classes
$: classesTrack = `${cTrack} ${height} ${rounded} ${track} ${$$props.class ?? ''}`;
$: classesMeter = `${cMeter} ${rounded} ${classesIndeterminate} ${meter}`;
$: classesTrack = `${cTrack} ${track} ${height} ${rounded} ${$$props.class ?? ''}`;
$: classesMeter = `${cMeter} ${meter} ${rounded} ${classesIndeterminate} ${transition}`;
</script>

<!-- Track -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
export let font = 56; // px
/** Sets the stoke-linecap value */
export let strokeLinecap: 'butt' | 'round' | 'square' = 'butt';
/** Provide classes to set the meter transition styles. */
export let transition: CssClasses = 'transition-[stroke-dashoffset]';

// Props (styles)
/** Provide classes to set the width. */
Expand All @@ -35,7 +37,7 @@
// Base Classes
const cBase = 'progress-radial relative overflow-hidden';
const cBaseTrack = 'fill-transparent';
const cBaseMeter = 'fill-transparent transition-[stroke-dashoffset] duration-200 -rotate-90 origin-[50%_50%]';
const cBaseMeter = 'fill-transparent -rotate-90 origin-[50%_50%]';

// Calculated Values
const baseSize = 512; // px
Expand Down Expand Up @@ -79,7 +81,7 @@

<!-- Meter -->
<circle
class="progress-radial-meter {cBaseMeter} {meter}"
class="progress-radial-meter {cBaseMeter} {meter} {transition}"
stroke-width={stroke}
r={radius}
cx="50%"
Expand Down