coveragebook_components 0.17.2 → 0.17.4

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: a2af0604e33ee8ea690a93abf997f126ecaeb23528b3bf682fadc79eed353df2
4
- data.tar.gz: 6d055a247adaa8f2a794d3a6864d38a23fd2059d0c01d08ea183e751c06c440c
3
+ metadata.gz: 640690640d1cb09848352d16bf5eab6b24525775a46bff8773c316eadc349333
4
+ data.tar.gz: 64520da2e244704072216713b5d08376b468015145850bdf393f6636b73a4dd1
5
5
  SHA512:
6
- metadata.gz: eb41e2bfb905a693fb9a9ac36019d09699001552fa9f6aa2ce0df0b7f8281ebcc159f15cf41a58c059e1f83fe6907c085265cddee43dc893d8d475e34b146092
7
- data.tar.gz: 9c229a0bf2926994c7bf5699485365d74956e3fc23cb0df41842b11ca5e27df24f3603c9339a86771316acdf94b185e83250f9e2b5c651771f0fcb130c0f7f24
6
+ metadata.gz: dd6d5464840a829d94a91093897bebc91c0af1c73d64729088a4563fe89b8f00e401c245067e8c95f50d878fb8ac6af7e394fbbe2022f28113f196fa5573a6f2
7
+ data.tar.gz: edda3f86449b0cf48c5c2811a4ee9b61b3c5b706727fe8e8259abebf34135e235489d6288cea5cd533ad8401ba3069c7044422a604dd29e82e4dfeb51aabfeeb
@@ -4383,6 +4383,12 @@ select{
4383
4383
  opacity: 0
4384
4384
  }
4385
4385
 
4386
+ [data-coco][data-component="tooltip"] {
4387
+ display: block;
4388
+ width: -moz-fit-content;
4389
+ width: fit-content;
4390
+ }
4391
+
4386
4392
  [data-coco][data-component="modal"]{
4387
4393
  position: fixed;
4388
4394
  inset: 0px;
@@ -4549,56 +4555,72 @@ select{
4549
4555
 
4550
4556
  [data-coco][data-component="modal-dialog"]{
4551
4557
  width: 100%;
4552
- border-radius: 0.75rem
4558
+ border-radius: 2rem;
4559
+ --tw-bg-opacity: 1;
4560
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity))
4553
4561
  }
4554
4562
 
4555
4563
  .modal-frame [data-coco][data-component="modal-dialog"]{
4556
- --tw-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
4557
- --tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);
4558
- box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
4559
- max-width: 42rem /* temp until sizes added */
4564
+ --tw-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
4565
+ --tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);
4566
+ box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
4560
4567
  }
4561
4568
 
4569
+ .modal-frame [data-coco][data-component="modal-dialog"][data-size="sm"] {
4570
+ max-width: 480px;
4571
+ }
4572
+
4573
+ .modal-frame [data-coco][data-component="modal-dialog"][data-size="md"] {
4574
+ max-width: 520px;
4575
+ }
4576
+
4577
+ .modal-frame [data-coco][data-component="modal-dialog"][data-size="lg"] {
4578
+ max-width: 640px;
4579
+ }
4580
+
4562
4581
  [data-coco][data-component="modal-dialog"] .modal-dialog-header{
4563
- position: relative;
4564
- display: flex;
4565
- align-items: center;
4566
- height: 3.5rem;
4567
- border-top-left-radius: 0.75rem;
4568
- border-top-right-radius: 0.75rem;
4569
- border-bottom-width: 1px;
4570
- --tw-border-opacity: 1;
4571
- border-color: rgb(209 213 219 / var(--tw-border-opacity));
4582
+ border-top-left-radius: 2rem;
4583
+ border-top-right-radius: 2rem;
4572
4584
  --tw-bg-opacity: 1;
4573
4585
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
4574
4586
  padding-left: 1rem;
4575
- padding-right: 1rem
4587
+ padding-right: 1rem;
4588
+ padding-top: 1rem;
4589
+ padding-bottom: 1rem
4576
4590
  }
4577
4591
 
4578
4592
  @media (min-width: 576px){
4579
4593
 
4580
4594
  [data-coco][data-component="modal-dialog"] .modal-dialog-header{
4581
- height: 4rem;
4582
- padding-left: 2rem;
4583
- padding-right: 2rem
4595
+ padding-left: 2.5rem;
4596
+ padding-right: 2.5rem;
4597
+ padding-top: 1.5rem;
4598
+ padding-bottom: 1.5rem
4584
4599
  }
4585
4600
  }
4586
4601
 
4602
+ [data-coco][data-component="modal-dialog"] .modal-dialog-header-container{
4603
+ position: relative;
4604
+ display: flex;
4605
+ height: 2.75rem;
4606
+ align-items: center
4607
+ }
4608
+
4587
4609
  [data-coco][data-component="modal-dialog"] .modal-dialog-title{
4588
4610
  width: 100%;
4589
4611
  overflow: hidden;
4590
4612
  text-overflow: ellipsis;
4591
4613
  white-space: nowrap;
4592
4614
  padding-right: 1.5rem;
4593
- font-size: 1.125rem;
4594
- line-height: 1.75rem;
4615
+ font-size: 20px;
4616
+ line-height: 24px;
4595
4617
  font-weight: 700
4596
4618
  }
4597
4619
 
4598
4620
  [data-coco][data-component="modal-dialog"] .modal-dialog-close{
4599
4621
  position: absolute;
4600
4622
  top: 50%;
4601
- right: 0.25rem;
4623
+ right: -0.25rem;
4602
4624
  display: block;
4603
4625
  flex: none;
4604
4626
  --tw-translate-y: -50%;
@@ -4609,18 +4631,24 @@ select{
4609
4631
  @media (min-width: 576px){
4610
4632
 
4611
4633
  [data-coco][data-component="modal-dialog"] .modal-dialog-close{
4612
- right: 0.75rem
4634
+ right: -0.5rem
4613
4635
  }
4614
4636
  }
4615
4637
 
4616
4638
  [data-coco][data-component="modal-dialog"] .modal-dialog-close{
4639
+ border-radius: 9999px;
4617
4640
  --tw-text-opacity: 1;
4618
- color: rgb(156 163 175 / var(--tw-text-opacity))
4641
+ color: rgb(17 24 39 / var(--tw-text-opacity));
4642
+ transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
4643
+ transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
4644
+ transition-duration: 150ms
4619
4645
  }
4620
4646
 
4621
4647
  [data-coco][data-component="modal-dialog"] .modal-dialog-close:hover{
4648
+ --tw-bg-opacity: 1;
4649
+ background-color: rgb(243 244 246 / var(--tw-bg-opacity));
4622
4650
  --tw-text-opacity: 1;
4623
- color: rgb(31 41 55 / var(--tw-text-opacity))
4651
+ color: rgb(17 24 39 / var(--tw-text-opacity))
4624
4652
  }
4625
4653
 
4626
4654
  [data-coco][data-component="modal-dialog"] .modal-dialog-close:focus{
@@ -4631,23 +4659,37 @@ select{
4631
4659
  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)
4632
4660
  }
4633
4661
 
4662
+ [data-coco][data-component="modal-dialog"] .modal-dialog-notice [data-component="notice"]{
4663
+ margin-bottom: 1rem;
4664
+ padding-left: 1rem;
4665
+ padding-right: 1rem
4666
+ }
4667
+
4668
+ @media (min-width: 576px){
4669
+
4670
+ [data-coco][data-component="modal-dialog"] .modal-dialog-notice [data-component="notice"]{
4671
+ margin-bottom: 1.5rem;
4672
+ padding-left: 2.5rem;
4673
+ padding-right: 2.5rem
4674
+ }
4675
+ }
4676
+
4634
4677
  [data-coco][data-component="modal-dialog"] .modal-dialog-content{
4635
- border-radius: 0.75rem;
4678
+ border-bottom-right-radius: 2rem;
4679
+ border-bottom-left-radius: 2rem;
4636
4680
  --tw-bg-opacity: 1;
4637
- background-color: rgb(243 244 246 / var(--tw-bg-opacity));
4681
+ background-color: rgb(255 255 255 / var(--tw-bg-opacity));
4638
4682
  padding-left: 1rem;
4639
4683
  padding-right: 1rem;
4640
- padding-top: 1rem;
4641
- padding-bottom: 1rem
4684
+ padding-bottom: 1.5rem
4642
4685
  }
4643
4686
 
4644
4687
  @media (min-width: 576px){
4645
4688
 
4646
4689
  [data-coco][data-component="modal-dialog"] .modal-dialog-content{
4647
- padding-left: 2rem;
4648
- padding-right: 2rem;
4649
- padding-top: 1.5rem;
4650
- padding-bottom: 1.5rem
4690
+ padding-left: 2.5rem;
4691
+ padding-right: 2.5rem;
4692
+ padding-bottom: 2rem
4651
4693
  }
4652
4694
  }
4653
4695
 
@@ -6861,9 +6903,6 @@ select{
6861
6903
 
6862
6904
  .tippy-box[data-theme~="coco-tooltip"] .tippy-content{
6863
6905
  max-width: 240px;
6864
- overflow: hidden;
6865
- text-overflow: ellipsis;
6866
- white-space: nowrap;
6867
6906
  padding-left: 0.75rem;
6868
6907
  padding-right: 0.75rem;
6869
6908
  padding-top: 0.5rem;
@@ -15415,7 +15415,7 @@ var alpine_default = import_alpinejs.default;
15415
15415
  // ../../../package.json
15416
15416
  var package_default = {
15417
15417
  name: "coveragebook-components",
15418
- version: "0.17.2",
15418
+ version: "0.17.4",
15419
15419
  repository: "git@github.com:coveragebook/coco.git",
15420
15420
  license: "NO LICENSE",
15421
15421
  author: "Mark Perkins <mark@coveragebook.com>",
@@ -16358,8 +16358,26 @@ var toast_default = CocoComponent("toast", () => {
16358
16358
  };
16359
16359
  });
16360
16360
 
16361
+ // ../../components/coco/messaging/tooltip/tooltip.js
16362
+ var tooltip_exports = {};
16363
+ __export(tooltip_exports, {
16364
+ default: () => tooltip_default2
16365
+ });
16366
+ var tooltip_default2 = CocoComponent("tooltip", () => {
16367
+ return {
16368
+ init() {
16369
+ tippy_default(this.$el, {
16370
+ theme: "coco-tooltip",
16371
+ appendTo: () => {
16372
+ return this.$el.firstElementChild;
16373
+ }
16374
+ });
16375
+ }
16376
+ };
16377
+ });
16378
+
16361
16379
  // import-glob:/Users/mark/Code/coveragebook/coco/app/assets/js/base|@components/messaging/**/*.js
16362
- var modules7 = [alert_exports, notice_exports, snackbar_exports, system_banner_exports, toast_exports];
16380
+ var modules7 = [alert_exports, notice_exports, snackbar_exports, system_banner_exports, toast_exports, tooltip_exports];
16363
16381
  var __default7 = modules7;
16364
16382
 
16365
16383
  // ../../components/coco/modals/modal/modal.js
@@ -35,7 +35,7 @@
35
35
  @apply bg-background-dark-2 text-white label-sm rounded-lg shadow-xl;
36
36
 
37
37
  .tippy-content {
38
- @apply px-3 py-2 truncate max-w-[240px];
38
+ @apply px-3 py-2 max-w-[240px];
39
39
  }
40
40
 
41
41
  /* arrow background */
@@ -35,6 +35,11 @@ module Coco
35
35
  unless tag_attr?(:id)
36
36
  set_tag_attr(:id, "alert-#{rand(1000)}")
37
37
  end
38
+ with_title { @title } unless title?
39
+ end
40
+
41
+ def initialize(title: nil, **kwargs)
42
+ @title = title
38
43
  end
39
44
 
40
45
  def dismissable?
@@ -14,5 +14,13 @@ module Coco
14
14
  alert.send(:"with_#{slot_name}", *args, **kwargs, &block)
15
15
  end
16
16
  end
17
+
18
+ before_render do
19
+ with_title { @title } unless title?
20
+ end
21
+
22
+ def initialize(title: nil, **kwargs)
23
+ @title = title
24
+ end
17
25
  end
18
26
  end
@@ -0,0 +1,6 @@
1
+ @layer components {
2
+ [data-coco][data-component="tooltip"] {
3
+ display: block;
4
+ width: fit-content;
5
+ }
6
+ }
@@ -0,0 +1,3 @@
1
+ <%= render component_tag(x:{data: "tooltip"}, data: {tippy_content: text}) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,15 @@
1
+ import { CocoComponent } from "@assets/js/coco/component";
2
+ import tippy from "@js/base/tippy";
3
+
4
+ export default CocoComponent("tooltip", () => {
5
+ return {
6
+ init() {
7
+ tippy(this.$el, {
8
+ theme: "coco-tooltip",
9
+ appendTo: () => {
10
+ return this.$el.firstElementChild;
11
+ },
12
+ });
13
+ },
14
+ };
15
+ });
@@ -0,0 +1,9 @@
1
+ module Coco
2
+ class Tooltip < Coco::Component
3
+ attr_reader :text
4
+
5
+ def initialize(text:, **)
6
+ @text = text
7
+ end
8
+ end
9
+ end
@@ -1,28 +1,46 @@
1
1
  @layer components {
2
2
  [data-coco][data-component="modal-dialog"] {
3
- @apply rounded-xl w-full;
3
+ @apply rounded-[2rem] w-full bg-background-light-1;
4
4
 
5
5
  .modal-frame & {
6
- @apply shadow-2xl;
7
- @apply max-w-2xl; /* temp until sizes added */
6
+ @apply shadow-xl;
7
+
8
+ &[data-size="sm"] {
9
+ max-width: 480px;
10
+ }
11
+
12
+ &[data-size="md"] {
13
+ max-width: 520px;
14
+ }
15
+
16
+ &[data-size="lg"] {
17
+ max-width: 640px;
18
+ }
8
19
  }
9
20
 
10
21
  .modal-dialog-header {
11
- @apply relative flex items-center;
12
- @apply px-4 sm:px-8 h-14 sm:h-16 border-b border-coco-gray-300 rounded-t-xl bg-white;
22
+ @apply px-4 sm:px-10 py-4 sm:py-6 rounded-t-[2rem] bg-background-light-1;
23
+ }
24
+
25
+ .modal-dialog-header-container {
26
+ @apply relative flex items-center h-11;
13
27
  }
14
28
 
15
29
  .modal-dialog-title {
16
- @apply text-lg pr-6 w-full font-bold truncate;
30
+ @apply text-heading-5 pr-6 w-full font-bold truncate;
17
31
  }
18
32
 
19
33
  .modal-dialog-close {
20
- @apply flex-none block p-2 absolute top-1/2 right-1 sm:right-3 -translate-y-1/2;
21
- @apply focus:ring-0 focus:outline-none text-content-dark-muted hover:text-content-dark-2;
34
+ @apply flex-none block p-2 absolute top-1/2 -right-1 sm:-right-2 -translate-y-1/2;
35
+ @apply focus:ring-0 focus:outline-none text-content-dark-1 hover:text-content-dark-1 rounded-full hover:bg-coco-gray-100 transition-colors;
36
+ }
37
+
38
+ .modal-dialog-notice [data-component="notice"] {
39
+ @apply px-4 sm:px-10 mb-4 sm:mb-6;
22
40
  }
23
41
 
24
42
  .modal-dialog-content {
25
- @apply px-4 sm:px-8 py-4 sm:py-6 rounded-xl bg-background-light-3;
43
+ @apply px-4 sm:px-10 pb-6 sm:pb-8 rounded-b-[2rem] bg-background-light-1;
26
44
  }
27
45
 
28
46
  .modal-dialog-header + .modal-dialog-content {
@@ -1,18 +1,27 @@
1
1
  <%= render component_tag(x: {data: x_data("modalDialog")}) do %>
2
2
  <% if header? %>
3
3
  <header class="modal-dialog-header">
4
- <% if title? %>
5
- <h4 class="modal-dialog-title" data-role="title">
6
- <%= title %>
7
- </h4>
8
- <% end %>
9
- <% if dismissable? %>
10
- <button type="button" class="modal-dialog-close" data-role="close" @click="close">
11
- <%= coco_icon(:x, size: :md) %>
12
- </button>
13
- <% end %>
4
+ <div class="modal-dialog-header-container">
5
+ <% if title? %>
6
+ <h4 class="modal-dialog-title" data-role="title">
7
+ <%= title %>
8
+ </h4>
9
+ <% end %>
10
+ <% if dismissable? %>
11
+ <button type="button" class="modal-dialog-close" data-role="close" @click="close">
12
+ <%= coco_icon(:x, size: :md) %>
13
+ </button>
14
+ <% end %>
15
+ </div>
14
16
  </header>
15
17
  <% end %>
18
+
19
+ <% if notice? %>
20
+ <div class="modal-dialog-notice">
21
+ <%= notice %>
22
+ </div>
23
+ <% end %>
24
+
16
25
  <div class="modal-dialog-content">
17
26
  <%= content %>
18
27
  </div>
@@ -3,6 +3,11 @@ module Coco
3
3
  include Concerns::AcceptsOptions
4
4
 
5
5
  accepts_option :dismissable, from: [true, false], default: true
6
+ accepts_option :size, from: [:sm, :md, :lg], default: :md
7
+
8
+ renders_one :notice, ->(**kwargs) do
9
+ Coco::Notice.new(**kwargs, dismissable: false)
10
+ end
6
11
 
7
12
  renders_one :title
8
13
 
@@ -146,6 +146,10 @@ module Coco
146
146
 
147
147
  # Messaging
148
148
 
149
+ def coco_tooltip(text, **, &)
150
+ render(Coco::Tooltip.new(text:, **), &)
151
+ end
152
+
149
153
  def coco_notice(**, &)
150
154
  render(Coco::Notice.new(**), &)
151
155
  end
@@ -168,9 +172,9 @@ module Coco
168
172
  render(Coco::Modal.new(name: name, **), &)
169
173
  end
170
174
 
171
- def coco_modal_dialog(name = "default", **, &block)
175
+ def coco_modal_dialog(name = "default", size: :md, **, &block)
172
176
  render(Coco::Modal.new(name: name, **)) do |modal|
173
- modal.with_container_dialog(&block)
177
+ modal.with_container_dialog(size: size, &block)
174
178
  end
175
179
  end
176
180
 
data/lib/coco.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Coco
2
- VERSION = "0.17.2"
2
+ VERSION = "0.17.4"
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.17.2
4
+ version: 0.17.4
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-03-21 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1653,6 +1653,10 @@ files:
1653
1653
  - app/components/coco/messaging/toast/toast.html.erb
1654
1654
  - app/components/coco/messaging/toast/toast.js
1655
1655
  - app/components/coco/messaging/toast/toast.rb
1656
+ - app/components/coco/messaging/tooltip/tooltip.css
1657
+ - app/components/coco/messaging/tooltip/tooltip.html.erb
1658
+ - app/components/coco/messaging/tooltip/tooltip.js
1659
+ - app/components/coco/messaging/tooltip/tooltip.rb
1656
1660
  - app/components/coco/modals/modal/modal.css
1657
1661
  - app/components/coco/modals/modal/modal.html.erb
1658
1662
  - app/components/coco/modals/modal/modal.js