better_ui 0.3.0 → 0.5.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.

Potentially problematic release.


This version of better_ui might be problematic. Click here for more details.

Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +227 -209
  4. data/app/assets/javascripts/better_ui/controllers/navbar_controller.js +138 -0
  5. data/app/assets/javascripts/better_ui/controllers/sidebar_controller.js +211 -0
  6. data/app/assets/javascripts/better_ui/controllers/toast_controller.js +161 -0
  7. data/app/assets/javascripts/better_ui/index.js +159 -0
  8. data/app/assets/javascripts/better_ui/toast_manager.js +77 -0
  9. data/app/assets/stylesheets/better_ui/application.css +30 -0
  10. data/app/components/better_ui/application/alert_component.html.erb +27 -0
  11. data/app/components/better_ui/application/alert_component.rb +202 -0
  12. data/app/components/better_ui/application/card_component.html.erb +24 -0
  13. data/app/components/better_ui/application/card_component.rb +53 -0
  14. data/app/components/better_ui/application/card_container_component.html.erb +8 -0
  15. data/app/components/better_ui/application/card_container_component.rb +14 -0
  16. data/app/components/better_ui/application/header_component.html.erb +88 -0
  17. data/app/components/better_ui/application/header_component.rb +188 -0
  18. data/app/components/better_ui/application/navbar_component.html.erb +294 -0
  19. data/app/components/better_ui/application/navbar_component.rb +249 -0
  20. data/app/components/better_ui/application/sidebar_component.html.erb +207 -0
  21. data/app/components/better_ui/application/sidebar_component.rb +318 -0
  22. data/app/components/better_ui/application/toast_component.html.erb +35 -0
  23. data/app/components/better_ui/application/toast_component.rb +223 -0
  24. data/app/components/better_ui/general/avatar_component.html.erb +19 -0
  25. data/app/components/better_ui/general/avatar_component.rb +171 -0
  26. data/app/components/better_ui/general/badge_component.html.erb +19 -0
  27. data/app/components/better_ui/general/badge_component.rb +123 -0
  28. data/app/components/better_ui/general/{breadcrumb/component.html.erb → breadcrumb_component.html.erb} +4 -4
  29. data/app/components/better_ui/general/breadcrumb_component.rb +130 -0
  30. data/app/components/better_ui/general/{button/component.html.erb → button_component.html.erb} +7 -7
  31. data/app/components/better_ui/general/button_component.rb +162 -0
  32. data/app/components/better_ui/general/heading_component.html.erb +25 -0
  33. data/app/components/better_ui/general/heading_component.rb +148 -0
  34. data/app/components/better_ui/general/icon_component.html.erb +2 -0
  35. data/app/components/better_ui/general/icon_component.rb +100 -0
  36. data/app/components/better_ui/general/link_component.html.erb +17 -0
  37. data/app/components/better_ui/general/link_component.rb +132 -0
  38. data/app/components/better_ui/general/panel_component.html.erb +27 -0
  39. data/app/components/better_ui/general/panel_component.rb +103 -0
  40. data/app/components/better_ui/general/spinner_component.html.erb +15 -0
  41. data/app/components/better_ui/general/spinner_component.rb +79 -0
  42. data/app/components/better_ui/general/table_component.html.erb +73 -0
  43. data/app/components/better_ui/general/table_component.rb +167 -0
  44. data/app/components/better_ui/theme_helper.rb +171 -0
  45. data/app/controllers/better_ui/application_controller.rb +1 -0
  46. data/app/controllers/better_ui/docs_controller.rb +34 -0
  47. data/app/views/components/better_ui/general/table/_custom_body_row.html.erb +17 -0
  48. data/app/views/components/better_ui/general/table/_custom_footer_rows.html.erb +17 -0
  49. data/app/views/components/better_ui/general/table/_custom_header_rows.html.erb +12 -0
  50. data/app/views/layouts/component_preview.html.erb +32 -0
  51. data/config/initializers/lookbook.rb +12 -12
  52. data/config/routes.rb +13 -0
  53. data/lib/better_ui/engine.rb +36 -5
  54. data/lib/better_ui/version.rb +1 -1
  55. data/lib/better_ui.rb +24 -4
  56. data/lib/generators/better_ui/stylesheet_generator.rb +96 -0
  57. data/lib/generators/better_ui/templates/README +56 -0
  58. data/lib/generators/better_ui/templates/components/_avatar.scss +151 -0
  59. data/lib/generators/better_ui/templates/components/_badge.scss +142 -0
  60. data/lib/generators/better_ui/templates/components/_breadcrumb.scss +107 -0
  61. data/lib/generators/better_ui/templates/components/_button.scss +106 -0
  62. data/lib/generators/better_ui/templates/components/_card.scss +69 -0
  63. data/lib/generators/better_ui/templates/components/_heading.scss +180 -0
  64. data/lib/generators/better_ui/templates/components/_icon.scss +90 -0
  65. data/lib/generators/better_ui/templates/components/_link.scss +130 -0
  66. data/lib/generators/better_ui/templates/components/_panel.scss +144 -0
  67. data/lib/generators/better_ui/templates/components/_spinner.scss +132 -0
  68. data/lib/generators/better_ui/templates/components/_table.scss +105 -0
  69. data/lib/generators/better_ui/templates/components/_variables.scss +33 -0
  70. data/lib/generators/better_ui/templates/components_stylesheet.scss +66 -0
  71. metadata +145 -156
  72. data/app/components/better_ui/application/card/component.html.erb +0 -20
  73. data/app/components/better_ui/application/card/component.rb +0 -214
  74. data/app/components/better_ui/application/main/component.html.erb +0 -9
  75. data/app/components/better_ui/application/main/component.rb +0 -123
  76. data/app/components/better_ui/application/navbar/component.html.erb +0 -92
  77. data/app/components/better_ui/application/navbar/component.rb +0 -136
  78. data/app/components/better_ui/application/sidebar/component.html.erb +0 -227
  79. data/app/components/better_ui/application/sidebar/component.rb +0 -130
  80. data/app/components/better_ui/general/accordion/component.html.erb +0 -5
  81. data/app/components/better_ui/general/accordion/component.rb +0 -92
  82. data/app/components/better_ui/general/accordion/item_component.html.erb +0 -12
  83. data/app/components/better_ui/general/accordion/item_component.rb +0 -176
  84. data/app/components/better_ui/general/alert/component.html.erb +0 -32
  85. data/app/components/better_ui/general/alert/component.rb +0 -242
  86. data/app/components/better_ui/general/avatar/component.html.erb +0 -20
  87. data/app/components/better_ui/general/avatar/component.rb +0 -301
  88. data/app/components/better_ui/general/badge/component.html.erb +0 -23
  89. data/app/components/better_ui/general/badge/component.rb +0 -248
  90. data/app/components/better_ui/general/breadcrumb/component.rb +0 -187
  91. data/app/components/better_ui/general/button/component.rb +0 -214
  92. data/app/components/better_ui/general/divider/component.html.erb +0 -10
  93. data/app/components/better_ui/general/divider/component.rb +0 -226
  94. data/app/components/better_ui/general/dropdown/component.html.erb +0 -25
  95. data/app/components/better_ui/general/dropdown/component.rb +0 -170
  96. data/app/components/better_ui/general/dropdown/divider_component.html.erb +0 -1
  97. data/app/components/better_ui/general/dropdown/divider_component.rb +0 -41
  98. data/app/components/better_ui/general/dropdown/item_component.html.erb +0 -6
  99. data/app/components/better_ui/general/dropdown/item_component.rb +0 -119
  100. data/app/components/better_ui/general/field/component.html.erb +0 -27
  101. data/app/components/better_ui/general/field/component.rb +0 -37
  102. data/app/components/better_ui/general/heading/component.html.erb +0 -22
  103. data/app/components/better_ui/general/heading/component.rb +0 -257
  104. data/app/components/better_ui/general/icon/component.html.erb +0 -7
  105. data/app/components/better_ui/general/icon/component.rb +0 -239
  106. data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
  107. data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
  108. data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
  109. data/app/components/better_ui/general/input/datetime/component.rb +0 -223
  110. data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
  111. data/app/components/better_ui/general/input/radio/component.rb +0 -230
  112. data/app/components/better_ui/general/input/select/component.html.erb +0 -16
  113. data/app/components/better_ui/general/input/select/component.rb +0 -184
  114. data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
  115. data/app/components/better_ui/general/input/select/select_component.rb +0 -37
  116. data/app/components/better_ui/general/input/text/component.html.erb +0 -5
  117. data/app/components/better_ui/general/input/text/component.rb +0 -171
  118. data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
  119. data/app/components/better_ui/general/input/textarea/component.rb +0 -166
  120. data/app/components/better_ui/general/link/component.html.erb +0 -18
  121. data/app/components/better_ui/general/link/component.rb +0 -258
  122. data/app/components/better_ui/general/modal/component.html.erb +0 -5
  123. data/app/components/better_ui/general/modal/component.rb +0 -47
  124. data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
  125. data/app/components/better_ui/general/modal/modal_component.rb +0 -160
  126. data/app/components/better_ui/general/pagination/component.html.erb +0 -85
  127. data/app/components/better_ui/general/pagination/component.rb +0 -216
  128. data/app/components/better_ui/general/panel/component.html.erb +0 -28
  129. data/app/components/better_ui/general/panel/component.rb +0 -249
  130. data/app/components/better_ui/general/progress/component.html.erb +0 -11
  131. data/app/components/better_ui/general/progress/component.rb +0 -160
  132. data/app/components/better_ui/general/spinner/component.html.erb +0 -35
  133. data/app/components/better_ui/general/spinner/component.rb +0 -93
  134. data/app/components/better_ui/general/table/component.html.erb +0 -5
  135. data/app/components/better_ui/general/table/component.rb +0 -217
  136. data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
  137. data/app/components/better_ui/general/table/tbody_component.rb +0 -30
  138. data/app/components/better_ui/general/table/td_component.html.erb +0 -3
  139. data/app/components/better_ui/general/table/td_component.rb +0 -44
  140. data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
  141. data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
  142. data/app/components/better_ui/general/table/th_component.html.erb +0 -6
  143. data/app/components/better_ui/general/table/th_component.rb +0 -51
  144. data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
  145. data/app/components/better_ui/general/table/thead_component.rb +0 -28
  146. data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
  147. data/app/components/better_ui/general/table/tr_component.rb +0 -30
  148. data/app/components/better_ui/general/tabs/component.html.erb +0 -11
  149. data/app/components/better_ui/general/tabs/component.rb +0 -120
  150. data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
  151. data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
  152. data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
  153. data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
  154. data/app/components/better_ui/general/tag/component.html.erb +0 -3
  155. data/app/components/better_ui/general/tag/component.rb +0 -104
  156. data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
  157. data/app/components/better_ui/general/tooltip/component.rb +0 -239
  158. data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
  159. data/app/helpers/better_ui/application/components/card.rb +0 -11
  160. data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
  161. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
  162. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
  163. data/app/helpers/better_ui/application_helper.rb +0 -55
  164. data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
  165. data/app/helpers/better_ui/general/components/accordion.rb +0 -11
  166. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
  167. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
  168. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
  169. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
  170. data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
  171. data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
  172. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
  173. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
  174. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -79
  175. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -62
  176. data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
  177. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
  178. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
  179. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
  180. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
  181. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
  182. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
  183. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -70
  184. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
  185. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
  186. data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
  187. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
  188. data/app/helpers/better_ui/general/components/modal.rb +0 -11
  189. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
  190. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
  191. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
  192. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
  193. data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
  194. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
  195. data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
  196. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
  197. data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
  198. data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
  199. data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
  200. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
  201. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
  202. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
  203. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
  204. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
  205. data/app/views/layouts/better_ui/application.html.erb +0 -17
  206. 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,17 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Better ui</title>
5
- <%= csrf_meta_tags %>
6
- <%= csp_meta_tag %>
7
-
8
- <%= yield :head %>
9
-
10
- <%= stylesheet_link_tag "better_ui/application", media: "all" %>
11
- </head>
12
- <body style="padding: 10px;">
13
-
14
- <%= yield %>
15
-
16
- </body>
17
- </html>
@@ -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