@xaypay/tui 0.0.54 → 0.0.56
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/.storybook/main.js +27 -20
- package/cli-command.js +3 -0
- package/dist/index.es.js +250 -99
- package/dist/index.js +251 -99
- package/package.json +8 -5
- package/rollup.config.js +2 -0
- package/src/components/autocomplate/index.js +22 -17
- package/src/components/button/index.js +27 -18
- package/src/components/input/index.js +136 -40
- package/src/components/input/input.module.css +17 -15
- package/src/components/table/index.js +1 -1
- package/src/components/tooltip/index.js +37 -34
- package/src/components/tooltip/tooltip.module.css +2 -2
- package/src/components/tooltip/tooltip.stories.js +3 -2
- package/src/components/typography/index.js +65 -6
- package/src/components/typography/typography.stories.js +8 -2
- package/src/stories/Introduction.stories.mdx +92 -93
- package/src/stories/changelog.stories.mdx +118 -0
- package/src/stories/configuration.stories.mdx +334 -0
- package/src/stories/documentation.stories.mdx +118 -0
- package/src/stories/static/button-usage.png +0 -0
- package/src/stories/usage.stories.mdx +128 -0
- package/src/utils/index.js +1 -0
- package/tui.config.js +190 -52
- package/storybook-static/favicon.ico +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaypay/tui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
9
|
"storybook": "start-storybook -p 6006",
|
|
10
10
|
"build-storybook": "build-storybook",
|
|
11
|
-
"build-lib": "rollup
|
|
11
|
+
"build-lib": "rollup --config rollup.config.js",
|
|
12
12
|
"svgr": "svgr --icon --title-prop --replace-attr-values '#1D1D1D=currentColor' -d src/components/icon -- src/assets"
|
|
13
13
|
},
|
|
14
14
|
"author": "",
|
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
"@storybook/addon-essentials": "^6.5.10",
|
|
22
22
|
"@storybook/addon-interactions": "^6.5.10",
|
|
23
23
|
"@storybook/addon-links": "^6.5.10",
|
|
24
|
-
"@storybook/builder-
|
|
25
|
-
"@storybook/manager-
|
|
24
|
+
"@storybook/builder-webpack5": "^6.5.16",
|
|
25
|
+
"@storybook/manager-webpack5": "^6.5.16",
|
|
26
|
+
"@storybook/preset-create-react-app": "^4.1.2",
|
|
26
27
|
"@storybook/preset-scss": "^1.0.3",
|
|
27
28
|
"@storybook/react": "^6.5.10",
|
|
28
29
|
"@storybook/testing-library": "^0.0.13",
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"rollup-plugin-babel": "^4.4.0",
|
|
41
42
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
42
43
|
"rollup-plugin-postcss": "^4.0.2",
|
|
44
|
+
"rollup-plugin-svg": "^2.0.0",
|
|
43
45
|
"sass": "^1.54.9",
|
|
44
46
|
"sass-loader": "^13.0.2",
|
|
45
47
|
"style-loader": "^3.3.1",
|
|
@@ -57,5 +59,6 @@
|
|
|
57
59
|
"dependencies": {
|
|
58
60
|
"lodash": "^4.17.21",
|
|
59
61
|
"react-icons": "^4.7.1"
|
|
60
|
-
}
|
|
62
|
+
},
|
|
63
|
+
"bin": "./cli-command.js"
|
|
61
64
|
}
|
package/rollup.config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// import {babel} from '@rollup/plugin-babel';
|
|
2
|
+
import svg from 'rollup-plugin-svg';
|
|
2
3
|
import babel from 'rollup-plugin-babel';
|
|
3
4
|
import resolve from '@rollup/plugin-node-resolve';
|
|
4
5
|
import external from 'rollup-plugin-peer-deps-external';
|
|
@@ -28,6 +29,7 @@ export default [
|
|
|
28
29
|
exclude: 'node_modules/**',
|
|
29
30
|
presets: ['@babel/preset-react'],
|
|
30
31
|
}),
|
|
32
|
+
svg(),
|
|
31
33
|
external(),
|
|
32
34
|
resolve()
|
|
33
35
|
]
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import classnames from "classnames";
|
|
4
|
+
import { compereConfigs } from "./../../utils";
|
|
4
5
|
import styles from "./autocomplate.module.css";
|
|
5
6
|
|
|
6
7
|
export const Autocomplate = ({
|
|
7
|
-
className,
|
|
8
8
|
label,
|
|
9
|
+
value,
|
|
9
10
|
required,
|
|
10
11
|
disabled,
|
|
11
|
-
|
|
12
|
-
jsonSelectedOptionsData,
|
|
12
|
+
keyNames,
|
|
13
13
|
onChange,
|
|
14
|
-
|
|
14
|
+
className,
|
|
15
15
|
searchCount,
|
|
16
16
|
placeHolder,
|
|
17
|
-
keyNames,
|
|
18
17
|
errorMesage,
|
|
18
|
+
autoComplete,
|
|
19
|
+
jsonOptionsData,
|
|
20
|
+
jsonSelectedOptionsData,
|
|
19
21
|
...props
|
|
20
22
|
}) => {
|
|
23
|
+
const configStyles = compereConfigs();
|
|
21
24
|
const classProps = classnames(styles.searchBox, className);
|
|
22
25
|
const parseSelectedOptionsData =
|
|
23
26
|
jsonSelectedOptionsData ? JSON.parse(jsonSelectedOptionsData) : { name: '', id: '' };
|
|
@@ -27,10 +30,6 @@ export const Autocomplate = ({
|
|
|
27
30
|
const [showOptions, setShowOptions] = useState(false);
|
|
28
31
|
const parseOptionsData =
|
|
29
32
|
jsonOptionsData ? JSON.parse(jsonOptionsData) : [];
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name])
|
|
32
|
-
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id])
|
|
33
|
-
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]])
|
|
34
33
|
|
|
35
34
|
const handleChange = (e) => {
|
|
36
35
|
const currentInputValue = e.currentTarget.value;
|
|
@@ -89,6 +88,11 @@ export const Autocomplate = ({
|
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name])
|
|
93
|
+
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id])
|
|
94
|
+
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]])
|
|
95
|
+
|
|
92
96
|
return (
|
|
93
97
|
<>
|
|
94
98
|
{label ? <label className={`${styles['autocomplate-title']} autocomplate-title-rem`}>{label} {required && <sup style={{color: "#ee0000"}}>*</sup>}</label> : ""}
|
|
@@ -96,6 +100,7 @@ export const Autocomplate = ({
|
|
|
96
100
|
<input
|
|
97
101
|
id={inputId}
|
|
98
102
|
type="text"
|
|
103
|
+
autoComplete={autoComplete ? autoComplete : configStyles.INPUT.autoComplete}
|
|
99
104
|
className={`${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMesage ? styles.errorBorder : ''}`}
|
|
100
105
|
disabled={disabled}
|
|
101
106
|
onChange={handleChange}
|
|
@@ -112,21 +117,21 @@ export const Autocomplate = ({
|
|
|
112
117
|
};
|
|
113
118
|
|
|
114
119
|
Autocomplate.propTypes = {
|
|
115
|
-
className: PropTypes.string,
|
|
116
120
|
label: PropTypes.string,
|
|
117
|
-
placeHolder: PropTypes.string,
|
|
118
|
-
required: PropTypes.bool,
|
|
119
121
|
disabled: PropTypes.bool,
|
|
120
|
-
|
|
121
|
-
jsonSelectedOptionsData: PropTypes.string,
|
|
122
|
+
required: PropTypes.bool,
|
|
122
123
|
onChange: PropTypes.func,
|
|
123
124
|
value: PropTypes.string,
|
|
124
|
-
searchCount: PropTypes.number,
|
|
125
125
|
keyNames: PropTypes.object,
|
|
126
|
+
className: PropTypes.string,
|
|
127
|
+
searchCount: PropTypes.number,
|
|
126
128
|
errorMesage: PropTypes.string,
|
|
129
|
+
placeHolder: PropTypes.string,
|
|
130
|
+
autoComplete: PropTypes.string,
|
|
131
|
+
jsonOptionsData: PropTypes.string,
|
|
132
|
+
jsonSelectedOptionsData: PropTypes.string,
|
|
127
133
|
};
|
|
128
134
|
|
|
129
|
-
|
|
130
135
|
Autocomplate.defaultProps = {
|
|
131
136
|
required: false,
|
|
132
|
-
};
|
|
137
|
+
};
|
|
@@ -4,27 +4,30 @@ import classnames from 'classnames';
|
|
|
4
4
|
import { compereConfigs } from './../../utils';
|
|
5
5
|
|
|
6
6
|
export const Button = ({
|
|
7
|
+
size,
|
|
7
8
|
type,
|
|
9
|
+
font,
|
|
8
10
|
color,
|
|
9
11
|
label,
|
|
10
12
|
width,
|
|
11
13
|
height,
|
|
12
14
|
cursor,
|
|
15
|
+
weight,
|
|
13
16
|
border,
|
|
17
|
+
radius,
|
|
14
18
|
outline,
|
|
15
19
|
padding,
|
|
16
20
|
onClick,
|
|
17
|
-
fontSize,
|
|
18
21
|
disabled,
|
|
19
22
|
className,
|
|
20
23
|
boxSizing,
|
|
21
24
|
transition,
|
|
22
25
|
contentWidth,
|
|
23
|
-
|
|
26
|
+
disabledColor,
|
|
27
|
+
textTransform,
|
|
24
28
|
backgroundColor,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
disabledThemeLineColor,
|
|
29
|
+
disabledLineColor,
|
|
30
|
+
disabledBackgroundColor,
|
|
28
31
|
...props
|
|
29
32
|
}) => {
|
|
30
33
|
|
|
@@ -52,27 +55,30 @@ export const Button = ({
|
|
|
52
55
|
return (
|
|
53
56
|
<button
|
|
54
57
|
style={{
|
|
58
|
+
fontSize: size ? size : configStyles.BUTTON.size,
|
|
59
|
+
fontFamily: font ? font : configStyles.BUTTON.font,
|
|
55
60
|
height: height ? height : configStyles.BUTTON.height,
|
|
61
|
+
fontWeight: weight ? weight : configStyles.BUTTON.weight,
|
|
56
62
|
padding: padding ? padding : configStyles.BUTTON.padding,
|
|
57
|
-
|
|
63
|
+
borderRadius: radius ? radius : configStyles.BUTTON.radius,
|
|
58
64
|
boxSizing: boxSizing ? boxSizing : configStyles.BUTTON.boxSizing,
|
|
59
65
|
transition: transition ? transition : configStyles.BUTTON.transition,
|
|
60
66
|
border: outline ? 'none' : border ? border : configStyles.BUTTON.border,
|
|
61
67
|
width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
|
|
62
|
-
borderRadius: borderRadius ? borderRadius : configStyles.BUTTON.borderRadius,
|
|
63
68
|
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
|
|
69
|
+
textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
|
|
64
70
|
backgroundColor:
|
|
65
|
-
(outline || !outline) && disabled ?
|
|
66
|
-
outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.
|
|
71
|
+
(outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor :
|
|
72
|
+
outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
|
|
67
73
|
boxShadow:
|
|
68
74
|
outline ?
|
|
69
75
|
disabled ?
|
|
70
|
-
`inset 0 0 0 2px ${
|
|
71
|
-
`inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.
|
|
76
|
+
`inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` :
|
|
77
|
+
`inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}` :
|
|
72
78
|
'none',
|
|
73
79
|
color:
|
|
74
|
-
(outline || !outline) && disabled ?
|
|
75
|
-
outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.
|
|
80
|
+
(outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor :
|
|
81
|
+
outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : color ? color : configStyles.BUTTON.color
|
|
76
82
|
}}
|
|
77
83
|
type={type ? type : configStyles.BUTTON.type}
|
|
78
84
|
disabled={disabled ? disabled : configStyles.BUTTON.disabled}
|
|
@@ -89,24 +95,27 @@ export const Button = ({
|
|
|
89
95
|
|
|
90
96
|
Button.propTypes = {
|
|
91
97
|
type: PropTypes.string,
|
|
98
|
+
size: PropTypes.string,
|
|
99
|
+
font: PropTypes.string,
|
|
92
100
|
color: PropTypes.string,
|
|
93
101
|
width: PropTypes.string,
|
|
94
102
|
outline: PropTypes.bool,
|
|
95
103
|
onClick: PropTypes.func,
|
|
104
|
+
weight: PropTypes.string,
|
|
96
105
|
height: PropTypes.string,
|
|
97
106
|
cursor: PropTypes.string,
|
|
98
107
|
border: PropTypes.string,
|
|
99
108
|
disabled: PropTypes.bool,
|
|
109
|
+
radius: PropTypes.string,
|
|
100
110
|
padding: PropTypes.string,
|
|
101
|
-
fontSize: PropTypes.string,
|
|
102
111
|
boxSizing: PropTypes.string,
|
|
103
112
|
className: PropTypes.string,
|
|
104
113
|
transition: PropTypes.string,
|
|
105
114
|
contentWidth: PropTypes.bool,
|
|
106
|
-
|
|
115
|
+
textTransform: PropTypes.string,
|
|
116
|
+
disabledColor: PropTypes.string,
|
|
107
117
|
backgroundColor: PropTypes.string,
|
|
108
118
|
label: PropTypes.string.isRequired,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
disabledThemeLineColor: PropTypes.string,
|
|
119
|
+
disabledLineColor: PropTypes.string,
|
|
120
|
+
disabledBackgroundColor: PropTypes.string
|
|
112
121
|
};
|
|
@@ -3,16 +3,19 @@ import PropTypes from "prop-types";
|
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import { Typography } from "../typography";
|
|
5
5
|
import { compereConfigs } from "./../../utils";
|
|
6
|
+
import styled, { keyframes, css } from 'styled-components';
|
|
6
7
|
|
|
7
8
|
import styles from "./input.module.css";
|
|
8
9
|
|
|
9
10
|
export const InputTypes = {
|
|
11
|
+
TEL: 'tel',
|
|
10
12
|
TEXT: "text",
|
|
11
13
|
PASSWORD: "password",
|
|
12
14
|
};
|
|
13
15
|
|
|
14
16
|
export const Input = ({
|
|
15
17
|
type,
|
|
18
|
+
size,
|
|
16
19
|
name,
|
|
17
20
|
color,
|
|
18
21
|
label,
|
|
@@ -20,37 +23,69 @@ export const Input = ({
|
|
|
20
23
|
width,
|
|
21
24
|
height,
|
|
22
25
|
radius,
|
|
23
|
-
border,
|
|
24
26
|
padding,
|
|
25
27
|
tooltip,
|
|
26
|
-
bgColor,
|
|
27
28
|
leftIcon,
|
|
28
|
-
fontSize,
|
|
29
29
|
required,
|
|
30
30
|
disabled,
|
|
31
31
|
onChange,
|
|
32
|
+
transform,
|
|
32
33
|
iconWidth,
|
|
33
34
|
rightIcon,
|
|
34
35
|
className,
|
|
35
36
|
boxSizing,
|
|
36
37
|
boxShadow,
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
errorLeft,
|
|
39
|
+
errorSize,
|
|
40
|
+
labelSize,
|
|
41
|
+
labelColor,
|
|
42
|
+
errorColor,
|
|
39
43
|
placeholder,
|
|
44
|
+
errorZindex,
|
|
45
|
+
errorBottom,
|
|
46
|
+
labelWeight,
|
|
47
|
+
errorMessage,
|
|
40
48
|
autoComplete,
|
|
49
|
+
labelDisplay,
|
|
50
|
+
errorPosition,
|
|
41
51
|
boxShadowHover,
|
|
52
|
+
errorClassName,
|
|
53
|
+
errorAnimation,
|
|
54
|
+
errorLineHeight,
|
|
55
|
+
labelLineHeight,
|
|
56
|
+
backgroundColor,
|
|
57
|
+
labelMarginBottom,
|
|
58
|
+
errorAnimationDuration,
|
|
42
59
|
...props
|
|
43
60
|
}) => {
|
|
44
61
|
const [show, setShow] = useState(false);
|
|
45
62
|
const [isHover, setIsHover] = useState(false);
|
|
46
|
-
const [tooltipStatus, setTooltipStatus] = useState(false);
|
|
47
63
|
|
|
48
64
|
const random = Math.floor((Math.random() * 1000) + 1);
|
|
49
65
|
const configStyles = compereConfigs();
|
|
50
66
|
const classProps = classnames(
|
|
51
|
-
className
|
|
67
|
+
className ? className : configStyles.INPUT.className
|
|
52
68
|
);
|
|
53
69
|
|
|
70
|
+
const errorShow = keyframes`
|
|
71
|
+
100% {
|
|
72
|
+
bottom: '-20px';
|
|
73
|
+
transform: scale3d(1,1,1);
|
|
74
|
+
-webkit-transform: scale3d(1,1,1);
|
|
75
|
+
-moz-transform: scale3d(1,1,1);
|
|
76
|
+
-ms-transform: scale3d(1,1,1);
|
|
77
|
+
-o-transform: scale3d(1,1,1);
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
const animation = _ => css`
|
|
82
|
+
${errorShow} ${errorAnimationDuration ? errorAnimationDuration : configStyles.INPUT.errorAnimationDuration} forwards
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
const P = styled.p`
|
|
86
|
+
animation: ${errorAnimation ? animation : 'none'};
|
|
87
|
+
`;
|
|
88
|
+
|
|
54
89
|
const handleChange = (event) => {
|
|
55
90
|
onChange ? onChange(event.target.value) : _ => _;
|
|
56
91
|
};
|
|
@@ -66,7 +101,17 @@ export const Input = ({
|
|
|
66
101
|
return (
|
|
67
102
|
<div className={`${styles["input-wrap"]}`}>
|
|
68
103
|
{
|
|
69
|
-
label ? <label
|
|
104
|
+
label ? <label
|
|
105
|
+
className={`${styles["input-title"]}`}
|
|
106
|
+
style={{
|
|
107
|
+
color: labelColor ? labelColor : configStyles.INPUT.labelColor,
|
|
108
|
+
fontSize: labelSize ? labelSize : configStyles.INPUT.labelSize,
|
|
109
|
+
display: labelDisplay ? labelDisplay : configStyles.INPUT.labelDisplay,
|
|
110
|
+
fontWeight: labelWeight ? labelWeight : configStyles.INPUT.labelWeight,
|
|
111
|
+
lineHeight: labelLineHeight ? labelLineHeight : configStyles.INPUT.labelLineHeight,
|
|
112
|
+
marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.INPUT.labelMarginBottom
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
70
115
|
{label} {required && <sup style={{ color: "#ee0000" }}>*</sup>}
|
|
71
116
|
</label>
|
|
72
117
|
: ''
|
|
@@ -75,30 +120,49 @@ export const Input = ({
|
|
|
75
120
|
className={`${styles["input-content"]}`}
|
|
76
121
|
style={{
|
|
77
122
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
78
|
-
boxShadow: isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
|
|
123
|
+
boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
|
|
79
124
|
}}
|
|
80
125
|
onMouseEnter={handleMouseEnter}
|
|
81
126
|
onMouseLeave={handleMouseLeave}
|
|
82
127
|
>
|
|
83
128
|
{
|
|
84
|
-
leftIcon && leftIcon.length > 0 ?
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
129
|
+
leftIcon && leftIcon.length > 0 && type != 'tel' ?
|
|
130
|
+
<div
|
|
131
|
+
onMouseUp={type === 'password' ? _ => setShow(false) : _ => _}
|
|
132
|
+
onMouseDown={type === 'password' ? _ => setShow(true) : _ => _}
|
|
133
|
+
onMouseOut={type === 'password' ? _ => setShow(false) : _ => _}
|
|
134
|
+
style={{
|
|
135
|
+
cursor: type === 'password' ? 'pointer' : 'default',
|
|
136
|
+
height: height ? height : configStyles.INPUT.height,
|
|
137
|
+
padding: padding ? padding : configStyles.INPUT.padding,
|
|
138
|
+
width: iconWidth ? iconWidth : configStyles.INPUT.iconWidth,
|
|
139
|
+
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
140
|
+
borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
141
|
+
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
142
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
{type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]}
|
|
146
|
+
</div> : ''
|
|
147
|
+
}
|
|
148
|
+
{
|
|
149
|
+
type === 'tel' ?
|
|
150
|
+
<div
|
|
151
|
+
style={{
|
|
152
|
+
pointerEvents: disabled ? 'none' : 'auto',
|
|
153
|
+
fontSize: size ? size : configStyles.INPUT.size,
|
|
154
|
+
height: height ? height : configStyles.INPUT.height,
|
|
155
|
+
padding: padding ? padding : configStyles.INPUT.padding,
|
|
156
|
+
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
157
|
+
borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
158
|
+
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
159
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
160
|
+
color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
+374
|
|
164
|
+
</div>
|
|
165
|
+
: ''
|
|
102
166
|
}
|
|
103
167
|
<input
|
|
104
168
|
{...props}
|
|
@@ -115,13 +179,13 @@ export const Input = ({
|
|
|
115
179
|
outline: 'none',
|
|
116
180
|
pointerEvents: disabled ? 'none' : 'auto',
|
|
117
181
|
width: width ? width : configStyles.INPUT.width,
|
|
182
|
+
fontSize: size ? size : configStyles.INPUT.size,
|
|
118
183
|
height: height ? height : configStyles.INPUT.height,
|
|
119
184
|
padding: padding ? padding : configStyles.INPUT.padding,
|
|
120
185
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
121
|
-
fontSize: fontSize ? fontSize : configStyles.INPUT.fontSize,
|
|
122
186
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
123
|
-
|
|
124
|
-
|
|
187
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
188
|
+
color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
125
189
|
}}
|
|
126
190
|
/>
|
|
127
191
|
{
|
|
@@ -132,14 +196,13 @@ export const Input = ({
|
|
|
132
196
|
onMouseOut={type === 'password' ? _ => setShow(false) : _ => _}
|
|
133
197
|
style={{
|
|
134
198
|
cursor: type === 'password' ? 'pointer' : 'default',
|
|
135
|
-
border: border ? border : configStyles.INPUT.border,
|
|
136
199
|
height: height ? height : configStyles.INPUT.height,
|
|
137
200
|
padding: padding ? padding : configStyles.INPUT.padding,
|
|
138
201
|
width: iconWidth ? iconWidth : configStyles.INPUT.iconWidth,
|
|
139
202
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
140
203
|
borderTopRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
141
204
|
borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
142
|
-
backgroundColor: disabled ? '#FBFBFB' :
|
|
205
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
143
206
|
}}
|
|
144
207
|
>
|
|
145
208
|
{type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]}
|
|
@@ -147,12 +210,27 @@ export const Input = ({
|
|
|
147
210
|
}
|
|
148
211
|
</div>
|
|
149
212
|
{
|
|
150
|
-
tooltip ?
|
|
151
|
-
|
|
152
|
-
|
|
213
|
+
tooltip && tooltip.length > 0 ? tooltip[0] : ''
|
|
214
|
+
}
|
|
215
|
+
{
|
|
216
|
+
errorMessage ?
|
|
217
|
+
<P
|
|
218
|
+
style={{
|
|
219
|
+
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
220
|
+
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
221
|
+
fontSize: errorSize ? errorSize : configStyles.INPUT.errorSize,
|
|
222
|
+
bottom: errorBottom ? errorBottom : configStyles.INPUT.errorBottom,
|
|
223
|
+
zIndex: errorZindex ? errorZindex : configStyles.INPUT.errorZindex,
|
|
224
|
+
position: errorPosition ? errorPosition : configStyles.INPUT.errorPosition,
|
|
225
|
+
lineHeight: errorLineHeight ? errorLineHeight : configStyles.INPUT.errorLineHeight,
|
|
226
|
+
transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform,
|
|
227
|
+
}}
|
|
228
|
+
className={errorClassName ? errorClassName : configStyles.INPUT.errorClassName}
|
|
229
|
+
>
|
|
230
|
+
{errorMessage}
|
|
231
|
+
</P>
|
|
232
|
+
: ''
|
|
153
233
|
}
|
|
154
|
-
{tooltipStatus ? <p>{tooltip}</p> : null}
|
|
155
|
-
{errorMesage ? <span className={styles.inputErrorMessages}>{errorMesage}</span> : ""}
|
|
156
234
|
</div>
|
|
157
235
|
);
|
|
158
236
|
};
|
|
@@ -168,17 +246,35 @@ Input.propTypes = {
|
|
|
168
246
|
disabled: PropTypes.bool,
|
|
169
247
|
height: PropTypes.string,
|
|
170
248
|
radius: PropTypes.string,
|
|
171
|
-
|
|
249
|
+
padding: PropTypes.string,
|
|
172
250
|
fontSize: PropTypes.string,
|
|
173
|
-
|
|
251
|
+
transform: PropTypes.string,
|
|
174
252
|
className: PropTypes.string,
|
|
175
253
|
iconWidth: PropTypes.string,
|
|
176
254
|
boxSizing: PropTypes.string,
|
|
177
255
|
boxShadow: PropTypes.string,
|
|
256
|
+
errorSize: PropTypes.string,
|
|
257
|
+
errorLeft: PropTypes.string,
|
|
258
|
+
labelSize: PropTypes.string,
|
|
259
|
+
errorColor: PropTypes.string,
|
|
260
|
+
labelColor: PropTypes.string,
|
|
178
261
|
placeholder: PropTypes.string,
|
|
179
|
-
|
|
262
|
+
errorZindex: PropTypes.string,
|
|
263
|
+
errorBottom: PropTypes.string,
|
|
264
|
+
labelWeight: PropTypes.string,
|
|
265
|
+
errorMessage: PropTypes.string,
|
|
180
266
|
autoComplete: PropTypes.string,
|
|
267
|
+
errorAnimation: PropTypes.bool,
|
|
268
|
+
labelDisplay: PropTypes.string,
|
|
269
|
+
errorPosition: PropTypes.string,
|
|
181
270
|
boxShadowHover: PropTypes.string,
|
|
271
|
+
errorClassName: PropTypes.string,
|
|
272
|
+
backgroundColor: PropTypes.string,
|
|
273
|
+
errorLineHeight: PropTypes.string,
|
|
274
|
+
labelLineHeight: PropTypes.string,
|
|
275
|
+
labelMarginBottom: PropTypes.string,
|
|
276
|
+
errorAnimationDuration: PropTypes.string,
|
|
277
|
+
tooltip: PropTypes.arrayOf(PropTypes.element),
|
|
182
278
|
leftIcon: PropTypes.arrayOf(PropTypes.element),
|
|
183
279
|
rightIcon: PropTypes.arrayOf(PropTypes.element),
|
|
184
280
|
type: PropTypes.oneOf(Object.values(InputTypes)),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
.input-wrap {
|
|
2
2
|
width: 100%;
|
|
3
|
+
position: relative;
|
|
3
4
|
}
|
|
4
5
|
|
|
5
6
|
.input-content {
|
|
@@ -7,24 +8,25 @@
|
|
|
7
8
|
width: 100%;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
.input-title {
|
|
11
|
-
display: block;
|
|
12
|
-
font-size: 16px;
|
|
13
|
-
color: #3c393e;
|
|
14
|
-
font-weight: 500;
|
|
15
|
-
line-height: 22px;
|
|
16
|
-
margin-bottom: 6px;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.inputErrorMessages {
|
|
20
|
-
font-size: 14px;
|
|
21
|
-
line-height: 19px;
|
|
22
|
-
color: rgba(238, 0, 0, 1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
11
|
input:-webkit-autofill,
|
|
26
12
|
input:-webkit-autofill:hover,
|
|
27
13
|
input:-webkit-autofill:focus,
|
|
28
14
|
input:-webkit-autofill:active {
|
|
29
15
|
background-color: inherit !important;
|
|
30
16
|
}
|
|
17
|
+
|
|
18
|
+
.error-message-show {
|
|
19
|
+
animation-name: error-show;
|
|
20
|
+
animation-fill-mode: forwards;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes error-show {
|
|
24
|
+
100% {
|
|
25
|
+
bottom: -20px;
|
|
26
|
+
transform: scale3d(1,1,1);
|
|
27
|
+
-webkit-transform: scale3d(1,1,1);
|
|
28
|
+
-moz-transform: scale3d(1,1,1);
|
|
29
|
+
-ms-transform: scale3d(1,1,1);
|
|
30
|
+
-o-transform: scale3d(1,1,1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import PropTypes
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import styles from "./table.module.css";
|
|
5
5
|
import { Checkbox } from "../checkbox";
|