@dreamcommerce/aurora 0.4.17 → 0.4.20

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.
@@ -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
 
@@ -25,14 +25,14 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
25
25
  * />
26
26
  * )
27
27
  */
28
- const ControlTextarea = ({ label, isRequired, id, name, value, placeholder, disabled, readOnly, onChange, onKeyPress, errors, hint, hintOptions = { isFixed: true } }) => {
28
+ const ControlTextarea = ({ label, isRequired, id, name, value, defaultValue, placeholder, disabled, readOnly, onChange, onFocus, onBlur, onKeyPress, errors, hint, hintOptions = { isFixed: true } }) => {
29
29
  return (React__default['default'].createElement(index['default'], { errors: errors, name: name, id: id },
30
30
  (label || hint) && (React__default['default'].createElement(index['default'].Label, { id: id, isRequired: isRequired },
31
31
  label,
32
32
  hint && React__default['default'].createElement(index$1['default'], { fixed: hintOptions.isFixed, spacingLeft: true, hint: hint }))),
33
33
  React__default['default'].createElement(index['default'].Content, null,
34
34
  React__default['default'].createElement(index['default'].Element, null,
35
- React__default['default'].createElement(index['default'].Textarea, { id: id, name: name, value: value, placeholder: placeholder, disabled: disabled, readOnly: readOnly, onChange: onChange, onKeyPress: onKeyPress }))),
35
+ React__default['default'].createElement(index['default'].Textarea, { id: id, name: name, value: value, defaultValue: defaultValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyPress: onKeyPress }))),
36
36
  React__default['default'].createElement(index['default'].Errors, null)));
37
37
  };
38
38
 
@@ -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 screenWidthName = use_screen_detect.useScreenDetect();
43
- const [isDropdownArrowVerticalDirectBottom, setIsDropdownArrowVerticalDirectBottom] = React.useState(false);
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
- isDropdownArrowVerticalDirectBottom && css_classes.cssDropdownArrowVerticalDirectionBottom
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;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,4 +1,4 @@
1
1
  import { IAsButtonProps } from './types';
2
2
  export declare const button: {
3
- render({ type, onClick, children }: IAsButtonProps, classNames: string): JSX.Element;
3
+ render({ type, onClick, testId, children }: IAsButtonProps, classNames: string): JSX.Element;
4
4
  };
@@ -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,5 +1,6 @@
1
1
  import { ButtonHTMLAttributes } from 'react';
2
2
  export interface IAsButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
3
3
  children: NodeListOf<HTMLElement> | Element | string;
4
+ testId?: string;
4
5
  onClick?(event: React.MouseEvent<HTMLElement>): void;
5
6
  }
@@ -1,4 +1,4 @@
1
1
  import { IAsLinkProps } from './types';
2
2
  export declare const link: {
3
- render({ href, target, onClick, children }: IAsLinkProps, classNames: string): JSX.Element;
3
+ render({ href, target, onClick, testId, children }: IAsLinkProps, classNames: string): JSX.Element;
4
4
  };
@@ -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
 
@@ -2,6 +2,7 @@
2
2
  export interface IAsLinkProps {
3
3
  href?: string;
4
4
  target?: '_blank';
5
+ testId?: string;
5
6
  onClick?(event: React.MouseEvent<HTMLElement>): void;
6
7
  children: NodeListOf<HTMLElement> | string | Element;
7
8
  }
@@ -7,5 +7,6 @@ export interface IButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
7
7
  color?: 'secondary' | 'on-dark-bg' | 'alert';
8
8
  href?: string;
9
9
  target?: '_blank';
10
+ testId?: string;
10
11
  children: NodeListOf<HTMLElement> | string | Element;
11
12
  }
@@ -17,14 +17,14 @@ import Hint from '../../../hint/index.js';
17
17
  * />
18
18
  * )
19
19
  */
20
- const ControlTextarea = ({ label, isRequired, id, name, value, placeholder, disabled, readOnly, onChange, onKeyPress, errors, hint, hintOptions = { isFixed: true } }) => {
20
+ const ControlTextarea = ({ label, isRequired, id, name, value, defaultValue, placeholder, disabled, readOnly, onChange, onFocus, onBlur, onKeyPress, errors, hint, hintOptions = { isFixed: true } }) => {
21
21
  return (React.createElement(Control, { errors: errors, name: name, id: id },
22
22
  (label || hint) && (React.createElement(Control.Label, { id: id, isRequired: isRequired },
23
23
  label,
24
24
  hint && React.createElement(Hint, { fixed: hintOptions.isFixed, spacingLeft: true, hint: hint }))),
25
25
  React.createElement(Control.Content, null,
26
26
  React.createElement(Control.Element, null,
27
- React.createElement(Control.Textarea, { id: id, name: name, value: value, placeholder: placeholder, disabled: disabled, readOnly: readOnly, onChange: onChange, onKeyPress: onKeyPress }))),
27
+ React.createElement(Control.Textarea, { id: id, name: name, value: value, defaultValue: defaultValue, placeholder: placeholder, disabled: disabled, readOnly: readOnly, onChange: onChange, onFocus: onFocus, onBlur: onBlur, onKeyPress: onKeyPress }))),
28
28
  React.createElement(Control.Errors, null)));
29
29
  };
30
30
 
@@ -71,6 +71,8 @@ export interface ITextareaProps extends TextareaHTMLAttributes<HTMLTextAreaEleme
71
71
  id?: string;
72
72
  padding?: string;
73
73
  onChange?(event: React.ChangeEvent<HTMLTextAreaElement>): void;
74
+ onFocus?(event: React.FocusEvent<HTMLTextAreaElement>): void;
75
+ onBlur?(event: React.FocusEvent<HTMLTextAreaElement>): void;
74
76
  onKeyPress?(event: React.KeyboardEvent<Element>): void;
75
77
  }
76
78
  export interface IInputWrapperProps extends HTMLAttributes<HTMLDivElement> {
@@ -31,13 +31,18 @@ const Content = ({ headerComponent, headerGoBackText, headerGoBackIcon, children
31
31
  bottom: '0px',
32
32
  zIndex: DROPDOWN_Z_INDEX
33
33
  });
34
- const screenWidthName = useScreenDetect();
35
- const [isDropdownArrowVerticalDirectBottom, setIsDropdownArrowVerticalDirectBottom] = useState(false);
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
- isDropdownArrowVerticalDirectBottom && cssDropdownArrowVerticalDirectionBottom
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;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;"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@dreamcommerce/aurora",
3
3
  "packageManager": "yarn@3.2.0",
4
4
  "sideEffects": false,
5
- "version": "0.4.17",
5
+ "version": "0.4.20",
6
6
  "description": "aurora",
7
7
  "author": "k0ssak",
8
8
  "license": "MIT",