better_ui 0.6.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 (198) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +257 -212
  3. data/Rakefile +11 -2
  4. data/app/components/better_ui/action_messages_component/action_messages_component.html.erb +48 -0
  5. data/app/components/better_ui/action_messages_component.rb +544 -0
  6. data/app/components/better_ui/application_component.rb +66 -0
  7. data/app/components/better_ui/button_component/button_component.html.erb +31 -0
  8. data/app/components/better_ui/button_component.rb +307 -0
  9. data/app/components/better_ui/card_component/card_component.html.erb +17 -0
  10. data/app/components/better_ui/card_component.rb +460 -0
  11. data/app/components/better_ui/drawer/header_component/header_component.html.erb +24 -0
  12. data/app/components/better_ui/drawer/header_component.rb +238 -0
  13. data/app/components/better_ui/drawer/layout_component/layout_component.html.erb +44 -0
  14. data/app/components/better_ui/drawer/layout_component.rb +270 -0
  15. data/app/components/better_ui/drawer/nav_group_component/nav_group_component.html.erb +10 -0
  16. data/app/components/better_ui/drawer/nav_group_component.rb +155 -0
  17. data/app/components/better_ui/drawer/nav_item_component/nav_item_component.html.erb +13 -0
  18. data/app/components/better_ui/drawer/nav_item_component.rb +225 -0
  19. data/app/components/better_ui/drawer/sidebar_component/sidebar_component.html.erb +17 -0
  20. data/app/components/better_ui/drawer/sidebar_component.rb +263 -0
  21. data/app/components/better_ui/forms/base_component.rb +450 -0
  22. data/app/components/better_ui/forms/checkbox_component/checkbox_component.html.erb +28 -0
  23. data/app/components/better_ui/forms/checkbox_component.rb +419 -0
  24. data/app/components/better_ui/forms/checkbox_group_component/checkbox_group_component.html.erb +40 -0
  25. data/app/components/better_ui/forms/checkbox_group_component.rb +363 -0
  26. data/app/components/better_ui/forms/number_input_component/number_input_component.html.erb +40 -0
  27. data/app/components/better_ui/forms/number_input_component.rb +320 -0
  28. data/app/components/better_ui/forms/password_input_component/password_input_component.html.erb +71 -0
  29. data/app/components/better_ui/forms/password_input_component.rb +206 -0
  30. data/app/components/better_ui/forms/text_input_component/text_input_component.html.erb +40 -0
  31. data/app/components/better_ui/forms/text_input_component.rb +258 -0
  32. data/app/components/better_ui/forms/textarea_component/textarea_component.html.erb +40 -0
  33. data/app/components/better_ui/forms/textarea_component.rb +329 -0
  34. data/app/form_builders/better_ui/ui_form_builder.rb +467 -0
  35. data/app/helpers/better_ui/application_helper.rb +325 -58
  36. data/app/views/layouts/better_ui/application.html.erb +1 -1
  37. data/config/routes.rb +1 -0
  38. data/lib/better_ui/engine.rb +34 -5
  39. data/lib/better_ui/version.rb +1 -1
  40. data/lib/better_ui.rb +32 -5
  41. data/lib/generators/better_ui/install/USAGE +44 -0
  42. data/lib/generators/better_ui/install/install_generator.rb +87 -0
  43. data/lib/generators/better_ui/install/templates/better_ui_theme.css.tt +280 -0
  44. data/lib/tasks/better_ui_tasks.rake +39 -4
  45. metadata +52 -200
  46. data/app/components/better_ui/application/card/component.html.erb +0 -20
  47. data/app/components/better_ui/application/card/component.rb +0 -214
  48. data/app/components/better_ui/application/main/component.html.erb +0 -9
  49. data/app/components/better_ui/application/main/component.rb +0 -123
  50. data/app/components/better_ui/application/navbar/component.html.erb +0 -92
  51. data/app/components/better_ui/application/navbar/component.rb +0 -136
  52. data/app/components/better_ui/application/sidebar/component.html.erb +0 -249
  53. data/app/components/better_ui/application/sidebar/component.rb +0 -187
  54. data/app/components/better_ui/general/accordion/component.html.erb +0 -5
  55. data/app/components/better_ui/general/accordion/component.rb +0 -92
  56. data/app/components/better_ui/general/accordion/item_component.html.erb +0 -12
  57. data/app/components/better_ui/general/accordion/item_component.rb +0 -176
  58. data/app/components/better_ui/general/alert/component.html.erb +0 -32
  59. data/app/components/better_ui/general/alert/component.rb +0 -242
  60. data/app/components/better_ui/general/avatar/component.html.erb +0 -20
  61. data/app/components/better_ui/general/avatar/component.rb +0 -301
  62. data/app/components/better_ui/general/badge/component.html.erb +0 -23
  63. data/app/components/better_ui/general/badge/component.rb +0 -248
  64. data/app/components/better_ui/general/breadcrumb/component.html.erb +0 -15
  65. data/app/components/better_ui/general/breadcrumb/component.rb +0 -187
  66. data/app/components/better_ui/general/button/component.html.erb +0 -34
  67. data/app/components/better_ui/general/button/component.rb +0 -214
  68. data/app/components/better_ui/general/divider/component.html.erb +0 -10
  69. data/app/components/better_ui/general/divider/component.rb +0 -226
  70. data/app/components/better_ui/general/dropdown/component.html.erb +0 -28
  71. data/app/components/better_ui/general/dropdown/component.rb +0 -192
  72. data/app/components/better_ui/general/dropdown/divider_component.html.erb +0 -1
  73. data/app/components/better_ui/general/dropdown/divider_component.rb +0 -41
  74. data/app/components/better_ui/general/dropdown/item_component.html.erb +0 -6
  75. data/app/components/better_ui/general/dropdown/item_component.rb +0 -119
  76. data/app/components/better_ui/general/field/component.html.erb +0 -27
  77. data/app/components/better_ui/general/field/component.rb +0 -37
  78. data/app/components/better_ui/general/grid/cell_component.html.erb +0 -3
  79. data/app/components/better_ui/general/grid/cell_component.rb +0 -390
  80. data/app/components/better_ui/general/grid/component.html.erb +0 -3
  81. data/app/components/better_ui/general/grid/component.rb +0 -301
  82. data/app/components/better_ui/general/heading/component.html.erb +0 -22
  83. data/app/components/better_ui/general/heading/component.rb +0 -257
  84. data/app/components/better_ui/general/icon/component.html.erb +0 -7
  85. data/app/components/better_ui/general/icon/component.rb +0 -240
  86. data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
  87. data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
  88. data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
  89. data/app/components/better_ui/general/input/datetime/component.rb +0 -223
  90. data/app/components/better_ui/general/input/pin/component.html.erb +0 -1
  91. data/app/components/better_ui/general/input/pin/component.rb +0 -201
  92. data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
  93. data/app/components/better_ui/general/input/radio/component.rb +0 -230
  94. data/app/components/better_ui/general/input/rating/component.html.erb +0 -4
  95. data/app/components/better_ui/general/input/rating/component.rb +0 -272
  96. data/app/components/better_ui/general/input/select/component.html.erb +0 -78
  97. data/app/components/better_ui/general/input/select/component.rb +0 -249
  98. data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
  99. data/app/components/better_ui/general/input/select/select_component.rb +0 -37
  100. data/app/components/better_ui/general/input/text/component.html.erb +0 -5
  101. data/app/components/better_ui/general/input/text/component.rb +0 -171
  102. data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
  103. data/app/components/better_ui/general/input/textarea/component.rb +0 -166
  104. data/app/components/better_ui/general/input/toggle/component.html.erb +0 -5
  105. data/app/components/better_ui/general/input/toggle/component.rb +0 -242
  106. data/app/components/better_ui/general/link/component.html.erb +0 -18
  107. data/app/components/better_ui/general/link/component.rb +0 -258
  108. data/app/components/better_ui/general/modal/component.html.erb +0 -5
  109. data/app/components/better_ui/general/modal/component.rb +0 -47
  110. data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
  111. data/app/components/better_ui/general/modal/modal_component.rb +0 -160
  112. data/app/components/better_ui/general/pagination/component.html.erb +0 -85
  113. data/app/components/better_ui/general/pagination/component.rb +0 -216
  114. data/app/components/better_ui/general/panel/component.html.erb +0 -28
  115. data/app/components/better_ui/general/panel/component.rb +0 -249
  116. data/app/components/better_ui/general/progress/component.html.erb +0 -11
  117. data/app/components/better_ui/general/progress/component.rb +0 -160
  118. data/app/components/better_ui/general/spinner/component.html.erb +0 -35
  119. data/app/components/better_ui/general/spinner/component.rb +0 -93
  120. data/app/components/better_ui/general/table/component.html.erb +0 -5
  121. data/app/components/better_ui/general/table/component.rb +0 -217
  122. data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
  123. data/app/components/better_ui/general/table/tbody_component.rb +0 -30
  124. data/app/components/better_ui/general/table/td_component.html.erb +0 -3
  125. data/app/components/better_ui/general/table/td_component.rb +0 -44
  126. data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
  127. data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
  128. data/app/components/better_ui/general/table/th_component.html.erb +0 -6
  129. data/app/components/better_ui/general/table/th_component.rb +0 -51
  130. data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
  131. data/app/components/better_ui/general/table/thead_component.rb +0 -28
  132. data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
  133. data/app/components/better_ui/general/table/tr_component.rb +0 -30
  134. data/app/components/better_ui/general/tabs/component.html.erb +0 -11
  135. data/app/components/better_ui/general/tabs/component.rb +0 -120
  136. data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
  137. data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
  138. data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
  139. data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
  140. data/app/components/better_ui/general/tag/component.html.erb +0 -3
  141. data/app/components/better_ui/general/tag/component.rb +0 -104
  142. data/app/components/better_ui/general/text/component.html.erb +0 -1
  143. data/app/components/better_ui/general/text/component.rb +0 -194
  144. data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
  145. data/app/components/better_ui/general/tooltip/component.rb +0 -239
  146. data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
  147. data/app/helpers/better_ui/application/components/card.rb +0 -11
  148. data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
  149. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
  150. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
  151. data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
  152. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
  153. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
  154. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
  155. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
  156. data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
  157. data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
  158. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
  159. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
  160. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -88
  161. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -68
  162. data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
  163. data/app/helpers/better_ui/general/components/grid/grid_helper.rb +0 -145
  164. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
  165. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
  166. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
  167. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
  168. data/app/helpers/better_ui/general/components/input/pin/pin_helper.rb +0 -76
  169. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
  170. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
  171. data/app/helpers/better_ui/general/components/input/rating/rating_helper.rb +0 -70
  172. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -86
  173. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
  174. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
  175. data/app/helpers/better_ui/general/components/input/toggle/toggle_helper.rb +0 -77
  176. data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
  177. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
  178. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
  179. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
  180. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
  181. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
  182. data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
  183. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
  184. data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
  185. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
  186. data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
  187. data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
  188. data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
  189. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
  190. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
  191. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
  192. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
  193. data/app/helpers/better_ui/general/components/text/text_helper.rb +0 -83
  194. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
  195. data/app/jobs/better_ui/application_job.rb +0 -4
  196. data/app/mailers/better_ui/application_mailer.rb +0 -6
  197. data/config/initializers/lookbook.rb +0 -23
  198. data/lib/better_ui/railtie.rb +0 -20
@@ -1,96 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BetterUi
4
- module Application
5
- module Components
6
- module Card
7
- module CardHelper
8
- # Helper per creare una card per metriche e statistiche nelle dashboard applicative
9
- #
10
- # @param title [String] Il titolo/etichetta della metrica
11
- # @param value [String] Il valore principale da visualizzare
12
- # @param trend [Symbol, nil] La direzione del trend (:up, :down, nil), default nil
13
- # @param change [String, nil] Il valore del cambiamento (es. "+12%"), default nil
14
- # @param color [Symbol] Il colore del trend (:green, :red, :blue, :yellow, :purple, :indigo, :gray), default :green
15
- # @param theme [Symbol] Il tema della card (:default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet, :purple), default :default
16
- # @param size [Symbol] La dimensione della card (:small, :medium, :large), default :medium
17
- # @param rounded [Symbol] Il livello di arrotondamento (:none, :small, :medium, :large, :full), default :medium
18
- # @param shadow [Symbol] Il tipo di ombra (:none, :small, :medium, :large), default :small
19
- # @param classes [String, nil] Classi CSS aggiuntive per il contenitore principale
20
- # @param form [Nil] Parametro form per compatibilità con form builder (non utilizzato)
21
- # @param options [Hash] Attributi HTML aggiuntivi da passare al div principale
22
- #
23
- # @return [String] HTML della card per metriche
24
- #
25
- # @example Card base con solo titolo e valore
26
- # <%= bui_card(title: "Utenti Attivi", value: "1.234") %>
27
- #
28
- # @example Card con trend positivo
29
- # <%= bui_card(
30
- # title: "Vendite Totali",
31
- # value: "€ 45.231",
32
- # trend: :up,
33
- # change: "+12%",
34
- # color: :green
35
- # ) %>
36
- #
37
- # @example Card con trend negativo
38
- # <%= bui_card(
39
- # title: "Conversioni",
40
- # value: "2.8%",
41
- # trend: :down,
42
- # change: "-5%",
43
- # color: :red
44
- # ) %>
45
- #
46
- # @example Card con tema e dimensioni personalizzate
47
- # <%= bui_card(
48
- # title: "Revenue",
49
- # value: "$89,432",
50
- # theme: :primary,
51
- # size: :large,
52
- # rounded: :large,
53
- # shadow: :medium
54
- # ) %>
55
- #
56
- # @example Card con attributi HTML aggiuntivi
57
- # <%= bui_card(
58
- # title: "Performance",
59
- # value: "98.5%",
60
- # classes: "transition-all hover:shadow-lg",
61
- # data: { controller: "stats" },
62
- # id: "performance-card"
63
- # ) %>
64
- def bui_card(
65
- title:,
66
- value:,
67
- trend: nil,
68
- change: nil,
69
- color: :green,
70
- theme: :default,
71
- size: :medium,
72
- rounded: :medium,
73
- shadow: :small,
74
- classes: nil,
75
- form: nil,
76
- **options
77
- )
78
- render BetterUi::Application::Card::Component.new(
79
- title: title,
80
- value: value,
81
- trend: trend,
82
- change: change,
83
- color: color,
84
- theme: theme,
85
- size: size,
86
- rounded: rounded,
87
- shadow: shadow,
88
- classes: classes,
89
- **options
90
- )
91
- end
92
- end
93
- end
94
- end
95
- end
96
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BetterUi
4
- module Application
5
- module Components
6
- module Card
7
- include BetterUi::Application::Components::Card::CardHelper
8
- end
9
- end
10
- end
11
- end
@@ -1,64 +0,0 @@
1
- module BetterUi
2
- module Application
3
- module Components
4
- module Main
5
- module MainHelper
6
- # Helper per creare il contenitore principale dell'applicazione
7
- #
8
- # @param padding [Boolean] Se applicare il padding al contenitore principale, default true
9
- # @param inner_padding [Boolean] Se applicare il padding al contenitore interno, default true
10
- # @param rounded [Symbol] Tipo di border-radius del contenitore interno (:none, :small, :medium, :large, :full), default :small
11
- # @param shadow [Symbol] Tipo di ombra del contenitore interno (:none, :small, :medium, :large), default :medium
12
- # @param with_sidebar [Boolean] Se lasciare lo spazio per la sidebar, default true
13
- # @param sidebar_width [Symbol] Larghezza della sidebar (:sm, :md, :lg, :xl), default :md
14
- # @param classes [String] Classi CSS aggiuntive per il contenitore principale
15
- # @param form [Nil] Parametro form per compatibilità con form builder (non utilizzato)
16
- # @param block [Proc] Blocco contenente il contenuto del main
17
- #
18
- # @return [String] HTML del componente main
19
- #
20
- # @example Main base
21
- # <%= bui_main %>
22
- #
23
- # @example Main con tema
24
- # <%= bui_main(rounded: :medium, shadow: :lg) %>
25
- #
26
- # @example Main senza sidebar
27
- # <%= bui_main(with_sidebar: false) %>
28
- #
29
- # @example Main con padding personalizzati
30
- # <%= bui_main(padding: false, inner_padding: true) %>
31
- #
32
- # @example Main con classi aggiuntive
33
- # <%= bui_main(
34
- # classes: "my-8",
35
- # data: { controller: "main" }
36
- # ) %>
37
- def bui_main(
38
- padding: true,
39
- inner_padding: true,
40
- rounded: :small,
41
- shadow: :medium,
42
- with_sidebar: true,
43
- sidebar_width: :md,
44
- classes: nil,
45
- form: nil,
46
- **options,
47
- &block
48
- )
49
- render BetterUi::Application::Main::Component.new(
50
- padding: padding,
51
- inner_padding: inner_padding,
52
- rounded: rounded,
53
- shadow: shadow,
54
- with_sidebar: with_sidebar,
55
- sidebar_width: sidebar_width,
56
- classes: classes,
57
- **options
58
- ), &block
59
- end
60
- end
61
- end
62
- end
63
- end
64
- end
@@ -1,77 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BetterUi
4
- module Application
5
- module Components
6
- module Navbar
7
- module NavbarHelper
8
- # Helper per creare la navbar dell'applicazione
9
- #
10
- # @param theme [Symbol] Tema colori (default, white, red, rose, orange, green, blue, yellow, violet), default :default
11
- # @param shadow [Symbol] Tipo di ombra (none, small, medium, large), default :small
12
- # @param border [Boolean] Se mostrare il bordo inferiore, default true
13
- # @param actions [Array] Array di azioni/pulsanti a destra
14
- # @param classes [String] Classi CSS aggiuntive
15
- # @param with_sidebar [Boolean] Se la navbar è affiancata a una sidebar, default false
16
- # @param sidebar_width [Symbol] Larghezza della sidebar affiancata (:sm, :md, :lg, :xl), default :md
17
- # @param form [Nil] Parametro form per compatibilità con form builder (non utilizzato)
18
- # @param options [Hash] Opzioni HTML aggiuntive
19
- # @param block [Proc] Blocco contenente contenuto aggiuntivo della navbar
20
- #
21
- # @return [String] HTML del componente navbar
22
- #
23
- # @example Navbar base
24
- # <%= bui_navbar %>
25
- #
26
- # @example Navbar con tema
27
- # <%= bui_navbar(theme: :blue) %>
28
- #
29
- #
30
- # @example Navbar con azioni
31
- # <%= bui_navbar(
32
- # actions: [
33
- # {
34
- # type: :avatar,
35
- # avatar: { initials: 'AB', theme: :green },
36
- # href: '/profile'
37
- # },
38
- # {
39
- # type: :icon,
40
- # icon: 'chat',
41
- # data: { action: 'click->chat#toggle' }
42
- # }
43
- # ]
44
- # ) %>
45
- #
46
- # @example Navbar con classi aggiuntive
47
- # <%= bui_navbar(
48
- # classes: "my-8",
49
- # data: { controller: "navbar" }
50
- # ) %>
51
- def bui_navbar(
52
- theme: :default,
53
- shadow: :small,
54
- border: true,
55
- actions: [],
56
- classes: nil,
57
- with_sidebar: false,
58
- sidebar_width: :md,
59
- form: nil,
60
- **options,
61
- &block
62
- )
63
- render BetterUi::Application::Navbar::Component.new(
64
- theme: theme,
65
- shadow: shadow,
66
- border: border,
67
- actions: actions,
68
- classes: classes,
69
- with_sidebar: with_sidebar,
70
- sidebar_width: sidebar_width
71
- ), &block
72
- end
73
- end
74
- end
75
- end
76
- end
77
- end
@@ -1,51 +0,0 @@
1
- module BetterUi
2
- module Application
3
- module Components
4
- module Sidebar
5
- module SidebarHelper
6
- # Helper per creare la sidebar dell'applicazione
7
- #
8
- # @param width [Symbol] Larghezza della sidebar (:sm, :md, :lg, :xl), default :md
9
- # @param position [Symbol] Posizione della sidebar (:left, :right), default :left
10
- # @param theme [Symbol] Tema colori (:default, :dark, :light), default :default
11
- # @param shadow [Symbol] Tipo di ombra (:none, :sm, :md, :lg), default :lg
12
- # @param border [Boolean] Se mostrare il bordo destro/sinistro, default true
13
- # @param header [Hash] Configurazione header (logo, title, subtitle)
14
- # @param footer [Hash] Configurazione footer (content, user_info)
15
- # @param navigation_sections [Array] Array di sezioni di navigazione
16
- # @param collapsible [Boolean] Se abilitare sezioni collassabili, default true
17
- # @param classes [String] Classi CSS aggiuntive
18
- # @param block [Proc] Blocco contenente contenuto aggiuntivo della sidebar
19
- #
20
- # @return [String] HTML del componente sidebar
21
- def bui_sidebar(
22
- width: :md,
23
- position: :left,
24
- theme: :default,
25
- shadow: :lg,
26
- border: true,
27
- header: {},
28
- footer: {},
29
- navigation_sections: [],
30
- collapsible: true,
31
- classes: nil,
32
- &block
33
- )
34
- render BetterUi::Application::Sidebar::Component.new(
35
- width: width,
36
- position: position,
37
- theme: theme,
38
- shadow: shadow,
39
- border: border,
40
- header: header,
41
- footer: footer,
42
- navigation_sections: navigation_sections,
43
- collapsible: collapsible,
44
- classes: classes
45
- ), &block
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
@@ -1,73 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BetterUi
4
- module General
5
- module Components
6
- module Accordion
7
- module AccordionHelper
8
- # Rendering di un accordion con item collassabili/espandibili
9
- #
10
- # @param multiple [Boolean] se permettere multipli item aperti contemporaneamente
11
- # @param theme [Symbol] tema di colore per l'accordion
12
- # @param variant [Symbol] variante visuale dell'accordion
13
- # @param size [Symbol] dimensione del testo e padding
14
- # @param classes [String] classi CSS aggiuntive per il wrapper
15
- # @param options [Hash] attributi HTML aggiuntivi da passare al componente
16
- # @return [String] HTML renderizzato dell'accordion
17
- #
18
- # @example Uso base standalone
19
- # <%= bui_accordion do |accordion| %>
20
- # <%= accordion.with_item(title: "Domanda 1") do %>
21
- # <p>Risposta alla prima domanda</p>
22
- # <% end %>
23
- # <% end %>
24
- #
25
- # @example Con tema e configurazioni
26
- # <%= bui_accordion(multiple: true, theme: :blue, size: :large) do |accordion| %>
27
- # <%= accordion.with_item(title: "FAQ 1", expanded: true) do %>
28
- # <p>Contenuto della prima FAQ</p>
29
- # <% end %>
30
- # <%= accordion.with_item(title: "FAQ 2") do %>
31
- # <p>Contenuto della seconda FAQ</p>
32
- # <% end %>
33
- # <% end %>
34
- #
35
- # @example Con varianti stilistiche
36
- # <%= bui_accordion(variant: :separated, theme: :green) do |accordion| %>
37
- # <%= accordion.with_item(title: "Sezione 1") do %>
38
- # <div>Contenuto complesso con HTML</div>
39
- # <% end %>
40
- # <% end %>
41
- #
42
- # @example Con attributi HTML aggiuntivi
43
- # <%= bui_accordion(id: "faq-accordion", "data-testid": "main-faq") do |accordion| %>
44
- # <%= accordion.with_item(title: "Come funziona?") do %>
45
- # <p>Spiegazione dettagliata...</p>
46
- # <% end %>
47
- # <% end %>
48
- #
49
- # @example Con item disabilitati e icone personalizzate
50
- # <%= bui_accordion(theme: :violet, size: :small) do |accordion| %>
51
- # <%= accordion.with_item(title: "Disponibile", icon: "check-circle") do %>
52
- # <p>Questa sezione è disponibile</p>
53
- # <% end %>
54
- # <%= accordion.with_item(title: "Non disponibile", disabled: true) do %>
55
- # <p>Questa sezione è disabilitata</p>
56
- # <% end %>
57
- # <% end %>
58
- def bui_accordion(multiple: false, theme: :default, variant: :bordered, size: :medium,
59
- classes: '', **options, &block)
60
- render BetterUi::General::Accordion::Component.new(
61
- multiple: multiple,
62
- theme: theme,
63
- variant: variant,
64
- size: size,
65
- classes: classes,
66
- **options
67
- ), &block
68
- end
69
- end
70
- end
71
- end
72
- end
73
- end
@@ -1,57 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Alert
5
- module AlertHelper
6
- # Renderizza un componente Alert per comunicare messaggi importanti all'utente.
7
- #
8
- # @param title [String, nil] Titolo dell'alert (opzionale)
9
- # @param message [String] Contenuto dell'alert
10
- # @param theme [Symbol] Tema dell'alert (:default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet)
11
- # @param icon [String, nil] Nome dell'icona (se vuoto usa l'icona predefinita in base al tema)
12
- # @param icon_position [Symbol] Posizione dell'icona (:left, :right)
13
- # @param dismissible [Boolean] Se l'alert può essere chiuso dall'utente
14
- # @param rounded [Symbol] Arrotondamento degli angoli (:none, :small, :medium, :large, :full)
15
- # @param importance [Symbol] Livello di importanza per accessibilità (:high, :medium, :low)
16
- # @param html_content [Boolean] Se il messaggio contiene HTML
17
- # @param classes [String] Classi CSS aggiuntive
18
- # @param options [Hash] Attributi HTML aggiuntivi
19
- #
20
- # @return [String] HTML del componente Alert renderizzato
21
- #
22
- # @example Alert base
23
- # <%= bui_alert(message: 'Operazione completata con successo') %>
24
- #
25
- # @example Alert con titolo e tema
26
- # <%= bui_alert(title: 'Errore', message: 'Impossibile completare', theme: :red) %>
27
- #
28
- # @example Alert con icona personalizzata
29
- # <%= bui_alert(message: 'Avviso importante', icon: 'bell') %>
30
- #
31
- # @example Alert con pulsante per chiudere
32
- # <%= bui_alert(message: 'Notifica temporanea', dismissible: true) %>
33
- #
34
- # @example Alert con HTML nel messaggio
35
- # <%= bui_alert(message: '<strong>Attenzione!</strong> Controlla i dati.', html_content: true) %>
36
- def bui_alert(title: nil, message: nil, theme: :default, icon: nil, icon_position: :left,
37
- dismissible: false, rounded: :medium, importance: :medium, html_content: false,
38
- classes: nil, **options)
39
- render BetterUi::General::Alert::Component.new(
40
- title: title,
41
- message: message,
42
- theme: theme,
43
- icon: icon,
44
- icon_position: icon_position,
45
- dismissible: dismissible,
46
- rounded: rounded,
47
- importance: importance,
48
- html_content: html_content,
49
- classes: classes,
50
- **options
51
- )
52
- end
53
- end
54
- end
55
- end
56
- end
57
- end
@@ -1,29 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Avatar
5
- module AvatarHelper
6
- # Render un avatar con le opzioni specificate
7
- #
8
- # @param options [Hash] opzioni per il componente
9
- #
10
- # @option options [String] :name (nil) nome per le iniziali
11
- # @option options [String] :src (nil) URL dell'immagine
12
- # @option options [Symbol] :size (:medium) :xxsmall, :xsmall, :small, :medium, :large, :xlarge, :xxlarge
13
- # @option options [Symbol] :shape (:circle) :circle, :square, :rounded
14
- # @option options [Symbol] :status (nil) :online, :offline, :busy, :away
15
- # @option options [Symbol] :status_position (:bottom_right) :bottom_right, :bottom_left, :top_right, :top_left
16
- # @option options [Symbol] :theme (:white) :default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet
17
- # @option options [Symbol] :style (:filled) :filled, :outline, :light
18
- # @option options [String] :classes (nil) classi CSS aggiuntive
19
- # @option options [String] :id (nil) ID HTML
20
- #
21
- # @return [String] HTML del componente
22
- def bui_avatar(**options)
23
- render BetterUi::General::Avatar::Component.new(**options)
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,53 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Badge
5
- module BadgeHelper
6
- # Helper per renderizzare un badge
7
- #
8
- # @param label [String] Testo del badge
9
- # @param theme [Symbol] Tema del badge (:default, :white, :red, etc.)
10
- # @param size [Symbol] Dimensione del badge (:small, :medium, :large)
11
- # @param shape [Symbol] Forma del badge (:square, :rounded)
12
- # @param style [Symbol] Stile del badge (:filled, :outline)
13
- # @param variant [Symbol] Variante del badge (:notification, :counter, :dot)
14
- # @param icon [String] Nome dell'icona (opzionale)
15
- # @param icon_position [Symbol] Posizione dell'icona (:left, :right)
16
- # @param classes [String] Classi CSS aggiuntive
17
- # @param id [String] ID HTML
18
- # @param html_options [Hash] Opzioni HTML aggiuntive
19
- #
20
- # @return [String] HTML del badge
21
- def bui_badge(
22
- label: nil,
23
- theme: :white,
24
- size: :medium,
25
- shape: :rounded,
26
- style: :filled,
27
- variant: nil,
28
- icon: nil,
29
- icon_position: :left,
30
- classes: nil,
31
- id: nil,
32
- **html_options,
33
- &block
34
- )
35
- render BetterUi::General::Badge::Component.new(
36
- label: label,
37
- theme: theme,
38
- size: size,
39
- shape: shape,
40
- style: style,
41
- variant: variant,
42
- icon: icon,
43
- icon_position: icon_position,
44
- classes: classes,
45
- id: id,
46
- **html_options
47
- ), &block
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,37 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Breadcrumb
5
- module BreadcrumbHelper
6
- # Helper per renderizzare un breadcrumb
7
- #
8
- # @param items [Array] Array di items del breadcrumb
9
- # @param separator [Symbol] Tipo di separatore (:chevron, :slash, :arrow, :dot, :pipe)
10
- # @param theme [Symbol] Tema del breadcrumb (:default, :white, :red, etc.)
11
- # @param size [Symbol] Dimensione del testo (:extra_small, :small, :medium, :large)
12
- # @param classes [String] Classi CSS aggiuntive
13
- # @param html_options [Hash] Opzioni HTML aggiuntive
14
- #
15
- # @return [String] HTML del breadcrumb
16
- def bui_breadcrumb(
17
- items: [],
18
- separator: :chevron,
19
- theme: :white,
20
- size: :medium,
21
- classes: nil,
22
- **html_options
23
- )
24
- render BetterUi::General::Breadcrumb::Component.new(
25
- items: items,
26
- separator: separator,
27
- theme: theme,
28
- size: size,
29
- classes: classes,
30
- **html_options
31
- )
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,65 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Button
5
- module ButtonHelper
6
- # Helper per renderizzare un bottone
7
- #
8
- # @param text [String] Testo del bottone (argomento posizionale)
9
- # @param theme [Symbol] Tema del bottone (:default, :white, :red, etc.)
10
- # @param size [Symbol] Dimensione del bottone (:small, :medium, :large)
11
- # @param full_width [Boolean] Larghezza completa
12
- # @param disabled [Boolean] Stato disabilitato
13
- # @param icon [String] Nome icona (opzionale)
14
- # @param icon_position [Symbol] Posizione icona (:left, :right)
15
- # @param href [String] URL per il link (opzionale)
16
- # @param method [Symbol] Metodo HTTP (opzionale)
17
- # @param data [Hash] Attributi data
18
- # @param classes [String] Classi CSS aggiuntive
19
- # @param id [String] ID elemento
20
- # @param rounded [Symbol] Tipo di border-radius (:none, :small, :medium, :large, :full)
21
- # @param html_options [Hash] Opzioni HTML aggiuntive
22
- # @params button_type [Symbol] Tipo di bottone (:button, :submit, :reset)
23
- #
24
- # @return [String] HTML del bottone
25
- def bui_button(
26
- text = nil,
27
- theme: :white,
28
- size: :medium,
29
- full_width: false,
30
- disabled: false,
31
- icon: nil,
32
- icon_position: :left,
33
- href: nil,
34
- method: nil,
35
- data: {},
36
- classes: nil,
37
- id: nil,
38
- rounded: :medium,
39
- button_type: :button,
40
- **html_options,
41
- &block
42
- )
43
- render BetterUi::General::Button::Component.new(
44
- text: text,
45
- theme: theme,
46
- size: size,
47
- full_width: full_width,
48
- disabled: disabled,
49
- icon: icon,
50
- icon_position: icon_position,
51
- href: href,
52
- method: method,
53
- data: data,
54
- classes: classes,
55
- id: id,
56
- rounded: rounded,
57
- button_type: button_type,
58
- **html_options
59
- ), &block
60
- end
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,60 +0,0 @@
1
- module BetterUi
2
- module General
3
- module Components
4
- module Container
5
- module ContainerHelper
6
- # Genera un container usando BetterUi::General::Container::Component
7
- #
8
- # @param html_content [String] contenuto HTML del container (opzionale)
9
- # @param fluid [Boolean] se il container deve essere fluid (full width)
10
- # @param max_width [Symbol] larghezza massima del container (:sm, :md, :lg, :xl, :xxl)
11
- # @param padding [Symbol] padding interno (:none, :small, :medium, :large)
12
- # @param background [Symbol] colore di sfondo (:white, :light, :dark, :transparent)
13
- # @param html_options [Hash] opzioni HTML aggiuntive
14
- # @return [String] HTML del container renderizzato
15
- #
16
- # @example Uso base
17
- # bui_container(html_content: "Contenuto del container")
18
- #
19
- # @example Container fluid
20
- # bui_container(
21
- # html_content: "Contenuto full width",
22
- # fluid: true
23
- # )
24
- #
25
- # @example Container con larghezza massima
26
- # bui_container(
27
- # html_content: "Contenuto limitato",
28
- # max_width: :lg,
29
- # padding: :large
30
- # )
31
- #
32
- # @example Con contenuto block
33
- # bui_container(background: :light) do
34
- # "<div>Il mio contenuto</div>".html_safe
35
- # end
36
- def bui_container(
37
- html_content: nil,
38
- fluid: false,
39
- max_width: :lg,
40
- padding: :medium,
41
- background: :white,
42
- border: false,
43
- **html_options,
44
- &block
45
- )
46
- render BetterUi::General::Container::Component.new(
47
- html_content: html_content,
48
- fluid: fluid,
49
- max_width: max_width,
50
- padding: padding,
51
- background: background,
52
- border: border,
53
- **html_options
54
- ), &block
55
- end
56
- end
57
- end
58
- end
59
- end
60
- end