better_ui 0.1.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.
- checksums.yaml +4 -4
- data/README.md +199 -75
- data/app/assets/javascripts/better_ui/controllers/navbar_controller.js +138 -0
- data/app/assets/javascripts/better_ui/controllers/sidebar_controller.js +211 -0
- data/app/assets/javascripts/better_ui/controllers/toast_controller.js +161 -0
- data/app/assets/javascripts/better_ui/index.js +159 -0
- data/app/assets/javascripts/better_ui/toast_manager.js +77 -0
- data/app/assets/stylesheets/better_ui/application.css +25 -351
- data/app/components/better_ui/application/alert_component.html.erb +27 -0
- data/app/components/better_ui/application/alert_component.rb +202 -0
- 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/header_component.html.erb +88 -0
- data/app/components/better_ui/application/header_component.rb +188 -0
- data/app/components/better_ui/application/navbar_component.html.erb +294 -0
- data/app/components/better_ui/application/navbar_component.rb +249 -0
- data/app/components/better_ui/application/sidebar_component.html.erb +207 -0
- data/app/components/better_ui/application/sidebar_component.rb +318 -0
- data/app/components/better_ui/application/toast_component.html.erb +35 -0
- data/app/components/better_ui/application/toast_component.rb +223 -0
- 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 +123 -0
- data/app/components/better_ui/general/breadcrumb_component.html.erb +15 -0
- data/app/components/better_ui/general/breadcrumb_component.rb +130 -0
- data/app/components/better_ui/general/button_component.html.erb +34 -0
- data/app/components/better_ui/general/button_component.rb +162 -0
- data/app/components/better_ui/general/heading_component.html.erb +25 -0
- data/app/components/better_ui/general/heading_component.rb +148 -0
- data/app/components/better_ui/general/icon_component.html.erb +2 -0
- data/app/components/better_ui/general/icon_component.rb +100 -0
- 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.html.erb +27 -0
- data/app/components/better_ui/general/panel_component.rb +103 -0
- 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 +73 -0
- data/app/components/better_ui/general/table_component.rb +167 -0
- data/app/components/better_ui/theme_helper.rb +171 -0
- data/app/controllers/better_ui/application_controller.rb +1 -0
- data/app/controllers/better_ui/docs_controller.rb +18 -25
- 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/app/views/layouts/component_preview.html.erb +32 -0
- data/config/initializers/lookbook.rb +23 -0
- data/config/routes.rb +6 -1
- data/lib/better_ui/engine.rb +18 -1
- data/lib/better_ui/version.rb +1 -1
- data/lib/better_ui.rb +4 -0
- data/lib/generators/better_ui/stylesheet_generator.rb +96 -0
- data/lib/generators/better_ui/templates/README +56 -0
- data/lib/generators/better_ui/templates/components/_avatar.scss +151 -0
- data/lib/generators/better_ui/templates/components/_badge.scss +142 -0
- data/lib/generators/better_ui/templates/components/_breadcrumb.scss +107 -0
- data/lib/generators/better_ui/templates/components/_button.scss +106 -0
- data/lib/generators/better_ui/templates/components/_card.scss +69 -0
- data/lib/generators/better_ui/templates/components/_heading.scss +180 -0
- data/lib/generators/better_ui/templates/components/_icon.scss +90 -0
- data/lib/generators/better_ui/templates/components/_link.scss +130 -0
- data/lib/generators/better_ui/templates/components/_panel.scss +144 -0
- data/lib/generators/better_ui/templates/components/_spinner.scss +132 -0
- data/lib/generators/better_ui/templates/components/_table.scss +105 -0
- data/lib/generators/better_ui/templates/components/_variables.scss +33 -0
- data/lib/generators/better_ui/templates/components_stylesheet.scss +66 -0
- metadata +135 -10
- data/app/helpers/better_ui/application_helper.rb +0 -183
- data/app/views/better_ui/docs/component.html.erb +0 -365
- data/app/views/better_ui/docs/index.html.erb +0 -100
- data/app/views/better_ui/docs/show.html.erb +0 -60
- data/app/views/layouts/better_ui/application.html.erb +0 -135
@@ -0,0 +1,105 @@
|
|
1
|
+
/* ==============================
|
2
|
+
* Table Component
|
3
|
+
* ============================== */
|
4
|
+
|
5
|
+
/* Contenitore e base */
|
6
|
+
.bui-table-container {
|
7
|
+
@apply overflow-hidden;
|
8
|
+
}
|
9
|
+
|
10
|
+
.bui-table-base {
|
11
|
+
@apply w-full;
|
12
|
+
}
|
13
|
+
|
14
|
+
.bui-table-bordered {
|
15
|
+
@apply border-collapse;
|
16
|
+
}
|
17
|
+
|
18
|
+
/* Bordi arrotondati */
|
19
|
+
.bui-table-radius-none { @apply rounded-none; }
|
20
|
+
.bui-table-radius-small { @apply rounded-md; }
|
21
|
+
.bui-table-radius-medium { @apply rounded-lg; }
|
22
|
+
.bui-table-radius-large { @apply rounded-xl; }
|
23
|
+
.bui-table-radius-full { @apply rounded-3xl; }
|
24
|
+
|
25
|
+
/* Celle e righe */
|
26
|
+
.bui-table-cell {
|
27
|
+
@apply px-4 py-3;
|
28
|
+
}
|
29
|
+
|
30
|
+
.bui-table-cell-compact {
|
31
|
+
@apply px-2 py-1 text-sm;
|
32
|
+
}
|
33
|
+
|
34
|
+
.bui-table-cell-bordered {
|
35
|
+
@apply border;
|
36
|
+
}
|
37
|
+
|
38
|
+
/* Stili per le righe */
|
39
|
+
.bui-table-row-hover tr:hover td {
|
40
|
+
@apply bg-opacity-10 bg-gray-500;
|
41
|
+
}
|
42
|
+
|
43
|
+
.bui-table-row-striped tr:nth-child(odd) td {
|
44
|
+
@apply bg-gray-50;
|
45
|
+
}
|
46
|
+
|
47
|
+
.bui-table-row-alternate {
|
48
|
+
@apply bg-gray-50;
|
49
|
+
}
|
50
|
+
|
51
|
+
/* Caption */
|
52
|
+
.bui-table-caption {
|
53
|
+
@apply p-3 font-medium;
|
54
|
+
}
|
55
|
+
|
56
|
+
.bui-table-caption-bordered {
|
57
|
+
@apply border-b;
|
58
|
+
}
|
59
|
+
|
60
|
+
/* Header */
|
61
|
+
.bui-table-header th {
|
62
|
+
@apply font-semibold;
|
63
|
+
}
|
64
|
+
|
65
|
+
/* Footer */
|
66
|
+
.bui-table-footer td {
|
67
|
+
@apply font-semibold;
|
68
|
+
}
|
69
|
+
|
70
|
+
.bui-table-footer-cell {
|
71
|
+
@apply bg-opacity-90;
|
72
|
+
}
|
73
|
+
|
74
|
+
/* Varianti bordi */
|
75
|
+
.bui-table-border-default { @apply border-gray-900; }
|
76
|
+
.bui-table-border-white { @apply border-gray-200; }
|
77
|
+
.bui-table-border-red { @apply border-red-600; }
|
78
|
+
.bui-table-border-rose { @apply border-rose-600; }
|
79
|
+
.bui-table-border-orange { @apply border-orange-600; }
|
80
|
+
.bui-table-border-green { @apply border-green-600; }
|
81
|
+
.bui-table-border-blue { @apply border-blue-600; }
|
82
|
+
.bui-table-border-yellow { @apply border-yellow-600; }
|
83
|
+
.bui-table-border-violet { @apply border-violet-600; }
|
84
|
+
|
85
|
+
/* Varianti background */
|
86
|
+
.bui-table-bg-default { @apply bg-black; }
|
87
|
+
.bui-table-bg-white { @apply bg-white; }
|
88
|
+
.bui-table-bg-red { @apply bg-red-500; }
|
89
|
+
.bui-table-bg-rose { @apply bg-rose-500; }
|
90
|
+
.bui-table-bg-orange { @apply bg-orange-500; }
|
91
|
+
.bui-table-bg-green { @apply bg-green-500; }
|
92
|
+
.bui-table-bg-blue { @apply bg-blue-500; }
|
93
|
+
.bui-table-bg-yellow { @apply bg-yellow-500; }
|
94
|
+
.bui-table-bg-violet { @apply bg-violet-500; }
|
95
|
+
|
96
|
+
/* Varianti testo */
|
97
|
+
.bui-table-text-default { @apply text-white; }
|
98
|
+
.bui-table-text-white { @apply text-black; }
|
99
|
+
.bui-table-text-red { @apply text-white; }
|
100
|
+
.bui-table-text-rose { @apply text-white; }
|
101
|
+
.bui-table-text-orange { @apply text-white; }
|
102
|
+
.bui-table-text-green { @apply text-white; }
|
103
|
+
.bui-table-text-blue { @apply text-white; }
|
104
|
+
.bui-table-text-yellow { @apply text-black; }
|
105
|
+
.bui-table-text-violet { @apply text-white; }
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/* ==============================
|
2
|
+
* Variables
|
3
|
+
* ============================== */
|
4
|
+
|
5
|
+
/* Colori principali - usa i colori di Tailwind */
|
6
|
+
$bui-primary: theme('colors.blue.500') !default;
|
7
|
+
$bui-primary-hover: theme('colors.blue.600') !default;
|
8
|
+
$bui-secondary: theme('colors.gray.500') !default;
|
9
|
+
$bui-secondary-hover: theme('colors.gray.600') !default;
|
10
|
+
$bui-success: theme('colors.emerald.500') !default;
|
11
|
+
$bui-warning: theme('colors.amber.500') !default;
|
12
|
+
$bui-danger: theme('colors.red.500') !default;
|
13
|
+
$bui-info: theme('colors.blue.500') !default;
|
14
|
+
|
15
|
+
/* Spaziature - usa gli spacing di Tailwind */
|
16
|
+
$bui-spacing-xs: theme('spacing.1') !default;
|
17
|
+
$bui-spacing-sm: theme('spacing.2') !default;
|
18
|
+
$bui-spacing-md: theme('spacing.4') !default;
|
19
|
+
$bui-spacing-lg: theme('spacing.6') !default;
|
20
|
+
$bui-spacing-xl: theme('spacing.8') !default;
|
21
|
+
|
22
|
+
/* Tipografia - usa i font di Tailwind */
|
23
|
+
$bui-font-family: theme('fontFamily.sans') !default;
|
24
|
+
$bui-font-size-sm: theme('fontSize.sm[0]') !default;
|
25
|
+
$bui-font-size-base: theme('fontSize.base[0]') !default;
|
26
|
+
$bui-font-size-lg: theme('fontSize.lg[0]') !default;
|
27
|
+
$bui-font-size-xl: theme('fontSize.xl[0]') !default;
|
28
|
+
|
29
|
+
/* Border radius - usa i radius di Tailwind */
|
30
|
+
$bui-radius-sm: theme('borderRadius.sm') !default;
|
31
|
+
$bui-radius-md: theme('borderRadius.md') !default;
|
32
|
+
$bui-radius-lg: theme('borderRadius.lg') !default;
|
33
|
+
$bui-radius-full: theme('borderRadius.full') !default;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
/*
|
2
|
+
* <%= options[:prefix] %>_better_ui_components.scss
|
3
|
+
* Foglio di stile SCSS per la personalizzazione dei componenti di BetterUi
|
4
|
+
* Generato il: <%= Time.now.strftime('%d/%m/%Y %H:%M') %>
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* INDICE:
|
9
|
+
* 1. Variabili
|
10
|
+
* 2. Componenti generali
|
11
|
+
* 3. Componenti applicativi
|
12
|
+
* 4. Personalizzazioni
|
13
|
+
*/
|
14
|
+
|
15
|
+
/*==================================
|
16
|
+
IMPORTAZIONE COMPONENTI E VARIABILI
|
17
|
+
====================================*/
|
18
|
+
/* Importa le variabili */
|
19
|
+
@import "components/variables";
|
20
|
+
|
21
|
+
@layer components {
|
22
|
+
/*==================================
|
23
|
+
COMPONENTI GENERALI
|
24
|
+
====================================*/
|
25
|
+
|
26
|
+
/* Importa il componente Bottone */
|
27
|
+
@import "components/button";
|
28
|
+
|
29
|
+
/* Importa il componente Heading */
|
30
|
+
@import "components/heading";
|
31
|
+
|
32
|
+
/* Importa il componente Breadcrumb */
|
33
|
+
@import "components/breadcrumb";
|
34
|
+
|
35
|
+
/* Importa il componente Link */
|
36
|
+
@import "components/link";
|
37
|
+
|
38
|
+
/* Importa il componente Panel */
|
39
|
+
@import "components/panel";
|
40
|
+
|
41
|
+
/* Importa il componente Icon */
|
42
|
+
@import "components/icon";
|
43
|
+
|
44
|
+
/* Importa il componente Table */
|
45
|
+
@import "components/table";
|
46
|
+
|
47
|
+
/* Importa il componente Spinner */
|
48
|
+
@import "components/spinner";
|
49
|
+
|
50
|
+
/* Importa il componente Badge */
|
51
|
+
@import "components/badge";
|
52
|
+
|
53
|
+
/* Importa il componente Avatar */
|
54
|
+
@import "components/avatar";
|
55
|
+
|
56
|
+
/*==================================
|
57
|
+
COMPONENTI APPLICATIVI
|
58
|
+
====================================*/
|
59
|
+
/* Importa il componente Card */
|
60
|
+
@import "components/card";
|
61
|
+
|
62
|
+
/*==================================
|
63
|
+
PERSONALIZZAZIONI
|
64
|
+
====================================*/
|
65
|
+
/* Qui è possibile aggiungere personalizzazioni specifiche */
|
66
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: better_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alessiobussolari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,6 +66,76 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coderay
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.1'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: font-awesome-sass
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 6.5.1
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 6.5.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: lookbook
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.1'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.1'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: listen
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: actioncable
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
69
139
|
- !ruby/object:Gem::Dependency
|
70
140
|
name: sqlite3
|
71
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,8 +164,8 @@ dependencies:
|
|
94
164
|
- - ">="
|
95
165
|
- !ruby/object:Gem::Version
|
96
166
|
version: '0'
|
97
|
-
description:
|
98
|
-
|
167
|
+
description: A Rails gem that works as a mountable engine containing reusable UI components
|
168
|
+
and documentation pages
|
99
169
|
email:
|
100
170
|
- alessio.bussolari@pandev.it
|
101
171
|
executables: []
|
@@ -105,21 +175,76 @@ files:
|
|
105
175
|
- MIT-LICENSE
|
106
176
|
- README.md
|
107
177
|
- Rakefile
|
178
|
+
- app/assets/javascripts/better_ui/controllers/navbar_controller.js
|
179
|
+
- app/assets/javascripts/better_ui/controllers/sidebar_controller.js
|
180
|
+
- app/assets/javascripts/better_ui/controllers/toast_controller.js
|
181
|
+
- app/assets/javascripts/better_ui/index.js
|
182
|
+
- app/assets/javascripts/better_ui/toast_manager.js
|
108
183
|
- app/assets/stylesheets/better_ui/application.css
|
184
|
+
- app/components/better_ui/application/alert_component.html.erb
|
185
|
+
- app/components/better_ui/application/alert_component.rb
|
186
|
+
- app/components/better_ui/application/card_component.html.erb
|
187
|
+
- app/components/better_ui/application/card_component.rb
|
188
|
+
- app/components/better_ui/application/card_container_component.html.erb
|
189
|
+
- app/components/better_ui/application/card_container_component.rb
|
190
|
+
- app/components/better_ui/application/header_component.html.erb
|
191
|
+
- app/components/better_ui/application/header_component.rb
|
192
|
+
- app/components/better_ui/application/navbar_component.html.erb
|
193
|
+
- app/components/better_ui/application/navbar_component.rb
|
194
|
+
- app/components/better_ui/application/sidebar_component.html.erb
|
195
|
+
- app/components/better_ui/application/sidebar_component.rb
|
196
|
+
- app/components/better_ui/application/toast_component.html.erb
|
197
|
+
- app/components/better_ui/application/toast_component.rb
|
198
|
+
- app/components/better_ui/general/avatar_component.html.erb
|
199
|
+
- app/components/better_ui/general/avatar_component.rb
|
200
|
+
- app/components/better_ui/general/badge_component.html.erb
|
201
|
+
- app/components/better_ui/general/badge_component.rb
|
202
|
+
- app/components/better_ui/general/breadcrumb_component.html.erb
|
203
|
+
- app/components/better_ui/general/breadcrumb_component.rb
|
204
|
+
- app/components/better_ui/general/button_component.html.erb
|
205
|
+
- app/components/better_ui/general/button_component.rb
|
206
|
+
- app/components/better_ui/general/heading_component.html.erb
|
207
|
+
- app/components/better_ui/general/heading_component.rb
|
208
|
+
- app/components/better_ui/general/icon_component.html.erb
|
209
|
+
- app/components/better_ui/general/icon_component.rb
|
210
|
+
- app/components/better_ui/general/link_component.html.erb
|
211
|
+
- app/components/better_ui/general/link_component.rb
|
212
|
+
- app/components/better_ui/general/panel_component.html.erb
|
213
|
+
- app/components/better_ui/general/panel_component.rb
|
214
|
+
- app/components/better_ui/general/spinner_component.html.erb
|
215
|
+
- app/components/better_ui/general/spinner_component.rb
|
216
|
+
- app/components/better_ui/general/table_component.html.erb
|
217
|
+
- app/components/better_ui/general/table_component.rb
|
218
|
+
- app/components/better_ui/theme_helper.rb
|
109
219
|
- app/controllers/better_ui/application_controller.rb
|
110
220
|
- app/controllers/better_ui/docs_controller.rb
|
111
|
-
- app/helpers/better_ui/application_helper.rb
|
112
221
|
- app/jobs/better_ui/application_job.rb
|
113
222
|
- app/mailers/better_ui/application_mailer.rb
|
114
223
|
- app/models/better_ui/application_record.rb
|
115
|
-
- app/views/better_ui/
|
116
|
-
- app/views/better_ui/
|
117
|
-
- app/views/better_ui/
|
118
|
-
- app/views/layouts/
|
224
|
+
- app/views/components/better_ui/general/table/_custom_body_row.html.erb
|
225
|
+
- app/views/components/better_ui/general/table/_custom_footer_rows.html.erb
|
226
|
+
- app/views/components/better_ui/general/table/_custom_header_rows.html.erb
|
227
|
+
- app/views/layouts/component_preview.html.erb
|
228
|
+
- config/initializers/lookbook.rb
|
119
229
|
- config/routes.rb
|
120
230
|
- lib/better_ui.rb
|
121
231
|
- lib/better_ui/engine.rb
|
122
232
|
- lib/better_ui/version.rb
|
233
|
+
- lib/generators/better_ui/stylesheet_generator.rb
|
234
|
+
- lib/generators/better_ui/templates/README
|
235
|
+
- lib/generators/better_ui/templates/components/_avatar.scss
|
236
|
+
- lib/generators/better_ui/templates/components/_badge.scss
|
237
|
+
- lib/generators/better_ui/templates/components/_breadcrumb.scss
|
238
|
+
- lib/generators/better_ui/templates/components/_button.scss
|
239
|
+
- lib/generators/better_ui/templates/components/_card.scss
|
240
|
+
- lib/generators/better_ui/templates/components/_heading.scss
|
241
|
+
- lib/generators/better_ui/templates/components/_icon.scss
|
242
|
+
- lib/generators/better_ui/templates/components/_link.scss
|
243
|
+
- lib/generators/better_ui/templates/components/_panel.scss
|
244
|
+
- lib/generators/better_ui/templates/components/_spinner.scss
|
245
|
+
- lib/generators/better_ui/templates/components/_table.scss
|
246
|
+
- lib/generators/better_ui/templates/components/_variables.scss
|
247
|
+
- lib/generators/better_ui/templates/components_stylesheet.scss
|
123
248
|
- lib/tasks/better_ui_tasks.rake
|
124
249
|
homepage: https://github.com/alessiobussolari/better_ui
|
125
250
|
licenses:
|
@@ -147,5 +272,5 @@ requirements: []
|
|
147
272
|
rubygems_version: 3.5.11
|
148
273
|
signing_key:
|
149
274
|
specification_version: 4
|
150
|
-
summary:
|
275
|
+
summary: Reusable UI components for Rails with integrated documentation
|
151
276
|
test_files: []
|
@@ -1,183 +0,0 @@
|
|
1
|
-
module BetterUi
|
2
|
-
module ApplicationHelper
|
3
|
-
# Metodi helper per i componenti UI semplici
|
4
|
-
|
5
|
-
# Button component
|
6
|
-
def better_ui_button(text, options = {})
|
7
|
-
options = BetterUi.configuration.button_defaults.deep_merge(options)
|
8
|
-
type = options.delete(:type) || 'primary'
|
9
|
-
css_class = "better-ui-button better-ui-button-#{type}"
|
10
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
11
|
-
|
12
|
-
button_tag(text, **options.merge(class: css_class))
|
13
|
-
end
|
14
|
-
|
15
|
-
# Alert component
|
16
|
-
def better_ui_alert(message, options = {})
|
17
|
-
options = BetterUi.configuration.alert_defaults.deep_merge(options)
|
18
|
-
type = options.delete(:type) || 'info'
|
19
|
-
css_class = "better-ui-alert better-ui-alert-#{type}"
|
20
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
21
|
-
|
22
|
-
content_tag(:div, class: css_class) do
|
23
|
-
concat content_tag(:div, message, class: 'better-ui-alert-message')
|
24
|
-
if options[:dismissible]
|
25
|
-
concat content_tag(:button, 'x', class: 'better-ui-alert-close')
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Card component
|
31
|
-
def better_ui_card(options = {}, &block)
|
32
|
-
options = BetterUi.configuration.card_defaults.deep_merge(options)
|
33
|
-
css_class = "better-ui-card"
|
34
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
35
|
-
|
36
|
-
content_tag(:div, class: css_class, **options, &block)
|
37
|
-
end
|
38
|
-
|
39
|
-
# Card header
|
40
|
-
def better_ui_card_header(title, options = {})
|
41
|
-
css_class = "better-ui-card-header"
|
42
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
43
|
-
|
44
|
-
content_tag(:div, class: css_class) do
|
45
|
-
content_tag(:h3, title, class: 'better-ui-card-title')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
# Card body
|
50
|
-
def better_ui_card_body(options = {}, &block)
|
51
|
-
css_class = "better-ui-card-body"
|
52
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
53
|
-
|
54
|
-
content_tag(:div, class: css_class, **options, &block)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Card footer
|
58
|
-
def better_ui_card_footer(options = {}, &block)
|
59
|
-
css_class = "better-ui-card-footer"
|
60
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
61
|
-
|
62
|
-
content_tag(:div, class: css_class, **options, &block)
|
63
|
-
end
|
64
|
-
|
65
|
-
# Tabs component
|
66
|
-
def better_ui_tabs(options = {}, &block)
|
67
|
-
options = BetterUi.configuration.tabs_defaults.deep_merge(options)
|
68
|
-
css_class = "better-ui-tabs"
|
69
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
70
|
-
|
71
|
-
content_tag(:div, class: css_class, **options, &block)
|
72
|
-
end
|
73
|
-
|
74
|
-
# Tab list
|
75
|
-
def better_ui_tab_list(options = {}, &block)
|
76
|
-
css_class = "better-ui-tab-list"
|
77
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
78
|
-
|
79
|
-
content_tag(:div, class: css_class, role: 'tablist', **options, &block)
|
80
|
-
end
|
81
|
-
|
82
|
-
# Tab item
|
83
|
-
def better_ui_tab_item(text, target, options = {})
|
84
|
-
active = options.delete(:active) || false
|
85
|
-
css_class = "better-ui-tab-item"
|
86
|
-
css_class += " better-ui-tab-active" if active
|
87
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
88
|
-
|
89
|
-
content_tag(:button, text, {
|
90
|
-
class: css_class,
|
91
|
-
role: 'tab',
|
92
|
-
'aria-selected': active,
|
93
|
-
'data-target': target,
|
94
|
-
}.merge(options))
|
95
|
-
end
|
96
|
-
|
97
|
-
# Tab content
|
98
|
-
def better_ui_tab_content(options = {}, &block)
|
99
|
-
css_class = "better-ui-tab-content"
|
100
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
101
|
-
|
102
|
-
content_tag(:div, class: css_class, role: 'tabpanel', **options, &block)
|
103
|
-
end
|
104
|
-
|
105
|
-
# Modal component
|
106
|
-
def better_ui_modal(id, options = {}, &block)
|
107
|
-
css_class = "better-ui-modal"
|
108
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
109
|
-
|
110
|
-
content_tag(:div, id: id, class: css_class) do
|
111
|
-
concat content_tag(:div, '', class: 'better-ui-modal-background')
|
112
|
-
concat content_tag(:div, class: 'better-ui-modal-dialog', &block)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
# Modal header
|
117
|
-
def better_ui_modal_header(title, options = {})
|
118
|
-
css_class = "better-ui-modal-header"
|
119
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
120
|
-
|
121
|
-
content_tag(:div, class: css_class) do
|
122
|
-
concat content_tag(:h5, title, class: 'better-ui-modal-title')
|
123
|
-
concat content_tag(:button, '×', type: 'button', class: 'better-ui-modal-close')
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
# Modal body
|
128
|
-
def better_ui_modal_body(options = {}, &block)
|
129
|
-
css_class = "better-ui-modal-body"
|
130
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
131
|
-
|
132
|
-
content_tag(:div, class: css_class, **options, &block)
|
133
|
-
end
|
134
|
-
|
135
|
-
# Modal footer
|
136
|
-
def better_ui_modal_footer(options = {}, &block)
|
137
|
-
css_class = "better-ui-modal-footer"
|
138
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
139
|
-
|
140
|
-
content_tag(:div, class: css_class, **options, &block)
|
141
|
-
end
|
142
|
-
|
143
|
-
# Trigger button for modal
|
144
|
-
def better_ui_modal_trigger(text, modal_id, options = {})
|
145
|
-
options = BetterUi.configuration.button_defaults.deep_merge(options)
|
146
|
-
type = options.delete(:type) || 'primary'
|
147
|
-
css_class = "better-ui-button better-ui-button-#{type}"
|
148
|
-
css_class += " #{options.delete(:class)}" if options[:class]
|
149
|
-
|
150
|
-
button_tag(text, **options.merge(
|
151
|
-
class: css_class,
|
152
|
-
type: 'button',
|
153
|
-
onclick: "document.getElementById('#{modal_id}').style.display='flex'"
|
154
|
-
))
|
155
|
-
end
|
156
|
-
|
157
|
-
# Render markdown
|
158
|
-
def better_ui_markdown(text)
|
159
|
-
return '' if text.blank?
|
160
|
-
|
161
|
-
renderer = Redcarpet::Render::HTML.new(
|
162
|
-
filter_html: false,
|
163
|
-
hard_wrap: true,
|
164
|
-
link_attributes: { target: '_blank', rel: 'noopener noreferrer' }
|
165
|
-
)
|
166
|
-
|
167
|
-
markdown = Redcarpet::Markdown.new(
|
168
|
-
renderer,
|
169
|
-
autolink: true,
|
170
|
-
tables: true,
|
171
|
-
fenced_code_blocks: true,
|
172
|
-
strikethrough: true,
|
173
|
-
superscript: true,
|
174
|
-
underline: true,
|
175
|
-
highlight: true,
|
176
|
-
quote: true,
|
177
|
-
footnotes: true
|
178
|
-
)
|
179
|
-
|
180
|
-
markdown.render(text).html_safe
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|