@xaypay/tui 0.0.56 → 0.0.58

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
@@ -108,6 +108,12 @@ const File = ({
108
108
  setFileName('no selected file');
109
109
  document.querySelector(`.${name}`).value = "";
110
110
  };
111
+ React.useEffect(() => {
112
+ return () => {
113
+ setError('');
114
+ setImage(null);
115
+ };
116
+ }, []);
111
117
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("p", {
112
118
  className: `${styles$b['file-form-title']} ile-form-title-rem`
113
119
  }, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
@@ -375,11 +381,13 @@ const compereConfigs = () => {
375
381
  let packageConfig = {};
376
382
  try {
377
383
  packageConfig = require('../tui.config.js');
378
- } catch (error) {
379
- packageConfig = require('../../tui.config.js');
380
- // console.log(error, 'Package: tui.config.js file is not define');
384
+ } catch (e) {
385
+ try {
386
+ packageConfig = require('../../tui.config.js');
387
+ } catch (err) {
388
+ packageConfig = {};
389
+ }
381
390
  }
382
-
383
391
  try {
384
392
  projectConfig = require('../../../../tui.config.js');
385
393
  } catch (error) {
@@ -410,7 +418,6 @@ const Typography = ({
410
418
  margin,
411
419
  padding,
412
420
  variant,
413
- bgColor,
414
421
  onClick,
415
422
  children,
416
423
  textAlign,
@@ -422,45 +429,18 @@ const Typography = ({
422
429
  fontFamily,
423
430
  textTransform,
424
431
  textDecoration,
432
+ backgroundColor,
425
433
  ...props
426
434
  }) => {
427
435
  const configStyles = compereConfigs();
428
436
  const classProps = classnames__default["default"](className);
429
437
  const [isHover, setIsHover] = React.useState(false);
430
438
  const [validVariant, setValidVariant] = React.useState(false);
431
- const [style, setStyle] = React.useState({
432
- border: border ? border : configStyles.TYPOGRAPHY.border,
433
- cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
434
- borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
435
- fontSize: size ? size : configStyles.TYPOGRAPHY['size' + variant],
436
- margin: margin ? margin : configStyles.TYPOGRAPHY['margin' + variant],
437
- fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight' + variant],
438
- padding: padding ? padding : configStyles.TYPOGRAPHY['padding' + variant],
439
- textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
440
- textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign' + variant],
441
- backgroundColor: bgColor ? bgColor : configStyles.TYPOGRAPHY['bgColor' + variant],
442
- fontStyle: fontStyle ? fontStyle : configStyles.TYPOGRAPHY['fontStyle' + variant],
443
- lineHeight: lineHeight ? lineHeight : configStyles.TYPOGRAPHY['lineHeight' + variant],
444
- fontFamily: fontFamily ? fontFamily : configStyles.TYPOGRAPHY['fontFamily' + variant],
445
- textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
446
- textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
447
- color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
448
- });
449
439
  React.useEffect(() => {
450
440
  if (!Object.values(TypographyType).includes(variant)) {
451
441
  setValidVariant(true);
452
442
  }
453
443
  }, [variant]);
454
- React.useEffect(() => {
455
- if (color) {
456
- setStyle(prev => {
457
- return {
458
- ...prev,
459
- color: color
460
- };
461
- });
462
- }
463
- }, [color]);
464
444
  const handleMouseEnter = () => {
465
445
  setIsHover(true);
466
446
  };
@@ -468,7 +448,24 @@ const Typography = ({
468
448
  setIsHover(false);
469
449
  };
470
450
  const tagT = /*#__PURE__*/React__default["default"].createElement(variant, {
471
- style,
451
+ style: {
452
+ border: border ? border : configStyles.TYPOGRAPHY.border,
453
+ cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
454
+ borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
455
+ fontSize: size ? size : configStyles.TYPOGRAPHY['size' + variant],
456
+ margin: margin ? margin : configStyles.TYPOGRAPHY['margin' + variant],
457
+ fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight' + variant],
458
+ padding: padding ? padding : configStyles.TYPOGRAPHY['padding' + variant],
459
+ textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
460
+ textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign' + variant],
461
+ fontStyle: fontStyle ? fontStyle : configStyles.TYPOGRAPHY['fontStyle' + variant],
462
+ lineHeight: lineHeight ? lineHeight : configStyles.TYPOGRAPHY['lineHeight' + variant],
463
+ fontFamily: fontFamily ? fontFamily : configStyles.TYPOGRAPHY['fontFamily' + variant],
464
+ textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
465
+ textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
466
+ backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor' + variant],
467
+ color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
468
+ },
472
469
  ...props,
473
470
  className: classProps,
474
471
  onClick: onClick ? onClick : _ => _,
@@ -486,7 +483,6 @@ Typography.propTypes = {
486
483
  cursor: PropTypes__default["default"].string,
487
484
  margin: PropTypes__default["default"].string,
488
485
  radius: PropTypes__default["default"].string,
489
- bgColor: PropTypes__default["default"].string,
490
486
  padding: PropTypes__default["default"].string,
491
487
  textAlign: PropTypes__default["default"].string,
492
488
  className: PropTypes__default["default"].string,
@@ -497,6 +493,7 @@ Typography.propTypes = {
497
493
  colorHover: PropTypes__default["default"].string,
498
494
  textTransform: PropTypes__default["default"].string,
499
495
  textDecoration: PropTypes__default["default"].string,
496
+ backgroundColor: PropTypes__default["default"].string,
500
497
  variant: PropTypes__default["default"].oneOf(Object.values(TypographyType))
501
498
  };
502
499
  Typography.defaultProps = {
@@ -676,6 +673,7 @@ const Input = ({
676
673
  }, "*")) : '', /*#__PURE__*/React__default["default"].createElement("div", {
677
674
  className: `${styles$7["input-content"]}`,
678
675
  style: {
676
+ width: width ? width : configStyles.INPUT.width,
679
677
  borderRadius: radius ? radius : configStyles.INPUT.radius,
680
678
  boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
681
679
  },
@@ -743,7 +741,7 @@ const Input = ({
743
741
  borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
744
742
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
745
743
  }
746
- }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip && tooltip.length > 0 ? tooltip[0] : '', errorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
744
+ }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', errorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
747
745
  style: {
748
746
  left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
749
747
  color: errorColor ? errorColor : configStyles.INPUT.errorColor,
@@ -770,6 +768,7 @@ Input.propTypes = {
770
768
  radius: PropTypes__default["default"].string,
771
769
  padding: PropTypes__default["default"].string,
772
770
  fontSize: PropTypes__default["default"].string,
771
+ tooltip: PropTypes__default["default"].element,
773
772
  transform: PropTypes__default["default"].string,
774
773
  className: PropTypes__default["default"].string,
775
774
  iconWidth: PropTypes__default["default"].string,
@@ -796,7 +795,6 @@ Input.propTypes = {
796
795
  labelLineHeight: PropTypes__default["default"].string,
797
796
  labelMarginBottom: PropTypes__default["default"].string,
798
797
  errorAnimationDuration: PropTypes__default["default"].string,
799
- tooltip: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
800
798
  leftIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
801
799
  rightIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
802
800
  type: PropTypes__default["default"].oneOf(Object.values(InputTypes))
@@ -953,42 +951,99 @@ Button.propTypes = {
953
951
  disabledBackgroundColor: PropTypes__default["default"].string
954
952
  };
955
953
 
956
- var css_248z$5 = ".select-module_select-title__c8bR7{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.select-module_select-content__GCMDX{display:flex;flex-direction:column;position:relative}.select-module_select-content-top__Aw-fB{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}.select-module_select-content-top__Aw-fB.select-module_active__v2Dce{border-color:#00236a}.select-module_select-content-top__Aw-fB:hover{border-color:#3c393e}.select-module_select-content-bottom__ueZCR{animation:select-module_select-show__391hQ .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}.select-module_select-content-bottom-inner__NWy2X{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes select-module_select-show__391hQ{to{max-height:400px}}.select-module_select-content-top-text__euajq{align-items:center;display:flex;flex:1;flex-direction:row;flex-wrap:nowrap}.select-module_select-content-top-icon__MBrGK{align-items:center;box-sizing:border-box;display:flex;flex:0 0 auto;padding:0 5px 0 20px}.select-module_select-content-top-icon__MBrGK>i{color:#3c393e;font-size:12px!important}.select-module_select-content-top-icon__MBrGK>i:not(:last-child){align-items:center;border-right:1px solid #eee;display:flex;height:22px;margin-right:8px;padding:0 8px}.select-module_select-content-bottom-row__eKq5L{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;line-height:22px;margin-bottom:2px;min-height:46px;padding:0 15px;transition:background .24s,color .24s}.select-module_select-content-bottom-row__eKq5L:last-child{margin-bottom:0}.select-module_select-content-bottom-row__eKq5L:hover{background:unset;color:#00236a}.select-module_error-message__-ac6X{border:2px solid #e00!important}.select-module_eMessage__Mm-F7{color:#e00}";
957
- var styles$5 = {"select-title":"select-module_select-title__c8bR7","select-content":"select-module_select-content__GCMDX","select-content-top":"select-module_select-content-top__Aw-fB","active":"select-module_active__v2Dce","select-content-bottom":"select-module_select-content-bottom__ueZCR","select-show":"select-module_select-show__391hQ","select-content-bottom-inner":"select-module_select-content-bottom-inner__NWy2X","select-content-top-text":"select-module_select-content-top-text__euajq","select-content-top-icon":"select-module_select-content-top-icon__MBrGK","select-content-bottom-row":"select-module_select-content-bottom-row__eKq5L","error-message":"select-module_error-message__-ac6X","eMessage":"select-module_eMessage__Mm-F7"};
954
+ var ReactArrowIcon = "<svg width=\"15\" height=\"9\" viewBox=\"0 0 15 9\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M7.9878 8.00003C7.75456 8.00049 7.52851 7.91911 7.34892 7.77003L1.3594 2.77003C1.15554 2.60029 1.02734 2.35638 1.003 2.09196C0.978666 1.82753 1.06019 1.56425 1.22963 1.36003C1.39907 1.15581 1.64255 1.02739 1.90652 1.00301C2.17048 0.978631 2.4333 1.06029 2.63716 1.23003L7.9878 5.71003L13.3384 1.39003C13.4405 1.30697 13.558 1.24493 13.6842 1.2075C13.8103 1.17007 13.9425 1.15798 14.0733 1.17192C14.2041 1.18586 14.3309 1.22555 14.4463 1.28873C14.5618 1.3519 14.6636 1.4373 14.746 1.54003C14.8374 1.64285 14.9066 1.76348 14.9493 1.89435C14.9921 2.02523 15.0073 2.16353 14.9942 2.30059C14.9811 2.43765 14.9399 2.57053 14.8731 2.69088C14.8063 2.81124 14.7155 2.91649 14.6062 3.00003L8.6167 7.83003C8.43194 7.95555 8.21051 8.0154 7.9878 8.00003Z\" fill=\"#3C393E\"/>\n</svg>";
955
+
956
+ var ReactCloseIcon = "<svg width=\"14\" height=\"14\" viewBox=\"0 0 14 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M12.4253 0.241029L12.431 0.236144C12.6129 0.0804082 12.8468 -0.00097097 13.0861 0.00827014C13.3253 0.0175112 13.5523 0.116692 13.7216 0.285992C13.8909 0.455292 13.9901 0.682241 13.9993 0.921488C14.0085 1.16074 13.9272 1.39466 13.7714 1.57651L13.7665 1.58222L8.38622 6.96254L13.7665 12.3429L13.7714 12.3486C13.9272 12.5304 14.0085 12.7643 13.9993 13.0036C13.9901 13.2428 13.8909 13.4698 13.7216 13.6391C13.5523 13.8084 13.3253 13.9076 13.0861 13.9168C12.8468 13.926 12.6129 13.8447 12.431 13.6889L12.4253 13.684L7.04493 8.30363L1.66742 13.6738C1.58315 13.7705 1.48016 13.8492 1.36462 13.9051C1.24669 13.9622 1.11823 13.9942 0.987309 13.9993C0.85639 14.0043 0.72584 13.9823 0.603852 13.9345C0.481865 13.8867 0.371073 13.8142 0.27843 13.7216C0.185788 13.6289 0.113295 13.5181 0.0655034 13.3961C0.0177115 13.2742 -0.00434842 13.1436 0.000708381 13.0127C0.00576522 12.8818 0.0378304 12.7533 0.0948891 12.6354C0.150805 12.5198 0.229542 12.4168 0.326326 12.3325L5.70384 6.96235L0.323475 1.57461L0.318633 1.56895C0.162897 1.3871 0.0815178 1.15317 0.0907589 0.913926C0.1 0.674678 0.199181 0.447729 0.36848 0.27843C0.53778 0.10913 0.76473 0.00995005 1.00398 0.000708956C1.24322 -0.00853214 1.47715 0.0728459 1.659 0.228582L1.66476 0.233511L7.04512 5.62125L12.4253 0.241029Z\" fill=\"#3C393E\"/>\n</svg>";
957
+
958
+ var css_248z$5 = ".select-module_select-content__GCMDX{display:flex;flex-direction:column;position:relative}.select-module_select-content-top__Aw-fB{align-items:center;display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between}.select-module_select-content-bottom__ueZCR{animation:select-module_select-show__391hQ .64s linear forwards;-webkit-animation:select-module_select-show__391hQ .64s linear forwards;left:0;max-height:0;overflow:hidden;position:absolute;width:100%;z-index:1}.select-module_select-content-bottom-inner__NWy2X{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}.select-module_select-content-top-icon__MBrGK{align-items:center;box-sizing:border-box;display:flex;flex:0 0 auto;padding:0 5px 0 20px}.select-module_select-content-top-icon__MBrGK>div{align-items:center;display:flex;height:14px;justify-content:center;width:14px}.select-module_close-icon__SFNaJ{border-right:1px solid #eee;padding-right:9px}.select-module_arrow-icon__rjHt-{margin-left:9px;transform-origin:center;transition:all .64s ease;-webkit-transition:all .64s ease;-moz-transition:all .64s ease;-ms-transition:all .64s ease;-o-transition:all .64s ease}.select-module_select-content-bottom-row__eKq5L{align-items:center;display:flex;transition:background-color .24s,color .24s;-webkit-transition:background-color .24s,color .24s;-moz-transition:background-color .24s,color .24s;-ms-transition:background-color .24s,color .24s;-o-transition:background-color .24s,color .24s}.select-module_select-content-bottom-row__eKq5L:last-child{margin-bottom:0}@keyframes select-module_select-show__391hQ{to{max-height:234px}}";
959
+ var styles$5 = {"select-content":"select-module_select-content__GCMDX","select-content-top":"select-module_select-content-top__Aw-fB","select-content-bottom":"select-module_select-content-bottom__ueZCR","select-show":"select-module_select-show__391hQ","select-content-bottom-inner":"select-module_select-content-bottom-inner__NWy2X","select-content-top-icon":"select-module_select-content-top-icon__MBrGK","close-icon":"select-module_close-icon__SFNaJ","arrow-icon":"select-module_arrow-icon__rjHt-","select-content-bottom-row":"select-module_select-content-bottom-row__eKq5L"};
958
960
  styleInject(css_248z$5);
959
961
 
960
- const SelectTheme = {
961
- DEFAULT: 'select-default',
962
- PRIMARY: 'select-primary',
963
- SUCCESS: 'select-success',
964
- INFO: 'select-info',
965
- WARNING: 'select-warning',
966
- DANGER: 'select-danger',
967
- LINK: 'select-link'
968
- };
969
- const SelectSize = {
970
- SMALL: 'small',
971
- MEDIUM: 'medium',
972
- LARGE: 'large'
973
- };
974
962
  const Select = ({
975
- theme,
976
- size,
977
- className,
978
963
  disabled,
979
- label,
980
964
  jsonData,
981
- eMessage,
982
965
  required,
983
- defaultOption,
984
966
  onChange,
985
967
  keyNames,
986
- selected
968
+ selected,
969
+ className,
970
+ arrowIcon,
971
+ closeIcon,
972
+ errorMessage,
973
+ defaultOption,
974
+ label,
975
+ labelColor,
976
+ labelWeight,
977
+ labelDisplay,
978
+ labelFontSize,
979
+ labelLineHeight,
980
+ labelMarginBottom,
981
+ labelTextTransform,
982
+ cursor,
983
+ errorSize,
984
+ errorColor,
985
+ selectedColor,
986
+ selectedRadius,
987
+ selectedHeight,
988
+ selectedBorder,
989
+ selectedPadding,
990
+ selectedFontSize,
991
+ selectedBoxSizing,
992
+ selectedFontWeight,
993
+ selectedLineHeight,
994
+ selectedHoverColor,
995
+ selectedTransition,
996
+ selectedBorderColor,
997
+ optionsBoxShadow,
998
+ optionsBorderRadius,
999
+ optionsBackgroundColor,
1000
+ optionItemColor,
1001
+ optionItemCursor,
1002
+ optionItemPadding,
1003
+ optionItemFontSize,
1004
+ optionItemMinHeight,
1005
+ optionItemBoxSizing,
1006
+ optionItemFontWeight,
1007
+ optionItemLineHeight,
1008
+ optionItemColorHover,
1009
+ optionItemMarginBottom,
1010
+ optionItemBackgroudColor,
1011
+ optionItemBackgroudColorHover
987
1012
  }) => {
988
1013
  const options = jsonData.length ? JSON.parse(jsonData) : [];
989
1014
  const ref = React.useRef();
990
- let [opened, setOpened] = React.useState(false);
991
- let [newSelected, setNewSelected] = React.useState({});
1015
+ const [opened, setOpened] = React.useState(false);
1016
+ const [isHover, setIsHover] = React.useState(false);
1017
+ const [newSelected, setNewSelected] = React.useState({});
1018
+ const configStyles = compereConfigs();
1019
+ const classProps = classnames__default["default"](className);
1020
+ const handleOpenClose = () => {
1021
+ setOpened(!opened);
1022
+ };
1023
+ const handleClearSelect = e => {
1024
+ onChange({});
1025
+ setNewSelected({});
1026
+ e.stopPropagation();
1027
+ };
1028
+ const handleSelectItem = option => {
1029
+ onChange(option);
1030
+ setOpened(!opened);
1031
+ setNewSelected(option);
1032
+ };
1033
+ const handleMouseEnter = () => {
1034
+ setIsHover(true);
1035
+ };
1036
+ const handleMouseLeave = () => {
1037
+ setIsHover(false);
1038
+ };
1039
+ const handleMouseEnterOption = e => {
1040
+ e.target.style.color = optionItemColorHover ? optionItemColorHover : configStyles.SELECT.optionItemColorHover;
1041
+ e.target.style.backgroundColor = optionItemBackgroudColorHover ? optionItemBackgroudColorHover : configStyles.SELECT.optionItemBackgroudColorHover;
1042
+ };
1043
+ const handleMouseLeaveOption = e => {
1044
+ e.target.style.color = optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor;
1045
+ e.target.style.backgroundColor = optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor;
1046
+ };
992
1047
  React.useEffect(() => {
993
1048
  const parseSelectedData = selected.length !== 0 ? JSON.parse(selected) : {};
994
1049
  setNewSelected(parseSelectedData);
@@ -1006,77 +1061,154 @@ const Select = ({
1006
1061
  };
1007
1062
  }
1008
1063
  }, [opened]);
1009
- classnames__default["default"](styles$5[theme], styles$5[size], {
1010
- [styles$5.disabled]: disabled,
1011
- [styles$5.required]: required
1012
- }, className);
1013
- return /*#__PURE__*/React__default["default"].createElement("div", null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
1014
- className: `${styles$5['select-title']} select-title-rem`
1015
- }, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
1064
+ return /*#__PURE__*/React__default["default"].createElement("div", {
1065
+ className: classProps
1066
+ }, label ? /*#__PURE__*/React__default["default"].createElement("label", {
1067
+ style: {
1068
+ color: labelColor ? labelColor : configStyles.SELECT.labelColor,
1069
+ fontWeight: labelWeight ? labelWeight : configStyles.SELECT.labelWeight,
1070
+ display: labelDisplay ? labelDisplay : configStyles.SELECT.labelDisplay,
1071
+ fontSize: labelFontSize ? labelFontSize : configStyles.SELECT.labelFontSize,
1072
+ lineHeight: labelLineHeight ? labelLineHeight : configStyles.SELECT.labelLineHeight,
1073
+ marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.SELECT.labelMarginBottom,
1074
+ textTransform: labelTextTransform ? labelTextTransform : configStyles.SELECT.labelTextTransform
1075
+ }
1076
+ }, label, required && /*#__PURE__*/React__default["default"].createElement("sup", {
1016
1077
  style: {
1017
1078
  color: "#ee0000"
1018
1079
  }
1019
1080
  }, "*")) : "", /*#__PURE__*/React__default["default"].createElement("div", {
1020
- className: `${styles$5['select-wrap']} select-wrap-rem`,
1021
1081
  ref: ref
1022
1082
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1023
- className: styles$5['select-content'],
1024
- id: styles$5.selector
1083
+ className: styles$5['select-content']
1025
1084
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1026
- className: `${styles$5['select-content-top']} select-content-top-rem ${eMessage ? styles$5['error-message'] : ''}`,
1027
- onClick: () => {
1028
- setOpened(!opened);
1029
- }
1085
+ style: {
1086
+ cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.SELECT.cursor,
1087
+ height: selectedHeight ? selectedHeight : configStyles.SELECT.selectedHeight,
1088
+ border: selectedBorder ? selectedBorder : configStyles.SELECT.selectedBorder,
1089
+ padding: selectedPadding ? selectedPadding : configStyles.SELECT.selectedPadding,
1090
+ borderRadius: selectedRadius ? selectedRadius : configStyles.SELECT.selectedRadius,
1091
+ fontSize: selectedFontSize ? selectedFontSize : configStyles.SELECT.selectedFontSize,
1092
+ boxSizing: selectedBoxSizing ? selectedBoxSizing : configStyles.SELECT.selectedBoxSizing,
1093
+ fontWeight: selectedFontWeight ? selectedFontWeight : configStyles.SELECT.selectedFontWeight,
1094
+ lineHeight: selectedLineHeight ? selectedLineHeight : configStyles.SELECT.selectedLineHeight,
1095
+ transition: selectedTransition ? selectedTransition : configStyles.SELECT.selectedTransition,
1096
+ borderColor: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : selectedBorderColor ? selectedBorderColor : configStyles.SELECT.selectedBorderColor
1097
+ },
1098
+ onClick: disabled ? _ => _ : _ => handleOpenClose(),
1099
+ onMouseEnter: disabled ? _ => _ : handleMouseEnter,
1100
+ onMouseLeave: disabled ? _ => _ : handleMouseLeave,
1101
+ className: `${styles$5['select-content-top']}`
1030
1102
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1031
- className: `${styles$5['select-content-top-text']} select-content-top-text-rem`
1032
- }, newSelected && newSelected[keyNames.name] ? newSelected[keyNames.name] : defaultOption), /*#__PURE__*/React__default["default"].createElement("div", {
1033
- className: `${styles$5['select-content-top-icon']} select-content-top-icon-rem`
1034
- }, Object.keys(newSelected).length > 0 && /*#__PURE__*/React__default["default"].createElement("i", {
1035
- className: "icon-close",
1036
- onClick: e => {
1037
- setNewSelected({});
1038
- onChange({});
1039
- e.stopPropagation();
1103
+ className: `${styles$5['select-content-top-text']}`,
1104
+ style: {
1105
+ color: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : isHover ? selectedHoverColor ? selectedHoverColor : configStyles.SELECT.selectedHoverColor : selectedColor ? selectedColor : configStyles.SELECT.selectedColor
1040
1106
  }
1041
- }), /*#__PURE__*/React__default["default"].createElement("i", {
1042
- className: opened ? 'icon-icon-up' : 'icon-icon-down'
1043
- }))), opened && !disabled ? /*#__PURE__*/React__default["default"].createElement("div", {
1044
- className: `${styles$5['select-content-bottom']} select-content-bottom-rem`
1107
+ }, newSelected && newSelected[keyNames.name] ? newSelected[keyNames.name] : defaultOption), /*#__PURE__*/React__default["default"].createElement("div", {
1108
+ className: `${styles$5['select-content-top-icon']}`
1109
+ }, Object.keys(newSelected).length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
1110
+ className: `${styles$5['close-icon']}`,
1111
+ onClick: disabled ? _ => _ : handleClearSelect
1112
+ }, closeIcon ? closeIcon : /*#__PURE__*/React__default["default"].createElement("img", {
1113
+ src: ReactCloseIcon,
1114
+ alt: "icon"
1115
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
1116
+ style: {
1117
+ transform: opened ? 'rotate(180deg)' : 'rotate(0deg)'
1118
+ },
1119
+ className: `${styles$5['arrow-icon']}`
1120
+ }, arrowIcon ? arrowIcon : /*#__PURE__*/React__default["default"].createElement("img", {
1121
+ src: ReactArrowIcon,
1122
+ alt: "icon"
1123
+ })))), opened && !disabled ? /*#__PURE__*/React__default["default"].createElement("div", {
1124
+ style: {
1125
+ boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
1126
+ borderRadius: optionsBorderRadius ? optionsBorderRadius : configStyles.SELECT.optionsBorderRadius,
1127
+ backgroundColor: optionsBackgroundColor ? optionsBackgroundColor : configStyles.SELECT.optionsBackgroundColor,
1128
+ top: parseFloat(selectedHeight ? selectedHeight.substring(0, selectedHeight.length - 2) : configStyles.SELECT.selectedHeight.substring(0, configStyles.SELECT.selectedHeight.length - 2)) + 6 + 'px'
1129
+ },
1130
+ className: `${styles$5['select-content-bottom']}`
1045
1131
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1046
- className: `${styles$5['select-content-bottom-inner']} select-content-bottom-inner-rem`
1132
+ className: `${styles$5['select-content-bottom-inner']}`
1047
1133
  }, options.map((option, i) => {
1048
1134
  return /*#__PURE__*/React__default["default"].createElement("div", {
1049
1135
  key: i,
1050
- className: `${styles$5['select-content-bottom-row']} select-content-bottom-row-rem`,
1051
1136
  disabled: true,
1052
- onClick: () => {
1053
- setNewSelected(option);
1054
- onChange(option);
1055
- setOpened(!opened);
1056
- },
1057
- defaultValue: option[keyNames.id]
1137
+ defaultValue: option[keyNames.id],
1138
+ onClick: disabled ? _ => _ : _ => handleSelectItem(option),
1139
+ onMouseEnter: disabled ? _ => _ : e => handleMouseEnterOption(e),
1140
+ onMouseLeave: disabled ? _ => _ : e => handleMouseLeaveOption(e),
1141
+ className: `${styles$5['select-content-bottom-row']}`,
1142
+ style: {
1143
+ color: optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor,
1144
+ cursor: optionItemCursor ? optionItemCursor : configStyles.SELECT.optionItemCursor,
1145
+ padding: optionItemPadding ? optionItemPadding : configStyles.SELECT.optionItemPadding,
1146
+ fontSize: optionItemFontSize ? optionItemFontSize : configStyles.SELECT.optionItemFontSize,
1147
+ boxSizing: optionItemBoxSizing ? optionItemBoxSizing : configStyles.SELECT.optionItemBoxSizing,
1148
+ minHeight: optionItemMinHeight ? optionItemMinHeight : configStyles.SELECT.optionItemMinHeight,
1149
+ fontWeight: optionItemFontWeight ? optionItemFontWeight : configStyles.SELECT.optionItemFontWeight,
1150
+ lineHeight: optionItemLineHeight ? optionItemLineHeight : configStyles.SELECT.optionItemLineHeight,
1151
+ marginBottom: optionItemMarginBottom ? optionItemMarginBottom : configStyles.SELECT.optionItemMarginBottom,
1152
+ backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor
1153
+ }
1058
1154
  }, option[keyNames.name]);
1059
- }))) : null)), eMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
1060
- className: styles$5.eMessage
1061
- }, eMessage) : null);
1155
+ }))) : null)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
1156
+ style: {
1157
+ color: errorColor ? errorColor : configStyles.SELECT.errorColor,
1158
+ fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize
1159
+ }
1160
+ }, errorMessage) : '');
1062
1161
  };
1063
1162
  Select.propTypes = {
1064
- theme: PropTypes__default["default"].oneOf(Object.values(SelectTheme)),
1065
- size: PropTypes__default["default"].oneOf(Object.values(SelectSize)),
1066
- label: PropTypes__default["default"].string,
1067
- eMessage: PropTypes__default["default"].string,
1068
- defaultOption: PropTypes__default["default"].string,
1069
1163
  onChange: PropTypes__default["default"].func,
1070
1164
  required: PropTypes__default["default"].bool,
1071
1165
  disabled: PropTypes__default["default"].bool,
1072
- className: PropTypes__default["default"].string,
1073
1166
  selected: PropTypes__default["default"].string,
1074
1167
  jsonData: PropTypes__default["default"].string,
1075
- keyNames: PropTypes__default["default"].object
1076
- };
1077
- Select.defaultProps = {
1078
- size: 'medium',
1079
- required: false
1168
+ keyNames: PropTypes__default["default"].object,
1169
+ className: PropTypes__default["default"].string,
1170
+ arrowIcon: PropTypes__default["default"].element,
1171
+ closeIcon: PropTypes__default["default"].element,
1172
+ errorMessage: PropTypes__default["default"].string,
1173
+ defaultOption: PropTypes__default["default"].string,
1174
+ label: PropTypes__default["default"].string,
1175
+ labelColor: PropTypes__default["default"].string,
1176
+ labelWeight: PropTypes__default["default"].string,
1177
+ labelDisplay: PropTypes__default["default"].string,
1178
+ labelFontSize: PropTypes__default["default"].string,
1179
+ labelLineHeight: PropTypes__default["default"].string,
1180
+ labelMarginBottom: PropTypes__default["default"].string,
1181
+ labelTextTransform: PropTypes__default["default"].string,
1182
+ cursor: PropTypes__default["default"].string,
1183
+ errorSize: PropTypes__default["default"].string,
1184
+ errorColor: PropTypes__default["default"].string,
1185
+ selectedColor: PropTypes__default["default"].string,
1186
+ selectedBorder: PropTypes__default["default"].string,
1187
+ selectedRadius: PropTypes__default["default"].string,
1188
+ selectedHeight: PropTypes__default["default"].string,
1189
+ selectedPadding: PropTypes__default["default"].string,
1190
+ selectedFontSize: PropTypes__default["default"].string,
1191
+ selectedBoxSizing: PropTypes__default["default"].string,
1192
+ selectedHoverColor: PropTypes__default["default"].string,
1193
+ selectedFontWeight: PropTypes__default["default"].string,
1194
+ selectedLineHeight: PropTypes__default["default"].string,
1195
+ selectedTransition: PropTypes__default["default"].string,
1196
+ selectedBorderColor: PropTypes__default["default"].string,
1197
+ optionsBoxShadow: PropTypes__default["default"].string,
1198
+ optionsBorderRadius: PropTypes__default["default"].string,
1199
+ optionsBackgroundColor: PropTypes__default["default"].string,
1200
+ optionItemColor: PropTypes__default["default"].string,
1201
+ optionItemCursor: PropTypes__default["default"].string,
1202
+ optionItemPadding: PropTypes__default["default"].string,
1203
+ optionItemFontSize: PropTypes__default["default"].string,
1204
+ optionItemMinHeight: PropTypes__default["default"].string,
1205
+ optionItemBoxSizing: PropTypes__default["default"].string,
1206
+ optionItemFontWeight: PropTypes__default["default"].string,
1207
+ optionItemColorHover: PropTypes__default["default"].string,
1208
+ optionItemLineHeight: PropTypes__default["default"].string,
1209
+ optionItemMarginBottom: PropTypes__default["default"].string,
1210
+ optionItemBackgroudColor: PropTypes__default["default"].string,
1211
+ optionItemBackgroudColorHover: PropTypes__default["default"].string
1080
1212
  };
1081
1213
 
1082
1214
  var ReactInfoIcon = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M8 0C3.58214 0 0 3.58214 0 8C0 12.4179 3.58214 16 8 16C12.4179 16 16 12.4179 16 8C16 3.58214 12.4179 0 8 0ZM8.57143 11.8571C8.57143 11.9357 8.50714 12 8.42857 12H7.57143C7.49286 12 7.42857 11.9357 7.42857 11.8571V7C7.42857 6.92143 7.49286 6.85714 7.57143 6.85714H8.42857C8.50714 6.85714 8.57143 6.92143 8.57143 7V11.8571ZM8 5.71429C7.7757 5.70971 7.56213 5.61739 7.40513 5.45714C7.24812 5.2969 7.16018 5.08149 7.16018 4.85714C7.16018 4.6328 7.24812 4.41739 7.40513 4.25714C7.56213 4.0969 7.7757 4.00458 8 4C8.2243 4.00458 8.43787 4.0969 8.59488 4.25714C8.75189 4.41739 8.83982 4.6328 8.83982 4.85714C8.83982 5.08149 8.75189 5.2969 8.59488 5.45714C8.43787 5.61739 8.2243 5.70971 8 5.71429Z\" fill=\"#D1D1D1\"/>\n</svg>";
@@ -1155,7 +1287,7 @@ const Tooltip = ({
1155
1287
  cursor: 'pointer'
1156
1288
  },
1157
1289
  onClick: handleShow
1158
- }, tooltipIcon && tooltipIcon[0] ? tooltipIcon[0] : /*#__PURE__*/React__default["default"].createElement("img", {
1290
+ }, tooltipIcon ? tooltipIcon : /*#__PURE__*/React__default["default"].createElement("img", {
1159
1291
  src: ReactInfoIcon
1160
1292
  })));
1161
1293
  };
@@ -1169,11 +1301,11 @@ Tooltip.propTypes = {
1169
1301
  className: PropTypes__default["default"].string,
1170
1302
  fontFamily: PropTypes__default["default"].string,
1171
1303
  tooltipWidth: PropTypes__default["default"].string,
1304
+ tooltipIcon: PropTypes__default["default"].element,
1172
1305
  tooltipRadius: PropTypes__default["default"].string,
1173
1306
  text: PropTypes__default["default"].string.isRequired,
1174
1307
  backgroundColor: PropTypes__default["default"].string,
1175
- tooltipBackgroundColor: PropTypes__default["default"].string,
1176
- tooltipIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element)
1308
+ tooltipBackgroundColor: PropTypes__default["default"].string
1177
1309
  };
1178
1310
  Tooltip.defaultProps = {
1179
1311
  type: 'top'
@@ -1585,8 +1717,6 @@ exports.Modal = Modal;
1585
1717
  exports.Pagination = Pagination;
1586
1718
  exports.Radio = Radio;
1587
1719
  exports.Select = Select;
1588
- exports.SelectSize = SelectSize;
1589
- exports.SelectTheme = SelectTheme;
1590
1720
  exports.Stepper = Stepper;
1591
1721
  exports.Table = Table;
1592
1722
  exports.Tooltip = Tooltip;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@xaypay/tui",
3
- "version": "0.0.56",
3
+ "version": "0.0.58",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
7
7
  "scripts": {
8
8
  "test": "echo \"Error: no test specified\" && exit 1",
9
- "storybook": "start-storybook -p 6006",
10
- "build-storybook": "build-storybook",
11
- "build-lib": "rollup --config rollup.config.js",
9
+ "storybook": "STORYBOOK_PATH=../../tui.config.js start-storybook -p 6006",
10
+ "build-storybook": "STORYBOOK_PATH=../../tui.config.js build-storybook",
11
+ "build-lib": "STORYBOOK_PATH=../tui.config.js rollup --config rollup.config.js",
12
12
  "svgr": "svgr --icon --title-prop --replace-attr-values '#1D1D1D=currentColor' -d src/components/icon -- src/assets"
13
13
  },
14
14
  "author": "",
@@ -0,0 +1,3 @@
1
+ <svg width="15" height="9" viewBox="0 0 15 9" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M7.9878 8.00003C7.75456 8.00049 7.52851 7.91911 7.34892 7.77003L1.3594 2.77003C1.15554 2.60029 1.02734 2.35638 1.003 2.09196C0.978666 1.82753 1.06019 1.56425 1.22963 1.36003C1.39907 1.15581 1.64255 1.02739 1.90652 1.00301C2.17048 0.978631 2.4333 1.06029 2.63716 1.23003L7.9878 5.71003L13.3384 1.39003C13.4405 1.30697 13.558 1.24493 13.6842 1.2075C13.8103 1.17007 13.9425 1.15798 14.0733 1.17192C14.2041 1.18586 14.3309 1.22555 14.4463 1.28873C14.5618 1.3519 14.6636 1.4373 14.746 1.54003C14.8374 1.64285 14.9066 1.76348 14.9493 1.89435C14.9921 2.02523 15.0073 2.16353 14.9942 2.30059C14.9811 2.43765 14.9399 2.57053 14.8731 2.69088C14.8063 2.81124 14.7155 2.91649 14.6062 3.00003L8.6167 7.83003C8.43194 7.95555 8.21051 8.0154 7.9878 8.00003Z" fill="#3C393E"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M12.4253 0.241029L12.431 0.236144C12.6129 0.0804082 12.8468 -0.00097097 13.0861 0.00827014C13.3253 0.0175112 13.5523 0.116692 13.7216 0.285992C13.8909 0.455292 13.9901 0.682241 13.9993 0.921488C14.0085 1.16074 13.9272 1.39466 13.7714 1.57651L13.7665 1.58222L8.38622 6.96254L13.7665 12.3429L13.7714 12.3486C13.9272 12.5304 14.0085 12.7643 13.9993 13.0036C13.9901 13.2428 13.8909 13.4698 13.7216 13.6391C13.5523 13.8084 13.3253 13.9076 13.0861 13.9168C12.8468 13.926 12.6129 13.8447 12.431 13.6889L12.4253 13.684L7.04493 8.30363L1.66742 13.6738C1.58315 13.7705 1.48016 13.8492 1.36462 13.9051C1.24669 13.9622 1.11823 13.9942 0.987309 13.9993C0.85639 14.0043 0.72584 13.9823 0.603852 13.9345C0.481865 13.8867 0.371073 13.8142 0.27843 13.7216C0.185788 13.6289 0.113295 13.5181 0.0655034 13.3961C0.0177115 13.2742 -0.00434842 13.1436 0.000708381 13.0127C0.00576522 12.8818 0.0378304 12.7533 0.0948891 12.6354C0.150805 12.5198 0.229542 12.4168 0.326326 12.3325L5.70384 6.96235L0.323475 1.57461L0.318633 1.56895C0.162897 1.3871 0.0815178 1.15317 0.0907589 0.913926C0.1 0.674678 0.199181 0.447729 0.36848 0.27843C0.53778 0.10913 0.76473 0.00995005 1.00398 0.000708956C1.24322 -0.00853214 1.47715 0.0728459 1.659 0.228582L1.66476 0.233511L7.04512 5.62125L12.4253 0.241029Z" fill="#3C393E"/>
3
+ </svg>
@@ -62,6 +62,13 @@ export const File = ({
62
62
  document.querySelector(`.${name}`).value = "";
63
63
  };
64
64
 
65
+ useEffect(() => {
66
+ return () => {
67
+ setError('');
68
+ setImage(null);
69
+ }
70
+ }, []);
71
+
65
72
  return (
66
73
  <>
67
74
  <p className={`${styles['file-form-title']} ile-form-title-rem`}>
@@ -1,7 +1,6 @@
1
1
  import React, { useState } from "react";
2
2
  import PropTypes from "prop-types";
3
3
  import classnames from "classnames";
4
- import { Typography } from "../typography";
5
4
  import { compereConfigs } from "./../../utils";
6
5
  import styled, { keyframes, css } from 'styled-components';
7
6
 
@@ -119,6 +118,7 @@ export const Input = ({
119
118
  <div
120
119
  className={`${styles["input-content"]}`}
121
120
  style={{
121
+ width: width ? width : configStyles.INPUT.width,
122
122
  borderRadius: radius ? radius : configStyles.INPUT.radius,
123
123
  boxShadow: errorMessage ? errorColor ? `0 0 0 2px ${errorColor}` : `0 0 0 2px ${configStyles.INPUT.errorColor}` : isHover ? boxShadowHover ? boxShadowHover : configStyles.INPUT.boxShadowHover : boxShadow ? boxShadow : configStyles.INPUT.boxShadow
124
124
  }}
@@ -210,7 +210,7 @@ export const Input = ({
210
210
  }
211
211
  </div>
212
212
  {
213
- tooltip && tooltip.length > 0 ? tooltip[0] : ''
213
+ tooltip ? tooltip : ''
214
214
  }
215
215
  {
216
216
  errorMessage ?
@@ -248,6 +248,7 @@ Input.propTypes = {
248
248
  radius: PropTypes.string,
249
249
  padding: PropTypes.string,
250
250
  fontSize: PropTypes.string,
251
+ tooltip: PropTypes.element,
251
252
  transform: PropTypes.string,
252
253
  className: PropTypes.string,
253
254
  iconWidth: PropTypes.string,
@@ -274,7 +275,6 @@ Input.propTypes = {
274
275
  labelLineHeight: PropTypes.string,
275
276
  labelMarginBottom: PropTypes.string,
276
277
  errorAnimationDuration: PropTypes.string,
277
- tooltip: PropTypes.arrayOf(PropTypes.element),
278
278
  leftIcon: PropTypes.arrayOf(PropTypes.element),
279
279
  rightIcon: PropTypes.arrayOf(PropTypes.element),
280
280
  type: PropTypes.oneOf(Object.values(InputTypes)),