"""
end
@doc """
Shows the flash group with standard titles and content.
## Examples
<.flash_group flash={@flash} />
"""
attr :flash, :map, required: true, doc: "the map of flash messages"
def flash_group(assigns) do
~H"""
"""
end
@doc """
Renders a message notice.
Similar to `flash/1`, but for permanent messages on the page.
## Examples
<.message_box kind={:info} message="🦊 in a 📦" />
"""
attr :message, :string, required: true
attr :kind, :atom, values: [:info, :success, :warning, :error]
def message_box(assigns) do
~H"""
<%= @message %>
"""
end
@doc """
Creates a live region with the given role.
## Examples
<.live_region role="alert" />
<.live_region role="status" />
"""
def live_region(assigns) do
~H"""
"""
end
@doc """
Sends a message to be read by the screen reader by changing the text content of the live region
"""
def sr_message(js \\ %JS{}, message) do
JS.dispatch(js, "lb:set_text", to: "#live-region", detail: %{value: message})
end
@doc """
Wraps the given content in a modal dialog.
## Example
<.modal id="edit-modal" patch={...}>
<.live_component module={MyComponent} />
"""
attr :id, :string, required: true
attr :show, :boolean, default: false
attr :patch, :string, default: nil
attr :navigate, :string, default: nil
attr :class, :string, default: nil
attr :width, :atom, values: [:small, :medium, :big, :large], required: true
attr :rest, :global
slot :inner_block, required: true
def modal(assigns) do
~H"""
"""
end
@doc """
Renders text with a tiny label.
## Examples
<.labeled_text label="Name">Sherlock Holmes
"""
attr :label, :string, required: true
attr :one_line, :boolean,
default: false,
doc: "whether to force the text into a single scrollable line"
slot :inner_block, required: true
def labeled_text(assigns) do
~H"""
<%= @label %>
<%= render_slot(@inner_block) %>
"""
end
@doc """
Renders a choice button that is either active or not.
## Examples
<.choice_button active={@tab == "my_tab"} phx-click="set_my_tab">
My tab
"""
attr :active, :boolean, required: true
attr :disabled, :boolean
attr :class, :string, default: nil
attr :rest, :global
slot :inner_block, required: true
def choice_button(assigns) do
assigns =
assigns
|> assign_new(:disabled, fn -> assigns.active end)
~H"""
"""
end
@doc """
Renders an status indicator circle.
"""
attr :variant, :atom,
required: true,
values: [:success, :warning, :error, :inactive, :waiting, :progressing]
def status_indicator(assigns) do
~H"""
"""
end
@doc """
Returns background class based on the given variant.
See `status_indicator/1` for available variants.
"""
def status_circle_class(variant)
def status_circle_class(:success), do: "bg-green-bright-400"
def status_circle_class(:warning), do: "bg-yellow-bright-200"
def status_circle_class(:error), do: "bg-red-400"
def status_circle_class(:inactive), do: "bg-gray-500"
def status_circle_class(:waiting), do: "bg-gray-400"
def status_circle_class(:progressing), do: "bg-blue-500"
defp animated_status_circle_class(:waiting), do: "bg-gray-300"
defp animated_status_circle_class(:progressing), do: "bg-blue-400"
defp animated_status_circle_class(_other), do: nil
@doc """
Renders an informative box as a placeholder for a list.
"""
slot :inner_block, required: true
slot :actions
def no_entries(assigns) do
~H"""