@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.
@@ -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>;
@@ -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: Element | null);
18
+ constructor(element: HTMLElement | null, subNavigation: HTMLElement | null);
19
19
  private init;
20
20
  enableFollow(): void;
21
21
  disableFollow(): void;
@@ -1,4 +1,4 @@
1
- import { handleDataOutside } from './index';
1
+ import { handleDataOutside } from './floating-components';
2
2
  export const isEventTargetNavigationItem = (event) => {
3
3
  var _a, _b;
4
4
  const { target } = event;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@db-ux/react-core-components",
3
- "version": "2.0.8",
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.8",
42
- "@db-ux/core-foundations": "2.0.8"
41
+ "@db-ux/core-components": "2.0.10-popover-d7e8b9a",
42
+ "@db-ux/core-foundations": "2.0.10-popover-d7e8b9a"
43
43
  }
44
44
  }