daisyui 1.1.0 → 1.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.
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DaisyUI
4
+ class Otp < Base
5
+ self.component_class = :otp
6
+
7
+ def initialize(*, digits: 4, as: :label, input_attributes: {}, **)
8
+ super(*, as:, **)
9
+ @digits = digits
10
+ @input_attributes = input_attributes
11
+ end
12
+
13
+ def view_template(&)
14
+ public_send(as, class: classes, **attributes) do
15
+ digits.times { span }
16
+ input(
17
+ type: :text,
18
+ autocomplete: "one-time-code",
19
+ inputmode: :numeric,
20
+ maxlength: digits,
21
+ pattern: "[0-9]{#{digits}}",
22
+ required: true,
23
+ **input_attributes
24
+ )
25
+ end
26
+ end
27
+
28
+ private
29
+
30
+ attr_reader :digits, :input_attributes
31
+
32
+ register_modifiers(
33
+ # "sm:otp-joined"
34
+ # "@sm:otp-joined"
35
+ # "md:otp-joined"
36
+ # "@md:otp-joined"
37
+ # "lg:otp-joined"
38
+ # "@lg:otp-joined"
39
+ joined: "otp-joined",
40
+ # Sizes
41
+ # "sm:otp-xs"
42
+ # "@sm:otp-xs"
43
+ # "md:otp-xs"
44
+ # "@md:otp-xs"
45
+ # "lg:otp-xs"
46
+ # "@lg:otp-xs"
47
+ xs: "otp-xs",
48
+ # "sm:otp-sm"
49
+ # "@sm:otp-sm"
50
+ # "md:otp-sm"
51
+ # "@md:otp-sm"
52
+ # "lg:otp-sm"
53
+ # "@lg:otp-sm"
54
+ sm: "otp-sm",
55
+ # "sm:otp-md"
56
+ # "@sm:otp-md"
57
+ # "md:otp-md"
58
+ # "@md:otp-md"
59
+ # "lg:otp-md"
60
+ # "@lg:otp-md"
61
+ md: "otp-md",
62
+ # "sm:otp-lg"
63
+ # "@sm:otp-lg"
64
+ # "md:otp-lg"
65
+ # "@md:otp-lg"
66
+ # "lg:otp-lg"
67
+ # "@lg:otp-lg"
68
+ lg: "otp-lg",
69
+ # "sm:otp-xl"
70
+ # "@sm:otp-xl"
71
+ # "md:otp-xl"
72
+ # "@md:otp-xl"
73
+ # "lg:otp-xl"
74
+ # "@lg:otp-xl"
75
+ xl: "otp-xl",
76
+ # Colors
77
+ # "sm:otp-neutral"
78
+ # "@sm:otp-neutral"
79
+ # "md:otp-neutral"
80
+ # "@md:otp-neutral"
81
+ # "lg:otp-neutral"
82
+ # "@lg:otp-neutral"
83
+ neutral: "otp-neutral",
84
+ # "sm:otp-primary"
85
+ # "@sm:otp-primary"
86
+ # "md:otp-primary"
87
+ # "@md:otp-primary"
88
+ # "lg:otp-primary"
89
+ # "@lg:otp-primary"
90
+ primary: "otp-primary",
91
+ # "sm:otp-secondary"
92
+ # "@sm:otp-secondary"
93
+ # "md:otp-secondary"
94
+ # "@md:otp-secondary"
95
+ # "lg:otp-secondary"
96
+ # "@lg:otp-secondary"
97
+ secondary: "otp-secondary",
98
+ # "sm:otp-accent"
99
+ # "@sm:otp-accent"
100
+ # "md:otp-accent"
101
+ # "@md:otp-accent"
102
+ # "lg:otp-accent"
103
+ # "@lg:otp-accent"
104
+ accent: "otp-accent",
105
+ # "sm:otp-success"
106
+ # "@sm:otp-success"
107
+ # "md:otp-success"
108
+ # "@md:otp-success"
109
+ # "lg:otp-success"
110
+ # "@lg:otp-success"
111
+ success: "otp-success",
112
+ # "sm:otp-info"
113
+ # "@sm:otp-info"
114
+ # "md:otp-info"
115
+ # "@md:otp-info"
116
+ # "lg:otp-info"
117
+ # "@lg:otp-info"
118
+ info: "otp-info",
119
+ # "sm:otp-warning"
120
+ # "@sm:otp-warning"
121
+ # "md:otp-warning"
122
+ # "@md:otp-warning"
123
+ # "lg:otp-warning"
124
+ # "@lg:otp-warning"
125
+ warning: "otp-warning",
126
+ # "sm:otp-error"
127
+ # "@sm:otp-error"
128
+ # "md:otp-error"
129
+ # "@md:otp-error"
130
+ # "lg:otp-error"
131
+ # "@lg:otp-error"
132
+ error: "otp-error"
133
+ )
134
+ end
135
+ end
@@ -3,7 +3,7 @@
3
3
  module DaisyUI
4
4
  # @component html class="join"
5
5
  class Pagination < Base
6
- self.component_class = "join"
6
+ self.component_class = :join
7
7
 
8
8
  def view_template(&)
9
9
  public_send(as, class: classes, **attributes, &)
@@ -18,8 +18,8 @@ module DaisyUI
18
18
  style_parts = []
19
19
  style_parts << style if style && !style.empty?
20
20
  style_parts << "--value: #{value};"
21
- style_parts << "--size: #{size};" if size && !size.empty?
22
- style_parts << "--thickness: #{thickness};" if thickness && !thickness.empty?
21
+ style_parts << "--size: #{size};" if size && !size.to_s.empty?
22
+ style_parts << "--thickness: #{thickness};" if thickness && !thickness.to_s.empty?
23
23
 
24
24
  public_send(as, role: :progressbar, class: classes, style: style_parts.join(" "), **attributes, &)
25
25
  end
@@ -104,7 +104,14 @@ module DaisyUI
104
104
  # "@md:range-error"
105
105
  # "lg:range-error"
106
106
  # "@lg:range-error"
107
- error: "range-error"
107
+ error: "range-error",
108
+ # "sm:range-vertical"
109
+ # "@sm:range-vertical"
110
+ # "md:range-vertical"
111
+ # "@md:range-vertical"
112
+ # "lg:range-vertical"
113
+ # "@lg:range-vertical"
114
+ vertical: "range-vertical"
108
115
  )
109
116
  end
110
117
  end
@@ -20,6 +20,10 @@ module DaisyUI
20
20
  li(class: step_classes, **options, &)
21
21
  end
22
22
 
23
+ def icon(**options, &)
24
+ div(class: component_classes("step-icon", options:), **options, &)
25
+ end
26
+
23
27
  private
24
28
 
25
29
  def build_step_classes(step_modifiers, options)
@@ -42,12 +46,6 @@ module DaisyUI
42
46
  }
43
47
  end
44
48
 
45
- public
46
-
47
- def icon(**options, &)
48
- div(class: component_classes("step-icon", options:), **options, &)
49
- end
50
-
51
49
  register_modifiers(
52
50
  # "sm:steps-vertical"
53
51
  # "@sm:steps-vertical"
@@ -5,7 +5,7 @@ module DaisyUI
5
5
  class SubMenu < Base
6
6
  def initialize(*, **)
7
7
  super
8
- @items ||= []
8
+ @items = []
9
9
  end
10
10
 
11
11
  def view_template(&)
@@ -3,7 +3,7 @@
3
3
  module DaisyUI
4
4
  # @private
5
5
  class TabWithContent < Base
6
- self.component_class = "tab"
6
+ self.component_class = :tab
7
7
 
8
8
  def initialize(*, content:, label: nil, id: nil, **)
9
9
  super(*, **)
@@ -3,7 +3,7 @@
3
3
  module DaisyUI
4
4
  # @private
5
5
  class TabWithoutContent < Base
6
- self.component_class = "tab"
6
+ self.component_class = :tab
7
7
 
8
8
  def initialize(*, label: nil, **)
9
9
  super(*, **)
@@ -9,20 +9,32 @@ module DaisyUI
9
9
 
10
10
  register_modifiers(
11
11
  # "sm:swap"
12
+ # "@sm:swap"
12
13
  # "md:swap"
14
+ # "@md:swap"
13
15
  # "lg:swap"
16
+ # "@lg:swap"
14
17
  swap: "swap",
15
18
  # "sm:swap sm:swap-rotate"
19
+ # "@sm:swap @sm:swap-rotate"
16
20
  # "md:swap md:swap-rotate"
21
+ # "@md:swap @md:swap-rotate"
17
22
  # "lg:swap lg:swap-rotate"
23
+ # "@lg:swap @lg:swap-rotate"
18
24
  swap_rotate: "swap swap-rotate",
19
25
  # "sm:swap sm:swap-flip"
26
+ # "@sm:swap @sm:swap-flip"
20
27
  # "md:swap md:swap-flip"
28
+ # "@md:swap @md:swap-flip"
21
29
  # "lg:swap lg:swap-flip"
30
+ # "@lg:swap @lg:swap-flip"
22
31
  swap_flip: "swap swap-flip",
23
32
  # "sm:toggle"
33
+ # "@sm:toggle"
24
34
  # "md:toggle"
35
+ # "@md:toggle"
25
36
  # "lg:toggle"
37
+ # "@lg:toggle"
26
38
  toggle: "toggle"
27
39
  )
28
40
 
@@ -34,7 +46,7 @@ module DaisyUI
34
46
 
35
47
  def view_template(&block)
36
48
  # Input always has just the theme-controller class
37
- input_classes = self.class.component_class.to_s
49
+ input_classes = apply_prefix(self.class.component_class.to_s)
38
50
 
39
51
  attrs = { type: :checkbox, class: input_classes }
40
52
  attrs[:value] = theme_value if theme_value
@@ -24,12 +24,12 @@ module DaisyUI
24
24
  # "lg:toast-center"
25
25
  # "@lg:toast-center"
26
26
  center: "toast-center",
27
- # "sm:toast-end"
28
- # "@sm:toast-end"
29
- # "md:toast-end"
30
- # "@md:toast-end"
31
- # "lg:toast-end"
32
- # "@lg:toast-end"
27
+ # "sm:toast-end"
28
+ # "@sm:toast-end"
29
+ # "md:toast-end"
30
+ # "@md:toast-end"
31
+ # "lg:toast-end"
32
+ # "@lg:toast-end"
33
33
  end: "toast-end",
34
34
  # "sm:toast-top"
35
35
  # "@sm:toast-top"
@@ -4,13 +4,19 @@ module DaisyUI
4
4
  class Tooltip < Base
5
5
  self.component_class = :tooltip
6
6
 
7
- def initialize(*, tip:, as: :div, **)
7
+ def initialize(*, tip: nil, as: :div, **)
8
8
  super(*, as:, **)
9
9
  @tip = tip
10
10
  end
11
11
 
12
12
  def view_template(&)
13
- public_send(as, class: classes, data_tip: tip, **attributes, &)
13
+ opts = { class: classes, **attributes }
14
+ opts[:data_tip] = tip if tip
15
+ public_send(as, **opts, &)
16
+ end
17
+
18
+ def content(**options, &)
19
+ div(class: component_classes("tooltip-content", options:), **options, &)
14
20
  end
15
21
 
16
22
  private
@@ -108,7 +114,28 @@ module DaisyUI
108
114
  # "@md:tooltip-error"
109
115
  # "lg:tooltip-error"
110
116
  # "@lg:tooltip-error"
111
- error: "tooltip-error"
117
+ error: "tooltip-error",
118
+ # "sm:tooltip-start"
119
+ # "@sm:tooltip-start"
120
+ # "md:tooltip-start"
121
+ # "@md:tooltip-start"
122
+ # "lg:tooltip-start"
123
+ # "@lg:tooltip-start"
124
+ start: "tooltip-start",
125
+ # "sm:tooltip-center"
126
+ # "@sm:tooltip-center"
127
+ # "md:tooltip-center"
128
+ # "@md:tooltip-center"
129
+ # "lg:tooltip-center"
130
+ # "@lg:tooltip-center"
131
+ center: "tooltip-center",
132
+ # "sm:tooltip-end"
133
+ # "@sm:tooltip-end"
134
+ # "md:tooltip-end"
135
+ # "@md:tooltip-end"
136
+ # "lg:tooltip-end"
137
+ # "@lg:tooltip-end"
138
+ end: "tooltip-end"
112
139
  )
113
140
  end
114
141
  end
@@ -3,5 +3,5 @@
3
3
  module DaisyUI
4
4
  # This timestamp is automatically updated when releasing a new version
5
5
  # Format: YYYY-MM-DD HH:MM:SS UTC
6
- UPDATED_AT = "2026-04-05 05:58:09 UTC"
6
+ UPDATED_AT = "2026-06-26 15:27:35 UTC"
7
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DaisyUI
4
- VERSION = "1.1.0"
4
+ VERSION = "1.2.0"
5
5
  end
data/lib/daisy_ui.rb CHANGED
@@ -11,6 +11,9 @@ loader.inflector.inflect(
11
11
  )
12
12
  loader.ignore("#{__dir__}/daisyui.rb")
13
13
  loader.ignore("#{__dir__}/daisy_ui/updated_at.rb")
14
+ # The Rails engine references Rails::Engine, so it is required explicitly below
15
+ # (only when Rails is present) rather than autoloaded.
16
+ loader.ignore("#{__dir__}/daisy_ui/engine.rb")
14
17
  loader.setup # ready!
15
18
  loader.load_file("#{__dir__}/daisy_ui/base.rb")
16
19
 
@@ -18,3 +21,7 @@ module DaisyUI
18
21
  extend Configurable
19
22
  extend Phlex::Kit
20
23
  end
24
+
25
+ # Optional Rails integration (exposes the opt-in Stimulus controller via
26
+ # importmap/assets). Loaded only under Rails; the gem stays pure Phlex otherwise.
27
+ require_relative "daisy_ui/engine" if defined?(Rails::Engine)
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.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -52,10 +52,16 @@ executables:
52
52
  extensions: []
53
53
  extra_rdoc_files: []
54
54
  files:
55
+ - CHANGELOG.md
56
+ - LICENSE.txt
57
+ - README.md
58
+ - app/javascript/daisy_ui/controllers/daisy_dropdown_controller.js
59
+ - config/importmap.rb
55
60
  - exe/daisyui-mcp
56
61
  - lib/daisy_ui.rb
57
62
  - lib/daisy_ui/accordion.rb
58
63
  - lib/daisy_ui/alert.rb
64
+ - lib/daisy_ui/aura.rb
59
65
  - lib/daisy_ui/avatar.rb
60
66
  - lib/daisy_ui/avatar_group.rb
61
67
  - lib/daisy_ui/badge.rb
@@ -76,6 +82,7 @@ files:
76
82
  - lib/daisy_ui/dock.rb
77
83
  - lib/daisy_ui/drawer.rb
78
84
  - lib/daisy_ui/dropdown.rb
85
+ - lib/daisy_ui/engine.rb
79
86
  - lib/daisy_ui/fab.rb
80
87
  - lib/daisy_ui/fieldset.rb
81
88
  - lib/daisy_ui/file_input.rb
@@ -95,6 +102,7 @@ files:
95
102
  - lib/daisy_ui/loading.rb
96
103
  - lib/daisy_ui/mask.rb
97
104
  - lib/daisy_ui/mcp_server.rb
105
+ - lib/daisy_ui/megamenu.rb
98
106
  - lib/daisy_ui/menu.rb
99
107
  - lib/daisy_ui/menu_item.rb
100
108
  - lib/daisy_ui/mockup_browser.rb
@@ -103,6 +111,7 @@ files:
103
111
  - lib/daisy_ui/mockup_window.rb
104
112
  - lib/daisy_ui/modal.rb
105
113
  - lib/daisy_ui/navbar.rb
114
+ - lib/daisy_ui/otp.rb
106
115
  - lib/daisy_ui/pagination.rb
107
116
  - lib/daisy_ui/progress.rb
108
117
  - lib/daisy_ui/radial_progress.rb