venice-ui 2.0.28 → 2.0.30

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.
@@ -31,7 +31,9 @@ const DropdownElements_1 = require("./DropdownElements");
31
31
  const Input_1 = require("../Input");
32
32
  const common_1 = require("../common");
33
33
  const react_dom_1 = require("react-dom");
34
- const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = false, error, width, options, value, placeholder = 'Please select', name, handleSelect, position = 'left', zIndex, readOnly = false, }) => {
34
+ const Icons_1 = require("../Icons");
35
+ const Theme_1 = require("../../Theme");
36
+ const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = false, error, width, options, value, placeholder = 'Please select', name, handleSelect, position = 'left', zIndex, readOnly = false, theme = Theme_1.mainTheme, }) => {
35
37
  const [open, toogleOpen] = (0, react_1.useState)(false);
36
38
  const ref = (0, react_1.useRef)(null);
37
39
  const sourceRef = (0, react_1.useRef)(null);
@@ -80,6 +82,8 @@ const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = fa
80
82
  label && (react_1.default.createElement(Input_1.InputLabelElement, { size: size, labelPosition: labelPosition }, label)),
81
83
  readOnly ? (react_1.default.createElement(Input_1.InputReadOnlyElement, { inputSize: size }, value)) : (react_1.default.createElement(Dropdown_styles_1.DropdownElement, { onClick: () => handleOpen(), ref: sourceRef },
82
84
  react_1.default.createElement(DropdownElements_1.Field, { inputSize: size, disabled: disabled, width: width, active: open, error: error }, value ? getLabelForValue(value) : placeholder),
85
+ react_1.default.createElement(Input_1.EyeIconWrapper, { size: size },
86
+ react_1.default.createElement(Icons_1.Icon, { name: open ? 'arrow_drop_up' : 'arrow_drop_down', size: 24, iconColor: theme.inputDefaultTextColor, iconHoverColor: theme.inputDefaultTextColor, iconBgHoverColor: "transparent" })),
83
87
  open &&
84
88
  (0, react_dom_1.createPortal)(react_1.default.createElement(common_1.Panel, { style: dropdownStyles, ref: ref, size: size, fullWidth: true, zIndex: zIndex }, options &&
85
89
  options.map((option) => (react_1.default.createElement(common_1.PanelOption, { key: option.value, active: option.value === value, onClick: (e) => selectOption(e, option.value) }, option.label)))), document.body),
@@ -30,7 +30,7 @@ const Aligment_1 = require("../Aligment");
30
30
  const Input_styles_1 = require("./Input.styles");
31
31
  const Icons_1 = require("../Icons");
32
32
  const Theme_1 = require("../../Theme");
33
- const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disabled = false, size = 'medium', handleChange, handleSubmit, width, error, placeholder, min, max, step = 0.1, autoFocus, theme = Theme_1.mainTheme, readOnly = false, }) => {
33
+ const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disabled = false, size = 'medium', handleChange, handleSubmit, width, error, placeholder, min, max, step = 0.1, autoFocus, theme = Theme_1.mainTheme, readOnly = false, prefix, }) => {
34
34
  const calculateNumberValue = (numberValue) => {
35
35
  return isNaN(parseFloat(numberValue))
36
36
  ? numberValue
@@ -92,7 +92,8 @@ const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disab
92
92
  label && (react_1.default.createElement(Input_styles_1.InputLabelElement, { size: size, labelPosition: labelPosition }, label)),
93
93
  react_1.default.createElement(Input_styles_1.InputWrapper, { width: width },
94
94
  react_1.default.createElement(react_1.default.Fragment, null, readOnly ? (react_1.default.createElement(Input_styles_1.InputReadOnlyElement, { inputSize: size }, inputType === 'password' ? '******' : value)) : (react_1.default.createElement(react_1.default.Fragment, null,
95
- react_1.default.createElement(Input_styles_1.InputTextElement, { autoFocus: autoFocus, inputSize: size, type: showPassword ? 'text' : inputType, disabled: disabled, name: name, value: value, onChange: onChange, onKeyDown: onKeyDown, onBlur: onBlurValidation, error: error, placeholder: placeholder, min: min, max: max, step: step }),
95
+ react_1.default.createElement(Input_styles_1.InputTextElement, { autoFocus: autoFocus, inputSize: size, type: showPassword ? 'text' : inputType, disabled: disabled, name: name, value: value, onChange: onChange, onKeyDown: onKeyDown, onBlur: onBlurValidation, error: error, placeholder: placeholder, min: min, max: max, step: step, prefix: prefix }),
96
+ prefix && react_1.default.createElement(Input_styles_1.Prefix, { inputSize: size }, prefix),
96
97
  inputType === 'password' && (react_1.default.createElement(Input_styles_1.EyeIconWrapper, { size: size },
97
98
  react_1.default.createElement(Icons_1.Icon, { name: showPassword ? 'visability_off' : 'visibility', size: 24, onClick: tooglePassword, iconColor: theme.inputDefaultTextColor, iconBgHoverColor: "transparent" }))),
98
99
  type === 'increase' && (react_1.default.createElement(Input_styles_1.IconsWrapper, null,
@@ -3,11 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.IconsWrapper = exports.EyeIconWrapper = exports.InputErrorMsg = exports.InputWrapper = exports.InputLabelElement = exports.InputReadOnlyElement = exports.InputTextElement = void 0;
6
+ exports.Prefix = exports.IconsWrapper = exports.EyeIconWrapper = exports.InputErrorMsg = exports.InputWrapper = exports.InputLabelElement = exports.InputReadOnlyElement = exports.InputTextElement = void 0;
7
7
  const common_1 = require("../common");
8
8
  const styled_components_1 = __importDefault(require("styled-components"));
9
- const Theme_1 = require("../../Theme");
10
9
  const Typography_1 = require("../Typography");
10
+ const Theme_1 = require("../../Theme");
11
11
  exports.InputTextElement = styled_components_1.default.input `
12
12
  position: relative;
13
13
  box-sizing: border-box;
@@ -20,7 +20,7 @@ exports.InputTextElement = styled_components_1.default.input `
20
20
  white-space: nowrap;
21
21
  overflow: hidden;
22
22
  text-overflow: ellipsis;
23
- ${(p) => (0, common_1.setSize)(p.inputSize)}
23
+ ${(p) => (p.prefix ? (0, common_1.setSizeWithPrefix)(p.inputSize) : (0, common_1.setSize)(p.inputSize))}
24
24
  color: ${(p) => p.theme.inputDefaultTextColor};
25
25
  width: ${(p) => (p.width ? p.width : '100%')};
26
26
  ${(p) => p.type === 'password' && `padding-right:32px;`}
@@ -63,8 +63,8 @@ exports.InputReadOnlyElement = styled_components_1.default.div `
63
63
  ${(p) => (0, common_1.setHeight)(p.inputSize)}
64
64
  color: ${(p) => p.theme.inputDefaultTextColor};
65
65
  width: ${(p) => (p.width ? p.width : '100%')};
66
- padding-left:0;
67
- border-bottom:1px solid #dddddd;
66
+ padding-left: 0;
67
+ border-bottom: 1px solid #dddddd;
68
68
  `;
69
69
  exports.InputLabelElement = (0, styled_components_1.default)(Typography_1.TextLabel) `
70
70
  ${(p) => p.labelPosition === 'top' && `margin-bottom: ${Theme_1.Theme.padding.s};`}
@@ -90,3 +90,13 @@ exports.IconsWrapper = styled_components_1.default.div `
90
90
  display: flex;
91
91
  align-items: center;
92
92
  `;
93
+ exports.Prefix = styled_components_1.default.div `
94
+ position: absolute;
95
+ dispaly: flex;
96
+ left: 0px;
97
+ top: 1px;
98
+ width: 24px;
99
+ align-items: center;
100
+ color: ${Theme_1.Theme.colors.gray_1};
101
+ ${(p) => (0, common_1.setSize)(p.inputSize)}
102
+ `;
@@ -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.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;
3
+ exports.setAnimationParams = exports.animationParams = exports.setFieldHeight = exports.fieldHeight = 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.setSizeWithPrefix = exports.setSize = exports.eyeTopPosition = exports.buttonLoaderHeight = exports.buttonLoaderPadding = exports.buttonPadding = exports.inputPaddingWithPrefix = 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 = `
@@ -64,6 +64,20 @@ exports.inputPadding = {
64
64
  padding: ${Theme_1.Theme.padding.m};
65
65
  `,
66
66
  };
67
+ exports.inputPaddingWithPrefix = {
68
+ small: `
69
+ padding: ${Theme_1.Theme.padding.s};
70
+ padding-left: calc(2* ${Theme_1.Theme.padding.s} + 24px);
71
+ `,
72
+ medium: `
73
+ padding: ${Theme_1.Theme.padding.m};
74
+ padding-left: calc(2* ${Theme_1.Theme.padding.m} + 24px);
75
+ `,
76
+ large: `
77
+ padding: ${Theme_1.Theme.padding.m};
78
+ padding-left: calc(2* ${Theme_1.Theme.padding.m} + 24px);
79
+ `,
80
+ };
67
81
  //TODO refactor this
68
82
  exports.buttonPadding = {
69
83
  small: `
@@ -102,6 +116,10 @@ const setSize = (size) => {
102
116
  return exports.sizes[size] + exports.inputPadding[size];
103
117
  };
104
118
  exports.setSize = setSize;
119
+ const setSizeWithPrefix = (size) => {
120
+ return exports.sizes[size] + exports.inputPaddingWithPrefix[size];
121
+ };
122
+ exports.setSizeWithPrefix = setSizeWithPrefix;
105
123
  const setHeight = (size) => {
106
124
  return exports.height[size];
107
125
  };
@@ -2,10 +2,12 @@ import React, { useState, useEffect, useRef } from 'react';
2
2
  import { Aligment } from '../Aligment';
3
3
  import { DropdownElement } from './Dropdown.styles';
4
4
  import { Field } from './DropdownElements';
5
- import { InputErrorMsg, InputLabelElement, InputReadOnlyElement, } from '../Input';
5
+ import { EyeIconWrapper, InputErrorMsg, InputLabelElement, InputReadOnlyElement, } from '../Input';
6
6
  import { Panel, PanelOption } from '../common';
7
7
  import { createPortal } from 'react-dom';
8
- export const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = false, error, width, options, value, placeholder = 'Please select', name, handleSelect, position = 'left', zIndex, readOnly = false, }) => {
8
+ import { Icon } from '../Icons';
9
+ import { mainTheme } from '../../Theme';
10
+ export const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabled = false, error, width, options, value, placeholder = 'Please select', name, handleSelect, position = 'left', zIndex, readOnly = false, theme = mainTheme, }) => {
9
11
  const [open, toogleOpen] = useState(false);
10
12
  const ref = useRef(null);
11
13
  const sourceRef = useRef(null);
@@ -54,6 +56,8 @@ export const Dropdown = ({ size = 'medium', label, labelPosition = 'top', disabl
54
56
  label && (React.createElement(InputLabelElement, { size: size, labelPosition: labelPosition }, label)),
55
57
  readOnly ? (React.createElement(InputReadOnlyElement, { inputSize: size }, value)) : (React.createElement(DropdownElement, { onClick: () => handleOpen(), ref: sourceRef },
56
58
  React.createElement(Field, { inputSize: size, disabled: disabled, width: width, active: open, error: error }, value ? getLabelForValue(value) : placeholder),
59
+ React.createElement(EyeIconWrapper, { size: size },
60
+ React.createElement(Icon, { name: open ? 'arrow_drop_up' : 'arrow_drop_down', size: 24, iconColor: theme.inputDefaultTextColor, iconHoverColor: theme.inputDefaultTextColor, iconBgHoverColor: "transparent" })),
57
61
  open &&
58
62
  createPortal(React.createElement(Panel, { style: dropdownStyles, ref: ref, size: size, fullWidth: true, zIndex: zIndex }, options &&
59
63
  options.map((option) => (React.createElement(PanelOption, { key: option.value, active: option.value === value, onClick: (e) => selectOption(e, option.value) }, option.label)))), document.body),
@@ -1,10 +1,10 @@
1
1
  import React, { useState } from 'react';
2
2
  import { ThemeProvider } from 'styled-components';
3
3
  import { Aligment } from '../Aligment';
4
- import { InputTextElement, InputLabelElement, InputErrorMsg, InputWrapper, EyeIconWrapper, IconsWrapper, InputReadOnlyElement, } from './Input.styles';
4
+ import { InputTextElement, InputLabelElement, InputErrorMsg, InputWrapper, EyeIconWrapper, IconsWrapper, InputReadOnlyElement, Prefix, } from './Input.styles';
5
5
  import { Icon } from '../Icons';
6
6
  import { mainTheme } from '../../Theme';
7
- export const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disabled = false, size = 'medium', handleChange, handleSubmit, width, error, placeholder, min, max, step = 0.1, autoFocus, theme = mainTheme, readOnly = false, }) => {
7
+ export const Input = ({ label, labelPosition = 'top', value, type = 'text', name, disabled = false, size = 'medium', handleChange, handleSubmit, width, error, placeholder, min, max, step = 0.1, autoFocus, theme = mainTheme, readOnly = false, prefix, }) => {
8
8
  const calculateNumberValue = (numberValue) => {
9
9
  return isNaN(parseFloat(numberValue))
10
10
  ? numberValue
@@ -66,7 +66,8 @@ export const Input = ({ label, labelPosition = 'top', value, type = 'text', name
66
66
  label && (React.createElement(InputLabelElement, { size: size, labelPosition: labelPosition }, label)),
67
67
  React.createElement(InputWrapper, { width: width },
68
68
  React.createElement(React.Fragment, null, readOnly ? (React.createElement(InputReadOnlyElement, { inputSize: size }, inputType === 'password' ? '******' : value)) : (React.createElement(React.Fragment, null,
69
- React.createElement(InputTextElement, { autoFocus: autoFocus, inputSize: size, type: showPassword ? 'text' : inputType, disabled: disabled, name: name, value: value, onChange: onChange, onKeyDown: onKeyDown, onBlur: onBlurValidation, error: error, placeholder: placeholder, min: min, max: max, step: step }),
69
+ React.createElement(InputTextElement, { autoFocus: autoFocus, inputSize: size, type: showPassword ? 'text' : inputType, disabled: disabled, name: name, value: value, onChange: onChange, onKeyDown: onKeyDown, onBlur: onBlurValidation, error: error, placeholder: placeholder, min: min, max: max, step: step, prefix: prefix }),
70
+ prefix && React.createElement(Prefix, { inputSize: size }, prefix),
70
71
  inputType === 'password' && (React.createElement(EyeIconWrapper, { size: size },
71
72
  React.createElement(Icon, { name: showPassword ? 'visability_off' : 'visibility', size: 24, onClick: tooglePassword, iconColor: theme.inputDefaultTextColor, iconBgHoverColor: "transparent" }))),
72
73
  type === 'increase' && (React.createElement(IconsWrapper, null,
@@ -1,7 +1,7 @@
1
- import { setSize, setEyeTopPosition, setHeight } from '../common';
1
+ import { setSize, setEyeTopPosition, setHeight, setSizeWithPrefix, } from '../common';
2
2
  import styled from 'styled-components';
3
- import { Theme } from '../../Theme';
4
3
  import { TextLabel } from '../Typography';
4
+ import { Theme } from '../../Theme';
5
5
  export const InputTextElement = styled.input `
6
6
  position: relative;
7
7
  box-sizing: border-box;
@@ -14,7 +14,7 @@ export const InputTextElement = styled.input `
14
14
  white-space: nowrap;
15
15
  overflow: hidden;
16
16
  text-overflow: ellipsis;
17
- ${(p) => setSize(p.inputSize)}
17
+ ${(p) => (p.prefix ? setSizeWithPrefix(p.inputSize) : setSize(p.inputSize))}
18
18
  color: ${(p) => p.theme.inputDefaultTextColor};
19
19
  width: ${(p) => (p.width ? p.width : '100%')};
20
20
  ${(p) => p.type === 'password' && `padding-right:32px;`}
@@ -57,8 +57,8 @@ export const InputReadOnlyElement = styled.div `
57
57
  ${(p) => setHeight(p.inputSize)}
58
58
  color: ${(p) => p.theme.inputDefaultTextColor};
59
59
  width: ${(p) => (p.width ? p.width : '100%')};
60
- padding-left:0;
61
- border-bottom:1px solid #dddddd;
60
+ padding-left: 0;
61
+ border-bottom: 1px solid #dddddd;
62
62
  `;
63
63
  export const InputLabelElement = styled(TextLabel) `
64
64
  ${(p) => p.labelPosition === 'top' && `margin-bottom: ${Theme.padding.s};`}
@@ -84,3 +84,13 @@ export const IconsWrapper = styled.div `
84
84
  display: flex;
85
85
  align-items: center;
86
86
  `;
87
+ export const Prefix = styled.div `
88
+ position: absolute;
89
+ dispaly: flex;
90
+ left: 0px;
91
+ top: 1px;
92
+ width: 24px;
93
+ align-items: center;
94
+ color: ${Theme.colors.gray_1};
95
+ ${(p) => setSize(p.inputSize)}
96
+ `;
@@ -61,6 +61,20 @@ export const inputPadding = {
61
61
  padding: ${Theme.padding.m};
62
62
  `,
63
63
  };
64
+ export const inputPaddingWithPrefix = {
65
+ small: `
66
+ padding: ${Theme.padding.s};
67
+ padding-left: calc(2* ${Theme.padding.s} + 24px);
68
+ `,
69
+ medium: `
70
+ padding: ${Theme.padding.m};
71
+ padding-left: calc(2* ${Theme.padding.m} + 24px);
72
+ `,
73
+ large: `
74
+ padding: ${Theme.padding.m};
75
+ padding-left: calc(2* ${Theme.padding.m} + 24px);
76
+ `,
77
+ };
64
78
  //TODO refactor this
65
79
  export const buttonPadding = {
66
80
  small: `
@@ -98,6 +112,9 @@ export const eyeTopPosition = {
98
112
  export const setSize = (size) => {
99
113
  return sizes[size] + inputPadding[size];
100
114
  };
115
+ export const setSizeWithPrefix = (size) => {
116
+ return sizes[size] + inputPaddingWithPrefix[size];
117
+ };
101
118
  export const setHeight = (size) => {
102
119
  return height[size];
103
120
  };
@@ -5,6 +5,7 @@ export interface IDropdownProps extends IFormElement {
5
5
  handleSelect: (name: string, value: string | number) => void;
6
6
  position?: string;
7
7
  zIndex?: number;
8
+ theme?: any;
8
9
  }
9
10
  export interface IPositionStyle {
10
11
  top: number;
@@ -10,5 +10,6 @@ export interface IInputProps extends IFormElement {
10
10
  autoFocus?: boolean;
11
11
  theme?: any;
12
12
  handleSubmit?: () => void;
13
+ prefix?: string;
13
14
  }
14
15
  export declare const Input: FC<IInputProps>;
@@ -28,4 +28,8 @@ interface IEyeIconWrapperProps {
28
28
  }
29
29
  export declare const EyeIconWrapper: import("styled-components").StyledComponent<"div", any, IEyeIconWrapperProps, never>;
30
30
  export declare const IconsWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
31
+ interface IPrefixProps {
32
+ inputSize: InputSize;
33
+ }
34
+ export declare const Prefix: import("styled-components").StyledComponent<"div", any, IPrefixProps, never>;
31
35
  export {};
@@ -20,6 +20,11 @@ export declare const inputPadding: {
20
20
  medium: string;
21
21
  large: string;
22
22
  };
23
+ export declare const inputPaddingWithPrefix: {
24
+ small: string;
25
+ medium: string;
26
+ large: string;
27
+ };
23
28
  export declare const buttonPadding: {
24
29
  small: string;
25
30
  medium: string;
@@ -41,6 +46,7 @@ export declare const eyeTopPosition: {
41
46
  large: string;
42
47
  };
43
48
  export declare const setSize: (size: InputSize) => string;
49
+ export declare const setSizeWithPrefix: (size: InputSize) => string;
44
50
  export declare const setHeight: (size: InputSize) => string;
45
51
  export declare const setButtonSize: (size: InputSize, loader: boolean) => string;
46
52
  export declare const setToogleSize: (size: InputSize) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "venice-ui",
3
- "version": "2.0.28",
3
+ "version": "2.0.30",
4
4
  "description": "Component library",
5
5
  "main": "index.js",
6
6
  "module": "./dist/esm/index.js",