better_ui 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +225 -119
  4. data/app/assets/stylesheets/better_ui/application.css +0 -356
  5. data/app/components/better_ui/application/card/component.html.erb +20 -0
  6. data/app/components/better_ui/application/card/component.rb +214 -0
  7. data/app/components/better_ui/application/main/component.html.erb +9 -0
  8. data/app/components/better_ui/application/main/component.rb +123 -0
  9. data/app/components/better_ui/application/navbar/component.html.erb +92 -0
  10. data/app/components/better_ui/application/navbar/component.rb +136 -0
  11. data/app/components/better_ui/application/sidebar/component.html.erb +190 -0
  12. data/app/components/better_ui/application/sidebar/component.rb +129 -0
  13. data/app/components/better_ui/general/alert/component.html.erb +32 -0
  14. data/app/components/better_ui/general/alert/component.rb +242 -0
  15. data/app/components/better_ui/general/avatar/component.html.erb +20 -0
  16. data/app/components/better_ui/general/avatar/component.rb +301 -0
  17. data/app/components/better_ui/general/badge/component.html.erb +23 -0
  18. data/app/components/better_ui/general/badge/component.rb +248 -0
  19. data/app/components/better_ui/general/breadcrumb/component.html.erb +15 -0
  20. data/app/components/better_ui/general/breadcrumb/component.rb +187 -0
  21. data/app/components/better_ui/general/button/component.html.erb +34 -0
  22. data/app/components/better_ui/general/button/component.rb +214 -0
  23. data/app/components/better_ui/general/divider/component.html.erb +10 -0
  24. data/app/components/better_ui/general/divider/component.rb +226 -0
  25. data/app/components/better_ui/general/dropdown/component.html.erb +14 -0
  26. data/app/components/better_ui/general/dropdown/component.rb +219 -0
  27. data/app/components/better_ui/general/dropdown/divider_component.html.erb +1 -0
  28. data/app/components/better_ui/general/dropdown/divider_component.rb +41 -0
  29. data/app/components/better_ui/general/dropdown/item_component.html.erb +6 -0
  30. data/app/components/better_ui/general/dropdown/item_component.rb +118 -0
  31. data/app/components/better_ui/general/field/component.html.erb +27 -0
  32. data/app/components/better_ui/general/field/component.rb +37 -0
  33. data/app/components/better_ui/general/heading/component.html.erb +22 -0
  34. data/app/components/better_ui/general/heading/component.rb +257 -0
  35. data/app/components/better_ui/general/icon/component.html.erb +7 -0
  36. data/app/components/better_ui/general/icon/component.rb +239 -0
  37. data/app/components/better_ui/general/input/checkbox/component.html.erb +5 -0
  38. data/app/components/better_ui/general/input/checkbox/component.rb +238 -0
  39. data/app/components/better_ui/general/input/datetime/component.html.erb +5 -0
  40. data/app/components/better_ui/general/input/datetime/component.rb +223 -0
  41. data/app/components/better_ui/general/input/radio/component.html.erb +5 -0
  42. data/app/components/better_ui/general/input/radio/component.rb +230 -0
  43. data/app/components/better_ui/general/input/select/component.html.erb +16 -0
  44. data/app/components/better_ui/general/input/select/component.rb +184 -0
  45. data/app/components/better_ui/general/input/select/select_component.html.erb +5 -0
  46. data/app/components/better_ui/general/input/select/select_component.rb +37 -0
  47. data/app/components/better_ui/general/input/text/component.html.erb +5 -0
  48. data/app/components/better_ui/general/input/text/component.rb +171 -0
  49. data/app/components/better_ui/general/input/textarea/component.html.erb +5 -0
  50. data/app/components/better_ui/general/input/textarea/component.rb +166 -0
  51. data/app/components/better_ui/general/link/component.html.erb +18 -0
  52. data/app/components/better_ui/general/link/component.rb +258 -0
  53. data/app/components/better_ui/general/modal/component.html.erb +42 -0
  54. data/app/components/better_ui/general/modal/component.rb +165 -0
  55. data/app/components/better_ui/general/pagination/component.html.erb +85 -0
  56. data/app/components/better_ui/general/pagination/component.rb +216 -0
  57. data/app/components/better_ui/general/panel/component.html.erb +28 -0
  58. data/app/components/better_ui/general/panel/component.rb +249 -0
  59. data/app/components/better_ui/general/progress/component.html.erb +11 -0
  60. data/app/components/better_ui/general/progress/component.rb +160 -0
  61. data/app/components/better_ui/general/spinner/component.html.erb +35 -0
  62. data/app/components/better_ui/general/spinner/component.rb +93 -0
  63. data/app/components/better_ui/general/table/component.html.erb +5 -0
  64. data/app/components/better_ui/general/table/component.rb +217 -0
  65. data/app/components/better_ui/general/table/tbody_component.html.erb +3 -0
  66. data/app/components/better_ui/general/table/tbody_component.rb +30 -0
  67. data/app/components/better_ui/general/table/td_component.html.erb +3 -0
  68. data/app/components/better_ui/general/table/td_component.rb +44 -0
  69. data/app/components/better_ui/general/table/tfoot_component.html.erb +3 -0
  70. data/app/components/better_ui/general/table/tfoot_component.rb +28 -0
  71. data/app/components/better_ui/general/table/th_component.html.erb +6 -0
  72. data/app/components/better_ui/general/table/th_component.rb +51 -0
  73. data/app/components/better_ui/general/table/thead_component.html.erb +3 -0
  74. data/app/components/better_ui/general/table/thead_component.rb +28 -0
  75. data/app/components/better_ui/general/table/tr_component.html.erb +3 -0
  76. data/app/components/better_ui/general/table/tr_component.rb +30 -0
  77. data/app/components/better_ui/general/tabs/component.html.erb +3 -0
  78. data/app/components/better_ui/general/tabs/component.rb +102 -0
  79. data/app/components/better_ui/general/tabs/panel_component.html.erb +3 -0
  80. data/app/components/better_ui/general/tabs/panel_component.rb +37 -0
  81. data/app/components/better_ui/general/tabs/tab_component.html.erb +13 -0
  82. data/app/components/better_ui/general/tabs/tab_component.rb +111 -0
  83. data/app/components/better_ui/general/tag/component.html.erb +3 -0
  84. data/app/components/better_ui/general/tag/component.rb +104 -0
  85. data/app/components/better_ui/general/tooltip/component.html.erb +7 -0
  86. data/app/components/better_ui/general/tooltip/component.rb +239 -0
  87. data/app/helpers/better_ui/application/components/card/card_helper.rb +96 -0
  88. data/app/helpers/better_ui/application/components/card.rb +11 -0
  89. data/app/helpers/better_ui/application/components/main/main_helper.rb +64 -0
  90. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +77 -0
  91. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +51 -0
  92. data/app/helpers/better_ui/application_helper.rb +51 -179
  93. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +57 -0
  94. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +29 -0
  95. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +53 -0
  96. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +37 -0
  97. data/app/helpers/better_ui/general/components/button/button_helper.rb +65 -0
  98. data/app/helpers/better_ui/general/components/container/container_helper.rb +60 -0
  99. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +63 -0
  100. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +32 -0
  101. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +79 -0
  102. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +62 -0
  103. data/app/helpers/better_ui/general/components/field/field_helper.rb +26 -0
  104. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +72 -0
  105. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +16 -0
  106. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +81 -0
  107. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +91 -0
  108. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +79 -0
  109. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +124 -0
  110. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +70 -0
  111. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +138 -0
  112. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +73 -0
  113. data/app/helpers/better_ui/general/components/link/link_helper.rb +89 -0
  114. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +95 -0
  115. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +82 -0
  116. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +83 -0
  117. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +53 -0
  118. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +19 -0
  119. data/app/helpers/better_ui/general/components/table/table_helper.rb +53 -0
  120. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +13 -0
  121. data/app/helpers/better_ui/general/components/table/td_helper.rb +19 -0
  122. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +13 -0
  123. data/app/helpers/better_ui/general/components/table/th_helper.rb +19 -0
  124. data/app/helpers/better_ui/general/components/table/thead_helper.rb +13 -0
  125. data/app/helpers/better_ui/general/components/table/tr_helper.rb +13 -0
  126. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +62 -0
  127. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +55 -0
  128. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +62 -0
  129. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +26 -0
  130. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +60 -0
  131. data/app/views/layouts/better_ui/application.html.erb +6 -124
  132. data/config/initializers/lookbook.rb +23 -0
  133. data/config/routes.rb +0 -8
  134. data/lib/better_ui/engine.rb +5 -19
  135. data/lib/better_ui/railtie.rb +20 -0
  136. data/lib/better_ui/version.rb +1 -1
  137. data/lib/better_ui.rb +4 -20
  138. metadata +155 -28
  139. data/app/controllers/better_ui/docs_controller.rb +0 -41
  140. data/app/views/better_ui/docs/component.html.erb +0 -365
  141. data/app/views/better_ui/docs/index.html.erb +0 -100
  142. data/app/views/better_ui/docs/show.html.erb +0 -60
@@ -0,0 +1,77 @@
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
@@ -0,0 +1,51 @@
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,183 +1,55 @@
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::Dropdown::DropdownHelper
14
+ include General::Components::Dropdown::ItemHelper
15
+ include General::Components::Dropdown::DividerHelper
16
+ include General::Components::Heading::HeadingHelper
17
+ include General::Components::Icon::IconHelper
18
+ include General::Components::Link::LinkHelper
19
+ include General::Components::Modal::ModalHelper
20
+ include General::Components::Pagination::PaginationHelper
21
+ include General::Components::Panel::PanelHelper
22
+ include General::Components::Progress::ProgressHelper
23
+ include General::Components::Spinner::SpinnerHelper
24
+
25
+ include General::Components::Table::TableHelper
26
+ include General::Components::Table::TbodyHelper
27
+ include General::Components::Table::TdHelper
28
+ include General::Components::Table::TfootHelper
29
+ include General::Components::Table::ThHelper
30
+ include General::Components::Table::TheadHelper
31
+ include General::Components::Table::TrHelper
32
+
33
+ include General::Components::Tag::TagHelper
34
+ include General::Components::Tabs::TabsHelper
35
+ include General::Components::Tabs::TabHelper
36
+
37
+ include General::Components::Tabs::PanelHelper
38
+ include General::Components::Tooltip::TooltipHelper
39
+
40
+ # General Form Components
41
+ include General::Components::Input::Checkbox::CheckboxHelper
42
+ include General::Components::Input::Datetime::DatetimeHelper
43
+ include General::Components::Input::Radio::RadioHelper
44
+ include General::Components::Input::RadioGroup::RadioGroupHelper
45
+ include General::Components::Input::Select::SelectHelper
46
+ include General::Components::Input::Text::TextHelper
47
+ include General::Components::Input::Textarea::TextareaHelper
48
+
49
+ # Application Components
50
+ include Application::Components::Main::MainHelper
51
+ include Application::Components::Navbar::NavbarHelper
52
+ include Application::Components::Sidebar::SidebarHelper
53
+ include Application::Components::Card::CardHelper
182
54
  end
183
55
  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