better_ui 0.3.0 → 0.7.0

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 (183) 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 -51
  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 -4
  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 +52 -185
  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 -227
  53. data/app/components/better_ui/application/sidebar/component.rb +0 -130
  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 -25
  71. data/app/components/better_ui/general/dropdown/component.rb +0 -170
  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/heading/component.html.erb +0 -22
  79. data/app/components/better_ui/general/heading/component.rb +0 -257
  80. data/app/components/better_ui/general/icon/component.html.erb +0 -7
  81. data/app/components/better_ui/general/icon/component.rb +0 -239
  82. data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
  83. data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
  84. data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
  85. data/app/components/better_ui/general/input/datetime/component.rb +0 -223
  86. data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
  87. data/app/components/better_ui/general/input/radio/component.rb +0 -230
  88. data/app/components/better_ui/general/input/select/component.html.erb +0 -16
  89. data/app/components/better_ui/general/input/select/component.rb +0 -184
  90. data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
  91. data/app/components/better_ui/general/input/select/select_component.rb +0 -37
  92. data/app/components/better_ui/general/input/text/component.html.erb +0 -5
  93. data/app/components/better_ui/general/input/text/component.rb +0 -171
  94. data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
  95. data/app/components/better_ui/general/input/textarea/component.rb +0 -166
  96. data/app/components/better_ui/general/link/component.html.erb +0 -18
  97. data/app/components/better_ui/general/link/component.rb +0 -258
  98. data/app/components/better_ui/general/modal/component.html.erb +0 -5
  99. data/app/components/better_ui/general/modal/component.rb +0 -47
  100. data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
  101. data/app/components/better_ui/general/modal/modal_component.rb +0 -160
  102. data/app/components/better_ui/general/pagination/component.html.erb +0 -85
  103. data/app/components/better_ui/general/pagination/component.rb +0 -216
  104. data/app/components/better_ui/general/panel/component.html.erb +0 -28
  105. data/app/components/better_ui/general/panel/component.rb +0 -249
  106. data/app/components/better_ui/general/progress/component.html.erb +0 -11
  107. data/app/components/better_ui/general/progress/component.rb +0 -160
  108. data/app/components/better_ui/general/spinner/component.html.erb +0 -35
  109. data/app/components/better_ui/general/spinner/component.rb +0 -93
  110. data/app/components/better_ui/general/table/component.html.erb +0 -5
  111. data/app/components/better_ui/general/table/component.rb +0 -217
  112. data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
  113. data/app/components/better_ui/general/table/tbody_component.rb +0 -30
  114. data/app/components/better_ui/general/table/td_component.html.erb +0 -3
  115. data/app/components/better_ui/general/table/td_component.rb +0 -44
  116. data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
  117. data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
  118. data/app/components/better_ui/general/table/th_component.html.erb +0 -6
  119. data/app/components/better_ui/general/table/th_component.rb +0 -51
  120. data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
  121. data/app/components/better_ui/general/table/thead_component.rb +0 -28
  122. data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
  123. data/app/components/better_ui/general/table/tr_component.rb +0 -30
  124. data/app/components/better_ui/general/tabs/component.html.erb +0 -11
  125. data/app/components/better_ui/general/tabs/component.rb +0 -120
  126. data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
  127. data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
  128. data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
  129. data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
  130. data/app/components/better_ui/general/tag/component.html.erb +0 -3
  131. data/app/components/better_ui/general/tag/component.rb +0 -104
  132. data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
  133. data/app/components/better_ui/general/tooltip/component.rb +0 -239
  134. data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
  135. data/app/helpers/better_ui/application/components/card.rb +0 -11
  136. data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
  137. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
  138. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
  139. data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
  140. data/app/helpers/better_ui/general/components/accordion.rb +0 -11
  141. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
  142. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
  143. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
  144. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
  145. data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
  146. data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
  147. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
  148. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
  149. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -79
  150. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -62
  151. data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
  152. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
  153. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
  154. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
  155. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
  156. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
  157. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
  158. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -70
  159. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
  160. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
  161. data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
  162. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
  163. data/app/helpers/better_ui/general/components/modal.rb +0 -11
  164. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
  165. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
  166. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
  167. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
  168. data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
  169. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
  170. data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
  171. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
  172. data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
  173. data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
  174. data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
  175. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
  176. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
  177. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
  178. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
  179. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
  180. data/app/jobs/better_ui/application_job.rb +0 -4
  181. data/app/mailers/better_ui/application_mailer.rb +0 -6
  182. data/config/initializers/lookbook.rb +0 -23
  183. data/lib/better_ui/railtie.rb +0 -20
@@ -1,53 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Progress
5
- module ProgressHelper
6
- # Helper per renderizzare una progress bar
7
- #
8
- # @param value [Integer] percentuale di completamento (0-100)
9
- # @param theme [Symbol] tema del colore (:default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet)
10
- # @param size [Symbol] dimensione della progress bar (:small, :medium, :large)
11
- # @param label [Boolean] mostra etichetta con percentuale
12
- # @param classes [String] classi CSS aggiuntive
13
- # @param html_options [Hash] opzioni HTML aggiuntive
14
- #
15
- # @return [String] HTML della progress bar
16
- #
17
- # @example Uso base
18
- # bui_progress(value: 75)
19
- #
20
- # @example Progress con etichetta
21
- # bui_progress(value: 50, label: true, theme: :green)
22
- #
23
- # @example Progress personalizzata
24
- # bui_progress(
25
- # value: 90,
26
- # theme: :blue,
27
- # size: :large,
28
- # label: true,
29
- # classes: "my-custom-class",
30
- # id: "main-progress"
31
- # )
32
- def bui_progress(
33
- value: 0,
34
- theme: :white,
35
- size: :medium,
36
- label: false,
37
- classes: nil,
38
- **html_options
39
- )
40
- render BetterUi::General::Progress::Component.new(
41
- value: value,
42
- theme: theme,
43
- size: size,
44
- label: label,
45
- classes: classes,
46
- **html_options
47
- )
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,19 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Spinner
5
- module SpinnerHelper
6
- def bui_spinner(label = nil, **options)
7
- render BetterUi::General::Spinner::Component.new(
8
- label: label,
9
- **options
10
- )
11
- end
12
-
13
- # Supporto per la sintassi originale per compatibilità
14
- alias_method :better_ui_general_spinner, :bui_spinner
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,53 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Table
5
- module TableHelper
6
-
7
- # Renderizza un componente Table per visualizzare dati strutturati in formato tabellare.
8
- #
9
- # @param headers [Array<String>] Intestazioni delle colonne della tabella
10
- # @param rows [Array<Array>] Dati delle righe della tabella
11
- # @param striped [Boolean] Applica righe alternate con colori diversi
12
- # @param bordered [Boolean] Aggiunge bordi alla tabella
13
- # @param hover [Boolean] Aggiunge effetto hover sulle righe
14
- # @param responsive [Boolean] Rende la tabella responsiva (scrollabile orizzontalmente)
15
- # @param compact [Boolean] Riduce la spaziatura interna
16
- # @param theme [Symbol] Tema della tabella (:default, :white, :gray)
17
- # @param size [Symbol] Dimensione della tabella (:small, :medium, :large)
18
- # @param rounded [Symbol] Arrotondamento degli angoli (:none, :small, :medium, :large)
19
- # @param classes [String] Classi CSS aggiuntive
20
- # @param options [Hash] Attributi HTML aggiuntivi
21
- #
22
- # @return [String] HTML della tabella renderizzata
23
- #
24
- # @example Tabella base con intestazioni e righe
25
- # <%= bui_table(headers: ['Nome', 'Email'], rows: [['Mario Rossi', 'mario@example.com']]) %>
26
- #
27
- # @example Tabella con righe alternate e bordi
28
- # <%= bui_table(headers: ['ID', 'Prodotto', 'Prezzo'],
29
- # rows: [[1, 'Scarpe', '€80'], [2, 'Camicia', '€40']],
30
- # striped: true, bordered: true) %>
31
- #
32
- # @example Tabella con stile personalizzato
33
- # <%= bui_table(headers: ['Data', 'Evento'],
34
- # rows: [['10/01/2023', 'Riunione'], ['15/01/2023', 'Scadenza']],
35
- # theme: :blue, size: :large, hover: true) %>
36
- #
37
- # @example Tabella responsiva per dispositivi mobili
38
- # <%= bui_table(headers: ['Prodotto', 'Descrizione', 'Prezzo', 'Disponibilità'],
39
- # rows: [...],
40
- # responsive: true) %>
41
- #
42
- # @example Tabella con attributi HTML personalizzati
43
- # <%= bui_table(headers: ['Nome', 'Email'],
44
- # rows: [['Mario Rossi', 'mario@example.com']],
45
- # id: 'users-table', 'data-sortable': true) %>
46
- def bui_table(**options, &block)
47
- render BetterUi::General::Table::Component.new(**options), &block
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,13 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Table
5
- module TbodyHelper
6
- def bui_tbody(**options, &block)
7
- render BetterUi::General::Table::TbodyComponent.new(**options), &block
8
- end
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,19 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Table
5
- module TdHelper
6
- def bui_td(content = nil, **options, &block)
7
- if block_given?
8
- render BetterUi::General::Table::TdComponent.new(**options), &block
9
- else
10
- render BetterUi::General::Table::TdComponent.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 TfootHelper
6
- def bui_tfoot(**options, &block)
7
- render BetterUi::General::Table::TfootComponent.new(**options), &block
8
- end
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -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,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