venice-ui 2.0.36 → 2.1.0
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 +2 -0
- package/dist/cjs/components/Checkbox/Checkbox.js +23 -0
- package/dist/cjs/components/Checkbox/Checkbox.styles.js +39 -0
- package/dist/esm/Theme/Theme.js +2 -0
- package/dist/esm/components/Checkbox/Checkbox.js +16 -0
- package/dist/esm/components/Checkbox/Checkbox.styles.js +33 -0
- package/dist/types/Theme/Theme.d.ts +1 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +15 -0
- package/dist/types/components/Checkbox/Checkbox.styles.d.ts +12 -0
- package/package.json +1 -1
package/dist/cjs/Theme/Theme.js
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
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.Checkbox = 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 Checkbox_styles_1 = require("./Checkbox.styles");
|
|
13
|
+
const Icons_1 = require("../Icons");
|
|
14
|
+
const Checkbox = ({ theme = Theme_1.mainTheme, label, labelPosition = 'top', value = false, readOnly = false, name, size = 'medium', width = 'auto', handleClick, }) => {
|
|
15
|
+
return (react_1.default.createElement(styled_components_1.ThemeProvider, { theme: theme },
|
|
16
|
+
react_1.default.createElement(Aligment_1.Aligment, { align: labelPosition === 'top' ? 'flex-start' : 'center', justify: labelPosition === 'top' ? 'center' : 'flex-start', direction: labelPosition === 'top' ? 'column-reverse' : 'row', wrap: 'nowrap', width: width },
|
|
17
|
+
react_1.default.createElement(Input_1.InputWrapper, { width: width },
|
|
18
|
+
react_1.default.createElement(Checkbox_styles_1.ToogleCheckboxWrapper, { size: size },
|
|
19
|
+
react_1.default.createElement(Checkbox_styles_1.CheckboxElement, { size: size, active: value, onClick: () => handleClick(!value) }, value && (react_1.default.createElement(Checkbox_styles_1.CheckoxIcon, null,
|
|
20
|
+
react_1.default.createElement(Icons_1.Icon, { name: 'check', size: 20, iconColor: theme.checkColor, noPadding: true })))))),
|
|
21
|
+
label && (react_1.default.createElement(Input_1.InputLabelElement, { size: size, labelPosition: labelPosition }, label)))));
|
|
22
|
+
};
|
|
23
|
+
exports.Checkbox = Checkbox;
|
|
@@ -0,0 +1,39 @@
|
|
|
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.CheckboxElement = exports.CheckoxIcon = exports.ToogleCheckboxWrapper = void 0;
|
|
7
|
+
const common_1 = require("../common");
|
|
8
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
9
|
+
const Theme_1 = require("../../Theme");
|
|
10
|
+
exports.ToogleCheckboxWrapper = styled_components_1.default.div `
|
|
11
|
+
${(p) => (0, common_1.setToogleSize)(p.size)}
|
|
12
|
+
`;
|
|
13
|
+
exports.CheckoxIcon = styled_components_1.default.div `
|
|
14
|
+
display: flex;
|
|
15
|
+
`;
|
|
16
|
+
exports.CheckboxElement = styled_components_1.default.div `
|
|
17
|
+
display: flex;
|
|
18
|
+
align-content: center;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
background-color: ${(p) => p.active ? p.theme.toogleActiveBackgorund : p.theme.toogleBackgrund};
|
|
23
|
+
border: 1px solid ${(p) => p.theme.inputDefaultBorder};
|
|
24
|
+
font-family: 'Lato', sans-serif;
|
|
25
|
+
outline: 0;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
${(p) => !p.active &&
|
|
31
|
+
`
|
|
32
|
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12),
|
|
33
|
+
inset 0 1px 2px rgba(0, 0, 0, 0.24);
|
|
34
|
+
`}
|
|
35
|
+
height: ${(p) => (p.size === 'small' ? '20px' : '24px')};
|
|
36
|
+
width: ${(p) => (p.size === 'small' ? '20px' : '24px')};
|
|
37
|
+
border-radius: ${Theme_1.Theme.borderRadius.m};
|
|
38
|
+
${(p) => p.size === 'small' && `margin:2px 0;`}
|
|
39
|
+
`;
|
package/dist/esm/Theme/Theme.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
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 { CheckboxElement, CheckoxIcon, ToogleCheckboxWrapper, } from './Checkbox.styles';
|
|
7
|
+
import { Icon } from '../Icons';
|
|
8
|
+
export const Checkbox = ({ theme = mainTheme, label, labelPosition = 'top', value = false, readOnly = false, name, size = 'medium', width = 'auto', handleClick, }) => {
|
|
9
|
+
return (React.createElement(ThemeProvider, { theme: theme },
|
|
10
|
+
React.createElement(Aligment, { align: labelPosition === 'top' ? 'flex-start' : 'center', justify: labelPosition === 'top' ? 'center' : 'flex-start', direction: labelPosition === 'top' ? 'column-reverse' : 'row', wrap: 'nowrap', width: width },
|
|
11
|
+
React.createElement(InputWrapper, { width: width },
|
|
12
|
+
React.createElement(ToogleCheckboxWrapper, { size: size },
|
|
13
|
+
React.createElement(CheckboxElement, { size: size, active: value, onClick: () => handleClick(!value) }, value && (React.createElement(CheckoxIcon, null,
|
|
14
|
+
React.createElement(Icon, { name: 'check', size: 20, iconColor: theme.checkColor, noPadding: true })))))),
|
|
15
|
+
label && (React.createElement(InputLabelElement, { size: size, labelPosition: labelPosition }, label)))));
|
|
16
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { setToogleSize } from '../common';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { Theme } from '../../Theme';
|
|
4
|
+
export const ToogleCheckboxWrapper = styled.div `
|
|
5
|
+
${(p) => setToogleSize(p.size)}
|
|
6
|
+
`;
|
|
7
|
+
export const CheckoxIcon = styled.div `
|
|
8
|
+
display: flex;
|
|
9
|
+
`;
|
|
10
|
+
export const CheckboxElement = styled.div `
|
|
11
|
+
display: flex;
|
|
12
|
+
align-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
background-color: ${(p) => p.active ? p.theme.toogleActiveBackgorund : p.theme.toogleBackgrund};
|
|
17
|
+
border: 1px solid ${(p) => p.theme.inputDefaultBorder};
|
|
18
|
+
font-family: 'Lato', sans-serif;
|
|
19
|
+
outline: 0;
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
text-overflow: ellipsis;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
${(p) => !p.active &&
|
|
25
|
+
`
|
|
26
|
+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.12),
|
|
27
|
+
inset 0 1px 2px rgba(0, 0, 0, 0.24);
|
|
28
|
+
`}
|
|
29
|
+
height: ${(p) => (p.size === 'small' ? '20px' : '24px')};
|
|
30
|
+
width: ${(p) => (p.size === 'small' ? '20px' : '24px')};
|
|
31
|
+
border-radius: ${Theme.borderRadius.m};
|
|
32
|
+
${(p) => p.size === 'small' && `margin:2px 0;`}
|
|
33
|
+
`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { InputSize, LabelPosition } from 'types';
|
|
3
|
+
interface ICheckbox {
|
|
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 Checkbox: FC<ICheckbox>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InputSize } from 'types';
|
|
2
|
+
interface IToogleElementWrapperProps {
|
|
3
|
+
size: InputSize;
|
|
4
|
+
}
|
|
5
|
+
export declare const ToogleCheckboxWrapper: import("styled-components").StyledComponent<"div", any, IToogleElementWrapperProps, never>;
|
|
6
|
+
export declare const CheckoxIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
interface IToogleElementProps {
|
|
8
|
+
size: InputSize;
|
|
9
|
+
active: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const CheckboxElement: import("styled-components").StyledComponent<"div", any, IToogleElementProps, never>;
|
|
12
|
+
export {};
|