@onereach/ui-components-vue2 26.11.3-beta.6034.0 → 26.11.3
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 +87 -32
- package/dist/esm/components/or-popover-v3/utils/getFallbackPlacements.d.ts +2 -0
- package/dist/esm/components/or-popover-v3/utils/index.d.ts +1 -0
- package/dist/esm/index.js +1 -1
- package/package.json +5 -4
|
@@ -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, isCrossOriginIframe, isPrevented, safeAutoUpdate } 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';
|
|
@@ -174,36 +174,6 @@ var PopoverPlacement;
|
|
|
174
174
|
PopoverPlacement["RightEnd"] = "right-end";
|
|
175
175
|
})(PopoverPlacement || (PopoverPlacement = {}));
|
|
176
176
|
|
|
177
|
-
/**
|
|
178
|
-
* True when this document runs in a cross-origin iframe.
|
|
179
|
-
* Parent `window` access throws or is blocked (Safari logs SecurityError for frameElement).
|
|
180
|
-
*/
|
|
181
|
-
function isCrossOriginIframe() {
|
|
182
|
-
if (typeof window === 'undefined' || window.self === window.top) {
|
|
183
|
-
return false;
|
|
184
|
-
}
|
|
185
|
-
try {
|
|
186
|
-
return !window.parent || !Object.getPrototypeOf(window.parent);
|
|
187
|
-
} catch {
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Wrapper around Floating UI `autoUpdate` for embedded apps.
|
|
193
|
-
* Disables ancestor scroll/resize tracking in cross-origin iframes where Floating UI
|
|
194
|
-
* cannot safely traverse into the parent frame.
|
|
195
|
-
*/
|
|
196
|
-
const safeAutoUpdate = (reference, floating, update, options = {}) => {
|
|
197
|
-
if (isCrossOriginIframe()) {
|
|
198
|
-
return autoUpdate(reference, floating, update, {
|
|
199
|
-
...options,
|
|
200
|
-
ancestorScroll: false,
|
|
201
|
-
ancestorResize: false
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
return autoUpdate(reference, floating, update, options);
|
|
205
|
-
};
|
|
206
|
-
|
|
207
177
|
const Popover = [
|
|
208
178
|
// Position
|
|
209
179
|
'absolute'];
|
|
@@ -255,6 +225,61 @@ const PopoverBodyPlacements = {
|
|
|
255
225
|
'ml-0', 'mb-0']
|
|
256
226
|
};
|
|
257
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
|
+
|
|
258
283
|
function isPrevented(path, trigger) {
|
|
259
284
|
return path.some(element => {
|
|
260
285
|
const {
|
|
@@ -275,6 +300,36 @@ function isPrevented(path, trigger) {
|
|
|
275
300
|
});
|
|
276
301
|
}
|
|
277
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
|
+
|
|
278
333
|
var script = defineComponent({
|
|
279
334
|
name: 'OrPopover',
|
|
280
335
|
components: {
|
|
@@ -373,7 +428,7 @@ var script = defineComponent({
|
|
|
373
428
|
} = useFloating(trigger, root, {
|
|
374
429
|
placement,
|
|
375
430
|
middleware: [offset(offset$1.value), shift(), flip(() => ({
|
|
376
|
-
|
|
431
|
+
fallbackPlacements: getFallbackPlacements(placement.value, props.fallbackPlacement)
|
|
377
432
|
})), hide(hideOptions.value), size({
|
|
378
433
|
apply({
|
|
379
434
|
rects,
|
|
@@ -492,4 +547,4 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
|
|
|
492
547
|
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
|
|
493
548
|
var OrPopover = __vue_component__;
|
|
494
549
|
|
|
495
|
-
export { OrPopover as OrPopoverV3, PopoverPlacement, PopoverVariant, isCrossOriginIframe, isPrevented, safeAutoUpdate };
|
|
550
|
+
export { OrPopover as OrPopoverV3, PopoverPlacement, PopoverVariant, getFallbackPlacements, isCrossOriginIframe, isPrevented, safeAutoUpdate };
|
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, isCrossOriginIframe, isPrevented, safeAutoUpdate } 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
|
|
3
|
+
"version": "26.11.3",
|
|
4
4
|
"description": "Vue components library for v2",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@codemirror/view": "^6",
|
|
41
41
|
"@floating-ui/dom": "1.7.6",
|
|
42
42
|
"@lezer/highlight": "*",
|
|
43
|
-
"@onereach/styles": "^26.11.3
|
|
44
|
-
"@onereach/ui-components-common": "^26.11.3
|
|
43
|
+
"@onereach/styles": "^26.11.3",
|
|
44
|
+
"@onereach/ui-components-common": "^26.11.3",
|
|
45
45
|
"@splidejs/splide": "4.0.6",
|
|
46
46
|
"@tiptap/core": "2.27.1",
|
|
47
47
|
"@tiptap/extension-blockquote": "2.27.1",
|
|
@@ -102,5 +102,6 @@
|
|
|
102
102
|
"publishConfig": {
|
|
103
103
|
"access": "public"
|
|
104
104
|
},
|
|
105
|
-
"npmUnpacked": "4.15.2"
|
|
105
|
+
"npmUnpacked": "4.15.2",
|
|
106
|
+
"gitHead": "23d3ed984e27919eaa3f2d688aefe6339b74493e"
|
|
106
107
|
}
|