better_ui 0.1.1 → 0.3.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/app/components/better_ui/application/sidebar/component.html.erb +53 -16
  3. data/app/components/better_ui/application/sidebar/component.rb +3 -2
  4. data/app/components/better_ui/general/accordion/component.html.erb +5 -0
  5. data/app/components/better_ui/general/accordion/component.rb +92 -0
  6. data/app/components/better_ui/general/accordion/item_component.html.erb +12 -0
  7. data/app/components/better_ui/general/accordion/item_component.rb +176 -0
  8. data/app/components/better_ui/general/button/component.html.erb +4 -4
  9. data/app/components/better_ui/general/dropdown/component.html.erb +25 -0
  10. data/app/components/better_ui/general/dropdown/component.rb +170 -0
  11. data/app/components/better_ui/general/dropdown/divider_component.html.erb +1 -0
  12. data/app/components/better_ui/general/dropdown/divider_component.rb +41 -0
  13. data/app/components/better_ui/general/dropdown/item_component.html.erb +6 -0
  14. data/app/components/better_ui/general/dropdown/item_component.rb +119 -0
  15. data/app/components/better_ui/general/modal/component.html.erb +5 -0
  16. data/app/components/better_ui/general/modal/component.rb +47 -0
  17. data/app/components/better_ui/general/modal/modal_component.html.erb +52 -0
  18. data/app/components/better_ui/general/modal/modal_component.rb +160 -0
  19. data/app/components/better_ui/general/pagination/component.html.erb +85 -0
  20. data/app/components/better_ui/general/pagination/component.rb +216 -0
  21. data/app/components/better_ui/general/tabs/component.html.erb +11 -0
  22. data/app/components/better_ui/general/tabs/component.rb +120 -0
  23. data/app/components/better_ui/general/tabs/panel_component.html.erb +3 -0
  24. data/app/components/better_ui/general/tabs/panel_component.rb +37 -0
  25. data/app/components/better_ui/general/tabs/tab_component.html.erb +13 -0
  26. data/app/components/better_ui/general/tabs/tab_component.rb +111 -0
  27. data/app/helpers/better_ui/application_helper.rb +12 -3
  28. data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +73 -0
  29. data/app/helpers/better_ui/general/components/accordion.rb +11 -0
  30. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +32 -0
  31. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +79 -0
  32. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +62 -0
  33. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +85 -0
  34. data/app/helpers/better_ui/general/components/modal.rb +11 -0
  35. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +82 -0
  36. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +62 -0
  37. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +55 -0
  38. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +95 -0
  39. data/lib/better_ui/version.rb +1 -1
  40. metadata +35 -2
@@ -0,0 +1,79 @@
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 classes [String] Classi CSS aggiuntive
18
+ # @param options [Hash] Attributi HTML aggiuntivi
19
+ # @param block [Proc] Il contenuto del menu dropdown
20
+ #
21
+ # @return [String] Il markup HTML del componente dropdown
22
+ #
23
+ # @example Uso base
24
+ # <%= bui_dropdown(trigger: "Azioni") do %>
25
+ # <%= bui_dropdown_item(text: "Modifica") %>
26
+ # <% end %>
27
+ #
28
+ # @example Con posizione e tema
29
+ # <%= bui_dropdown(trigger: "Menu", position: :top, theme: :blue) do %>
30
+ # <%= bui_dropdown_item(text: "Profilo", icon: "user") %>
31
+ # <%= bui_dropdown_divider %>
32
+ # <%= bui_dropdown_item(text: "Logout", icon: "logout") %>
33
+ # <% end %>
34
+ #
35
+ # @example Con dimensioni e stile
36
+ # <%= bui_dropdown(trigger: "Opzioni", size: :large, rounded: :full, animation: :slide) do %>
37
+ # <%= bui_dropdown_item(text: "Impostazioni", icon: "cog") %>
38
+ # <% end %>
39
+ #
40
+ # @example Con link e azioni
41
+ # <%= bui_dropdown(trigger: "Utente", theme: :green) do %>
42
+ # <%= bui_dropdown_item(text: "Dashboard", href: "/dashboard") %>
43
+ # <%= bui_dropdown_item(text: "Profilo", href: "/profile") %>
44
+ # <%= bui_dropdown_divider %>
45
+ # <%= bui_dropdown_item(text: "Elimina", theme: :red, icon: "trash") %>
46
+ # <% end %>
47
+ #
48
+ # @example Con attributi HTML personalizzati
49
+ # <%= bui_dropdown(trigger: "Menu", id: "main-menu", data: { controller: "dropdown" }) do %>
50
+ # <%= bui_dropdown_item(text: "Item 1") %>
51
+ # <% end %>
52
+ #
53
+ def bui_dropdown(
54
+ trigger:,
55
+ position: :bottom,
56
+ theme: :default,
57
+ size: :medium,
58
+ rounded: :medium,
59
+ animation: :fade,
60
+ classes: '',
61
+ **options,
62
+ &block
63
+ )
64
+ render BetterUi::General::Dropdown::Component.new(
65
+ trigger: trigger,
66
+ position: position,
67
+ theme: theme,
68
+ size: size,
69
+ rounded: rounded,
70
+ animation: animation,
71
+ classes: classes,
72
+ **options
73
+ ), &block
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,62 @@
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(text: "Modifica") %>
24
+ #
25
+ # @example Con icona
26
+ # <%= bui_dropdown_item(text: "Elimina", icon: "trash") %>
27
+ #
28
+ # @example Come link
29
+ # <%= bui_dropdown_item(text: "Profilo", href: "/profile", icon: "user") %>
30
+ #
31
+ # @example Con tema colorato
32
+ # <%= bui_dropdown_item(text: "Azione pericolosa", theme: :red, icon: "trash") %>
33
+ #
34
+ # @example Disabilitato
35
+ # <%= bui_dropdown_item(text: "Non disponibile", disabled: true) %>
36
+ #
37
+ def bui_dropdown_item(
38
+ text:,
39
+ icon: nil,
40
+ href: nil,
41
+ theme: :default,
42
+ disabled: false,
43
+ active: false,
44
+ classes: '',
45
+ **options
46
+ )
47
+ render BetterUi::General::Dropdown::ItemComponent.new(
48
+ text: text,
49
+ icon: icon,
50
+ href: href,
51
+ theme: theme,
52
+ disabled: disabled,
53
+ active: active,
54
+ classes: classes,
55
+ **options
56
+ )
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,85 @@
1
+ module BetterUi
2
+ module General
3
+ module Components
4
+ module Modal
5
+ module ModalHelper
6
+ # Helper per renderizzare un modal con trigger e contenuto
7
+ #
8
+ # @param close_on_backdrop [Boolean] Se chiudere il modal cliccando sul backdrop
9
+ # @param close_on_escape [Boolean] Se chiudere il modal premendo Escape
10
+ # @param lock_scroll [Boolean] Se bloccare lo scroll del body quando il modal è aperto
11
+ # @param classes [String] Classi CSS aggiuntive per il contenitore
12
+ # @param html_options [Hash] Attributi HTML aggiuntivi
13
+ #
14
+ # @option theme [Symbol] :default (default) Header con sfondo grigio chiaro
15
+ # @option theme [Symbol] :white Header con sfondo bianco
16
+ # @option theme [Symbol] :red Header con sfondo rosso chiaro
17
+ # @option theme [Symbol] :rose Header con sfondo rosa chiaro
18
+ # @option theme [Symbol] :orange Header con sfondo arancione chiaro
19
+ # @option theme [Symbol] :green Header con sfondo verde chiaro
20
+ # @option theme [Symbol] :blue Header con sfondo blu chiaro
21
+ # @option theme [Symbol] :yellow Header con sfondo giallo chiaro
22
+ # @option theme [Symbol] :violet Header con sfondo violetto chiaro
23
+ #
24
+ # @option size [Symbol] :small (max-w-sm) Modal piccolo
25
+ # @option size [Symbol] :medium (max-w-md, default) Modal medio
26
+ # @option size [Symbol] :large (max-w-2xl) Modal grande
27
+ #
28
+ # @option rounded [Symbol] :none (rounded-none) Nessun border radius
29
+ # @option rounded [Symbol] :small (rounded-md) Border radius piccolo
30
+ # @option rounded [Symbol] :medium (rounded-lg, default) Border radius medio
31
+ # @option rounded [Symbol] :large (rounded-xl) Border radius grande
32
+ # @option rounded [Symbol] :full (rounded-full) Border radius completo
33
+ #
34
+ # @return [String] HTML del modal
35
+ #
36
+ # @example Utilizzo base con button trigger
37
+ # <%= bui_modal do |modal| %>
38
+ # <% modal.with_trigger(label: "Apri Modal", as: :button, type: :primary) %>
39
+ # <% modal.with_modal(title: "Conferma azione") do %>
40
+ # <p>Sei sicuro di voler continuare?</p>
41
+ # <% end %>
42
+ # <% end %>
43
+ #
44
+ # @example Con link trigger
45
+ # <%= bui_modal do |modal| %>
46
+ # <% modal.with_trigger(label: "Visualizza dettagli", as: :link, variant: :underline) %>
47
+ # <% modal.with_modal(title: "Dettagli elemento", theme: :blue, size: :large) do %>
48
+ # <p>Informazioni dettagliate sull'elemento selezionato.</p>
49
+ # <% end %>
50
+ # <% end %>
51
+ #
52
+ # @example Modal con configurazione avanzata
53
+ # <%= bui_modal(close_on_backdrop: false, lock_scroll: false) do |modal| %>
54
+ # <% modal.with_trigger(label: "Elimina", as: :button, type: :red, size: :small) %>
55
+ # <% modal.with_modal(title: "Elimina elemento", theme: :red, backdrop: true, closable: true) do %>
56
+ # <p>Sei sicuro di voler eliminare questo elemento?</p>
57
+ # <p class="text-sm text-gray-600 mt-2">Questa azione non può essere annullata.</p>
58
+ #
59
+ # <div class="flex justify-end space-x-3 mt-6">
60
+ # <%= bui_button(label: "Annulla", type: :white, size: :medium) %>
61
+ # <%= bui_button(label: "Elimina", type: :red, size: :medium) %>
62
+ # </div>
63
+ # <% end %>
64
+ # <% end %>
65
+ def bui_modal(
66
+ close_on_backdrop: true,
67
+ close_on_escape: true,
68
+ lock_scroll: true,
69
+ classes: nil,
70
+ **html_options,
71
+ &block
72
+ )
73
+ render BetterUi::General::Modal::Component.new(
74
+ close_on_backdrop: close_on_backdrop,
75
+ close_on_escape: close_on_escape,
76
+ lock_scroll: lock_scroll,
77
+ classes: classes,
78
+ **html_options
79
+ ), &block
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BetterUi
4
+ module General
5
+ module Components
6
+ module Modal
7
+ include BetterUi::General::Components::Modal::ModalHelper
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,82 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BetterUi
4
+ module General
5
+ module Components
6
+ module Pagination
7
+ module PaginationHelper
8
+ # Genera un componente di navigazione paginata per liste e tabelle
9
+ #
10
+ # @param current_page [Integer] La pagina corrente (1-indexed)
11
+ # @param total_pages [Integer] Il numero totale di pagine
12
+ # @param path [String] L'URL base per costruire i link di paginazione
13
+ # @param theme [Symbol] Il tema del componente (:default, :blue, :red, :green, :yellow, :violet, :orange, :rose, :white)
14
+ # @param size [Symbol] La dimensione del componente (:small, :medium, :large)
15
+ # @param window [Integer] Il numero di pagine da mostrare intorno alla pagina corrente (default: 2)
16
+ # @param show_info [Boolean] Se mostrare le informazioni sui risultati (default: false)
17
+ # @param per_page [Integer] Il numero di elementi per pagina (richiesto se show_info è true)
18
+ # @param classes [String] Classi CSS aggiuntive
19
+ # @param form [FormBuilder, nil] Form builder per l'integrazione con Rails form (opzionale)
20
+ # @param options [Hash] Attributi HTML aggiuntivi
21
+ # @return [String] Il markup HTML del componente pagination
22
+ #
23
+ # @example Uso base standalone
24
+ # <%= bui_pagination(current_page: 3, total_pages: 10, path: '/products') %>
25
+ #
26
+ # @example Con tema e dimensione personalizzati
27
+ # <%= bui_pagination(
28
+ # current_page: 5,
29
+ # total_pages: 20,
30
+ # path: '/articles',
31
+ # theme: :blue,
32
+ # size: :large
33
+ # ) %>
34
+ #
35
+ # @example Con informazioni sui risultati
36
+ # <%= bui_pagination(
37
+ # current_page: 2,
38
+ # total_pages: 8,
39
+ # path: '/users',
40
+ # show_info: true,
41
+ # per_page: 25,
42
+ # theme: :green
43
+ # ) %>
44
+ #
45
+ # @example Con finestra di pagine personalizzata
46
+ # <%= bui_pagination(
47
+ # current_page: 10,
48
+ # total_pages: 50,
49
+ # path: '/orders',
50
+ # window: 3,
51
+ # size: :small
52
+ # ) %>
53
+ #
54
+ # @example Con attributi HTML aggiuntivi
55
+ # <%= bui_pagination(
56
+ # current_page: 1,
57
+ # total_pages: 5,
58
+ # path: '/dashboard',
59
+ # classes: 'my-4',
60
+ # data: { turbo_frame: 'content' }
61
+ # ) %>
62
+ def bui_pagination(current_page:, total_pages:, path:, theme: :default, size: :medium,
63
+ window: 2, show_info: false, per_page: nil, classes: '',
64
+ form: nil, **options)
65
+ render BetterUi::General::Pagination::Component.new(
66
+ current_page: current_page,
67
+ total_pages: total_pages,
68
+ path: path,
69
+ theme: theme,
70
+ size: size,
71
+ window: window,
72
+ show_info: show_info,
73
+ per_page: per_page,
74
+ classes: classes,
75
+ **options
76
+ )
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BetterUi
4
+ module General
5
+ module Components
6
+ module Tabs
7
+ module PanelHelper
8
+ # Crea un pannello di contenuto associato a una tab
9
+ #
10
+ # @param id [String] l'identificatore univoco del pannello (deve corrispondere al target della tab)
11
+ # @param active [Boolean] se questo pannello è attualmente visibile
12
+ # @param classes [String] classi CSS aggiuntive da applicare al pannello
13
+ # @param options [Hash] attributi HTML aggiuntivi da applicare all'elemento
14
+ # @param block [Proc] il contenuto del pannello
15
+ # @return [String] l'HTML del pannello
16
+ #
17
+ # @example Uso base
18
+ # <%= bui_tab_panel(id: "generale", active: true) do %>
19
+ # <h3>Impostazioni Generali</h3>
20
+ # <p>Contenuto del pannello generale...</p>
21
+ # <% end %>
22
+ #
23
+ # @example Pannello nascosto
24
+ # <%= bui_tab_panel(id: "sicurezza") do %>
25
+ # <h3>Sicurezza</h3>
26
+ # <p>Contenuto del pannello sicurezza...</p>
27
+ # <% end %>
28
+ #
29
+ # @example Con classi personalizzate
30
+ # <%= bui_tab_panel(id: "notifiche", classes: "p-6 bg-gray-50") do %>
31
+ # <h3>Notifiche</h3>
32
+ # <p>Contenuto del pannello notifiche...</p>
33
+ # <% end %>
34
+ #
35
+ # @example Con attributi personalizzati
36
+ # <%= bui_tab_panel(id: "dashboard", data: { testid: "dashboard-panel" }) do %>
37
+ # <div class="grid grid-cols-2 gap-4">
38
+ # <div>Statistiche</div>
39
+ # <div>Grafici</div>
40
+ # </div>
41
+ # <% end %>
42
+ #
43
+ # @example Con form Rails
44
+ # <%= bui_tab_panel(id: "profile") do %>
45
+ # <%= form_with model: @user do |form| %>
46
+ # <%= form.text_field :name, class: "form-input" %>
47
+ # <%= form.submit "Salva", class: "btn btn-primary" %>
48
+ # <% end %>
49
+ # <% end %>
50
+ def bui_tab_panel(id:, active: false, classes: '', **options, &block)
51
+ render BetterUi::General::Tabs::PanelComponent.new(
52
+ id: id,
53
+ active: active,
54
+ classes: classes,
55
+ **options
56
+ ), &block
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BetterUi
4
+ module General
5
+ module Components
6
+ module Tabs
7
+ module TabHelper
8
+ # Crea una singola tab all'interno di un container tabs
9
+ #
10
+ # @param text [String] il testo da visualizzare nella tab
11
+ # @param target [String] l'ID del pannello associato a questa tab
12
+ # @param active [Boolean] se questa tab è attualmente attiva
13
+ # @param icon [String] il nome dell'icona opzionale da visualizzare
14
+ # @param disabled [Boolean] se questa tab è disabilitata
15
+ # @param badge [String] il testo/numero del badge opzionale
16
+ # @param theme [Symbol] il tema di colore della tab (:default, :blue, :red, :green, :yellow, :violet, :orange, :rose, :white)
17
+ # @param size [Symbol] la dimensione della tab (:small, :medium, :large)
18
+ # @param classes [String] classi CSS aggiuntive da applicare alla tab
19
+ # @param options [Hash] attributi HTML aggiuntivi da applicare all'elemento
20
+ # @return [String] l'HTML della tab
21
+ #
22
+ # @example Uso base
23
+ # <%= bui_tab(text: "Generale", target: "generale", active: true) %>
24
+ #
25
+ # @example Con icona e badge
26
+ # <%= bui_tab(text: "Messaggi", target: "messages", icon: "envelope", badge: "3") %>
27
+ #
28
+ # @example Tab disabilitata
29
+ # <%= bui_tab(text: "Premium", target: "premium", disabled: true, icon: "star") %>
30
+ #
31
+ # @example Con temi personalizzati
32
+ # <%= bui_tab(text: "Errori", target: "errors", theme: :red, badge: "12") %>
33
+ #
34
+ # @example Con attributi personalizzati
35
+ # <%= bui_tab(text: "Settings", target: "settings", classes: "font-bold", data: { testid: "settings-tab" }) %>
36
+ def bui_tab(text:, target:, active: false, icon: nil, disabled: false, badge: nil,
37
+ theme: :default, size: :medium, classes: '', **options)
38
+ render BetterUi::General::Tabs::TabComponent.new(
39
+ text: text,
40
+ target: target,
41
+ active: active,
42
+ icon: icon,
43
+ disabled: disabled,
44
+ badge: badge,
45
+ theme: theme,
46
+ size: size,
47
+ classes: classes,
48
+ **options
49
+ )
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BetterUi
4
+ module General
5
+ module Components
6
+ module Tabs
7
+ module TabsHelper
8
+ # Crea un sistema completo di tabs con navigazione e panel inclusi
9
+ #
10
+ # @param variant [Symbol] lo stile delle tabs (:pills, :underline, :bordered, :minimal)
11
+ # @param theme [Symbol] il tema di colore delle tabs (:default, :blue, :red, :green, :yellow, :violet, :orange, :rose, :white)
12
+ # @param size [Symbol] la dimensione delle tabs (:small, :medium, :large)
13
+ # @param orientation [Symbol] l'orientamento delle tabs (:horizontal, :vertical)
14
+ # @param navigation_classes [String] classi CSS aggiuntive per la navigazione
15
+ # @param panels_classes [String] classi CSS aggiuntive per i panel (default: 'mt-4')
16
+ # @param options [Hash] attributi HTML aggiuntivi da applicare all'elemento wrapper
17
+ # @param block [Proc] il contenuto che definisce navigation e panels tramite slots
18
+ # @return [String] l'HTML completo del sistema tabs
19
+ #
20
+ # @example Uso base con slots
21
+ # <%= bui_tabs do |tabs| %>
22
+ # <% tabs.with_navigation do %>
23
+ # <%= bui_tab(text: "Tab 1", target: "tab1", active: true) %>
24
+ # <%= bui_tab(text: "Tab 2", target: "tab2") %>
25
+ # <% end %>
26
+ # <% tabs.with_panels do %>
27
+ # <%= bui_tab_panel(id: "tab1", active: true) do %>
28
+ # Contenuto del primo pannello
29
+ # <% end %>
30
+ # <%= bui_tab_panel(id: "tab2") do %>
31
+ # Contenuto del secondo pannello
32
+ # <% end %>
33
+ # <% end %>
34
+ # <% end %>
35
+ #
36
+ # @example Con temi e dimensioni
37
+ # <%= bui_tabs(variant: :underline, theme: :blue, size: :large) do |tabs| %>
38
+ # <% tabs.with_navigation do %>
39
+ # <%= bui_tab(text: "Dashboard", target: "dashboard", active: true, icon: "chart-bar") %>
40
+ # <%= bui_tab(text: "Impostazioni", target: "settings", icon: "cog-6-tooth") %>
41
+ # <% end %>
42
+ # <% tabs.with_panels do %>
43
+ # <%= bui_tab_panel(id: "dashboard", active: true) do %>
44
+ # Dashboard content...
45
+ # <% end %>
46
+ # <%= bui_tab_panel(id: "settings") do %>
47
+ # Settings content...
48
+ # <% end %>
49
+ # <% end %>
50
+ # <% end %>
51
+ #
52
+ # @example Tabs verticali
53
+ # <%= bui_tabs(orientation: :vertical, variant: :pills) do |tabs| %>
54
+ # <% tabs.with_navigation do %>
55
+ # <%= bui_tab(text: "Profilo", target: "profile", active: true) %>
56
+ # <%= bui_tab(text: "Account", target: "account") %>
57
+ # <% end %>
58
+ # <% tabs.with_panels do %>
59
+ # <%= bui_tab_panel(id: "profile", active: true) do %>
60
+ # Informazioni profilo...
61
+ # <% end %>
62
+ # <%= bui_tab_panel(id: "account") do %>
63
+ # Impostazioni account...
64
+ # <% end %>
65
+ # <% end %>
66
+ # <% end %>
67
+ #
68
+ # @example Con classi personalizzate
69
+ # <%= bui_tabs(navigation_classes: "border-b-2", panels_classes: "p-6 bg-gray-50") do |tabs| %>
70
+ # <% tabs.with_navigation do %>
71
+ # <%= bui_tab(text: "Home", target: "home", active: true) %>
72
+ # <% end %>
73
+ # <% tabs.with_panels do %>
74
+ # <%= bui_tab_panel(id: "home", active: true) do %>
75
+ # Home content with custom styling...
76
+ # <% end %>
77
+ # <% end %>
78
+ # <% end %>
79
+ def bui_tabs(variant: :pills, theme: :default, size: :medium, orientation: :horizontal,
80
+ navigation_classes: '', panels_classes: 'mt-4', **options, &block)
81
+ render BetterUi::General::Tabs::Component.new(
82
+ variant: variant,
83
+ theme: theme,
84
+ size: size,
85
+ orientation: orientation,
86
+ navigation_classes: navigation_classes,
87
+ panels_classes: panels_classes,
88
+ **options
89
+ ), &block
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
@@ -1,3 +1,3 @@
1
1
  module BetterUi
2
- VERSION = "0.1.1"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alessiobussolari
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-06-01 00:00:00.000000000 Z
12
+ date: 2025-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -117,6 +117,10 @@ files:
117
117
  - app/components/better_ui/application/navbar/component.rb
118
118
  - app/components/better_ui/application/sidebar/component.html.erb
119
119
  - app/components/better_ui/application/sidebar/component.rb
120
+ - app/components/better_ui/general/accordion/component.html.erb
121
+ - app/components/better_ui/general/accordion/component.rb
122
+ - app/components/better_ui/general/accordion/item_component.html.erb
123
+ - app/components/better_ui/general/accordion/item_component.rb
120
124
  - app/components/better_ui/general/alert/component.html.erb
121
125
  - app/components/better_ui/general/alert/component.rb
122
126
  - app/components/better_ui/general/avatar/component.html.erb
@@ -129,6 +133,12 @@ files:
129
133
  - app/components/better_ui/general/button/component.rb
130
134
  - app/components/better_ui/general/divider/component.html.erb
131
135
  - app/components/better_ui/general/divider/component.rb
136
+ - app/components/better_ui/general/dropdown/component.html.erb
137
+ - app/components/better_ui/general/dropdown/component.rb
138
+ - app/components/better_ui/general/dropdown/divider_component.html.erb
139
+ - app/components/better_ui/general/dropdown/divider_component.rb
140
+ - app/components/better_ui/general/dropdown/item_component.html.erb
141
+ - app/components/better_ui/general/dropdown/item_component.rb
132
142
  - app/components/better_ui/general/field/component.html.erb
133
143
  - app/components/better_ui/general/field/component.rb
134
144
  - app/components/better_ui/general/heading/component.html.erb
@@ -151,6 +161,12 @@ files:
151
161
  - app/components/better_ui/general/input/textarea/component.rb
152
162
  - app/components/better_ui/general/link/component.html.erb
153
163
  - app/components/better_ui/general/link/component.rb
164
+ - app/components/better_ui/general/modal/component.html.erb
165
+ - app/components/better_ui/general/modal/component.rb
166
+ - app/components/better_ui/general/modal/modal_component.html.erb
167
+ - app/components/better_ui/general/modal/modal_component.rb
168
+ - app/components/better_ui/general/pagination/component.html.erb
169
+ - app/components/better_ui/general/pagination/component.rb
154
170
  - app/components/better_ui/general/panel/component.html.erb
155
171
  - app/components/better_ui/general/panel/component.rb
156
172
  - app/components/better_ui/general/progress/component.html.erb
@@ -171,6 +187,12 @@ files:
171
187
  - app/components/better_ui/general/table/thead_component.rb
172
188
  - app/components/better_ui/general/table/tr_component.html.erb
173
189
  - app/components/better_ui/general/table/tr_component.rb
190
+ - app/components/better_ui/general/tabs/component.html.erb
191
+ - app/components/better_ui/general/tabs/component.rb
192
+ - app/components/better_ui/general/tabs/panel_component.html.erb
193
+ - app/components/better_ui/general/tabs/panel_component.rb
194
+ - app/components/better_ui/general/tabs/tab_component.html.erb
195
+ - app/components/better_ui/general/tabs/tab_component.rb
174
196
  - app/components/better_ui/general/tag/component.html.erb
175
197
  - app/components/better_ui/general/tag/component.rb
176
198
  - app/components/better_ui/general/tooltip/component.html.erb
@@ -182,6 +204,8 @@ files:
182
204
  - app/helpers/better_ui/application/components/navbar/navbar_helper.rb
183
205
  - app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb
184
206
  - app/helpers/better_ui/application_helper.rb
207
+ - app/helpers/better_ui/general/components/accordion.rb
208
+ - app/helpers/better_ui/general/components/accordion/accordion_helper.rb
185
209
  - app/helpers/better_ui/general/components/alert/alert_helper.rb
186
210
  - app/helpers/better_ui/general/components/avatar/avatar_helper.rb
187
211
  - app/helpers/better_ui/general/components/badge/badge_helper.rb
@@ -189,6 +213,9 @@ files:
189
213
  - app/helpers/better_ui/general/components/button/button_helper.rb
190
214
  - app/helpers/better_ui/general/components/container/container_helper.rb
191
215
  - app/helpers/better_ui/general/components/divider/divider_helper.rb
216
+ - app/helpers/better_ui/general/components/dropdown/divider_helper.rb
217
+ - app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb
218
+ - app/helpers/better_ui/general/components/dropdown/item_helper.rb
192
219
  - app/helpers/better_ui/general/components/field/field_helper.rb
193
220
  - app/helpers/better_ui/general/components/heading/heading_helper.rb
194
221
  - app/helpers/better_ui/general/components/icon/icon_helper.rb
@@ -200,6 +227,9 @@ files:
200
227
  - app/helpers/better_ui/general/components/input/text/text_helper.rb
201
228
  - app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb
202
229
  - app/helpers/better_ui/general/components/link/link_helper.rb
230
+ - app/helpers/better_ui/general/components/modal.rb
231
+ - app/helpers/better_ui/general/components/modal/modal_helper.rb
232
+ - app/helpers/better_ui/general/components/pagination/pagination_helper.rb
203
233
  - app/helpers/better_ui/general/components/panel/panel_helper.rb
204
234
  - app/helpers/better_ui/general/components/progress/progress_helper.rb
205
235
  - app/helpers/better_ui/general/components/spinner/spinner_helper.rb
@@ -210,6 +240,9 @@ files:
210
240
  - app/helpers/better_ui/general/components/table/th_helper.rb
211
241
  - app/helpers/better_ui/general/components/table/thead_helper.rb
212
242
  - app/helpers/better_ui/general/components/table/tr_helper.rb
243
+ - app/helpers/better_ui/general/components/tabs/panel_helper.rb
244
+ - app/helpers/better_ui/general/components/tabs/tab_helper.rb
245
+ - app/helpers/better_ui/general/components/tabs/tabs_helper.rb
213
246
  - app/helpers/better_ui/general/components/tag/tag_helper.rb
214
247
  - app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb
215
248
  - app/jobs/better_ui/application_job.rb