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
@@ -2,105 +2,108 @@
2
2
  * Button Component
3
3
  * ============================== */
4
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;
5
+ @layer components {
6
+ // Classe base per il bottone (Block)
7
+ .bui-button {
8
+ @apply inline-flex items-center justify-center font-medium
9
+ transition-colors duration-200 rounded-md
10
+ focus:outline-none focus:ring-2 focus:ring-offset-2;
11
+
12
+ // Elements
13
+ &__icon {
14
+ @apply flex-shrink-0;
15
+
16
+ &--left {
17
+ @apply mr-2;
18
+ }
19
+
20
+ &--right {
21
+ @apply ml-2;
22
+ }
23
+ }
24
+
25
+ &__text {
26
+ @apply flex-grow;
27
+ }
28
+
29
+ // Modifiers (varianti colore)
30
+ &--default {
31
+ @apply bg-black text-white hover:bg-gray-900 focus:ring-gray-900;
32
+ }
33
+
34
+ &--white {
35
+ @apply bg-white text-black hover:bg-gray-100 focus:ring-gray-400;
36
+ }
37
+
38
+ &--red {
39
+ @apply bg-red-500 text-white hover:bg-red-600 focus:ring-red-500;
40
+ }
41
+
42
+ &--rose {
43
+ @apply bg-rose-500 text-white hover:bg-rose-600 focus:ring-rose-500;
44
+ }
45
+
46
+ &--orange {
47
+ @apply bg-orange-500 text-white hover:bg-orange-600 focus:ring-orange-500;
48
+ }
49
+
50
+ &--green {
51
+ @apply bg-green-500 text-white hover:bg-green-600 focus:ring-green-500;
52
+ }
53
+
54
+ &--blue {
55
+ @apply bg-blue-500 text-white hover:bg-blue-600 focus:ring-blue-500;
56
+ }
57
+
58
+ &--yellow {
59
+ @apply bg-yellow-500 text-black hover:bg-yellow-600 focus:ring-yellow-500;
60
+ }
61
+
62
+ &--violet {
63
+ @apply bg-violet-500 text-white hover:bg-violet-600 focus:ring-violet-500;
64
+ }
65
+
66
+ // Modifiers (dimensioni)
67
+ &--small {
68
+ @apply px-2.5 py-1.5 text-xs;
69
+ }
70
+
71
+ &--medium {
72
+ @apply px-4 py-2 text-sm;
73
+ }
74
+
75
+ &--large {
76
+ @apply px-6 py-3 text-base;
77
+ }
78
+
79
+ // Modifiers (border radius)
80
+ &--radius-none {
81
+ @apply rounded-none;
82
+ }
83
+
84
+ &--radius-small {
85
+ @apply rounded-md;
86
+ }
87
+
88
+ &--radius-medium {
89
+ @apply rounded-lg;
90
+ }
91
+
92
+ &--radius-large {
93
+ @apply rounded-xl;
94
+ }
95
+
96
+ &--radius-full {
97
+ @apply rounded-full;
98
+ }
99
+
100
+ // Modifiers (stati)
101
+ &--disabled {
102
+ @apply opacity-50 cursor-not-allowed;
103
+ }
104
+
105
+ &--full-width {
106
+ @apply w-full;
107
+ }
108
+ }
106
109
  }
@@ -1,69 +1,60 @@
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
- }
1
+ @layer components {
2
+ // Classe base per la card (Block)
3
+ .bui-card {
4
+ @apply bg-white border shadow-sm overflow-hidden;
54
5
 
55
- .bui-card-radius-small {
56
- @apply rounded-md;
57
- }
6
+ // Elements
7
+ &__content {
8
+ @apply p-4;
9
+ }
58
10
 
59
- .bui-card-radius-medium {
60
- @apply rounded-lg;
61
- }
11
+ &__header {
12
+ @apply p-4 border-b;
13
+ }
62
14
 
63
- .bui-card-radius-large {
64
- @apply rounded-xl;
65
- }
15
+ &__footer {
16
+ @apply p-4 border-t;
17
+ }
18
+
19
+ &__body {
20
+ @apply flex flex-col;
21
+ }
22
+
23
+ &__title {
24
+ @apply text-lg font-medium;
25
+ }
26
+
27
+ &__value {
28
+ @apply text-2xl font-bold mt-2;
29
+
30
+ &--reference {
31
+ @apply text-sm text-gray-500 mt-1;
32
+ }
33
+ }
34
+
35
+ &__trend {
36
+ @apply mt-2 inline-flex items-center px-2 py-1 text-xs font-medium rounded;
37
+ }
66
38
 
67
- .bui-card-radius-full {
68
- @apply rounded-full;
69
- }
39
+ // Modifiers (border radius)
40
+ &--radius-none {
41
+ @apply rounded-none;
42
+ }
43
+
44
+ &--radius-small {
45
+ @apply rounded-md;
46
+ }
47
+
48
+ &--radius-medium {
49
+ @apply rounded-lg;
50
+ }
51
+
52
+ &--radius-large {
53
+ @apply rounded-xl;
54
+ }
55
+
56
+ &--radius-full {
57
+ @apply rounded-full;
58
+ }
59
+ }
60
+ }
@@ -1,180 +1,81 @@
1
- /* ==============================
2
- * Heading Component
3
- * ============================== */
4
-
5
- /* Varianti di colore per le intestazioni */
6
- .bui-header-default-heading {
7
- @apply text-gray-900;
8
- }
9
-
10
- .bui-header-default-subtitle {
11
- @apply text-gray-600;
12
- }
13
-
14
- .bui-header-default-divider {
15
- @apply border-gray-200;
16
- }
17
-
18
- .bui-header-white-heading {
19
- @apply text-gray-100;
20
- }
21
-
22
- .bui-header-white-subtitle {
23
- @apply text-gray-300;
24
- }
25
-
26
- .bui-header-white-divider {
27
- @apply border-gray-200;
28
- }
29
-
30
- .bui-header-red-heading {
31
- @apply text-red-700;
32
- }
33
-
34
- .bui-header-red-subtitle {
35
- @apply text-red-500;
36
- }
37
-
38
- .bui-header-red-divider {
39
- @apply border-red-300;
40
- }
41
-
42
- .bui-header-rose-heading {
43
- @apply text-rose-700;
44
- }
45
-
46
- .bui-header-rose-subtitle {
47
- @apply text-rose-500;
48
- }
49
-
50
- .bui-header-rose-divider {
51
- @apply border-rose-300;
52
- }
53
-
54
- .bui-header-orange-heading {
55
- @apply text-orange-700;
56
- }
57
-
58
- .bui-header-orange-subtitle {
59
- @apply text-orange-500;
60
- }
61
-
62
- .bui-header-orange-divider {
63
- @apply border-orange-300;
64
- }
65
-
66
- .bui-header-green-heading {
67
- @apply text-green-700;
68
- }
69
-
70
- .bui-header-green-subtitle {
71
- @apply text-green-500;
72
- }
73
-
74
- .bui-header-green-divider {
75
- @apply border-green-300;
76
- }
77
-
78
- .bui-header-blue-heading {
79
- @apply text-blue-700;
80
- }
81
-
82
- .bui-header-blue-subtitle {
83
- @apply text-blue-500;
84
- }
85
-
86
- .bui-header-blue-divider {
87
- @apply border-blue-300;
88
- }
89
-
90
- .bui-header-yellow-heading {
91
- @apply text-yellow-700;
92
- }
93
-
94
- .bui-header-yellow-subtitle {
95
- @apply text-yellow-500;
96
- }
97
-
98
- .bui-header-yellow-divider {
99
- @apply border-yellow-300;
100
- }
101
-
102
- .bui-header-violet-heading {
103
- @apply text-violet-700;
104
- }
105
-
106
- .bui-header-violet-subtitle {
107
- @apply text-violet-500;
108
- }
109
-
110
- .bui-header-violet-divider {
111
- @apply border-violet-300;
112
- }
113
-
114
- /* Classi per le dimensioni dell'intestazione */
115
- .bui-header-small-heading {
116
- @apply text-xl;
117
- }
118
-
119
- .bui-header-small-subtitle {
120
- @apply text-base;
121
- }
122
-
123
- .bui-header-medium-heading {
124
- @apply text-2xl;
125
- }
126
-
127
- .bui-header-medium-subtitle {
128
- @apply text-lg;
129
- }
130
-
131
- .bui-header-large-heading {
132
- @apply text-3xl;
133
- }
134
-
135
- .bui-header-large-subtitle {
136
- @apply text-xl;
137
- }
138
-
139
- /* Classi per l'allineamento dell'intestazione */
140
- .bui-header-left {
141
- @apply text-left;
142
- }
143
-
144
- .bui-header-center {
145
- @apply text-center;
146
- }
147
-
148
- .bui-header-right {
149
- @apply text-right;
150
- }
151
-
152
- /* Stili comuni */
153
- .bui-header-heading-base {
154
- @apply font-bold;
155
- }
156
-
157
- .bui-header-subtitle-base {
158
- @apply mt-1;
159
- }
160
-
161
- .bui-header-divider-base {
162
- @apply border-t mt-2;
163
- }
164
-
165
- .bui-header-container-base {
166
- @apply mb-4;
167
- }
168
-
169
- .bui-header-container-with-divider {
170
- @apply mb-4 pb-2;
171
- }
172
-
173
- /* Stili per le icone */
174
- .bui-header-icon-container {
175
- @apply inline-flex items-center;
176
- }
177
-
178
- .bui-header-icon-wrapper {
179
- @apply mr-2;
1
+ @layer components {
2
+ // Classe base per il titolo (Block)
3
+ .bui-heading {
4
+ @apply font-bold text-gray-900 leading-tight;
5
+
6
+ // Modifiers (dimensioni/livelli)
7
+ &--1 {
8
+ @apply text-3xl sm:text-4xl;
9
+ }
10
+
11
+ &--2 {
12
+ @apply text-2xl sm:text-3xl;
13
+ }
14
+
15
+ &--3 {
16
+ @apply text-xl sm:text-2xl;
17
+ }
18
+
19
+ &--4 {
20
+ @apply text-lg sm:text-xl;
21
+ }
22
+
23
+ &--5 {
24
+ @apply text-base sm:text-lg;
25
+ }
26
+
27
+ &--6 {
28
+ @apply text-sm sm:text-base;
29
+ }
30
+
31
+ // Modifiers (varianti colore)
32
+ &--default {
33
+ @apply text-gray-900;
34
+ }
35
+
36
+ &--white {
37
+ @apply text-white;
38
+ }
39
+
40
+ &--red {
41
+ @apply text-red-600;
42
+ }
43
+
44
+ &--rose {
45
+ @apply text-rose-600;
46
+ }
47
+
48
+ &--orange {
49
+ @apply text-orange-600;
50
+ }
51
+
52
+ &--green {
53
+ @apply text-green-600;
54
+ }
55
+
56
+ &--blue {
57
+ @apply text-blue-600;
58
+ }
59
+
60
+ &--yellow {
61
+ @apply text-yellow-600;
62
+ }
63
+
64
+ &--violet {
65
+ @apply text-violet-600;
66
+ }
67
+
68
+ // Modifiers (allineamento)
69
+ &--left {
70
+ @apply text-left;
71
+ }
72
+
73
+ &--center {
74
+ @apply text-center;
75
+ }
76
+
77
+ &--right {
78
+ @apply text-right;
79
+ }
80
+ }
180
81
  }