coveragebook_components 0.8.0.beta.2 → 0.8.0

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: b89e4f8770587065a0d3967f7f767ff9b420e36e30abf97c3dc72bcf3bc41d34
4
- data.tar.gz: 70662dbab01723243b282c24ea050f697f639044acf91157648945dfe52b9a1e
3
+ metadata.gz: ae77cd8872af17a8cd219cb7a618bd31ad7b91ab25b1c852d5b64f24e2d737d9
4
+ data.tar.gz: 9b81c6df5c45518c68cf232ee7ffa91e4624cd7a9ccb9313d27a216d2daf8630
5
5
  SHA512:
6
- metadata.gz: eb05436465f98461bbbb58148fe1519e7e0b4bf2981328d0d16aa4a05312aa2755ee24f07de5a4137d138fd42ba0fa002cc4320cae9a687f29421848b9d651f6
7
- data.tar.gz: 6dbc15f4ab52cf871137891789fed68a544ed90b824f11381b84559de0c4be3fb49129337a8a744f8c43d444fa23f0da2cba2b82605e29596640019aa698210b
6
+ metadata.gz: 675ca27e722a47f807018e81c069396b7f6476f8ac04a2cb63676442de5f2fbbe307354f6d693eea04318c81f205671627d5b50dcd978a1d848749b2853d971d
7
+ data.tar.gz: 20280d160c4ea2c53bd8fe600bb04180e42815091a60530c962ccabe0021fb8fedfaae6a8cc6c15dac2abfa6759fc2b2e45f5d6f74f8dbab6aff64fdea22df08
@@ -1395,6 +1395,8 @@ select{
1395
1395
  width: 100%;
1396
1396
  grid-template-rows: repeat(1, minmax(0, 1fr));
1397
1397
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1fr)}
1398
+ [data-coco][data-component="app-sidebar-nav"] .nav-action{
1399
+ cursor: pointer}
1398
1400
  [data-coco][data-component="app-sidebar-nav"] .nav-action .nav-item-label{
1399
1401
  display: none;
1400
1402
  --tw-text-opacity: 1 !important;
@@ -1514,6 +1516,7 @@ select{
1514
1516
  }
1515
1517
  [data-coco][data-component="app-sidebar-nav-item"]{
1516
1518
  flex: none;
1519
+ cursor: pointer;
1517
1520
  --tw-bg-opacity: 1;
1518
1521
  background-color: rgb(31 41 55 / var(--tw-bg-opacity));
1519
1522
  text-align: center;
@@ -1545,6 +1548,7 @@ select{
1545
1548
  [data-coco][data-component="app-sidebar-nav-item"] .nav-item-label{
1546
1549
  margin-top: 0.125rem;
1547
1550
  display: block;
1551
+ cursor: pointer;
1548
1552
  font-size: 10px;
1549
1553
  line-height: 12px;
1550
1554
  font-weight: 600;
@@ -2686,26 +2690,29 @@ select{
2686
2690
  --tw-bg-opacity: 1;
2687
2691
  background-color: rgb(209 213 219 / var(--tw-bg-opacity))}
2688
2692
  [data-coco][data-component="app-button"][data-theme="neutral-light"]{
2693
+ border-width: 1px;
2694
+ border-color: transparent}
2695
+ [data-coco][data-component="app-button"][data-theme="neutral-light"] .button-element{
2689
2696
  --tw-bg-opacity: 1;
2690
2697
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
2691
2698
  --tw-text-opacity: 1;
2692
2699
  color: rgb(17 24 39 / var(--tw-text-opacity))}
2693
- [data-coco][data-component="app-button"][data-theme="neutral-light"]:hover{
2700
+ [data-coco][data-component="app-button"][data-theme="neutral-light"] .button-element:hover{
2694
2701
  --tw-bg-opacity: 1;
2695
2702
  background-color: rgb(249 250 251 / var(--tw-bg-opacity))}
2696
- [data-coco][data-component="app-button"][data-theme="neutral-light"]:active{
2703
+ [data-coco][data-component="app-button"][data-theme="neutral-light"] .button-element:active{
2697
2704
  --tw-bg-opacity: 1;
2698
2705
  background-color: rgb(243 244 246 / var(--tw-bg-opacity))}
2699
- [data-coco][data-component="app-button"][data-theme="neutral-light"][data-state="loading"]{
2706
+ [data-coco][data-component="app-button"][data-theme="neutral-light"][data-state="loading"] .button-element{
2700
2707
  --tw-bg-opacity: 1;
2701
2708
  background-color: rgb(255 255 255 / var(--tw-bg-opacity))}
2702
- [data-coco][data-component="app-button"][data-theme="neutral-light"][data-state="active"]{
2709
+ [data-coco][data-component="app-button"][data-theme="neutral-light"][data-state="active"] .button-element{
2703
2710
  --tw-bg-opacity: 1;
2704
2711
  background-color: rgb(243 244 246 / var(--tw-bg-opacity))}
2705
- [data-coco][data-component="app-button"][data-theme="neutral-light"][data-disabled="true"]{
2712
+ [data-coco][data-component="app-button"][data-theme="neutral-light"][data-disabled="true"] .button-element{
2706
2713
  --tw-bg-opacity: 1;
2707
2714
  background-color: rgb(255 255 255 / var(--tw-bg-opacity))}
2708
- [data-coco][data-component="app-button"][data-theme="neutral-light"][data-disabled="true"] .button-inner{
2715
+ [data-coco][data-component="app-button"][data-theme="neutral-light"][data-disabled="true"] .button-element .button-inner{
2709
2716
  opacity: 0.4}
2710
2717
  [data-coco][data-component="app-button"][data-theme="text-neutral-light"]{
2711
2718
  background-color: transparent;
@@ -14038,7 +14038,7 @@
14038
14038
  var package_default = {
14039
14039
  name: "coveragebook-components",
14040
14040
  type: "module",
14041
- version: "0.8.0-beta.2",
14041
+ version: "0.8.0",
14042
14042
  main: "index.js",
14043
14043
  repository: "git@github.com:coveragebook/coco.git",
14044
14044
  author: "Mark Perkins <mark@coveragebook.com>",
@@ -5,6 +5,8 @@
5
5
  grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1fr);
6
6
 
7
7
  .nav-action {
8
+ @apply cursor-pointer;
9
+
8
10
  .nav-item-label {
9
11
  @apply hidden !text-content-primary-inverse-vivid;
10
12
  }
@@ -8,7 +8,7 @@
8
8
  </span>
9
9
  <% end %>
10
10
 
11
- <% item.with_menu do %>
11
+ <% item.with_menu(id: "actions-nav-link") do %>
12
12
  <% actions_data.each do |action| %>
13
13
  <%= coco_link(action[:href],
14
14
  **action.except(:label, :description, :href, :icon),
@@ -1,6 +1,6 @@
1
1
  @layer components {
2
2
  [data-coco][data-component="app-sidebar-nav-item"] {
3
- @apply bg-background-dark-2 text-content-dark-muted text-center no-underline transition-colors flex-none;
3
+ @apply bg-background-dark-2 text-content-dark-muted text-center no-underline transition-colors flex-none cursor-pointer;
4
4
  @apply flex items-center justify-center px-4 w-full flex-col;
5
5
 
6
6
  &[href] {
@@ -13,7 +13,7 @@
13
13
  }
14
14
 
15
15
  .nav-item-label {
16
- @apply block font-semibold text-label-xxs transition-colors mt-0.5;
16
+ @apply block font-semibold text-label-xxs transition-colors mt-0.5 cursor-pointer;
17
17
  }
18
18
 
19
19
  &.emphasised {
@@ -12,8 +12,10 @@
12
12
  <%= label %>
13
13
  </label>
14
14
  <% if menu? || menu_items? %>
15
- <template x-ref="menu">
16
- <div class="sidebar-nav-menu" x-cloak>
15
+ <%= tag.template id: menu_template_id, "x-ref": "menu" do %>
16
+ <%= tag.div id: menu_id,
17
+ class: "sidebar-nav-menu",
18
+ "x-cloak": "" do %>
17
19
  <% if menu? %>
18
20
  <%= menu %>
19
21
  <% else %>
@@ -37,7 +39,7 @@
37
39
 
38
40
  <%= menu_action %>
39
41
  <% end %>
40
- </div>
41
- </template>
42
+ <% end %>
43
+ <% end %>
42
44
  <% end %>
43
45
  <% end %>
@@ -25,6 +25,7 @@ module Coco
25
25
  end
26
26
 
27
27
  before_render do
28
+ set_tag_attr(:id, item_id)
28
29
  if @icon && !icon?
29
30
  with_icon do
30
31
  tag.span(class: "nav-item-icon") do
@@ -34,9 +35,10 @@ module Coco
34
35
  end
35
36
  end
36
37
 
37
- attr_reader :label, :tooltip, :dropdown_menu_items, :max_menu_items
38
+ attr_reader :label, :tooltip, :dropdown_menu_items, :max_menu_items, :item_id
38
39
 
39
- def initialize(label:, icon: nil, emphasise: false, active: false, tooltip: nil, menu_select_placeholder: nil, max_menu_items: 6, **)
40
+ def initialize(label:, id: nil, icon: nil, emphasise: false, active: false, tooltip: nil, menu_select_placeholder: nil, max_menu_items: 6, **)
41
+ @item_id = id
40
42
  @label = label
41
43
  @icon = icon
42
44
  @emphasise = emphasise
@@ -63,6 +65,14 @@ module Coco
63
65
  @menu_select_placeholder || "More items..."
64
66
  end
65
67
 
68
+ def menu_id
69
+ "#{item_id}-menu" if item_id.present?
70
+ end
71
+
72
+ def menu_template_id
73
+ "#{menu_id}-template" if menu_id.present?
74
+ end
75
+
66
76
  class SidebarNavMenuItem < Coco::Component
67
77
  attr_reader :icon, :href, :modal
68
78
 
@@ -20,7 +20,7 @@
20
20
  <% end %>
21
21
 
22
22
  <p class="alert-message"<% if single_line? %> x-dimensions="checkSingleLineWrap(dimensions)"<% end %>>
23
- <%= content %>
23
+ <%= message? ? message : content %>
24
24
  </p>
25
25
 
26
26
  <% if link? %>
@@ -26,6 +26,7 @@ module Coco
26
26
  accepts_option :condensed, from: [true, false], default: false
27
27
 
28
28
  renders_one :title
29
+ renders_one :message
29
30
 
30
31
  renders_one :action, ->(*args, **kwargs, &block) do
31
32
  theme = vivid? ? "neutral-dark" : get_option_value(:theme)
@@ -241,17 +241,21 @@
241
241
  }
242
242
 
243
243
  &[data-theme="neutral-light"] {
244
- @apply bg-background-light-1 text-content-dark-1 hover:bg-background-light-2 active:bg-background-light-3;
244
+ @apply border border-transparent;
245
245
 
246
- &[data-state="loading"] {
246
+ .button-element {
247
+ @apply bg-background-light-1 text-content-dark-1 hover:bg-background-light-2 active:bg-background-light-3;
248
+ }
249
+
250
+ &[data-state="loading"] .button-element {
247
251
  @apply bg-background-light-1;
248
252
  }
249
253
 
250
- &[data-state="active"] {
254
+ &[data-state="active"] .button-element {
251
255
  @apply bg-background-light-3;
252
256
  }
253
257
 
254
- &[data-disabled="true"] {
258
+ &[data-disabled="true"] .button-element {
255
259
  @apply bg-background-light-1;
256
260
 
257
261
  .button-inner {
@@ -1,5 +1,4 @@
1
- <%= render component_tag(
2
- x: { data: x_data("appSystemBanner", alpine_data), bind: "root"}) do %>
1
+ <%= render component_tag(x: { data: x_data("appSystemBanner", alpine_data), bind: "root"}) do %>
3
2
  <%= render alert do %>
4
3
  <%= content %>
5
4
  <% end %>
@@ -20,12 +20,20 @@ module Coco
20
20
  )
21
21
  end
22
22
 
23
- %i[title action secondary_action link].each do |slot_name|
23
+ %i[action secondary_action link].each do |slot_name|
24
24
  renders_one slot_name, ->(*args, **kwargs, &block) do
25
25
  alert.send("with_#{slot_name}".to_sym, *args, **kwargs, &block)
26
26
  end
27
27
  end
28
28
 
29
+ renders_one :title, ->(text = nil, **kwargs, &block) do
30
+ alert.public_send(:with_title, **kwargs) { text.presence || block.call }
31
+ end
32
+
33
+ renders_one :message, ->(text = nil, **kwargs, &block) do
34
+ alert.public_send(:with_message, **kwargs) { text.presence || block.call }
35
+ end
36
+
29
37
  before_render do
30
38
  if dismissable? && id.blank?
31
39
  raise ArgumentError, "Dismissable banners must be given an ID"
data/lib/coco.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Coco
2
- VERSION = "0.8.0.beta.2"
2
+ VERSION = "0.8.0"
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.0.beta.2
4
+ version: 0.8.0
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-10-23 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1605,9 +1605,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1605
1605
  version: 3.2.0
1606
1606
  required_rubygems_version: !ruby/object:Gem::Requirement
1607
1607
  requirements:
1608
- - - ">"
1608
+ - - ">="
1609
1609
  - !ruby/object:Gem::Version
1610
- version: 1.3.1
1610
+ version: '0'
1611
1611
  requirements: []
1612
1612
  rubygems_version: 3.4.19
1613
1613
  signing_key: