venice-ui 2.0.9 → 2.0.11
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/ButtonsFooter/ButtonsFooter.js +2 -2
- package/dist/cjs/components/Form/Form.js +3 -0
- package/dist/cjs/components/Modal/Modal.js +2 -2
- package/dist/esm/components/ButtonsFooter/ButtonsFooter.js +2 -2
- package/dist/esm/components/Form/Form.js +3 -0
- package/dist/esm/components/Modal/Modal.js +2 -2
- package/dist/types/components/ButtonsFooter/ButtonsFooter.d.ts +1 -0
- package/dist/types/components/Form/formTypes.d.ts +2 -0
- package/dist/types/components/Modal/Modal.d.ts +1 -0
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ const Button_1 = require("../Button");
|
|
|
10
10
|
const Aligment_1 = require("../Aligment");
|
|
11
11
|
const ButtonsFooter_style_1 = require("./ButtonsFooter.style");
|
|
12
12
|
const Toogle_1 = require("../Toogle");
|
|
13
|
-
const ButtonsFooter = ({ handleConfirm, handleClose, handleAdditional, labelConfirm = 'Confirm', labelClose = 'Close', labelAdditional, submitDisabled, submitLoader, backgroundColor = 'transparent', additionalType = 'button', additionalValue = false, }) => {
|
|
13
|
+
const ButtonsFooter = ({ handleConfirm, handleClose, handleAdditional, labelConfirm = 'Confirm', labelClose = 'Close', labelAdditional, submitDisabled, submitLoader, backgroundColor = 'transparent', additionalType = 'button', additionalValue = false, additionaNormalMode = false, }) => {
|
|
14
14
|
const isAdditional = () => {
|
|
15
15
|
return labelAdditional !== undefined && handleAdditional !== undefined;
|
|
16
16
|
};
|
|
@@ -29,7 +29,7 @@ const ButtonsFooter = ({ handleConfirm, handleClose, handleAdditional, labelConf
|
|
|
29
29
|
};
|
|
30
30
|
return (react_1.default.createElement(Aligment_1.Aligment, { justify: isAdditional() ? 'space-between' : 'flex-end', vPadding: Theme_1.Theme.padding.l, hPadding: Theme_1.Theme.padding.l, backgroundColor: backgroundColor },
|
|
31
31
|
labelAdditional && handleAdditional && (react_1.default.createElement(ButtonsFooter_style_1.ButtonsFooterGroup, null, !submitLoader && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
32
|
-
additionalType === 'button' && (react_1.default.createElement(Button_1.Button, { errorVariant:
|
|
32
|
+
additionalType === 'button' && (react_1.default.createElement(Button_1.Button, { errorVariant: !additionaNormalMode, mode: 'secondary', onClick: additionAction, text: labelAdditional, left: isMultiButtons() })),
|
|
33
33
|
additionalType === 'toogle' && (react_1.default.createElement(Toogle_1.Toogle, { label: labelAdditional, value: additionalValue, handleClick: additionAction, labelPosition: "left", size: "medium" })))))),
|
|
34
34
|
react_1.default.createElement(ButtonsFooter_style_1.ButtonsFooterGroup, null,
|
|
35
35
|
!submitLoader && (react_1.default.createElement(Button_1.Button, { mode: isMultiButtons() ? 'secondary' : 'primary', onClick: () => handleClose(), text: labelClose, left: isMultiButtons() })),
|
|
@@ -8,6 +8,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const Input_1 = require("../Input");
|
|
9
9
|
const File_1 = require("../File");
|
|
10
10
|
const FormElements_1 = require("./FormElements");
|
|
11
|
+
const Dropdown_1 = require("../Dropdown");
|
|
11
12
|
const Form = ({ formData, size = 'medium', read }) => {
|
|
12
13
|
const onChangeHandler = (name, value) => {
|
|
13
14
|
formData.action(name, value);
|
|
@@ -43,6 +44,8 @@ const Form = ({ formData, size = 'medium', read }) => {
|
|
|
43
44
|
return (react_1.default.createElement(Input_1.Input, { label: item.label, value: item.value, name: item.name, type: "number", size: size, min: item.min, max: item.max, step: item.step, handleChange: onIntChangeHandler, readOnly: read, autoFocus: item.autofocus, handleSubmit: item.submit }));
|
|
44
45
|
case 'increase':
|
|
45
46
|
return (react_1.default.createElement(Input_1.Input, { type: "increase", label: item.label, value: item.value, name: item.name, size: size, handleChange: onIntChangeHandler, min: item.min, max: item.max, step: item.step, readOnly: read, autoFocus: item.autofocus, handleSubmit: item.submit }));
|
|
47
|
+
case 'select':
|
|
48
|
+
return (react_1.default.createElement(Dropdown_1.Dropdown, { options: item.options, handleSelect: onChangeHandler, name: item.name, value: item.value, size: size, label: item.label }));
|
|
46
49
|
case 'file':
|
|
47
50
|
return (react_1.default.createElement(File_1.File, { label: item.label, fileValue: item.value, name: item.name, size: size, handleChange: onFileHandler, readOnly: read }));
|
|
48
51
|
}
|
|
@@ -11,12 +11,12 @@ const common_1 = require("../common");
|
|
|
11
11
|
const Modal_styles_1 = require("./Modal.styles");
|
|
12
12
|
const styled_components_1 = require("styled-components");
|
|
13
13
|
const ButtonsFooter_1 = require("../ButtonsFooter");
|
|
14
|
-
const Modal = ({ theme = Theme_1.mainTheme, children, title, handleConfirm, handleClose, handleAdditional, labelConfirm
|
|
14
|
+
const Modal = ({ theme = Theme_1.mainTheme, children, title, handleConfirm, handleClose, handleAdditional, labelConfirm, labelClose = 'Cancel', labelAdditional, submitDisabled, size = 'small', submitLoader = false, additionalType = 'button', additionalValue = false, headerDivader = false, additionaNormalMode = false }) => {
|
|
15
15
|
return (react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme },
|
|
16
16
|
react_1.default.createElement(Modal_styles_1.ModalOverlayer, null,
|
|
17
17
|
react_1.default.createElement(Modal_styles_1.ModalElement, { size: size },
|
|
18
18
|
react_1.default.createElement(ElementHeader_1.ElementHeader, { title: title, handleClose: handleClose, bottomDivader: headerDivader }),
|
|
19
19
|
react_1.default.createElement(common_1.ScrollCotainer, null, children),
|
|
20
|
-
react_1.default.createElement(ButtonsFooter_1.ButtonsFooter, { handleConfirm: handleConfirm, handleClose: handleClose, handleAdditional: handleAdditional, labelConfirm: labelConfirm, labelClose: labelClose, labelAdditional: labelAdditional, submitDisabled: submitDisabled, submitLoader: submitLoader, additionalType: additionalType, additionalValue: additionalValue })))));
|
|
20
|
+
react_1.default.createElement(ButtonsFooter_1.ButtonsFooter, { handleConfirm: handleConfirm, handleClose: handleClose, handleAdditional: handleAdditional, labelConfirm: labelConfirm, labelClose: labelClose, labelAdditional: labelAdditional, submitDisabled: submitDisabled, submitLoader: submitLoader, additionalType: additionalType, additionalValue: additionalValue, additionaNormalMode: additionaNormalMode })))));
|
|
21
21
|
};
|
|
22
22
|
exports.Modal = Modal;
|
|
@@ -4,7 +4,7 @@ import { Button } from '../Button';
|
|
|
4
4
|
import { Aligment } from '../Aligment';
|
|
5
5
|
import { ButtonsFooterGroup } from './ButtonsFooter.style';
|
|
6
6
|
import { Toogle } from '../Toogle';
|
|
7
|
-
export const ButtonsFooter = ({ handleConfirm, handleClose, handleAdditional, labelConfirm = 'Confirm', labelClose = 'Close', labelAdditional, submitDisabled, submitLoader, backgroundColor = 'transparent', additionalType = 'button', additionalValue = false, }) => {
|
|
7
|
+
export const ButtonsFooter = ({ handleConfirm, handleClose, handleAdditional, labelConfirm = 'Confirm', labelClose = 'Close', labelAdditional, submitDisabled, submitLoader, backgroundColor = 'transparent', additionalType = 'button', additionalValue = false, additionaNormalMode = false, }) => {
|
|
8
8
|
const isAdditional = () => {
|
|
9
9
|
return labelAdditional !== undefined && handleAdditional !== undefined;
|
|
10
10
|
};
|
|
@@ -23,7 +23,7 @@ export const ButtonsFooter = ({ handleConfirm, handleClose, handleAdditional, la
|
|
|
23
23
|
};
|
|
24
24
|
return (React.createElement(Aligment, { justify: isAdditional() ? 'space-between' : 'flex-end', vPadding: Theme.padding.l, hPadding: Theme.padding.l, backgroundColor: backgroundColor },
|
|
25
25
|
labelAdditional && handleAdditional && (React.createElement(ButtonsFooterGroup, null, !submitLoader && (React.createElement(React.Fragment, null,
|
|
26
|
-
additionalType === 'button' && (React.createElement(Button, { errorVariant:
|
|
26
|
+
additionalType === 'button' && (React.createElement(Button, { errorVariant: !additionaNormalMode, mode: 'secondary', onClick: additionAction, text: labelAdditional, left: isMultiButtons() })),
|
|
27
27
|
additionalType === 'toogle' && (React.createElement(Toogle, { label: labelAdditional, value: additionalValue, handleClick: additionAction, labelPosition: "left", size: "medium" })))))),
|
|
28
28
|
React.createElement(ButtonsFooterGroup, null,
|
|
29
29
|
!submitLoader && (React.createElement(Button, { mode: isMultiButtons() ? 'secondary' : 'primary', onClick: () => handleClose(), text: labelClose, left: isMultiButtons() })),
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Input } from '../Input';
|
|
3
3
|
import { File } from '../File';
|
|
4
4
|
import { FormRow, FormSubRow, FormWrapper } from './FormElements';
|
|
5
|
+
import { Dropdown } from '../Dropdown';
|
|
5
6
|
export const Form = ({ formData, size = 'medium', read }) => {
|
|
6
7
|
const onChangeHandler = (name, value) => {
|
|
7
8
|
formData.action(name, value);
|
|
@@ -37,6 +38,8 @@ export const Form = ({ formData, size = 'medium', read }) => {
|
|
|
37
38
|
return (React.createElement(Input, { label: item.label, value: item.value, name: item.name, type: "number", size: size, min: item.min, max: item.max, step: item.step, handleChange: onIntChangeHandler, readOnly: read, autoFocus: item.autofocus, handleSubmit: item.submit }));
|
|
38
39
|
case 'increase':
|
|
39
40
|
return (React.createElement(Input, { type: "increase", label: item.label, value: item.value, name: item.name, size: size, handleChange: onIntChangeHandler, min: item.min, max: item.max, step: item.step, readOnly: read, autoFocus: item.autofocus, handleSubmit: item.submit }));
|
|
41
|
+
case 'select':
|
|
42
|
+
return (React.createElement(Dropdown, { options: item.options, handleSelect: onChangeHandler, name: item.name, value: item.value, size: size, label: item.label }));
|
|
40
43
|
case 'file':
|
|
41
44
|
return (React.createElement(File, { label: item.label, fileValue: item.value, name: item.name, size: size, handleChange: onFileHandler, readOnly: read }));
|
|
42
45
|
}
|
|
@@ -5,11 +5,11 @@ import { ScrollCotainer } from '../common';
|
|
|
5
5
|
import { ModalElement, ModalOverlayer } from './Modal.styles';
|
|
6
6
|
import { ThemeProvider } from 'styled-components';
|
|
7
7
|
import { ButtonsFooter } from '../ButtonsFooter';
|
|
8
|
-
export const Modal = ({ theme = mainTheme, children, title, handleConfirm, handleClose, handleAdditional, labelConfirm
|
|
8
|
+
export const Modal = ({ theme = mainTheme, children, title, handleConfirm, handleClose, handleAdditional, labelConfirm, labelClose = 'Cancel', labelAdditional, submitDisabled, size = 'small', submitLoader = false, additionalType = 'button', additionalValue = false, headerDivader = false, additionaNormalMode = false }) => {
|
|
9
9
|
return (React.createElement(ThemeProvider, { theme: theme },
|
|
10
10
|
React.createElement(ModalOverlayer, null,
|
|
11
11
|
React.createElement(ModalElement, { size: size },
|
|
12
12
|
React.createElement(ElementHeader, { title: title, handleClose: handleClose, bottomDivader: headerDivader }),
|
|
13
13
|
React.createElement(ScrollCotainer, null, children),
|
|
14
|
-
React.createElement(ButtonsFooter, { handleConfirm: handleConfirm, handleClose: handleClose, handleAdditional: handleAdditional, labelConfirm: labelConfirm, labelClose: labelClose, labelAdditional: labelAdditional, submitDisabled: submitDisabled, submitLoader: submitLoader, additionalType: additionalType, additionalValue: additionalValue })))));
|
|
14
|
+
React.createElement(ButtonsFooter, { handleConfirm: handleConfirm, handleClose: handleClose, handleAdditional: handleAdditional, labelConfirm: labelConfirm, labelClose: labelClose, labelAdditional: labelAdditional, submitDisabled: submitDisabled, submitLoader: submitLoader, additionalType: additionalType, additionalValue: additionalValue, additionaNormalMode: additionaNormalMode })))));
|
|
15
15
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IOption } from './../../types';
|
|
1
2
|
export interface FormDataProps {
|
|
2
3
|
type: string;
|
|
3
4
|
label: string;
|
|
@@ -6,6 +7,7 @@ export interface FormDataProps {
|
|
|
6
7
|
min?: number;
|
|
7
8
|
max?: number;
|
|
8
9
|
step?: number;
|
|
10
|
+
options?: IOption[];
|
|
9
11
|
autofocus?: boolean;
|
|
10
12
|
submit?: () => void;
|
|
11
13
|
}
|