essence 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41a46dd9be7eb9ea84ba3ca4ad2f3a20333154644472673c347117bd6fb6b652
4
- data.tar.gz: 3fd04819b2f327760571d3ec200a7300c45b7a4d7627b425e969a6999a051925
3
+ metadata.gz: b698fdfbf94b34b4afa01e1c6f38a2e9ac2feca00f34166c0acead4c4e6c8e40
4
+ data.tar.gz: b11e693d29dbc9bd6763725692570bffb8879cafb32967cc1c34a2fbc5c65881
5
5
  SHA512:
6
- metadata.gz: 5688120d6baf34e1de5049978bd7a8b63f18bfd9dae45ab8acfbe3096b42f36168c5408502e7d4fc24bdafb4cda29fa1e7db77469fc3b6cd297ec685e89bb0a7
7
- data.tar.gz: 9067b68f43129af1e0d5e4398b1d3682cf10bb05b0e06898ba708cec4d79e531e00129998a4697306c1b229fb139f33b985980c6216129a04279c1d02fb8e4d9
6
+ metadata.gz: b95a0636aca009728061fc524f93bfeacf2728aa846e7e6ff7afa8918ba99ce1a47ba80ef8bc44863d982c0cb8cc1ef760f61f9c367b9cddd9beda463de5798c
7
+ data.tar.gz: 371fb23359faf1f9e5835394c2fea1952813d7f43bf0f008704b641dca2d50faa2463c371869d1511a8625a22b9416ac8d2c3b59f09ceae36ca1c1e6fc865d29
data/README.md CHANGED
@@ -2,11 +2,53 @@
2
2
 
3
3
  A simple, ergonomic and performant component library for Ruby applications.
4
4
 
5
+ <a href="https://rubygems.org/gems/essence">
6
+ <img alt="Essence GEM Version" src="https://img.shields.io/gem/v/essence?color=10b981&include_prereleases&logo=ruby&logoColor=f43f5e">
7
+ </a>
8
+
9
+ <a href="https://rubygems.org/gems/essence">
10
+ <img alt="Essence GEM Version" src="https://img.shields.io/gem/dt/essence?color=10b981&include_prereleases&logo=ruby&logoColor=f43f5e">
11
+ </a>
12
+
13
+ ---
14
+
15
+ ### Features
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
21
+
5
22
  ---
6
23
 
7
24
  ## Installation
8
25
 
9
- TBA
26
+ #### Add gem
27
+
28
+ Simply add the gem to your Gemfile by running the following command
29
+
30
+ ```bash
31
+ bundle add essence
32
+ ```
33
+
34
+ #### Install Essence
35
+
36
+ Run the installation command and we'll take care of the rest
37
+
38
+ ```bash
39
+ bundle exec essence install
40
+ ```
41
+
42
+ More information on about the installation can be found in the [documentation](https://essence.primevise.com/installation)
43
+
44
+ ## Who uses Essence?
45
+
46
+ - [Mintis](https://mintis.app)
47
+ - [Hansa](https://hansahq.com)
48
+ - [Release Server](https://releaseserver.com)
49
+ - [College Life Work](https://work.collegelife.co)
50
+
51
+ Do you use Essence in your project? Let us know!
10
52
 
11
53
  ## Licence
12
54
 
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Essence::Button < Essence::Essence
4
+ BASE = "inline-flex items-center justify-center w-fit rounded-xs border border-transparent font-medium transition duration-150 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90"
5
+ SIZES = {
6
+ none: "",
7
+ xs: "text-[0.6rem] px-2 py-1.5 gap-1",
8
+ sm: "text-xs px-3 py-2 gap-1.5",
9
+ md: "text-sm px-4 py-2 gap-2",
10
+ lg: "text-base px-6 py-2.5 gap-2.5",
11
+ xl: "text-base px-8 py-3 gap-3"
12
+ }
13
+ KINDS = {
14
+ primary: "text-white bg-indigo-500 hover:bg-indigo-500",
15
+ secondary: "text-gray-700 bg-gray-100 hover:bg-gray-200",
16
+ critical: "text-white bg-rose-500 hover:bg-rose-400",
17
+ warning: "text-white bg-amber-500 hover:bg-amber-400",
18
+ success: "text-white bg-emerald-500 hover:bg-emerald-400",
19
+ info: "text-white bg-blue-500 hover:bg-blue-400",
20
+ dark: "text-white bg-gray-900 hover:bg-gray-800",
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"
23
+ }
24
+
25
+ attr_reader :size
26
+ attr_reader :kind
27
+ attr_reader :attributes
28
+
29
+ def initialize(size: :md, kind: :primary, **attributes)
30
+ @size = size
31
+ @kind = kind
32
+ @attributes = attributes
33
+ @attributes[:class] = construct_classes(@attributes[:class])
34
+ end
35
+
36
+ def view_template(&)
37
+ element_tag(**attributes, &)
38
+ end
39
+
40
+ private
41
+
42
+ def element_tag(...)
43
+ attributes[:href] ? a(...) : button(...)
44
+ end
45
+
46
+ def construct_classes(classes)
47
+ TAILWIND_MERGER.merge([ BASE, SIZES[size], KINDS[kind], classes ].compact)
48
+ end
49
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Essence::Avatar < Essence::Essence
4
+ BASE = "border border-transparent rounded-full bg-gray-100 aspect-square inline-flex items-center justify-center font-medium text-gray-700"
5
+ SIZES = {
6
+ sm: "size-6 text-xs",
7
+ md: "size-8 text-sm",
8
+ lg: "size-12 text-base"
9
+ }
10
+
11
+ attr_reader :attributes
12
+ attr_reader :size
13
+
14
+ def initialize(size: :md, **attributes)
15
+ @size = size
16
+ @attributes = attributes
17
+ @attributes[:class] = construct_classes(@attributes[:class])
18
+ end
19
+
20
+ def view_template(&)
21
+ div(**attributes, &)
22
+ end
23
+
24
+ def fallback(**attrs, &)
25
+ span(**attrs, &)
26
+ end
27
+
28
+ def construct_classes(classes)
29
+ TAILWIND_MERGER.merge([ BASE, SIZES[size], classes ].compact)
30
+ end
31
+ end
@@ -1,27 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Essence::Button < Essence::Essence
4
- BASE = "inline-flex items-center rounded-xs border border-transparent font-medium transition duration-150 cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed hover:opacity-90"
5
-
3
+ class Essence::Badge < Essence::Essence
4
+ BASE = "inline-flex items-center justify-center w-fit rounded-full border border-transparent font-medium transition duration-150 hover:opacity-90"
6
5
  SIZES = {
7
6
  none: "",
8
- xs: "text-[0.6rem] px-2 py-1.5 gap-1",
9
- sm: "text-xs px-3 py-2 gap-1.5",
10
- md: "text-sm px-4 py-2 gap-2",
11
- lg: "text-base px-6 py-2.5 gap-2.5",
12
- xl: "text-base px-8 py-3 gap-3"
7
+ sm: "text-[0.65rem] px-2 py-0.5 gap-1",
8
+ md: "text-xs px-2.5 py-1 gap-2",
9
+ lg: "text-sm px-4 py-1.5 gap-2"
13
10
  }
14
-
15
11
  KINDS = {
16
- primary: "text-white bg-indigo-500 hover:bg-indigo-500",
17
- secondary: "text-gray-700 bg-gray-100 hover:bg-gray-200",
18
- critical: "text-white bg-rose-500 hover:bg-rose-400",
19
- warning: "text-white bg-amber-500 hover:bg-amber-400",
20
- success: "text-white bg-emerald-500 hover:bg-emerald-400",
21
- info: "text-white bg-blue-500 hover:bg-blue-400",
22
- dark: "text-white bg-gray-900 hover:bg-gray-800",
23
- white: "text-gray-900 bg-white hover:bg-gray-200",
24
- ghost: "text-gray-900 bg-white hover:bg-gray-200 hover:text-gray-800"
12
+ primary: "text-gray-900 border-gray-200",
13
+ success: "text-white bg-emerald-500",
14
+ critical: "text-white bg-rose-500",
15
+ warning: "text-white bg-amber-500",
16
+ info: "text-white bg-blue-500",
17
+ dark: "text-white bg-gray-900",
18
+ white: "text-gray-900 bg-white"
25
19
  }
26
20
 
27
21
  attr_reader :size
@@ -36,16 +30,13 @@ class Essence::Button < Essence::Essence
36
30
  end
37
31
 
38
32
  def view_template(&)
39
- element_tag(**attributes, &)
33
+ div(**attributes, &)
40
34
  end
41
35
 
42
36
  private
43
37
 
44
- def element_tag(...)
45
- attributes[:href] ? a(...) : button(...)
46
- end
47
-
48
38
  def construct_classes(classes)
49
39
  TAILWIND_MERGER.merge([ BASE, SIZES[size], KINDS[kind], classes ].compact)
50
40
  end
41
+
51
42
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Essence::Link < Essence::Essence
4
- CLASS = "inline-flex items-center gap-1 font-medium text-gray-900 border-b-2 hover:border-gray-900 transition-colors"
4
+ BASE = "inline-flex w-fit items-center gap-1 font-medium text-gray-900 border-b-2 hover:border-gray-900 transition-colors"
5
5
  KINDS = {
6
6
  regular: "border-transparent",
7
7
  underline: "border-gray-200"
@@ -11,7 +11,7 @@ class Essence::Link < Essence::Essence
11
11
 
12
12
  def initialize(kind: :regular, **attributes)
13
13
  @attributes = attributes
14
- @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ CLASS, @attributes[:class] ]) : CLASS
14
+ @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ BASE, @attributes[:class] ]) : BASE
15
15
  end
16
16
 
17
17
  def view_template(&)
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Essence::Row < Essence::Essence
4
- CLASS = "flex gap-4"
5
-
4
+ BASE = "flex gap-4"
6
5
  KINDS = {
7
6
  default: "flex-col md:flex-row md:items-center md:justify-between",
8
7
  center: "flex-col md:flex-row md:items-center md:justify-center",
@@ -16,7 +15,7 @@ class Essence::Row < Essence::Essence
16
15
  def initialize(kind: :default, **attributes)
17
16
  @kind = kind
18
17
  @attributes = attributes
19
- @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ CLASS, KINDS[kind], @attributes[:class] ]) : CLASS
18
+ @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ BASE, KINDS[kind], @attributes[:class] ]) : BASE
20
19
  end
21
20
 
22
21
  def view_template(&)
@@ -24,6 +23,6 @@ class Essence::Row < Essence::Essence
24
23
  end
25
24
 
26
25
  def item(**attrs, &)
27
- div(class: TAILWIND_MERGER.merge([ "flex items-center gap-2 flex-wrap", iattrs[:class] ]), **attrs, &)
26
+ div(class: TAILWIND_MERGER.merge([ "flex items-center gap-2 flex-wrap", attrs[:class] ]), **attrs, &)
28
27
  end
29
28
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Essence::Skeleton < Essence::Essence
4
- CLASSES = "animate-pulse bg-gray-200/55 rounded-xs"
4
+ BASE = "animate-pulse bg-gray-200/55 rounded-xs"
5
5
 
6
6
  def initialize(**attributes)
7
7
  @attributes = attributes
8
- @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ CLASSES, @attributes[:class] ]) : CLASSES
8
+ @attributes[:class] = @attributes[:class] ? TAILWIND_MERGER.merge([ BASE, @attributes[:class] ]) : BASE
9
9
  end
10
10
 
11
11
  def view_template(&)
@@ -1,3 +1,3 @@
1
1
  module Essence
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/essence.rb CHANGED
@@ -19,6 +19,8 @@ module Essence
19
19
  def self.component_class_names
20
20
  @component_class_names ||= {
21
21
  essence: "Essence::Essence",
22
+ avataro: "Essence::Avatar",
23
+ badge: "Essence::Badge",
22
24
  button: "Essence::Button",
23
25
  link: "Essence::Link",
24
26
  skeleton: "Essence::Skeleton",
@@ -29,6 +31,8 @@ module Essence
29
31
  def self.component_classes
30
32
  @components_classes ||= {
31
33
  essence: ::Essence::Essence,
34
+ avatar: ::Essence::Avatar,
35
+ badge: ::Essence::Badge,
32
36
  button: ::Essence::Button,
33
37
  link: ::Essence::Link,
34
38
  skeleton: ::Essence::Skeleton,
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.0
4
+ version: 0.2.1
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-18 00:00:00.000000000 Z
12
+ date: 2024-12-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-cli
@@ -74,6 +74,8 @@ 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/avatar.rb
78
+ - lib/essence/components/badge.rb
77
79
  - lib/essence/components/button.rb
78
80
  - lib/essence/components/essence.rb
79
81
  - lib/essence/components/link.rb