better_ui 0.5.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.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +137 -245
  3. data/app/assets/stylesheets/better_ui/_base.scss +9 -0
  4. data/app/assets/stylesheets/better_ui/_components.scss +2 -0
  5. data/app/assets/stylesheets/better_ui/_utilities.scss +14 -0
  6. data/app/assets/stylesheets/better_ui/application.css +3 -1
  7. data/app/assets/stylesheets/better_ui/components/_avatar.scss +200 -0
  8. data/app/assets/stylesheets/better_ui/components/_badge.scss +154 -0
  9. data/app/assets/stylesheets/better_ui/components/_breadcrumb.scss +106 -0
  10. data/app/assets/stylesheets/better_ui/components/_button.scss +105 -0
  11. data/app/assets/stylesheets/better_ui/components/_card.scss +60 -0
  12. data/app/assets/stylesheets/better_ui/components/_heading.scss +81 -0
  13. data/app/assets/stylesheets/better_ui/components/_icon.scss +134 -0
  14. data/app/assets/stylesheets/better_ui/components/_index.scss +17 -0
  15. data/app/assets/stylesheets/better_ui/components/_link.scss +100 -0
  16. data/app/assets/stylesheets/better_ui/components/_panel.scss +104 -0
  17. data/app/assets/stylesheets/better_ui/components/_spinner.scss +129 -0
  18. data/app/assets/stylesheets/better_ui/components/_table.scss +156 -0
  19. data/app/assets/stylesheets/better_ui/components/_variables.scss +1 -0
  20. data/app/assets/stylesheets/better_ui.scss +4 -0
  21. data/app/components/better_ui/general/avatar_component.html.erb +2 -2
  22. data/app/components/better_ui/general/avatar_component.rb +29 -29
  23. data/app/components/better_ui/general/badge_component.html.erb +3 -3
  24. data/app/components/better_ui/general/badge_component.rb +32 -20
  25. data/app/components/better_ui/general/breadcrumb_component.html.erb +2 -2
  26. data/app/components/better_ui/general/breadcrumb_component.rb +23 -23
  27. data/app/components/better_ui/general/button_component.html.erb +6 -6
  28. data/app/components/better_ui/general/button_component.rb +20 -22
  29. data/app/components/better_ui/general/heading_component.html.erb +1 -25
  30. data/app/components/better_ui/general/heading_component.rb +17 -116
  31. data/app/components/better_ui/general/icon_component.html.erb +1 -1
  32. data/app/components/better_ui/general/icon_component.rb +33 -56
  33. data/app/components/better_ui/general/link_component.html.erb +4 -4
  34. data/app/components/better_ui/general/link_component.rb +28 -28
  35. data/app/components/better_ui/general/panel_component.rb +30 -41
  36. data/app/components/better_ui/general/spinner_component.html.erb +3 -3
  37. data/app/components/better_ui/general/spinner_component.rb +13 -13
  38. data/app/components/better_ui/general/table_component.rb +35 -59
  39. data/app/helpers/better_ui/general/components/avatar_helper.rb +17 -0
  40. data/app/helpers/better_ui/general/components/badge_helper.rb +17 -0
  41. data/app/helpers/better_ui/general/components/breadcrumb_helper.rb +17 -0
  42. data/app/helpers/better_ui/general/components/button_helper.rb +17 -0
  43. data/app/helpers/better_ui/general/components/heading_helper.rb +17 -0
  44. data/app/helpers/better_ui/general/components/icon_helper.rb +17 -0
  45. data/app/helpers/better_ui/general/components/link_helper.rb +17 -0
  46. data/app/helpers/better_ui/general/components/panel_helper.rb +16 -0
  47. data/app/helpers/better_ui/general/components/spinner_helper.rb +17 -0
  48. data/app/helpers/better_ui/general/components/table_helper.rb +17 -0
  49. data/app/helpers/better_ui/general_helper.rb +15 -0
  50. data/app/helpers/better_ui_helper.rb +12 -0
  51. data/config/routes.rb +2 -13
  52. data/lib/better_ui/engine.rb +67 -11
  53. data/lib/better_ui/version.rb +1 -1
  54. data/lib/better_ui.rb +10 -2
  55. data/lib/generators/better_ui/install_generator.rb +103 -0
  56. data/lib/generators/better_ui/stylesheet_generator.rb +93 -30
  57. data/lib/generators/better_ui/templates/README +74 -5
  58. data/lib/generators/better_ui/templates/components/_avatar.scss +199 -150
  59. data/lib/generators/better_ui/templates/components/_badge.scss +153 -141
  60. data/lib/generators/better_ui/templates/components/_breadcrumb.scss +105 -106
  61. data/lib/generators/better_ui/templates/components/_button.scss +104 -101
  62. data/lib/generators/better_ui/templates/components/_card.scss +56 -65
  63. data/lib/generators/better_ui/templates/components/_heading.scss +80 -179
  64. data/lib/generators/better_ui/templates/components/_icon.scss +133 -89
  65. data/lib/generators/better_ui/templates/components/_index.scss +17 -0
  66. data/lib/generators/better_ui/templates/components/_link.scss +99 -129
  67. data/lib/generators/better_ui/templates/components/_panel.scss +103 -143
  68. data/lib/generators/better_ui/templates/components/_spinner.scss +127 -130
  69. data/lib/generators/better_ui/templates/components/_table.scss +156 -105
  70. data/lib/generators/better_ui/templates/components/_variables.scss +0 -33
  71. data/lib/generators/better_ui/templates/components_stylesheet.scss +25 -56
  72. data/lib/generators/better_ui/templates/index.scss +18 -0
  73. data/lib/generators/better_ui/templates/initializer.rb +41 -0
  74. metadata +91 -49
  75. data/app/assets/javascripts/better_ui/controllers/navbar_controller.js +0 -138
  76. data/app/assets/javascripts/better_ui/controllers/sidebar_controller.js +0 -211
  77. data/app/assets/javascripts/better_ui/controllers/toast_controller.js +0 -161
  78. data/app/assets/javascripts/better_ui/index.js +0 -159
  79. data/app/assets/javascripts/better_ui/toast_manager.js +0 -77
  80. data/app/components/better_ui/theme_helper.rb +0 -171
  81. data/app/controllers/better_ui/docs_controller.rb +0 -34
@@ -1,3 +1,65 @@
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
+
1
63
  ===============================================================================
2
64
 
3
65
  Installazione completata!
@@ -5,7 +67,7 @@ Installazione completata!
5
67
  Il tuo foglio di stile SCSS per la personalizzazione dei componenti di BetterUi
6
68
  è stato creato in:
7
69
 
8
- app/assets/stylesheets/<%= options[:prefix] %>_better_ui_components.scss
70
+ <%= options[:path] %>/<%= options[:prefix] %>_better_ui_components.scss
9
71
 
10
72
  ===============================================================================
11
73
 
@@ -18,7 +80,7 @@ PROSSIMI PASSI:
18
80
 
19
81
  In app/assets/stylesheets/application.scss:
20
82
 
21
- @import '<%= options[:prefix] %>_better_ui_components';
83
+ @use '<%= options[:prefix] %>_better_ui_components';
22
84
 
23
85
  Oppure in app/assets/stylesheets/application.css:
24
86
 
@@ -26,12 +88,19 @@ PROSSIMI PASSI:
26
88
  *= require <%= options[:prefix] %>_better_ui_components
27
89
  */
28
90
 
29
- 3. Personalizza le variabili SCSS e le classi secondo le tue esigenze.
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.
30
99
  Il foglio di stile utilizza le classi di Tailwind CSS tramite la direttiva
31
100
  @apply, consentendoti di sfruttare l'ecosistema Tailwind mantenendo un
32
101
  codice SCSS organizzato e modulare.
33
102
 
34
- 4. Nei componenti Ruby, usa le classi con prefisso 'bui-' invece di includere
103
+ 5. Nei componenti Ruby, usa le classi con prefisso 'bui-' invece di includere
35
104
  direttamente le classi Tailwind. Ad esempio per i bottoni:
36
105
 
37
106
  # Esempio di utilizzo di classi CSS personalizzate
@@ -44,7 +113,7 @@ PROSSIMI PASSI:
44
113
  Questo approccio centralizza gli stili nel foglio SCSS e rende più facile
45
114
  mantenere e modificare l'aspetto dei componenti.
46
115
 
47
- 5. Assicurati che il tuo foglio di stile venga caricato dopo i fogli di stile
116
+ 6. Assicurati che il tuo foglio di stile venga caricato dopo i fogli di stile
48
117
  di BetterUI per sovrascrivere correttamente gli stili predefiniti.
49
118
 
50
119
  ===============================================================================
@@ -1,151 +1,200 @@
1
- /* ==============================
2
- * Avatar Component
3
- * ============================== */
4
-
5
- /* Stile base */
6
- .bui-avatar {
7
- @apply relative inline-flex items-center justify-center;
8
- @apply box-border;
9
- @apply overflow-hidden;
10
- }
11
-
12
- /* Dimensioni */
13
- .bui-avatar-size-xxsmall {
14
- @apply w-5 h-5;
15
- @apply text-[0.625rem];
16
- }
17
-
18
- .bui-avatar-size-xsmall {
19
- @apply w-6 h-6;
20
- @apply text-xs;
21
- }
22
-
23
- .bui-avatar-size-small {
24
- @apply w-8 h-8;
25
- @apply text-sm;
26
- }
27
-
28
- .bui-avatar-size-medium {
29
- @apply w-10 h-10;
30
- @apply text-base;
31
- }
32
-
33
- .bui-avatar-size-large {
34
- @apply w-12 h-12;
35
- @apply text-lg;
36
- }
37
-
38
- .bui-avatar-size-xlarge {
39
- @apply w-16 h-16;
40
- @apply text-xl;
41
- }
42
-
43
- .bui-avatar-size-xxlarge {
44
- @apply w-24 h-24;
45
- @apply text-2xl;
46
- }
47
-
48
- /* Forme */
49
- .bui-avatar-shape-circle {
50
- @apply rounded-full;
51
- }
52
-
53
- .bui-avatar-shape-square {
54
- @apply rounded-none;
55
- }
56
-
57
- .bui-avatar-shape-rounded {
58
- @apply rounded-md;
59
- }
60
-
61
- /* Immagine */
62
- .bui-avatar-image {
63
- @apply w-full h-full object-cover;
64
- }
65
-
66
- /* Iniziali di fallback */
67
- .bui-avatar-initials {
68
- @apply w-full h-full flex items-center justify-center font-medium text-white;
69
- }
70
-
71
- /* Temi di colore */
72
- .bui-avatar-default {
73
- @apply bg-gray-700 text-white;
74
- }
75
-
76
- .bui-avatar-white {
77
- @apply bg-white text-gray-800 border border-gray-200;
78
- }
79
-
80
- .bui-avatar-red {
81
- @apply bg-red-500 text-white;
82
- }
83
-
84
- .bui-avatar-rose {
85
- @apply bg-rose-500 text-white;
86
- }
87
-
88
- .bui-avatar-orange {
89
- @apply bg-orange-500 text-white;
90
- }
91
-
92
- .bui-avatar-green {
93
- @apply bg-green-500 text-white;
94
- }
95
-
96
- .bui-avatar-blue {
97
- @apply bg-blue-500 text-white;
98
- }
99
-
100
- .bui-avatar-yellow {
101
- @apply bg-yellow-500 text-black;
102
- }
103
-
104
- .bui-avatar-violet {
105
- @apply bg-violet-500 text-white;
106
- }
107
-
108
- .bui-avatar-gray {
109
- @apply bg-gray-400 text-white;
110
- }
111
-
112
- /* Indicatore di stato */
113
- .bui-avatar-status-indicator {
114
- @apply absolute block rounded-full border-2 border-white;
115
- @apply w-3 h-3;
116
- @apply z-10;
117
- }
118
-
119
- /* Posizioni dell'indicatore di stato */
120
- .bui-avatar-status-position-bottom-right {
121
- @apply bottom-0 right-0;
122
- }
123
-
124
- .bui-avatar-status-position-bottom-left {
125
- @apply bottom-0 left-0;
126
- }
127
-
128
- .bui-avatar-status-position-top-right {
129
- @apply top-0 right-0;
130
- }
131
-
132
- .bui-avatar-status-position-top-left {
133
- @apply top-0 left-0;
134
- }
135
-
136
- /* Varianti di stato */
137
- .bui-avatar-status-online {
138
- @apply bg-green-500;
139
- }
140
-
141
- .bui-avatar-status-offline {
142
- @apply bg-gray-400;
143
- }
144
-
145
- .bui-avatar-status-busy {
146
- @apply bg-red-500;
147
- }
148
-
149
- .bui-avatar-status-away {
150
- @apply bg-yellow-500;
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
+ }
151
200
  }