@onereach/ui-components-vue2 26.11.2 → 26.11.3-beta.6036.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/dist/esm/components/index.js +1 -1
- package/dist/esm/components/or-popover-v3/index.js +89 -4
- package/dist/esm/components/or-popover-v3/utils/getFallbackPlacements.d.ts +2 -0
- package/dist/esm/components/or-popover-v3/utils/index.d.ts +2 -0
- package/dist/esm/components/or-popover-v3/utils/safeAutoUpdate.d.ts +14 -0
- package/dist/esm/index.js +1 -1
- package/package.json +5 -6
|
@@ -63,7 +63,7 @@ export { ModalSize, OrModalV3 } from './or-modal-v3/index.js';
|
|
|
63
63
|
export { NotificationVariant, OrNotificationV3, VariantToIconName } from './or-notification-v3/index.js';
|
|
64
64
|
export { OrOverlayV3 } from './or-overlay-v3/index.js';
|
|
65
65
|
export { OrPaginationV3 } from './or-pagination-v3/index.js';
|
|
66
|
-
export { OrPopoverV3, PopoverPlacement, PopoverVariant, isPrevented } from './or-popover-v3/index.js';
|
|
66
|
+
export { OrPopoverV3, PopoverPlacement, PopoverVariant, getFallbackPlacements, isCrossOriginIframe, isPrevented, safeAutoUpdate } from './or-popover-v3/index.js';
|
|
67
67
|
export { OrProgressV3, ProgressColor, ProgressType } from './or-progress-v3/index.js';
|
|
68
68
|
export { OrRadioGroupV3 } from './or-radio-group-v3/index.js';
|
|
69
69
|
export { OrRadioV3 } from './or-radio-v3/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computePosition, offset, shift, flip, hide, size
|
|
1
|
+
import { computePosition, autoUpdate, offset, shift, flip, hide, size } from '@floating-ui/dom';
|
|
2
2
|
import { t as te, a as re, G } from '../../useValidationAttributes-Da9U8-T7-fd6d5d7d.js';
|
|
3
3
|
import { onClickOutside } from '@vueuse/core';
|
|
4
4
|
import { computed, unref, ref, shallowRef, watch, getCurrentScope, onScopeDispose, shallowReadonly, defineComponent, toRefs, toRef } from 'vue-demi';
|
|
@@ -225,6 +225,61 @@ const PopoverBodyPlacements = {
|
|
|
225
225
|
'ml-0', 'mb-0']
|
|
226
226
|
};
|
|
227
227
|
|
|
228
|
+
const oppositeSide = {
|
|
229
|
+
top: 'bottom',
|
|
230
|
+
right: 'left',
|
|
231
|
+
bottom: 'top',
|
|
232
|
+
left: 'right'
|
|
233
|
+
};
|
|
234
|
+
const oppositeAlignment = {
|
|
235
|
+
start: 'end',
|
|
236
|
+
end: 'start'
|
|
237
|
+
};
|
|
238
|
+
function getSide(placement) {
|
|
239
|
+
return placement.split('-')[0];
|
|
240
|
+
}
|
|
241
|
+
function getAlignment(placement) {
|
|
242
|
+
return placement.split('-')[1];
|
|
243
|
+
}
|
|
244
|
+
function getOppositePlacement(placement) {
|
|
245
|
+
const side = getSide(placement);
|
|
246
|
+
return placement.replace(side, oppositeSide[side]);
|
|
247
|
+
}
|
|
248
|
+
function getOppositeAlignmentPlacement(placement) {
|
|
249
|
+
const alignment = getAlignment(placement);
|
|
250
|
+
return alignment ? placement.replace(alignment, oppositeAlignment[alignment]) : placement;
|
|
251
|
+
}
|
|
252
|
+
function getExpandedPlacements(placement) {
|
|
253
|
+
const oppositePlacement = getOppositePlacement(placement);
|
|
254
|
+
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
255
|
+
}
|
|
256
|
+
function getOppositeAxisSides(placement, direction) {
|
|
257
|
+
const isStart = direction === 'start';
|
|
258
|
+
switch (getSide(placement)) {
|
|
259
|
+
case 'top':
|
|
260
|
+
case 'bottom':
|
|
261
|
+
return isStart ? ['left', 'right'] : ['right', 'left'];
|
|
262
|
+
case 'left':
|
|
263
|
+
case 'right':
|
|
264
|
+
return isStart ? ['top', 'bottom'] : ['bottom', 'top'];
|
|
265
|
+
default:
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function getFallbackPlacements(placement, direction) {
|
|
270
|
+
const alignment = getAlignment(placement);
|
|
271
|
+
const fallbackPlacements = alignment ? getExpandedPlacements(placement) : [getOppositePlacement(placement)];
|
|
272
|
+
if (direction === 'none') {
|
|
273
|
+
return fallbackPlacements;
|
|
274
|
+
}
|
|
275
|
+
let oppositeAxisPlacements = getOppositeAxisSides(placement, direction);
|
|
276
|
+
if (alignment) {
|
|
277
|
+
oppositeAxisPlacements = oppositeAxisPlacements.map(side => `${side}-${alignment}`);
|
|
278
|
+
oppositeAxisPlacements = [...oppositeAxisPlacements, ...oppositeAxisPlacements.map(getOppositeAlignmentPlacement)];
|
|
279
|
+
}
|
|
280
|
+
return [...fallbackPlacements, ...oppositeAxisPlacements];
|
|
281
|
+
}
|
|
282
|
+
|
|
228
283
|
function isPrevented(path, trigger) {
|
|
229
284
|
return path.some(element => {
|
|
230
285
|
const {
|
|
@@ -245,6 +300,36 @@ function isPrevented(path, trigger) {
|
|
|
245
300
|
});
|
|
246
301
|
}
|
|
247
302
|
|
|
303
|
+
/**
|
|
304
|
+
* True when this document runs in a cross-origin iframe.
|
|
305
|
+
* Parent `window` access throws or is blocked (Safari logs SecurityError for frameElement).
|
|
306
|
+
*/
|
|
307
|
+
function isCrossOriginIframe() {
|
|
308
|
+
if (typeof window === 'undefined' || window.self === window.top) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
return !window.parent || !Object.getPrototypeOf(window.parent);
|
|
313
|
+
} catch {
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Wrapper around Floating UI `autoUpdate` for embedded apps.
|
|
319
|
+
* Disables ancestor scroll/resize tracking in cross-origin iframes where Floating UI
|
|
320
|
+
* cannot safely traverse into the parent frame.
|
|
321
|
+
*/
|
|
322
|
+
const safeAutoUpdate = (reference, floating, update, options = {}) => {
|
|
323
|
+
if (isCrossOriginIframe()) {
|
|
324
|
+
return autoUpdate(reference, floating, update, {
|
|
325
|
+
...options,
|
|
326
|
+
ancestorScroll: false,
|
|
327
|
+
ancestorResize: false
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
return autoUpdate(reference, floating, update, options);
|
|
331
|
+
};
|
|
332
|
+
|
|
248
333
|
var script = defineComponent({
|
|
249
334
|
name: 'OrPopover',
|
|
250
335
|
components: {
|
|
@@ -343,7 +428,7 @@ var script = defineComponent({
|
|
|
343
428
|
} = useFloating(trigger, root, {
|
|
344
429
|
placement,
|
|
345
430
|
middleware: [offset(offset$1.value), shift(), flip(() => ({
|
|
346
|
-
|
|
431
|
+
fallbackPlacements: getFallbackPlacements(placement.value, props.fallbackPlacement)
|
|
347
432
|
})), hide(hideOptions.value), size({
|
|
348
433
|
apply({
|
|
349
434
|
rects,
|
|
@@ -357,7 +442,7 @@ var script = defineComponent({
|
|
|
357
442
|
}
|
|
358
443
|
})],
|
|
359
444
|
whileElementsMounted(...args) {
|
|
360
|
-
return
|
|
445
|
+
return safeAutoUpdate(...args, {
|
|
361
446
|
animationFrame: true
|
|
362
447
|
});
|
|
363
448
|
}
|
|
@@ -462,4 +547,4 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
|
|
|
462
547
|
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
|
|
463
548
|
var OrPopover = __vue_component__;
|
|
464
549
|
|
|
465
|
-
export { OrPopover as OrPopoverV3, PopoverPlacement, PopoverVariant, isPrevented };
|
|
550
|
+
export { OrPopover as OrPopoverV3, PopoverPlacement, PopoverVariant, getFallbackPlacements, isCrossOriginIframe, isPrevented, safeAutoUpdate };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { autoUpdate } from '@floating-ui/dom';
|
|
2
|
+
/**
|
|
3
|
+
* True when this document runs in a cross-origin iframe.
|
|
4
|
+
* Parent `window` access throws or is blocked (Safari logs SecurityError for frameElement).
|
|
5
|
+
*/
|
|
6
|
+
export declare function isCrossOriginIframe(): boolean;
|
|
7
|
+
type AutoUpdateFn = typeof autoUpdate;
|
|
8
|
+
/**
|
|
9
|
+
* Wrapper around Floating UI `autoUpdate` for embedded apps.
|
|
10
|
+
* Disables ancestor scroll/resize tracking in cross-origin iframes where Floating UI
|
|
11
|
+
* cannot safely traverse into the parent frame.
|
|
12
|
+
*/
|
|
13
|
+
export declare const safeAutoUpdate: AutoUpdateFn;
|
|
14
|
+
export {};
|
package/dist/esm/index.js
CHANGED
|
@@ -69,7 +69,7 @@ export { ModalSize, OrModalV3 } from './components/or-modal-v3/index.js';
|
|
|
69
69
|
export { NotificationVariant, OrNotificationV3, VariantToIconName } from './components/or-notification-v3/index.js';
|
|
70
70
|
export { OrOverlayV3 } from './components/or-overlay-v3/index.js';
|
|
71
71
|
export { OrPaginationV3 } from './components/or-pagination-v3/index.js';
|
|
72
|
-
export { OrPopoverV3, PopoverPlacement, PopoverVariant, isPrevented } from './components/or-popover-v3/index.js';
|
|
72
|
+
export { OrPopoverV3, PopoverPlacement, PopoverVariant, getFallbackPlacements, isCrossOriginIframe, isPrevented, safeAutoUpdate } from './components/or-popover-v3/index.js';
|
|
73
73
|
export { OrProgressV3, ProgressColor, ProgressType } from './components/or-progress-v3/index.js';
|
|
74
74
|
export { OrRadioGroupV3 } from './components/or-radio-group-v3/index.js';
|
|
75
75
|
export { OrRadioV3 } from './components/or-radio-v3/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components-vue2",
|
|
3
|
-
"version": "26.11.
|
|
3
|
+
"version": "26.11.3-beta.6036.0",
|
|
4
4
|
"description": "Vue components library for v2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"@codemirror/lint": "^6",
|
|
39
39
|
"@codemirror/state": "^6",
|
|
40
40
|
"@codemirror/view": "^6",
|
|
41
|
-
"@floating-ui/dom": "1.
|
|
41
|
+
"@floating-ui/dom": "1.7.6",
|
|
42
42
|
"@lezer/highlight": "*",
|
|
43
|
-
"@onereach/styles": "^26.11.
|
|
44
|
-
"@onereach/ui-components-common": "^26.11.
|
|
43
|
+
"@onereach/styles": "^26.11.3-beta.6036.0",
|
|
44
|
+
"@onereach/ui-components-common": "^26.11.3-beta.6036.0",
|
|
45
45
|
"@splidejs/splide": "4.0.6",
|
|
46
46
|
"@tiptap/core": "2.27.1",
|
|
47
47
|
"@tiptap/extension-blockquote": "2.27.1",
|
|
@@ -102,6 +102,5 @@
|
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"access": "public"
|
|
104
104
|
},
|
|
105
|
-
"npmUnpacked": "4.15.2"
|
|
106
|
-
"gitHead": "ba95cca98160dbb4ea5677d35bd81d85c4ea8025"
|
|
105
|
+
"npmUnpacked": "4.15.2"
|
|
107
106
|
}
|