daisyui_on_phlex 0.1.2 → 0.2.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 +4 -4
- data/README.md +77 -7
- data/lib/daisyui_on_phlex/components/accordion.rb +59 -0
- data/lib/daisyui_on_phlex/components/avatar.rb +90 -0
- data/lib/daisyui_on_phlex/components/breadcrumbs.rb +27 -0
- data/lib/daisyui_on_phlex/components/calendar.rb +20 -0
- data/lib/daisyui_on_phlex/components/carousel.rb +37 -0
- data/lib/daisyui_on_phlex/components/chat.rb +54 -0
- data/lib/daisyui_on_phlex/components/checkbox.rb +64 -0
- data/lib/daisyui_on_phlex/components/collapse.rb +37 -0
- data/lib/daisyui_on_phlex/components/countdown.rb +20 -0
- data/lib/daisyui_on_phlex/components/diff.rb +27 -0
- data/lib/daisyui_on_phlex/components/divider.rb +20 -0
- data/lib/daisyui_on_phlex/components/dock.rb +33 -0
- data/lib/daisyui_on_phlex/components/drawer.rb +49 -0
- data/lib/daisyui_on_phlex/components/dropdown.rb +66 -0
- data/lib/daisyui_on_phlex/components/fieldset.rb +31 -0
- data/lib/daisyui_on_phlex/components/file_input.rb +69 -0
- data/lib/daisyui_on_phlex/components/filter.rb +34 -0
- data/lib/daisyui_on_phlex/components/footer.rb +32 -0
- data/lib/daisyui_on_phlex/components/hero.rb +28 -0
- data/lib/daisyui_on_phlex/components/indicator.rb +61 -0
- data/lib/daisyui_on_phlex/components/join.rb +24 -0
- data/lib/daisyui_on_phlex/components/kbd.rb +27 -0
- data/lib/daisyui_on_phlex/components/label.rb +23 -0
- data/lib/daisyui_on_phlex/components/link.rb +45 -0
- data/lib/daisyui_on_phlex/components/list.rb +19 -0
- data/lib/daisyui_on_phlex/components/loading.rb +36 -0
- data/lib/daisyui_on_phlex/components/mask.rb +42 -0
- data/lib/daisyui_on_phlex/components/menu.rb +60 -0
- data/lib/daisyui_on_phlex/components/mockup_browser.rb +25 -0
- data/lib/daisyui_on_phlex/components/mockup_code.rb +21 -0
- data/lib/daisyui_on_phlex/components/mockup_phone.rb +29 -0
- data/lib/daisyui_on_phlex/components/mockup_window.rb +29 -0
- data/lib/daisyui_on_phlex/components/navbar.rb +27 -0
- data/lib/daisyui_on_phlex/components/pagination.rb +56 -0
- data/lib/daisyui_on_phlex/components/progress.rb +50 -0
- data/lib/daisyui_on_phlex/components/radial_progress.rb +56 -0
- data/lib/daisyui_on_phlex/components/radio.rb +62 -0
- data/lib/daisyui_on_phlex/components/range.rb +62 -0
- data/lib/daisyui_on_phlex/components/rating.rb +61 -0
- data/lib/daisyui_on_phlex/components/select.rb +74 -0
- data/lib/daisyui_on_phlex/components/skeleton.rb +23 -0
- data/lib/daisyui_on_phlex/components/stack.rb +15 -0
- data/lib/daisyui_on_phlex/components/stat.rb +39 -0
- data/lib/daisyui_on_phlex/components/status.rb +34 -0
- data/lib/daisyui_on_phlex/components/steps.rb +42 -0
- data/lib/daisyui_on_phlex/components/swap.rb +45 -0
- data/lib/daisyui_on_phlex/components/tab.rb +72 -0
- data/lib/daisyui_on_phlex/components/table.rb +52 -0
- data/lib/daisyui_on_phlex/components/textarea.rb +66 -0
- data/lib/daisyui_on_phlex/components/theme_controller.rb +29 -0
- data/lib/daisyui_on_phlex/components/timeline.rb +52 -0
- data/lib/daisyui_on_phlex/components/toast.rb +56 -0
- data/lib/daisyui_on_phlex/components/toggle.rb +62 -0
- data/lib/daisyui_on_phlex/components/tooltip.rb +57 -0
- data/lib/daisyui_on_phlex/components/validator.rb +35 -0
- data/lib/daisyui_on_phlex/version.rb +1 -1
- metadata +62 -7
@@ -0,0 +1,66 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Dropdown < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(
|
7
|
+
position: :bottom,
|
8
|
+
align: :left,
|
9
|
+
end: false,
|
10
|
+
top: false,
|
11
|
+
hover: false,
|
12
|
+
open: false,
|
13
|
+
**attributes
|
14
|
+
)
|
15
|
+
@position = position
|
16
|
+
@align = align
|
17
|
+
@end = end
|
18
|
+
@top = top
|
19
|
+
@hover = hover
|
20
|
+
@open = open
|
21
|
+
@attributes = attributes
|
22
|
+
end
|
23
|
+
|
24
|
+
def view_template(&block)
|
25
|
+
div(class: dropdown_classes, **@attributes, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def trigger(**attributes, &block)
|
29
|
+
div(tabindex: "0", role: "button", **attributes, &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def content(**attributes, &block)
|
33
|
+
div(
|
34
|
+
tabindex: "0",
|
35
|
+
class: dropdown_content_classes,
|
36
|
+
**attributes,
|
37
|
+
&block
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def dropdown_classes
|
44
|
+
classes = ["dropdown"]
|
45
|
+
|
46
|
+
case @position
|
47
|
+
when :top then classes << "dropdown-top"
|
48
|
+
when :bottom then classes << "dropdown-bottom"
|
49
|
+
when :left then classes << "dropdown-left"
|
50
|
+
when :right then classes << "dropdown-right"
|
51
|
+
end
|
52
|
+
|
53
|
+
classes << "dropdown-end" if @end
|
54
|
+
classes << "dropdown-hover" if @hover
|
55
|
+
classes << "dropdown-open" if @open
|
56
|
+
|
57
|
+
merge_classes(*classes)
|
58
|
+
end
|
59
|
+
|
60
|
+
def dropdown_content_classes
|
61
|
+
classes = ["dropdown-content", "z-[1]", "menu", "p-2", "shadow", "bg-base-100", "rounded-box", "w-52"]
|
62
|
+
merge_classes(*classes)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Fieldset < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(**attributes)
|
7
|
+
@attributes = attributes
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&block)
|
11
|
+
fieldset(class: "fieldset", **@attributes, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def legend(**attributes, &block)
|
15
|
+
legend(class: "fieldset-legend", **attributes, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def label(text = nil, **attributes, &block)
|
19
|
+
label_tag(class: "fieldset-label", **attributes) do
|
20
|
+
text ? text : yield
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def label_tag(...)
|
27
|
+
label(...)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class FileInput < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(
|
7
|
+
variant: nil,
|
8
|
+
size: :md,
|
9
|
+
bordered: false,
|
10
|
+
ghost: false,
|
11
|
+
name: nil,
|
12
|
+
multiple: false,
|
13
|
+
accept: nil,
|
14
|
+
**attributes
|
15
|
+
)
|
16
|
+
@variant = variant
|
17
|
+
@size = size
|
18
|
+
@bordered = bordered
|
19
|
+
@ghost = ghost
|
20
|
+
@name = name
|
21
|
+
@multiple = multiple
|
22
|
+
@accept = accept
|
23
|
+
@attributes = attributes
|
24
|
+
end
|
25
|
+
|
26
|
+
def view_template
|
27
|
+
input(
|
28
|
+
type: "file",
|
29
|
+
class: file_input_classes,
|
30
|
+
name: @name,
|
31
|
+
multiple: @multiple,
|
32
|
+
accept: @accept,
|
33
|
+
**@attributes
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def file_input_classes
|
40
|
+
classes = ["file-input"]
|
41
|
+
|
42
|
+
# Variant classes
|
43
|
+
case @variant
|
44
|
+
when :primary then classes << "file-input-primary"
|
45
|
+
when :secondary then classes << "file-input-secondary"
|
46
|
+
when :accent then classes << "file-input-accent"
|
47
|
+
when :info then classes << "file-input-info"
|
48
|
+
when :success then classes << "file-input-success"
|
49
|
+
when :warning then classes << "file-input-warning"
|
50
|
+
when :error then classes << "file-input-error"
|
51
|
+
end
|
52
|
+
|
53
|
+
# Size classes
|
54
|
+
case @size
|
55
|
+
when :xs then classes << "file-input-xs"
|
56
|
+
when :sm then classes << "file-input-sm"
|
57
|
+
when :md then classes << "file-input-md"
|
58
|
+
when :lg then classes << "file-input-lg"
|
59
|
+
end
|
60
|
+
|
61
|
+
# Style modifiers
|
62
|
+
classes << "file-input-bordered" if @bordered
|
63
|
+
classes << "file-input-ghost" if @ghost
|
64
|
+
|
65
|
+
merge_classes(*classes)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Filter < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(name:, **attributes)
|
7
|
+
@name = name
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
div(class: "filter", **@attributes, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def option(value:, label:, checked: false, **attributes)
|
16
|
+
div(class: "filter-option") do
|
17
|
+
input(
|
18
|
+
type: "radio",
|
19
|
+
name: @name,
|
20
|
+
value: value,
|
21
|
+
id: "#{@name}_#{value}",
|
22
|
+
checked: checked,
|
23
|
+
class: "filter-radio sr-only",
|
24
|
+
**attributes
|
25
|
+
)
|
26
|
+
label(
|
27
|
+
for: "#{@name}_#{value}",
|
28
|
+
class: "filter-label cursor-pointer"
|
29
|
+
) { label }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Footer < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(center: false, **attributes)
|
7
|
+
@center = center
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
footer(class: footer_classes, **@attributes, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def title(**attributes, &block)
|
16
|
+
h6(class: merge_classes("footer-title", attributes[:class]), **attributes.except(:class), &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def link(href:, **attributes, &block)
|
20
|
+
a(href: href, class: merge_classes("link", "link-hover", attributes[:class]), **attributes.except(:class), &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def footer_classes
|
26
|
+
classes = ["footer", "p-10", "bg-neutral", "text-neutral-content"]
|
27
|
+
classes << "items-center" if @center
|
28
|
+
merge_classes(*classes)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Hero < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(overlay: false, **attributes)
|
7
|
+
@overlay = overlay
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
div(
|
13
|
+
class: merge_classes("hero", "min-h-screen", ("hero-overlay" if @overlay), @attributes[:class]),
|
14
|
+
**@attributes.except(:class),
|
15
|
+
&block
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def content(**attributes, &block)
|
20
|
+
div(class: merge_classes("hero-content", "text-center", attributes[:class]), **attributes.except(:class), &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def overlay(**attributes, &block)
|
24
|
+
div(class: merge_classes("hero-overlay", "bg-opacity-60", attributes[:class]), **attributes.except(:class), &block)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Indicator < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(**attributes)
|
7
|
+
@attributes = attributes
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&block)
|
11
|
+
div(class: "indicator", **@attributes, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def item(
|
15
|
+
position: :top_end,
|
16
|
+
variant: nil,
|
17
|
+
**attributes,
|
18
|
+
&block
|
19
|
+
)
|
20
|
+
span(
|
21
|
+
class: indicator_item_classes(position: position, variant: variant),
|
22
|
+
**attributes,
|
23
|
+
&block
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def indicator_item_classes(position:, variant:)
|
30
|
+
classes = ["indicator-item"]
|
31
|
+
|
32
|
+
case position
|
33
|
+
when :top_start then classes << "indicator-top" << "indicator-start"
|
34
|
+
when :top_center then classes << "indicator-top" << "indicator-center"
|
35
|
+
when :top_end then classes << "indicator-top" << "indicator-end"
|
36
|
+
when :middle_start then classes << "indicator-middle" << "indicator-start"
|
37
|
+
when :middle_center then classes << "indicator-middle" << "indicator-center"
|
38
|
+
when :middle_end then classes << "indicator-middle" << "indicator-end"
|
39
|
+
when :bottom_start then classes << "indicator-bottom" << "indicator-start"
|
40
|
+
when :bottom_center then classes << "indicator-bottom" << "indicator-center"
|
41
|
+
when :bottom_end then classes << "indicator-bottom" << "indicator-end"
|
42
|
+
end
|
43
|
+
|
44
|
+
case variant
|
45
|
+
when :primary then classes << "badge-primary"
|
46
|
+
when :secondary then classes << "badge-secondary"
|
47
|
+
when :accent then classes << "badge-accent"
|
48
|
+
when :neutral then classes << "badge-neutral"
|
49
|
+
when :info then classes << "badge-info"
|
50
|
+
when :success then classes << "badge-success"
|
51
|
+
when :warning then classes << "badge-warning"
|
52
|
+
when :error then classes << "badge-error"
|
53
|
+
end
|
54
|
+
|
55
|
+
classes << "badge" if variant
|
56
|
+
|
57
|
+
merge_classes(*classes)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Join < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(vertical: false, **attributes)
|
7
|
+
@vertical = vertical
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
div(
|
13
|
+
class: merge_classes("join", ("join-vertical" if @vertical), @attributes[:class]),
|
14
|
+
**@attributes.except(:class),
|
15
|
+
&block
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def item(**attributes, &block)
|
20
|
+
div(class: merge_classes("join-item", attributes[:class]), **attributes.except(:class), &block)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Kbd < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(size: :md, **attributes)
|
7
|
+
@size = size
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
size_class = case @size
|
13
|
+
when :xs then "kbd-xs"
|
14
|
+
when :sm then "kbd-sm"
|
15
|
+
when :md then "kbd-md"
|
16
|
+
when :lg then "kbd-lg"
|
17
|
+
end
|
18
|
+
|
19
|
+
kbd(
|
20
|
+
class: merge_classes("kbd", size_class, @attributes[:class]),
|
21
|
+
**@attributes.except(:class),
|
22
|
+
&block
|
23
|
+
)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Label < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(**attributes)
|
7
|
+
@attributes = attributes
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&block)
|
11
|
+
div(class: "label", **@attributes, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def text(**attributes, &block)
|
15
|
+
span(class: "label-text", **attributes, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def alt_text(**attributes, &block)
|
19
|
+
span(class: "label-text-alt", **attributes, &block)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Link < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(
|
7
|
+
variant: nil,
|
8
|
+
hover: false,
|
9
|
+
neutral: false,
|
10
|
+
**attributes
|
11
|
+
)
|
12
|
+
@variant = variant
|
13
|
+
@hover = hover
|
14
|
+
@neutral = neutral
|
15
|
+
@attributes = attributes
|
16
|
+
end
|
17
|
+
|
18
|
+
def view_template(&block)
|
19
|
+
a(class: link_classes, **@attributes, &block)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def link_classes
|
25
|
+
classes = ["link"]
|
26
|
+
|
27
|
+
case @variant
|
28
|
+
when :primary then classes << "link-primary"
|
29
|
+
when :secondary then classes << "link-secondary"
|
30
|
+
when :accent then classes << "link-accent"
|
31
|
+
when :neutral then classes << "link-neutral"
|
32
|
+
when :info then classes << "link-info"
|
33
|
+
when :success then classes << "link-success"
|
34
|
+
when :warning then classes << "link-warning"
|
35
|
+
when :error then classes << "link-error"
|
36
|
+
end
|
37
|
+
|
38
|
+
classes << "link-hover" if @hover
|
39
|
+
classes << "link-neutral" if @neutral
|
40
|
+
|
41
|
+
merge_classes(*classes)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class List < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(**attributes)
|
7
|
+
@attributes = attributes
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&block)
|
11
|
+
ul(class: "menu bg-base-200 w-56 rounded-box", **@attributes, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def section_title(**attributes, &block)
|
15
|
+
li(class: merge_classes("menu-title", attributes[:class]), **attributes.except(:class), &block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Loading < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(variant: :spinner, size: :md, **attributes)
|
7
|
+
@variant = variant
|
8
|
+
@size = size
|
9
|
+
@attributes = attributes
|
10
|
+
end
|
11
|
+
|
12
|
+
def view_template
|
13
|
+
variant_class = case @variant
|
14
|
+
when :spinner then "loading-spinner"
|
15
|
+
when :dots then "loading-dots"
|
16
|
+
when :ring then "loading-ring"
|
17
|
+
when :ball then "loading-ball"
|
18
|
+
when :bars then "loading-bars"
|
19
|
+
when :infinity then "loading-infinity"
|
20
|
+
end
|
21
|
+
|
22
|
+
size_class = case @size
|
23
|
+
when :xs then "loading-xs"
|
24
|
+
when :sm then "loading-sm"
|
25
|
+
when :md then "loading-md"
|
26
|
+
when :lg then "loading-lg"
|
27
|
+
end
|
28
|
+
|
29
|
+
span(
|
30
|
+
class: merge_classes("loading", variant_class, size_class, @attributes[:class]),
|
31
|
+
**@attributes.except(:class)
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Mask < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(variant: :squircle, **attributes)
|
7
|
+
@variant = variant
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
variant_classes = {
|
13
|
+
squircle: "mask-squircle",
|
14
|
+
heart: "mask-heart",
|
15
|
+
hexagon: "mask-hexagon",
|
16
|
+
hexagon_2: "mask-hexagon-2",
|
17
|
+
decagon: "mask-decagon",
|
18
|
+
pentagon: "mask-pentagon",
|
19
|
+
diamond: "mask-diamond",
|
20
|
+
square: "mask-square",
|
21
|
+
circle: "mask-circle",
|
22
|
+
parallelogram: "mask-parallelogram",
|
23
|
+
parallelogram_2: "mask-parallelogram-2",
|
24
|
+
parallelogram_3: "mask-parallelogram-3",
|
25
|
+
parallelogram_4: "mask-parallelogram-4",
|
26
|
+
star: "mask-star",
|
27
|
+
star_2: "mask-star-2",
|
28
|
+
triangle: "mask-triangle",
|
29
|
+
triangle_2: "mask-triangle-2",
|
30
|
+
triangle_3: "mask-triangle-3",
|
31
|
+
triangle_4: "mask-triangle-4"
|
32
|
+
}
|
33
|
+
|
34
|
+
div(
|
35
|
+
class: merge_classes("mask", variant_classes[@variant], @attributes[:class]),
|
36
|
+
**@attributes.except(:class),
|
37
|
+
&block
|
38
|
+
)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
class Menu < DaisyuiOnPhlex::Base
|
6
|
+
def initialize(
|
7
|
+
size: :md,
|
8
|
+
horizontal: false,
|
9
|
+
vertical: false,
|
10
|
+
compact: false,
|
11
|
+
**attributes
|
12
|
+
)
|
13
|
+
@size = size
|
14
|
+
@horizontal = horizontal
|
15
|
+
@vertical = vertical
|
16
|
+
@compact = compact
|
17
|
+
@attributes = attributes
|
18
|
+
end
|
19
|
+
|
20
|
+
def view_template(&block)
|
21
|
+
ul(class: menu_classes, **@attributes, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def item(disabled: false, **attributes, &block)
|
25
|
+
li(class: ("disabled" if disabled), **attributes, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def title(**attributes, &block)
|
29
|
+
li(class: merge_classes("menu-title", attributes[:class]), **attributes.except(:class), &block)
|
30
|
+
end
|
31
|
+
|
32
|
+
def link(href: nil, active: false, **attributes, &block)
|
33
|
+
if href
|
34
|
+
a(href: href, class: ("active" if active), **attributes, &block)
|
35
|
+
else
|
36
|
+
span(class: ("active" if active), **attributes, &block)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def menu_classes
|
43
|
+
classes = ["menu"]
|
44
|
+
|
45
|
+
case @size
|
46
|
+
when :xs then classes << "menu-xs"
|
47
|
+
when :sm then classes << "menu-sm"
|
48
|
+
when :md then classes << "menu-md"
|
49
|
+
when :lg then classes << "menu-lg"
|
50
|
+
end
|
51
|
+
|
52
|
+
classes << "menu-horizontal" if @horizontal
|
53
|
+
classes << "menu-vertical" if @vertical
|
54
|
+
classes << "menu-compact" if @compact
|
55
|
+
|
56
|
+
merge_classes(*classes)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
module Mockup
|
6
|
+
class Browser < DaisyuiOnPhlex::Base
|
7
|
+
def initialize(**attributes)
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
div(class: "mockup-browser border bg-base-300", **@attributes, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def toolbar(**attributes, &block)
|
16
|
+
div(class: merge_classes("mockup-browser-toolbar", attributes[:class]), **attributes.except(:class), &block)
|
17
|
+
end
|
18
|
+
|
19
|
+
def content(**attributes, &block)
|
20
|
+
div(class: merge_classes("flex", "justify-center", "px-4", "py-16", "bg-base-200", attributes[:class]), **attributes.except(:class), &block)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
module Mockup
|
6
|
+
class Code < DaisyuiOnPhlex::Base
|
7
|
+
def initialize(**attributes)
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
div(class: "mockup-code", **@attributes, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def line(prefix: nil, **attributes, &block)
|
16
|
+
pre(data: { prefix: prefix }, **attributes, &block)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module DaisyuiOnPhlex
|
4
|
+
module Components
|
5
|
+
module Mockup
|
6
|
+
class Phone < DaisyuiOnPhlex::Base
|
7
|
+
def initialize(**attributes)
|
8
|
+
@attributes = attributes
|
9
|
+
end
|
10
|
+
|
11
|
+
def view_template(&block)
|
12
|
+
div(class: "mockup-phone", **@attributes, &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
def camera
|
16
|
+
div(class: "camera")
|
17
|
+
end
|
18
|
+
|
19
|
+
def display(**attributes, &block)
|
20
|
+
div(class: "display", **attributes, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def artboard(**attributes, &block)
|
24
|
+
div(class: "artboard artboard-demo phone-1", **attributes, &block)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|