better_ui 0.6.0 → 0.7.1

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 (198) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +257 -212
  3. data/Rakefile +11 -2
  4. data/app/components/better_ui/action_messages_component/action_messages_component.html.erb +48 -0
  5. data/app/components/better_ui/action_messages_component.rb +544 -0
  6. data/app/components/better_ui/application_component.rb +66 -0
  7. data/app/components/better_ui/button_component/button_component.html.erb +31 -0
  8. data/app/components/better_ui/button_component.rb +307 -0
  9. data/app/components/better_ui/card_component/card_component.html.erb +17 -0
  10. data/app/components/better_ui/card_component.rb +460 -0
  11. data/app/components/better_ui/drawer/header_component/header_component.html.erb +24 -0
  12. data/app/components/better_ui/drawer/header_component.rb +238 -0
  13. data/app/components/better_ui/drawer/layout_component/layout_component.html.erb +44 -0
  14. data/app/components/better_ui/drawer/layout_component.rb +270 -0
  15. data/app/components/better_ui/drawer/nav_group_component/nav_group_component.html.erb +10 -0
  16. data/app/components/better_ui/drawer/nav_group_component.rb +155 -0
  17. data/app/components/better_ui/drawer/nav_item_component/nav_item_component.html.erb +13 -0
  18. data/app/components/better_ui/drawer/nav_item_component.rb +225 -0
  19. data/app/components/better_ui/drawer/sidebar_component/sidebar_component.html.erb +17 -0
  20. data/app/components/better_ui/drawer/sidebar_component.rb +263 -0
  21. data/app/components/better_ui/forms/base_component.rb +450 -0
  22. data/app/components/better_ui/forms/checkbox_component/checkbox_component.html.erb +28 -0
  23. data/app/components/better_ui/forms/checkbox_component.rb +419 -0
  24. data/app/components/better_ui/forms/checkbox_group_component/checkbox_group_component.html.erb +40 -0
  25. data/app/components/better_ui/forms/checkbox_group_component.rb +363 -0
  26. data/app/components/better_ui/forms/number_input_component/number_input_component.html.erb +40 -0
  27. data/app/components/better_ui/forms/number_input_component.rb +320 -0
  28. data/app/components/better_ui/forms/password_input_component/password_input_component.html.erb +71 -0
  29. data/app/components/better_ui/forms/password_input_component.rb +206 -0
  30. data/app/components/better_ui/forms/text_input_component/text_input_component.html.erb +40 -0
  31. data/app/components/better_ui/forms/text_input_component.rb +258 -0
  32. data/app/components/better_ui/forms/textarea_component/textarea_component.html.erb +40 -0
  33. data/app/components/better_ui/forms/textarea_component.rb +329 -0
  34. data/app/form_builders/better_ui/ui_form_builder.rb +467 -0
  35. data/app/helpers/better_ui/application_helper.rb +325 -58
  36. data/app/views/layouts/better_ui/application.html.erb +1 -1
  37. data/config/routes.rb +1 -0
  38. data/lib/better_ui/engine.rb +34 -5
  39. data/lib/better_ui/version.rb +1 -1
  40. data/lib/better_ui.rb +32 -5
  41. data/lib/generators/better_ui/install/USAGE +44 -0
  42. data/lib/generators/better_ui/install/install_generator.rb +87 -0
  43. data/lib/generators/better_ui/install/templates/better_ui_theme.css.tt +280 -0
  44. data/lib/tasks/better_ui_tasks.rake +39 -4
  45. metadata +55 -203
  46. data/app/components/better_ui/application/card/component.html.erb +0 -20
  47. data/app/components/better_ui/application/card/component.rb +0 -214
  48. data/app/components/better_ui/application/main/component.html.erb +0 -9
  49. data/app/components/better_ui/application/main/component.rb +0 -123
  50. data/app/components/better_ui/application/navbar/component.html.erb +0 -92
  51. data/app/components/better_ui/application/navbar/component.rb +0 -136
  52. data/app/components/better_ui/application/sidebar/component.html.erb +0 -249
  53. data/app/components/better_ui/application/sidebar/component.rb +0 -187
  54. data/app/components/better_ui/general/accordion/component.html.erb +0 -5
  55. data/app/components/better_ui/general/accordion/component.rb +0 -92
  56. data/app/components/better_ui/general/accordion/item_component.html.erb +0 -12
  57. data/app/components/better_ui/general/accordion/item_component.rb +0 -176
  58. data/app/components/better_ui/general/alert/component.html.erb +0 -32
  59. data/app/components/better_ui/general/alert/component.rb +0 -242
  60. data/app/components/better_ui/general/avatar/component.html.erb +0 -20
  61. data/app/components/better_ui/general/avatar/component.rb +0 -301
  62. data/app/components/better_ui/general/badge/component.html.erb +0 -23
  63. data/app/components/better_ui/general/badge/component.rb +0 -248
  64. data/app/components/better_ui/general/breadcrumb/component.html.erb +0 -15
  65. data/app/components/better_ui/general/breadcrumb/component.rb +0 -187
  66. data/app/components/better_ui/general/button/component.html.erb +0 -34
  67. data/app/components/better_ui/general/button/component.rb +0 -214
  68. data/app/components/better_ui/general/divider/component.html.erb +0 -10
  69. data/app/components/better_ui/general/divider/component.rb +0 -226
  70. data/app/components/better_ui/general/dropdown/component.html.erb +0 -28
  71. data/app/components/better_ui/general/dropdown/component.rb +0 -192
  72. data/app/components/better_ui/general/dropdown/divider_component.html.erb +0 -1
  73. data/app/components/better_ui/general/dropdown/divider_component.rb +0 -41
  74. data/app/components/better_ui/general/dropdown/item_component.html.erb +0 -6
  75. data/app/components/better_ui/general/dropdown/item_component.rb +0 -119
  76. data/app/components/better_ui/general/field/component.html.erb +0 -27
  77. data/app/components/better_ui/general/field/component.rb +0 -37
  78. data/app/components/better_ui/general/grid/cell_component.html.erb +0 -3
  79. data/app/components/better_ui/general/grid/cell_component.rb +0 -390
  80. data/app/components/better_ui/general/grid/component.html.erb +0 -3
  81. data/app/components/better_ui/general/grid/component.rb +0 -301
  82. data/app/components/better_ui/general/heading/component.html.erb +0 -22
  83. data/app/components/better_ui/general/heading/component.rb +0 -257
  84. data/app/components/better_ui/general/icon/component.html.erb +0 -7
  85. data/app/components/better_ui/general/icon/component.rb +0 -240
  86. data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
  87. data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
  88. data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
  89. data/app/components/better_ui/general/input/datetime/component.rb +0 -223
  90. data/app/components/better_ui/general/input/pin/component.html.erb +0 -1
  91. data/app/components/better_ui/general/input/pin/component.rb +0 -201
  92. data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
  93. data/app/components/better_ui/general/input/radio/component.rb +0 -230
  94. data/app/components/better_ui/general/input/rating/component.html.erb +0 -4
  95. data/app/components/better_ui/general/input/rating/component.rb +0 -272
  96. data/app/components/better_ui/general/input/select/component.html.erb +0 -78
  97. data/app/components/better_ui/general/input/select/component.rb +0 -249
  98. data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
  99. data/app/components/better_ui/general/input/select/select_component.rb +0 -37
  100. data/app/components/better_ui/general/input/text/component.html.erb +0 -5
  101. data/app/components/better_ui/general/input/text/component.rb +0 -171
  102. data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
  103. data/app/components/better_ui/general/input/textarea/component.rb +0 -166
  104. data/app/components/better_ui/general/input/toggle/component.html.erb +0 -5
  105. data/app/components/better_ui/general/input/toggle/component.rb +0 -242
  106. data/app/components/better_ui/general/link/component.html.erb +0 -18
  107. data/app/components/better_ui/general/link/component.rb +0 -258
  108. data/app/components/better_ui/general/modal/component.html.erb +0 -5
  109. data/app/components/better_ui/general/modal/component.rb +0 -47
  110. data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
  111. data/app/components/better_ui/general/modal/modal_component.rb +0 -160
  112. data/app/components/better_ui/general/pagination/component.html.erb +0 -85
  113. data/app/components/better_ui/general/pagination/component.rb +0 -216
  114. data/app/components/better_ui/general/panel/component.html.erb +0 -28
  115. data/app/components/better_ui/general/panel/component.rb +0 -249
  116. data/app/components/better_ui/general/progress/component.html.erb +0 -11
  117. data/app/components/better_ui/general/progress/component.rb +0 -160
  118. data/app/components/better_ui/general/spinner/component.html.erb +0 -35
  119. data/app/components/better_ui/general/spinner/component.rb +0 -93
  120. data/app/components/better_ui/general/table/component.html.erb +0 -5
  121. data/app/components/better_ui/general/table/component.rb +0 -217
  122. data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
  123. data/app/components/better_ui/general/table/tbody_component.rb +0 -30
  124. data/app/components/better_ui/general/table/td_component.html.erb +0 -3
  125. data/app/components/better_ui/general/table/td_component.rb +0 -44
  126. data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
  127. data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
  128. data/app/components/better_ui/general/table/th_component.html.erb +0 -6
  129. data/app/components/better_ui/general/table/th_component.rb +0 -51
  130. data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
  131. data/app/components/better_ui/general/table/thead_component.rb +0 -28
  132. data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
  133. data/app/components/better_ui/general/table/tr_component.rb +0 -30
  134. data/app/components/better_ui/general/tabs/component.html.erb +0 -11
  135. data/app/components/better_ui/general/tabs/component.rb +0 -120
  136. data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
  137. data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
  138. data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
  139. data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
  140. data/app/components/better_ui/general/tag/component.html.erb +0 -3
  141. data/app/components/better_ui/general/tag/component.rb +0 -104
  142. data/app/components/better_ui/general/text/component.html.erb +0 -1
  143. data/app/components/better_ui/general/text/component.rb +0 -194
  144. data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
  145. data/app/components/better_ui/general/tooltip/component.rb +0 -239
  146. data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
  147. data/app/helpers/better_ui/application/components/card.rb +0 -11
  148. data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
  149. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
  150. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
  151. data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
  152. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
  153. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
  154. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
  155. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
  156. data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
  157. data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
  158. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
  159. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
  160. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -88
  161. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -68
  162. data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
  163. data/app/helpers/better_ui/general/components/grid/grid_helper.rb +0 -145
  164. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
  165. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
  166. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
  167. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
  168. data/app/helpers/better_ui/general/components/input/pin/pin_helper.rb +0 -76
  169. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
  170. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
  171. data/app/helpers/better_ui/general/components/input/rating/rating_helper.rb +0 -70
  172. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -86
  173. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
  174. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
  175. data/app/helpers/better_ui/general/components/input/toggle/toggle_helper.rb +0 -77
  176. data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
  177. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
  178. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
  179. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
  180. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
  181. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
  182. data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
  183. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
  184. data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
  185. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
  186. data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
  187. data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
  188. data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
  189. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
  190. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
  191. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
  192. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
  193. data/app/helpers/better_ui/general/components/text/text_helper.rb +0 -83
  194. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
  195. data/app/jobs/better_ui/application_job.rb +0 -4
  196. data/app/mailers/better_ui/application_mailer.rb +0 -6
  197. data/config/initializers/lookbook.rb +0 -23
  198. data/lib/better_ui/railtie.rb +0 -20
@@ -1,19 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Table
5
- module ThHelper
6
- def bui_th(content = nil, **options, &block)
7
- if block_given?
8
- render BetterUi::General::Table::ThComponent.new(**options), &block
9
- else
10
- render BetterUi::General::Table::ThComponent.new(**options) do
11
- content
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,13 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Table
5
- module TheadHelper
6
- def bui_thead(**options, &block)
7
- render BetterUi::General::Table::TheadComponent.new(**options), &block
8
- end
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Table
5
- module TrHelper
6
- def bui_tr(**options, &block)
7
- render BetterUi::General::Table::TrComponent.new(**options), &block
8
- end
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BetterUi
4
- module General
5
- module Components
6
- module Tabs
7
- module PanelHelper
8
- # Crea un pannello di contenuto associato a una tab
9
- #
10
- # @param id [String] l'identificatore univoco del pannello (deve corrispondere al target della tab)
11
- # @param active [Boolean] se questo pannello è attualmente visibile
12
- # @param classes [String] classi CSS aggiuntive da applicare al pannello
13
- # @param options [Hash] attributi HTML aggiuntivi da applicare all'elemento
14
- # @param block [Proc] il contenuto del pannello
15
- # @return [String] l'HTML del pannello
16
- #
17
- # @example Uso base
18
- # <%= bui_tab_panel(id: "generale", active: true) do %>
19
- # <h3>Impostazioni Generali</h3>
20
- # <p>Contenuto del pannello generale...</p>
21
- # <% end %>
22
- #
23
- # @example Pannello nascosto
24
- # <%= bui_tab_panel(id: "sicurezza") do %>
25
- # <h3>Sicurezza</h3>
26
- # <p>Contenuto del pannello sicurezza...</p>
27
- # <% end %>
28
- #
29
- # @example Con classi personalizzate
30
- # <%= bui_tab_panel(id: "notifiche", classes: "p-6 bg-gray-50") do %>
31
- # <h3>Notifiche</h3>
32
- # <p>Contenuto del pannello notifiche...</p>
33
- # <% end %>
34
- #
35
- # @example Con attributi personalizzati
36
- # <%= bui_tab_panel(id: "dashboard", data: { testid: "dashboard-panel" }) do %>
37
- # <div class="grid grid-cols-2 gap-4">
38
- # <div>Statistiche</div>
39
- # <div>Grafici</div>
40
- # </div>
41
- # <% end %>
42
- #
43
- # @example Con form Rails
44
- # <%= bui_tab_panel(id: "profile") do %>
45
- # <%= form_with model: @user do |form| %>
46
- # <%= form.text_field :name, class: "form-input" %>
47
- # <%= form.submit "Salva", class: "btn btn-primary" %>
48
- # <% end %>
49
- # <% end %>
50
- def bui_tab_panel(id:, active: false, classes: '', **options, &block)
51
- render BetterUi::General::Tabs::PanelComponent.new(
52
- id: id,
53
- active: active,
54
- classes: classes,
55
- **options
56
- ), &block
57
- end
58
- end
59
- end
60
- end
61
- end
62
- end
@@ -1,55 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BetterUi
4
- module General
5
- module Components
6
- module Tabs
7
- module TabHelper
8
- # Crea una singola tab all'interno di un container tabs
9
- #
10
- # @param text [String] il testo da visualizzare nella tab
11
- # @param target [String] l'ID del pannello associato a questa tab
12
- # @param active [Boolean] se questa tab è attualmente attiva
13
- # @param icon [String] il nome dell'icona opzionale da visualizzare
14
- # @param disabled [Boolean] se questa tab è disabilitata
15
- # @param badge [String] il testo/numero del badge opzionale
16
- # @param theme [Symbol] il tema di colore della tab (:default, :blue, :red, :green, :yellow, :violet, :orange, :rose, :white)
17
- # @param size [Symbol] la dimensione della tab (:small, :medium, :large)
18
- # @param classes [String] classi CSS aggiuntive da applicare alla tab
19
- # @param options [Hash] attributi HTML aggiuntivi da applicare all'elemento
20
- # @return [String] l'HTML della tab
21
- #
22
- # @example Uso base
23
- # <%= bui_tab(text: "Generale", target: "generale", active: true) %>
24
- #
25
- # @example Con icona e badge
26
- # <%= bui_tab(text: "Messaggi", target: "messages", icon: "envelope", badge: "3") %>
27
- #
28
- # @example Tab disabilitata
29
- # <%= bui_tab(text: "Premium", target: "premium", disabled: true, icon: "star") %>
30
- #
31
- # @example Con temi personalizzati
32
- # <%= bui_tab(text: "Errori", target: "errors", theme: :red, badge: "12") %>
33
- #
34
- # @example Con attributi personalizzati
35
- # <%= bui_tab(text: "Settings", target: "settings", classes: "font-bold", data: { testid: "settings-tab" }) %>
36
- def bui_tab(text:, target:, active: false, icon: nil, disabled: false, badge: nil,
37
- theme: :default, size: :medium, classes: '', **options)
38
- render BetterUi::General::Tabs::TabComponent.new(
39
- text: text,
40
- target: target,
41
- active: active,
42
- icon: icon,
43
- disabled: disabled,
44
- badge: badge,
45
- theme: theme,
46
- size: size,
47
- classes: classes,
48
- **options
49
- )
50
- end
51
- end
52
- end
53
- end
54
- end
55
- end
@@ -1,95 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BetterUi
4
- module General
5
- module Components
6
- module Tabs
7
- module TabsHelper
8
- # Crea un sistema completo di tabs con navigazione e panel inclusi
9
- #
10
- # @param variant [Symbol] lo stile delle tabs (:pills, :underline, :bordered, :minimal)
11
- # @param theme [Symbol] il tema di colore delle tabs (:default, :blue, :red, :green, :yellow, :violet, :orange, :rose, :white)
12
- # @param size [Symbol] la dimensione delle tabs (:small, :medium, :large)
13
- # @param orientation [Symbol] l'orientamento delle tabs (:horizontal, :vertical)
14
- # @param navigation_classes [String] classi CSS aggiuntive per la navigazione
15
- # @param panels_classes [String] classi CSS aggiuntive per i panel (default: 'mt-4')
16
- # @param options [Hash] attributi HTML aggiuntivi da applicare all'elemento wrapper
17
- # @param block [Proc] il contenuto che definisce navigation e panels tramite slots
18
- # @return [String] l'HTML completo del sistema tabs
19
- #
20
- # @example Uso base con slots
21
- # <%= bui_tabs do |tabs| %>
22
- # <% tabs.with_navigation do %>
23
- # <%= bui_tab(text: "Tab 1", target: "tab1", active: true) %>
24
- # <%= bui_tab(text: "Tab 2", target: "tab2") %>
25
- # <% end %>
26
- # <% tabs.with_panels do %>
27
- # <%= bui_tab_panel(id: "tab1", active: true) do %>
28
- # Contenuto del primo pannello
29
- # <% end %>
30
- # <%= bui_tab_panel(id: "tab2") do %>
31
- # Contenuto del secondo pannello
32
- # <% end %>
33
- # <% end %>
34
- # <% end %>
35
- #
36
- # @example Con temi e dimensioni
37
- # <%= bui_tabs(variant: :underline, theme: :blue, size: :large) do |tabs| %>
38
- # <% tabs.with_navigation do %>
39
- # <%= bui_tab(text: "Dashboard", target: "dashboard", active: true, icon: "chart-bar") %>
40
- # <%= bui_tab(text: "Impostazioni", target: "settings", icon: "cog-6-tooth") %>
41
- # <% end %>
42
- # <% tabs.with_panels do %>
43
- # <%= bui_tab_panel(id: "dashboard", active: true) do %>
44
- # Dashboard content...
45
- # <% end %>
46
- # <%= bui_tab_panel(id: "settings") do %>
47
- # Settings content...
48
- # <% end %>
49
- # <% end %>
50
- # <% end %>
51
- #
52
- # @example Tabs verticali
53
- # <%= bui_tabs(orientation: :vertical, variant: :pills) do |tabs| %>
54
- # <% tabs.with_navigation do %>
55
- # <%= bui_tab(text: "Profilo", target: "profile", active: true) %>
56
- # <%= bui_tab(text: "Account", target: "account") %>
57
- # <% end %>
58
- # <% tabs.with_panels do %>
59
- # <%= bui_tab_panel(id: "profile", active: true) do %>
60
- # Informazioni profilo...
61
- # <% end %>
62
- # <%= bui_tab_panel(id: "account") do %>
63
- # Impostazioni account...
64
- # <% end %>
65
- # <% end %>
66
- # <% end %>
67
- #
68
- # @example Con classi personalizzate
69
- # <%= bui_tabs(navigation_classes: "border-b-2", panels_classes: "p-6 bg-gray-50") do |tabs| %>
70
- # <% tabs.with_navigation do %>
71
- # <%= bui_tab(text: "Home", target: "home", active: true) %>
72
- # <% end %>
73
- # <% tabs.with_panels do %>
74
- # <%= bui_tab_panel(id: "home", active: true) do %>
75
- # Home content with custom styling...
76
- # <% end %>
77
- # <% end %>
78
- # <% end %>
79
- def bui_tabs(variant: :pills, theme: :default, size: :medium, orientation: :horizontal,
80
- navigation_classes: '', panels_classes: 'mt-4', **options, &block)
81
- render BetterUi::General::Tabs::Component.new(
82
- variant: variant,
83
- theme: theme,
84
- size: size,
85
- orientation: orientation,
86
- navigation_classes: navigation_classes,
87
- panels_classes: panels_classes,
88
- **options
89
- ), &block
90
- end
91
- end
92
- end
93
- end
94
- end
95
- end
@@ -1,26 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Tag
5
- module TagHelper
6
- # Render un tag con le opzioni specificate
7
- #
8
- # @param text [String] testo del tag (obbligatorio)
9
- # @param options [Hash] opzioni per il componente
10
- #
11
- # @option options [Symbol] :theme (:white) tema del colore (:default, :white, :red, etc.)
12
- # @option options [Symbol] :size (:medium) dimensione (:small, :medium, :large)
13
- # @option options [Symbol] :style (:filled) stile (:filled, :outline)
14
- #
15
- # @return [String] HTML del componente
16
- def bui_tag(text, **options)
17
- render BetterUi::General::Tag::Component.new(
18
- text: text,
19
- **options
20
- )
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,83 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BetterUi
4
- module General
5
- module Components
6
- module Text
7
- module TextHelper
8
- # Genera un testo usando BetterUi::General::Text::Component
9
- #
10
- # @param text [String] testo da mostrare (nil se si usa blocco)
11
- # @param theme [Symbol] tema del colore (:default, :white, :red, :blue, etc.)
12
- # @param size [Symbol] dimensione (:xs, :small, :medium, :large, :xl, :"2xl")
13
- # @param align [Symbol] allineamento (:left, :center, :right, :justify)
14
- # @param weight [Symbol] peso font (:thin, :light, :normal, :medium, :semibold, :bold, :extrabold)
15
- # @param style [Symbol] stile (:normal, :italic, :underline, :line_through)
16
- # @param classes [String] classi CSS aggiuntive
17
- # @param html_options [Hash] opzioni HTML aggiuntive
18
- # @return [String] HTML del testo renderizzato
19
- #
20
- # @example Uso base
21
- # bui_text("Testo semplice")
22
- # bui_text("Testo importante", theme: :blue, weight: :bold)
23
- #
24
- # @example Con dimensioni e stili
25
- # bui_text("Titolo grande", size: :xl, weight: :bold)
26
- # bui_text("Testo sottile", theme: :muted, size: :small)
27
- #
28
- # @example Con allineamento
29
- # bui_text("Testo centrato", align: :center)
30
- # bui_text("Testo giustificato", align: :justify)
31
- #
32
- # @example Con stili tipografici
33
- # bui_text("Testo corsivo", style: :italic)
34
- # bui_text("Testo sottolineato", style: :underline)
35
- #
36
- # @example Con blocco Ruby
37
- # bui_text(theme: :green, weight: :semibold) do
38
- # "Contenuto complesso con <strong>HTML</strong>".html_safe
39
- # end
40
- #
41
- # @example Con attributi HTML personalizzati
42
- # bui_text("Testo con ID",
43
- # theme: :blue,
44
- # id: "my-text",
45
- # data: { action: "click->handler#process" })
46
- #
47
- # @example Per sostituire paragrafi standard
48
- # # Invece di: <p class="text-gray-600">Descrizione</p>
49
- # bui_text("Descrizione", theme: :gray)
50
- #
51
- # @example Combinazioni complesse
52
- # bui_text("Messaggio di errore",
53
- # theme: :red,
54
- # size: :small,
55
- # weight: :medium,
56
- # classes: "mb-2")
57
- def bui_text(
58
- text = nil,
59
- theme: :default,
60
- size: :medium,
61
- align: :left,
62
- weight: :normal,
63
- style: :normal,
64
- classes: '',
65
- **html_options,
66
- &block
67
- )
68
- render BetterUi::General::Text::Component.new(
69
- text: text,
70
- theme: theme,
71
- size: size,
72
- align: align,
73
- weight: weight,
74
- style: style,
75
- classes: classes,
76
- **html_options
77
- ), &block
78
- end
79
- end
80
- end
81
- end
82
- end
83
- end
@@ -1,60 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Tooltip
5
- module TooltipHelper
6
- # Genera un tooltip usando BetterUi::General::Tooltip::Component
7
- #
8
- # @param text [String] testo del tooltip
9
- # @param theme [Symbol] tema del colore (:default, :white, :red, etc.)
10
- # @param position [Symbol] posizione del tooltip (:top, :right, :bottom, :left)
11
- # @param size [Symbol] dimensione del tooltip (:small, :medium, :large)
12
- # @param style [Symbol] stile del tooltip (:filled, :outline)
13
- # @param html_options [Hash] opzioni HTML aggiuntive
14
- # @param block [Block] contenuto dell'elemento trigger
15
- # @return [String] HTML del tooltip renderizzato
16
- #
17
- # @example Uso base
18
- # bui_tooltip("Questo è un tooltip") do
19
- # bui_button(label: "Hover me")
20
- # end
21
- #
22
- # @example Tooltip con posizione specifica
23
- # bui_tooltip("Messaggio importante", position: :right, theme: :red) do
24
- # link_to "Info", "#", class: "text-blue-500"
25
- # end
26
- #
27
- # @example Tooltip con stili avanzati
28
- # bui_tooltip(
29
- # "Tooltip grande con outline",
30
- # theme: :blue,
31
- # position: :bottom,
32
- # size: :large,
33
- # style: :outline,
34
- # id: "custom-tooltip"
35
- # ) do
36
- # content_tag(:span, "Trigger personalizzato", class: "custom-trigger")
37
- # end
38
- def bui_tooltip(
39
- text,
40
- theme: :white,
41
- position: :top,
42
- size: :medium,
43
- style: :filled,
44
- **html_options,
45
- &block
46
- )
47
- render BetterUi::General::Tooltip::Component.new(
48
- text: text,
49
- theme: theme,
50
- position: position,
51
- size: size,
52
- style: style,
53
- **html_options
54
- ), &block
55
- end
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,4 +0,0 @@
1
- module BetterUi
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module BetterUi
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: "from@example.com"
4
- layout "mailer"
5
- end
6
- end
@@ -1,23 +0,0 @@
1
- if defined?(Lookbook)
2
- Lookbook.configure do |config|
3
- # Configura la directory delle preview dei componenti
4
- config.preview_paths << BetterUi::Engine.root.join("test/components/previews")
5
-
6
- # Configura il titolo della pagina Lookbook
7
- config.page_title = "BetterUI - Catalogo Componenti"
8
-
9
- # Configura i tag principali
10
- config.preview_display_names = {
11
- "BetterUi::General" => "Componenti Generali",
12
- "BetterUi::Application" => "Componenti Applicazione",
13
- "BetterUi::Website" => "Componenti Sito Web"
14
- }
15
-
16
- # Per supportare i componenti ViewComponent
17
- config.listen_for_changes = {
18
- component: "app/components/**/*.rb",
19
- preview: "test/components/previews/**/*_preview.rb",
20
- template: "app/components/**/*.erb"
21
- }
22
- end
23
- end
@@ -1,20 +0,0 @@
1
- module BetterUi
2
- class Railtie < ::Rails::Railtie
3
- config.after_initialize do
4
- # Configure Lookbook to include BetterUI previews if Lookbook is available
5
- if defined?(Lookbook)
6
- # Get the gem's root path
7
- gem_root = Gem.loaded_specs["better_ui"]&.gem_dir
8
-
9
- if gem_root
10
- # Add the gem's preview path to Lookbook
11
- preview_path = File.join(gem_root, "spec", "components", "previews")
12
-
13
- if File.directory?(preview_path)
14
- Lookbook.config.preview_paths << preview_path
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end