uchi 0.1.4 → 0.1.6

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 (128) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/uchi/application.js +2655 -24
  3. data/app/assets/javascripts/uchi.js +11 -0
  4. data/app/assets/stylesheets/uchi/application.css +982 -1311
  5. data/app/assets/tailwind/uchi.css +4 -4
  6. data/app/components/uchi/field/belongs_to/edit.html.erb +1 -1
  7. data/app/components/uchi/field/belongs_to/index.html.erb +1 -1
  8. data/app/components/uchi/field/belongs_to/show.html.erb +3 -3
  9. data/app/components/uchi/field/belongs_to.rb +38 -8
  10. data/app/components/uchi/field/boolean/edit.html.erb +1 -1
  11. data/app/components/uchi/field/date/edit.html.erb +1 -1
  12. data/app/components/uchi/field/date_time/edit.html.erb +1 -1
  13. data/app/components/uchi/field/file/edit.html.erb +1 -1
  14. data/app/components/uchi/field/file/index.html.erb +2 -1
  15. data/app/components/uchi/field/file/show.html.erb +3 -2
  16. data/app/components/uchi/field/has_and_belongs_to_many/show.html.erb +5 -3
  17. data/app/components/uchi/field/has_many/show.html.erb +5 -3
  18. data/app/components/uchi/field/id/index.html.erb +1 -1
  19. data/app/components/uchi/field/id/show.html.erb +1 -1
  20. data/app/components/uchi/field/image/edit.html.erb +1 -1
  21. data/app/components/uchi/field/image/index.html.erb +2 -1
  22. data/app/components/uchi/field/image/show.html.erb +2 -1
  23. data/app/components/uchi/field/number/edit.html.erb +1 -1
  24. data/app/components/uchi/field/string/edit.html.erb +1 -1
  25. data/app/components/uchi/field/text/edit.html.erb +1 -1
  26. data/app/components/{flowbite → uchi/flowbite}/breadcrumb.rb +5 -5
  27. data/app/components/{flowbite → uchi/flowbite}/breadcrumb_home.rb +2 -2
  28. data/app/components/{flowbite → uchi/flowbite}/breadcrumb_item/current.rb +3 -3
  29. data/app/components/{flowbite → uchi/flowbite}/breadcrumb_item/first.rb +4 -4
  30. data/app/components/{flowbite → uchi/flowbite}/breadcrumb_item.rb +4 -4
  31. data/app/components/{flowbite → uchi/flowbite}/breadcrumb_separator.rb +7 -5
  32. data/app/components/uchi/flowbite/button/outline.rb +37 -0
  33. data/app/components/uchi/flowbite/button/pill.rb +40 -0
  34. data/app/components/uchi/flowbite/button.rb +93 -0
  35. data/app/components/uchi/flowbite/card/card.html.erb +7 -0
  36. data/app/components/uchi/flowbite/card/title.rb +37 -0
  37. data/app/components/uchi/flowbite/card.rb +84 -0
  38. data/app/components/{flowbite → uchi/flowbite}/input/checkbox.rb +7 -7
  39. data/app/components/{flowbite → uchi/flowbite}/input/date.rb +1 -1
  40. data/app/components/{flowbite → uchi/flowbite}/input/date_time.rb +1 -1
  41. data/app/components/{flowbite → uchi/flowbite}/input/email.rb +1 -1
  42. data/app/components/{flowbite → uchi/flowbite}/input/field.rb +11 -10
  43. data/app/components/uchi/flowbite/input/file.rb +30 -0
  44. data/app/components/{flowbite → uchi/flowbite}/input/hint.rb +6 -5
  45. data/app/components/{flowbite → uchi/flowbite}/input/label.rb +8 -7
  46. data/app/components/{flowbite → uchi/flowbite}/input/number.rb +1 -1
  47. data/app/components/{flowbite → uchi/flowbite}/input/password.rb +1 -1
  48. data/app/components/{flowbite → uchi/flowbite}/input/phone.rb +1 -1
  49. data/app/components/{flowbite → uchi/flowbite}/input/radio_button.rb +7 -7
  50. data/app/components/{flowbite → uchi/flowbite}/input/select.rb +16 -7
  51. data/app/components/uchi/flowbite/input/textarea.rb +42 -0
  52. data/app/components/{flowbite → uchi/flowbite}/input/url.rb +1 -1
  53. data/app/components/uchi/flowbite/input/validation_error.rb +39 -0
  54. data/app/components/uchi/flowbite/input_field/checkbox.html.erb +9 -0
  55. data/app/components/{flowbite → uchi/flowbite}/input_field/checkbox.rb +10 -6
  56. data/app/components/{flowbite → uchi/flowbite}/input_field/date.rb +2 -2
  57. data/app/components/{flowbite → uchi/flowbite}/input_field/date_time.rb +2 -2
  58. data/app/components/{flowbite → uchi/flowbite}/input_field/email.rb +2 -2
  59. data/app/components/{flowbite → uchi/flowbite}/input_field/file.rb +2 -2
  60. data/app/components/uchi/flowbite/input_field/input_field.html.erb +9 -0
  61. data/app/components/{flowbite → uchi/flowbite}/input_field/number.rb +2 -2
  62. data/app/components/{flowbite → uchi/flowbite}/input_field/password.rb +2 -2
  63. data/app/components/{flowbite → uchi/flowbite}/input_field/phone.rb +2 -2
  64. data/app/components/uchi/flowbite/input_field/radio_button.html.erb +9 -0
  65. data/app/components/{flowbite → uchi/flowbite}/input_field/radio_button.rb +13 -9
  66. data/app/components/{flowbite → uchi/flowbite}/input_field/select.rb +7 -3
  67. data/app/components/{flowbite → uchi/flowbite}/input_field/text.rb +1 -1
  68. data/app/components/{flowbite → uchi/flowbite}/input_field/textarea.rb +2 -2
  69. data/app/components/{flowbite → uchi/flowbite}/input_field/url.rb +2 -2
  70. data/app/components/{flowbite → uchi/flowbite}/input_field.rb +19 -5
  71. data/app/components/uchi/flowbite/link.rb +41 -0
  72. data/app/components/{flowbite → uchi/flowbite}/style.rb +1 -1
  73. data/app/components/{flowbite → uchi/flowbite}/toast/icon.rb +1 -1
  74. data/app/components/uchi/flowbite/toast/toast.html.erb +40 -0
  75. data/app/components/{flowbite → uchi/flowbite}/toast.rb +2 -2
  76. data/app/components/uchi/ui/actions/dropdown/dropdown.html.erb +59 -0
  77. data/app/components/uchi/ui/actions/dropdown.rb +32 -0
  78. data/app/components/uchi/ui/breadcrumb/breadcrumb.html.erb +4 -4
  79. data/app/components/uchi/ui/form/input/collection_checkboxes.html.erb +2 -1
  80. data/app/components/uchi/ui/form/input/collection_checkboxes.rb +12 -17
  81. data/app/components/uchi/ui/frame/frame.html.erb +6 -1
  82. data/app/components/uchi/ui/index/records_table/records_table.html.erb +109 -18
  83. data/app/components/uchi/ui/index/records_table/search_form/search_form.html.erb +21 -5
  84. data/app/components/uchi/ui/navigation/navigation.html.erb +9 -0
  85. data/app/components/uchi/ui/navigation.rb +37 -0
  86. data/app/components/uchi/ui/no_value/no_value.html.erb +1 -0
  87. data/app/components/uchi/ui/no_value.rb +8 -0
  88. data/app/components/uchi/ui/page_header/page_header.html.erb +8 -3
  89. data/app/components/uchi/ui/pagination/current_link.html.erb +1 -1
  90. data/app/components/uchi/ui/pagination/gap.html.erb +7 -1
  91. data/app/components/uchi/ui/pagination/link.html.erb +1 -1
  92. data/app/components/uchi/ui/pagination/next_link.html.erb +18 -3
  93. data/app/components/uchi/ui/pagination/pagination.html.erb +3 -1
  94. data/app/components/uchi/ui/pagination/previous_link.html.erb +18 -3
  95. data/app/components/uchi/ui/pagination.rb +1 -1
  96. data/app/components/uchi/ui/show/attribute_fields/attribute_fields.html.erb +4 -3
  97. data/app/components/uchi/ui/spinner/spinner.html.erb +17 -3
  98. data/app/controllers/uchi/actions/executions_controller.rb +107 -0
  99. data/app/controllers/uchi/repository_controller.rb +21 -1
  100. data/app/views/layouts/uchi/_flash_messages.html.erb +1 -1
  101. data/app/views/layouts/uchi/application.html.erb +10 -16
  102. data/app/views/uchi/navigation/_main.html.erb +9 -0
  103. data/app/views/uchi/repository/edit.html.erb +5 -5
  104. data/app/views/uchi/repository/index.html.erb +15 -6
  105. data/app/views/uchi/repository/new.html.erb +5 -5
  106. data/app/views/uchi/repository/show.html.erb +16 -5
  107. data/lib/generators/uchi/controller/templates/controller.rb.tt +0 -5
  108. data/lib/generators/uchi/scaffold/scaffold_generator.rb +15 -0
  109. data/lib/uchi/action.rb +84 -0
  110. data/lib/uchi/action_response.rb +108 -0
  111. data/lib/uchi/repository/translate.rb +117 -19
  112. data/lib/uchi/repository.rb +25 -0
  113. data/lib/uchi/version.rb +1 -1
  114. data/lib/uchi.rb +2 -0
  115. metadata +63 -50
  116. data/app/components/flowbite/button/outline.rb +0 -22
  117. data/app/components/flowbite/button/pill.rb +0 -40
  118. data/app/components/flowbite/button.rb +0 -92
  119. data/app/components/flowbite/card.rb +0 -45
  120. data/app/components/flowbite/input/file.rb +0 -30
  121. data/app/components/flowbite/input/textarea.rb +0 -42
  122. data/app/components/flowbite/input/validation_error.rb +0 -11
  123. data/app/components/flowbite/input_field/checkbox.html.erb +0 -14
  124. data/app/components/flowbite/input_field/input_field.html.erb +0 -8
  125. data/app/components/flowbite/input_field/radio_button.html.erb +0 -14
  126. data/app/components/flowbite/link.rb +0 -21
  127. data/app/components/flowbite/toast/toast.html.erb +0 -11
  128. /data/app/components/{flowbite → uchi/flowbite}/toast/icon.html.erb +0 -0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uchi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakob Skjerning
@@ -68,55 +68,6 @@ files:
68
68
  - app/assets/stylesheets/uchi/application.css
69
69
  - app/assets/stylesheets/uchi/uchi.css
70
70
  - app/assets/tailwind/uchi.css
71
- - app/components/flowbite/breadcrumb.rb
72
- - app/components/flowbite/breadcrumb_home.rb
73
- - app/components/flowbite/breadcrumb_item.rb
74
- - app/components/flowbite/breadcrumb_item/current.rb
75
- - app/components/flowbite/breadcrumb_item/first.rb
76
- - app/components/flowbite/breadcrumb_separator.rb
77
- - app/components/flowbite/button.rb
78
- - app/components/flowbite/button/outline.rb
79
- - app/components/flowbite/button/pill.rb
80
- - app/components/flowbite/card.rb
81
- - app/components/flowbite/input/checkbox.rb
82
- - app/components/flowbite/input/date.rb
83
- - app/components/flowbite/input/date_time.rb
84
- - app/components/flowbite/input/email.rb
85
- - app/components/flowbite/input/field.rb
86
- - app/components/flowbite/input/file.rb
87
- - app/components/flowbite/input/hint.rb
88
- - app/components/flowbite/input/label.rb
89
- - app/components/flowbite/input/number.rb
90
- - app/components/flowbite/input/password.rb
91
- - app/components/flowbite/input/phone.rb
92
- - app/components/flowbite/input/radio_button.rb
93
- - app/components/flowbite/input/select.rb
94
- - app/components/flowbite/input/textarea.rb
95
- - app/components/flowbite/input/url.rb
96
- - app/components/flowbite/input/validation_error.rb
97
- - app/components/flowbite/input_field.rb
98
- - app/components/flowbite/input_field/checkbox.html.erb
99
- - app/components/flowbite/input_field/checkbox.rb
100
- - app/components/flowbite/input_field/date.rb
101
- - app/components/flowbite/input_field/date_time.rb
102
- - app/components/flowbite/input_field/email.rb
103
- - app/components/flowbite/input_field/file.rb
104
- - app/components/flowbite/input_field/input_field.html.erb
105
- - app/components/flowbite/input_field/number.rb
106
- - app/components/flowbite/input_field/password.rb
107
- - app/components/flowbite/input_field/phone.rb
108
- - app/components/flowbite/input_field/radio_button.html.erb
109
- - app/components/flowbite/input_field/radio_button.rb
110
- - app/components/flowbite/input_field/select.rb
111
- - app/components/flowbite/input_field/text.rb
112
- - app/components/flowbite/input_field/textarea.rb
113
- - app/components/flowbite/input_field/url.rb
114
- - app/components/flowbite/link.rb
115
- - app/components/flowbite/style.rb
116
- - app/components/flowbite/toast.rb
117
- - app/components/flowbite/toast/icon.html.erb
118
- - app/components/flowbite/toast/icon.rb
119
- - app/components/flowbite/toast/toast.html.erb
120
71
  - app/components/uchi/field/base.rb
121
72
  - app/components/uchi/field/belongs_to.rb
122
73
  - app/components/uchi/field/belongs_to/edit.html.erb
@@ -169,6 +120,59 @@ files:
169
120
  - app/components/uchi/field/text/edit.html.erb
170
121
  - app/components/uchi/field/text/index.html.erb
171
122
  - app/components/uchi/field/text/show.html.erb
123
+ - app/components/uchi/flowbite/breadcrumb.rb
124
+ - app/components/uchi/flowbite/breadcrumb_home.rb
125
+ - app/components/uchi/flowbite/breadcrumb_item.rb
126
+ - app/components/uchi/flowbite/breadcrumb_item/current.rb
127
+ - app/components/uchi/flowbite/breadcrumb_item/first.rb
128
+ - app/components/uchi/flowbite/breadcrumb_separator.rb
129
+ - app/components/uchi/flowbite/button.rb
130
+ - app/components/uchi/flowbite/button/outline.rb
131
+ - app/components/uchi/flowbite/button/pill.rb
132
+ - app/components/uchi/flowbite/card.rb
133
+ - app/components/uchi/flowbite/card/card.html.erb
134
+ - app/components/uchi/flowbite/card/title.rb
135
+ - app/components/uchi/flowbite/input/checkbox.rb
136
+ - app/components/uchi/flowbite/input/date.rb
137
+ - app/components/uchi/flowbite/input/date_time.rb
138
+ - app/components/uchi/flowbite/input/email.rb
139
+ - app/components/uchi/flowbite/input/field.rb
140
+ - app/components/uchi/flowbite/input/file.rb
141
+ - app/components/uchi/flowbite/input/hint.rb
142
+ - app/components/uchi/flowbite/input/label.rb
143
+ - app/components/uchi/flowbite/input/number.rb
144
+ - app/components/uchi/flowbite/input/password.rb
145
+ - app/components/uchi/flowbite/input/phone.rb
146
+ - app/components/uchi/flowbite/input/radio_button.rb
147
+ - app/components/uchi/flowbite/input/select.rb
148
+ - app/components/uchi/flowbite/input/textarea.rb
149
+ - app/components/uchi/flowbite/input/url.rb
150
+ - app/components/uchi/flowbite/input/validation_error.rb
151
+ - app/components/uchi/flowbite/input_field.rb
152
+ - app/components/uchi/flowbite/input_field/checkbox.html.erb
153
+ - app/components/uchi/flowbite/input_field/checkbox.rb
154
+ - app/components/uchi/flowbite/input_field/date.rb
155
+ - app/components/uchi/flowbite/input_field/date_time.rb
156
+ - app/components/uchi/flowbite/input_field/email.rb
157
+ - app/components/uchi/flowbite/input_field/file.rb
158
+ - app/components/uchi/flowbite/input_field/input_field.html.erb
159
+ - app/components/uchi/flowbite/input_field/number.rb
160
+ - app/components/uchi/flowbite/input_field/password.rb
161
+ - app/components/uchi/flowbite/input_field/phone.rb
162
+ - app/components/uchi/flowbite/input_field/radio_button.html.erb
163
+ - app/components/uchi/flowbite/input_field/radio_button.rb
164
+ - app/components/uchi/flowbite/input_field/select.rb
165
+ - app/components/uchi/flowbite/input_field/text.rb
166
+ - app/components/uchi/flowbite/input_field/textarea.rb
167
+ - app/components/uchi/flowbite/input_field/url.rb
168
+ - app/components/uchi/flowbite/link.rb
169
+ - app/components/uchi/flowbite/style.rb
170
+ - app/components/uchi/flowbite/toast.rb
171
+ - app/components/uchi/flowbite/toast/icon.html.erb
172
+ - app/components/uchi/flowbite/toast/icon.rb
173
+ - app/components/uchi/flowbite/toast/toast.html.erb
174
+ - app/components/uchi/ui/actions/dropdown.rb
175
+ - app/components/uchi/ui/actions/dropdown/dropdown.html.erb
172
176
  - app/components/uchi/ui/breadcrumb.rb
173
177
  - app/components/uchi/ui/breadcrumb/breadcrumb.html.erb
174
178
  - app/components/uchi/ui/form/footer.rb
@@ -182,6 +186,10 @@ files:
182
186
  - app/components/uchi/ui/index/records_table/search_form.rb
183
187
  - app/components/uchi/ui/index/records_table/search_form/search_form.html.erb
184
188
  - app/components/uchi/ui/index/turbo_frame.rb
189
+ - app/components/uchi/ui/navigation.rb
190
+ - app/components/uchi/ui/navigation/navigation.html.erb
191
+ - app/components/uchi/ui/no_value.rb
192
+ - app/components/uchi/ui/no_value/no_value.html.erb
185
193
  - app/components/uchi/ui/page_header.rb
186
194
  - app/components/uchi/ui/page_header/page_header.html.erb
187
195
  - app/components/uchi/ui/pagination.rb
@@ -201,6 +209,7 @@ files:
201
209
  - app/components/uchi/ui/show/attribute_fields/attribute_fields.html.erb
202
210
  - app/components/uchi/ui/spinner.rb
203
211
  - app/components/uchi/ui/spinner/spinner.html.erb
212
+ - app/controllers/uchi/actions/executions_controller.rb
204
213
  - app/controllers/uchi/application_controller.rb
205
214
  - app/controllers/uchi/controller.rb
206
215
  - app/controllers/uchi/repository_controller.rb
@@ -209,6 +218,7 @@ files:
209
218
  - app/mailers/uchi/application_mailer.rb
210
219
  - app/views/layouts/uchi/_flash_messages.html.erb
211
220
  - app/views/layouts/uchi/application.html.erb
221
+ - app/views/uchi/navigation/_main.html.erb
212
222
  - app/views/uchi/repository/edit.html.erb
213
223
  - app/views/uchi/repository/index.html.erb
214
224
  - app/views/uchi/repository/new.html.erb
@@ -218,8 +228,11 @@ files:
218
228
  - lib/generators/uchi/install/install_generator.rb
219
229
  - lib/generators/uchi/repository/repository_generator.rb
220
230
  - lib/generators/uchi/repository/templates/repository.rb.tt
231
+ - lib/generators/uchi/scaffold/scaffold_generator.rb
221
232
  - lib/tasks/uchi_tasks.rake
222
233
  - lib/uchi.rb
234
+ - lib/uchi/action.rb
235
+ - lib/uchi/action_response.rb
223
236
  - lib/uchi/application_record.rb
224
237
  - lib/uchi/engine.rb
225
238
  - lib/uchi/field.rb
@@ -1,22 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flowbite
4
- class Button
5
- class Outline < Flowbite::Button
6
- class << self
7
- # rubocop:disable Layout/LineLength
8
- def styles
9
- {
10
- default: Flowbite::Style.new(
11
- default: ["text-blue-700", "hover:text-white", "border", "border-blue-700", "hover:bg-blue-800", "focus:ring-4", "focus:outline-none", "focus:ring-blue-300", "font-medium", "rounded-lg", "text-center", "me-2", "mb-2", "dark:border-blue-500", "dark:text-blue-500", "dark:hover:text-white", "dark:hover:bg-blue-500", "dark:focus:ring-blue-800"]
12
- ),
13
- green: Flowbite::Style.new(
14
- default: ["text-green-700", "hover:text-white", "border", "border-green-700", "hover:bg-green-800", "focus:ring-4", "focus:outline-none", "focus:ring-green-300", "font-medium", "rounded-lg", "text-center", "me-2", "mb-2", "dark:border-green-500", "dark:text-green-500", "dark:hover:text-white", "dark:hover:bg-green-600", "dark:focus:ring-green-800"]
15
- )
16
- }
17
- end
18
- # rubocop:enable Layout/LineLength
19
- end
20
- end
21
- end
22
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flowbite
4
- class Button
5
- class Pill < Flowbite::Button
6
- class << self
7
- # rubocop:disable Layout/LineLength, Metrics/MethodLength
8
- def styles
9
- {
10
- alternative: Flowbite::Style.new(
11
- default: ["text-sm", "font-medium", "text-gray-900", "focus:outline-none", "bg-white", "rounded-full", "border", "border-gray-200", "hover:bg-gray-100", "hover:text-blue-700", "focus:z-10", "focus:ring-4", "focus:ring-gray-100", "dark:focus:ring-gray-700", "dark:bg-gray-800", "dark:text-gray-400", "dark:border-gray-600", "dark:hover:text-white", "dark:hover:bg-gray-700"]
12
- ),
13
- dark: Flowbite::Style.new(
14
- default: ["text-white", "bg-gray-800", "hover:bg-gray-900", "focus:outline-none", "focus:ring-4", "focus:ring-gray-300", "font-medium", "rounded-full", "dark:bg-gray-800", "dark:hover:bg-gray-700", "dark:focus:ring-gray-700", "dark:border-gray-700"]
15
- ),
16
- default: Flowbite::Style.new(
17
- default: ["text-white", "bg-blue-700", "hover:bg-blue-800", "focus:outline-none", "focus:ring-4", "focus:ring-blue-300", "font-medium", "rounded-full", "text-center", "dark:bg-blue-600", "dark:hover:bg-blue-700", "dark:focus:ring-blue-800"]
18
- ),
19
- green: Flowbite::Style.new(
20
- default: ["text-white", "bg-green-700", "hover:bg-green-800", "focus:outline-none", "focus:ring-4", "focus:ring-green-300", "font-medium", "rounded-full", "text-center", "dark:bg-green-600", "dark:hover:bg-green-700", "dark:focus:ring-green-800"]
21
- ),
22
- light: Flowbite::Style.new(
23
- default: ["text-gray-900", "bg-white", "border", "border-gray-300", "focus:outline-none", "hover:bg-gray-100", "focus:ring-4", "focus:ring-gray-100", "font-medium", "rounded-full", "dark:bg-gray-800", "dark:text-white", "dark:border-gray-600", "dark:hover:bg-gray-700", "dark:hover:border-gray-600", "dark:focus:ring-gray-700"]
24
- ),
25
- purple: Flowbite::Style.new(
26
- default: ["text-white", "bg-purple-700", "hover:bg-purple-800", "focus:outline-none", "focus:ring-4", "focus:ring-purple-300", "font-medium", "rounded-full", "text-center", "dark:bg-purple-600", "dark:hover:bg-purple-700", "dark:focus:ring-purple-900"]
27
- ),
28
- red: Flowbite::Style.new(
29
- default: ["text-white", "bg-red-700", "hover:bg-red-800", "focus:outline-none", "focus:ring-4", "focus:ring-red-300", "font-medium", "rounded-full", "text-center", "dark:bg-red-600", "dark:hover:bg-red-700", "dark:focus:ring-red-900"]
30
- ),
31
- yellow: Flowbite::Style.new(
32
- default: ["text-white", "bg-yellow-400", "hover:bg-yellow-500", "focus:outline-none", "focus:ring-4", "focus:ring-yellow-300", "font-medium", "rounded-full", "text-center", "dark:focus:ring-yellow-900"]
33
- )
34
- }
35
- end
36
- # rubocop:enable Layout/LineLength, Metrics/MethodLength
37
- end
38
- end
39
- end
40
- end
@@ -1,92 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flowbite
4
- # Renders a HTML button element.
5
- #
6
- # See https://flowbite.com/docs/components/buttons/
7
- #
8
- # @param label [String] The text to display on the button.
9
- #
10
- # All other parameters are optional and are passed directly to the button tag
11
- # as HTML attributes.
12
- class Button < ViewComponent::Base
13
- SIZES = {
14
- xs: ["text-xs", "px-3", "py-2"],
15
- sm: ["text-sm", "px-3", "py-2"],
16
- default: ["text-sm", "px-5", "py-2.5"],
17
- lg: ["text-base", "px-5", "py-3"],
18
- xl: ["text-base", "px-6", "py-3.5"]
19
- }.freeze
20
-
21
- class << self
22
- def classes(size: :default, state: :default, style: :default)
23
- style = styles.fetch(style)
24
- classes = style.fetch(state)
25
- classes + sizes.fetch(size)
26
- end
27
-
28
- def sizes
29
- SIZES
30
- end
31
-
32
- # rubocop:disable Layout/LineLength
33
- def styles
34
- {
35
- alternative: Flowbite::Style.new(
36
- default: ["font-medium", "text-gray-900", "focus:outline-none", "bg-white", "rounded-lg", "border", "border-gray-200", "hover:bg-gray-100", "hover:text-blue-700", "focus:z-10", "focus:ring-4", "focus:ring-gray-100", "dark:focus:ring-gray-700", "dark:bg-gray-800", "dark:text-gray-400", "dark:border-gray-600", "dark:hover:text-white", "dark:hover:bg-gray-700"]
37
- ),
38
- dark: Flowbite::Style.new(
39
- default: ["text-white", "bg-gray-800", "hover:bg-gray-900", "focus:ring-4", "focus:ring-gray-300", "font-medium", "rounded-lg", "dark:bg-gray-800", "dark:hover:bg-gray-700", "dark:focus:ring-gray-700", "dark:border-gray-700"]
40
- ),
41
- default: Flowbite::Style.new(
42
- default: ["text-white", "bg-blue-700", "hover:bg-blue-800", "focus:ring-4", "focus:ring-blue-300", "font-medium", "rounded-lg", "dark:bg-blue-600", "dark:hover:bg-blue-700", "focus:outline-none", "dark:focus:ring-blue-800"]
43
- ),
44
- green: Flowbite::Style.new(
45
- default: ["focus:outline-none", "text-white", "bg-green-700", "hover:bg-green-800", "focus:ring-4", "focus:ring-green-300", "font-medium", "rounded-lg", "dark:bg-green-600", "dark:hover:bg-green-700", "dark:focus:ring-green-800"]
46
- ),
47
- light: Flowbite::Style.new(
48
- default: ["text-gray-900", "bg-white", "border", "border-gray-300", "hover:bg-gray-100", "focus:ring-4", "focus:ring-gray-100", "font-medium", "rounded-lg", "dark:bg-gray-800", "dark:text-white", "dark:border-gray-600", "dark:hover:bg-gray-700", "dark:hover:border-gray-600", "dark:focus:ring-gray-700"]
49
- ),
50
- purple: Flowbite::Style.new(
51
- default: ["focus:outline-none", "text-white", "bg-purple-700", "hover:bg-purple-800", "focus:ring-4", "focus:ring-purple-300", "font-medium", "rounded-lg", "dark:bg-purple-600", "dark:hover:bg-purple-700", "dark:focus:ring-purple-900"]
52
- ),
53
- red: Flowbite::Style.new(
54
- default: ["focus:outline-none", "text-white", "bg-red-700", "hover:bg-red-800", "focus:ring-4", "focus:ring-red-300", "font-medium", "rounded-lg", "dark:bg-red-600", "dark:hover:bg-red-700", "dark:focus:ring-red-900"]
55
- ),
56
- yellow: Flowbite::Style.new(
57
- default: ["focus:outline-none", "text-white", "bg-yellow-400", "hover:bg-yellow-500", "focus:ring-4", "focus:ring-yellow-300", "font-medium", "rounded-lg", "dark:focus:ring-yellow-900"]
58
- )
59
- }.freeze
60
- end
61
- # rubocop:enable Layout/LineLength
62
- end
63
-
64
- attr_reader :button_attributes, :size, :style
65
-
66
- def initialize(size: :default, style: :default, **button_attributes)
67
- @size = size
68
- @style = style
69
- @button_attributes = button_attributes
70
- end
71
-
72
- def call
73
- content_tag(
74
- :button,
75
- content,
76
- **options
77
- )
78
- end
79
-
80
- private
81
-
82
- def classes
83
- self.class.classes(size: size, state: :default, style: style)
84
- end
85
-
86
- def options
87
- {
88
- class: classes
89
- }.merge(button_attributes)
90
- end
91
- end
92
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flowbite
4
- # Renders a card element.
5
- #
6
- # See https://flowbite.com/docs/components/cards/
7
- class Card < ViewComponent::Base
8
- class << self
9
- def classes(state: :default, style: :default)
10
- style = styles.fetch(style)
11
- style.fetch(state)
12
- end
13
-
14
- # rubocop:disable Layout/LineLength
15
- def styles
16
- {
17
- default: Flowbite::Style.new(
18
- default: ["p-6", "bg-white", "border", "border-gray-200", "rounded-lg", "shadow-sm", "dark:bg-gray-800", "dark:border-gray-700"]
19
- )
20
- }.freeze
21
- end
22
- # rubocop:enable Layout/LineLength
23
- end
24
-
25
- def call
26
- card_options = {}
27
- card_options[:class] = self.class.classes + @class
28
-
29
- content_tag(:div, card_options.merge(@options)) do
30
- concat(content_tag(:div, content, class: "font-normal text-gray-700 dark:text-gray-400"))
31
- end
32
- end
33
-
34
- # @param class [Array<String>] Additional CSS classes for the card
35
- # container.
36
- #
37
- # @param options [Hash] Additional HTML options for the card container
38
- # (e.g., custom classes, data attributes). These options are merged into
39
- # the card's root element.
40
- def initialize(class: [], options: {})
41
- @class = Array(binding.local_variable_get(:class)) || []
42
- @options = options || {}
43
- end
44
- end
45
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flowbite
4
- module Input
5
- class File < Field
6
- SIZES = {
7
- sm: ["text-xs"],
8
- default: ["text-sm"],
9
- lg: ["text-lg"]
10
- }.freeze
11
-
12
- # Returns the name of the method used to generate HTML for the input field
13
- def input_field_type
14
- :file_field
15
- end
16
-
17
- # rubocop:disable Layout/LineLength
18
- def self.styles
19
- {
20
- default: Flowbite::Style.new(
21
- default: ["block", "w-full", "text-gray-900", "border", "border-gray-300", "rounded-lg", "cursor-pointer", "bg-gray-50", "focus:outline-none", "dark:text-gray-400", "dark:bg-gray-700", "dark:border-gray-600"],
22
- disabled: ["block", "w-full", "text-gray-400", "border", "border-gray-300", "rounded-lg", "cursor-not-allowed", "bg-gray-100", "dark:text-gray-500", "dark:bg-gray-600", "dark:border-gray-500"],
23
- error: ["block", "w-full", "text-red-900", "border", "border-red-500", "rounded-lg", "cursor-pointer", "bg-red-50", "focus:outline-none", "dark:text-red-400", "dark:bg-gray-700", "dark:border-red-500"]
24
- )
25
- }.freeze
26
- end
27
- # rubocop:enable Layout/LineLength
28
- end
29
- end
30
- end
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flowbite
4
- module Input
5
- class Textarea < Field
6
- class << self
7
- # rubocop:disable Layout/LineLength
8
- def styles
9
- {
10
- default: Flowbite::Style.new(
11
- default: ["block", "w-full", "text-gray-900", "bg-gray-50", "rounded-lg", "border", "border-gray-300", "focus:ring-blue-500", "focus:border-blue-500", "dark:bg-gray-700", "dark:border-gray-600", "dark:placeholder-gray-400", "dark:text-white", "dark:focus:ring-blue-500", "dark:focus:border-blue-500"],
12
- disabled: ["block", "w-full", "bg-gray-100", "rounded-lg", "border", "border-gray-300", "text-gray-900", "cursor-not-allowed"],
13
- error: ["block", "w-full", "bg-red-50", "border", "border-red-500", "text-red-900", "placeholder-red-700", "rounded-lg", "focus:ring-red-500", "focus:border-red-500", "dark:bg-gray-700", "dark:text-red-500", "dark:placeholder-red-500", "dark:border-red-500"]
14
- )
15
- }.freeze
16
- end
17
- # rubocop:enable Layout/LineLength
18
- end
19
-
20
- # Returns the HTML to use for the actual input field element.
21
- def call
22
- @form.send(
23
- input_field_type,
24
- @attribute,
25
- **input_options
26
- )
27
- end
28
-
29
- protected
30
-
31
- # Returns the CSS classes to apply to the input field
32
- def classes
33
- self.class.classes(size: size, state: state)
34
- end
35
-
36
- # Returns the name of the method used to generate HTML for the input field
37
- def input_field_type
38
- :text_area
39
- end
40
- end
41
- end
42
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Flowbite
4
- module Input
5
- class ValidationError < ViewComponent::Base
6
- def call
7
- tag.p(content, class: "mt-2 text-sm text-red-600 dark:text-red-500")
8
- end
9
- end
10
- end
11
- end
@@ -1,14 +0,0 @@
1
- <div class="flex">
2
- <div class="flex items-center h-5">
3
- <%= input %>
4
- </div>
5
-
6
- <div class="ms-2 text-sm">
7
- <%= label %>
8
- <%= hint %>
9
- </div>
10
-
11
- <% errors.each do |error| %>
12
- <%= render(Flowbite::Input::ValidationError.new) { error.upcase_first } %>
13
- <% end %>
14
- </div>
@@ -1,8 +0,0 @@
1
- <div>
2
- <%= label %>
3
- <%= input %>
4
- <%= hint %>
5
- <% errors.each do |error| %>
6
- <%= render(Flowbite::Input::ValidationError.new) { error.upcase_first } %>
7
- <% end %>
8
- </div>
@@ -1,14 +0,0 @@
1
- <div class="flex">
2
- <div class="flex items-center h-5">
3
- <%= input %>
4
- </div>
5
-
6
- <div class="ms-2 text-sm">
7
- <%= label %>
8
- <%= hint %>
9
- </div>
10
-
11
- <% errors.each do |error| %>
12
- <%= render(Flowbite::Input::ValidationError.new) { error.upcase_first } %>
13
- <% end %>
14
- </div>
@@ -1,21 +0,0 @@
1
- module Flowbite
2
- class Link < ViewComponent::Base
3
- attr_reader :href, :text, :options
4
-
5
- class << self
6
- def classes
7
- ["font-medium", "text-blue-600", "dark:text-blue-500", "hover:underline"].join(" ")
8
- end
9
- end
10
-
11
- def initialize(href:, **options)
12
- super()
13
- @href = href
14
- @options = options
15
- end
16
-
17
- def call
18
- link_to(content, href, {class: self.class.classes}.merge(options))
19
- end
20
- end
21
- end
@@ -1,11 +0,0 @@
1
- <div class="<%= container_classes.join(" ") %>" role="alert" <%= options.map { |k, v| "#{k}=\"#{v}\"" }.join(" ").html_safe %>>
2
- <%= render Flowbite::Toast::Icon.new(style: style) %>
3
- <div class="ms-3 text-sm font-normal"><%= message %></div>
4
- <% if dismissible %>
5
- <button type="button" class="ms-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex items-center justify-center h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700" aria-label="Close">
6
- <svg class="w-3 h-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 14 14">
7
- <path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"/>
8
- </svg>
9
- </button>
10
- <% end %>
11
- </div>