keystone_ui 0.56.0 → 0.57.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: 1d60dc9eb75d07285fc1f90e102456631d1462851a5fcb2af7f2b28a3ddcc550
4
- data.tar.gz: 65b03bbda334318e51b71014cbc1d9b2fa5b10841eb5d62c9cb963da5d7532ee
3
+ metadata.gz: 2fb26a12c2b20d1b8102650320a2e5e6f2dfefaf2b304237f757338dacd2e1ae
4
+ data.tar.gz: 858ac42699c78a23a79942f18202db43f698a99a252f5d1fca6d098f2ec8d318
5
5
  SHA512:
6
- metadata.gz: 4316551b415b8ea4b392ad4929d7c6601ce7e2cc0a9284a83b060201d772f8c8257d20f819f1cc433dc3fc3b008d43fae47c28ce4c206cb026e48433cf926a36
7
- data.tar.gz: e34615f42f57d85cfcc9602624c8c3e8a4fd86e56cc4decec8835796330d27fe6994b0de3c92b18d5ad98162f6c1459761aefce6fefc71a96bb24fdeba2a1056
6
+ metadata.gz: 5033f7611a6beb90d84c9ff39cfd49abac83ca61f881dae585f1effc838e485bbfd9a3f6087c00f2e090bb5dcfeabdef8ff7ed7f6c125a6f8b3e0bb546d66d3c
7
+ data.tar.gz: 41a9d9300720e1bfab2c8b46b2ac065922d2e2331a8f17ba0d2c178e11356f2c0953fe1695408ee0c5e904bca83134873c50bff3e74f1354d509bee39896d589
@@ -19,11 +19,17 @@ export default class extends Controller {
19
19
  this.menuTarget.classList.add("hidden")
20
20
  }
21
21
 
22
+ follow() {
23
+ if (!this.menuTarget.classList.contains("hidden")) this.place()
24
+ }
25
+
22
26
  place() {
23
27
  const button = this.buttonTarget.getBoundingClientRect()
28
+ const screenHeight = this.element.ownerDocument.documentElement.clientHeight
29
+ const roomBelow = button.bottom + this.menuTarget.offsetHeight <= screenHeight
24
30
  Object.assign(this.menuTarget.style, {
25
31
  position: "fixed",
26
- top: `${button.bottom}px`,
32
+ top: `${roomBelow ? button.bottom : Math.max(0, button.top - this.menuTarget.offsetHeight)}px`,
27
33
  left: `${button.right - this.menuTarget.offsetWidth}px`,
28
34
  right: "auto"
29
35
  })
@@ -1,6 +1,6 @@
1
- <div class="<%= WRAPPER_CLASSES %>" data-controller="action-menu" data-action="scroll@window->action-menu#close resize@window->action-menu#close">
1
+ <div class="<%= WRAPPER_CLASSES %>" data-controller="action-menu" data-action="scroll@window->action-menu#follow resize@window->action-menu#close">
2
2
  <button type="button"
3
- data-action="click->action-menu#toggle click@window->action-menu#hide"
3
+ data-action="click->action-menu#toggle pointerup@window->action-menu#hide"
4
4
  data-action-menu-target="button"
5
5
  class="<%= BUTTON_CLASSES %>"
6
6
  aria-label="Actions">
@@ -1,11 +1,12 @@
1
- <div class="<%= WRAPPER_CLASSES %>" data-controller="dropdown">
1
+ <div class="<%= WRAPPER_CLASSES %>" data-controller="action-menu" data-action="scroll@window->action-menu#follow resize@window->action-menu#close">
2
2
  <button type="button"
3
- data-action="click->dropdown#toggle click@window->dropdown#hide"
3
+ data-action="click->action-menu#toggle pointerup@window->action-menu#hide"
4
+ data-action-menu-target="button"
4
5
  class="<%= BUTTON_CLASSES %>"
5
6
  aria-label="Actions">
6
7
  <%= ELLIPSIS_ICON.html_safe %>
7
8
  </button>
8
- <div data-dropdown-target="menu" class="<%= DROPDOWN_CLASSES %>">
9
+ <div data-action-menu-target="menu" class="<%= DROPDOWN_CLASSES %>">
9
10
  <%= content %>
10
11
  </div>
11
12
  </div>
@@ -14,7 +14,7 @@ module Keystone
14
14
  DROPDOWN_CLASSES = "ks-action-menu hidden absolute right-0 z-50 w-48 origin-top-right"
15
15
 
16
16
  def wrapper_data
17
- { controller: "dropdown" }
17
+ { controller: "action-menu" }
18
18
  end
19
19
  end
20
20
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.56.0"
4
+ VERSION = "0.57.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keystone_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.56.0
4
+ version: 0.57.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider