@xaypay/tui 0.0.56 → 0.0.57

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", {
@@ -373,13 +379,7 @@ const _ = require('lodash');
373
379
  const compereConfigs = () => {
374
380
  let projectConfig = {};
375
381
  let packageConfig = {};
376
- try {
377
- 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');
381
- }
382
-
382
+ packageConfig = require(process.env.STORYBOOK_PATH);
383
383
  try {
384
384
  projectConfig = require('../../../../tui.config.js');
385
385
  } catch (error) {
@@ -410,7 +410,6 @@ const Typography = ({
410
410
  margin,
411
411
  padding,
412
412
  variant,
413
- bgColor,
414
413
  onClick,
415
414
  children,
416
415
  textAlign,
@@ -422,45 +421,18 @@ const Typography = ({
422
421
  fontFamily,
423
422
  textTransform,
424
423
  textDecoration,
424
+ backgroundColor,
425
425
  ...props
426
426
  }) => {
427
427
  const configStyles = compereConfigs();
428
428
  const classProps = classnames__default["default"](className);
429
429
  const [isHover, setIsHover] = React.useState(false);
430
430
  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
431
  React.useEffect(() => {
450
432
  if (!Object.values(TypographyType).includes(variant)) {
451
433
  setValidVariant(true);
452
434
  }
453
435
  }, [variant]);
454
- React.useEffect(() => {
455
- if (color) {
456
- setStyle(prev => {
457
- return {
458
- ...prev,
459
- color: color
460
- };
461
- });
462
- }
463
- }, [color]);
464
436
  const handleMouseEnter = () => {
465
437
  setIsHover(true);
466
438
  };
@@ -468,7 +440,24 @@ const Typography = ({
468
440
  setIsHover(false);
469
441
  };
470
442
  const tagT = /*#__PURE__*/React__default["default"].createElement(variant, {
471
- style,
443
+ style: {
444
+ border: border ? border : configStyles.TYPOGRAPHY.border,
445
+ cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
446
+ borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
447
+ fontSize: size ? size : configStyles.TYPOGRAPHY['size' + variant],
448
+ margin: margin ? margin : configStyles.TYPOGRAPHY['margin' + variant],
449
+ fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight' + variant],
450
+ padding: padding ? padding : configStyles.TYPOGRAPHY['padding' + variant],
451
+ textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
452
+ textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign' + variant],
453
+ fontStyle: fontStyle ? fontStyle : configStyles.TYPOGRAPHY['fontStyle' + variant],
454
+ lineHeight: lineHeight ? lineHeight : configStyles.TYPOGRAPHY['lineHeight' + variant],
455
+ fontFamily: fontFamily ? fontFamily : configStyles.TYPOGRAPHY['fontFamily' + variant],
456
+ textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
457
+ textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
458
+ backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor' + variant],
459
+ color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
460
+ },
472
461
  ...props,
473
462
  className: classProps,
474
463
  onClick: onClick ? onClick : _ => _,
@@ -486,7 +475,6 @@ Typography.propTypes = {
486
475
  cursor: PropTypes__default["default"].string,
487
476
  margin: PropTypes__default["default"].string,
488
477
  radius: PropTypes__default["default"].string,
489
- bgColor: PropTypes__default["default"].string,
490
478
  padding: PropTypes__default["default"].string,
491
479
  textAlign: PropTypes__default["default"].string,
492
480
  className: PropTypes__default["default"].string,
@@ -497,6 +485,7 @@ Typography.propTypes = {
497
485
  colorHover: PropTypes__default["default"].string,
498
486
  textTransform: PropTypes__default["default"].string,
499
487
  textDecoration: PropTypes__default["default"].string,
488
+ backgroundColor: PropTypes__default["default"].string,
500
489
  variant: PropTypes__default["default"].oneOf(Object.values(TypographyType))
501
490
  };
502
491
  Typography.defaultProps = {
@@ -676,6 +665,7 @@ const Input = ({
676
665
  }, "*")) : '', /*#__PURE__*/React__default["default"].createElement("div", {
677
666
  className: `${styles$7["input-content"]}`,
678
667
  style: {
668
+ width: width ? width : configStyles.INPUT.width,
679
669
  borderRadius: radius ? radius : configStyles.INPUT.radius,
680
670
  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
671
  },
@@ -743,7 +733,7 @@ const Input = ({
743
733
  borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
744
734
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
745
735
  }
746
- }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip && tooltip.length > 0 ? tooltip[0] : '', errorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
736
+ }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', errorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
747
737
  style: {
748
738
  left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
749
739
  color: errorColor ? errorColor : configStyles.INPUT.errorColor,
@@ -770,6 +760,7 @@ Input.propTypes = {
770
760
  radius: PropTypes__default["default"].string,
771
761
  padding: PropTypes__default["default"].string,
772
762
  fontSize: PropTypes__default["default"].string,
763
+ tooltip: PropTypes__default["default"].element,
773
764
  transform: PropTypes__default["default"].string,
774
765
  className: PropTypes__default["default"].string,
775
766
  iconWidth: PropTypes__default["default"].string,
@@ -796,7 +787,6 @@ Input.propTypes = {
796
787
  labelLineHeight: PropTypes__default["default"].string,
797
788
  labelMarginBottom: PropTypes__default["default"].string,
798
789
  errorAnimationDuration: PropTypes__default["default"].string,
799
- tooltip: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
800
790
  leftIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
801
791
  rightIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
802
792
  type: PropTypes__default["default"].oneOf(Object.values(InputTypes))
@@ -953,42 +943,99 @@ Button.propTypes = {
953
943
  disabledBackgroundColor: PropTypes__default["default"].string
954
944
  };
955
945
 
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"};
946
+ 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>";
947
+
948
+ 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>";
949
+
950
+ 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}}";
951
+ 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
952
  styleInject(css_248z$5);
959
953
 
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
954
  const Select = ({
975
- theme,
976
- size,
977
- className,
978
955
  disabled,
979
- label,
980
956
  jsonData,
981
- eMessage,
982
957
  required,
983
- defaultOption,
984
958
  onChange,
985
959
  keyNames,
986
- selected
960
+ selected,
961
+ className,
962
+ arrowIcon,
963
+ closeIcon,
964
+ errorMessage,
965
+ defaultOption,
966
+ label,
967
+ labelColor,
968
+ labelWeight,
969
+ labelDisplay,
970
+ labelFontSize,
971
+ labelLineHeight,
972
+ labelMarginBottom,
973
+ labelTextTransform,
974
+ cursor,
975
+ errorSize,
976
+ errorColor,
977
+ selectedColor,
978
+ selectedRadius,
979
+ selectedHeight,
980
+ selectedBorder,
981
+ selectedPadding,
982
+ selectedFontSize,
983
+ selectedBoxSizing,
984
+ selectedFontWeight,
985
+ selectedLineHeight,
986
+ selectedHoverColor,
987
+ selectedTransition,
988
+ selectedBorderColor,
989
+ optionsBoxShadow,
990
+ optionsBorderRadius,
991
+ optionsBackgroundColor,
992
+ optionItemColor,
993
+ optionItemCursor,
994
+ optionItemPadding,
995
+ optionItemFontSize,
996
+ optionItemMinHeight,
997
+ optionItemBoxSizing,
998
+ optionItemFontWeight,
999
+ optionItemLineHeight,
1000
+ optionItemColorHover,
1001
+ optionItemMarginBottom,
1002
+ optionItemBackgroudColor,
1003
+ optionItemBackgroudColorHover
987
1004
  }) => {
988
1005
  const options = jsonData.length ? JSON.parse(jsonData) : [];
989
1006
  const ref = React.useRef();
990
- let [opened, setOpened] = React.useState(false);
991
- let [newSelected, setNewSelected] = React.useState({});
1007
+ const [opened, setOpened] = React.useState(false);
1008
+ const [isHover, setIsHover] = React.useState(false);
1009
+ const [newSelected, setNewSelected] = React.useState({});
1010
+ const configStyles = compereConfigs();
1011
+ const classProps = classnames__default["default"](className);
1012
+ const handleOpenClose = () => {
1013
+ setOpened(!opened);
1014
+ };
1015
+ const handleClearSelect = e => {
1016
+ onChange({});
1017
+ setNewSelected({});
1018
+ e.stopPropagation();
1019
+ };
1020
+ const handleSelectItem = option => {
1021
+ onChange(option);
1022
+ setOpened(!opened);
1023
+ setNewSelected(option);
1024
+ };
1025
+ const handleMouseEnter = () => {
1026
+ setIsHover(true);
1027
+ };
1028
+ const handleMouseLeave = () => {
1029
+ setIsHover(false);
1030
+ };
1031
+ const handleMouseEnterOption = e => {
1032
+ e.target.style.color = optionItemColorHover ? optionItemColorHover : configStyles.SELECT.optionItemColorHover;
1033
+ e.target.style.backgroundColor = optionItemBackgroudColorHover ? optionItemBackgroudColorHover : configStyles.SELECT.optionItemBackgroudColorHover;
1034
+ };
1035
+ const handleMouseLeaveOption = e => {
1036
+ e.target.style.color = optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor;
1037
+ e.target.style.backgroundColor = optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor;
1038
+ };
992
1039
  React.useEffect(() => {
993
1040
  const parseSelectedData = selected.length !== 0 ? JSON.parse(selected) : {};
994
1041
  setNewSelected(parseSelectedData);
@@ -1006,77 +1053,154 @@ const Select = ({
1006
1053
  };
1007
1054
  }
1008
1055
  }, [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", {
1056
+ return /*#__PURE__*/React__default["default"].createElement("div", {
1057
+ className: classProps
1058
+ }, label ? /*#__PURE__*/React__default["default"].createElement("label", {
1059
+ style: {
1060
+ color: labelColor ? labelColor : configStyles.SELECT.labelColor,
1061
+ fontWeight: labelWeight ? labelWeight : configStyles.SELECT.labelWeight,
1062
+ display: labelDisplay ? labelDisplay : configStyles.SELECT.labelDisplay,
1063
+ fontSize: labelFontSize ? labelFontSize : configStyles.SELECT.labelFontSize,
1064
+ lineHeight: labelLineHeight ? labelLineHeight : configStyles.SELECT.labelLineHeight,
1065
+ marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.SELECT.labelMarginBottom,
1066
+ textTransform: labelTextTransform ? labelTextTransform : configStyles.SELECT.labelTextTransform
1067
+ }
1068
+ }, label, required && /*#__PURE__*/React__default["default"].createElement("sup", {
1016
1069
  style: {
1017
1070
  color: "#ee0000"
1018
1071
  }
1019
1072
  }, "*")) : "", /*#__PURE__*/React__default["default"].createElement("div", {
1020
- className: `${styles$5['select-wrap']} select-wrap-rem`,
1021
1073
  ref: ref
1022
1074
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1023
- className: styles$5['select-content'],
1024
- id: styles$5.selector
1075
+ className: styles$5['select-content']
1025
1076
  }, /*#__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
- }
1077
+ style: {
1078
+ cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.SELECT.cursor,
1079
+ height: selectedHeight ? selectedHeight : configStyles.SELECT.selectedHeight,
1080
+ border: selectedBorder ? selectedBorder : configStyles.SELECT.selectedBorder,
1081
+ padding: selectedPadding ? selectedPadding : configStyles.SELECT.selectedPadding,
1082
+ borderRadius: selectedRadius ? selectedRadius : configStyles.SELECT.selectedRadius,
1083
+ fontSize: selectedFontSize ? selectedFontSize : configStyles.SELECT.selectedFontSize,
1084
+ boxSizing: selectedBoxSizing ? selectedBoxSizing : configStyles.SELECT.selectedBoxSizing,
1085
+ fontWeight: selectedFontWeight ? selectedFontWeight : configStyles.SELECT.selectedFontWeight,
1086
+ lineHeight: selectedLineHeight ? selectedLineHeight : configStyles.SELECT.selectedLineHeight,
1087
+ transition: selectedTransition ? selectedTransition : configStyles.SELECT.selectedTransition,
1088
+ borderColor: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : selectedBorderColor ? selectedBorderColor : configStyles.SELECT.selectedBorderColor
1089
+ },
1090
+ onClick: disabled ? _ => _ : _ => handleOpenClose(),
1091
+ onMouseEnter: disabled ? _ => _ : handleMouseEnter,
1092
+ onMouseLeave: disabled ? _ => _ : handleMouseLeave,
1093
+ className: `${styles$5['select-content-top']}`
1030
1094
  }, /*#__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();
1095
+ className: `${styles$5['select-content-top-text']}`,
1096
+ style: {
1097
+ color: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : isHover ? selectedHoverColor ? selectedHoverColor : configStyles.SELECT.selectedHoverColor : selectedColor ? selectedColor : configStyles.SELECT.selectedColor
1040
1098
  }
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`
1099
+ }, newSelected && newSelected[keyNames.name] ? newSelected[keyNames.name] : defaultOption), /*#__PURE__*/React__default["default"].createElement("div", {
1100
+ className: `${styles$5['select-content-top-icon']}`
1101
+ }, Object.keys(newSelected).length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
1102
+ className: `${styles$5['close-icon']}`,
1103
+ onClick: disabled ? _ => _ : handleClearSelect
1104
+ }, closeIcon ? closeIcon : /*#__PURE__*/React__default["default"].createElement("img", {
1105
+ src: ReactCloseIcon,
1106
+ alt: "icon"
1107
+ })), /*#__PURE__*/React__default["default"].createElement("div", {
1108
+ style: {
1109
+ transform: opened ? 'rotate(180deg)' : 'rotate(0deg)'
1110
+ },
1111
+ className: `${styles$5['arrow-icon']}`
1112
+ }, arrowIcon ? arrowIcon : /*#__PURE__*/React__default["default"].createElement("img", {
1113
+ src: ReactArrowIcon,
1114
+ alt: "icon"
1115
+ })))), opened && !disabled ? /*#__PURE__*/React__default["default"].createElement("div", {
1116
+ style: {
1117
+ boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
1118
+ borderRadius: optionsBorderRadius ? optionsBorderRadius : configStyles.SELECT.optionsBorderRadius,
1119
+ backgroundColor: optionsBackgroundColor ? optionsBackgroundColor : configStyles.SELECT.optionsBackgroundColor,
1120
+ top: parseFloat(selectedHeight ? selectedHeight.substring(0, selectedHeight.length - 2) : configStyles.SELECT.selectedHeight.substring(0, configStyles.SELECT.selectedHeight.length - 2)) + 6 + 'px'
1121
+ },
1122
+ className: `${styles$5['select-content-bottom']}`
1045
1123
  }, /*#__PURE__*/React__default["default"].createElement("div", {
1046
- className: `${styles$5['select-content-bottom-inner']} select-content-bottom-inner-rem`
1124
+ className: `${styles$5['select-content-bottom-inner']}`
1047
1125
  }, options.map((option, i) => {
1048
1126
  return /*#__PURE__*/React__default["default"].createElement("div", {
1049
1127
  key: i,
1050
- className: `${styles$5['select-content-bottom-row']} select-content-bottom-row-rem`,
1051
1128
  disabled: true,
1052
- onClick: () => {
1053
- setNewSelected(option);
1054
- onChange(option);
1055
- setOpened(!opened);
1056
- },
1057
- defaultValue: option[keyNames.id]
1129
+ defaultValue: option[keyNames.id],
1130
+ onClick: disabled ? _ => _ : _ => handleSelectItem(option),
1131
+ onMouseEnter: disabled ? _ => _ : e => handleMouseEnterOption(e),
1132
+ onMouseLeave: disabled ? _ => _ : e => handleMouseLeaveOption(e),
1133
+ className: `${styles$5['select-content-bottom-row']}`,
1134
+ style: {
1135
+ color: optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor,
1136
+ cursor: optionItemCursor ? optionItemCursor : configStyles.SELECT.optionItemCursor,
1137
+ padding: optionItemPadding ? optionItemPadding : configStyles.SELECT.optionItemPadding,
1138
+ fontSize: optionItemFontSize ? optionItemFontSize : configStyles.SELECT.optionItemFontSize,
1139
+ boxSizing: optionItemBoxSizing ? optionItemBoxSizing : configStyles.SELECT.optionItemBoxSizing,
1140
+ minHeight: optionItemMinHeight ? optionItemMinHeight : configStyles.SELECT.optionItemMinHeight,
1141
+ fontWeight: optionItemFontWeight ? optionItemFontWeight : configStyles.SELECT.optionItemFontWeight,
1142
+ lineHeight: optionItemLineHeight ? optionItemLineHeight : configStyles.SELECT.optionItemLineHeight,
1143
+ marginBottom: optionItemMarginBottom ? optionItemMarginBottom : configStyles.SELECT.optionItemMarginBottom,
1144
+ backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor
1145
+ }
1058
1146
  }, option[keyNames.name]);
1059
- }))) : null)), eMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
1060
- className: styles$5.eMessage
1061
- }, eMessage) : null);
1147
+ }))) : null)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
1148
+ style: {
1149
+ color: errorColor ? errorColor : configStyles.SELECT.errorColor,
1150
+ fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize
1151
+ }
1152
+ }, errorMessage) : '');
1062
1153
  };
1063
1154
  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
1155
  onChange: PropTypes__default["default"].func,
1070
1156
  required: PropTypes__default["default"].bool,
1071
1157
  disabled: PropTypes__default["default"].bool,
1072
- className: PropTypes__default["default"].string,
1073
1158
  selected: PropTypes__default["default"].string,
1074
1159
  jsonData: PropTypes__default["default"].string,
1075
- keyNames: PropTypes__default["default"].object
1076
- };
1077
- Select.defaultProps = {
1078
- size: 'medium',
1079
- required: false
1160
+ keyNames: PropTypes__default["default"].object,
1161
+ className: PropTypes__default["default"].string,
1162
+ arrowIcon: PropTypes__default["default"].element,
1163
+ closeIcon: PropTypes__default["default"].element,
1164
+ errorMessage: PropTypes__default["default"].string,
1165
+ defaultOption: PropTypes__default["default"].string,
1166
+ label: PropTypes__default["default"].string,
1167
+ labelColor: PropTypes__default["default"].string,
1168
+ labelWeight: PropTypes__default["default"].string,
1169
+ labelDisplay: PropTypes__default["default"].string,
1170
+ labelFontSize: PropTypes__default["default"].string,
1171
+ labelLineHeight: PropTypes__default["default"].string,
1172
+ labelMarginBottom: PropTypes__default["default"].string,
1173
+ labelTextTransform: PropTypes__default["default"].string,
1174
+ cursor: PropTypes__default["default"].string,
1175
+ errorSize: PropTypes__default["default"].string,
1176
+ errorColor: PropTypes__default["default"].string,
1177
+ selectedColor: PropTypes__default["default"].string,
1178
+ selectedBorder: PropTypes__default["default"].string,
1179
+ selectedRadius: PropTypes__default["default"].string,
1180
+ selectedHeight: PropTypes__default["default"].string,
1181
+ selectedPadding: PropTypes__default["default"].string,
1182
+ selectedFontSize: PropTypes__default["default"].string,
1183
+ selectedBoxSizing: PropTypes__default["default"].string,
1184
+ selectedHoverColor: PropTypes__default["default"].string,
1185
+ selectedFontWeight: PropTypes__default["default"].string,
1186
+ selectedLineHeight: PropTypes__default["default"].string,
1187
+ selectedTransition: PropTypes__default["default"].string,
1188
+ selectedBorderColor: PropTypes__default["default"].string,
1189
+ optionsBoxShadow: PropTypes__default["default"].string,
1190
+ optionsBorderRadius: PropTypes__default["default"].string,
1191
+ optionsBackgroundColor: PropTypes__default["default"].string,
1192
+ optionItemColor: PropTypes__default["default"].string,
1193
+ optionItemCursor: PropTypes__default["default"].string,
1194
+ optionItemPadding: PropTypes__default["default"].string,
1195
+ optionItemFontSize: PropTypes__default["default"].string,
1196
+ optionItemMinHeight: PropTypes__default["default"].string,
1197
+ optionItemBoxSizing: PropTypes__default["default"].string,
1198
+ optionItemFontWeight: PropTypes__default["default"].string,
1199
+ optionItemColorHover: PropTypes__default["default"].string,
1200
+ optionItemLineHeight: PropTypes__default["default"].string,
1201
+ optionItemMarginBottom: PropTypes__default["default"].string,
1202
+ optionItemBackgroudColor: PropTypes__default["default"].string,
1203
+ optionItemBackgroudColorHover: PropTypes__default["default"].string
1080
1204
  };
1081
1205
 
1082
1206
  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 +1279,7 @@ const Tooltip = ({
1155
1279
  cursor: 'pointer'
1156
1280
  },
1157
1281
  onClick: handleShow
1158
- }, tooltipIcon && tooltipIcon[0] ? tooltipIcon[0] : /*#__PURE__*/React__default["default"].createElement("img", {
1282
+ }, tooltipIcon ? tooltipIcon : /*#__PURE__*/React__default["default"].createElement("img", {
1159
1283
  src: ReactInfoIcon
1160
1284
  })));
1161
1285
  };
@@ -1169,11 +1293,11 @@ Tooltip.propTypes = {
1169
1293
  className: PropTypes__default["default"].string,
1170
1294
  fontFamily: PropTypes__default["default"].string,
1171
1295
  tooltipWidth: PropTypes__default["default"].string,
1296
+ tooltipIcon: PropTypes__default["default"].element,
1172
1297
  tooltipRadius: PropTypes__default["default"].string,
1173
1298
  text: PropTypes__default["default"].string.isRequired,
1174
1299
  backgroundColor: PropTypes__default["default"].string,
1175
- tooltipBackgroundColor: PropTypes__default["default"].string,
1176
- tooltipIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element)
1300
+ tooltipBackgroundColor: PropTypes__default["default"].string
1177
1301
  };
1178
1302
  Tooltip.defaultProps = {
1179
1303
  type: 'top'
@@ -1585,8 +1709,6 @@ exports.Modal = Modal;
1585
1709
  exports.Pagination = Pagination;
1586
1710
  exports.Radio = Radio;
1587
1711
  exports.Select = Select;
1588
- exports.SelectSize = SelectSize;
1589
- exports.SelectTheme = SelectTheme;
1590
1712
  exports.Stepper = Stepper;
1591
1713
  exports.Table = Table;
1592
1714
  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.57",
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)),