phlexy_ui 0.1.11 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phlexy_ui/alert.rb +58 -0
- data/lib/phlexy_ui/base.rb +1 -0
- data/lib/phlexy_ui/button.rb +13 -1
- data/lib/phlexy_ui/collapsible_sub_menu.rb +64 -11
- data/lib/phlexy_ui/navbar.rb +21 -6
- data/lib/phlexy_ui/radial_progress.rb +83 -0
- data/lib/phlexy_ui/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05cc7d7b0f5ca858eaef1fdb41520f94eb2fc518d3eecb8512b3ca9f66cde412
|
4
|
+
data.tar.gz: 3dbb3b78459c7b44700a4f49a314ec1d6974d96f47bcd110559f905a399b04d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 949a7237e3f8ea09d3ffbbc151043350fc359be2cab2df9a602cb7df157b004d6626a38e4724664902ee22c94bbc02d41fea9679db81ebe4c7f96b72d0f95868
|
7
|
+
data.tar.gz: b926813ecc2a3561a199213d5592c5e659344324cc6014f06d89e78218507a5403541ced957c4d36d28d9845a6d85550f78802ff303042ff1ad54f3c4bcb6fce
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PhlexyUI
|
4
|
+
class Alert < Base
|
5
|
+
def initialize(*, as: :div, **)
|
6
|
+
super(*, **)
|
7
|
+
@as = as
|
8
|
+
end
|
9
|
+
|
10
|
+
def view_template(&)
|
11
|
+
generate_classes!(
|
12
|
+
component_html_class: :alert,
|
13
|
+
modifiers_map: modifiers,
|
14
|
+
base_modifiers:,
|
15
|
+
options:
|
16
|
+
).then do |classes|
|
17
|
+
public_send(as, role: :alert, class: classes, **options, &)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
register_modifiers(
|
24
|
+
# "sm:alert-info"
|
25
|
+
# "md:alert-info"
|
26
|
+
# "lg:alert-info"
|
27
|
+
info: "alert-info",
|
28
|
+
# "sm:alert-success"
|
29
|
+
# "md:alert-success"
|
30
|
+
# "lg:alert-success"
|
31
|
+
success: "alert-success",
|
32
|
+
# "sm:alert-warning"
|
33
|
+
# "md:alert-warning"
|
34
|
+
# "lg:alert-warning"
|
35
|
+
warning: "alert-warning",
|
36
|
+
# "sm:alert-error"
|
37
|
+
# "md:alert-error"
|
38
|
+
# "lg:alert-error"
|
39
|
+
error: "alert-error",
|
40
|
+
# "sm:alert-neutral"
|
41
|
+
# "md:alert-neutral"
|
42
|
+
# "lg:alert-neutral"
|
43
|
+
neutral: "alert-neutral",
|
44
|
+
# "sm:alert-primary"
|
45
|
+
# "md:alert-primary"
|
46
|
+
# "lg:alert-primary"
|
47
|
+
primary: "alert-primary",
|
48
|
+
# "sm:alert-secondary"
|
49
|
+
# "md:alert-secondary"
|
50
|
+
# "lg:alert-secondary"
|
51
|
+
secondary: "alert-secondary",
|
52
|
+
# "sm:alert-accent"
|
53
|
+
# "md:alert-accent"
|
54
|
+
# "lg:alert-accent"
|
55
|
+
accent: "alert-accent"
|
56
|
+
)
|
57
|
+
end
|
58
|
+
end
|
data/lib/phlexy_ui/base.rb
CHANGED
data/lib/phlexy_ui/button.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "phlex/version"
|
4
|
+
|
3
5
|
module PhlexyUI
|
4
6
|
class Button < Base
|
5
7
|
def initialize(*, as: :button, modal: nil, **)
|
@@ -16,7 +18,17 @@ module PhlexyUI
|
|
16
18
|
options:
|
17
19
|
).then do |classes|
|
18
20
|
if modal
|
19
|
-
|
21
|
+
if Phlex::VERSION.start_with?("1.")
|
22
|
+
build_button_via_unsafe_raw(classes, &)
|
23
|
+
else
|
24
|
+
public_send(
|
25
|
+
as,
|
26
|
+
class: classes,
|
27
|
+
onclick: safe("#{Phlex::Escape.html_escape(modal)}.showModal()"),
|
28
|
+
**options,
|
29
|
+
&
|
30
|
+
)
|
31
|
+
end
|
20
32
|
else
|
21
33
|
public_send(as, class: classes, **options, &)
|
22
34
|
end
|
@@ -13,19 +13,25 @@ module PhlexyUI
|
|
13
13
|
def view_template(&)
|
14
14
|
attributes = generate_attributes(base_modifiers, ATTRIBUTES_MAP)
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
generate_classes!(
|
17
|
+
base_modifiers:,
|
18
|
+
modifiers_map: modifiers,
|
19
|
+
options:
|
20
|
+
).then do |classes|
|
21
|
+
details(**attributes) do
|
22
|
+
if @title
|
23
|
+
summary do
|
24
|
+
render @title
|
25
|
+
end
|
26
|
+
else
|
27
|
+
raise ArgumentError, "A collapsible submenu requires a title"
|
20
28
|
end
|
21
|
-
else
|
22
|
-
raise ArgumentError, "A collapsible submenu requires a title"
|
23
|
-
end
|
24
29
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
30
|
+
if @items.any?
|
31
|
+
ul class: classes, **options do
|
32
|
+
@items.each do |item|
|
33
|
+
render item
|
34
|
+
end
|
29
35
|
end
|
30
36
|
end
|
31
37
|
end
|
@@ -49,5 +55,52 @@ module PhlexyUI
|
|
49
55
|
ATTRIBUTES_MAP = {
|
50
56
|
open: true
|
51
57
|
}.freeze
|
58
|
+
|
59
|
+
register_modifiers(
|
60
|
+
# "sm:bg-primary sm:text-primary-content"
|
61
|
+
# "md:bg-primary md:text-primary-content"
|
62
|
+
# "lg:bg-primary lg:text-primary-content"
|
63
|
+
primary: "bg-primary text-primary-content",
|
64
|
+
# "sm:bg-secondary sm:text-secondary-content"
|
65
|
+
# "md:bg-secondary md:text-secondary-content"
|
66
|
+
# "lg:bg-secondary lg:text-secondary-content"
|
67
|
+
secondary: "bg-secondary text-secondary-content",
|
68
|
+
# "sm:bg-accent sm:text-accent-content"
|
69
|
+
# "md:bg-accent md:text-accent-content"
|
70
|
+
# "lg:bg-accent lg:text-accent-content"
|
71
|
+
accent: "bg-accent text-accent-content",
|
72
|
+
# "sm:bg-neutral sm:text-neutral-content"
|
73
|
+
# "md:bg-neutral md:text-neutral-content"
|
74
|
+
# "lg:bg-neutral lg:text-neutral-content"
|
75
|
+
neutral: "bg-neutral text-neutral-content",
|
76
|
+
# "sm:bg-base-100 sm:text-base-content"
|
77
|
+
# "md:bg-base-100 md:text-base-content"
|
78
|
+
# "lg:bg-base-100 lg:text-base-content"
|
79
|
+
base_100: "bg-base-100 text-base-content",
|
80
|
+
# "sm:bg-base-200 sm:text-base-content"
|
81
|
+
# "md:bg-base-200 md:text-base-content"
|
82
|
+
# "lg:bg-base-200 lg:text-base-content"
|
83
|
+
base_200: "bg-base-200 text-base-content",
|
84
|
+
# "sm:bg-base-300 sm:text-base-content"
|
85
|
+
# "md:bg-base-300 md:text-base-content"
|
86
|
+
# "lg:bg-base-300 lg:text-base-content"
|
87
|
+
base_300: "bg-base-300 text-base-content",
|
88
|
+
# "sm:bg-info sm:text-info-content"
|
89
|
+
# "md:bg-info sm:text-info-content"
|
90
|
+
# "lg:bg-info sm:text-info-content"
|
91
|
+
info: "bg-info text-info-content",
|
92
|
+
# "sm:bg-success sm:text-success-content"
|
93
|
+
# "md:bg-success md:text-success-content"
|
94
|
+
# "lg:bg-success lg:text-success-content"
|
95
|
+
success: "bg-success text-success-content",
|
96
|
+
# "sm:bg-warning sm:text-warning-content"
|
97
|
+
# "md:bg-warning md:text-warning-content"
|
98
|
+
# "lg:bg-warning lg:text-warning-content"
|
99
|
+
warning: "bg-warning text-warning-content",
|
100
|
+
# "sm:bg-error sm:text-error-content"
|
101
|
+
# "md:bg-error md:text-error-content"
|
102
|
+
# "lg:bg-error lg:text-error-content"
|
103
|
+
error: "bg-error text-error-content"
|
104
|
+
)
|
52
105
|
end
|
53
106
|
end
|
data/lib/phlexy_ui/navbar.rb
CHANGED
@@ -18,16 +18,31 @@ module PhlexyUI
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
def start(&)
|
22
|
-
|
21
|
+
def start(*, as: :div, **options, &)
|
22
|
+
generate_classes!(
|
23
|
+
component_html_class: :"navbar-start",
|
24
|
+
options:
|
25
|
+
).then do |classes|
|
26
|
+
public_send(as, class: classes, **options, &)
|
27
|
+
end
|
23
28
|
end
|
24
29
|
|
25
|
-
def center(&)
|
26
|
-
|
30
|
+
def center(*, as: :div, **options, &)
|
31
|
+
generate_classes!(
|
32
|
+
component_html_class: :"navbar-center",
|
33
|
+
options:
|
34
|
+
).then do |classes|
|
35
|
+
public_send(as, class: classes, **options, &)
|
36
|
+
end
|
27
37
|
end
|
28
38
|
|
29
|
-
def end(&)
|
30
|
-
|
39
|
+
def end(*, as: :div, **options, &)
|
40
|
+
generate_classes!(
|
41
|
+
component_html_class: :"navbar-end",
|
42
|
+
options:
|
43
|
+
).then do |classes|
|
44
|
+
public_send(as, class: classes, **options, &)
|
45
|
+
end
|
31
46
|
end
|
32
47
|
|
33
48
|
register_modifiers(
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module PhlexyUI
|
4
|
+
class RadialProgress < Base
|
5
|
+
def initialize(*, value:, as: :div, size: nil, thickness: nil, **)
|
6
|
+
super(*, **)
|
7
|
+
@as = as
|
8
|
+
@value = value
|
9
|
+
@size = size
|
10
|
+
@thickness = thickness
|
11
|
+
end
|
12
|
+
|
13
|
+
def view_template(&)
|
14
|
+
generate_classes!(
|
15
|
+
component_html_class: :"radial-progress",
|
16
|
+
modifiers_map: modifiers,
|
17
|
+
base_modifiers:,
|
18
|
+
options:
|
19
|
+
).then do |classes|
|
20
|
+
style = options.delete(:style)
|
21
|
+
|
22
|
+
if style.nil?
|
23
|
+
style = "--value: #{value}; --size: #{size}; --thickness: #{thickness};"
|
24
|
+
elsif style.is_a?(String)
|
25
|
+
style = "#{style} --value: #{value}; --size: #{size}; --thickness: #{thickness};"
|
26
|
+
end
|
27
|
+
|
28
|
+
public_send(as, role: :progressbar, class: classes, style:, **options, &)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
attr_reader :value, :size, :thickness
|
35
|
+
|
36
|
+
register_modifiers(
|
37
|
+
# "sm:bg-primary sm:text-primary-content"
|
38
|
+
# "md:bg-primary md:text-primary-content"
|
39
|
+
# "lg:bg-primary lg:text-primary-content"
|
40
|
+
primary: "bg-primary text-primary-content",
|
41
|
+
# "sm:bg-secondary sm:text-secondary-content"
|
42
|
+
# "md:bg-secondary md:text-secondary-content"
|
43
|
+
# "lg:bg-secondary lg:text-secondary-content"
|
44
|
+
secondary: "bg-secondary text-secondary-content",
|
45
|
+
# "sm:bg-accent sm:text-accent-content"
|
46
|
+
# "md:bg-accent md:text-accent-content"
|
47
|
+
# "lg:bg-accent lg:text-accent-content"
|
48
|
+
accent: "bg-accent text-accent-content",
|
49
|
+
# "sm:bg-neutral sm:text-neutral-content"
|
50
|
+
# "md:bg-neutral md:text-neutral-content"
|
51
|
+
# "lg:bg-neutral lg:text-neutral-content"
|
52
|
+
neutral: "bg-neutral text-neutral-content",
|
53
|
+
# "sm:bg-base-100 sm:text-base-content"
|
54
|
+
# "md:bg-base-100 md:text-base-content"
|
55
|
+
# "lg:bg-base-100 lg:text-base-content"
|
56
|
+
base_100: "bg-base-100 text-base-content",
|
57
|
+
# "sm:bg-base-200 sm:text-base-content"
|
58
|
+
# "md:bg-base-200 md:text-base-content"
|
59
|
+
# "lg:bg-base-200 lg:text-base-content"
|
60
|
+
base_200: "bg-base-200 text-base-content",
|
61
|
+
# "sm:bg-base-300 sm:text-base-content"
|
62
|
+
# "md:bg-base-300 md:text-base-content"
|
63
|
+
# "lg:bg-base-300 lg:text-base-content"
|
64
|
+
base_300: "bg-base-300 text-base-content",
|
65
|
+
# "sm:bg-info sm:text-info-content"
|
66
|
+
# "md:bg-info sm:text-info-content"
|
67
|
+
# "lg:bg-info sm:text-info-content"
|
68
|
+
info: "bg-info text-info-content",
|
69
|
+
# "sm:bg-success sm:text-success-content"
|
70
|
+
# "md:bg-success md:text-success-content"
|
71
|
+
# "lg:bg-success lg:text-success-content"
|
72
|
+
success: "bg-success text-success-content",
|
73
|
+
# "sm:bg-warning sm:text-warning-content"
|
74
|
+
# "md:bg-warning md:text-warning-content"
|
75
|
+
# "lg:bg-warning lg:text-warning-content"
|
76
|
+
warning: "bg-warning text-warning-content",
|
77
|
+
# "sm:bg-error sm:text-error-content"
|
78
|
+
# "md:bg-error md:text-error-content"
|
79
|
+
# "lg:bg-error lg:text-error-content"
|
80
|
+
error: "bg-error text-error-content"
|
81
|
+
)
|
82
|
+
end
|
83
|
+
end
|
data/lib/phlexy_ui/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phlexy_ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Alejandro Aguilar Ramos
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phlex
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.10'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -93,6 +93,7 @@ extensions: []
|
|
93
93
|
extra_rdoc_files: []
|
94
94
|
files:
|
95
95
|
- lib/phlexy_ui.rb
|
96
|
+
- lib/phlexy_ui/alert.rb
|
96
97
|
- lib/phlexy_ui/attribute_set.rb
|
97
98
|
- lib/phlexy_ui/avatar.rb
|
98
99
|
- lib/phlexy_ui/avatar_group.rb
|
@@ -115,6 +116,7 @@ files:
|
|
115
116
|
- lib/phlexy_ui/menu_item.rb
|
116
117
|
- lib/phlexy_ui/modal.rb
|
117
118
|
- lib/phlexy_ui/navbar.rb
|
119
|
+
- lib/phlexy_ui/radial_progress.rb
|
118
120
|
- lib/phlexy_ui/sub_menu.rb
|
119
121
|
- lib/phlexy_ui/tab.rb
|
120
122
|
- lib/phlexy_ui/tab_with_content.rb
|