coveragebook_components 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56e96bf21cb8437a062de0f41591fa2368d9ac92ff5e9dbf04f43601807f298c
4
- data.tar.gz: 7e7cf02e0e22797765a93794e8ec6f6530b6796ba912b8c12c3c9338c995cc2b
3
+ metadata.gz: 287b92ab8ab281433ab11b74dc67dcff72cffd6d2ef1c3e3e03a7b7336f7cb7f
4
+ data.tar.gz: fafbf5dca17cc74fe3e7c1c7916ed17ad094283e4c74d551f22ebc087e7faecb
5
5
  SHA512:
6
- metadata.gz: 0d83add134a2d60eb2ce75818286274a2241f8fa63b384c85c3c50c8e8c0d4b9d25bedeacbe8225190680da26ec48f1200d6b0bc6fbda03f8f08487b11be877b
7
- data.tar.gz: 89075553adbaefe4f6c4e620507791b54adcaff30f8038a3d4f06d03d7b14d7e5c725085f8f06e844b8463855fdd243ba4b9f811b98a168bc9f38367f51e488e
6
+ metadata.gz: 9b8f37fd4a0af96e03ee70512e55fdf50a28f640e0577557a7b961a59ac05ef75890af415bcdb1cdcc5a205ed46749706c2d04213fdd2fb03a87b972e7beaf7d
7
+ data.tar.gz: fb86b8cf5ac533096b0872b11b263b0be7c170ce2ed6c031d543089188db8a0acb82f9c2aa9c9345b87e08e4ab404e66e1790973e2832a14f3460c8fe21b1931
@@ -879,16 +879,17 @@ select{
879
879
  [data-coco].coco-link{
880
880
  display: inline-flex;
881
881
  align-items: center}
882
- [data-coco].coco-link[data-icon-position="start"] .link-text{
883
- order: 2}
884
- [data-coco].coco-link[data-icon-position="start"] [data-component="icon"]{
882
+ [data-coco].coco-link.with-icon > [data-component="icon"]{
885
883
  order: 1;
886
884
  margin-right: 0.4em}
887
- [data-coco].coco-link[data-icon-position="end"] .link-text{
885
+ [data-coco].coco-link.with-icon .link-text{
886
+ order: 2}
887
+ [data-coco].coco-link.with-icon[data-icon-position="end"] .link-text{
888
888
  order: 1;
889
889
  margin-right: 0.4em}
890
- [data-coco].coco-link[data-icon-position="end"] [data-component="icon"]{
891
- order: 2}
890
+ [data-coco].coco-link.with-icon[data-icon-position="end"] [data-component="icon"]{
891
+ order: 2;
892
+ margin-right: 0px}
892
893
  [data-coco][data-component="modal"]{
893
894
  position: fixed;
894
895
  inset: 0px;
@@ -952,7 +953,7 @@ select{
952
953
  padding-right: 1.5rem;
953
954
  font-size: 1.125rem;
954
955
  line-height: 1.75rem;
955
- font-weight: 600}
956
+ font-weight: 700}
956
957
  [data-coco][data-component="modal-dialog"] .modal-dialog-close{
957
958
  position: absolute;
958
959
  top: 50%;
@@ -2422,6 +2423,12 @@ select{
2422
2423
  --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
2423
2424
  --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
2424
2425
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}
2426
+ [data-coco][data-component="app-button-to"]{
2427
+ display: inline-flex;
2428
+ width: -moz-max-content;
2429
+ width: max-content}
2430
+ [data-coco][data-component="app-button-to"] form{
2431
+ width: 100%}
2425
2432
  [data-coco][data-component="app-color-picker"]{
2426
2433
  --tw-bg-opacity: 1;
2427
2434
  background-color: rgb(249 250 251 / var(--tw-bg-opacity))}
@@ -2750,12 +2757,6 @@ select{
2750
2757
  font-size: 14px;
2751
2758
  line-height: 16px;
2752
2759
  font-weight: 600}
2753
- [data-coco][data-component="app-form-button"]{
2754
- display: inline-flex;
2755
- width: -moz-max-content;
2756
- width: max-content}
2757
- [data-coco][data-component="app-form-button"] form{
2758
- width: 100%}
2759
2760
  [data-coco][data-component="app-image-picker"] .picker-blank-state{
2760
2761
  display: flex;
2761
2762
  flex-direction: column;
@@ -3012,10 +3013,14 @@ select{
3012
3013
  padding: 1.5rem;
3013
3014
  }
3014
3015
  }
3015
- [data-coco][data-component="app-link"]{
3016
+ [data-coco][data-component="app-link"][data-theme]{
3016
3017
  text-decoration-line: none}
3017
- [data-coco][data-component="app-link"]:hover{
3018
+ [data-coco][data-component="app-link"][data-theme]:hover{
3018
3019
  text-decoration-line: underline}
3020
+ [data-coco][data-component="app-link"][data-underline="true"]{
3021
+ text-decoration-line: underline}
3022
+ [data-coco][data-component="app-link"][data-underline="false"]{
3023
+ text-decoration-line: none}
3019
3024
  [data-coco][data-component="app-link"][data-theme="primary"]{
3020
3025
  --tw-text-opacity: 1;
3021
3026
  color: rgb(26 136 113 / var(--tw-text-opacity))}
@@ -3059,21 +3064,21 @@ select{
3059
3064
  [data-coco][data-component="app-menu"] .menu-item > *{
3060
3065
  width: 100%}
3061
3066
  [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button"]:hover,
3062
- [data-coco][data-component="app-menu"] .menu-item > [data-component="app-form-button"]:hover,
3067
+ [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button-to"]:hover,
3063
3068
  [data-coco][data-component="app-menu"] .menu-item > [data-component="app-menu-button"]:hover{
3064
3069
  background-color: rgba(0, 12, 39, 0.06);
3065
3070
  background-blend-mode: hard-light}
3066
3071
  [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button"]:active,
3067
- [data-coco][data-component="app-menu"] .menu-item > [data-component="app-form-button"]:active,
3072
+ [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button-to"]:active,
3068
3073
  [data-coco][data-component="app-menu"] .menu-item > [data-component="app-menu-button"]:active{
3069
3074
  background-color: rgba(0, 12, 39, 0.1);
3070
3075
  background-blend-mode: hard-light}
3071
- [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button"] .button-inner, [data-coco][data-component="app-menu"] .menu-item > [data-component="app-form-button"] .button-inner, [data-coco][data-component="app-menu"] .menu-item > [data-component="app-menu-button"] .button-inner{
3076
+ [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button"] .button-inner, [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button-to"] .button-inner, [data-coco][data-component="app-menu"] .menu-item > [data-component="app-menu-button"] .button-inner{
3072
3077
  margin-left: 0px;
3073
3078
  margin-right: 0px;
3074
3079
  justify-content: flex-start;
3075
3080
  text-align: left}
3076
- [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button"] .button-content, [data-coco][data-component="app-menu"] .menu-item > [data-component="app-form-button"] .button-content, [data-coco][data-component="app-menu"] .menu-item > [data-component="app-menu-button"] .button-content{
3081
+ [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button"] .button-content, [data-coco][data-component="app-menu"] .menu-item > [data-component="app-button-to"] .button-content, [data-coco][data-component="app-menu"] .menu-item > [data-component="app-menu-button"] .button-content{
3077
3082
  font-weight: 400 !important}
3078
3083
  [data-coco][data-component="app-menu"][data-size="sm"]{
3079
3084
  padding-top: 0.375rem;
@@ -3301,7 +3306,7 @@ select{
3301
3306
  position: fixed;
3302
3307
  top: 2rem;
3303
3308
  right: 2rem;
3304
- z-index: 1000}
3309
+ z-index: 10001}
3305
3310
  /* Transitions */
3306
3311
  [data-coco][data-component="app-toast"].toast-enter{
3307
3312
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
@@ -3786,6 +3791,8 @@ select{
3786
3791
  .text-teal-500{
3787
3792
  --tw-text-opacity: 1;
3788
3793
  color: rgb(20 184 166 / var(--tw-text-opacity))}
3794
+ .underline{
3795
+ text-decoration-line: underline}
3789
3796
  .filter{
3790
3797
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}
3791
3798
  /* Transparent gray blend-mode background utilities */
@@ -14032,7 +14032,7 @@
14032
14032
  var package_default = {
14033
14033
  name: "coveragebook-components",
14034
14034
  type: "module",
14035
- version: "0.7.2",
14035
+ version: "0.7.3",
14036
14036
  main: "index.js",
14037
14037
  repository: "git@github.com:coveragebook/coco.git",
14038
14038
  author: "Mark Perkins <mark@coveragebook.com>",
@@ -944,19 +944,20 @@ select {
944
944
  display: inline-flex;
945
945
  align-items: center;
946
946
  }
947
- [data-coco].coco-link[data-icon-position="start"] .link-text {
948
- order: 2;
949
- }
950
- [data-coco].coco-link[data-icon-position="start"] [data-component="icon"] {
947
+ [data-coco].coco-link.with-icon > [data-component="icon"] {
951
948
  order: 1;
952
949
  margin-right: 0.4em;
953
950
  }
954
- [data-coco].coco-link[data-icon-position="end"] .link-text {
951
+ [data-coco].coco-link.with-icon .link-text {
952
+ order: 2;
953
+ }
954
+ [data-coco].coco-link.with-icon[data-icon-position="end"] .link-text {
955
955
  order: 1;
956
956
  margin-right: 0.4em;
957
957
  }
958
- [data-coco].coco-link[data-icon-position="end"] [data-component="icon"] {
958
+ [data-coco].coco-link.with-icon[data-icon-position="end"] [data-component="icon"] {
959
959
  order: 2;
960
+ margin-right: 0px;
960
961
  }
961
962
  [data-coco][data-component="modal"] {
962
963
  position: fixed;
@@ -1032,7 +1033,7 @@ select {
1032
1033
  padding-right: 1.5rem;
1033
1034
  font-size: 1.125rem;
1034
1035
  line-height: 1.75rem;
1035
- font-weight: 600;
1036
+ font-weight: 700;
1036
1037
  }
1037
1038
  [data-coco][data-component="modal-dialog"] .modal-dialog-close {
1038
1039
  position: absolute;
@@ -1624,6 +1625,9 @@ select {
1624
1625
  --tw-text-opacity: 1;
1625
1626
  color: rgb(20 184 166 / var(--tw-text-opacity));
1626
1627
  }
1628
+ .underline {
1629
+ text-decoration-line: underline;
1630
+ }
1627
1631
  .filter {
1628
1632
  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
1629
1633
  }
@@ -1,5 +1,5 @@
1
1
  @layer components {
2
- [data-coco][data-component="app-form-button"] {
2
+ [data-coco][data-component="app-button-to"] {
3
3
  @apply inline-flex;
4
4
  width: max-content;
5
5
 
@@ -1,7 +1,7 @@
1
1
  module Coco
2
2
  module App
3
3
  module Elements
4
- class FormButton < Coco::Component
4
+ class ButtonTo < Coco::Component
5
5
  include Concerns::WrapsComponent
6
6
 
7
7
  wraps_component :button do |args|
@@ -1,6 +1,16 @@
1
1
  @layer components {
2
2
  [data-coco][data-component="app-link"] {
3
- @apply no-underline hover:underline;
3
+ &[data-theme] {
4
+ @apply no-underline hover:underline;
5
+ }
6
+
7
+ &[data-underline="true"] {
8
+ @apply underline;
9
+ }
10
+
11
+ &[data-underline="false"] {
12
+ @apply no-underline;
13
+ }
4
14
 
5
15
  &[data-theme="primary"] {
6
16
  @apply app-link-primary;
@@ -8,6 +8,7 @@ module Coco
8
8
  THEMES = %W[positive primary warning negative info neutral-dark neutral-light] << nil
9
9
 
10
10
  accepts_option :theme, from: THEMES
11
+ accepts_option :underline, from: [true, false]
11
12
  end
12
13
  end
13
14
  end
@@ -8,7 +8,7 @@
8
8
  }
9
9
 
10
10
  > [data-component="app-button"],
11
- > [data-component="app-form-button"],
11
+ > [data-component="app-button-to"],
12
12
  > [data-component="app-menu-button"] {
13
13
  @apply hover:bg-gray-blend-50 active:bg-gray-blend-100;
14
14
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  &[data-position="fixed"] {
13
13
  @apply fixed top-8 right-8;
14
- z-index: 1000;
14
+ z-index: 10001;
15
15
  }
16
16
 
17
17
  /* Transitions */
@@ -74,11 +74,10 @@ module Coco
74
74
  end
75
75
  end
76
76
 
77
- attr_reader :on_click, :resize, :props, :button_attrs
77
+ attr_reader :on_click, :resize, :button_attrs
78
78
 
79
- def initialize(click: nil, resize: nil, props: nil, states: nil, loading: false, active: false, button_element: {}, **kwargs)
79
+ def initialize(click: nil, resize: nil, states: nil, loading: false, active: false, button_element: {}, **kwargs)
80
80
  @on_click = click
81
- @props = props.to_h
82
81
  @resize = resize.to_h
83
82
  @states = states.to_h
84
83
  @loading = loading
@@ -183,12 +182,7 @@ module Coco
183
182
  end
184
183
 
185
184
  def alpine_data
186
- if props.present? || state_tooltips.present?
187
- {
188
- tooltips: (state_tooltips if state_tooltips.present?),
189
- props: (props if props.present?)
190
- }.compact
191
- end
185
+ {tooltips: state_tooltips} if state_tooltips.present?
192
186
  end
193
187
 
194
188
  private
@@ -2,23 +2,23 @@
2
2
  [data-coco].coco-link {
3
3
  @apply inline-flex items-center;
4
4
 
5
- &[data-icon-position="start"] {
6
- .link-text {
7
- @apply order-2;
8
- }
9
-
10
- [data-component="icon"] {
5
+ &.with-icon {
6
+ > [data-component="icon"] {
11
7
  @apply order-1 mr-[0.4em];
12
8
  }
13
- }
14
9
 
15
- &[data-icon-position="end"] {
16
10
  .link-text {
17
- @apply order-1 mr-[0.4em];
11
+ @apply order-2;
18
12
  }
19
13
 
20
- [data-component="icon"] {
21
- @apply order-2;
14
+ &[data-icon-position="end"] {
15
+ .link-text {
16
+ @apply order-1 mr-[0.4em];
17
+ }
18
+
19
+ [data-component="icon"] {
20
+ @apply order-2 mr-0;
21
+ }
22
22
  }
23
23
  }
24
24
  }
@@ -4,12 +4,8 @@ module Coco
4
4
  include Concerns::ActsAsLink
5
5
  include Concerns::WithIcon
6
6
 
7
- after_initialize do
8
- get_option(:icon, :position).default = "start"
9
- end
10
-
11
7
  def call
12
- render component_tag(class: "coco-link") do
8
+ render component_tag(class: ["coco-link", ("with-icon" if icon?)]) do
13
9
  safe_join([
14
10
  icon,
15
11
  icon? ? tag.span(link_text, class: "link-text") : link_text
@@ -9,7 +9,7 @@
9
9
  }
10
10
 
11
11
  .modal-dialog-title {
12
- @apply text-lg pr-6 w-full font-semibold truncate;
12
+ @apply text-lg pr-6 w-full font-bold truncate;
13
13
  }
14
14
 
15
15
  .modal-dialog-close {
@@ -9,7 +9,7 @@ module Coco
9
9
  divider: ->(**kwargs) { tag.div(class: "divider") },
10
10
  button: ->(**kwargs) {
11
11
  if kwargs.key?(:action) || kwargs.key?(:method) || kwargs.key?(:params)
12
- App::Elements::FormButton.new(**button_kwargs(kwargs, :form_button))
12
+ App::Elements::ButtonTo.new(**button_kwargs(kwargs, :button_to))
13
13
  else
14
14
  App::Elements::Button.new(**button_kwargs(kwargs, :button))
15
15
  end
@@ -2,6 +2,19 @@ module Coco
2
2
  module AppHelper
3
3
  def coco_link(*args, **kwargs, &block)
4
4
  href, content = args[0..2].reverse!
5
+
6
+ if kwargs.key?(:modal)
7
+ modal_name = (kwargs[:modal] == true) ? "default" : kwargs[:modal]
8
+ kwargs[:data] = kwargs.fetch(:data, {}).merge(coco_modal_data_attributes(modal_name))
9
+ kwargs.delete(:modal)
10
+ end
11
+
12
+ if kwargs.key?(:frame)
13
+ turbo_data = {turbo: true, turbo_frame: kwargs[:frame]}
14
+ kwargs[:data] = kwargs.fetch(:data, {}).merge(turbo_data)
15
+ kwargs.delete(:frame)
16
+ end
17
+
5
18
  link = Coco::App::Elements::Link.new(href: href, **kwargs)
6
19
  link = link.with_content(content) unless block
7
20
 
@@ -10,81 +23,91 @@ module Coco
10
23
 
11
24
  def coco_button(href = nil, **kwargs, &block)
12
25
  button = if kwargs.key?(:action) || kwargs.key?(:method) || kwargs.key?(:params)
13
- "FormButton"
26
+ "ButtonTo"
14
27
  else
15
28
  "Button"
16
29
  end
17
30
 
31
+ kwargs[:button_element] ||= {}
32
+
33
+ if kwargs.key?(:modal)
34
+ modal_name = (kwargs[:modal] == true) ? "default" : kwargs[:modal]
35
+ kwargs[:button_element][:data] = kwargs[:button_element].fetch(:data, {}).merge(coco_modal_data_attributes(modal_name))
36
+ kwargs.delete(:modal)
37
+ end
38
+
39
+ if kwargs.key?(:frame)
40
+ turbo_data = {turbo: true, turbo_frame: kwargs[:frame]}
41
+ kwargs[:button_element][:data] = kwargs[:button_element].fetch(:data, {}).merge(turbo_data)
42
+ kwargs.delete(:frame)
43
+ end
44
+
18
45
  component = "Coco::App::Elements::#{button}".constantize.new(href: href, **kwargs)
19
46
  render component, &block
20
47
  end
21
48
 
22
- def coco_form_button(**kwargs, &block)
23
- render Coco::App::Elements::FormButton.new(**kwargs), &block
24
- end
25
-
26
- def coco_menu_button(**kwargs, &block)
27
- render Coco::App::Elements::MenuButton.new(**kwargs), &block
49
+ def coco_menu_button(**, &block)
50
+ render Coco::App::Elements::MenuButton.new(**), &block
28
51
  end
29
52
 
30
- def coco_confirm_button(href = nil, **kwargs, &block)
31
- render Coco::App::Elements::ConfirmButton.new(href: href, **kwargs), &block
53
+ def coco_confirm_button(href = nil, **, &block)
54
+ render Coco::App::Elements::ConfirmButton.new(href: href, **), &block
32
55
  end
33
56
 
34
- def coco_color_picker_button(**kwargs, &block)
35
- render Coco::App::Elements::ColorPickerButton.new(**kwargs), &block
57
+ def coco_color_picker_button(**, &block)
58
+ render Coco::App::Elements::ColorPickerButton.new(**), &block
36
59
  end
37
60
 
38
- def coco_image_picker_button(**kwargs, &block)
39
- render Coco::App::Elements::ImagePickerButton.new(**kwargs), &block
61
+ def coco_image_picker_button(**, &block)
62
+ render Coco::App::Elements::ImagePickerButton.new(**), &block
40
63
  end
41
64
 
42
- def coco_layout_picker_button(**kwargs, &block)
43
- render Coco::App::Elements::LayoutPickerButton.new(**kwargs), &block
65
+ def coco_layout_picker_button(**, &block)
66
+ render Coco::App::Elements::LayoutPickerButton.new(**), &block
44
67
  end
45
68
 
46
- def coco_dropdown_button(**kwargs, &block)
47
- render Coco::App::Elements::DropdownButton.new(**kwargs), &block
69
+ def coco_dropdown_button(**, &block)
70
+ render Coco::App::Elements::DropdownButton.new(**), &block
48
71
  end
49
72
 
50
- def coco_button_group(**kwargs, &block)
51
- render Coco::App::Elements::ButtonGroup.new(**kwargs), &block
73
+ def coco_button_group(**, &block)
74
+ render Coco::App::Elements::ButtonGroup.new(**), &block
52
75
  end
53
76
 
54
- def coco_toolbar(**kwargs, &block)
55
- render Coco::App::Elements::Toolbar.new(**kwargs), &block
77
+ def coco_toolbar(**, &block)
78
+ render Coco::App::Elements::Toolbar.new(**), &block
56
79
  end
57
80
 
58
- def coco_seamless_textarea(**kwargs, &block)
59
- render Coco::App::Elements::SeamlessTextarea.new(**kwargs), &block
81
+ def coco_seamless_textarea(**, &block)
82
+ render Coco::App::Elements::SeamlessTextarea.new(**), &block
60
83
  end
61
84
 
62
- def coco_snackbar(**kwargs, &block)
63
- render Coco::App::Elements::Snackbar.new(**kwargs), &block
85
+ def coco_snackbar(**, &block)
86
+ render Coco::App::Elements::Snackbar.new(**), &block
64
87
  end
65
88
 
66
- def coco_notice(**kwargs, &block)
67
- render Coco::App::Elements::Notice.new(**kwargs), &block
89
+ def coco_notice(**, &block)
90
+ render Coco::App::Elements::Notice.new(**), &block
68
91
  end
69
92
 
70
- def coco_toast(**kwargs, &block)
71
- render Coco::App::Elements::Toast.new(**kwargs), &block
93
+ def coco_toast(**, &block)
94
+ render Coco::App::Elements::Toast.new(**), &block
72
95
  end
73
96
 
74
- def coco_system_banner(**kwargs, &block)
75
- render Coco::App::Elements::SystemBanner.new(**kwargs), &block
97
+ def coco_system_banner(**, &block)
98
+ render Coco::App::Elements::SystemBanner.new(**), &block
76
99
  end
77
100
 
78
- def coco_form_with(**kwargs, &block)
79
- form_with(**kwargs, builder: Coco::AppFormBuilder, &block)
101
+ def coco_form_with(**, &block)
102
+ form_with(**, builder: Coco::AppFormBuilder, &block)
80
103
  end
81
104
 
82
- def coco_form_for(*args, **kwargs, &block)
83
- form_for(*args, **kwargs, builder: Coco::AppFormBuilder, &block)
105
+ def coco_form_for(*, **, &block)
106
+ form_for(*, **, builder: Coco::AppFormBuilder, &block)
84
107
  end
85
108
 
86
- def coco_fields(**kwargs, &block)
87
- fields(**kwargs, builder: Coco::AppFormBuilder, &block)
109
+ def coco_fields(**, &block)
110
+ fields(**, builder: Coco::AppFormBuilder, &block)
88
111
  end
89
112
  end
90
113
  end
@@ -5,27 +5,21 @@ module Coco
5
5
  def coco_link_to(name = nil, options = nil, html_options = nil, &block)
6
6
  html_options, options, name = options, name, block if block
7
7
  options ||= {}
8
-
9
8
  html_options = Coco::ActionViewHelper.convert_options_to_data_attributes(options, html_options)
10
- html_options[:classes] = html_options[:class]
11
- html_options.delete(:class)
12
9
 
13
10
  href = Coco::ActionViewHelper.url_target(name, options)
14
11
 
15
- link = Coco::App::Elements::Link.new(href: href, **html_options.symbolize_keys!)
16
- link = link.with_content(name) unless block
17
-
18
- render(link, &block)
12
+ coco_link(name, href, **html_options.symbolize_keys!, &block)
19
13
  end
20
14
 
21
- def coco_button_to(content = nil, options = nil, html_options = nil, &block)
22
- html_options, options = options, content if block
15
+ def coco_button_to(name = nil, options = nil, html_options = nil, &block)
16
+ html_options, options = options, name if block
23
17
  options ||= {}
24
18
  html_options ||= {}
19
+ html_options.symbolize_keys!
25
20
 
26
- button = Coco::App::Elements::FormButton.new(action: options, **html_options.symbolize_keys!)
27
- button = button.with_content(content) unless block
28
-
21
+ button = Coco::App::Elements::ButtonTo.new(action: options, type: :submit, **html_options)
22
+ button = button.with_content(name) unless block
29
23
  render(button, &block)
30
24
  end
31
25
  end
data/lib/coco.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Coco
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
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.7.2
4
+ version: 0.7.3
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-09-29 00:00:00.000000000 Z
11
+ date: 2023-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -1372,6 +1372,9 @@ files:
1372
1372
  - app/components/coco/app/elements/button_group/button_group.html.erb
1373
1373
  - app/components/coco/app/elements/button_group/button_group.js
1374
1374
  - app/components/coco/app/elements/button_group/button_group.rb
1375
+ - app/components/coco/app/elements/button_to/button_to.css
1376
+ - app/components/coco/app/elements/button_to/button_to.html.erb
1377
+ - app/components/coco/app/elements/button_to/button_to.rb
1375
1378
  - app/components/coco/app/elements/color_picker/color_picker.css
1376
1379
  - app/components/coco/app/elements/color_picker/color_picker.html.erb
1377
1380
  - app/components/coco/app/elements/color_picker/color_picker.js
@@ -1384,9 +1387,6 @@ files:
1384
1387
  - app/components/coco/app/elements/confirm_panel/confirm_panel.html.erb
1385
1388
  - app/components/coco/app/elements/confirm_panel/confirm_panel.js
1386
1389
  - app/components/coco/app/elements/confirm_panel/confirm_panel.rb
1387
- - app/components/coco/app/elements/form_button/form_button.css
1388
- - app/components/coco/app/elements/form_button/form_button.html.erb
1389
- - app/components/coco/app/elements/form_button/form_button.rb
1390
1390
  - app/components/coco/app/elements/image_picker/image_picker.css
1391
1391
  - app/components/coco/app/elements/image_picker/image_picker.html.erb
1392
1392
  - app/components/coco/app/elements/image_picker/image_picker.js