@xaypay/tui 0.0.52 → 0.0.53
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/index.es.js +331 -195
- package/dist/index.js +330 -198
- package/package.json +7 -3
- package/src/components/button/button.stories.js +3 -24
- package/src/components/button/index.js +88 -67
- package/src/components/input/index.js +149 -95
- package/src/components/input/input.module.css +15 -83
- package/src/components/input/input.stories.js +1 -20
- package/src/components/tooltip/index.js +110 -0
- package/src/components/tooltip/tooltip.module.css +39 -0
- package/src/components/tooltip/tooltip.stories.js +26 -0
- package/src/components/typography/index.js +43 -36
- package/src/components/typography/typography.module.css +2 -7
- package/src/components/typography/typography.stories.js +3 -16
- package/src/index.js +1 -0
- package/src/utils/index.js +21 -0
- package/tui.config.js +61 -0
- package/src/components/button/button.module.css +0 -66
package/dist/index.es.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import React, { useState, useEffect, useMemo, useRef } from 'react';
|
|
1
|
+
import React, { useState, useEffect, createRef, useMemo, useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
|
-
import styled from 'styled-components';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
const _ = require('lodash');
|
|
6
|
+
const compereConfigs = () => {
|
|
7
|
+
let projectConfig = {};
|
|
8
|
+
let packageConfig = {};
|
|
9
|
+
try {
|
|
10
|
+
packageConfig = require('../tui.config.js');
|
|
11
|
+
} catch (error) {
|
|
12
|
+
// console.log(error, 'Package: tui.config.js file is not define');
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
projectConfig = require('../../../../tui.config.js');
|
|
16
|
+
} catch (error) {
|
|
17
|
+
projectConfig = {};
|
|
18
|
+
// console.log(error, 'Project: if you want to use custom styles, create tui.config.js file in your project root');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return _.merge(packageConfig, projectConfig);
|
|
22
|
+
};
|
|
20
23
|
|
|
21
24
|
function styleInject(css, ref) {
|
|
22
25
|
if ( ref === void 0 ) ref = {};
|
|
@@ -45,144 +48,234 @@ function styleInject(css, ref) {
|
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
var css_248z$
|
|
49
|
-
var styles$b = {"
|
|
50
|
-
styleInject(css_248z$
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Primary UI component for user interaction
|
|
54
|
-
*/
|
|
51
|
+
var css_248z$c = ".tooltip-module_tooltip__emM6A{padding:10px;position:absolute;z-index:1}.tooltip-module_tooltip-rel__to9gq{align-items:center;border-radius:5px;-webkit-border-radius:5px;-moz-border-radius:5px;-ms-border-radius:5px;-o-border-radius:5px;display:flex;height:auto;justify-content:center;min-height:20px;min-width:50px;position:relative;width:auto}.tooltip-module_tooltip-decor__qvt7t{border-radius:2px;-webkit-border-radius:2px;-moz-border-radius:2px;-ms-border-radius:2px;-o-border-radius:2px;height:10px;position:absolute;transform:rotate(45deg);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);width:10px;z-index:-1}";
|
|
52
|
+
var styles$b = {"tooltip":"tooltip-module_tooltip__emM6A","tooltip-rel":"tooltip-module_tooltip-rel__to9gq","tooltip-decor":"tooltip-module_tooltip-decor__qvt7t"};
|
|
53
|
+
styleInject(css_248z$c);
|
|
55
54
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
const Tooltip = ({
|
|
56
|
+
type,
|
|
57
|
+
text,
|
|
58
|
+
width,
|
|
59
|
+
color,
|
|
60
|
+
height,
|
|
61
|
+
bgColor,
|
|
62
|
+
fontSize,
|
|
63
|
+
tBgColor,
|
|
64
|
+
className,
|
|
65
|
+
fontFamily,
|
|
66
|
+
borderRadius,
|
|
67
|
+
tBorderRadius
|
|
68
|
+
}) => {
|
|
69
|
+
const tooltipRef = /*#__PURE__*/createRef(null);
|
|
70
|
+
const [tooltipWidth, setTooltipWidth] = useState(0);
|
|
71
|
+
const [tooltipHeight, setTooltipHeight] = useState(0);
|
|
72
|
+
useState(false);
|
|
73
|
+
const configStyles = compereConfigs();
|
|
74
|
+
const classProps = classnames(styles$b['tooltip'], className);
|
|
75
|
+
useEffect(_ => {
|
|
76
|
+
if (!type && !text) {
|
|
77
|
+
alert('Add type and text on tooltip');
|
|
78
|
+
} else if (!type) {
|
|
79
|
+
alert('Add type on tooltip');
|
|
80
|
+
} else if (!text) {
|
|
81
|
+
alert('Add text on tooltip');
|
|
82
|
+
}
|
|
83
|
+
tooltipRef.current && tooltipRef.current.clientWidth && tooltipRef.current.clientWidth > 0 && setTooltipWidth(tooltipRef.current.clientWidth);
|
|
84
|
+
tooltipRef.current && tooltipRef.current.clientHeight && tooltipRef.current.clientHeight > 0 && setTooltipHeight(tooltipRef.current.clientHeight);
|
|
85
|
+
}, [type, text, tooltipWidth, tooltipRef]);
|
|
86
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
87
|
+
className: `${styles$b['tooltip-block']}`,
|
|
88
|
+
style: {
|
|
89
|
+
width: width ? width : configStyles.TOOLTIP.width,
|
|
90
|
+
height: height ? height : configStyles.TOOLTIP.height,
|
|
91
|
+
backgroundColor: bgColor ? bgColor : configStyles.TOOLTIP.bgColor
|
|
92
|
+
}
|
|
93
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
94
|
+
ref: tooltipRef,
|
|
95
|
+
className: classProps,
|
|
96
|
+
style: {
|
|
97
|
+
backgroundColor: tBgColor ? tBgColor : configStyles.TOOLTIP.tBgColor,
|
|
98
|
+
borderRadius: tBorderRadius ? tBorderRadius : configStyles.TOOLTIP.tBorderRadius,
|
|
99
|
+
top: type === 'top' ? `calc(-${tooltipHeight + 7}px)` : type === 'bottom' ? 'calc(100% + 7px)' : type === 'left' || type === 'right' ? `calc(50% - ${tooltipHeight / 2}px)` : '0px',
|
|
100
|
+
left: type === 'top' || type === 'bottom' ? `calc(50% - ${tooltipWidth / 2}px)` : type === 'left' ? `-${tooltipWidth + 7}px` : type === 'right' ? 'calc(100% + 7px)' : '0px'
|
|
101
|
+
}
|
|
102
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: `${styles$b['tooltip-rel']}`
|
|
104
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
105
|
+
className: `${styles$b['tooltip-decor']}`,
|
|
106
|
+
style: {
|
|
107
|
+
backgroundColor: tBgColor ? tBgColor : configStyles.TOOLTIP.bgColor,
|
|
108
|
+
left: type === 'top' || type === 'bottom' ? 'calc(50% - 5px)' : type === 'right' ? '-15px' : type === 'left' ? 'calc(100% + 5px)' : '0px',
|
|
109
|
+
top: type === 'top' ? 'calc(100% + 5px)' : type === 'bottom' ? '-15px' : type === 'right' || type === 'left' ? 'calc(50% - 5px)' : '0px'
|
|
110
|
+
}
|
|
111
|
+
}), /*#__PURE__*/React.createElement("p", {
|
|
112
|
+
style: {
|
|
113
|
+
color: color ? color : configStyles.TOOLTIP.color,
|
|
114
|
+
fontSize: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
115
|
+
lineHeight: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
116
|
+
fontFamily: fontFamily ? fontFamily : configStyles.TOOLTIP.fontFamily
|
|
117
|
+
}
|
|
118
|
+
}, text))));
|
|
69
119
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
120
|
+
Tooltip.propTypes = {
|
|
121
|
+
width: PropTypes.string,
|
|
122
|
+
color: PropTypes.string,
|
|
123
|
+
height: PropTypes.string,
|
|
124
|
+
bgColor: PropTypes.string,
|
|
125
|
+
tBgColor: PropTypes.string,
|
|
126
|
+
fontSize: PropTypes.string,
|
|
127
|
+
className: PropTypes.string,
|
|
128
|
+
fontFamily: PropTypes.string,
|
|
129
|
+
borderRadius: PropTypes.string,
|
|
130
|
+
tBorderRadius: PropTypes.string,
|
|
131
|
+
type: PropTypes.string.isRequired,
|
|
132
|
+
text: PropTypes.string.isRequired
|
|
74
133
|
};
|
|
134
|
+
|
|
135
|
+
function _extends() {
|
|
136
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
137
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
138
|
+
var source = arguments[i];
|
|
139
|
+
for (var key in source) {
|
|
140
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
141
|
+
target[key] = source[key];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return target;
|
|
146
|
+
};
|
|
147
|
+
return _extends.apply(this, arguments);
|
|
148
|
+
}
|
|
149
|
+
|
|
75
150
|
const Button = ({
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
theme,
|
|
79
|
-
size,
|
|
80
|
-
className,
|
|
81
|
-
disabled,
|
|
151
|
+
type,
|
|
152
|
+
color,
|
|
82
153
|
label,
|
|
154
|
+
width,
|
|
155
|
+
height,
|
|
156
|
+
cursor,
|
|
157
|
+
border,
|
|
83
158
|
outline,
|
|
159
|
+
padding,
|
|
160
|
+
onClick,
|
|
161
|
+
fontSize,
|
|
162
|
+
disabled,
|
|
163
|
+
className,
|
|
164
|
+
boxSizing,
|
|
165
|
+
transition,
|
|
166
|
+
contentWidth,
|
|
167
|
+
borderRadius,
|
|
168
|
+
backgroundColor,
|
|
169
|
+
disabledThemeColor,
|
|
170
|
+
disabledThemeBgColor,
|
|
171
|
+
disabledThemeLineColor,
|
|
84
172
|
...props
|
|
85
173
|
}) => {
|
|
86
|
-
const
|
|
87
|
-
|
|
174
|
+
const [isHover, setIsHover] = useState(false);
|
|
175
|
+
useEffect(() => {
|
|
176
|
+
if (!label) {
|
|
177
|
+
alert('Button component: label prop is required, please add it!!!');
|
|
178
|
+
}
|
|
179
|
+
}, []);
|
|
180
|
+
const configStyles = compereConfigs();
|
|
181
|
+
const classProps = classnames(className);
|
|
182
|
+
const handleMouseEnter = () => {
|
|
183
|
+
setIsHover(true);
|
|
184
|
+
};
|
|
185
|
+
const handleMouseLeave = () => {
|
|
186
|
+
setIsHover(false);
|
|
187
|
+
};
|
|
88
188
|
return /*#__PURE__*/React.createElement("button", _extends({
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
189
|
+
style: {
|
|
190
|
+
height: height ? height : configStyles.BUTTON.height,
|
|
191
|
+
padding: padding ? padding : configStyles.BUTTON.padding,
|
|
192
|
+
fontSize: fontSize ? fontSize : configStyles.BUTTON.fontSize,
|
|
193
|
+
boxSizing: boxSizing ? boxSizing : configStyles.BUTTON.boxSizing,
|
|
194
|
+
transition: transition ? transition : configStyles.BUTTON.transition,
|
|
195
|
+
border: outline ? 'none' : border ? border : configStyles.BUTTON.border,
|
|
196
|
+
width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
|
|
197
|
+
borderRadius: borderRadius ? borderRadius : configStyles.BUTTON.borderRadius,
|
|
198
|
+
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
|
|
199
|
+
backgroundColor: (outline || !outline) && disabled ? disabledThemeBgColor ? disabledThemeBgColor : configStyles.BUTTON.disabledThemeBgColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.bgColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.bgColor,
|
|
200
|
+
boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledThemeLineColor ? disabledThemeLineColor : configStyles.BUTTON.disabledThemeLineColor}` : `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.bgColor}` : 'none',
|
|
201
|
+
color: (outline || !outline) && disabled ? disabledThemeColor ? disabledThemeColor : configStyles.BUTTON.disabledThemeColor : outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.bgColor : color ? color : configStyles.BUTTON.color
|
|
93
202
|
},
|
|
94
|
-
|
|
203
|
+
type: type ? type : configStyles.BUTTON.type,
|
|
204
|
+
disabled: disabled ? disabled : configStyles.BUTTON.disabled,
|
|
205
|
+
onClick: disabled ? _ => _ : type !== 'submit' ? onClick ? onClick : _ => alert('Add click event handler on Button component') : _ => _,
|
|
206
|
+
onMouseEnter: handleMouseEnter,
|
|
207
|
+
onMouseLeave: handleMouseLeave,
|
|
208
|
+
className: classProps
|
|
95
209
|
}, props), label);
|
|
96
210
|
};
|
|
97
211
|
Button.propTypes = {
|
|
98
|
-
type: PropTypes.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
* What background color to use
|
|
103
|
-
*/
|
|
104
|
-
backgroundColor: PropTypes.string,
|
|
105
|
-
/**
|
|
106
|
-
* How large should the button be?
|
|
107
|
-
*/
|
|
108
|
-
// size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
109
|
-
/**
|
|
110
|
-
* Button contents
|
|
111
|
-
*/
|
|
112
|
-
label: PropTypes.string.isRequired,
|
|
113
|
-
/**
|
|
114
|
-
* Optional click handler
|
|
115
|
-
*/
|
|
212
|
+
type: PropTypes.string,
|
|
213
|
+
color: PropTypes.string,
|
|
214
|
+
width: PropTypes.string,
|
|
215
|
+
outline: PropTypes.bool,
|
|
116
216
|
onClick: PropTypes.func,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
217
|
+
height: PropTypes.string,
|
|
218
|
+
cursor: PropTypes.string,
|
|
219
|
+
border: PropTypes.string,
|
|
120
220
|
disabled: PropTypes.bool,
|
|
221
|
+
padding: PropTypes.string,
|
|
222
|
+
fontSize: PropTypes.string,
|
|
223
|
+
boxSizing: PropTypes.string,
|
|
121
224
|
className: PropTypes.string,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
backgroundColor:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
225
|
+
transition: PropTypes.string,
|
|
226
|
+
contentWidth: PropTypes.bool,
|
|
227
|
+
borderRadius: PropTypes.string,
|
|
228
|
+
backgroundColor: PropTypes.string,
|
|
229
|
+
label: PropTypes.string.isRequired,
|
|
230
|
+
disabledThemeColor: PropTypes.string,
|
|
231
|
+
disabledThemeBgColor: PropTypes.string,
|
|
232
|
+
disabledThemeLineColor: PropTypes.string
|
|
130
233
|
};
|
|
131
234
|
|
|
132
|
-
var css_248z$c = "h1{font-size:70px;line-height:78px}h1,h2{font-weight:400;text-transform:uppercase}h2{font-size:50px;line-height:56px}h3{font-size:38px;font-weight:400;line-height:44px;text-transform:uppercase}h4{font-size:24px;line-height:28px}h4,h5{font-weight:600;text-transform:uppercase}h5{font-size:20px;line-height:26px}h6{font-size:14px;font-weight:600;line-height:20px;text-transform:none}p{font-size:13px;line-height:18px}p,span{color:#3c393e;font-weight:500;text-transform:none}span{font-size:12px;line-height:16px}i{font-family:icomoon;font-style:inherit}";
|
|
133
|
-
styleInject(css_248z$c);
|
|
134
|
-
|
|
135
235
|
const TypographyType = {
|
|
236
|
+
p: 'p',
|
|
136
237
|
h1: 'h1',
|
|
137
238
|
h2: 'h2',
|
|
138
239
|
h3: 'h3',
|
|
139
240
|
h4: 'h4',
|
|
140
241
|
h5: 'h5',
|
|
141
242
|
h6: 'h6',
|
|
142
|
-
span: 'span'
|
|
143
|
-
p: 'p',
|
|
144
|
-
i: 'i'
|
|
243
|
+
span: 'span'
|
|
145
244
|
};
|
|
146
245
|
const Typography = ({
|
|
246
|
+
size,
|
|
247
|
+
weight,
|
|
147
248
|
onClick,
|
|
148
249
|
variant,
|
|
149
|
-
className,
|
|
150
|
-
color,
|
|
151
|
-
bold,
|
|
152
250
|
children,
|
|
251
|
+
className,
|
|
153
252
|
...props
|
|
154
253
|
}) => {
|
|
155
|
-
const
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
// );
|
|
166
|
-
|
|
167
|
-
const StyledTypograpy = styled(CustomTag)`
|
|
168
|
-
${color ? 'color: ' + color + ';' : ''}
|
|
169
|
-
${bold ? 'font-weight: bold;' : ''}
|
|
170
|
-
`;
|
|
171
|
-
return /*#__PURE__*/React.createElement(StyledTypograpy, {
|
|
254
|
+
const [validVariant, setValidVariant] = useState(false);
|
|
255
|
+
const configStyles = compereConfigs();
|
|
256
|
+
const classProps = classnames(className);
|
|
257
|
+
useEffect(() => {
|
|
258
|
+
if (!Object.values(TypographyType).includes(variant)) {
|
|
259
|
+
setValidVariant(true);
|
|
260
|
+
}
|
|
261
|
+
}, [variant]);
|
|
262
|
+
const tagT = /*#__PURE__*/React.createElement(variant, {
|
|
263
|
+
...props,
|
|
172
264
|
className: classProps,
|
|
173
|
-
|
|
174
|
-
|
|
265
|
+
style: {
|
|
266
|
+
fontSize: size ? size : configStyles.TYPOGRAPHY['fSize' + variant],
|
|
267
|
+
fontWeight: weight ? weight : configStyles.TYPOGRAPHY['fWeight' + variant]
|
|
268
|
+
},
|
|
269
|
+
onClick: onClick ? onClick : _ => _
|
|
270
|
+
}, [children]);
|
|
271
|
+
return validVariant ? 'Please set Typography valid variant' : tagT;
|
|
175
272
|
};
|
|
176
273
|
Typography.propTypes = {
|
|
177
|
-
|
|
274
|
+
size: PropTypes.string,
|
|
275
|
+
weight: PropTypes.string,
|
|
276
|
+
onClick: PropTypes.func,
|
|
178
277
|
className: PropTypes.string,
|
|
179
|
-
|
|
180
|
-
color: PropTypes.string,
|
|
181
|
-
onClick: PropTypes.func
|
|
182
|
-
};
|
|
183
|
-
Typography.defaultProps = {
|
|
184
|
-
variant: 'h1',
|
|
185
|
-
onClick: () => {}
|
|
278
|
+
variant: PropTypes.oneOf(Object.values(TypographyType)).isRequired
|
|
186
279
|
};
|
|
187
280
|
|
|
188
281
|
var css_248z$b = ".autocomplate-module_autocomplate-content__UbIUT{display:flex;flex-direction:column;position:relative}.autocomplate-module_autocomplate-content-top__FVgCp{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.autocomplate-module_autocomplate-content-top__FVgCp.autocomplate-module_active__40fdV{border-color:#00236a}.autocomplate-module_autocomplate-content-top__FVgCp:hover{border-color:#3c393e}.autocomplate-module_autocomplate-content-bottom__yk0zP{animation:autocomplate-module_select-show__7Uap4 .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.autocomplate-module_autocomplate-content-bottom-inner__rF5IF{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes autocomplate-module_select-show__7Uap4{to{max-height:400px}}.autocomplate-module_autocomplate-content-bottom-row__dRsZa{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;height:46px;line-height:22px;margin-bottom:2px;padding:0 15px;transition:background .24s,color .24s}.autocomplate-module_autocomplate-content-bottom-row__dRsZa .autocomplate-module_no-option__xv0-E{color:red}.autocomplate-module_autocomplate-content-bottom-row__dRsZa:hover{background:unset;color:#00236a}.autocomplate-module_option-active__WuH4I .autocomplate-module_autocomplate-content-bottom-row__dRsZa{color:#00236a}.autocomplate-module_autocomplate-title__3Qxqz{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.autocomplate-module_errorBorder__LV-nb{border:2px solid #e00!important}.autocomplate-module_errorMessage__Gchpc{color:#e00!important}";
|
|
@@ -405,118 +498,161 @@ Checkbox.defaultProps = {
|
|
|
405
498
|
var css_248z$9 = "";
|
|
406
499
|
styleInject(css_248z$9);
|
|
407
500
|
|
|
408
|
-
var css_248z$8 = ".input-module_input-wrap__NunrE{
|
|
409
|
-
var styles$8 = {"input-wrap":"input-module_input-wrap__NunrE","input
|
|
501
|
+
var css_248z$8 = ".input-module_input-wrap__NunrE{width:100%}.input-module_input-content__kP7lZ{display:flex;width:100%}.input-module_input-title__giCsY{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px}.input-module_inputErrorMessages__hx490{color:#e00;font-size:14px;line-height:19px}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{background-color:inherit!important}";
|
|
502
|
+
var styles$8 = {"input-wrap":"input-module_input-wrap__NunrE","input-content":"input-module_input-content__kP7lZ","input-title":"input-module_input-title__giCsY","inputErrorMessages":"input-module_inputErrorMessages__hx490"};
|
|
410
503
|
styleInject(css_248z$8);
|
|
411
504
|
|
|
412
505
|
const InputTypes = {
|
|
413
506
|
TEXT: "text",
|
|
414
|
-
PASSWORD: "password"
|
|
415
|
-
EMAIL: "email",
|
|
416
|
-
NUMBER: "number",
|
|
417
|
-
TEL: "tel"
|
|
418
|
-
};
|
|
419
|
-
const InputSizes = {
|
|
420
|
-
SMALL: "size-small",
|
|
421
|
-
MEDIUM: "size-medium",
|
|
422
|
-
LARGE: "size-large"
|
|
507
|
+
PASSWORD: "password"
|
|
423
508
|
};
|
|
424
509
|
const Input = ({
|
|
425
|
-
|
|
510
|
+
type,
|
|
511
|
+
name,
|
|
426
512
|
color,
|
|
427
|
-
className,
|
|
428
513
|
label,
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
514
|
+
value,
|
|
515
|
+
width,
|
|
516
|
+
height,
|
|
517
|
+
radius,
|
|
518
|
+
border,
|
|
519
|
+
padding,
|
|
520
|
+
tooltip,
|
|
521
|
+
bgColor,
|
|
522
|
+
leftIcon,
|
|
523
|
+
fontSize,
|
|
432
524
|
required,
|
|
433
|
-
showEye,
|
|
434
525
|
disabled,
|
|
435
|
-
type,
|
|
436
|
-
tooltip,
|
|
437
526
|
onChange,
|
|
438
|
-
|
|
527
|
+
iconWidth,
|
|
528
|
+
rightIcon,
|
|
529
|
+
className,
|
|
530
|
+
boxSizing,
|
|
531
|
+
boxShadow,
|
|
532
|
+
errorMesage,
|
|
533
|
+
borderColor,
|
|
534
|
+
placeholder,
|
|
535
|
+
autoComplete,
|
|
536
|
+
boxShadowHover,
|
|
439
537
|
...props
|
|
440
538
|
}) => {
|
|
441
|
-
const [
|
|
442
|
-
const [
|
|
539
|
+
const [show, setShow] = useState(false);
|
|
540
|
+
const [isHover, setIsHover] = useState(false);
|
|
443
541
|
const [tooltipStatus, setTooltipStatus] = useState(false);
|
|
542
|
+
const random = Math.floor(Math.random() * 1000 + 1);
|
|
543
|
+
const configStyles = compereConfigs();
|
|
544
|
+
const classProps = classnames(className);
|
|
444
545
|
const handleChange = event => {
|
|
445
|
-
|
|
446
|
-
onChange ? onChange(event.target.value) : "";
|
|
546
|
+
onChange ? onChange(event.target.value) : _ => _;
|
|
447
547
|
};
|
|
448
|
-
|
|
449
|
-
|
|
548
|
+
const handleMouseEnter = () => {
|
|
549
|
+
setIsHover(true);
|
|
550
|
+
};
|
|
551
|
+
const handleMouseLeave = () => {
|
|
552
|
+
setIsHover(false);
|
|
450
553
|
};
|
|
451
|
-
useEffect(() => {
|
|
452
|
-
setInputValue(value);
|
|
453
|
-
}, [value]);
|
|
454
|
-
let eMessage = "";
|
|
455
|
-
if (errorMesage) {
|
|
456
|
-
eMessage = errorMesage;
|
|
457
|
-
} else if (regexp) {
|
|
458
|
-
const regex = new RegExp(regexp);
|
|
459
|
-
eMessage = regex.test(inputValue) ? "" : regexpError;
|
|
460
|
-
}
|
|
461
|
-
const classProps = classnames(styles$8.input, styles$8[size], eMessage != "" ? styles$8["error-message"] : "", className, "input-inner-rem");
|
|
462
554
|
return /*#__PURE__*/React.createElement("div", {
|
|
463
|
-
className: `${styles$8["input-wrap"]}
|
|
555
|
+
className: `${styles$8["input-wrap"]}`
|
|
464
556
|
}, label ? /*#__PURE__*/React.createElement("label", {
|
|
465
|
-
className: `${styles$8["input-title"]}
|
|
557
|
+
className: `${styles$8["input-title"]}`
|
|
466
558
|
}, label, " ", required && /*#__PURE__*/React.createElement("sup", {
|
|
467
559
|
style: {
|
|
468
560
|
color: "#ee0000"
|
|
469
561
|
}
|
|
470
|
-
}, "*")) :
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
562
|
+
}, "*")) : '', /*#__PURE__*/React.createElement("div", {
|
|
563
|
+
className: `${styles$8["input-content"]}`,
|
|
564
|
+
style: {
|
|
565
|
+
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
566
|
+
boxShadow: isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
|
|
475
567
|
},
|
|
476
|
-
|
|
568
|
+
onMouseEnter: handleMouseEnter,
|
|
569
|
+
onMouseLeave: handleMouseLeave
|
|
570
|
+
}, leftIcon && leftIcon.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
571
|
+
onMouseUp: type === 'password' ? _ => setShow(false) : _ => _,
|
|
572
|
+
onMouseDown: type === 'password' ? _ => setShow(true) : _ => _,
|
|
573
|
+
onMouseOut: type === 'password' ? _ => setShow(false) : _ => _,
|
|
574
|
+
style: {
|
|
575
|
+
cursor: type === 'password' ? 'pointer' : 'default',
|
|
576
|
+
height: height ? height : configStyles.INPUT.height,
|
|
577
|
+
padding: padding ? padding : configStyles.INPUT.padding,
|
|
578
|
+
width: iconWidth ? iconWidth : configStyles.INPUT.iconWidth,
|
|
579
|
+
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
580
|
+
borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
581
|
+
borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
|
|
582
|
+
backgroundColor: disabled ? '#FBFBFB' : bgColor ? bgColor : configStyles.INPUT.bgColor
|
|
583
|
+
}
|
|
584
|
+
}, type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]) : '', /*#__PURE__*/React.createElement("input", _extends({}, props, {
|
|
585
|
+
value: value,
|
|
586
|
+
className: classProps,
|
|
477
587
|
onChange: handleChange,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
588
|
+
type: show ? 'text' : type,
|
|
589
|
+
disabled: disabled ? disabled : "",
|
|
590
|
+
name: name ? name : `tui_${random}_tui`,
|
|
591
|
+
placeholder: placeholder ? placeholder : '',
|
|
592
|
+
autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
|
|
593
|
+
style: {
|
|
594
|
+
border: 'none',
|
|
595
|
+
outline: 'none',
|
|
596
|
+
pointerEvents: disabled ? 'none' : 'auto',
|
|
597
|
+
width: width ? width : configStyles.INPUT.width,
|
|
598
|
+
height: height ? height : configStyles.INPUT.height,
|
|
599
|
+
padding: padding ? padding : configStyles.INPUT.padding,
|
|
600
|
+
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
601
|
+
fontSize: fontSize ? fontSize : configStyles.INPUT.fontSize,
|
|
602
|
+
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
603
|
+
color: errorMesage ? 'rgba(238, 0, 0, 1)' : color ? color : configStyles.INPUT.color,
|
|
604
|
+
backgroundColor: disabled ? '#FBFBFB' : bgColor ? bgColor : configStyles.INPUT.bgColor
|
|
485
605
|
}
|
|
486
|
-
},
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
606
|
+
})), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
607
|
+
onMouseUp: type === 'password' ? _ => setShow(false) : _ => _,
|
|
608
|
+
onMouseDown: type === 'password' ? _ => setShow(true) : _ => _,
|
|
609
|
+
onMouseOut: type === 'password' ? _ => setShow(false) : _ => _,
|
|
610
|
+
style: {
|
|
611
|
+
cursor: type === 'password' ? 'pointer' : 'default',
|
|
612
|
+
border: border ? border : configStyles.INPUT.border,
|
|
613
|
+
height: height ? height : configStyles.INPUT.height,
|
|
614
|
+
padding: padding ? padding : configStyles.INPUT.padding,
|
|
615
|
+
width: iconWidth ? iconWidth : configStyles.INPUT.iconWidth,
|
|
616
|
+
boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
|
|
617
|
+
borderTopRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
618
|
+
borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
619
|
+
backgroundColor: disabled ? '#FBFBFB' : bgColor ? bgColor : configStyles.INPUT.bgColor
|
|
490
620
|
}
|
|
491
|
-
},
|
|
621
|
+
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? /*#__PURE__*/React.createElement(Typography, {
|
|
622
|
+
variant: "p",
|
|
623
|
+
onClick: () => setTooltipStatus(!tooltipStatus)
|
|
624
|
+
}, "\u24D8") : null, tooltipStatus ? /*#__PURE__*/React.createElement("p", null, tooltip) : null, errorMesage ? /*#__PURE__*/React.createElement("span", {
|
|
492
625
|
className: styles$8.inputErrorMessages
|
|
493
|
-
},
|
|
626
|
+
}, errorMesage) : "");
|
|
494
627
|
};
|
|
495
628
|
Input.propTypes = {
|
|
496
|
-
|
|
497
|
-
size: PropTypes.oneOf(Object.values(InputSizes)),
|
|
629
|
+
name: PropTypes.string,
|
|
498
630
|
color: PropTypes.string,
|
|
499
|
-
|
|
631
|
+
value: PropTypes.string,
|
|
632
|
+
width: PropTypes.string,
|
|
633
|
+
label: PropTypes.string,
|
|
500
634
|
onChange: PropTypes.func,
|
|
501
635
|
required: PropTypes.bool,
|
|
502
|
-
errorMesage: PropTypes.string,
|
|
503
|
-
regexp: PropTypes.string,
|
|
504
|
-
regexpError: PropTypes.string,
|
|
505
|
-
label: PropTypes.string.isRequired,
|
|
506
636
|
disabled: PropTypes.bool,
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
637
|
+
height: PropTypes.string,
|
|
638
|
+
radius: PropTypes.string,
|
|
639
|
+
bgColor: PropTypes.string,
|
|
640
|
+
fontSize: PropTypes.string,
|
|
641
|
+
tooltip: PropTypes.element,
|
|
642
|
+
className: PropTypes.string,
|
|
643
|
+
iconWidth: PropTypes.string,
|
|
644
|
+
boxSizing: PropTypes.string,
|
|
645
|
+
boxShadow: PropTypes.string,
|
|
646
|
+
placeholder: PropTypes.string,
|
|
647
|
+
errorMesage: PropTypes.string,
|
|
648
|
+
autoComplete: PropTypes.string,
|
|
649
|
+
boxShadowHover: PropTypes.string,
|
|
650
|
+
leftIcon: PropTypes.arrayOf(PropTypes.element),
|
|
651
|
+
rightIcon: PropTypes.arrayOf(PropTypes.element),
|
|
652
|
+
type: PropTypes.oneOf(Object.values(InputTypes))
|
|
510
653
|
};
|
|
511
654
|
Input.defaultProps = {
|
|
512
|
-
|
|
513
|
-
color: null,
|
|
514
|
-
size: InputSizes.MEDIUM,
|
|
515
|
-
onChange: undefined,
|
|
516
|
-
required: false,
|
|
517
|
-
errorMesage: "",
|
|
518
|
-
type: "text",
|
|
519
|
-
value: ""
|
|
655
|
+
type: "text"
|
|
520
656
|
};
|
|
521
657
|
|
|
522
658
|
var css_248z$7 = ".pagination-module_listItem__b1-WN:focus{background-color:#4caf50;color:#fff}.pagination-module_listItem__b1-WN:hover:not(.pagination-module_active__KwBDp){background-color:#ddd}.pagination-module_pagination-bar__MrtYT{display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;justify-content:center}.pagination-module_pagination-btn__w8Yh8{border:none;border-radius:6px;outline:none}.pagination-module_pagination-btn__w8Yh8,.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{align-items:center;background-color:#fff;box-shadow:0 0 0 1px #eee;cursor:pointer;display:flex;height:34px;justify-content:center;width:34px}.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{border-radius:6px;flex:0 0 auto;font-size:13px;line-height:16px;position:relative;transition:background-color .24s}.pagination-module_pagination-item__t3emS:hover{background-color:#eee}.pagination-module_pagination-item__t3emS.pagination-module_selected__EXzCA{background-color:#00236a;color:#fff}.pagination-module_pagination-jump-next-arrow__aEVD8,.pagination-module_pagination-jump-next-txt__e7nFj{align-items:center;bottom:0;display:flex;font-size:12px;justify-content:center;left:0;line-height:14px;margin:auto;position:absolute;right:0;top:0;transition:opacity .24s,color .24s}.pagination-module_pagination-jump-next-arrow__aEVD8{opacity:0}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-arrow__aEVD8{opacity:1}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-txt__e7nFj{opacity:0}i{color:#3c393e;font-size:12px;line-height:12px}";
|
|
@@ -1253,4 +1389,4 @@ Table.defaultProps = {
|
|
|
1253
1389
|
hearderData: []
|
|
1254
1390
|
};
|
|
1255
1391
|
|
|
1256
|
-
export { Autocomplate, Button,
|
|
1392
|
+
export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, Pagination, Radio, Select, SelectSize, SelectTheme, Stepper, Table, Tooltip, Typography, TypographyType };
|