@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.js CHANGED
@@ -5,29 +5,31 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var React = require('react');
6
6
  var PropTypes = require('prop-types');
7
7
  var classnames = require('classnames');
8
- var styled = require('styled-components');
9
8
 
10
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
10
 
12
11
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
13
12
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
14
13
  var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
15
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
16
14
 
17
- function _extends() {
18
- _extends = Object.assign ? Object.assign.bind() : function (target) {
19
- for (var i = 1; i < arguments.length; i++) {
20
- var source = arguments[i];
21
- for (var key in source) {
22
- if (Object.prototype.hasOwnProperty.call(source, key)) {
23
- target[key] = source[key];
24
- }
25
- }
26
- }
27
- return target;
28
- };
29
- return _extends.apply(this, arguments);
30
- }
15
+ const _ = require('lodash');
16
+ const compereConfigs = () => {
17
+ let projectConfig = {};
18
+ let packageConfig = {};
19
+ try {
20
+ packageConfig = require('../tui.config.js');
21
+ } catch (error) {
22
+ // console.log(error, 'Package: tui.config.js file is not define');
23
+ }
24
+ try {
25
+ projectConfig = require('../../../../tui.config.js');
26
+ } catch (error) {
27
+ projectConfig = {};
28
+ // console.log(error, 'Project: if you want to use custom styles, create tui.config.js file in your project root');
29
+ }
30
+
31
+ return _.merge(packageConfig, projectConfig);
32
+ };
31
33
 
32
34
  function styleInject(css, ref) {
33
35
  if ( ref === void 0 ) ref = {};
@@ -56,144 +58,234 @@ function styleInject(css, ref) {
56
58
  }
57
59
  }
58
60
 
59
- 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}";
60
- 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"};
61
- styleInject(css_248z$d);
62
-
63
- /**
64
- * Primary UI component for user interaction
65
- */
61
+ 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}";
62
+ var styles$b = {"tooltip":"tooltip-module_tooltip__emM6A","tooltip-rel":"tooltip-module_tooltip-rel__to9gq","tooltip-decor":"tooltip-module_tooltip-decor__qvt7t"};
63
+ styleInject(css_248z$c);
66
64
 
67
- const ButtonType = {
68
- BUTTON: 'button',
69
- RESET: 'reset',
70
- SUBMIT: 'submit'
71
- };
72
- const ButtonTheme = {
73
- DEFAULT: 'content-size',
74
- PRIMARY: 'full-size',
75
- SUCCESS: 'btn-success',
76
- INFO: 'btn-info',
77
- WARNING: 'btn-warning',
78
- DANGER: 'btn-danger',
79
- LINK: 'btn-link'
65
+ const Tooltip = ({
66
+ type,
67
+ text,
68
+ width,
69
+ color,
70
+ height,
71
+ bgColor,
72
+ fontSize,
73
+ tBgColor,
74
+ className,
75
+ fontFamily,
76
+ borderRadius,
77
+ tBorderRadius
78
+ }) => {
79
+ const tooltipRef = /*#__PURE__*/React.createRef(null);
80
+ const [tooltipWidth, setTooltipWidth] = React.useState(0);
81
+ const [tooltipHeight, setTooltipHeight] = React.useState(0);
82
+ React.useState(false);
83
+ const configStyles = compereConfigs();
84
+ const classProps = classnames__default["default"](styles$b['tooltip'], className);
85
+ React.useEffect(_ => {
86
+ if (!type && !text) {
87
+ alert('Add type and text on tooltip');
88
+ } else if (!type) {
89
+ alert('Add type on tooltip');
90
+ } else if (!text) {
91
+ alert('Add text on tooltip');
92
+ }
93
+ tooltipRef.current && tooltipRef.current.clientWidth && tooltipRef.current.clientWidth > 0 && setTooltipWidth(tooltipRef.current.clientWidth);
94
+ tooltipRef.current && tooltipRef.current.clientHeight && tooltipRef.current.clientHeight > 0 && setTooltipHeight(tooltipRef.current.clientHeight);
95
+ }, [type, text, tooltipWidth, tooltipRef]);
96
+ return /*#__PURE__*/React__default["default"].createElement("div", {
97
+ className: `${styles$b['tooltip-block']}`,
98
+ style: {
99
+ width: width ? width : configStyles.TOOLTIP.width,
100
+ height: height ? height : configStyles.TOOLTIP.height,
101
+ backgroundColor: bgColor ? bgColor : configStyles.TOOLTIP.bgColor
102
+ }
103
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
104
+ ref: tooltipRef,
105
+ className: classProps,
106
+ style: {
107
+ backgroundColor: tBgColor ? tBgColor : configStyles.TOOLTIP.tBgColor,
108
+ borderRadius: tBorderRadius ? tBorderRadius : configStyles.TOOLTIP.tBorderRadius,
109
+ top: type === 'top' ? `calc(-${tooltipHeight + 7}px)` : type === 'bottom' ? 'calc(100% + 7px)' : type === 'left' || type === 'right' ? `calc(50% - ${tooltipHeight / 2}px)` : '0px',
110
+ left: type === 'top' || type === 'bottom' ? `calc(50% - ${tooltipWidth / 2}px)` : type === 'left' ? `-${tooltipWidth + 7}px` : type === 'right' ? 'calc(100% + 7px)' : '0px'
111
+ }
112
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
113
+ className: `${styles$b['tooltip-rel']}`
114
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
115
+ className: `${styles$b['tooltip-decor']}`,
116
+ style: {
117
+ backgroundColor: tBgColor ? tBgColor : configStyles.TOOLTIP.bgColor,
118
+ left: type === 'top' || type === 'bottom' ? 'calc(50% - 5px)' : type === 'right' ? '-15px' : type === 'left' ? 'calc(100% + 5px)' : '0px',
119
+ top: type === 'top' ? 'calc(100% + 5px)' : type === 'bottom' ? '-15px' : type === 'right' || type === 'left' ? 'calc(50% - 5px)' : '0px'
120
+ }
121
+ }), /*#__PURE__*/React__default["default"].createElement("p", {
122
+ style: {
123
+ color: color ? color : configStyles.TOOLTIP.color,
124
+ fontSize: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
125
+ lineHeight: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
126
+ fontFamily: fontFamily ? fontFamily : configStyles.TOOLTIP.fontFamily
127
+ }
128
+ }, text))));
80
129
  };
81
- const ButtonSize = {
82
- SMALL: 'small',
83
- MEDIUM: 'medium',
84
- LARGE: 'large'
130
+ Tooltip.propTypes = {
131
+ width: PropTypes__default["default"].string,
132
+ color: PropTypes__default["default"].string,
133
+ height: PropTypes__default["default"].string,
134
+ bgColor: PropTypes__default["default"].string,
135
+ tBgColor: PropTypes__default["default"].string,
136
+ fontSize: PropTypes__default["default"].string,
137
+ className: PropTypes__default["default"].string,
138
+ fontFamily: PropTypes__default["default"].string,
139
+ borderRadius: PropTypes__default["default"].string,
140
+ tBorderRadius: PropTypes__default["default"].string,
141
+ type: PropTypes__default["default"].string.isRequired,
142
+ text: PropTypes__default["default"].string.isRequired
85
143
  };
144
+
145
+ function _extends() {
146
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
147
+ for (var i = 1; i < arguments.length; i++) {
148
+ var source = arguments[i];
149
+ for (var key in source) {
150
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
151
+ target[key] = source[key];
152
+ }
153
+ }
154
+ }
155
+ return target;
156
+ };
157
+ return _extends.apply(this, arguments);
158
+ }
159
+
86
160
  const Button = ({
87
- primary,
88
- backgroundColor,
89
- theme,
90
- size,
91
- className,
92
- disabled,
161
+ type,
162
+ color,
93
163
  label,
164
+ width,
165
+ height,
166
+ cursor,
167
+ border,
94
168
  outline,
169
+ padding,
170
+ onClick,
171
+ fontSize,
172
+ disabled,
173
+ className,
174
+ boxSizing,
175
+ transition,
176
+ contentWidth,
177
+ borderRadius,
178
+ backgroundColor,
179
+ disabledThemeColor,
180
+ disabledThemeBgColor,
181
+ disabledThemeLineColor,
95
182
  ...props
96
183
  }) => {
97
- const classProps = classnames__default["default"](styles$b.btn, styles$b[theme], styles$b[size], outline ? styles$b['type-outline'] : styles$b['type-filled'], className, 'button-rem');
98
- // className='btn type-outline size-default'
184
+ const [isHover, setIsHover] = React.useState(false);
185
+ React.useEffect(() => {
186
+ if (!label) {
187
+ alert('Button component: label prop is required, please add it!!!');
188
+ }
189
+ }, []);
190
+ const configStyles = compereConfigs();
191
+ const classProps = classnames__default["default"](className);
192
+ const handleMouseEnter = () => {
193
+ setIsHover(true);
194
+ };
195
+ const handleMouseLeave = () => {
196
+ setIsHover(false);
197
+ };
99
198
  return /*#__PURE__*/React__default["default"].createElement("button", _extends({
100
- type: "button",
101
- className: classProps,
102
- style: backgroundColor && {
103
- backgroundColor
199
+ style: {
200
+ height: height ? height : configStyles.BUTTON.height,
201
+ padding: padding ? padding : configStyles.BUTTON.padding,
202
+ fontSize: fontSize ? fontSize : configStyles.BUTTON.fontSize,
203
+ boxSizing: boxSizing ? boxSizing : configStyles.BUTTON.boxSizing,
204
+ transition: transition ? transition : configStyles.BUTTON.transition,
205
+ border: outline ? 'none' : border ? border : configStyles.BUTTON.border,
206
+ width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
207
+ borderRadius: borderRadius ? borderRadius : configStyles.BUTTON.borderRadius,
208
+ cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
209
+ backgroundColor: (outline || !outline) && disabled ? disabledThemeBgColor ? disabledThemeBgColor : configStyles.BUTTON.disabledThemeBgColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.bgColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.bgColor,
210
+ boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledThemeLineColor ? disabledThemeLineColor : configStyles.BUTTON.disabledThemeLineColor}` : `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.bgColor}` : 'none',
211
+ 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
104
212
  },
105
- disabled: disabled ? 'disabled' : ''
213
+ type: type ? type : configStyles.BUTTON.type,
214
+ disabled: disabled ? disabled : configStyles.BUTTON.disabled,
215
+ onClick: disabled ? _ => _ : type !== 'submit' ? onClick ? onClick : _ => alert('Add click event handler on Button component') : _ => _,
216
+ onMouseEnter: handleMouseEnter,
217
+ onMouseLeave: handleMouseLeave,
218
+ className: classProps
106
219
  }, props), label);
107
220
  };
108
221
  Button.propTypes = {
109
- type: PropTypes__default["default"].oneOf(Object.values(ButtonType)),
110
- theme: PropTypes__default["default"].oneOf(Object.values(ButtonTheme)),
111
- size: PropTypes__default["default"].oneOf(Object.values(ButtonSize)),
112
- /**
113
- * What background color to use
114
- */
115
- backgroundColor: PropTypes__default["default"].string,
116
- /**
117
- * How large should the button be?
118
- */
119
- // size: PropTypes.oneOf(['small', 'medium', 'large']),
120
- /**
121
- * Button contents
122
- */
123
- label: PropTypes__default["default"].string.isRequired,
124
- /**
125
- * Optional click handler
126
- */
222
+ type: PropTypes__default["default"].string,
223
+ color: PropTypes__default["default"].string,
224
+ width: PropTypes__default["default"].string,
225
+ outline: PropTypes__default["default"].bool,
127
226
  onClick: PropTypes__default["default"].func,
128
- /**
129
- * disabled
130
- */
227
+ height: PropTypes__default["default"].string,
228
+ cursor: PropTypes__default["default"].string,
229
+ border: PropTypes__default["default"].string,
131
230
  disabled: PropTypes__default["default"].bool,
231
+ padding: PropTypes__default["default"].string,
232
+ fontSize: PropTypes__default["default"].string,
233
+ boxSizing: PropTypes__default["default"].string,
132
234
  className: PropTypes__default["default"].string,
133
- outline: PropTypes__default["default"].bool
134
- };
135
- Button.defaultProps = {
136
- backgroundColor: null,
137
- primary: false,
138
- size: 'medium',
139
- onClick: undefined,
140
- outline: false
235
+ transition: PropTypes__default["default"].string,
236
+ contentWidth: PropTypes__default["default"].bool,
237
+ borderRadius: PropTypes__default["default"].string,
238
+ backgroundColor: PropTypes__default["default"].string,
239
+ label: PropTypes__default["default"].string.isRequired,
240
+ disabledThemeColor: PropTypes__default["default"].string,
241
+ disabledThemeBgColor: PropTypes__default["default"].string,
242
+ disabledThemeLineColor: PropTypes__default["default"].string
141
243
  };
142
244
 
143
- 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}";
144
- styleInject(css_248z$c);
145
-
146
245
  const TypographyType = {
246
+ p: 'p',
147
247
  h1: 'h1',
148
248
  h2: 'h2',
149
249
  h3: 'h3',
150
250
  h4: 'h4',
151
251
  h5: 'h5',
152
252
  h6: 'h6',
153
- span: 'span',
154
- p: 'p',
155
- i: 'i'
253
+ span: 'span'
156
254
  };
157
255
  const Typography = ({
256
+ size,
257
+ weight,
158
258
  onClick,
159
259
  variant,
160
- className,
161
- color,
162
- bold,
163
260
  children,
261
+ className,
164
262
  ...props
165
263
  }) => {
166
- const classProps = classnames__default["default"](className, 'sizes-rem', bold ? 'bold' : '');
167
- const CustomTag = variant;
168
-
169
- // const Tag = ({ className, children }) => (
170
- // <CustomTag
171
- // className={className}
172
- // {...props}
173
- // >
174
- // {children}
175
- // </CustomTag>
176
- // );
177
-
178
- const StyledTypograpy = styled__default["default"](CustomTag)`
179
- ${color ? 'color: ' + color + ';' : ''}
180
- ${bold ? 'font-weight: bold;' : ''}
181
- `;
182
- return /*#__PURE__*/React__default["default"].createElement(StyledTypograpy, {
264
+ const [validVariant, setValidVariant] = React.useState(false);
265
+ const configStyles = compereConfigs();
266
+ const classProps = classnames__default["default"](className);
267
+ React.useEffect(() => {
268
+ if (!Object.values(TypographyType).includes(variant)) {
269
+ setValidVariant(true);
270
+ }
271
+ }, [variant]);
272
+ const tagT = /*#__PURE__*/React__default["default"].createElement(variant, {
273
+ ...props,
183
274
  className: classProps,
184
- onClick: onClick
185
- }, " ", children, " ");
275
+ style: {
276
+ fontSize: size ? size : configStyles.TYPOGRAPHY['fSize' + variant],
277
+ fontWeight: weight ? weight : configStyles.TYPOGRAPHY['fWeight' + variant]
278
+ },
279
+ onClick: onClick ? onClick : _ => _
280
+ }, [children]);
281
+ return validVariant ? 'Please set Typography valid variant' : tagT;
186
282
  };
187
283
  Typography.propTypes = {
188
- variant: PropTypes__default["default"].oneOf(Object.values(TypographyType)),
284
+ size: PropTypes__default["default"].string,
285
+ weight: PropTypes__default["default"].string,
286
+ onClick: PropTypes__default["default"].func,
189
287
  className: PropTypes__default["default"].string,
190
- bold: PropTypes__default["default"].bool,
191
- color: PropTypes__default["default"].string,
192
- onClick: PropTypes__default["default"].func
193
- };
194
- Typography.defaultProps = {
195
- variant: 'h1',
196
- onClick: () => {}
288
+ variant: PropTypes__default["default"].oneOf(Object.values(TypographyType)).isRequired
197
289
  };
198
290
 
199
291
  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}";
@@ -416,118 +508,161 @@ Checkbox.defaultProps = {
416
508
  var css_248z$9 = "";
417
509
  styleInject(css_248z$9);
418
510
 
419
- 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)}}";
420
- 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"};
511
+ 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}";
512
+ 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"};
421
513
  styleInject(css_248z$8);
422
514
 
423
515
  const InputTypes = {
424
516
  TEXT: "text",
425
- PASSWORD: "password",
426
- EMAIL: "email",
427
- NUMBER: "number",
428
- TEL: "tel"
429
- };
430
- const InputSizes = {
431
- SMALL: "size-small",
432
- MEDIUM: "size-medium",
433
- LARGE: "size-large"
517
+ PASSWORD: "password"
434
518
  };
435
519
  const Input = ({
436
- size,
520
+ type,
521
+ name,
437
522
  color,
438
- className,
439
523
  label,
440
- regexp,
441
- regexpError,
442
- errorMesage,
524
+ value,
525
+ width,
526
+ height,
527
+ radius,
528
+ border,
529
+ padding,
530
+ tooltip,
531
+ bgColor,
532
+ leftIcon,
533
+ fontSize,
443
534
  required,
444
- showEye,
445
535
  disabled,
446
- type,
447
- tooltip,
448
536
  onChange,
449
- value,
537
+ iconWidth,
538
+ rightIcon,
539
+ className,
540
+ boxSizing,
541
+ boxShadow,
542
+ errorMesage,
543
+ borderColor,
544
+ placeholder,
545
+ autoComplete,
546
+ boxShadowHover,
450
547
  ...props
451
548
  }) => {
452
- const [inputValue, setInputValue] = React.useState(value);
453
- const [eyeStatus, setEyeStatus] = React.useState("");
549
+ const [show, setShow] = React.useState(false);
550
+ const [isHover, setIsHover] = React.useState(false);
454
551
  const [tooltipStatus, setTooltipStatus] = React.useState(false);
552
+ const random = Math.floor(Math.random() * 1000 + 1);
553
+ const configStyles = compereConfigs();
554
+ const classProps = classnames__default["default"](className);
455
555
  const handleChange = event => {
456
- setInputValue(event.target.value);
457
- onChange ? onChange(event.target.value) : "";
556
+ onChange ? onChange(event.target.value) : _ => _;
458
557
  };
459
- document.onmouseup = () => {
460
- setEyeStatus("");
558
+ const handleMouseEnter = () => {
559
+ setIsHover(true);
560
+ };
561
+ const handleMouseLeave = () => {
562
+ setIsHover(false);
461
563
  };
462
- React.useEffect(() => {
463
- setInputValue(value);
464
- }, [value]);
465
- let eMessage = "";
466
- if (errorMesage) {
467
- eMessage = errorMesage;
468
- } else if (regexp) {
469
- const regex = new RegExp(regexp);
470
- eMessage = regex.test(inputValue) ? "" : regexpError;
471
- }
472
- const classProps = classnames__default["default"](styles$8.input, styles$8[size], eMessage != "" ? styles$8["error-message"] : "", className, "input-inner-rem");
473
564
  return /*#__PURE__*/React__default["default"].createElement("div", {
474
- className: `${styles$8["input-wrap"]} input-wrap-rem`
565
+ className: `${styles$8["input-wrap"]}`
475
566
  }, label ? /*#__PURE__*/React__default["default"].createElement("label", {
476
- className: `${styles$8["input-title"]} input-title-rem`
567
+ className: `${styles$8["input-title"]}`
477
568
  }, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
478
569
  style: {
479
570
  color: "#ee0000"
480
571
  }
481
- }, "*")) : "", /*#__PURE__*/React__default["default"].createElement("input", _extends({}, props, {
482
- type: eyeStatus || type,
483
- className: classProps,
484
- style: color && {
485
- color
572
+ }, "*")) : '', /*#__PURE__*/React__default["default"].createElement("div", {
573
+ className: `${styles$8["input-content"]}`,
574
+ style: {
575
+ borderRadius: radius ? radius : configStyles.INPUT.radius,
576
+ boxShadow: isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
486
577
  },
487
- disabled: disabled ? disabled : "",
578
+ onMouseEnter: handleMouseEnter,
579
+ onMouseLeave: handleMouseLeave
580
+ }, leftIcon && leftIcon.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
581
+ onMouseUp: type === 'password' ? _ => setShow(false) : _ => _,
582
+ onMouseDown: type === 'password' ? _ => setShow(true) : _ => _,
583
+ onMouseOut: type === 'password' ? _ => setShow(false) : _ => _,
584
+ style: {
585
+ cursor: type === 'password' ? 'pointer' : 'default',
586
+ height: height ? height : configStyles.INPUT.height,
587
+ padding: padding ? padding : configStyles.INPUT.padding,
588
+ width: iconWidth ? iconWidth : configStyles.INPUT.iconWidth,
589
+ boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
590
+ borderTopLeftRadius: radius ? radius : configStyles.INPUT.radius,
591
+ borderBottomLeftRadius: radius ? radius : configStyles.INPUT.radius,
592
+ backgroundColor: disabled ? '#FBFBFB' : bgColor ? bgColor : configStyles.INPUT.bgColor
593
+ }
594
+ }, type === 'password' ? show ? leftIcon[1] : leftIcon[0] : leftIcon[0]) : '', /*#__PURE__*/React__default["default"].createElement("input", _extends({}, props, {
595
+ value: value,
596
+ className: classProps,
488
597
  onChange: handleChange,
489
- value: inputValue
490
- })), type === "password" && showEye ? /*#__PURE__*/React__default["default"].createElement("p", {
491
- onMouseDown: () => {
492
- setEyeStatus("text");
493
- },
494
- onMouseUp: () => {
495
- setEyeStatus("");
598
+ type: show ? 'text' : type,
599
+ disabled: disabled ? disabled : "",
600
+ name: name ? name : `tui_${random}_tui`,
601
+ placeholder: placeholder ? placeholder : '',
602
+ autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
603
+ style: {
604
+ border: 'none',
605
+ outline: 'none',
606
+ pointerEvents: disabled ? 'none' : 'auto',
607
+ width: width ? width : configStyles.INPUT.width,
608
+ height: height ? height : configStyles.INPUT.height,
609
+ padding: padding ? padding : configStyles.INPUT.padding,
610
+ borderRadius: radius ? radius : configStyles.INPUT.radius,
611
+ fontSize: fontSize ? fontSize : configStyles.INPUT.fontSize,
612
+ boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
613
+ color: errorMesage ? 'rgba(238, 0, 0, 1)' : color ? color : configStyles.INPUT.color,
614
+ backgroundColor: disabled ? '#FBFBFB' : bgColor ? bgColor : configStyles.INPUT.bgColor
496
615
  }
497
- }, "\uD83D\uDC41") : null, tooltip ? /*#__PURE__*/React__default["default"].createElement(Typography, {
498
- variant: "p",
499
- onClick: () => {
500
- setTooltipStatus(!tooltipStatus);
616
+ })), rightIcon && rightIcon.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
617
+ onMouseUp: type === 'password' ? _ => setShow(false) : _ => _,
618
+ onMouseDown: type === 'password' ? _ => setShow(true) : _ => _,
619
+ onMouseOut: type === 'password' ? _ => setShow(false) : _ => _,
620
+ style: {
621
+ cursor: type === 'password' ? 'pointer' : 'default',
622
+ border: border ? border : configStyles.INPUT.border,
623
+ height: height ? height : configStyles.INPUT.height,
624
+ padding: padding ? padding : configStyles.INPUT.padding,
625
+ width: iconWidth ? iconWidth : configStyles.INPUT.iconWidth,
626
+ boxSizing: boxSizing ? boxSizing : configStyles.INPUT.boxSizing,
627
+ borderTopRightRadius: radius ? radius : configStyles.INPUT.radius,
628
+ borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
629
+ backgroundColor: disabled ? '#FBFBFB' : bgColor ? bgColor : configStyles.INPUT.bgColor
501
630
  }
502
- }, "\u24D8") : null, tooltipStatus ? /*#__PURE__*/React__default["default"].createElement("p", null, tooltip) : null, eMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
631
+ }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? /*#__PURE__*/React__default["default"].createElement(Typography, {
632
+ variant: "p",
633
+ onClick: () => setTooltipStatus(!tooltipStatus)
634
+ }, "\u24D8") : null, tooltipStatus ? /*#__PURE__*/React__default["default"].createElement("p", null, tooltip) : null, errorMesage ? /*#__PURE__*/React__default["default"].createElement("span", {
503
635
  className: styles$8.inputErrorMessages
504
- }, eMessage) : "");
636
+ }, errorMesage) : "");
505
637
  };
506
638
  Input.propTypes = {
507
- type: PropTypes__default["default"].oneOf(Object.values(InputTypes)),
508
- size: PropTypes__default["default"].oneOf(Object.values(InputSizes)),
639
+ name: PropTypes__default["default"].string,
509
640
  color: PropTypes__default["default"].string,
510
- className: PropTypes__default["default"].string,
641
+ value: PropTypes__default["default"].string,
642
+ width: PropTypes__default["default"].string,
643
+ label: PropTypes__default["default"].string,
511
644
  onChange: PropTypes__default["default"].func,
512
645
  required: PropTypes__default["default"].bool,
513
- errorMesage: PropTypes__default["default"].string,
514
- regexp: PropTypes__default["default"].string,
515
- regexpError: PropTypes__default["default"].string,
516
- label: PropTypes__default["default"].string.isRequired,
517
646
  disabled: PropTypes__default["default"].bool,
518
- value: PropTypes__default["default"].string,
519
- showEye: PropTypes__default["default"].bool,
520
- tooltip: PropTypes__default["default"].string
647
+ height: PropTypes__default["default"].string,
648
+ radius: PropTypes__default["default"].string,
649
+ bgColor: PropTypes__default["default"].string,
650
+ fontSize: PropTypes__default["default"].string,
651
+ tooltip: PropTypes__default["default"].element,
652
+ className: PropTypes__default["default"].string,
653
+ iconWidth: PropTypes__default["default"].string,
654
+ boxSizing: PropTypes__default["default"].string,
655
+ boxShadow: PropTypes__default["default"].string,
656
+ placeholder: PropTypes__default["default"].string,
657
+ errorMesage: PropTypes__default["default"].string,
658
+ autoComplete: PropTypes__default["default"].string,
659
+ boxShadowHover: PropTypes__default["default"].string,
660
+ leftIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
661
+ rightIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
662
+ type: PropTypes__default["default"].oneOf(Object.values(InputTypes))
521
663
  };
522
664
  Input.defaultProps = {
523
- label: "",
524
- color: null,
525
- size: InputSizes.MEDIUM,
526
- onChange: undefined,
527
- required: false,
528
- errorMesage: "",
529
- type: "text",
530
- value: ""
665
+ type: "text"
531
666
  };
532
667
 
533
668
  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}";
@@ -1117,7 +1252,10 @@ const Modal = ({
1117
1252
  className: `${styles$1["modal-wrap"]} modal-wrap-rem`,
1118
1253
  onClick: () => setShow(false)
1119
1254
  }, type == "content" ? /*#__PURE__*/React__default["default"].createElement("div", {
1120
- className: `${styles$1["modal-content"]} modal-content-rem`
1255
+ className: `${styles$1["modal-content"]} modal-content-rem`,
1256
+ onClick: e => {
1257
+ e.stopPropagation();
1258
+ }
1121
1259
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1122
1260
  className: `${styles$1["modal-top"]} modal-top-rem`
1123
1261
  }, /*#__PURE__*/React__default["default"].createElement("div", {
@@ -1133,7 +1271,10 @@ const Modal = ({
1133
1271
  }))), /*#__PURE__*/React__default["default"].createElement("div", {
1134
1272
  className: `${styles$1["modal-section"]} modal-section-rem`
1135
1273
  }, children)) : type == "images" ? /*#__PURE__*/React__default["default"].createElement("div", {
1136
- className: `${styles$1["modal-content"]} modal-content-rem`
1274
+ className: `${styles$1["modal-content"]} modal-content-rem`,
1275
+ onClick: e => {
1276
+ e.stopPropagation();
1277
+ }
1137
1278
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1138
1279
  className: `${styles$1["close-btn"]} close-btn-rem`,
1139
1280
  onClick: () => setShow(false)
@@ -1260,14 +1401,10 @@ Table.defaultProps = {
1260
1401
 
1261
1402
  exports.Autocomplate = Autocomplate;
1262
1403
  exports.Button = Button;
1263
- exports.ButtonSize = ButtonSize;
1264
- exports.ButtonTheme = ButtonTheme;
1265
- exports.ButtonType = ButtonType;
1266
1404
  exports.Captcha = Captcha;
1267
1405
  exports.Checkbox = Checkbox;
1268
1406
  exports.File = File;
1269
1407
  exports.Input = Input;
1270
- exports.InputSizes = InputSizes;
1271
1408
  exports.InputTypes = InputTypes;
1272
1409
  exports.Modal = Modal;
1273
1410
  exports.Pagination = Pagination;
@@ -1277,5 +1414,6 @@ exports.SelectSize = SelectSize;
1277
1414
  exports.SelectTheme = SelectTheme;
1278
1415
  exports.Stepper = Stepper;
1279
1416
  exports.Table = Table;
1417
+ exports.Tooltip = Tooltip;
1280
1418
  exports.Typography = Typography;
1281
1419
  exports.TypographyType = TypographyType;