Skip to main content

priv/registry/progress.json

{
  "files": [
    {
      "content": "defmodule Shadix.Components.Progress do\n  @moduledoc \"\"\"\n  Progress bar, translated from the shadcn/ui `progress` component.\n\n  Renders a determinate progress bar. The `value` attribute (0-100) controls\n  how far the indicator is filled.\n  \"\"\"\n  use Phoenix.Component\n  import Shadix.Cn\n\n  attr(:value, :integer, default: 0)\n  attr(:label, :string, default: \"Progress\", doc: \"Accessible name for the progress bar.\")\n  attr(:class, :string, default: nil)\n  attr(:rest, :global)\n\n  def progress(assigns) do\n    class = cn([\"relative h-2 w-full overflow-hidden rounded-full bg-primary/20\", assigns.class])\n    assigns = assign(assigns, :computed_class, class)\n\n    ~H\"\"\"\n    <div\n      data-slot=\"progress\"\n      role=\"progressbar\"\n      aria-label={@label}\n      aria-valuemin=\"0\"\n      aria-valuemax=\"100\"\n      aria-valuenow={@value}\n      aria-valuetext={\"#{@value}%\"}\n      class={@computed_class}\n      {@rest}\n    >\n      <div\n        data-slot=\"progress-indicator\"\n        class=\"h-full w-full flex-1 bg-primary transition-all motion-reduce:transition-none\"\n        style={\"transform: translateX(-#{100 - @value}%)\"}\n      >\n      </div>\n    </div>\n    \"\"\"\n  end\nend\n",
      "path": "progress.ex"
    }
  ],
  "hooks": [],
  "name": "progress",
  "npm_deps": [],
  "registry_deps": [
    "cn"
  ]
}