coveragebook_components 0.18.0 → 0.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/build/coco/coco.css +0 -4
- data/app/assets/build/coco/coco.js +10 -3
- data/app/assets/js/base/alpine/directives/dropdown.js +4 -1
- data/app/components/coco/buttons/button/button.js +5 -1
- data/app/components/coco/buttons/button/button.rb +2 -1
- data/app/components/coco/concerns/acts_as_button_group.rb +7 -11
- data/app/helpers/coco/components_helper.rb +2 -2
- data/lib/coco.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d1e2c38d35907997a458be41c8d3c58aa1e2bd59a574d859ae79a4249baac99
|
4
|
+
data.tar.gz: 61be0de9cfc48cfa7f1bacd3634f5684515e2f212475690704102ce63ea6ef93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1272f8a3e79da8c29eaad226d0e824782b04b787d126980fb232a208d107be678fa2865b1e2bbfafa4b24dd9babcff78eda1e85622ec3feba3ba7e098b34cd03
|
7
|
+
data.tar.gz: 4413438ae4e3e67299bcd80097b9dd80269bd17c21eea80fc5e755d81321c9873584666c6ee4dd2d1eb474cf41a793c466faf0c98ebf8d63c3dcde15c063d15d
|
@@ -15260,7 +15260,7 @@ function dropdown_default(Alpine3) {
|
|
15260
15260
|
const settings = tippyModifiers(modifiers);
|
15261
15261
|
const result = expression ? evaluate(expression) : {};
|
15262
15262
|
const directiveConfig = isObject(result) ? result : {};
|
15263
|
-
let { triggerTarget, contentTarget, anchorTarget, ...config } = directiveConfig;
|
15263
|
+
let { triggerTarget, contentTarget, anchorTarget, flip, ...config } = directiveConfig;
|
15264
15264
|
contentTarget = contentTarget || el.querySelector("[x-dropdown\\:content]");
|
15265
15265
|
const content = isNode(contentTarget) ? contentTarget.firstElementChild : contentTarget;
|
15266
15266
|
triggerTarget = triggerTarget || el.querySelector("[x-dropdown\\:trigger]") || el;
|
@@ -15288,6 +15288,9 @@ function dropdown_default(Alpine3) {
|
|
15288
15288
|
interactive: true,
|
15289
15289
|
animation: false,
|
15290
15290
|
maxWidth: 380,
|
15291
|
+
popperOptions: {
|
15292
|
+
modifiers: [{ name: "flip", enabled: flip !== false }]
|
15293
|
+
},
|
15291
15294
|
triggerTarget,
|
15292
15295
|
content,
|
15293
15296
|
onShow: (...args) => {
|
@@ -15441,7 +15444,7 @@ var alpine_default = import_alpinejs.default;
|
|
15441
15444
|
// ../../../package.json
|
15442
15445
|
var package_default = {
|
15443
15446
|
name: "coveragebook-components",
|
15444
|
-
version: "0.18.
|
15447
|
+
version: "0.18.2",
|
15445
15448
|
repository: "git@github.com:coveragebook/coco.git",
|
15446
15449
|
license: "NO LICENSE",
|
15447
15450
|
author: "Mark Perkins <mark@coveragebook.com>",
|
@@ -15650,7 +15653,11 @@ var button_default = CocoComponent("button", (data = {}) => {
|
|
15650
15653
|
if (this.approving) {
|
15651
15654
|
event.stopPropagation();
|
15652
15655
|
this.confirmed = true;
|
15653
|
-
this.dropdown.trigger.
|
15656
|
+
if (this.dropdown.trigger.getAttribute("type") === "submit") {
|
15657
|
+
this.$root.closest("form").requestSubmit();
|
15658
|
+
} else {
|
15659
|
+
this.dropdown.trigger.click();
|
15660
|
+
}
|
15654
15661
|
this.dropdown.hide();
|
15655
15662
|
this.confirmed = false;
|
15656
15663
|
this.approving = false;
|
@@ -16,7 +16,7 @@ export default function (Alpine) {
|
|
16
16
|
const settings = buildConfig(modifiers);
|
17
17
|
const result = expression ? evaluate(expression) : {};
|
18
18
|
const directiveConfig = isObject(result) ? result : {};
|
19
|
-
let { triggerTarget, contentTarget, anchorTarget, ...config } =
|
19
|
+
let { triggerTarget, contentTarget, anchorTarget, flip, ...config } =
|
20
20
|
directiveConfig;
|
21
21
|
|
22
22
|
contentTarget =
|
@@ -61,6 +61,9 @@ export default function (Alpine) {
|
|
61
61
|
interactive: true,
|
62
62
|
animation: false,
|
63
63
|
maxWidth: 380,
|
64
|
+
popperOptions: {
|
65
|
+
modifiers: [{ name: "flip", enabled: flip !== false }],
|
66
|
+
},
|
64
67
|
|
65
68
|
triggerTarget,
|
66
69
|
content,
|
@@ -84,7 +84,11 @@ export default CocoComponent("button", (data = {}) => {
|
|
84
84
|
if (this.approving) {
|
85
85
|
event.stopPropagation();
|
86
86
|
this.confirmed = true;
|
87
|
-
this.dropdown.trigger.
|
87
|
+
if (this.dropdown.trigger.getAttribute("type") === "submit") {
|
88
|
+
this.$root.closest("form").requestSubmit();
|
89
|
+
} else {
|
90
|
+
this.dropdown.trigger.click();
|
91
|
+
}
|
88
92
|
this.dropdown.hide();
|
89
93
|
this.confirmed = false;
|
90
94
|
this.approving = false;
|
@@ -55,6 +55,7 @@ module Coco
|
|
55
55
|
dd.accepts_option :placement,
|
56
56
|
from: %w[top top-start top-end right right-start right-end bottom bottom-start bottom-end left left-start left-end auto auto-start auto-end],
|
57
57
|
private: true
|
58
|
+
dd.accepts_option :flip, from: [true, false], default: true, private: true
|
58
59
|
end
|
59
60
|
|
60
61
|
renders_one :text, Coco::Content
|
@@ -154,7 +155,7 @@ module Coco
|
|
154
155
|
if dropdown? || confirm?
|
155
156
|
{
|
156
157
|
data: x_data("buttonDropdown"),
|
157
|
-
dropdown: jsify_data({placement: get_option_value(:dropdown, :placement)}.compact),
|
158
|
+
dropdown: jsify_data({placement: get_option_value(:dropdown, :placement), flip: get_option_value(:dropdown, :flip)}.compact),
|
158
159
|
bind: "root"
|
159
160
|
}
|
160
161
|
end
|
@@ -16,21 +16,17 @@ module Coco
|
|
16
16
|
divider: ->(**kwargs) { tag.div(class: "divider") },
|
17
17
|
html: ->(&block) { block.call },
|
18
18
|
button: ->(*args, **kwargs, &block) { coco_button(*args, **button_kwargs(kwargs, :button), &block) },
|
19
|
-
menu_button: ->(*args, **kwargs, &block) { instantiate_button(:menu,
|
20
|
-
color_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:color_picker,
|
21
|
-
image_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:image_picker,
|
22
|
-
layout_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:layout_picker,
|
19
|
+
menu_button: ->(*args, **kwargs, &block) { instantiate_button(:menu, args.first, nil, **kwargs, &block) },
|
20
|
+
color_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:color_picker, args.first, nil, **kwargs, &block) },
|
21
|
+
image_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:image_picker, args.first, nil, **kwargs, &block) },
|
22
|
+
layout_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:layout_picker, args.first, nil, **kwargs, &block) }
|
23
23
|
}
|
24
24
|
end
|
25
25
|
|
26
26
|
def instantiate_button(type, *args, **kwargs, &block)
|
27
|
-
href, content =
|
28
|
-
|
29
|
-
|
30
|
-
(args.size == 1) ? [nil, args.first] : args[0..2].reverse!
|
31
|
-
end
|
32
|
-
component = BUTTON_TYPES[type].constantize.new(href: href, **button_kwargs(kwargs, type))
|
33
|
-
component.with_content(content) if !block && content.present?
|
27
|
+
href, content = (args.size == 1) ? [nil, args.first] : args[0..2].reverse!
|
28
|
+
component = BUTTON_TYPES[type].constantize.new(text: content, href: href, **button_kwargs(kwargs, type))
|
29
|
+
component.with_text(content) if content.present?
|
34
30
|
component
|
35
31
|
end
|
36
32
|
|
@@ -27,8 +27,8 @@ module Coco
|
|
27
27
|
render(Coco::ButtonGroup.new(**), &)
|
28
28
|
end
|
29
29
|
|
30
|
-
def coco_menu_button(**, &)
|
31
|
-
render(Coco::MenuButton.new(**), &)
|
30
|
+
def coco_menu_button(text = nil, **, &)
|
31
|
+
render(Coco::MenuButton.new(text: text, **), &)
|
32
32
|
end
|
33
33
|
|
34
34
|
def coco_menu_item(type, **, &)
|
data/lib/coco.rb
CHANGED
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.18.
|
4
|
+
version: 0.18.2
|
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-
|
11
|
+
date: 2024-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|