@xaypay/tui 0.0.55 → 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.es.js +319 -184
- package/dist/index.js +318 -185
- package/package.json +5 -4
- package/rollup.config.js +2 -0
- package/src/assets/icons/arrow.svg +3 -0
- package/src/assets/icons/close-icon.svg +3 -0
- package/src/components/autocomplate/index.js +22 -17
- package/src/components/button/index.js +8 -8
- package/src/components/file/index.js +7 -0
- package/src/components/input/index.js +14 -18
- package/src/components/select/index.js +252 -103
- package/src/components/select/select.module.css +43 -80
- package/src/components/select/select.stories.js +1 -2
- 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 +26 -35
- package/src/components/typography/typography.stories.js +1 -1
- package/src/stories/Introduction.stories.mdx +10 -0
- package/src/stories/configuration.stories.mdx +76 -11
- package/src/stories/static/button-usage.png +0 -0
- package/src/stories/static/input-tooltip-usage.png +0 -0
- package/src/stories/usage.stories.mdx +132 -0
- package/src/utils/index.js +1 -5
- package/tui.config.js +67 -13
- package/src/components/multiselect/index.js +0 -96
- package/src/components/multiselect/multiselect.module.css +0 -137
- package/src/components/multiselect/multiselect.stories.js +0 -20
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,11 +379,7 @@ const _ = require('lodash');
|
|
|
373
379
|
const compereConfigs = () => {
|
|
374
380
|
let projectConfig = {};
|
|
375
381
|
let packageConfig = {};
|
|
376
|
-
|
|
377
|
-
packageConfig = require('../tui.config.js');
|
|
378
|
-
} catch (error) {
|
|
379
|
-
// console.log(error, 'Package: tui.config.js file is not define');
|
|
380
|
-
}
|
|
382
|
+
packageConfig = require(process.env.STORYBOOK_PATH);
|
|
381
383
|
try {
|
|
382
384
|
projectConfig = require('../../../../tui.config.js');
|
|
383
385
|
} catch (error) {
|
|
@@ -408,7 +410,6 @@ const Typography = ({
|
|
|
408
410
|
margin,
|
|
409
411
|
padding,
|
|
410
412
|
variant,
|
|
411
|
-
bgColor,
|
|
412
413
|
onClick,
|
|
413
414
|
children,
|
|
414
415
|
textAlign,
|
|
@@ -420,45 +421,18 @@ const Typography = ({
|
|
|
420
421
|
fontFamily,
|
|
421
422
|
textTransform,
|
|
422
423
|
textDecoration,
|
|
424
|
+
backgroundColor,
|
|
423
425
|
...props
|
|
424
426
|
}) => {
|
|
425
427
|
const configStyles = compereConfigs();
|
|
426
428
|
const classProps = classnames__default["default"](className);
|
|
427
429
|
const [isHover, setIsHover] = React.useState(false);
|
|
428
430
|
const [validVariant, setValidVariant] = React.useState(false);
|
|
429
|
-
const [style, setStyle] = React.useState({
|
|
430
|
-
border: border ? border : configStyles.TYPOGRAPHY.border,
|
|
431
|
-
cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
|
|
432
|
-
borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
|
|
433
|
-
fontSize: size ? size : configStyles.TYPOGRAPHY['size' + variant],
|
|
434
|
-
margin: margin ? margin : configStyles.TYPOGRAPHY['margin' + variant],
|
|
435
|
-
fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight' + variant],
|
|
436
|
-
padding: padding ? padding : configStyles.TYPOGRAPHY['padding' + variant],
|
|
437
|
-
textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
|
|
438
|
-
textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign' + variant],
|
|
439
|
-
backgroundColor: bgColor ? bgColor : configStyles.TYPOGRAPHY['bgColor' + variant],
|
|
440
|
-
fontStyle: fontStyle ? fontStyle : configStyles.TYPOGRAPHY['fontStyle' + variant],
|
|
441
|
-
lineHeight: lineHeight ? lineHeight : configStyles.TYPOGRAPHY['lineHeight' + variant],
|
|
442
|
-
fontFamily: fontFamily ? fontFamily : configStyles.TYPOGRAPHY['fontFamily' + variant],
|
|
443
|
-
textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
|
|
444
|
-
textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
|
|
445
|
-
color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
|
|
446
|
-
});
|
|
447
431
|
React.useEffect(() => {
|
|
448
432
|
if (!Object.values(TypographyType).includes(variant)) {
|
|
449
433
|
setValidVariant(true);
|
|
450
434
|
}
|
|
451
435
|
}, [variant]);
|
|
452
|
-
React.useEffect(() => {
|
|
453
|
-
if (color) {
|
|
454
|
-
setStyle(prev => {
|
|
455
|
-
return {
|
|
456
|
-
...prev,
|
|
457
|
-
color: color
|
|
458
|
-
};
|
|
459
|
-
});
|
|
460
|
-
}
|
|
461
|
-
}, [color]);
|
|
462
436
|
const handleMouseEnter = () => {
|
|
463
437
|
setIsHover(true);
|
|
464
438
|
};
|
|
@@ -466,7 +440,24 @@ const Typography = ({
|
|
|
466
440
|
setIsHover(false);
|
|
467
441
|
};
|
|
468
442
|
const tagT = /*#__PURE__*/React__default["default"].createElement(variant, {
|
|
469
|
-
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
|
+
},
|
|
470
461
|
...props,
|
|
471
462
|
className: classProps,
|
|
472
463
|
onClick: onClick ? onClick : _ => _,
|
|
@@ -484,7 +475,6 @@ Typography.propTypes = {
|
|
|
484
475
|
cursor: PropTypes__default["default"].string,
|
|
485
476
|
margin: PropTypes__default["default"].string,
|
|
486
477
|
radius: PropTypes__default["default"].string,
|
|
487
|
-
bgColor: PropTypes__default["default"].string,
|
|
488
478
|
padding: PropTypes__default["default"].string,
|
|
489
479
|
textAlign: PropTypes__default["default"].string,
|
|
490
480
|
className: PropTypes__default["default"].string,
|
|
@@ -495,7 +485,11 @@ Typography.propTypes = {
|
|
|
495
485
|
colorHover: PropTypes__default["default"].string,
|
|
496
486
|
textTransform: PropTypes__default["default"].string,
|
|
497
487
|
textDecoration: PropTypes__default["default"].string,
|
|
498
|
-
|
|
488
|
+
backgroundColor: PropTypes__default["default"].string,
|
|
489
|
+
variant: PropTypes__default["default"].oneOf(Object.values(TypographyType))
|
|
490
|
+
};
|
|
491
|
+
Typography.defaultProps = {
|
|
492
|
+
variant: 'p'
|
|
499
493
|
};
|
|
500
494
|
|
|
501
495
|
const Modal = ({
|
|
@@ -624,19 +618,9 @@ const Input = ({
|
|
|
624
618
|
}) => {
|
|
625
619
|
const [show, setShow] = React.useState(false);
|
|
626
620
|
const [isHover, setIsHover] = React.useState(false);
|
|
627
|
-
const [tooltipStatus, setTooltipStatus] = React.useState(false);
|
|
628
621
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
629
622
|
const configStyles = compereConfigs();
|
|
630
623
|
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
624
|
const errorShow = styled.keyframes`
|
|
641
625
|
100% {
|
|
642
626
|
bottom: '-20px';
|
|
@@ -653,6 +637,15 @@ const Input = ({
|
|
|
653
637
|
const P = styled__default["default"].p`
|
|
654
638
|
animation: ${errorAnimation ? animation : 'none'};
|
|
655
639
|
`;
|
|
640
|
+
const handleChange = event => {
|
|
641
|
+
onChange ? onChange(event.target.value) : _ => _;
|
|
642
|
+
};
|
|
643
|
+
const handleMouseEnter = () => {
|
|
644
|
+
setIsHover(true);
|
|
645
|
+
};
|
|
646
|
+
const handleMouseLeave = () => {
|
|
647
|
+
setIsHover(false);
|
|
648
|
+
};
|
|
656
649
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
657
650
|
className: `${styles$7["input-wrap"]}`
|
|
658
651
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
@@ -672,6 +665,7 @@ const Input = ({
|
|
|
672
665
|
}, "*")) : '', /*#__PURE__*/React__default["default"].createElement("div", {
|
|
673
666
|
className: `${styles$7["input-content"]}`,
|
|
674
667
|
style: {
|
|
668
|
+
width: width ? width : configStyles.INPUT.width,
|
|
675
669
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
676
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
|
|
677
671
|
},
|
|
@@ -739,10 +733,7 @@ const Input = ({
|
|
|
739
733
|
borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
740
734
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
741
735
|
}
|
|
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, {
|
|
736
|
+
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', errorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
|
|
746
737
|
style: {
|
|
747
738
|
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
748
739
|
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
@@ -872,7 +863,6 @@ const Button = ({
|
|
|
872
863
|
radius,
|
|
873
864
|
outline,
|
|
874
865
|
padding,
|
|
875
|
-
bgColor,
|
|
876
866
|
onClick,
|
|
877
867
|
disabled,
|
|
878
868
|
className,
|
|
@@ -881,8 +871,9 @@ const Button = ({
|
|
|
881
871
|
contentWidth,
|
|
882
872
|
disabledColor,
|
|
883
873
|
textTransform,
|
|
884
|
-
|
|
874
|
+
backgroundColor,
|
|
885
875
|
disabledLineColor,
|
|
876
|
+
disabledBackgroundColor,
|
|
886
877
|
...props
|
|
887
878
|
}) => {
|
|
888
879
|
const [isHover, setIsHover] = React.useState(false);
|
|
@@ -913,9 +904,9 @@ const Button = ({
|
|
|
913
904
|
width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
|
|
914
905
|
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
|
|
915
906
|
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 :
|
|
907
|
+
backgroundColor: (outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
|
|
908
|
+
boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` : `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}` : 'none',
|
|
909
|
+
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
910
|
},
|
|
920
911
|
type: type ? type : configStyles.BUTTON.type,
|
|
921
912
|
disabled: disabled ? disabled : configStyles.BUTTON.disabled,
|
|
@@ -940,54 +931,111 @@ Button.propTypes = {
|
|
|
940
931
|
disabled: PropTypes__default["default"].bool,
|
|
941
932
|
radius: PropTypes__default["default"].string,
|
|
942
933
|
padding: PropTypes__default["default"].string,
|
|
943
|
-
bgColor: PropTypes__default["default"].string,
|
|
944
934
|
boxSizing: PropTypes__default["default"].string,
|
|
945
935
|
className: PropTypes__default["default"].string,
|
|
946
936
|
transition: PropTypes__default["default"].string,
|
|
947
937
|
contentWidth: PropTypes__default["default"].bool,
|
|
948
938
|
textTransform: PropTypes__default["default"].string,
|
|
949
939
|
disabledColor: PropTypes__default["default"].string,
|
|
950
|
-
|
|
940
|
+
backgroundColor: PropTypes__default["default"].string,
|
|
951
941
|
label: PropTypes__default["default"].string.isRequired,
|
|
952
|
-
disabledLineColor: PropTypes__default["default"].string
|
|
942
|
+
disabledLineColor: PropTypes__default["default"].string,
|
|
943
|
+
disabledBackgroundColor: PropTypes__default["default"].string
|
|
953
944
|
};
|
|
954
945
|
|
|
955
|
-
var
|
|
956
|
-
|
|
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"};
|
|
957
952
|
styleInject(css_248z$5);
|
|
958
953
|
|
|
959
|
-
const SelectTheme = {
|
|
960
|
-
DEFAULT: 'select-default',
|
|
961
|
-
PRIMARY: 'select-primary',
|
|
962
|
-
SUCCESS: 'select-success',
|
|
963
|
-
INFO: 'select-info',
|
|
964
|
-
WARNING: 'select-warning',
|
|
965
|
-
DANGER: 'select-danger',
|
|
966
|
-
LINK: 'select-link'
|
|
967
|
-
};
|
|
968
|
-
const SelectSize = {
|
|
969
|
-
SMALL: 'small',
|
|
970
|
-
MEDIUM: 'medium',
|
|
971
|
-
LARGE: 'large'
|
|
972
|
-
};
|
|
973
954
|
const Select = ({
|
|
974
|
-
theme,
|
|
975
|
-
size,
|
|
976
|
-
className,
|
|
977
955
|
disabled,
|
|
978
|
-
label,
|
|
979
956
|
jsonData,
|
|
980
|
-
eMessage,
|
|
981
957
|
required,
|
|
982
|
-
defaultOption,
|
|
983
958
|
onChange,
|
|
984
959
|
keyNames,
|
|
985
|
-
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
|
|
986
1004
|
}) => {
|
|
987
1005
|
const options = jsonData.length ? JSON.parse(jsonData) : [];
|
|
988
1006
|
const ref = React.useRef();
|
|
989
|
-
|
|
990
|
-
|
|
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
|
+
};
|
|
991
1039
|
React.useEffect(() => {
|
|
992
1040
|
const parseSelectedData = selected.length !== 0 ? JSON.parse(selected) : {};
|
|
993
1041
|
setNewSelected(parseSelectedData);
|
|
@@ -1005,80 +1053,159 @@ const Select = ({
|
|
|
1005
1053
|
};
|
|
1006
1054
|
}
|
|
1007
1055
|
}, [opened]);
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
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", {
|
|
1015
1069
|
style: {
|
|
1016
1070
|
color: "#ee0000"
|
|
1017
1071
|
}
|
|
1018
1072
|
}, "*")) : "", /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1019
|
-
className: `${styles$5['select-wrap']} select-wrap-rem`,
|
|
1020
1073
|
ref: ref
|
|
1021
1074
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1022
|
-
className: styles$5['select-content']
|
|
1023
|
-
id: styles$5.selector
|
|
1075
|
+
className: styles$5['select-content']
|
|
1024
1076
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
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']}`
|
|
1029
1094
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1030
|
-
className: `${styles$5['select-content-top-text']}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
}, Object.keys(newSelected).length > 0 && /*#__PURE__*/React__default["default"].createElement("i", {
|
|
1034
|
-
className: "icon-close",
|
|
1035
|
-
onClick: e => {
|
|
1036
|
-
setNewSelected({});
|
|
1037
|
-
onChange({});
|
|
1038
|
-
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
|
|
1039
1098
|
}
|
|
1040
|
-
}), /*#__PURE__*/React__default["default"].createElement("
|
|
1041
|
-
className:
|
|
1042
|
-
}
|
|
1043
|
-
className: `${styles$5['
|
|
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']}`
|
|
1044
1123
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1045
|
-
className: `${styles$5['select-content-bottom-inner']}
|
|
1124
|
+
className: `${styles$5['select-content-bottom-inner']}`
|
|
1046
1125
|
}, options.map((option, i) => {
|
|
1047
1126
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1048
1127
|
key: i,
|
|
1049
|
-
className: `${styles$5['select-content-bottom-row']} select-content-bottom-row-rem`,
|
|
1050
1128
|
disabled: true,
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
}
|
|
1056
|
-
|
|
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
|
+
}
|
|
1057
1146
|
}, option[keyNames.name]);
|
|
1058
|
-
}))) : null)),
|
|
1059
|
-
|
|
1060
|
-
|
|
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) : '');
|
|
1061
1153
|
};
|
|
1062
1154
|
Select.propTypes = {
|
|
1063
|
-
theme: PropTypes__default["default"].oneOf(Object.values(SelectTheme)),
|
|
1064
|
-
size: PropTypes__default["default"].oneOf(Object.values(SelectSize)),
|
|
1065
|
-
label: PropTypes__default["default"].string,
|
|
1066
|
-
eMessage: PropTypes__default["default"].string,
|
|
1067
|
-
defaultOption: PropTypes__default["default"].string,
|
|
1068
1155
|
onChange: PropTypes__default["default"].func,
|
|
1069
1156
|
required: PropTypes__default["default"].bool,
|
|
1070
1157
|
disabled: PropTypes__default["default"].bool,
|
|
1071
|
-
className: PropTypes__default["default"].string,
|
|
1072
1158
|
selected: PropTypes__default["default"].string,
|
|
1073
1159
|
jsonData: PropTypes__default["default"].string,
|
|
1074
|
-
keyNames: PropTypes__default["default"].object
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
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
|
|
1079
1204
|
};
|
|
1080
1205
|
|
|
1081
|
-
var
|
|
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>";
|
|
1207
|
+
|
|
1208
|
+
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
1209
|
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
1210
|
styleInject(css_248z$4);
|
|
1084
1211
|
|
|
@@ -1087,58 +1214,57 @@ const Tooltip = ({
|
|
|
1087
1214
|
text,
|
|
1088
1215
|
width,
|
|
1089
1216
|
color,
|
|
1090
|
-
tIcon,
|
|
1091
1217
|
height,
|
|
1092
|
-
|
|
1218
|
+
radius,
|
|
1093
1219
|
fontSize,
|
|
1094
|
-
tBgColor,
|
|
1095
1220
|
className,
|
|
1096
1221
|
fontFamily,
|
|
1097
|
-
|
|
1098
|
-
|
|
1222
|
+
tooltipIcon,
|
|
1223
|
+
tooltipWidth,
|
|
1224
|
+
tooltipRadius,
|
|
1225
|
+
backgroundColor,
|
|
1226
|
+
tooltipBackgroundColor
|
|
1099
1227
|
}) => {
|
|
1100
1228
|
const tooltipRef = /*#__PURE__*/React.createRef(null);
|
|
1101
|
-
const [
|
|
1102
|
-
const [
|
|
1229
|
+
const [checkTooltipWidth, setCheckTooltipWidth] = React.useState(0);
|
|
1230
|
+
const [checkTooltipHeight, setCheckTooltipHeight] = React.useState(0);
|
|
1103
1231
|
const [showTooltip, setShowTooltip] = React.useState(false);
|
|
1104
1232
|
const configStyles = compereConfigs();
|
|
1105
1233
|
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
1234
|
const handleShow = () => {
|
|
1118
1235
|
setShowTooltip(!showTooltip);
|
|
1119
1236
|
};
|
|
1237
|
+
React.useEffect(_ => {
|
|
1238
|
+
if (!text) {
|
|
1239
|
+
alert('Add text on tooltip');
|
|
1240
|
+
}
|
|
1241
|
+
tooltipRef.current && tooltipRef.current.clientWidth && tooltipRef.current.clientWidth > 0 && setCheckTooltipWidth(tooltipRef.current.clientWidth);
|
|
1242
|
+
tooltipRef.current && tooltipRef.current.clientHeight && tooltipRef.current.clientHeight > 0 && setCheckTooltipHeight(tooltipRef.current.clientHeight);
|
|
1243
|
+
}, [text, tooltipRef, checkTooltipWidth, checkTooltipHeight]);
|
|
1120
1244
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1121
1245
|
className: `${styles$4['tooltip-block']}`,
|
|
1122
1246
|
style: {
|
|
1123
1247
|
width: width ? width : configStyles.TOOLTIP.width,
|
|
1124
1248
|
height: height ? height : configStyles.TOOLTIP.height,
|
|
1125
|
-
|
|
1249
|
+
borderRadius: radius ? radius : configStyles.TOOLTIP.radius,
|
|
1250
|
+
backgroundColor: backgroundColor ? backgroundColor : configStyles.TOOLTIP.backgroundColor
|
|
1126
1251
|
}
|
|
1127
1252
|
}, showTooltip ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1128
1253
|
ref: tooltipRef,
|
|
1129
1254
|
className: classProps,
|
|
1130
1255
|
style: {
|
|
1131
|
-
|
|
1132
|
-
borderRadius:
|
|
1133
|
-
|
|
1134
|
-
|
|
1256
|
+
width: tooltipWidth ? tooltipWidth : configStyles.TOOLTIP.tooltipWidth,
|
|
1257
|
+
borderRadius: tooltipRadius ? tooltipRadius : configStyles.TOOLTIP.tooltipRadius,
|
|
1258
|
+
backgroundColor: tooltipBackgroundColor ? tooltipBackgroundColor : configStyles.TOOLTIP.tooltipBackgroundColor,
|
|
1259
|
+
top: type === 'top' ? `calc(-${checkTooltipHeight + 7}px)` : type === 'bottom' ? 'calc(100% + 7px)' : type === 'left' || type === 'right' ? `calc(50% - ${checkTooltipHeight / 2}px)` : '0px',
|
|
1260
|
+
left: type === 'top' || type === 'bottom' ? `calc(50% - ${checkTooltipWidth / 2}px)` : type === 'left' ? `-${checkTooltipWidth + 7}px` : type === 'right' ? 'calc(100% + 7px)' : '0px'
|
|
1135
1261
|
}
|
|
1136
1262
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1137
1263
|
className: `${styles$4['tooltip-rel']}`
|
|
1138
1264
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1139
1265
|
className: `${styles$4['tooltip-decor']}`,
|
|
1140
1266
|
style: {
|
|
1141
|
-
backgroundColor:
|
|
1267
|
+
backgroundColor: tooltipBackgroundColor ? tooltipBackgroundColor : configStyles.TOOLTIP.tooltipBackgroundColor,
|
|
1142
1268
|
left: type === 'top' || type === 'bottom' ? 'calc(50% - 5px)' : type === 'right' ? '-15px' : type === 'left' ? 'calc(100% + 5px)' : '0px',
|
|
1143
1269
|
top: type === 'top' ? 'calc(100% + 5px)' : type === 'bottom' ? '-15px' : type === 'right' || type === 'left' ? 'calc(50% - 5px)' : '0px'
|
|
1144
1270
|
}
|
|
@@ -1146,7 +1272,6 @@ const Tooltip = ({
|
|
|
1146
1272
|
style: {
|
|
1147
1273
|
color: color ? color : configStyles.TOOLTIP.color,
|
|
1148
1274
|
fontSize: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
1149
|
-
lineHeight: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
1150
1275
|
fontFamily: fontFamily ? fontFamily : configStyles.TOOLTIP.fontFamily
|
|
1151
1276
|
}
|
|
1152
1277
|
}, text))) : '', /*#__PURE__*/React__default["default"].createElement("div", {
|
|
@@ -1154,22 +1279,28 @@ const Tooltip = ({
|
|
|
1154
1279
|
cursor: 'pointer'
|
|
1155
1280
|
},
|
|
1156
1281
|
onClick: handleShow
|
|
1157
|
-
}
|
|
1282
|
+
}, tooltipIcon ? tooltipIcon : /*#__PURE__*/React__default["default"].createElement("img", {
|
|
1283
|
+
src: ReactInfoIcon
|
|
1284
|
+
})));
|
|
1158
1285
|
};
|
|
1159
1286
|
Tooltip.propTypes = {
|
|
1287
|
+
type: PropTypes__default["default"].string,
|
|
1160
1288
|
width: PropTypes__default["default"].string,
|
|
1161
1289
|
color: PropTypes__default["default"].string,
|
|
1162
|
-
tIcon: PropTypes__default["default"].element,
|
|
1163
1290
|
height: PropTypes__default["default"].string,
|
|
1164
|
-
|
|
1165
|
-
tBgColor: PropTypes__default["default"].string,
|
|
1291
|
+
radius: PropTypes__default["default"].string,
|
|
1166
1292
|
fontSize: PropTypes__default["default"].string,
|
|
1167
1293
|
className: PropTypes__default["default"].string,
|
|
1168
1294
|
fontFamily: PropTypes__default["default"].string,
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
text: PropTypes__default["default"].string.isRequired
|
|
1295
|
+
tooltipWidth: PropTypes__default["default"].string,
|
|
1296
|
+
tooltipIcon: PropTypes__default["default"].element,
|
|
1297
|
+
tooltipRadius: PropTypes__default["default"].string,
|
|
1298
|
+
text: PropTypes__default["default"].string.isRequired,
|
|
1299
|
+
backgroundColor: PropTypes__default["default"].string,
|
|
1300
|
+
tooltipBackgroundColor: PropTypes__default["default"].string
|
|
1301
|
+
};
|
|
1302
|
+
Tooltip.defaultProps = {
|
|
1303
|
+
type: 'top'
|
|
1173
1304
|
};
|
|
1174
1305
|
|
|
1175
1306
|
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 +1570,22 @@ var styles = {"autocomplate-content":"autocomplate-module_autocomplate-content__
|
|
|
1439
1570
|
styleInject(css_248z);
|
|
1440
1571
|
|
|
1441
1572
|
const Autocomplate = ({
|
|
1442
|
-
className,
|
|
1443
1573
|
label,
|
|
1574
|
+
value,
|
|
1444
1575
|
required,
|
|
1445
1576
|
disabled,
|
|
1446
|
-
|
|
1447
|
-
jsonSelectedOptionsData,
|
|
1577
|
+
keyNames,
|
|
1448
1578
|
onChange,
|
|
1449
|
-
|
|
1579
|
+
className,
|
|
1450
1580
|
searchCount,
|
|
1451
1581
|
placeHolder,
|
|
1452
|
-
keyNames,
|
|
1453
1582
|
errorMesage,
|
|
1583
|
+
autoComplete,
|
|
1584
|
+
jsonOptionsData,
|
|
1585
|
+
jsonSelectedOptionsData,
|
|
1454
1586
|
...props
|
|
1455
1587
|
}) => {
|
|
1588
|
+
const configStyles = compereConfigs();
|
|
1456
1589
|
classnames__default["default"](styles.searchBox, className);
|
|
1457
1590
|
const parseSelectedOptionsData = jsonSelectedOptionsData ? JSON.parse(jsonSelectedOptionsData) : {
|
|
1458
1591
|
name: '',
|
|
@@ -1463,10 +1596,6 @@ const Autocomplate = ({
|
|
|
1463
1596
|
const [activeOption, setActiveOption] = React.useState(0);
|
|
1464
1597
|
const [showOptions, setShowOptions] = React.useState(false);
|
|
1465
1598
|
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
1599
|
const handleChange = e => {
|
|
1471
1600
|
const currentInputValue = e.currentTarget.value;
|
|
1472
1601
|
setInputId(null);
|
|
@@ -1522,6 +1651,10 @@ const Autocomplate = ({
|
|
|
1522
1651
|
}, inputValue.length < searchCount ? `Լրացնել առնվազն ${searchCount} նիշ` : 'Նման տվյալ առկա չէ'))));
|
|
1523
1652
|
}
|
|
1524
1653
|
}
|
|
1654
|
+
React.useEffect(() => {
|
|
1655
|
+
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name]);
|
|
1656
|
+
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id]);
|
|
1657
|
+
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]]);
|
|
1525
1658
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
1526
1659
|
className: `${styles['autocomplate-title']} autocomplate-title-rem`
|
|
1527
1660
|
}, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
|
|
@@ -1533,6 +1666,7 @@ const Autocomplate = ({
|
|
|
1533
1666
|
}, /*#__PURE__*/React__default["default"].createElement("input", _extends({
|
|
1534
1667
|
id: inputId,
|
|
1535
1668
|
type: "text",
|
|
1669
|
+
autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
|
|
1536
1670
|
className: `${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMesage ? styles.errorBorder : ''}`,
|
|
1537
1671
|
disabled: disabled,
|
|
1538
1672
|
onChange: handleChange,
|
|
@@ -1546,18 +1680,19 @@ const Autocomplate = ({
|
|
|
1546
1680
|
}, errorMesage) : null, optionList));
|
|
1547
1681
|
};
|
|
1548
1682
|
Autocomplate.propTypes = {
|
|
1549
|
-
className: PropTypes__default["default"].string,
|
|
1550
1683
|
label: PropTypes__default["default"].string,
|
|
1551
|
-
placeHolder: PropTypes__default["default"].string,
|
|
1552
|
-
required: PropTypes__default["default"].bool,
|
|
1553
1684
|
disabled: PropTypes__default["default"].bool,
|
|
1554
|
-
|
|
1555
|
-
jsonSelectedOptionsData: PropTypes__default["default"].string,
|
|
1685
|
+
required: PropTypes__default["default"].bool,
|
|
1556
1686
|
onChange: PropTypes__default["default"].func,
|
|
1557
1687
|
value: PropTypes__default["default"].string,
|
|
1558
|
-
searchCount: PropTypes__default["default"].number,
|
|
1559
1688
|
keyNames: PropTypes__default["default"].object,
|
|
1560
|
-
|
|
1689
|
+
className: PropTypes__default["default"].string,
|
|
1690
|
+
searchCount: PropTypes__default["default"].number,
|
|
1691
|
+
errorMesage: PropTypes__default["default"].string,
|
|
1692
|
+
placeHolder: PropTypes__default["default"].string,
|
|
1693
|
+
autoComplete: PropTypes__default["default"].string,
|
|
1694
|
+
jsonOptionsData: PropTypes__default["default"].string,
|
|
1695
|
+
jsonSelectedOptionsData: PropTypes__default["default"].string
|
|
1561
1696
|
};
|
|
1562
1697
|
Autocomplate.defaultProps = {
|
|
1563
1698
|
required: false
|
|
@@ -1574,8 +1709,6 @@ exports.Modal = Modal;
|
|
|
1574
1709
|
exports.Pagination = Pagination;
|
|
1575
1710
|
exports.Radio = Radio;
|
|
1576
1711
|
exports.Select = Select;
|
|
1577
|
-
exports.SelectSize = SelectSize;
|
|
1578
|
-
exports.SelectTheme = SelectTheme;
|
|
1579
1712
|
exports.Stepper = Stepper;
|
|
1580
1713
|
exports.Table = Table;
|
|
1581
1714
|
exports.Tooltip = Tooltip;
|