daisyui 1.0.1 → 1.0.3
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/lib/daisy_ui/alert.rb +0 -6
- data/lib/daisy_ui/avatar.rb +0 -6
- data/lib/daisy_ui/avatar_group.rb +2 -6
- data/lib/daisy_ui/badge.rb +0 -2
- data/lib/daisy_ui/base.rb +59 -14
- data/lib/daisy_ui/breadcrumbs.rb +4 -8
- data/lib/daisy_ui/calendar.rb +2 -2
- data/lib/daisy_ui/card.rb +6 -6
- data/lib/daisy_ui/carousel.rb +2 -6
- data/lib/daisy_ui/chat.rb +8 -12
- data/lib/daisy_ui/collapse.rb +5 -7
- data/lib/daisy_ui/collapsible_sub_menu.rb +9 -15
- data/lib/daisy_ui/configurable.rb +2 -0
- data/lib/daisy_ui/diff.rb +6 -6
- data/lib/daisy_ui/divider.rb +0 -4
- data/lib/daisy_ui/dock.rb +2 -6
- data/lib/daisy_ui/drawer.rb +14 -6
- data/lib/daisy_ui/dropdown.rb +16 -14
- data/lib/daisy_ui/fab.rb +4 -8
- data/lib/daisy_ui/fieldset.rb +2 -2
- data/lib/daisy_ui/filter.rb +3 -7
- data/lib/daisy_ui/footer.rb +2 -2
- data/lib/daisy_ui/form_control.rb +0 -4
- data/lib/daisy_ui/hero.rb +4 -8
- data/lib/daisy_ui/indicator.rb +2 -6
- data/lib/daisy_ui/join.rb +3 -5
- data/lib/daisy_ui/label.rb +2 -2
- data/lib/daisy_ui/list.rb +2 -2
- data/lib/daisy_ui/loading.rb +0 -2
- data/lib/daisy_ui/mask.rb +0 -6
- data/lib/daisy_ui/menu.rb +4 -6
- data/lib/daisy_ui/menu_item.rb +5 -7
- data/lib/daisy_ui/mockup_browser.rb +2 -6
- data/lib/daisy_ui/mockup_code.rb +0 -4
- data/lib/daisy_ui/mockup_phone.rb +4 -8
- data/lib/daisy_ui/mockup_window.rb +0 -4
- data/lib/daisy_ui/modal.rb +8 -10
- data/lib/daisy_ui/navbar.rb +6 -6
- data/lib/daisy_ui/pagination.rb +2 -6
- data/lib/daisy_ui/rating.rb +0 -4
- data/lib/daisy_ui/skeleton.rb +0 -6
- data/lib/daisy_ui/stack.rb +0 -4
- data/lib/daisy_ui/stat.rb +12 -16
- data/lib/daisy_ui/steps.rb +4 -4
- data/lib/daisy_ui/sub_menu.rb +7 -7
- data/lib/daisy_ui/swap.rb +6 -6
- data/lib/daisy_ui/tab.rb +6 -6
- data/lib/daisy_ui/tab_with_content.rb +9 -2
- data/lib/daisy_ui/tab_without_content.rb +0 -2
- data/lib/daisy_ui/table.rb +8 -10
- data/lib/daisy_ui/table_row.rb +5 -7
- data/lib/daisy_ui/tabs.rb +8 -3
- data/lib/daisy_ui/theme_controller.rb +2 -2
- data/lib/daisy_ui/timeline.rb +6 -6
- data/lib/daisy_ui/toast.rb +0 -4
- data/lib/daisy_ui/validator.rb +1 -1
- data/lib/daisy_ui/version.rb +1 -1
- data/lib/daisy_ui.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0dfd69755019e48481d090083a5165c37b04d50af7d76b145a2f76dae4ebb594
|
|
4
|
+
data.tar.gz: c4b804a2a61d7018f6db355629b9d90525dfe89508b63a236829d7dcd72e25a6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 976568cac60b3cb8ce9ce4d1270630660dd60507447c6e4304336f7c58296204a84acbc4ccc41dc628f17b77180cf5b75a6889d28ce7a3f424aba064a0914183
|
|
7
|
+
data.tar.gz: b7c07d86fe55bc2722e6730dcd021197d8f98b13e54d0560736bc7e97d57f38bd1bd6da028ee7fc99f5ddb1c5077093094bf2c67205e04a7697e7bcad3f02f0c
|
data/lib/daisy_ui/alert.rb
CHANGED
|
@@ -4,16 +4,10 @@ module DaisyUI
|
|
|
4
4
|
class Alert < Base
|
|
5
5
|
self.component_class = :alert
|
|
6
6
|
|
|
7
|
-
def initialize(*, as: :div, **)
|
|
8
|
-
super
|
|
9
|
-
end
|
|
10
|
-
|
|
11
7
|
def view_template(&)
|
|
12
8
|
public_send(as, role: :alert, class: classes, **attributes, &)
|
|
13
9
|
end
|
|
14
10
|
|
|
15
|
-
private
|
|
16
|
-
|
|
17
11
|
register_modifiers(
|
|
18
12
|
# "sm:alert-info"
|
|
19
13
|
# "@sm:alert-info"
|
data/lib/daisy_ui/avatar.rb
CHANGED
|
@@ -4,16 +4,10 @@ module DaisyUI
|
|
|
4
4
|
class Avatar < Base
|
|
5
5
|
self.component_class = :avatar
|
|
6
6
|
|
|
7
|
-
def initialize(*, as: :div, **)
|
|
8
|
-
super
|
|
9
|
-
end
|
|
10
|
-
|
|
11
7
|
def view_template(&)
|
|
12
8
|
public_send(as, class: classes, **attributes, &)
|
|
13
9
|
end
|
|
14
10
|
|
|
15
|
-
private
|
|
16
|
-
|
|
17
11
|
register_modifiers(
|
|
18
12
|
# "sm:online"
|
|
19
13
|
# "@sm:online"
|
|
@@ -4,16 +4,12 @@ module DaisyUI
|
|
|
4
4
|
class AvatarGroup < Base
|
|
5
5
|
self.component_class = "avatar-group"
|
|
6
6
|
|
|
7
|
-
def initialize(*, as: :div, **)
|
|
8
|
-
super
|
|
9
|
-
end
|
|
10
|
-
|
|
11
7
|
def view_template(&)
|
|
12
8
|
public_send(as, class: classes, **attributes, &)
|
|
13
9
|
end
|
|
14
10
|
|
|
15
|
-
def avatar(
|
|
16
|
-
render DaisyUI::Avatar.new(
|
|
11
|
+
def avatar(...)
|
|
12
|
+
render DaisyUI::Avatar.new(...)
|
|
17
13
|
end
|
|
18
14
|
end
|
|
19
15
|
end
|
data/lib/daisy_ui/badge.rb
CHANGED
data/lib/daisy_ui/base.rb
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module DaisyUI
|
|
4
|
+
# Base class for all DaisyUI components.
|
|
5
|
+
#
|
|
6
|
+
# ## Architecture Overview
|
|
7
|
+
#
|
|
8
|
+
# Components accept three types of arguments:
|
|
9
|
+
# 1. **Modifiers** - Positional symbol arguments that map to DaisyUI CSS classes
|
|
10
|
+
# Example: Dropdown.new(:top, :hover) → "dropdown-top dropdown-hover"
|
|
11
|
+
#
|
|
12
|
+
# 2. **Options** - Keyword arguments for the component (as:, id:)
|
|
13
|
+
# Example: Dropdown.new(as: :div, id: "my-dropdown")
|
|
14
|
+
#
|
|
15
|
+
# 3. **Attributes** - Additional keyword arguments for HTML attributes (data:, aria:, class:)
|
|
16
|
+
# Example: Dropdown.new(data: {controller: "dropdown"}, class: "my-custom-class")
|
|
17
|
+
#
|
|
18
|
+
# ## Key Methods
|
|
19
|
+
#
|
|
20
|
+
# - `classes` - Builds the final CSS class string by combining base class,
|
|
21
|
+
# modifiers, responsive classes, and user-provided classes. DESTRUCTIVELY
|
|
22
|
+
# removes :class from options.
|
|
23
|
+
#
|
|
24
|
+
# - `attributes` - Returns the hash of HTML attributes to splat into the element.
|
|
25
|
+
# By default includes all remaining options (after :class was removed) plus :id.
|
|
26
|
+
# Override in subclasses if different behavior is needed.
|
|
27
|
+
#
|
|
28
|
+
# ## Typical Usage Pattern
|
|
29
|
+
#
|
|
30
|
+
# In a component's view_template:
|
|
31
|
+
# def view_template(&)
|
|
32
|
+
# div(class: classes, **attributes, &)
|
|
33
|
+
# end
|
|
34
|
+
#
|
|
35
|
+
# This renders: <div class="[generated classes]" id="..." data-...="..." ...>
|
|
36
|
+
#
|
|
4
37
|
class Base < Phlex::HTML
|
|
38
|
+
BOOLS = [true, false].freeze
|
|
5
39
|
# Shared color modifiers used across multiple components
|
|
6
40
|
# Maps color names to their DaisyUI background/text class combinations
|
|
7
41
|
COLOR_MODIFIERS = {
|
|
@@ -105,9 +139,9 @@ module DaisyUI
|
|
|
105
139
|
super
|
|
106
140
|
subclass.modifiers = (modifiers || {}).dup
|
|
107
141
|
# Inherit component_class if it was explicitly set
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
142
|
+
return unless instance_variable_defined?(:@component_class)
|
|
143
|
+
|
|
144
|
+
subclass.component_class = @component_class
|
|
111
145
|
end
|
|
112
146
|
|
|
113
147
|
def register_modifiers(mods)
|
|
@@ -122,7 +156,10 @@ module DaisyUI
|
|
|
122
156
|
@modifiers = modifiers + boolean_modifiers
|
|
123
157
|
@as = as
|
|
124
158
|
@id = id
|
|
159
|
+
# Store all keyword arguments (class, data, aria, etc.)
|
|
160
|
+
# This will be processed by `classes` and `attributes` methods
|
|
125
161
|
@options = options
|
|
162
|
+
super()
|
|
126
163
|
end
|
|
127
164
|
|
|
128
165
|
private
|
|
@@ -130,6 +167,15 @@ module DaisyUI
|
|
|
130
167
|
attr_reader :modifiers, :options, :as, :id
|
|
131
168
|
|
|
132
169
|
# Main extension points - override these in your project!
|
|
170
|
+
|
|
171
|
+
# Builds the final CSS class string from:
|
|
172
|
+
# 1. Component base class (e.g., "dropdown")
|
|
173
|
+
# 2. Modifier classes (e.g., "dropdown-top")
|
|
174
|
+
# 3. Responsive classes (e.g., "sm:dropdown-hover")
|
|
175
|
+
# 4. User-provided classes via `class:` option
|
|
176
|
+
#
|
|
177
|
+
# Note: This method DESTRUCTIVELY removes :class from options
|
|
178
|
+
# so it won't appear again in attributes
|
|
133
179
|
def classes
|
|
134
180
|
merge_classes(
|
|
135
181
|
base_class,
|
|
@@ -139,8 +185,15 @@ module DaisyUI
|
|
|
139
185
|
)
|
|
140
186
|
end
|
|
141
187
|
|
|
188
|
+
# Returns the hash of HTML attributes to splat into the element.
|
|
189
|
+
# By default, includes all options (except :class which was removed by `classes`)
|
|
190
|
+
# and adds :id if provided.
|
|
191
|
+
#
|
|
192
|
+
# Override this method in subclasses if you need different behavior.
|
|
193
|
+
# For example, Drawer overrides this to exclude :id because it uses
|
|
194
|
+
# id internally for toggle/overlay elements.
|
|
142
195
|
def attributes
|
|
143
|
-
|
|
196
|
+
options.dup.merge(id: id).compact
|
|
144
197
|
end
|
|
145
198
|
|
|
146
199
|
# Simple defaults - easy to override
|
|
@@ -149,16 +202,10 @@ module DaisyUI
|
|
|
149
202
|
result.empty? ? nil : result
|
|
150
203
|
end
|
|
151
204
|
|
|
152
|
-
def merge_attributes(**attrs)
|
|
153
|
-
attrs
|
|
154
|
-
end
|
|
155
|
-
|
|
156
205
|
# Core functionality
|
|
157
206
|
def base_class
|
|
158
207
|
# If responsive option includes `true`, base class should only appear with responsive prefix
|
|
159
|
-
if options[:responsive]&.values&.any? { |mods| Array(mods).include?(true) }
|
|
160
|
-
return nil
|
|
161
|
-
end
|
|
208
|
+
return nil if options[:responsive]&.values&.any? { |mods| Array(mods).include?(true) }
|
|
162
209
|
|
|
163
210
|
apply_prefix(self.class.component_class&.to_s)
|
|
164
211
|
end
|
|
@@ -206,9 +253,7 @@ module DaisyUI
|
|
|
206
253
|
boolean_mods = []
|
|
207
254
|
|
|
208
255
|
modifier_keys.each do |key|
|
|
209
|
-
if options.key?(key) && (options[key]
|
|
210
|
-
boolean_mods << key if options.delete(key) == true
|
|
211
|
-
end
|
|
256
|
+
boolean_mods << key if options.key?(key) && BOOLS.include?(options[key]) && (options.delete(key) == true)
|
|
212
257
|
end
|
|
213
258
|
|
|
214
259
|
boolean_mods
|
data/lib/daisy_ui/breadcrumbs.rb
CHANGED
|
@@ -4,21 +4,17 @@ module DaisyUI
|
|
|
4
4
|
class Breadcrumbs < Base
|
|
5
5
|
self.component_class = :breadcrumbs
|
|
6
6
|
|
|
7
|
-
def initialize(*, as: :div, **)
|
|
8
|
-
super
|
|
9
|
-
end
|
|
10
|
-
|
|
11
7
|
def view_template(&)
|
|
12
8
|
public_send(as, class: classes, **attributes) do
|
|
13
9
|
ul(&)
|
|
14
10
|
end
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
def crumb(**
|
|
18
|
-
li(class: component_classes(options:
|
|
13
|
+
def crumb(**options, &)
|
|
14
|
+
li(class: component_classes(options: options), **options, &)
|
|
19
15
|
end
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
alias breadcrumb crumb
|
|
17
|
+
alias item crumb
|
|
22
18
|
|
|
23
19
|
register_modifiers({})
|
|
24
20
|
end
|
data/lib/daisy_ui/calendar.rb
CHANGED
data/lib/daisy_ui/card.rb
CHANGED
|
@@ -12,16 +12,16 @@ module DaisyUI
|
|
|
12
12
|
public_send(as, class: classes, **attributes, &)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def body(**
|
|
16
|
-
div(class: component_classes("card-body", options:
|
|
15
|
+
def body(**options, &)
|
|
16
|
+
div(class: component_classes("card-body", options:), **options, &)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def title(**
|
|
20
|
-
header(class: component_classes("card-title", options:
|
|
19
|
+
def title(**options, &)
|
|
20
|
+
header(class: component_classes("card-title", options:), **options, &)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def actions(**
|
|
24
|
-
footer(class: component_classes("card-actions", options:
|
|
23
|
+
def actions(**options, &)
|
|
24
|
+
footer(class: component_classes("card-actions", options:), **options, &)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
register_modifiers(
|
data/lib/daisy_ui/carousel.rb
CHANGED
|
@@ -5,16 +5,12 @@ module DaisyUI
|
|
|
5
5
|
class Carousel < Base
|
|
6
6
|
self.component_class = :carousel
|
|
7
7
|
|
|
8
|
-
def initialize(*, as: :div, **)
|
|
9
|
-
super
|
|
10
|
-
end
|
|
11
|
-
|
|
12
8
|
def view_template(&)
|
|
13
9
|
public_send(as, class: classes, **attributes, &)
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
def item(**
|
|
17
|
-
div(class: component_classes("carousel-item", options:
|
|
12
|
+
def item(**options, &)
|
|
13
|
+
div(class: component_classes("carousel-item", options:), **options, &)
|
|
18
14
|
end
|
|
19
15
|
|
|
20
16
|
register_modifiers(
|
data/lib/daisy_ui/chat.rb
CHANGED
|
@@ -5,28 +5,24 @@ module DaisyUI
|
|
|
5
5
|
class Chat < Base
|
|
6
6
|
self.component_class = :chat
|
|
7
7
|
|
|
8
|
-
def initialize(*, as: :div, **)
|
|
9
|
-
super
|
|
10
|
-
end
|
|
11
|
-
|
|
12
8
|
def view_template(&)
|
|
13
9
|
public_send(as, class: classes, **attributes, &)
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
def image(**
|
|
17
|
-
div(class: component_classes("chat-image", options:
|
|
12
|
+
def image(**options, &)
|
|
13
|
+
div(class: component_classes("chat-image", options:), **options, &)
|
|
18
14
|
end
|
|
19
15
|
|
|
20
|
-
def header(**
|
|
21
|
-
div(class: component_classes("chat-header", options:
|
|
16
|
+
def header(**options, &)
|
|
17
|
+
div(class: component_classes("chat-header", options:), **options, &)
|
|
22
18
|
end
|
|
23
19
|
|
|
24
|
-
def bubble(**
|
|
25
|
-
div(class: component_classes("chat-bubble", options:
|
|
20
|
+
def bubble(**options, &)
|
|
21
|
+
div(class: component_classes("chat-bubble", options:), **options, &)
|
|
26
22
|
end
|
|
27
23
|
|
|
28
|
-
def footer(**
|
|
29
|
-
div(class: component_classes("chat-footer", options:
|
|
24
|
+
def footer(**options, &)
|
|
25
|
+
div(class: component_classes("chat-footer", options:), **options, &)
|
|
30
26
|
end
|
|
31
27
|
|
|
32
28
|
register_modifiers(
|
data/lib/daisy_ui/collapse.rb
CHANGED
|
@@ -3,20 +3,18 @@
|
|
|
3
3
|
module DaisyUI
|
|
4
4
|
# @component html class="collapse"
|
|
5
5
|
class Collapse < Base
|
|
6
|
-
|
|
7
|
-
super
|
|
8
|
-
end
|
|
6
|
+
self.component_class = :collapse
|
|
9
7
|
|
|
10
8
|
def view_template(&)
|
|
11
9
|
public_send(as, class: classes, **attributes, &)
|
|
12
10
|
end
|
|
13
11
|
|
|
14
|
-
def title(**
|
|
15
|
-
div(class: component_classes("collapse-title", options:
|
|
12
|
+
def title(**options, &)
|
|
13
|
+
div(class: component_classes("collapse-title", options:), **options, &)
|
|
16
14
|
end
|
|
17
15
|
|
|
18
|
-
def content(**
|
|
19
|
-
div(class: component_classes("collapse-content", options:
|
|
16
|
+
def content(**options, &)
|
|
17
|
+
div(class: component_classes("collapse-content", options:), **options, &)
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
register_modifiers(
|
|
@@ -18,12 +18,10 @@ module DaisyUI
|
|
|
18
18
|
details_attrs[:open] = true if modifiers.include?(:open) || options.delete(:open) == true
|
|
19
19
|
|
|
20
20
|
details(**details_attrs) do
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
else
|
|
26
|
-
raise ArgumentError, "A collapsible submenu requires a title"
|
|
21
|
+
raise ArgumentError, "A collapsible submenu requires a title" unless @title
|
|
22
|
+
|
|
23
|
+
summary do
|
|
24
|
+
render @title
|
|
27
25
|
end
|
|
28
26
|
|
|
29
27
|
if @items.any?
|
|
@@ -37,18 +35,14 @@ module DaisyUI
|
|
|
37
35
|
end
|
|
38
36
|
|
|
39
37
|
def title(&block)
|
|
40
|
-
if @title
|
|
41
|
-
raise ArgumentError, "A collapsible submenu can only have one title"
|
|
42
|
-
else
|
|
43
|
-
@title = block
|
|
44
|
-
end
|
|
45
|
-
end
|
|
38
|
+
raise ArgumentError, "A collapsible submenu can only have one title" if @title
|
|
46
39
|
|
|
47
|
-
|
|
48
|
-
@items << MenuItem.new(*, **, &)
|
|
40
|
+
@title = block
|
|
49
41
|
end
|
|
50
42
|
|
|
51
|
-
|
|
43
|
+
def item(...)
|
|
44
|
+
@items << MenuItem.new(...)
|
|
45
|
+
end
|
|
52
46
|
|
|
53
47
|
register_modifiers(COLOR_MODIFIERS)
|
|
54
48
|
end
|
data/lib/daisy_ui/diff.rb
CHANGED
|
@@ -13,16 +13,16 @@ module DaisyUI
|
|
|
13
13
|
public_send(as, class: classes, **attributes, &)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def item_1(**
|
|
17
|
-
div(class: component_classes("diff-item-1", options:
|
|
16
|
+
def item_1(**options, &)
|
|
17
|
+
div(class: component_classes("diff-item-1", options:), **options, &)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def item_2(**
|
|
21
|
-
div(class: component_classes("diff-item-2", options:
|
|
20
|
+
def item_2(**options, &)
|
|
21
|
+
div(class: component_classes("diff-item-2", options:), **options, &)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def resizer(**
|
|
25
|
-
div(class: component_classes("diff-resizer", options:
|
|
24
|
+
def resizer(**options, &)
|
|
25
|
+
div(class: component_classes("diff-resizer", options:), **options, &)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
data/lib/daisy_ui/divider.rb
CHANGED
data/lib/daisy_ui/dock.rb
CHANGED
|
@@ -5,16 +5,12 @@ module DaisyUI
|
|
|
5
5
|
class Dock < Base
|
|
6
6
|
self.component_class = :dock
|
|
7
7
|
|
|
8
|
-
def initialize(*, as: :div, **)
|
|
9
|
-
super
|
|
10
|
-
end
|
|
11
|
-
|
|
12
8
|
def view_template(&)
|
|
13
9
|
public_send(as, class: classes, **attributes, &)
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
def label(**
|
|
17
|
-
span(class: component_classes("dock-label", options:
|
|
12
|
+
def label(**options, &)
|
|
13
|
+
span(class: component_classes("dock-label", options:), **options, &)
|
|
18
14
|
end
|
|
19
15
|
|
|
20
16
|
register_modifiers(
|
data/lib/daisy_ui/drawer.rb
CHANGED
|
@@ -13,21 +13,21 @@ module DaisyUI
|
|
|
13
13
|
public_send(as, class: classes, **attributes, &)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def toggle(**
|
|
17
|
-
toggle_classes = component_classes("drawer-toggle", options:
|
|
18
|
-
input(id:, type: :checkbox, class: toggle_classes, **
|
|
16
|
+
def toggle(**options, &)
|
|
17
|
+
toggle_classes = component_classes("drawer-toggle", options:)
|
|
18
|
+
input(id:, type: :checkbox, class: toggle_classes, **options, &)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def content(as: :div, **options, &)
|
|
22
|
-
public_send(as, class: component_classes("drawer-content", options:
|
|
22
|
+
public_send(as, class: component_classes("drawer-content", options:), **options, &)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def side(as: :div, **options, &)
|
|
26
|
-
public_send(as, class: component_classes("drawer-side", options:
|
|
26
|
+
public_send(as, class: component_classes("drawer-side", options:), **options, &)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def overlay(**options, &)
|
|
30
|
-
overlay_classes = component_classes("drawer-overlay", options:
|
|
30
|
+
overlay_classes = component_classes("drawer-overlay", options:)
|
|
31
31
|
label(for: id, class: overlay_classes, **options, &)
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -37,6 +37,14 @@ module DaisyUI
|
|
|
37
37
|
|
|
38
38
|
private
|
|
39
39
|
|
|
40
|
+
# Override Base#attributes to exclude :id from the main drawer element.
|
|
41
|
+
# The Drawer component requires an :id parameter, but it's used internally
|
|
42
|
+
# to wire up the toggle checkbox, overlay, and button elements - NOT for
|
|
43
|
+
# the main drawer container.
|
|
44
|
+
def attributes
|
|
45
|
+
options
|
|
46
|
+
end
|
|
47
|
+
|
|
40
48
|
register_modifiers(
|
|
41
49
|
# "sm:drawer-end"
|
|
42
50
|
# "@sm:drawer-end"
|
data/lib/daisy_ui/dropdown.rb
CHANGED
|
@@ -4,12 +4,12 @@ module DaisyUI
|
|
|
4
4
|
class Dropdown < Base
|
|
5
5
|
self.component_class = :dropdown
|
|
6
6
|
|
|
7
|
-
def initialize(
|
|
7
|
+
def initialize(*modifiers, as: :div, id: nil, **options)
|
|
8
8
|
super
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def view_template(&)
|
|
12
|
-
if
|
|
12
|
+
if tap_to_close?
|
|
13
13
|
details(class: classes, **attributes, &)
|
|
14
14
|
else
|
|
15
15
|
public_send(as, class: classes, **attributes, &)
|
|
@@ -17,34 +17,36 @@ module DaisyUI
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def button(*, **, &)
|
|
20
|
-
if
|
|
20
|
+
if tap_to_close?
|
|
21
21
|
render Button.new(*, as: :summary, **, &)
|
|
22
22
|
else
|
|
23
23
|
render Button.new(*, as: :div, role: :button, tabindex: 0, **, &)
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
-
def content(*, as: :div, **
|
|
28
|
-
content_classes = component_classes("dropdown-content", options:
|
|
27
|
+
def content(*, as: :div, **options, &)
|
|
28
|
+
content_classes = component_classes("dropdown-content", options:)
|
|
29
29
|
|
|
30
|
-
if
|
|
31
|
-
render_as(*, as:, class: content_classes, **
|
|
30
|
+
if tap_to_close?
|
|
31
|
+
render_as(*, as:, class: content_classes, **options, &)
|
|
32
32
|
else
|
|
33
|
-
render_as(*, as:, tabindex: 0, class: content_classes, **
|
|
33
|
+
render_as(*, as:, tabindex: 0, class: content_classes, **options, &)
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
def menu(*, **
|
|
38
|
-
menu_classes = component_classes("dropdown-content", options:
|
|
37
|
+
def menu(*, **options, &)
|
|
38
|
+
menu_classes = component_classes("dropdown-content", options:)
|
|
39
39
|
|
|
40
|
-
if
|
|
41
|
-
render Menu.new(*, class: menu_classes, **
|
|
40
|
+
if tap_to_close?
|
|
41
|
+
render Menu.new(*, class: menu_classes, **options, &)
|
|
42
42
|
else
|
|
43
|
-
render Menu.new(*, tabindex: 0, class: menu_classes, **
|
|
43
|
+
render Menu.new(*, tabindex: 0, class: menu_classes, **options, &)
|
|
44
44
|
end
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
def tap_to_close?
|
|
48
|
+
modifiers.include?(:tap_to_close)
|
|
49
|
+
end
|
|
48
50
|
|
|
49
51
|
register_modifiers(
|
|
50
52
|
# "sm:dropdown-end"
|
data/lib/daisy_ui/fab.rb
CHANGED
|
@@ -5,20 +5,16 @@ module DaisyUI
|
|
|
5
5
|
class Fab < Base
|
|
6
6
|
self.component_class = :fab
|
|
7
7
|
|
|
8
|
-
def initialize(*, as: :div, **)
|
|
9
|
-
super
|
|
10
|
-
end
|
|
11
|
-
|
|
12
8
|
def view_template(&)
|
|
13
9
|
public_send(as, class: classes, **attributes, &)
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
def close(**
|
|
17
|
-
div(class: component_classes("fab-close", options:
|
|
12
|
+
def close(**options, &)
|
|
13
|
+
div(class: component_classes("fab-close", options:), **options, &)
|
|
18
14
|
end
|
|
19
15
|
|
|
20
|
-
def main_action(**
|
|
21
|
-
div(class: component_classes("fab-main-action", options:
|
|
16
|
+
def main_action(**options, &)
|
|
17
|
+
div(class: component_classes("fab-main-action", options:), **options, &)
|
|
22
18
|
end
|
|
23
19
|
|
|
24
20
|
register_modifiers(
|
data/lib/daisy_ui/fieldset.rb
CHANGED
|
@@ -13,8 +13,8 @@ module DaisyUI
|
|
|
13
13
|
public_send(as, class: classes, **attributes, &)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def legend(**
|
|
17
|
-
super(class: component_classes("fieldset-legend", options:
|
|
16
|
+
def legend(**options, &)
|
|
17
|
+
super(class: component_classes("fieldset-legend", options:), **options, &)
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
data/lib/daisy_ui/filter.rb
CHANGED
|
@@ -5,17 +5,13 @@ module DaisyUI
|
|
|
5
5
|
class Filter < Base
|
|
6
6
|
self.component_class = :filter
|
|
7
7
|
|
|
8
|
-
def initialize(*, as: :div, **)
|
|
9
|
-
super
|
|
10
|
-
end
|
|
11
|
-
|
|
12
8
|
def view_template(&)
|
|
13
9
|
public_send(as, class: classes, **attributes, &)
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
def reset(**
|
|
17
|
-
reset_classes = component_classes("filter-reset", options:
|
|
18
|
-
input(type: :radio, class: reset_classes, **
|
|
12
|
+
def reset(**options, &)
|
|
13
|
+
reset_classes = component_classes("filter-reset", options:)
|
|
14
|
+
input(type: :radio, class: reset_classes, **options, &)
|
|
19
15
|
end
|
|
20
16
|
end
|
|
21
17
|
end
|
data/lib/daisy_ui/footer.rb
CHANGED
|
@@ -13,8 +13,8 @@ module DaisyUI
|
|
|
13
13
|
public_send(as, class: classes, **attributes, &)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def title(**
|
|
17
|
-
div(class: component_classes("footer-title", options:
|
|
16
|
+
def title(**options, &)
|
|
17
|
+
div(class: component_classes("footer-title", options:), **options, &)
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
register_modifiers(
|