@greendrake/ui 0.4.0 → 0.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greendrake/ui",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Vue 3 component library: form controls, modals, search, tabs, toasts, layout",
5
5
  "license": "MIT",
6
6
  "author": "Eugene Greendrake <eugene@greendrake.nz>",
@@ -33,9 +33,9 @@
33
33
  },
34
34
  "prettier": "@greendrake/dev-config/prettier",
35
35
  "dependencies": {
36
- "@greendrake/domains": "0.4.0",
37
- "@greendrake/scss-kit": "0.4.0",
38
- "@greendrake/util": "0.4.0",
36
+ "@greendrake/domains": "0.6.0",
37
+ "@greendrake/scss-kit": "0.6.0",
38
+ "@greendrake/util": "0.6.0",
39
39
  "vue-tippy": "^6.7.1"
40
40
  },
41
41
  "peerDependencies": {
@@ -43,7 +43,7 @@
43
43
  "vue-router": "^4.6.4"
44
44
  },
45
45
  "devDependencies": {
46
- "@greendrake/dev-config": "0.4.0",
46
+ "@greendrake/dev-config": "0.6.0",
47
47
  "typescript": "6.0.3",
48
48
  "vue": "^3.5.34",
49
49
  "vue-router": "^4.6.4",
package/src/SelectBox.vue CHANGED
@@ -119,6 +119,12 @@ const placeMenu = async (): Promise<void> => {
119
119
  // the visual viewport to hold a focused field clear of the keyboard.
120
120
  const vv = window.visualViewport
121
121
  const viewportBottom = vv ? vv.offsetTop + vv.height : window.innerHeight
122
+ // The ceiling is the top of what is on screen for the same reason, and lower
123
+ // still by the top safe-area inset: in a native shell the status bar
124
+ // overlays that strip and the page's content stops short of it. The token is
125
+ // optional, as everywhere it is read — undeclared, there is no inset.
126
+ const insetTop = getComputedStyle(m).getPropertyValue('--safe-area-inset-top')
127
+ const viewportTop = (vv ? vv.offsetTop : 0) + (insetTop ? parseFloat(insetTop) : 0)
122
128
  const menuRect = m.getBoundingClientRect()
123
129
  let floor = Math.min(viewportBottom, menuRect.bottom + MARGIN)
124
130
  const probe = document.elementFromPoint(Math.round(menuRect.x + menuRect.width / 2), Math.round(Math.min(menuRect.bottom, viewportBottom) - 4))
@@ -126,7 +132,7 @@ const placeMenu = async (): Promise<void> => {
126
132
  floor = Math.min(floor, probe.getBoundingClientRect().top)
127
133
  }
128
134
  const below = floor - rootRect.bottom - MARGIN
129
- const above = rootRect.top - MARGIN
135
+ const above = rootRect.top - viewportTop - MARGIN
130
136
  if (height > below && above > below) {
131
137
  menuStyle.value = { ...anchorStyle(rootRect, true), maxHeight: `${Math.min(height, above)}px` }
132
138
  } else if (height > below) {