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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9024fd2b1372e1c28286a54173750921c33b6f9cee10cce9e2ca5d1fd982d9e
4
- data.tar.gz: f6e89d2b38167d6198b967af281344146e3f131964457e9c2dff2ea11f2e2737
3
+ metadata.gz: 8d1e2c38d35907997a458be41c8d3c58aa1e2bd59a574d859ae79a4249baac99
4
+ data.tar.gz: 61be0de9cfc48cfa7f1bacd3634f5684515e2f212475690704102ce63ea6ef93
5
5
  SHA512:
6
- metadata.gz: 131b0f18bf5b4462ba4be9c5cfc55f76aaceeac1b4c671f5144589aee73ae79742bbe01f9b0b8f2846fd1b89fc10b2fb07a453061d95f3a606e64ee9ff5c9546
7
- data.tar.gz: 16115cf26b19813e8e44639956d10de3ac45ec39fea45bbd008dbc53aab8a86cbb3eea1ddd5955f9d06f10d9e15af348463d7b962ef758548be873e6455cc32c
6
+ metadata.gz: 1272f8a3e79da8c29eaad226d0e824782b04b787d126980fb232a208d107be678fa2865b1e2bbfafa4b24dd9babcff78eda1e85622ec3feba3ba7e098b34cd03
7
+ data.tar.gz: 4413438ae4e3e67299bcd80097b9dd80269bd17c21eea80fc5e755d81321c9873584666c6ee4dd2d1eb474cf41a793c466faf0c98ebf8d63c3dcde15c063d15d
@@ -5784,10 +5784,6 @@ select{
5784
5784
  position: fixed
5785
5785
  }
5786
5786
 
5787
- .\!block{
5788
- display: block !important
5789
- }
5790
-
5791
5787
  .block{
5792
5788
  display: block
5793
5789
  }
@@ -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.0",
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.click();
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.click();
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, *args, **kwargs, &block) },
20
- color_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:color_picker, *args, **kwargs, &block) },
21
- image_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:image_picker, *args, **kwargs, &block) },
22
- layout_picker_button: ->(*args, **kwargs, &block) { instantiate_button(:layout_picker, *args, **kwargs, &block) }
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 = if block
28
- [args.first, nil]
29
- else
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
@@ -1,3 +1,3 @@
1
1
  module Coco
2
- VERSION = "0.18.0"
2
+ VERSION = "0.18.2"
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.18.0
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-04-24 00:00:00.000000000 Z
11
+ date: 2024-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails