better_ui 0.3.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.

Potentially problematic release.


This version of better_ui might be problematic. Click here for more details.

Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +227 -209
  4. data/app/assets/javascripts/better_ui/controllers/navbar_controller.js +138 -0
  5. data/app/assets/javascripts/better_ui/controllers/sidebar_controller.js +211 -0
  6. data/app/assets/javascripts/better_ui/controllers/toast_controller.js +161 -0
  7. data/app/assets/javascripts/better_ui/index.js +159 -0
  8. data/app/assets/javascripts/better_ui/toast_manager.js +77 -0
  9. data/app/assets/stylesheets/better_ui/application.css +30 -0
  10. data/app/components/better_ui/application/alert_component.html.erb +27 -0
  11. data/app/components/better_ui/application/alert_component.rb +202 -0
  12. data/app/components/better_ui/application/card_component.html.erb +24 -0
  13. data/app/components/better_ui/application/card_component.rb +53 -0
  14. data/app/components/better_ui/application/card_container_component.html.erb +8 -0
  15. data/app/components/better_ui/application/card_container_component.rb +14 -0
  16. data/app/components/better_ui/application/header_component.html.erb +88 -0
  17. data/app/components/better_ui/application/header_component.rb +188 -0
  18. data/app/components/better_ui/application/navbar_component.html.erb +294 -0
  19. data/app/components/better_ui/application/navbar_component.rb +249 -0
  20. data/app/components/better_ui/application/sidebar_component.html.erb +207 -0
  21. data/app/components/better_ui/application/sidebar_component.rb +318 -0
  22. data/app/components/better_ui/application/toast_component.html.erb +35 -0
  23. data/app/components/better_ui/application/toast_component.rb +223 -0
  24. data/app/components/better_ui/general/avatar_component.html.erb +19 -0
  25. data/app/components/better_ui/general/avatar_component.rb +171 -0
  26. data/app/components/better_ui/general/badge_component.html.erb +19 -0
  27. data/app/components/better_ui/general/badge_component.rb +123 -0
  28. data/app/components/better_ui/general/{breadcrumb/component.html.erb → breadcrumb_component.html.erb} +4 -4
  29. data/app/components/better_ui/general/breadcrumb_component.rb +130 -0
  30. data/app/components/better_ui/general/{button/component.html.erb → button_component.html.erb} +7 -7
  31. data/app/components/better_ui/general/button_component.rb +162 -0
  32. data/app/components/better_ui/general/heading_component.html.erb +25 -0
  33. data/app/components/better_ui/general/heading_component.rb +148 -0
  34. data/app/components/better_ui/general/icon_component.html.erb +2 -0
  35. data/app/components/better_ui/general/icon_component.rb +100 -0
  36. data/app/components/better_ui/general/link_component.html.erb +17 -0
  37. data/app/components/better_ui/general/link_component.rb +132 -0
  38. data/app/components/better_ui/general/panel_component.html.erb +27 -0
  39. data/app/components/better_ui/general/panel_component.rb +103 -0
  40. data/app/components/better_ui/general/spinner_component.html.erb +15 -0
  41. data/app/components/better_ui/general/spinner_component.rb +79 -0
  42. data/app/components/better_ui/general/table_component.html.erb +73 -0
  43. data/app/components/better_ui/general/table_component.rb +167 -0
  44. data/app/components/better_ui/theme_helper.rb +171 -0
  45. data/app/controllers/better_ui/application_controller.rb +1 -0
  46. data/app/controllers/better_ui/docs_controller.rb +34 -0
  47. data/app/views/components/better_ui/general/table/_custom_body_row.html.erb +17 -0
  48. data/app/views/components/better_ui/general/table/_custom_footer_rows.html.erb +17 -0
  49. data/app/views/components/better_ui/general/table/_custom_header_rows.html.erb +12 -0
  50. data/app/views/layouts/component_preview.html.erb +32 -0
  51. data/config/initializers/lookbook.rb +12 -12
  52. data/config/routes.rb +13 -0
  53. data/lib/better_ui/engine.rb +36 -5
  54. data/lib/better_ui/version.rb +1 -1
  55. data/lib/better_ui.rb +24 -4
  56. data/lib/generators/better_ui/stylesheet_generator.rb +96 -0
  57. data/lib/generators/better_ui/templates/README +56 -0
  58. data/lib/generators/better_ui/templates/components/_avatar.scss +151 -0
  59. data/lib/generators/better_ui/templates/components/_badge.scss +142 -0
  60. data/lib/generators/better_ui/templates/components/_breadcrumb.scss +107 -0
  61. data/lib/generators/better_ui/templates/components/_button.scss +106 -0
  62. data/lib/generators/better_ui/templates/components/_card.scss +69 -0
  63. data/lib/generators/better_ui/templates/components/_heading.scss +180 -0
  64. data/lib/generators/better_ui/templates/components/_icon.scss +90 -0
  65. data/lib/generators/better_ui/templates/components/_link.scss +130 -0
  66. data/lib/generators/better_ui/templates/components/_panel.scss +144 -0
  67. data/lib/generators/better_ui/templates/components/_spinner.scss +132 -0
  68. data/lib/generators/better_ui/templates/components/_table.scss +105 -0
  69. data/lib/generators/better_ui/templates/components/_variables.scss +33 -0
  70. data/lib/generators/better_ui/templates/components_stylesheet.scss +66 -0
  71. metadata +145 -156
  72. data/app/components/better_ui/application/card/component.html.erb +0 -20
  73. data/app/components/better_ui/application/card/component.rb +0 -214
  74. data/app/components/better_ui/application/main/component.html.erb +0 -9
  75. data/app/components/better_ui/application/main/component.rb +0 -123
  76. data/app/components/better_ui/application/navbar/component.html.erb +0 -92
  77. data/app/components/better_ui/application/navbar/component.rb +0 -136
  78. data/app/components/better_ui/application/sidebar/component.html.erb +0 -227
  79. data/app/components/better_ui/application/sidebar/component.rb +0 -130
  80. data/app/components/better_ui/general/accordion/component.html.erb +0 -5
  81. data/app/components/better_ui/general/accordion/component.rb +0 -92
  82. data/app/components/better_ui/general/accordion/item_component.html.erb +0 -12
  83. data/app/components/better_ui/general/accordion/item_component.rb +0 -176
  84. data/app/components/better_ui/general/alert/component.html.erb +0 -32
  85. data/app/components/better_ui/general/alert/component.rb +0 -242
  86. data/app/components/better_ui/general/avatar/component.html.erb +0 -20
  87. data/app/components/better_ui/general/avatar/component.rb +0 -301
  88. data/app/components/better_ui/general/badge/component.html.erb +0 -23
  89. data/app/components/better_ui/general/badge/component.rb +0 -248
  90. data/app/components/better_ui/general/breadcrumb/component.rb +0 -187
  91. data/app/components/better_ui/general/button/component.rb +0 -214
  92. data/app/components/better_ui/general/divider/component.html.erb +0 -10
  93. data/app/components/better_ui/general/divider/component.rb +0 -226
  94. data/app/components/better_ui/general/dropdown/component.html.erb +0 -25
  95. data/app/components/better_ui/general/dropdown/component.rb +0 -170
  96. data/app/components/better_ui/general/dropdown/divider_component.html.erb +0 -1
  97. data/app/components/better_ui/general/dropdown/divider_component.rb +0 -41
  98. data/app/components/better_ui/general/dropdown/item_component.html.erb +0 -6
  99. data/app/components/better_ui/general/dropdown/item_component.rb +0 -119
  100. data/app/components/better_ui/general/field/component.html.erb +0 -27
  101. data/app/components/better_ui/general/field/component.rb +0 -37
  102. data/app/components/better_ui/general/heading/component.html.erb +0 -22
  103. data/app/components/better_ui/general/heading/component.rb +0 -257
  104. data/app/components/better_ui/general/icon/component.html.erb +0 -7
  105. data/app/components/better_ui/general/icon/component.rb +0 -239
  106. data/app/components/better_ui/general/input/checkbox/component.html.erb +0 -5
  107. data/app/components/better_ui/general/input/checkbox/component.rb +0 -238
  108. data/app/components/better_ui/general/input/datetime/component.html.erb +0 -5
  109. data/app/components/better_ui/general/input/datetime/component.rb +0 -223
  110. data/app/components/better_ui/general/input/radio/component.html.erb +0 -5
  111. data/app/components/better_ui/general/input/radio/component.rb +0 -230
  112. data/app/components/better_ui/general/input/select/component.html.erb +0 -16
  113. data/app/components/better_ui/general/input/select/component.rb +0 -184
  114. data/app/components/better_ui/general/input/select/select_component.html.erb +0 -5
  115. data/app/components/better_ui/general/input/select/select_component.rb +0 -37
  116. data/app/components/better_ui/general/input/text/component.html.erb +0 -5
  117. data/app/components/better_ui/general/input/text/component.rb +0 -171
  118. data/app/components/better_ui/general/input/textarea/component.html.erb +0 -5
  119. data/app/components/better_ui/general/input/textarea/component.rb +0 -166
  120. data/app/components/better_ui/general/link/component.html.erb +0 -18
  121. data/app/components/better_ui/general/link/component.rb +0 -258
  122. data/app/components/better_ui/general/modal/component.html.erb +0 -5
  123. data/app/components/better_ui/general/modal/component.rb +0 -47
  124. data/app/components/better_ui/general/modal/modal_component.html.erb +0 -52
  125. data/app/components/better_ui/general/modal/modal_component.rb +0 -160
  126. data/app/components/better_ui/general/pagination/component.html.erb +0 -85
  127. data/app/components/better_ui/general/pagination/component.rb +0 -216
  128. data/app/components/better_ui/general/panel/component.html.erb +0 -28
  129. data/app/components/better_ui/general/panel/component.rb +0 -249
  130. data/app/components/better_ui/general/progress/component.html.erb +0 -11
  131. data/app/components/better_ui/general/progress/component.rb +0 -160
  132. data/app/components/better_ui/general/spinner/component.html.erb +0 -35
  133. data/app/components/better_ui/general/spinner/component.rb +0 -93
  134. data/app/components/better_ui/general/table/component.html.erb +0 -5
  135. data/app/components/better_ui/general/table/component.rb +0 -217
  136. data/app/components/better_ui/general/table/tbody_component.html.erb +0 -3
  137. data/app/components/better_ui/general/table/tbody_component.rb +0 -30
  138. data/app/components/better_ui/general/table/td_component.html.erb +0 -3
  139. data/app/components/better_ui/general/table/td_component.rb +0 -44
  140. data/app/components/better_ui/general/table/tfoot_component.html.erb +0 -3
  141. data/app/components/better_ui/general/table/tfoot_component.rb +0 -28
  142. data/app/components/better_ui/general/table/th_component.html.erb +0 -6
  143. data/app/components/better_ui/general/table/th_component.rb +0 -51
  144. data/app/components/better_ui/general/table/thead_component.html.erb +0 -3
  145. data/app/components/better_ui/general/table/thead_component.rb +0 -28
  146. data/app/components/better_ui/general/table/tr_component.html.erb +0 -3
  147. data/app/components/better_ui/general/table/tr_component.rb +0 -30
  148. data/app/components/better_ui/general/tabs/component.html.erb +0 -11
  149. data/app/components/better_ui/general/tabs/component.rb +0 -120
  150. data/app/components/better_ui/general/tabs/panel_component.html.erb +0 -3
  151. data/app/components/better_ui/general/tabs/panel_component.rb +0 -37
  152. data/app/components/better_ui/general/tabs/tab_component.html.erb +0 -13
  153. data/app/components/better_ui/general/tabs/tab_component.rb +0 -111
  154. data/app/components/better_ui/general/tag/component.html.erb +0 -3
  155. data/app/components/better_ui/general/tag/component.rb +0 -104
  156. data/app/components/better_ui/general/tooltip/component.html.erb +0 -7
  157. data/app/components/better_ui/general/tooltip/component.rb +0 -239
  158. data/app/helpers/better_ui/application/components/card/card_helper.rb +0 -96
  159. data/app/helpers/better_ui/application/components/card.rb +0 -11
  160. data/app/helpers/better_ui/application/components/main/main_helper.rb +0 -64
  161. data/app/helpers/better_ui/application/components/navbar/navbar_helper.rb +0 -77
  162. data/app/helpers/better_ui/application/components/sidebar/sidebar_helper.rb +0 -51
  163. data/app/helpers/better_ui/application_helper.rb +0 -55
  164. data/app/helpers/better_ui/general/components/accordion/accordion_helper.rb +0 -73
  165. data/app/helpers/better_ui/general/components/accordion.rb +0 -11
  166. data/app/helpers/better_ui/general/components/alert/alert_helper.rb +0 -57
  167. data/app/helpers/better_ui/general/components/avatar/avatar_helper.rb +0 -29
  168. data/app/helpers/better_ui/general/components/badge/badge_helper.rb +0 -53
  169. data/app/helpers/better_ui/general/components/breadcrumb/breadcrumb_helper.rb +0 -37
  170. data/app/helpers/better_ui/general/components/button/button_helper.rb +0 -65
  171. data/app/helpers/better_ui/general/components/container/container_helper.rb +0 -60
  172. data/app/helpers/better_ui/general/components/divider/divider_helper.rb +0 -63
  173. data/app/helpers/better_ui/general/components/dropdown/divider_helper.rb +0 -32
  174. data/app/helpers/better_ui/general/components/dropdown/dropdown_helper.rb +0 -79
  175. data/app/helpers/better_ui/general/components/dropdown/item_helper.rb +0 -62
  176. data/app/helpers/better_ui/general/components/field/field_helper.rb +0 -26
  177. data/app/helpers/better_ui/general/components/heading/heading_helper.rb +0 -72
  178. data/app/helpers/better_ui/general/components/icon/icon_helper.rb +0 -16
  179. data/app/helpers/better_ui/general/components/input/checkbox/checkbox_helper.rb +0 -81
  180. data/app/helpers/better_ui/general/components/input/datetime/datetime_helper.rb +0 -91
  181. data/app/helpers/better_ui/general/components/input/radio/radio_helper.rb +0 -79
  182. data/app/helpers/better_ui/general/components/input/radio_group/radio_group_helper.rb +0 -124
  183. data/app/helpers/better_ui/general/components/input/select/select_helper.rb +0 -70
  184. data/app/helpers/better_ui/general/components/input/text/text_helper.rb +0 -138
  185. data/app/helpers/better_ui/general/components/input/textarea/textarea_helper.rb +0 -73
  186. data/app/helpers/better_ui/general/components/link/link_helper.rb +0 -89
  187. data/app/helpers/better_ui/general/components/modal/modal_helper.rb +0 -85
  188. data/app/helpers/better_ui/general/components/modal.rb +0 -11
  189. data/app/helpers/better_ui/general/components/pagination/pagination_helper.rb +0 -82
  190. data/app/helpers/better_ui/general/components/panel/panel_helper.rb +0 -83
  191. data/app/helpers/better_ui/general/components/progress/progress_helper.rb +0 -53
  192. data/app/helpers/better_ui/general/components/spinner/spinner_helper.rb +0 -19
  193. data/app/helpers/better_ui/general/components/table/table_helper.rb +0 -53
  194. data/app/helpers/better_ui/general/components/table/tbody_helper.rb +0 -13
  195. data/app/helpers/better_ui/general/components/table/td_helper.rb +0 -19
  196. data/app/helpers/better_ui/general/components/table/tfoot_helper.rb +0 -13
  197. data/app/helpers/better_ui/general/components/table/th_helper.rb +0 -19
  198. data/app/helpers/better_ui/general/components/table/thead_helper.rb +0 -13
  199. data/app/helpers/better_ui/general/components/table/tr_helper.rb +0 -13
  200. data/app/helpers/better_ui/general/components/tabs/panel_helper.rb +0 -62
  201. data/app/helpers/better_ui/general/components/tabs/tab_helper.rb +0 -55
  202. data/app/helpers/better_ui/general/components/tabs/tabs_helper.rb +0 -95
  203. data/app/helpers/better_ui/general/components/tag/tag_helper.rb +0 -26
  204. data/app/helpers/better_ui/general/components/tooltip/tooltip_helper.rb +0 -60
  205. data/app/views/layouts/better_ui/application.html.erb +0 -17
  206. data/lib/better_ui/railtie.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f8b92fdba76f5e84f09fb6a3bf9879b209e0e7dfd8f864186784db24b808c59
4
- data.tar.gz: 4d21e971baeecb10c7a3c5952041ac7e6911342e0efe4d0015efb92f9f214652
3
+ metadata.gz: 317837f4f80e12e6ab860a7a134e9f17e01f5db2d86f5b178a4c9a2bc9588f3a
4
+ data.tar.gz: 8815e3b40a461070b9cb178ee1a7e1e8abaccbf6cea7366ab5c079db174429f4
5
5
  SHA512:
6
- metadata.gz: 778ee8d067130b37947a227ccf1322e8cf5b82d19c9b3f7a0371cc16b62071daaeb5eb6a191898ef2b06419486fe656bc22bea4314fbf98884fdf16259ac8409
7
- data.tar.gz: 1df545b428bdb281fb6f78b7be2e58e455bd6bd67f0202684f51b9e756c9ccc3e928a283f97d98a924185e1bb859b63f8cf2a91857ef49478cf6bfc3f254629d
6
+ metadata.gz: 0fb96fb9537391b7448ffde247cd8d9ae4916dac0cfcd17c4efe912b061dfd05986368ebe6563549c58ce0909e9a509474ac885e136d133214f806437925726d
7
+ data.tar.gz: de95bf54dcd6fa022f5afa5c0867d65b7a78e8f24cab637aa7cf098f0bf01f5cabdac5e6c7b36ba1aba14833682b17174e1d229a4d428f5646d92ee876ad42f4
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright Umberto Peserico
1
+ Copyright alessiobussolari
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,301 +1,319 @@
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
+ [![Gem Version](https://badge.fury.io/rb/better_ui.svg)](https://badge.fury.io/rb/better_ui)
4
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
5
 
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à
6
+ > Elegant, consistent, and easily integrable UI components for your Rails applications
11
7
 
12
- ## Panoramica
8
+ BetterUI is a Rails gem that provides reusable UI components with built-in documentation. Designed to be lightweight, customizable, and easy to use, it helps you build beautiful and consistent interfaces without JavaScript.
13
9
 
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.
10
+ ## Key Features
15
11
 
16
- ### Caratteristiche Principali
12
+ - **Pure Design** - Elegant, fully CSS UI components, no JavaScript
13
+ - **Easy Integration** - Mountable Rails engine that integrates seamlessly with your app
14
+ - **Built-in Documentation** - View examples and documentation directly in your browser
15
+ - **Highly Customizable** - Easily adapt the style to your brand
16
+ - **Modular Components** - Use only what you need
17
+ - **Component Previews** - View and interact with components using Lookbook
17
18
 
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à
19
+ ## 📦 Available Components
26
20
 
27
- ## Installazione
21
+ | Component | Description |
22
+ |------------|-------------|
23
+ | **Button** | Styled buttons with primary, secondary, success, danger variants |
24
+ | **Alert** | Informational, success, warning, and error messages |
25
+ | **Card** | Flexible containers with header, body, and footer |
26
+ | **Modal** | Modal dialog windows |
27
+ | **Tabs** | Tab navigation |
28
+ | **Navbar** | Responsive navigation bar with dropdown menu support |
29
+ | **Sidebar** | Side menu with hierarchical navigation support |
30
+ | **Toast** | Temporary notifications with timer and animations |
31
+ | **Header** | Page headers with title, subtitle, breadcrumb, and actions |
32
+ | **Badge** | Labels with support for icons, colors, and outline variants |
33
+ | **Spinner** | Loading indicators with various themes and sizes |
34
+ | **Avatar** | User avatars with support for images, initials, and online status |
35
+ | **Form Elements** | Styled input fields (coming soon) |
28
36
 
29
- Aggiungi questa riga al Gemfile della tua applicazione:
37
+ ## 🚀 Installation
30
38
 
31
- ```ruby
32
- gem "better_ui"
33
- ```
34
-
35
- Per lo sviluppo con documentazione Lookbook:
39
+ Add this line to your application's Gemfile:
36
40
 
37
41
  ```ruby
38
- gem "better_ui"
39
- gem "lookbook", group: :development
42
+ gem 'better_ui', '~> 0.1.0'
40
43
  ```
41
44
 
42
- Quindi esegui:
45
+ And then execute:
43
46
 
44
47
  ```bash
45
48
  $ bundle install
46
49
  ```
47
50
 
48
- ## Setup
51
+ ## ⚙️ Configuration
49
52
 
50
- ### 1. Mount Engine (Opzionale)
53
+ ### Mount the Engine
51
54
 
52
- Se vuoi accedere alle route interne di BetterUI, monta l'engine in `config/routes.rb`:
55
+ Add this to your `config/routes.rb` file:
53
56
 
54
57
  ```ruby
55
58
  Rails.application.routes.draw do
56
- mount BetterUi::Engine => "/better_ui"
57
- # le tue altre route...
59
+ mount BetterUi::Engine => '/better_ui'
60
+
61
+ # ... your other routes
58
62
  end
59
63
  ```
60
64
 
61
- ### 2. Setup Lookbook (Raccomandato per Development)
65
+ ### Include the Assets
62
66
 
63
- Per accedere alla documentazione interattiva dei componenti durante lo sviluppo, monta Lookbook in `config/routes.rb`:
64
-
65
- ```ruby
66
- Rails.application.routes.draw do
67
- # Monta Lookbook solo in development
68
- mount Lookbook::Engine => "/lookbook" if Rails.env.development?
67
+ In `app/assets/stylesheets/application.css`:
69
68
 
70
- # le tue altre route...
71
- end
69
+ ```css
70
+ /*
71
+ *= require better_ui/application
72
+ */
72
73
  ```
73
74
 
74
- **Fatto!** I componenti BetterUI e le loro preview sono automaticamente disponibili in Lookbook.
75
-
76
- ### 3. Includi Tailwind CSS
77
-
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).
75
+ ## 🎮 Usage
79
76
 
80
- ## Utilizzo
81
-
82
- I componenti Better UI possono essere utilizzati in due modi: istanziazione diretta o metodi helper.
83
-
84
- ### Metodi Helper (Raccomandato)
77
+ Once installed, you can start using the components:
85
78
 
86
79
  ```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
- ) %>
80
+ <%# Button %>
81
+ <%= better_ui_button("Save", type: "primary") %>
82
+
83
+ <%# Alert %>
84
+ <%= better_ui_alert("Operation completed", type: "success") %>
85
+
86
+ <%# Card %>
87
+ <%= better_ui_card do %>
88
+ <%= better_ui_card_header("Card Title") %>
89
+ <%= better_ui_card_body do %>
90
+ <p>Card content...</p>
91
+ <% end %>
92
+ <% end %>
96
93
 
97
- <%# Button con theme e size %>
98
- <%= bui_button(
99
- 'Invia Form',
100
- theme: :green,
101
- size: :large,
102
- type: :submit
94
+ <%# Header with breadcrumb %>
95
+ <%= render BetterUi::Application::HeaderComponent.new(
96
+ title: "Dashboard",
97
+ subtitle: "Manage everything from here",
98
+ breadcrumbs: [
99
+ { text: "Home", url: "/" },
100
+ { text: "Dashboard" }
101
+ ],
102
+ actions: [
103
+ { content: button_html("New", "primary") }
104
+ ]
103
105
  ) %>
106
+ ```
104
107
 
105
- <%# Card con blocco di contenuto %>
106
- <%= bui_card(title: 'Profilo Utente', theme: :white) do %>
107
- <p>Contenuto informazioni utente qui</p>
108
- <% end %>
108
+ Visit `/better_ui` in your application to see the complete documentation and examples.
109
109
 
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) %>
115
- <% end %>
116
- ```
110
+ ### The Header Component
117
111
 
118
- ### Istanziazione Diretta
112
+ The Header component is designed to create complete page headers with numerous features:
119
113
 
120
114
  ```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
127
- ) %>
128
-
129
- <%# Componente button %>
130
- <%= render BetterUi::General::Button::Component.new(
131
- 'Cliccami',
132
- theme: :blue,
133
- size: :large
115
+ <%= render BetterUi::Application::HeaderComponent.new(
116
+ title: {
117
+ text: "Settings",
118
+ icon: "settings"
119
+ },
120
+ subtitle: "Configure system preferences",
121
+ breadcrumbs: [
122
+ { text: "Home", url: "/" },
123
+ { text: "Admin", url: "/admin" },
124
+ { text: "Settings" }
125
+ ],
126
+ variant: :modern,
127
+ fixed: :top,
128
+ show_breadcrumbs: true,
129
+ actions: [
130
+ { content: button_html("Save", "primary") },
131
+ { content: button_html("Cancel", "secondary") }
132
+ ]
134
133
  ) %>
135
134
  ```
136
135
 
137
- ### Sistema di Tematizzazione
136
+ The component supports:
137
+ - Title with optional integrated icon
138
+ - Descriptive subtitle
139
+ - Complete breadcrumbs with navigation links
140
+ - Contextual actions (buttons, menus, etc.)
141
+ - Style variants: modern, light, dark, primary, transparent
142
+ - Fixed positioning (top or bottom)
143
+ - Breadcrumb visibility control
138
144
 
139
- Tutti i componenti supportano tematizzazione consistente:
145
+ ### Component Previews with Lookbook
140
146
 
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
147
+ BetterUI integrates [Lookbook](https://github.com/allmarkedup/lookbook) to preview UI components:
144
148
 
145
- ### Approccio Styling
149
+ 1. Access `/better_ui/lookbook` in your application to view the component catalog
150
+ 2. Explore available variants and configurations for each component
151
+ 3. View source code and generated markup
152
+ 4. Interact with components in real-time
146
153
 
147
- Better UI usa un approccio TailwindCSS puro con costanti per styling manutenibile:
154
+ Lookbook is only available in development and test environments.
148
155
 
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
162
- ```
156
+ ## 🎨 Customization
163
157
 
164
- ## Componenti Disponibili
158
+ ### Generate a Custom Stylesheet
165
159
 
166
- Better UI include 26 componenti organizzati in tre categorie:
160
+ BetterUI includes a generator to create a base stylesheet for customizing components:
167
161
 
168
- ### Componenti Application (4)
169
-
170
- Componenti di layout e navigazione per interfacce applicative:
162
+ ```bash
163
+ # Generate a stylesheet with the default "custom" prefix
164
+ rails generate better_ui:stylesheet
171
165
 
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
166
+ # Generate a stylesheet with a custom prefix
167
+ rails generate better_ui:stylesheet --prefix=my_theme
168
+ ```
176
169
 
177
- ### Componenti General (22)
170
+ This will create:
171
+ 1. A main SCSS file with imports for all components
172
+ 2. Individual SCSS files for each component in the `app/assets/stylesheets/components/` directory
173
+ 3. Special `*_overrides.scss` files for each component that allow you to override styles without modifying the original files
178
174
 
179
- Elementi UI core per costruire interfacce:
175
+ ### Component Overrides System
180
176
 
181
- **Display & Feedback**
177
+ One of BetterUI's most powerful features is the automatic generation of override files:
182
178
 
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
179
+ ```bash
180
+ # Generate override files for all components
181
+ rails generate better_ui:stylesheet
182
+ ```
189
183
 
190
- **Navigazione & Struttura**
184
+ This creates special `*_overrides.scss` files that:
185
+ - Contain empty classes matching the original component files
186
+ - Allow for clean customization without modifying the original styles
187
+ - Support both standard and nested SCSS class structures
188
+ - Include helpful comments for easier modification
189
+
190
+ Example override file structure:
191
+ ```scss
192
+ /* ==============================
193
+ * Button Component Overrides
194
+ * ==============================
195
+ * This file contains empty classes to override default styles.
196
+ * Add your customizations here.
197
+ */
198
+
199
+ .bui-button-primary {
200
+ // Override styles for .bui-button-primary here
201
+ }
202
+
203
+ .bui-button-secondary {
204
+ // Override styles for .bui-button-secondary here
205
+ }
206
+
207
+ // Nested class overrides
208
+ .bui-button-with-icon {
209
+ .bui-icon {
210
+ // Override nested styles here
211
+ }
212
+ }
213
+ ```
191
214
 
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
215
+ ### Use the Initializer
200
216
 
201
- **Form & Input**
217
+ Create a `config/initializers/better_ui.rb` file:
202
218
 
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
219
+ ```ruby
220
+ BetterUi.configure do |config|
221
+ config.button_defaults = {
222
+ class: 'rounded-lg text-sm'
223
+ }
224
+
225
+ config.alert_defaults = {
226
+ dismissible: true
227
+ }
228
+ end
229
+ ```
215
230
 
216
- ### Componenti Form (0)
231
+ ### Customize Styles
217
232
 
218
- Riservati per futuri componenti form specializzati e widget form complessi.
233
+ Override CSS styles in your stylesheet:
219
234
 
220
- ## Personalizzazione e Styling
235
+ ```css
236
+ .better-ui-button-primary {
237
+ background-color: #8b5cf6; /* Custom purple */
238
+ border-color: #8b5cf6;
239
+ }
240
+ ```
221
241
 
222
- I componenti BetterUI usano classi Tailwind CSS. Puoi:
242
+ ## 🛠 Development
223
243
 
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
244
+ BetterUI uses an integrated dummy app for development and testing. Here's how to get started:
227
245
 
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
- ) %>
234
- ```
246
+ ### Initial Setup
235
247
 
236
- Better UI è progettato per essere altamente personalizzabile mantenendo consistenza:
248
+ ```bash
249
+ # Clone the repository
250
+ git clone https://github.com/alessiobussolari/better_ui.git
251
+ cd better_ui
237
252
 
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
253
+ # Install dependencies
254
+ bin/setup
255
+ ```
242
256
 
243
- ## Testing
257
+ ### Start the Test Application
244
258
 
245
- I componenti Better UI sono testati completamente. Puoi eseguire la test suite con:
259
+ To see components in action and work on documentation:
246
260
 
247
261
  ```bash
248
- bin/rails test
262
+ # Start the test server
263
+ cd test/dummy
264
+ bin/rails server
265
+
266
+ # Or from the main directory
267
+ bin/rails server -b 0.0.0.0
249
268
  ```
250
269
 
251
- ## Supporto Browser
270
+ Visit `http://localhost:3000/better_ui` in your browser to see the documentation and test the components.
252
271
 
253
- I componenti BetterUI supportano tutti i browser moderni che supportano:
272
+ ### Development Flow
254
273
 
255
- - CSS Grid e Flexbox
256
- - Funzionalità JavaScript ES6+
257
- - Tailwind CSS
274
+ 1. **Create a branch**: `git checkout -b feature/new-component`
275
+ 2. **Implement the component**: Add helpers in `app/helpers/better_ui/application_helper.rb`
276
+ 3. **Add CSS**: Insert styles in `app/assets/stylesheets/better_ui/application.css`
277
+ 4. **Document**: Create Markdown files in `docs/components/`
278
+ 5. **Test**: Verify in the dummy app that everything works correctly
279
+ 6. **Run tests**: `rake test`
258
280
 
259
- ## Contributing
281
+ ### Build and Release
260
282
 
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
283
+ To build the gem locally:
267
284
 
268
- ### Setup Development
285
+ ```bash
286
+ bundle exec rake build
287
+ ```
288
+
289
+ To install the development version:
269
290
 
270
291
  ```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
292
+ bundle exec rake install
276
293
  ```
277
294
 
278
- Visita `http://localhost:3000/lookbook` per vedere la documentazione dei componenti.
295
+ ## 🤝 Contributing
279
296
 
280
- ## Roadmap
297
+ Contributions are welcome and appreciated! Here's how you can help:
281
298
 
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
299
+ 1. **Fork** the repository on GitHub
300
+ 2. **Clone** your fork: `git clone https://github.com/YOUR-USERNAME/better_ui.git`
301
+ 3. **Create** a branch for your feature: `git checkout -b feature/amazing-improvement`
302
+ 4. **Commit** your changes: `git commit -am 'Add an amazing feature'`
303
+ 5. **Push** to the branch: `git push origin feature/amazing-improvement`
304
+ 6. Submit a **Pull Request**
288
305
 
289
- ## License
306
+ ### Guidelines
290
307
 
291
- La gem è disponibile come open source sotto i termini della [MIT License](https://opensource.org/licenses/MIT).
308
+ - Follow the existing code style
309
+ - Write tests for new features
310
+ - Update documentation
311
+ - Create components that work without JavaScript
292
312
 
293
- ## Support
313
+ ## 📄 License
294
314
 
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)
315
+ BetterUI is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
298
316
 
299
317
  ---
300
318
 
301
- Costruito con ❤️ da [PanDev](https://github.com/alessiobussolari)
319
+ Made with ❤️ by [Alessio Bussolari](https://github.com/alessiobussolari)