@db-ux/react-core-components 2.0.8 → 2.0.10-popover-d7e8b9a
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/components/button/button.js +1 -1
- package/dist/components/card/card.js +1 -1
- package/dist/components/checkbox/checkbox.js +2 -1
- package/dist/components/custom-select/custom-select.js +99 -62
- package/dist/components/custom-select/model.d.ts +6 -5
- package/dist/components/icon/model.d.ts +1 -3
- package/dist/components/icon/model.js +0 -1
- package/dist/components/link/link.js +1 -1
- package/dist/components/navigation-item/navigation-item.js +1 -1
- package/dist/components/popover/model.d.ts +0 -1
- package/dist/components/popover/popover.js +60 -9
- package/dist/components/radio/model.d.ts +1 -3
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +2 -1
- package/dist/components/select/model.d.ts +2 -1
- package/dist/components/select/select.js +5 -5
- package/dist/components/switch/switch.js +2 -1
- package/dist/components/textarea/textarea.js +2 -2
- package/dist/components/tooltip/model.d.ts +5 -3
- package/dist/components/tooltip/tooltip.js +60 -11
- package/dist/shared/model.d.ts +12 -3
- package/dist/utils/document-click-listener.js +4 -4
- package/dist/utils/document-scroll-listener.d.ts +9 -0
- package/dist/utils/document-scroll-listener.js +38 -0
- package/dist/utils/floating-components.d.ts +7 -0
- package/dist/utils/floating-components.js +290 -0
- package/dist/utils/index.d.ts +0 -13
- package/dist/utils/index.js +0 -70
- package/dist/utils/navigation.d.ts +1 -1
- package/dist/utils/navigation.js +1 -1
- package/package.json +3 -3
package/dist/utils/index.d.ts
CHANGED
|
@@ -7,19 +7,6 @@ export type ClassNameArg = string | {
|
|
|
7
7
|
[key: string]: boolean | undefined;
|
|
8
8
|
} | undefined;
|
|
9
9
|
export declare const cls: (...args: ClassNameArg[]) => string;
|
|
10
|
-
export declare const visibleInVX: (el: Element) => boolean;
|
|
11
|
-
export declare const visibleInVY: (el: Element) => boolean;
|
|
12
|
-
export declare const isInView: (el: Element) => {
|
|
13
|
-
outTop: boolean;
|
|
14
|
-
outBottom: boolean;
|
|
15
|
-
outLeft: boolean;
|
|
16
|
-
outRight: boolean;
|
|
17
|
-
};
|
|
18
|
-
export interface DBDataOutsidePair {
|
|
19
|
-
vx?: 'left' | 'right';
|
|
20
|
-
vy?: 'top' | 'bottom';
|
|
21
|
-
}
|
|
22
|
-
export declare const handleDataOutside: (el: Element) => DBDataOutsidePair;
|
|
23
10
|
export declare const isArrayOfStrings: (value: unknown) => value is string[];
|
|
24
11
|
export declare const hasVoiceOver: () => boolean;
|
|
25
12
|
export declare const delay: (fn: () => void, ms: number) => Promise<unknown>;
|
package/dist/utils/index.js
CHANGED
|
@@ -37,76 +37,6 @@ export const cls = (...args) => {
|
|
|
37
37
|
}
|
|
38
38
|
return result.trim();
|
|
39
39
|
};
|
|
40
|
-
export const visibleInVX = (el) => {
|
|
41
|
-
const { left, right } = el.getBoundingClientRect();
|
|
42
|
-
const { innerWidth } = window;
|
|
43
|
-
return left >= 0 && right <= innerWidth;
|
|
44
|
-
};
|
|
45
|
-
export const visibleInVY = (el) => {
|
|
46
|
-
const { top, bottom } = el.getBoundingClientRect();
|
|
47
|
-
const { innerHeight } = window;
|
|
48
|
-
return top >= 0 && bottom <= innerHeight;
|
|
49
|
-
};
|
|
50
|
-
export const isInView = (el) => {
|
|
51
|
-
var _a;
|
|
52
|
-
const { top, bottom, left, right } = el.getBoundingClientRect();
|
|
53
|
-
const { innerHeight, innerWidth } = window;
|
|
54
|
-
let outTop = top < 0;
|
|
55
|
-
let outBottom = bottom > innerHeight;
|
|
56
|
-
let outLeft = left < 0;
|
|
57
|
-
let outRight = right > innerWidth;
|
|
58
|
-
// We need to check if it was already outside
|
|
59
|
-
const outsideY = el.hasAttribute('data-outside-vy');
|
|
60
|
-
const outsideX = el.hasAttribute('data-outside-vx');
|
|
61
|
-
const parentRect = (_a = el === null || el === void 0 ? void 0 : el.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
62
|
-
if (parentRect) {
|
|
63
|
-
if (outsideY) {
|
|
64
|
-
const position = el.getAttribute('data-outside-vy');
|
|
65
|
-
if (position === 'top') {
|
|
66
|
-
outTop = parentRect.top - (bottom - parentRect.bottom) < 0;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
outBottom = parentRect.bottom + (parentRect.top - top) > innerHeight;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (outsideX) {
|
|
73
|
-
const position = el.getAttribute('data-outside-vx');
|
|
74
|
-
if (position === 'left') {
|
|
75
|
-
outLeft = parentRect.left - (right - parentRect.right) < 0;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
outRight = parentRect.right + (parentRect.left - left) > innerWidth;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
outTop,
|
|
84
|
-
outBottom,
|
|
85
|
-
outLeft,
|
|
86
|
-
outRight
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
|
-
export const handleDataOutside = (el) => {
|
|
90
|
-
const { outTop, outBottom, outLeft, outRight } = isInView(el);
|
|
91
|
-
let dataOutsidePair = {};
|
|
92
|
-
if (outTop || outBottom) {
|
|
93
|
-
dataOutsidePair = {
|
|
94
|
-
vy: outTop ? 'top' : 'bottom'
|
|
95
|
-
};
|
|
96
|
-
el.setAttribute('data-outside-vy', dataOutsidePair.vy);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
el.removeAttribute('data-outside-vy');
|
|
100
|
-
}
|
|
101
|
-
if (outLeft || outRight) {
|
|
102
|
-
dataOutsidePair = Object.assign(Object.assign({}, dataOutsidePair), { vx: outRight ? 'right' : 'left' });
|
|
103
|
-
el.setAttribute('data-outside-vx', dataOutsidePair.vx);
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
el.removeAttribute('data-outside-vx');
|
|
107
|
-
}
|
|
108
|
-
return dataOutsidePair;
|
|
109
|
-
};
|
|
110
40
|
export const isArrayOfStrings = (value) => Array.isArray(value) && value.every(item => typeof item === 'string');
|
|
111
41
|
const appleOs = ['Mac', 'iPhone', 'iPad', 'iPod'];
|
|
112
42
|
export const hasVoiceOver = () => typeof window !== 'undefined' && appleOs.some(os => window.navigator.userAgent.includes(os));
|
|
@@ -15,7 +15,7 @@ export declare class NavigationItemSafeTriangle {
|
|
|
15
15
|
private initialized;
|
|
16
16
|
private mouseX;
|
|
17
17
|
private mouseY;
|
|
18
|
-
constructor(element: HTMLElement | null, subNavigation:
|
|
18
|
+
constructor(element: HTMLElement | null, subNavigation: HTMLElement | null);
|
|
19
19
|
private init;
|
|
20
20
|
enableFollow(): void;
|
|
21
21
|
disableFollow(): void;
|
package/dist/utils/navigation.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@db-ux/react-core-components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10-popover-d7e8b9a",
|
|
4
4
|
"description": "React components for @db-ux/core-components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"sideEffects": false,
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@db-ux/core-components": "2.0.
|
|
42
|
-
"@db-ux/core-foundations": "2.0.
|
|
41
|
+
"@db-ux/core-components": "2.0.10-popover-d7e8b9a",
|
|
42
|
+
"@db-ux/core-foundations": "2.0.10-popover-d7e8b9a"
|
|
43
43
|
}
|
|
44
44
|
}
|