react-core-ts 1.1.28 → 1.1.30

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.
@@ -22,12 +22,11 @@ var getPosition = function (textFieldElement, formFieldView) {
22
22
  var scrollableParent = getScrollableParent(textFieldElement);
23
23
  var parentRect = scrollableParent.getBoundingClientRect();
24
24
  var spaceBelow = parentRect.bottom - textFieldRect.bottom;
25
- var spaceAbove = parentRect.top - textFieldRect.top;
26
25
  if (formFieldView) {
27
26
  return spaceBelow < 50 ? 'top-tool' : 'bottom-tool';
28
27
  }
29
28
  else {
30
- return spaceAbove > 50 ? 'top' : 'bottom';
29
+ return spaceBelow < 60 ? 'top' : 'bottom';
31
30
  }
32
31
  };
33
32
  var applyPositionClass = function (textFieldRef) {
@@ -1 +1 @@
1
- {"version":3,"file":"getPosition.js","sourceRoot":"","sources":["../../src/utilities/getPosition.ts"],"names":[],"mappings":";;;AAEA,2DAA2D;AAC3D,mEAAmE;AAEnE,iEAAiE;AACjE,+CAA+C;AAC/C,IAAI;AACJ,IAAM,mBAAmB,GAAG,UAAC,OAAoB;IAC/C,IAAI,MAAM,GAAG,OAAO,CAAC,aAAa,CAAA;IAClC,OAAO,MAAM,EAAE;QACb,IAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,SAAS,CAAA;QAC3D,IAAI,SAAS,KAAK,QAAQ,IAAI,SAAS,KAAK,MAAM,EAAE;YAClD,OAAO,MAAM,CAAA;SACd;QACD,MAAM,GAAG,MAAM,CAAC,aAAa,CAAA;KAC9B;IACD,OAAO,MAAM,CAAA,CAAC,sDAAsD;AACtE,CAAC,CAAA;AAED,IAAM,WAAW,GAAG,UAAC,gBAA6B,EAAE,aAAuB;IACzE,IAAM,aAAa,GAAG,gBAAgB,CAAC,qBAAqB,EAAE,CAAA;IAC9D,IAAM,gBAAgB,GAAG,mBAAmB,CAAC,gBAAgB,CAAgB,CAAA;IAC7E,IAAM,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AgB,CAAC,CAAC,CAAC,+BAA+B;QACpF,gBAAgB,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACnD,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;KAC/C;AACH,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B;AACK,IAAM,yBAAyB,GAAG,UACvC,YAA6C;IAE7C,IAAI,YAAY,CAAC,OAAO,EAAE;QACxB,IAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,CAAC;QAC9C,IAAM,aAAa,GAAG,WAAW,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC,+BAA+B;QAE1F,gBAAgB,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;QAC7D,gBAAgB,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;KAC/C;AACH,CAAC,CAAC;AAVW,QAAA,yBAAyB,6BAUpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-core-ts",
3
- "version": "1.1.28",
3
+ "version": "1.1.30",
4
4
  "description": "React Components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React from 'react';
2
2
 
3
3
  // const getPosition = (textFieldElement: HTMLElement) => {
4
4
  // const textFieldRect = textFieldElement.getBoundingClientRect()
@@ -7,47 +7,50 @@ import React from 'react'
7
7
  // return spaceBelow < 180 ? 'top' : 'bottom'
8
8
  // }
9
9
  const getScrollableParent = (element: HTMLElement): HTMLElement | Window => {
10
- let parent = element.parentElement
10
+ let parent = element.parentElement;
11
11
  while (parent) {
12
- const overflowY = window.getComputedStyle(parent).overflowY
12
+ const overflowY = window.getComputedStyle(parent).overflowY;
13
13
  if (overflowY === 'scroll' || overflowY === 'auto') {
14
- return parent
14
+ return parent;
15
15
  }
16
- parent = parent.parentElement
16
+ parent = parent.parentElement;
17
17
  }
18
- return window // Fallback to window if no scrollable parent is found
19
- }
18
+ return window; // Fallback to window if no scrollable parent is found
19
+ };
20
20
 
21
- const getPosition = (textFieldElement: HTMLElement, formFieldView?: boolean) => {
22
- const textFieldRect = textFieldElement.getBoundingClientRect()
23
- const scrollableParent = getScrollableParent(textFieldElement) as HTMLElement
24
- const parentRect = scrollableParent.getBoundingClientRect()
21
+ const getPosition = (
22
+ textFieldElement: HTMLElement,
23
+ formFieldView?: boolean
24
+ ) => {
25
+ const textFieldRect = textFieldElement.getBoundingClientRect();
26
+ const scrollableParent = getScrollableParent(textFieldElement) as HTMLElement;
27
+ const parentRect = scrollableParent.getBoundingClientRect();
25
28
 
26
- const spaceBelow = parentRect.bottom - textFieldRect.bottom
27
- const spaceAbove = parentRect.top - textFieldRect.top
29
+ const spaceBelow = parentRect.bottom - textFieldRect.bottom;
28
30
  if (formFieldView) {
29
- return spaceBelow < 50 ? 'top-tool' : 'bottom-tool'
31
+ return spaceBelow < 50 ? 'top-tool' : 'bottom-tool';
30
32
  } else {
31
- return spaceAbove > 50 ? 'top' : 'bottom'
33
+ return spaceBelow < 60 ? 'top' : 'bottom';
32
34
  }
33
- }
34
- export const applyPositionClass = (textFieldRef: React.RefObject<HTMLDivElement>) => {
35
+ };
36
+ export const applyPositionClass = (
37
+ textFieldRef: React.RefObject<HTMLDivElement>
38
+ ) => {
35
39
  if (textFieldRef.current) {
36
- const textFieldElement = textFieldRef.current
37
- const positionClass = getPosition(textFieldElement) // Get either 'top' or 'bottom'
38
-
39
- textFieldElement.classList.remove('top', 'bottom')
40
- textFieldElement.classList.add(positionClass)
40
+ const textFieldElement = textFieldRef.current;
41
+ const positionClass = getPosition(textFieldElement); // Get either 'top' or 'bottom'
42
+ textFieldElement.classList.remove('top', 'bottom');
43
+ textFieldElement.classList.add(positionClass);
41
44
  }
42
- }
45
+ };
43
46
  export const applyToolTipPositionClass = (
44
47
  textFieldRef: React.RefObject<HTMLDivElement>
45
48
  ) => {
46
49
  if (textFieldRef.current) {
47
- const textFieldElement = textFieldRef.current
48
- const positionClass = getPosition(textFieldElement, true) // Get either 'top' or 'bottom'
50
+ const textFieldElement = textFieldRef.current;
51
+ const positionClass = getPosition(textFieldElement, true); // Get either 'top' or 'bottom'
49
52
 
50
- textFieldElement.classList.remove('top-tool', 'bottom-tool')
51
- textFieldElement.classList.add(positionClass)
53
+ textFieldElement.classList.remove('top-tool', 'bottom-tool');
54
+ textFieldElement.classList.add(positionClass);
52
55
  }
53
- }
56
+ };