flowbite-components 0.1.4 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -4
- data/README.md +23 -4
- data/app/components/flowbite/breadcrumb/home_icon.rb +28 -0
- data/app/components/flowbite/breadcrumb/item/current.rb +35 -0
- data/app/components/flowbite/breadcrumb/item/first.rb +37 -0
- data/app/components/flowbite/breadcrumb/item.rb +50 -0
- data/app/components/flowbite/breadcrumb/separator_icon.rb +34 -0
- data/app/components/flowbite/breadcrumb.rb +54 -0
- data/app/components/flowbite/button.rb +6 -5
- data/app/components/flowbite/card.rb +15 -1
- data/app/components/flowbite/input/checkbox.rb +2 -2
- data/app/components/flowbite/input/date.rb +2 -2
- data/app/components/flowbite/input/date_time.rb +11 -0
- data/app/components/flowbite/input/email.rb +2 -2
- data/app/components/flowbite/input/file.rb +2 -2
- data/app/components/flowbite/input/hint.rb +6 -1
- data/app/components/flowbite/input/label.rb +1 -1
- data/app/components/flowbite/input/number.rb +2 -2
- data/app/components/flowbite/input/password.rb +2 -2
- data/app/components/flowbite/input/phone.rb +2 -2
- data/app/components/flowbite/input/radio_button.rb +2 -2
- data/app/components/flowbite/input/select.rb +2 -2
- data/app/components/flowbite/input/textarea.rb +2 -2
- data/app/components/flowbite/input/url.rb +2 -2
- data/app/components/flowbite/input/validation_error.rb +1 -1
- data/app/components/flowbite/input.rb +155 -0
- data/app/components/flowbite/input_field/date_time.rb +13 -0
- data/app/components/flowbite/input_field/input_field.html.erb +2 -2
- data/app/components/flowbite/input_field/radio_button.rb +9 -15
- data/app/components/flowbite/input_field.rb +91 -47
- data/app/components/flowbite/link.rb +2 -0
- data/app/components/flowbite/toast/icon.html.erb +5 -0
- data/app/components/flowbite/toast/icon.rb +57 -0
- data/app/components/flowbite/toast/toast.html.erb +40 -0
- data/app/components/flowbite/toast.rb +37 -0
- data/lib/flowbite/components/version.rb +1 -1
- data/lib/yard/flowbite_viewcomponent.rb +24 -0
- metadata +33 -5
- data/app/components/flowbite/input/field.rb +0 -126
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ca94dfc5af1c662f4a7cfb77f038f60402daf411673078c30b77672280c6055
|
|
4
|
+
data.tar.gz: 60ad1e86847bd59c9b8ba598d44562cbd8f24776b9e696bc55e60550da9cfc0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2676a2b3da22cae60d35793a71d2e24637edb9cd61f5d3096c95352b1f6426d3e1116d124a474f05fa5198f4ce7935b1f0499f1ee82eb756101a9229a1ecf6bc
|
|
7
|
+
data.tar.gz: 18fc7aaad24ffad2d9ec01a5ae772bf0b7194a24d3d91800a535fa3b3fd22017f1fac025791ff59a4a6de249d931abf2d30d16e88e3e1f50e78fc04d747a9899
|
data/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,23 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
|
6
|
-
## [
|
|
6
|
+
## [0.2.0]
|
|
7
7
|
|
|
8
8
|
### Added
|
|
9
9
|
|
|
10
|
+
* Breadcrumb component, including Flowbite::Breadcrumb::Item with Flowbite::Breadcrumb::Item::First and Flowbite::Breadcrumb::Item::Current variants.
|
|
11
|
+
* DateTime input field components.
|
|
12
|
+
* Toast component.
|
|
13
|
+
* Ruby 4.0 support (no changes).
|
|
14
|
+
|
|
10
15
|
### Changed
|
|
11
16
|
|
|
12
|
-
|
|
17
|
+
* [BREAKING] The API of Flowbite::InputField::RadioButton now follows the same structure as the other components for hints. Instead of passing a String (`hint: "This is the hint"`) you now have to pass a Hash that's passed along to the Hint component (i.e. `hint: {content: "This is the hint"}`), allowing you to customize other options (eg HTML attributes like class) as well.
|
|
18
|
+
* [BREAKING] Flowbite::Input::Field has been renamed to Flowbite::Input. All individual input components now use that as their superclass. This matches the class hierarchy of Flowbite::InputField::* classes better and allows Flowbite::Input to automagically appear in the documentation.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
* Flowbite::InputField classes now correctly add their options to the container element, so you can add id attributes or connect Stimulus controllers again.
|
|
13
23
|
|
|
14
24
|
|
|
15
25
|
## [0.1.4]
|
|
@@ -19,7 +29,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
19
29
|
* Flowbite::Link component to render links.
|
|
20
30
|
* Flowbite::Card now displays a title via the title argument/slot.
|
|
21
31
|
* Improved error message when an unknown style is requested.
|
|
22
|
-
* Input-elements now support forms without an object;
|
|
32
|
+
* Input-elements now support forms without an object; i.e. forms built with `form_tag` - not `form_for` or `form_with`.
|
|
23
33
|
|
|
24
34
|
### Changed
|
|
25
35
|
|
|
@@ -28,7 +38,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
28
38
|
|
|
29
39
|
### Removed
|
|
30
40
|
|
|
31
|
-
* [BREAKING] Color-specific styles from Flowbite::Button,
|
|
41
|
+
* [BREAKING] Color-specific styles from Flowbite::Button, i.e. `alternative`, `green`, `light`, `purple`, `red`, `yellow`.
|
|
32
42
|
|
|
33
43
|
|
|
34
44
|
## [0.1.3]
|
data/README.md
CHANGED
|
@@ -7,6 +7,8 @@ Unofficial, open source implementation of [Flowbite](https://flowbite.com/) comp
|
|
|
7
7
|
|
|
8
8
|
Flowbite Components 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
9
|
|
|
10
|
+
Preview the components at https://flowbite-components.substancelab.com/lookbook/
|
|
11
|
+
|
|
10
12
|
## Features
|
|
11
13
|
|
|
12
14
|
- **Full Flowbite Design System**: Faithful implementation of Flowbite components
|
|
@@ -82,6 +84,8 @@ If you want to use one of the other [Flowbite themes](https://flowbite.com/docs/
|
|
|
82
84
|
<% end %>
|
|
83
85
|
```
|
|
84
86
|
|
|
87
|
+
See more examples at https://flowbite-components.substancelab.com/lookbook/inspect/input_field/inputfield.
|
|
88
|
+
|
|
85
89
|
### Button Examples
|
|
86
90
|
|
|
87
91
|
```erb
|
|
@@ -91,16 +95,18 @@ If you want to use one of the other [Flowbite themes](https://flowbite.com/docs/
|
|
|
91
95
|
<% end %>
|
|
92
96
|
|
|
93
97
|
<!-- Outline button with color -->
|
|
94
|
-
<%= render Flowbite::Button::Outline.new(style: :
|
|
98
|
+
<%= render Flowbite::Button::Outline.new(style: :success) do %>
|
|
95
99
|
Outline Button
|
|
96
100
|
<% end %>
|
|
97
101
|
|
|
98
102
|
<!-- Pill button -->
|
|
99
|
-
<%= render Flowbite::Button::Pill.new(style: :
|
|
103
|
+
<%= render Flowbite::Button::Pill.new(style: :danger) do %>
|
|
100
104
|
Pill Button
|
|
101
105
|
<% end %>
|
|
102
106
|
```
|
|
103
107
|
|
|
108
|
+
See more examples at https://flowbite-components.substancelab.com/lookbook/inspect/button/default.
|
|
109
|
+
|
|
104
110
|
### Custom Input Options
|
|
105
111
|
|
|
106
112
|
```erb
|
|
@@ -118,6 +124,8 @@ If you want to use one of the other [Flowbite themes](https://flowbite.com/docs/
|
|
|
118
124
|
) %>
|
|
119
125
|
```
|
|
120
126
|
|
|
127
|
+
See more examples at https://flowbite-components.substancelab.com/lookbook/inspect/input_field/inputfield.
|
|
128
|
+
|
|
121
129
|
### Custom Labels
|
|
122
130
|
|
|
123
131
|
```erb
|
|
@@ -131,6 +139,8 @@ If you want to use one of the other [Flowbite themes](https://flowbite.com/docs/
|
|
|
131
139
|
) %>
|
|
132
140
|
```
|
|
133
141
|
|
|
142
|
+
See more examples at https://flowbite-components.substancelab.com/lookbook/inspect/input_label/inputlabel.
|
|
143
|
+
|
|
134
144
|
### Disabled and Error States
|
|
135
145
|
|
|
136
146
|
```erb
|
|
@@ -149,6 +159,8 @@ If you want to use one of the other [Flowbite themes](https://flowbite.com/docs/
|
|
|
149
159
|
) %>
|
|
150
160
|
```
|
|
151
161
|
|
|
162
|
+
See more examples at https://flowbite-components.substancelab.com/lookbook/inspect/input_field/disabled_state.
|
|
163
|
+
|
|
152
164
|
## How to customize components
|
|
153
165
|
|
|
154
166
|
### Add specific CSS classes
|
|
@@ -238,7 +250,7 @@ render(Component.new(class: "these are added"))
|
|
|
238
250
|
```
|
|
239
251
|
|
|
240
252
|
This makes for easier customization of components, where you don't have to
|
|
241
|
-
recreate the entire classlist,
|
|
253
|
+
recreate the entire classlist, i.e. in order to increase sizes or add margins or
|
|
242
254
|
whatever.
|
|
243
255
|
|
|
244
256
|
If you want to replace the entire class attribute for a component, pass it as part of the `options` hash, ie
|
|
@@ -276,7 +288,7 @@ This library includes a demo application with previews for all components. To vi
|
|
|
276
288
|
1. cd demo
|
|
277
289
|
2. Run `bundle && npm install`
|
|
278
290
|
3. Run `rails server`
|
|
279
|
-
4. Visit `http://localhost:3000/
|
|
291
|
+
4. Visit `http://localhost:3000/lookbook`
|
|
280
292
|
|
|
281
293
|
## Contributing
|
|
282
294
|
|
|
@@ -296,6 +308,13 @@ Bug reports and pull requests are welcome on GitHub at [https://github.com/subst
|
|
|
296
308
|
- [ViewComponent Documentation](https://viewcomponent.org/)
|
|
297
309
|
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
|
|
298
310
|
|
|
311
|
+
## Other ViewComponent-based libraries
|
|
312
|
+
|
|
313
|
+
If Flowbite isn't your preference, perhaps one of these other component libraries suits you better?
|
|
314
|
+
|
|
315
|
+
* [GOV.UK Components](https://govuk-components.netlify.app/introduction/get-started/)
|
|
316
|
+
* [Primer Product UI for Rails](https://primer.style/product/getting-started/rails/)
|
|
317
|
+
|
|
299
318
|
## Other Flowbite component libraries
|
|
300
319
|
|
|
301
320
|
* https://flowbite-react.com/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Flowbite
|
|
4
|
+
class Breadcrumb
|
|
5
|
+
# Renders a breadcrumb home icon.
|
|
6
|
+
#
|
|
7
|
+
# This is typically used as a prefix icon in the first breadcrumb item,
|
|
8
|
+
# but can be used standalone if needed.
|
|
9
|
+
#
|
|
10
|
+
# @example Standalone usage
|
|
11
|
+
# <%= render Flowbite::Breadcrumb::HomeIcon.new %>
|
|
12
|
+
class HomeIcon < ViewComponent::Base
|
|
13
|
+
def call
|
|
14
|
+
tag.svg(
|
|
15
|
+
class: "w-3 h-3 me-2.5",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
fill: "currentColor",
|
|
19
|
+
viewBox: "0 0 20 20"
|
|
20
|
+
) do
|
|
21
|
+
tag.path(
|
|
22
|
+
d: "m19.707 9.293-2-2-7-7a1 1 0 0 0-1.414 0l-7 7-2 2a1 1 0 0 0 1.414 1.414L2 10.414V18a2 2 0 0 0 2 2h3a1 1 0 0 0 1-1v-4a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v4a1 1 0 0 0 1 1h3a2 2 0 0 0 2-2v-7.586l.293.293a1 1 0 0 0 1.414-1.414Z"
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Flowbite
|
|
4
|
+
class Breadcrumb
|
|
5
|
+
class Item
|
|
6
|
+
# Renders the current page breadcrumb item.
|
|
7
|
+
# Current items are rendered as non-interactive spans with different styling.
|
|
8
|
+
#
|
|
9
|
+
# @param options [Hash] Additional HTML attributes to pass to the span element.
|
|
10
|
+
#
|
|
11
|
+
# @example Current page item
|
|
12
|
+
# <%= render Flowbite::Breadcrumb::Item::Current.new { "Current Page" } %>
|
|
13
|
+
class Current < Item
|
|
14
|
+
def initialize(**options)
|
|
15
|
+
super(href: nil, **options)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
protected
|
|
19
|
+
|
|
20
|
+
def item_options
|
|
21
|
+
{"aria-current": "page"}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def render_link
|
|
25
|
+
link_options = {class: link_classes}.merge(options)
|
|
26
|
+
content_tag(:span, content, **link_options)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def link_classes
|
|
30
|
+
["ms-1", "text-sm", "font-medium", "text-body-subtle"]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Flowbite
|
|
4
|
+
class Breadcrumb
|
|
5
|
+
class Item
|
|
6
|
+
# Renders the first breadcrumb item (typically home).
|
|
7
|
+
# First items don't show a separator icon.
|
|
8
|
+
#
|
|
9
|
+
# @param href [String] The URL for the breadcrumb link.
|
|
10
|
+
# @param options [Hash] Additional HTML attributes to pass to the link element.
|
|
11
|
+
#
|
|
12
|
+
# @example First item
|
|
13
|
+
# <%= render Flowbite::Breadcrumb::Item::First.new(href: "/") { "Home" } %>
|
|
14
|
+
class First < Item
|
|
15
|
+
protected
|
|
16
|
+
|
|
17
|
+
def item_options
|
|
18
|
+
{class: "inline-flex items-center"}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def link_classes
|
|
22
|
+
["text-sm", "font-medium", "inline-flex", "items-center", "text-body", "hover:text-fg-brand"]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def prefix_icon
|
|
26
|
+
nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def render_link
|
|
30
|
+
icon = render(Flowbite::Breadcrumb::HomeIcon.new)
|
|
31
|
+
link_options = {class: link_classes}.merge(options)
|
|
32
|
+
content_tag(:a, safe_join([icon, content]), href: href, **link_options)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Flowbite
|
|
4
|
+
class Breadcrumb
|
|
5
|
+
# Base class for rendering a breadcrumb item (middle items in the breadcrumb trail).
|
|
6
|
+
#
|
|
7
|
+
# @param href [String] The URL for the breadcrumb link.
|
|
8
|
+
# @param options [Hash] Additional HTML attributes to pass to the link element.
|
|
9
|
+
#
|
|
10
|
+
# @example Middle item
|
|
11
|
+
# <%= render Flowbite::Breadcrumb::Item.new(href: "/projects") { "Projects" } %>
|
|
12
|
+
class Item < ViewComponent::Base
|
|
13
|
+
attr_reader :href, :options
|
|
14
|
+
|
|
15
|
+
def initialize(href:, **options)
|
|
16
|
+
super()
|
|
17
|
+
@href = href
|
|
18
|
+
@options = options
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def call
|
|
22
|
+
content_tag(:li, item_options) do
|
|
23
|
+
content_tag(:div, class: "flex items-center") do
|
|
24
|
+
concat(render(prefix_icon)) if prefix_icon
|
|
25
|
+
concat(render_link)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
protected
|
|
31
|
+
|
|
32
|
+
def item_options
|
|
33
|
+
{}
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def prefix_icon
|
|
37
|
+
Flowbite::Breadcrumb::SeparatorIcon.new
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def render_link
|
|
41
|
+
link_options = {class: link_classes}.merge(options)
|
|
42
|
+
content_tag(:a, content, href: href, **link_options)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def link_classes
|
|
46
|
+
["ms-1", "text-sm", "font-medium", "text-body", "hover:text-fg-brand"]
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Flowbite
|
|
4
|
+
class Breadcrumb
|
|
5
|
+
# Renders a breadcrumb separator icon.
|
|
6
|
+
#
|
|
7
|
+
# This is automatically used by Breadcrumb::Item components, but can be
|
|
8
|
+
# used standalone if needed.
|
|
9
|
+
#
|
|
10
|
+
# @example Standalone usage
|
|
11
|
+
# <%= render Flowbite::Breadcrumb::SeparatorIcon.new %>
|
|
12
|
+
class SeparatorIcon < ViewComponent::Base
|
|
13
|
+
def call
|
|
14
|
+
tag.svg(
|
|
15
|
+
class: "w-3.5 h-3.5 rtl:rotate-180 text-body",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18
|
+
fill: "none",
|
|
19
|
+
height: 24,
|
|
20
|
+
viewBox: "0 0 24 24",
|
|
21
|
+
width: 24
|
|
22
|
+
) do
|
|
23
|
+
tag.path(
|
|
24
|
+
stroke: "currentColor",
|
|
25
|
+
"stroke-linecap": "round",
|
|
26
|
+
"stroke-linejoin": "round",
|
|
27
|
+
"stroke-width": "2",
|
|
28
|
+
d: "m9 5 7 7-7 7"
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Flowbite
|
|
4
|
+
# Renders a breadcrumb navigation component.
|
|
5
|
+
#
|
|
6
|
+
# Use {Flowbite::Breadcrumb} and the child {Flowbite::Breadcrumb::Item}
|
|
7
|
+
# components to create and indicate a series of page structure and URLs to
|
|
8
|
+
# help the user navigate through the website.
|
|
9
|
+
#
|
|
10
|
+
# Breadcrumbs consist of the following components:
|
|
11
|
+
#
|
|
12
|
+
# - {Flowbite::Breadcrumb}: Container for breadcrumb items.
|
|
13
|
+
# - {Flowbite::Breadcrumb::HomeIcon}: Home icon for the first breadcrumb item.
|
|
14
|
+
# - {Flowbite::Breadcrumb::SeparatorIcon}: Separator between breadcrumb items.
|
|
15
|
+
# - {Flowbite::Breadcrumb::Item}: An individual breadcrumb item.
|
|
16
|
+
# - {Flowbite::Breadcrumb::Item::Current}: An individual breadcrumb item
|
|
17
|
+
# without a link, usually used for the current page in the breadcrumb trail.
|
|
18
|
+
# - {Flowbite::Breadcrumb::Item::First}: An individual breadcrumb item with a
|
|
19
|
+
# home icon on it.
|
|
20
|
+
#
|
|
21
|
+
# @example Usage
|
|
22
|
+
# <%= render(Flowbite::Breadcrumb.new) do |breadcrumb| %>
|
|
23
|
+
# <% breadcrumb.with_item do %>
|
|
24
|
+
# <%= render(Flowbite::Breadcrumb::Item::First.new(href: "/")) { "Root page" } %>
|
|
25
|
+
# <% end %>
|
|
26
|
+
# <% breadcrumb.with_item do %>
|
|
27
|
+
# <%= render(Flowbite::Breadcrumb::Item.new(href: "/projects")) { "Parent page" } %>
|
|
28
|
+
# <% end %>
|
|
29
|
+
# <% breadcrumb.with_item do %>
|
|
30
|
+
# <%= render(Flowbite::Breadcrumb::Item::Current.new) { "Current Page" } %>
|
|
31
|
+
# <% end %>
|
|
32
|
+
# <% end %>
|
|
33
|
+
#
|
|
34
|
+
# @viewcomponent_slot [Flowbite::Breadcrumb::Item] items The items of the
|
|
35
|
+
# breadcrumb trail. Use {Flowbite::Breadcrumb::Item::First} for the first
|
|
36
|
+
# item to get a home icon, and {Flowbite::Breadcrumb::Item::Current} for the
|
|
37
|
+
# last item to render it without a link.
|
|
38
|
+
#
|
|
39
|
+
# @lookbook_embed BreadcrumbPreview
|
|
40
|
+
# @see https://flowbite.com/docs/components/breadcrumb/
|
|
41
|
+
class Breadcrumb < ViewComponent::Base
|
|
42
|
+
renders_many :items
|
|
43
|
+
|
|
44
|
+
def call
|
|
45
|
+
content_tag(:nav, class: "flex", "aria-label": "Breadcrumb") do
|
|
46
|
+
content_tag(:ol, class: "inline-flex items-center space-x-1 md:space-x-2 rtl:space-x-reverse") do
|
|
47
|
+
items.each do |item|
|
|
48
|
+
concat(item)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
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.
|
|
4
|
+
# Renders a HTML button element. See https://flowbite.com/docs/components/buttons/
|
|
9
5
|
#
|
|
10
6
|
# All other parameters are optional and are passed directly to the button tag
|
|
11
7
|
# as HTML attributes.
|
|
8
|
+
#
|
|
9
|
+
# @example Basic usage
|
|
10
|
+
# <%= render Flowbite::Button.new { "Click me" } %>
|
|
11
|
+
#
|
|
12
|
+
# @lookbook_embed ButtonPreview
|
|
12
13
|
class Button < ViewComponent::Base
|
|
13
14
|
SIZES = {
|
|
14
15
|
xs: ["text-xs", "px-3", "py-1.5"],
|
|
@@ -3,7 +3,21 @@
|
|
|
3
3
|
module Flowbite
|
|
4
4
|
# Renders a card element.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
6
|
+
# To render a title in the card, use the title argument or the title slot.
|
|
7
|
+
#
|
|
8
|
+
# @example Using the title slot
|
|
9
|
+
# <%= render(Flowbite::Card.new) do |card| %>
|
|
10
|
+
# <% card.with_title do %>
|
|
11
|
+
# <div><%= parent_category.name %></div>
|
|
12
|
+
# <%= render(Flowbite::Card::Title.new) { category.name } %>
|
|
13
|
+
# <% end %>
|
|
14
|
+
# <% end %>
|
|
15
|
+
#
|
|
16
|
+
# @viewcomponent_slot [Flowbite::Card::Title] title The title of the card,
|
|
17
|
+
# rendered at the top. Use +with_title+ to set custom content.
|
|
18
|
+
#
|
|
19
|
+
# @see https://flowbite.com/docs/components/cards/
|
|
20
|
+
# @lookbook_embed CardPreview
|
|
7
21
|
class Card < ViewComponent::Base
|
|
8
22
|
renders_one :title
|
|
9
23
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Flowbite
|
|
4
|
-
|
|
4
|
+
class Input
|
|
5
5
|
# The checkbox component can be used to receive one or more selected options
|
|
6
6
|
# from the user in the form of a square box available in multiple styles,
|
|
7
7
|
# sizes, colors, and variants coded with the utility classes from Tailwind
|
|
8
8
|
# CSS and with support for dark mode.
|
|
9
9
|
#
|
|
10
10
|
# https://flowbite.com/docs/forms/checkbox/
|
|
11
|
-
class Checkbox <
|
|
11
|
+
class Checkbox < Input
|
|
12
12
|
DEFAULT_CHECKED_VALUE = "1"
|
|
13
13
|
DEFAULT_UNCHECKED_VALUE = "0"
|
|
14
14
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Flowbite
|
|
4
|
-
|
|
4
|
+
class Input
|
|
5
|
+
# A hint element for input fields.
|
|
6
|
+
#
|
|
7
|
+
# Provides additional context or instructions for the user.
|
|
8
|
+
#
|
|
9
|
+
# See https://flowbite.com/docs/forms/input-field/#helper-text
|
|
5
10
|
class Hint < ViewComponent::Base
|
|
6
11
|
STATES = [
|
|
7
12
|
DEFAULT = :default
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Flowbite
|
|
4
|
-
|
|
4
|
+
class Input
|
|
5
5
|
# The radio button component can be used to allow the user to choose a
|
|
6
6
|
# single option from one or more available options.
|
|
7
7
|
#
|
|
8
8
|
# https://flowbite.com/docs/forms/radio/
|
|
9
|
-
class RadioButton <
|
|
9
|
+
class RadioButton < Input
|
|
10
10
|
class << self
|
|
11
11
|
# Radio buttons only have their default size.
|
|
12
12
|
def sizes
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Flowbite
|
|
4
|
-
|
|
4
|
+
class Input
|
|
5
5
|
# The `Select` component renders a select input field for use in forms.
|
|
6
6
|
#
|
|
7
7
|
# https://flowbite.com/docs/forms/select/
|
|
8
8
|
#
|
|
9
9
|
# Wraps `ActionView::Helpers::FormOptionsHelper#select`: https://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-select
|
|
10
|
-
class Select <
|
|
10
|
+
class Select < Input
|
|
11
11
|
SIZES = {
|
|
12
12
|
sm: ["px-2.5", "py-2", "text-sm"],
|
|
13
13
|
default: ["px-3", "py-2.5", "text-sm"],
|