@dreamcommerce/aurora 0.4.17 → 0.4.18
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/build/cjs/packages/aurora/src/components/button/components/button/index.js +2 -2
- package/build/cjs/packages/aurora/src/components/button/components/link/index.js +2 -2
- package/build/cjs/packages/aurora/src/components/dropdown/components/content.js +10 -12
- package/build/cjs/packages/aurora/src/components/dropdown/components/content.js.map +1 -1
- package/build/esm/packages/aurora/src/components/button/components/button/index.d.ts +1 -1
- package/build/esm/packages/aurora/src/components/button/components/button/index.js +2 -2
- package/build/esm/packages/aurora/src/components/button/components/button/types.d.ts +1 -0
- package/build/esm/packages/aurora/src/components/button/components/link/index.d.ts +1 -1
- package/build/esm/packages/aurora/src/components/button/components/link/index.js +2 -2
- package/build/esm/packages/aurora/src/components/button/components/link/types.d.ts +1 -0
- package/build/esm/packages/aurora/src/components/button/types.d.ts +1 -0
- package/build/esm/packages/aurora/src/components/dropdown/components/content.js +10 -12
- package/build/esm/packages/aurora/src/components/dropdown/components/content.js.map +1 -1
- package/package.json +1 -1
|
@@ -9,8 +9,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
11
|
const button = {
|
|
12
|
-
render({ type = 'button', onClick, children }, classNames) {
|
|
13
|
-
return (React__default['default'].createElement("button", { type: type, onClick: onClick, className: classNames }, children));
|
|
12
|
+
render({ type = 'button', onClick, testId, children }, classNames) {
|
|
13
|
+
return (React__default['default'].createElement("button", { type: type, onClick: onClick, className: classNames, "data-test-id": testId }, children));
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -9,8 +9,8 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
11
|
const link = {
|
|
12
|
-
render({ href, target, onClick, children }, classNames) {
|
|
13
|
-
return (React__default['default'].createElement("a", { href: href, target: target, onClick: onClick, className: classNames }, children));
|
|
12
|
+
render({ href, target, onClick, testId, children }, classNames) {
|
|
13
|
+
return (React__default['default'].createElement("a", { href: href, target: target, onClick: onClick, className: classNames, "data-test-id": testId }, children));
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -39,13 +39,18 @@ const Content = ({ headerComponent, headerGoBackText, headerGoBackIcon, children
|
|
|
39
39
|
bottom: '0px',
|
|
40
40
|
zIndex: constants.DROPDOWN_Z_INDEX
|
|
41
41
|
});
|
|
42
|
-
const
|
|
43
|
-
const
|
|
42
|
+
const windowHeightMinusYOffset = window.innerHeight - window.pageYOffset;
|
|
43
|
+
const checkIfIsOutsideBottomViewport = (elem) => {
|
|
44
|
+
const bounding = elem.getBoundingClientRect();
|
|
45
|
+
return bounding.bottom > windowHeightMinusYOffset;
|
|
46
|
+
};
|
|
47
|
+
const dropdownIsOutsideBottomViewport = contentRef.current && checkIfIsOutsideBottomViewport(contentRef.current);
|
|
44
48
|
const contentClassName = classNames.classNames([
|
|
45
49
|
css_classes.cssDropdownContent,
|
|
46
50
|
arrowSide === 'right' && css_classes.cssDropdownArrowHorizontalDirectionRight,
|
|
47
|
-
|
|
51
|
+
dropdownIsOutsideBottomViewport && css_classes.cssDropdownArrowVerticalDirectionBottom
|
|
48
52
|
], main_module['default']);
|
|
53
|
+
const screenWidthName = use_screen_detect.useScreenDetect();
|
|
49
54
|
const refs = [contentRef];
|
|
50
55
|
if (wrapperRef) {
|
|
51
56
|
refs.push(wrapperRef);
|
|
@@ -58,15 +63,8 @@ const Content = ({ headerComponent, headerGoBackText, headerGoBackIcon, children
|
|
|
58
63
|
React.useEffect(() => {
|
|
59
64
|
if (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current) {
|
|
60
65
|
const { x, y, height } = wrapperRef.current.getBoundingClientRect();
|
|
61
|
-
const { xModifier, yModifier } = utilities.getXYModifiersForNestedDropdowns(portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.current);
|
|
62
|
-
const windowHeightMinusYOffset = window.innerHeight - window.pageYOffset;
|
|
63
|
-
const checkIfIsOutsideBottomViewport = (elem) => {
|
|
64
|
-
const elementBottomPosition = elem.offsetTop + elem.offsetHeight;
|
|
65
|
-
return elementBottomPosition > windowHeightMinusYOffset;
|
|
66
|
-
};
|
|
67
|
-
const dropdownIsOutsideBottomViewport = contentRef.current && checkIfIsOutsideBottomViewport(contentRef.current);
|
|
68
|
-
dropdownIsOutsideBottomViewport && setIsDropdownArrowVerticalDirectBottom(dropdownIsOutsideBottomViewport);
|
|
69
66
|
const yOffset = 10;
|
|
67
|
+
const { xModifier, yModifier } = utilities.getXYModifiersForNestedDropdowns(portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.current);
|
|
70
68
|
const positionTop = height + y + yOffset - yModifier;
|
|
71
69
|
const positionBottom = windowHeightMinusYOffset - y + yOffset;
|
|
72
70
|
const positionLeft = x - xModifier;
|
|
@@ -78,7 +76,7 @@ const Content = ({ headerComponent, headerGoBackText, headerGoBackIcon, children
|
|
|
78
76
|
? setStyles({ left: `0px`, top: `0px`, bottom: 'auto', zIndex })
|
|
79
77
|
: setStyles({ left: `${positionLeft}px`, top: topPositionValue, bottom: bottomPositionValue, zIndex });
|
|
80
78
|
}
|
|
81
|
-
}, [portalContainer, screenWidthName, wrapperRef, isOpen]);
|
|
79
|
+
}, [portalContainer, screenWidthName, wrapperRef, isOpen, dropdownIsOutsideBottomViewport]);
|
|
82
80
|
return reactDom.createPortal(React__default['default'].createElement(reactTransitionGroup.TransitionGroup, { component: null }, isOpen === true ? (React__default['default'].createElement(reactTransitionGroup.CSSTransition, { timeout: 200, classNames: {
|
|
83
81
|
enter: main_module['default']['dropdown-enter'],
|
|
84
82
|
enterActive: main_module['default']['dropdown-enter-active'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,6BAA6B,oEAAwE;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA,6BAA6B,oEAAwE;AACrG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
const button = {
|
|
4
|
-
render({ type = 'button', onClick, children }, classNames) {
|
|
5
|
-
return (React.createElement("button", { type: type, onClick: onClick, className: classNames }, children));
|
|
4
|
+
render({ type = 'button', onClick, testId, children }, classNames) {
|
|
5
|
+
return (React.createElement("button", { type: type, onClick: onClick, className: classNames, "data-test-id": testId }, children));
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
const link = {
|
|
4
|
-
render({ href, target, onClick, children }, classNames) {
|
|
5
|
-
return (React.createElement("a", { href: href, target: target, onClick: onClick, className: classNames }, children));
|
|
4
|
+
render({ href, target, onClick, testId, children }, classNames) {
|
|
5
|
+
return (React.createElement("a", { href: href, target: target, onClick: onClick, className: classNames, "data-test-id": testId }, children));
|
|
6
6
|
}
|
|
7
7
|
};
|
|
8
8
|
|
|
@@ -31,13 +31,18 @@ const Content = ({ headerComponent, headerGoBackText, headerGoBackIcon, children
|
|
|
31
31
|
bottom: '0px',
|
|
32
32
|
zIndex: DROPDOWN_Z_INDEX
|
|
33
33
|
});
|
|
34
|
-
const
|
|
35
|
-
const
|
|
34
|
+
const windowHeightMinusYOffset = window.innerHeight - window.pageYOffset;
|
|
35
|
+
const checkIfIsOutsideBottomViewport = (elem) => {
|
|
36
|
+
const bounding = elem.getBoundingClientRect();
|
|
37
|
+
return bounding.bottom > windowHeightMinusYOffset;
|
|
38
|
+
};
|
|
39
|
+
const dropdownIsOutsideBottomViewport = contentRef.current && checkIfIsOutsideBottomViewport(contentRef.current);
|
|
36
40
|
const contentClassName = classNames([
|
|
37
41
|
cssDropdownContent,
|
|
38
42
|
arrowSide === 'right' && cssDropdownArrowHorizontalDirectionRight,
|
|
39
|
-
|
|
43
|
+
dropdownIsOutsideBottomViewport && cssDropdownArrowVerticalDirectionBottom
|
|
40
44
|
], cssClasses);
|
|
45
|
+
const screenWidthName = useScreenDetect();
|
|
41
46
|
const refs = [contentRef];
|
|
42
47
|
if (wrapperRef) {
|
|
43
48
|
refs.push(wrapperRef);
|
|
@@ -50,15 +55,8 @@ const Content = ({ headerComponent, headerGoBackText, headerGoBackIcon, children
|
|
|
50
55
|
useEffect(() => {
|
|
51
56
|
if (wrapperRef === null || wrapperRef === void 0 ? void 0 : wrapperRef.current) {
|
|
52
57
|
const { x, y, height } = wrapperRef.current.getBoundingClientRect();
|
|
53
|
-
const { xModifier, yModifier } = getXYModifiersForNestedDropdowns(portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.current);
|
|
54
|
-
const windowHeightMinusYOffset = window.innerHeight - window.pageYOffset;
|
|
55
|
-
const checkIfIsOutsideBottomViewport = (elem) => {
|
|
56
|
-
const elementBottomPosition = elem.offsetTop + elem.offsetHeight;
|
|
57
|
-
return elementBottomPosition > windowHeightMinusYOffset;
|
|
58
|
-
};
|
|
59
|
-
const dropdownIsOutsideBottomViewport = contentRef.current && checkIfIsOutsideBottomViewport(contentRef.current);
|
|
60
|
-
dropdownIsOutsideBottomViewport && setIsDropdownArrowVerticalDirectBottom(dropdownIsOutsideBottomViewport);
|
|
61
58
|
const yOffset = 10;
|
|
59
|
+
const { xModifier, yModifier } = getXYModifiersForNestedDropdowns(portalContainer === null || portalContainer === void 0 ? void 0 : portalContainer.current);
|
|
62
60
|
const positionTop = height + y + yOffset - yModifier;
|
|
63
61
|
const positionBottom = windowHeightMinusYOffset - y + yOffset;
|
|
64
62
|
const positionLeft = x - xModifier;
|
|
@@ -70,7 +68,7 @@ const Content = ({ headerComponent, headerGoBackText, headerGoBackIcon, children
|
|
|
70
68
|
? setStyles({ left: `0px`, top: `0px`, bottom: 'auto', zIndex })
|
|
71
69
|
: setStyles({ left: `${positionLeft}px`, top: topPositionValue, bottom: bottomPositionValue, zIndex });
|
|
72
70
|
}
|
|
73
|
-
}, [portalContainer, screenWidthName, wrapperRef, isOpen]);
|
|
71
|
+
}, [portalContainer, screenWidthName, wrapperRef, isOpen, dropdownIsOutsideBottomViewport]);
|
|
74
72
|
return createPortal(React.createElement(TransitionGroup, { component: null }, isOpen === true ? (React.createElement(CSSTransition, { timeout: 200, classNames: {
|
|
75
73
|
enter: cssClasses['dropdown-enter'],
|
|
76
74
|
enterActive: cssClasses['dropdown-enter-active'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,+BAA+B,oEAAwE;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA,+BAA+B,oEAAwE;AACvG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
|