coveragebook_components 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.8"
2
+ VERSION = "0.8.9"
3
3
  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.8
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-15 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