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
@@ -0,0 +1,134 @@
1
+ @layer components {
2
+ // Classe base per l'icona (Block)
3
+ .bui-icon {
4
+ @apply inline-flex items-center justify-center;
5
+
6
+ // Modifiers (dimensioni)
7
+ &--xs {
8
+ @apply h-3 w-3;
9
+
10
+ svg {
11
+ @apply h-3 w-3;
12
+ }
13
+ }
14
+
15
+ &--sm {
16
+ @apply h-4 w-4;
17
+
18
+ svg {
19
+ @apply h-4 w-4;
20
+ }
21
+ }
22
+
23
+ &--md {
24
+ @apply h-5 w-5;
25
+
26
+ svg {
27
+ @apply h-5 w-5;
28
+ }
29
+ }
30
+
31
+ &--lg {
32
+ @apply h-6 w-6;
33
+
34
+ svg {
35
+ @apply h-6 w-6;
36
+ }
37
+ }
38
+
39
+ &--xl {
40
+ @apply h-8 w-8;
41
+
42
+ svg {
43
+ @apply h-8 w-8;
44
+ }
45
+ }
46
+
47
+ // Modifiers (varianti colore)
48
+ &--default {
49
+ @apply text-gray-500;
50
+ }
51
+
52
+ &--white {
53
+ @apply text-white;
54
+ }
55
+
56
+ &--red {
57
+ @apply text-red-500;
58
+ }
59
+
60
+ &--rose {
61
+ @apply text-rose-500;
62
+ }
63
+
64
+ &--orange {
65
+ @apply text-orange-500;
66
+ }
67
+
68
+ &--green {
69
+ @apply text-green-500;
70
+ }
71
+
72
+ &--blue {
73
+ @apply text-blue-500;
74
+ }
75
+
76
+ &--yellow {
77
+ @apply text-yellow-500;
78
+ }
79
+
80
+ &--violet {
81
+ @apply text-violet-500;
82
+ }
83
+
84
+ // Modifiers (varianti stile)
85
+ &--solid {
86
+ @apply rounded-full p-2 bg-gray-100;
87
+ }
88
+
89
+ &--solid-primary {
90
+ @apply rounded-full p-2 text-white;
91
+
92
+ &.bui-icon--red {
93
+ @apply bg-red-500;
94
+ }
95
+
96
+ &.bui-icon--rose {
97
+ @apply bg-rose-500;
98
+ }
99
+
100
+ &.bui-icon--orange {
101
+ @apply bg-orange-500;
102
+ }
103
+
104
+ &.bui-icon--green {
105
+ @apply bg-green-500;
106
+ }
107
+
108
+ &.bui-icon--blue {
109
+ @apply bg-blue-500;
110
+ }
111
+
112
+ &.bui-icon--yellow {
113
+ @apply bg-yellow-500;
114
+ }
115
+
116
+ &.bui-icon--violet {
117
+ @apply bg-violet-500;
118
+ }
119
+ }
120
+
121
+ // Stati
122
+ &--spin {
123
+ @apply animate-spin;
124
+ }
125
+
126
+ &--pulse {
127
+ @apply animate-pulse;
128
+ }
129
+
130
+ &--fixed-width {
131
+ @apply w-5;
132
+ }
133
+ }
134
+ }
@@ -0,0 +1,17 @@
1
+ // Index file che raggruppa e riespone tutti i componenti
2
+ // Nota: È possibile utilizzare le variabili con @use "better_ui/components/variables" as vars;
3
+
4
+ // Componenti generali
5
+ @forward "button";
6
+ @forward "panel";
7
+ @forward "table";
8
+ @forward "badge";
9
+ @forward "avatar";
10
+ @forward "icon";
11
+ @forward "link";
12
+ @forward "heading";
13
+ @forward "breadcrumb";
14
+ @forward "spinner";
15
+
16
+ // Componenti applicativi
17
+ @forward "card";
@@ -0,0 +1,100 @@
1
+ @layer components {
2
+ // Classe base per il link (Block)
3
+ .bui-link {
4
+ @apply inline-flex items-center transition-colors duration-200;
5
+
6
+ // Elements
7
+ &__icon {
8
+ @apply flex-shrink-0;
9
+
10
+ &--left {
11
+ @apply mr-1.5;
12
+ }
13
+
14
+ &--right {
15
+ @apply ml-1.5;
16
+ }
17
+ }
18
+
19
+ &__text {
20
+ @apply inline;
21
+ }
22
+
23
+ // Modifiers (varianti colore)
24
+ &--default {
25
+ @apply text-gray-700 hover:text-gray-900;
26
+ }
27
+
28
+ &--white {
29
+ @apply text-white hover:text-gray-100;
30
+ }
31
+
32
+ &--red {
33
+ @apply text-red-600 hover:text-red-700;
34
+ }
35
+
36
+ &--rose {
37
+ @apply text-rose-600 hover:text-rose-700;
38
+ }
39
+
40
+ &--orange {
41
+ @apply text-orange-600 hover:text-orange-700;
42
+ }
43
+
44
+ &--green {
45
+ @apply text-green-600 hover:text-green-700;
46
+ }
47
+
48
+ &--blue {
49
+ @apply text-blue-600 hover:text-blue-700;
50
+ }
51
+
52
+ &--yellow {
53
+ @apply text-yellow-600 hover:text-yellow-700;
54
+ }
55
+
56
+ &--violet {
57
+ @apply text-violet-600 hover:text-violet-700;
58
+ }
59
+
60
+ // Modifiers (varianti stile)
61
+ &--underlined {
62
+ @apply underline decoration-1 underline-offset-2;
63
+ }
64
+
65
+ &--hover-underlined {
66
+ @apply no-underline hover:underline decoration-1 underline-offset-2;
67
+ }
68
+
69
+ &--bold {
70
+ @apply font-semibold;
71
+ }
72
+
73
+ // Modifiers (dimensioni)
74
+ &--sm {
75
+ @apply text-sm;
76
+ }
77
+
78
+ &--base {
79
+ @apply text-base;
80
+ }
81
+
82
+ &--lg {
83
+ @apply text-lg;
84
+ }
85
+
86
+ // Stati
87
+ &--active {
88
+ @apply font-medium;
89
+ }
90
+
91
+ &--disabled {
92
+ @apply pointer-events-none opacity-50;
93
+ }
94
+
95
+ // Stili specifici per bottoni che sembrano link
96
+ &--button {
97
+ @apply appearance-none bg-transparent border-none p-0 cursor-pointer;
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,104 @@
1
+ @layer components {
2
+ // Classe base per il pannello (Block)
3
+ .bui-panel {
4
+ @apply border shadow-sm;
5
+
6
+ // Elements
7
+ &__header {
8
+ @apply px-4 py-3 border-b;
9
+ }
10
+
11
+ &__body {
12
+ @apply p-4;
13
+ }
14
+
15
+ &__footer {
16
+ @apply px-4 py-3 border-t;
17
+ }
18
+
19
+ &__title {
20
+ @apply text-lg font-medium;
21
+ }
22
+
23
+ // Modifiers (varianti colore)
24
+ &--default {
25
+ @apply bg-black text-white border-gray-900;
26
+
27
+ .bui-panel__header {
28
+ @apply bg-gray-900;
29
+ }
30
+
31
+ .bui-panel__footer {
32
+ @apply bg-gray-900;
33
+ }
34
+ }
35
+
36
+ &--white {
37
+ @apply bg-white text-black border-gray-200;
38
+
39
+ .bui-panel__header {
40
+ @apply bg-gray-50;
41
+ }
42
+
43
+ .bui-panel__footer {
44
+ @apply bg-gray-50;
45
+ }
46
+ }
47
+
48
+ &--red {
49
+ @apply bg-red-50 text-red-900 border-red-200;
50
+
51
+ .bui-panel__header {
52
+ @apply bg-red-100 text-red-800;
53
+ }
54
+
55
+ .bui-panel__footer {
56
+ @apply bg-red-100;
57
+ }
58
+ }
59
+
60
+ // ... altre varianti di colore ...
61
+
62
+ // Modifiers (varianti di padding)
63
+ &--padding-none {
64
+ .bui-panel__body {
65
+ @apply p-0;
66
+ }
67
+ }
68
+
69
+ &--padding-small {
70
+ .bui-panel__body {
71
+ @apply p-2;
72
+ }
73
+ }
74
+
75
+ &--padding-medium {
76
+ .bui-panel__body {
77
+ @apply p-4;
78
+ }
79
+ }
80
+
81
+ &--padding-large {
82
+ .bui-panel__body {
83
+ @apply p-6;
84
+ }
85
+ }
86
+
87
+ // Modifiers (border radius)
88
+ &--radius-none {
89
+ @apply rounded-none;
90
+ }
91
+
92
+ &--radius-small {
93
+ @apply rounded-md;
94
+ }
95
+
96
+ &--radius-medium {
97
+ @apply rounded-lg;
98
+ }
99
+
100
+ &--radius-large {
101
+ @apply rounded-xl;
102
+ }
103
+ }
104
+ }
@@ -0,0 +1,129 @@
1
+ @layer components {
2
+ // Classe base per lo spinner (Block)
3
+ .bui-spinner {
4
+ @apply inline-flex flex-col items-center justify-center;
5
+
6
+ // Elements
7
+ &__animation {
8
+ @apply inline-block rounded-full animate-spin;
9
+ border-top-color: transparent;
10
+ }
11
+
12
+ &__label {
13
+ @apply mt-2 text-center;
14
+ }
15
+
16
+ &__content {
17
+ @apply mt-4;
18
+ }
19
+
20
+ // Modifiers (dimensioni)
21
+ &--small &__animation {
22
+ @apply w-5 h-5 border-2;
23
+ }
24
+
25
+ &--medium &__animation {
26
+ @apply w-8 h-8 border-3;
27
+ }
28
+
29
+ &--large &__animation {
30
+ @apply w-12 h-12 border-4;
31
+ }
32
+
33
+ // Modifiers (temi colore)
34
+ &--default {
35
+ .bui-spinner__animation {
36
+ @apply border-gray-200 border-t-gray-800;
37
+ }
38
+
39
+ .bui-spinner__label {
40
+ @apply text-gray-800;
41
+ }
42
+ }
43
+
44
+ &--white {
45
+ .bui-spinner__animation {
46
+ @apply border-gray-100 border-t-white;
47
+ }
48
+
49
+ .bui-spinner__label {
50
+ @apply text-white;
51
+ }
52
+ }
53
+
54
+ &--red {
55
+ .bui-spinner__animation {
56
+ @apply border-red-100 border-t-red-600;
57
+ }
58
+
59
+ .bui-spinner__label {
60
+ @apply text-red-600;
61
+ }
62
+ }
63
+
64
+ &--rose {
65
+ .bui-spinner__animation {
66
+ @apply border-rose-100 border-t-rose-600;
67
+ }
68
+
69
+ .bui-spinner__label {
70
+ @apply text-rose-600;
71
+ }
72
+ }
73
+
74
+ &--orange {
75
+ .bui-spinner__animation {
76
+ @apply border-orange-100 border-t-orange-500;
77
+ }
78
+
79
+ .bui-spinner__label {
80
+ @apply text-orange-500;
81
+ }
82
+ }
83
+
84
+ &--green {
85
+ .bui-spinner__animation {
86
+ @apply border-green-100 border-t-green-600;
87
+ }
88
+
89
+ .bui-spinner__label {
90
+ @apply text-green-600;
91
+ }
92
+ }
93
+
94
+ &--blue {
95
+ .bui-spinner__animation {
96
+ @apply border-blue-100 border-t-blue-600;
97
+ }
98
+
99
+ .bui-spinner__label {
100
+ @apply text-blue-600;
101
+ }
102
+ }
103
+
104
+ &--yellow {
105
+ .bui-spinner__animation {
106
+ @apply border-yellow-100 border-t-yellow-500;
107
+ }
108
+
109
+ .bui-spinner__label {
110
+ @apply text-yellow-500;
111
+ }
112
+ }
113
+
114
+ &--violet {
115
+ .bui-spinner__animation {
116
+ @apply border-violet-100 border-t-violet-600;
117
+ }
118
+
119
+ .bui-spinner__label {
120
+ @apply text-violet-600;
121
+ }
122
+ }
123
+
124
+ // Modifiers (stati)
125
+ &--fullscreen {
126
+ @apply fixed inset-0 flex items-center justify-center z-50 bg-black bg-opacity-50;
127
+ }
128
+ }
129
+ }
@@ -0,0 +1,156 @@
1
+ @layer components {
2
+ // Classe base per la tabella (Block)
3
+ .bui-table {
4
+ @apply w-full border-collapse;
5
+
6
+ // Elements
7
+ &__container {
8
+ @apply overflow-hidden border shadow-sm;
9
+ }
10
+
11
+ &__caption {
12
+ @apply p-4 font-medium text-left;
13
+ }
14
+
15
+ &__header {
16
+ @apply bg-gray-50;
17
+ }
18
+
19
+ &__footer {
20
+ @apply bg-gray-50;
21
+ }
22
+
23
+ &__body {
24
+ // Styling base per il corpo della tabella
25
+ }
26
+
27
+ &__cell {
28
+ @apply px-4 py-3 text-sm text-gray-700;
29
+
30
+ &--header {
31
+ @apply bg-gray-50 text-left text-xs uppercase tracking-wider text-gray-500 font-medium;
32
+ }
33
+
34
+ &--footer {
35
+ @apply font-medium;
36
+ }
37
+ }
38
+
39
+ &__row {
40
+ @apply border-b border-gray-200;
41
+ }
42
+
43
+ // Modifiers (varianti)
44
+ &--default {
45
+ @apply bg-white text-gray-900 border-gray-200;
46
+ }
47
+
48
+ &--red {
49
+ @apply bg-red-50 text-red-900 border-red-200;
50
+
51
+ .bui-table__header {
52
+ @apply bg-red-100;
53
+ }
54
+
55
+ .bui-table__footer {
56
+ @apply bg-red-100;
57
+ }
58
+
59
+ .bui-table__cell--header {
60
+ @apply bg-red-100 text-red-800;
61
+ }
62
+ }
63
+
64
+ &--blue {
65
+ @apply bg-blue-50 text-blue-900 border-blue-200;
66
+
67
+ .bui-table__header {
68
+ @apply bg-blue-100;
69
+ }
70
+
71
+ .bui-table__footer {
72
+ @apply bg-blue-100;
73
+ }
74
+
75
+ .bui-table__cell--header {
76
+ @apply bg-blue-100 text-blue-800;
77
+ }
78
+ }
79
+
80
+ &--green {
81
+ @apply bg-green-50 text-green-900 border-green-200;
82
+
83
+ .bui-table__header {
84
+ @apply bg-green-100;
85
+ }
86
+
87
+ .bui-table__footer {
88
+ @apply bg-green-100;
89
+ }
90
+
91
+ .bui-table__cell--header {
92
+ @apply bg-green-100 text-green-800;
93
+ }
94
+ }
95
+
96
+ // Stati tabella
97
+ &--striped {
98
+ .bui-table__row:nth-child(even) {
99
+ @apply bg-gray-50;
100
+ }
101
+ }
102
+
103
+ &--hoverable {
104
+ .bui-table__row:hover {
105
+ @apply bg-gray-100;
106
+ }
107
+ }
108
+
109
+ &--bordered {
110
+ @apply border;
111
+
112
+ .bui-table__cell {
113
+ @apply border;
114
+ }
115
+ }
116
+
117
+ &--compact {
118
+ .bui-table__cell {
119
+ @apply px-2 py-1 text-xs;
120
+ }
121
+ }
122
+
123
+ // Modifiers (border radius)
124
+ &--radius-none {
125
+ @apply rounded-none;
126
+
127
+ .bui-table__container {
128
+ @apply rounded-none;
129
+ }
130
+ }
131
+
132
+ &--radius-small {
133
+ @apply rounded-md;
134
+
135
+ .bui-table__container {
136
+ @apply rounded-md overflow-hidden;
137
+ }
138
+ }
139
+
140
+ &--radius-medium {
141
+ @apply rounded-lg;
142
+
143
+ .bui-table__container {
144
+ @apply rounded-lg overflow-hidden;
145
+ }
146
+ }
147
+
148
+ &--radius-large {
149
+ @apply rounded-xl;
150
+
151
+ .bui-table__container {
152
+ @apply rounded-xl overflow-hidden;
153
+ }
154
+ }
155
+ }
156
+ }
@@ -0,0 +1,4 @@
1
+ // File principale che importa tutti i moduli
2
+ @use "better_ui/base";
3
+ @use "better_ui/components";
4
+ @use "better_ui/utilities";
@@ -3,12 +3,12 @@
3
3
  <img
4
4
  src="<%= @src %>"
5
5
  alt="<%= @name || 'Avatar' %>"
6
- class="bui-avatar-image"
6
+ class="bui-avatar__image"
7
7
  width="<%= pixel_size %>"
8
8
  height="<%= pixel_size %>"
9
9
  >
10
10
  <% else %>
11
- <div class="bui-avatar-initials">
11
+ <div class="bui-avatar__placeholder">
12
12
  <%= initials %>
13
13
  </div>
14
14
  <% end %>