better_ui 0.6.0 → 0.7.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 +4 -4
- data/README.md +257 -212
- data/Rakefile +11 -2
- data/app/components/better_ui/action_messages_component/action_messages_component.html.erb +48 -0
- data/app/components/better_ui/action_messages_component.rb +544 -0
- data/app/components/better_ui/application_component.rb +66 -0
- data/app/components/better_ui/button_component/button_component.html.erb +31 -0
- data/app/components/better_ui/button_component.rb +307 -0
- data/app/components/better_ui/card_component/card_component.html.erb +17 -0
- data/app/components/better_ui/card_component.rb +460 -0
- data/app/components/better_ui/drawer/header_component/header_component.html.erb +24 -0
- data/app/components/better_ui/drawer/header_component.rb +238 -0
- data/app/components/better_ui/drawer/layout_component/layout_component.html.erb +44 -0
- data/app/components/better_ui/drawer/layout_component.rb +270 -0
- data/app/components/better_ui/drawer/nav_group_component/nav_group_component.html.erb +10 -0
- data/app/components/better_ui/drawer/nav_group_component.rb +155 -0
- data/app/components/better_ui/drawer/nav_item_component/nav_item_component.html.erb +13 -0
- data/app/components/better_ui/drawer/nav_item_component.rb +225 -0
- data/app/components/better_ui/drawer/sidebar_component/sidebar_component.html.erb +17 -0
- data/app/components/better_ui/drawer/sidebar_component.rb +263 -0
- data/app/components/better_ui/forms/base_component.rb +450 -0
- data/app/components/better_ui/forms/checkbox_component/checkbox_component.html.erb +28 -0
- data/app/components/better_ui/forms/checkbox_component.rb +419 -0
- data/app/components/better_ui/forms/checkbox_group_component/checkbox_group_component.html.erb +40 -0
- data/app/components/better_ui/forms/checkbox_group_component.rb +363 -0
- data/app/components/better_ui/forms/number_input_component/number_input_component.html.erb +40 -0
- data/app/components/better_ui/forms/number_input_component.rb +320 -0
- data/app/components/better_ui/forms/password_input_component/password_input_component.html.erb +71 -0
- data/app/components/better_ui/forms/password_input_component.rb +206 -0
- data/app/components/better_ui/forms/text_input_component/text_input_component.html.erb +40 -0
- data/app/components/better_ui/forms/text_input_component.rb +258 -0
- data/app/components/better_ui/forms/textarea_component/textarea_component.html.erb +40 -0
- data/app/components/better_ui/forms/textarea_component.rb +329 -0
- data/app/form_builders/better_ui/ui_form_builder.rb +467 -0
- data/app/helpers/better_ui/application_helper.rb +325 -58
- data/app/views/layouts/better_ui/application.html.erb +1 -1
- data/config/routes.rb +1 -0
- data/lib/better_ui/engine.rb +34 -5
- data/lib/better_ui/version.rb +1 -1
- data/lib/better_ui.rb +32 -5
- data/lib/generators/better_ui/install/USAGE +44 -0
- data/lib/generators/better_ui/install/install_generator.rb +87 -0
- data/lib/generators/better_ui/install/templates/better_ui_theme.css.tt +280 -0
- data/lib/tasks/better_ui_tasks.rake +39 -4
- metadata +55 -203
- data/app/components/better_ui/application/card/component.html.erb +0 -20
- data/app/components/better_ui/application/card/component.rb +0 -214
- data/app/components/better_ui/application/main/component.html.erb +0 -9
- data/app/components/better_ui/application/main/component.rb +0 -123
- data/app/components/better_ui/application/navbar/component.html.erb +0 -92
- data/app/components/better_ui/application/navbar/component.rb +0 -136
- data/app/components/better_ui/application/sidebar/component.html.erb +0 -249
- data/app/components/better_ui/application/sidebar/component.rb +0 -187
- data/app/components/better_ui/general/accordion/component.html.erb +0 -5
- data/app/components/better_ui/general/accordion/component.rb +0 -92
- data/app/components/better_ui/general/accordion/item_component.html.erb +0 -12
- data/app/components/better_ui/general/accordion/item_component.rb +0 -176
- data/app/components/better_ui/general/alert/component.html.erb +0 -32
- data/app/components/better_ui/general/alert/component.rb +0 -242
- data/app/components/better_ui/general/avatar/component.html.erb +0 -20
- data/app/components/better_ui/general/avatar/component.rb +0 -301
- data/app/components/better_ui/general/badge/component.html.erb +0 -23
- data/app/components/better_ui/general/badge/component.rb +0 -248
- data/app/components/better_ui/general/breadcrumb/component.html.erb +0 -15
- data/app/components/better_ui/general/breadcrumb/component.rb +0 -187
- data/app/components/better_ui/general/button/component.html.erb +0 -34
- data/app/components/better_ui/general/button/component.rb +0 -214
- data/app/components/better_ui/general/divider/component.html.erb +0 -10
- data/app/components/better_ui/general/divider/component.rb +0 -226
- data/app/components/better_ui/general/dropdown/component.html.erb +0 -28
- data/app/components/better_ui/general/dropdown/component.rb +0 -192
- data/app/components/better_ui/general/dropdown/divider_component.html.erb +0 -1
- data/app/components/better_ui/general/dropdown/divider_component.rb +0 -41
- data/app/components/better_ui/general/dropdown/item_component.html.erb +0 -6
- data/app/components/better_ui/general/dropdown/item_component.rb +0 -119
- data/app/components/better_ui/general/field/component.html.erb +0 -27
- data/app/components/better_ui/general/field/component.rb +0 -37
- data/app/components/better_ui/general/grid/cell_component.html.erb +0 -3
- data/app/components/better_ui/general/grid/cell_component.rb +0 -390
- data/app/components/better_ui/general/grid/component.html.erb +0 -3
- data/app/components/better_ui/general/grid/component.rb +0 -301
- data/app/components/better_ui/general/heading/component.html.erb +0 -22
- data/app/components/better_ui/general/heading/component.rb +0 -257
- data/app/components/better_ui/general/icon/component.html.erb +0 -7
- data/app/components/better_ui/general/icon/component.rb +0 -240
- data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
- data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
- data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
- data/app/components/better_ui/general/input/datetime/component.rb +0 -223
- data/app/components/better_ui/general/input/pin/component.html.erb +0 -1
- data/app/components/better_ui/general/input/pin/component.rb +0 -201
- data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
- data/app/components/better_ui/general/input/radio/component.rb +0 -230
- data/app/components/better_ui/general/input/rating/component.html.erb +0 -4
- data/app/components/better_ui/general/input/rating/component.rb +0 -272
- data/app/components/better_ui/general/input/select/component.html.erb +0 -78
- data/app/components/better_ui/general/input/select/component.rb +0 -249
- data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
- data/app/components/better_ui/general/input/select/select_component.rb +0 -37
- data/app/components/better_ui/general/input/text/component.html.erb +0 -5
- data/app/components/better_ui/general/input/text/component.rb +0 -171
- data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
- data/app/components/better_ui/general/input/textarea/component.rb +0 -166
- data/app/components/better_ui/general/input/toggle/component.html.erb +0 -5
- data/app/components/better_ui/general/input/toggle/component.rb +0 -242
- data/app/components/better_ui/general/link/component.html.erb +0 -18
- data/app/components/better_ui/general/link/component.rb +0 -258
- data/app/components/better_ui/general/modal/component.html.erb +0 -5
- data/app/components/better_ui/general/modal/component.rb +0 -47
- data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
- data/app/components/better_ui/general/modal/modal_component.rb +0 -160
- data/app/components/better_ui/general/pagination/component.html.erb +0 -85
- data/app/components/better_ui/general/pagination/component.rb +0 -216
- data/app/components/better_ui/general/panel/component.html.erb +0 -28
- data/app/components/better_ui/general/panel/component.rb +0 -249
- data/app/components/better_ui/general/progress/component.html.erb +0 -11
- data/app/components/better_ui/general/progress/component.rb +0 -160
- data/app/components/better_ui/general/spinner/component.html.erb +0 -35
- data/app/components/better_ui/general/spinner/component.rb +0 -93
- data/app/components/better_ui/general/table/component.html.erb +0 -5
- data/app/components/better_ui/general/table/component.rb +0 -217
- data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tbody_component.rb +0 -30
- data/app/components/better_ui/general/table/td_component.html.erb +0 -3
- data/app/components/better_ui/general/table/td_component.rb +0 -44
- data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
- data/app/components/better_ui/general/table/th_component.html.erb +0 -6
- data/app/components/better_ui/general/table/th_component.rb +0 -51
- data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
- data/app/components/better_ui/general/table/thead_component.rb +0 -28
- data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tr_component.rb +0 -30
- data/app/components/better_ui/general/tabs/component.html.erb +0 -11
- data/app/components/better_ui/general/tabs/component.rb +0 -120
- data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
- data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
- data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
- data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
- data/app/components/better_ui/general/tag/component.html.erb +0 -3
- data/app/components/better_ui/general/tag/component.rb +0 -104
- data/app/components/better_ui/general/text/component.html.erb +0 -1
- data/app/components/better_ui/general/text/component.rb +0 -194
- data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
- data/app/components/better_ui/general/tooltip/component.rb +0 -239
- data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
- data/app/helpers/better_ui/application/components/card.rb +0 -11
- data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
- data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
- data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
- data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
- data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
- data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
- data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
- data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
- data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
- data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
- data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
- data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -88
- data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -68
- data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
- data/app/helpers/better_ui/general/components/grid/grid_helper.rb +0 -145
- data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
- data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
- data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
- data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
- data/app/helpers/better_ui/general/components/input/pin/pin_helper.rb +0 -76
- data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
- data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
- data/app/helpers/better_ui/general/components/input/rating/rating_helper.rb +0 -70
- data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -86
- data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
- data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
- data/app/helpers/better_ui/general/components/input/toggle/toggle_helper.rb +0 -77
- data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
- data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
- data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
- data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
- data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
- data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
- data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
- data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
- data/app/helpers/better_ui/general/components/text/text_helper.rb +0 -83
- data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
- data/app/jobs/better_ui/application_job.rb +0 -4
- data/app/mailers/better_ui/application_mailer.rb +0 -6
- data/config/initializers/lookbook.rb +0 -23
- data/lib/better_ui/railtie.rb +0 -20
|
@@ -1,63 +0,0 @@
|
|
|
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
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BetterUi
|
|
4
|
-
module General
|
|
5
|
-
module Components
|
|
6
|
-
module Dropdown
|
|
7
|
-
module DividerHelper
|
|
8
|
-
##
|
|
9
|
-
# Crea un divisore per separare gruppi di elementi nel menu dropdown.
|
|
10
|
-
#
|
|
11
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
12
|
-
# @param options [Hash] Attributi HTML aggiuntivi
|
|
13
|
-
#
|
|
14
|
-
# @return [String] Il markup HTML del divisore dropdown
|
|
15
|
-
#
|
|
16
|
-
# @example Uso base
|
|
17
|
-
# <%= bui_dropdown_divider %>
|
|
18
|
-
#
|
|
19
|
-
# @example Con classi personalizzate
|
|
20
|
-
# <%= bui_dropdown_divider(classes: "my-4") %>
|
|
21
|
-
#
|
|
22
|
-
def bui_dropdown_divider(classes: '', **options)
|
|
23
|
-
render BetterUi::General::Dropdown::DividerComponent.new(
|
|
24
|
-
classes: classes,
|
|
25
|
-
**options
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BetterUi
|
|
4
|
-
module General
|
|
5
|
-
module Components
|
|
6
|
-
module Dropdown
|
|
7
|
-
module DropdownHelper
|
|
8
|
-
##
|
|
9
|
-
# Crea un componente dropdown interattivo con menu contestuale.
|
|
10
|
-
#
|
|
11
|
-
# @param trigger [String] Il testo del pulsante trigger (obbligatorio)
|
|
12
|
-
# @param position [Symbol] La posizione del menu dropdown (:bottom, :top, :left, :right)
|
|
13
|
-
# @param theme [Symbol] Il tema colore del trigger (:default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet)
|
|
14
|
-
# @param size [Symbol] La dimensione del trigger (:small, :medium, :large)
|
|
15
|
-
# @param rounded [Symbol] Il border radius (:none, :small, :medium, :large, :full)
|
|
16
|
-
# @param animation [Symbol] Il tipo di animazione (:fade, :slide, :none)
|
|
17
|
-
# @param fullwidth [Boolean] Se il trigger deve occupare tutta la larghezza disponibile
|
|
18
|
-
# @param show_chevron [Boolean] Se mostrare l'icona chevron automatica
|
|
19
|
-
# @param selectable [Boolean] Se il dropdown deve aggiornare il trigger con la selezione
|
|
20
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
21
|
-
# @param options [Hash] Attributi HTML aggiuntivi
|
|
22
|
-
# @param block [Proc] Il contenuto del menu dropdown
|
|
23
|
-
#
|
|
24
|
-
# @return [String] Il markup HTML del componente dropdown
|
|
25
|
-
#
|
|
26
|
-
# @example Uso base
|
|
27
|
-
# <%= bui_dropdown(trigger: "Azioni") do %>
|
|
28
|
-
# <%= bui_dropdown_item(text: "Modifica") %>
|
|
29
|
-
# <% end %>
|
|
30
|
-
#
|
|
31
|
-
# @example Con posizione e tema
|
|
32
|
-
# <%= bui_dropdown(trigger: "Menu", position: :top, theme: :blue) do %>
|
|
33
|
-
# <%= bui_dropdown_item(text: "Profilo", icon: "user") %>
|
|
34
|
-
# <%= bui_dropdown_divider %>
|
|
35
|
-
# <%= bui_dropdown_item(text: "Logout", icon: "logout") %>
|
|
36
|
-
# <% end %>
|
|
37
|
-
#
|
|
38
|
-
# @example Con dimensioni e stile
|
|
39
|
-
# <%= bui_dropdown(trigger: "Opzioni", size: :large, rounded: :full, animation: :slide) do %>
|
|
40
|
-
# <%= bui_dropdown_item(text: "Impostazioni", icon: "cog") %>
|
|
41
|
-
# <% end %>
|
|
42
|
-
#
|
|
43
|
-
# @example Con link e azioni
|
|
44
|
-
# <%= bui_dropdown(trigger: "Utente", theme: :green) do %>
|
|
45
|
-
# <%= bui_dropdown_item(text: "Dashboard", href: "/dashboard") %>
|
|
46
|
-
# <%= bui_dropdown_item(text: "Profilo", href: "/profile") %>
|
|
47
|
-
# <%= bui_dropdown_divider %>
|
|
48
|
-
# <%= bui_dropdown_item(text: "Elimina", theme: :red, icon: "trash") %>
|
|
49
|
-
# <% end %>
|
|
50
|
-
#
|
|
51
|
-
# @example Con attributi HTML personalizzati
|
|
52
|
-
# <%= bui_dropdown(trigger: "Menu", id: "main-menu", data: { controller: "dropdown" }) do %>
|
|
53
|
-
# <%= bui_dropdown_item(text: "Item 1") %>
|
|
54
|
-
# <% end %>
|
|
55
|
-
#
|
|
56
|
-
def bui_dropdown(
|
|
57
|
-
trigger:,
|
|
58
|
-
position: :bottom,
|
|
59
|
-
theme: :default,
|
|
60
|
-
size: :medium,
|
|
61
|
-
rounded: :medium,
|
|
62
|
-
animation: :fade,
|
|
63
|
-
fullwidth: false,
|
|
64
|
-
show_chevron: true,
|
|
65
|
-
selectable: false,
|
|
66
|
-
classes: '',
|
|
67
|
-
**options,
|
|
68
|
-
&block
|
|
69
|
-
)
|
|
70
|
-
render BetterUi::General::Dropdown::Component.new(
|
|
71
|
-
trigger: trigger,
|
|
72
|
-
position: position,
|
|
73
|
-
theme: theme,
|
|
74
|
-
size: size,
|
|
75
|
-
rounded: rounded,
|
|
76
|
-
animation: animation,
|
|
77
|
-
fullwidth: fullwidth,
|
|
78
|
-
show_chevron: show_chevron,
|
|
79
|
-
selectable: selectable,
|
|
80
|
-
classes: classes,
|
|
81
|
-
**options
|
|
82
|
-
), &block
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
end
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BetterUi
|
|
4
|
-
module General
|
|
5
|
-
module Components
|
|
6
|
-
module Dropdown
|
|
7
|
-
module ItemHelper
|
|
8
|
-
##
|
|
9
|
-
# Crea un elemento del menu dropdown.
|
|
10
|
-
#
|
|
11
|
-
# @param text [String] Il testo dell'elemento (obbligatorio)
|
|
12
|
-
# @param icon [String] Il nome dell'icona da mostrare ("edit", "trash", "share", "user", "cog", "logout")
|
|
13
|
-
# @param href [String] L'URL per renderlo un link
|
|
14
|
-
# @param theme [Symbol] Il tema colore (:default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet)
|
|
15
|
-
# @param disabled [Boolean] Se l'elemento è disabilitato
|
|
16
|
-
# @param active [Boolean] Se l'elemento è attivo/selezionato
|
|
17
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
18
|
-
# @param options [Hash] Attributi HTML aggiuntivi
|
|
19
|
-
#
|
|
20
|
-
# @return [String] Il markup HTML dell'elemento dropdown
|
|
21
|
-
#
|
|
22
|
-
# @example Uso base
|
|
23
|
-
# <%= bui_dropdown_item("Modifica") %>
|
|
24
|
-
#
|
|
25
|
-
# @example Con icona
|
|
26
|
-
# <%= bui_dropdown_item("Elimina", icon: "trash") %>
|
|
27
|
-
#
|
|
28
|
-
# @example Come link
|
|
29
|
-
# <%= bui_dropdown_item("Profilo", href: "/profile", icon: "user") %>
|
|
30
|
-
#
|
|
31
|
-
# @example Con tema colorato
|
|
32
|
-
# <%= bui_dropdown_item("Azione pericolosa", theme: :red, icon: "trash") %>
|
|
33
|
-
#
|
|
34
|
-
# @example Disabilitato
|
|
35
|
-
# <%= bui_dropdown_item("Non disponibile", disabled: true) %>
|
|
36
|
-
#
|
|
37
|
-
# @example Uso con sintassi keyword (backward compatible)
|
|
38
|
-
# <%= bui_dropdown_item(text: "Modifica legacy") %>
|
|
39
|
-
#
|
|
40
|
-
def bui_dropdown_item(
|
|
41
|
-
text = nil,
|
|
42
|
-
icon: nil,
|
|
43
|
-
href: nil,
|
|
44
|
-
theme: :default,
|
|
45
|
-
disabled: false,
|
|
46
|
-
active: false,
|
|
47
|
-
classes: '',
|
|
48
|
-
**options
|
|
49
|
-
)
|
|
50
|
-
# Supporta sia sintassi posizionale che keyword per backward compatibility
|
|
51
|
-
item_text = text || options.delete(:text)
|
|
52
|
-
|
|
53
|
-
render BetterUi::General::Dropdown::ItemComponent.new(
|
|
54
|
-
text: item_text,
|
|
55
|
-
icon: icon,
|
|
56
|
-
href: href,
|
|
57
|
-
theme: theme,
|
|
58
|
-
disabled: disabled,
|
|
59
|
-
active: active,
|
|
60
|
-
classes: classes,
|
|
61
|
-
**options
|
|
62
|
-
)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
end
|
|
68
|
-
end
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module General
|
|
3
|
-
module Components
|
|
4
|
-
module Field
|
|
5
|
-
module FieldHelper
|
|
6
|
-
# @param text [String] Testo della label (argomento posizionale)
|
|
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(text = nil, name:, required: false, error: nil, help_text: nil, id: nil, &block)
|
|
13
|
-
render BetterUi::General::Field::Component.new(
|
|
14
|
-
text: text,
|
|
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
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BetterUi
|
|
4
|
-
module General
|
|
5
|
-
module Components
|
|
6
|
-
module Grid
|
|
7
|
-
module GridHelper
|
|
8
|
-
# Helper per creare un contenitore grid CSS
|
|
9
|
-
#
|
|
10
|
-
# @param cols [Integer, Hash] Numero colonne (1-12, :auto, :none) o hash responsive {sm: 1, md: 2, lg: 3, xl: 4}
|
|
11
|
-
# @param rows [Integer, Hash, nil] Numero righe (1-6, :auto, :none) o hash responsive
|
|
12
|
-
# @param gap [Symbol, Hash] Spaziatura (:none, :small, :medium, :large) o hash responsive
|
|
13
|
-
# @param flow [Symbol] Direzione flusso (:row, :col, :row_dense, :col_dense)
|
|
14
|
-
# @param align_items [Symbol, nil] Allineamento verticale (:start, :center, :end, :stretch)
|
|
15
|
-
# @param justify_items [Symbol, nil] Allineamento orizzontale (:start, :center, :end, :stretch)
|
|
16
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
17
|
-
# @param id [String, nil] ID elemento
|
|
18
|
-
# @param options [Hash] Attributi HTML aggiuntivi
|
|
19
|
-
# @param block [Proc] Blocco contenente le celle grid
|
|
20
|
-
#
|
|
21
|
-
# @return [String] HTML del grid container
|
|
22
|
-
#
|
|
23
|
-
# @example Uso base
|
|
24
|
-
# <%= bui_grid(cols: 3, gap: :medium) do %>
|
|
25
|
-
# <%= content %>
|
|
26
|
-
# <% end %>
|
|
27
|
-
#
|
|
28
|
-
# @example Con responsive
|
|
29
|
-
# <%= bui_grid(cols: {sm: 1, md: 2, lg: 3, xl: 4}, gap: :large) do %>
|
|
30
|
-
# <%= content %>
|
|
31
|
-
# <% end %>
|
|
32
|
-
#
|
|
33
|
-
# @example Con righe e allineamento
|
|
34
|
-
# <%= bui_grid(cols: 2, rows: 3, gap: :medium, align_items: :center) do %>
|
|
35
|
-
# <%= content %>
|
|
36
|
-
# <% end %>
|
|
37
|
-
#
|
|
38
|
-
# @example Con flow e justify
|
|
39
|
-
# <%= bui_grid(cols: 4, flow: :col, justify_items: :center) do %>
|
|
40
|
-
# <%= content %>
|
|
41
|
-
# <% end %>
|
|
42
|
-
#
|
|
43
|
-
# @example Con attributi HTML aggiuntivi
|
|
44
|
-
# <%= bui_grid(cols: 3, id: "main-grid", data: {testid: "grid"}) do %>
|
|
45
|
-
# <%= content %>
|
|
46
|
-
# <% end %>
|
|
47
|
-
def bui_grid(
|
|
48
|
-
cols: 1,
|
|
49
|
-
rows: nil,
|
|
50
|
-
gap: :medium,
|
|
51
|
-
flow: :row,
|
|
52
|
-
align_items: nil,
|
|
53
|
-
justify_items: nil,
|
|
54
|
-
classes: '',
|
|
55
|
-
id: nil,
|
|
56
|
-
**options,
|
|
57
|
-
&block
|
|
58
|
-
)
|
|
59
|
-
render BetterUi::General::Grid::Component.new(
|
|
60
|
-
cols: cols,
|
|
61
|
-
rows: rows,
|
|
62
|
-
gap: gap,
|
|
63
|
-
flow: flow,
|
|
64
|
-
align_items: align_items,
|
|
65
|
-
justify_items: justify_items,
|
|
66
|
-
classes: classes,
|
|
67
|
-
id: id,
|
|
68
|
-
**options
|
|
69
|
-
), &block
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
# Helper per creare una cella grid con controllo posizionamento
|
|
73
|
-
#
|
|
74
|
-
# @param col [Integer, Hash, nil] Span colonne (1-12, :auto, :full) o hash responsive {sm: 1, md: 2, lg: 3}
|
|
75
|
-
# @param row [Integer, Hash, nil] Span righe (1-6, :auto, :full) o hash responsive
|
|
76
|
-
# @param col_start [Integer, Hash, nil] Posizione inizio colonna (1-13, :auto) o hash responsive
|
|
77
|
-
# @param col_end [Integer, Hash, nil] Posizione fine colonna (1-13, :auto) o hash responsive
|
|
78
|
-
# @param row_start [Integer, Hash, nil] Posizione inizio riga (1-7, :auto) o hash responsive
|
|
79
|
-
# @param row_end [Integer, Hash, nil] Posizione fine riga (1-7, :auto) o hash responsive
|
|
80
|
-
# @param justify_self [Symbol, nil] Allineamento orizzontale cella (:auto, :start, :center, :end, :stretch)
|
|
81
|
-
# @param align_self [Symbol, nil] Allineamento verticale cella (:auto, :start, :center, :end, :stretch)
|
|
82
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
83
|
-
# @param id [String, nil] ID elemento
|
|
84
|
-
# @param options [Hash] Attributi HTML aggiuntivi
|
|
85
|
-
# @param block [Proc] Blocco contenente il contenuto della cella
|
|
86
|
-
#
|
|
87
|
-
# @return [String] HTML della grid cell
|
|
88
|
-
#
|
|
89
|
-
# @example Uso base
|
|
90
|
-
# <%= bui_grid_cell do %>
|
|
91
|
-
# <div>Contenuto cella</div>
|
|
92
|
-
# <% end %>
|
|
93
|
-
#
|
|
94
|
-
# @example Con span colonne
|
|
95
|
-
# <%= bui_grid_cell(col: 2) do %>
|
|
96
|
-
# <div>Cella che occupa 2 colonne</div>
|
|
97
|
-
# <% end %>
|
|
98
|
-
#
|
|
99
|
-
# @example Con responsive
|
|
100
|
-
# <%= bui_grid_cell(col: {sm: 1, md: 2, lg: 3}) do %>
|
|
101
|
-
# <div>Cella responsive</div>
|
|
102
|
-
# <% end %>
|
|
103
|
-
#
|
|
104
|
-
# @example Con posizionamento specifico
|
|
105
|
-
# <%= bui_grid_cell(col_start: 2, col_end: 4) do %>
|
|
106
|
-
# <div>Cella dalla colonna 2 alla 4</div>
|
|
107
|
-
# <% end %>
|
|
108
|
-
#
|
|
109
|
-
# @example Con allineamento
|
|
110
|
-
# <%= bui_grid_cell(col: 2, justify_self: :center, align_self: :start) do %>
|
|
111
|
-
# <div>Cella centrata orizzontalmente</div>
|
|
112
|
-
# <% end %>
|
|
113
|
-
def bui_grid_cell(
|
|
114
|
-
col: nil,
|
|
115
|
-
row: nil,
|
|
116
|
-
col_start: nil,
|
|
117
|
-
col_end: nil,
|
|
118
|
-
row_start: nil,
|
|
119
|
-
row_end: nil,
|
|
120
|
-
justify_self: nil,
|
|
121
|
-
align_self: nil,
|
|
122
|
-
classes: '',
|
|
123
|
-
id: nil,
|
|
124
|
-
**options,
|
|
125
|
-
&block
|
|
126
|
-
)
|
|
127
|
-
render BetterUi::General::Grid::CellComponent.new(
|
|
128
|
-
col: col,
|
|
129
|
-
row: row,
|
|
130
|
-
col_start: col_start,
|
|
131
|
-
col_end: col_end,
|
|
132
|
-
row_start: row_start,
|
|
133
|
-
row_end: row_end,
|
|
134
|
-
justify_self: justify_self,
|
|
135
|
-
align_self: align_self,
|
|
136
|
-
classes: classes,
|
|
137
|
-
id: id,
|
|
138
|
-
**options
|
|
139
|
-
), &block
|
|
140
|
-
end
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
end
|
|
@@ -1,72 +0,0 @@
|
|
|
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
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BetterUi
|
|
4
|
-
module General
|
|
5
|
-
module Components
|
|
6
|
-
module Input
|
|
7
|
-
module Checkbox
|
|
8
|
-
module CheckboxHelper
|
|
9
|
-
# Renderizza un componente Checkbox con tutti i parametri disponibili.
|
|
10
|
-
#
|
|
11
|
-
# @param name [String] Nome del campo checkbox (obbligatorio)
|
|
12
|
-
# @param value [String] Valore del checkbox (default: "1")
|
|
13
|
-
# @param checked [Boolean] Se il checkbox è selezionato
|
|
14
|
-
# @param required [Boolean] Se il campo è obbligatorio
|
|
15
|
-
# @param disabled [Boolean] Se il campo è disabilitato
|
|
16
|
-
# @param indeterminate [Boolean] Se il checkbox è in stato indeterminate
|
|
17
|
-
# @param label [String, nil] Testo della label associata al checkbox
|
|
18
|
-
# @param label_position [Symbol] Posizione della label (:left, :right)
|
|
19
|
-
# @param theme [Symbol] Tema del componente (:default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet)
|
|
20
|
-
# @param size [Symbol] Dimensione del componente (:small, :medium, :large)
|
|
21
|
-
# @param rounded [Symbol] Border radius (:none, :small, :medium, :large, :full)
|
|
22
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
23
|
-
# @param form [ActionView::Helpers::FormBuilder, nil] Form builder Rails opzionale
|
|
24
|
-
# @param options [Hash] Opzioni aggiuntive per l'input (es. data attributes, aria attributes)
|
|
25
|
-
#
|
|
26
|
-
# @return [String] HTML del componente Checkbox renderizzato
|
|
27
|
-
#
|
|
28
|
-
# @example Uso base
|
|
29
|
-
# <%= bui_input_checkbox(name: 'accept_terms') %>
|
|
30
|
-
#
|
|
31
|
-
# @example Con label
|
|
32
|
-
# <%= bui_input_checkbox(name: 'newsletter', label: 'Iscriviti alla newsletter', checked: true) %>
|
|
33
|
-
#
|
|
34
|
-
# @example Con label a sinistra
|
|
35
|
-
# <%= bui_input_checkbox(name: 'terms', label: 'Accetto i termini e condizioni', label_position: :left, required: true) %>
|
|
36
|
-
#
|
|
37
|
-
# @example Con tema e dimensione personalizzati
|
|
38
|
-
# <%= bui_input_checkbox(name: 'important', label: 'Importante', theme: :green, size: :large) %>
|
|
39
|
-
#
|
|
40
|
-
# @example Con border radius personalizzato
|
|
41
|
-
# <%= bui_input_checkbox(name: 'rounded_option', label: 'Opzione arrotondata', rounded: :full) %>
|
|
42
|
-
#
|
|
43
|
-
# @example Con classi aggiuntive
|
|
44
|
-
# <%= bui_input_checkbox(name: 'custom', label: 'Campo personalizzato', classes: 'mb-4', checked: true) %>
|
|
45
|
-
#
|
|
46
|
-
# @example Con attributi HTML aggiuntivi
|
|
47
|
-
# <%= bui_input_checkbox(name: 'data-field', label: 'Campo obbligatorio', 'data-validation': 'required', 'aria-describedby': 'help-text') %>
|
|
48
|
-
#
|
|
49
|
-
# @example Con Rails form builder
|
|
50
|
-
# <%= form_with model: @user do |form| %>
|
|
51
|
-
# <%= bui_input_checkbox(name: :terms_accepted, label: 'Accetto i termini', form: form, theme: :green, required: true) %>
|
|
52
|
-
# <% end %>
|
|
53
|
-
#
|
|
54
|
-
# @example Stato indeterminate
|
|
55
|
-
# <%= bui_input_checkbox(name: 'partial_selection', label: 'Selezione parziale', indeterminate: true, theme: :blue) %>
|
|
56
|
-
def bui_input_checkbox(name:, value: '1', checked: false, required: false, disabled: false,
|
|
57
|
-
indeterminate: false, label: nil, label_position: :right, theme: :default,
|
|
58
|
-
size: :medium, rounded: :medium, classes: '', form: nil, **options)
|
|
59
|
-
render BetterUi::General::Input::Checkbox::Component.new(
|
|
60
|
-
name: name,
|
|
61
|
-
value: value,
|
|
62
|
-
checked: checked,
|
|
63
|
-
required: required,
|
|
64
|
-
disabled: disabled,
|
|
65
|
-
indeterminate: indeterminate,
|
|
66
|
-
label: label,
|
|
67
|
-
label_position: label_position,
|
|
68
|
-
theme: theme,
|
|
69
|
-
size: size,
|
|
70
|
-
rounded: rounded,
|
|
71
|
-
classes: classes,
|
|
72
|
-
form: form,
|
|
73
|
-
**options
|
|
74
|
-
)
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
end
|