progress-circle.stories.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // @ts-nocheck
  2. import * as mod from "./progress-circle"
  3. import { create } from "../storybook/scaffold"
  4. const docs = `### Overview
  5. Circular progress indicator for compact loading states.
  6. Pair with labels for clarity in dashboards.
  7. ### API
  8. - Required: \`percentage\` (0-100).
  9. - Optional: \`size\`, \`strokeWidth\`.
  10. ### Variants and states
  11. - Single visual style; size and stroke width adjust appearance.
  12. ### Behavior
  13. - Percentage is clamped between 0 and 100.
  14. ### Accessibility
  15. - Use alongside text or aria-live messaging for progress context.
  16. ### Theming/tokens
  17. - Uses \`data-component="progress-circle"\` with background/progress slots.
  18. `
  19. const story = create({ title: "UI/ProgressCircle", mod, args: { percentage: 65, size: 48 } })
  20. export default {
  21. title: "UI/ProgressCircle",
  22. id: "components-progress-circle",
  23. component: story.meta.component,
  24. tags: ["autodocs"],
  25. parameters: {
  26. docs: {
  27. description: {
  28. component: docs,
  29. },
  30. },
  31. },
  32. argTypes: {
  33. percentage: {
  34. control: { type: "range", min: 0, max: 100, step: 1 },
  35. },
  36. },
  37. }
  38. export const Basic = story.Basic
  39. export const States = {
  40. render: () => (
  41. <div style={{ display: "flex", gap: "16px", "align-items": "center" }}>
  42. <mod.ProgressCircle percentage={0} size={32} />
  43. <mod.ProgressCircle percentage={50} size={32} />
  44. <mod.ProgressCircle percentage={100} size={32} />
  45. </div>
  46. ),
  47. }