venice-ui 2.3.1 → 2.3.4
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/dist/cjs/components/Input/Input.js +11 -4
- package/dist/cjs/components/Section/Section.js +4 -4
- package/dist/cjs/components/Section/Section.styles.js +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.styles.js +1 -1
- package/dist/esm/components/Input/Input.js +12 -5
- package/dist/esm/components/Section/Section.js +4 -4
- package/dist/esm/components/Section/Section.styles.js +1 -0
- package/dist/esm/components/Tooltip/Tooltip.styles.js +1 -1
- package/dist/types/components/Section/Section.d.ts +2 -1
- package/dist/types/components/Section/Section.styles.d.ts +1 -0
- package/package.json +1 -1
|
@@ -39,17 +39,23 @@ const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disab
|
|
|
39
39
|
? numberValue
|
|
40
40
|
: parseFloat(numberValue);
|
|
41
41
|
};
|
|
42
|
-
const
|
|
43
|
-
handleChange(
|
|
44
|
-
}, 300)
|
|
42
|
+
const debouncedRef = (0, react_1.useRef)((0, lodash_1.debounce)((n, v) => {
|
|
43
|
+
handleChange(n, v);
|
|
44
|
+
}, 300));
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
return () => {
|
|
47
|
+
debouncedRef.current.flush();
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
45
50
|
const onChange = (e) => {
|
|
46
51
|
let returnedValue = type === 'number' || type === 'increase'
|
|
47
52
|
? calculateNumberValue(e.target.value)
|
|
48
53
|
: e.target.value.toString();
|
|
49
54
|
setInputValue(returnedValue);
|
|
50
|
-
|
|
55
|
+
debouncedRef.current(name, returnedValue);
|
|
51
56
|
};
|
|
52
57
|
const onBlurValidation = () => {
|
|
58
|
+
debouncedRef.current.flush();
|
|
53
59
|
if (type === 'number' || type === 'increase') {
|
|
54
60
|
let validateValue = inputValue;
|
|
55
61
|
if (isNaN(parseFloat(validateValue.toString()))) {
|
|
@@ -68,6 +74,7 @@ const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disab
|
|
|
68
74
|
};
|
|
69
75
|
const onKeyDown = (e) => {
|
|
70
76
|
if (handleSubmit && e.key === 'Enter') {
|
|
77
|
+
debouncedRef.current.flush();
|
|
71
78
|
handleSubmit();
|
|
72
79
|
}
|
|
73
80
|
};
|
|
@@ -9,11 +9,11 @@ const react_1 = __importDefault(require("react"));
|
|
|
9
9
|
const Section_styles_1 = require("./Section.styles");
|
|
10
10
|
const Theme_1 = require("../../Theme");
|
|
11
11
|
const Button_1 = require("../Button");
|
|
12
|
-
const Section = ({ title, children, titlePosition = 'left',
|
|
13
|
-
return (react_1.default.createElement(Section_styles_1.SectionElement, { backgroundColor: backgroundColor },
|
|
14
|
-
title && (react_1.default.createElement(Section_styles_1.SectionTitle, { titlePosition: titlePosition, noPadding:
|
|
12
|
+
const Section = ({ title, children, titlePosition = 'left', noHorizontalPadding = false, noTopPadding = false, theme = Theme_1.mainTheme, backgroundColor = theme.contentBackground, action, actionLabel = 'action', }) => {
|
|
13
|
+
return (react_1.default.createElement(Section_styles_1.SectionElement, { backgroundColor: backgroundColor, noTopPadding: noTopPadding },
|
|
14
|
+
title && (react_1.default.createElement(Section_styles_1.SectionTitle, { titlePosition: titlePosition, noPadding: noHorizontalPadding, withAction: titlePosition === 'left' && !!action },
|
|
15
15
|
react_1.default.createElement(Typography_1.TextSubHeader, null, title),
|
|
16
16
|
titlePosition === 'left' && !!action && (react_1.default.createElement(Button_1.Button, { text: actionLabel, onClick: action, size: "small", mode: "secondary" })))),
|
|
17
|
-
react_1.default.createElement(Section_styles_1.SectionContent, { noPadding:
|
|
17
|
+
react_1.default.createElement(Section_styles_1.SectionContent, { noPadding: noHorizontalPadding }, children)));
|
|
18
18
|
};
|
|
19
19
|
exports.Section = Section;
|
|
@@ -12,6 +12,7 @@ exports.SectionElement = styled_components_1.default.div `
|
|
|
12
12
|
overflow: auto;
|
|
13
13
|
padding: ${Theme_1.Theme.padding.l} 0;
|
|
14
14
|
background-color: ${(p) => p.backgroundColor};
|
|
15
|
+
${(p) => p.noTopPadding && `padding-top: 0;`}
|
|
15
16
|
`;
|
|
16
17
|
exports.SectionTitle = styled_components_1.default.div `
|
|
17
18
|
width: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { ThemeProvider } from 'styled-components';
|
|
3
3
|
import { Aligment } from '../Aligment';
|
|
4
4
|
import { InputTextElement, InputLabelElement, InputErrorMsg, InputWrapper, EyeIconWrapper, IconsWrapper, InputReadOnlyElement, Prefix, } from './Input.styles';
|
|
@@ -13,17 +13,23 @@ export const Input = ({ label, labelPosition = 'top', value, type = 'text', name
|
|
|
13
13
|
? numberValue
|
|
14
14
|
: parseFloat(numberValue);
|
|
15
15
|
};
|
|
16
|
-
const
|
|
17
|
-
handleChange(
|
|
18
|
-
}, 300)
|
|
16
|
+
const debouncedRef = useRef(debounce((n, v) => {
|
|
17
|
+
handleChange(n, v);
|
|
18
|
+
}, 300));
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
return () => {
|
|
21
|
+
debouncedRef.current.flush();
|
|
22
|
+
};
|
|
23
|
+
}, []);
|
|
19
24
|
const onChange = (e) => {
|
|
20
25
|
let returnedValue = type === 'number' || type === 'increase'
|
|
21
26
|
? calculateNumberValue(e.target.value)
|
|
22
27
|
: e.target.value.toString();
|
|
23
28
|
setInputValue(returnedValue);
|
|
24
|
-
|
|
29
|
+
debouncedRef.current(name, returnedValue);
|
|
25
30
|
};
|
|
26
31
|
const onBlurValidation = () => {
|
|
32
|
+
debouncedRef.current.flush();
|
|
27
33
|
if (type === 'number' || type === 'increase') {
|
|
28
34
|
let validateValue = inputValue;
|
|
29
35
|
if (isNaN(parseFloat(validateValue.toString()))) {
|
|
@@ -42,6 +48,7 @@ export const Input = ({ label, labelPosition = 'top', value, type = 'text', name
|
|
|
42
48
|
};
|
|
43
49
|
const onKeyDown = (e) => {
|
|
44
50
|
if (handleSubmit && e.key === 'Enter') {
|
|
51
|
+
debouncedRef.current.flush();
|
|
45
52
|
handleSubmit();
|
|
46
53
|
}
|
|
47
54
|
};
|
|
@@ -3,10 +3,10 @@ import React from 'react';
|
|
|
3
3
|
import { SectionElement, SectionTitle, SectionContent } from './Section.styles';
|
|
4
4
|
import { mainTheme } from '../../Theme';
|
|
5
5
|
import { Button } from '../Button';
|
|
6
|
-
export const Section = ({ title, children, titlePosition = 'left',
|
|
7
|
-
return (React.createElement(SectionElement, { backgroundColor: backgroundColor },
|
|
8
|
-
title && (React.createElement(SectionTitle, { titlePosition: titlePosition, noPadding:
|
|
6
|
+
export const Section = ({ title, children, titlePosition = 'left', noHorizontalPadding = false, noTopPadding = false, theme = mainTheme, backgroundColor = theme.contentBackground, action, actionLabel = 'action', }) => {
|
|
7
|
+
return (React.createElement(SectionElement, { backgroundColor: backgroundColor, noTopPadding: noTopPadding },
|
|
8
|
+
title && (React.createElement(SectionTitle, { titlePosition: titlePosition, noPadding: noHorizontalPadding, withAction: titlePosition === 'left' && !!action },
|
|
9
9
|
React.createElement(TextSubHeader, null, title),
|
|
10
10
|
titlePosition === 'left' && !!action && (React.createElement(Button, { text: actionLabel, onClick: action, size: "small", mode: "secondary" })))),
|
|
11
|
-
React.createElement(SectionContent, { noPadding:
|
|
11
|
+
React.createElement(SectionContent, { noPadding: noHorizontalPadding }, children)));
|
|
12
12
|
};
|
|
@@ -3,7 +3,8 @@ import { TitlePosition } from '../../types';
|
|
|
3
3
|
export interface ISectionProps {
|
|
4
4
|
title?: string;
|
|
5
5
|
titlePosition?: TitlePosition;
|
|
6
|
-
|
|
6
|
+
noHorizontalPadding?: boolean;
|
|
7
|
+
noTopPadding?: boolean;
|
|
7
8
|
backgroundColor?: string;
|
|
8
9
|
children: React.ReactNode;
|
|
9
10
|
theme?: any;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TitlePosition } from '../../types';
|
|
2
2
|
interface ISectionStyles {
|
|
3
3
|
backgroundColor: string;
|
|
4
|
+
noTopPadding?: boolean;
|
|
4
5
|
}
|
|
5
6
|
export declare const SectionElement: import("styled-components").StyledComponent<"div", any, ISectionStyles, never>;
|
|
6
7
|
interface ISectionTitleStyle {
|