daisyui 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a564d7aec76c78ac4e110e35fd555266479b9227fbafd15ee71eb0a60de5d2e
4
- data.tar.gz: 42613dc36df55a9c948909b261eeda51b3cd0856f3fb270a2c7fef7c17516713
3
+ metadata.gz: 618724b24d6d8e24b2af9f8c3ec73c54e2585780f7f08f95e7b95a695003f884
4
+ data.tar.gz: bf4a1d586b782bf36402fee0854198004977d3be75a9e814181933ceb4451275
5
5
  SHA512:
6
- metadata.gz: 2f68431a6c62e5c0c947b013e1a7b0383cb9f6b5b273f5a9bb97a91fe1f9ab41412fa5969f32b58bef6cdf1dc5146b372b0be9e6ec51bdbde84923457d27d57c
7
- data.tar.gz: 6edad53184274486618aa899945046b4eac33d98d63a02b2a6d79b5b887485e6170091635e5f0597967e3a059e00fbdab23ec48607ddfe95c54cb56c4e17faac
6
+ metadata.gz: d0679796916b581e19c7d519f006cf63f2cef7304148339f84c59129e03244ef7da2c10b0060e1ec232bb272cba04067cf181b3eb9fd58e50e1ed2df1a88ea3d
7
+ data.tar.gz: b8b705ab2250dfeda5953ae36f9e9a45fdeee9f5200aba740f683c64b5e5a3501e8c21a6c85dba6e500ec9fd33c02d47aff78bbefda7383b4906b71b2fc5d8d9
@@ -1,15 +1,63 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DaisyUI
4
+ # Label component for wrapping inputs, selects, or creating floating labels
5
+ #
6
+ # @example Floating label
7
+ # DaisyUI::Label.new(:floating) do
8
+ # input(type: "text", placeholder: "Email", class: "input input-md")
9
+ # span { "Your Email" }
10
+ # end
11
+ #
12
+ # @example Input wrapper with label
13
+ # DaisyUI::Label.new(:input) do |label|
14
+ # label.text("https://")
15
+ # input(type: "text", placeholder: "URL")
16
+ # end
17
+ #
18
+ # @example Select wrapper with label
19
+ # DaisyUI::Label.new(:select) do |label|
20
+ # label.text("Type")
21
+ # select do
22
+ # option { "Personal" }
23
+ # option { "Business" }
24
+ # end
25
+ # end
4
26
  class Label < Base
5
- self.component_class = :label
27
+ # No default component_class - it varies based on usage
28
+ # (floating-label, input, or select)
29
+ self.component_class = nil
30
+
31
+ register_modifiers(
32
+ # "sm:floating-label"
33
+ # "md:floating-label"
34
+ # "lg:floating-label"
35
+ floating: "floating-label",
36
+ # "sm:input"
37
+ # "md:input"
38
+ # "lg:input"
39
+ input: "input",
40
+ # "sm:select"
41
+ # "md:select"
42
+ # "lg:select"
43
+ select: "select"
44
+ )
6
45
 
7
46
  def view_template(&)
8
47
  label(class: classes, **attributes, &)
9
48
  end
10
49
 
11
- def text(as: :span, **options, &)
12
- public_send(as, class: component_classes("label-text", options: options), **options, &)
50
+ # Renders label text for input/select wrappers
51
+ # For floating labels, use a plain span instead
52
+ #
53
+ # @example
54
+ # label.text("Username")
55
+ # label.text { "Email Address" }
56
+ # label.text("https://", class: "custom-class")
57
+ def text(content = nil, **options, &block)
58
+ span(class: component_classes("label", options: options), **options) do
59
+ content || yield
60
+ end
13
61
  end
14
62
  end
15
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DaisyUI
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daisyui
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson