venice-ui 1.5.3 → 1.6.1
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/Theme/Theme.js +3 -0
- package/dist/cjs/components/ButtonsFooter/ButtonsFooter.js +15 -2
- package/dist/cjs/components/Modal/Modal.js +2 -2
- package/dist/cjs/components/Toogle/Toogle.js +22 -0
- package/dist/cjs/components/Toogle/Toogle.styles.js +42 -0
- package/dist/cjs/components/Toogle/index.js +17 -0
- package/dist/cjs/components/common/inputStyles.js +17 -2
- package/dist/cjs/index.js +1 -0
- package/dist/esm/Theme/Theme.js +3 -0
- package/dist/esm/components/ButtonsFooter/ButtonsFooter.js +15 -2
- package/dist/esm/components/Modal/Modal.js +2 -2
- package/dist/esm/components/Toogle/Toogle.js +15 -0
- package/dist/esm/components/Toogle/Toogle.styles.js +36 -0
- package/dist/esm/components/Toogle/index.js +1 -0
- package/dist/esm/components/common/inputStyles.js +15 -1
- package/dist/esm/index.js +1 -0
- package/dist/types/Theme/Theme.d.ts +2 -0
- package/dist/types/components/ButtonsFooter/ButtonsFooter.d.ts +3 -1
- package/dist/types/components/Modal/Modal.d.ts +3 -1
- package/dist/types/components/Toogle/Toogle.d.ts +15 -0
- package/dist/types/components/Toogle/Toogle.styles.d.ts +16 -0
- package/dist/types/components/Toogle/index.d.ts +1 -0
- package/dist/types/components/common/inputStyles.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/Theme/Theme.js
CHANGED
|
@@ -110,4 +110,7 @@ exports.mainTheme = {
|
|
|
110
110
|
chipsNeutralBackground: exports.Theme.colors.primary,
|
|
111
111
|
chipsNeutralTextColor: exports.Theme.colors.white,
|
|
112
112
|
chipsNeutralHoverBackground: (0, polished_1.lighten)(0.1, exports.Theme.colors.primary),
|
|
113
|
+
//toogle
|
|
114
|
+
toogleBackgrund: exports.Theme.colors.gray_3,
|
|
115
|
+
toogleActiveBackgorund: exports.Theme.colors.primary_40,
|
|
113
116
|
};
|
|
@@ -9,15 +9,28 @@ const Theme_1 = require("../../Theme/Theme");
|
|
|
9
9
|
const Button_1 = require("../Button");
|
|
10
10
|
const Aligment_1 = require("../Aligment");
|
|
11
11
|
const ButtonsFooter_style_1 = require("./ButtonsFooter.style");
|
|
12
|
-
const
|
|
12
|
+
const Toogle_1 = require("../Toogle");
|
|
13
|
+
const ButtonsFooter = ({ handleConfirm, handleClose, handleAdditional, labelConfirm = 'Confirm', labelClose = 'Close', labelAdditional = 'Reset', submitDisabled, submitLoader, backgroundColor = 'transparent', additionalType = 'button', additionalValue = false, }) => {
|
|
13
14
|
const isAdditional = () => {
|
|
14
15
|
return labelAdditional !== undefined && handleAdditional !== undefined;
|
|
15
16
|
};
|
|
16
17
|
const isMultiButtons = () => {
|
|
17
18
|
return handleConfirm !== undefined && labelConfirm !== undefined;
|
|
18
19
|
};
|
|
20
|
+
const additionAction = () => {
|
|
21
|
+
if (handleAdditional) {
|
|
22
|
+
if (additionalType === 'toogle' && additionalValue) {
|
|
23
|
+
handleAdditional(!additionalValue);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
handleAdditional();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
19
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 },
|
|
20
|
-
labelAdditional && handleAdditional && (react_1.default.createElement(ButtonsFooter_style_1.ButtonsFooterGroup, null, !submitLoader && (react_1.default.createElement(
|
|
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, { mode: 'inverse', onClick: additionAction, text: labelAdditional, left: isMultiButtons() })),
|
|
33
|
+
additionalType === 'toogle' && (react_1.default.createElement(Toogle_1.Toogle, { label: labelAdditional, value: additionalValue, handleClick: additionAction, labelPosition: "left", size: "medium" })))))),
|
|
21
34
|
react_1.default.createElement(ButtonsFooter_style_1.ButtonsFooterGroup, null,
|
|
22
35
|
!submitLoader && (react_1.default.createElement(Button_1.Button, { mode: isMultiButtons() ? 'secondary' : 'primary', onClick: () => handleClose(), text: labelClose, left: isMultiButtons() })),
|
|
23
36
|
handleConfirm && labelConfirm && (react_1.default.createElement(Button_1.Button, { onClick: handleConfirm, text: labelConfirm, disabled: submitDisabled, loader: submitLoader })))));
|
|
@@ -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 = 'Save', labelClose = 'Cancel', labelAdditional = 'Reset', submitDisabled, size = 'small', submitLoader = false, }) => {
|
|
14
|
+
const Modal = ({ theme = Theme_1.mainTheme, children, title, handleConfirm, handleClose, handleAdditional, labelConfirm = 'Save', labelClose = 'Cancel', labelAdditional = 'Reset', submitDisabled, size = 'small', submitLoader = false, additionalType = 'button', additionalValue = 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 }),
|
|
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 })))));
|
|
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 })))));
|
|
21
21
|
};
|
|
22
22
|
exports.Modal = Modal;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Toogle = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const Theme_1 = require("../../Theme/Theme");
|
|
9
|
+
const styled_components_1 = require("styled-components");
|
|
10
|
+
const Aligment_1 = require("../Aligment");
|
|
11
|
+
const Input_1 = require("../Input");
|
|
12
|
+
const Toogle_styles_1 = require("./Toogle.styles");
|
|
13
|
+
const Toogle = ({ theme = Theme_1.mainTheme, label, labelPosition = 'top', value = false, readOnly = false, name, size = 'medium', width = 'auto', handleClick, }) => {
|
|
14
|
+
return (react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme },
|
|
15
|
+
react_1.default.createElement(Aligment_1.Aligment, { align: labelPosition === 'top' ? 'flex-start' : 'center', justify: labelPosition === 'top' ? 'center' : 'flex-start', direction: labelPosition === 'top' ? 'column' : 'row', wrap: 'nowrap', width: width },
|
|
16
|
+
label && (react_1.default.createElement(Input_1.InputLabelElement, { size: size, labelPosition: labelPosition }, label)),
|
|
17
|
+
react_1.default.createElement(Input_1.InputWrapper, { width: width },
|
|
18
|
+
react_1.default.createElement(Toogle_styles_1.ToogleElementWrapper, { size: size },
|
|
19
|
+
react_1.default.createElement(Toogle_styles_1.ToogleElement, { size: size, active: value, onClick: () => handleClick(!value) },
|
|
20
|
+
react_1.default.createElement(Toogle_styles_1.ToogleElementPoint, { size: size, active: value })))))));
|
|
21
|
+
};
|
|
22
|
+
exports.Toogle = Toogle;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ToogleElement = exports.ToogleElementPoint = exports.ToogleElementWrapper = void 0;
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
exports.ToogleElementWrapper = styled_components_1.default.div `
|
|
10
|
+
${(p) => (0, common_1.setToogleSize)(p.size)}
|
|
11
|
+
`;
|
|
12
|
+
exports.ToogleElementPoint = styled_components_1.default.div `
|
|
13
|
+
background-color: ${(p) => p.theme.inputDefaultBackground};
|
|
14
|
+
width: 20px;
|
|
15
|
+
height: 20px;
|
|
16
|
+
border-radius: 50%;
|
|
17
|
+
top: 0px;
|
|
18
|
+
height: 22px;
|
|
19
|
+
width: 22px;
|
|
20
|
+
transition: 300ms;
|
|
21
|
+
position: absolute;
|
|
22
|
+
${(p) => p.active && `left:0px;`}
|
|
23
|
+
${(p) => !p.active && `right:0px;`}
|
|
24
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
|
25
|
+
`;
|
|
26
|
+
exports.ToogleElement = styled_components_1.default.div `
|
|
27
|
+
position: relative;
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
background-color: ${(p) => p.active ? p.theme.toogleActiveBackgorund : p.theme.toogleBackgrund};
|
|
30
|
+
border: 1px solid ${(p) => p.theme.inputDefaultBorder};
|
|
31
|
+
font-family: 'Lato', sans-serif;
|
|
32
|
+
outline: 0;
|
|
33
|
+
white-space: nowrap;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12),
|
|
38
|
+
inset 0 1px 2px rgba(0, 0, 0, 0.24);
|
|
39
|
+
height: 24px;
|
|
40
|
+
width: 40px;
|
|
41
|
+
border-radius: 12px;
|
|
42
|
+
`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Toogle"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setAnimationParams = exports.animationParams = exports.setFieldHeight = exports.fieldHeight = exports.setPanelPosition = exports.panelPosition = exports.setPanelTop = exports.panelTop = exports.setIconSize = exports.iconSize = exports.setLabelFontSize = exports.lableFontSize = exports.inputColorSchema = exports.setEyeTopPosition = exports.setButtonLoaderSize = exports.setButtonSize = exports.setHeight = exports.setSize = exports.eyeTopPosition = exports.buttonLoaderHeight = exports.buttonLoaderPadding = exports.buttonPadding = exports.inputPadding = exports.height = exports.sizes = exports.defaultStyles = void 0;
|
|
3
|
+
exports.setAnimationParams = exports.animationParams = exports.setFieldHeight = exports.fieldHeight = exports.setPanelPosition = exports.panelPosition = exports.setPanelTop = exports.panelTop = exports.setIconSize = exports.iconSize = exports.setLabelFontSize = exports.lableFontSize = exports.inputColorSchema = exports.setEyeTopPosition = exports.setButtonLoaderSize = exports.setToogleSize = exports.setButtonSize = exports.setHeight = exports.setSize = exports.eyeTopPosition = exports.buttonLoaderHeight = exports.buttonLoaderPadding = exports.buttonPadding = exports.inputPadding = exports.toogleSize = exports.height = exports.sizes = exports.defaultStyles = void 0;
|
|
4
4
|
const polished_1 = require("polished");
|
|
5
5
|
const Theme_1 = require("../../Theme");
|
|
6
6
|
exports.defaultStyles = `
|
|
@@ -39,7 +39,18 @@ exports.height = {
|
|
|
39
39
|
|
|
40
40
|
`,
|
|
41
41
|
large: `
|
|
42
|
-
|
|
42
|
+
height: calc( ${Theme_1.Theme.lineHeight.l} + 2 * (${Theme_1.Theme.padding.m}) + 2px);
|
|
43
|
+
`,
|
|
44
|
+
};
|
|
45
|
+
exports.toogleSize = {
|
|
46
|
+
small: `
|
|
47
|
+
padding:1px 0px;
|
|
48
|
+
`,
|
|
49
|
+
medium: `
|
|
50
|
+
padding:7px 0px;
|
|
51
|
+
`,
|
|
52
|
+
large: `
|
|
53
|
+
padding:10px 0px;
|
|
43
54
|
`,
|
|
44
55
|
};
|
|
45
56
|
exports.inputPadding = {
|
|
@@ -99,6 +110,10 @@ const setButtonSize = (size, loader) => {
|
|
|
99
110
|
return (exports.sizes[size] + (loader ? exports.buttonLoaderPadding[size] : exports.buttonPadding[size]));
|
|
100
111
|
};
|
|
101
112
|
exports.setButtonSize = setButtonSize;
|
|
113
|
+
const setToogleSize = (size) => {
|
|
114
|
+
return exports.toogleSize[size];
|
|
115
|
+
};
|
|
116
|
+
exports.setToogleSize = setToogleSize;
|
|
102
117
|
const setButtonLoaderSize = (size) => {
|
|
103
118
|
return exports.buttonLoaderHeight[size];
|
|
104
119
|
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -35,4 +35,5 @@ __exportStar(require("./components/Selector"), exports);
|
|
|
35
35
|
__exportStar(require("./components/Sidepanel"), exports);
|
|
36
36
|
__exportStar(require("./components/Table"), exports);
|
|
37
37
|
__exportStar(require("./components/Tile"), exports);
|
|
38
|
+
__exportStar(require("./components/Toogle"), exports);
|
|
38
39
|
__exportStar(require("./components/Typography"), exports);
|
package/dist/esm/Theme/Theme.js
CHANGED
|
@@ -107,4 +107,7 @@ export const mainTheme = {
|
|
|
107
107
|
chipsNeutralBackground: Theme.colors.primary,
|
|
108
108
|
chipsNeutralTextColor: Theme.colors.white,
|
|
109
109
|
chipsNeutralHoverBackground: lighten(0.1, Theme.colors.primary),
|
|
110
|
+
//toogle
|
|
111
|
+
toogleBackgrund: Theme.colors.gray_3,
|
|
112
|
+
toogleActiveBackgorund: Theme.colors.primary_40,
|
|
110
113
|
};
|
|
@@ -3,15 +3,28 @@ import { Theme } from '../../Theme/Theme';
|
|
|
3
3
|
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 = 'Reset', submitDisabled, submitLoader, backgroundColor = 'transparent', additionalType = 'button', additionalValue = false, }) => {
|
|
7
8
|
const isAdditional = () => {
|
|
8
9
|
return labelAdditional !== undefined && handleAdditional !== undefined;
|
|
9
10
|
};
|
|
10
11
|
const isMultiButtons = () => {
|
|
11
12
|
return handleConfirm !== undefined && labelConfirm !== undefined;
|
|
12
13
|
};
|
|
14
|
+
const additionAction = () => {
|
|
15
|
+
if (handleAdditional) {
|
|
16
|
+
if (additionalType === 'toogle' && additionalValue) {
|
|
17
|
+
handleAdditional(!additionalValue);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
handleAdditional();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
13
24
|
return (React.createElement(Aligment, { justify: isAdditional() ? 'space-between' : 'flex-end', vPadding: Theme.padding.l, hPadding: Theme.padding.l, backgroundColor: backgroundColor },
|
|
14
|
-
labelAdditional && handleAdditional && (React.createElement(ButtonsFooterGroup, null, !submitLoader && (React.createElement(
|
|
25
|
+
labelAdditional && handleAdditional && (React.createElement(ButtonsFooterGroup, null, !submitLoader && (React.createElement(React.Fragment, null,
|
|
26
|
+
additionalType === 'button' && (React.createElement(Button, { mode: 'inverse', onClick: additionAction, text: labelAdditional, left: isMultiButtons() })),
|
|
27
|
+
additionalType === 'toogle' && (React.createElement(Toogle, { label: labelAdditional, value: additionalValue, handleClick: additionAction, labelPosition: "left", size: "medium" })))))),
|
|
15
28
|
React.createElement(ButtonsFooterGroup, null,
|
|
16
29
|
!submitLoader && (React.createElement(Button, { mode: isMultiButtons() ? 'secondary' : 'primary', onClick: () => handleClose(), text: labelClose, left: isMultiButtons() })),
|
|
17
30
|
handleConfirm && labelConfirm && (React.createElement(Button, { onClick: handleConfirm, text: labelConfirm, disabled: submitDisabled, loader: submitLoader })))));
|
|
@@ -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 = 'Save', labelClose = 'Cancel', labelAdditional = 'Reset', submitDisabled, size = 'small', submitLoader = false, }) => {
|
|
8
|
+
export const Modal = ({ theme = mainTheme, children, title, handleConfirm, handleClose, handleAdditional, labelConfirm = 'Save', labelClose = 'Cancel', labelAdditional = 'Reset', submitDisabled, size = 'small', submitLoader = false, additionalType = 'button', additionalValue = 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 }),
|
|
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 })))));
|
|
14
|
+
React.createElement(ButtonsFooter, { handleConfirm: handleConfirm, handleClose: handleClose, handleAdditional: handleAdditional, labelConfirm: labelConfirm, labelClose: labelClose, labelAdditional: labelAdditional, submitDisabled: submitDisabled, submitLoader: submitLoader, additionalType: additionalType, additionalValue: additionalValue })))));
|
|
15
15
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { mainTheme } from '../../Theme/Theme';
|
|
3
|
+
import { ThemeProvider } from 'styled-components';
|
|
4
|
+
import { Aligment } from '../Aligment';
|
|
5
|
+
import { InputLabelElement, InputWrapper } from '../Input';
|
|
6
|
+
import { ToogleElement, ToogleElementPoint, ToogleElementWrapper, } from './Toogle.styles';
|
|
7
|
+
export const Toogle = ({ theme = mainTheme, label, labelPosition = 'top', value = false, readOnly = false, name, size = 'medium', width = 'auto', handleClick, }) => {
|
|
8
|
+
return (React.createElement(ThemeProvider, { theme: theme },
|
|
9
|
+
React.createElement(Aligment, { align: labelPosition === 'top' ? 'flex-start' : 'center', justify: labelPosition === 'top' ? 'center' : 'flex-start', direction: labelPosition === 'top' ? 'column' : 'row', wrap: 'nowrap', width: width },
|
|
10
|
+
label && (React.createElement(InputLabelElement, { size: size, labelPosition: labelPosition }, label)),
|
|
11
|
+
React.createElement(InputWrapper, { width: width },
|
|
12
|
+
React.createElement(ToogleElementWrapper, { size: size },
|
|
13
|
+
React.createElement(ToogleElement, { size: size, active: value, onClick: () => handleClick(!value) },
|
|
14
|
+
React.createElement(ToogleElementPoint, { size: size, active: value })))))));
|
|
15
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { setToogleSize } from '../common';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
export const ToogleElementWrapper = styled.div `
|
|
4
|
+
${(p) => setToogleSize(p.size)}
|
|
5
|
+
`;
|
|
6
|
+
export const ToogleElementPoint = styled.div `
|
|
7
|
+
background-color: ${(p) => p.theme.inputDefaultBackground};
|
|
8
|
+
width: 20px;
|
|
9
|
+
height: 20px;
|
|
10
|
+
border-radius: 50%;
|
|
11
|
+
top: 0px;
|
|
12
|
+
height: 22px;
|
|
13
|
+
width: 22px;
|
|
14
|
+
transition: 300ms;
|
|
15
|
+
position: absolute;
|
|
16
|
+
${(p) => p.active && `left:0px;`}
|
|
17
|
+
${(p) => !p.active && `right:0px;`}
|
|
18
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
|
19
|
+
`;
|
|
20
|
+
export const ToogleElement = styled.div `
|
|
21
|
+
position: relative;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
background-color: ${(p) => p.active ? p.theme.toogleActiveBackgorund : p.theme.toogleBackgrund};
|
|
24
|
+
border: 1px solid ${(p) => p.theme.inputDefaultBorder};
|
|
25
|
+
font-family: 'Lato', sans-serif;
|
|
26
|
+
outline: 0;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
text-overflow: ellipsis;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12),
|
|
32
|
+
inset 0 1px 2px rgba(0, 0, 0, 0.24);
|
|
33
|
+
height: 24px;
|
|
34
|
+
width: 40px;
|
|
35
|
+
border-radius: 12px;
|
|
36
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Toogle';
|
|
@@ -36,7 +36,18 @@ export const height = {
|
|
|
36
36
|
|
|
37
37
|
`,
|
|
38
38
|
large: `
|
|
39
|
-
|
|
39
|
+
height: calc( ${Theme.lineHeight.l} + 2 * (${Theme.padding.m}) + 2px);
|
|
40
|
+
`,
|
|
41
|
+
};
|
|
42
|
+
export const toogleSize = {
|
|
43
|
+
small: `
|
|
44
|
+
padding:1px 0px;
|
|
45
|
+
`,
|
|
46
|
+
medium: `
|
|
47
|
+
padding:7px 0px;
|
|
48
|
+
`,
|
|
49
|
+
large: `
|
|
50
|
+
padding:10px 0px;
|
|
40
51
|
`,
|
|
41
52
|
};
|
|
42
53
|
export const inputPadding = {
|
|
@@ -93,6 +104,9 @@ export const setHeight = (size) => {
|
|
|
93
104
|
export const setButtonSize = (size, loader) => {
|
|
94
105
|
return (sizes[size] + (loader ? buttonLoaderPadding[size] : buttonPadding[size]));
|
|
95
106
|
};
|
|
107
|
+
export const setToogleSize = (size) => {
|
|
108
|
+
return toogleSize[size];
|
|
109
|
+
};
|
|
96
110
|
export const setButtonLoaderSize = (size) => {
|
|
97
111
|
return buttonLoaderHeight[size];
|
|
98
112
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -2,13 +2,15 @@ import { FC } from 'react';
|
|
|
2
2
|
interface IButtonsFooterProps {
|
|
3
3
|
handleConfirm?: () => void;
|
|
4
4
|
handleClose: () => void;
|
|
5
|
-
handleAdditional?: () => void;
|
|
5
|
+
handleAdditional?: (value?: boolean) => void;
|
|
6
6
|
labelConfirm?: string;
|
|
7
7
|
labelClose: string;
|
|
8
8
|
labelAdditional?: string;
|
|
9
9
|
submitDisabled?: boolean;
|
|
10
10
|
submitLoader?: boolean;
|
|
11
11
|
backgroundColor?: string;
|
|
12
|
+
additionalType?: string;
|
|
13
|
+
additionalValue?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export declare const ButtonsFooter: FC<IButtonsFooterProps>;
|
|
14
16
|
export {};
|
|
@@ -5,12 +5,14 @@ export interface IModalProps {
|
|
|
5
5
|
title?: string;
|
|
6
6
|
handleConfirm?: () => void;
|
|
7
7
|
handleClose: () => void;
|
|
8
|
-
handleAdditional?: () => void;
|
|
8
|
+
handleAdditional?: (value?: boolean) => void;
|
|
9
9
|
labelConfirm?: string;
|
|
10
10
|
labelClose: string;
|
|
11
11
|
labelAdditional?: string;
|
|
12
12
|
size?: string;
|
|
13
13
|
submitDisabled?: boolean;
|
|
14
14
|
submitLoader?: boolean;
|
|
15
|
+
additionalType?: string;
|
|
16
|
+
additionalValue?: boolean;
|
|
15
17
|
}
|
|
16
18
|
export declare const Modal: FC<IModalProps>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InputSize, LabelPosition } from 'types';
|
|
3
|
+
interface IToogle {
|
|
4
|
+
theme?: any;
|
|
5
|
+
handleClick: (value: boolean) => void;
|
|
6
|
+
label?: string;
|
|
7
|
+
labelPosition?: LabelPosition;
|
|
8
|
+
size?: InputSize;
|
|
9
|
+
value: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
name?: string;
|
|
12
|
+
width?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const Toogle: FC<IToogle>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InputSize } from 'types';
|
|
2
|
+
interface IToogleElementWrapperProps {
|
|
3
|
+
size: InputSize;
|
|
4
|
+
}
|
|
5
|
+
export declare const ToogleElementWrapper: import("styled-components").StyledComponent<"div", any, IToogleElementWrapperProps, never>;
|
|
6
|
+
interface IToogleElementPointProps {
|
|
7
|
+
size: InputSize;
|
|
8
|
+
active: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const ToogleElementPoint: import("styled-components").StyledComponent<"div", any, IToogleElementPointProps, never>;
|
|
11
|
+
interface IToogleElementProps {
|
|
12
|
+
size: InputSize;
|
|
13
|
+
active: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const ToogleElement: import("styled-components").StyledComponent<"div", any, IToogleElementProps, never>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Toogle';
|
|
@@ -10,6 +10,11 @@ export declare const height: {
|
|
|
10
10
|
medium: string;
|
|
11
11
|
large: string;
|
|
12
12
|
};
|
|
13
|
+
export declare const toogleSize: {
|
|
14
|
+
small: string;
|
|
15
|
+
medium: string;
|
|
16
|
+
large: string;
|
|
17
|
+
};
|
|
13
18
|
export declare const inputPadding: {
|
|
14
19
|
small: string;
|
|
15
20
|
medium: string;
|
|
@@ -38,6 +43,7 @@ export declare const eyeTopPosition: {
|
|
|
38
43
|
export declare const setSize: (size: InputSize) => string;
|
|
39
44
|
export declare const setHeight: (size: InputSize) => string;
|
|
40
45
|
export declare const setButtonSize: (size: InputSize, loader: boolean) => string;
|
|
46
|
+
export declare const setToogleSize: (size: InputSize) => string;
|
|
41
47
|
export declare const setButtonLoaderSize: (size: InputSize) => string;
|
|
42
48
|
export declare const setEyeTopPosition: (size: InputSize) => string;
|
|
43
49
|
export declare const inputColorSchema: {
|
package/dist/types/index.d.ts
CHANGED