better_ui 0.1.0 → 0.2.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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +225 -119
  4. data/app/assets/stylesheets/better_ui/application.css +0 -356
  5. data/app/components/better_ui/application/card/component.html.erb +20 -0
  6. data/app/components/better_ui/application/card/component.rb +214 -0
  7. data/app/components/better_ui/application/main/component.html.erb +9 -0
  8. data/app/components/better_ui/application/main/component.rb +123 -0
  9. data/app/components/better_ui/application/navbar/component.html.erb +92 -0
  10. data/app/components/better_ui/application/navbar/component.rb +136 -0
  11. data/app/components/better_ui/application/sidebar/component.html.erb +190 -0
  12. data/app/components/better_ui/application/sidebar/component.rb +129 -0
  13. data/app/components/better_ui/general/alert/component.html.erb +32 -0
  14. data/app/components/better_ui/general/alert/component.rb +242 -0
  15. data/app/components/better_ui/general/avatar/component.html.erb +20 -0
  16. data/app/components/better_ui/general/avatar/component.rb +301 -0
  17. data/app/components/better_ui/general/badge/component.html.erb +23 -0
  18. data/app/components/better_ui/general/badge/component.rb +248 -0
  19. data/app/components/better_ui/general/breadcrumb/component.html.erb +15 -0
  20. data/app/components/better_ui/general/breadcrumb/component.rb +187 -0
  21. data/app/components/better_ui/general/button/component.html.erb +34 -0
  22. data/app/components/better_ui/general/button/component.rb +214 -0
  23. data/app/components/better_ui/general/divider/component.html.erb +10 -0
  24. data/app/components/better_ui/general/divider/component.rb +226 -0
  25. data/app/components/better_ui/general/dropdown/component.html.erb +14 -0
  26. data/app/components/better_ui/general/dropdown/component.rb +219 -0
  27. data/app/components/better_ui/general/dropdown/divider_component.html.erb +1 -0
  28. data/app/components/better_ui/general/dropdown/divider_component.rb +41 -0
  29. data/app/components/better_ui/general/dropdown/item_component.html.erb +6 -0
  30. data/app/components/better_ui/general/dropdown/item_component.rb +118 -0
  31. data/app/components/better_ui/general/field/component.html.erb +27 -0
  32. data/app/components/better_ui/general/field/component.rb +37 -0
  33. data/app/components/better_ui/general/heading/component.html.erb +22 -0
  34. data/app/components/better_ui/general/heading/component.rb +257 -0
  35. data/app/components/better_ui/general/icon/component.html.erb +7 -0
  36. data/app/components/better_ui/general/icon/component.rb +239 -0
  37. data/app/components/better_ui/general/input/checkbox/component.html.erb +5 -0
  38. data/app/components/better_ui/general/input/checkbox/component.rb +238 -0
  39. data/app/components/better_ui/general/input/datetime/component.html.erb +5 -0
  40. data/app/components/better_ui/general/input/datetime/component.rb +223 -0
  41. data/app/components/better_ui/general/input/radio/component.html.erb +5 -0
  42. data/app/components/better_ui/general/input/radio/component.rb +230 -0
  43. data/app/components/better_ui/general/input/select/component.html.erb +16 -0
  44. data/app/components/better_ui/general/input/select/component.rb +184 -0
  45. data/app/components/better_ui/general/input/select/select_component.html.erb +5 -0
  46. data/app/components/better_ui/general/input/select/select_component.rb +37 -0
  47. data/app/components/better_ui/general/input/text/component.html.erb +5 -0
  48. data/app/components/better_ui/general/input/text/component.rb +171 -0
  49. data/app/components/better_ui/general/input/textarea/component.html.erb +5 -0
  50. data/app/components/better_ui/general/input/textarea/component.rb +166 -0
  51. data/app/components/better_ui/general/link/component.html.erb +18 -0
  52. data/app/components/better_ui/general/link/component.rb +258 -0
  53. data/app/components/better_ui/general/modal/component.html.erb +42 -0
  54. data/app/components/better_ui/general/modal/component.rb +165 -0
  55. data/app/components/better_ui/general/pagination/component.html.erb +85 -0
  56. data/app/components/better_ui/general/pagination/component.rb +216 -0
  57. data/app/components/better_ui/general/panel/component.html.erb +28 -0
  58. data/app/components/better_ui/general/panel/component.rb +249 -0
  59. data/app/components/better_ui/general/progress/component.html.erb +11 -0
  60. data/app/components/better_ui/general/progress/component.rb +160 -0
  61. data/app/components/better_ui/general/spinner/component.html.erb +35 -0
  62. data/app/components/better_ui/general/spinner/component.rb +93 -0
  63. data/app/components/better_ui/general/table/component.html.erb +5 -0
  64. data/app/components/better_ui/general/table/component.rb +217 -0
  65. data/app/components/better_ui/general/table/tbody_component.html.erb +3 -0
  66. data/app/components/better_ui/general/table/tbody_component.rb +30 -0
  67. data/app/components/better_ui/general/table/td_component.html.erb +3 -0
  68. data/app/components/better_ui/general/table/td_component.rb +44 -0
  69. data/app/components/better_ui/general/table/tfoot_component.html.erb +3 -0
  70. data/app/components/better_ui/general/table/tfoot_component.rb +28 -0
  71. data/app/components/better_ui/general/table/th_component.html.erb +6 -0
  72. data/app/components/better_ui/general/table/th_component.rb +51 -0
  73. data/app/components/better_ui/general/table/thead_component.html.erb +3 -0
  74. data/app/components/better_ui/general/table/thead_component.rb +28 -0
  75. data/app/components/better_ui/general/table/tr_component.html.erb +3 -0
  76. data/app/components/better_ui/general/table/tr_component.rb +30 -0
  77. data/app/components/better_ui/general/tabs/component.html.erb +3 -0
  78. data/app/components/better_ui/general/tabs/component.rb +102 -0
  79. data/app/components/better_ui/general/tabs/panel_component.html.erb +3 -0
  80. data/app/components/better_ui/general/tabs/panel_component.rb +37 -0
  81. data/app/components/better_ui/general/tabs/tab_component.html.erb +13 -0
  82. data/app/components/better_ui/general/tabs/tab_component.rb +111 -0
  83. data/app/components/better_ui/general/tag/component.html.erb +3 -0
  84. data/app/components/better_ui/general/tag/component.rb +104 -0
  85. data/app/components/better_ui/general/tooltip/component.html.erb +7 -0
  86. data/app/components/better_ui/general/tooltip/component.rb +239 -0
  87. data/app/helpers/better_ui/application/components/card/card_helper.rb +96 -0
  88. data/app/helpers/better_ui/application/components/card.rb +11 -0
  89. data/app/helpers/better_ui/application/components/main/main_helper.rb +64 -0
  90. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +77 -0
  91. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +51 -0
  92. data/app/helpers/better_ui/application_helper.rb +51 -179
  93. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +57 -0
  94. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +29 -0
  95. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +53 -0
  96. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +37 -0
  97. data/app/helpers/better_ui/general/components/button/button_helper.rb +65 -0
  98. data/app/helpers/better_ui/general/components/container/container_helper.rb +60 -0
  99. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +63 -0
  100. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +32 -0
  101. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +79 -0
  102. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +62 -0
  103. data/app/helpers/better_ui/general/components/field/field_helper.rb +26 -0
  104. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +72 -0
  105. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +16 -0
  106. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +81 -0
  107. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +91 -0
  108. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +79 -0
  109. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +124 -0
  110. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +70 -0
  111. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +138 -0
  112. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +73 -0
  113. data/app/helpers/better_ui/general/components/link/link_helper.rb +89 -0
  114. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +95 -0
  115. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +82 -0
  116. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +83 -0
  117. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +53 -0
  118. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +19 -0
  119. data/app/helpers/better_ui/general/components/table/table_helper.rb +53 -0
  120. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +13 -0
  121. data/app/helpers/better_ui/general/components/table/td_helper.rb +19 -0
  122. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +13 -0
  123. data/app/helpers/better_ui/general/components/table/th_helper.rb +19 -0
  124. data/app/helpers/better_ui/general/components/table/thead_helper.rb +13 -0
  125. data/app/helpers/better_ui/general/components/table/tr_helper.rb +13 -0
  126. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +62 -0
  127. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +55 -0
  128. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +62 -0
  129. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +26 -0
  130. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +60 -0
  131. data/app/views/layouts/better_ui/application.html.erb +6 -124
  132. data/config/initializers/lookbook.rb +23 -0
  133. data/config/routes.rb +0 -8
  134. data/lib/better_ui/engine.rb +5 -19
  135. data/lib/better_ui/railtie.rb +20 -0
  136. data/lib/better_ui/version.rb +1 -1
  137. data/lib/better_ui.rb +4 -20
  138. metadata +155 -28
  139. data/app/controllers/better_ui/docs_controller.rb +0 -41
  140. data/app/views/better_ui/docs/component.html.erb +0 -365
  141. data/app/views/better_ui/docs/index.html.erb +0 -100
  142. data/app/views/better_ui/docs/show.html.erb +0 -60
@@ -0,0 +1,83 @@
1
+ module BetterUi
2
+ module General
3
+ module Components
4
+ module Panel
5
+ module PanelHelper
6
+ # Genera un pannello usando BetterUi::General::Panel::Component
7
+ #
8
+ # @param title [String] titolo del pannello (opzionale)
9
+ # @param body [String] contenuto HTML del pannello (opzionale)
10
+ # @param header [String] header personalizzato (opzionale)
11
+ # @param footer [String] footer del pannello (opzionale)
12
+ # @param theme [Symbol] tema del colore (:default, :white, etc.)
13
+ # @param style [Symbol] stile (:default, :flat, :raised, :bordered)
14
+ # @param padding [Symbol] padding interno (:none, :small, :medium, :large)
15
+ # @param radius [Symbol] raggio dei bordi (:none, :small, :medium, :large, :full)
16
+ # @param html_options [Hash] opzioni HTML aggiuntive
17
+ # @return [String] HTML del pannello renderizzato
18
+ #
19
+ # @example Uso base
20
+ # bui_panel(title: "Dashboard")
21
+ # bui_panel(body: "Contenuto del pannello")
22
+ #
23
+ # @example Pannello completo
24
+ # bui_panel(
25
+ # title: "Impostazioni",
26
+ # body: "Configura le tue preferenze",
27
+ # footer: "Ultimo aggiornamento: oggi",
28
+ # theme: :blue
29
+ # )
30
+ #
31
+ # @example Con header personalizzato
32
+ # bui_panel(
33
+ # header: "<h2>Header Custom</h2>",
34
+ # body: "Il mio contenuto",
35
+ # theme: :green,
36
+ # style: :raised
37
+ # )
38
+ #
39
+ # @example Pannello con stili avanzati
40
+ # bui_panel(
41
+ # title: "Card Premium",
42
+ # body: "Contenuto speciale",
43
+ # theme: :violet,
44
+ # style: :bordered,
45
+ # padding: :large,
46
+ # radius: :large,
47
+ # id: "premium-panel",
48
+ # class: "special-panel"
49
+ # )
50
+ #
51
+ # @example Con contenuto block
52
+ # bui_panel(title: "Lista Utenti", theme: :white) do
53
+ # "<ul><li>Utente 1</li><li>Utente 2</li></ul>".html_safe
54
+ # end
55
+ def bui_panel(
56
+ title: nil,
57
+ body: nil,
58
+ header: nil,
59
+ footer: nil,
60
+ theme: :white,
61
+ style: :default,
62
+ padding: :medium,
63
+ radius: :small,
64
+ **html_options,
65
+ &block
66
+ )
67
+ render BetterUi::General::Panel::Component.new(
68
+ title: title,
69
+ body: body,
70
+ header: header,
71
+ footer: footer,
72
+ theme: theme,
73
+ style: style,
74
+ padding: padding,
75
+ radius: radius,
76
+ **html_options
77
+ ), &block
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,53 @@
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
@@ -0,0 +1,19 @@
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
@@ -0,0 +1,53 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,19 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,19 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,13 @@
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
@@ -0,0 +1,62 @@
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
@@ -0,0 +1,55 @@
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
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BetterUi
4
+ module General
5
+ module Components
6
+ module Tabs
7
+ module TabsHelper
8
+ # Crea un container di navigazione tabs per organizzare contenuti correlati
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 classes [String] classi CSS aggiuntive da applicare al container
15
+ # @param options [Hash] attributi HTML aggiuntivi da applicare all'elemento
16
+ # @param block [Proc] il contenuto delle tabs (le singole tab)
17
+ # @return [String] l'HTML del container tabs
18
+ #
19
+ # @example Uso base
20
+ # <%= bui_tabs do %>
21
+ # <%= bui_tab(text: "Generale", target: "generale", active: true) %>
22
+ # <%= bui_tab(text: "Sicurezza", target: "sicurezza") %>
23
+ # <% end %>
24
+ #
25
+ # @example Con temi e dimensioni
26
+ # <%= bui_tabs(variant: :underline, theme: :blue, size: :large) do %>
27
+ # <%= bui_tab(text: "Dashboard", target: "dashboard", active: true, icon: "chart-bar") %>
28
+ # <%= bui_tab(text: "Impostazioni", target: "settings", icon: "cog-6-tooth") %>
29
+ # <% end %>
30
+ #
31
+ # @example Tabs verticali
32
+ # <%= bui_tabs(orientation: :vertical, variant: :pills) do %>
33
+ # <%= bui_tab(text: "Profilo", target: "profile") %>
34
+ # <%= bui_tab(text: "Account", target: "account") %>
35
+ # <% end %>
36
+ #
37
+ # @example Con attributi personalizzati
38
+ # <%= bui_tabs(classes: "my-4", data: { testid: "main-tabs" }) do %>
39
+ # <%= bui_tab(text: "Home", target: "home", active: true) %>
40
+ # <% end %>
41
+ #
42
+ # @example Con Rails form builder
43
+ # <%= bui_tabs(form: form, variant: :bordered) do %>
44
+ # <%= bui_tab(text: "Dati personali", target: "personal") %>
45
+ # <%= bui_tab(text: "Contatti", target: "contacts") %>
46
+ # <% end %>
47
+ def bui_tabs(variant: :pills, theme: :default, size: :medium, orientation: :horizontal,
48
+ classes: '', form: nil, **options, &block)
49
+ render BetterUi::General::Tabs::Component.new(
50
+ variant: variant,
51
+ theme: theme,
52
+ size: size,
53
+ orientation: orientation,
54
+ classes: classes,
55
+ **options
56
+ ), &block
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,26 @@
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
@@ -0,0 +1,60 @@
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