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.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +257 -212
  3. data/Rakefile +11 -2
  4. data/app/components/better_ui/action_messages_component/action_messages_component.html.erb +48 -0
  5. data/app/components/better_ui/action_messages_component.rb +544 -0
  6. data/app/components/better_ui/application_component.rb +66 -0
  7. data/app/components/better_ui/button_component/button_component.html.erb +31 -0
  8. data/app/components/better_ui/button_component.rb +307 -0
  9. data/app/components/better_ui/card_component/card_component.html.erb +17 -0
  10. data/app/components/better_ui/card_component.rb +460 -0
  11. data/app/components/better_ui/drawer/header_component/header_component.html.erb +24 -0
  12. data/app/components/better_ui/drawer/header_component.rb +238 -0
  13. data/app/components/better_ui/drawer/layout_component/layout_component.html.erb +44 -0
  14. data/app/components/better_ui/drawer/layout_component.rb +270 -0
  15. data/app/components/better_ui/drawer/nav_group_component/nav_group_component.html.erb +10 -0
  16. data/app/components/better_ui/drawer/nav_group_component.rb +155 -0
  17. data/app/components/better_ui/drawer/nav_item_component/nav_item_component.html.erb +13 -0
  18. data/app/components/better_ui/drawer/nav_item_component.rb +225 -0
  19. data/app/components/better_ui/drawer/sidebar_component/sidebar_component.html.erb +17 -0
  20. data/app/components/better_ui/drawer/sidebar_component.rb +263 -0
  21. data/app/components/better_ui/forms/base_component.rb +450 -0
  22. data/app/components/better_ui/forms/checkbox_component/checkbox_component.html.erb +28 -0
  23. data/app/components/better_ui/forms/checkbox_component.rb +419 -0
  24. data/app/components/better_ui/forms/checkbox_group_component/checkbox_group_component.html.erb +40 -0
  25. data/app/components/better_ui/forms/checkbox_group_component.rb +363 -0
  26. data/app/components/better_ui/forms/number_input_component/number_input_component.html.erb +40 -0
  27. data/app/components/better_ui/forms/number_input_component.rb +320 -0
  28. data/app/components/better_ui/forms/password_input_component/password_input_component.html.erb +71 -0
  29. data/app/components/better_ui/forms/password_input_component.rb +206 -0
  30. data/app/components/better_ui/forms/text_input_component/text_input_component.html.erb +40 -0
  31. data/app/components/better_ui/forms/text_input_component.rb +258 -0
  32. data/app/components/better_ui/forms/textarea_component/textarea_component.html.erb +40 -0
  33. data/app/components/better_ui/forms/textarea_component.rb +329 -0
  34. data/app/form_builders/better_ui/ui_form_builder.rb +467 -0
  35. data/app/helpers/better_ui/application_helper.rb +325 -58
  36. data/app/views/layouts/better_ui/application.html.erb +1 -1
  37. data/config/routes.rb +1 -0
  38. data/lib/better_ui/engine.rb +34 -5
  39. data/lib/better_ui/version.rb +1 -1
  40. data/lib/better_ui.rb +32 -5
  41. data/lib/generators/better_ui/install/USAGE +44 -0
  42. data/lib/generators/better_ui/install/install_generator.rb +87 -0
  43. data/lib/generators/better_ui/install/templates/better_ui_theme.css.tt +280 -0
  44. data/lib/tasks/better_ui_tasks.rake +39 -4
  45. metadata +52 -200
  46. data/app/components/better_ui/application/card/component.html.erb +0 -20
  47. data/app/components/better_ui/application/card/component.rb +0 -214
  48. data/app/components/better_ui/application/main/component.html.erb +0 -9
  49. data/app/components/better_ui/application/main/component.rb +0 -123
  50. data/app/components/better_ui/application/navbar/component.html.erb +0 -92
  51. data/app/components/better_ui/application/navbar/component.rb +0 -136
  52. data/app/components/better_ui/application/sidebar/component.html.erb +0 -249
  53. data/app/components/better_ui/application/sidebar/component.rb +0 -187
  54. data/app/components/better_ui/general/accordion/component.html.erb +0 -5
  55. data/app/components/better_ui/general/accordion/component.rb +0 -92
  56. data/app/components/better_ui/general/accordion/item_component.html.erb +0 -12
  57. data/app/components/better_ui/general/accordion/item_component.rb +0 -176
  58. data/app/components/better_ui/general/alert/component.html.erb +0 -32
  59. data/app/components/better_ui/general/alert/component.rb +0 -242
  60. data/app/components/better_ui/general/avatar/component.html.erb +0 -20
  61. data/app/components/better_ui/general/avatar/component.rb +0 -301
  62. data/app/components/better_ui/general/badge/component.html.erb +0 -23
  63. data/app/components/better_ui/general/badge/component.rb +0 -248
  64. data/app/components/better_ui/general/breadcrumb/component.html.erb +0 -15
  65. data/app/components/better_ui/general/breadcrumb/component.rb +0 -187
  66. data/app/components/better_ui/general/button/component.html.erb +0 -34
  67. data/app/components/better_ui/general/button/component.rb +0 -214
  68. data/app/components/better_ui/general/divider/component.html.erb +0 -10
  69. data/app/components/better_ui/general/divider/component.rb +0 -226
  70. data/app/components/better_ui/general/dropdown/component.html.erb +0 -28
  71. data/app/components/better_ui/general/dropdown/component.rb +0 -192
  72. data/app/components/better_ui/general/dropdown/divider_component.html.erb +0 -1
  73. data/app/components/better_ui/general/dropdown/divider_component.rb +0 -41
  74. data/app/components/better_ui/general/dropdown/item_component.html.erb +0 -6
  75. data/app/components/better_ui/general/dropdown/item_component.rb +0 -119
  76. data/app/components/better_ui/general/field/component.html.erb +0 -27
  77. data/app/components/better_ui/general/field/component.rb +0 -37
  78. data/app/components/better_ui/general/grid/cell_component.html.erb +0 -3
  79. data/app/components/better_ui/general/grid/cell_component.rb +0 -390
  80. data/app/components/better_ui/general/grid/component.html.erb +0 -3
  81. data/app/components/better_ui/general/grid/component.rb +0 -301
  82. data/app/components/better_ui/general/heading/component.html.erb +0 -22
  83. data/app/components/better_ui/general/heading/component.rb +0 -257
  84. data/app/components/better_ui/general/icon/component.html.erb +0 -7
  85. data/app/components/better_ui/general/icon/component.rb +0 -240
  86. data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
  87. data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
  88. data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
  89. data/app/components/better_ui/general/input/datetime/component.rb +0 -223
  90. data/app/components/better_ui/general/input/pin/component.html.erb +0 -1
  91. data/app/components/better_ui/general/input/pin/component.rb +0 -201
  92. data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
  93. data/app/components/better_ui/general/input/radio/component.rb +0 -230
  94. data/app/components/better_ui/general/input/rating/component.html.erb +0 -4
  95. data/app/components/better_ui/general/input/rating/component.rb +0 -272
  96. data/app/components/better_ui/general/input/select/component.html.erb +0 -78
  97. data/app/components/better_ui/general/input/select/component.rb +0 -249
  98. data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
  99. data/app/components/better_ui/general/input/select/select_component.rb +0 -37
  100. data/app/components/better_ui/general/input/text/component.html.erb +0 -5
  101. data/app/components/better_ui/general/input/text/component.rb +0 -171
  102. data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
  103. data/app/components/better_ui/general/input/textarea/component.rb +0 -166
  104. data/app/components/better_ui/general/input/toggle/component.html.erb +0 -5
  105. data/app/components/better_ui/general/input/toggle/component.rb +0 -242
  106. data/app/components/better_ui/general/link/component.html.erb +0 -18
  107. data/app/components/better_ui/general/link/component.rb +0 -258
  108. data/app/components/better_ui/general/modal/component.html.erb +0 -5
  109. data/app/components/better_ui/general/modal/component.rb +0 -47
  110. data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
  111. data/app/components/better_ui/general/modal/modal_component.rb +0 -160
  112. data/app/components/better_ui/general/pagination/component.html.erb +0 -85
  113. data/app/components/better_ui/general/pagination/component.rb +0 -216
  114. data/app/components/better_ui/general/panel/component.html.erb +0 -28
  115. data/app/components/better_ui/general/panel/component.rb +0 -249
  116. data/app/components/better_ui/general/progress/component.html.erb +0 -11
  117. data/app/components/better_ui/general/progress/component.rb +0 -160
  118. data/app/components/better_ui/general/spinner/component.html.erb +0 -35
  119. data/app/components/better_ui/general/spinner/component.rb +0 -93
  120. data/app/components/better_ui/general/table/component.html.erb +0 -5
  121. data/app/components/better_ui/general/table/component.rb +0 -217
  122. data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
  123. data/app/components/better_ui/general/table/tbody_component.rb +0 -30
  124. data/app/components/better_ui/general/table/td_component.html.erb +0 -3
  125. data/app/components/better_ui/general/table/td_component.rb +0 -44
  126. data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
  127. data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
  128. data/app/components/better_ui/general/table/th_component.html.erb +0 -6
  129. data/app/components/better_ui/general/table/th_component.rb +0 -51
  130. data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
  131. data/app/components/better_ui/general/table/thead_component.rb +0 -28
  132. data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
  133. data/app/components/better_ui/general/table/tr_component.rb +0 -30
  134. data/app/components/better_ui/general/tabs/component.html.erb +0 -11
  135. data/app/components/better_ui/general/tabs/component.rb +0 -120
  136. data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
  137. data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
  138. data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
  139. data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
  140. data/app/components/better_ui/general/tag/component.html.erb +0 -3
  141. data/app/components/better_ui/general/tag/component.rb +0 -104
  142. data/app/components/better_ui/general/text/component.html.erb +0 -1
  143. data/app/components/better_ui/general/text/component.rb +0 -194
  144. data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
  145. data/app/components/better_ui/general/tooltip/component.rb +0 -239
  146. data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
  147. data/app/helpers/better_ui/application/components/card.rb +0 -11
  148. data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
  149. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
  150. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
  151. data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
  152. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
  153. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
  154. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
  155. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
  156. data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
  157. data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
  158. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
  159. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
  160. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -88
  161. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -68
  162. data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
  163. data/app/helpers/better_ui/general/components/grid/grid_helper.rb +0 -145
  164. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
  165. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
  166. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
  167. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
  168. data/app/helpers/better_ui/general/components/input/pin/pin_helper.rb +0 -76
  169. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
  170. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
  171. data/app/helpers/better_ui/general/components/input/rating/rating_helper.rb +0 -70
  172. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -86
  173. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
  174. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
  175. data/app/helpers/better_ui/general/components/input/toggle/toggle_helper.rb +0 -77
  176. data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
  177. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
  178. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
  179. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
  180. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
  181. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
  182. data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
  183. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
  184. data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
  185. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
  186. data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
  187. data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
  188. data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
  189. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
  190. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
  191. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
  192. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
  193. data/app/helpers/better_ui/general/components/text/text_helper.rb +0 -83
  194. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
  195. data/app/jobs/better_ui/application_job.rb +0 -4
  196. data/app/mailers/better_ui/application_mailer.rb +0 -6
  197. data/config/initializers/lookbook.rb +0 -23
  198. data/lib/better_ui/railtie.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5ce58a483a9db3c7164c77c50c5206f83304c2b52f6ebff2d92dbc2ddfe0c78
4
- data.tar.gz: 262e9f1b61ccf46254e582c2466cf4fea4c89d6ec48cb1117cb63355996a3e2c
3
+ metadata.gz: 901faa502739d5315ad85daca3b71de07b07f27cf3e0bce6ff613ff95f4aa749
4
+ data.tar.gz: 8035578f8400b55714940ae366de2dd0543648c5c7238efa73d82ef7808fb247
5
5
  SHA512:
6
- metadata.gz: 9d024e430e9eb3d69c30adc09b8cff4a8a79a3585ea0769abe0e279c7dcb54b36faf7239ad393436f5558dc0db67c29a66e7eac8f32a11232d12cffbffc2cb96
7
- data.tar.gz: 4c18bd0f1df604a289bab875eee931283616cd22f7b1a24e239446643392228a09b92f0e9b54888b9c3d8bdc2074a089ff0d35373aca0e60bccda86ef7b843fe
6
+ metadata.gz: 3f2d7365e452d664eb6edd0558f172ca9d5d36f1dc7e856d7b76171cabab7fb9bc491207d46474ede9d5487d02eca729efc76dcf449d2ad95dff256d36064e04
7
+ data.tar.gz: 7055b3abfe4b843f68b4ff06005b33862b1d13855fc312688a81c474c44034be629e7690ab1572596d4bb22591575336b44b95783e2487eb1f7a6b9bd2f1ec9a
data/README.md CHANGED
@@ -1,301 +1,346 @@
1
- # BetterUI
1
+ # BetterUi
2
2
 
3
- Una libreria completa di componenti UI per applicazioni Rails costruita con ViewComponent e Tailwind CSS. Include 26 componenti con un sistema di design unificato e documentazione interattiva.
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
- - ๐ŸŽจ **Componenti Eleganti**: Componenti UI pre-costruiti con styling Tailwind CSS
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
- ## Panoramica
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
- Better UI รจ una gem Rails che fornisce una collezione di componenti UI riutilizzabili costruiti con ViewComponent e Tailwind CSS. Include un sistema di design unificato con tematizzazione consistente e gestione completa dei form.
11
+ Your Rails application must install both. See [Installation Guide](doc/INSTALLATION.md) for detailed setup instructions.
15
12
 
16
- ### Caratteristiche Principali
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
- $ bundle install
21
+ bundle install
22
+ yarn add @pandev-srl/better-ui
46
23
  ```
47
24
 
48
- ## Setup
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
- ### 1. Mount Engine (Opzionale)
51
-
52
- Se vuoi accedere alle route interne di BetterUI, monta l'engine in `config/routes.rb`:
30
+ const application = Application.start()
31
+ registerControllers(application)
32
+ ```
53
33
 
54
- ```ruby
55
- Rails.application.routes.draw do
56
- mount BetterUi::Engine => "/better_ui"
57
- # le tue altre route...
58
- end
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
- ### 2. Setup Lookbook (Raccomandato per Development)
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
- Per accedere alla documentazione interattiva dei componenti durante lo sviluppo, monta Lookbook in `config/routes.rb`:
56
+ ## Features
64
57
 
65
- ```ruby
66
- Rails.application.routes.draw do
67
- # Monta Lookbook solo in development
68
- mount Lookbook::Engine => "/lookbook" if Rails.env.development?
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
- # le tue altre route...
71
- end
72
- ```
67
+ ## Installation
73
68
 
74
- **Fatto!** I componenti BetterUI e le loro preview sono automaticamente disponibili in Lookbook.
69
+ For detailed installation and configuration instructions, see the [Installation Guide](doc/INSTALLATION.md).
75
70
 
76
- ### 3. Includi Tailwind CSS
71
+ ### Prerequisites
77
72
 
78
- Assicurati che la tua applicazione includa Tailwind CSS, dato che i componenti BetterUI si basano sulle classi Tailwind. Se non hai Tailwind CSS installato, segui la [guida ufficiale di installazione Tailwind CSS](https://tailwindcss.com/docs/guides/ruby-on-rails).
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
- ## Utilizzo
77
+ ## Component Overview
81
78
 
82
- I componenti Better UI possono essere utilizzati in due modi: istanziazione diretta o metodi helper.
79
+ ### Core Components
83
80
 
84
- ### Metodi Helper (Raccomandato)
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
- <%# Input di testo con validazione %>
88
- <%= bui_input_text(
89
- name: 'email',
90
- value: @user.email,
91
- type: :email,
92
- theme: :blue,
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
- <%# Integrazione con form %>
111
- <%= form_with model: @user do |form| %>
112
- <%= bui_input_text(name: 'name', form: form, required: true) %>
113
- <%= bui_input_text(name: 'email', type: :email, form: form) %>
114
- <%= bui_button('Salva', type: :submit, theme: :blue) %>
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
- ### Istanziazione Diretta
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
- <%# Rendering diretto del componente %>
122
- <%= render BetterUi::General::Input::Text::Component.new(
123
- name: 'username',
124
- type: :text,
125
- theme: :default,
126
- size: :medium
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
- <%# Componente button %>
130
- <%= render BetterUi::General::Button::Component.new(
131
- 'Cliccami',
132
- theme: :blue,
133
- size: :large
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
- ### Sistema di Tematizzazione
145
+ #### Number Input Component
146
+ Numeric input with min/max validation and optional spinners.
138
147
 
139
- Tutti i componenti supportano tematizzazione consistente:
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
- - **9 Temi Standard**: default, white, red, rose, orange, green, blue, yellow, violet
142
- - **3 Dimensioni Standard**: small, medium, large
143
- - **5 Opzioni Border Radius**: none, small, medium, large, full
160
+ #### Password Input Component
161
+ Password field with visibility toggle functionality.
144
162
 
145
- ### Approccio Styling
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
- Better UI usa un approccio TailwindCSS puro con costanti per styling manutenibile:
171
+ #### Textarea Component
172
+ Multi-line text input with resizing options.
148
173
 
149
- ```ruby
150
- # Le costanti del componente definiscono le opzioni di styling
151
- BUTTON_THEME_CLASSES = {
152
- default: 'bg-gray-100 text-gray-900 hover:bg-gray-200',
153
- blue: 'bg-blue-600 text-white hover:bg-blue-700',
154
- green: 'bg-green-600 text-white hover:bg-green-700'
155
- }.freeze
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
- ## Componenti Disponibili
184
+ #### Checkbox Component
185
+ Single checkbox with color variants and label positioning.
165
186
 
166
- Better UI include 26 componenti organizzati in tre categorie:
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
- ### Componenti Application (4)
195
+ #### Checkbox Group Component
196
+ Multiple checkboxes for selecting from a collection.
169
197
 
170
- Componenti di layout e navigazione per interfacce applicative:
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
- - **Card**: Container di contenuto con supporto header e azioni
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
- ### Componenti General (22)
209
+ BetterUi provides a complete drawer layout system for building responsive admin dashboards and applications with sidebar navigation.
178
210
 
179
- Elementi UI core per costruire interfacce:
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
- **Display & Feedback**
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
- - **Alert**: Messaggi di notifica con temi multipli e opzioni dismissible
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
- **Navigazione & Struttura**
236
+ BetterUi includes a custom form builder for seamless Rails form integration:
191
237
 
192
- - **Breadcrumb**: Indicatori di percorso di navigazione
193
- - **Divider**: Separatori di contenuto visivi
194
- - **Heading**: Intestazioni con tipografia consistente
195
- - **Icon**: Sistema icone SVG con libreria estesa
196
- - **Link**: Elementi anchor potenziati con supporto theme
197
- - **Panel**: Sezioni di contenuto organizzate
198
- - **Table**: Tabelle dati con sorting e funzionalitร  responsive
199
- - **Tag**: Elementi di categorizzazione ed etichettatura
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
- **Form & Input**
250
+ ## Documentation
202
251
 
203
- - **Button**: Button azione con varianti multiple e stati
204
- - **Field**: Wrapper campo form con supporto label e validazione
205
- - **Input**: Sistema input unificato che supporta 14+ tipi:
206
- - **Text**: text, email, password, search, url, tel
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
- ### Componenti Form (0)
257
+ ## Development Setup
217
258
 
218
- Riservati per futuri componenti form specializzati e widget form complessi.
259
+ For development and testing, BetterUi includes a dummy Rails application:
219
260
 
220
- ## Personalizzazione e Styling
261
+ ```bash
262
+ # Clone the repository
263
+ git clone https://github.com/umbertopeserico/better_ui.git
264
+ cd better_ui
221
265
 
222
- I componenti BetterUI usano classi Tailwind CSS. Puoi:
266
+ # Install dependencies
267
+ bundle install
223
268
 
224
- 1. **Sovrascrivere classi**: Passa classi personalizzate tramite il parametro `classes`
225
- 2. **Estendere componenti**: Crea i tuoi componenti che ereditano da BetterUI
226
- 3. **Personalizzazione theme**: Modifica la configurazione Tailwind per tematizzazione consistente
269
+ # Run tests
270
+ bundle exec rake test
227
271
 
228
- ```erb
229
- <!-- Aggiungi classi personalizzate -->
230
- <%= render BetterUi::General::Button::Component.new(
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
- Better UI รจ progettato per essere altamente personalizzabile mantenendo consistenza:
277
+ Visit `http://localhost:3000` to see the components in action.
237
278
 
238
- 1. **Personalizzazione Theme**: Modifica le costanti dei componenti per cambiare lo styling di default
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
- ## Testing
281
+ ```bash
282
+ # Run all tests
283
+ bundle exec rake test
244
284
 
245
- I componenti Better UI sono testati completamente. Puoi eseguire la test suite con:
285
+ # Run specific test file
286
+ bundle exec ruby -Itest test/components/better_ui/button_component_test.rb
246
287
 
247
- ```bash
248
- bin/rails test
288
+ # Run with coverage
289
+ COVERAGE=true bundle exec rake test
249
290
  ```
250
291
 
251
- ## Supporto Browser
292
+ ### Code Style
252
293
 
253
- I componenti BetterUI supportano tutti i browser moderni che supportano:
294
+ BetterUi follows Omakase Ruby styling via `rubocop-rails-omakase`:
254
295
 
255
- - CSS Grid e Flexbox
256
- - Funzionalitร  JavaScript ES6+
257
- - Tailwind CSS
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
- 1. Forka il repository
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
- ### Setup Development
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
- ```bash
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
- Visita `http://localhost:3000/lookbook` per vedere la documentazione dei componenti.
318
+ - New components
319
+ - Component enhancements
320
+ - Documentation improvements
321
+ - Bug fixes
322
+ - Performance optimizations
323
+ - Accessibility improvements
279
324
 
280
- ## Roadmap
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
- - ๐ŸŽฏ Componenti form avanzati (input complessi, validazioni)
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
- La gem รจ disponibile come open source sotto i termini della [MIT License](https://opensource.org/licenses/MIT).
333
+ BetterUi is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
292
334
 
293
- ## Support
335
+ ## Credits
336
+
337
+ Built with โค๏ธ by [Umberto Peserico](https://github.com/umbertopeserico) and contributors.
294
338
 
295
- - ๐Ÿ“– [Documentazione](https://github.com/alessiobussolari/better_ui)
296
- - ๐Ÿ› [Issue Tracker](https://github.com/alessiobussolari/better_ui/issues)
297
- - ๐Ÿ’ฌ [Discussioni](https://github.com/alessiobussolari/better_ui/discussions)
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
- Costruito con โค๏ธ da [PanDev](https://github.com/alessiobussolari)
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>