daisyui-view-components 0.0.2 → 0.0.3

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 (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/daisyui-view-components/app/components/daisyui_view_components/accordion/component.rb +28 -0
  4. data/daisyui-view-components/app/components/daisyui_view_components/alert/component.html.erb +34 -0
  5. data/daisyui-view-components/app/components/daisyui_view_components/alert/component.rb +27 -0
  6. data/daisyui-view-components/app/components/daisyui_view_components/avatar/component.rb +21 -0
  7. data/daisyui-view-components/app/components/daisyui_view_components/avatar_group/component.rb +19 -0
  8. data/daisyui-view-components/app/components/daisyui_view_components/badge/component.rb +41 -0
  9. data/daisyui-view-components/app/components/daisyui_view_components/base_component.rb +118 -0
  10. data/daisyui-view-components/app/components/daisyui_view_components/bottom_nav/component.rb +50 -0
  11. data/daisyui-view-components/app/components/daisyui_view_components/breadcrumbs/component.html.erb +7 -0
  12. data/daisyui-view-components/app/components/daisyui_view_components/breadcrumbs/component.rb +21 -0
  13. data/daisyui-view-components/app/components/daisyui_view_components/button/component.rb +68 -0
  14. data/daisyui-view-components/app/components/daisyui_view_components/card/component.rb +64 -0
  15. data/daisyui-view-components/app/components/daisyui_view_components/carousel/component.rb +35 -0
  16. data/daisyui-view-components/app/components/daisyui_view_components/checkbox/component.html.erb +19 -0
  17. data/daisyui-view-components/app/components/daisyui_view_components/checkbox/component.rb +40 -0
  18. data/daisyui-view-components/app/components/daisyui_view_components/collapse/component.html.erb +9 -0
  19. data/daisyui-view-components/app/components/daisyui_view_components/collapse/component.rb +62 -0
  20. data/daisyui-view-components/app/components/daisyui_view_components/dropdown/component.html.erb +4 -0
  21. data/daisyui-view-components/app/components/daisyui_view_components/dropdown/component.rb +37 -0
  22. data/daisyui-view-components/app/components/daisyui_view_components/file_input/component.html.erb +5 -0
  23. data/daisyui-view-components/app/components/daisyui_view_components/file_input/component.rb +44 -0
  24. data/daisyui-view-components/app/components/daisyui_view_components/form_control/component.rb +21 -0
  25. data/daisyui-view-components/app/components/daisyui_view_components/label/component.rb +22 -0
  26. data/daisyui-view-components/app/components/daisyui_view_components/link/component.rb +34 -0
  27. data/daisyui-view-components/app/components/daisyui_view_components/menu/component.html.erb +7 -0
  28. data/daisyui-view-components/app/components/daisyui_view_components/menu/component.rb +28 -0
  29. data/daisyui-view-components/app/components/daisyui_view_components/modal/action/component.rb +30 -0
  30. data/daisyui-view-components/app/components/daisyui_view_components/modal/box/component.html.erb +9 -0
  31. data/daisyui-view-components/app/components/daisyui_view_components/modal/box/component.rb +15 -0
  32. data/daisyui-view-components/app/components/daisyui_view_components/modal/component.html.erb +8 -0
  33. data/daisyui-view-components/app/components/daisyui_view_components/modal/component.rb +18 -0
  34. data/daisyui-view-components/app/components/daisyui_view_components/navbar/component.html.erb +9 -0
  35. data/daisyui-view-components/app/components/daisyui_view_components/navbar/component.rb +42 -0
  36. data/daisyui-view-components/app/components/daisyui_view_components/radio/component.html.erb +19 -0
  37. data/daisyui-view-components/app/components/daisyui_view_components/radio/component.rb +57 -0
  38. data/daisyui-view-components/app/components/daisyui_view_components/range/component.rb +45 -0
  39. data/daisyui-view-components/app/components/daisyui_view_components/rating/component.rb +73 -0
  40. data/daisyui-view-components/app/components/daisyui_view_components/select/component.html.erb +5 -0
  41. data/daisyui-view-components/app/components/daisyui_view_components/select/component.rb +73 -0
  42. data/daisyui-view-components/app/components/daisyui_view_components/steps/component.rb +56 -0
  43. data/daisyui-view-components/app/components/daisyui_view_components/swap/component.rb +49 -0
  44. data/daisyui-view-components/app/components/daisyui_view_components/table/component.html.erb +5 -0
  45. data/daisyui-view-components/app/components/daisyui_view_components/table/component.rb +92 -0
  46. data/daisyui-view-components/app/components/daisyui_view_components/tabs/component.html.erb +5 -0
  47. data/daisyui-view-components/app/components/daisyui_view_components/tabs/component.rb +50 -0
  48. data/daisyui-view-components/app/components/daisyui_view_components/text_input/component.html.erb +9 -0
  49. data/daisyui-view-components/app/components/daisyui_view_components/text_input/component.rb +71 -0
  50. data/daisyui-view-components/app/components/daisyui_view_components/textarea/component.html.erb +5 -0
  51. data/daisyui-view-components/app/components/daisyui_view_components/textarea/component.rb +50 -0
  52. data/daisyui-view-components/app/components/daisyui_view_components/toggle/component.rb +43 -0
  53. data/daisyui-view-components/lib/daisyui_view_components/cache.rb +50 -0
  54. data/daisyui-view-components/lib/daisyui_view_components/engine.rb +30 -0
  55. data/daisyui-view-components/lib/daisyui_view_components/helpers/component.rb +36 -0
  56. data/daisyui-view-components/lib/daisyui_view_components/tailwind_merger.rb +23 -0
  57. data/daisyui-view-components/lib/daisyui_view_components/version.rb +7 -0
  58. data/daisyui-view-components/lib/daisyui_view_components.rb +12 -0
  59. data/daisyui-view-components/previews/accordion/default.html.erb +29 -0
  60. data/daisyui-view-components/previews/accordion/preview.rb +14 -0
  61. data/daisyui-view-components/previews/alert/default.html.erb +4 -0
  62. data/daisyui-view-components/previews/alert/info_color.html.erb +4 -0
  63. data/daisyui-view-components/previews/alert/preview.rb +23 -0
  64. data/daisyui-view-components/previews/alert/with_buttons.html.erb +10 -0
  65. data/daisyui-view-components/previews/alert/with_icon_title_and_description.html.erb +14 -0
  66. data/daisyui-view-components/previews/avatar/default.html.erb +5 -0
  67. data/daisyui-view-components/previews/avatar/preview.rb +19 -0
  68. data/daisyui-view-components/previews/avatar_group/default.html.erb +17 -0
  69. data/daisyui-view-components/previews/avatar_group/preview.rb +12 -0
  70. data/daisyui-view-components/previews/badge/default.html.erb +1 -0
  71. data/daisyui-view-components/previews/badge/preview.rb +14 -0
  72. data/daisyui-view-components/previews/bottom_nav/default.html.erb +44 -0
  73. data/daisyui-view-components/previews/bottom_nav/preview.rb +16 -0
  74. data/daisyui-view-components/previews/bottom_nav/with_labels.html.erb +47 -0
  75. data/daisyui-view-components/previews/breadcrumbs/default.html.erb +11 -0
  76. data/daisyui-view-components/previews/breadcrumbs/preview.rb +16 -0
  77. data/daisyui-view-components/previews/breadcrumbs/with_icons.html.erb +50 -0
  78. data/daisyui-view-components/previews/button/default.html.erb +3 -0
  79. data/daisyui-view-components/previews/button/preview.rb +28 -0
  80. data/daisyui-view-components/previews/card/default.html.erb +24 -0
  81. data/daisyui-view-components/previews/card/preview.rb +12 -0
  82. data/daisyui-view-components/previews/carousel/default.html.erb +37 -0
  83. data/daisyui-view-components/previews/carousel/preview.rb +19 -0
  84. data/daisyui-view-components/previews/checkbox/default.html.erb +1 -0
  85. data/daisyui-view-components/previews/checkbox/preview.rb +34 -0
  86. data/daisyui-view-components/previews/checkbox/with_form.html.erb +3 -0
  87. data/daisyui-view-components/previews/collapse/default.html.erb +9 -0
  88. data/daisyui-view-components/previews/collapse/preview.rb +14 -0
  89. data/daisyui-view-components/previews/dropdown/default.html.erb +11 -0
  90. data/daisyui-view-components/previews/dropdown/preview.rb +13 -0
  91. data/daisyui-view-components/previews/file_input/default.html.erb +1 -0
  92. data/daisyui-view-components/previews/file_input/preview.rb +26 -0
  93. data/daisyui-view-components/previews/file_input/with_form.html.erb +13 -0
  94. data/daisyui-view-components/previews/link/default.html.erb +1 -0
  95. data/daisyui-view-components/previews/link/preview.rb +17 -0
  96. data/daisyui-view-components/previews/modal/default.html.erb +14 -0
  97. data/daisyui-view-components/previews/modal/preview.rb +19 -0
  98. data/daisyui-view-components/previews/navbar/default.html.erb +75 -0
  99. data/daisyui-view-components/previews/navbar/preview.rb +12 -0
  100. data/daisyui-view-components/previews/radio/default.html.erb +1 -0
  101. data/daisyui-view-components/previews/radio/preview.rb +26 -0
  102. data/daisyui-view-components/previews/radio/with_form.html.erb +4 -0
  103. data/daisyui-view-components/previews/range_slider/default.html.erb +1 -0
  104. data/daisyui-view-components/previews/range_slider/preview.rb +14 -0
  105. data/daisyui-view-components/previews/rating/default.html.erb +6 -0
  106. data/daisyui-view-components/previews/rating/preview.rb +14 -0
  107. data/daisyui-view-components/previews/select/default.html.erb +1 -0
  108. data/daisyui-view-components/previews/select/preview.rb +26 -0
  109. data/daisyui-view-components/previews/select/with_form.html.erb +13 -0
  110. data/daisyui-view-components/previews/steps/default.html.erb +14 -0
  111. data/daisyui-view-components/previews/steps/preview.rb +13 -0
  112. data/daisyui-view-components/previews/swap/default.html.erb +9 -0
  113. data/daisyui-view-components/previews/swap/flip_effect.html.erb +9 -0
  114. data/daisyui-view-components/previews/swap/hamburger_button.html.erb +26 -0
  115. data/daisyui-view-components/previews/swap/preview.rb +28 -0
  116. data/daisyui-view-components/previews/swap/rotate_effect.html.erb +23 -0
  117. data/daisyui-view-components/previews/swap/volume_icons.html.erb +27 -0
  118. data/daisyui-view-components/previews/table/default.html.erb +60 -0
  119. data/daisyui-view-components/previews/table/preview.rb +17 -0
  120. data/daisyui-view-components/previews/tabs/default.html.erb +11 -0
  121. data/daisyui-view-components/previews/tabs/preview.rb +21 -0
  122. data/daisyui-view-components/previews/text_input/default.html.erb +1 -0
  123. data/daisyui-view-components/previews/text_input/preview.rb +42 -0
  124. data/daisyui-view-components/previews/text_input/with_form.html.erb +13 -0
  125. data/daisyui-view-components/previews/text_input/with_icon_inside.html.erb +59 -0
  126. data/daisyui-view-components/previews/text_input/with_text_label_inside.html.erb +26 -0
  127. data/daisyui-view-components/previews/textarea/default.html.erb +1 -0
  128. data/daisyui-view-components/previews/textarea/preview.rb +26 -0
  129. data/daisyui-view-components/previews/textarea/with_form.html.erb +13 -0
  130. data/daisyui-view-components/previews/toggle/default.html.erb +1 -0
  131. data/daisyui-view-components/previews/toggle/preview.rb +26 -0
  132. data/daisyui-view-components/previews/toggle/with_form.html.erb +3 -0
  133. metadata +137 -7
@@ -0,0 +1,29 @@
1
+ <%= component :accordion, arrow: arrow do |accordion| %>
2
+ <% accordion.with_collapse do |collapse| %>
3
+ <% collapse.with_radio name: "accordion1", data: {a: 1}, class: 'sss' %>
4
+ <% collapse.with_collapse_title do %>
5
+ Focus me to see content
6
+ <% end %>
7
+ <% collapse.with_collapse_content do %>
8
+ <p>tabindex="0" attribute is necessary to make the div focusable</p>
9
+ <% end %>
10
+ <% end %>
11
+ <% accordion.with_collapse do |collapse| %>
12
+ <% collapse.with_radio name: "accordion1", data: {a: 1}, class: 'sss' %>
13
+ <% collapse.with_collapse_title do %>
14
+ Focus me to see content
15
+ <% end %>
16
+ <% collapse.with_collapse_content do %>
17
+ <p>tabindex="0" attribute is necessary to make the div focusable</p>
18
+ <% end %>
19
+ <% end %>
20
+ <% accordion.with_collapse do |collapse| %>
21
+ <% collapse.with_radio name: "accordion1", data: {a: 1}, class: 'sss' %>
22
+ <% collapse.with_collapse_title do %>
23
+ Focus me to see content
24
+ <% end %>
25
+ <% collapse.with_collapse_content do %>
26
+ <p>tabindex="0" attribute is necessary to make the div focusable</p>
27
+ <% end %>
28
+ <% end %>
29
+ <% end %>
@@ -0,0 +1,14 @@
1
+ # fronze_string_literal: true
2
+
3
+ module Accordion
4
+ # @label Accordion
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @label Column
8
+ # @param arrow [Boolean] select [false, true] "Show arrow"
9
+ def default(arrow: false)
10
+ render_with_template locals: { arrow: arrow }, template: 'accordion/default'
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,4 @@
1
+ <%= component :alert, color: color do %>
2
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-info shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
3
+ <span>New software update available.</span>
4
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <%= component :alert, color: color do %>
2
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-current shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
3
+ <span>New software update available.</span>
4
+ <% end %>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Alert
4
+ # @label Alert
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @param color [Symbol] select {{ DaisyUIViewComponents::Alert::Component::COLOR_OPTIONS.dup.push('nil') }}
8
+ def default(color: nil)
9
+ render_with_template locals: { color: color }, template: 'alert/default'
10
+ end
11
+
12
+ # @param color [Symbol] select {{ DaisyUIViewComponents::Alert::Component::COLOR_OPTIONS.dup.push('nil') }}
13
+ def with_buttons(color: nil)
14
+ render_with_template locals: { color: color }, template: 'alert/with_buttons'
15
+ end
16
+
17
+ # @param color [Symbol] select {{ DaisyUIViewComponents::Alert::Component::COLOR_OPTIONS.dup.push('nil') }}
18
+ def with_icon_title_and_description(color: nil)
19
+ render_with_template locals: { color: color }, template: 'alert/with_icon_title_and_description'
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,10 @@
1
+ <%= component :alert, color: color do |alert| %>
2
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-info shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
3
+ <span>We use cookies for no reason.</span>
4
+ <% alert.with_button class: "btn-sm" do %>
5
+ Deny
6
+ <% end %>
7
+ <% alert.with_button class: "btn-sm" do %>
8
+ Accept
9
+ <% end %>
10
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <%= component :alert, color: color do |alert| %>
2
+ <% alert.with_icon do %>
3
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" class="stroke-info shrink-0 w-6 h-6"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>
4
+ <% end %>
5
+ <% alert.with_title do %>
6
+ New message!
7
+ <% end %>
8
+ <% alert.with_description do %>
9
+ You have 1 unread message
10
+ <% end %>
11
+ <% alert.with_button class: "btn-sm" do %>
12
+ Show
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <%= component :avatar, online: online, offline: offline, placeholder: placeholder, class: "asd" do %>
2
+ <div class="w-24 rounded">
3
+ <img src="https://avatar.iran.liara.run/public/88" />
4
+ </div>
5
+ <% end %>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Avatar
4
+ # @label Avatar
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @param online [Boolean] select [false, true] "shows a green dot as online indicator"
8
+ # @param offline [Boolean] select [true, false] "shows a gray dot as offline indicator"
9
+ # @param placeholder [Boolean] select [true, false] "Whether to show some letters as avatar placeholder"
10
+ def default(online: false, offline: false, placeholder: false)
11
+ render_with_template locals: {
12
+ online: online,
13
+ offline: offline,
14
+ placeholder: placeholder
15
+ }, template: 'avatar/default'
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ <%= component :avatar_group do |group| %>
2
+ <% group.with_avatar do %>
3
+ <div class="w-12">
4
+ <img src="https://avatar.iran.liara.run/public/88" />
5
+ </div>
6
+ <% end %>
7
+ <% group.with_avatar do %>
8
+ <div class="w-12">
9
+ <img src="https://avatar.iran.liara.run/public/88" />
10
+ </div>
11
+ <% end %>
12
+ <% group.with_avatar placeholder: true do %>
13
+ <div class="bg-neutral text-neutral-content w-12">
14
+ <span>+99</span>
15
+ </div>
16
+ <% end %>
17
+ <% end %>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AvatarGroup
4
+ # @label AvatarGroup
5
+ class Preview < ViewComponent::Preview
6
+
7
+ def default
8
+ render_with_template template: 'avatar_group/default'
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1 @@
1
+ <%= component :badge, "Badge", color: color, size: size %>
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Badge
4
+ # @label Badge
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @param color [Symbol] select {{ DaisyUIViewComponents::Badge::Component::COLOR_OPTIONS }}
8
+ # @param size [Symbol] select {{ DaisyUIViewComponents::Badge::Component::SIZE_OPTIONS.dup.push('nil') }}
9
+ def default(color: nil, size: nil)
10
+ render_with_template locals: { color: color, size: size }, template: 'badge/default'
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,44 @@
1
+ <%= component :bottom_nav do |nav| %>
2
+ <% nav.with_button do %>
3
+ <svg
4
+ xmlns="http://www.w3.org/2000/svg"
5
+ class="h-5 w-5"
6
+ fill="none"
7
+ viewBox="0 0 24 24"
8
+ stroke="currentColor">
9
+ <path
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ stroke-width="2"
13
+ d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
14
+ </svg>
15
+ <% end %>
16
+ <% nav.with_button active: true do %>
17
+ <svg
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ class="h-5 w-5"
20
+ fill="none"
21
+ viewBox="0 0 24 24"
22
+ stroke="currentColor">
23
+ <path
24
+ stroke-linecap="round"
25
+ stroke-linejoin="round"
26
+ stroke-width="2"
27
+ d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
28
+ </svg>
29
+ <% end %>
30
+ <% nav.with_button disabled: true do %>
31
+ <svg
32
+ xmlns="http://www.w3.org/2000/svg"
33
+ class="h-5 w-5"
34
+ fill="none"
35
+ viewBox="0 0 24 24"
36
+ stroke="currentColor">
37
+ <path
38
+ stroke-linecap="round"
39
+ stroke-linejoin="round"
40
+ stroke-width="2"
41
+ d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
42
+ </svg>
43
+ <% end %>
44
+ <% end %>
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BottomNav
4
+ # @label Bottom Nav
5
+ class Preview < ViewComponent::Preview
6
+
7
+ def default
8
+ render_with_template template: 'bottom_nav/default'
9
+ end
10
+
11
+ def with_labels
12
+ render_with_template template: 'bottom_nav/with_labels'
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,47 @@
1
+ <%= component :bottom_nav do |nav| %>
2
+ <% nav.with_button do |button| %>
3
+ <% button.with_label "Home" %>
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ class="h-5 w-5"
7
+ fill="none"
8
+ viewBox="0 0 24 24"
9
+ stroke="currentColor">
10
+ <path
11
+ stroke-linecap="round"
12
+ stroke-linejoin="round"
13
+ stroke-width="2"
14
+ d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
15
+ </svg>
16
+ <% end %>
17
+ <% nav.with_button active: true do |button| %>
18
+ <% button.with_label "Warnings" %>
19
+ <svg
20
+ xmlns="http://www.w3.org/2000/svg"
21
+ class="h-5 w-5"
22
+ fill="none"
23
+ viewBox="0 0 24 24"
24
+ stroke="currentColor">
25
+ <path
26
+ stroke-linecap="round"
27
+ stroke-linejoin="round"
28
+ stroke-width="2"
29
+ d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
30
+ </svg>
31
+ <% end %>
32
+ <% nav.with_button do |button| %>
33
+ <% button.with_label "Statistics" %>
34
+ <svg
35
+ xmlns="http://www.w3.org/2000/svg"
36
+ class="h-5 w-5"
37
+ fill="none"
38
+ viewBox="0 0 24 24"
39
+ stroke="currentColor">
40
+ <path
41
+ stroke-linecap="round"
42
+ stroke-linejoin="round"
43
+ stroke-width="2"
44
+ d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
45
+ </svg>
46
+ <% end %>
47
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <%= component :breadcrumbs, class: "text-sm" do |bc| %>
2
+ <% bc.with_item do %>
3
+ <a>Home</a>
4
+ <% end %>
5
+ <% bc.with_item do %>
6
+ <a>Documents</a>
7
+ <% end %>
8
+ <% bc.with_item do %>
9
+ Add Document
10
+ <% end %>
11
+ <% end %>
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Breadcrumbs
4
+ # @label Breadcrumbs
5
+ class Preview < ViewComponent::Preview
6
+
7
+ def default
8
+ render_with_template template: 'breadcrumbs/default'
9
+ end
10
+
11
+ def with_icons
12
+ render_with_template template: 'breadcrumbs/with_icons'
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,50 @@
1
+ <%= component :breadcrumbs, class: "text-sm" do |bc| %>
2
+ <% bc.with_item do %>
3
+ <a class="inline-flex items-center gap-2">
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ fill="none"
7
+ viewBox="0 0 24 24"
8
+ class="h-4 w-4 stroke-current">
9
+ <path
10
+ stroke-linecap="round"
11
+ stroke-linejoin="round"
12
+ stroke-width="2"
13
+ d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path>
14
+ </svg>
15
+ Home
16
+ </a>
17
+ <% end %>
18
+ <% bc.with_item do %>
19
+ <a class="inline-flex items-center gap-2">
20
+ <svg
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ fill="none"
23
+ viewBox="0 0 24 24"
24
+ class="h-4 w-4 stroke-current">
25
+ <path
26
+ stroke-linecap="round"
27
+ stroke-linejoin="round"
28
+ stroke-width="2"
29
+ d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path>
30
+ </svg>
31
+ Documents
32
+ </a>
33
+ <% end %>
34
+ <% bc.with_item do %>
35
+ <span class="inline-flex items-center gap-2">
36
+ <svg
37
+ xmlns="http://www.w3.org/2000/svg"
38
+ fill="none"
39
+ viewBox="0 0 24 24"
40
+ class="h-4 w-4 stroke-current">
41
+ <path
42
+ stroke-linecap="round"
43
+ stroke-linejoin="round"
44
+ stroke-width="2"
45
+ d="M9 13h6m-3-3v6m5 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
46
+ </svg>
47
+ Add Document
48
+ </span>
49
+ <% end %>
50
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <%= component :button, color: color, style: style, class: 'asd' do %>
2
+ Button
3
+ <% end %>
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Button
4
+ # @label Button
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @param color [Symbol] select {{ DaisyUIViewComponents::Button::Component::COLOR_OPTIONS.dup.push('nil') }}
8
+ # @param style [Symbol] select {{ DaisyUIViewComponents::Button::Component::STYLE_OPTIONS.dup.push('nil') }}
9
+ def default(
10
+ url: '',
11
+ label: '',
12
+ method: '',
13
+ options: '',
14
+ color: nil,
15
+ style: nil
16
+ )
17
+ render_with_template locals: {
18
+ url: url,
19
+ label: label,
20
+ method: method,
21
+ options: options,
22
+ color: color,
23
+ style: style
24
+ }, template: 'button/default'
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ <%= component :card do |card| %>
2
+ <%= card.with_image do %>
3
+ <img src="https://placehold.co/600x400" alt="Album"/>
4
+ <% end %>
5
+ <%= card.with_card_body do |card_body| %>
6
+ <%= card_body.with_title do %>
7
+ Shoes!
8
+ <%= component :badge, class: 'badge-secondary' do %>
9
+ NEW
10
+ <% end %>
11
+ <% end %>
12
+ <p>If a dog chews shoes whose shoes does he choose?</p>
13
+ <%= card_body.with_card_actions class: "justify-end" do |actions| %>
14
+ <div class="my-auto">
15
+ <%= actions.with_badge do %>
16
+ $19.99
17
+ <% end %>
18
+ </div>
19
+ <%= actions.with_button class: "btn-primary" do %>
20
+ Buy now
21
+ <% end %>
22
+ <% end %>
23
+ <% end %>
24
+ <% end %>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Card
4
+ # @label Card
5
+ class Preview < ViewComponent::Preview
6
+
7
+ def default
8
+ render_with_template template: 'card/default'
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,37 @@
1
+ <%= component :carousel, carousel_center: carousel_center, carousel_end: carousel_end, carousel_vertical: carousel_vertical, class: "rounded-box" do |carousel| %>
2
+ <% carousel.with_item do %>
3
+ <img
4
+ src="https://placehold.co/600x400/orange/white"
5
+ alt="CarrouselImage" />
6
+ <% end %>
7
+ <% carousel.with_item do %>
8
+ <img
9
+ src="https://placehold.co/600x400/green/white"
10
+ alt="CarrouselImage" />
11
+ <% end %>
12
+ <% carousel.with_item do %>
13
+ <img
14
+ src="https://placehold.co/600x400/blue/white"
15
+ alt="Burger" />
16
+ <% end %>
17
+ <% carousel.with_item do %>
18
+ <img
19
+ src="https://placehold.co/600x400/red/white"
20
+ alt="Burger" />
21
+ <% end %>
22
+ <% carousel.with_item do %>
23
+ <img
24
+ src="https://placehold.co/600x400/beige/white"
25
+ alt="Burger" />
26
+ <% end %>
27
+ <% carousel.with_item do %>
28
+ <img
29
+ src="https://placehold.co/600x400/purple/white"
30
+ alt="Burger" />
31
+ <% end %>
32
+ <% carousel.with_item do %>
33
+ <img
34
+ src="https://placehold.co/600x400/gold/white"
35
+ alt="Burger" />
36
+ <% end %>
37
+ <% end %>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Carousel
4
+ # @label Carousel
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @param carousel_center [Boolean] select [false, true] "Snap elements to center"
8
+ # @param carousel_end [Boolean] select [true, false] "Snap elements to end"
9
+ # @param carousel_vertical [Boolean] select [true, false] "Vertical carousel"
10
+ def default(carousel_center: false, carousel_end: false, carousel_vertical: false)
11
+ render_with_template locals: {
12
+ carousel_center: carousel_center,
13
+ carousel_end: carousel_end,
14
+ carousel_vertical: carousel_vertical
15
+ }, template: 'carousel/default'
16
+ end
17
+
18
+ end
19
+ end
@@ -0,0 +1 @@
1
+ <%= component :checkbox, size: size, color: color, checked: checked, disabled: disabled %>
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Checkbox
4
+ # @label Checkbox
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @param size [Symbol] select {{ DaisyUIViewComponents::Checkbox::Component::SIZE_OPTIONS }}
8
+ # @param color [Symbol] select {{ DaisyUIViewComponents::Checkbox::Component::COLOR_OPTIONS }}
9
+ # @param checked [Boolean] select [false, true] "Checked"
10
+ # @param disabled [Boolean] select [false, true] "Disabled"
11
+ def default(checked: false, disabled: false, size: nil, color: nil)
12
+ render_with_template locals: {
13
+ checked: checked,
14
+ disabled: disabled,
15
+ size: size,
16
+ color: color
17
+ }, template: 'checkbox/default'
18
+ end
19
+
20
+ # @param size [Symbol] select {{ DaisyUIViewComponents::Checkbox::Component::SIZE_OPTIONS }}
21
+ # @param color [Symbol] select {{ DaisyUIViewComponents::Checkbox::Component::COLOR_OPTIONS }}
22
+ # @param checked [Boolean] select [false, true] "Checked"
23
+ # @param disabled [Boolean] select [false, true] "Disabled"
24
+ def with_form(checked: false, disabled: false, size: nil, color: nil)
25
+ render_with_template locals: {
26
+ checked: checked,
27
+ disabled: disabled,
28
+ size: size,
29
+ color: color
30
+ }, template: 'checkbox/with_form'
31
+ end
32
+
33
+ end
34
+ end
@@ -0,0 +1,3 @@
1
+ <%= form_with url: "#" do |f| %>
2
+ <%= component :checkbox, :remember, label: "Remember me", size: size, color: color, checked: checked, disabled: disabled, form: f %>
3
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <%= component :collapse, open: open, arrow: arrow do |collapse| %>
2
+ <% collapse.with_checkbox data: {a: 1}, class: 'sss' %>
3
+ <% collapse.with_collapse_title do %>
4
+ Focus me to see content
5
+ <% end %>
6
+ <% collapse.with_collapse_content do %>
7
+ <p>tabindex="0" attribute is necessary to make the div focusable</p>
8
+ <% end %>
9
+ <% end %>
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Collapse
4
+ # @label Collapse
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @param open [Boolean] select [false, true] "Force open"
8
+ # @param arrow [Boolean] select [false, true] "Show arrow"
9
+ def default(open: false, arrow: false)
10
+ render_with_template locals: { open: open, arrow: arrow }, template: 'collapse/default'
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ <%= component :dropdown, position: position do |dropdown| %>
2
+ <% dropdown.with_trigger "Open" %>
3
+ <% dropdown.with_menu do |menu| %>
4
+ <% menu.with_item data: {a: 1}, class: "test" do %>
5
+ <a>Item 1</a>
6
+ <% end %>
7
+ <% menu.with_item do %>
8
+ <a>Item 2</a>
9
+ <% end %>
10
+ <% end %>
11
+ <% end %>
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dropdown
4
+ # @label Dropdown
5
+ class Preview < ViewComponent::Preview
6
+
7
+ # @param position [Symbol] select {{ DaisyUIViewComponents::Dropdown::Component::POSITIONS }} "The position of the menu"
8
+ def default(position: nil)
9
+ render_with_template locals: { position: position }, template: 'dropdown/default'
10
+ end
11
+
12
+ end
13
+ end
@@ -0,0 +1 @@
1
+ <%= component :file_input, size: size, color: color, bordered: bordered, ghost: ghost %>
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Layout/LineLength
4
+ module FileInput
5
+ # @label FileInput
6
+ class Preview < ViewComponent::Preview
7
+
8
+ # @param size [Symbol] select {{ DaisyUIViewComponents::FileInput::Component::SIZE_OPTIONS.dup.push('nil') }}
9
+ # @param color [Symbol] select {{ DaisyUIViewComponents::FileInput::Component::COLOR_OPTIONS.dup.push('nil') }}
10
+ # @param bordered [Boolean] select [true, false] "Adds border to input"
11
+ # @param ghost [Boolean] select [true, false] "Adds ghost style to input"
12
+ def default(size: nil, color: nil, bordered: false, ghost: false)
13
+ render_with_template locals: { size: size, color: color, bordered: bordered, ghost: ghost }, template: 'file_input/default'
14
+ end
15
+
16
+ # @param size [Symbol] select {{ DaisyUIViewComponents::FileInput::Component::SIZE_OPTIONS.dup.push('nil') }}
17
+ # @param color [Symbol] select {{ DaisyUIViewComponents::FileInput::Component::COLOR_OPTIONS.dup.push('nil') }}
18
+ # @param bordered [Boolean] select [true, false] "Adds border to input"
19
+ # @param ghost [Boolean] select [true, false] "Adds ghost style to input"
20
+ def with_form(size: nil, color: nil, bordered: false, ghost: false)
21
+ render_with_template locals: { size: size, color: color, bordered: bordered, ghost: ghost }, template: 'file_input/with_form'
22
+ end
23
+
24
+ end
25
+ end
26
+ # rubocop:enable Layout/LineLength
@@ -0,0 +1,13 @@
1
+ <%= form_with url: "#" do |f| %>
2
+ <label class="form-control">
3
+ <div class="label">
4
+ <span class="label-text">Pick a file</span>
5
+ <span class="label-text-alt">Alt label</span>
6
+ </div>
7
+ <%= component :file_input, :some_file, form: f, size: size, color: color, bordered: bordered, ghost: ghost %>
8
+ <div class="label">
9
+ <span class="label-text-alt">Your bio</span>
10
+ <span class="label-text-alt">Alt label</span>
11
+ </div>
12
+ </label>
13
+ <% end %>