@dtdot/lego 2.0.0-24 → 2.0.0-26
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.
|
@@ -112,7 +112,7 @@ const Input = React.forwardRef(function ForwardRefInput(props, ref) {
|
|
|
112
112
|
React.createElement(ErrorInner, null,
|
|
113
113
|
React.createElement(FontAwesomeIcon, { icon: faExclamationCircle }))),
|
|
114
114
|
error && (React.createElement(ErrorMessage, { style: { opacity: 0, y: 0 }, animate: animationVariant, variants: messageVariants, transition: { type: 'spring', duration: 0.3 }, "data-testid": 'error-message' }, error))),
|
|
115
|
-
splitDescription && (React.createElement(ControlDescription, null, splitDescription.map((line, index) => (React.createElement(
|
|
115
|
+
splitDescription && (React.createElement(ControlDescription, null, splitDescription.map((line, index) => (React.createElement("span", { key: index },
|
|
116
116
|
index !== 0 && React.createElement("br", null),
|
|
117
117
|
line))))),
|
|
118
118
|
filteredOptions && isOpen && (React.createElement(OptionsPopper, { referenceElement: referenceElement, options: filteredOptions, onSelect: handleSetSuggestion, onClose: () => setIsOpen(false) }))));
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export type ModalSize = 'sm' | 'md' | 'lg';
|
|
3
3
|
export interface ModalProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
size?: ModalSize;
|
|
6
|
-
loading?: boolean;
|
|
7
|
-
onClose: () => void;
|
|
4
|
+
'children': React.ReactNode;
|
|
5
|
+
'size'?: ModalSize;
|
|
6
|
+
'loading'?: boolean;
|
|
7
|
+
'onClose': () => void;
|
|
8
|
+
'data-testid'?: string;
|
|
8
9
|
}
|
|
9
10
|
declare const Modal: {
|
|
10
|
-
({ children, size, loading, onClose }: ModalProps): React.ReactPortal;
|
|
11
|
+
({ children, size, loading, onClose, "data-testid": dataTestId }: ModalProps): React.ReactPortal;
|
|
11
12
|
Body: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
12
13
|
Header: ({ header, subHeader }: import("./_ModalHeader.component").ModalHeaderProps) => JSX.Element;
|
|
13
14
|
};
|
|
@@ -76,7 +76,7 @@ const SpinnerContainer = styled.div `
|
|
|
76
76
|
justify-content: center;
|
|
77
77
|
align-items: center;
|
|
78
78
|
`;
|
|
79
|
-
const Modal = ({ children, size, loading, onClose }) => {
|
|
79
|
+
const Modal = ({ children, size, loading, onClose, 'data-testid': dataTestId }) => {
|
|
80
80
|
const handleModalClick = (event) => {
|
|
81
81
|
event.modalClicked = true;
|
|
82
82
|
};
|
|
@@ -90,7 +90,7 @@ const Modal = ({ children, size, loading, onClose }) => {
|
|
|
90
90
|
React.createElement(ScrollContainer, null,
|
|
91
91
|
React.createElement(ModalContext.Provider, { value: { onClose } },
|
|
92
92
|
React.createElement(ModalWrapper, { size: size || 'md' },
|
|
93
|
-
React.createElement(ModalOuter, { transition: { type: 'spring', bounce: 0, duration: 0.6 }, initial: { height: loading ? loadingHeight : 'auto' }, animate: { height: loading ? loadingHeight : 'auto' }, size: size || 'md', onClick: handleModalClick, "data-testid": 'modal' },
|
|
93
|
+
React.createElement(ModalOuter, { transition: { type: 'spring', bounce: 0, duration: 0.6 }, initial: { height: loading ? loadingHeight : 'auto' }, animate: { height: loading ? loadingHeight : 'auto' }, size: size || 'md', onClick: handleModalClick, "data-testid": dataTestId || 'modal' },
|
|
94
94
|
!loading && children,
|
|
95
95
|
loading && (React.createElement(SpinnerContainer, null,
|
|
96
96
|
React.createElement(Loader, null))))))))), document.body);
|
|
@@ -39,6 +39,12 @@ export const OptionsPopper = ({ referenceElement, options, onSelect, onClose })
|
|
|
39
39
|
document.removeEventListener('mouseup', handleGlobalClick);
|
|
40
40
|
};
|
|
41
41
|
}, [handleGlobalClick, popperElement]);
|
|
42
|
-
return ReactDOM.createPortal(React.createElement("div", { "data-testid": 'options-popper', ref: setPopperElement, style: {
|
|
42
|
+
return ReactDOM.createPortal(React.createElement("div", { "data-testid": 'options-popper', ref: setPopperElement, style: {
|
|
43
|
+
...styles.popper,
|
|
44
|
+
zIndex: 999,
|
|
45
|
+
width: referenceElement?.offsetWidth,
|
|
46
|
+
maxHeight: '270px',
|
|
47
|
+
overflowY: 'auto',
|
|
48
|
+
}, ...attributes.popper },
|
|
43
49
|
React.createElement(SelectOptions, { options: options, onSelect: onSelect })), document.querySelector('body'));
|
|
44
50
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dtdot/lego",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-26",
|
|
4
4
|
"description": "Some reusable components for building my applications",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "tsc",
|
|
8
8
|
"start": "start-storybook -p 6006 --no-open",
|
|
9
9
|
"watch": "npm run build -- --watch",
|
|
10
|
-
"lint": "eslint
|
|
10
|
+
"lint": "eslint src",
|
|
11
11
|
"storybook": "start-storybook -p 6006",
|
|
12
12
|
"build-storybook": "build-storybook",
|
|
13
13
|
"pretty": "prettier --write \"./**/*.{js,jsx,ts,tsx,json}\""
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@babel/core": "^7.20.7",
|
|
23
23
|
"@babel/preset-react": "^7.18.6",
|
|
24
24
|
"@babel/preset-typescript": "^7.18.6",
|
|
25
|
-
"@dtdot/eslint-config": "^0.0.
|
|
25
|
+
"@dtdot/eslint-config": "^0.0.9-15",
|
|
26
26
|
"@storybook/addon-actions": "^6.5.15",
|
|
27
27
|
"@storybook/addon-essentials": "^6.5.15",
|
|
28
28
|
"@storybook/addon-interactions": "^6.5.15",
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
"@storybook/manager-webpack5": "^6.5.15",
|
|
32
32
|
"@storybook/react": "^6.5.15",
|
|
33
33
|
"@storybook/testing-library": "^0.0.13",
|
|
34
|
-
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
|
|
35
34
|
"@types/identicon.js": "^2.3.1",
|
|
36
35
|
"@types/qrcode": "^1.5.0",
|
|
37
36
|
"@types/react": "^18.0.26",
|
|
@@ -40,15 +39,9 @@
|
|
|
40
39
|
"@types/styled-components": "^5.1.26",
|
|
41
40
|
"@types/tinycolor2": "^1.4.3",
|
|
42
41
|
"@types/uuid": "^9.0.0",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
|
44
|
-
"@typescript-eslint/parser": "^5.47.0",
|
|
45
42
|
"babel-loader": "^9.1.0",
|
|
46
|
-
"eslint": "^8.
|
|
47
|
-
"
|
|
48
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
49
|
-
"eslint-plugin-react": "^7.31.11",
|
|
50
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
51
|
-
"prettier": "^2.8.1",
|
|
43
|
+
"eslint": "^8.57.0",
|
|
44
|
+
"prettier": "^3.2.5",
|
|
52
45
|
"react": "^18.2.0",
|
|
53
46
|
"react-dom": "^18.2.0",
|
|
54
47
|
"styled-components": "^5.3.5",
|