@xaypay/tui 0.0.51 → 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 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
- function _extends() {
7
- _extends = Object.assign ? Object.assign.bind() : function (target) {
8
- for (var i = 1; i < arguments.length; i++) {
9
- var source = arguments[i];
10
- for (var key in source) {
11
- if (Object.prototype.hasOwnProperty.call(source, key)) {
12
- target[key] = source[key];
13
- }
14
- }
15
- }
16
- return target;
17
- };
18
- return _extends.apply(this, arguments);
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$d = ".button-module_btn__ffRtT{border:none;border-radius:6px;box-sizing:border-box;cursor:pointer;font-size:16px;line-height:20px;max-height:46px;min-height:46px;outline:none;overflow:hidden;padding:12px 20px;text-transform:none;transition:background-color .24s,color .24s}.button-module_btn__ffRtT.button-module_full-size__vmV2E{width:100%}.button-module_btn__ffRtT.button-module_content-size__f7JSE{width:auto}.button-module_btn__ffRtT.button-module_type-filled__BiyVo{background-color:#00236a;color:#fff}.button-module_btn__ffRtT.button-module_type-filled__BiyVo:hover{background-color:#001745}.button-module_btn__ffRtT.button-module_type-filled__BiyVo:disabled{background-color:#eee;color:#3c393e;pointer-events:none}.button-module_btn__ffRtT.button-module_type-outline__RpZ2V{background-color:#fff;box-shadow:inset 0 0 0 2px #00236a}.button-module_btn__ffRtT.button-module_type-outline__RpZ2V:hover{background-color:#001745;color:#fff}.button-module_btn__ffRtT.button-module_type-outline__RpZ2V:disabled{box-shadow:inset 0 0 0 2px #eee;color:#3c393e;pointer-events:none}";
49
- var styles$b = {"btn":"button-module_btn__ffRtT","full-size":"button-module_full-size__vmV2E","content-size":"button-module_content-size__f7JSE","size-default":"button-module_size-default__ydEgl","type-filled":"button-module_type-filled__BiyVo","with-icon":"button-module_with-icon__mfKU-","type-outline":"button-module_type-outline__RpZ2V"};
50
- styleInject(css_248z$d);
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 ButtonType = {
57
- BUTTON: 'button',
58
- RESET: 'reset',
59
- SUBMIT: 'submit'
60
- };
61
- const ButtonTheme = {
62
- DEFAULT: 'content-size',
63
- PRIMARY: 'full-size',
64
- SUCCESS: 'btn-success',
65
- INFO: 'btn-info',
66
- WARNING: 'btn-warning',
67
- DANGER: 'btn-danger',
68
- LINK: 'btn-link'
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
- const ButtonSize = {
71
- SMALL: 'small',
72
- MEDIUM: 'medium',
73
- LARGE: 'large'
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
- primary,
77
- backgroundColor,
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 classProps = classnames(styles$b.btn, styles$b[theme], styles$b[size], outline ? styles$b['type-outline'] : styles$b['type-filled'], className, 'button-rem');
87
- // className='btn type-outline size-default'
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
- type: "button",
90
- className: classProps,
91
- style: backgroundColor && {
92
- backgroundColor
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
- disabled: disabled ? 'disabled' : ''
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.oneOf(Object.values(ButtonType)),
99
- theme: PropTypes.oneOf(Object.values(ButtonTheme)),
100
- size: PropTypes.oneOf(Object.values(ButtonSize)),
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
- * disabled
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
- outline: PropTypes.bool
123
- };
124
- Button.defaultProps = {
125
- backgroundColor: null,
126
- primary: false,
127
- size: 'medium',
128
- onClick: undefined,
129
- outline: false
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 classProps = classnames(className, 'sizes-rem', bold ? 'bold' : '');
156
- const CustomTag = variant;
157
-
158
- // const Tag = ({ className, children }) => (
159
- // <CustomTag
160
- // className={className}
161
- // {...props}
162
- // >
163
- // {children}
164
- // </CustomTag>
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
- onClick: onClick
174
- }, " ", children, " ");
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
- variant: PropTypes.oneOf(Object.values(TypographyType)),
274
+ size: PropTypes.string,
275
+ weight: PropTypes.string,
276
+ onClick: PropTypes.func,
178
277
  className: PropTypes.string,
179
- bold: PropTypes.bool,
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{max-width:400px;position:relative}.input-module_input__-ipHD{border:none;border-radius:6px;box-shadow:inset 0 0 0 2px #d1d1d1;box-sizing:border-box;color:#3c393e;cursor:text;font-size:16px;line-height:20px;outline:none;overflow:hidden;transition:background-color .24s,color .24s}.input-module_input__-ipHD.input-module_full-size__38YG7{width:100%}.input-module_input__-ipHD.input-module_content-size__rZ5EA{width:auto}.input-module_input__-ipHD.input-module_size-medium__frTDq{min-height:46px;padding:12px 15px}.input-module_input__-ipHD:hover{box-shadow:inset 0 0 0 2px #3c393e}.input-module_input__-ipHD:active{box-shadow:inset 0 0 0 2px #00236a}.input-module_inputErrorMessages__hx490{animation:input-module_error-message-show__OrVSo .24s forwards;bottom:0;color:#e00;font-size:14px;left:0;line-height:19px;position:absolute;transform:scale3d(0,0,0);z-index:1}.input-module_labelInput__sUMKQ{color:#000}.input-module_input__-ipHD.input-module_state-disabled__402v0{background-color:#fbfbfb;pointer-events:none}.input-module_input__-ipHD.input-module_error-message__7NphF{box-shadow:inset 0 0 0 2px #e00}.input-module_input-title__giCsY{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}@keyframes input-module_error-message-show__OrVSo{to{bottom:-20px;transform:scaleX(1)}}";
409
- var styles$8 = {"input-wrap":"input-module_input-wrap__NunrE","input":"input-module_input__-ipHD","full-size":"input-module_full-size__38YG7","content-size":"input-module_content-size__rZ5EA","size-medium":"input-module_size-medium__frTDq","with-icon":"input-module_with-icon__w3jTW","inputErrorMessages":"input-module_inputErrorMessages__hx490","error-message-show":"input-module_error-message-show__OrVSo","labelInput":"input-module_labelInput__sUMKQ","state-disabled":"input-module_state-disabled__402v0","error-message":"input-module_error-message__7NphF","input-title":"input-module_input-title__giCsY"};
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
- size,
510
+ type,
511
+ name,
426
512
  color,
427
- className,
428
513
  label,
429
- regexp,
430
- regexpError,
431
- errorMesage,
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
- value,
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 [inputValue, setInputValue] = useState(value);
442
- const [eyeStatus, setEyeStatus] = useState("");
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
- setInputValue(event.target.value);
446
- onChange ? onChange(event.target.value) : "";
546
+ onChange ? onChange(event.target.value) : _ => _;
447
547
  };
448
- document.onmouseup = () => {
449
- setEyeStatus("");
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"]} input-wrap-rem`
555
+ className: `${styles$8["input-wrap"]}`
464
556
  }, label ? /*#__PURE__*/React.createElement("label", {
465
- className: `${styles$8["input-title"]} input-title-rem`
557
+ className: `${styles$8["input-title"]}`
466
558
  }, label, " ", required && /*#__PURE__*/React.createElement("sup", {
467
559
  style: {
468
560
  color: "#ee0000"
469
561
  }
470
- }, "*")) : "", /*#__PURE__*/React.createElement("input", _extends({}, props, {
471
- type: eyeStatus || type,
472
- className: classProps,
473
- style: color && {
474
- color
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
- disabled: disabled ? disabled : "",
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
- value: inputValue
479
- })), type === "password" && showEye ? /*#__PURE__*/React.createElement("p", {
480
- onMouseDown: () => {
481
- setEyeStatus("text");
482
- },
483
- onMouseUp: () => {
484
- setEyeStatus("");
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
- }, "\uD83D\uDC41") : null, tooltip ? /*#__PURE__*/React.createElement(Typography, {
487
- variant: "p",
488
- onClick: () => {
489
- setTooltipStatus(!tooltipStatus);
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
- }, "\u24D8") : null, tooltipStatus ? /*#__PURE__*/React.createElement("p", null, tooltip) : null, eMessage ? /*#__PURE__*/React.createElement("span", {
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
- }, eMessage) : "");
626
+ }, errorMesage) : "");
494
627
  };
495
628
  Input.propTypes = {
496
- type: PropTypes.oneOf(Object.values(InputTypes)),
497
- size: PropTypes.oneOf(Object.values(InputSizes)),
629
+ name: PropTypes.string,
498
630
  color: PropTypes.string,
499
- className: PropTypes.string,
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
- value: PropTypes.string,
508
- showEye: PropTypes.bool,
509
- tooltip: PropTypes.string
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
- label: "",
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}";
@@ -1106,7 +1242,10 @@ const Modal = ({
1106
1242
  className: `${styles$1["modal-wrap"]} modal-wrap-rem`,
1107
1243
  onClick: () => setShow(false)
1108
1244
  }, type == "content" ? /*#__PURE__*/React.createElement("div", {
1109
- className: `${styles$1["modal-content"]} modal-content-rem`
1245
+ className: `${styles$1["modal-content"]} modal-content-rem`,
1246
+ onClick: e => {
1247
+ e.stopPropagation();
1248
+ }
1110
1249
  }, /*#__PURE__*/React.createElement("div", {
1111
1250
  className: `${styles$1["modal-top"]} modal-top-rem`
1112
1251
  }, /*#__PURE__*/React.createElement("div", {
@@ -1122,7 +1261,10 @@ const Modal = ({
1122
1261
  }))), /*#__PURE__*/React.createElement("div", {
1123
1262
  className: `${styles$1["modal-section"]} modal-section-rem`
1124
1263
  }, children)) : type == "images" ? /*#__PURE__*/React.createElement("div", {
1125
- className: `${styles$1["modal-content"]} modal-content-rem`
1264
+ className: `${styles$1["modal-content"]} modal-content-rem`,
1265
+ onClick: e => {
1266
+ e.stopPropagation();
1267
+ }
1126
1268
  }, /*#__PURE__*/React.createElement("div", {
1127
1269
  className: `${styles$1["close-btn"]} close-btn-rem`,
1128
1270
  onClick: () => setShow(false)
@@ -1247,4 +1389,4 @@ Table.defaultProps = {
1247
1389
  hearderData: []
1248
1390
  };
1249
1391
 
1250
- export { Autocomplate, Button, ButtonSize, ButtonTheme, ButtonType, Captcha, Checkbox, File, Input, InputSizes, InputTypes, Modal, Pagination, Radio, Select, SelectSize, SelectTheme, Stepper, Table, Typography, TypographyType };
1392
+ export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, Pagination, Radio, Select, SelectSize, SelectTheme, Stepper, Table, Tooltip, Typography, TypographyType };