better_ui 0.6.0 โ 0.7.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 +257 -212
- data/Rakefile +11 -2
- data/app/components/better_ui/action_messages_component/action_messages_component.html.erb +48 -0
- data/app/components/better_ui/action_messages_component.rb +544 -0
- data/app/components/better_ui/application_component.rb +66 -0
- data/app/components/better_ui/button_component/button_component.html.erb +31 -0
- data/app/components/better_ui/button_component.rb +307 -0
- data/app/components/better_ui/card_component/card_component.html.erb +17 -0
- data/app/components/better_ui/card_component.rb +460 -0
- data/app/components/better_ui/drawer/header_component/header_component.html.erb +24 -0
- data/app/components/better_ui/drawer/header_component.rb +238 -0
- data/app/components/better_ui/drawer/layout_component/layout_component.html.erb +44 -0
- data/app/components/better_ui/drawer/layout_component.rb +270 -0
- data/app/components/better_ui/drawer/nav_group_component/nav_group_component.html.erb +10 -0
- data/app/components/better_ui/drawer/nav_group_component.rb +155 -0
- data/app/components/better_ui/drawer/nav_item_component/nav_item_component.html.erb +13 -0
- data/app/components/better_ui/drawer/nav_item_component.rb +225 -0
- data/app/components/better_ui/drawer/sidebar_component/sidebar_component.html.erb +17 -0
- data/app/components/better_ui/drawer/sidebar_component.rb +263 -0
- data/app/components/better_ui/forms/base_component.rb +450 -0
- data/app/components/better_ui/forms/checkbox_component/checkbox_component.html.erb +28 -0
- data/app/components/better_ui/forms/checkbox_component.rb +419 -0
- data/app/components/better_ui/forms/checkbox_group_component/checkbox_group_component.html.erb +40 -0
- data/app/components/better_ui/forms/checkbox_group_component.rb +363 -0
- data/app/components/better_ui/forms/number_input_component/number_input_component.html.erb +40 -0
- data/app/components/better_ui/forms/number_input_component.rb +320 -0
- data/app/components/better_ui/forms/password_input_component/password_input_component.html.erb +71 -0
- data/app/components/better_ui/forms/password_input_component.rb +206 -0
- data/app/components/better_ui/forms/text_input_component/text_input_component.html.erb +40 -0
- data/app/components/better_ui/forms/text_input_component.rb +258 -0
- data/app/components/better_ui/forms/textarea_component/textarea_component.html.erb +40 -0
- data/app/components/better_ui/forms/textarea_component.rb +329 -0
- data/app/form_builders/better_ui/ui_form_builder.rb +467 -0
- data/app/helpers/better_ui/application_helper.rb +325 -58
- data/app/views/layouts/better_ui/application.html.erb +1 -1
- data/config/routes.rb +1 -0
- data/lib/better_ui/engine.rb +34 -5
- data/lib/better_ui/version.rb +1 -1
- data/lib/better_ui.rb +32 -5
- data/lib/generators/better_ui/install/USAGE +44 -0
- data/lib/generators/better_ui/install/install_generator.rb +87 -0
- data/lib/generators/better_ui/install/templates/better_ui_theme.css.tt +280 -0
- data/lib/tasks/better_ui_tasks.rake +39 -4
- metadata +52 -200
- data/app/components/better_ui/application/card/component.html.erb +0 -20
- data/app/components/better_ui/application/card/component.rb +0 -214
- data/app/components/better_ui/application/main/component.html.erb +0 -9
- data/app/components/better_ui/application/main/component.rb +0 -123
- data/app/components/better_ui/application/navbar/component.html.erb +0 -92
- data/app/components/better_ui/application/navbar/component.rb +0 -136
- data/app/components/better_ui/application/sidebar/component.html.erb +0 -249
- data/app/components/better_ui/application/sidebar/component.rb +0 -187
- data/app/components/better_ui/general/accordion/component.html.erb +0 -5
- data/app/components/better_ui/general/accordion/component.rb +0 -92
- data/app/components/better_ui/general/accordion/item_component.html.erb +0 -12
- data/app/components/better_ui/general/accordion/item_component.rb +0 -176
- data/app/components/better_ui/general/alert/component.html.erb +0 -32
- data/app/components/better_ui/general/alert/component.rb +0 -242
- data/app/components/better_ui/general/avatar/component.html.erb +0 -20
- data/app/components/better_ui/general/avatar/component.rb +0 -301
- data/app/components/better_ui/general/badge/component.html.erb +0 -23
- data/app/components/better_ui/general/badge/component.rb +0 -248
- data/app/components/better_ui/general/breadcrumb/component.html.erb +0 -15
- data/app/components/better_ui/general/breadcrumb/component.rb +0 -187
- data/app/components/better_ui/general/button/component.html.erb +0 -34
- data/app/components/better_ui/general/button/component.rb +0 -214
- data/app/components/better_ui/general/divider/component.html.erb +0 -10
- data/app/components/better_ui/general/divider/component.rb +0 -226
- data/app/components/better_ui/general/dropdown/component.html.erb +0 -28
- data/app/components/better_ui/general/dropdown/component.rb +0 -192
- data/app/components/better_ui/general/dropdown/divider_component.html.erb +0 -1
- data/app/components/better_ui/general/dropdown/divider_component.rb +0 -41
- data/app/components/better_ui/general/dropdown/item_component.html.erb +0 -6
- data/app/components/better_ui/general/dropdown/item_component.rb +0 -119
- data/app/components/better_ui/general/field/component.html.erb +0 -27
- data/app/components/better_ui/general/field/component.rb +0 -37
- data/app/components/better_ui/general/grid/cell_component.html.erb +0 -3
- data/app/components/better_ui/general/grid/cell_component.rb +0 -390
- data/app/components/better_ui/general/grid/component.html.erb +0 -3
- data/app/components/better_ui/general/grid/component.rb +0 -301
- data/app/components/better_ui/general/heading/component.html.erb +0 -22
- data/app/components/better_ui/general/heading/component.rb +0 -257
- data/app/components/better_ui/general/icon/component.html.erb +0 -7
- data/app/components/better_ui/general/icon/component.rb +0 -240
- data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
- data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
- data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
- data/app/components/better_ui/general/input/datetime/component.rb +0 -223
- data/app/components/better_ui/general/input/pin/component.html.erb +0 -1
- data/app/components/better_ui/general/input/pin/component.rb +0 -201
- data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
- data/app/components/better_ui/general/input/radio/component.rb +0 -230
- data/app/components/better_ui/general/input/rating/component.html.erb +0 -4
- data/app/components/better_ui/general/input/rating/component.rb +0 -272
- data/app/components/better_ui/general/input/select/component.html.erb +0 -78
- data/app/components/better_ui/general/input/select/component.rb +0 -249
- data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
- data/app/components/better_ui/general/input/select/select_component.rb +0 -37
- data/app/components/better_ui/general/input/text/component.html.erb +0 -5
- data/app/components/better_ui/general/input/text/component.rb +0 -171
- data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
- data/app/components/better_ui/general/input/textarea/component.rb +0 -166
- data/app/components/better_ui/general/input/toggle/component.html.erb +0 -5
- data/app/components/better_ui/general/input/toggle/component.rb +0 -242
- data/app/components/better_ui/general/link/component.html.erb +0 -18
- data/app/components/better_ui/general/link/component.rb +0 -258
- data/app/components/better_ui/general/modal/component.html.erb +0 -5
- data/app/components/better_ui/general/modal/component.rb +0 -47
- data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
- data/app/components/better_ui/general/modal/modal_component.rb +0 -160
- data/app/components/better_ui/general/pagination/component.html.erb +0 -85
- data/app/components/better_ui/general/pagination/component.rb +0 -216
- data/app/components/better_ui/general/panel/component.html.erb +0 -28
- data/app/components/better_ui/general/panel/component.rb +0 -249
- data/app/components/better_ui/general/progress/component.html.erb +0 -11
- data/app/components/better_ui/general/progress/component.rb +0 -160
- data/app/components/better_ui/general/spinner/component.html.erb +0 -35
- data/app/components/better_ui/general/spinner/component.rb +0 -93
- data/app/components/better_ui/general/table/component.html.erb +0 -5
- data/app/components/better_ui/general/table/component.rb +0 -217
- data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tbody_component.rb +0 -30
- data/app/components/better_ui/general/table/td_component.html.erb +0 -3
- data/app/components/better_ui/general/table/td_component.rb +0 -44
- data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
- data/app/components/better_ui/general/table/th_component.html.erb +0 -6
- data/app/components/better_ui/general/table/th_component.rb +0 -51
- data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
- data/app/components/better_ui/general/table/thead_component.rb +0 -28
- data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
- data/app/components/better_ui/general/table/tr_component.rb +0 -30
- data/app/components/better_ui/general/tabs/component.html.erb +0 -11
- data/app/components/better_ui/general/tabs/component.rb +0 -120
- data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
- data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
- data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
- data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
- data/app/components/better_ui/general/tag/component.html.erb +0 -3
- data/app/components/better_ui/general/tag/component.rb +0 -104
- data/app/components/better_ui/general/text/component.html.erb +0 -1
- data/app/components/better_ui/general/text/component.rb +0 -194
- data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
- data/app/components/better_ui/general/tooltip/component.rb +0 -239
- data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
- data/app/helpers/better_ui/application/components/card.rb +0 -11
- data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
- data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
- data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
- data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
- data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
- data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
- data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
- data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
- data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
- data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
- data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
- data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -88
- data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -68
- data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
- data/app/helpers/better_ui/general/components/grid/grid_helper.rb +0 -145
- data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
- data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
- data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
- data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
- data/app/helpers/better_ui/general/components/input/pin/pin_helper.rb +0 -76
- data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
- data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
- data/app/helpers/better_ui/general/components/input/rating/rating_helper.rb +0 -70
- data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -86
- data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
- data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
- data/app/helpers/better_ui/general/components/input/toggle/toggle_helper.rb +0 -77
- data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
- data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
- data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
- data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
- data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
- data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
- data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
- data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
- data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
- data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
- data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
- data/app/helpers/better_ui/general/components/text/text_helper.rb +0 -83
- data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
- data/app/jobs/better_ui/application_job.rb +0 -4
- data/app/mailers/better_ui/application_mailer.rb +0 -6
- data/config/initializers/lookbook.rb +0 -23
- data/lib/better_ui/railtie.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 901faa502739d5315ad85daca3b71de07b07f27cf3e0bce6ff613ff95f4aa749
|
|
4
|
+
data.tar.gz: 8035578f8400b55714940ae366de2dd0543648c5c7238efa73d82ef7808fb247
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3f2d7365e452d664eb6edd0558f172ca9d5d36f1dc7e856d7b76171cabab7fb9bc491207d46474ede9d5487d02eca729efc76dcf449d2ad95dff256d36064e04
|
|
7
|
+
data.tar.gz: 7055b3abfe4b843f68b4ff06005b33862b1d13855fc312688a81c474c44034be629e7690ab1572596d4bb22591575336b44b95783e2487eb1f7a6b9bd2f1ec9a
|
data/README.md
CHANGED
|
@@ -1,301 +1,346 @@
|
|
|
1
|
-
#
|
|
1
|
+
# BetterUi
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A modern Rails UI component library built with ViewComponent and Tailwind CSS v4. BetterUi provides a comprehensive set of customizable, accessible, and production-ready components for Rails applications.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- ๐ **Documentazione Interattiva**: Preview Lookbook integrate per tutti i componenti
|
|
7
|
-
- ๐ง **Altamente Personalizzabile**: Opzioni di configurazione flessibili per ogni componente
|
|
8
|
-
- ๐ **Production Ready**: Componenti testati che seguono le best practices
|
|
9
|
-
- ๐ฑ **Responsive**: Tutti i componenti sono mobile-first e responsive
|
|
10
|
-
- โฟ **Accessibile**: Costruiti pensando all'accessibilitร
|
|
5
|
+
## Important: Dual Distribution
|
|
11
6
|
|
|
12
|
-
|
|
7
|
+
BetterUi uses a **dual distribution model**:
|
|
8
|
+
- **Ruby gem** (`better_ui`) - ViewComponents for Rails
|
|
9
|
+
- **npm package** (`@pandev-srl/better-ui`) - JavaScript (Stimulus controllers) and CSS (theme)
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
Your Rails application must install both. See [Installation Guide](doc/INSTALLATION.md) for detailed setup instructions.
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- **Solo TailwindCSS**: Approccio puro Tailwind senza file CSS/SCSS personalizzati
|
|
19
|
-
- **26 Componenti**: Libreria completa organizzata per scopo
|
|
20
|
-
- **Sistema Input Unificato**: Componenti input supportano 14+ tipi (text, email, password, number, date, time, etc.)
|
|
21
|
-
- **Documentazione Interattiva**: Integrazione Lookbook con preview live
|
|
22
|
-
- **Sistema Helper**: Helper Rails-friendly con integrazione form builder
|
|
23
|
-
- **Tematizzazione Consistente**: 9 temi standard (default, white, red, rose, orange, green, blue, yellow, violet)
|
|
24
|
-
- **Dimensionamento Flessibile**: 3 dimensioni standard (small, medium, large) con 5 opzioni border radius
|
|
25
|
-
- **Accessibilitร **: Componenti progettati seguendo le best practices di accessibilitร
|
|
26
|
-
|
|
27
|
-
## Installazione
|
|
28
|
-
|
|
29
|
-
Aggiungi questa riga al Gemfile della tua applicazione:
|
|
30
|
-
|
|
31
|
-
```ruby
|
|
32
|
-
gem "better_ui"
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Per lo sviluppo con documentazione Lookbook:
|
|
13
|
+
## Quick Start
|
|
36
14
|
|
|
37
15
|
```ruby
|
|
16
|
+
# Gemfile
|
|
38
17
|
gem "better_ui"
|
|
39
|
-
gem "lookbook", group: :development
|
|
40
18
|
```
|
|
41
19
|
|
|
42
|
-
Quindi esegui:
|
|
43
|
-
|
|
44
20
|
```bash
|
|
45
|
-
|
|
21
|
+
bundle install
|
|
22
|
+
yarn add @pandev-srl/better-ui
|
|
46
23
|
```
|
|
47
24
|
|
|
48
|
-
|
|
25
|
+
**JavaScript** (app/javascript/application.js):
|
|
26
|
+
```javascript
|
|
27
|
+
import { Application } from "@hotwired/stimulus"
|
|
28
|
+
import { registerControllers } from "@pandev-srl/better-ui"
|
|
49
29
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
30
|
+
const application = Application.start()
|
|
31
|
+
registerControllers(application)
|
|
32
|
+
```
|
|
53
33
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
34
|
+
**CSS** (app/assets/stylesheets/application.css):
|
|
35
|
+
```css
|
|
36
|
+
/* Full bundle (recommended) */
|
|
37
|
+
@import "@pandev-srl/better-ui/css";
|
|
38
|
+
@source "../../../vendor/bundle/**/*.{rb,erb}";
|
|
39
|
+
|
|
40
|
+
/* Or import individual modules for customization */
|
|
41
|
+
/* @import "tailwindcss"; */
|
|
42
|
+
/* @import "@pandev-srl/better-ui/theme"; */
|
|
43
|
+
/* @import "@pandev-srl/better-ui/typography"; */
|
|
44
|
+
/* @import "@pandev-srl/better-ui/utilities"; */
|
|
59
45
|
```
|
|
60
46
|
|
|
61
|
-
|
|
47
|
+
```erb
|
|
48
|
+
<!-- In your views -->
|
|
49
|
+
<%= render BetterUi::ButtonComponent.new(
|
|
50
|
+
label: "Get Started",
|
|
51
|
+
variant: "primary",
|
|
52
|
+
size: "lg"
|
|
53
|
+
) %>
|
|
54
|
+
```
|
|
62
55
|
|
|
63
|
-
|
|
56
|
+
## Features
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
- **Rails 8.1+ Compatible**: Built for modern Rails applications
|
|
59
|
+
- **ViewComponent Architecture**: Encapsulated, testable, and reusable components
|
|
60
|
+
- **Tailwind CSS v4**: Leverages the latest Tailwind features with OKLCH color space
|
|
61
|
+
- **Fully Customizable**: 9 semantic color variants with complete theme control
|
|
62
|
+
- **Form Builder Integration**: Seamless integration with Rails forms via `UiFormBuilder`
|
|
63
|
+
- **Stimulus Controllers**: Interactive components with built-in JavaScript behaviors
|
|
64
|
+
- **Accessible by Default**: ARIA attributes and keyboard navigation support
|
|
65
|
+
- **Production Ready**: Battle-tested components with comprehensive documentation
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
end
|
|
72
|
-
```
|
|
67
|
+
## Installation
|
|
73
68
|
|
|
74
|
-
|
|
69
|
+
For detailed installation and configuration instructions, see the [Installation Guide](doc/INSTALLATION.md).
|
|
75
70
|
|
|
76
|
-
###
|
|
71
|
+
### Prerequisites
|
|
77
72
|
|
|
78
|
-
|
|
73
|
+
- Rails 8.1.1 or higher
|
|
74
|
+
- Node.js and npm (for Tailwind CSS)
|
|
75
|
+
- Tailwind CSS v4 (currently in beta)
|
|
79
76
|
|
|
80
|
-
##
|
|
77
|
+
## Component Overview
|
|
81
78
|
|
|
82
|
-
|
|
79
|
+
### Core Components
|
|
83
80
|
|
|
84
|
-
|
|
81
|
+
#### Button Component
|
|
82
|
+
A versatile button component with multiple styles, sizes, and states.
|
|
83
|
+
- **Variants**: primary, secondary, accent, success, danger, warning, info, light, dark
|
|
84
|
+
- **Styles**: solid, outline, ghost, soft
|
|
85
|
+
- **Sizes**: xs, sm, md, lg, xl
|
|
86
|
+
- **Features**: Loading states, icons, disabled states
|
|
85
87
|
|
|
86
88
|
```erb
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
size: :large,
|
|
94
|
-
required: true
|
|
95
|
-
) %>
|
|
96
|
-
|
|
97
|
-
<%# Button con theme e size %>
|
|
98
|
-
<%= bui_button(
|
|
99
|
-
'Invia Form',
|
|
100
|
-
theme: :green,
|
|
101
|
-
size: :large,
|
|
102
|
-
type: :submit
|
|
103
|
-
) %>
|
|
104
|
-
|
|
105
|
-
<%# Card con blocco di contenuto %>
|
|
106
|
-
<%= bui_card(title: 'Profilo Utente', theme: :white) do %>
|
|
107
|
-
<p>Contenuto informazioni utente qui</p>
|
|
89
|
+
<%= render BetterUi::ButtonComponent.new(
|
|
90
|
+
label: "Save Changes",
|
|
91
|
+
variant: "success",
|
|
92
|
+
style: "solid"
|
|
93
|
+
) do |c| %>
|
|
94
|
+
<% c.with_icon_before { "๐พ" } %>
|
|
108
95
|
<% end %>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Card Component
|
|
99
|
+
A flexible container component with customizable padding and optional slots.
|
|
100
|
+
- **Variants**: primary, secondary, accent, success, danger, warning, info, light, dark
|
|
101
|
+
- **Styles**: solid, outline, ghost, soft, bordered
|
|
102
|
+
- **Sizes**: xs, sm, md, lg, xl
|
|
103
|
+
- **Slots**: header, body, footer
|
|
109
104
|
|
|
110
|
-
|
|
111
|
-
<%=
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
```erb
|
|
106
|
+
<%= render BetterUi::CardComponent.new(size: :lg, style: :bordered) do |c| %>
|
|
107
|
+
<% c.with_header { "Card Title" } %>
|
|
108
|
+
<% c.with_body { "Card content goes here" } %>
|
|
109
|
+
<% c.with_footer { "Footer content" } %>
|
|
115
110
|
<% end %>
|
|
116
111
|
```
|
|
117
112
|
|
|
118
|
-
|
|
113
|
+
#### Action Messages Component
|
|
114
|
+
Display notifications, alerts, and validation messages with style.
|
|
115
|
+
- **Variants**: All 9 semantic color variants
|
|
116
|
+
- **Styles**: solid, soft, outline, ghost
|
|
117
|
+
- **Features**: Dismissible, auto-dismiss, titles, icons
|
|
119
118
|
|
|
120
119
|
```erb
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
<%= render BetterUi::ActionMessagesComponent.new(
|
|
121
|
+
variant: "danger",
|
|
122
|
+
title: "Validation Errors",
|
|
123
|
+
messages: @model.errors.full_messages,
|
|
124
|
+
dismissible: true,
|
|
125
|
+
auto_dismiss: 10
|
|
127
126
|
) %>
|
|
127
|
+
```
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
### Form Components
|
|
130
|
+
|
|
131
|
+
#### Text Input Component
|
|
132
|
+
Standard text input with error handling and icon support.
|
|
133
|
+
|
|
134
|
+
```erb
|
|
135
|
+
<%= render BetterUi::Forms::TextInputComponent.new(
|
|
136
|
+
name: "user[email]",
|
|
137
|
+
label: "Email Address",
|
|
138
|
+
hint: "We'll never share your email",
|
|
139
|
+
placeholder: "you@example.com"
|
|
140
|
+
) do |c| %>
|
|
141
|
+
<% c.with_prefix_icon { "@" } %>
|
|
142
|
+
<% end %>
|
|
135
143
|
```
|
|
136
144
|
|
|
137
|
-
|
|
145
|
+
#### Number Input Component
|
|
146
|
+
Numeric input with min/max validation and optional spinners.
|
|
138
147
|
|
|
139
|
-
|
|
148
|
+
```erb
|
|
149
|
+
<%= render BetterUi::Forms::NumberInputComponent.new(
|
|
150
|
+
name: "product[price]",
|
|
151
|
+
label: "Price",
|
|
152
|
+
min: 0,
|
|
153
|
+
step: 0.01,
|
|
154
|
+
show_spinner: false
|
|
155
|
+
) do |c| %>
|
|
156
|
+
<% c.with_prefix_icon { "$" } %>
|
|
157
|
+
<% end %>
|
|
158
|
+
```
|
|
140
159
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
- **5 Opzioni Border Radius**: none, small, medium, large, full
|
|
160
|
+
#### Password Input Component
|
|
161
|
+
Password field with visibility toggle functionality.
|
|
144
162
|
|
|
145
|
-
|
|
163
|
+
```erb
|
|
164
|
+
<%= render BetterUi::Forms::PasswordInputComponent.new(
|
|
165
|
+
name: "user[password]",
|
|
166
|
+
label: "Password",
|
|
167
|
+
hint: "Minimum 8 characters"
|
|
168
|
+
) %>
|
|
169
|
+
```
|
|
146
170
|
|
|
147
|
-
|
|
171
|
+
#### Textarea Component
|
|
172
|
+
Multi-line text input with resizing options.
|
|
148
173
|
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
BUTTON_SIZE_CLASSES = {
|
|
158
|
-
small: 'px-3 py-1.5 text-sm',
|
|
159
|
-
medium: 'px-4 py-2 text-base',
|
|
160
|
-
large: 'px-6 py-3 text-lg'
|
|
161
|
-
}.freeze
|
|
174
|
+
```erb
|
|
175
|
+
<%= render BetterUi::Forms::TextareaComponent.new(
|
|
176
|
+
name: "post[content]",
|
|
177
|
+
label: "Content",
|
|
178
|
+
rows: 6,
|
|
179
|
+
resize: :vertical,
|
|
180
|
+
maxlength: 1000
|
|
181
|
+
) %>
|
|
162
182
|
```
|
|
163
183
|
|
|
164
|
-
|
|
184
|
+
#### Checkbox Component
|
|
185
|
+
Single checkbox with color variants and label positioning.
|
|
165
186
|
|
|
166
|
-
|
|
187
|
+
```erb
|
|
188
|
+
<%= render BetterUi::Forms::CheckboxComponent.new(
|
|
189
|
+
name: "user[terms]",
|
|
190
|
+
label: "I agree to the terms and conditions",
|
|
191
|
+
variant: :primary
|
|
192
|
+
) %>
|
|
193
|
+
```
|
|
167
194
|
|
|
168
|
-
|
|
195
|
+
#### Checkbox Group Component
|
|
196
|
+
Multiple checkboxes for selecting from a collection.
|
|
169
197
|
|
|
170
|
-
|
|
198
|
+
```erb
|
|
199
|
+
<%= render BetterUi::Forms::CheckboxGroupComponent.new(
|
|
200
|
+
name: "user[roles]",
|
|
201
|
+
collection: [["Admin", "admin"], ["Editor", "editor"]],
|
|
202
|
+
legend: "User Roles",
|
|
203
|
+
orientation: :vertical
|
|
204
|
+
) %>
|
|
205
|
+
```
|
|
171
206
|
|
|
172
|
-
|
|
173
|
-
- **Main**: Area contenuto principale dell'applicazione con layout responsive
|
|
174
|
-
- **Navbar**: Barra di navigazione superiore con supporto contenuto flessibile
|
|
175
|
-
- **Sidebar**: Navigazione laterale collassabile
|
|
207
|
+
### Drawer Layout Components
|
|
176
208
|
|
|
177
|
-
|
|
209
|
+
BetterUi provides a complete drawer layout system for building responsive admin dashboards and applications with sidebar navigation.
|
|
178
210
|
|
|
179
|
-
|
|
211
|
+
- **LayoutComponent**: Main wrapper with header, sidebar, and content
|
|
212
|
+
- **HeaderComponent**: Sticky header with logo, navigation, and actions
|
|
213
|
+
- **SidebarComponent**: Responsive sidebar with navigation
|
|
214
|
+
- **NavItemComponent**: Navigation items with icons and badges
|
|
215
|
+
- **NavGroupComponent**: Grouped navigation with titles
|
|
180
216
|
|
|
181
|
-
|
|
217
|
+
```erb
|
|
218
|
+
<%= render BetterUi::Drawer::LayoutComponent.new do |layout| %>
|
|
219
|
+
<% layout.with_header do |header| %>
|
|
220
|
+
<% header.with_logo { "MyApp" } %>
|
|
221
|
+
<% end %>
|
|
222
|
+
<% layout.with_sidebar do |sidebar| %>
|
|
223
|
+
<% sidebar.with_navigation do %>
|
|
224
|
+
<%= render BetterUi::Drawer::NavGroupComponent.new(title: "Menu") do |group| %>
|
|
225
|
+
<% group.with_item(label: "Dashboard", href: "/", active: true) %>
|
|
226
|
+
<% group.with_item(label: "Settings", href: "/settings") %>
|
|
227
|
+
<% end %>
|
|
228
|
+
<% end %>
|
|
229
|
+
<% end %>
|
|
230
|
+
<% layout.with_main { yield } %>
|
|
231
|
+
<% end %>
|
|
232
|
+
```
|
|
182
233
|
|
|
183
|
-
|
|
184
|
-
- **Avatar**: Immagini profilo utente con supporto fallback
|
|
185
|
-
- **Badge**: Indicatori di stato e etichette
|
|
186
|
-
- **Progress**: Barre di progresso e indicatori di caricamento
|
|
187
|
-
- **Spinner**: Animazioni di caricamento
|
|
188
|
-
- **Tooltip**: Overlay di aiuto contestuale e informazioni
|
|
234
|
+
### Form Builder Integration
|
|
189
235
|
|
|
190
|
-
|
|
236
|
+
BetterUi includes a custom form builder for seamless Rails form integration:
|
|
191
237
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
238
|
+
```erb
|
|
239
|
+
<%= form_with model: @user, builder: BetterUi::UiFormBuilder do |f| %>
|
|
240
|
+
<%= f.ui_text_input :name %>
|
|
241
|
+
<%= f.ui_text_input :email, hint: "We'll never share your email" %>
|
|
242
|
+
<%= f.ui_password_input :password %>
|
|
243
|
+
<%= f.ui_textarea :bio, rows: 6 %>
|
|
244
|
+
<%= f.ui_number_input :age, min: 0, max: 120 %>
|
|
245
|
+
<%= f.bui_checkbox :newsletter, label: "Subscribe to newsletter" %>
|
|
246
|
+
<%= f.bui_checkbox_group :roles, [["Admin", "admin"], ["Editor", "editor"]] %>
|
|
247
|
+
<% end %>
|
|
248
|
+
```
|
|
200
249
|
|
|
201
|
-
|
|
250
|
+
## Documentation
|
|
202
251
|
|
|
203
|
-
- **
|
|
204
|
-
- **
|
|
205
|
-
- **
|
|
206
|
-
|
|
207
|
-
- **Number**: number, range
|
|
208
|
-
- **Date/Time**: date, datetime-local, time, month, week
|
|
209
|
-
- **File**: upload file
|
|
210
|
-
- **Color**: color picker
|
|
211
|
-
- **Checkbox**: Opzioni multi-selezione
|
|
212
|
-
- **Radio**: Opzioni selezione singola
|
|
213
|
-
- **Select**: Selezioni dropdown
|
|
214
|
-
- **Textarea**: Input testo multi-riga
|
|
252
|
+
- [**Installation Guide**](doc/INSTALLATION.md) - Detailed setup and configuration instructions
|
|
253
|
+
- [**Component API Reference**](doc/COMPONENTS.md) - Complete component documentation with examples
|
|
254
|
+
- [**Customization Guide**](doc/CUSTOMIZATION.md) - Theme customization and extending components
|
|
255
|
+
- [**Changelog**](CHANGELOG.md) - Version history and release notes
|
|
215
256
|
|
|
216
|
-
|
|
257
|
+
## Development Setup
|
|
217
258
|
|
|
218
|
-
|
|
259
|
+
For development and testing, BetterUi includes a dummy Rails application:
|
|
219
260
|
|
|
220
|
-
|
|
261
|
+
```bash
|
|
262
|
+
# Clone the repository
|
|
263
|
+
git clone https://github.com/umbertopeserico/better_ui.git
|
|
264
|
+
cd better_ui
|
|
221
265
|
|
|
222
|
-
|
|
266
|
+
# Install dependencies
|
|
267
|
+
bundle install
|
|
223
268
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
3. **Personalizzazione theme**: Modifica la configurazione Tailwind per tematizzazione consistente
|
|
269
|
+
# Run tests
|
|
270
|
+
bundle exec rake test
|
|
227
271
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
label: "Button Personalizzato",
|
|
232
|
-
classes: "my-custom-class hover:scale-105"
|
|
233
|
-
) %>
|
|
272
|
+
# Start the dummy app server
|
|
273
|
+
cd test/dummy
|
|
274
|
+
bundle exec rails server
|
|
234
275
|
```
|
|
235
276
|
|
|
236
|
-
|
|
277
|
+
Visit `http://localhost:3000` to see the components in action.
|
|
237
278
|
|
|
238
|
-
|
|
239
|
-
2. **Configurazione Componenti**: Configura opzioni di default in `config/initializers/better_ui.rb`
|
|
240
|
-
3. **Integrazione TailwindCSS**: Tutto lo styling usa classi TailwindCSS per massima flessibilitร
|
|
241
|
-
4. **Estensioni Componenti**: Estendi componenti esistenti o crea i tuoi seguendo i pattern stabiliti
|
|
279
|
+
### Running Tests
|
|
242
280
|
|
|
243
|
-
|
|
281
|
+
```bash
|
|
282
|
+
# Run all tests
|
|
283
|
+
bundle exec rake test
|
|
244
284
|
|
|
245
|
-
|
|
285
|
+
# Run specific test file
|
|
286
|
+
bundle exec ruby -Itest test/components/better_ui/button_component_test.rb
|
|
246
287
|
|
|
247
|
-
|
|
248
|
-
|
|
288
|
+
# Run with coverage
|
|
289
|
+
COVERAGE=true bundle exec rake test
|
|
249
290
|
```
|
|
250
291
|
|
|
251
|
-
|
|
292
|
+
### Code Style
|
|
252
293
|
|
|
253
|
-
|
|
294
|
+
BetterUi follows Omakase Ruby styling via `rubocop-rails-omakase`:
|
|
254
295
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
296
|
+
```bash
|
|
297
|
+
# Run linter
|
|
298
|
+
bundle exec rubocop
|
|
299
|
+
|
|
300
|
+
# Auto-fix issues
|
|
301
|
+
bundle exec rubocop -a
|
|
302
|
+
```
|
|
258
303
|
|
|
259
304
|
## Contributing
|
|
260
305
|
|
|
261
|
-
|
|
262
|
-
2. Crea il tuo branch feature (`git checkout -b feature/componente-fantastico`)
|
|
263
|
-
3. Aggiungi il tuo componente con test e preview Lookbook
|
|
264
|
-
4. Committa le tue modifiche (`git commit -am 'Aggiungi componente fantastico'`)
|
|
265
|
-
5. Pusha al branch (`git push origin feature/componente-fantastico`)
|
|
266
|
-
6. Crea una Pull Request
|
|
306
|
+
We welcome contributions! Please follow these guidelines:
|
|
267
307
|
|
|
268
|
-
|
|
308
|
+
1. Fork the repository
|
|
309
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
310
|
+
3. Write tests for your changes
|
|
311
|
+
4. Ensure all tests pass and code follows style guide
|
|
312
|
+
5. Commit your changes with conventional commits (`feat: add amazing feature`)
|
|
313
|
+
6. Push to the branch (`git push origin feature/amazing-feature`)
|
|
314
|
+
7. Open a Pull Request
|
|
269
315
|
|
|
270
|
-
|
|
271
|
-
git clone https://github.com/alessiobussolari/better_ui.git
|
|
272
|
-
cd better_ui
|
|
273
|
-
bundle install
|
|
274
|
-
cd test/dummy
|
|
275
|
-
bundle exec rails server
|
|
276
|
-
```
|
|
316
|
+
### Contribution Areas
|
|
277
317
|
|
|
278
|
-
|
|
318
|
+
- New components
|
|
319
|
+
- Component enhancements
|
|
320
|
+
- Documentation improvements
|
|
321
|
+
- Bug fixes
|
|
322
|
+
- Performance optimizations
|
|
323
|
+
- Accessibility improvements
|
|
279
324
|
|
|
280
|
-
##
|
|
325
|
+
## Support
|
|
326
|
+
|
|
327
|
+
For bug reports and feature requests, please use the [GitHub Issues](https://github.com/umbertopeserico/better_ui/issues) page.
|
|
281
328
|
|
|
282
|
-
|
|
283
|
-
- ๐ Componenti chart e visualizzazione dati
|
|
284
|
-
- ๐ญ Componenti animazione e transizione
|
|
285
|
-
- ๐ Supporto dark mode
|
|
286
|
-
- ๐ฑ Componenti specifici mobile
|
|
287
|
-
- ๐ง Tool di configurazione e generatori
|
|
329
|
+
For questions and discussions, use the [GitHub Discussions](https://github.com/umbertopeserico/better_ui/discussions) forum.
|
|
288
330
|
|
|
289
331
|
## License
|
|
290
332
|
|
|
291
|
-
|
|
333
|
+
BetterUi is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
292
334
|
|
|
293
|
-
##
|
|
335
|
+
## Credits
|
|
336
|
+
|
|
337
|
+
Built with โค๏ธ by [Umberto Peserico](https://github.com/umbertopeserico) and contributors.
|
|
294
338
|
|
|
295
|
-
|
|
296
|
-
-
|
|
297
|
-
-
|
|
339
|
+
Powered by:
|
|
340
|
+
- [ViewComponent](https://viewcomponent.org/) - GitHub's component framework for Rails
|
|
341
|
+
- [Tailwind CSS](https://tailwindcss.com/) - A utility-first CSS framework
|
|
342
|
+
- [Stimulus](https://stimulus.hotwired.dev/) - A modest JavaScript framework for Rails
|
|
298
343
|
|
|
299
|
-
|
|
344
|
+
## Acknowledgments
|
|
300
345
|
|
|
301
|
-
|
|
346
|
+
Special thanks to the Ruby on Rails community and all contributors who help make BetterUi better.
|
data/Rakefile
CHANGED
|
@@ -3,6 +3,15 @@ require "bundler/setup"
|
|
|
3
3
|
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
|
4
4
|
load "rails/tasks/engine.rake"
|
|
5
5
|
|
|
6
|
-
load "rails/tasks/statistics.rake"
|
|
7
|
-
|
|
8
6
|
require "bundler/gem_tasks"
|
|
7
|
+
|
|
8
|
+
require "rake/testtask"
|
|
9
|
+
|
|
10
|
+
Rake::TestTask.new(:test) do |t|
|
|
11
|
+
t.libs << "test"
|
|
12
|
+
t.pattern = "test/**/*_test.rb"
|
|
13
|
+
t.verbose = false
|
|
14
|
+
t.warning = false
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
task default: :test
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<%# ActionMessages Component Template
|
|
2
|
+
Displays a list of messages with optional title, icon, and dismiss button.
|
|
3
|
+
Supports auto-dismiss via Stimulus controller.
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
<%# Main container with Stimulus controller and dynamic classes %>
|
|
7
|
+
<div <%= tag.attributes(component_attributes) %> class="<%= component_classes %>">
|
|
8
|
+
|
|
9
|
+
<%# Optional title/heading above messages %>
|
|
10
|
+
<% if title.present? %>
|
|
11
|
+
<div class="<%= title_classes %>">
|
|
12
|
+
<%= title %>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
15
|
+
|
|
16
|
+
<%# Content wrapper for icon (slot) and message list %>
|
|
17
|
+
<div class="<%= content_wrapper_classes %>">
|
|
18
|
+
|
|
19
|
+
<%# Optional icon slot - pass content via block %>
|
|
20
|
+
<% if content.present? %>
|
|
21
|
+
<div class="flex-shrink-0">
|
|
22
|
+
<%= content %>
|
|
23
|
+
</div>
|
|
24
|
+
<% end %>
|
|
25
|
+
|
|
26
|
+
<%# Message list - only render if messages exist %>
|
|
27
|
+
<% if messages.any? %>
|
|
28
|
+
<ul class="<%= list_classes %>">
|
|
29
|
+
<% messages.each do |message| %>
|
|
30
|
+
<li class="<%= list_item_classes %>"><%= message %></li>
|
|
31
|
+
<% end %>
|
|
32
|
+
</ul>
|
|
33
|
+
<% end %>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<%# Optional dismiss button - triggers Stimulus dismiss action %>
|
|
37
|
+
<% if dismissible %>
|
|
38
|
+
<button type="button"
|
|
39
|
+
data-action="click->better-ui--action-messages#dismiss"
|
|
40
|
+
class="<%= dismiss_button_classes %>"
|
|
41
|
+
aria-label="Dismiss">
|
|
42
|
+
<%# X icon SVG %>
|
|
43
|
+
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
44
|
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
|
|
45
|
+
</svg>
|
|
46
|
+
</button>
|
|
47
|
+
<% end %>
|
|
48
|
+
</div>
|