better_ui 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +165 -105
  3. data/app/components/better_ui/application/alert_component.html.erb +1 -1
  4. data/app/components/better_ui/application/alert_component.rb +95 -89
  5. data/app/components/better_ui/application/card_component.html.erb +24 -0
  6. data/app/components/better_ui/application/card_component.rb +53 -0
  7. data/app/components/better_ui/application/card_container_component.html.erb +8 -0
  8. data/app/components/better_ui/application/card_container_component.rb +14 -0
  9. data/app/components/better_ui/application/toast_component.rb +92 -57
  10. data/app/components/better_ui/general/avatar_component.html.erb +19 -0
  11. data/app/components/better_ui/general/avatar_component.rb +171 -0
  12. data/app/components/better_ui/general/badge_component.html.erb +19 -0
  13. data/app/components/better_ui/general/badge_component.rb +123 -0
  14. data/app/components/better_ui/general/breadcrumb_component.html.erb +7 -31
  15. data/app/components/better_ui/general/breadcrumb_component.rb +64 -66
  16. data/app/components/better_ui/general/button_component.html.erb +4 -4
  17. data/app/components/better_ui/general/button_component.rb +64 -95
  18. data/app/components/better_ui/general/heading_component.html.erb +3 -3
  19. data/app/components/better_ui/general/heading_component.rb +76 -70
  20. data/app/components/better_ui/general/icon_component.html.erb +1 -1
  21. data/app/components/better_ui/general/icon_component.rb +22 -23
  22. data/app/components/better_ui/general/link_component.html.erb +17 -0
  23. data/app/components/better_ui/general/link_component.rb +132 -0
  24. data/app/components/better_ui/general/panel_component.rb +62 -56
  25. data/app/components/better_ui/general/spinner_component.html.erb +15 -0
  26. data/app/components/better_ui/general/spinner_component.rb +79 -0
  27. data/app/components/better_ui/general/table_component.html.erb +56 -20
  28. data/app/components/better_ui/general/table_component.rb +106 -80
  29. data/app/components/better_ui/theme_helper.rb +77 -75
  30. data/app/views/components/better_ui/general/table/_custom_body_row.html.erb +17 -0
  31. data/app/views/components/better_ui/general/table/_custom_footer_rows.html.erb +17 -0
  32. data/app/views/components/better_ui/general/table/_custom_header_rows.html.erb +12 -0
  33. data/lib/better_ui/engine.rb +4 -10
  34. data/lib/better_ui/version.rb +1 -1
  35. data/lib/better_ui.rb +4 -0
  36. data/lib/generators/better_ui/stylesheet_generator.rb +96 -0
  37. data/lib/generators/better_ui/templates/README +56 -0
  38. data/lib/generators/better_ui/templates/components/_avatar.scss +151 -0
  39. data/lib/generators/better_ui/templates/components/_badge.scss +142 -0
  40. data/lib/generators/better_ui/templates/components/_breadcrumb.scss +107 -0
  41. data/lib/generators/better_ui/templates/components/_button.scss +106 -0
  42. data/lib/generators/better_ui/templates/components/_card.scss +69 -0
  43. data/lib/generators/better_ui/templates/components/_heading.scss +180 -0
  44. data/lib/generators/better_ui/templates/components/_icon.scss +90 -0
  45. data/lib/generators/better_ui/templates/components/_link.scss +130 -0
  46. data/lib/generators/better_ui/templates/components/_panel.scss +144 -0
  47. data/lib/generators/better_ui/templates/components/_spinner.scss +132 -0
  48. data/lib/generators/better_ui/templates/components/_table.scss +105 -0
  49. data/lib/generators/better_ui/templates/components/_variables.scss +33 -0
  50. data/lib/generators/better_ui/templates/components_stylesheet.scss +66 -0
  51. metadata +51 -22
  52. data/app/helpers/better_ui_application_helper.rb +0 -99
@@ -0,0 +1,56 @@
1
+ ===============================================================================
2
+
3
+ Installazione completata!
4
+
5
+ Il tuo foglio di stile SCSS per la personalizzazione dei componenti di BetterUi
6
+ è stato creato in:
7
+
8
+ app/assets/stylesheets/<%= options[:prefix] %>_better_ui_components.scss
9
+
10
+ ===============================================================================
11
+
12
+ PROSSIMI PASSI:
13
+
14
+ 1. Assicurati che Tailwind CSS sia correttamente configurato nel tuo progetto.
15
+ Questo foglio di stile utilizza le utility @apply di Tailwind CSS.
16
+
17
+ 2. Importa il foglio di stile nella tua applicazione:
18
+
19
+ In app/assets/stylesheets/application.scss:
20
+
21
+ @import '<%= options[:prefix] %>_better_ui_components';
22
+
23
+ Oppure in app/assets/stylesheets/application.css:
24
+
25
+ /*
26
+ *= require <%= options[:prefix] %>_better_ui_components
27
+ */
28
+
29
+ 3. Personalizza le variabili SCSS e le classi secondo le tue esigenze.
30
+ Il foglio di stile utilizza le classi di Tailwind CSS tramite la direttiva
31
+ @apply, consentendoti di sfruttare l'ecosistema Tailwind mantenendo un
32
+ codice SCSS organizzato e modulare.
33
+
34
+ 4. Nei componenti Ruby, usa le classi con prefisso 'bui-' invece di includere
35
+ direttamente le classi Tailwind. Ad esempio per i bottoni:
36
+
37
+ # Esempio di utilizzo di classi CSS personalizzate
38
+ BUTTON_TYPES = {
39
+ default: "bui-btn-default",
40
+ red: "bui-btn-red",
41
+ blue: "bui-btn-blue"
42
+ }
43
+
44
+ Questo approccio centralizza gli stili nel foglio SCSS e rende più facile
45
+ mantenere e modificare l'aspetto dei componenti.
46
+
47
+ 5. Assicurati che il tuo foglio di stile venga caricato dopo i fogli di stile
48
+ di BetterUI per sovrascrivere correttamente gli stili predefiniti.
49
+
50
+ ===============================================================================
51
+
52
+ Per ulteriori informazioni sulla personalizzazione dei componenti,
53
+ consulta la documentazione ufficiale su:
54
+ https://github.com/YOUR_USERNAME/better_ui
55
+
56
+ ===============================================================================
@@ -0,0 +1,151 @@
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;
151
+ }
@@ -0,0 +1,142 @@
1
+ /* ==============================
2
+ * Badge Component
3
+ * ============================== */
4
+
5
+ /* Stile base */
6
+ .bui-badge {
7
+ @apply inline-flex items-center justify-center;
8
+ @apply font-medium whitespace-nowrap;
9
+ @apply transition-colors;
10
+ }
11
+
12
+ /* Posizionamento icone */
13
+ .bui-badge-icon-left {
14
+ @apply mr-1;
15
+ }
16
+
17
+ .bui-badge-icon-right {
18
+ @apply ml-1;
19
+ }
20
+
21
+ /* Varianti di dimensione */
22
+ .bui-badge-size-small {
23
+ @apply py-0.5 px-1.5 text-xs;
24
+ }
25
+
26
+ .bui-badge-size-medium {
27
+ @apply py-1 px-2 text-sm;
28
+ }
29
+
30
+ .bui-badge-size-large {
31
+ @apply py-1.5 px-3 text-base;
32
+ }
33
+
34
+ /* Varianti di border-radius */
35
+ .bui-badge-radius-none {
36
+ @apply rounded-none;
37
+ }
38
+
39
+ .bui-badge-radius-small {
40
+ @apply rounded;
41
+ }
42
+
43
+ .bui-badge-radius-medium {
44
+ @apply rounded-md;
45
+ }
46
+
47
+ .bui-badge-radius-large {
48
+ @apply rounded-lg;
49
+ }
50
+
51
+ .bui-badge-radius-full {
52
+ @apply rounded-full;
53
+ }
54
+
55
+ /* Varianti stile */
56
+ .bui-badge-outline {
57
+ @apply bg-transparent border;
58
+ }
59
+
60
+ .bui-badge-notification {
61
+ @apply absolute -top-1 -right-1 min-w-[1.25rem] h-5 py-0 px-1.5;
62
+ @apply flex items-center justify-center text-xs;
63
+ @apply rounded-full;
64
+ }
65
+
66
+ /* Varianti di colore - Standard */
67
+ .bui-badge-default {
68
+ @apply bg-gray-800 text-white;
69
+ }
70
+
71
+ .bui-badge-white {
72
+ @apply bg-white text-gray-800 border border-gray-200;
73
+ }
74
+
75
+ .bui-badge-red {
76
+ @apply bg-red-500 text-white;
77
+ }
78
+
79
+ .bui-badge-rose {
80
+ @apply bg-rose-500 text-white;
81
+ }
82
+
83
+ .bui-badge-orange {
84
+ @apply bg-orange-500 text-white;
85
+ }
86
+
87
+ .bui-badge-green {
88
+ @apply bg-green-500 text-white;
89
+ }
90
+
91
+ .bui-badge-blue {
92
+ @apply bg-blue-500 text-white;
93
+ }
94
+
95
+ .bui-badge-yellow {
96
+ @apply bg-yellow-500 text-black;
97
+ }
98
+
99
+ .bui-badge-violet {
100
+ @apply bg-violet-500 text-white;
101
+ }
102
+
103
+ .bui-badge-gray {
104
+ @apply bg-gray-200 text-gray-800;
105
+ }
106
+
107
+ /* Varianti di colore - Outline */
108
+ .bui-badge-outline.bui-badge-default {
109
+ @apply border-gray-800 text-gray-800;
110
+ }
111
+
112
+ .bui-badge-outline.bui-badge-red {
113
+ @apply border-red-500 text-red-600;
114
+ }
115
+
116
+ .bui-badge-outline.bui-badge-rose {
117
+ @apply border-rose-500 text-rose-600;
118
+ }
119
+
120
+ .bui-badge-outline.bui-badge-orange {
121
+ @apply border-orange-500 text-orange-600;
122
+ }
123
+
124
+ .bui-badge-outline.bui-badge-green {
125
+ @apply border-green-500 text-green-600;
126
+ }
127
+
128
+ .bui-badge-outline.bui-badge-blue {
129
+ @apply border-blue-500 text-blue-600;
130
+ }
131
+
132
+ .bui-badge-outline.bui-badge-yellow {
133
+ @apply border-yellow-500 text-yellow-600;
134
+ }
135
+
136
+ .bui-badge-outline.bui-badge-violet {
137
+ @apply border-violet-500 text-violet-600;
138
+ }
139
+
140
+ .bui-badge-outline.bui-badge-gray {
141
+ @apply border-gray-300 text-gray-600;
142
+ }
@@ -0,0 +1,107 @@
1
+ /* ==============================
2
+ * Breadcrumb Component
3
+ * ============================== */
4
+
5
+ /* Classi di base per il container e gli elementi */
6
+ .bui-breadcrumb-container {
7
+ @apply flex items-center flex-wrap;
8
+ }
9
+
10
+ .bui-breadcrumb-list {
11
+ @apply flex flex-wrap items-center;
12
+ }
13
+
14
+ .bui-breadcrumb-item {
15
+ @apply flex items-center;
16
+ }
17
+
18
+ .bui-breadcrumb-separator {
19
+ @apply mx-2;
20
+ }
21
+
22
+ /* Dimensioni */
23
+ .bui-breadcrumb-small {
24
+ @apply text-xs;
25
+ }
26
+
27
+ .bui-breadcrumb-medium {
28
+ @apply text-sm;
29
+ }
30
+
31
+ .bui-breadcrumb-large {
32
+ @apply text-base;
33
+ }
34
+
35
+ /* Temi colore - Container */
36
+ .bui-breadcrumb-default-container {
37
+ @apply text-white;
38
+ }
39
+
40
+ .bui-breadcrumb-white-container {
41
+ @apply text-black;
42
+ }
43
+
44
+ .bui-breadcrumb-red-container {
45
+ @apply text-white;
46
+ }
47
+
48
+ .bui-breadcrumb-rose-container {
49
+ @apply text-white;
50
+ }
51
+
52
+ .bui-breadcrumb-orange-container {
53
+ @apply text-white;
54
+ }
55
+
56
+ .bui-breadcrumb-green-container {
57
+ @apply text-white;
58
+ }
59
+
60
+ .bui-breadcrumb-blue-container {
61
+ @apply text-white;
62
+ }
63
+
64
+ .bui-breadcrumb-yellow-container {
65
+ @apply text-black;
66
+ }
67
+
68
+ .bui-breadcrumb-violet-container {
69
+ @apply text-white;
70
+ }
71
+
72
+ /* Temi colore - Separatori */
73
+ .bui-breadcrumb-default-separator {
74
+ @apply text-gray-500;
75
+ }
76
+
77
+ .bui-breadcrumb-white-separator {
78
+ @apply text-gray-400;
79
+ }
80
+
81
+ .bui-breadcrumb-red-separator {
82
+ @apply text-red-300;
83
+ }
84
+
85
+ .bui-breadcrumb-rose-separator {
86
+ @apply text-rose-300;
87
+ }
88
+
89
+ .bui-breadcrumb-orange-separator {
90
+ @apply text-orange-300;
91
+ }
92
+
93
+ .bui-breadcrumb-green-separator {
94
+ @apply text-green-300;
95
+ }
96
+
97
+ .bui-breadcrumb-blue-separator {
98
+ @apply text-blue-300;
99
+ }
100
+
101
+ .bui-breadcrumb-yellow-separator {
102
+ @apply text-yellow-600;
103
+ }
104
+
105
+ .bui-breadcrumb-violet-separator {
106
+ @apply text-violet-300;
107
+ }
@@ -0,0 +1,106 @@
1
+ /* ==============================
2
+ * Button Component
3
+ * ============================== */
4
+
5
+ /* Stile base */
6
+ .bui-btn {
7
+ @apply py-2 px-4 font-medium rounded transition-colors;
8
+ }
9
+
10
+ /* Layout e posizionamento */
11
+ .bui-btn-layout-default {
12
+ @apply inline-flex items-center justify-center font-medium;
13
+ }
14
+
15
+ .bui-btn-focus {
16
+ @apply focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500;
17
+ }
18
+
19
+ /* Varianti di colore */
20
+ .bui-btn-default {
21
+ @apply bg-black text-white hover:bg-gray-900;
22
+ }
23
+
24
+ .bui-btn-white {
25
+ @apply bg-white text-black hover:bg-gray-100;
26
+ }
27
+
28
+ .bui-btn-red {
29
+ @apply bg-red-500 text-white hover:bg-red-600;
30
+ }
31
+
32
+ .bui-btn-rose {
33
+ @apply bg-rose-500 text-white hover:bg-rose-600;
34
+ }
35
+
36
+ .bui-btn-orange {
37
+ @apply bg-orange-500 text-white hover:bg-orange-600;
38
+ }
39
+
40
+ .bui-btn-green {
41
+ @apply bg-green-500 text-white hover:bg-green-600;
42
+ }
43
+
44
+ .bui-btn-blue {
45
+ @apply bg-blue-500 text-white hover:bg-blue-600;
46
+ }
47
+
48
+ .bui-btn-yellow {
49
+ @apply bg-yellow-500 text-black hover:bg-yellow-600;
50
+ }
51
+
52
+ .bui-btn-violet {
53
+ @apply bg-violet-500 text-white hover:bg-violet-600;
54
+ }
55
+
56
+ /* Varianti di dimensione */
57
+ .bui-btn-size-small {
58
+ @apply py-1 px-2.5 text-xs;
59
+ }
60
+
61
+ .bui-btn-size-medium {
62
+ @apply py-2 px-4 text-sm;
63
+ }
64
+
65
+ .bui-btn-size-large {
66
+ @apply py-2.5 px-6 text-base;
67
+ }
68
+
69
+ /* Varianti di border-radius */
70
+ .bui-btn-radius-none {
71
+ @apply rounded-none;
72
+ }
73
+
74
+ .bui-btn-radius-small {
75
+ @apply rounded-md;
76
+ }
77
+
78
+ .bui-btn-radius-medium {
79
+ @apply rounded-lg;
80
+ }
81
+
82
+ .bui-btn-radius-large {
83
+ @apply rounded-xl;
84
+ }
85
+
86
+ .bui-btn-radius-full {
87
+ @apply rounded-full;
88
+ }
89
+
90
+ /* Stati e modificatori */
91
+ .bui-btn-disabled {
92
+ @apply opacity-50 cursor-not-allowed;
93
+ }
94
+
95
+ .bui-btn-full-width {
96
+ @apply w-full;
97
+ }
98
+
99
+ /* Posizionamento icone */
100
+ .bui-btn-icon-left {
101
+ @apply mr-2;
102
+ }
103
+
104
+ .bui-btn-icon-right {
105
+ @apply ml-2;
106
+ }
@@ -0,0 +1,69 @@
1
+ /* ==============================
2
+ * Card Component
3
+ * ============================== */
4
+
5
+ /* Struttura di base */
6
+ .bui-card-base {
7
+ @apply bg-white border shadow-sm overflow-hidden;
8
+ }
9
+
10
+ /* Contenuto */
11
+ .bui-card-content {
12
+ @apply p-4;
13
+ }
14
+
15
+ /* Intestazione */
16
+ .bui-card-header {
17
+ @apply p-4 border-b;
18
+ }
19
+
20
+ /* Piè di pagina */
21
+ .bui-card-footer {
22
+ @apply p-4 border-t;
23
+ }
24
+
25
+ /* Corpo */
26
+ .bui-card-body {
27
+ @apply flex flex-col;
28
+ }
29
+
30
+ /* Titolo */
31
+ .bui-card-title {
32
+ @apply text-lg font-medium;
33
+ }
34
+
35
+ /* Valore */
36
+ .bui-card-value {
37
+ @apply text-2xl font-bold mt-2;
38
+ }
39
+
40
+ /* Valore di riferimento */
41
+ .bui-card-value-from {
42
+ @apply text-sm text-gray-500 mt-1;
43
+ }
44
+
45
+ /* Trend */
46
+ .bui-card-trend {
47
+ @apply mt-2 inline-flex items-center px-2 py-1 text-xs font-medium rounded;
48
+ }
49
+
50
+ /* Opzioni di border-radius */
51
+ .bui-card-radius-none {
52
+ @apply rounded-none;
53
+ }
54
+
55
+ .bui-card-radius-small {
56
+ @apply rounded-md;
57
+ }
58
+
59
+ .bui-card-radius-medium {
60
+ @apply rounded-lg;
61
+ }
62
+
63
+ .bui-card-radius-large {
64
+ @apply rounded-xl;
65
+ }
66
+
67
+ .bui-card-radius-full {
68
+ @apply rounded-full;
69
+ }