coveragebook_components 0.19.4 → 0.19.6

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: 5a6fb593342b6d0d763f42c38489d2e8d8099cf829d40723fca1dfa0436c729b
4
+ data.tar.gz: d47179da3e25b9c8ccccac86046b3520049db717a08f4f4a5127a82a1441bdc3
5
5
  SHA512:
6
- metadata.gz: 94509db5c4e1ea656d48e2aa6a1aaf3a7627974b7e8418eccc467b67d39631c1284d4f5ab873c2555aaadade7aa87a21612596ca57a5ee9d8864dca32fbbbcff
7
- data.tar.gz: db56406dbedbb3b0629cd8aeb684f6154d8a6fd0529648ea7af30b7a62b28e8b129b8e50a7e7f2c21db0c08c6ef3621598cbf02f63820998165997928e161e58
6
+ metadata.gz: 8623cb1e2a5f3f8ed328d6a83eec049e62729a4b2f829d534a5a8c2e35415d72a2f595d08418455bef5c515391e4e372cfce95f700a3247668faa6538fedee4d
7
+ data.tar.gz: 5345ffa5480a34a6fd15684411f4f9a2760c20e809c630cedcbf2324e665dd8d99f252aede51a09b5769eabbf3d0dcdad181b00e7a62dbb8e7b764c6a754cfc6
@@ -3824,20 +3824,14 @@ select{
3824
3824
  padding-bottom: 0.5rem
3825
3825
  }
3826
3826
 
3827
- /*
3828
- .alert-icon {
3829
- @apply flex items-center p-2 rounded-full;
3830
-
3831
- .coco-icon {
3832
- @apply w-5 h-5;
3833
- }
3834
- } */
3835
-
3836
3827
  [data-coco][data-component="alert"] .alert-body{
3837
- padding-left: 1rem;
3838
3828
  padding-right: 0.5rem
3839
3829
  }
3840
3830
 
3831
+ [data-coco][data-component="alert"] .alert-stamp + .alert-body{
3832
+ padding-left: 1rem
3833
+ }
3834
+
3841
3835
  [data-coco][data-component="alert"] .alert-content{
3842
3836
  width: 100%;
3843
3837
  --tw-text-opacity: 1;
@@ -4004,7 +3998,7 @@ select{
4004
3998
  padding-bottom: 0.375rem;
4005
3999
  }
4006
4000
 
4007
- [data-coco][data-component="alert"][data-condensed="true"] .alert-body{
4001
+ [data-coco][data-component="alert"][data-condensed="true"] .alert-stamp + .alert-body{
4008
4002
  padding-left: 0.75rem
4009
4003
  }
4010
4004
 
@@ -4552,8 +4546,16 @@ select{
4552
4546
  opacity: 0
4553
4547
  }
4554
4548
 
4555
- [data-coco][data-component="system-banner"] {
4549
+ [data-coco][data-component="system-banner"] .alert-stamp{
4550
+ margin-top: 0.25rem !important
4551
+ }
4552
+
4553
+ @container (min-width: 550px){
4554
+
4555
+ [data-coco][data-component="system-banner"] .alert-stamp{
4556
+ margin-top: 0px !important
4556
4557
  }
4558
+ }
4557
4559
 
4558
4560
  [data-coco][data-component="toast"]{
4559
4561
  width: 100%;
@@ -4780,13 +4782,10 @@ select{
4780
4782
  host page rather than displayed as a modal.
4781
4783
  */
4782
4784
 
4783
- [data-role="inline-modal-content"]{
4785
+ [data-role="inline-modal-content"] [data-component="modal-dialog"]{
4784
4786
  margin-left: auto;
4785
4787
  margin-right: auto;
4786
- max-width: 42rem
4787
- }
4788
-
4789
- [data-role="inline-modal-content"] [data-component="modal-dialog"]{
4788
+ max-width: 42rem;
4790
4789
  border-radius: 0.75rem;
4791
4790
  border-width: 1px;
4792
4791
  --tw-border-opacity: 1;
@@ -4796,6 +4795,63 @@ select{
4796
4795
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
4797
4796
  }
4798
4797
 
4798
+ [data-coco][data-component="modal-canvas"]{
4799
+ position: relative;
4800
+ width: -moz-fit-content;
4801
+ width: fit-content
4802
+ }
4803
+
4804
+ [data-coco][data-component="modal-canvas"] .modal-canvas-close{
4805
+ position: absolute;
4806
+ right: -0.375rem;
4807
+ top: -0.375rem;
4808
+ z-index: 20;
4809
+ flex: none;
4810
+ border-radius: 9999px;
4811
+ padding: 0.5rem;
4812
+ transition-property: all;
4813
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
4814
+ transition-duration: 150ms
4815
+ }
4816
+
4817
+ @media (min-width: 576px){
4818
+
4819
+ [data-coco][data-component="modal-canvas"] .modal-canvas-close{
4820
+ right: -1rem;
4821
+ top: -1rem
4822
+ }
4823
+ }
4824
+
4825
+ [data-coco][data-component="modal-canvas"] .modal-canvas-close{
4826
+ --tw-bg-opacity: 1;
4827
+ background-color: rgb(17 24 39 / var(--tw-bg-opacity));
4828
+ --tw-text-opacity: 1;
4829
+ color: rgb(255 255 255 / var(--tw-text-opacity));
4830
+ --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
4831
+ --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
4832
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
4833
+ }
4834
+
4835
+ [data-coco][data-component="modal-canvas"] .modal-canvas-close:focus{
4836
+ outline: 2px solid transparent;
4837
+ outline-offset: 2px;
4838
+ --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
4839
+ --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
4840
+ box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)
4841
+ }
4842
+
4843
+ [data-coco][data-component="modal-canvas"] .modal-canvas-content{
4844
+ position: relative;
4845
+ min-height: 100px;
4846
+ min-width: 100px;
4847
+ overflow: hidden;
4848
+ border-radius: 0.75rem;
4849
+ --tw-bg-opacity: 1;
4850
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
4851
+ width: -moz-fit-content;
4852
+ width: fit-content
4853
+ }
4854
+
4799
4855
  [data-coco][data-component="modal-dialog"]{
4800
4856
  width: 100%;
4801
4857
  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.6",
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
@@ -5,17 +5,13 @@
5
5
  .alert-container {
6
6
  @apply flex items-start px-4 py-2 relative;
7
7
  }
8
- /*
9
- .alert-icon {
10
- @apply flex items-center p-2 rounded-full;
11
-
12
- .coco-icon {
13
- @apply w-5 h-5;
14
- }
15
- } */
16
8
 
17
9
  .alert-body {
18
- @apply pl-4 pr-2;
10
+ @apply pr-2;
11
+ }
12
+
13
+ .alert-stamp + .alert-body {
14
+ @apply pl-4;
19
15
  }
20
16
 
21
17
  .alert-content {
@@ -88,7 +84,7 @@
88
84
  @apply py-1.5;
89
85
  }
90
86
 
91
- .alert-body {
87
+ .alert-stamp + .alert-body {
92
88
  @apply pl-3;
93
89
  }
94
90
 
@@ -9,9 +9,11 @@
9
9
  "vivid": vivid?
10
10
  }) do %>
11
11
  <div class="alert-container">
12
- <div class="alert-stamp" data-role="icon">
13
- <%= stamp %>
14
- </div>
12
+ <% if stamp.present? %>
13
+ <div class="alert-stamp" data-role="icon">
14
+ <%= stamp %>
15
+ </div>
16
+ <% end %>
15
17
 
16
18
  <div class="alert-body">
17
19
  <div class="alert-content" data-role="content">
@@ -12,6 +12,7 @@ module Coco
12
12
  accepts_option :single_line, from: [true, false]
13
13
  accepts_option :cloak, from: [true, false], default: true, private: true
14
14
  accepts_option :condensed, from: [true, false], default: false
15
+ accepts_option :icon, default: true
15
16
 
16
17
  renders_one :title
17
18
  renders_one :message
@@ -68,13 +69,18 @@ module Coco
68
69
  end
69
70
 
70
71
  def stamp
71
- type = unvividify(get_option_value(:theme))&.to_sym
72
72
  style = if get_option_value(:banner)
73
73
  :compact
74
74
  else
75
75
  vivid? ? :inverse : :subtle
76
76
  end
77
- coco_stamp(type, style:)
77
+
78
+ if get_option_value(:icon) == true
79
+ type = unvividify(get_option_value(:theme))&.to_sym
80
+ coco_stamp(type, style:)
81
+ elsif get_option_value(:icon).present?
82
+ coco_stamp(icon: get_option_value(:icon), style:)
83
+ end
78
84
  end
79
85
  end
80
86
  end
@@ -1,4 +1,8 @@
1
1
  @layer components {
2
2
  [data-coco][data-component="system-banner"] {
3
+ .alert-stamp {
4
+ @apply !mt-1;
5
+ @apply @[550px]:!mt-0;
6
+ }
3
7
  }
4
8
  }
@@ -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.6"
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.6
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-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '3.9'
34
34
  - - "<"
35
35
  - !ruby/object:Gem::Version
36
- version: '3.13'
36
+ version: '3.20'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '3.9'
44
44
  - - "<"
45
45
  - !ruby/object:Gem::Version
46
- version: '3.13'
46
+ version: '3.20'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: turbo-rails
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -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