Current section
41 Versions
Jump to
Current section
41 Versions
Compare versions
9
files changed
+268
additions
-66
deletions
| @@ -141,7 +141,7 @@ List of available components. | |
| 141 141 | |
| 142 142 | | Component | Status | Storybook | |
| 143 143 | | ----------------------------------------------------- | ------ | --------- | |
| 144 | - | [Accordion](https://daisyui.com/components/accordion) | ✅ | ❌ | |
| 144 | + | [Accordion](https://daisyui.com/components/accordion) | âś… | âś… | |
| 145 145 | | [Avatar](https://daisyui.com/components/avatar) | âś… | âś… | |
| 146 146 | | [Badge](https://daisyui.com/components/badge) | âś… | âś… | |
| 147 147 | | [Card](https://daisyui.com/components/card) | âś… | âś… | |
| @@ -1,60 +1,60 @@ | |
| 1 1 | {<<"links">>, |
| 2 2 | [{<<"GitHub">>,<<"https://github.com/phcurado/daisy_ui_components">>}]}. |
| 3 3 | {<<"name">>,<<"daisy_ui_components">>}. |
| 4 | - {<<"version">>,<<"0.9.1">>}. |
| 4 | + {<<"version">>,<<"0.9.2">>}. |
| 5 5 | {<<"description">>,<<"DaisyUI component library for LiveView">>}. |
| 6 6 | {<<"elixir">>,<<"~> 1.14">>}. |
| 7 7 | {<<"app">>,<<"daisy_ui_components">>}. |
| 8 8 | {<<"licenses">>,[<<"Apache-2.0">>]}. |
| 9 9 | {<<"files">>, |
| 10 | - [<<"lib">>,<<"lib/daisy_ui_components">>, |
| 11 | - <<"lib/daisy_ui_components/utils.ex">>, |
| 12 | - <<"lib/daisy_ui_components/drawer.ex">>, |
| 13 | - <<"lib/daisy_ui_components/collapse.ex">>, |
| 10 | + [<<"lib">>,<<"lib/daisy_ui_components.ex">>,<<"lib/daisy_ui_components">>, |
| 11 | + <<"lib/daisy_ui_components/checkbox.ex">>, |
| 12 | + <<"lib/daisy_ui_components/menu.ex">>,<<"lib/daisy_ui_components/hero.ex">>, |
| 14 13 | <<"lib/daisy_ui_components/textarea.ex">>, |
| 15 | - <<"lib/daisy_ui_components/avatar.ex">>, |
| 16 | - <<"lib/daisy_ui_components/pagination.ex">>, |
| 17 | - <<"lib/daisy_ui_components/list.ex">>, |
| 18 | - <<"lib/daisy_ui_components/tooltip.ex">>, |
| 19 | - <<"lib/daisy_ui_components/loading.ex">>, |
| 20 | - <<"lib/daisy_ui_components/flash.ex">>, |
| 21 | - <<"lib/daisy_ui_components/card.ex">>,<<"lib/daisy_ui_components/swap.ex">>, |
| 14 | + <<"lib/daisy_ui_components/fieldset.ex">>, |
| 22 15 | <<"lib/daisy_ui_components/modal.ex">>, |
| 23 | - <<"lib/daisy_ui_components/hero.ex">>, |
| 24 | - <<"lib/daisy_ui_components/navbar.ex">>, |
| 25 | - <<"lib/daisy_ui_components/progress.ex">>, |
| 26 | - <<"lib/daisy_ui_components/badge.ex">>, |
| 27 | - <<"lib/daisy_ui_components/tabs.ex">>, |
| 28 | - <<"lib/daisy_ui_components/footer.ex">>, |
| 29 | - <<"lib/daisy_ui_components/table.ex">>, |
| 30 | - <<"lib/daisy_ui_components/dropdown.ex">>, |
| 31 | - <<"lib/daisy_ui_components/js_helpers.ex">>, |
| 16 | + <<"lib/daisy_ui_components/tooltip.ex">>, |
| 32 17 | <<"lib/daisy_ui_components/range.ex">>, |
| 33 18 | <<"lib/daisy_ui_components/button.ex">>, |
| 34 | - <<"lib/daisy_ui_components/radio.ex">>, |
| 35 | - <<"lib/daisy_ui_components/checkbox.ex">>, |
| 36 | - <<"lib/daisy_ui_components/select.ex">>, |
| 37 | - <<"lib/daisy_ui_components/accordion.ex">>, |
| 38 | - <<"lib/daisy_ui_components/alert.ex">>, |
| 39 | - <<"lib/daisy_ui_components/label.ex">>, |
| 40 | - <<"lib/daisy_ui_components/form.ex">>, |
| 41 | - <<"lib/daisy_ui_components/toggle.ex">>, |
| 42 | - <<"lib/daisy_ui_components/breadcrumbs.ex">>, |
| 43 | - <<"lib/daisy_ui_components/steps.ex">>, |
| 44 | - <<"lib/daisy_ui_components/icon.ex">>, |
| 45 | - <<"lib/daisy_ui_components/fieldset.ex">>, |
| 19 | + <<"lib/daisy_ui_components/progress.ex">>, |
| 20 | + <<"lib/daisy_ui_components/list.ex">>, |
| 46 21 | <<"lib/daisy_ui_components/text_input.ex">>, |
| 47 | - <<"lib/daisy_ui_components/indicator.ex">>, |
| 48 | - <<"lib/daisy_ui_components/menu.ex">>,<<"lib/daisy_ui_components/join.ex">>, |
| 49 | - <<"lib/daisy_ui_components/header.ex">>, |
| 22 | + <<"lib/daisy_ui_components/avatar.ex">>, |
| 23 | + <<"lib/daisy_ui_components/alert.ex">>, |
| 24 | + <<"lib/daisy_ui_components/breadcrumbs.ex">>, |
| 25 | + <<"lib/daisy_ui_components/drawer.ex">>, |
| 26 | + <<"lib/daisy_ui_components/tabs.ex">>, |
| 27 | + <<"lib/daisy_ui_components/js_helpers.ex">>, |
| 28 | + <<"lib/daisy_ui_components/select.ex">>, |
| 29 | + <<"lib/daisy_ui_components/toggle.ex">>, |
| 30 | + <<"lib/daisy_ui_components/join.ex">>, |
| 31 | + <<"lib/daisy_ui_components/steps.ex">>, |
| 50 32 | <<"lib/daisy_ui_components/input.ex">>, |
| 51 | - <<"lib/daisy_ui_components/stat.ex">>,<<"lib/daisy_ui_components/back.ex">>, |
| 52 | - <<"lib/daisy_ui_components.ex">>,<<".formatter.exs">>,<<"mix.exs">>, |
| 33 | + <<"lib/daisy_ui_components/loading.ex">>, |
| 34 | + <<"lib/daisy_ui_components/form.ex">>, |
| 35 | + <<"lib/daisy_ui_components/badge.ex">>, |
| 36 | + <<"lib/daisy_ui_components/card.ex">>,<<"lib/daisy_ui_components/swap.ex">>, |
| 37 | + <<"lib/daisy_ui_components/back.ex">>, |
| 38 | + <<"lib/daisy_ui_components/utils.ex">>, |
| 39 | + <<"lib/daisy_ui_components/table.ex">>, |
| 40 | + <<"lib/daisy_ui_components/footer.ex">>, |
| 41 | + <<"lib/daisy_ui_components/pagination.ex">>, |
| 42 | + <<"lib/daisy_ui_components/radio.ex">>, |
| 43 | + <<"lib/daisy_ui_components/label.ex">>, |
| 44 | + <<"lib/daisy_ui_components/accordion.ex">>, |
| 45 | + <<"lib/daisy_ui_components/stat.ex">>,<<"lib/daisy_ui_components/icon.ex">>, |
| 46 | + <<"lib/daisy_ui_components/indicator.ex">>, |
| 47 | + <<"lib/daisy_ui_components/navbar.ex">>, |
| 48 | + <<"lib/daisy_ui_components/dropdown.ex">>, |
| 49 | + <<"lib/daisy_ui_components/header.ex">>, |
| 50 | + <<"lib/daisy_ui_components/flash.ex">>, |
| 51 | + <<"lib/daisy_ui_components/collapse.ex">>, |
| 52 | + <<"lib/daisy_ui_components/sidebar.ex">>,<<".formatter.exs">>,<<"mix.exs">>, |
| 53 53 | <<"README.md">>,<<"LICENSE">>]}. |
| 54 54 | {<<"requirements">>, |
| 55 55 | [[{<<"name">>,<<"phoenix_live_view">>}, |
| 56 56 | {<<"app">>,<<"phoenix_live_view">>}, |
| 57 57 | {<<"optional">>,false}, |
| 58 | - {<<"requirement">>,<<"~> 1.0">>}, |
| 58 | + {<<"requirement">>,<<"~> 1.1">>}, |
| 59 59 | {<<"repository">>,<<"hexpm">>}]]}. |
| 60 60 | {<<"build_tools">>,[<<"mix">>]}. |
| @@ -86,6 +86,7 @@ defmodule DaisyUIComponents do | |
| 86 86 | import DaisyUIComponents.Radio |
| 87 87 | import DaisyUIComponents.Range |
| 88 88 | import DaisyUIComponents.Select |
| 89 | + import DaisyUIComponents.Sidebar |
| 89 90 | import DaisyUIComponents.Stat |
| 90 91 | import DaisyUIComponents.Swap |
| 91 92 | import DaisyUIComponents.Tabs |
| @@ -12,22 +12,31 @@ defmodule DaisyUIComponents.Accordion do | |
| 12 12 | |
| 13 13 | ## Examples |
| 14 14 | |
| 15 | - <.accordion> |
| 15 | + <.accordion name="my-accordion"> |
| 16 16 | <:title>Title</:title> |
| 17 | - Content goes here |
| 17 | + <:content>Content goes here</:content> |
| 18 | + </.accordion> |
| 19 | + <.accordion name="my-accordion"> |
| 20 | + <:title>Second Title</:title> |
| 21 | + <:content>Second Content</:content> |
| 18 22 | </.accordion> |
| 19 23 | """ |
| 20 24 | |
| 21 25 | attr :class, :any, default: nil |
| 22 | - attr :name, :string |
| 26 | + attr :name, :string, required: true |
| 23 27 | attr :arrow, :boolean, default: false |
| 24 28 | attr :plus, :boolean, default: false |
| 25 29 | attr :open, :boolean, default: false |
| 26 30 | attr :close, :boolean, default: false |
| 27 31 | attr :rest, :global |
| 28 32 | |
| 29 | - slot :title, required: true |
| 30 | - slot :inner_block, required: true |
| 33 | + slot :title, required: true do |
| 34 | + attr :class, :any |
| 35 | + end |
| 36 | + |
| 37 | + slot :content, required: true do |
| 38 | + attr :class, :any |
| 39 | + end |
| 31 40 | |
| 32 41 | def accordion(assigns) do |
| 33 42 | assigns = |
| @@ -43,19 +52,41 @@ defmodule DaisyUIComponents.Accordion do | |
| 43 52 | assigns.class |
| 44 53 | ]) |
| 45 54 | ) |
| 46 | - |> assign_new(:name, fn -> "accordion-#{System.unique_integer([:positive])}" end) |
| 47 55 | |
| 48 56 | ~H""" |
| 49 57 | <div class={@class} {@rest}> |
| 50 58 | <input type="radio" name={@name} /> |
| 51 59 | |
| 52 | - <div class="collapse-title"> |
| 53 | - {render_slot(@title)} |
| 54 | - </div> |
| 60 | + <.accordion_title :for={title <- @title} class={Map.get(title, :class, nil)}> |
| 61 | + {render_slot(title)} |
| 62 | + </.accordion_title> |
| 63 | + <.accordion_content :for={content <- @content} class={Map.get(content, :class, nil)}> |
| 64 | + {render_slot(content)} |
| 65 | + </.accordion_content> |
| 66 | + </div> |
| 67 | + """ |
| 68 | + end |
| 55 69 | |
| 56 | - <div class="collapse-content"> |
| 57 | - {render_slot(@inner_block)} |
| 58 | - </div> |
| 70 | + attr :class, :any, default: nil |
| 71 | + attr :rest, :global |
| 72 | + slot :inner_block |
| 73 | + |
| 74 | + def accordion_title(assigns) do |
| 75 | + ~H""" |
| 76 | + <div class={classes(["collapse-title", @class])}> |
| 77 | + {render_slot(@inner_block)} |
| 78 | + </div> |
| 79 | + """ |
| 80 | + end |
| 81 | + |
| 82 | + attr :class, :any, default: nil |
| 83 | + attr :rest, :global |
| 84 | + slot :inner_block |
| 85 | + |
| 86 | + def accordion_content(assigns) do |
| 87 | + ~H""" |
| 88 | + <div class={classes(["collapse-content", @class])}> |
| 89 | + {render_slot(@inner_block)} |
| 59 90 | </div> |
| 60 91 | """ |
| 61 92 | end |
| @@ -8,6 +8,7 @@ defmodule DaisyUIComponents.Drawer do | |
| 8 8 | use DaisyUIComponents, :component |
| 9 9 | |
| 10 10 | attr :selector_id, :string, required: true, doc: "identifier to toggle the modal" |
| 11 | + attr :checked, :boolean, default: nil, doc: "Whether the drawer is open or closed" |
| 11 12 | attr :class, :any, default: nil |
| 12 13 | attr :open, :boolean, default: nil, doc: "Forces the drawer to be open" |
| 13 14 | attr :end, :boolean, default: nil, doc: "Puts drawer to the right" |
| @@ -38,7 +39,7 @@ defmodule DaisyUIComponents.Drawer do | |
| 38 39 | |
| 39 40 | ~H""" |
| 40 41 | <div class={@class} {@rest}> |
| 41 | - <input id={@selector_id} type="checkbox" class="drawer-toggle" /> |
| 42 | + <input id={@selector_id} type="checkbox" class="drawer-toggle" checked={@checked} /> |
| 42 43 | {render_slot(@inner_block)} |
| 43 44 | <.drawer_content |
| 44 45 | :for={drawer_content <- @drawer_content} |
| @@ -46,6 +47,7 @@ defmodule DaisyUIComponents.Drawer do | |
| 46 47 | > |
| 47 48 | {render_slot(drawer_content)} |
| 48 49 | </.drawer_content> |
| 50 | + |
| 49 51 | <.drawer_side |
| 50 52 | :for={drawer_side <- @drawer_side} |
| 51 53 | class={Map.get(drawer_side, :class)} |
Loading more files…