better_ui 0.4.0 → 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 +4 -4
- data/README.md +141 -189
- data/app/assets/stylesheets/better_ui/_base.scss +9 -0
- data/app/assets/stylesheets/better_ui/_components.scss +2 -0
- data/app/assets/stylesheets/better_ui/_utilities.scss +14 -0
- data/app/assets/stylesheets/better_ui/application.css +3 -1
- data/app/assets/stylesheets/better_ui/components/_avatar.scss +200 -0
- data/app/assets/stylesheets/better_ui/components/_badge.scss +154 -0
- data/app/assets/stylesheets/better_ui/components/_breadcrumb.scss +106 -0
- data/app/assets/stylesheets/better_ui/components/_button.scss +105 -0
- data/app/assets/stylesheets/better_ui/components/_card.scss +60 -0
- data/app/assets/stylesheets/better_ui/components/_heading.scss +81 -0
- data/app/assets/stylesheets/better_ui/components/_icon.scss +134 -0
- data/app/assets/stylesheets/better_ui/components/_index.scss +17 -0
- data/app/assets/stylesheets/better_ui/components/_link.scss +100 -0
- data/app/assets/stylesheets/better_ui/components/_panel.scss +104 -0
- data/app/assets/stylesheets/better_ui/components/_spinner.scss +129 -0
- data/app/assets/stylesheets/better_ui/components/_table.scss +156 -0
- data/app/assets/stylesheets/better_ui/components/_variables.scss +1 -0
- data/app/assets/stylesheets/better_ui.scss +4 -0
- data/app/components/better_ui/application/alert_component.html.erb +1 -1
- data/app/components/better_ui/application/alert_component.rb +95 -89
- data/app/components/better_ui/application/card_component.html.erb +24 -0
- data/app/components/better_ui/application/card_component.rb +53 -0
- data/app/components/better_ui/application/card_container_component.html.erb +8 -0
- data/app/components/better_ui/application/card_container_component.rb +14 -0
- data/app/components/better_ui/application/toast_component.rb +92 -57
- data/app/components/better_ui/general/avatar_component.html.erb +19 -0
- data/app/components/better_ui/general/avatar_component.rb +171 -0
- data/app/components/better_ui/general/badge_component.html.erb +19 -0
- data/app/components/better_ui/general/badge_component.rb +135 -0
- data/app/components/better_ui/general/breadcrumb_component.html.erb +7 -31
- data/app/components/better_ui/general/breadcrumb_component.rb +64 -66
- data/app/components/better_ui/general/button_component.html.erb +6 -6
- data/app/components/better_ui/general/button_component.rb +62 -95
- data/app/components/better_ui/general/heading_component.html.erb +1 -25
- data/app/components/better_ui/general/heading_component.rb +20 -113
- data/app/components/better_ui/general/icon_component.rb +37 -61
- data/app/components/better_ui/general/link_component.html.erb +17 -0
- data/app/components/better_ui/general/link_component.rb +132 -0
- data/app/components/better_ui/general/panel_component.rb +51 -56
- data/app/components/better_ui/general/spinner_component.html.erb +15 -0
- data/app/components/better_ui/general/spinner_component.rb +79 -0
- data/app/components/better_ui/general/table_component.html.erb +56 -20
- data/app/components/better_ui/general/table_component.rb +89 -87
- data/app/helpers/better_ui/general/components/avatar_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/badge_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/breadcrumb_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/button_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/heading_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/icon_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/link_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/panel_helper.rb +16 -0
- data/app/helpers/better_ui/general/components/spinner_helper.rb +17 -0
- data/app/helpers/better_ui/general/components/table_helper.rb +17 -0
- data/app/helpers/better_ui/general_helper.rb +15 -0
- data/app/helpers/better_ui_helper.rb +12 -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/config/routes.rb +2 -13
- data/lib/better_ui/engine.rb +66 -16
- data/lib/better_ui/version.rb +1 -1
- data/lib/better_ui.rb +12 -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/README +125 -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
- metadata +120 -49
- data/app/assets/javascripts/better_ui/controllers/navbar_controller.js +0 -138
- data/app/assets/javascripts/better_ui/controllers/sidebar_controller.js +0 -211
- data/app/assets/javascripts/better_ui/controllers/toast_controller.js +0 -161
- data/app/assets/javascripts/better_ui/index.js +0 -159
- data/app/assets/javascripts/better_ui/toast_manager.js +0 -77
- data/app/components/better_ui/theme_helper.rb +0 -169
- data/app/controllers/better_ui/docs_controller.rb +0 -34
- data/app/helpers/better_ui_application_helper.rb +0 -99
@@ -0,0 +1,159 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BetterUi
|
4
|
+
module Generators
|
5
|
+
# Generatore per creare file SCSS personalizzati per i componenti BetterUI
|
6
|
+
#
|
7
|
+
# Questo generatore crea:
|
8
|
+
# 1. Un foglio di stile principale che importa tutti i componenti usando @use/@forward
|
9
|
+
# 2. File di override per ogni componente che permettono personalizzazioni senza modificare i file originali
|
10
|
+
# 3. Un file indice che raccoglie tutti gli override usando @forward
|
11
|
+
class StylesheetGenerator < Rails::Generators::Base
|
12
|
+
source_root File.expand_path('templates', __dir__)
|
13
|
+
|
14
|
+
desc "Genera un foglio di stile SCSS di base per personalizzare i componenti di BetterUI"
|
15
|
+
|
16
|
+
# Opzioni configurabili
|
17
|
+
class_option :prefix, type: :string, default: "custom",
|
18
|
+
desc: "Prefisso da utilizzare per il foglio di stile (default: 'custom')"
|
19
|
+
class_option :path, type: :string, default: "app/assets/stylesheets",
|
20
|
+
desc: "Path dove installare i file CSS all'interno della cartella app (default: 'app/assets/stylesheets')"
|
21
|
+
|
22
|
+
# Lista dei file dei componenti da gestire
|
23
|
+
COMPONENT_FILES = [
|
24
|
+
'_variables.scss',
|
25
|
+
'_button.scss',
|
26
|
+
'_heading.scss',
|
27
|
+
'_breadcrumb.scss',
|
28
|
+
'_link.scss',
|
29
|
+
'_panel.scss',
|
30
|
+
'_icon.scss',
|
31
|
+
'_table.scss',
|
32
|
+
'_badge.scss',
|
33
|
+
'_spinner.scss',
|
34
|
+
'_avatar.scss',
|
35
|
+
'_card.scss'
|
36
|
+
].freeze
|
37
|
+
|
38
|
+
# Crea il foglio di stile principale
|
39
|
+
def create_stylesheet
|
40
|
+
# Crea il file principale che importa tutti i componenti
|
41
|
+
template "components_stylesheet.scss",
|
42
|
+
File.join(options[:path], "#{options[:prefix]}_better_ui.scss")
|
43
|
+
|
44
|
+
# Crea la directory dei componenti se non esiste
|
45
|
+
directory = File.join(options[:path], "components")
|
46
|
+
FileUtils.mkdir_p(directory) unless File.directory?(directory)
|
47
|
+
|
48
|
+
# Crea il file indice che raccoglie tutti gli override
|
49
|
+
template "index.scss", File.join(directory, "_index.scss")
|
50
|
+
end
|
51
|
+
|
52
|
+
# Crea i file di override per ogni componente
|
53
|
+
def create_overrides
|
54
|
+
# Crea la directory dei componenti se non esiste
|
55
|
+
directory = File.join(options[:path], "components")
|
56
|
+
FileUtils.mkdir_p(directory) unless File.directory?(directory)
|
57
|
+
|
58
|
+
# Crea i file di override per ogni componente
|
59
|
+
COMPONENT_FILES.each do |filename|
|
60
|
+
# Nome del file di override (es. _button_overrides.scss)
|
61
|
+
override_filename = filename.sub('.scss', '_overrides.scss')
|
62
|
+
override_path = File.join(directory, override_filename)
|
63
|
+
|
64
|
+
# Crea il file di override solo se non esiste già
|
65
|
+
unless File.exist?(override_path)
|
66
|
+
# Percorso del file template originale
|
67
|
+
template_path = File.join(self.class.source_root, "components", filename)
|
68
|
+
|
69
|
+
# Se il file template esiste, crea il file di override basato su di esso
|
70
|
+
if File.exist?(template_path)
|
71
|
+
original_content = File.read(template_path)
|
72
|
+
override_content = generate_empty_override(original_content, filename)
|
73
|
+
create_file override_path, override_content
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Mostra le istruzioni README dopo l'esecuzione del generatore
|
80
|
+
def show_readme
|
81
|
+
readme "README" if behavior == :invoke
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
# Genera un file di override vuoto con le stesse classi del file originale
|
87
|
+
#
|
88
|
+
# @param content [String] Il contenuto del file SCSS originale
|
89
|
+
# @param filename [String] Il nome del file del componente
|
90
|
+
# @return [String] Il contenuto formattato del file di override
|
91
|
+
def generate_empty_override(content, filename)
|
92
|
+
# Estrae il nome del componente dal nome file (es. "_button.scss" -> "button")
|
93
|
+
component_name = filename.sub('_', '').sub('.scss', '')
|
94
|
+
|
95
|
+
# Intestazione del file di override
|
96
|
+
result = "/* ==============================\n"
|
97
|
+
result += " * #{component_name.capitalize} Component Overrides\n"
|
98
|
+
result += " * ==============================\n"
|
99
|
+
result += " * Questo file contiene le classi vuote per sovrascrivere gli stili di default.\n"
|
100
|
+
result += " * Aggiungi qui le tue personalizzazioni.\n"
|
101
|
+
result += " */\n\n"
|
102
|
+
|
103
|
+
# Aggiungiamo il layer di Tailwind se presente nell'originale
|
104
|
+
if content.include?('@layer components')
|
105
|
+
result += "@layer components {\n"
|
106
|
+
layer_present = true
|
107
|
+
end
|
108
|
+
|
109
|
+
# Estrae le classi principali (Block) usando regex
|
110
|
+
class_matches = content.scan(/\.(bui-[a-zA-Z0-9_-]+)\s*\{/)
|
111
|
+
class_matches.flatten.uniq.each do |css_class|
|
112
|
+
result += layer_present ? " " : ""
|
113
|
+
result += ".#{css_class} {\n // Aggiungi personalizzazioni qui\n#{layer_present ? " " : ""}}\n\n"
|
114
|
+
end
|
115
|
+
|
116
|
+
# Estrae classi modifier (es. &--small, &__icon, ecc.)
|
117
|
+
modifier_matches = content.scan(/&([a-zA-Z0-9_-]+)\s*\{/)
|
118
|
+
if !modifier_matches.empty?
|
119
|
+
# Raggruppa i modifier per classe principale
|
120
|
+
main_classes = class_matches.flatten.uniq
|
121
|
+
main_classes.each do |main_class|
|
122
|
+
# Estrae tutti i modifier di questa classe principale
|
123
|
+
class_content = extract_class_block(content, main_class)
|
124
|
+
modifiers = class_content.scan(/&([a-zA-Z0-9_-]+)\s*\{/).flatten.uniq
|
125
|
+
|
126
|
+
if !modifiers.empty?
|
127
|
+
result += layer_present ? " " : ""
|
128
|
+
result += ".#{main_class} {\n"
|
129
|
+
|
130
|
+
modifiers.each do |modifier|
|
131
|
+
result += layer_present ? " " : " "
|
132
|
+
result += "&#{modifier} {\n // Aggiungi personalizzazioni qui\n#{layer_present ? " " : " "}}\n\n"
|
133
|
+
end
|
134
|
+
|
135
|
+
result += layer_present ? " " : ""
|
136
|
+
result += "}\n\n"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# Chiude il layer se presente
|
142
|
+
result += "}\n" if layer_present
|
143
|
+
|
144
|
+
result
|
145
|
+
end
|
146
|
+
|
147
|
+
# Estrae il blocco di codice relativo a una classe CSS specifica
|
148
|
+
#
|
149
|
+
# @param content [String] Il contenuto del file SCSS completo
|
150
|
+
# @param css_class [String] Il nome della classe CSS da estrarre
|
151
|
+
# @return [String] Il blocco di codice della classe
|
152
|
+
def extract_class_block(content, css_class)
|
153
|
+
regex = /\.(#{css_class})\s*\{((?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*)\}/m
|
154
|
+
match = content.match(regex)
|
155
|
+
match ? match[2] : ""
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
==========================================================
|
2
|
+
BETTER UI
|
3
|
+
==========================================================
|
4
|
+
|
5
|
+
Fogli di stile per componenti generati con successo!
|
6
|
+
|
7
|
+
STRUTTURA DEI FILE:
|
8
|
+
----------------------------------------------------------
|
9
|
+
I seguenti file sono stati creati:
|
10
|
+
|
11
|
+
1. File principale:
|
12
|
+
* <%= options[:prefix] %>_better_ui_components.scss
|
13
|
+
|
14
|
+
2. File indice:
|
15
|
+
* components/_index.scss (raccoglie tutti gli override usando @forward)
|
16
|
+
|
17
|
+
3. File di override:
|
18
|
+
* components/_variables_overrides.scss
|
19
|
+
* components/_button_overrides.scss
|
20
|
+
* components/_heading_overrides.scss
|
21
|
+
... e altri file di override
|
22
|
+
|
23
|
+
COME UTILIZZARE:
|
24
|
+
----------------------------------------------------------
|
25
|
+
1. Il file principale già utilizza @use per importare tutti i componenti:
|
26
|
+
@use 'better_ui/components' as bui;
|
27
|
+
@use 'components/index' as overrides;
|
28
|
+
|
29
|
+
2. Personalizza i componenti modificando i file *_overrides.scss:
|
30
|
+
Ogni file di override contiene classi vuote corrispondenti
|
31
|
+
alle classi originali, pronte per essere personalizzate.
|
32
|
+
|
33
|
+
3. Se hai bisogno di aggiungere nuovi file SCSS, ricorda di includere
|
34
|
+
il riferimento nel file components/_index.scss usando @forward.
|
35
|
+
|
36
|
+
BEST PRACTICES:
|
37
|
+
----------------------------------------------------------
|
38
|
+
* Segui la metodologia BEM per le tue personalizzazioni
|
39
|
+
* Usa le variabili CSS definite in _variables.scss
|
40
|
+
* Mantieni la coerenza visiva tra i componenti
|
41
|
+
* Aggiungi nuovi modificatori nei file di override
|
42
|
+
|
43
|
+
ESEMPIO DI PERSONALIZZAZIONE:
|
44
|
+
----------------------------------------------------------
|
45
|
+
// In _button_overrides.scss
|
46
|
+
@layer components {
|
47
|
+
.bui-button {
|
48
|
+
// Modifica la classe base
|
49
|
+
@apply transition-all;
|
50
|
+
|
51
|
+
// Modifica uno specifico modificatore
|
52
|
+
&--primary {
|
53
|
+
@apply bg-indigo-600 hover:bg-indigo-700;
|
54
|
+
}
|
55
|
+
|
56
|
+
// Aggiungi un nuovo modificatore
|
57
|
+
&--custom {
|
58
|
+
@apply bg-gradient-to-r from-purple-500 to-pink-500;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
===============================================================================
|
64
|
+
|
65
|
+
Installazione completata!
|
66
|
+
|
67
|
+
Il tuo foglio di stile SCSS per la personalizzazione dei componenti di BetterUi
|
68
|
+
è stato creato in:
|
69
|
+
|
70
|
+
<%= options[:path] %>/<%= options[:prefix] %>_better_ui_components.scss
|
71
|
+
|
72
|
+
===============================================================================
|
73
|
+
|
74
|
+
PROSSIMI PASSI:
|
75
|
+
|
76
|
+
1. Assicurati che Tailwind CSS sia correttamente configurato nel tuo progetto.
|
77
|
+
Questo foglio di stile utilizza le utility @apply di Tailwind CSS.
|
78
|
+
|
79
|
+
2. Importa il foglio di stile nella tua applicazione:
|
80
|
+
|
81
|
+
In app/assets/stylesheets/application.scss:
|
82
|
+
|
83
|
+
@use '<%= options[:prefix] %>_better_ui_components';
|
84
|
+
|
85
|
+
Oppure in app/assets/stylesheets/application.css:
|
86
|
+
|
87
|
+
/*
|
88
|
+
*= require <%= options[:prefix] %>_better_ui_components
|
89
|
+
*/
|
90
|
+
|
91
|
+
Se hai utilizzato un path personalizzato, assicurati di importare
|
92
|
+
correttamente il file dal percorso specificato.
|
93
|
+
|
94
|
+
3. I file SCSS utilizzano la moderna sintassi @use e @forward di Sass
|
95
|
+
invece della sintassi @import deprecata. Questo ti permette di evitare
|
96
|
+
conflitti di nome e organizzare meglio il tuo codice SCSS.
|
97
|
+
|
98
|
+
4. Personalizza le variabili SCSS e le classi secondo le tue esigenze.
|
99
|
+
Il foglio di stile utilizza le classi di Tailwind CSS tramite la direttiva
|
100
|
+
@apply, consentendoti di sfruttare l'ecosistema Tailwind mantenendo un
|
101
|
+
codice SCSS organizzato e modulare.
|
102
|
+
|
103
|
+
5. Nei componenti Ruby, usa le classi con prefisso 'bui-' invece di includere
|
104
|
+
direttamente le classi Tailwind. Ad esempio per i bottoni:
|
105
|
+
|
106
|
+
# Esempio di utilizzo di classi CSS personalizzate
|
107
|
+
BUTTON_TYPES = {
|
108
|
+
default: "bui-btn-default",
|
109
|
+
red: "bui-btn-red",
|
110
|
+
blue: "bui-btn-blue"
|
111
|
+
}
|
112
|
+
|
113
|
+
Questo approccio centralizza gli stili nel foglio SCSS e rende più facile
|
114
|
+
mantenere e modificare l'aspetto dei componenti.
|
115
|
+
|
116
|
+
6. Assicurati che il tuo foglio di stile venga caricato dopo i fogli di stile
|
117
|
+
di BetterUI per sovrascrivere correttamente gli stili predefiniti.
|
118
|
+
|
119
|
+
===============================================================================
|
120
|
+
|
121
|
+
Per ulteriori informazioni sulla personalizzazione dei componenti,
|
122
|
+
consulta la documentazione ufficiale su:
|
123
|
+
https://github.com/YOUR_USERNAME/better_ui
|
124
|
+
|
125
|
+
===============================================================================
|
@@ -0,0 +1,200 @@
|
|
1
|
+
@layer components {
|
2
|
+
// Classe base per l'avatar (Block)
|
3
|
+
.bui-avatar {
|
4
|
+
@apply inline-flex items-center justify-center relative;
|
5
|
+
|
6
|
+
// Elements
|
7
|
+
&__image {
|
8
|
+
@apply object-cover;
|
9
|
+
}
|
10
|
+
|
11
|
+
&__placeholder {
|
12
|
+
@apply flex items-center justify-center font-medium text-white uppercase;
|
13
|
+
}
|
14
|
+
|
15
|
+
&__status {
|
16
|
+
@apply absolute bottom-0 right-0 block rounded-full ring-2 ring-white;
|
17
|
+
|
18
|
+
&--online {
|
19
|
+
@apply bg-green-400;
|
20
|
+
}
|
21
|
+
|
22
|
+
&--offline {
|
23
|
+
@apply bg-gray-400;
|
24
|
+
}
|
25
|
+
|
26
|
+
&--busy {
|
27
|
+
@apply bg-red-400;
|
28
|
+
}
|
29
|
+
|
30
|
+
&--away {
|
31
|
+
@apply bg-yellow-400;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
&__presence {
|
36
|
+
@apply absolute block rounded-full ring-2 ring-white;
|
37
|
+
}
|
38
|
+
|
39
|
+
&__badge {
|
40
|
+
@apply absolute -top-1 -right-1 flex items-center justify-center;
|
41
|
+
}
|
42
|
+
|
43
|
+
// Modifiers (dimensioni)
|
44
|
+
&--xs {
|
45
|
+
@apply h-6 w-6;
|
46
|
+
|
47
|
+
.bui-avatar__placeholder {
|
48
|
+
@apply text-xs;
|
49
|
+
}
|
50
|
+
|
51
|
+
.bui-avatar__status {
|
52
|
+
@apply h-1.5 w-1.5;
|
53
|
+
}
|
54
|
+
|
55
|
+
.bui-avatar__badge {
|
56
|
+
@apply h-4 w-4 text-[0.6rem];
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
&--sm {
|
61
|
+
@apply h-8 w-8;
|
62
|
+
|
63
|
+
.bui-avatar__placeholder {
|
64
|
+
@apply text-xs;
|
65
|
+
}
|
66
|
+
|
67
|
+
.bui-avatar__status {
|
68
|
+
@apply h-2 w-2;
|
69
|
+
}
|
70
|
+
|
71
|
+
.bui-avatar__badge {
|
72
|
+
@apply h-5 w-5 text-xs;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
&--md {
|
77
|
+
@apply h-10 w-10;
|
78
|
+
|
79
|
+
.bui-avatar__placeholder {
|
80
|
+
@apply text-sm;
|
81
|
+
}
|
82
|
+
|
83
|
+
.bui-avatar__status {
|
84
|
+
@apply h-2.5 w-2.5;
|
85
|
+
}
|
86
|
+
|
87
|
+
.bui-avatar__badge {
|
88
|
+
@apply h-6 w-6 text-xs;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
&--lg {
|
93
|
+
@apply h-12 w-12;
|
94
|
+
|
95
|
+
.bui-avatar__placeholder {
|
96
|
+
@apply text-base;
|
97
|
+
}
|
98
|
+
|
99
|
+
.bui-avatar__status {
|
100
|
+
@apply h-3 w-3;
|
101
|
+
}
|
102
|
+
|
103
|
+
.bui-avatar__badge {
|
104
|
+
@apply h-7 w-7 text-sm;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
&--xl {
|
109
|
+
@apply h-16 w-16;
|
110
|
+
|
111
|
+
.bui-avatar__placeholder {
|
112
|
+
@apply text-lg;
|
113
|
+
}
|
114
|
+
|
115
|
+
.bui-avatar__status {
|
116
|
+
@apply h-4 w-4;
|
117
|
+
}
|
118
|
+
|
119
|
+
.bui-avatar__badge {
|
120
|
+
@apply h-8 w-8 text-sm;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
// Modifiers (colori placeholders)
|
125
|
+
&--gray {
|
126
|
+
.bui-avatar__placeholder {
|
127
|
+
@apply bg-gray-500;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
|
131
|
+
&--red {
|
132
|
+
.bui-avatar__placeholder {
|
133
|
+
@apply bg-red-500;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
&--blue {
|
138
|
+
.bui-avatar__placeholder {
|
139
|
+
@apply bg-blue-500;
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
&--green {
|
144
|
+
.bui-avatar__placeholder {
|
145
|
+
@apply bg-green-500;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
&--violet {
|
150
|
+
.bui-avatar__placeholder {
|
151
|
+
@apply bg-violet-500;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
&--orange {
|
156
|
+
.bui-avatar__placeholder {
|
157
|
+
@apply bg-orange-500;
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
&--yellow {
|
162
|
+
.bui-avatar__placeholder {
|
163
|
+
@apply bg-yellow-500 text-yellow-900;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
// Modifiers (forma)
|
168
|
+
&--circle {
|
169
|
+
@apply rounded-full;
|
170
|
+
|
171
|
+
.bui-avatar__image,
|
172
|
+
.bui-avatar__placeholder {
|
173
|
+
@apply rounded-full;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
|
177
|
+
&--square {
|
178
|
+
@apply rounded-md;
|
179
|
+
|
180
|
+
.bui-avatar__image,
|
181
|
+
.bui-avatar__placeholder {
|
182
|
+
@apply rounded-md;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
|
186
|
+
// Modifiers (gruppo)
|
187
|
+
&--group {
|
188
|
+
@apply -ml-2 first:ml-0;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
192
|
+
// Avatar group container
|
193
|
+
.bui-avatar-group {
|
194
|
+
@apply flex;
|
195
|
+
|
196
|
+
.bui-avatar {
|
197
|
+
@apply border-2 border-white;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
@@ -0,0 +1,154 @@
|
|
1
|
+
@layer components {
|
2
|
+
// Classe base per il badge (Block)
|
3
|
+
.bui-badge {
|
4
|
+
@apply inline-flex items-center justify-center rounded-full px-2.5 py-0.5 text-xs font-medium;
|
5
|
+
|
6
|
+
// Elements
|
7
|
+
&__icon {
|
8
|
+
@apply flex-shrink-0;
|
9
|
+
|
10
|
+
&--left {
|
11
|
+
@apply -ml-0.5 mr-1.5;
|
12
|
+
}
|
13
|
+
|
14
|
+
&--right {
|
15
|
+
@apply -mr-0.5 ml-1.5;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
&__text {
|
20
|
+
@apply whitespace-nowrap;
|
21
|
+
}
|
22
|
+
|
23
|
+
&__dot {
|
24
|
+
@apply h-2 w-2 rounded-full mr-1.5;
|
25
|
+
}
|
26
|
+
|
27
|
+
// Modifiers (varianti colore)
|
28
|
+
&--default {
|
29
|
+
@apply bg-gray-100 text-gray-800;
|
30
|
+
|
31
|
+
.bui-badge__dot {
|
32
|
+
@apply bg-gray-500;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
&--white {
|
37
|
+
@apply bg-white text-gray-800 border border-gray-200;
|
38
|
+
|
39
|
+
.bui-badge__dot {
|
40
|
+
@apply bg-gray-400;
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
&--red {
|
45
|
+
@apply bg-red-100 text-red-800;
|
46
|
+
|
47
|
+
.bui-badge__dot {
|
48
|
+
@apply bg-red-500;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
&--rose {
|
53
|
+
@apply bg-rose-100 text-rose-800;
|
54
|
+
|
55
|
+
.bui-badge__dot {
|
56
|
+
@apply bg-rose-500;
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
&--orange {
|
61
|
+
@apply bg-orange-100 text-orange-800;
|
62
|
+
|
63
|
+
.bui-badge__dot {
|
64
|
+
@apply bg-orange-500;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
&--green {
|
69
|
+
@apply bg-green-100 text-green-800;
|
70
|
+
|
71
|
+
.bui-badge__dot {
|
72
|
+
@apply bg-green-500;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
&--blue {
|
77
|
+
@apply bg-blue-100 text-blue-800;
|
78
|
+
|
79
|
+
.bui-badge__dot {
|
80
|
+
@apply bg-blue-500;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
&--yellow {
|
85
|
+
@apply bg-yellow-100 text-yellow-800;
|
86
|
+
|
87
|
+
.bui-badge__dot {
|
88
|
+
@apply bg-yellow-500;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
&--violet {
|
93
|
+
@apply bg-violet-100 text-violet-800;
|
94
|
+
|
95
|
+
.bui-badge__dot {
|
96
|
+
@apply bg-violet-500;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
// Modifiers (varianti dimensione)
|
101
|
+
&--small {
|
102
|
+
@apply text-xs px-2 py-0.5;
|
103
|
+
}
|
104
|
+
|
105
|
+
&--medium {
|
106
|
+
@apply text-sm px-2.5 py-0.5;
|
107
|
+
}
|
108
|
+
|
109
|
+
&--large {
|
110
|
+
@apply text-sm px-3 py-1;
|
111
|
+
}
|
112
|
+
|
113
|
+
// Modifiers (varianti stile)
|
114
|
+
&--pill {
|
115
|
+
@apply rounded-full;
|
116
|
+
}
|
117
|
+
|
118
|
+
&--square {
|
119
|
+
@apply rounded-md;
|
120
|
+
}
|
121
|
+
|
122
|
+
&--outline {
|
123
|
+
@apply bg-transparent border;
|
124
|
+
|
125
|
+
&.bui-badge--red {
|
126
|
+
@apply border-red-500 text-red-700 bg-transparent;
|
127
|
+
}
|
128
|
+
|
129
|
+
&.bui-badge--green {
|
130
|
+
@apply border-green-500 text-green-700 bg-transparent;
|
131
|
+
}
|
132
|
+
|
133
|
+
&.bui-badge--blue {
|
134
|
+
@apply border-blue-500 text-blue-700 bg-transparent;
|
135
|
+
}
|
136
|
+
|
137
|
+
&.bui-badge--yellow {
|
138
|
+
@apply border-yellow-500 text-yellow-700 bg-transparent;
|
139
|
+
}
|
140
|
+
|
141
|
+
&.bui-badge--violet {
|
142
|
+
@apply border-violet-500 text-violet-700 bg-transparent;
|
143
|
+
}
|
144
|
+
|
145
|
+
&.bui-badge--orange {
|
146
|
+
@apply border-orange-500 text-orange-700 bg-transparent;
|
147
|
+
}
|
148
|
+
|
149
|
+
&.bui-badge--rose {
|
150
|
+
@apply border-rose-500 text-rose-700 bg-transparent;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
}
|