better_ui 0.3.0 → 0.4.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.
Potentially problematic release.
This version of better_ui might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +174 -216
- data/app/assets/javascripts/better_ui/controllers/navbar_controller.js +138 -0
- data/app/assets/javascripts/better_ui/controllers/sidebar_controller.js +211 -0
- data/app/assets/javascripts/better_ui/controllers/toast_controller.js +161 -0
- data/app/assets/javascripts/better_ui/index.js +159 -0
- data/app/assets/javascripts/better_ui/toast_manager.js +77 -0
- data/app/assets/stylesheets/better_ui/application.css +30 -0
- data/app/components/better_ui/application/alert_component.html.erb +27 -0
- data/app/components/better_ui/application/alert_component.rb +196 -0
- data/app/components/better_ui/application/header_component.html.erb +88 -0
- data/app/components/better_ui/application/header_component.rb +188 -0
- data/app/components/better_ui/application/navbar_component.html.erb +294 -0
- data/app/components/better_ui/application/navbar_component.rb +249 -0
- data/app/components/better_ui/application/sidebar_component.html.erb +207 -0
- data/app/components/better_ui/application/sidebar_component.rb +318 -0
- data/app/components/better_ui/application/toast_component.html.erb +35 -0
- data/app/components/better_ui/application/toast_component.rb +188 -0
- data/app/components/better_ui/general/breadcrumb_component.html.erb +39 -0
- data/app/components/better_ui/general/breadcrumb_component.rb +132 -0
- data/app/components/better_ui/general/{button/component.html.erb → button_component.html.erb} +7 -7
- data/app/components/better_ui/general/button_component.rb +193 -0
- data/app/components/better_ui/general/heading_component.html.erb +25 -0
- data/app/components/better_ui/general/heading_component.rb +142 -0
- data/app/components/better_ui/general/icon_component.html.erb +2 -0
- data/app/components/better_ui/general/icon_component.rb +101 -0
- data/app/components/better_ui/general/panel_component.html.erb +27 -0
- data/app/components/better_ui/general/panel_component.rb +97 -0
- data/app/components/better_ui/general/table_component.html.erb +37 -0
- data/app/components/better_ui/general/table_component.rb +141 -0
- data/app/components/better_ui/theme_helper.rb +169 -0
- data/app/controllers/better_ui/application_controller.rb +1 -0
- data/app/controllers/better_ui/docs_controller.rb +34 -0
- data/app/helpers/better_ui_application_helper.rb +99 -0
- data/app/views/layouts/component_preview.html.erb +32 -0
- data/config/initializers/lookbook.rb +12 -12
- data/config/routes.rb +13 -0
- data/lib/better_ui/engine.rb +42 -5
- data/lib/better_ui/version.rb +1 -1
- data/lib/better_ui.rb +20 -4
- metadata +117 -157
- 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 -227
- data/app/components/better_ui/application/sidebar/component.rb +0 -130
- 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.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 -25
- data/app/components/better_ui/general/dropdown/component.rb +0 -170
- 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/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 -239
- 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/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/select/component.html.erb +0 -16
- data/app/components/better_ui/general/input/select/component.rb +0 -184
- 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/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/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/application_helper.rb +0 -55
- data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
- data/app/helpers/better_ui/general/components/accordion.rb +0 -11
- 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 -79
- data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -62
- data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
- 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/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/select/select_helper.rb +0 -70
- 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/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/modal.rb +0 -11
- 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/tooltip/tooltip_helper.rb +0 -60
- data/app/views/layouts/better_ui/application.html.erb +0 -17
- data/lib/better_ui/railtie.rb +0 -20
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BetterUi
|
|
4
|
-
module Application
|
|
5
|
-
module Components
|
|
6
|
-
module Navbar
|
|
7
|
-
module NavbarHelper
|
|
8
|
-
# Helper per creare la navbar dell'applicazione
|
|
9
|
-
#
|
|
10
|
-
# @param theme [Symbol] Tema colori (default, white, red, rose, orange, green, blue, yellow, violet), default :default
|
|
11
|
-
# @param shadow [Symbol] Tipo di ombra (none, small, medium, large), default :small
|
|
12
|
-
# @param border [Boolean] Se mostrare il bordo inferiore, default true
|
|
13
|
-
# @param actions [Array] Array di azioni/pulsanti a destra
|
|
14
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
15
|
-
# @param with_sidebar [Boolean] Se la navbar è affiancata a una sidebar, default false
|
|
16
|
-
# @param sidebar_width [Symbol] Larghezza della sidebar affiancata (:sm, :md, :lg, :xl), default :md
|
|
17
|
-
# @param form [Nil] Parametro form per compatibilità con form builder (non utilizzato)
|
|
18
|
-
# @param options [Hash] Opzioni HTML aggiuntive
|
|
19
|
-
# @param block [Proc] Blocco contenente contenuto aggiuntivo della navbar
|
|
20
|
-
#
|
|
21
|
-
# @return [String] HTML del componente navbar
|
|
22
|
-
#
|
|
23
|
-
# @example Navbar base
|
|
24
|
-
# <%= bui_navbar %>
|
|
25
|
-
#
|
|
26
|
-
# @example Navbar con tema
|
|
27
|
-
# <%= bui_navbar(theme: :blue) %>
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
# @example Navbar con azioni
|
|
31
|
-
# <%= bui_navbar(
|
|
32
|
-
# actions: [
|
|
33
|
-
# {
|
|
34
|
-
# type: :avatar,
|
|
35
|
-
# avatar: { initials: 'AB', theme: :green },
|
|
36
|
-
# href: '/profile'
|
|
37
|
-
# },
|
|
38
|
-
# {
|
|
39
|
-
# type: :icon,
|
|
40
|
-
# icon: 'chat',
|
|
41
|
-
# data: { action: 'click->chat#toggle' }
|
|
42
|
-
# }
|
|
43
|
-
# ]
|
|
44
|
-
# ) %>
|
|
45
|
-
#
|
|
46
|
-
# @example Navbar con classi aggiuntive
|
|
47
|
-
# <%= bui_navbar(
|
|
48
|
-
# classes: "my-8",
|
|
49
|
-
# data: { controller: "navbar" }
|
|
50
|
-
# ) %>
|
|
51
|
-
def bui_navbar(
|
|
52
|
-
theme: :default,
|
|
53
|
-
shadow: :small,
|
|
54
|
-
border: true,
|
|
55
|
-
actions: [],
|
|
56
|
-
classes: nil,
|
|
57
|
-
with_sidebar: false,
|
|
58
|
-
sidebar_width: :md,
|
|
59
|
-
form: nil,
|
|
60
|
-
**options,
|
|
61
|
-
&block
|
|
62
|
-
)
|
|
63
|
-
render BetterUi::Application::Navbar::Component.new(
|
|
64
|
-
theme: theme,
|
|
65
|
-
shadow: shadow,
|
|
66
|
-
border: border,
|
|
67
|
-
actions: actions,
|
|
68
|
-
classes: classes,
|
|
69
|
-
with_sidebar: with_sidebar,
|
|
70
|
-
sidebar_width: sidebar_width
|
|
71
|
-
), &block
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
end
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module Application
|
|
3
|
-
module Components
|
|
4
|
-
module Sidebar
|
|
5
|
-
module SidebarHelper
|
|
6
|
-
# Helper per creare la sidebar dell'applicazione
|
|
7
|
-
#
|
|
8
|
-
# @param width [Symbol] Larghezza della sidebar (:sm, :md, :lg, :xl), default :md
|
|
9
|
-
# @param position [Symbol] Posizione della sidebar (:left, :right), default :left
|
|
10
|
-
# @param theme [Symbol] Tema colori (:default, :dark, :light), default :default
|
|
11
|
-
# @param shadow [Symbol] Tipo di ombra (:none, :sm, :md, :lg), default :lg
|
|
12
|
-
# @param border [Boolean] Se mostrare il bordo destro/sinistro, default true
|
|
13
|
-
# @param header [Hash] Configurazione header (logo, title, subtitle)
|
|
14
|
-
# @param footer [Hash] Configurazione footer (content, user_info)
|
|
15
|
-
# @param navigation_sections [Array] Array di sezioni di navigazione
|
|
16
|
-
# @param collapsible [Boolean] Se abilitare sezioni collassabili, default true
|
|
17
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
18
|
-
# @param block [Proc] Blocco contenente contenuto aggiuntivo della sidebar
|
|
19
|
-
#
|
|
20
|
-
# @return [String] HTML del componente sidebar
|
|
21
|
-
def bui_sidebar(
|
|
22
|
-
width: :md,
|
|
23
|
-
position: :left,
|
|
24
|
-
theme: :default,
|
|
25
|
-
shadow: :lg,
|
|
26
|
-
border: true,
|
|
27
|
-
header: {},
|
|
28
|
-
footer: {},
|
|
29
|
-
navigation_sections: [],
|
|
30
|
-
collapsible: true,
|
|
31
|
-
classes: nil,
|
|
32
|
-
&block
|
|
33
|
-
)
|
|
34
|
-
render BetterUi::Application::Sidebar::Component.new(
|
|
35
|
-
width: width,
|
|
36
|
-
position: position,
|
|
37
|
-
theme: theme,
|
|
38
|
-
shadow: shadow,
|
|
39
|
-
border: border,
|
|
40
|
-
header: header,
|
|
41
|
-
footer: footer,
|
|
42
|
-
navigation_sections: navigation_sections,
|
|
43
|
-
collapsible: collapsible,
|
|
44
|
-
classes: classes
|
|
45
|
-
), &block
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module ApplicationHelper
|
|
3
|
-
# Inclusione dei moduli aggregatori per i componenti application
|
|
4
|
-
# Questo assicura che tutti gli helper specifici dei componenti siano disponibili.
|
|
5
|
-
|
|
6
|
-
# General Components
|
|
7
|
-
include General::Components::Accordion::AccordionHelper
|
|
8
|
-
include General::Components::Alert::AlertHelper
|
|
9
|
-
include General::Components::Avatar::AvatarHelper
|
|
10
|
-
include General::Components::Badge::BadgeHelper
|
|
11
|
-
include General::Components::Breadcrumb::BreadcrumbHelper
|
|
12
|
-
include General::Components::Button::ButtonHelper
|
|
13
|
-
include General::Components::Divider::DividerHelper
|
|
14
|
-
include General::Components::Dropdown::DropdownHelper
|
|
15
|
-
include General::Components::Dropdown::ItemHelper
|
|
16
|
-
include General::Components::Dropdown::DividerHelper
|
|
17
|
-
include General::Components::Heading::HeadingHelper
|
|
18
|
-
include General::Components::Icon::IconHelper
|
|
19
|
-
include General::Components::Link::LinkHelper
|
|
20
|
-
include General::Components::Modal::ModalHelper
|
|
21
|
-
include General::Components::Pagination::PaginationHelper
|
|
22
|
-
include General::Components::Panel::PanelHelper
|
|
23
|
-
include General::Components::Progress::ProgressHelper
|
|
24
|
-
include General::Components::Spinner::SpinnerHelper
|
|
25
|
-
include General::Components::Tag::TagHelper
|
|
26
|
-
include General::Components::Tooltip::TooltipHelper
|
|
27
|
-
|
|
28
|
-
include General::Components::Table::TableHelper
|
|
29
|
-
include General::Components::Table::TbodyHelper
|
|
30
|
-
include General::Components::Table::TdHelper
|
|
31
|
-
include General::Components::Table::TfootHelper
|
|
32
|
-
include General::Components::Table::ThHelper
|
|
33
|
-
include General::Components::Table::TheadHelper
|
|
34
|
-
include General::Components::Table::TrHelper
|
|
35
|
-
|
|
36
|
-
include General::Components::Tabs::TabsHelper
|
|
37
|
-
include General::Components::Tabs::TabHelper
|
|
38
|
-
include General::Components::Tabs::PanelHelper
|
|
39
|
-
|
|
40
|
-
# General Form Components
|
|
41
|
-
include General::Components::Input::Checkbox::CheckboxHelper
|
|
42
|
-
include General::Components::Input::Datetime::DatetimeHelper
|
|
43
|
-
include General::Components::Input::Radio::RadioHelper
|
|
44
|
-
include General::Components::Input::RadioGroup::RadioGroupHelper
|
|
45
|
-
include General::Components::Input::Select::SelectHelper
|
|
46
|
-
include General::Components::Input::Text::TextHelper
|
|
47
|
-
include General::Components::Input::Textarea::TextareaHelper
|
|
48
|
-
|
|
49
|
-
# Application Components
|
|
50
|
-
include Application::Components::Main::MainHelper
|
|
51
|
-
include Application::Components::Navbar::NavbarHelper
|
|
52
|
-
include Application::Components::Sidebar::SidebarHelper
|
|
53
|
-
include Application::Components::Card::CardHelper
|
|
54
|
-
end
|
|
55
|
-
end
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module BetterUi
|
|
4
|
-
module General
|
|
5
|
-
module Components
|
|
6
|
-
module Accordion
|
|
7
|
-
module AccordionHelper
|
|
8
|
-
# Rendering di un accordion con item collassabili/espandibili
|
|
9
|
-
#
|
|
10
|
-
# @param multiple [Boolean] se permettere multipli item aperti contemporaneamente
|
|
11
|
-
# @param theme [Symbol] tema di colore per l'accordion
|
|
12
|
-
# @param variant [Symbol] variante visuale dell'accordion
|
|
13
|
-
# @param size [Symbol] dimensione del testo e padding
|
|
14
|
-
# @param classes [String] classi CSS aggiuntive per il wrapper
|
|
15
|
-
# @param options [Hash] attributi HTML aggiuntivi da passare al componente
|
|
16
|
-
# @return [String] HTML renderizzato dell'accordion
|
|
17
|
-
#
|
|
18
|
-
# @example Uso base standalone
|
|
19
|
-
# <%= bui_accordion do |accordion| %>
|
|
20
|
-
# <%= accordion.with_item(title: "Domanda 1") do %>
|
|
21
|
-
# <p>Risposta alla prima domanda</p>
|
|
22
|
-
# <% end %>
|
|
23
|
-
# <% end %>
|
|
24
|
-
#
|
|
25
|
-
# @example Con tema e configurazioni
|
|
26
|
-
# <%= bui_accordion(multiple: true, theme: :blue, size: :large) do |accordion| %>
|
|
27
|
-
# <%= accordion.with_item(title: "FAQ 1", expanded: true) do %>
|
|
28
|
-
# <p>Contenuto della prima FAQ</p>
|
|
29
|
-
# <% end %>
|
|
30
|
-
# <%= accordion.with_item(title: "FAQ 2") do %>
|
|
31
|
-
# <p>Contenuto della seconda FAQ</p>
|
|
32
|
-
# <% end %>
|
|
33
|
-
# <% end %>
|
|
34
|
-
#
|
|
35
|
-
# @example Con varianti stilistiche
|
|
36
|
-
# <%= bui_accordion(variant: :separated, theme: :green) do |accordion| %>
|
|
37
|
-
# <%= accordion.with_item(title: "Sezione 1") do %>
|
|
38
|
-
# <div>Contenuto complesso con HTML</div>
|
|
39
|
-
# <% end %>
|
|
40
|
-
# <% end %>
|
|
41
|
-
#
|
|
42
|
-
# @example Con attributi HTML aggiuntivi
|
|
43
|
-
# <%= bui_accordion(id: "faq-accordion", "data-testid": "main-faq") do |accordion| %>
|
|
44
|
-
# <%= accordion.with_item(title: "Come funziona?") do %>
|
|
45
|
-
# <p>Spiegazione dettagliata...</p>
|
|
46
|
-
# <% end %>
|
|
47
|
-
# <% end %>
|
|
48
|
-
#
|
|
49
|
-
# @example Con item disabilitati e icone personalizzate
|
|
50
|
-
# <%= bui_accordion(theme: :violet, size: :small) do |accordion| %>
|
|
51
|
-
# <%= accordion.with_item(title: "Disponibile", icon: "check-circle") do %>
|
|
52
|
-
# <p>Questa sezione è disponibile</p>
|
|
53
|
-
# <% end %>
|
|
54
|
-
# <%= accordion.with_item(title: "Non disponibile", disabled: true) do %>
|
|
55
|
-
# <p>Questa sezione è disabilitata</p>
|
|
56
|
-
# <% end %>
|
|
57
|
-
# <% end %>
|
|
58
|
-
def bui_accordion(multiple: false, theme: :default, variant: :bordered, size: :medium,
|
|
59
|
-
classes: '', **options, &block)
|
|
60
|
-
render BetterUi::General::Accordion::Component.new(
|
|
61
|
-
multiple: multiple,
|
|
62
|
-
theme: theme,
|
|
63
|
-
variant: variant,
|
|
64
|
-
size: size,
|
|
65
|
-
classes: classes,
|
|
66
|
-
**options
|
|
67
|
-
), &block
|
|
68
|
-
end
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module General
|
|
3
|
-
module Components
|
|
4
|
-
module Alert
|
|
5
|
-
module AlertHelper
|
|
6
|
-
# Renderizza un componente Alert per comunicare messaggi importanti all'utente.
|
|
7
|
-
#
|
|
8
|
-
# @param title [String, nil] Titolo dell'alert (opzionale)
|
|
9
|
-
# @param message [String] Contenuto dell'alert
|
|
10
|
-
# @param theme [Symbol] Tema dell'alert (:default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet)
|
|
11
|
-
# @param icon [String, nil] Nome dell'icona (se vuoto usa l'icona predefinita in base al tema)
|
|
12
|
-
# @param icon_position [Symbol] Posizione dell'icona (:left, :right)
|
|
13
|
-
# @param dismissible [Boolean] Se l'alert può essere chiuso dall'utente
|
|
14
|
-
# @param rounded [Symbol] Arrotondamento degli angoli (:none, :small, :medium, :large, :full)
|
|
15
|
-
# @param importance [Symbol] Livello di importanza per accessibilità (:high, :medium, :low)
|
|
16
|
-
# @param html_content [Boolean] Se il messaggio contiene HTML
|
|
17
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
18
|
-
# @param options [Hash] Attributi HTML aggiuntivi
|
|
19
|
-
#
|
|
20
|
-
# @return [String] HTML del componente Alert renderizzato
|
|
21
|
-
#
|
|
22
|
-
# @example Alert base
|
|
23
|
-
# <%= bui_alert(message: 'Operazione completata con successo') %>
|
|
24
|
-
#
|
|
25
|
-
# @example Alert con titolo e tema
|
|
26
|
-
# <%= bui_alert(title: 'Errore', message: 'Impossibile completare', theme: :red) %>
|
|
27
|
-
#
|
|
28
|
-
# @example Alert con icona personalizzata
|
|
29
|
-
# <%= bui_alert(message: 'Avviso importante', icon: 'bell') %>
|
|
30
|
-
#
|
|
31
|
-
# @example Alert con pulsante per chiudere
|
|
32
|
-
# <%= bui_alert(message: 'Notifica temporanea', dismissible: true) %>
|
|
33
|
-
#
|
|
34
|
-
# @example Alert con HTML nel messaggio
|
|
35
|
-
# <%= bui_alert(message: '<strong>Attenzione!</strong> Controlla i dati.', html_content: true) %>
|
|
36
|
-
def bui_alert(title: nil, message: nil, theme: :default, icon: nil, icon_position: :left,
|
|
37
|
-
dismissible: false, rounded: :medium, importance: :medium, html_content: false,
|
|
38
|
-
classes: nil, **options)
|
|
39
|
-
render BetterUi::General::Alert::Component.new(
|
|
40
|
-
title: title,
|
|
41
|
-
message: message,
|
|
42
|
-
theme: theme,
|
|
43
|
-
icon: icon,
|
|
44
|
-
icon_position: icon_position,
|
|
45
|
-
dismissible: dismissible,
|
|
46
|
-
rounded: rounded,
|
|
47
|
-
importance: importance,
|
|
48
|
-
html_content: html_content,
|
|
49
|
-
classes: classes,
|
|
50
|
-
**options
|
|
51
|
-
)
|
|
52
|
-
end
|
|
53
|
-
end
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module General
|
|
3
|
-
module Components
|
|
4
|
-
module Avatar
|
|
5
|
-
module AvatarHelper
|
|
6
|
-
# Render un avatar con le opzioni specificate
|
|
7
|
-
#
|
|
8
|
-
# @param options [Hash] opzioni per il componente
|
|
9
|
-
#
|
|
10
|
-
# @option options [String] :name (nil) nome per le iniziali
|
|
11
|
-
# @option options [String] :src (nil) URL dell'immagine
|
|
12
|
-
# @option options [Symbol] :size (:medium) :xxsmall, :xsmall, :small, :medium, :large, :xlarge, :xxlarge
|
|
13
|
-
# @option options [Symbol] :shape (:circle) :circle, :square, :rounded
|
|
14
|
-
# @option options [Symbol] :status (nil) :online, :offline, :busy, :away
|
|
15
|
-
# @option options [Symbol] :status_position (:bottom_right) :bottom_right, :bottom_left, :top_right, :top_left
|
|
16
|
-
# @option options [Symbol] :theme (:white) :default, :white, :red, :rose, :orange, :green, :blue, :yellow, :violet
|
|
17
|
-
# @option options [Symbol] :style (:filled) :filled, :outline, :light
|
|
18
|
-
# @option options [String] :classes (nil) classi CSS aggiuntive
|
|
19
|
-
# @option options [String] :id (nil) ID HTML
|
|
20
|
-
#
|
|
21
|
-
# @return [String] HTML del componente
|
|
22
|
-
def bui_avatar(**options)
|
|
23
|
-
render BetterUi::General::Avatar::Component.new(**options)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module General
|
|
3
|
-
module Components
|
|
4
|
-
module Badge
|
|
5
|
-
module BadgeHelper
|
|
6
|
-
# Helper per renderizzare un badge
|
|
7
|
-
#
|
|
8
|
-
# @param label [String] Testo del badge
|
|
9
|
-
# @param theme [Symbol] Tema del badge (:default, :white, :red, etc.)
|
|
10
|
-
# @param size [Symbol] Dimensione del badge (:small, :medium, :large)
|
|
11
|
-
# @param shape [Symbol] Forma del badge (:square, :rounded)
|
|
12
|
-
# @param style [Symbol] Stile del badge (:filled, :outline)
|
|
13
|
-
# @param variant [Symbol] Variante del badge (:notification, :counter, :dot)
|
|
14
|
-
# @param icon [String] Nome dell'icona (opzionale)
|
|
15
|
-
# @param icon_position [Symbol] Posizione dell'icona (:left, :right)
|
|
16
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
17
|
-
# @param id [String] ID HTML
|
|
18
|
-
# @param html_options [Hash] Opzioni HTML aggiuntive
|
|
19
|
-
#
|
|
20
|
-
# @return [String] HTML del badge
|
|
21
|
-
def bui_badge(
|
|
22
|
-
label: nil,
|
|
23
|
-
theme: :white,
|
|
24
|
-
size: :medium,
|
|
25
|
-
shape: :rounded,
|
|
26
|
-
style: :filled,
|
|
27
|
-
variant: nil,
|
|
28
|
-
icon: nil,
|
|
29
|
-
icon_position: :left,
|
|
30
|
-
classes: nil,
|
|
31
|
-
id: nil,
|
|
32
|
-
**html_options,
|
|
33
|
-
&block
|
|
34
|
-
)
|
|
35
|
-
render BetterUi::General::Badge::Component.new(
|
|
36
|
-
label: label,
|
|
37
|
-
theme: theme,
|
|
38
|
-
size: size,
|
|
39
|
-
shape: shape,
|
|
40
|
-
style: style,
|
|
41
|
-
variant: variant,
|
|
42
|
-
icon: icon,
|
|
43
|
-
icon_position: icon_position,
|
|
44
|
-
classes: classes,
|
|
45
|
-
id: id,
|
|
46
|
-
**html_options
|
|
47
|
-
), &block
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module General
|
|
3
|
-
module Components
|
|
4
|
-
module Breadcrumb
|
|
5
|
-
module BreadcrumbHelper
|
|
6
|
-
# Helper per renderizzare un breadcrumb
|
|
7
|
-
#
|
|
8
|
-
# @param items [Array] Array di items del breadcrumb
|
|
9
|
-
# @param separator [Symbol] Tipo di separatore (:chevron, :slash, :arrow, :dot, :pipe)
|
|
10
|
-
# @param theme [Symbol] Tema del breadcrumb (:default, :white, :red, etc.)
|
|
11
|
-
# @param size [Symbol] Dimensione del testo (:extra_small, :small, :medium, :large)
|
|
12
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
13
|
-
# @param html_options [Hash] Opzioni HTML aggiuntive
|
|
14
|
-
#
|
|
15
|
-
# @return [String] HTML del breadcrumb
|
|
16
|
-
def bui_breadcrumb(
|
|
17
|
-
items: [],
|
|
18
|
-
separator: :chevron,
|
|
19
|
-
theme: :white,
|
|
20
|
-
size: :medium,
|
|
21
|
-
classes: nil,
|
|
22
|
-
**html_options
|
|
23
|
-
)
|
|
24
|
-
render BetterUi::General::Breadcrumb::Component.new(
|
|
25
|
-
items: items,
|
|
26
|
-
separator: separator,
|
|
27
|
-
theme: theme,
|
|
28
|
-
size: size,
|
|
29
|
-
classes: classes,
|
|
30
|
-
**html_options
|
|
31
|
-
)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
end
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module General
|
|
3
|
-
module Components
|
|
4
|
-
module Button
|
|
5
|
-
module ButtonHelper
|
|
6
|
-
# Helper per renderizzare un bottone
|
|
7
|
-
#
|
|
8
|
-
# @param label [String] Testo del bottone
|
|
9
|
-
# @param type [Symbol] Tipo del bottone (:default, :white, :red, etc.)
|
|
10
|
-
# @param size [Symbol] Dimensione del bottone (:small, :medium, :large)
|
|
11
|
-
# @param full_width [Boolean] Larghezza completa
|
|
12
|
-
# @param disabled [Boolean] Stato disabilitato
|
|
13
|
-
# @param icon [String] Nome icona (opzionale)
|
|
14
|
-
# @param icon_position [Symbol] Posizione icona (:left, :right)
|
|
15
|
-
# @param href [String] URL per il link (opzionale)
|
|
16
|
-
# @param method [Symbol] Metodo HTTP (opzionale)
|
|
17
|
-
# @param data [Hash] Attributi data
|
|
18
|
-
# @param classes [String] Classi CSS aggiuntive
|
|
19
|
-
# @param id [String] ID elemento
|
|
20
|
-
# @param rounded [Symbol] Tipo di border-radius (:none, :small, :medium, :large, :full)
|
|
21
|
-
# @param html_options [Hash] Opzioni HTML aggiuntive
|
|
22
|
-
# @params button_type [Symbol] Tipo di bottone (:button, :submit, :reset)
|
|
23
|
-
#
|
|
24
|
-
# @return [String] HTML del bottone
|
|
25
|
-
def bui_button(
|
|
26
|
-
label: nil,
|
|
27
|
-
type: :white,
|
|
28
|
-
size: :medium,
|
|
29
|
-
full_width: false,
|
|
30
|
-
disabled: false,
|
|
31
|
-
icon: nil,
|
|
32
|
-
icon_position: :left,
|
|
33
|
-
href: nil,
|
|
34
|
-
method: nil,
|
|
35
|
-
data: {},
|
|
36
|
-
classes: nil,
|
|
37
|
-
id: nil,
|
|
38
|
-
rounded: :medium,
|
|
39
|
-
button_type: :button,
|
|
40
|
-
**html_options,
|
|
41
|
-
&block
|
|
42
|
-
)
|
|
43
|
-
render BetterUi::General::Button::Component.new(
|
|
44
|
-
label: label,
|
|
45
|
-
type: type,
|
|
46
|
-
size: size,
|
|
47
|
-
full_width: full_width,
|
|
48
|
-
disabled: disabled,
|
|
49
|
-
icon: icon,
|
|
50
|
-
icon_position: icon_position,
|
|
51
|
-
href: href,
|
|
52
|
-
method: method,
|
|
53
|
-
data: data,
|
|
54
|
-
classes: classes,
|
|
55
|
-
id: id,
|
|
56
|
-
rounded: rounded,
|
|
57
|
-
button_type: button_type,
|
|
58
|
-
**html_options
|
|
59
|
-
), &block
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
end
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
module BetterUi
|
|
2
|
-
module General
|
|
3
|
-
module Components
|
|
4
|
-
module Container
|
|
5
|
-
module ContainerHelper
|
|
6
|
-
# Genera un container usando BetterUi::General::Container::Component
|
|
7
|
-
#
|
|
8
|
-
# @param html_content [String] contenuto HTML del container (opzionale)
|
|
9
|
-
# @param fluid [Boolean] se il container deve essere fluid (full width)
|
|
10
|
-
# @param max_width [Symbol] larghezza massima del container (:sm, :md, :lg, :xl, :xxl)
|
|
11
|
-
# @param padding [Symbol] padding interno (:none, :small, :medium, :large)
|
|
12
|
-
# @param background [Symbol] colore di sfondo (:white, :light, :dark, :transparent)
|
|
13
|
-
# @param html_options [Hash] opzioni HTML aggiuntive
|
|
14
|
-
# @return [String] HTML del container renderizzato
|
|
15
|
-
#
|
|
16
|
-
# @example Uso base
|
|
17
|
-
# bui_container(html_content: "Contenuto del container")
|
|
18
|
-
#
|
|
19
|
-
# @example Container fluid
|
|
20
|
-
# bui_container(
|
|
21
|
-
# html_content: "Contenuto full width",
|
|
22
|
-
# fluid: true
|
|
23
|
-
# )
|
|
24
|
-
#
|
|
25
|
-
# @example Container con larghezza massima
|
|
26
|
-
# bui_container(
|
|
27
|
-
# html_content: "Contenuto limitato",
|
|
28
|
-
# max_width: :lg,
|
|
29
|
-
# padding: :large
|
|
30
|
-
# )
|
|
31
|
-
#
|
|
32
|
-
# @example Con contenuto block
|
|
33
|
-
# bui_container(background: :light) do
|
|
34
|
-
# "<div>Il mio contenuto</div>".html_safe
|
|
35
|
-
# end
|
|
36
|
-
def bui_container(
|
|
37
|
-
html_content: nil,
|
|
38
|
-
fluid: false,
|
|
39
|
-
max_width: :lg,
|
|
40
|
-
padding: :medium,
|
|
41
|
-
background: :white,
|
|
42
|
-
border: false,
|
|
43
|
-
**html_options,
|
|
44
|
-
&block
|
|
45
|
-
)
|
|
46
|
-
render BetterUi::General::Container::Component.new(
|
|
47
|
-
html_content: html_content,
|
|
48
|
-
fluid: fluid,
|
|
49
|
-
max_width: max_width,
|
|
50
|
-
padding: padding,
|
|
51
|
-
background: background,
|
|
52
|
-
border: border,
|
|
53
|
-
**html_options
|
|
54
|
-
), &block
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
@@ -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
|