ui_components 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/ui_components/controllers/countdown_controller.js +55 -0
  3. data/app/components/documentation/body/example_preview_component.rb +1 -1
  4. data/app/components/documentation/body_component.html.erb +1 -1
  5. data/app/components/documentation/body_component.rb +4 -4
  6. data/app/components/ui_components/daisy_ui/action/button_component.rb +13 -13
  7. data/app/components/ui_components/daisy_ui/action/dropdown/anchor_component.rb +1 -11
  8. data/app/components/ui_components/daisy_ui/action/dropdown/card/item_component.rb +20 -0
  9. data/app/components/ui_components/daisy_ui/action/dropdown/card_component.rb +4 -14
  10. data/app/components/ui_components/daisy_ui/action/dropdown/menu/item_component.rb +32 -0
  11. data/app/components/ui_components/daisy_ui/action/dropdown/menu_component.rb +2 -12
  12. data/app/components/ui_components/daisy_ui/action/dropdown_component.rb +12 -12
  13. data/app/components/ui_components/daisy_ui/action/modal/anchor_component.rb +1 -11
  14. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/action/item_component.rb +0 -9
  15. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/action_component.rb +0 -9
  16. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/body_component.rb +0 -9
  17. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/close_component.rb +0 -9
  18. data/app/components/ui_components/daisy_ui/action/modal/dialog/box/title_component.rb +0 -9
  19. data/app/components/ui_components/daisy_ui/action/modal/dialog/box_component.rb +0 -9
  20. data/app/components/ui_components/daisy_ui/action/modal/dialog_component.rb +2 -12
  21. data/app/components/ui_components/daisy_ui/action/swap/off_component.rb +0 -9
  22. data/app/components/ui_components/daisy_ui/action/swap/on_component.rb +0 -9
  23. data/app/components/ui_components/daisy_ui/action/swap_component.rb +6 -6
  24. data/app/components/ui_components/daisy_ui/base_component.rb +24 -3
  25. data/app/components/ui_components/daisy_ui/data_display/accordion/item/anchor_component.rb +20 -0
  26. data/app/components/ui_components/daisy_ui/data_display/accordion/item/body_component.rb +20 -0
  27. data/app/components/ui_components/daisy_ui/data_display/accordion/item_component.rb +15 -15
  28. data/app/components/ui_components/daisy_ui/data_display/avatar/item/box_component.rb +63 -0
  29. data/app/components/ui_components/daisy_ui/data_display/avatar/item_component.rb +8 -8
  30. data/app/components/ui_components/daisy_ui/data_display/badge_component.rb +7 -7
  31. data/app/components/ui_components/daisy_ui/data_display/card/body/action_component.rb +20 -0
  32. data/app/components/ui_components/daisy_ui/data_display/card/body/context_component.rb +17 -0
  33. data/app/components/ui_components/daisy_ui/data_display/card/body/title_component.rb +20 -0
  34. data/app/components/ui_components/daisy_ui/data_display/card/body_component.rb +34 -0
  35. data/app/components/ui_components/daisy_ui/data_display/card/figure_component.rb +15 -0
  36. data/app/components/ui_components/daisy_ui/data_display/card_component.rb +83 -0
  37. data/app/components/ui_components/daisy_ui/data_display/carousel/indicator_component.rb +18 -0
  38. data/app/components/ui_components/daisy_ui/data_display/carousel/item/passer_component.rb +20 -0
  39. data/app/components/ui_components/daisy_ui/data_display/carousel/item_component.rb +26 -0
  40. data/app/components/ui_components/daisy_ui/data_display/carousel_component.rb +63 -0
  41. data/app/components/ui_components/daisy_ui/data_display/chat/bubble_component.rb +42 -0
  42. data/app/components/ui_components/daisy_ui/data_display/chat/footer_component.rb +18 -0
  43. data/app/components/ui_components/daisy_ui/data_display/chat/header_component.rb +18 -0
  44. data/app/components/ui_components/daisy_ui/data_display/chat_component.rb +58 -0
  45. data/app/components/ui_components/daisy_ui/data_display/countdown/item_component.rb +49 -0
  46. data/app/components/ui_components/daisy_ui/data_display/countdown_component.rb +37 -0
  47. data/app/components/ui_components/daisy_ui/data_display/{accordion/anchor_component.rb → diff/item1_component.rb} +5 -8
  48. data/app/components/ui_components/daisy_ui/data_display/{accordion/body_component.rb → diff/item2_component.rb} +6 -8
  49. data/app/components/ui_components/daisy_ui/data_display/diff/resizer_component.rb +25 -0
  50. data/app/components/ui_components/daisy_ui/data_display/diff_component.rb +35 -0
  51. data/app/components/ui_components/daisy_ui/data_display/kbd_component.rb +40 -0
  52. data/app/components/ui_components/daisy_ui/data_display/list/item_component.rb +40 -0
  53. data/app/components/ui_components/daisy_ui/data_display/list_component.rb +22 -0
  54. data/app/components/ui_components/daisy_ui/data_display/stat/item/action_component.rb +20 -0
  55. data/app/components/ui_components/daisy_ui/data_display/stat/item/description_component.rb +20 -0
  56. data/app/components/ui_components/daisy_ui/data_display/stat/item/figure_component.rb +24 -0
  57. data/app/components/ui_components/daisy_ui/data_display/stat/item/title_component.rb +20 -0
  58. data/app/components/ui_components/daisy_ui/data_display/stat/item/value_component.rb +20 -0
  59. data/app/components/ui_components/daisy_ui/data_display/stat/item_component.rb +39 -0
  60. data/app/components/ui_components/daisy_ui/data_display/stat_component.rb +50 -0
  61. data/app/components/ui_components/daisy_ui/data_display/status_component.rb +59 -0
  62. data/app/components/ui_components/daisy_ui/data_display/table/item/body_component.rb +23 -0
  63. data/app/components/ui_components/daisy_ui/data_display/table/item/foot_component.rb +23 -0
  64. data/app/components/ui_components/daisy_ui/data_display/table/item/head_component.rb +23 -0
  65. data/app/components/ui_components/daisy_ui/data_display/table/item/row/data_component.rb +19 -0
  66. data/app/components/ui_components/daisy_ui/data_display/table/item/row/header_component.rb +19 -0
  67. data/app/components/ui_components/daisy_ui/data_display/table/item/row_component.rb +32 -0
  68. data/app/components/ui_components/daisy_ui/data_display/table/item_component.rb +29 -0
  69. data/app/components/ui_components/daisy_ui/data_display/table_component.rb +72 -0
  70. data/app/components/ui_components/daisy_ui/data_display/timeline/item/item_end_component.rb +44 -0
  71. data/app/components/ui_components/daisy_ui/data_display/timeline/item/item_middle_component.rb +20 -0
  72. data/app/components/ui_components/daisy_ui/data_display/timeline/item/item_start_component.rb +44 -0
  73. data/app/components/ui_components/daisy_ui/data_display/timeline/item/line_component.rb +17 -0
  74. data/app/components/ui_components/daisy_ui/data_display/timeline/item_component.rb +40 -0
  75. data/app/components/ui_components/daisy_ui/data_display/timeline_component.rb +50 -0
  76. data/app/controllers/ui_components/daisy_ui/data_display_components_controller.rb +22 -0
  77. data/app/helpers/data_display/carousel_helper.rb +13 -0
  78. data/app/views/ui_components/daisy_ui/action_components/button.html.erb +35 -33
  79. data/app/views/ui_components/daisy_ui/action_components/dropdown.html.erb +38 -25
  80. data/app/views/ui_components/daisy_ui/action_components/modal.html.erb +31 -18
  81. data/app/views/ui_components/daisy_ui/action_components/swap.html.erb +31 -17
  82. data/app/views/ui_components/daisy_ui/data_display_components/accordion.html.erb +59 -105
  83. data/app/views/ui_components/daisy_ui/data_display_components/avatar.html.erb +40 -27
  84. data/app/views/ui_components/daisy_ui/data_display_components/badge.html.erb +45 -42
  85. data/app/views/ui_components/daisy_ui/data_display_components/card.html.erb +302 -0
  86. data/app/views/ui_components/daisy_ui/data_display_components/carousel.html.erb +303 -0
  87. data/app/views/ui_components/daisy_ui/data_display_components/chat.html.erb +190 -0
  88. data/app/views/ui_components/daisy_ui/data_display_components/countdown.html.erb +211 -0
  89. data/app/views/ui_components/daisy_ui/data_display_components/diff.html.erb +69 -0
  90. data/app/views/ui_components/daisy_ui/data_display_components/kbd.html.erb +157 -0
  91. data/app/views/ui_components/daisy_ui/data_display_components/list.html.erb +247 -0
  92. data/app/views/ui_components/daisy_ui/data_display_components/stat.html.erb +208 -0
  93. data/app/views/ui_components/daisy_ui/data_display_components/status.html.erb +93 -0
  94. data/app/views/ui_components/daisy_ui/data_display_components/table.html.erb +358 -0
  95. data/app/views/ui_components/daisy_ui/data_display_components/timeline.html.erb +431 -0
  96. data/app/views/ui_components/daisy_ui/home/index.html.erb +11 -0
  97. data/config/routes.rb +13 -2
  98. data/lib/tasks/ui_components_tasks.rake +0 -3
  99. data/lib/ui_components/config/daisy_ui_class_names.rb +3 -2
  100. data/lib/ui_components/config/tailwind_class_names.rb +27 -4
  101. data/lib/ui_components/version.rb +1 -1
  102. metadata +65 -7
  103. data/app/components/ui_components/daisy_ui/action/dropdown/card_item_component.rb +0 -29
  104. data/app/components/ui_components/daisy_ui/action/dropdown/list_item_component.rb +0 -30
  105. data/app/components/ui_components/daisy_ui/data_display/avatar/box_component.rb +0 -61
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ module Table
7
+ module Item
8
+ class RowComponent < BaseComponent
9
+ erb_template <<-ERB
10
+ <%= tag.tr(**set_options) do %>
11
+ <% content.present? %>
12
+
13
+ <% slot_order.each do |slot| %>
14
+ <% if send(slot).present? %>
15
+ <% send(slot).each do |item| %>
16
+ <%= item %>
17
+ <% end %>
18
+ <% end %>
19
+ <% end %>
20
+ <% end %>
21
+ ERB
22
+
23
+ renders_many :headers, Row::HeaderComponent
24
+ renders_many :data, Row::DataComponent
25
+
26
+ tracks_slot_order registered_slots.keys
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ module Table
7
+ class ItemComponent < BaseComponent
8
+ erb_template <<-ERB
9
+ <% content.present? %>
10
+
11
+ <% slot_order.each do |slot| %>
12
+ <% if send(slot).present? %>
13
+ <% send(slot).each do |item| %>
14
+ <%= item %>
15
+ <% end %>
16
+ <% end %>
17
+ <% end %>
18
+ ERB
19
+
20
+ renders_many :heads, Item::HeadComponent
21
+ renders_many :bodies, Item::BodyComponent
22
+ renders_many :foots, Item::FootComponent
23
+
24
+ tracks_slot_order registered_slots.keys
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ class TableComponent < BaseComponent
7
+ SIZES = %w[xs sm md lg xl].freeze
8
+
9
+ CSS_CLASSES_DEFAULT = %w[table].freeze
10
+ CSS_CLASSES_VARIANTS = (
11
+ %w[table-zebra table-pin-rows table-pin-cols] +
12
+ SIZES.map { |key| "table-#{key}" }
13
+ ).freeze
14
+ CSS_CLASSES = (CSS_CLASSES_DEFAULT + CSS_CLASSES_VARIANTS).freeze
15
+
16
+ erb_template <<-ERB
17
+ <%= tag.table(**set_options) do %>
18
+ <% items.each do |item| %>
19
+ <%= item %>
20
+ <% end %>
21
+ <% end %>
22
+ ERB
23
+
24
+ renders_many :items, Table::ItemComponent
25
+
26
+ def initialize(
27
+ zebra: false,
28
+ size: nil,
29
+ pinned_rows: false,
30
+ pinned_cols: false,
31
+ **args
32
+ )
33
+ @zebra = zebra
34
+ @size = size
35
+ @pinned_rows = pinned_rows
36
+ @pinned_cols = pinned_cols
37
+
38
+ super(**args)
39
+ end
40
+
41
+ private
42
+
43
+ def css_class_string
44
+ TailwindMerge::Merger.new.merge([
45
+ *CSS_CLASSES_DEFAULT,
46
+ zebra_css_class,
47
+ size_css_class,
48
+ pinned_rows_css_class,
49
+ pinned_cols_css_class,
50
+ @css_class
51
+ ])
52
+ end
53
+
54
+ def zebra_css_class
55
+ "table-zebra" if @zebra
56
+ end
57
+
58
+ def size_css_class
59
+ "table-#{@size}" if SIZES.include?(@size)
60
+ end
61
+
62
+ def pinned_rows_css_class
63
+ "table-pin-rows" if @pinned_rows
64
+ end
65
+
66
+ def pinned_cols_css_class
67
+ "table-pin-cols" if @pinned_cols
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ module Timeline
7
+ module Item
8
+ class ItemEndComponent < BaseComponent
9
+ CSS_CLASSES_DEFAULT = %w[timeline-end].freeze
10
+ CSS_CLASSES_VARIANTS = %w[timeline-box].freeze
11
+ CSS_CLASSES = (CSS_CLASSES_DEFAULT + CSS_CLASSES_VARIANTS).freeze
12
+
13
+ erb_template <<-ERB
14
+ <%= tag.div(**set_options) { content } %>
15
+ ERB
16
+
17
+ def initialize(
18
+ box: false,
19
+ **args
20
+ )
21
+ @box = box
22
+
23
+ super(**args)
24
+ end
25
+
26
+ private
27
+
28
+ def css_class_string
29
+ TailwindMerge::Merger.new.merge([
30
+ *CSS_CLASSES_DEFAULT,
31
+ box_css_class,
32
+ @css_class
33
+ ])
34
+ end
35
+
36
+ def box_css_class
37
+ "timeline-box" if @box
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ module Timeline
7
+ module Item
8
+ class ItemMiddleComponent < BaseComponent
9
+ CSS_CLASSES_DEFAULT = %w[timeline-middle].freeze
10
+ CSS_CLASSES = CSS_CLASSES_DEFAULT
11
+
12
+ erb_template <<-ERB
13
+ <%= tag.div(**set_options) { content } %>
14
+ ERB
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ module Timeline
7
+ module Item
8
+ class ItemStartComponent < BaseComponent
9
+ CSS_CLASSES_DEFAULT = %w[timeline-start].freeze
10
+ CSS_CLASSES_VARIANTS = %w[timeline-box].freeze
11
+ CSS_CLASSES = (CSS_CLASSES_DEFAULT + CSS_CLASSES_VARIANTS).freeze
12
+
13
+ erb_template <<-ERB
14
+ <%= tag.div(**set_options) { content } %>
15
+ ERB
16
+
17
+ def initialize(
18
+ box: false,
19
+ **args
20
+ )
21
+ @box = box
22
+
23
+ super(**args)
24
+ end
25
+
26
+ private
27
+
28
+ def css_class_string
29
+ TailwindMerge::Merger.new.merge([
30
+ *CSS_CLASSES_DEFAULT,
31
+ box_css_class,
32
+ @css_class
33
+ ])
34
+ end
35
+
36
+ def box_css_class
37
+ "timeline-box" if @box
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ module Timeline
7
+ module Item
8
+ class LineComponent < BaseComponent
9
+ erb_template <<-ERB
10
+ <hr <%= tag.attributes(set_options) %> />
11
+ ERB
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ module Timeline
7
+ class ItemComponent < BaseComponent
8
+ CSS_CLASSES = (
9
+ Item::ItemStartComponent::CSS_CLASSES +
10
+ Item::ItemMiddleComponent::CSS_CLASSES +
11
+ Item::ItemEndComponent::CSS_CLASSES
12
+ ).freeze
13
+
14
+ erb_template <<-ERB
15
+ <%= tag.li(**set_options) do %>
16
+ <% content.present? %>
17
+
18
+ <%= line_start %>
19
+
20
+ <% slot_order.each do |slot| %>
21
+ <%= send(slot) if send(slot).present? %>
22
+ <% end %>
23
+
24
+ <%= line_end %>
25
+ <% end %>
26
+ ERB
27
+
28
+ renders_one :item_start, Item::ItemStartComponent
29
+ renders_one :item_middle, Item::ItemMiddleComponent
30
+ renders_one :item_end, Item::ItemEndComponent
31
+ renders_one :line_start, Item::LineComponent
32
+ renders_one :line_end, Item::LineComponent
33
+
34
+
35
+ tracks_slot_order registered_slots.except(:line_start ,:line_end).keys
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UiComponents
4
+ module DaisyUi
5
+ module DataDisplay
6
+ class TimelineComponent < BaseComponent
7
+ CSS_CLASSES_DEFAULT = %w[timeline].freeze
8
+ CSS_CLASSES_VARIANTS = %w[timeline-horizontal timeline-vertical timeline-snap-icon timeline-compact].freeze
9
+ CSS_CLASSES = (
10
+ CSS_CLASSES_DEFAULT +
11
+ CSS_CLASSES_VARIANTS +
12
+ Timeline::ItemComponent::CSS_CLASSES
13
+ ).freeze
14
+
15
+ erb_template <<-ERB
16
+ <%= tag.ul(**set_options) do %>
17
+ <% items.each do |item| %>
18
+ <%= item %>
19
+ <% end %>
20
+ <% end %>
21
+ ERB
22
+
23
+ renders_many :items, Timeline::ItemComponent
24
+
25
+ def initialize(
26
+ vertical: false,
27
+ **args
28
+ )
29
+ @vertical = vertical
30
+
31
+ super(**args)
32
+ end
33
+
34
+ private
35
+
36
+ def css_class_string
37
+ TailwindMerge::Merger.new.merge([
38
+ *CSS_CLASSES_DEFAULT,
39
+ vertical_css_class,
40
+ @css_class
41
+ ])
42
+ end
43
+
44
+ def vertical_css_class
45
+ "timeline-vertical" if @vertical
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -8,6 +8,28 @@ module UiComponents
8
8
  def avatar; end
9
9
 
10
10
  def badge; end
11
+
12
+ def card; end
13
+
14
+ def carousel; end
15
+
16
+ def chat; end
17
+
18
+ def countdown; end
19
+
20
+ def diff; end
21
+
22
+ def kbd; end
23
+
24
+ def list; end
25
+
26
+ def stat; end
27
+
28
+ def status; end
29
+
30
+ def table; end
31
+
32
+ def timeline; end
11
33
  end
12
34
  end
13
35
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DataDisplay
4
+ module CarouselHelper
5
+ def data_display_carousel_handle_component_params(key:)
6
+ params = { align: "#{key}", css_class: "rounded-box" }
7
+
8
+ params.delete(:align) if key == "start"
9
+
10
+ params.compact_blank.filter_map { |k, v| "#{k}: #{v.inspect}" }.join(", ")
11
+ end
12
+ end
13
+ end
@@ -9,14 +9,14 @@
9
9
  </ul>
10
10
  </div>
11
11
 
12
- <%= render DocumentationComponent.new do |document| %>
13
- <%= document.with_header { "# Button" } %>
14
- <%= document.with_body do |body| %>
12
+ <div class="divider"></div>
13
+
14
+ <%= render DocumentationComponent.new do |doc| %>
15
+ <%= doc.with_header { "# Button" } %>
16
+ <%= doc.with_body do |body| %>
15
17
  <%= body.with_preview_example(
16
18
  source: <<~ERB
17
- <$= render #{component}.new do $>
18
- Default
19
- <$ end $>
19
+ <$= render #{component}.new.with_content("Default") $>
20
20
  ERB
21
21
  ) %>
22
22
  <% end %>
@@ -24,15 +24,13 @@
24
24
 
25
25
  <% sizes = { 'xs' => 'Xsmall', 'sm' => 'Small', 'md' => 'Medium', 'lg' => 'Large', 'xl' => 'Xlarge' } %>
26
26
 
27
- <%= render DocumentationComponent.new do |document| %>
28
- <%= document.with_header { "# Button sizes" } %>
29
- <%= document.with_body do |body| %>
27
+ <%= render DocumentationComponent.new do |doc| %>
28
+ <%= doc.with_header { "# Button sizes" } %>
29
+ <%= doc.with_body do |body| %>
30
30
  <% sizes.each do |key, value| %>
31
31
  <%= body.with_preview_example(
32
32
  source: <<~ERB
33
- <$= render #{component}.new#{"(size: \"#{key}\")" if key != "md"} do $>
34
- #{value}
35
- <$ end $>
33
+ <$= render #{component}.new#{"(size: \"#{key}\")" if key != "md"}.with_content("#{value}") $>
36
34
  ERB
37
35
  ) %>
38
36
  <% end %>
@@ -41,15 +39,13 @@
41
39
 
42
40
  <% colors = { 'default' => 'Default', 'primary' => 'Primary', 'secondary' => 'Secondary', 'accent' => 'Accent', 'info' => 'Info', 'success' => 'Success', 'warning' => 'Warning', 'error' => 'Error' } %>
43
41
 
44
- <%= render DocumentationComponent.new do |document| %>
45
- <%= document.with_header { "# Button colors" } %>
46
- <%= document.with_body do |body| %>
42
+ <%= render DocumentationComponent.new do |doc| %>
43
+ <%= doc.with_header { "# Button colors" } %>
44
+ <%= doc.with_body do |body| %>
47
45
  <% colors.each do |key, value| %>
48
46
  <%= body.with_preview_example(
49
47
  source: <<~ERB
50
- <$= render #{component}.new#{"(color: \"#{key}\")" if key != "default"} do $>
51
- #{value}
52
- <$ end $>
48
+ <$= render #{component}.new#{"(color: \"#{key}\")" if key != "default"}.with_content("#{value}") $>
53
49
  ERB
54
50
  ) %>
55
51
  <% end %>
@@ -59,18 +55,16 @@
59
55
  <% kinds = { 'soft' => 'Soft', 'outline' => 'Outline', 'dash' => 'Dash', 'active' => 'Active', 'disabled' => 'Disabled', 'ghost' => 'Ghost', 'link' => 'Link' } %>
60
56
 
61
57
  <% kinds.each do |kind_key, kind_value| %>
62
- <%= render DocumentationComponent.new do |document| %>
63
- <%= document.with_header { "# #{kind_value} buttons" } %>
64
- <%= document.with_body do |body| %>
58
+ <%= render DocumentationComponent.new do |doc| %>
59
+ <%= doc.with_header { "# #{kind_value} buttons" } %>
60
+ <%= doc.with_body do |body| %>
65
61
  <% colors.each do |color_key, value| %>
66
62
 
67
63
  <% next if action_button_skip_kind(kind_key:, color_key:) %>
68
64
 
69
65
  <%= body.with_preview_example(
70
66
  source: <<~ERB
71
- <$= render #{component}.new(#{action_button_handle_component_params(kind_key:, color_key:)}) do $>
72
- #{value}
73
- <$ end $>
67
+ <$= render #{component}.new(#{action_button_handle_component_params(kind_key:, color_key:)}).with_content("#{value}") $>
74
68
  ERB
75
69
  ) %>
76
70
  <% end %>
@@ -80,15 +74,13 @@
80
74
 
81
75
  <% wide_sizes = { 'wide' => 'Wide', 'block' => 'Block' } %>
82
76
 
83
- <%= render DocumentationComponent.new do |document| %>
84
- <%= document.with_header { "# Wide buttons" } %>
85
- <%= document.with_body do |body| %>
77
+ <%= render DocumentationComponent.new do |doc| %>
78
+ <%= doc.with_header { "# Wide buttons" } %>
79
+ <%= doc.with_body do |body| %>
86
80
  <% wide_sizes.each do |key, value| %>
87
81
  <%= body.with_preview_example(
88
82
  source: <<~ERB
89
- <$= render #{component}.new(wide_size: "#{key}") do $>
90
- #{value}
91
- <$ end $>
83
+ <$= render #{component}.new(wide_size: "#{key}").with_content("#{value}") $>
92
84
  ERB
93
85
  ) %>
94
86
  <% end %>
@@ -97,9 +89,9 @@
97
89
 
98
90
  <% shapes = { 'square' => 'Square', 'circle' => 'Circle' } %>
99
91
 
100
- <%= render DocumentationComponent.new do |document| %>
101
- <%= document.with_header { "# Shape buttons" } %>
102
- <%= document.with_body do |body| %>
92
+ <%= render DocumentationComponent.new do |doc| %>
93
+ <%= doc.with_header { "# Shape buttons" } %>
94
+ <%= doc.with_body do |body| %>
103
95
  <% shapes.each do |key, value| %>
104
96
  <%= body.with_preview_example(
105
97
  source: <<~ERB
@@ -111,4 +103,14 @@
111
103
  <% end %>
112
104
  <% end %>
113
105
  <% end %>
106
+
107
+ <div class="divider"></div>
108
+
109
+ <div class="mb-2">
110
+ <h1 class="font-bold mb-2"># Actions > Button</h1>
111
+ <ul class="bg-base-100 rounded-box shadow-md p-2">
112
+ <%= link_to "Home", daisy_ui_path, class: "link link-primary m-2" %>
113
+ <%= link_to "Dropdown >", daisy_ui_dropdown_path, class: "link link-primary m-2" %>
114
+ </ul>
115
+ </div>
114
116
  </div>
@@ -10,16 +10,18 @@
10
10
  </ul>
11
11
  </div>
12
12
 
13
- <%= render DocumentationComponent.new do |document| %>
14
- <%= document.with_header { "# Dropdown" } %>
15
- <%= document.with_body(preview_options: { css_class: "text-center" }) do |body| %>
13
+ <div class="divider"></div>
14
+
15
+ <%= render DocumentationComponent.new do |doc| %>
16
+ <%= doc.with_header { "# Dropdown" } %>
17
+ <%= doc.with_body(preview_options: { css_class: "text-center" }) do |body| %>
16
18
  <%= body.with_preview_example(
17
19
  source: <<~ERB
18
20
  <$= render #{component}.new do |dropdown| $>
19
- <$= dropdown.with_anchor { "Click" } $>
21
+ <$= dropdown.with_anchor_content("Click") $>
20
22
  <$= dropdown.with_menu do |menu| $>
21
- <$= menu.with_item { "Item 1" } $>
22
- <$= menu.with_item { "Item 2" } $>
23
+ <$= menu.with_item_content("Item 1") $>
24
+ <$= menu.with_item_content("Item 2") $>
23
25
  <$ end $>
24
26
  <$ end $>
25
27
  ERB
@@ -32,18 +34,18 @@
32
34
 
33
35
  <% axes.each do |axis_key| %>
34
36
  <% aligns.each do |align_key| %>
35
- <%= render DocumentationComponent.new do |document| %>
36
- <%= document.with_header { action_dropdown_handle_component_title(axis_key:, align_key:) } %>
37
- <%= document.with_body(preview_options: { css_class: "text-center" }) do |body| %>
37
+ <%= render DocumentationComponent.new do |doc| %>
38
+ <%= doc.with_header { action_dropdown_handle_component_title(axis_key:, align_key:) } %>
39
+ <%= doc.with_body(preview_options: { css_class: "text-center" }) do |body| %>
38
40
  <% component_params = action_dropdown_handle_component_params(axis_key:, align_key:) %>
39
41
 
40
42
  <%= body.with_preview_example(
41
43
  source: <<~ERB
42
44
  <$= render #{component}.new#{"(#{component_params})" if component_params.present?} do |dropdown| $>
43
- <$= dropdown.with_anchor { "Click" } $>
45
+ <$= dropdown.with_anchor_content("Click") $>
44
46
  <$= dropdown.with_menu do |menu| $>
45
- <$= menu.with_item { "Item 1" } $>
46
- <$= menu.with_item { "Item 2" } $>
47
+ <$= menu.with_item_content("Item 1") $>
48
+ <$= menu.with_item_content("Item 2") $>
47
49
  <$ end $>
48
50
  <$ end $>
49
51
  ERB
@@ -56,16 +58,16 @@
56
58
  <% events = %w[hover opened] %>
57
59
 
58
60
  <% events.each do |key| %>
59
- <%= render DocumentationComponent.new do |document| %>
60
- <%= document.with_header { "# Dropdown - #{key}" } %>
61
- <%= document.with_body(preview_options: { css_class: "text-center" }) do |body| %>
61
+ <%= render DocumentationComponent.new do |doc| %>
62
+ <%= doc.with_header { "# Dropdown - #{key}" } %>
63
+ <%= doc.with_body(preview_options: { css_class: "text-center" }) do |body| %>
62
64
  <%= body.with_preview_example(
63
65
  source: <<~ERB
64
66
  <$= render #{component}.new(#{key}: true) do |dropdown| $>
65
- <$= dropdown.with_anchor { "Click" } $>
67
+ <$= dropdown.with_anchor_content("Click") $>
66
68
  <$= dropdown.with_menu do |menu| $>
67
- <$= menu.with_item { "Item 1" } $>
68
- <$= menu.with_item { "Item 2" } $>
69
+ <$= menu.with_item_content("Item 1") $>
70
+ <$= menu.with_item_content("Item 2") $>
69
71
  <$ end $>
70
72
  <$ end $>
71
73
  ERB
@@ -74,13 +76,13 @@
74
76
  <% end %>
75
77
  <% end %>
76
78
 
77
- <%= render DocumentationComponent.new do |document| %>
78
- <%= document.with_header { "# Card as dropdown" } %>
79
- <%= document.with_body(preview_options: { css_class: "text-center" }) do |body| %>
79
+ <%= render DocumentationComponent.new do |doc| %>
80
+ <%= doc.with_header { "# Card as dropdown" } %>
81
+ <%= doc.with_body(preview_options: { css_class: "text-center" }) do |body| %>
80
82
  <%= body.with_preview_example(
81
83
  source: <<~ERB
82
84
  <$= render #{component}.new do |dropdown| $>
83
- <$= dropdown.with_anchor(css_class: "m-1") { "Click" } $>
85
+ <$= dropdown.with_anchor(css_class: "m-1").with_content("Click") $>
84
86
  <$= dropdown.with_card do |card| $>
85
87
  <$= card.with_item do $>
86
88
  <p>This is a card. You can use any element as a dropdown.</p>
@@ -92,9 +94,9 @@
92
94
  <% end %>
93
95
  <% end %>
94
96
 
95
- <%= render DocumentationComponent.new do |document| %>
96
- <%= document.with_header { "# Helper dropdown" } %>
97
- <%= document.with_body(preview_options: { css_class: "text-center" }) do |body| %>
97
+ <%= render DocumentationComponent.new do |doc| %>
98
+ <%= doc.with_header { "# Helper dropdown" } %>
99
+ <%= doc.with_body(preview_options: { css_class: "text-center" }) do |body| %>
98
100
  <%= body.with_preview_example(
99
101
  source: <<~ERB
100
102
  A normal text and a helper dropdown
@@ -114,4 +116,15 @@
114
116
  ) %>
115
117
  <% end %>
116
118
  <% end %>
119
+
120
+ <div class="divider"></div>
121
+
122
+ <div class="mb-2">
123
+ <h1 class="font-bold mb-2"># Actions > Dropdown</h1>
124
+ <ul class="bg-base-100 rounded-box shadow-md p-2">
125
+ <%= link_to "< Button", daisy_ui_button_path, class: "link link-primary m-2" %>
126
+ <%= link_to "Home", daisy_ui_path, class: "link link-primary m-2" %>
127
+ <%= link_to "Modal >", daisy_ui_modal_path, class: "link link-primary m-2" %>
128
+ </ul>
129
+ </div>
117
130
  </div>