noph-ui 0.8.7 → 0.8.9

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.
@@ -66,6 +66,7 @@
66
66
  padding: 1.5rem;
67
67
  border-radius: var(--np-shape-corner-extra-large);
68
68
  box-shadow: var(--np-elevation-3);
69
+ max-height: 100dvh;
69
70
  transition:
70
71
  display 0.2s allow-discrete,
71
72
  overlay 0.2s allow-discrete,
@@ -86,6 +86,20 @@
86
86
  popover="auto"
87
87
  class={[position, 'np-menu', attributes.class]}
88
88
  role="menu"
89
+ ontoggle={(event) => {
90
+ if (event.newState === 'open') {
91
+ const rect = event.currentTarget.getBoundingClientRect()
92
+ const viewportHeight = window.innerHeight
93
+
94
+ if (rect.bottom > viewportHeight) {
95
+ const maxHeight = viewportHeight - rect.top - 18
96
+ event.currentTarget.style.maxHeight = `${maxHeight}px`
97
+ }
98
+ }
99
+ if (event.newState === 'closed') {
100
+ event.currentTarget.style.maxHeight = '80dvh'
101
+ }
102
+ }}
89
103
  >
90
104
  {@render children()}
91
105
  </div>
@@ -94,7 +108,7 @@
94
108
  .np-menu[popover] {
95
109
  color: var(--np-menu-text-color, var(--np-color-on-surface));
96
110
  background-color: var(--np-menu-container-color, var(--np-color-surface-container));
97
- overflow: auto;
111
+ overflow-y: auto;
98
112
  border: none;
99
113
  border-radius: var(--np-menu-container-shape, var(--np-shape-corner-extra-small));
100
114
  padding: 0.5rem 0;
@@ -102,6 +116,9 @@
102
116
  margin: 0;
103
117
  margin-bottom: 2px;
104
118
  margin-top: 2px;
119
+ max-height: 80dvh;
120
+ scrollbar-color: var(--np-color-on-surface-variant) transparent;
121
+ scrollbar-width: thin;
105
122
  transition:
106
123
  display 0.2s allow-discrete,
107
124
  opacity 0.2s linear;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "noph-ui",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "license": "MIT",
5
5
  "homepage": "https://noph.dev",
6
6
  "repository": {