Current section

41 Versions

Jump to

Compare versions

36 files changed
+231 additions
-66 deletions
  @@ -1,7 +1,7 @@
1 1 {<<"links">>,
2 2 [{<<"GitHub">>,<<"https://github.com/phcurado/daisy_ui_components">>}]}.
3 3 {<<"name">>,<<"daisy_ui_components">>}.
4 - {<<"version">>,<<"0.7.1">>}.
4 + {<<"version">>,<<"0.7.2">>}.
5 5 {<<"description">>,<<"DaisyUI component library for LiveView">>}.
6 6 {<<"elixir">>,<<"~> 1.14">>}.
7 7 {<<"app">>,<<"daisy_ui_components">>}.
  @@ -10,7 +10,6 @@
10 10 [<<"lib">>,<<"lib/daisy_ui_components">>,
11 11 <<"lib/daisy_ui_components/utils.ex">>,
12 12 <<"lib/daisy_ui_components/drawer.ex">>,
13 - <<"lib/daisy_ui_components/component.ex">>,
14 13 <<"lib/daisy_ui_components/textarea.ex">>,
15 14 <<"lib/daisy_ui_components/avatar.ex">>,
16 15 <<"lib/daisy_ui_components/pagination.ex">>,
  @@ -34,6 +33,7 @@
34 33 <<"lib/daisy_ui_components/toggle.ex">>,
35 34 <<"lib/daisy_ui_components/breadcrumbs.ex">>,
36 35 <<"lib/daisy_ui_components/icon.ex">>,
36 + <<"lib/daisy_ui_components/sidebar.ex">>,
37 37 <<"lib/daisy_ui_components/text_input.ex">>,
38 38 <<"lib/daisy_ui_components/menu.ex">>,<<"lib/daisy_ui_components/join.ex">>,
39 39 <<"lib/daisy_ui_components/header.ex">>,
  @@ -6,6 +6,40 @@ defmodule DaisyUIComponents do
6 6 |> String.split("<!-- MDOC -->")
7 7 |> Enum.fetch!(1)
8 8
9 + @doc false
10 + def live_component do
11 + quote do
12 + use Phoenix.LiveComponent
13 +
14 + unquote(helpers())
15 + end
16 + end
17 +
18 + @doc false
19 + def component do
20 + quote do
21 + use Phoenix.Component
22 +
23 + unquote(helpers())
24 + end
25 + end
26 +
27 + defp helpers() do
28 + quote do
29 + import DaisyUIComponents.Utils
30 + import DaisyUIComponents.JSHelpers
31 +
32 + alias Phoenix.LiveView.JS
33 + end
34 + end
35 +
36 + @doc """
37 + Used for functional or live components
38 + """
39 + defmacro __using__(which) when is_atom(which) do
40 + apply(__MODULE__, which, [])
41 + end
42 +
9 43 defmacro __using__(_) do
10 44 quote do
11 45 import DaisyUIComponents.Alert
  @@ -7,13 +7,11 @@ defmodule DaisyUIComponents.Alert do
7 7
8 8 """
9 9
10 - use DaisyUIComponents.Component
10 + use DaisyUIComponents, :component
11 11
12 12 import DaisyUIComponents.JSHelpers
13 13 import DaisyUIComponents.Icon
14 14
15 - alias Phoenix.LiveView.JS
16 -
17 15 @doc """
18 16 Shows the flash group with standard titles and content.
  @@ -5,7 +5,7 @@ defmodule DaisyUIComponents.Avatar do
5 5 https://daisyui.com/components/avatar
6 6 """
7 7
8 - use DaisyUIComponents.Component
8 + use DaisyUIComponents, :component
9 9
10 10 attr :class, :any, default: nil
11 11 attr :placeholder, :boolean, default: false
  @@ -3,7 +3,7 @@ defmodule DaisyUIComponents.Back do
3 3 This component was extracted from the original [Phoenix CoreComponents](https://github.com/phoenixframework/phoenix/blob/main/installer/templates/phx_web/components/core_components.ex).
4 4 """
5 5
6 - use DaisyUIComponents.Component
6 + use DaisyUIComponents, :component
7 7
8 8 import DaisyUIComponents.Icon
Loading more files…