defmodule Moon.Design.Dropdown.Options do @moduledoc "Options list for the Dropdown component" use Moon.StatelessComponent import Moon.Helpers.MakeList import Moon.Helpers.Positions @doc "Value of the selected option(s)" prop(value, :any, from_context: :value) @doc "On option click event, in most cases got from context" prop(on_change, :event, from_context: :on_change) @doc "If the optionlist is open, got from context" prop(is_open, :boolean, from_context: :is_open) @doc "Size of the options" prop(size, :string, values!: ~w(sm md lg), default: "md") @doc "Additional CSS classes for the div" prop(class, :css_class) @doc "Specifies the position of the dropdown" prop(position, :string, values: position_list()) @doc "Additional values to be passed" prop(values, :map, from_context: :values) @doc "List of the options. Used when no option slot is given " prop(titles, :list, default: []) @doc "Option module" prop(option_module, :atom, default: Moon.Design.Dropdown.Option) @doc "Data-testid attribute for div" prop(testid, :string) @doc "Id attribute for div" prop(id, :string) slot(option) slot(default) slot(header) slot(footer) def render(assigns) do ~F"""