@xaypay/tui 0.0.55 → 0.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +85 -74
- package/dist/index.js +85 -74
- package/package.json +2 -1
- package/rollup.config.js +2 -0
- package/src/components/autocomplate/index.js +22 -17
- package/src/components/button/index.js +8 -8
- package/src/components/input/index.js +14 -18
- package/src/components/table/index.js +1 -1
- package/src/components/tooltip/index.js +37 -34
- package/src/components/tooltip/tooltip.module.css +2 -2
- package/src/components/tooltip/tooltip.stories.js +3 -2
- package/src/components/typography/index.js +6 -2
- package/src/stories/Introduction.stories.mdx +10 -0
- package/src/stories/configuration.stories.mdx +20 -3
- package/src/stories/static/button-usage.png +0 -0
- package/src/stories/usage.stories.mdx +128 -0
- package/src/utils/index.js +1 -0
- package/tui.config.js +15 -5
package/dist/index.js
CHANGED
|
@@ -376,8 +376,10 @@ const compereConfigs = () => {
|
|
|
376
376
|
try {
|
|
377
377
|
packageConfig = require('../tui.config.js');
|
|
378
378
|
} catch (error) {
|
|
379
|
+
packageConfig = require('../../tui.config.js');
|
|
379
380
|
// console.log(error, 'Package: tui.config.js file is not define');
|
|
380
381
|
}
|
|
382
|
+
|
|
381
383
|
try {
|
|
382
384
|
projectConfig = require('../../../../tui.config.js');
|
|
383
385
|
} catch (error) {
|
|
@@ -495,7 +497,10 @@ Typography.propTypes = {
|
|
|
495
497
|
colorHover: PropTypes__default["default"].string,
|
|
496
498
|
textTransform: PropTypes__default["default"].string,
|
|
497
499
|
textDecoration: PropTypes__default["default"].string,
|
|
498
|
-
variant: PropTypes__default["default"].oneOf(Object.values(TypographyType))
|
|
500
|
+
variant: PropTypes__default["default"].oneOf(Object.values(TypographyType))
|
|
501
|
+
};
|
|
502
|
+
Typography.defaultProps = {
|
|
503
|
+
variant: 'p'
|
|
499
504
|
};
|
|
500
505
|
|
|
501
506
|
const Modal = ({
|
|
@@ -624,19 +629,9 @@ const Input = ({
|
|
|
624
629
|
}) => {
|
|
625
630
|
const [show, setShow] = React.useState(false);
|
|
626
631
|
const [isHover, setIsHover] = React.useState(false);
|
|
627
|
-
const [tooltipStatus, setTooltipStatus] = React.useState(false);
|
|
628
632
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
629
633
|
const configStyles = compereConfigs();
|
|
630
634
|
const classProps = classnames__default["default"](className ? className : configStyles.INPUT.className);
|
|
631
|
-
const handleChange = event => {
|
|
632
|
-
onChange ? onChange(event.target.value) : _ => _;
|
|
633
|
-
};
|
|
634
|
-
const handleMouseEnter = () => {
|
|
635
|
-
setIsHover(true);
|
|
636
|
-
};
|
|
637
|
-
const handleMouseLeave = () => {
|
|
638
|
-
setIsHover(false);
|
|
639
|
-
};
|
|
640
635
|
const errorShow = styled.keyframes`
|
|
641
636
|
100% {
|
|
642
637
|
bottom: '-20px';
|
|
@@ -653,6 +648,15 @@ const Input = ({
|
|
|
653
648
|
const P = styled__default["default"].p`
|
|
654
649
|
animation: ${errorAnimation ? animation : 'none'};
|
|
655
650
|
`;
|
|
651
|
+
const handleChange = event => {
|
|
652
|
+
onChange ? onChange(event.target.value) : _ => _;
|
|
653
|
+
};
|
|
654
|
+
const handleMouseEnter = () => {
|
|
655
|
+
setIsHover(true);
|
|
656
|
+
};
|
|
657
|
+
const handleMouseLeave = () => {
|
|
658
|
+
setIsHover(false);
|
|
659
|
+
};
|
|
656
660
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
657
661
|
className: `${styles$7["input-wrap"]}`
|
|
658
662
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
@@ -739,10 +743,7 @@ const Input = ({
|
|
|
739
743
|
borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
740
744
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
741
745
|
}
|
|
742
|
-
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? /*#__PURE__*/React__default["default"].createElement(
|
|
743
|
-
variant: "p",
|
|
744
|
-
onClick: () => setTooltipStatus(!tooltipStatus)
|
|
745
|
-
}, "\u24D8") : null, tooltipStatus ? /*#__PURE__*/React__default["default"].createElement("p", null, tooltip) : null, errorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
|
|
746
|
+
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip && tooltip.length > 0 ? tooltip[0] : '', errorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
|
|
746
747
|
style: {
|
|
747
748
|
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
748
749
|
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
@@ -769,7 +770,6 @@ Input.propTypes = {
|
|
|
769
770
|
radius: PropTypes__default["default"].string,
|
|
770
771
|
padding: PropTypes__default["default"].string,
|
|
771
772
|
fontSize: PropTypes__default["default"].string,
|
|
772
|
-
tooltip: PropTypes__default["default"].element,
|
|
773
773
|
transform: PropTypes__default["default"].string,
|
|
774
774
|
className: PropTypes__default["default"].string,
|
|
775
775
|
iconWidth: PropTypes__default["default"].string,
|
|
@@ -796,6 +796,7 @@ Input.propTypes = {
|
|
|
796
796
|
labelLineHeight: PropTypes__default["default"].string,
|
|
797
797
|
labelMarginBottom: PropTypes__default["default"].string,
|
|
798
798
|
errorAnimationDuration: PropTypes__default["default"].string,
|
|
799
|
+
tooltip: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
|
|
799
800
|
leftIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
|
|
800
801
|
rightIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element),
|
|
801
802
|
type: PropTypes__default["default"].oneOf(Object.values(InputTypes))
|
|
@@ -872,7 +873,6 @@ const Button = ({
|
|
|
872
873
|
radius,
|
|
873
874
|
outline,
|
|
874
875
|
padding,
|
|
875
|
-
bgColor,
|
|
876
876
|
onClick,
|
|
877
877
|
disabled,
|
|
878
878
|
className,
|
|
@@ -881,8 +881,9 @@ const Button = ({
|
|
|
881
881
|
contentWidth,
|
|
882
882
|
disabledColor,
|
|
883
883
|
textTransform,
|
|
884
|
-
|
|
884
|
+
backgroundColor,
|
|
885
885
|
disabledLineColor,
|
|
886
|
+
disabledBackgroundColor,
|
|
886
887
|
...props
|
|
887
888
|
}) => {
|
|
888
889
|
const [isHover, setIsHover] = React.useState(false);
|
|
@@ -913,9 +914,9 @@ const Button = ({
|
|
|
913
914
|
width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
|
|
914
915
|
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
|
|
915
916
|
textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
|
|
916
|
-
backgroundColor: (outline || !outline) && disabled ?
|
|
917
|
-
boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` : `inset 0 0 0 2px ${
|
|
918
|
-
color: (outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor : outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color :
|
|
917
|
+
backgroundColor: (outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
|
|
918
|
+
boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` : `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}` : 'none',
|
|
919
|
+
color: (outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor : outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : color ? color : configStyles.BUTTON.color
|
|
919
920
|
},
|
|
920
921
|
type: type ? type : configStyles.BUTTON.type,
|
|
921
922
|
disabled: disabled ? disabled : configStyles.BUTTON.disabled,
|
|
@@ -940,16 +941,16 @@ Button.propTypes = {
|
|
|
940
941
|
disabled: PropTypes__default["default"].bool,
|
|
941
942
|
radius: PropTypes__default["default"].string,
|
|
942
943
|
padding: PropTypes__default["default"].string,
|
|
943
|
-
bgColor: PropTypes__default["default"].string,
|
|
944
944
|
boxSizing: PropTypes__default["default"].string,
|
|
945
945
|
className: PropTypes__default["default"].string,
|
|
946
946
|
transition: PropTypes__default["default"].string,
|
|
947
947
|
contentWidth: PropTypes__default["default"].bool,
|
|
948
948
|
textTransform: PropTypes__default["default"].string,
|
|
949
949
|
disabledColor: PropTypes__default["default"].string,
|
|
950
|
-
|
|
950
|
+
backgroundColor: PropTypes__default["default"].string,
|
|
951
951
|
label: PropTypes__default["default"].string.isRequired,
|
|
952
|
-
disabledLineColor: PropTypes__default["default"].string
|
|
952
|
+
disabledLineColor: PropTypes__default["default"].string,
|
|
953
|
+
disabledBackgroundColor: PropTypes__default["default"].string
|
|
953
954
|
};
|
|
954
955
|
|
|
955
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}";
|
|
@@ -1078,7 +1079,9 @@ Select.defaultProps = {
|
|
|
1078
1079
|
required: false
|
|
1079
1080
|
};
|
|
1080
1081
|
|
|
1081
|
-
var
|
|
1082
|
+
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>";
|
|
1083
|
+
|
|
1084
|
+
var css_248z$4 = ".tooltip-module_tooltip-block__v8U9u{align-items:center;display:flex;justify-content:center;position:relative}.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:10px;min-width:30px;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}";
|
|
1082
1085
|
var styles$4 = {"tooltip-block":"tooltip-module_tooltip-block__v8U9u","tooltip":"tooltip-module_tooltip__emM6A","tooltip-rel":"tooltip-module_tooltip-rel__to9gq","tooltip-decor":"tooltip-module_tooltip-decor__qvt7t"};
|
|
1083
1086
|
styleInject(css_248z$4);
|
|
1084
1087
|
|
|
@@ -1087,58 +1090,57 @@ const Tooltip = ({
|
|
|
1087
1090
|
text,
|
|
1088
1091
|
width,
|
|
1089
1092
|
color,
|
|
1090
|
-
tIcon,
|
|
1091
1093
|
height,
|
|
1092
|
-
|
|
1094
|
+
radius,
|
|
1093
1095
|
fontSize,
|
|
1094
|
-
tBgColor,
|
|
1095
1096
|
className,
|
|
1096
1097
|
fontFamily,
|
|
1097
|
-
|
|
1098
|
-
|
|
1098
|
+
tooltipIcon,
|
|
1099
|
+
tooltipWidth,
|
|
1100
|
+
tooltipRadius,
|
|
1101
|
+
backgroundColor,
|
|
1102
|
+
tooltipBackgroundColor
|
|
1099
1103
|
}) => {
|
|
1100
1104
|
const tooltipRef = /*#__PURE__*/React.createRef(null);
|
|
1101
|
-
const [
|
|
1102
|
-
const [
|
|
1105
|
+
const [checkTooltipWidth, setCheckTooltipWidth] = React.useState(0);
|
|
1106
|
+
const [checkTooltipHeight, setCheckTooltipHeight] = React.useState(0);
|
|
1103
1107
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
1104
1108
|
const configStyles = compereConfigs();
|
|
1105
1109
|
const classProps = classnames__default["default"](styles$4['tooltip'], className);
|
|
1106
|
-
React.useEffect(_ => {
|
|
1107
|
-
if (!type && !text) {
|
|
1108
|
-
alert('Add type and text on tooltip');
|
|
1109
|
-
} else if (!type) {
|
|
1110
|
-
alert('Add type on tooltip');
|
|
1111
|
-
} else if (!text) {
|
|
1112
|
-
alert('Add text on tooltip');
|
|
1113
|
-
}
|
|
1114
|
-
tooltipRef.current && tooltipRef.current.clientWidth && tooltipRef.current.clientWidth > 0 && setTooltipWidth(tooltipRef.current.clientWidth);
|
|
1115
|
-
tooltipRef.current && tooltipRef.current.clientHeight && tooltipRef.current.clientHeight > 0 && setTooltipHeight(tooltipRef.current.clientHeight);
|
|
1116
|
-
}, [type, text, tooltipWidth, tooltipRef]);
|
|
1117
1110
|
const handleShow = () => {
|
|
1118
1111
|
setShowTooltip(!showTooltip);
|
|
1119
1112
|
};
|
|
1113
|
+
React.useEffect(_ => {
|
|
1114
|
+
if (!text) {
|
|
1115
|
+
alert('Add text on tooltip');
|
|
1116
|
+
}
|
|
1117
|
+
tooltipRef.current && tooltipRef.current.clientWidth && tooltipRef.current.clientWidth > 0 && setCheckTooltipWidth(tooltipRef.current.clientWidth);
|
|
1118
|
+
tooltipRef.current && tooltipRef.current.clientHeight && tooltipRef.current.clientHeight > 0 && setCheckTooltipHeight(tooltipRef.current.clientHeight);
|
|
1119
|
+
}, [text, tooltipRef, checkTooltipWidth, checkTooltipHeight]);
|
|
1120
1120
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1121
1121
|
className: `${styles$4['tooltip-block']}`,
|
|
1122
1122
|
style: {
|
|
1123
1123
|
width: width ? width : configStyles.TOOLTIP.width,
|
|
1124
1124
|
height: height ? height : configStyles.TOOLTIP.height,
|
|
1125
|
-
|
|
1125
|
+
borderRadius: radius ? radius : configStyles.TOOLTIP.radius,
|
|
1126
|
+
backgroundColor: backgroundColor ? backgroundColor : configStyles.TOOLTIP.backgroundColor
|
|
1126
1127
|
}
|
|
1127
1128
|
}, showTooltip ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1128
1129
|
ref: tooltipRef,
|
|
1129
1130
|
className: classProps,
|
|
1130
1131
|
style: {
|
|
1131
|
-
|
|
1132
|
-
borderRadius:
|
|
1133
|
-
|
|
1134
|
-
|
|
1132
|
+
width: tooltipWidth ? tooltipWidth : configStyles.TOOLTIP.tooltipWidth,
|
|
1133
|
+
borderRadius: tooltipRadius ? tooltipRadius : configStyles.TOOLTIP.tooltipRadius,
|
|
1134
|
+
backgroundColor: tooltipBackgroundColor ? tooltipBackgroundColor : configStyles.TOOLTIP.tooltipBackgroundColor,
|
|
1135
|
+
top: type === 'top' ? `calc(-${checkTooltipHeight + 7}px)` : type === 'bottom' ? 'calc(100% + 7px)' : type === 'left' || type === 'right' ? `calc(50% - ${checkTooltipHeight / 2}px)` : '0px',
|
|
1136
|
+
left: type === 'top' || type === 'bottom' ? `calc(50% - ${checkTooltipWidth / 2}px)` : type === 'left' ? `-${checkTooltipWidth + 7}px` : type === 'right' ? 'calc(100% + 7px)' : '0px'
|
|
1135
1137
|
}
|
|
1136
1138
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1137
1139
|
className: `${styles$4['tooltip-rel']}`
|
|
1138
1140
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1139
1141
|
className: `${styles$4['tooltip-decor']}`,
|
|
1140
1142
|
style: {
|
|
1141
|
-
backgroundColor:
|
|
1143
|
+
backgroundColor: tooltipBackgroundColor ? tooltipBackgroundColor : configStyles.TOOLTIP.tooltipBackgroundColor,
|
|
1142
1144
|
left: type === 'top' || type === 'bottom' ? 'calc(50% - 5px)' : type === 'right' ? '-15px' : type === 'left' ? 'calc(100% + 5px)' : '0px',
|
|
1143
1145
|
top: type === 'top' ? 'calc(100% + 5px)' : type === 'bottom' ? '-15px' : type === 'right' || type === 'left' ? 'calc(50% - 5px)' : '0px'
|
|
1144
1146
|
}
|
|
@@ -1146,7 +1148,6 @@ const Tooltip = ({
|
|
|
1146
1148
|
style: {
|
|
1147
1149
|
color: color ? color : configStyles.TOOLTIP.color,
|
|
1148
1150
|
fontSize: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
1149
|
-
lineHeight: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
1150
1151
|
fontFamily: fontFamily ? fontFamily : configStyles.TOOLTIP.fontFamily
|
|
1151
1152
|
}
|
|
1152
1153
|
}, text))) : '', /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -1154,22 +1155,28 @@ const Tooltip = ({
|
|
|
1154
1155
|
cursor: 'pointer'
|
|
1155
1156
|
},
|
|
1156
1157
|
onClick: handleShow
|
|
1157
|
-
}
|
|
1158
|
+
}, tooltipIcon && tooltipIcon[0] ? tooltipIcon[0] : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1159
|
+
src: ReactInfoIcon
|
|
1160
|
+
})));
|
|
1158
1161
|
};
|
|
1159
1162
|
Tooltip.propTypes = {
|
|
1163
|
+
type: PropTypes__default["default"].string,
|
|
1160
1164
|
width: PropTypes__default["default"].string,
|
|
1161
1165
|
color: PropTypes__default["default"].string,
|
|
1162
|
-
tIcon: PropTypes__default["default"].element,
|
|
1163
1166
|
height: PropTypes__default["default"].string,
|
|
1164
|
-
|
|
1165
|
-
tBgColor: PropTypes__default["default"].string,
|
|
1167
|
+
radius: PropTypes__default["default"].string,
|
|
1166
1168
|
fontSize: PropTypes__default["default"].string,
|
|
1167
1169
|
className: PropTypes__default["default"].string,
|
|
1168
1170
|
fontFamily: PropTypes__default["default"].string,
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1171
|
+
tooltipWidth: PropTypes__default["default"].string,
|
|
1172
|
+
tooltipRadius: PropTypes__default["default"].string,
|
|
1173
|
+
text: PropTypes__default["default"].string.isRequired,
|
|
1174
|
+
backgroundColor: PropTypes__default["default"].string,
|
|
1175
|
+
tooltipBackgroundColor: PropTypes__default["default"].string,
|
|
1176
|
+
tooltipIcon: PropTypes__default["default"].arrayOf(PropTypes__default["default"].element)
|
|
1177
|
+
};
|
|
1178
|
+
Tooltip.defaultProps = {
|
|
1179
|
+
type: 'top'
|
|
1173
1180
|
};
|
|
1174
1181
|
|
|
1175
1182
|
var css_248z$3 = "*{margin:0;padding:0}.captcha-module_main__Ys3EH{height:74px;max-width:400px;position:relative;width:100%}.captcha-module_slider__KLYny{-webkit-appearance:none;background:#eee;border-radius:2px;bottom:0;height:4px;left:0;margin:auto 0;outline:none;position:absolute;top:0;width:100%}.captcha-module_slider__KLYny::-webkit-slider-thumb{-webkit-appearance:none;height:30px;position:relative;width:30px;z-index:3}.captcha-module_selector__JFhb4{left:0;z-index:2}.captcha-module_selectBtn__GP1iH,.captcha-module_selector__JFhb4{bottom:0;height:30px;margin:auto 0;position:absolute;top:0;width:30px}.captcha-module_selectBtn__GP1iH{background:#00236a;border:2px solid #fff;border-radius:50%;box-shadow:1px 0 6px rgba(60,57,62,.15);cursor:pointer}.captcha-module_progressBar__mhdtM{background:red;bottom:0;height:4px;left:0;margin:auto 0;position:absolute;top:0;width:auto}.captcha-module_range__k24I2{color:blue;margin-bottom:15px;margin-top:15px}";
|
|
@@ -1439,20 +1446,22 @@ var styles = {"autocomplate-content":"autocomplate-module_autocomplate-content__
|
|
|
1439
1446
|
styleInject(css_248z);
|
|
1440
1447
|
|
|
1441
1448
|
const Autocomplate = ({
|
|
1442
|
-
className,
|
|
1443
1449
|
label,
|
|
1450
|
+
value,
|
|
1444
1451
|
required,
|
|
1445
1452
|
disabled,
|
|
1446
|
-
|
|
1447
|
-
jsonSelectedOptionsData,
|
|
1453
|
+
keyNames,
|
|
1448
1454
|
onChange,
|
|
1449
|
-
|
|
1455
|
+
className,
|
|
1450
1456
|
searchCount,
|
|
1451
1457
|
placeHolder,
|
|
1452
|
-
keyNames,
|
|
1453
1458
|
errorMesage,
|
|
1459
|
+
autoComplete,
|
|
1460
|
+
jsonOptionsData,
|
|
1461
|
+
jsonSelectedOptionsData,
|
|
1454
1462
|
...props
|
|
1455
1463
|
}) => {
|
|
1464
|
+
const configStyles = compereConfigs();
|
|
1456
1465
|
classnames__default["default"](styles.searchBox, className);
|
|
1457
1466
|
const parseSelectedOptionsData = jsonSelectedOptionsData ? JSON.parse(jsonSelectedOptionsData) : {
|
|
1458
1467
|
name: '',
|
|
@@ -1463,10 +1472,6 @@ const Autocomplate = ({
|
|
|
1463
1472
|
const [activeOption, setActiveOption] = React.useState(0);
|
|
1464
1473
|
const [showOptions, setShowOptions] = React.useState(false);
|
|
1465
1474
|
const parseOptionsData = jsonOptionsData ? JSON.parse(jsonOptionsData) : [];
|
|
1466
|
-
React.useEffect(() => {
|
|
1467
|
-
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name]);
|
|
1468
|
-
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id]);
|
|
1469
|
-
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]]);
|
|
1470
1475
|
const handleChange = e => {
|
|
1471
1476
|
const currentInputValue = e.currentTarget.value;
|
|
1472
1477
|
setInputId(null);
|
|
@@ -1522,6 +1527,10 @@ const Autocomplate = ({
|
|
|
1522
1527
|
}, inputValue.length < searchCount ? `Լրացնել առնվազն ${searchCount} նիշ` : 'Նման տվյալ առկա չէ'))));
|
|
1523
1528
|
}
|
|
1524
1529
|
}
|
|
1530
|
+
React.useEffect(() => {
|
|
1531
|
+
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name]);
|
|
1532
|
+
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id]);
|
|
1533
|
+
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]]);
|
|
1525
1534
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
1526
1535
|
className: `${styles['autocomplate-title']} autocomplate-title-rem`
|
|
1527
1536
|
}, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
|
|
@@ -1533,6 +1542,7 @@ const Autocomplate = ({
|
|
|
1533
1542
|
}, /*#__PURE__*/React__default["default"].createElement("input", _extends({
|
|
1534
1543
|
id: inputId,
|
|
1535
1544
|
type: "text",
|
|
1545
|
+
autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
|
|
1536
1546
|
className: `${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMesage ? styles.errorBorder : ''}`,
|
|
1537
1547
|
disabled: disabled,
|
|
1538
1548
|
onChange: handleChange,
|
|
@@ -1546,18 +1556,19 @@ const Autocomplate = ({
|
|
|
1546
1556
|
}, errorMesage) : null, optionList));
|
|
1547
1557
|
};
|
|
1548
1558
|
Autocomplate.propTypes = {
|
|
1549
|
-
className: PropTypes__default["default"].string,
|
|
1550
1559
|
label: PropTypes__default["default"].string,
|
|
1551
|
-
placeHolder: PropTypes__default["default"].string,
|
|
1552
|
-
required: PropTypes__default["default"].bool,
|
|
1553
1560
|
disabled: PropTypes__default["default"].bool,
|
|
1554
|
-
|
|
1555
|
-
jsonSelectedOptionsData: PropTypes__default["default"].string,
|
|
1561
|
+
required: PropTypes__default["default"].bool,
|
|
1556
1562
|
onChange: PropTypes__default["default"].func,
|
|
1557
1563
|
value: PropTypes__default["default"].string,
|
|
1558
|
-
searchCount: PropTypes__default["default"].number,
|
|
1559
1564
|
keyNames: PropTypes__default["default"].object,
|
|
1560
|
-
|
|
1565
|
+
className: PropTypes__default["default"].string,
|
|
1566
|
+
searchCount: PropTypes__default["default"].number,
|
|
1567
|
+
errorMesage: PropTypes__default["default"].string,
|
|
1568
|
+
placeHolder: PropTypes__default["default"].string,
|
|
1569
|
+
autoComplete: PropTypes__default["default"].string,
|
|
1570
|
+
jsonOptionsData: PropTypes__default["default"].string,
|
|
1571
|
+
jsonSelectedOptionsData: PropTypes__default["default"].string
|
|
1561
1572
|
};
|
|
1562
1573
|
Autocomplate.defaultProps = {
|
|
1563
1574
|
required: false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaypay/tui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"rollup-plugin-babel": "^4.4.0",
|
|
42
42
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
43
43
|
"rollup-plugin-postcss": "^4.0.2",
|
|
44
|
+
"rollup-plugin-svg": "^2.0.0",
|
|
44
45
|
"sass": "^1.54.9",
|
|
45
46
|
"sass-loader": "^13.0.2",
|
|
46
47
|
"style-loader": "^3.3.1",
|
package/rollup.config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// import {babel} from '@rollup/plugin-babel';
|
|
2
|
+
import svg from 'rollup-plugin-svg';
|
|
2
3
|
import babel from 'rollup-plugin-babel';
|
|
3
4
|
import resolve from '@rollup/plugin-node-resolve';
|
|
4
5
|
import external from 'rollup-plugin-peer-deps-external';
|
|
@@ -28,6 +29,7 @@ export default [
|
|
|
28
29
|
exclude: 'node_modules/**',
|
|
29
30
|
presets: ['@babel/preset-react'],
|
|
30
31
|
}),
|
|
32
|
+
svg(),
|
|
31
33
|
external(),
|
|
32
34
|
resolve()
|
|
33
35
|
]
|
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import classnames from "classnames";
|
|
4
|
+
import { compereConfigs } from "./../../utils";
|
|
4
5
|
import styles from "./autocomplate.module.css";
|
|
5
6
|
|
|
6
7
|
export const Autocomplate = ({
|
|
7
|
-
className,
|
|
8
8
|
label,
|
|
9
|
+
value,
|
|
9
10
|
required,
|
|
10
11
|
disabled,
|
|
11
|
-
|
|
12
|
-
jsonSelectedOptionsData,
|
|
12
|
+
keyNames,
|
|
13
13
|
onChange,
|
|
14
|
-
|
|
14
|
+
className,
|
|
15
15
|
searchCount,
|
|
16
16
|
placeHolder,
|
|
17
|
-
keyNames,
|
|
18
17
|
errorMesage,
|
|
18
|
+
autoComplete,
|
|
19
|
+
jsonOptionsData,
|
|
20
|
+
jsonSelectedOptionsData,
|
|
19
21
|
...props
|
|
20
22
|
}) => {
|
|
23
|
+
const configStyles = compereConfigs();
|
|
21
24
|
const classProps = classnames(styles.searchBox, className);
|
|
22
25
|
const parseSelectedOptionsData =
|
|
23
26
|
jsonSelectedOptionsData ? JSON.parse(jsonSelectedOptionsData) : { name: '', id: '' };
|
|
@@ -27,10 +30,6 @@ export const Autocomplate = ({
|
|
|
27
30
|
const [showOptions, setShowOptions] = useState(false);
|
|
28
31
|
const parseOptionsData =
|
|
29
32
|
jsonOptionsData ? JSON.parse(jsonOptionsData) : [];
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name])
|
|
32
|
-
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id])
|
|
33
|
-
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]])
|
|
34
33
|
|
|
35
34
|
const handleChange = (e) => {
|
|
36
35
|
const currentInputValue = e.currentTarget.value;
|
|
@@ -89,6 +88,11 @@ export const Autocomplate = ({
|
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
|
|
91
|
+
useEffect(() => {
|
|
92
|
+
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name])
|
|
93
|
+
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id])
|
|
94
|
+
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]])
|
|
95
|
+
|
|
92
96
|
return (
|
|
93
97
|
<>
|
|
94
98
|
{label ? <label className={`${styles['autocomplate-title']} autocomplate-title-rem`}>{label} {required && <sup style={{color: "#ee0000"}}>*</sup>}</label> : ""}
|
|
@@ -96,6 +100,7 @@ export const Autocomplate = ({
|
|
|
96
100
|
<input
|
|
97
101
|
id={inputId}
|
|
98
102
|
type="text"
|
|
103
|
+
autoComplete={autoComplete ? autoComplete : configStyles.INPUT.autoComplete}
|
|
99
104
|
className={`${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMesage ? styles.errorBorder : ''}`}
|
|
100
105
|
disabled={disabled}
|
|
101
106
|
onChange={handleChange}
|
|
@@ -112,21 +117,21 @@ export const Autocomplate = ({
|
|
|
112
117
|
};
|
|
113
118
|
|
|
114
119
|
Autocomplate.propTypes = {
|
|
115
|
-
className: PropTypes.string,
|
|
116
120
|
label: PropTypes.string,
|
|
117
|
-
placeHolder: PropTypes.string,
|
|
118
|
-
required: PropTypes.bool,
|
|
119
121
|
disabled: PropTypes.bool,
|
|
120
|
-
|
|
121
|
-
jsonSelectedOptionsData: PropTypes.string,
|
|
122
|
+
required: PropTypes.bool,
|
|
122
123
|
onChange: PropTypes.func,
|
|
123
124
|
value: PropTypes.string,
|
|
124
|
-
searchCount: PropTypes.number,
|
|
125
125
|
keyNames: PropTypes.object,
|
|
126
|
+
className: PropTypes.string,
|
|
127
|
+
searchCount: PropTypes.number,
|
|
126
128
|
errorMesage: PropTypes.string,
|
|
129
|
+
placeHolder: PropTypes.string,
|
|
130
|
+
autoComplete: PropTypes.string,
|
|
131
|
+
jsonOptionsData: PropTypes.string,
|
|
132
|
+
jsonSelectedOptionsData: PropTypes.string,
|
|
127
133
|
};
|
|
128
134
|
|
|
129
|
-
|
|
130
135
|
Autocomplate.defaultProps = {
|
|
131
136
|
required: false,
|
|
132
|
-
};
|
|
137
|
+
};
|
|
@@ -17,7 +17,6 @@ export const Button = ({
|
|
|
17
17
|
radius,
|
|
18
18
|
outline,
|
|
19
19
|
padding,
|
|
20
|
-
bgColor,
|
|
21
20
|
onClick,
|
|
22
21
|
disabled,
|
|
23
22
|
className,
|
|
@@ -26,8 +25,9 @@ export const Button = ({
|
|
|
26
25
|
contentWidth,
|
|
27
26
|
disabledColor,
|
|
28
27
|
textTransform,
|
|
29
|
-
|
|
28
|
+
backgroundColor,
|
|
30
29
|
disabledLineColor,
|
|
30
|
+
disabledBackgroundColor,
|
|
31
31
|
...props
|
|
32
32
|
}) => {
|
|
33
33
|
|
|
@@ -68,17 +68,17 @@ export const Button = ({
|
|
|
68
68
|
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
|
|
69
69
|
textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
|
|
70
70
|
backgroundColor:
|
|
71
|
-
(outline || !outline) && disabled ?
|
|
72
|
-
outline && !disabled ? isHover ?
|
|
71
|
+
(outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor :
|
|
72
|
+
outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
|
|
73
73
|
boxShadow:
|
|
74
74
|
outline ?
|
|
75
75
|
disabled ?
|
|
76
76
|
`inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` :
|
|
77
|
-
`inset 0 0 0 2px ${
|
|
77
|
+
`inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}` :
|
|
78
78
|
'none',
|
|
79
79
|
color:
|
|
80
80
|
(outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor :
|
|
81
|
-
outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color :
|
|
81
|
+
outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : color ? color : configStyles.BUTTON.color
|
|
82
82
|
}}
|
|
83
83
|
type={type ? type : configStyles.BUTTON.type}
|
|
84
84
|
disabled={disabled ? disabled : configStyles.BUTTON.disabled}
|
|
@@ -108,14 +108,14 @@ Button.propTypes = {
|
|
|
108
108
|
disabled: PropTypes.bool,
|
|
109
109
|
radius: PropTypes.string,
|
|
110
110
|
padding: PropTypes.string,
|
|
111
|
-
bgColor: PropTypes.string,
|
|
112
111
|
boxSizing: PropTypes.string,
|
|
113
112
|
className: PropTypes.string,
|
|
114
113
|
transition: PropTypes.string,
|
|
115
114
|
contentWidth: PropTypes.bool,
|
|
116
115
|
textTransform: PropTypes.string,
|
|
117
116
|
disabledColor: PropTypes.string,
|
|
118
|
-
|
|
117
|
+
backgroundColor: PropTypes.string,
|
|
119
118
|
label: PropTypes.string.isRequired,
|
|
120
119
|
disabledLineColor: PropTypes.string,
|
|
120
|
+
disabledBackgroundColor: PropTypes.string
|
|
121
121
|
};
|
|
@@ -60,7 +60,6 @@ export const Input = ({
|
|
|
60
60
|
}) => {
|
|
61
61
|
const [show, setShow] = useState(false);
|
|
62
62
|
const [isHover, setIsHover] = useState(false);
|
|
63
|
-
const [tooltipStatus, setTooltipStatus] = useState(false);
|
|
64
63
|
|
|
65
64
|
const random = Math.floor((Math.random() * 1000) + 1);
|
|
66
65
|
const configStyles = compereConfigs();
|
|
@@ -68,18 +67,6 @@ export const Input = ({
|
|
|
68
67
|
className ? className : configStyles.INPUT.className
|
|
69
68
|
);
|
|
70
69
|
|
|
71
|
-
const handleChange = (event) => {
|
|
72
|
-
onChange ? onChange(event.target.value) : _ => _;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const handleMouseEnter = () => {
|
|
76
|
-
setIsHover(true);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const handleMouseLeave = () => {
|
|
80
|
-
setIsHover(false);
|
|
81
|
-
};
|
|
82
|
-
|
|
83
70
|
const errorShow = keyframes`
|
|
84
71
|
100% {
|
|
85
72
|
bottom: '-20px';
|
|
@@ -98,6 +85,18 @@ export const Input = ({
|
|
|
98
85
|
const P = styled.p`
|
|
99
86
|
animation: ${errorAnimation ? animation : 'none'};
|
|
100
87
|
`;
|
|
88
|
+
|
|
89
|
+
const handleChange = (event) => {
|
|
90
|
+
onChange ? onChange(event.target.value) : _ => _;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const handleMouseEnter = () => {
|
|
94
|
+
setIsHover(true);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const handleMouseLeave = () => {
|
|
98
|
+
setIsHover(false);
|
|
99
|
+
};
|
|
101
100
|
|
|
102
101
|
return (
|
|
103
102
|
<div className={`${styles["input-wrap"]}`}>
|
|
@@ -211,11 +210,8 @@ export const Input = ({
|
|
|
211
210
|
}
|
|
212
211
|
</div>
|
|
213
212
|
{
|
|
214
|
-
tooltip ?
|
|
215
|
-
ⓘ
|
|
216
|
-
</Typography> : null
|
|
213
|
+
tooltip && tooltip.length > 0 ? tooltip[0] : ''
|
|
217
214
|
}
|
|
218
|
-
{tooltipStatus ? <p>{tooltip}</p> : null}
|
|
219
215
|
{
|
|
220
216
|
errorMessage ?
|
|
221
217
|
<P
|
|
@@ -252,7 +248,6 @@ Input.propTypes = {
|
|
|
252
248
|
radius: PropTypes.string,
|
|
253
249
|
padding: PropTypes.string,
|
|
254
250
|
fontSize: PropTypes.string,
|
|
255
|
-
tooltip: PropTypes.element,
|
|
256
251
|
transform: PropTypes.string,
|
|
257
252
|
className: PropTypes.string,
|
|
258
253
|
iconWidth: PropTypes.string,
|
|
@@ -279,6 +274,7 @@ Input.propTypes = {
|
|
|
279
274
|
labelLineHeight: PropTypes.string,
|
|
280
275
|
labelMarginBottom: PropTypes.string,
|
|
281
276
|
errorAnimationDuration: PropTypes.string,
|
|
277
|
+
tooltip: PropTypes.arrayOf(PropTypes.element),
|
|
282
278
|
leftIcon: PropTypes.arrayOf(PropTypes.element),
|
|
283
279
|
rightIcon: PropTypes.arrayOf(PropTypes.element),
|
|
284
280
|
type: PropTypes.oneOf(Object.values(InputTypes)),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import PropTypes
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import styles from "./table.module.css";
|
|
5
5
|
import { Checkbox } from "../checkbox";
|