essence 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f9be2e0f4b7e7288c5cf845c54d67988f472a967ebdd04b6d01ac790c1d1c7a4
4
- data.tar.gz: f1ebff9a5f1f108042f48f3241edc2cd5d8998d9605b20d6e52bed3b338219dc
3
+ metadata.gz: c9a6970b18d2b7b5546ed98b54b5a782b74cbd92b379f69b996643416f604bd8
4
+ data.tar.gz: e1fedc61962792961d2ae47ecb01f7fe77c6c312ec2efb0987a4faa5b8e88cf1
5
5
  SHA512:
6
- metadata.gz: 067d0df4723dd420b5100d7c21c417f37e959e62e325154fcd3671a22b3b919d51720e6b6a911233a8791065d0a3a93a9b931c0111b5e4b90454aa6c8648b80c
7
- data.tar.gz: 06d8732651332803411614ae867fd3e78ae226853992fd3d0367bc441054925d6647d4c2151d0c3e0af4b24990b8a24891c8042f816789cd454cda9f5197e03d
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 - Designed using flexibility in mind while streamlining the development process
18
- - Gorgeous simplicity - Essence empowers minimalistic user interface with purposeful accents
19
- - Geared for performance - Keep everything in one place. No spreadsheets or getting lost between tooling
20
- - Ergonomic approach - Essence is designed to be easy to use and understand
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
- @attributes = attributes
29
- @attributes[:class] = construct_classes(@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 bg-white hover:bg-gray-200 hover:text-gray-800"
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
- @attributes = attributes
33
- @attributes[:class] = construct_classes(@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
- @attributes = attributes
14
- @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ BASE, @attributes[:class] ]) : BASE
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
- @attributes = attributes
18
- @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ BASE, KINDS[kind], @attributes[:class] ]) : BASE
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
- @attributes = attributes
8
- @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ BASE, @attributes[:class] ]) : BASE
7
+ super(**attributes)
8
+ @attributes[:class] = merge_classes([ BASE, @attributes[:class]])
9
9
  end
10
10
 
11
11
  def view_template(&)
@@ -1,3 +1,3 @@
1
1
  module Essence
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
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.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-22 00:00:00.000000000 Z
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