stimulus-overlay-helpers 0.0.3 → 1.0.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 +4 -4
- data/README.md +13 -0
- data/lib/stimulus_overlay_helpers/view_helpers.rb +4 -4
- 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: deccbe57dab0e4e45e99893419fdb6495f518565b134c5ec30e1869e9cbb8ac1
|
|
4
|
+
data.tar.gz: c68a39bce68d49f5c9079c08b87bf989a8fae3763b16e0e599192fad442c9100
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f23720354622b3233d1616d2fbcd67c6d3c57c32a23d800689b7d793dae6b75d25b7a86d45f64bc04e61dc976be649600e4a087617f996423aa9d419d9ec357
|
|
7
|
+
data.tar.gz: 86168a819f03aeee4aeec4e7383fc86ee02230d83838da86e325a96e5dd5f0257da2be9e6a5e400d2b3b376475313c480477b99bbc78451f88d98b0760d9620f
|
data/README.md
CHANGED
|
@@ -32,6 +32,19 @@ StimulusDropdown.configure do |config|
|
|
|
32
32
|
end
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
+
**Z-index issues / `panel_at_place` option**
|
|
36
|
+
|
|
37
|
+
If the overlay should appear above all other elements, it should be rendered closer to the root level, because `z-index` is always relative to sibling elements.
|
|
38
|
+
|
|
39
|
+
By default, when the `panel_at_place` argument is not passed to the helper, the overlay is rendered into the `:overlays_box` content block. Therefore, this block must be yielded in the layout:
|
|
40
|
+
|
|
41
|
+
```haml
|
|
42
|
+
#overlays-box
|
|
43
|
+
= yield :overlays_box
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This aligns to the behaviour of the [svelte overlays from @csedl/hotwire-svelte-helpers](https://www.npmjs.com/package/@csedl/hotwire-svelte-helpers)
|
|
47
|
+
|
|
35
48
|
## Usage Examples
|
|
36
49
|
|
|
37
50
|
```haml
|
|
@@ -2,11 +2,11 @@ module StimulusOverlayHelpers
|
|
|
2
2
|
module ViewHelpers
|
|
3
3
|
#== dropdown helper
|
|
4
4
|
# @param [button_content] Proc or String for content of the button element
|
|
5
|
-
# @param [panel_at_place] true (default: false) => it would render the panel into content_for(:
|
|
5
|
+
# @param [panel_at_place] true (default: false) => it would render the panel into content_for(:overlays_box) on sticky parts (left-menu / top-bar) panels should be at place for avoiding that the panel would scroll with the content
|
|
6
6
|
# @block [panel_content] Panel Content as block
|
|
7
7
|
# what it does:
|
|
8
8
|
# * a) wraps the button_content in element like: %button{ data: { controller: 'dropdown', ... } } and renders it at place
|
|
9
|
-
# * b) wraps the panel_content in a corresponding element and renders it to the
|
|
9
|
+
# * b) wraps the panel_content in a corresponding element and renders it to the overlays_box (because of z-index-hierarchy)
|
|
10
10
|
# * c) the stimulus controller always adds the class .dropdown-panel to the panel
|
|
11
11
|
def dropdown(button_content, title = nil, options = {}, &panel_content)
|
|
12
12
|
if title.is_a?(Hash)
|
|
@@ -57,7 +57,7 @@ module StimulusOverlayHelpers
|
|
|
57
57
|
if panel_at_place
|
|
58
58
|
btn + panel
|
|
59
59
|
else
|
|
60
|
-
content_for(:
|
|
60
|
+
content_for(:overlays_box, panel)
|
|
61
61
|
btn
|
|
62
62
|
end
|
|
63
63
|
end
|
|
@@ -125,7 +125,7 @@ module StimulusOverlayHelpers
|
|
|
125
125
|
r = label_element
|
|
126
126
|
r << panel_element
|
|
127
127
|
else
|
|
128
|
-
content_for(:
|
|
128
|
+
content_for(:overlays_box) do
|
|
129
129
|
panel_element
|
|
130
130
|
end
|
|
131
131
|
label_element
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stimulus-overlay-helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Christian Sedlmair
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-04-
|
|
11
|
+
date: 2026-04-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: christian@sedlmair.ch
|