@xaypay/tui 0.0.53 → 0.0.55
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 +1121 -958
- package/dist/index.js +1121 -957
- package/package.json +7 -5
- package/src/assets/icons/tooltip.svg +3 -0
- package/src/components/button/index.js +29 -20
- package/src/components/input/index.js +134 -34
- package/src/components/input/input.module.css +17 -15
- package/src/components/tooltip/index.js +39 -29
- package/src/components/tooltip/tooltip.module.css +7 -0
- package/src/components/tooltip/tooltip.stories.js +10 -6
- package/src/components/typography/index.js +77 -8
- package/src/components/typography/typography.stories.js +8 -2
- package/src/index.js +11 -11
- package/src/stories/Introduction.stories.mdx +82 -93
- package/src/stories/changelog.stories.mdx +118 -0
- package/src/stories/configuration.stories.mdx +317 -0
- package/src/stories/documentation.stories.mdx +118 -0
- package/tui.config.js +180 -51
- 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.55",
|
|
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",
|
|
@@ -57,5 +58,6 @@
|
|
|
57
58
|
"dependencies": {
|
|
58
59
|
"lodash": "^4.17.21",
|
|
59
60
|
"react-icons": "^4.7.1"
|
|
60
|
-
}
|
|
61
|
+
},
|
|
62
|
+
"bin": "./cli-command.js"
|
|
61
63
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M8 0C3.58214 0 0 3.58214 0 8C0 12.4179 3.58214 16 8 16C12.4179 16 16 12.4179 16 8C16 3.58214 12.4179 0 8 0ZM8.57143 11.8571C8.57143 11.9357 8.50714 12 8.42857 12H7.57143C7.49286 12 7.42857 11.9357 7.42857 11.8571V7C7.42857 6.92143 7.49286 6.85714 7.57143 6.85714H8.42857C8.50714 6.85714 8.57143 6.92143 8.57143 7V11.8571ZM8 5.71429C7.7757 5.70971 7.56213 5.61739 7.40513 5.45714C7.24812 5.2969 7.16018 5.08149 7.16018 4.85714C7.16018 4.6328 7.24812 4.41739 7.40513 4.25714C7.56213 4.0969 7.7757 4.00458 8 4C8.2243 4.00458 8.43787 4.0969 8.59488 4.25714C8.75189 4.41739 8.83982 4.6328 8.83982 4.85714C8.83982 5.08149 8.75189 5.2969 8.59488 5.45714C8.43787 5.61739 8.2243 5.70971 8 5.71429Z" fill="#D1D1D1"/>
|
|
3
|
+
</svg>
|
|
@@ -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,
|
|
20
|
+
bgColor,
|
|
16
21
|
onClick,
|
|
17
|
-
fontSize,
|
|
18
22
|
disabled,
|
|
19
23
|
className,
|
|
20
24
|
boxSizing,
|
|
21
25
|
transition,
|
|
22
26
|
contentWidth,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
disabledThemeLineColor,
|
|
27
|
+
disabledColor,
|
|
28
|
+
textTransform,
|
|
29
|
+
disabledBgColor,
|
|
30
|
+
disabledLineColor,
|
|
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 ?
|
|
71
|
+
(outline || !outline) && disabled ? disabledBgColor ? disabledBgColor : configStyles.BUTTON.disabledBgColor :
|
|
72
|
+
outline && !disabled ? isHover ? bgColor ? bgColor : configStyles.BUTTON.bgColor : '#ffffff' : bgColor ? bgColor : configStyles.BUTTON.bgColor,
|
|
67
73
|
boxShadow:
|
|
68
74
|
outline ?
|
|
69
75
|
disabled ?
|
|
70
|
-
`inset 0 0 0 2px ${
|
|
71
|
-
`inset 0 0 0 2px ${
|
|
76
|
+
`inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` :
|
|
77
|
+
`inset 0 0 0 2px ${bgColor ? bgColor : configStyles.BUTTON.bgColor}` :
|
|
72
78
|
'none',
|
|
73
79
|
color:
|
|
74
|
-
(outline || !outline) && disabled ?
|
|
75
|
-
outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color :
|
|
80
|
+
(outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor :
|
|
81
|
+
outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : bgColor ? bgColor : configStyles.BUTTON.bgColor : 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
|
-
|
|
111
|
+
bgColor: PropTypes.string,
|
|
102
112
|
boxSizing: PropTypes.string,
|
|
103
113
|
className: PropTypes.string,
|
|
104
114
|
transition: PropTypes.string,
|
|
105
115
|
contentWidth: PropTypes.bool,
|
|
106
|
-
|
|
107
|
-
|
|
116
|
+
textTransform: PropTypes.string,
|
|
117
|
+
disabledColor: PropTypes.string,
|
|
118
|
+
disabledBgColor: PropTypes.string,
|
|
108
119
|
label: PropTypes.string.isRequired,
|
|
109
|
-
|
|
110
|
-
disabledThemeBgColor: PropTypes.string,
|
|
111
|
-
disabledThemeLineColor: PropTypes.string,
|
|
120
|
+
disabledLineColor: 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,25 +23,39 @@ 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);
|
|
@@ -48,7 +65,7 @@ export const Input = ({
|
|
|
48
65
|
const random = Math.floor((Math.random() * 1000) + 1);
|
|
49
66
|
const configStyles = compereConfigs();
|
|
50
67
|
const classProps = classnames(
|
|
51
|
-
className
|
|
68
|
+
className ? className : configStyles.INPUT.className
|
|
52
69
|
);
|
|
53
70
|
|
|
54
71
|
const handleChange = (event) => {
|
|
@@ -63,10 +80,39 @@ export const Input = ({
|
|
|
63
80
|
setIsHover(false);
|
|
64
81
|
};
|
|
65
82
|
|
|
83
|
+
const errorShow = keyframes`
|
|
84
|
+
100% {
|
|
85
|
+
bottom: '-20px';
|
|
86
|
+
transform: scale3d(1,1,1);
|
|
87
|
+
-webkit-transform: scale3d(1,1,1);
|
|
88
|
+
-moz-transform: scale3d(1,1,1);
|
|
89
|
+
-ms-transform: scale3d(1,1,1);
|
|
90
|
+
-o-transform: scale3d(1,1,1);
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
const animation = _ => css`
|
|
95
|
+
${errorShow} ${errorAnimationDuration ? errorAnimationDuration : configStyles.INPUT.errorAnimationDuration} forwards
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const P = styled.p`
|
|
99
|
+
animation: ${errorAnimation ? animation : 'none'};
|
|
100
|
+
`;
|
|
101
|
+
|
|
66
102
|
return (
|
|
67
103
|
<div className={`${styles["input-wrap"]}`}>
|
|
68
104
|
{
|
|
69
|
-
label ? <label
|
|
105
|
+
label ? <label
|
|
106
|
+
className={`${styles["input-title"]}`}
|
|
107
|
+
style={{
|
|
108
|
+
color: labelColor ? labelColor : configStyles.INPUT.labelColor,
|
|
109
|
+
fontSize: labelSize ? labelSize : configStyles.INPUT.labelSize,
|
|
110
|
+
display: labelDisplay ? labelDisplay : configStyles.INPUT.labelDisplay,
|
|
111
|
+
fontWeight: labelWeight ? labelWeight : configStyles.INPUT.labelWeight,
|
|
112
|
+
lineHeight: labelLineHeight ? labelLineHeight : configStyles.INPUT.labelLineHeight,
|
|
113
|
+
marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.INPUT.labelMarginBottom
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
70
116
|
{label} {required && <sup style={{ color: "#ee0000" }}>*</sup>}
|
|
71
117
|
</label>
|
|
72
118
|
: ''
|
|
@@ -75,30 +121,49 @@ export const Input = ({
|
|
|
75
121
|
className={`${styles["input-content"]}`}
|
|
76
122
|
style={{
|
|
77
123
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
78
|
-
boxShadow: isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
|
|
124
|
+
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
125
|
}}
|
|
80
126
|
onMouseEnter={handleMouseEnter}
|
|
81
127
|
onMouseLeave={handleMouseLeave}
|
|
82
128
|
>
|
|
83
129
|
{
|
|
84
|
-
leftIcon && leftIcon.length > 0 ?
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
130
|
+
leftIcon && leftIcon.length > 0 && type != 'tel' ?
|
|
131
|
+
<div
|
|
132
|
+
onMouseUp={type === 'password' ? _ => setShow(false) : _ => _}
|
|
133
|
+
onMouseDown={type === 'password' ? _ => setShow(true) : _ => _}
|
|
134
|
+
onMouseOut={type === 'password' ? _ => setShow(false) : _ => _}
|
|
135
|
+
style={{
|
|
136
|
+
cursor: type === 'password' ? 'pointer' : 'default',
|
|
137
|
+
height: height ? height : configStyles.INPUT.height,
|
|
138
|
+
padding: padding ? padding : configStyles.INPUT.padding,
|
|
139
|
+
width: iconWidth ? iconWidth : configStyles.INPUT.iconWidth,
|
|
140
|
+
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
141
|
+
borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
142
|
+
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
143
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
144
|
+
}}
|
|
145
|
+
>
|
|
146
|
+
{type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]}
|
|
147
|
+
</div> : ''
|
|
148
|
+
}
|
|
149
|
+
{
|
|
150
|
+
type === 'tel' ?
|
|
151
|
+
<div
|
|
152
|
+
style={{
|
|
153
|
+
pointerEvents: disabled ? 'none' : 'auto',
|
|
154
|
+
fontSize: size ? size : configStyles.INPUT.size,
|
|
155
|
+
height: height ? height : configStyles.INPUT.height,
|
|
156
|
+
padding: padding ? padding : configStyles.INPUT.padding,
|
|
157
|
+
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
158
|
+
borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
159
|
+
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
160
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
161
|
+
color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
+374
|
|
165
|
+
</div>
|
|
166
|
+
: ''
|
|
102
167
|
}
|
|
103
168
|
<input
|
|
104
169
|
{...props}
|
|
@@ -115,13 +180,13 @@ export const Input = ({
|
|
|
115
180
|
outline: 'none',
|
|
116
181
|
pointerEvents: disabled ? 'none' : 'auto',
|
|
117
182
|
width: width ? width : configStyles.INPUT.width,
|
|
183
|
+
fontSize: size ? size : configStyles.INPUT.size,
|
|
118
184
|
height: height ? height : configStyles.INPUT.height,
|
|
119
185
|
padding: padding ? padding : configStyles.INPUT.padding,
|
|
120
186
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
121
|
-
fontSize: fontSize ? fontSize : configStyles.INPUT.fontSize,
|
|
122
187
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
123
|
-
|
|
124
|
-
|
|
188
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
189
|
+
color: errorMessage && errorColor ? errorColor : color ? color : configStyles.INPUT.color,
|
|
125
190
|
}}
|
|
126
191
|
/>
|
|
127
192
|
{
|
|
@@ -132,14 +197,13 @@ export const Input = ({
|
|
|
132
197
|
onMouseOut={type === 'password' ? _ => setShow(false) : _ => _}
|
|
133
198
|
style={{
|
|
134
199
|
cursor: type === 'password' ? 'pointer' : 'default',
|
|
135
|
-
border: border ? border : configStyles.INPUT.border,
|
|
136
200
|
height: height ? height : configStyles.INPUT.height,
|
|
137
201
|
padding: padding ? padding : configStyles.INPUT.padding,
|
|
138
202
|
width: iconWidth ? iconWidth : configStyles.INPUT.iconWidth,
|
|
139
203
|
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
140
204
|
borderTopRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
141
205
|
borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
142
|
-
backgroundColor: disabled ? '#FBFBFB' :
|
|
206
|
+
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor,
|
|
143
207
|
}}
|
|
144
208
|
>
|
|
145
209
|
{type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]}
|
|
@@ -152,7 +216,25 @@ export const Input = ({
|
|
|
152
216
|
</Typography> : null
|
|
153
217
|
}
|
|
154
218
|
{tooltipStatus ? <p>{tooltip}</p> : null}
|
|
155
|
-
{
|
|
219
|
+
{
|
|
220
|
+
errorMessage ?
|
|
221
|
+
<P
|
|
222
|
+
style={{
|
|
223
|
+
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
224
|
+
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
225
|
+
fontSize: errorSize ? errorSize : configStyles.INPUT.errorSize,
|
|
226
|
+
bottom: errorBottom ? errorBottom : configStyles.INPUT.errorBottom,
|
|
227
|
+
zIndex: errorZindex ? errorZindex : configStyles.INPUT.errorZindex,
|
|
228
|
+
position: errorPosition ? errorPosition : configStyles.INPUT.errorPosition,
|
|
229
|
+
lineHeight: errorLineHeight ? errorLineHeight : configStyles.INPUT.errorLineHeight,
|
|
230
|
+
transform: !errorAnimation ? 'scale3d(1,1,1)' : transform ? transform : configStyles.INPUT.transform,
|
|
231
|
+
}}
|
|
232
|
+
className={errorClassName ? errorClassName : configStyles.INPUT.errorClassName}
|
|
233
|
+
>
|
|
234
|
+
{errorMessage}
|
|
235
|
+
</P>
|
|
236
|
+
: ''
|
|
237
|
+
}
|
|
156
238
|
</div>
|
|
157
239
|
);
|
|
158
240
|
};
|
|
@@ -168,17 +250,35 @@ Input.propTypes = {
|
|
|
168
250
|
disabled: PropTypes.bool,
|
|
169
251
|
height: PropTypes.string,
|
|
170
252
|
radius: PropTypes.string,
|
|
171
|
-
|
|
253
|
+
padding: PropTypes.string,
|
|
172
254
|
fontSize: PropTypes.string,
|
|
173
255
|
tooltip: PropTypes.element,
|
|
256
|
+
transform: PropTypes.string,
|
|
174
257
|
className: PropTypes.string,
|
|
175
258
|
iconWidth: PropTypes.string,
|
|
176
259
|
boxSizing: PropTypes.string,
|
|
177
260
|
boxShadow: PropTypes.string,
|
|
261
|
+
errorSize: PropTypes.string,
|
|
262
|
+
errorLeft: PropTypes.string,
|
|
263
|
+
labelSize: PropTypes.string,
|
|
264
|
+
errorColor: PropTypes.string,
|
|
265
|
+
labelColor: PropTypes.string,
|
|
178
266
|
placeholder: PropTypes.string,
|
|
179
|
-
|
|
267
|
+
errorZindex: PropTypes.string,
|
|
268
|
+
errorBottom: PropTypes.string,
|
|
269
|
+
labelWeight: PropTypes.string,
|
|
270
|
+
errorMessage: PropTypes.string,
|
|
180
271
|
autoComplete: PropTypes.string,
|
|
272
|
+
errorAnimation: PropTypes.bool,
|
|
273
|
+
labelDisplay: PropTypes.string,
|
|
274
|
+
errorPosition: PropTypes.string,
|
|
181
275
|
boxShadowHover: PropTypes.string,
|
|
276
|
+
errorClassName: PropTypes.string,
|
|
277
|
+
backgroundColor: PropTypes.string,
|
|
278
|
+
errorLineHeight: PropTypes.string,
|
|
279
|
+
labelLineHeight: PropTypes.string,
|
|
280
|
+
labelMarginBottom: PropTypes.string,
|
|
281
|
+
errorAnimationDuration: PropTypes.string,
|
|
182
282
|
leftIcon: PropTypes.arrayOf(PropTypes.element),
|
|
183
283
|
rightIcon: PropTypes.arrayOf(PropTypes.element),
|
|
184
284
|
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
|
+
}
|
|
@@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { compereConfigs } from "./../../utils";
|
|
5
5
|
|
|
6
|
+
// import ReactInfoIcon from './../../assets/icons/tooltip.svg';
|
|
7
|
+
|
|
6
8
|
import styles from "./tooltip.module.css";
|
|
7
9
|
|
|
8
10
|
export const Tooltip = ({
|
|
@@ -10,6 +12,7 @@ export const Tooltip = ({
|
|
|
10
12
|
text,
|
|
11
13
|
width,
|
|
12
14
|
color,
|
|
15
|
+
tIcon,
|
|
13
16
|
height,
|
|
14
17
|
bgColor,
|
|
15
18
|
fontSize,
|
|
@@ -55,41 +58,47 @@ export const Tooltip = ({
|
|
|
55
58
|
backgroundColor: bgColor ? bgColor : configStyles.TOOLTIP.bgColor,
|
|
56
59
|
}}
|
|
57
60
|
>
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
className={classProps}
|
|
61
|
-
style={{
|
|
62
|
-
backgroundColor: tBgColor ? tBgColor : configStyles.TOOLTIP.tBgColor,
|
|
63
|
-
borderRadius: tBorderRadius ? tBorderRadius : configStyles.TOOLTIP.tBorderRadius,
|
|
64
|
-
top: type === 'top' ? `calc(-${tooltipHeight + 7}px)` : type === 'bottom' ? 'calc(100% + 7px)' : type === 'left' || type === 'right' ? `calc(50% - ${tooltipHeight / 2}px)` : '0px',
|
|
65
|
-
left: type === 'top' || type === 'bottom' ? `calc(50% - ${tooltipWidth / 2}px)` : type === 'left' ? `-${tooltipWidth + 7}px` : type === 'right' ? 'calc(100% + 7px)' : '0px'
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
61
|
+
{
|
|
62
|
+
showTooltip ?
|
|
68
63
|
<div
|
|
69
|
-
|
|
64
|
+
ref={tooltipRef}
|
|
65
|
+
className={classProps}
|
|
66
|
+
style={{
|
|
67
|
+
backgroundColor: tBgColor ? tBgColor : configStyles.TOOLTIP.tBgColor,
|
|
68
|
+
borderRadius: tBorderRadius ? tBorderRadius : configStyles.TOOLTIP.tBorderRadius,
|
|
69
|
+
top: type === 'top' ? `calc(-${tooltipHeight + 7}px)` : type === 'bottom' ? 'calc(100% + 7px)' : type === 'left' || type === 'right' ? `calc(50% - ${tooltipHeight / 2}px)` : '0px',
|
|
70
|
+
left: type === 'top' || type === 'bottom' ? `calc(50% - ${tooltipWidth / 2}px)` : type === 'left' ? `-${tooltipWidth + 7}px` : type === 'right' ? 'calc(100% + 7px)' : '0px'
|
|
71
|
+
}}
|
|
70
72
|
>
|
|
71
73
|
<div
|
|
72
|
-
className={`${styles['tooltip-
|
|
73
|
-
style={{
|
|
74
|
-
backgroundColor: tBgColor ? tBgColor : configStyles.TOOLTIP.bgColor,
|
|
75
|
-
left: type === 'top' || type === 'bottom' ? 'calc(50% - 5px)' : type === 'right' ? '-15px' : type === 'left' ? 'calc(100% + 5px)' : '0px',
|
|
76
|
-
top: type === 'top' ? 'calc(100% + 5px)' : type === 'bottom' ? '-15px' : type === 'right' || type === 'left' ? 'calc(50% - 5px)' : '0px'
|
|
77
|
-
}}
|
|
78
|
-
></div>
|
|
79
|
-
<p
|
|
80
|
-
style={{
|
|
81
|
-
color: color ? color : configStyles.TOOLTIP.color,
|
|
82
|
-
fontSize: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
83
|
-
lineHeight: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
84
|
-
fontFamily: fontFamily ? fontFamily : configStyles.TOOLTIP.fontFamily
|
|
85
|
-
}}
|
|
74
|
+
className={`${styles['tooltip-rel']}`}
|
|
86
75
|
>
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
<div
|
|
77
|
+
className={`${styles['tooltip-decor']}`}
|
|
78
|
+
style={{
|
|
79
|
+
backgroundColor: tBgColor ? tBgColor : configStyles.TOOLTIP.bgColor,
|
|
80
|
+
left: type === 'top' || type === 'bottom' ? 'calc(50% - 5px)' : type === 'right' ? '-15px' : type === 'left' ? 'calc(100% + 5px)' : '0px',
|
|
81
|
+
top: type === 'top' ? 'calc(100% + 5px)' : type === 'bottom' ? '-15px' : type === 'right' || type === 'left' ? 'calc(50% - 5px)' : '0px'
|
|
82
|
+
}}
|
|
83
|
+
></div>
|
|
84
|
+
<p
|
|
85
|
+
style={{
|
|
86
|
+
color: color ? color : configStyles.TOOLTIP.color,
|
|
87
|
+
fontSize: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
88
|
+
lineHeight: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
89
|
+
fontFamily: fontFamily ? fontFamily : configStyles.TOOLTIP.fontFamily
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{ text }
|
|
93
|
+
</p>
|
|
94
|
+
</div>
|
|
89
95
|
</div>
|
|
96
|
+
: ''
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
<div style={{cursor: 'pointer'}} onClick={handleShow}>
|
|
100
|
+
{/* {tIcon ? tIcon : <img src={ReactInfoIcon} alt="ReactInfoIcon" />} */}
|
|
90
101
|
</div>
|
|
91
|
-
|
|
92
|
-
|
|
93
102
|
</div>
|
|
94
103
|
);
|
|
95
104
|
};
|
|
@@ -97,6 +106,7 @@ export const Tooltip = ({
|
|
|
97
106
|
Tooltip.propTypes = {
|
|
98
107
|
width: PropTypes.string,
|
|
99
108
|
color: PropTypes.string,
|
|
109
|
+
tIcon: PropTypes.element,
|
|
100
110
|
height: PropTypes.string,
|
|
101
111
|
bgColor: PropTypes.string,
|
|
102
112
|
tBgColor: PropTypes.string,
|
|
@@ -7,15 +7,14 @@ export default {
|
|
|
7
7
|
title: "Components/Tooltip",
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
const Template = (args) => {
|
|
11
11
|
return (
|
|
12
12
|
<div
|
|
13
13
|
style={{
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
margin: '100px auto'
|
|
14
|
+
display: 'flex',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
height: 'calc(100vh - 32px)'
|
|
19
18
|
}}
|
|
20
19
|
>
|
|
21
20
|
<Tooltip {...args} />
|
|
@@ -23,4 +22,9 @@ export const Template = (args) => {
|
|
|
23
22
|
);
|
|
24
23
|
};
|
|
25
24
|
|
|
25
|
+
export const Default = Template.bind({});
|
|
26
|
+
Default.args = {
|
|
27
|
+
type: 'bottom',
|
|
28
|
+
text: 'new tooltip'
|
|
29
|
+
}
|
|
26
30
|
|