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,83 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Panel
|
5
|
+
module PanelHelper
|
6
|
+
# Genera un pannello usando BetterUi::General::Panel::Component
|
7
|
+
#
|
8
|
+
# @param title [String] titolo del pannello (opzionale)
|
9
|
+
# @param body [String] contenuto HTML del pannello (opzionale)
|
10
|
+
# @param header [String] header personalizzato (opzionale)
|
11
|
+
# @param footer [String] footer del pannello (opzionale)
|
12
|
+
# @param theme [Symbol] tema del colore (:default, :white, etc.)
|
13
|
+
# @param style [Symbol] stile (:default, :flat, :raised, :bordered)
|
14
|
+
# @param padding [Symbol] padding interno (:none, :small, :medium, :large)
|
15
|
+
# @param radius [Symbol] raggio dei bordi (:none, :small, :medium, :large, :full)
|
16
|
+
# @param html_options [Hash] opzioni HTML aggiuntive
|
17
|
+
# @return [String] HTML del pannello renderizzato
|
18
|
+
#
|
19
|
+
# @example Uso base
|
20
|
+
# bui_panel(title: "Dashboard")
|
21
|
+
# bui_panel(body: "Contenuto del pannello")
|
22
|
+
#
|
23
|
+
# @example Pannello completo
|
24
|
+
# bui_panel(
|
25
|
+
# title: "Impostazioni",
|
26
|
+
# body: "Configura le tue preferenze",
|
27
|
+
# footer: "Ultimo aggiornamento: oggi",
|
28
|
+
# theme: :blue
|
29
|
+
# )
|
30
|
+
#
|
31
|
+
# @example Con header personalizzato
|
32
|
+
# bui_panel(
|
33
|
+
# header: "<h2>Header Custom</h2>",
|
34
|
+
# body: "Il mio contenuto",
|
35
|
+
# theme: :green,
|
36
|
+
# style: :raised
|
37
|
+
# )
|
38
|
+
#
|
39
|
+
# @example Pannello con stili avanzati
|
40
|
+
# bui_panel(
|
41
|
+
# title: "Card Premium",
|
42
|
+
# body: "Contenuto speciale",
|
43
|
+
# theme: :violet,
|
44
|
+
# style: :bordered,
|
45
|
+
# padding: :large,
|
46
|
+
# radius: :large,
|
47
|
+
# id: "premium-panel",
|
48
|
+
# class: "special-panel"
|
49
|
+
# )
|
50
|
+
#
|
51
|
+
# @example Con contenuto block
|
52
|
+
# bui_panel(title: "Lista Utenti", theme: :white) do
|
53
|
+
# "<ul><li>Utente 1</li><li>Utente 2</li></ul>".html_safe
|
54
|
+
# end
|
55
|
+
def bui_panel(
|
56
|
+
title: nil,
|
57
|
+
body: nil,
|
58
|
+
header: nil,
|
59
|
+
footer: nil,
|
60
|
+
theme: :white,
|
61
|
+
style: :default,
|
62
|
+
padding: :medium,
|
63
|
+
radius: :small,
|
64
|
+
**html_options,
|
65
|
+
&block
|
66
|
+
)
|
67
|
+
render BetterUi::General::Panel::Component.new(
|
68
|
+
title: title,
|
69
|
+
body: body,
|
70
|
+
header: header,
|
71
|
+
footer: footer,
|
72
|
+
theme: theme,
|
73
|
+
style: style,
|
74
|
+
padding: padding,
|
75
|
+
radius: radius,
|
76
|
+
**html_options
|
77
|
+
), &block
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Progress
|
5
|
+
module ProgressHelper
|
6
|
+
# Helper per renderizzare una progress bar
|
7
|
+
#
|
8
|
+
# @param value [Integer] percentuale di completamento (0-100)
|
9
|
+
# @param theme [Symbol] tema del colore (:default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet)
|
10
|
+
# @param size [Symbol] dimensione della progress bar (:small, :medium, :large)
|
11
|
+
# @param label [Boolean] mostra etichetta con percentuale
|
12
|
+
# @param classes [String] classi CSS aggiuntive
|
13
|
+
# @param html_options [Hash] opzioni HTML aggiuntive
|
14
|
+
#
|
15
|
+
# @return [String] HTML della progress bar
|
16
|
+
#
|
17
|
+
# @example Uso base
|
18
|
+
# bui_progress(value: 75)
|
19
|
+
#
|
20
|
+
# @example Progress con etichetta
|
21
|
+
# bui_progress(value: 50, label: true, theme: :green)
|
22
|
+
#
|
23
|
+
# @example Progress personalizzata
|
24
|
+
# bui_progress(
|
25
|
+
# value: 90,
|
26
|
+
# theme: :blue,
|
27
|
+
# size: :large,
|
28
|
+
# label: true,
|
29
|
+
# classes: "my-custom-class",
|
30
|
+
# id: "main-progress"
|
31
|
+
# )
|
32
|
+
def bui_progress(
|
33
|
+
value: 0,
|
34
|
+
theme: :white,
|
35
|
+
size: :medium,
|
36
|
+
label: false,
|
37
|
+
classes: nil,
|
38
|
+
**html_options
|
39
|
+
)
|
40
|
+
render BetterUi::General::Progress::Component.new(
|
41
|
+
value: value,
|
42
|
+
theme: theme,
|
43
|
+
size: size,
|
44
|
+
label: label,
|
45
|
+
classes: classes,
|
46
|
+
**html_options
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module SpinnerHelper
|
5
|
+
def bui_spinner(label = nil, **options)
|
6
|
+
render BetterUi::General::Spinner::Component.new(
|
7
|
+
label: label,
|
8
|
+
**options
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Supporto per la sintassi originale per compatibilità
|
13
|
+
alias_method :better_ui_general_spinner, :bui_spinner
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Table
|
5
|
+
module TdHelper
|
6
|
+
def bui_td(content = nil, **options, &block)
|
7
|
+
if block_given?
|
8
|
+
render BetterUi::General::Table::TdComponent.new(**options), &block
|
9
|
+
else
|
10
|
+
render BetterUi::General::Table::TdComponent.new(**options) do
|
11
|
+
content
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Table
|
5
|
+
module ThHelper
|
6
|
+
def bui_th(content = nil, **options, &block)
|
7
|
+
if block_given?
|
8
|
+
render BetterUi::General::Table::ThComponent.new(**options), &block
|
9
|
+
else
|
10
|
+
render BetterUi::General::Table::ThComponent.new(**options) do
|
11
|
+
content
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Table
|
5
|
+
# Require di tutti i file helper
|
6
|
+
require_relative 'table/table_helper'
|
7
|
+
require_relative 'table/thead_helper'
|
8
|
+
require_relative 'table/tbody_helper'
|
9
|
+
require_relative 'table/tfoot_helper'
|
10
|
+
require_relative 'table/tr_helper'
|
11
|
+
require_relative 'table/th_helper'
|
12
|
+
require_relative 'table/td_helper'
|
13
|
+
|
14
|
+
# Include di tutti i moduli helper nel modulo Table
|
15
|
+
include TableHelper
|
16
|
+
include TheadHelper
|
17
|
+
include TbodyHelper
|
18
|
+
include TfootHelper
|
19
|
+
include TrHelper
|
20
|
+
include ThHelper
|
21
|
+
include TdHelper
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Tag
|
5
|
+
module TagHelper
|
6
|
+
# Render un tag con le opzioni specificate
|
7
|
+
#
|
8
|
+
# @param text [String] testo del tag (obbligatorio)
|
9
|
+
# @param options [Hash] opzioni per il componente
|
10
|
+
#
|
11
|
+
# @option options [Symbol] :theme (:white) tema del colore (:default, :white, :red, etc.)
|
12
|
+
# @option options [Symbol] :size (:medium) dimensione (:small, :medium, :large)
|
13
|
+
# @option options [Symbol] :style (:filled) stile (:filled, :outline)
|
14
|
+
#
|
15
|
+
# @return [String] HTML del componente
|
16
|
+
def bui_tag(text, **options)
|
17
|
+
render BetterUi::General::Tag::Component.new(
|
18
|
+
text: text,
|
19
|
+
**options
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BetterUi
|
4
|
+
module General
|
5
|
+
module Components
|
6
|
+
module Tag
|
7
|
+
# Require dell'helper tag
|
8
|
+
require_relative 'tag/tag_helper'
|
9
|
+
|
10
|
+
# Include dell'helper nel modulo Tag
|
11
|
+
include TagHelper
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module General
|
3
|
+
module Components
|
4
|
+
module Tooltip
|
5
|
+
module TooltipHelper
|
6
|
+
# Genera un tooltip usando BetterUi::General::Tooltip::Component
|
7
|
+
#
|
8
|
+
# @param text [String] testo del tooltip
|
9
|
+
# @param theme [Symbol] tema del colore (:default, :white, :red, etc.)
|
10
|
+
# @param position [Symbol] posizione del tooltip (:top, :right, :bottom, :left)
|
11
|
+
# @param size [Symbol] dimensione del tooltip (:small, :medium, :large)
|
12
|
+
# @param style [Symbol] stile del tooltip (:filled, :outline)
|
13
|
+
# @param html_options [Hash] opzioni HTML aggiuntive
|
14
|
+
# @param block [Block] contenuto dell'elemento trigger
|
15
|
+
# @return [String] HTML del tooltip renderizzato
|
16
|
+
#
|
17
|
+
# @example Uso base
|
18
|
+
# bui_tooltip("Questo è un tooltip") do
|
19
|
+
# bui_button(label: "Hover me")
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# @example Tooltip con posizione specifica
|
23
|
+
# bui_tooltip("Messaggio importante", position: :right, theme: :red) do
|
24
|
+
# link_to "Info", "#", class: "text-blue-500"
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# @example Tooltip con stili avanzati
|
28
|
+
# bui_tooltip(
|
29
|
+
# "Tooltip grande con outline",
|
30
|
+
# theme: :blue,
|
31
|
+
# position: :bottom,
|
32
|
+
# size: :large,
|
33
|
+
# style: :outline,
|
34
|
+
# id: "custom-tooltip"
|
35
|
+
# ) do
|
36
|
+
# content_tag(:span, "Trigger personalizzato", class: "custom-trigger")
|
37
|
+
# end
|
38
|
+
def bui_tooltip(
|
39
|
+
text,
|
40
|
+
theme: :white,
|
41
|
+
position: :top,
|
42
|
+
size: :medium,
|
43
|
+
style: :filled,
|
44
|
+
**html_options,
|
45
|
+
&block
|
46
|
+
)
|
47
|
+
render BetterUi::General::Tooltip::Component.new(
|
48
|
+
text: text,
|
49
|
+
theme: theme,
|
50
|
+
position: position,
|
51
|
+
size: size,
|
52
|
+
style: style,
|
53
|
+
**html_options
|
54
|
+
), &block
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module BetterUi
|
2
|
+
module GeneralHelper
|
3
|
+
# Inclusione dei moduli aggregatori per i componenti generali
|
4
|
+
# Questo assicura che tutti gli helper specifici dei componenti e dei loro sotto-componenti siano disponibili.
|
5
|
+
|
6
|
+
include BetterUi::General::Components::Alert if defined?(BetterUi::General::Components::Alert)
|
7
|
+
include BetterUi::General::Components::Avatar if defined?(BetterUi::General::Components::Avatar)
|
8
|
+
include BetterUi::General::Components::Badge if defined?(BetterUi::General::Components::Badge)
|
9
|
+
include BetterUi::General::Components::Breadcrumb if defined?(BetterUi::General::Components::Breadcrumb)
|
10
|
+
include BetterUi::General::Components::Button if defined?(BetterUi::General::Components::Button)
|
11
|
+
include BetterUi::General::Components::Divider if defined?(BetterUi::General::Components::Divider)
|
12
|
+
include BetterUi::General::Components::Heading if defined?(BetterUi::General::Components::Heading)
|
13
|
+
include BetterUi::General::Components::Icon if defined?(BetterUi::General::Components::Icon)
|
14
|
+
include BetterUi::General::Components::Link if defined?(BetterUi::General::Components::Link)
|
15
|
+
include BetterUi::General::Components::Panel if defined?(BetterUi::General::Components::Panel)
|
16
|
+
include BetterUi::General::Components::Progress if defined?(BetterUi::General::Components::Progress)
|
17
|
+
include BetterUi::General::Components::Spinner if defined?(BetterUi::General::Components::Spinner)
|
18
|
+
include BetterUi::General::Components::Table if defined?(BetterUi::General::Components::Table)
|
19
|
+
include BetterUi::General::Components::Tag if defined?(BetterUi::General::Components::Tag)
|
20
|
+
include BetterUi::General::Components::Tooltip if defined?(BetterUi::General::Components::Tooltip)
|
21
|
+
include BetterUi::General::Components::Container if defined?(BetterUi::General::Components::Container)
|
22
|
+
include BetterUi::General::Components::Card if defined?(BetterUi::General::Components::Card)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module BetterUi
|
2
|
+
# Includi esplicitamente gli helper
|
3
|
+
require_relative 'better_ui/general_helper'
|
4
|
+
require_relative 'better_ui/application_helper'
|
5
|
+
require_relative 'better_ui/form_helper'
|
6
|
+
|
7
|
+
module Helper
|
8
|
+
# Estendi il modulo con ActiveSupport::Concern per funzionalità helper
|
9
|
+
extend ActiveSupport::Concern
|
10
|
+
|
11
|
+
# Includi gli helper disponibili
|
12
|
+
include BetterUi::GeneralHelper
|
13
|
+
include BetterUi::ApplicationHelper
|
14
|
+
include BetterUi::FormHelper
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
import "../assets/stylesheets/better_ui.scss";
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<tr class="<%= component.tr_classes(index) %>">
|
2
|
+
<% headers.each_with_index do |header, cell_index| %>
|
3
|
+
<td class="<%= component.td_classes %>">
|
4
|
+
<% cell_value = component.get_cell_value(row, header) %>
|
5
|
+
<% if cell_index == 0 %>
|
6
|
+
<div class="flex items-center">
|
7
|
+
<div class="w-8 h-8 rounded-full bg-blue-100 mr-2 flex items-center justify-center text-blue-700">
|
8
|
+
<%= cell_value.to_s.first&.upcase || 'N/A' %>
|
9
|
+
</div>
|
10
|
+
<%= cell_value %>
|
11
|
+
</div>
|
12
|
+
<% else %>
|
13
|
+
<%= cell_value %>
|
14
|
+
<% end %>
|
15
|
+
</td>
|
16
|
+
<% end %>
|
17
|
+
</tr>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<tr>
|
2
|
+
<% footer.each_with_index do |value, index| %>
|
3
|
+
<td class="<%= component.tf_classes %>">
|
4
|
+
<% if index == 0 %>
|
5
|
+
<div class="flex items-center">
|
6
|
+
<svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
7
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2
|
8
|
+
0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"></path>
|
9
|
+
</svg>
|
10
|
+
<strong><%= value %></strong>
|
11
|
+
</div>
|
12
|
+
<% else %>
|
13
|
+
<%= value %>
|
14
|
+
<% end %>
|
15
|
+
</td>
|
16
|
+
<% end %>
|
17
|
+
</tr>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<tr>
|
2
|
+
<% headers.each do |header| %>
|
3
|
+
<th class="<%= component.th_classes %>">
|
4
|
+
<div class="flex items-center justify-between">
|
5
|
+
<%= header.to_s.humanize %>
|
6
|
+
<svg class="w-4 h-4 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
7
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
|
8
|
+
</svg>
|
9
|
+
</div>
|
10
|
+
</th>
|
11
|
+
<% end %>
|
12
|
+
</tr>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html style="background-color: <%= params.dig(:lookbook, :display, :bg_color) || "white" %>">
|
3
|
+
<head>
|
4
|
+
<title><%= content_for(:title) || "BetterUI" %></title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
7
|
+
<meta name="mobile-web-app-capable" content="yes">
|
8
|
+
<%= csrf_meta_tags %>
|
9
|
+
<%= csp_meta_tag %>
|
10
|
+
|
11
|
+
<%= yield :head %>
|
12
|
+
|
13
|
+
<link rel="icon" href="/icon.png" type="image/png">
|
14
|
+
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
15
|
+
<link rel="apple-touch-icon" href="/icon.png">
|
16
|
+
|
17
|
+
<%# Includes all stylesheet files in app/assets/stylesheets %>
|
18
|
+
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
|
19
|
+
<%= stylesheet_link_tag "better_ui/application" %>
|
20
|
+
</head>
|
21
|
+
|
22
|
+
<body class="bg-white text-gray-800">
|
23
|
+
<main class="min-h-screen p-8 bg-yellow-500">
|
24
|
+
<div style="
|
25
|
+
margin-left: auto;
|
26
|
+
margin-right: auto;
|
27
|
+
max-width: <%= params.dig(:lookbook, :display, :max_width) || "100%" %>
|
28
|
+
">
|
29
|
+
<%= yield %> <!-- rendered preview will be injected here -->
|
30
|
+
</main>
|
31
|
+
</body>
|
32
|
+
</html>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
if defined?(Lookbook)
|
2
|
+
Lookbook.configure do |config|
|
3
|
+
# Configura la directory delle preview dei componenti
|
4
|
+
config.preview_paths << BetterUi::Engine.root.join('test/components/previews')
|
5
|
+
|
6
|
+
# Configura il titolo della pagina Lookbook
|
7
|
+
config.page_title = 'BetterUI - Catalogo Componenti'
|
8
|
+
|
9
|
+
# Configura i tag principali
|
10
|
+
config.preview_display_names = {
|
11
|
+
'BetterUi::General' => 'Componenti Generali',
|
12
|
+
'BetterUi::Application' => 'Componenti Applicazione',
|
13
|
+
'BetterUi::Website' => 'Componenti Sito Web'
|
14
|
+
}
|
15
|
+
|
16
|
+
# Per supportare i componenti ViewComponent
|
17
|
+
config.listen_for_changes = {
|
18
|
+
component: 'app/components/**/*.rb',
|
19
|
+
preview: 'test/components/previews/**/*_preview.rb',
|
20
|
+
template: 'app/components/**/*.erb'
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
data/config/routes.rb
ADDED