essence 0.3.1 → 0.4.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.
- checksums.yaml +4 -4
- data/lib/essence/cli.rb +1 -1
- data/lib/essence/components/alert.rb +50 -0
- data/lib/essence/components/checkbox.rb +17 -0
- data/lib/essence/components/essence.rb +0 -2
- data/lib/essence/components/heading.rb +28 -0
- data/lib/essence/components/input.rb +14 -0
- data/lib/essence/components/label.rb +28 -0
- data/lib/essence/components/metric.rb +40 -0
- data/lib/essence/components/separator.rb +29 -0
- data/lib/essence/components/switch.rb +69 -0
- data/lib/essence/components/text.rb +21 -0
- data/lib/essence/configuration.rb +2 -0
- data/lib/essence/definitions.rb +89 -0
- data/lib/essence/stimulus/switch_controller.js +32 -0
- data/lib/essence/version.rb +1 -1
- data/lib/essence.rb +40 -12
- metadata +15 -5
- /data/{essence → lib/essence}/stimulus/tabs_controller.js +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f50eba3dff7653e3e65f0f1e2dabb114782f0e0bf09cb64995118d86427b65b1
|
|
4
|
+
data.tar.gz: 21ce8e60063dc1930aa31eb4f3bb22be5045ffefd15fed55db823178dcc0d4da
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a6738cd42f2504d0b96be1b711abba2a4788cc6a411e27f2d47d62716cf6051b3f3835e95a68d45103fc47da909f1d02c7fe2c1226fd661362c337d89df4e09
|
|
7
|
+
data.tar.gz: ac414b095aa27a017b2438bcf9da0bfd2e8f638c21525b1bf3f749573fbb0771f3250ae418151f5175ef9f8ff44d25ef172d56317e7cc640836e3c25eeddb07d
|
data/lib/essence/cli.rb
CHANGED
|
@@ -17,7 +17,7 @@ module Essence
|
|
|
17
17
|
extend Dry::CLI::Registry
|
|
18
18
|
|
|
19
19
|
# Constants
|
|
20
|
-
STIMULUS_CONTROLLERS_DIR = Pathname.new(
|
|
20
|
+
STIMULUS_CONTROLLERS_DIR = Pathname.new(File.expand_path("stimulus", __dir__))
|
|
21
21
|
STIMULUS_CONTROLLERS_DESTINATION_DIR = Pathname.new(File.expand_path(Dir.pwd)).join(::Essence.configuration.stimulus_controller_path)
|
|
22
22
|
|
|
23
23
|
COMPONENTS_DIR = Pathname.new(File.expand_path("components", __dir__))
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Essence::Alert < Essence::Essence
|
|
4
|
+
BASE = "bg-white border-l-2 flex flex-col p-3 sm:p-4 bg-gray-50/50"
|
|
5
|
+
TITLE_BASE = "text-gray-900 text-sm sm:text-base font-medium w-full"
|
|
6
|
+
DESCRIPTION_BASE = "text-gray-700 flex text-xs sm:text-sm w-full"
|
|
7
|
+
ICON_BASE = "inline-flex items-center justify-center w-fit size-7 rounded-xs"
|
|
8
|
+
|
|
9
|
+
KINDS = {
|
|
10
|
+
primary: "border-blue-500",
|
|
11
|
+
critical: "border-rose-600",
|
|
12
|
+
warning: "border-orange-400",
|
|
13
|
+
success: "border-emerald-500"
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
ICON_KINDS = {
|
|
17
|
+
primary: "bg-blue-500 text-white",
|
|
18
|
+
critical: "bg-rose-600 text-white",
|
|
19
|
+
warning: "bg-orange-400 text-gray-900",
|
|
20
|
+
success: "bg-emerald-500 text-white"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
attr_reader :kind
|
|
24
|
+
attr_reader :attributes
|
|
25
|
+
|
|
26
|
+
def initialize(kind: :primary, **attributes)
|
|
27
|
+
@kind = kind
|
|
28
|
+
super(**attributes)
|
|
29
|
+
@attributes[:class] = merge_classes([ BASE, KINDS[kind], attributes[:class] ])
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def view_template(&)
|
|
33
|
+
div(**attributes, &)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def title(**mattributes, &)
|
|
37
|
+
mattributes[:class] = merge_classes([ TITLE_BASE, mattributes[:class] ])
|
|
38
|
+
h5(**mattributes, &)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def description(**mattributes, &)
|
|
42
|
+
mattributes[:class] = merge_classes([ DESCRIPTION_BASE, mattributes[:class] ])
|
|
43
|
+
p(**mattributes, &)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def icon(**mattributes, &)
|
|
47
|
+
mattributes[:class] = merge_classes([ ICON_BASE, ICON_KINDS[kind], mattributes[:class] ])
|
|
48
|
+
div(**mattributes, &)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Essence::Checkbox < Essence::Essence
|
|
4
|
+
BASE = "appearance-none size-3.5 cursor-pointer transition duration-100 rounded-xs border border-gray-300 focus:ring-0 checked:border-indigo-600 checked:bg-indigo-500 indeterminate:border-indigo-600 indeterminate:bg-indigo-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:checked:bg-gray-100 forced-colors:appearance-auto"
|
|
5
|
+
|
|
6
|
+
attr_reader :attributes
|
|
7
|
+
|
|
8
|
+
def initialize(**attributes)
|
|
9
|
+
super(**attributes)
|
|
10
|
+
@attributes[:class] = merge_classes(BASE, attributes[:class])
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def view_template
|
|
14
|
+
attributes[:type] = :checkbox
|
|
15
|
+
input(**attributes)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
class Essence::Heading < Essence::Essence
|
|
2
|
+
ALLOWED_TAGS = [ :h1, :h2, :h3, :h4, :h5, :h6 ]
|
|
3
|
+
BASE = "font-medium text-gray-900 leading-normal"
|
|
4
|
+
SIZES = {
|
|
5
|
+
xs: "text-base lg:text-lg",
|
|
6
|
+
sm: "text-lg lg:text-xl",
|
|
7
|
+
md: "text-xl lg:text-2xl",
|
|
8
|
+
lg: "text-2xl lg:text-3xl",
|
|
9
|
+
xl: "text-3xl lg:text-4xl",
|
|
10
|
+
"2xl": "text-4xl lg:text-5xl",
|
|
11
|
+
"3xl": "text-5xl lg:text-6xl"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
attr_reader :as
|
|
15
|
+
attr_reader :size
|
|
16
|
+
attr_reader :attributes
|
|
17
|
+
|
|
18
|
+
def initialize(as: :h2, size: :xs, **attributes)
|
|
19
|
+
super(**attributes)
|
|
20
|
+
@as = ALLOWED_TAGS.include?(as.to_sym) ? as.to_sym : :h1
|
|
21
|
+
@size = SIZES.keys.include?(size.to_sym) ? size.to_sym : :xs
|
|
22
|
+
@attributes[:class] = merge_classes([ BASE, SIZES[size], attributes[:class] ])
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def view_template(&)
|
|
26
|
+
tag(as, **attributes, &)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Essence::Input < Essence::Essence
|
|
4
|
+
BASE = "flex px-4 h-10 md:h-12 rounded-sm border border-gray-200/80 focus:outline-none focus:ring-offset-2 focus-visible:ring-2"
|
|
5
|
+
|
|
6
|
+
def initialize(**attributes)
|
|
7
|
+
super(**attributes)
|
|
8
|
+
@attributes[:class] = merge_classes([ BASE, @attributes[:class] ])
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def view_template(&)
|
|
12
|
+
input(**attributes)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Essence::Label < Essence::Essence
|
|
4
|
+
BASE = "flex text-sm font-medium text-gray-700"
|
|
5
|
+
HELPER_BASE = "text-xs font-normal text-gray-500"
|
|
6
|
+
ASTERISK_BASE = "text-rose-500 font-normal mx-0.5"
|
|
7
|
+
|
|
8
|
+
attr_reader :attributes
|
|
9
|
+
|
|
10
|
+
def initialize(**attributes)
|
|
11
|
+
super(**attributes)
|
|
12
|
+
@attributes[:class] = merge_classes([ BASE, attributes[:class], !!attributes[:for] ? "cursor-pointer" : "" ])
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def view_template(&)
|
|
16
|
+
label(**@attributes, &)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def asterisk(**mattributes)
|
|
20
|
+
mattributes[:class] = merge_classes([ ASTERISK_BASE, mattributes[:class] ])
|
|
21
|
+
span(**mattributes) { "*" }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def helper_text(**mattributes, &)
|
|
25
|
+
mattributes[:class] = merge_classes([ HELPER_BASE, mattributes[:class] ])
|
|
26
|
+
p(**mattributes, &)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Essence::Metric < Essence::Essence
|
|
4
|
+
BASE = "p-4 border rounded-xs"
|
|
5
|
+
HELPER_BASE = "text-xs uppercase font-medium text-gray-500"
|
|
6
|
+
TITLE_BASE = "text-2xl text-gray-900 font-medium"
|
|
7
|
+
BODY_BASE = "text-sm text-gray-700"
|
|
8
|
+
|
|
9
|
+
KINDS = {
|
|
10
|
+
primary: "",
|
|
11
|
+
secondary: "border-transparent bg-gray-100"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
attr_reader :kind
|
|
15
|
+
|
|
16
|
+
def initialize(kind: :primary, **attributes)
|
|
17
|
+
@kind = kind
|
|
18
|
+
super(**attributes)
|
|
19
|
+
@attributes[:class] = merge_classes([ BASE, KINDS[kind], @attributes[:class] ])
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def view_template(&)
|
|
23
|
+
div(**attributes, &)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def title(**mattributes, &)
|
|
27
|
+
mattributes[:class] = merge_classes([ TITLE_BASE, mattributes[:class] ])
|
|
28
|
+
h5(**mattributes, &)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def helper(**mattributes, &)
|
|
32
|
+
mattributes[:class] = merge_classes([ HELPER_BASE, mattributes[:class] ])
|
|
33
|
+
p(**mattributes, &)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def body(**mattributes, &)
|
|
37
|
+
mattributes[:class] = merge_classes([ BODY_BASE, mattributes[:class] ])
|
|
38
|
+
p(**mattributes, &)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Essence::Separator < Essence::Essence
|
|
4
|
+
BASE = "border-gray-200/50"
|
|
5
|
+
|
|
6
|
+
KINDS = {
|
|
7
|
+
horizontal: "border-t",
|
|
8
|
+
vertical: "border-l h-full"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
attr_reader :kind
|
|
12
|
+
attr_reader :attributes
|
|
13
|
+
|
|
14
|
+
def initialize(kind: :horizontal, **attributes)
|
|
15
|
+
@kind = kind
|
|
16
|
+
super(**attributes)
|
|
17
|
+
@attributes[:class] = merge_classes([ BASE, KINDS[kind], @attributes[:class] ])
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def view_template
|
|
21
|
+
element_tag(**attributes)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def element_tag(...)
|
|
27
|
+
kind.to_sym == :horizontal ? hr(...) : div(...)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# A switch component that can be toggled on and off.
|
|
4
|
+
#
|
|
5
|
+
# ==== Examples
|
|
6
|
+
#
|
|
7
|
+
# render Switch.new
|
|
8
|
+
#
|
|
9
|
+
# ==== Documentation
|
|
10
|
+
#
|
|
11
|
+
# https://essence.primevise.com/components/switch
|
|
12
|
+
#
|
|
13
|
+
class Essence::Switch < Essence::Essence
|
|
14
|
+
BASE = "relative inline-flex h-6 w-12 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition-colors duration-200 ease-in-out focus:ring-2 focus:ring-indigo-200 focus:ring-offset-2 focus:outline-hidden"
|
|
15
|
+
LEVER_BASE = "pointer-events-none inline-block size-5 translate-x-0 transform rounded-full bg-white ring-0 transition duration-200 ease-in-out"
|
|
16
|
+
|
|
17
|
+
ACTIVE_CLASSES = "bg-indigo-600"
|
|
18
|
+
INACTIVE_CLASSES = "bg-gray-200"
|
|
19
|
+
|
|
20
|
+
ACTIVE_LEVER_CLASSES = "translate-x-6"
|
|
21
|
+
INACTIVE_LEVER_CLASSES = "translate-x-0"
|
|
22
|
+
|
|
23
|
+
def initialize(**attributes)
|
|
24
|
+
super(**attributes)
|
|
25
|
+
@attributes[:class] = merge_classes([ BASE, @attributes[:class] ])
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def view_template(&)
|
|
29
|
+
button(**attributes) do
|
|
30
|
+
span(class: "sr-only") { "Use setting" }
|
|
31
|
+
span(
|
|
32
|
+
aria_hidden: "true",
|
|
33
|
+
class: LEVER_BASE,
|
|
34
|
+
data: {
|
|
35
|
+
essence__switch_target: "lever"
|
|
36
|
+
},
|
|
37
|
+
)
|
|
38
|
+
yield if block_given?
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def hidden_input(**mattributes)
|
|
43
|
+
mattributes[:type] = "hidden"
|
|
44
|
+
mattributes[:name] = mattributes[:name] || "enabled"
|
|
45
|
+
mattributes[:value] = mattributes[:value] || false
|
|
46
|
+
mattributes[:data] = { essence__switch_target: "input" }
|
|
47
|
+
|
|
48
|
+
input(**mattributes)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
private
|
|
52
|
+
|
|
53
|
+
def default_attributes
|
|
54
|
+
{
|
|
55
|
+
type: "button",
|
|
56
|
+
role: "switch",
|
|
57
|
+
aria_checked: false,
|
|
58
|
+
data: {
|
|
59
|
+
controller: "essence--switch",
|
|
60
|
+
action: "click->essence--switch#toggle",
|
|
61
|
+
essence__switch_active_class: ACTIVE_CLASSES,
|
|
62
|
+
essence__switch_inactive_class: INACTIVE_CLASSES,
|
|
63
|
+
essence__switch_active_lever_class: ACTIVE_LEVER_CLASSES,
|
|
64
|
+
essence__switch_inactive_lever_class: INACTIVE_LEVER_CLASSES
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class Essence::Text < Essence::Essence
|
|
4
|
+
BASE = "text-base text-gray-500 dark:text-gray-400"
|
|
5
|
+
SIZES = {
|
|
6
|
+
sm: "text-sm",
|
|
7
|
+
md: "text-base",
|
|
8
|
+
lg: "text-lg"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
attr_reader :size
|
|
12
|
+
|
|
13
|
+
def initialize(size: :md, **attributes)
|
|
14
|
+
super(**attributes)
|
|
15
|
+
@attributes[:class] = merge_classes([ BASE, SIZES[size], attributes[:class] ])
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def view_template(&)
|
|
19
|
+
p(**attributes, &)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
module Essence
|
|
2
2
|
class Configuration
|
|
3
|
+
attr_accessor :api_key
|
|
3
4
|
attr_accessor :phlex_components_path
|
|
4
5
|
attr_accessor :stimulus_controller_path
|
|
5
6
|
|
|
6
7
|
def initialize
|
|
8
|
+
@api_key = nil
|
|
7
9
|
@phlex_components_path = "app/components"
|
|
8
10
|
@stimulus_controller_path = "app/javascript/controllers/essence"
|
|
9
11
|
end
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
module Essence
|
|
2
|
+
DEFINITIONS = {
|
|
3
|
+
accordion: {
|
|
4
|
+
name: "Accordion",
|
|
5
|
+
class_name: "Essence::Accordion",
|
|
6
|
+
stimulus: false
|
|
7
|
+
},
|
|
8
|
+
alert: {
|
|
9
|
+
name: "Alert",
|
|
10
|
+
class_name: "Essence::Alert",
|
|
11
|
+
stimulus: false
|
|
12
|
+
},
|
|
13
|
+
avatar: {
|
|
14
|
+
name: "Avatar",
|
|
15
|
+
class_name: "Essence::Avatar",
|
|
16
|
+
stimulus: false
|
|
17
|
+
},
|
|
18
|
+
badge: {
|
|
19
|
+
name: "Badge",
|
|
20
|
+
class_name: "Essence::Badge",
|
|
21
|
+
stimulus: false
|
|
22
|
+
},
|
|
23
|
+
button: {
|
|
24
|
+
name: "Button",
|
|
25
|
+
class_name: "Essence::Button",
|
|
26
|
+
stimulus: false
|
|
27
|
+
},
|
|
28
|
+
checkbox: {
|
|
29
|
+
name: "Checkbox",
|
|
30
|
+
class_name: "Essence::Checkbox",
|
|
31
|
+
stimulus: false
|
|
32
|
+
},
|
|
33
|
+
heading: {
|
|
34
|
+
name: "Heading",
|
|
35
|
+
class_name: "Essence::Heading",
|
|
36
|
+
stimulus: false
|
|
37
|
+
},
|
|
38
|
+
label: {
|
|
39
|
+
name: "Label",
|
|
40
|
+
class_name: "Essence::Label",
|
|
41
|
+
stimulus: false
|
|
42
|
+
},
|
|
43
|
+
input: {
|
|
44
|
+
name: "Input",
|
|
45
|
+
class_name: "Essence::Input",
|
|
46
|
+
stimulus: false
|
|
47
|
+
},
|
|
48
|
+
link: {
|
|
49
|
+
name: "Link",
|
|
50
|
+
class_name: "Essence::Link",
|
|
51
|
+
stimulus: false
|
|
52
|
+
},
|
|
53
|
+
metric: {
|
|
54
|
+
name: "Metric",
|
|
55
|
+
class_name: "Essence::Metric",
|
|
56
|
+
stimulus: false
|
|
57
|
+
},
|
|
58
|
+
row: {
|
|
59
|
+
name: "Row",
|
|
60
|
+
class_name: "Essence::Row",
|
|
61
|
+
stimulus: false
|
|
62
|
+
},
|
|
63
|
+
separator: {
|
|
64
|
+
name: "Separator",
|
|
65
|
+
class_name: "Essence::Separator",
|
|
66
|
+
stimulus: false
|
|
67
|
+
},
|
|
68
|
+
skeleton: {
|
|
69
|
+
name: "Skeleton",
|
|
70
|
+
class_name: "Essence::Skeleton",
|
|
71
|
+
stimulus: false
|
|
72
|
+
},
|
|
73
|
+
switch: {
|
|
74
|
+
name: "Switch",
|
|
75
|
+
class_name: "Essence::Switch",
|
|
76
|
+
stimulus: true
|
|
77
|
+
},
|
|
78
|
+
tabs: {
|
|
79
|
+
name: "Tabs",
|
|
80
|
+
class_name: "Essence::Tabs",
|
|
81
|
+
stimulus: true
|
|
82
|
+
},
|
|
83
|
+
text: {
|
|
84
|
+
name: "Text",
|
|
85
|
+
class_name: "Essence::Text",
|
|
86
|
+
stimulus: false
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus";
|
|
2
|
+
|
|
3
|
+
export default class extends Controller {
|
|
4
|
+
static targets = ["input", "lever"];
|
|
5
|
+
|
|
6
|
+
static classes = ["active", "inactive", "activeLever", "inactiveLever"];
|
|
7
|
+
|
|
8
|
+
static values = {
|
|
9
|
+
checked: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: false,
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
connect() {
|
|
16
|
+
if (this.checkedValue) this.toggle();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
toggle(event) {
|
|
20
|
+
this.element.ariaChecked =
|
|
21
|
+
this.element.ariaChecked == "true" ? false : true;
|
|
22
|
+
|
|
23
|
+
if (this.hasInputTarget)
|
|
24
|
+
this.inputTarget.value = this.element.ariaChecked == "true";
|
|
25
|
+
|
|
26
|
+
this.element.classList.toggle(...this.activeClasses);
|
|
27
|
+
this.element.classList.toggle(...this.inactiveClasses);
|
|
28
|
+
|
|
29
|
+
this.leverTarget.classList.toggle(...this.activeLeverClasses);
|
|
30
|
+
this.leverTarget.classList.toggle(...this.inactiveLeverClasses);
|
|
31
|
+
}
|
|
32
|
+
}
|
data/lib/essence/version.rb
CHANGED
data/lib/essence.rb
CHANGED
|
@@ -3,20 +3,9 @@
|
|
|
3
3
|
require "tailwind_merge"
|
|
4
4
|
|
|
5
5
|
require_relative "essence/configuration"
|
|
6
|
+
require_relative "essence/definitions"
|
|
6
7
|
|
|
7
8
|
module Essence
|
|
8
|
-
# Autoloading
|
|
9
|
-
# Components
|
|
10
|
-
autoload :Accordion, "essence/components/accordion"
|
|
11
|
-
autoload :Avatar, "essence/components/avatar"
|
|
12
|
-
autoload :Badge, "essence/components/badge"
|
|
13
|
-
autoload :Button, "essence/components/button"
|
|
14
|
-
# autoload :Essence, "essence/components/essence" # Base component
|
|
15
|
-
autoload :Link, "essence/components/link"
|
|
16
|
-
autoload :Row, "essence/components/row"
|
|
17
|
-
autoload :Skeleton, "essence/components/skeleton"
|
|
18
|
-
|
|
19
|
-
# CLI
|
|
20
9
|
autoload :CLI, "essence/cli"
|
|
21
10
|
|
|
22
11
|
class << self
|
|
@@ -33,6 +22,10 @@ module Essence
|
|
|
33
22
|
yield configuration
|
|
34
23
|
end
|
|
35
24
|
|
|
25
|
+
def definitions
|
|
26
|
+
@definitions ||= Essence::DEFINITIONS
|
|
27
|
+
end
|
|
28
|
+
|
|
36
29
|
# COMPONENTS
|
|
37
30
|
def components
|
|
38
31
|
@components ||= {
|
|
@@ -41,6 +34,11 @@ module Essence
|
|
|
41
34
|
class_name: "Essence::Accordion",
|
|
42
35
|
stimulus: false
|
|
43
36
|
},
|
|
37
|
+
alert: {
|
|
38
|
+
name: "Alert",
|
|
39
|
+
class_name: "Essence::Alert",
|
|
40
|
+
stimulus: false
|
|
41
|
+
},
|
|
44
42
|
avatar: {
|
|
45
43
|
name: "Avatar",
|
|
46
44
|
class_name: "Essence::Avatar",
|
|
@@ -56,21 +54,51 @@ module Essence
|
|
|
56
54
|
class_name: "Essence::Button",
|
|
57
55
|
stimulus: false
|
|
58
56
|
},
|
|
57
|
+
checkbox: {
|
|
58
|
+
name: "Checkbox",
|
|
59
|
+
class_name: "Essence::Checkbox",
|
|
60
|
+
stimulus: false
|
|
61
|
+
},
|
|
62
|
+
label: {
|
|
63
|
+
name: "Label",
|
|
64
|
+
class_name: "Essence::Label",
|
|
65
|
+
stimulus: false
|
|
66
|
+
},
|
|
67
|
+
input: {
|
|
68
|
+
name: "Input",
|
|
69
|
+
class_name: "Essence::Input",
|
|
70
|
+
stimulus: false
|
|
71
|
+
},
|
|
59
72
|
link: {
|
|
60
73
|
name: "Link",
|
|
61
74
|
class_name: "Essence::Link",
|
|
62
75
|
stimulus: false
|
|
63
76
|
},
|
|
77
|
+
metric: {
|
|
78
|
+
name: "Metric",
|
|
79
|
+
class_name: "Essence::Metric",
|
|
80
|
+
stimulus: false
|
|
81
|
+
},
|
|
64
82
|
row: {
|
|
65
83
|
name: "Row",
|
|
66
84
|
class_name: "Essence::Row",
|
|
67
85
|
stimulus: false
|
|
68
86
|
},
|
|
87
|
+
separator: {
|
|
88
|
+
name: "Separator",
|
|
89
|
+
class_name: "Essence::Separator",
|
|
90
|
+
stimulus: false
|
|
91
|
+
},
|
|
69
92
|
skeleton: {
|
|
70
93
|
name: "Skeleton",
|
|
71
94
|
class_name: "Essence::Skeleton",
|
|
72
95
|
stimulus: false
|
|
73
96
|
},
|
|
97
|
+
switch: {
|
|
98
|
+
name: "Switch",
|
|
99
|
+
class_name: "Essence::Switch",
|
|
100
|
+
stimulus: true
|
|
101
|
+
},
|
|
74
102
|
tabs: {
|
|
75
103
|
name: "Tabs",
|
|
76
104
|
class_name: "Essence::Tabs",
|
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: essence
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Elvinas Predkelis
|
|
8
|
-
- Primevise
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: exe
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2025-
|
|
11
|
+
date: 2025-04-15 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: dry-cli
|
|
@@ -61,14 +60,13 @@ dependencies:
|
|
|
61
60
|
version: 0.13.3
|
|
62
61
|
description: Component library for Ruby applications using Phlex
|
|
63
62
|
email:
|
|
64
|
-
-
|
|
63
|
+
- elvinas@primevise.com
|
|
65
64
|
executables:
|
|
66
65
|
- essence
|
|
67
66
|
extensions: []
|
|
68
67
|
extra_rdoc_files: []
|
|
69
68
|
files:
|
|
70
69
|
- README.md
|
|
71
|
-
- essence/stimulus/tabs_controller.js
|
|
72
70
|
- exe/essence
|
|
73
71
|
- lib/essence.rb
|
|
74
72
|
- lib/essence/cli.rb
|
|
@@ -76,17 +74,29 @@ files:
|
|
|
76
74
|
- lib/essence/cli/install.rb
|
|
77
75
|
- lib/essence/cli/version.rb
|
|
78
76
|
- lib/essence/components/accordion.rb
|
|
77
|
+
- lib/essence/components/alert.rb
|
|
79
78
|
- lib/essence/components/avatar.rb
|
|
80
79
|
- lib/essence/components/badge.rb
|
|
81
80
|
- lib/essence/components/button.rb
|
|
81
|
+
- lib/essence/components/checkbox.rb
|
|
82
82
|
- lib/essence/components/dialog.rb
|
|
83
83
|
- lib/essence/components/dropdown.rb
|
|
84
84
|
- lib/essence/components/essence.rb
|
|
85
|
+
- lib/essence/components/heading.rb
|
|
86
|
+
- lib/essence/components/input.rb
|
|
87
|
+
- lib/essence/components/label.rb
|
|
85
88
|
- lib/essence/components/link.rb
|
|
89
|
+
- lib/essence/components/metric.rb
|
|
86
90
|
- lib/essence/components/row.rb
|
|
91
|
+
- lib/essence/components/separator.rb
|
|
87
92
|
- lib/essence/components/skeleton.rb
|
|
93
|
+
- lib/essence/components/switch.rb
|
|
88
94
|
- lib/essence/components/tabs.rb
|
|
95
|
+
- lib/essence/components/text.rb
|
|
89
96
|
- lib/essence/configuration.rb
|
|
97
|
+
- lib/essence/definitions.rb
|
|
98
|
+
- lib/essence/stimulus/switch_controller.js
|
|
99
|
+
- lib/essence/stimulus/tabs_controller.js
|
|
90
100
|
- lib/essence/version.rb
|
|
91
101
|
homepage: https://rubygems.org/gems/essence
|
|
92
102
|
licenses:
|
|
File without changes
|