better_ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) 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/field/component.html.erb +27 -0
  26. data/app/components/better_ui/general/field/component.rb +37 -0
  27. data/app/components/better_ui/general/heading/component.html.erb +22 -0
  28. data/app/components/better_ui/general/heading/component.rb +257 -0
  29. data/app/components/better_ui/general/icon/component.html.erb +7 -0
  30. data/app/components/better_ui/general/icon/component.rb +239 -0
  31. data/app/components/better_ui/general/input/checkbox/component.html.erb +5 -0
  32. data/app/components/better_ui/general/input/checkbox/component.rb +238 -0
  33. data/app/components/better_ui/general/input/datetime/component.html.erb +5 -0
  34. data/app/components/better_ui/general/input/datetime/component.rb +223 -0
  35. data/app/components/better_ui/general/input/radio/component.html.erb +5 -0
  36. data/app/components/better_ui/general/input/radio/component.rb +230 -0
  37. data/app/components/better_ui/general/input/select/component.html.erb +16 -0
  38. data/app/components/better_ui/general/input/select/component.rb +184 -0
  39. data/app/components/better_ui/general/input/select/select_component.html.erb +5 -0
  40. data/app/components/better_ui/general/input/select/select_component.rb +37 -0
  41. data/app/components/better_ui/general/input/text/component.html.erb +5 -0
  42. data/app/components/better_ui/general/input/text/component.rb +171 -0
  43. data/app/components/better_ui/general/input/textarea/component.html.erb +5 -0
  44. data/app/components/better_ui/general/input/textarea/component.rb +166 -0
  45. data/app/components/better_ui/general/link/component.html.erb +18 -0
  46. data/app/components/better_ui/general/link/component.rb +258 -0
  47. data/app/components/better_ui/general/panel/component.html.erb +28 -0
  48. data/app/components/better_ui/general/panel/component.rb +249 -0
  49. data/app/components/better_ui/general/progress/component.html.erb +11 -0
  50. data/app/components/better_ui/general/progress/component.rb +160 -0
  51. data/app/components/better_ui/general/spinner/component.html.erb +35 -0
  52. data/app/components/better_ui/general/spinner/component.rb +93 -0
  53. data/app/components/better_ui/general/table/component.html.erb +5 -0
  54. data/app/components/better_ui/general/table/component.rb +217 -0
  55. data/app/components/better_ui/general/table/tbody_component.html.erb +3 -0
  56. data/app/components/better_ui/general/table/tbody_component.rb +30 -0
  57. data/app/components/better_ui/general/table/td_component.html.erb +3 -0
  58. data/app/components/better_ui/general/table/td_component.rb +44 -0
  59. data/app/components/better_ui/general/table/tfoot_component.html.erb +3 -0
  60. data/app/components/better_ui/general/table/tfoot_component.rb +28 -0
  61. data/app/components/better_ui/general/table/th_component.html.erb +6 -0
  62. data/app/components/better_ui/general/table/th_component.rb +51 -0
  63. data/app/components/better_ui/general/table/thead_component.html.erb +3 -0
  64. data/app/components/better_ui/general/table/thead_component.rb +28 -0
  65. data/app/components/better_ui/general/table/tr_component.html.erb +3 -0
  66. data/app/components/better_ui/general/table/tr_component.rb +30 -0
  67. data/app/components/better_ui/general/tag/component.html.erb +3 -0
  68. data/app/components/better_ui/general/tag/component.rb +104 -0
  69. data/app/components/better_ui/general/tooltip/component.html.erb +7 -0
  70. data/app/components/better_ui/general/tooltip/component.rb +239 -0
  71. data/app/helpers/better_ui/application/components/card/card_helper.rb +96 -0
  72. data/app/helpers/better_ui/application/components/card.rb +11 -0
  73. data/app/helpers/better_ui/application/components/main/main_helper.rb +64 -0
  74. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +77 -0
  75. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +51 -0
  76. data/app/helpers/better_ui/application_helper.rb +42 -179
  77. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +57 -0
  78. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +29 -0
  79. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +53 -0
  80. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +37 -0
  81. data/app/helpers/better_ui/general/components/button/button_helper.rb +65 -0
  82. data/app/helpers/better_ui/general/components/container/container_helper.rb +60 -0
  83. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +63 -0
  84. data/app/helpers/better_ui/general/components/field/field_helper.rb +26 -0
  85. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +72 -0
  86. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +16 -0
  87. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +81 -0
  88. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +91 -0
  89. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +79 -0
  90. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +124 -0
  91. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +70 -0
  92. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +138 -0
  93. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +73 -0
  94. data/app/helpers/better_ui/general/components/link/link_helper.rb +89 -0
  95. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +83 -0
  96. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +53 -0
  97. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +19 -0
  98. data/app/helpers/better_ui/general/components/table/table_helper.rb +53 -0
  99. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +13 -0
  100. data/app/helpers/better_ui/general/components/table/td_helper.rb +19 -0
  101. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +13 -0
  102. data/app/helpers/better_ui/general/components/table/th_helper.rb +19 -0
  103. data/app/helpers/better_ui/general/components/table/thead_helper.rb +13 -0
  104. data/app/helpers/better_ui/general/components/table/tr_helper.rb +13 -0
  105. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +26 -0
  106. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +60 -0
  107. data/app/views/layouts/better_ui/application.html.erb +6 -124
  108. data/config/initializers/lookbook.rb +23 -0
  109. data/config/routes.rb +0 -8
  110. data/lib/better_ui/engine.rb +5 -19
  111. data/lib/better_ui/railtie.rb +20 -0
  112. data/lib/better_ui/version.rb +1 -1
  113. data/lib/better_ui.rb +4 -20
  114. metadata +131 -28
  115. data/app/controllers/better_ui/docs_controller.rb +0 -41
  116. data/app/views/better_ui/docs/component.html.erb +0 -365
  117. data/app/views/better_ui/docs/index.html.erb +0 -100
  118. data/app/views/better_ui/docs/show.html.erb +0 -60
@@ -1,183 +1,46 @@
1
1
  module BetterUi
2
2
  module ApplicationHelper
3
- # Metodi helper per i componenti UI semplici
4
-
5
- # Button component
6
- def better_ui_button(text, options = {})
7
- options = BetterUi.configuration.button_defaults.deep_merge(options)
8
- type = options.delete(:type) || 'primary'
9
- css_class = "better-ui-button better-ui-button-#{type}"
10
- css_class += " #{options.delete(:class)}" if options[:class]
11
-
12
- button_tag(text, **options.merge(class: css_class))
13
- end
14
-
15
- # Alert component
16
- def better_ui_alert(message, options = {})
17
- options = BetterUi.configuration.alert_defaults.deep_merge(options)
18
- type = options.delete(:type) || 'info'
19
- css_class = "better-ui-alert better-ui-alert-#{type}"
20
- css_class += " #{options.delete(:class)}" if options[:class]
21
-
22
- content_tag(:div, class: css_class) do
23
- concat content_tag(:div, message, class: 'better-ui-alert-message')
24
- if options[:dismissible]
25
- concat content_tag(:button, 'x', class: 'better-ui-alert-close')
26
- end
27
- end
28
- end
29
-
30
- # Card component
31
- def better_ui_card(options = {}, &block)
32
- options = BetterUi.configuration.card_defaults.deep_merge(options)
33
- css_class = "better-ui-card"
34
- css_class += " #{options.delete(:class)}" if options[:class]
35
-
36
- content_tag(:div, class: css_class, **options, &block)
37
- end
38
-
39
- # Card header
40
- def better_ui_card_header(title, options = {})
41
- css_class = "better-ui-card-header"
42
- css_class += " #{options.delete(:class)}" if options[:class]
43
-
44
- content_tag(:div, class: css_class) do
45
- content_tag(:h3, title, class: 'better-ui-card-title')
46
- end
47
- end
48
-
49
- # Card body
50
- def better_ui_card_body(options = {}, &block)
51
- css_class = "better-ui-card-body"
52
- css_class += " #{options.delete(:class)}" if options[:class]
53
-
54
- content_tag(:div, class: css_class, **options, &block)
55
- end
56
-
57
- # Card footer
58
- def better_ui_card_footer(options = {}, &block)
59
- css_class = "better-ui-card-footer"
60
- css_class += " #{options.delete(:class)}" if options[:class]
61
-
62
- content_tag(:div, class: css_class, **options, &block)
63
- end
64
-
65
- # Tabs component
66
- def better_ui_tabs(options = {}, &block)
67
- options = BetterUi.configuration.tabs_defaults.deep_merge(options)
68
- css_class = "better-ui-tabs"
69
- css_class += " #{options.delete(:class)}" if options[:class]
70
-
71
- content_tag(:div, class: css_class, **options, &block)
72
- end
73
-
74
- # Tab list
75
- def better_ui_tab_list(options = {}, &block)
76
- css_class = "better-ui-tab-list"
77
- css_class += " #{options.delete(:class)}" if options[:class]
78
-
79
- content_tag(:div, class: css_class, role: 'tablist', **options, &block)
80
- end
81
-
82
- # Tab item
83
- def better_ui_tab_item(text, target, options = {})
84
- active = options.delete(:active) || false
85
- css_class = "better-ui-tab-item"
86
- css_class += " better-ui-tab-active" if active
87
- css_class += " #{options.delete(:class)}" if options[:class]
88
-
89
- content_tag(:button, text, {
90
- class: css_class,
91
- role: 'tab',
92
- 'aria-selected': active,
93
- 'data-target': target,
94
- }.merge(options))
95
- end
96
-
97
- # Tab content
98
- def better_ui_tab_content(options = {}, &block)
99
- css_class = "better-ui-tab-content"
100
- css_class += " #{options.delete(:class)}" if options[:class]
101
-
102
- content_tag(:div, class: css_class, role: 'tabpanel', **options, &block)
103
- end
104
-
105
- # Modal component
106
- def better_ui_modal(id, options = {}, &block)
107
- css_class = "better-ui-modal"
108
- css_class += " #{options.delete(:class)}" if options[:class]
109
-
110
- content_tag(:div, id: id, class: css_class) do
111
- concat content_tag(:div, '', class: 'better-ui-modal-background')
112
- concat content_tag(:div, class: 'better-ui-modal-dialog', &block)
113
- end
114
- end
115
-
116
- # Modal header
117
- def better_ui_modal_header(title, options = {})
118
- css_class = "better-ui-modal-header"
119
- css_class += " #{options.delete(:class)}" if options[:class]
120
-
121
- content_tag(:div, class: css_class) do
122
- concat content_tag(:h5, title, class: 'better-ui-modal-title')
123
- concat content_tag(:button, '×', type: 'button', class: 'better-ui-modal-close')
124
- end
125
- end
126
-
127
- # Modal body
128
- def better_ui_modal_body(options = {}, &block)
129
- css_class = "better-ui-modal-body"
130
- css_class += " #{options.delete(:class)}" if options[:class]
131
-
132
- content_tag(:div, class: css_class, **options, &block)
133
- end
134
-
135
- # Modal footer
136
- def better_ui_modal_footer(options = {}, &block)
137
- css_class = "better-ui-modal-footer"
138
- css_class += " #{options.delete(:class)}" if options[:class]
139
-
140
- content_tag(:div, class: css_class, **options, &block)
141
- end
142
-
143
- # Trigger button for modal
144
- def better_ui_modal_trigger(text, modal_id, options = {})
145
- options = BetterUi.configuration.button_defaults.deep_merge(options)
146
- type = options.delete(:type) || 'primary'
147
- css_class = "better-ui-button better-ui-button-#{type}"
148
- css_class += " #{options.delete(:class)}" if options[:class]
149
-
150
- button_tag(text, **options.merge(
151
- class: css_class,
152
- type: 'button',
153
- onclick: "document.getElementById('#{modal_id}').style.display='flex'"
154
- ))
155
- end
156
-
157
- # Render markdown
158
- def better_ui_markdown(text)
159
- return '' if text.blank?
160
-
161
- renderer = Redcarpet::Render::HTML.new(
162
- filter_html: false,
163
- hard_wrap: true,
164
- link_attributes: { target: '_blank', rel: 'noopener noreferrer' }
165
- )
166
-
167
- markdown = Redcarpet::Markdown.new(
168
- renderer,
169
- autolink: true,
170
- tables: true,
171
- fenced_code_blocks: true,
172
- strikethrough: true,
173
- superscript: true,
174
- underline: true,
175
- highlight: true,
176
- quote: true,
177
- footnotes: true
178
- )
179
-
180
- markdown.render(text).html_safe
181
- end
3
+ # Inclusione dei moduli aggregatori per i componenti application
4
+ # Questo assicura che tutti gli helper specifici dei componenti siano disponibili.
5
+
6
+ # General Components
7
+ include General::Components::Alert::AlertHelper
8
+ include General::Components::Avatar::AvatarHelper
9
+ include General::Components::Badge::BadgeHelper
10
+ include General::Components::Breadcrumb::BreadcrumbHelper
11
+ include General::Components::Button::ButtonHelper
12
+ include General::Components::Divider::DividerHelper
13
+ include General::Components::Heading::HeadingHelper
14
+ include General::Components::Icon::IconHelper
15
+ include General::Components::Link::LinkHelper
16
+ include General::Components::Panel::PanelHelper
17
+ include General::Components::Progress::ProgressHelper
18
+ include General::Components::Spinner::SpinnerHelper
19
+
20
+ include General::Components::Table::TableHelper
21
+ include General::Components::Table::TbodyHelper
22
+ include General::Components::Table::TdHelper
23
+ include General::Components::Table::TfootHelper
24
+ include General::Components::Table::ThHelper
25
+ include General::Components::Table::TheadHelper
26
+ include General::Components::Table::TrHelper
27
+
28
+ include General::Components::Tag::TagHelper
29
+ include General::Components::Tooltip::TooltipHelper
30
+
31
+ # General Form Components
32
+ include General::Components::Input::Checkbox::CheckboxHelper
33
+ include General::Components::Input::Datetime::DatetimeHelper
34
+ include General::Components::Input::Radio::RadioHelper
35
+ include General::Components::Input::RadioGroup::RadioGroupHelper
36
+ include General::Components::Input::Select::SelectHelper
37
+ include General::Components::Input::Text::TextHelper
38
+ include General::Components::Input::Textarea::TextareaHelper
39
+
40
+ # Application Components
41
+ include Application::Components::Main::MainHelper
42
+ include Application::Components::Navbar::NavbarHelper
43
+ include Application::Components::Sidebar::SidebarHelper
44
+ include Application::Components::Card::CardHelper
182
45
  end
183
46
  end
@@ -0,0 +1,57 @@
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
@@ -0,0 +1,29 @@
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
@@ -0,0 +1,53 @@
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
@@ -0,0 +1,37 @@
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
@@ -0,0 +1,65 @@
1
+ module BetterUi
2
+ module General
3
+ module Components
4
+ module Button
5
+ module ButtonHelper
6
+ # Helper per renderizzare un bottone
7
+ #
8
+ # @param label [String] Testo del bottone
9
+ # @param type [Symbol] Tipo 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
+ label: nil,
27
+ type: :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
+ label: label,
45
+ type: type,
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
@@ -0,0 +1,60 @@
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
@@ -0,0 +1,63 @@
1
+ module BetterUi
2
+ module General
3
+ module Components
4
+ module Divider
5
+ module DividerHelper
6
+ # Genera un divider usando BetterUi::General::Divider::Component
7
+ #
8
+ # @param theme [Symbol] tema del divider (:default, :white, etc.)
9
+ # @param orientation [Symbol] orientamento del divider (:horizontal, :vertical)
10
+ # @param style [Symbol] stile della linea (:solid, :dashed, :dotted, :double)
11
+ # @param size [Symbol] dimensione della linea (:thin, :medium, :thick)
12
+ # @param label [String] testo opzionale da mostrare al centro del divider
13
+ # @param height [String] altezza per divider verticale (es. "100px", "100%")
14
+ # @param classes [String] classi CSS aggiuntive
15
+ # @param html_options [Hash] opzioni HTML per il container
16
+ # @return [String] HTML del divider renderizzato
17
+ #
18
+ # @example Uso base
19
+ # bui_divider
20
+ # bui_divider(theme: :blue, size: :thick)
21
+ #
22
+ # @example Con label
23
+ # bui_divider(label: "Oppure", theme: :red)
24
+ #
25
+ # @example Divider verticale
26
+ # bui_divider(orientation: :vertical, height: "100px", theme: :green)
27
+ #
28
+ # @example Con opzioni avanzate
29
+ # bui_divider(
30
+ # theme: :violet,
31
+ # orientation: :horizontal,
32
+ # style: :dashed,
33
+ # size: :medium,
34
+ # label: "Sezione",
35
+ # classes: "my-8",
36
+ # id: "main-divider"
37
+ # )
38
+ def bui_divider(
39
+ theme: :white,
40
+ orientation: :horizontal,
41
+ style: :solid,
42
+ size: :medium,
43
+ label: nil,
44
+ height: nil,
45
+ classes: nil,
46
+ **html_options
47
+ )
48
+ render BetterUi::General::Divider::Component.new(
49
+ theme: theme,
50
+ orientation: orientation,
51
+ style: style,
52
+ size: size,
53
+ label: label,
54
+ height: height,
55
+ classes: classes,
56
+ **html_options
57
+ )
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,26 @@
1
+ module BetterUi
2
+ module General
3
+ module Components
4
+ module Field
5
+ module FieldHelper
6
+ # @param label [String] Label del campo
7
+ # @param name [String] Nome del campo
8
+ # @param required [Boolean] Se il campo è obbligatorio
9
+ # @param error [String] Messaggio di errore
10
+ # @param help_text [String] Testo di aiuto
11
+ # @return [BetterUi::General::FieldComponent] Componente del campo
12
+ def bui_field(label:, name:, required: false, error: nil, help_text: nil, id: nil, &block)
13
+ render BetterUi::General::Field::Component.new(
14
+ label: label,
15
+ name: name,
16
+ required: required,
17
+ error: error,
18
+ help_text: help_text,
19
+ id: id || SecureRandom.uuid
20
+ ), &block
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end