flowbite-components 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8801080d6b51d7c4fef754dcd189ebaea34c8dd17a496c7dda80eb31e37f9737
4
+ data.tar.gz: a50284e6b62c7713edbaadec851d34ec87ad698986431ca407539c9282033928
5
+ SHA512:
6
+ metadata.gz: 894c82db7d448e8a444e4fb3df781e0ccea35df068ae5711d358e83d3651dfc30e2b086e55dcfd8afabd5d84db5f777b1dd0fc497382cab1531f0dcf6623ab3f
7
+ data.tar.gz: cd0bb587980b19ff4d4b6ec9f6cfad3d3ec42a624a87f2a88f28eafd77608956a3cd2d3de6135c1b118ab0f85505a8c390dc0e6be53a548ef794e0aeb3bb228e
data/CHANGELOG.md ADDED
@@ -0,0 +1,20 @@
1
+ # Changes
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ This project adheres to [Semantic Versioning](http://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ### Added
9
+
10
+ * Button component (first component, wee!)
11
+ * Input components
12
+ * InputField components
13
+
14
+ ### Changes
15
+
16
+ *
17
+
18
+ ### Removed
19
+
20
+ *
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Substance Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,250 @@
1
+ # Flowbite ViewComponents
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/flowbite-view_components.svg)](https://rubygems.org/gems/flowbite-view_components)
4
+ [![Ruby Tests](https://github.com/substancelab/flowbite-view_components/workflows/Ruby/badge.svg)](https://github.com/substancelab/flowbite-view_components/actions)
5
+
6
+ Unofficial, open source implementation of [Flowbite](https://flowbite.com/) components for Rails applications, built using [ViewComponent](https://viewcomponent.org/).
7
+
8
+ Flowbite ViewComponents provides a comprehensive library of UI components following the Flowbite design system, implemented as Rails ViewComponents with full Tailwind CSS integration and dark mode support.
9
+
10
+ ## Features
11
+
12
+ - **Full Flowbite Design System**: Faithful implementation of Flowbite components
13
+ - **Rails Native**: Built specifically for Rails using ViewComponent
14
+ - **Tailwind CSS Integration**: Seamless integration with Tailwind CSS
15
+ - **Dark Mode Support**: Built-in dark theme variants
16
+ - **Form Helpers**: Comprehensive form input components with validation states
17
+ - **Accessibility First**: ARIA attributes and semantic HTML
18
+ - **Type Safety**: Comprehensive test coverage and input validation
19
+
20
+ ## Installation
21
+
22
+ Add the gem to your application's Gemfile:
23
+
24
+ ```ruby
25
+ gem 'flowbite-view_components'
26
+ ```
27
+
28
+ Then execute:
29
+
30
+ ```bash
31
+ bundle install
32
+ ```
33
+
34
+ ### Configuration
35
+
36
+ Make sure you have Tailwind CSS installed in your Rails application. We recommend using the [tailwindcss-rails](https://github.com/rails/tailwindcss-rails) gem:
37
+
38
+ ```ruby
39
+ gem "tailwindcss-rails", ">= 4.3.0"
40
+ ```
41
+
42
+ ### Flowbite Setup
43
+
44
+ Install Flowbite as an npm dependency:
45
+
46
+ ```bash
47
+ npm install flowbite
48
+ ```
49
+
50
+ Add Flowbite to your Tailwind CSS configuration. In your `app/assets/tailwind/application.css`:
51
+
52
+ ```css
53
+ @import "flowbite/src/themes/default";
54
+ @plugin "flowbite/plugin";
55
+ @import "../builds/tailwind/flowbite_view_components";
56
+ ```
57
+
58
+ ## Usage examples
59
+
60
+ ### Basic Form Field
61
+
62
+ ```erb
63
+ <% form_with model: @user do |form| %>
64
+ <%= render Flowbite::InputField::Text.new(
65
+ attribute: :name,
66
+ form: form,
67
+ label: {content: "Full Name"},
68
+ hint: {content: "Enter your full name"}
69
+ ) %>
70
+
71
+ <%= render Flowbite::InputField::Email.new(
72
+ attribute: :email,
73
+ form: form
74
+ ) %>
75
+
76
+ <%= render Flowbite::Button.new(
77
+ type: :submit,
78
+ content: "Save User"
79
+ ) %>
80
+ <% end %>
81
+ ```
82
+
83
+ ### Button Examples
84
+
85
+ ```erb
86
+ <!-- Default button -->
87
+ <%= render Flowbite::Button.new do %>
88
+ Click me
89
+ <% end %>
90
+
91
+ <!-- Outline button with color -->
92
+ <%= render Flowbite::Button::Outline.new(style: :blue) do %>
93
+ Outline Button
94
+ <% end %>
95
+
96
+ <!-- Pill button -->
97
+ <%= render Flowbite::Button::Pill.new(style: :green) do %>
98
+ Pill Button
99
+ <% end %>
100
+ ```
101
+
102
+ ### Custom Input Options
103
+
104
+ ```erb
105
+ <%= render Flowbite::InputField::Text.new(
106
+ attribute: :username,
107
+ form: form,
108
+ size: :lg,
109
+ input: {
110
+ options: {
111
+ placeholder: "Enter username",
112
+ maxlength: 50,
113
+ class: "custom-class"
114
+ }
115
+ }
116
+ ) %>
117
+ ```
118
+
119
+ ### Custom Labels
120
+
121
+ ```erb
122
+ <%= render Flowbite::InputField::Email.new(
123
+ attribute: :email,
124
+ form: form,
125
+ label: {
126
+ content: "Email Address",
127
+ options: {class: "font-bold"}
128
+ }
129
+ ) %>
130
+ ```
131
+
132
+ ### Disabled and Error States
133
+
134
+ ```erb
135
+ <!-- Disabled field -->
136
+ <%= render Flowbite::InputField::Text.new(
137
+ attribute: :name,
138
+ form: form,
139
+ disabled: true
140
+ ) %>
141
+
142
+ <!-- Field with hint -->
143
+ <%= render Flowbite::InputField::Password.new(
144
+ attribute: :password,
145
+ form: form,
146
+ hint: "Must be at least 8 characters long"
147
+ ) %>
148
+ ```
149
+
150
+ ## Available Components
151
+
152
+ ### Form Components
153
+
154
+ #### Input Fields (Complete form fields with labels, hints, and error handling)
155
+ - **Checkbox**: `Flowbite::InputField::Checkbox`
156
+ - **Date**: `Flowbite::InputField::Date`
157
+ - **Email**: `Flowbite::InputField::Email`
158
+ - **File**: `Flowbite::InputField::File`
159
+ - **Number**: `Flowbite::InputField::Number`
160
+ - **Password**: `Flowbite::InputField::Password`
161
+ - **Phone**: `Flowbite::InputField::Phone`
162
+ - **Radio Button**: `Flowbite::InputField::RadioButton`
163
+ - **Select**: `Flowbite::InputField::Select`
164
+ - **Text**: `Flowbite::InputField::Text`
165
+ - **Textarea**: `Flowbite::InputField::Textarea`
166
+ - **URL**: `Flowbite::InputField::Url`
167
+
168
+ #### Basic Input Components (Input elements without labels or wrappers)
169
+ - **Checkbox**: `Flowbite::Input::Checkbox`
170
+ - **Date**: `Flowbite::Input::Date`
171
+ - **Email**: `Flowbite::Input::Email`
172
+ - **File**: `Flowbite::Input::File`
173
+ - **Number**: `Flowbite::Input::Number`
174
+ - **Password**: `Flowbite::Input::Password`
175
+ - **Phone**: `Flowbite::Input::Phone`
176
+ - **Radio Button**: `Flowbite::Input::RadioButton`
177
+ - **Select**: `Flowbite::Input::Select`
178
+ - **Textarea**: `Flowbite::Input::Textarea`
179
+ - **URL**: `Flowbite::Input::Url`
180
+
181
+ #### Form Utilities
182
+ - **Hint**: `Flowbite::Input::Hint`
183
+ - **Label**: `Flowbite::Input::Label`
184
+ - **Validation Error**: `Flowbite::Input::ValidationError`
185
+
186
+ ### UI Components
187
+
188
+ #### Buttons
189
+ - **Button**: `Flowbite::Button` (default solid button)
190
+ - **Outline Button**: `Flowbite::Button::Outline`
191
+ - **Pill Button**: `Flowbite::Button::Pill`
192
+
193
+
194
+ ## Development
195
+
196
+ After checking out the repo, run `bin/setup` to install dependencies.
197
+
198
+ To run tests:
199
+
200
+ ```bash
201
+ bundle exec rake test
202
+ ```
203
+
204
+ To check code style:
205
+
206
+ ```bash
207
+ bundle exec rake standard
208
+ ```
209
+
210
+ To install this gem onto your local machine:
211
+
212
+ ```bash
213
+ bundle exec rake install
214
+ ```
215
+
216
+ ### Component Previews
217
+
218
+ This library includes Lookbook previews for all components. To view them:
219
+
220
+ 1. Add Lookbook to your development dependencies
221
+ 2. Run `rails server`
222
+ 3. Visit `/rails/lookbook`
223
+
224
+ ## Contributing
225
+
226
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/substancelab/flowbite-view_components](https://github.com/substancelab/flowbite-view_components).
227
+
228
+ ### Development Guidelines
229
+
230
+ - All components should follow Flowbite design system specifications
231
+ - Use keyword arguments for component initialization
232
+ - Include comprehensive tests for all components
233
+ - Follow the existing naming conventions
234
+ - Ensure accessibility standards are met
235
+
236
+ ## Support
237
+
238
+ - [Flowbite Documentation](https://flowbite.com/docs/)
239
+ - [ViewComponent Documentation](https://viewcomponent.org/)
240
+ - [Tailwind CSS Documentation](https://tailwindcss.com/docs)
241
+
242
+ ## Other Flowbite component libraries
243
+
244
+ * https://flowbite-react.com/
245
+ * https://flowbite-svelte.com/
246
+ * https://flowbite-vue.com/
247
+
248
+ ## License
249
+
250
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,13 @@
1
+ require "rails/engine"
2
+
3
+ module Flowbite
4
+ module ViewComponents
5
+ class Engine < ::Rails::Engine
6
+ isolate_namespace Flowbite::ViewComponents
7
+
8
+ config.autoload_paths = [
9
+ "#{root}/app/components"
10
+ ]
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Flowbite
4
+ module ViewComponents
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "view_components/engine"
4
+ require_relative "view_components/version"
5
+
6
+ require "view_component"
7
+
8
+ module Flowbite
9
+ module ViewComponents
10
+ class Error < StandardError; end
11
+ # Your code goes here...
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flowbite-components
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jakob Skjerning
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: view_component
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: 4.0.0
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 4.0.0
26
+ description: A library of Flowbite View Components to be used in Rails applications.
27
+ email:
28
+ - jakob@mentalized.net
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - CHANGELOG.md
34
+ - LICENSE
35
+ - README.md
36
+ - lib/flowbite/view_components.rb
37
+ - lib/flowbite/view_components/engine.rb
38
+ - lib/flowbite/view_components/version.rb
39
+ homepage: https://github.com/substancelab/flowbite-view_components
40
+ licenses: []
41
+ metadata:
42
+ allowed_push_host: https://rubygems.org/
43
+ homepage_uri: https://github.com/substancelab/flowbite-view_components
44
+ source_code_uri: https://github.com/substancelab/flowbite-view_components
45
+ changelog_uri: https://github.com/substancelab/flowbite-view_components/blob/main/CHANGELOG.md
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 3.1.0
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.6.9
61
+ specification_version: 4
62
+ summary: Flowbite components for Rails applications
63
+ test_files: []