vitrail 0.3.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a21fd7a542ed8c1e4d3607925dbf30522b1dbcab267e62c332ea579eec8494f
4
- data.tar.gz: 5672e0d10c8dc43b25e305baa3378b2ac5af88ad82a8a0cc90e4754a56560a12
3
+ metadata.gz: 3847f0778cef05c75a87efdd00cd1393ed57b30914e49afc768dd1593c0866bc
4
+ data.tar.gz: 4c8ab120e0ad5a156167605dafa1a390b11c3360f9bc1cef6f1fe85dbb4f80ef
5
5
  SHA512:
6
- metadata.gz: ef007d0e9d8dea67411131415a44eaf79e9504bbcada06d08ba46dbcbddcc484a0b3046065402d9ece2fc96ba7cb3009e463dfcd71eed0461b7c186eebf041f8
7
- data.tar.gz: c50f4bdbdefd11a2ab94b3a3c4a928690912f8331a93bd0deb096e04ed18c740e94dbac1307ab6598367004149b682bd4cb8e4f52999ce70478d06a33d88657a
6
+ metadata.gz: 4dbaeed7ff26ae42fc038b7b0c8f4f5709f96014e21f93fa0adbca23bf11de2eef8f43740ff8e538bdaed023bcb21d977a8c0add21708e3159f11d31316ca8e6
7
+ data.tar.gz: e798ddfb27bcb3fd253ea97ca8ff8e762a9a2f28bd1612f7d78e29ea6863ebe7dab99018e0a3b885cd29b8eb225ca4e870d2a3c69254b3221b35996ee513476b
@@ -726,6 +726,10 @@ select {
726
726
  margin-left: 0.5rem;
727
727
  }
728
728
 
729
+ .ml-3 {
730
+ margin-left: 0.75rem;
731
+ }
732
+
729
733
  .block {
730
734
  display: block;
731
735
  }
@@ -746,10 +750,18 @@ select {
746
750
  display: flow-root;
747
751
  }
748
752
 
753
+ .max-h-\[28rem\] {
754
+ max-height: 28rem;
755
+ }
756
+
749
757
  .min-w-full {
750
758
  min-width: 100%;
751
759
  }
752
760
 
761
+ .flex-shrink-0 {
762
+ flex-shrink: 0;
763
+ }
764
+
753
765
  .table-auto {
754
766
  table-layout: auto;
755
767
  }
@@ -778,44 +790,34 @@ select {
778
790
  border-color: rgb(209 213 219 / var(--tw-divide-opacity));
779
791
  }
780
792
 
781
- .overflow-x-auto {
782
- overflow-x: auto;
783
- }
784
-
785
793
  .truncate {
786
794
  overflow: hidden;
787
795
  text-overflow: ellipsis;
788
796
  white-space: nowrap;
789
797
  }
790
798
 
791
- .border-red-400 {
792
- --tw-border-opacity: 1;
793
- border-color: rgb(248 113 113 / var(--tw-border-opacity));
799
+ .border {
800
+ border-width: 1px;
794
801
  }
795
802
 
796
- .border-red-200 {
797
- --tw-border-opacity: 1;
798
- border-color: rgb(254 202 202 / var(--tw-border-opacity));
803
+ .\!border-red-200 {
804
+ --tw-border-opacity: 1 !important;
805
+ border-color: rgb(254 202 202 / var(--tw-border-opacity)) !important;
799
806
  }
800
807
 
801
- .bg-white {
802
- --tw-bg-opacity: 1;
803
- background-color: rgb(255 255 255 / var(--tw-bg-opacity));
804
- }
805
-
806
- .bg-red-500 {
807
- --tw-bg-opacity: 1;
808
- background-color: rgb(239 68 68 / var(--tw-bg-opacity));
808
+ .border-slate-200 {
809
+ --tw-border-opacity: 1;
810
+ border-color: rgb(226 232 240 / var(--tw-border-opacity));
809
811
  }
810
812
 
811
- .bg-red-200 {
812
- --tw-bg-opacity: 1;
813
- background-color: rgb(254 202 202 / var(--tw-bg-opacity));
813
+ .\!bg-red-100 {
814
+ --tw-bg-opacity: 1 !important;
815
+ background-color: rgb(254 226 226 / var(--tw-bg-opacity)) !important;
814
816
  }
815
817
 
816
- .bg-red-100 {
818
+ .bg-white {
817
819
  --tw-bg-opacity: 1;
818
- background-color: rgb(254 226 226 / var(--tw-bg-opacity));
820
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
819
821
  }
820
822
 
821
823
  .px-3 {
@@ -850,10 +852,19 @@ select {
850
852
  font-weight: 500;
851
853
  }
852
854
 
855
+ .font-semibold {
856
+ font-weight: 600;
857
+ }
858
+
853
859
  .uppercase {
854
860
  text-transform: uppercase;
855
861
  }
856
862
 
863
+ .text-red-800 {
864
+ --tw-text-opacity: 1;
865
+ color: rgb(153 27 27 / var(--tw-text-opacity));
866
+ }
867
+
857
868
  .text-slate-500 {
858
869
  --tw-text-opacity: 1;
859
870
  color: rgb(100 116 139 / var(--tw-text-opacity));
@@ -864,9 +875,9 @@ select {
864
875
  color: rgb(71 85 105 / var(--tw-text-opacity));
865
876
  }
866
877
 
867
- .text-red-800 {
878
+ .text-slate-900 {
868
879
  --tw-text-opacity: 1;
869
- color: rgb(153 27 27 / var(--tw-text-opacity));
880
+ color: rgb(15 23 42 / var(--tw-text-opacity));
870
881
  }
871
882
 
872
883
  /*
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vitrail
4
+ class Badge < BaseComponent
5
+ erb_template <<~ERB.squish
6
+ <span class="<%= html_classes %>" <%= html_attributes %>>
7
+ <%= content %>
8
+ </span>
9
+ ERB
10
+
11
+ def initialize(level: :default, **html_options)
12
+ super(**html_options)
13
+ @level = level
14
+ end
15
+
16
+ private
17
+
18
+ attr_reader :level
19
+
20
+ LOCAL_CLASSES = "inline-flex items-center rounded-full px-2 py-1 text-xs font-medium ring-1 ring-inset"
21
+ LEVEL_CLASSES = {
22
+ default: "bg-blue-50 text-blue-700 ring-blue-700/10",
23
+ info: "bg-blue-50 text-blue-700 ring-blue-700/10",
24
+ positive: "bg-green-50 text-green-700 ring-green-700/10",
25
+ negative: "bg-yellow-50 text-yellow-700 ring-yellow-700/10",
26
+ warning: "bg-red-50 text-red-700 ring-red-700/10",
27
+ urgent: "bg-red-700 text-white ring-red-700/10"
28
+ }.freeze
29
+ private_constant :LEVEL_CLASSES
30
+
31
+ def local_classes = [LOCAL_CLASSES, LEVEL_CLASSES[level]].join(" ")
32
+ end
33
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vitrail
4
+ class LinkTo < ViewComponent::Base
5
+ def initialize(level, options = nil, html_options = nil)
6
+ @level = level
7
+ @options = options
8
+ @html_options = html_options || {}
9
+ end
10
+
11
+ def call = link_to(options, decorated_html_options) { content }
12
+
13
+ private
14
+
15
+ attr_reader :level, :options, :html_options
16
+
17
+ GLOBAL_CLASSES = "font-semibold px-3 py-2".freeze
18
+ private_constant :GLOBAL_CLASSES
19
+
20
+ LEVEL_CLASSES = {
21
+ primary: <<~TXT.squish,
22
+ text-indigo-600 hover:text-indigo-500
23
+ focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2
24
+ focus-visible:outline-indigo-600
25
+ TXT
26
+ secondary: <<~TXT.squish,
27
+ text-slate-700 hover:text-slate-80
28
+ underline decoration-dashed underline-offset-4 decoration-slate-500
29
+ TXT
30
+ }.freeze
31
+ private_constant :LEVEL_CLASSES
32
+ def level_classes
33
+ LEVEL_CLASSES[level.to_sym]
34
+ end
35
+
36
+ def decorated_html_options
37
+ html_options&.merge(class: [GLOBAL_CLASSES, level_classes].join(" "))
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,15 @@
1
+ <%= render Vitrail::Card.new(class: level_background) do %>
2
+ <div class="flex">
3
+ <div class="flex-shrink-0">
4
+ <i class="<%= level_icon %>"></i>
5
+ </div>
6
+ <div class="ml-3">
7
+ <h4 class="font-semibold text-slate-900">
8
+ <%= title %>
9
+ </h4>
10
+ <div class="text-slate-600">
11
+ <%= content %>
12
+ </div>
13
+ </div>
14
+ </div>
15
+ <% end %>
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vitrail
4
+ class Notice < BaseComponent
5
+ def initialize(title:, level: :default, **html_options)
6
+ super(**html_options)
7
+ @title = title
8
+ @level = level
9
+ end
10
+
11
+ private
12
+
13
+ attr_reader :title, :level
14
+
15
+ LEVEL_BACKGROUNDS = {
16
+ default: "!bg-gray-50",
17
+ caution: "!bg-yellow-50",
18
+ critical: "!bg-red-50"
19
+ }.freeze
20
+ private_constant :LEVEL_BACKGROUNDS
21
+ def level_background = LEVEL_BACKGROUNDS[level]
22
+
23
+ LEVEL_ICONS = {
24
+ default: "fa-solid fa-square-info text-gray-500",
25
+ caution: "fa-solid fa-square-info text-yellow-600",
26
+ critical: "fa-solid fa-triangle-exclamation text-red-600"
27
+ }.freeze
28
+ private_constant :LEVEL_ICONS
29
+ def level_icon = LEVEL_ICONS[level]
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Vitrail
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vitrail
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume CABANEL
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-21 00:00:00.000000000 Z
11
+ date: 2023-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -66,9 +66,13 @@ files:
66
66
  - app/assets/stylesheets/vitrail.tailwind.css
67
67
  - app/assets/stylesheets/vitrail/application.css
68
68
  - app/assets/stylesheets/vitrail/vitrail.css
69
+ - app/components/vitrail/badge.rb
69
70
  - app/components/vitrail/base_component.rb
70
71
  - app/components/vitrail/card.html.erb
71
72
  - app/components/vitrail/card.rb
73
+ - app/components/vitrail/link_to.rb
74
+ - app/components/vitrail/notice.html.erb
75
+ - app/components/vitrail/notice.rb
72
76
  - app/components/vitrail/table.html.erb
73
77
  - app/components/vitrail/table.rb
74
78
  - app/components/vitrail/table/division.html.erb
@@ -76,7 +80,6 @@ files:
76
80
  - app/components/vitrail/table/header.rb
77
81
  - app/components/vitrail/table/row.rb
78
82
  - app/components/vitrail/title.rb
79
- - app/helpers/vitrail/application_helper.rb
80
83
  - app/views/layouts/vitrail/component_preview.html.erb
81
84
  - config/tailwind.config.js
82
85
  - lib/tasks/vitrail_tasks.rake
@@ -1,4 +0,0 @@
1
- module Vitrail
2
- module ApplicationHelper
3
- end
4
- end