better_ui_tmp 0.5.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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +211 -0
- data/Rakefile +8 -0
- data/app/assets/builds/application.js +1 -0
- data/app/assets/builds/better_ui.css +1 -0
- data/app/assets/stylesheets/better_ui.scss +3 -0
- data/app/components/better_ui/application/main/component.html.erb +5 -0
- data/app/components/better_ui/application/main/component.rb +99 -0
- data/app/components/better_ui/application/navbar/component.html.erb +219 -0
- data/app/components/better_ui/application/navbar/component.rb +148 -0
- data/app/components/better_ui/application/sidebar/component.html.erb +184 -0
- data/app/components/better_ui/application/sidebar/component.rb +129 -0
- data/app/components/better_ui/general/alert/component.html.erb +32 -0
- data/app/components/better_ui/general/alert/component.rb +242 -0
- data/app/components/better_ui/general/avatar/component.html.erb +20 -0
- data/app/components/better_ui/general/avatar/component.rb +301 -0
- data/app/components/better_ui/general/badge/component.html.erb +23 -0
- data/app/components/better_ui/general/badge/component.rb +248 -0
- data/app/components/better_ui/general/breadcrumb/component.html.erb +15 -0
- data/app/components/better_ui/general/breadcrumb/component.rb +186 -0
- data/app/components/better_ui/general/button/component.html.erb +34 -0
- data/app/components/better_ui/general/button/component.rb +214 -0
- data/app/components/better_ui/general/card/component.html.erb +21 -0
- data/app/components/better_ui/general/card/component.rb +37 -0
- data/app/components/better_ui/general/container/component.html.erb +8 -0
- data/app/components/better_ui/general/container/component.rb +158 -0
- data/app/components/better_ui/general/divider/component.html.erb +10 -0
- data/app/components/better_ui/general/divider/component.rb +226 -0
- data/app/components/better_ui/general/heading/component.html.erb +22 -0
- data/app/components/better_ui/general/heading/component.rb +257 -0
- data/app/components/better_ui/general/icon/component.html.erb +1 -0
- data/app/components/better_ui/general/icon/component.rb +222 -0
- data/app/components/better_ui/general/link/component.html.erb +18 -0
- data/app/components/better_ui/general/link/component.rb +255 -0
- data/app/components/better_ui/general/panel/component.html.erb +28 -0
- data/app/components/better_ui/general/panel/component.rb +249 -0
- data/app/components/better_ui/general/progress/component.html.erb +11 -0
- data/app/components/better_ui/general/progress/component.rb +160 -0
- data/app/components/better_ui/general/spinner/component.html.erb +35 -0
- data/app/components/better_ui/general/spinner/component.rb +93 -0
- data/app/components/better_ui/general/table/component.html.erb +5 -0
- data/app/components/better_ui/general/table/component.rb +217 -0
- data/app/components/better_ui/general/table/tbody_component.html.erb +3 -0
- data/app/components/better_ui/general/table/tbody_component.rb +30 -0
- data/app/components/better_ui/general/table/td_component.html.erb +3 -0
- data/app/components/better_ui/general/table/td_component.rb +44 -0
- data/app/components/better_ui/general/table/tfoot_component.html.erb +3 -0
- data/app/components/better_ui/general/table/tfoot_component.rb +28 -0
- data/app/components/better_ui/general/table/th_component.html.erb +6 -0
- data/app/components/better_ui/general/table/th_component.rb +51 -0
- data/app/components/better_ui/general/table/thead_component.html.erb +3 -0
- data/app/components/better_ui/general/table/thead_component.rb +28 -0
- data/app/components/better_ui/general/table/tr_component.html.erb +3 -0
- data/app/components/better_ui/general/table/tr_component.rb +30 -0
- data/app/components/better_ui/general/tag/component.html.erb +3 -0
- data/app/components/better_ui/general/tag/component.rb +104 -0
- data/app/components/better_ui/general/tooltip/component.html.erb +7 -0
- data/app/components/better_ui/general/tooltip/component.rb +239 -0
- data/app/controllers/better_ui/application_controller.rb +5 -0
- data/app/helpers/better_ui/application/components/main/main_helper.rb +42 -0
- data/app/helpers/better_ui/application/components/main.rb +13 -0
- data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +51 -0
- data/app/helpers/better_ui/application/components/navbar.rb +13 -0
- data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +51 -0
- data/app/helpers/better_ui/application/components/sidebar.rb +13 -0
- data/app/helpers/better_ui/application_helper.rb +10 -0
- data/app/helpers/better_ui/form_helper.rb +5 -0
- data/app/helpers/better_ui/general/components/alert/alert_helper.rb +29 -0
- data/app/helpers/better_ui/general/components/alert.rb +13 -0
- data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +29 -0
- data/app/helpers/better_ui/general/components/avatar.rb +13 -0
- data/app/helpers/better_ui/general/components/badge/badge_helper.rb +53 -0
- data/app/helpers/better_ui/general/components/badge.rb +13 -0
- data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +37 -0
- data/app/helpers/better_ui/general/components/breadcrumb.rb +13 -0
- data/app/helpers/better_ui/general/components/button/button_helper.rb +65 -0
- data/app/helpers/better_ui/general/components/button.rb +13 -0
- data/app/helpers/better_ui/general/components/card/card_helper.rb +37 -0
- data/app/helpers/better_ui/general/components/card.rb +13 -0
- data/app/helpers/better_ui/general/components/container/container_helper.rb +60 -0
- data/app/helpers/better_ui/general/components/container.rb +13 -0
- data/app/helpers/better_ui/general/components/divider/divider_helper.rb +63 -0
- data/app/helpers/better_ui/general/components/divider.rb +13 -0
- data/app/helpers/better_ui/general/components/heading/heading_helper.rb +72 -0
- data/app/helpers/better_ui/general/components/heading.rb +13 -0
- data/app/helpers/better_ui/general/components/icon/icon_helper.rb +16 -0
- data/app/helpers/better_ui/general/components/icon.rb +13 -0
- data/app/helpers/better_ui/general/components/link/link_helper.rb +89 -0
- data/app/helpers/better_ui/general/components/link.rb +13 -0
- data/app/helpers/better_ui/general/components/panel/panel_helper.rb +83 -0
- data/app/helpers/better_ui/general/components/panel.rb +13 -0
- data/app/helpers/better_ui/general/components/progress/progress_helper.rb +53 -0
- data/app/helpers/better_ui/general/components/progress.rb +11 -0
- data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/spinner.rb +10 -0
- data/app/helpers/better_ui/general/components/table/table_helper.rb +13 -0
- data/app/helpers/better_ui/general/components/table/tbody_helper.rb +13 -0
- data/app/helpers/better_ui/general/components/table/td_helper.rb +19 -0
- data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +13 -0
- data/app/helpers/better_ui/general/components/table/th_helper.rb +19 -0
- data/app/helpers/better_ui/general/components/table/thead_helper.rb +13 -0
- data/app/helpers/better_ui/general/components/table/tr_helper.rb +13 -0
- data/app/helpers/better_ui/general/components/table.rb +25 -0
- data/app/helpers/better_ui/general/components/tag/tag_helper.rb +26 -0
- data/app/helpers/better_ui/general/components/tag.rb +15 -0
- data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +60 -0
- data/app/helpers/better_ui/general/components/tooltip.rb +13 -0
- data/app/helpers/better_ui/general_helper.rb +24 -0
- data/app/helpers/better_ui_helper.rb +16 -0
- data/app/javascript/application.js +1 -0
- data/app/jobs/better_ui/application_job.rb +4 -0
- data/app/mailers/better_ui/application_mailer.rb +6 -0
- data/app/models/better_ui/application_record.rb +5 -0
- data/app/views/components/better_ui/general/table/_custom_body_row.html.erb +17 -0
- data/app/views/components/better_ui/general/table/_custom_footer_rows.html.erb +17 -0
- data/app/views/components/better_ui/general/table/_custom_header_rows.html.erb +12 -0
- data/app/views/layouts/component_preview.html.erb +32 -0
- data/config/initializers/lookbook.rb +23 -0
- data/config/routes.rb +3 -0
- data/lib/better_ui/engine.rb +109 -0
- data/lib/better_ui/version.rb +3 -0
- data/lib/better_ui.rb +37 -0
- data/lib/generators/better_ui/install_generator.rb +103 -0
- data/lib/generators/better_ui/stylesheet_generator.rb +159 -0
- data/lib/generators/better_ui/templates/components/_avatar.scss +200 -0
- data/lib/generators/better_ui/templates/components/_badge.scss +154 -0
- data/lib/generators/better_ui/templates/components/_breadcrumb.scss +106 -0
- data/lib/generators/better_ui/templates/components/_button.scss +109 -0
- data/lib/generators/better_ui/templates/components/_card.scss +60 -0
- data/lib/generators/better_ui/templates/components/_heading.scss +81 -0
- data/lib/generators/better_ui/templates/components/_icon.scss +134 -0
- data/lib/generators/better_ui/templates/components/_index.scss +17 -0
- data/lib/generators/better_ui/templates/components/_link.scss +100 -0
- data/lib/generators/better_ui/templates/components/_panel.scss +104 -0
- data/lib/generators/better_ui/templates/components/_spinner.scss +129 -0
- data/lib/generators/better_ui/templates/components/_table.scss +156 -0
- data/lib/generators/better_ui/templates/components/_variables.scss +0 -0
- data/lib/generators/better_ui/templates/components_stylesheet.scss +35 -0
- data/lib/generators/better_ui/templates/index.scss +18 -0
- data/lib/generators/better_ui/templates/initializer.rb +41 -0
- data/lib/tasks/better_ui_tasks.rake +4 -0
- metadata +260 -0
@@ -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 (: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,13 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Breadcrumb
|
5
|
+
# Require dell'helper breadcrumb
|
6
|
+
require_relative 'breadcrumb/breadcrumb_helper'
|
7
|
+
|
8
|
+
# Include dell'helper nel modulo Breadcrumb
|
9
|
+
include BreadcrumbHelper
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
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,37 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Card
|
5
|
+
module CardHelper
|
6
|
+
# Helper per renderizzare una card
|
7
|
+
#
|
8
|
+
# @param options [Hash] opzioni per il componente
|
9
|
+
# @option options [Symbol] :theme (:white) tema del colore (:default, :white, :red, etc.)
|
10
|
+
# @option options [Symbol] :style (:default) stile (:default, :flat, :raised, :bordered)
|
11
|
+
# @option options [Symbol] :padding (:medium) padding interno (:none, :small, :medium, :large)
|
12
|
+
# @option options [Symbol] :radius (:medium) raggio dei bordi (:none, :small, :medium, :large, :full)
|
13
|
+
# @param block [Block] blocco per il contenuto della card
|
14
|
+
# @return [String] HTML della card
|
15
|
+
|
16
|
+
|
17
|
+
def bui_card(
|
18
|
+
theme: :white,
|
19
|
+
style: :default,
|
20
|
+
padding: :medium,
|
21
|
+
radius: :medium,
|
22
|
+
**options,
|
23
|
+
&block
|
24
|
+
)
|
25
|
+
render BetterUi::General::Card::Component.new(
|
26
|
+
theme: theme,
|
27
|
+
style: style,
|
28
|
+
padding: padding,
|
29
|
+
radius: radius,
|
30
|
+
**options
|
31
|
+
), &block
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
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,72 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Heading
|
5
|
+
module HeadingHelper
|
6
|
+
# Genera un heading usando BetterUi::General::Heading::Component
|
7
|
+
#
|
8
|
+
# @param text [String] testo del heading
|
9
|
+
# @param level [Integer] livello del heading (1-6)
|
10
|
+
# @param theme [Symbol] tema del colore (:default, :white, etc.)
|
11
|
+
# @param align [Symbol] allineamento (:left, :center, :right)
|
12
|
+
# @param size [Symbol] dimensione (:small, :medium, :large)
|
13
|
+
# @param style [Symbol] stile (:normal, :bold, :italic, :underline)
|
14
|
+
# @param icon [String] icona opzionale
|
15
|
+
# @param subtitle [String] sottotitolo opzionale
|
16
|
+
# @param with_divider [Boolean] mostra linea divisoria
|
17
|
+
# @param html_options [Hash] opzioni HTML per il container
|
18
|
+
# @return [String] HTML del heading renderizzato
|
19
|
+
#
|
20
|
+
# @example Uso base
|
21
|
+
# bui_heading("Titolo principale")
|
22
|
+
# bui_heading("Sottotitolo", level: 3, theme: :blue)
|
23
|
+
#
|
24
|
+
# @example Con icona e sottotitolo
|
25
|
+
# bui_heading("Dashboard", icon: "home", subtitle: "Panoramica generale")
|
26
|
+
#
|
27
|
+
# @example Con divider
|
28
|
+
# bui_heading("Sezione", level: 2, with_divider: true, theme: :green)
|
29
|
+
#
|
30
|
+
# @example Con opzioni avanzate
|
31
|
+
# bui_heading(
|
32
|
+
# "Titolo personalizzato",
|
33
|
+
# level: 1,
|
34
|
+
# theme: :violet,
|
35
|
+
# align: :center,
|
36
|
+
# size: :large,
|
37
|
+
# style: :bold,
|
38
|
+
# icon: "star",
|
39
|
+
# subtitle: "Con tutte le opzioni",
|
40
|
+
# with_divider: true,
|
41
|
+
# id: "main-title",
|
42
|
+
# class: "custom-heading"
|
43
|
+
# )
|
44
|
+
def bui_heading(
|
45
|
+
text,
|
46
|
+
level: 2,
|
47
|
+
theme: :white,
|
48
|
+
align: :left,
|
49
|
+
size: :medium,
|
50
|
+
style: :normal,
|
51
|
+
icon: nil,
|
52
|
+
subtitle: nil,
|
53
|
+
with_divider: false,
|
54
|
+
**html_options
|
55
|
+
)
|
56
|
+
render BetterUi::General::Heading::Component.new(
|
57
|
+
level: level,
|
58
|
+
theme: theme,
|
59
|
+
align: align,
|
60
|
+
size: size,
|
61
|
+
style: style,
|
62
|
+
icon: icon,
|
63
|
+
subtitle: subtitle,
|
64
|
+
with_divider: with_divider,
|
65
|
+
**html_options
|
66
|
+
).with_content(text)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Link
|
5
|
+
module LinkHelper
|
6
|
+
# Genera un link usando BetterUi::General::Link::Component
|
7
|
+
#
|
8
|
+
# @param label [String] testo del link
|
9
|
+
# @param href [String] URL di destinazione (nil per semplice testo)
|
10
|
+
# @param theme [Symbol] tema del colore (:default, :white, etc.)
|
11
|
+
# @param orientation [Symbol] orientamento (:horizontal, :vertical)
|
12
|
+
# @param style [Symbol] stile (:default, :underline, :bold, :text)
|
13
|
+
# @param size [Symbol] dimensione (:small, :medium, :large)
|
14
|
+
# @param icon [String] icona opzionale
|
15
|
+
# @param active [Boolean] stato attivo del link
|
16
|
+
# @param disabled [Boolean] stato disabilitato del link
|
17
|
+
# @param data [Hash] attributi data
|
18
|
+
# @param method [Symbol] metodo HTTP (per Turbo)
|
19
|
+
# @param target [String] target del link
|
20
|
+
# @param html_options [Hash] opzioni HTML aggiuntive
|
21
|
+
# @return [String] HTML del link renderizzato
|
22
|
+
#
|
23
|
+
# @example Uso base
|
24
|
+
# bui_link("Home", href: "/")
|
25
|
+
# bui_link("Contatti", href: "/contact", theme: :blue)
|
26
|
+
#
|
27
|
+
# @example Con icona
|
28
|
+
# bui_link("Dashboard", href: "/admin", icon: "home", theme: :green)
|
29
|
+
#
|
30
|
+
# @example Link attivo
|
31
|
+
# bui_link("Pagina corrente", href: "/current", active: true)
|
32
|
+
#
|
33
|
+
# @example Link disabilitato (diventa span)
|
34
|
+
# bui_link("Non disponibile", disabled: true)
|
35
|
+
#
|
36
|
+
# @example Con attributi Turbo
|
37
|
+
# bui_link("Elimina", href: "/delete", method: :delete,
|
38
|
+
# data: { confirm: "Sei sicuro?" }, theme: :red)
|
39
|
+
#
|
40
|
+
# @example Con opzioni avanzate
|
41
|
+
# bui_link(
|
42
|
+
# "Link esterno",
|
43
|
+
# href: "https://example.com",
|
44
|
+
# theme: :violet,
|
45
|
+
# orientation: :vertical,
|
46
|
+
# style: :bold,
|
47
|
+
# size: :large,
|
48
|
+
# icon: "external-link",
|
49
|
+
# target: "_blank",
|
50
|
+
# id: "external-link",
|
51
|
+
# class: "custom-link"
|
52
|
+
# )
|
53
|
+
def bui_link(
|
54
|
+
label,
|
55
|
+
href: nil,
|
56
|
+
theme: :white,
|
57
|
+
orientation: :horizontal,
|
58
|
+
style: :default,
|
59
|
+
size: :medium,
|
60
|
+
icon: nil,
|
61
|
+
active: false,
|
62
|
+
disabled: false,
|
63
|
+
data: {},
|
64
|
+
method: nil,
|
65
|
+
target: nil,
|
66
|
+
**html_options,
|
67
|
+
&block
|
68
|
+
)
|
69
|
+
render BetterUi::General::Link::Component.new(
|
70
|
+
label: label,
|
71
|
+
href: href,
|
72
|
+
theme: theme,
|
73
|
+
orientation: orientation,
|
74
|
+
style: style,
|
75
|
+
size: size,
|
76
|
+
icon: icon,
|
77
|
+
active: active,
|
78
|
+
disabled: disabled,
|
79
|
+
data: data,
|
80
|
+
method: method,
|
81
|
+
target: target,
|
82
|
+
**html_options
|
83
|
+
), &block
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|