feat: add ProgressBar ProgressCircle and Meter
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
|
||||
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
|
||||
|
||||
/* ==========================================================================
|
||||
ProgressBar - Shows determinate or indeterminate progress
|
||||
========================================================================== */
|
||||
|
||||
/* Base styles */
|
||||
.hv-progress-bar {
|
||||
@apply grid w-full gap-1;
|
||||
grid-template-areas:
|
||||
"label output"
|
||||
"track track";
|
||||
grid-template-columns: 1fr auto;
|
||||
|
||||
/* Default color token (accent) */
|
||||
--progress-bar-fill: var(--accent);
|
||||
|
||||
[data-slot="label"] {
|
||||
@apply w-fit text-sm font-medium;
|
||||
|
||||
grid-area: label;
|
||||
}
|
||||
|
||||
.hv-progress-bar__output {
|
||||
@apply text-sm font-medium tabular-nums;
|
||||
|
||||
grid-area: output;
|
||||
}
|
||||
|
||||
.hv-progress-bar__track {
|
||||
@apply relative overflow-hidden rounded-sm bg-default;
|
||||
|
||||
grid-area: track;
|
||||
|
||||
/* Default height (matches --md) */
|
||||
@apply h-2;
|
||||
}
|
||||
|
||||
.hv-progress-bar__fill {
|
||||
@apply absolute start-0 top-0 h-full rounded-sm;
|
||||
|
||||
background-color: var(--progress-bar-fill);
|
||||
|
||||
/**
|
||||
* Transitions
|
||||
* CRITICAL: motion-reduce must be AFTER transition for correct override specificity
|
||||
*/
|
||||
transition: width 300ms var(--ease-out);
|
||||
@apply motion-reduce:transition-none;
|
||||
}
|
||||
|
||||
/* Indeterminate state - when no aria-valuenow is set */
|
||||
&:not([aria-valuenow]) {
|
||||
.hv-progress-bar__fill {
|
||||
@apply w-2/5;
|
||||
|
||||
animation: hv-progress-bar-indeterminate 1.5s
|
||||
cubic-bezier(0.65, 0, 0.35, 1) infinite;
|
||||
|
||||
@apply motion-reduce:animate-none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Disabled state */
|
||||
&:disabled,
|
||||
&[data-disabled="true"],
|
||||
&[aria-disabled="true"] {
|
||||
@apply status-disabled;
|
||||
|
||||
[data-slot="label"] {
|
||||
@apply opacity-100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Indeterminate animation
|
||||
========================================================================== */
|
||||
|
||||
@keyframes hv-progress-bar-indeterminate {
|
||||
0% {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(350%);
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Size variants
|
||||
========================================================================== */
|
||||
|
||||
.hv-progress-bar--sm {
|
||||
.hv-progress-bar__track {
|
||||
@apply h-1 rounded-xs;
|
||||
}
|
||||
|
||||
.hv-progress-bar__fill {
|
||||
@apply rounded-xs;
|
||||
}
|
||||
}
|
||||
|
||||
.hv-progress-bar--md {
|
||||
/* No styles as this is the default size */
|
||||
}
|
||||
|
||||
.hv-progress-bar--lg {
|
||||
.hv-progress-bar__track {
|
||||
@apply h-3 rounded-md;
|
||||
}
|
||||
|
||||
.hv-progress-bar__fill {
|
||||
@apply rounded-md;
|
||||
}
|
||||
}
|
||||
|
||||
/* ==========================================================================
|
||||
Color variants
|
||||
========================================================================== */
|
||||
|
||||
.hv-progress-bar--default {
|
||||
--progress-bar-fill: var(--default-foreground);
|
||||
}
|
||||
|
||||
.hv-progress-bar--accent {
|
||||
--progress-bar-fill: var(--accent);
|
||||
}
|
||||
|
||||
.hv-progress-bar--success {
|
||||
--progress-bar-fill: var(--success);
|
||||
}
|
||||
|
||||
.hv-progress-bar--warning {
|
||||
--progress-bar-fill: var(--warning);
|
||||
}
|
||||
|
||||
.hv-progress-bar--danger {
|
||||
--progress-bar-fill: var(--danger);
|
||||
}
|
||||
Reference in New Issue
Block a user