stimulus-overlay-helpers 3.0.0 → 3.1.0

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: a2215812e0ecb9c0bd1f4b7efc9400166bda8e93de7c0081e74a2df208ad14c5
4
- data.tar.gz: 71aa2665940125d96e6d805dec6e5ee0f1ff67bee21f2f2de7e234189ae4f428
3
+ metadata.gz: 39101cef1d9fef4cba42c3dc3e19766b1936cadb91c04b8120cb40d436959764
4
+ data.tar.gz: 583c4630ee41e316dab54038034d849b0dd858132fb08804b802ab56a39d29da
5
5
  SHA512:
6
- metadata.gz: 603f3d036f358c53d05afe2c2e0e0b0526b03f895ae9bf37b18458ba067ab42ace156f5b72b11cd81c1dccc5b011c958ca427cc64b28cb761c55f61c425793ed
7
- data.tar.gz: 21693b5bdd51a47011afde4ec0842ba149cd67a6e77648982785ae033980eeba41d20ef17fb412ee828336ef71806182eee3646597506434a7c52dde63f6c5f4
6
+ metadata.gz: 756f24cf638fcde7836f0ca95419c526b26c646d2d6cf92ebe3796a8ddabd0ab097b3bee8969b3bcabf714a260a13f20804f9154e672c87087a31cb577c47561
7
+ data.tar.gz: da5451bfbb0c43d1cb1fa35cd92cb7e02cb9b0a0af5575ce29d5300c5676c4339d1e59f1aebba97519bdf3a65b9c32d606a9e02501340cf79ebcf834c4c567ef
@@ -4,7 +4,7 @@ require 'stimulus_overlay_helpers/view_helpers'
4
4
  # Provides helpers and configuration for Stimulus overlay behavior.
5
5
  module StimulusOverlayHelpers
6
6
  class << self
7
- attr_accessor :close_button_proc
7
+ attr_accessor :close_button_proc, :dropdown_arrow
8
8
 
9
9
  def configure
10
10
  yield self
@@ -12,9 +12,11 @@ module StimulusOverlayHelpers
12
12
 
13
13
  def reset_config!
14
14
  self.close_button_proc = nil
15
+ self.dropdown_arrow = true
15
16
  end
16
17
  end
17
18
 
18
19
  # Default fallback if no config is set
19
20
  self.close_button_proc = nil
21
+ self.dropdown_arrow = false
20
22
  end
@@ -10,6 +10,10 @@ module StimulusOverlayHelpers
10
10
  # * a) wraps the button_content in element like: %button{ data: { controller: 'dropdown', ... } } and renders it at place
11
11
  # * b) wraps the panel_content in a corresponding element and renders it to the overlays_box (because of z-index-hierarchy)
12
12
  # * c) the stimulus controller always adds the class .dropdown-panel to the panel
13
+ # * options:
14
+ # ** class: custom class for the dropdown-button
15
+ # ** panel_class: custom class for the dropdown-panel
16
+ # ** src: custom src for the dropdown-panel, triggers a GET xhr request that fills up the panel
13
17
  def dropdown(button_content, title = nil, options = {}, &panel_content)
14
18
  if title.is_a?(Hash)
15
19
  options = title.dup
@@ -18,7 +22,7 @@ module StimulusOverlayHelpers
18
22
 
19
23
  panel_at_place = options.delete(:panel_at_place)
20
24
  src = options.delete(:src)
21
- button_class = [options.delete(:button_class) || 'dropdown-button', options[:class]].compact.join(' ')
25
+ button_class = [options.delete(:button_class), 'dropdown-button', options[:class]].compact.join(' ')
22
26
  panel_class = [options.delete(:class), 'dropdown-panel'].compact.join(' ')
23
27
  close_btn_proc = StimulusOverlayHelpers.close_button_proc
24
28
 
@@ -47,7 +51,8 @@ module StimulusOverlayHelpers
47
51
  end,
48
52
  content_tag(:div, class: 'content') do
49
53
  capture(&panel_content) if block_given?
50
- end
54
+ end,
55
+ (content_tag(:div, nil, id: 'arrow') if StimulusOverlayHelpers.dropdown_arrow),
51
56
  ])
52
57
  end
53
58
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stimulus-overlay-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Sedlmair