@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.es.js
CHANGED
|
@@ -97,6 +97,12 @@ const File = ({
|
|
|
97
97
|
setFileName('no selected file');
|
|
98
98
|
document.querySelector(`.${name}`).value = "";
|
|
99
99
|
};
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
return () => {
|
|
102
|
+
setError('');
|
|
103
|
+
setImage(null);
|
|
104
|
+
};
|
|
105
|
+
}, []);
|
|
100
106
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
|
|
101
107
|
className: `${styles$b['file-form-title']} ile-form-title-rem`
|
|
102
108
|
}, label, " ", required && /*#__PURE__*/React.createElement("sup", {
|
|
@@ -362,11 +368,7 @@ const _ = require('lodash');
|
|
|
362
368
|
const compereConfigs = () => {
|
|
363
369
|
let projectConfig = {};
|
|
364
370
|
let packageConfig = {};
|
|
365
|
-
|
|
366
|
-
packageConfig = require('../tui.config.js');
|
|
367
|
-
} catch (error) {
|
|
368
|
-
// console.log(error, 'Package: tui.config.js file is not define');
|
|
369
|
-
}
|
|
371
|
+
packageConfig = require(process.env.STORYBOOK_PATH);
|
|
370
372
|
try {
|
|
371
373
|
projectConfig = require('../../../../tui.config.js');
|
|
372
374
|
} catch (error) {
|
|
@@ -397,7 +399,6 @@ const Typography = ({
|
|
|
397
399
|
margin,
|
|
398
400
|
padding,
|
|
399
401
|
variant,
|
|
400
|
-
bgColor,
|
|
401
402
|
onClick,
|
|
402
403
|
children,
|
|
403
404
|
textAlign,
|
|
@@ -409,45 +410,18 @@ const Typography = ({
|
|
|
409
410
|
fontFamily,
|
|
410
411
|
textTransform,
|
|
411
412
|
textDecoration,
|
|
413
|
+
backgroundColor,
|
|
412
414
|
...props
|
|
413
415
|
}) => {
|
|
414
416
|
const configStyles = compereConfigs();
|
|
415
417
|
const classProps = classnames(className);
|
|
416
418
|
const [isHover, setIsHover] = useState(false);
|
|
417
419
|
const [validVariant, setValidVariant] = useState(false);
|
|
418
|
-
const [style, setStyle] = useState({
|
|
419
|
-
border: border ? border : configStyles.TYPOGRAPHY.border,
|
|
420
|
-
cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
|
|
421
|
-
borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
|
|
422
|
-
fontSize: size ? size : configStyles.TYPOGRAPHY['size' + variant],
|
|
423
|
-
margin: margin ? margin : configStyles.TYPOGRAPHY['margin' + variant],
|
|
424
|
-
fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight' + variant],
|
|
425
|
-
padding: padding ? padding : configStyles.TYPOGRAPHY['padding' + variant],
|
|
426
|
-
textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
|
|
427
|
-
textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign' + variant],
|
|
428
|
-
backgroundColor: bgColor ? bgColor : configStyles.TYPOGRAPHY['bgColor' + variant],
|
|
429
|
-
fontStyle: fontStyle ? fontStyle : configStyles.TYPOGRAPHY['fontStyle' + variant],
|
|
430
|
-
lineHeight: lineHeight ? lineHeight : configStyles.TYPOGRAPHY['lineHeight' + variant],
|
|
431
|
-
fontFamily: fontFamily ? fontFamily : configStyles.TYPOGRAPHY['fontFamily' + variant],
|
|
432
|
-
textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
|
|
433
|
-
textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
|
|
434
|
-
color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
|
|
435
|
-
});
|
|
436
420
|
useEffect(() => {
|
|
437
421
|
if (!Object.values(TypographyType).includes(variant)) {
|
|
438
422
|
setValidVariant(true);
|
|
439
423
|
}
|
|
440
424
|
}, [variant]);
|
|
441
|
-
useEffect(() => {
|
|
442
|
-
if (color) {
|
|
443
|
-
setStyle(prev => {
|
|
444
|
-
return {
|
|
445
|
-
...prev,
|
|
446
|
-
color: color
|
|
447
|
-
};
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
}, [color]);
|
|
451
425
|
const handleMouseEnter = () => {
|
|
452
426
|
setIsHover(true);
|
|
453
427
|
};
|
|
@@ -455,7 +429,24 @@ const Typography = ({
|
|
|
455
429
|
setIsHover(false);
|
|
456
430
|
};
|
|
457
431
|
const tagT = /*#__PURE__*/React.createElement(variant, {
|
|
458
|
-
style
|
|
432
|
+
style: {
|
|
433
|
+
border: border ? border : configStyles.TYPOGRAPHY.border,
|
|
434
|
+
cursor: cursor ? cursor : configStyles.TYPOGRAPHY.cursor,
|
|
435
|
+
borderRadius: radius ? radius : configStyles.TYPOGRAPHY.radius,
|
|
436
|
+
fontSize: size ? size : configStyles.TYPOGRAPHY['size' + variant],
|
|
437
|
+
margin: margin ? margin : configStyles.TYPOGRAPHY['margin' + variant],
|
|
438
|
+
fontWeight: weight ? weight : configStyles.TYPOGRAPHY['weight' + variant],
|
|
439
|
+
padding: padding ? padding : configStyles.TYPOGRAPHY['padding' + variant],
|
|
440
|
+
textShadow: textShadow ? textShadow : configStyles.TYPOGRAPHY.textShadow,
|
|
441
|
+
textAlign: textAlign ? textAlign : configStyles.TYPOGRAPHY['textAlign' + 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
|
+
backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor' + variant],
|
|
448
|
+
color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
|
|
449
|
+
},
|
|
459
450
|
...props,
|
|
460
451
|
className: classProps,
|
|
461
452
|
onClick: onClick ? onClick : _ => _,
|
|
@@ -473,7 +464,6 @@ Typography.propTypes = {
|
|
|
473
464
|
cursor: PropTypes.string,
|
|
474
465
|
margin: PropTypes.string,
|
|
475
466
|
radius: PropTypes.string,
|
|
476
|
-
bgColor: PropTypes.string,
|
|
477
467
|
padding: PropTypes.string,
|
|
478
468
|
textAlign: PropTypes.string,
|
|
479
469
|
className: PropTypes.string,
|
|
@@ -484,7 +474,11 @@ Typography.propTypes = {
|
|
|
484
474
|
colorHover: PropTypes.string,
|
|
485
475
|
textTransform: PropTypes.string,
|
|
486
476
|
textDecoration: PropTypes.string,
|
|
487
|
-
|
|
477
|
+
backgroundColor: PropTypes.string,
|
|
478
|
+
variant: PropTypes.oneOf(Object.values(TypographyType))
|
|
479
|
+
};
|
|
480
|
+
Typography.defaultProps = {
|
|
481
|
+
variant: 'p'
|
|
488
482
|
};
|
|
489
483
|
|
|
490
484
|
const Modal = ({
|
|
@@ -613,19 +607,9 @@ const Input = ({
|
|
|
613
607
|
}) => {
|
|
614
608
|
const [show, setShow] = useState(false);
|
|
615
609
|
const [isHover, setIsHover] = useState(false);
|
|
616
|
-
const [tooltipStatus, setTooltipStatus] = useState(false);
|
|
617
610
|
const random = Math.floor(Math.random() * 1000 + 1);
|
|
618
611
|
const configStyles = compereConfigs();
|
|
619
612
|
const classProps = classnames(className ? className : configStyles.INPUT.className);
|
|
620
|
-
const handleChange = event => {
|
|
621
|
-
onChange ? onChange(event.target.value) : _ => _;
|
|
622
|
-
};
|
|
623
|
-
const handleMouseEnter = () => {
|
|
624
|
-
setIsHover(true);
|
|
625
|
-
};
|
|
626
|
-
const handleMouseLeave = () => {
|
|
627
|
-
setIsHover(false);
|
|
628
|
-
};
|
|
629
613
|
const errorShow = keyframes`
|
|
630
614
|
100% {
|
|
631
615
|
bottom: '-20px';
|
|
@@ -642,6 +626,15 @@ const Input = ({
|
|
|
642
626
|
const P = styled.p`
|
|
643
627
|
animation: ${errorAnimation ? animation : 'none'};
|
|
644
628
|
`;
|
|
629
|
+
const handleChange = event => {
|
|
630
|
+
onChange ? onChange(event.target.value) : _ => _;
|
|
631
|
+
};
|
|
632
|
+
const handleMouseEnter = () => {
|
|
633
|
+
setIsHover(true);
|
|
634
|
+
};
|
|
635
|
+
const handleMouseLeave = () => {
|
|
636
|
+
setIsHover(false);
|
|
637
|
+
};
|
|
645
638
|
return /*#__PURE__*/React.createElement("div", {
|
|
646
639
|
className: `${styles$7["input-wrap"]}`
|
|
647
640
|
}, label ? /*#__PURE__*/React.createElement("label", {
|
|
@@ -661,6 +654,7 @@ const Input = ({
|
|
|
661
654
|
}, "*")) : '', /*#__PURE__*/React.createElement("div", {
|
|
662
655
|
className: `${styles$7["input-content"]}`,
|
|
663
656
|
style: {
|
|
657
|
+
width: width ? width : configStyles.INPUT.width,
|
|
664
658
|
borderRadius: radius ? radius : configStyles.INPUT.radius,
|
|
665
659
|
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
|
|
666
660
|
},
|
|
@@ -728,10 +722,7 @@ const Input = ({
|
|
|
728
722
|
borderBottomRightRadius: radius ? radius : configStyles.INPUT.radius,
|
|
729
723
|
backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
|
|
730
724
|
}
|
|
731
|
-
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? /*#__PURE__*/React.createElement(
|
|
732
|
-
variant: "p",
|
|
733
|
-
onClick: () => setTooltipStatus(!tooltipStatus)
|
|
734
|
-
}, "\u24D8") : null, tooltipStatus ? /*#__PURE__*/React.createElement("p", null, tooltip) : null, errorMessage ? /*#__PURE__*/React.createElement(P, {
|
|
725
|
+
}, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', errorMessage ? /*#__PURE__*/React.createElement(P, {
|
|
735
726
|
style: {
|
|
736
727
|
left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
|
|
737
728
|
color: errorColor ? errorColor : configStyles.INPUT.errorColor,
|
|
@@ -861,7 +852,6 @@ const Button = ({
|
|
|
861
852
|
radius,
|
|
862
853
|
outline,
|
|
863
854
|
padding,
|
|
864
|
-
bgColor,
|
|
865
855
|
onClick,
|
|
866
856
|
disabled,
|
|
867
857
|
className,
|
|
@@ -870,8 +860,9 @@ const Button = ({
|
|
|
870
860
|
contentWidth,
|
|
871
861
|
disabledColor,
|
|
872
862
|
textTransform,
|
|
873
|
-
|
|
863
|
+
backgroundColor,
|
|
874
864
|
disabledLineColor,
|
|
865
|
+
disabledBackgroundColor,
|
|
875
866
|
...props
|
|
876
867
|
}) => {
|
|
877
868
|
const [isHover, setIsHover] = useState(false);
|
|
@@ -902,9 +893,9 @@ const Button = ({
|
|
|
902
893
|
width: contentWidth ? 'auto' : width ? width : configStyles.BUTTON.width,
|
|
903
894
|
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.BUTTON.cursor,
|
|
904
895
|
textTransform: textTransform ? textTransform : configStyles.BUTTON.textTransform,
|
|
905
|
-
backgroundColor: (outline || !outline) && disabled ?
|
|
906
|
-
boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` : `inset 0 0 0 2px ${
|
|
907
|
-
color: (outline || !outline) && disabled ? disabledColor ? disabledColor : configStyles.BUTTON.disabledColor : outline && !disabled ? isHover ? color ? color : configStyles.BUTTON.color :
|
|
896
|
+
backgroundColor: (outline || !outline) && disabled ? disabledBackgroundColor ? disabledBackgroundColor : configStyles.BUTTON.disabledBackgroundColor : outline && !disabled ? isHover ? backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor : '#ffffff' : backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor,
|
|
897
|
+
boxShadow: outline ? disabled ? `inset 0 0 0 2px ${disabledLineColor ? disabledLineColor : configStyles.BUTTON.disabledLineColor}` : `inset 0 0 0 2px ${backgroundColor ? backgroundColor : configStyles.BUTTON.backgroundColor}` : 'none',
|
|
898
|
+
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
|
|
908
899
|
},
|
|
909
900
|
type: type ? type : configStyles.BUTTON.type,
|
|
910
901
|
disabled: disabled ? disabled : configStyles.BUTTON.disabled,
|
|
@@ -929,54 +920,111 @@ Button.propTypes = {
|
|
|
929
920
|
disabled: PropTypes.bool,
|
|
930
921
|
radius: PropTypes.string,
|
|
931
922
|
padding: PropTypes.string,
|
|
932
|
-
bgColor: PropTypes.string,
|
|
933
923
|
boxSizing: PropTypes.string,
|
|
934
924
|
className: PropTypes.string,
|
|
935
925
|
transition: PropTypes.string,
|
|
936
926
|
contentWidth: PropTypes.bool,
|
|
937
927
|
textTransform: PropTypes.string,
|
|
938
928
|
disabledColor: PropTypes.string,
|
|
939
|
-
|
|
929
|
+
backgroundColor: PropTypes.string,
|
|
940
930
|
label: PropTypes.string.isRequired,
|
|
941
|
-
disabledLineColor: PropTypes.string
|
|
931
|
+
disabledLineColor: PropTypes.string,
|
|
932
|
+
disabledBackgroundColor: PropTypes.string
|
|
942
933
|
};
|
|
943
934
|
|
|
944
|
-
var
|
|
945
|
-
|
|
935
|
+
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>";
|
|
936
|
+
|
|
937
|
+
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>";
|
|
938
|
+
|
|
939
|
+
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}}";
|
|
940
|
+
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"};
|
|
946
941
|
styleInject(css_248z$5);
|
|
947
942
|
|
|
948
|
-
const SelectTheme = {
|
|
949
|
-
DEFAULT: 'select-default',
|
|
950
|
-
PRIMARY: 'select-primary',
|
|
951
|
-
SUCCESS: 'select-success',
|
|
952
|
-
INFO: 'select-info',
|
|
953
|
-
WARNING: 'select-warning',
|
|
954
|
-
DANGER: 'select-danger',
|
|
955
|
-
LINK: 'select-link'
|
|
956
|
-
};
|
|
957
|
-
const SelectSize = {
|
|
958
|
-
SMALL: 'small',
|
|
959
|
-
MEDIUM: 'medium',
|
|
960
|
-
LARGE: 'large'
|
|
961
|
-
};
|
|
962
943
|
const Select = ({
|
|
963
|
-
theme,
|
|
964
|
-
size,
|
|
965
|
-
className,
|
|
966
944
|
disabled,
|
|
967
|
-
label,
|
|
968
945
|
jsonData,
|
|
969
|
-
eMessage,
|
|
970
946
|
required,
|
|
971
|
-
defaultOption,
|
|
972
947
|
onChange,
|
|
973
948
|
keyNames,
|
|
974
|
-
selected
|
|
949
|
+
selected,
|
|
950
|
+
className,
|
|
951
|
+
arrowIcon,
|
|
952
|
+
closeIcon,
|
|
953
|
+
errorMessage,
|
|
954
|
+
defaultOption,
|
|
955
|
+
label,
|
|
956
|
+
labelColor,
|
|
957
|
+
labelWeight,
|
|
958
|
+
labelDisplay,
|
|
959
|
+
labelFontSize,
|
|
960
|
+
labelLineHeight,
|
|
961
|
+
labelMarginBottom,
|
|
962
|
+
labelTextTransform,
|
|
963
|
+
cursor,
|
|
964
|
+
errorSize,
|
|
965
|
+
errorColor,
|
|
966
|
+
selectedColor,
|
|
967
|
+
selectedRadius,
|
|
968
|
+
selectedHeight,
|
|
969
|
+
selectedBorder,
|
|
970
|
+
selectedPadding,
|
|
971
|
+
selectedFontSize,
|
|
972
|
+
selectedBoxSizing,
|
|
973
|
+
selectedFontWeight,
|
|
974
|
+
selectedLineHeight,
|
|
975
|
+
selectedHoverColor,
|
|
976
|
+
selectedTransition,
|
|
977
|
+
selectedBorderColor,
|
|
978
|
+
optionsBoxShadow,
|
|
979
|
+
optionsBorderRadius,
|
|
980
|
+
optionsBackgroundColor,
|
|
981
|
+
optionItemColor,
|
|
982
|
+
optionItemCursor,
|
|
983
|
+
optionItemPadding,
|
|
984
|
+
optionItemFontSize,
|
|
985
|
+
optionItemMinHeight,
|
|
986
|
+
optionItemBoxSizing,
|
|
987
|
+
optionItemFontWeight,
|
|
988
|
+
optionItemLineHeight,
|
|
989
|
+
optionItemColorHover,
|
|
990
|
+
optionItemMarginBottom,
|
|
991
|
+
optionItemBackgroudColor,
|
|
992
|
+
optionItemBackgroudColorHover
|
|
975
993
|
}) => {
|
|
976
994
|
const options = jsonData.length ? JSON.parse(jsonData) : [];
|
|
977
995
|
const ref = useRef();
|
|
978
|
-
|
|
979
|
-
|
|
996
|
+
const [opened, setOpened] = useState(false);
|
|
997
|
+
const [isHover, setIsHover] = useState(false);
|
|
998
|
+
const [newSelected, setNewSelected] = useState({});
|
|
999
|
+
const configStyles = compereConfigs();
|
|
1000
|
+
const classProps = classnames(className);
|
|
1001
|
+
const handleOpenClose = () => {
|
|
1002
|
+
setOpened(!opened);
|
|
1003
|
+
};
|
|
1004
|
+
const handleClearSelect = e => {
|
|
1005
|
+
onChange({});
|
|
1006
|
+
setNewSelected({});
|
|
1007
|
+
e.stopPropagation();
|
|
1008
|
+
};
|
|
1009
|
+
const handleSelectItem = option => {
|
|
1010
|
+
onChange(option);
|
|
1011
|
+
setOpened(!opened);
|
|
1012
|
+
setNewSelected(option);
|
|
1013
|
+
};
|
|
1014
|
+
const handleMouseEnter = () => {
|
|
1015
|
+
setIsHover(true);
|
|
1016
|
+
};
|
|
1017
|
+
const handleMouseLeave = () => {
|
|
1018
|
+
setIsHover(false);
|
|
1019
|
+
};
|
|
1020
|
+
const handleMouseEnterOption = e => {
|
|
1021
|
+
e.target.style.color = optionItemColorHover ? optionItemColorHover : configStyles.SELECT.optionItemColorHover;
|
|
1022
|
+
e.target.style.backgroundColor = optionItemBackgroudColorHover ? optionItemBackgroudColorHover : configStyles.SELECT.optionItemBackgroudColorHover;
|
|
1023
|
+
};
|
|
1024
|
+
const handleMouseLeaveOption = e => {
|
|
1025
|
+
e.target.style.color = optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor;
|
|
1026
|
+
e.target.style.backgroundColor = optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor;
|
|
1027
|
+
};
|
|
980
1028
|
useEffect(() => {
|
|
981
1029
|
const parseSelectedData = selected.length !== 0 ? JSON.parse(selected) : {};
|
|
982
1030
|
setNewSelected(parseSelectedData);
|
|
@@ -994,80 +1042,159 @@ const Select = ({
|
|
|
994
1042
|
};
|
|
995
1043
|
}
|
|
996
1044
|
}, [opened]);
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1045
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1046
|
+
className: classProps
|
|
1047
|
+
}, label ? /*#__PURE__*/React.createElement("label", {
|
|
1048
|
+
style: {
|
|
1049
|
+
color: labelColor ? labelColor : configStyles.SELECT.labelColor,
|
|
1050
|
+
fontWeight: labelWeight ? labelWeight : configStyles.SELECT.labelWeight,
|
|
1051
|
+
display: labelDisplay ? labelDisplay : configStyles.SELECT.labelDisplay,
|
|
1052
|
+
fontSize: labelFontSize ? labelFontSize : configStyles.SELECT.labelFontSize,
|
|
1053
|
+
lineHeight: labelLineHeight ? labelLineHeight : configStyles.SELECT.labelLineHeight,
|
|
1054
|
+
marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.SELECT.labelMarginBottom,
|
|
1055
|
+
textTransform: labelTextTransform ? labelTextTransform : configStyles.SELECT.labelTextTransform
|
|
1056
|
+
}
|
|
1057
|
+
}, label, required && /*#__PURE__*/React.createElement("sup", {
|
|
1004
1058
|
style: {
|
|
1005
1059
|
color: "#ee0000"
|
|
1006
1060
|
}
|
|
1007
1061
|
}, "*")) : "", /*#__PURE__*/React.createElement("div", {
|
|
1008
|
-
className: `${styles$5['select-wrap']} select-wrap-rem`,
|
|
1009
1062
|
ref: ref
|
|
1010
1063
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1011
|
-
className: styles$5['select-content']
|
|
1012
|
-
id: styles$5.selector
|
|
1064
|
+
className: styles$5['select-content']
|
|
1013
1065
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1066
|
+
style: {
|
|
1067
|
+
cursor: disabled ? 'not-allowed' : cursor ? cursor : configStyles.SELECT.cursor,
|
|
1068
|
+
height: selectedHeight ? selectedHeight : configStyles.SELECT.selectedHeight,
|
|
1069
|
+
border: selectedBorder ? selectedBorder : configStyles.SELECT.selectedBorder,
|
|
1070
|
+
padding: selectedPadding ? selectedPadding : configStyles.SELECT.selectedPadding,
|
|
1071
|
+
borderRadius: selectedRadius ? selectedRadius : configStyles.SELECT.selectedRadius,
|
|
1072
|
+
fontSize: selectedFontSize ? selectedFontSize : configStyles.SELECT.selectedFontSize,
|
|
1073
|
+
boxSizing: selectedBoxSizing ? selectedBoxSizing : configStyles.SELECT.selectedBoxSizing,
|
|
1074
|
+
fontWeight: selectedFontWeight ? selectedFontWeight : configStyles.SELECT.selectedFontWeight,
|
|
1075
|
+
lineHeight: selectedLineHeight ? selectedLineHeight : configStyles.SELECT.selectedLineHeight,
|
|
1076
|
+
transition: selectedTransition ? selectedTransition : configStyles.SELECT.selectedTransition,
|
|
1077
|
+
borderColor: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : selectedBorderColor ? selectedBorderColor : configStyles.SELECT.selectedBorderColor
|
|
1078
|
+
},
|
|
1079
|
+
onClick: disabled ? _ => _ : _ => handleOpenClose(),
|
|
1080
|
+
onMouseEnter: disabled ? _ => _ : handleMouseEnter,
|
|
1081
|
+
onMouseLeave: disabled ? _ => _ : handleMouseLeave,
|
|
1082
|
+
className: `${styles$5['select-content-top']}`
|
|
1018
1083
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1019
|
-
className: `${styles$5['select-content-top-text']}
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
}, Object.keys(newSelected).length > 0 && /*#__PURE__*/React.createElement("i", {
|
|
1023
|
-
className: "icon-close",
|
|
1024
|
-
onClick: e => {
|
|
1025
|
-
setNewSelected({});
|
|
1026
|
-
onChange({});
|
|
1027
|
-
e.stopPropagation();
|
|
1084
|
+
className: `${styles$5['select-content-top-text']}`,
|
|
1085
|
+
style: {
|
|
1086
|
+
color: errorMessage ? errorColor ? errorColor : configStyles.SELECT.errorColor : isHover ? selectedHoverColor ? selectedHoverColor : configStyles.SELECT.selectedHoverColor : selectedColor ? selectedColor : configStyles.SELECT.selectedColor
|
|
1028
1087
|
}
|
|
1029
|
-
}), /*#__PURE__*/React.createElement("
|
|
1030
|
-
className:
|
|
1031
|
-
}
|
|
1032
|
-
className: `${styles$5['
|
|
1088
|
+
}, newSelected && newSelected[keyNames.name] ? newSelected[keyNames.name] : defaultOption), /*#__PURE__*/React.createElement("div", {
|
|
1089
|
+
className: `${styles$5['select-content-top-icon']}`
|
|
1090
|
+
}, Object.keys(newSelected).length > 0 && /*#__PURE__*/React.createElement("div", {
|
|
1091
|
+
className: `${styles$5['close-icon']}`,
|
|
1092
|
+
onClick: disabled ? _ => _ : handleClearSelect
|
|
1093
|
+
}, closeIcon ? closeIcon : /*#__PURE__*/React.createElement("img", {
|
|
1094
|
+
src: ReactCloseIcon,
|
|
1095
|
+
alt: "icon"
|
|
1096
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
1097
|
+
style: {
|
|
1098
|
+
transform: opened ? 'rotate(180deg)' : 'rotate(0deg)'
|
|
1099
|
+
},
|
|
1100
|
+
className: `${styles$5['arrow-icon']}`
|
|
1101
|
+
}, arrowIcon ? arrowIcon : /*#__PURE__*/React.createElement("img", {
|
|
1102
|
+
src: ReactArrowIcon,
|
|
1103
|
+
alt: "icon"
|
|
1104
|
+
})))), opened && !disabled ? /*#__PURE__*/React.createElement("div", {
|
|
1105
|
+
style: {
|
|
1106
|
+
boxShadow: optionsBoxShadow ? optionsBoxShadow : configStyles.SELECT.optionsBoxShadow,
|
|
1107
|
+
borderRadius: optionsBorderRadius ? optionsBorderRadius : configStyles.SELECT.optionsBorderRadius,
|
|
1108
|
+
backgroundColor: optionsBackgroundColor ? optionsBackgroundColor : configStyles.SELECT.optionsBackgroundColor,
|
|
1109
|
+
top: parseFloat(selectedHeight ? selectedHeight.substring(0, selectedHeight.length - 2) : configStyles.SELECT.selectedHeight.substring(0, configStyles.SELECT.selectedHeight.length - 2)) + 6 + 'px'
|
|
1110
|
+
},
|
|
1111
|
+
className: `${styles$5['select-content-bottom']}`
|
|
1033
1112
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1034
|
-
className: `${styles$5['select-content-bottom-inner']}
|
|
1113
|
+
className: `${styles$5['select-content-bottom-inner']}`
|
|
1035
1114
|
}, options.map((option, i) => {
|
|
1036
1115
|
return /*#__PURE__*/React.createElement("div", {
|
|
1037
1116
|
key: i,
|
|
1038
|
-
className: `${styles$5['select-content-bottom-row']} select-content-bottom-row-rem`,
|
|
1039
1117
|
disabled: true,
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1118
|
+
defaultValue: option[keyNames.id],
|
|
1119
|
+
onClick: disabled ? _ => _ : _ => handleSelectItem(option),
|
|
1120
|
+
onMouseEnter: disabled ? _ => _ : e => handleMouseEnterOption(e),
|
|
1121
|
+
onMouseLeave: disabled ? _ => _ : e => handleMouseLeaveOption(e),
|
|
1122
|
+
className: `${styles$5['select-content-bottom-row']}`,
|
|
1123
|
+
style: {
|
|
1124
|
+
color: optionItemColor ? optionItemColor : configStyles.SELECT.optionItemColor,
|
|
1125
|
+
cursor: optionItemCursor ? optionItemCursor : configStyles.SELECT.optionItemCursor,
|
|
1126
|
+
padding: optionItemPadding ? optionItemPadding : configStyles.SELECT.optionItemPadding,
|
|
1127
|
+
fontSize: optionItemFontSize ? optionItemFontSize : configStyles.SELECT.optionItemFontSize,
|
|
1128
|
+
boxSizing: optionItemBoxSizing ? optionItemBoxSizing : configStyles.SELECT.optionItemBoxSizing,
|
|
1129
|
+
minHeight: optionItemMinHeight ? optionItemMinHeight : configStyles.SELECT.optionItemMinHeight,
|
|
1130
|
+
fontWeight: optionItemFontWeight ? optionItemFontWeight : configStyles.SELECT.optionItemFontWeight,
|
|
1131
|
+
lineHeight: optionItemLineHeight ? optionItemLineHeight : configStyles.SELECT.optionItemLineHeight,
|
|
1132
|
+
marginBottom: optionItemMarginBottom ? optionItemMarginBottom : configStyles.SELECT.optionItemMarginBottom,
|
|
1133
|
+
backgroundColor: optionItemBackgroudColor ? optionItemBackgroudColor : configStyles.SELECT.optionItemBackgroudColor
|
|
1134
|
+
}
|
|
1046
1135
|
}, option[keyNames.name]);
|
|
1047
|
-
}))) : null)),
|
|
1048
|
-
|
|
1049
|
-
|
|
1136
|
+
}))) : null)), errorMessage ? /*#__PURE__*/React.createElement("span", {
|
|
1137
|
+
style: {
|
|
1138
|
+
color: errorColor ? errorColor : configStyles.SELECT.errorColor,
|
|
1139
|
+
fontSize: errorSize ? errorSize : configStyles.SELECT.errorSize
|
|
1140
|
+
}
|
|
1141
|
+
}, errorMessage) : '');
|
|
1050
1142
|
};
|
|
1051
1143
|
Select.propTypes = {
|
|
1052
|
-
theme: PropTypes.oneOf(Object.values(SelectTheme)),
|
|
1053
|
-
size: PropTypes.oneOf(Object.values(SelectSize)),
|
|
1054
|
-
label: PropTypes.string,
|
|
1055
|
-
eMessage: PropTypes.string,
|
|
1056
|
-
defaultOption: PropTypes.string,
|
|
1057
1144
|
onChange: PropTypes.func,
|
|
1058
1145
|
required: PropTypes.bool,
|
|
1059
1146
|
disabled: PropTypes.bool,
|
|
1060
|
-
className: PropTypes.string,
|
|
1061
1147
|
selected: PropTypes.string,
|
|
1062
1148
|
jsonData: PropTypes.string,
|
|
1063
|
-
keyNames: PropTypes.object
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1149
|
+
keyNames: PropTypes.object,
|
|
1150
|
+
className: PropTypes.string,
|
|
1151
|
+
arrowIcon: PropTypes.element,
|
|
1152
|
+
closeIcon: PropTypes.element,
|
|
1153
|
+
errorMessage: PropTypes.string,
|
|
1154
|
+
defaultOption: PropTypes.string,
|
|
1155
|
+
label: PropTypes.string,
|
|
1156
|
+
labelColor: PropTypes.string,
|
|
1157
|
+
labelWeight: PropTypes.string,
|
|
1158
|
+
labelDisplay: PropTypes.string,
|
|
1159
|
+
labelFontSize: PropTypes.string,
|
|
1160
|
+
labelLineHeight: PropTypes.string,
|
|
1161
|
+
labelMarginBottom: PropTypes.string,
|
|
1162
|
+
labelTextTransform: PropTypes.string,
|
|
1163
|
+
cursor: PropTypes.string,
|
|
1164
|
+
errorSize: PropTypes.string,
|
|
1165
|
+
errorColor: PropTypes.string,
|
|
1166
|
+
selectedColor: PropTypes.string,
|
|
1167
|
+
selectedBorder: PropTypes.string,
|
|
1168
|
+
selectedRadius: PropTypes.string,
|
|
1169
|
+
selectedHeight: PropTypes.string,
|
|
1170
|
+
selectedPadding: PropTypes.string,
|
|
1171
|
+
selectedFontSize: PropTypes.string,
|
|
1172
|
+
selectedBoxSizing: PropTypes.string,
|
|
1173
|
+
selectedHoverColor: PropTypes.string,
|
|
1174
|
+
selectedFontWeight: PropTypes.string,
|
|
1175
|
+
selectedLineHeight: PropTypes.string,
|
|
1176
|
+
selectedTransition: PropTypes.string,
|
|
1177
|
+
selectedBorderColor: PropTypes.string,
|
|
1178
|
+
optionsBoxShadow: PropTypes.string,
|
|
1179
|
+
optionsBorderRadius: PropTypes.string,
|
|
1180
|
+
optionsBackgroundColor: PropTypes.string,
|
|
1181
|
+
optionItemColor: PropTypes.string,
|
|
1182
|
+
optionItemCursor: PropTypes.string,
|
|
1183
|
+
optionItemPadding: PropTypes.string,
|
|
1184
|
+
optionItemFontSize: PropTypes.string,
|
|
1185
|
+
optionItemMinHeight: PropTypes.string,
|
|
1186
|
+
optionItemBoxSizing: PropTypes.string,
|
|
1187
|
+
optionItemFontWeight: PropTypes.string,
|
|
1188
|
+
optionItemColorHover: PropTypes.string,
|
|
1189
|
+
optionItemLineHeight: PropTypes.string,
|
|
1190
|
+
optionItemMarginBottom: PropTypes.string,
|
|
1191
|
+
optionItemBackgroudColor: PropTypes.string,
|
|
1192
|
+
optionItemBackgroudColorHover: PropTypes.string
|
|
1068
1193
|
};
|
|
1069
1194
|
|
|
1070
|
-
var
|
|
1195
|
+
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>";
|
|
1196
|
+
|
|
1197
|
+
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}";
|
|
1071
1198
|
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"};
|
|
1072
1199
|
styleInject(css_248z$4);
|
|
1073
1200
|
|
|
@@ -1076,58 +1203,57 @@ const Tooltip = ({
|
|
|
1076
1203
|
text,
|
|
1077
1204
|
width,
|
|
1078
1205
|
color,
|
|
1079
|
-
tIcon,
|
|
1080
1206
|
height,
|
|
1081
|
-
|
|
1207
|
+
radius,
|
|
1082
1208
|
fontSize,
|
|
1083
|
-
tBgColor,
|
|
1084
1209
|
className,
|
|
1085
1210
|
fontFamily,
|
|
1086
|
-
|
|
1087
|
-
|
|
1211
|
+
tooltipIcon,
|
|
1212
|
+
tooltipWidth,
|
|
1213
|
+
tooltipRadius,
|
|
1214
|
+
backgroundColor,
|
|
1215
|
+
tooltipBackgroundColor
|
|
1088
1216
|
}) => {
|
|
1089
1217
|
const tooltipRef = /*#__PURE__*/createRef(null);
|
|
1090
|
-
const [
|
|
1091
|
-
const [
|
|
1218
|
+
const [checkTooltipWidth, setCheckTooltipWidth] = useState(0);
|
|
1219
|
+
const [checkTooltipHeight, setCheckTooltipHeight] = useState(0);
|
|
1092
1220
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
1093
1221
|
const configStyles = compereConfigs();
|
|
1094
1222
|
const classProps = classnames(styles$4['tooltip'], className);
|
|
1095
|
-
useEffect(_ => {
|
|
1096
|
-
if (!type && !text) {
|
|
1097
|
-
alert('Add type and text on tooltip');
|
|
1098
|
-
} else if (!type) {
|
|
1099
|
-
alert('Add type on tooltip');
|
|
1100
|
-
} else if (!text) {
|
|
1101
|
-
alert('Add text on tooltip');
|
|
1102
|
-
}
|
|
1103
|
-
tooltipRef.current && tooltipRef.current.clientWidth && tooltipRef.current.clientWidth > 0 && setTooltipWidth(tooltipRef.current.clientWidth);
|
|
1104
|
-
tooltipRef.current && tooltipRef.current.clientHeight && tooltipRef.current.clientHeight > 0 && setTooltipHeight(tooltipRef.current.clientHeight);
|
|
1105
|
-
}, [type, text, tooltipWidth, tooltipRef]);
|
|
1106
1223
|
const handleShow = () => {
|
|
1107
1224
|
setShowTooltip(!showTooltip);
|
|
1108
1225
|
};
|
|
1226
|
+
useEffect(_ => {
|
|
1227
|
+
if (!text) {
|
|
1228
|
+
alert('Add text on tooltip');
|
|
1229
|
+
}
|
|
1230
|
+
tooltipRef.current && tooltipRef.current.clientWidth && tooltipRef.current.clientWidth > 0 && setCheckTooltipWidth(tooltipRef.current.clientWidth);
|
|
1231
|
+
tooltipRef.current && tooltipRef.current.clientHeight && tooltipRef.current.clientHeight > 0 && setCheckTooltipHeight(tooltipRef.current.clientHeight);
|
|
1232
|
+
}, [text, tooltipRef, checkTooltipWidth, checkTooltipHeight]);
|
|
1109
1233
|
return /*#__PURE__*/React.createElement("div", {
|
|
1110
1234
|
className: `${styles$4['tooltip-block']}`,
|
|
1111
1235
|
style: {
|
|
1112
1236
|
width: width ? width : configStyles.TOOLTIP.width,
|
|
1113
1237
|
height: height ? height : configStyles.TOOLTIP.height,
|
|
1114
|
-
|
|
1238
|
+
borderRadius: radius ? radius : configStyles.TOOLTIP.radius,
|
|
1239
|
+
backgroundColor: backgroundColor ? backgroundColor : configStyles.TOOLTIP.backgroundColor
|
|
1115
1240
|
}
|
|
1116
1241
|
}, showTooltip ? /*#__PURE__*/React.createElement("div", {
|
|
1117
1242
|
ref: tooltipRef,
|
|
1118
1243
|
className: classProps,
|
|
1119
1244
|
style: {
|
|
1120
|
-
|
|
1121
|
-
borderRadius:
|
|
1122
|
-
|
|
1123
|
-
|
|
1245
|
+
width: tooltipWidth ? tooltipWidth : configStyles.TOOLTIP.tooltipWidth,
|
|
1246
|
+
borderRadius: tooltipRadius ? tooltipRadius : configStyles.TOOLTIP.tooltipRadius,
|
|
1247
|
+
backgroundColor: tooltipBackgroundColor ? tooltipBackgroundColor : configStyles.TOOLTIP.tooltipBackgroundColor,
|
|
1248
|
+
top: type === 'top' ? `calc(-${checkTooltipHeight + 7}px)` : type === 'bottom' ? 'calc(100% + 7px)' : type === 'left' || type === 'right' ? `calc(50% - ${checkTooltipHeight / 2}px)` : '0px',
|
|
1249
|
+
left: type === 'top' || type === 'bottom' ? `calc(50% - ${checkTooltipWidth / 2}px)` : type === 'left' ? `-${checkTooltipWidth + 7}px` : type === 'right' ? 'calc(100% + 7px)' : '0px'
|
|
1124
1250
|
}
|
|
1125
1251
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1126
1252
|
className: `${styles$4['tooltip-rel']}`
|
|
1127
1253
|
}, /*#__PURE__*/React.createElement("div", {
|
|
1128
1254
|
className: `${styles$4['tooltip-decor']}`,
|
|
1129
1255
|
style: {
|
|
1130
|
-
backgroundColor:
|
|
1256
|
+
backgroundColor: tooltipBackgroundColor ? tooltipBackgroundColor : configStyles.TOOLTIP.tooltipBackgroundColor,
|
|
1131
1257
|
left: type === 'top' || type === 'bottom' ? 'calc(50% - 5px)' : type === 'right' ? '-15px' : type === 'left' ? 'calc(100% + 5px)' : '0px',
|
|
1132
1258
|
top: type === 'top' ? 'calc(100% + 5px)' : type === 'bottom' ? '-15px' : type === 'right' || type === 'left' ? 'calc(50% - 5px)' : '0px'
|
|
1133
1259
|
}
|
|
@@ -1135,7 +1261,6 @@ const Tooltip = ({
|
|
|
1135
1261
|
style: {
|
|
1136
1262
|
color: color ? color : configStyles.TOOLTIP.color,
|
|
1137
1263
|
fontSize: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
1138
|
-
lineHeight: fontSize ? fontSize : configStyles.TOOLTIP.fontSize,
|
|
1139
1264
|
fontFamily: fontFamily ? fontFamily : configStyles.TOOLTIP.fontFamily
|
|
1140
1265
|
}
|
|
1141
1266
|
}, text))) : '', /*#__PURE__*/React.createElement("div", {
|
|
@@ -1143,22 +1268,28 @@ const Tooltip = ({
|
|
|
1143
1268
|
cursor: 'pointer'
|
|
1144
1269
|
},
|
|
1145
1270
|
onClick: handleShow
|
|
1146
|
-
}
|
|
1271
|
+
}, tooltipIcon ? tooltipIcon : /*#__PURE__*/React.createElement("img", {
|
|
1272
|
+
src: ReactInfoIcon
|
|
1273
|
+
})));
|
|
1147
1274
|
};
|
|
1148
1275
|
Tooltip.propTypes = {
|
|
1276
|
+
type: PropTypes.string,
|
|
1149
1277
|
width: PropTypes.string,
|
|
1150
1278
|
color: PropTypes.string,
|
|
1151
|
-
tIcon: PropTypes.element,
|
|
1152
1279
|
height: PropTypes.string,
|
|
1153
|
-
|
|
1154
|
-
tBgColor: PropTypes.string,
|
|
1280
|
+
radius: PropTypes.string,
|
|
1155
1281
|
fontSize: PropTypes.string,
|
|
1156
1282
|
className: PropTypes.string,
|
|
1157
1283
|
fontFamily: PropTypes.string,
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
text: PropTypes.string.isRequired
|
|
1284
|
+
tooltipWidth: PropTypes.string,
|
|
1285
|
+
tooltipIcon: PropTypes.element,
|
|
1286
|
+
tooltipRadius: PropTypes.string,
|
|
1287
|
+
text: PropTypes.string.isRequired,
|
|
1288
|
+
backgroundColor: PropTypes.string,
|
|
1289
|
+
tooltipBackgroundColor: PropTypes.string
|
|
1290
|
+
};
|
|
1291
|
+
Tooltip.defaultProps = {
|
|
1292
|
+
type: 'top'
|
|
1162
1293
|
};
|
|
1163
1294
|
|
|
1164
1295
|
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}";
|
|
@@ -1428,20 +1559,22 @@ var styles = {"autocomplate-content":"autocomplate-module_autocomplate-content__
|
|
|
1428
1559
|
styleInject(css_248z);
|
|
1429
1560
|
|
|
1430
1561
|
const Autocomplate = ({
|
|
1431
|
-
className,
|
|
1432
1562
|
label,
|
|
1563
|
+
value,
|
|
1433
1564
|
required,
|
|
1434
1565
|
disabled,
|
|
1435
|
-
|
|
1436
|
-
jsonSelectedOptionsData,
|
|
1566
|
+
keyNames,
|
|
1437
1567
|
onChange,
|
|
1438
|
-
|
|
1568
|
+
className,
|
|
1439
1569
|
searchCount,
|
|
1440
1570
|
placeHolder,
|
|
1441
|
-
keyNames,
|
|
1442
1571
|
errorMesage,
|
|
1572
|
+
autoComplete,
|
|
1573
|
+
jsonOptionsData,
|
|
1574
|
+
jsonSelectedOptionsData,
|
|
1443
1575
|
...props
|
|
1444
1576
|
}) => {
|
|
1577
|
+
const configStyles = compereConfigs();
|
|
1445
1578
|
classnames(styles.searchBox, className);
|
|
1446
1579
|
const parseSelectedOptionsData = jsonSelectedOptionsData ? JSON.parse(jsonSelectedOptionsData) : {
|
|
1447
1580
|
name: '',
|
|
@@ -1452,10 +1585,6 @@ const Autocomplate = ({
|
|
|
1452
1585
|
const [activeOption, setActiveOption] = useState(0);
|
|
1453
1586
|
const [showOptions, setShowOptions] = useState(false);
|
|
1454
1587
|
const parseOptionsData = jsonOptionsData ? JSON.parse(jsonOptionsData) : [];
|
|
1455
|
-
useEffect(() => {
|
|
1456
|
-
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name]);
|
|
1457
|
-
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id]);
|
|
1458
|
-
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]]);
|
|
1459
1588
|
const handleChange = e => {
|
|
1460
1589
|
const currentInputValue = e.currentTarget.value;
|
|
1461
1590
|
setInputId(null);
|
|
@@ -1511,6 +1640,10 @@ const Autocomplate = ({
|
|
|
1511
1640
|
}, inputValue.length < searchCount ? `Լրացնել առնվազն ${searchCount} նիշ` : 'Նման տվյալ առկա չէ'))));
|
|
1512
1641
|
}
|
|
1513
1642
|
}
|
|
1643
|
+
useEffect(() => {
|
|
1644
|
+
setInputValue(JSON.parse(jsonSelectedOptionsData)[keyNames.name]);
|
|
1645
|
+
setInputId(JSON.parse(jsonSelectedOptionsData)[keyNames.id]);
|
|
1646
|
+
}, [JSON.parse(jsonSelectedOptionsData)[keyNames.id]]);
|
|
1514
1647
|
return /*#__PURE__*/React.createElement(React.Fragment, null, label ? /*#__PURE__*/React.createElement("label", {
|
|
1515
1648
|
className: `${styles['autocomplate-title']} autocomplate-title-rem`
|
|
1516
1649
|
}, label, " ", required && /*#__PURE__*/React.createElement("sup", {
|
|
@@ -1522,6 +1655,7 @@ const Autocomplate = ({
|
|
|
1522
1655
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
1523
1656
|
id: inputId,
|
|
1524
1657
|
type: "text",
|
|
1658
|
+
autoComplete: autoComplete ? autoComplete : configStyles.INPUT.autoComplete,
|
|
1525
1659
|
className: `${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMesage ? styles.errorBorder : ''}`,
|
|
1526
1660
|
disabled: disabled,
|
|
1527
1661
|
onChange: handleChange,
|
|
@@ -1535,21 +1669,22 @@ const Autocomplate = ({
|
|
|
1535
1669
|
}, errorMesage) : null, optionList));
|
|
1536
1670
|
};
|
|
1537
1671
|
Autocomplate.propTypes = {
|
|
1538
|
-
className: PropTypes.string,
|
|
1539
1672
|
label: PropTypes.string,
|
|
1540
|
-
placeHolder: PropTypes.string,
|
|
1541
|
-
required: PropTypes.bool,
|
|
1542
1673
|
disabled: PropTypes.bool,
|
|
1543
|
-
|
|
1544
|
-
jsonSelectedOptionsData: PropTypes.string,
|
|
1674
|
+
required: PropTypes.bool,
|
|
1545
1675
|
onChange: PropTypes.func,
|
|
1546
1676
|
value: PropTypes.string,
|
|
1547
|
-
searchCount: PropTypes.number,
|
|
1548
1677
|
keyNames: PropTypes.object,
|
|
1549
|
-
|
|
1678
|
+
className: PropTypes.string,
|
|
1679
|
+
searchCount: PropTypes.number,
|
|
1680
|
+
errorMesage: PropTypes.string,
|
|
1681
|
+
placeHolder: PropTypes.string,
|
|
1682
|
+
autoComplete: PropTypes.string,
|
|
1683
|
+
jsonOptionsData: PropTypes.string,
|
|
1684
|
+
jsonSelectedOptionsData: PropTypes.string
|
|
1550
1685
|
};
|
|
1551
1686
|
Autocomplate.defaultProps = {
|
|
1552
1687
|
required: false
|
|
1553
1688
|
};
|
|
1554
1689
|
|
|
1555
|
-
export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, Pagination, Radio, Select,
|
|
1690
|
+
export { Autocomplate, Button, Captcha, Checkbox, File, Input, InputTypes, Modal, Pagination, Radio, Select, Stepper, Table, Tooltip, Typography, TypographyType };
|