essence 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -4
- data/lib/essence/components/accordion.rb +36 -0
- data/lib/essence/components/avatar.rb +2 -6
- data/lib/essence/components/badge.rb +2 -8
- data/lib/essence/components/button.rb +3 -7
- data/lib/essence/components/dialog.rb +21 -0
- data/lib/essence/components/dropdown.rb +18 -0
- data/lib/essence/components/essence.rb +3 -5
- data/lib/essence/components/link.rb +2 -2
- data/lib/essence/components/row.rb +2 -2
- data/lib/essence/components/skeleton.rb +2 -2
- data/lib/essence/version.rb +1 -1
- data/lib/essence.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9a6970b18d2b7b5546ed98b54b5a782b74cbd92b379f69b996643416f604bd8
|
4
|
+
data.tar.gz: e1fedc61962792961d2ae47ecb01f7fe77c6c312ec2efb0987a4faa5b8e88cf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22926d9d79c1ed96f02d48791b6badd99d032b7c23edd93d0159c9a5b2c275606f5570b8881543ed582066b3d7cd9187c94a2504ab3f6c97805e7f12d09cc1e7
|
7
|
+
data.tar.gz: 3d8816d4799f4e415ca1f7733202a914e1332579c2df95a24da7c3e0fca81039833b925a5df9f3625dce086c43f708a994c89525c4edc14e9da532f99a7e9a1f
|
data/README.md
CHANGED
@@ -14,10 +14,10 @@ A simple, ergonomic and performant component library for Ruby applications.
|
|
14
14
|
|
15
15
|
### Features
|
16
16
|
|
17
|
-
- Tailored components -
|
18
|
-
- Gorgeous simplicity -
|
19
|
-
- Geared for performance -
|
20
|
-
- Ergonomic approach -
|
17
|
+
- Tailored components - Flexible by design while streamlining the development process
|
18
|
+
- Gorgeous simplicity - Empowers minimalistic user interface with purposeful accents
|
19
|
+
- Geared for performance - Built with performance in mind
|
20
|
+
- Ergonomic approach - Designed to be easy to use and understand
|
21
21
|
|
22
22
|
---
|
23
23
|
|
@@ -45,6 +45,7 @@ More information on about the installation can be found in the [documentation](h
|
|
45
45
|
|
46
46
|
- [Mintis](https://mintis.app)
|
47
47
|
- [Hansa](https://hansahq.com)
|
48
|
+
- [Oversee](https://github.com/primevise/oversee)
|
48
49
|
- [Release Server](https://releaseserver.com)
|
49
50
|
- [College Life Work](https://work.collegelife.co)
|
50
51
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Essence::Accordion < Essence::Essence
|
4
|
+
BASE = "group py-4"
|
5
|
+
TRIGGER_BASE = "cursor-pointer list-none flex items-center justify-between text-base font-medium"
|
6
|
+
CONTENT_BASE = "py-2 transform transition-all duration-500 not-open:-mt-4 opacity-0 group-open:opacity-100 group-open:mt-0 text-sm"
|
7
|
+
CHEVRON_BASE = "transform transition-all duration-300 rotate-90 group-open:-rotate-90 text-lg text-gray-700"
|
8
|
+
|
9
|
+
attr_reader :attributes
|
10
|
+
|
11
|
+
def initialize(**attributes)
|
12
|
+
super(**attributes)
|
13
|
+
@attributes[:class] = merge_classes([ BASE, @attributes[:class]])
|
14
|
+
end
|
15
|
+
|
16
|
+
def view_template(&)
|
17
|
+
details(class: "w-full group py-4", &) if block_given?
|
18
|
+
end
|
19
|
+
|
20
|
+
def trigger(**tattributes, &)
|
21
|
+
summary(class: merge_classes(TRIGGER_BASE, tattributes[:class])) do
|
22
|
+
p(class: "inline", &)
|
23
|
+
span(class: CHEVRON_BASE) { "›" }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def content(**cattributes, &)
|
28
|
+
p(class: merge_classes(CONTENT_BASE, cattributes[:class]), &)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def merge_classes(*classes)
|
34
|
+
TAILWIND_MERGER.merge([ *classes ].compact)
|
35
|
+
end
|
36
|
+
end
|
@@ -13,9 +13,9 @@ class Essence::Avatar < Essence::Essence
|
|
13
13
|
attr_reader :size
|
14
14
|
|
15
15
|
def initialize(size: :md, **attributes)
|
16
|
+
super(**attributes)
|
16
17
|
@size = size
|
17
|
-
@attributes = attributes
|
18
|
-
@attributes[:class] = construct_classes(@attributes[:class])
|
18
|
+
@attributes[:class] = merge_classes([ BASE, SIZES[size], @attributes[:class]])
|
19
19
|
end
|
20
20
|
|
21
21
|
def view_template(&)
|
@@ -28,8 +28,4 @@ class Essence::Avatar < Essence::Essence
|
|
28
28
|
def fallback(**attrs, &)
|
29
29
|
div(**attrs, &)
|
30
30
|
end
|
31
|
-
|
32
|
-
def construct_classes(classes)
|
33
|
-
TAILWIND_MERGER.merge([ BASE, SIZES[size], classes ].compact)
|
34
|
-
end
|
35
31
|
end
|
@@ -25,17 +25,11 @@ class Essence::Badge < Essence::Essence
|
|
25
25
|
def initialize(size: :md, kind: :primary, **attributes)
|
26
26
|
@size = size
|
27
27
|
@kind = kind
|
28
|
-
|
29
|
-
@attributes[:class] =
|
28
|
+
super(**attributes)
|
29
|
+
@attributes[:class] = merge_classes([ BASE, SIZES[size], KINDS[kind], @attributes[:class]])
|
30
30
|
end
|
31
31
|
|
32
32
|
def view_template(&)
|
33
33
|
div(**attributes, &)
|
34
34
|
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def construct_classes(classes)
|
39
|
-
TAILWIND_MERGER.merge([ BASE, SIZES[size], KINDS[kind], classes ].compact)
|
40
|
-
end
|
41
35
|
end
|
@@ -19,7 +19,7 @@ class Essence::Button < Essence::Essence
|
|
19
19
|
info: "text-white bg-blue-500 hover:bg-blue-400",
|
20
20
|
dark: "text-white bg-gray-900 hover:bg-gray-800",
|
21
21
|
white: "text-gray-900 bg-white hover:bg-gray-200",
|
22
|
-
ghost: "text-gray-900
|
22
|
+
ghost: "text-gray-900 hover:bg-gray-200 hover:text-gray-800"
|
23
23
|
}
|
24
24
|
|
25
25
|
attr_reader :size
|
@@ -29,8 +29,8 @@ class Essence::Button < Essence::Essence
|
|
29
29
|
def initialize(size: :md, kind: :primary, **attributes)
|
30
30
|
@size = size
|
31
31
|
@kind = kind
|
32
|
-
|
33
|
-
@attributes[:class] =
|
32
|
+
super(**attributes)
|
33
|
+
@attributes[:class] = merge_classes([ BASE, SIZES[size], KINDS[kind], @attributes[:class]])
|
34
34
|
end
|
35
35
|
|
36
36
|
def view_template(&)
|
@@ -42,8 +42,4 @@ class Essence::Button < Essence::Essence
|
|
42
42
|
def element_tag(...)
|
43
43
|
attributes[:href] ? a(...) : button(...)
|
44
44
|
end
|
45
|
-
|
46
|
-
def construct_classes(classes)
|
47
|
-
TAILWIND_MERGER.merge([ BASE, SIZES[size], KINDS[kind], classes ].compact)
|
48
|
-
end
|
49
45
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Essence::Dialog < Essence::Essence
|
4
|
+
BASE = ""
|
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
|
+
dialog(**attributes) do
|
15
|
+
yield if block_given?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def footer(&)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Essence::Dropdown < Essence::Essence
|
4
|
+
BASE = ""
|
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
|
+
div(**attributes) do
|
15
|
+
yield if block_given?
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -6,13 +6,11 @@ class Essence::Essence < Phlex::HTML
|
|
6
6
|
attr_reader :attributes
|
7
7
|
|
8
8
|
def initialize(**attributes)
|
9
|
-
@attributes = attributes
|
10
|
-
@attributes[:class] = TAILWIND_MERGER.merge([self.class::CLASSES, @attributes[:class]]) if @attributes[:class]
|
9
|
+
@attributes = default_attributes.deep_merge(attributes)
|
11
10
|
end
|
12
11
|
|
13
12
|
private
|
14
13
|
|
15
|
-
def default_attributes
|
16
|
-
|
17
|
-
end
|
14
|
+
def default_attributes = {}
|
15
|
+
def merge_classes(*classes) = TAILWIND_MERGER.merge([ *classes ].compact)
|
18
16
|
end
|
@@ -10,8 +10,8 @@ class Essence::Link < Essence::Essence
|
|
10
10
|
attr_reader :attributes
|
11
11
|
|
12
12
|
def initialize(kind: :regular, **attributes)
|
13
|
-
|
14
|
-
@attributes[:class] =
|
13
|
+
super(**attributes)
|
14
|
+
@attributes[:class] = merge_classes([ BASE, @attributes[:class]])
|
15
15
|
end
|
16
16
|
|
17
17
|
def view_template(&)
|
@@ -14,8 +14,8 @@ class Essence::Row < Essence::Essence
|
|
14
14
|
|
15
15
|
def initialize(kind: :default, **attributes)
|
16
16
|
@kind = kind
|
17
|
-
|
18
|
-
@attributes[:class] =
|
17
|
+
super(**attributes)
|
18
|
+
@attributes[:class] = merge_classes([ BASE, KINDS[kind], @attributes[:class]])
|
19
19
|
end
|
20
20
|
|
21
21
|
def view_template(&)
|
@@ -4,8 +4,8 @@ class Essence::Skeleton < Essence::Essence
|
|
4
4
|
BASE = "animate-pulse bg-gray-200/55 rounded-xs"
|
5
5
|
|
6
6
|
def initialize(**attributes)
|
7
|
-
|
8
|
-
@attributes[:class] =
|
7
|
+
super(**attributes)
|
8
|
+
@attributes[:class] = merge_classes([ BASE, @attributes[:class]])
|
9
9
|
end
|
10
10
|
|
11
11
|
def view_template(&)
|
data/lib/essence/version.rb
CHANGED
data/lib/essence.rb
CHANGED
@@ -4,6 +4,7 @@ require "tailwind_merge"
|
|
4
4
|
|
5
5
|
module Essence
|
6
6
|
# Autoloading
|
7
|
+
autoload :Accordion, "essence/components/accordion"
|
7
8
|
autoload :Avatar, "essence/components/avatar"
|
8
9
|
autoload :Badge, "essence/components/badge"
|
9
10
|
autoload :Button, "essence/components/button"
|
@@ -20,6 +21,7 @@ module Essence
|
|
20
21
|
def self.component_class_names
|
21
22
|
@component_class_names ||= {
|
22
23
|
essence: "Essence::Essence",
|
24
|
+
accordion: "Essence::Accordion",
|
23
25
|
avatar: "Essence::Avatar",
|
24
26
|
badge: "Essence::Badge",
|
25
27
|
button: "Essence::Button",
|
@@ -32,6 +34,7 @@ module Essence
|
|
32
34
|
def self.component_classes
|
33
35
|
@components_classes ||= {
|
34
36
|
essence: ::Essence::Essence,
|
37
|
+
accordion: ::Essence::Accordion,
|
35
38
|
avatar: ::Essence::Avatar,
|
36
39
|
badge: ::Essence::Badge,
|
37
40
|
button: ::Essence::Button,
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: essence
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elvinas Predkelis
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-12-
|
12
|
+
date: 2024-12-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-cli
|
@@ -74,9 +74,12 @@ files:
|
|
74
74
|
- lib/essence/cli/add.rb
|
75
75
|
- lib/essence/cli/install.rb
|
76
76
|
- lib/essence/cli/version.rb
|
77
|
+
- lib/essence/components/accordion.rb
|
77
78
|
- lib/essence/components/avatar.rb
|
78
79
|
- lib/essence/components/badge.rb
|
79
80
|
- lib/essence/components/button.rb
|
81
|
+
- lib/essence/components/dialog.rb
|
82
|
+
- lib/essence/components/dropdown.rb
|
80
83
|
- lib/essence/components/essence.rb
|
81
84
|
- lib/essence/components/link.rb
|
82
85
|
- lib/essence/components/row.rb
|