coveragebook_components 0.19.4 → 0.19.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d1344822e2d4d928b5e9e92d7e213d271dee81696c3e1ac2672f6e3381d6d2a
4
- data.tar.gz: 696d4ab8106207a268a7ebc7b8925192c1e9e7981f105dc29d77c69e26740bd6
3
+ metadata.gz: a1d2704c6cd4936c7c4ab5d7b662753d96e9b5339bbcc616de4426810513c4ca
4
+ data.tar.gz: 7e30ef8812a9348343ed83f5afeb2fa3a46b5c2cf2594ba7eb100a1d817b0104
5
5
  SHA512:
6
- metadata.gz: 94509db5c4e1ea656d48e2aa6a1aaf3a7627974b7e8418eccc467b67d39631c1284d4f5ab873c2555aaadade7aa87a21612596ca57a5ee9d8864dca32fbbbcff
7
- data.tar.gz: db56406dbedbb3b0629cd8aeb684f6154d8a6fd0529648ea7af30b7a62b28e8b129b8e50a7e7f2c21db0c08c6ef3621598cbf02f63820998165997928e161e58
6
+ metadata.gz: 6b6c0c6e7877e033a90380df797fb3627ef05fb5d7ff45b0d8c986f9f587afd6e8804eaa23a935598b2c626337c32a4bc4ccfe5adc34caf5e9c8bfd9840d463f
7
+ data.tar.gz: e4ae100660db97da842376df34f758df39a4df72c0b2fda46d891c5a26fd57c8c9e7c25b3cb870a58c6deef2f0ff37910da8bd8b0335df65dee1d402596546e5
@@ -4780,13 +4780,10 @@ select{
4780
4780
  host page rather than displayed as a modal.
4781
4781
  */
4782
4782
 
4783
- [data-role="inline-modal-content"]{
4783
+ [data-role="inline-modal-content"] [data-component="modal-dialog"]{
4784
4784
  margin-left: auto;
4785
4785
  margin-right: auto;
4786
- max-width: 42rem
4787
- }
4788
-
4789
- [data-role="inline-modal-content"] [data-component="modal-dialog"]{
4786
+ max-width: 42rem;
4790
4787
  border-radius: 0.75rem;
4791
4788
  border-width: 1px;
4792
4789
  --tw-border-opacity: 1;
@@ -4796,6 +4793,63 @@ select{
4796
4793
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
4797
4794
  }
4798
4795
 
4796
+ [data-coco][data-component="modal-canvas"]{
4797
+ position: relative;
4798
+ width: -moz-fit-content;
4799
+ width: fit-content
4800
+ }
4801
+
4802
+ [data-coco][data-component="modal-canvas"] .modal-canvas-close{
4803
+ position: absolute;
4804
+ right: -0.375rem;
4805
+ top: -0.375rem;
4806
+ z-index: 20;
4807
+ flex: none;
4808
+ border-radius: 9999px;
4809
+ padding: 0.5rem;
4810
+ transition-property: all;
4811
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
4812
+ transition-duration: 150ms
4813
+ }
4814
+
4815
+ @media (min-width: 576px){
4816
+
4817
+ [data-coco][data-component="modal-canvas"] .modal-canvas-close{
4818
+ right: -1rem;
4819
+ top: -1rem
4820
+ }
4821
+ }
4822
+
4823
+ [data-coco][data-component="modal-canvas"] .modal-canvas-close{
4824
+ --tw-bg-opacity: 1;
4825
+ background-color: rgb(17 24 39 / var(--tw-bg-opacity));
4826
+ --tw-text-opacity: 1;
4827
+ color: rgb(255 255 255 / var(--tw-text-opacity));
4828
+ --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
4829
+ --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
4830
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
4831
+ }
4832
+
4833
+ [data-coco][data-component="modal-canvas"] .modal-canvas-close:focus{
4834
+ outline: 2px solid transparent;
4835
+ outline-offset: 2px;
4836
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
4837
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
4838
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)
4839
+ }
4840
+
4841
+ [data-coco][data-component="modal-canvas"] .modal-canvas-content{
4842
+ position: relative;
4843
+ min-height: 100px;
4844
+ min-width: 100px;
4845
+ overflow: hidden;
4846
+ border-radius: 0.75rem;
4847
+ --tw-bg-opacity: 1;
4848
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
4849
+ width: -moz-fit-content;
4850
+ width: fit-content
4851
+ }
4852
+
4799
4853
  [data-coco][data-component="modal-dialog"]{
4800
4854
  width: 100%;
4801
4855
  border-radius: 2rem;
@@ -15338,7 +15338,7 @@ var alpine_default = import_alpinejs.default;
15338
15338
  // ../../../package.json
15339
15339
  var package_default = {
15340
15340
  name: "coveragebook-components",
15341
- version: "0.19.4",
15341
+ version: "0.19.5",
15342
15342
  repository: "git@github.com:coveragebook/coco.git",
15343
15343
  license: "NO LICENSE",
15344
15344
  author: "Mark Perkins <mark@coveragebook.com>",
@@ -16503,6 +16503,19 @@ var modal_default = CocoComponent("modal", () => {
16503
16503
  };
16504
16504
  });
16505
16505
 
16506
+ // ../../components/coco/modals/modal_canvas/modal_canvas.js
16507
+ var modal_canvas_exports = {};
16508
+ __export(modal_canvas_exports, {
16509
+ default: () => modal_canvas_default
16510
+ });
16511
+ var modal_canvas_default = CocoComponent("modalCanvas", () => {
16512
+ return {
16513
+ close() {
16514
+ this.modal.hide();
16515
+ }
16516
+ };
16517
+ });
16518
+
16506
16519
  // ../../components/coco/modals/modal_dialog/modal_dialog.js
16507
16520
  var modal_dialog_exports = {};
16508
16521
  __export(modal_dialog_exports, {
@@ -16572,7 +16585,7 @@ var modal_lightbox_default = CocoComponent("modalLightbox", () => {
16572
16585
  });
16573
16586
 
16574
16587
  // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/base|@components/modals/**/*.js
16575
- var modules8 = [modal_exports, modal_dialog_exports, modal_lightbox_exports];
16588
+ var modules8 = [modal_exports, modal_canvas_exports, modal_dialog_exports, modal_lightbox_exports];
16576
16589
  var __default8 = modules8;
16577
16590
 
16578
16591
  // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/base|@components/navigation/**/*.js
@@ -79,9 +79,8 @@
79
79
  host page rather than displayed as a modal.
80
80
  */
81
81
  [data-role="inline-modal-content"] {
82
- @apply max-w-2xl mx-auto;
83
-
84
82
  [data-component="modal-dialog"] {
83
+ @apply max-w-2xl mx-auto;
85
84
  @apply border border-coco-gray-300 shadow-md rounded-xl;
86
85
  }
87
86
  }
@@ -27,6 +27,10 @@
27
27
  <%= render Coco::ModalDialog.new(id: @container_id, title: title.to_s, dismissable: false) do %>
28
28
  <%= content %>
29
29
  <% end %>
30
+ <% elsif container_type == :canvas %>
31
+ <%= render Coco::ModalCanvas.new(id: @container_id, dismissable: false) do %>
32
+ <%= content %>
33
+ <% end %>
30
34
  <% else %>
31
35
  <%= coco_panel(id: @container_id) do %>
32
36
  <%= content %>
@@ -21,6 +21,13 @@ module Coco
21
21
  @container_type = :lightbox
22
22
  @container_id = id
23
23
  Coco::ModalLightbox.new(dismissable: get_option_value(:dismissable), id:, **kwargs)
24
+ end,
25
+
26
+ canvas: ->(id: nil, **kwargs, &block) do
27
+ @container_content = block
28
+ @container_id = id
29
+ @container_type = :canvas
30
+ Coco::ModalCanvas.new(dismissable: get_option_value(:dismissable), id:, **kwargs)
24
31
  end
25
32
  }
26
33
 
@@ -0,0 +1,17 @@
1
+ @layer components {
2
+ [data-coco][data-component="modal-canvas"] {
3
+ @apply relative;
4
+ width: fit-content;
5
+
6
+ .modal-canvas-close {
7
+ @apply flex-none p-2 absolute -right-1.5 -top-1.5 sm:-right-4 sm:-top-4 rounded-full transition-all z-20;
8
+ @apply bg-background-dark-1 text-content-light-1;
9
+ @apply focus:ring-0 focus:outline-none text-content-light-1 shadow-md;
10
+ }
11
+
12
+ .modal-canvas-content {
13
+ @apply rounded-xl overflow-hidden min-w-[100px] min-h-[100px] relative bg-background-light-1;
14
+ width: fit-content;
15
+ }
16
+ }
17
+ }
@@ -0,0 +1,10 @@
1
+ <%= render component_tag(x: {data: x_data("modalCanvas")}) do %>
2
+ <% if dismissable? %>
3
+ <button type="button" class="modal-canvas-close" data-role="close" @click="close">
4
+ <%= coco_icon(:x, size: :md) %>
5
+ </button>
6
+ <% end %>
7
+ <div class="modal-canvas-content"<% if dismissable? %> @click.outside="close"<% end %>>
8
+ <%= content %>
9
+ </div>
10
+ <% end %>
@@ -0,0 +1,9 @@
1
+ import { CocoComponent } from "@assets/js/coco/component";
2
+
3
+ export default CocoComponent("modalCanvas", () => {
4
+ return {
5
+ close() {
6
+ this.modal.hide();
7
+ },
8
+ };
9
+ });
@@ -0,0 +1,11 @@
1
+ module Coco
2
+ class ModalCanvas < Coco::Component
3
+ include Concerns::AcceptsOptions
4
+
5
+ accepts_option :dismissable, from: [true, false], default: true
6
+
7
+ def dismissable?
8
+ get_option_value(:dismissable)
9
+ end
10
+ end
11
+ end
@@ -192,6 +192,12 @@ module Coco
192
192
  end
193
193
  end
194
194
 
195
+ def coco_modal_canvas(name = "default", **, &block)
196
+ render(Coco::Modal.new(name: name, **)) do |modal|
197
+ modal.with_container_canvas(&block)
198
+ end
199
+ end
200
+
195
201
  # Navigation
196
202
 
197
203
  def coco_link(*args, **, &block)
data/lib/coco.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Coco
2
- VERSION = "0.19.4"
2
+ VERSION = "0.19.5"
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.19.4
4
+ version: 0.19.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Perkins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-08 00:00:00.000000000 Z
11
+ date: 2024-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1835,6 +1835,10 @@ files:
1835
1835
  - app/components/coco/modals/modal/modal.html.erb
1836
1836
  - app/components/coco/modals/modal/modal.js
1837
1837
  - app/components/coco/modals/modal/modal.rb
1838
+ - app/components/coco/modals/modal_canvas/modal_canvas.css
1839
+ - app/components/coco/modals/modal_canvas/modal_canvas.html.erb
1840
+ - app/components/coco/modals/modal_canvas/modal_canvas.js
1841
+ - app/components/coco/modals/modal_canvas/modal_canvas.rb
1838
1842
  - app/components/coco/modals/modal_dialog/modal_dialog.css
1839
1843
  - app/components/coco/modals/modal_dialog/modal_dialog.html.erb
1840
1844
  - app/components/coco/modals/modal_dialog/modal_dialog.js