feat(Progress): add circular variant#6747
Conversation
Also adds thickness prop to control circle stroke width
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe Progress component now supports Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/runtime/components/Progress.vue`:
- Around line 217-224: Update the circular branch in Progress.vue around the SVG
element to apply the component’s sizing class to the <svg>, ensuring it fills
the intended square container and preserves the circle’s aspect ratio.
Coordinate this with the circular variant sizing definitions in the progress
theme so the root size propagates through the SVG; leave non-circular rendering
unchanged.
- Around line 217-232: Add data-slot="indicator" to the circular variant’s
indicator <circle> in the Progress component, the same element using
ui.indicator({ class: props.ui?.indicator }). Leave the linear ProgressIndicator
and other markup unchanged.
In `@src/runtime/keyframes.css`:
- Around line 568-572: Update the circular-rotate keyframes to explicitly define
a from state matching the indicator’s static -90deg transform, while preserving
the existing 360deg to state, so each animation loop restarts continuously
without a visible jump.
In `@src/theme/progress.ts`:
- Around line 94-98: Update the circular variant configuration in the theme
definition to provide an explicit base sizing override, matching the sizing
behavior required by the root’s fixed dimensions and centered alignment. Add the
appropriate circular base classes alongside its existing track, indicator, and
status classes, while leaving the linear variant and other circular styling
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: ddbd35d0-bbed-4e38-ae10-a61442b9bd49
⛔ Files ignored due to path filters (4)
test/components/__snapshots__/Progress-vue.spec.ts.snapis excluded by!**/*.snaptest/components/__snapshots__/Progress.spec.ts.snapis excluded by!**/*.snaptest/components/__snapshots__/Toast-vue.spec.ts.snapis excluded by!**/*.snaptest/components/__snapshots__/Toast.spec.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (6)
docs/content/docs/2.components/progress.mdplaygrounds/nuxt/app/pages/components/progress.vuesrc/runtime/components/Progress.vuesrc/runtime/keyframes.csssrc/theme/progress.tstest/components/Progress.spec.ts
🔗 Linked issue
Resolves #6151
❓ Type of change
📚 Description
Adds circular progress support to
UProgressas avariantrather than a separateUCircularProgresscomponent, as suggested in the issue. This keeps a single API surface and lets the existingcolor,size,animation,inverted,statusandorientationprops carry over.What's included
variantprop —linear(default) orcircular. Defaults preserve current behaviour, so this is non-breaking.<circle>track plus aProgressIndicatorcircle withpathLength="100", driven bystroke-dasharray. A newtrackslot is exposed for the background circle.thicknessprop —auto(default) derives the stroke width fromsize, or pass a number of pixels. Both go through the--ui-progress-thicknessCSS variable, which also drives the radius (r: calc(50px - thickness / 2)) so the stroke never overflows the viewBox.2xs→2xlmap to both a diameter and a default thickness.statusslot is rendered centered inside the circle instead of above/beside the bar.animationvalues (carousel,carousel-inverse,swing,elastic) have circular equivalents, added as new keyframes inkeyframes.css.inverted— flips the sweep direction of the circle.Theme refactor
The
progresstheme has been reorganised so most existingorientation/size/animationcompound variants are now scoped undervariant: 'linear', withvariant: 'circular'counterparts added. Some slot classes moved fromslotsinto thelinearvariant (e.g.overflow-hidden rounded-full bg-accentedonbase). Rendered output for the defaultlinearvariant is unchanged apart from class ordering — snapshots were updated accordingly (Progress, andToastwhich embeds a progress bar).Playground
playgrounds/nuxt/app/pages/components/progress.vuenow exercises the circular variant across sizes, colors, animations and a custom thickness.📝 Checklist