vitrail 0.1.1 → 0.2.1

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: 1edf1a792a8e1917393b0327b97132b923cfb4684ab805f14ffe6f3d505ec8b5
4
- data.tar.gz: 396c5856abb8f0295520fc0b796003f52584d4b9e5e07e793b967000e8921008
3
+ metadata.gz: f651fb5fbab1ebe0ce61ecf4750b8fc7ed68dd428ca9cc7b5d750d8c9a0855e9
4
+ data.tar.gz: 3d748cea3dd9a264f698ecd44b9cc12ef1b75976a74d7ed76575d4dcc76aefa0
5
5
  SHA512:
6
- metadata.gz: 5075c244406e1238ada0877f04dacb94d87ae521ded42c9d9f5664145c625d85eafe37bb6c6e53fa625f1356f45e05671b5443408233601514b3100f353e22d6
7
- data.tar.gz: f2242dd704b84c01c43473df75566018bebec3133a4a1bfdd4e083c1e3fa552ee849b630c94df7275b22b563e1d0dbed47cad9710e8906a0a5d91924e8557354
6
+ metadata.gz: 46db3d0d523cda1da9ccb83c8608dd32cca0d3966997fcfabaf0639095860196630dd5e4142c1166b82765ad20ae972aedcbedd73132c72edef7668e7eabcba2
7
+ data.tar.gz: 734477fc361a7d59057314cf129db1b923550a86b10c09273fb41723cd8a56692ad0347822b20efacb5604e510ae99c8fe60223bb6d1e584f3c56222debfb3a0
data/README.md CHANGED
@@ -34,7 +34,6 @@ In `config/tailwind.config.js`,
34
34
  ],
35
35
  ```
36
36
 
37
-
38
37
  ## Development
39
38
 
40
39
  watch tailwindcss changes with:
@@ -700,8 +700,127 @@ select {
700
700
  --tw-backdrop-sepia: ;
701
701
  }
702
702
 
703
- .p-20 {
704
- padding: 5rem;
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
+ .border-red-400 {
792
+ --tw-border-opacity: 1;
793
+ border-color: rgb(248 113 113 / var(--tw-border-opacity));
794
+ }
795
+
796
+ .border-red-200 {
797
+ --tw-border-opacity: 1;
798
+ border-color: rgb(254 202 202 / var(--tw-border-opacity));
799
+ }
800
+
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));
809
+ }
810
+
811
+ .bg-red-200 {
812
+ --tw-bg-opacity: 1;
813
+ background-color: rgb(254 202 202 / var(--tw-bg-opacity));
814
+ }
815
+
816
+ .bg-red-100 {
817
+ --tw-bg-opacity: 1;
818
+ background-color: rgb(254 226 226 / var(--tw-bg-opacity));
819
+ }
820
+
821
+ .px-3 {
822
+ padding-left: 0.75rem;
823
+ padding-right: 0.75rem;
705
824
  }
706
825
 
707
826
  .px-8 {
@@ -714,9 +833,40 @@ select {
714
833
  padding-bottom: 1rem;
715
834
  }
716
835
 
717
- .text-blue-700 {
836
+ .text-right {
837
+ text-align: right;
838
+ }
839
+
840
+ .align-middle {
841
+ vertical-align: middle;
842
+ }
843
+
844
+ .text-sm {
845
+ font-size: 0.875rem;
846
+ line-height: 1.25rem;
847
+ }
848
+
849
+ .font-medium {
850
+ font-weight: 500;
851
+ }
852
+
853
+ .uppercase {
854
+ text-transform: uppercase;
855
+ }
856
+
857
+ .text-slate-500 {
858
+ --tw-text-opacity: 1;
859
+ color: rgb(100 116 139 / var(--tw-text-opacity));
860
+ }
861
+
862
+ .text-slate-600 {
863
+ --tw-text-opacity: 1;
864
+ color: rgb(71 85 105 / var(--tw-text-opacity));
865
+ }
866
+
867
+ .text-red-800 {
718
868
  --tw-text-opacity: 1;
719
- color: rgb(29 78 216 / var(--tw-text-opacity));
869
+ color: rgb(153 27 27 / var(--tw-text-opacity));
720
870
  }
721
871
 
722
872
  /*
@@ -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
- ActionView::Helpers::TagHelper::TagBuilder.new(view_context).
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 || "&nbsp;".html_safe %>
5
+ <% end %>
6
+ <% else %>
7
+ <%= content || "&nbsp;".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>
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vitrail
4
+ class Table < BaseComponent
5
+ renders_many :headers, Table::Header
6
+ renders_many :rows, Table::Row
7
+ end
8
+ end
@@ -8,6 +8,7 @@
8
8
 
9
9
  <%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
10
10
  <%= stylesheet_link_tag "vitrail/application" %>
11
+ <script src="https://kit.fontawesome.com/910f22a437.js" crossorigin="anonymous"></script>
11
12
  </head>
12
13
  <body class="px-8 py-4 margin-x-auto">
13
14
  <%= yield %>
@@ -5,16 +5,5 @@ module Vitrail
5
5
  initializer "vitrail.precompile" do |app|
6
6
  app.config.assets.precompile += %w[vitrail_manifest]
7
7
  end
8
-
9
- initializer "vitrail.lookbook" do |app|
10
- app.config.lookbook.preview_paths << Vitrail::Engine.root.join("test/components/previews")
11
- app.config.lookbook.preview_layout = "vitrail/component_preview"
12
- app.config.lookbook.project_name = "Vitrail"
13
- app.config.lookbook.project_logo = false
14
- app.config.lookbook.ui_favicon = false
15
- app.config.lookbook.preview_collection_label = "Components"
16
- app.config.lookbook.ui_theme = "zinc"
17
- app.config.lookbook.preview_inspector.drawer_panels = [:source]
18
- end
19
8
  end
20
9
  end
@@ -1,3 +1,3 @@
1
1
  module Vitrail
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.1"
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.1.1
4
+ version: 0.2.1
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-15 00:00:00.000000000 Z
11
+ date: 2023-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2'
55
- - !ruby/object:Gem::Dependency
56
- name: lookbook
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '2'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2'
69
55
  description: Kuartz design system view components
70
56
  email:
71
57
  - guillaume@kuartz.fr
@@ -81,15 +67,17 @@ files:
81
67
  - app/assets/stylesheets/vitrail/application.css
82
68
  - app/assets/stylesheets/vitrail/vitrail.css
83
69
  - app/components/vitrail/base_component.rb
70
+ - app/components/vitrail/card.html.erb
71
+ - app/components/vitrail/card.rb
72
+ - app/components/vitrail/table.html.erb
73
+ - app/components/vitrail/table.rb
74
+ - app/components/vitrail/table/division.html.erb
75
+ - app/components/vitrail/table/division.rb
76
+ - app/components/vitrail/table/header.rb
77
+ - app/components/vitrail/table/row.rb
84
78
  - app/components/vitrail/title.rb
85
- - app/controllers/vitrail/application_controller.rb
86
79
  - app/helpers/vitrail/application_helper.rb
87
- - app/jobs/vitrail/application_job.rb
88
- - app/mailers/vitrail/application_mailer.rb
89
- - app/models/vitrail/application_record.rb
90
- - app/views/layouts/vitrail/application.html.erb
91
80
  - app/views/layouts/vitrail/component_preview.html.erb
92
- - config/routes.rb
93
81
  - config/tailwind.config.js
94
82
  - lib/tasks/vitrail_tasks.rake
95
83
  - lib/vitrail.rb
@@ -1,4 +0,0 @@
1
- module Vitrail
2
- class ApplicationController < ActionController::Base
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Vitrail
2
- class ApplicationJob < ActiveJob::Base
3
- end
4
- end
@@ -1,6 +0,0 @@
1
- module Vitrail
2
- class ApplicationMailer < ActionMailer::Base
3
- default from: "from@example.com"
4
- layout "mailer"
5
- end
6
- end
@@ -1,5 +0,0 @@
1
- module Vitrail
2
- class ApplicationRecord < ActiveRecord::Base
3
- self.abstract_class = true
4
- end
5
- end
@@ -1,15 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Vitrail</title>
5
- <%= csrf_meta_tags %>
6
- <%= csp_meta_tag %>
7
-
8
- <%= stylesheet_link_tag "vitrail", "data-turbo-track": "reload" %>
9
- </head>
10
- <body>
11
- <main class="p-20">
12
- <%= yield %>
13
- </main>
14
- </body>
15
- </html>
data/config/routes.rb DELETED
@@ -1,3 +0,0 @@
1
- Vitrail::Engine.routes.draw do
2
- mount Lookbook::Engine, at: "/"
3
- end