vitrail 0.1.1 → 0.2.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/README.md +0 -1
- data/app/assets/stylesheets/vitrail/vitrail.css +126 -2
- data/app/components/vitrail/base_component.rb +2 -5
- data/app/components/vitrail/card.html.erb +12 -0
- data/app/components/vitrail/card.rb +18 -0
- data/app/components/vitrail/table/division.html.erb +9 -0
- data/app/components/vitrail/table/division.rb +24 -0
- data/app/components/vitrail/table/header.rb +19 -0
- data/app/components/vitrail/table/row.rb +27 -0
- data/app/components/vitrail/table.html.erb +19 -0
- data/app/components/vitrail/table.rb +8 -0
- data/lib/vitrail/engine.rb +2 -1
- data/lib/vitrail/version.rb +1 -1
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d19a656a36c93b3bda4cb6e96f759715b4a934c7aea3c738aa7022921c97fa4d
|
4
|
+
data.tar.gz: 53201fdf84823b65504497931dbfd086046091b9cfa06f1650c92e3acd44850d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bb7aca2bd3318dc01936d19a79dd692bed7963544a621a9d0ed1bb0de59f2316362c18bd05172323cdcbe4f95c3e9bcb85e4c0bd877d55ddbccba420c5b681c
|
7
|
+
data.tar.gz: d81b1b723d0a12902b72f0c215177a01f493d6a1f15e5dd69f61c24f782892837449be7f9673076a1143bf4c8aac5dbca33c34aeff7a07522ea6d1be19ec78a5
|
data/README.md
CHANGED
@@ -700,10 +700,108 @@ select {
|
|
700
700
|
--tw-backdrop-sepia: ;
|
701
701
|
}
|
702
702
|
|
703
|
+
.sticky {
|
704
|
+
position: sticky;
|
705
|
+
}
|
706
|
+
|
707
|
+
.top-0 {
|
708
|
+
top: 0px;
|
709
|
+
}
|
710
|
+
|
711
|
+
.-mx-3 {
|
712
|
+
margin-left: -0.75rem;
|
713
|
+
margin-right: -0.75rem;
|
714
|
+
}
|
715
|
+
|
716
|
+
.-my-4 {
|
717
|
+
margin-top: -1rem;
|
718
|
+
margin-bottom: -1rem;
|
719
|
+
}
|
720
|
+
|
721
|
+
.mb-2 {
|
722
|
+
margin-bottom: 0.5rem;
|
723
|
+
}
|
724
|
+
|
725
|
+
.ml-2 {
|
726
|
+
margin-left: 0.5rem;
|
727
|
+
}
|
728
|
+
|
729
|
+
.block {
|
730
|
+
display: block;
|
731
|
+
}
|
732
|
+
|
733
|
+
.inline-block {
|
734
|
+
display: inline-block;
|
735
|
+
}
|
736
|
+
|
737
|
+
.flex {
|
738
|
+
display: flex;
|
739
|
+
}
|
740
|
+
|
741
|
+
.table {
|
742
|
+
display: table;
|
743
|
+
}
|
744
|
+
|
745
|
+
.flow-root {
|
746
|
+
display: flow-root;
|
747
|
+
}
|
748
|
+
|
749
|
+
.min-w-full {
|
750
|
+
min-width: 100%;
|
751
|
+
}
|
752
|
+
|
753
|
+
.table-auto {
|
754
|
+
table-layout: auto;
|
755
|
+
}
|
756
|
+
|
757
|
+
.items-center {
|
758
|
+
align-items: center;
|
759
|
+
}
|
760
|
+
|
761
|
+
.justify-between {
|
762
|
+
justify-content: space-between;
|
763
|
+
}
|
764
|
+
|
765
|
+
.divide-y > :not([hidden]) ~ :not([hidden]) {
|
766
|
+
--tw-divide-y-reverse: 0;
|
767
|
+
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
768
|
+
border-bottom-width: calc(1px * var(--tw-divide-y-reverse));
|
769
|
+
}
|
770
|
+
|
771
|
+
.divide-gray-200 > :not([hidden]) ~ :not([hidden]) {
|
772
|
+
--tw-divide-opacity: 1;
|
773
|
+
border-color: rgb(229 231 235 / var(--tw-divide-opacity));
|
774
|
+
}
|
775
|
+
|
776
|
+
.divide-gray-300 > :not([hidden]) ~ :not([hidden]) {
|
777
|
+
--tw-divide-opacity: 1;
|
778
|
+
border-color: rgb(209 213 219 / var(--tw-divide-opacity));
|
779
|
+
}
|
780
|
+
|
781
|
+
.overflow-x-auto {
|
782
|
+
overflow-x: auto;
|
783
|
+
}
|
784
|
+
|
785
|
+
.truncate {
|
786
|
+
overflow: hidden;
|
787
|
+
text-overflow: ellipsis;
|
788
|
+
white-space: nowrap;
|
789
|
+
}
|
790
|
+
|
791
|
+
.bg-white {
|
792
|
+
--tw-bg-opacity: 1;
|
793
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
794
|
+
}
|
795
|
+
|
703
796
|
.p-20 {
|
704
797
|
padding: 5rem;
|
705
798
|
}
|
706
799
|
|
800
|
+
.px-3 {
|
801
|
+
padding-left: 0.75rem;
|
802
|
+
padding-right: 0.75rem;
|
803
|
+
}
|
804
|
+
|
707
805
|
.px-8 {
|
708
806
|
padding-left: 2rem;
|
709
807
|
padding-right: 2rem;
|
@@ -714,9 +812,35 @@ select {
|
|
714
812
|
padding-bottom: 1rem;
|
715
813
|
}
|
716
814
|
|
717
|
-
.text-
|
815
|
+
.text-right {
|
816
|
+
text-align: right;
|
817
|
+
}
|
818
|
+
|
819
|
+
.align-middle {
|
820
|
+
vertical-align: middle;
|
821
|
+
}
|
822
|
+
|
823
|
+
.text-sm {
|
824
|
+
font-size: 0.875rem;
|
825
|
+
line-height: 1.25rem;
|
826
|
+
}
|
827
|
+
|
828
|
+
.font-medium {
|
829
|
+
font-weight: 500;
|
830
|
+
}
|
831
|
+
|
832
|
+
.uppercase {
|
833
|
+
text-transform: uppercase;
|
834
|
+
}
|
835
|
+
|
836
|
+
.text-slate-500 {
|
837
|
+
--tw-text-opacity: 1;
|
838
|
+
color: rgb(100 116 139 / var(--tw-text-opacity));
|
839
|
+
}
|
840
|
+
|
841
|
+
.text-slate-600 {
|
718
842
|
--tw-text-opacity: 1;
|
719
|
-
color: rgb(
|
843
|
+
color: rgb(71 85 105 / var(--tw-text-opacity));
|
720
844
|
}
|
721
845
|
|
722
846
|
/*
|
@@ -13,13 +13,10 @@ module Vitrail
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
-
def local_classes
|
17
|
-
""
|
18
|
-
end
|
16
|
+
def local_classes = ""
|
19
17
|
|
20
18
|
def html_attributes
|
21
|
-
|
22
|
-
attributes(html_options)
|
19
|
+
tag.attributes(html_options)
|
23
20
|
end
|
24
21
|
|
25
22
|
def html_classes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="<%= html_classes %>" <%= html_attributes %>>
|
2
|
+
<% if header? %>
|
3
|
+
<header>
|
4
|
+
<div class="flex justify-between items-center mb-2">
|
5
|
+
<h3 class="truncate text-sm font-medium text-slate-500">
|
6
|
+
<%= title %>
|
7
|
+
</h3>
|
8
|
+
<i class="fa-light text-slate-600 ml-2 fa-<%= icon %>" aria-hidden="true"></i>
|
9
|
+
</header>
|
10
|
+
<% end %>
|
11
|
+
<%= content %>
|
12
|
+
</div>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vitrail
|
4
|
+
class Card < BaseComponent
|
5
|
+
LOCAL_CLASSES = "border border-slate-200 rounded px-4 py-2 bg-white shadow-sm"
|
6
|
+
|
7
|
+
private attr_reader :title, :icon
|
8
|
+
|
9
|
+
def initialize(title: nil, icon: nil, **html_options)
|
10
|
+
super(**html_options)
|
11
|
+
@title = title
|
12
|
+
@icon = icon
|
13
|
+
end
|
14
|
+
|
15
|
+
def local_classes = LOCAL_CLASSES
|
16
|
+
def header? = title || icon
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<td class="<%= html_classes %>" <%= html_attributes %>>
|
2
|
+
<% if link_to? %>
|
3
|
+
<%= link_to link_path, class: "block -mx-3 px-3 -my-4 py-4" do %>
|
4
|
+
<%= content || " ".html_safe %>
|
5
|
+
<% end %>
|
6
|
+
<% else %>
|
7
|
+
<%= content || " ".html_safe %>
|
8
|
+
<% end %>
|
9
|
+
</td>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vitrail
|
4
|
+
class Table
|
5
|
+
class Division < BaseComponent
|
6
|
+
LOCAL_CLASSES = "whitespace-nowrap px-3 py-4 text-sm text-gray-500"
|
7
|
+
|
8
|
+
private attr_reader :link_path
|
9
|
+
|
10
|
+
def initialize(link_to: nil, **html_options)
|
11
|
+
super(**html_options)
|
12
|
+
@link_path = link_to
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def link_to? = link_path.present?
|
18
|
+
|
19
|
+
def local_classes
|
20
|
+
LOCAL_CLASSES + (" group-hover:bg-gray-50" if link_to?).to_s
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vitrail
|
4
|
+
class Table
|
5
|
+
class Header < BaseComponent
|
6
|
+
erb_template <<~ERB.squish
|
7
|
+
<th class="<%= html_classes %> scope="col" <%= html_attributes %>>
|
8
|
+
<%= content %>
|
9
|
+
</th>
|
10
|
+
ERB
|
11
|
+
|
12
|
+
LOCAL_CLASSES = "px-3 py-4 text-left text-sm font-semibold text-gray-900"
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def local_classes = LOCAL_CLASSES
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vitrail
|
4
|
+
class Table
|
5
|
+
class Row < BaseComponent
|
6
|
+
erb_template <<~ERB.squish
|
7
|
+
<tr class="group" <%= html_attributes %>>
|
8
|
+
<% divisions.each do |division| %>
|
9
|
+
<%= division %>
|
10
|
+
<% end %>
|
11
|
+
</tr>
|
12
|
+
ERB
|
13
|
+
|
14
|
+
renders_many :divisions, ->(link_to: nil, **html_options) do
|
15
|
+
Division.new(link_to: link_path, **html_options.merge(td_options))
|
16
|
+
end
|
17
|
+
|
18
|
+
private attr_reader :link_path, :td_options
|
19
|
+
|
20
|
+
def initialize(link_to: nil, td: {}, **html_options)
|
21
|
+
super(**html_options)
|
22
|
+
@link_path = link_to
|
23
|
+
@td_options = td
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<div class="flow-root" <%= html_attributes %>>
|
2
|
+
<div class="overflow-x-auto">
|
3
|
+
<div class="inline-block min-w-full align-middle">
|
4
|
+
<table class="table-auto min-w-full divide-y divide-gray-300">
|
5
|
+
<thead class="sticky top-0 bg-white">
|
6
|
+
<tr>
|
7
|
+
<% headers.each do |header| %>
|
8
|
+
<%= header %>
|
9
|
+
<% end %>
|
10
|
+
</tr>
|
11
|
+
<tbody class="divide-y divide-gray-200">
|
12
|
+
<% rows.each do |row| %>
|
13
|
+
<%= row %>
|
14
|
+
<% end %>
|
15
|
+
</tbody>
|
16
|
+
</table>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</div>
|
data/lib/vitrail/engine.rb
CHANGED
@@ -8,13 +8,14 @@ module Vitrail
|
|
8
8
|
|
9
9
|
initializer "vitrail.lookbook" do |app|
|
10
10
|
app.config.lookbook.preview_paths << Vitrail::Engine.root.join("test/components/previews")
|
11
|
+
app.config.view_component.preview_paths << Vitrail::Engine.root.join("test/components/previews")
|
11
12
|
app.config.lookbook.preview_layout = "vitrail/component_preview"
|
12
13
|
app.config.lookbook.project_name = "Vitrail"
|
13
14
|
app.config.lookbook.project_logo = false
|
14
15
|
app.config.lookbook.ui_favicon = false
|
15
16
|
app.config.lookbook.preview_collection_label = "Components"
|
16
17
|
app.config.lookbook.ui_theme = "zinc"
|
17
|
-
app.config.lookbook.preview_inspector.drawer_panels = [:source]
|
18
|
+
app.config.lookbook.preview_inspector.drawer_panels = [:source, :notes]
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
data/lib/vitrail/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.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-
|
11
|
+
date: 2023-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -81,6 +81,14 @@ files:
|
|
81
81
|
- app/assets/stylesheets/vitrail/application.css
|
82
82
|
- app/assets/stylesheets/vitrail/vitrail.css
|
83
83
|
- app/components/vitrail/base_component.rb
|
84
|
+
- app/components/vitrail/card.html.erb
|
85
|
+
- app/components/vitrail/card.rb
|
86
|
+
- app/components/vitrail/table.html.erb
|
87
|
+
- app/components/vitrail/table.rb
|
88
|
+
- app/components/vitrail/table/division.html.erb
|
89
|
+
- app/components/vitrail/table/division.rb
|
90
|
+
- app/components/vitrail/table/header.rb
|
91
|
+
- app/components/vitrail/table/row.rb
|
84
92
|
- app/components/vitrail/title.rb
|
85
93
|
- app/controllers/vitrail/application_controller.rb
|
86
94
|
- app/helpers/vitrail/application_helper.rb
|