coveragebook_components 0.8.7 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,7 @@
15
15
  }
16
16
 
17
17
  &[data-width="constrained"] {
18
- .page-body {
18
+ .page-body-content {
19
19
  @apply max-w-screen-2xl mx-auto;
20
20
  }
21
21
  }
@@ -5,7 +5,9 @@
5
5
  </header>
6
6
  <% end %>
7
7
  <div class="page-body" data-role="page-body">
8
- <%= content %>
8
+ <div class="page-body-content">
9
+ <%= content %>
10
+ </div>
9
11
  </div>
10
12
 
11
13
  <% if previous_link? || next_link? %>
@@ -73,4 +73,16 @@
73
73
  .modal-frame {
74
74
  @apply contents;
75
75
  }
76
+
77
+ /*
78
+ Limit the size of modal content when rendered in the
79
+ host page rather than displayed as a modal.
80
+ */
81
+ [data-role="inline-modal-content"] {
82
+ @apply max-w-2xl mx-auto;
83
+
84
+ [data-component="modal-dialog"] {
85
+ @apply border border-gray-300 shadow-md rounded-xl;
86
+ }
87
+ }
76
88
  }
@@ -22,5 +22,15 @@
22
22
  <%= render_flash_messages %>
23
23
  <% end %>
24
24
  <% else %>
25
- <%= content %>
25
+ <div data-role="inline-modal-content">
26
+ <% if container_type == :dialog %>
27
+ <%= render Coco::ModalDialog.new(title: title.to_s, dismissable: false) do %>
28
+ <%= content %>
29
+ <% end %>
30
+ <% else %>
31
+ <%= coco_panel do %>
32
+ <%= content %>
33
+ <% end %>
34
+ <% end %>
35
+ </div>
26
36
  <% end %>
@@ -11,10 +11,12 @@ module Coco
11
11
  renders_one :container, types: {
12
12
  dialog: ->(**kwargs, &block) do
13
13
  @container_content = block
14
+ @container_type = :dialog
14
15
  Coco::ModalDialog.new(dismissable: get_option_value(:dismissable), **kwargs)
15
16
  end,
16
17
 
17
18
  lightbox: ->(**kwargs, &block) do
19
+ @container_type = :lightbox
18
20
  Coco::ModalLightbox.new(dismissable: get_option_value(:dismissable), **kwargs)
19
21
  end
20
22
  }
@@ -25,11 +27,12 @@ module Coco
25
27
  end
26
28
  end
27
29
 
28
- attr_reader :name, :show
30
+ attr_reader :name, :show, :container_type
29
31
 
30
32
  def initialize(name:, show: false, **kwargs)
31
33
  @name = name
32
34
  @show = show
35
+ @container_type = nil
33
36
  title { kwargs[:title] } if kwargs[:title]
34
37
  end
35
38
 
@@ -1,7 +1,11 @@
1
1
  @layer components {
2
2
  [data-coco][data-component="modal-dialog"] {
3
- @apply shadow-2xl rounded-xl w-full;
4
- @apply max-w-2xl; /* temp until sizes added */
3
+ @apply rounded-xl w-full;
4
+
5
+ .modal-frame & {
6
+ @apply shadow-2xl;
7
+ @apply max-w-2xl; /* temp until sizes added */
8
+ }
5
9
 
6
10
  .modal-dialog-header {
7
11
  @apply relative flex items-center;
@@ -0,0 +1,19 @@
1
+ @layer components {
2
+ [data-coco][data-component="panel"] {
3
+ @apply contents;
4
+
5
+ .panel-content {
6
+ @apply contents;
7
+ }
8
+
9
+ /* Only style Coco panels that are not rendered inside legacy panel components */
10
+ &:not([data-component="panel"] [data-component="panel"]) {
11
+ @apply block bg-content-light-1 border border-gray-300 shadow-md rounded-xl;
12
+
13
+ .panel-content {
14
+ @apply block;
15
+ padding: max(min(5%, 2rem), 1rem);
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,5 @@
1
+ <%= render component_tag do %>
2
+ <div class="panel-content">
3
+ <%= content %>
4
+ </div>
5
+ <% end %>
@@ -0,0 +1,4 @@
1
+ module Coco
2
+ class Panel < Coco::Component
3
+ end
4
+ end
@@ -84,6 +84,10 @@ module Coco
84
84
  render Coco::App::Elements::SystemBanner.new(**), &block
85
85
  end
86
86
 
87
+ def coco_panel(**, &block)
88
+ render Coco::Panel.new(**), &block
89
+ end
90
+
87
91
  def coco_form_with(**, &block)
88
92
  form_with(**, builder: Coco::AppFormBuilder, &block)
89
93
  end
data/lib/coco.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Coco
2
- VERSION = "0.8.7"
2
+ VERSION = "0.8.9"
3
3
  end
@@ -45,7 +45,7 @@ export default function (sourcePath, destPath, configPath) {
45
45
  const iconsDataFilePath = `${configPath}/icons.json`;
46
46
 
47
47
  prettier.resolveConfig(iconsDataFilePath).then(async (options) => {
48
- const formattedJSON = prettier.format(
48
+ const formattedJSON = await prettier.format(
49
49
  JSON.stringify(iconNames.sort()),
50
50
  {
51
51
  ...options,
@@ -1,13 +1,23 @@
1
+ require "json"
2
+
1
3
  namespace :coco do
2
- desc "Run Ruby and JS tests"
3
- task :test do
4
+ desc "Run tests"
5
+ task :test, [:files] do |task, args|
4
6
  puts "🥥 Running Ruby tests..."
5
- Rake::Task["test"].execute
7
+ system "npm run build:dev"
8
+ system "bundle exec rake test TEST=#{args.files || "test/**/*_test.rb"}"
6
9
  puts "✅ Ruby tests complete"
10
+ end
7
11
 
8
- puts "🥥 Running JS tests..."
9
- system "npm run js:test"
10
- puts "✅JS tests complete"
12
+ namespace :test do
13
+ desc "Run tests in CI"
14
+ task :ci do
15
+ puts "🥥 Building assets..."
16
+ Rake::Task["coco:assets:build"].execute
17
+ puts "🥥 Running Ruby tests..."
18
+ Rake::Task["test"].execute
19
+ puts "✅ Ruby tests complete"
20
+ end
11
21
  end
12
22
 
13
23
  task :lint do
@@ -41,4 +51,43 @@ namespace :coco do
41
51
  puts "✅ Asset build complete"
42
52
  end
43
53
  end
54
+
55
+ namespace :gem do
56
+ desc "Build and push to RubyGems"
57
+ task :release, [:version] do |task, args|
58
+ Rake::Task["coco:gem:build"].execute
59
+ Rake::Task["coco:gem:push"].invoke(args.version)
60
+ end
61
+
62
+ desc "Bump gem version"
63
+ task :bump_version, [:version] => :environment do |task, args|
64
+ puts "🥥 Bumping version number to #{args.version}"
65
+
66
+ new_version = args.version.sub("v", "").tr("-", ".")
67
+ version_file = File.expand_path("#{File.dirname(__FILE__)}/../coco.rb")
68
+ current_version = Coco::VERSION.to_s
69
+ file = File.open(version_file)
70
+ contents = file.read
71
+ File.write(version_file, contents.gsub(current_version, new_version))
72
+
73
+ puts "✅ Version bump complete"
74
+ end
75
+
76
+ desc "Build gem"
77
+ task :build do
78
+ puts "🥥 Building Gem..."
79
+ Rake::Task["build"].execute
80
+ puts "✅ Gem build complete"
81
+ end
82
+
83
+ desc "Push gem to Rubygems"
84
+ task :push, [:version] do |task, args|
85
+ puts "🥥 Pushing to RubyGems..."
86
+
87
+ version = args.version.sub("v", "").tr("-", ".")
88
+ system "gem push pkg/coveragebook_components-#{version}.gem"
89
+
90
+ puts "✅ Gem pushed to RubyGems"
91
+ end
92
+ end
44
93
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coveragebook_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-10 00:00:00.000000000 Z
11
+ date: 2023-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -74,8 +74,12 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - app/assets/build/coco/app.css
77
+ - app/assets/build/coco/app.dev.css
78
+ - app/assets/build/coco/app.dev.js
77
79
  - app/assets/build/coco/app.js
78
80
  - app/assets/build/coco/book.css
81
+ - app/assets/build/coco/book.dev.css
82
+ - app/assets/build/coco/book.dev.js
79
83
  - app/assets/build/coco/book.js
80
84
  - app/assets/build/coco/icons/accessibility.svg
81
85
  - app/assets/build/coco/icons/activity-square.svg
@@ -1653,6 +1657,9 @@ files:
1653
1657
  - app/components/coco/base/pager_link/pager_link.css
1654
1658
  - app/components/coco/base/pager_link/pager_link.html.erb
1655
1659
  - app/components/coco/base/pager_link/pager_link.rb
1660
+ - app/components/coco/base/panel/panel.css
1661
+ - app/components/coco/base/panel/panel.html.erb
1662
+ - app/components/coco/base/panel/panel.rb
1656
1663
  - app/components/coco/base/placeholder/placeholder.css
1657
1664
  - app/components/coco/base/placeholder/placeholder.html.erb
1658
1665
  - app/components/coco/base/placeholder/placeholder.rb