pgo-ui 1.0.38 → 1.0.39

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.
@@ -132,11 +132,12 @@ function ensureTooltipEl(state: TooltipState) {
132
132
  const el = document.createElement('div')
133
133
  el.className = 'vts-tooltip'
134
134
  el.setAttribute('role', 'tooltip')
135
- el.style.position = 'absolute'
135
+ el.style.position = 'fixed'
136
136
  el.style.top = '-9999px'
137
137
  el.style.left = '-9999px'
138
138
  el.style.visibility = 'hidden'
139
139
  el.style.zIndex = 'var(--vts-z-tooltip, 1000)'
140
+ el.style.maxWidth = 'calc(100vw - 16px)'
140
141
 
141
142
  const content = document.createElement('div')
142
143
  content.className = 'vts-tooltip-content'
@@ -183,8 +184,6 @@ function computePosition(activator: HTMLElement, state: TooltipState) {
183
184
  const tooltip = state.tooltipEl
184
185
  const rect = activator.getBoundingClientRect()
185
186
  const tooltipRect = tooltip.getBoundingClientRect()
186
- const scrollX = window.scrollX || window.pageXOffset
187
- const scrollY = window.scrollY || window.pageYOffset
188
187
  const placement = getNormalizedPlacement(state.options.placement || 'top')
189
188
  const offsetX = state.options.offset?.x ?? 0
190
189
  const offsetY = state.options.offset?.y ?? 0
@@ -193,25 +192,34 @@ function computePosition(activator: HTMLElement, state: TooltipState) {
193
192
  let top = 0
194
193
  let left = 0
195
194
 
195
+ // Position relative to viewport (fixed positioning)
196
196
  switch (placement) {
197
197
  case 'top':
198
- top = rect.top + scrollY - tooltipRect.height - gap - offsetY
199
- left = rect.left + scrollX + rect.width / 2 - tooltipRect.width / 2 + offsetX
198
+ top = rect.top - tooltipRect.height - gap - offsetY
199
+ left = rect.left + rect.width / 2 - tooltipRect.width / 2 + offsetX
200
200
  break
201
201
  case 'bottom':
202
- top = rect.bottom + scrollY + gap + offsetY
203
- left = rect.left + scrollX + rect.width / 2 - tooltipRect.width / 2 + offsetX
202
+ top = rect.bottom + gap + offsetY
203
+ left = rect.left + rect.width / 2 - tooltipRect.width / 2 + offsetX
204
204
  break
205
205
  case 'left':
206
- top = rect.top + scrollY + rect.height / 2 - tooltipRect.height / 2 + offsetY
207
- left = rect.left + scrollX - tooltipRect.width - gap - offsetX
206
+ top = rect.top + rect.height / 2 - tooltipRect.height / 2 + offsetY
207
+ left = rect.left - tooltipRect.width - gap - offsetX
208
208
  break
209
209
  case 'right':
210
- top = rect.top + scrollY + rect.height / 2 - tooltipRect.height / 2 + offsetY
211
- left = rect.right + scrollX + gap + offsetX
210
+ top = rect.top + rect.height / 2 - tooltipRect.height / 2 + offsetY
211
+ left = rect.right + gap + offsetX
212
212
  break
213
213
  }
214
214
 
215
+ // Clamp to viewport so the tooltip never causes scrollbars
216
+ const viewW = document.documentElement.clientWidth
217
+ const viewH = document.documentElement.clientHeight
218
+ const pad = 8
219
+
220
+ left = Math.max(pad, Math.min(left, viewW - tooltipRect.width - pad))
221
+ top = Math.max(pad, Math.min(top, viewH - tooltipRect.height - pad))
222
+
215
223
  tooltip.style.top = `${top}px`
216
224
  tooltip.style.left = `${left}px`
217
225
  tooltip.style.visibility = ''
@@ -221,35 +229,47 @@ function computePosition(activator: HTMLElement, state: TooltipState) {
221
229
  const arrow = state.arrowEl
222
230
  arrow.style.width = `${size}px`
223
231
  arrow.style.height = `${size}px`
232
+ // Arrow points at the activator center, adjusted if tooltip was clamped
233
+ const actCenterX = rect.left + rect.width / 2
234
+ const actCenterY = rect.top + rect.height / 2
235
+ const arrowMinEdge = 12
224
236
  switch (placement) {
225
- case 'top':
237
+ case 'top': {
238
+ const ax = Math.max(arrowMinEdge, Math.min(actCenterX - left, tooltipRect.width - arrowMinEdge))
226
239
  arrow.style.bottom = '-4px'
227
- arrow.style.left = '50%'
240
+ arrow.style.left = `${ax}px`
228
241
  arrow.style.top = ''
229
242
  arrow.style.right = ''
230
243
  arrow.style.transform = 'translateX(-50%) rotate(225deg)'
231
244
  break
232
- case 'bottom':
245
+ }
246
+ case 'bottom': {
247
+ const ax = Math.max(arrowMinEdge, Math.min(actCenterX - left, tooltipRect.width - arrowMinEdge))
233
248
  arrow.style.top = '-4px'
234
- arrow.style.left = '50%'
249
+ arrow.style.left = `${ax}px`
235
250
  arrow.style.bottom = ''
236
251
  arrow.style.right = ''
237
252
  arrow.style.transform = 'translateX(-50%) rotate(45deg)'
238
253
  break
239
- case 'left':
254
+ }
255
+ case 'left': {
256
+ const ay = Math.max(arrowMinEdge, Math.min(actCenterY - top, tooltipRect.height - arrowMinEdge))
240
257
  arrow.style.right = '-4px'
241
- arrow.style.top = '50%'
258
+ arrow.style.top = `${ay}px`
242
259
  arrow.style.left = ''
243
260
  arrow.style.bottom = ''
244
261
  arrow.style.transform = 'translateY(-50%) rotate(135deg)'
245
262
  break
246
- case 'right':
263
+ }
264
+ case 'right': {
265
+ const ay = Math.max(arrowMinEdge, Math.min(actCenterY - top, tooltipRect.height - arrowMinEdge))
247
266
  arrow.style.left = '-4px'
248
- arrow.style.top = '50%'
267
+ arrow.style.top = `${ay}px`
249
268
  arrow.style.right = ''
250
269
  arrow.style.bottom = ''
251
270
  arrow.style.transform = 'translateY(-50%) rotate(315deg)'
252
271
  break
272
+ }
253
273
  }
254
274
  }
255
275
  }
@@ -7,7 +7,7 @@
7
7
  :show-print="true"
8
8
  title="View Document"
9
9
  />
10
- <!-- <Button @click="handlePdfView('../../../public/Sex_offenders.pdf')">View</Button> -->
10
+ <Button @click="handlePdfView('../../../public/Sex_offenders.pdf')">View</Button>
11
11
  <!-- <Button @click="handlePdfView('../../../public/1_ref_20251120_050755.pdf')">View</Button> -->
12
12
  <template v-if="items">
13
13
  <slot name="topSlot" :items="items" />
@@ -39,7 +39,6 @@ export function createApi() {
39
39
  console.error('API Error:', error.response.data);
40
40
  if (error.response.status === 401) {
41
41
  localStorage.removeItem('token');
42
- window.location.href = '/auth/login';
43
42
  }
44
43
  } else if (error.request) {
45
44
  console.error('Network Error:', error.request);
@@ -210,13 +210,14 @@ html .dp__theme_dark {
210
210
 
211
211
  /* Global tooltip styles for v-tooltip directive */
212
212
  .vts-tooltip {
213
+ position: fixed;
213
214
  background-color: var(--vts-color-surfaceElevated);
214
215
  color: var(--vts-color-text);
215
216
  border: 1px solid var(--vts-color-border);
216
217
  border-radius: var(--vts-radius-sm);
217
218
  box-shadow: var(--vts-elevation-2, 0 4px 12px rgba(0, 0, 0, 0.12));
218
219
  padding: 6px 10px;
219
- max-width: 280px;
220
+ max-width: min(280px, calc(100vw - 16px));
220
221
  pointer-events: none; /* do not steal hover from activator */
221
222
  }
222
223
 
@@ -1,4 +0,0 @@
1
- import { _ as f } from "./index-piz7IhPQ.js";
2
- export {
3
- f as default
4
- };