@xaypay/tui 0.0.48 → 0.0.50
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 +89 -67
- package/dist/index.js +89 -67
- package/package.json +1 -1
- package/src/components/autocomplate/autocomplate.module.css +8 -0
- package/src/components/autocomplate/index.js +2 -2
- package/src/components/file/file.module.css +1 -1
- package/src/components/file/file.stories.js +1 -5
- package/src/components/file/index.js +82 -70
- package/src/components/input/index.js +113 -77
- package/src/components/select/index.js +1 -1
- package/src/components/select/select.module.css +9 -1
package/dist/index.es.js
CHANGED
|
@@ -185,8 +185,8 @@ Typography.defaultProps = {
|
|
|
185
185
|
onClick: () => {}
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
var css_248z$b = ".autocomplate-module_autocomplate-content__UbIUT{display:flex;flex-direction:column;position:relative}.autocomplate-module_autocomplate-content-top__FVgCp{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.autocomplate-module_autocomplate-content-top__FVgCp.autocomplate-module_active__40fdV{border-color:#00236a}.autocomplate-module_autocomplate-content-top__FVgCp:hover{border-color:#3c393e}.autocomplate-module_autocomplate-content-bottom__yk0zP{animation:autocomplate-module_select-show__7Uap4 .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.autocomplate-module_autocomplate-content-bottom-inner__rF5IF{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes autocomplate-module_select-show__7Uap4{to{max-height:400px}}.autocomplate-module_autocomplate-content-bottom-row__dRsZa{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;height:46px;line-height:22px;margin-bottom:2px;padding:0 15px;transition:background .24s,color .24s}.autocomplate-module_autocomplate-content-bottom-row__dRsZa .autocomplate-module_no-option__xv0-E{color:red}.autocomplate-module_autocomplate-content-bottom-row__dRsZa:hover{background:unset;color:#00236a}.autocomplate-module_option-active__WuH4I .autocomplate-module_autocomplate-content-bottom-row__dRsZa{color:#00236a}.autocomplate-module_autocomplate-title__3Qxqz{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}";
|
|
189
|
-
var styles$a = {"autocomplate-content":"autocomplate-module_autocomplate-content__UbIUT","autocomplate-content-top":"autocomplate-module_autocomplate-content-top__FVgCp","active":"autocomplate-module_active__40fdV","autocomplate-content-bottom":"autocomplate-module_autocomplate-content-bottom__yk0zP","select-show":"autocomplate-module_select-show__7Uap4","autocomplate-content-bottom-inner":"autocomplate-module_autocomplate-content-bottom-inner__rF5IF","autocomplate-content-bottom-row":"autocomplate-module_autocomplate-content-bottom-row__dRsZa","no-option":"autocomplate-module_no-option__xv0-E","option-active":"autocomplate-module_option-active__WuH4I","autocomplate-title":"autocomplate-module_autocomplate-title__3Qxqz"};
|
|
188
|
+
var css_248z$b = ".autocomplate-module_autocomplate-content__UbIUT{display:flex;flex-direction:column;position:relative}.autocomplate-module_autocomplate-content-top__FVgCp{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.autocomplate-module_autocomplate-content-top__FVgCp.autocomplate-module_active__40fdV{border-color:#00236a}.autocomplate-module_autocomplate-content-top__FVgCp:hover{border-color:#3c393e}.autocomplate-module_autocomplate-content-bottom__yk0zP{animation:autocomplate-module_select-show__7Uap4 .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.autocomplate-module_autocomplate-content-bottom-inner__rF5IF{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes autocomplate-module_select-show__7Uap4{to{max-height:400px}}.autocomplate-module_autocomplate-content-bottom-row__dRsZa{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;height:46px;line-height:22px;margin-bottom:2px;padding:0 15px;transition:background .24s,color .24s}.autocomplate-module_autocomplate-content-bottom-row__dRsZa .autocomplate-module_no-option__xv0-E{color:red}.autocomplate-module_autocomplate-content-bottom-row__dRsZa:hover{background:unset;color:#00236a}.autocomplate-module_option-active__WuH4I .autocomplate-module_autocomplate-content-bottom-row__dRsZa{color:#00236a}.autocomplate-module_autocomplate-title__3Qxqz{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.autocomplate-module_errorBorder__LV-nb{border:2px solid #e00!important}.autocomplate-module_errorMessage__Gchpc{color:#e00!important}";
|
|
189
|
+
var styles$a = {"autocomplate-content":"autocomplate-module_autocomplate-content__UbIUT","autocomplate-content-top":"autocomplate-module_autocomplate-content-top__FVgCp","active":"autocomplate-module_active__40fdV","autocomplate-content-bottom":"autocomplate-module_autocomplate-content-bottom__yk0zP","select-show":"autocomplate-module_select-show__7Uap4","autocomplate-content-bottom-inner":"autocomplate-module_autocomplate-content-bottom-inner__rF5IF","autocomplate-content-bottom-row":"autocomplate-module_autocomplate-content-bottom-row__dRsZa","no-option":"autocomplate-module_no-option__xv0-E","option-active":"autocomplate-module_option-active__WuH4I","autocomplate-title":"autocomplate-module_autocomplate-title__3Qxqz","errorBorder":"autocomplate-module_errorBorder__LV-nb","errorMessage":"autocomplate-module_errorMessage__Gchpc"};
|
|
190
190
|
styleInject(css_248z$b);
|
|
191
191
|
|
|
192
192
|
const Autocomplate = ({
|
|
@@ -270,7 +270,7 @@ const Autocomplate = ({
|
|
|
270
270
|
className: `${styles$a['autocomplate-content-bottom-row']} autocomplate-content-bottom-row-rem`
|
|
271
271
|
}, /*#__PURE__*/React.createElement("div", {
|
|
272
272
|
className: `${styles$a['no-option']} autocomplate-no-option`
|
|
273
|
-
}, inputValue.length <= searchCount ?
|
|
273
|
+
}, inputValue.length <= searchCount ? `Լրացնել առնվազն ${searchCount} նիշ` : 'Նման տվյալ առկա չէ'))));
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
return /*#__PURE__*/React.createElement(React.Fragment, null, label ? /*#__PURE__*/React.createElement("label", {
|
|
@@ -284,7 +284,7 @@ const Autocomplate = ({
|
|
|
284
284
|
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
285
285
|
id: inputId,
|
|
286
286
|
type: "text",
|
|
287
|
-
className: `${styles$a['autocomplate-content-top']} autocomplate-content-top-rem`,
|
|
287
|
+
className: `${styles$a['autocomplate-content-top']} autocomplate-content-top-rem ${errorMesage ? styles$a.errorBorder : ''}`,
|
|
288
288
|
disabled: disabled,
|
|
289
289
|
onChange: handleChange,
|
|
290
290
|
onClick: () => {
|
|
@@ -430,16 +430,23 @@ const Input = ({
|
|
|
430
430
|
regexpError,
|
|
431
431
|
errorMesage,
|
|
432
432
|
required,
|
|
433
|
+
showEye,
|
|
433
434
|
disabled,
|
|
434
435
|
type,
|
|
436
|
+
tooltip,
|
|
435
437
|
onChange,
|
|
436
438
|
value,
|
|
437
439
|
...props
|
|
438
440
|
}) => {
|
|
439
441
|
const [inputValue, setInputValue] = useState(value);
|
|
442
|
+
const [eyeStatus, setEyeStatus] = useState("");
|
|
443
|
+
const [tooltipStatus, setTooltipStatus] = useState(false);
|
|
440
444
|
const handleChange = event => {
|
|
441
445
|
setInputValue(event.target.value);
|
|
442
|
-
onChange ? onChange(event.target.value) :
|
|
446
|
+
onChange ? onChange(event.target.value) : "";
|
|
447
|
+
};
|
|
448
|
+
document.onmouseup = () => {
|
|
449
|
+
setEyeStatus("");
|
|
443
450
|
};
|
|
444
451
|
useEffect(() => {
|
|
445
452
|
setInputValue(value);
|
|
@@ -451,17 +458,17 @@ const Input = ({
|
|
|
451
458
|
const regex = new RegExp(regexp);
|
|
452
459
|
eMessage = regex.test(inputValue) ? "" : regexpError;
|
|
453
460
|
}
|
|
454
|
-
const classProps = classnames(styles$8.input, styles$8[size], eMessage !=
|
|
461
|
+
const classProps = classnames(styles$8.input, styles$8[size], eMessage != "" ? styles$8["error-message"] : "", className, "input-inner-rem");
|
|
455
462
|
return /*#__PURE__*/React.createElement("div", {
|
|
456
|
-
className: `${styles$8[
|
|
463
|
+
className: `${styles$8["input-wrap"]} input-wrap-rem`
|
|
457
464
|
}, label ? /*#__PURE__*/React.createElement("label", {
|
|
458
|
-
className: `${styles$8[
|
|
465
|
+
className: `${styles$8["input-title"]} input-title-rem`
|
|
459
466
|
}, label, " ", required && /*#__PURE__*/React.createElement("sup", {
|
|
460
467
|
style: {
|
|
461
468
|
color: "#ee0000"
|
|
462
469
|
}
|
|
463
470
|
}, "*")) : "", /*#__PURE__*/React.createElement("input", _extends({}, props, {
|
|
464
|
-
type: type,
|
|
471
|
+
type: eyeStatus || type,
|
|
465
472
|
className: classProps,
|
|
466
473
|
style: color && {
|
|
467
474
|
color
|
|
@@ -469,7 +476,19 @@ const Input = ({
|
|
|
469
476
|
disabled: disabled ? disabled : "",
|
|
470
477
|
onChange: handleChange,
|
|
471
478
|
value: inputValue
|
|
472
|
-
})),
|
|
479
|
+
})), type === "password" && showEye ? /*#__PURE__*/React.createElement("p", {
|
|
480
|
+
onMouseDown: () => {
|
|
481
|
+
setEyeStatus("text");
|
|
482
|
+
},
|
|
483
|
+
onMouseUp: () => {
|
|
484
|
+
setEyeStatus("");
|
|
485
|
+
}
|
|
486
|
+
}, "\uD83D\uDC41") : null, tooltip ? /*#__PURE__*/React.createElement(Typography, {
|
|
487
|
+
variant: "p",
|
|
488
|
+
onClick: () => {
|
|
489
|
+
setTooltipStatus(!tooltipStatus);
|
|
490
|
+
}
|
|
491
|
+
}, "\u24D8") : null, tooltipStatus ? /*#__PURE__*/React.createElement("p", null, tooltip) : null, eMessage ? /*#__PURE__*/React.createElement("span", {
|
|
473
492
|
className: styles$8.inputErrorMessages
|
|
474
493
|
}, eMessage) : "");
|
|
475
494
|
};
|
|
@@ -485,7 +504,9 @@ Input.propTypes = {
|
|
|
485
504
|
regexpError: PropTypes.string,
|
|
486
505
|
label: PropTypes.string.isRequired,
|
|
487
506
|
disabled: PropTypes.bool,
|
|
488
|
-
value: PropTypes.string
|
|
507
|
+
value: PropTypes.string,
|
|
508
|
+
showEye: PropTypes.bool,
|
|
509
|
+
tooltip: PropTypes.string
|
|
489
510
|
};
|
|
490
511
|
Input.defaultProps = {
|
|
491
512
|
label: "",
|
|
@@ -814,8 +835,8 @@ Stepper.propTypes = {
|
|
|
814
835
|
activeSteps: PropTypes.number
|
|
815
836
|
};
|
|
816
837
|
|
|
817
|
-
var css_248z$3 = ".select-module_select-title__c8bR7{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.select-module_select-content__GCMDX{display:flex;flex-direction:column;position:relative}.select-module_select-content-top__Aw-fB{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.select-module_select-content-top__Aw-fB.select-module_active__v2Dce{border-color:#00236a}.select-module_select-content-top__Aw-fB:hover{border-color:#3c393e}.select-module_select-content-bottom__ueZCR{animation:select-module_select-show__391hQ .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.select-module_select-content-bottom-inner__NWy2X{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes select-module_select-show__391hQ{to{max-height:400px}}.select-module_select-content-top-text__euajq{align-items:center;display:flex;flex:1;flex-direction:row;flex-wrap:nowrap}.select-module_select-content-top-icon__MBrGK{align-items:center;box-sizing:border-box;display:flex;flex:0 0 auto;padding:0 5px 0 20px}.select-module_select-content-top-icon__MBrGK>i{color:#3c393e;font-size:12px!important}.select-module_select-content-top-icon__MBrGK>i:not(:last-child){align-items:center;border-right:1px solid #eee;display:flex;height:22px;margin-right:8px;padding:0 8px}.select-module_select-content-bottom-row__eKq5L{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;line-height:22px;margin-bottom:2px;min-height:46px;padding:0 15px;transition:background .24s,color .24s}.select-module_select-content-bottom-row__eKq5L:last-child{margin-bottom:0}.select-module_select-content-bottom-row__eKq5L:hover{background:unset;color:#00236a}";
|
|
818
|
-
var styles$3 = {"select-title":"select-module_select-title__c8bR7","select-content":"select-module_select-content__GCMDX","select-content-top":"select-module_select-content-top__Aw-fB","active":"select-module_active__v2Dce","select-content-bottom":"select-module_select-content-bottom__ueZCR","select-show":"select-module_select-show__391hQ","select-content-bottom-inner":"select-module_select-content-bottom-inner__NWy2X","select-content-top-text":"select-module_select-content-top-text__euajq","select-content-top-icon":"select-module_select-content-top-icon__MBrGK","select-content-bottom-row":"select-module_select-content-bottom-row__eKq5L"};
|
|
838
|
+
var css_248z$3 = ".select-module_select-title__c8bR7{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.select-module_select-content__GCMDX{display:flex;flex-direction:column;position:relative}.select-module_select-content-top__Aw-fB{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.select-module_select-content-top__Aw-fB.select-module_active__v2Dce{border-color:#00236a}.select-module_select-content-top__Aw-fB:hover{border-color:#3c393e}.select-module_select-content-bottom__ueZCR{animation:select-module_select-show__391hQ .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.select-module_select-content-bottom-inner__NWy2X{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes select-module_select-show__391hQ{to{max-height:400px}}.select-module_select-content-top-text__euajq{align-items:center;display:flex;flex:1;flex-direction:row;flex-wrap:nowrap}.select-module_select-content-top-icon__MBrGK{align-items:center;box-sizing:border-box;display:flex;flex:0 0 auto;padding:0 5px 0 20px}.select-module_select-content-top-icon__MBrGK>i{color:#3c393e;font-size:12px!important}.select-module_select-content-top-icon__MBrGK>i:not(:last-child){align-items:center;border-right:1px solid #eee;display:flex;height:22px;margin-right:8px;padding:0 8px}.select-module_select-content-bottom-row__eKq5L{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;line-height:22px;margin-bottom:2px;min-height:46px;padding:0 15px;transition:background .24s,color .24s}.select-module_select-content-bottom-row__eKq5L:last-child{margin-bottom:0}.select-module_select-content-bottom-row__eKq5L:hover{background:unset;color:#00236a}.select-module_error-message__-ac6X{border:2px solid #e00!important}.select-module_eMessage__Mm-F7{color:#e00}";
|
|
839
|
+
var styles$3 = {"select-title":"select-module_select-title__c8bR7","select-content":"select-module_select-content__GCMDX","select-content-top":"select-module_select-content-top__Aw-fB","active":"select-module_active__v2Dce","select-content-bottom":"select-module_select-content-bottom__ueZCR","select-show":"select-module_select-show__391hQ","select-content-bottom-inner":"select-module_select-content-bottom-inner__NWy2X","select-content-top-text":"select-module_select-content-top-text__euajq","select-content-top-icon":"select-module_select-content-top-icon__MBrGK","select-content-bottom-row":"select-module_select-content-bottom-row__eKq5L","error-message":"select-module_error-message__-ac6X","eMessage":"select-module_eMessage__Mm-F7"};
|
|
819
840
|
styleInject(css_248z$3);
|
|
820
841
|
|
|
821
842
|
const SelectTheme = {
|
|
@@ -884,7 +905,7 @@ const Select = ({
|
|
|
884
905
|
className: styles$3['select-content'],
|
|
885
906
|
id: styles$3.selector
|
|
886
907
|
}, /*#__PURE__*/React.createElement("div", {
|
|
887
|
-
className: `${styles$3['select-content-top']} select-content-top-rem`,
|
|
908
|
+
className: `${styles$3['select-content-top']} select-content-top-rem ${eMessage ? styles$3['error-message'] : ''}`,
|
|
888
909
|
onClick: () => {
|
|
889
910
|
setOpened(!opened);
|
|
890
911
|
}
|
|
@@ -940,51 +961,70 @@ Select.defaultProps = {
|
|
|
940
961
|
required: false
|
|
941
962
|
};
|
|
942
963
|
|
|
943
|
-
var css_248z$2 = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{bottom:0;display:block;height:190px;left:0;margin:auto;max-height:190px;position:absolute;right:0;top:0;width:auto}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
|
|
964
|
+
var css_248z$2 = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{bottom:0;display:block;height:190px;left:0;margin:auto;max-height:190px;position:absolute;right:0;top:0;width:auto}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
|
|
944
965
|
var styles$2 = {"file-form-wrap":"file-module_file-form-wrap__qY--B","file-form":"file-module_file-form__l13d5","active":"file-module_active__L1gPt","delete-upload-icon":"file-module_delete-upload-icon__PWN66","file-form-inner-upload":"file-module_file-form-inner-upload__tq3Dn","upload-info":"file-module_upload-info__a8GFs","upload-info-txt":"file-module_upload-info-txt__l11uN","default":"file-module_default__t7KU0","error":"file-module_error__H-M4Z","accept":"file-module_accept__WTW6V","upload-file-content":"file-module_upload-file-content__QHMjn","file-form-title":"file-module_file-form-title__zWTSB"};
|
|
945
966
|
styleInject(css_248z$2);
|
|
946
967
|
|
|
947
968
|
const File = ({
|
|
948
|
-
|
|
969
|
+
name,
|
|
949
970
|
label,
|
|
971
|
+
maxSize,
|
|
950
972
|
required,
|
|
951
973
|
disabled,
|
|
952
974
|
onChange,
|
|
975
|
+
className,
|
|
953
976
|
defaultData,
|
|
954
977
|
errorMesage,
|
|
955
|
-
|
|
978
|
+
fileExtensions,
|
|
956
979
|
...props
|
|
957
980
|
}) => {
|
|
958
981
|
const pdfImageName = 'https://play-lh.googleusercontent.com/kIwlXqs28otssKK_9AKwdkB6gouex_U2WmtLshTACnwIJuvOqVvJEzewpzuYBXwXQQ';
|
|
959
982
|
const [image, setImage] = useState(defaultData ? defaultData.type != 'application/pdf' ? defaultData.url : pdfImageName : null);
|
|
960
983
|
const [error, setError] = useState('');
|
|
961
984
|
const [fileName, setFileName] = useState('no selected file');
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
985
|
+
const handleCheckFile = e => {
|
|
986
|
+
const file = e.target.files;
|
|
987
|
+
if (file[0]) {
|
|
988
|
+
if (file[0].size <= maxSize * Math.pow(2, 20)) {
|
|
989
|
+
if (fileExtensions.includes(file[0].type.split('/')[1])) {
|
|
990
|
+
if (file[0].type === 'application/pdf') {
|
|
991
|
+
setError('');
|
|
992
|
+
onChange({
|
|
993
|
+
file
|
|
994
|
+
});
|
|
995
|
+
setImage(pdfImageName);
|
|
996
|
+
} else {
|
|
997
|
+
setError('');
|
|
998
|
+
onChange({
|
|
999
|
+
file
|
|
1000
|
+
});
|
|
1001
|
+
setFileName(file[0].name);
|
|
1002
|
+
setImage(URL.createObjectURL(file[0]));
|
|
1003
|
+
}
|
|
1004
|
+
} else {
|
|
1005
|
+
setImage(null);
|
|
1006
|
+
setError('ֆայլի սխալ ֆորմատ');
|
|
1007
|
+
setFileName('no selected file');
|
|
1008
|
+
}
|
|
977
1009
|
} else {
|
|
978
1010
|
setImage(null);
|
|
1011
|
+
setError('առավելագույն ծավալ');
|
|
979
1012
|
setFileName('no selected file');
|
|
980
|
-
setError('ֆայլի սխալ ֆորմատ');
|
|
981
1013
|
}
|
|
982
1014
|
} else {
|
|
983
1015
|
setImage(null);
|
|
1016
|
+
setError('Ֆայլը ընտրված չէ');
|
|
984
1017
|
setFileName('no selected file');
|
|
985
|
-
setError('առավելագույն ծավալ');
|
|
986
1018
|
}
|
|
987
|
-
}
|
|
1019
|
+
};
|
|
1020
|
+
const handleRemoveFile = () => {
|
|
1021
|
+
setImage(null);
|
|
1022
|
+
onChange({
|
|
1023
|
+
target: null
|
|
1024
|
+
});
|
|
1025
|
+
setFileName('no selected file');
|
|
1026
|
+
document.querySelector(`.${name}`).value = "";
|
|
1027
|
+
};
|
|
988
1028
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
|
|
989
1029
|
className: `${styles$2['file-form-title']} ile-form-title-rem`
|
|
990
1030
|
}, label, " ", required && /*#__PURE__*/React.createElement("sup", {
|
|
@@ -994,30 +1034,15 @@ const File = ({
|
|
|
994
1034
|
}, "*")), /*#__PURE__*/React.createElement("div", {
|
|
995
1035
|
className: classnames(`${styles$2['file-form-wrap']} file-form-wrap-rem`, image ? styles$2['active'] : '')
|
|
996
1036
|
}, /*#__PURE__*/React.createElement("div", {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
},
|
|
1001
|
-
style: error || errorMesage ? {
|
|
1002
|
-
borderColor: 'red'
|
|
1003
|
-
} : {},
|
|
1004
|
-
onClick: () => {
|
|
1005
|
-
document.querySelector(`.${name}`).click();
|
|
1006
|
-
}
|
|
1037
|
+
onChange: e => console.log(e),
|
|
1038
|
+
className: `${styles$2['file-form']} file-form-rem ${errorMesage ? styles$2['error'] : ''}`,
|
|
1039
|
+
onClick: () => document.querySelector(`.${name}`).click()
|
|
1007
1040
|
}, /*#__PURE__*/React.createElement("input", {
|
|
1041
|
+
hidden: true,
|
|
1008
1042
|
type: "file",
|
|
1009
1043
|
className: name,
|
|
1010
|
-
hidden: true,
|
|
1011
1044
|
disabled: disabled,
|
|
1012
|
-
onChange: (
|
|
1013
|
-
target: {
|
|
1014
|
-
files
|
|
1015
|
-
}
|
|
1016
|
-
}) => {
|
|
1017
|
-
if (files[0]) {
|
|
1018
|
-
fileType(files);
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1045
|
+
onChange: e => handleCheckFile(e)
|
|
1021
1046
|
}), image ? /*#__PURE__*/React.createElement("div", {
|
|
1022
1047
|
className: `${styles$2['upload-file-content']} upload-file-content-rem`
|
|
1023
1048
|
}, /*#__PURE__*/React.createElement("img", {
|
|
@@ -1034,16 +1059,9 @@ const File = ({
|
|
|
1034
1059
|
className: `${styles$2['upload-info-txt']} upload-info-txt-rem`
|
|
1035
1060
|
}, "\u0532\u0565\u057C\u0576\u0565\u056C")), /*#__PURE__*/React.createElement("span", {
|
|
1036
1061
|
className: `${styles$2['upload-info-size']} upload-info-size-rem`
|
|
1037
|
-
}, "\u0531\u057C\u0561\u057E\u0565\u056C\u0561\u0563\u0578\u0582\u0575\u0576\u0568
|
|
1062
|
+
}, "\u0531\u057C\u0561\u057E\u0565\u056C\u0561\u0563\u0578\u0582\u0575\u0576\u0568 ", maxSize, "\u0544\u0532 ( ", fileExtensions.toString().split(',').join(', '), " )"))), /*#__PURE__*/React.createElement("div", {
|
|
1038
1063
|
className: `${styles$2['delete-upload-icon']} delete-upload-icon-rem`,
|
|
1039
|
-
onClick:
|
|
1040
|
-
setFileName('no selected file');
|
|
1041
|
-
setImage(null);
|
|
1042
|
-
document.querySelector(`.${name}`).value = "";
|
|
1043
|
-
onChange({
|
|
1044
|
-
target: null
|
|
1045
|
-
});
|
|
1046
|
-
}
|
|
1064
|
+
onClick: handleRemoveFile
|
|
1047
1065
|
}, /*#__PURE__*/React.createElement("i", {
|
|
1048
1066
|
className: "icon-delete"
|
|
1049
1067
|
})), errorMesage || error ? /*#__PURE__*/React.createElement("span", {
|
|
@@ -1053,16 +1071,20 @@ const File = ({
|
|
|
1053
1071
|
}, errorMesage || error) : null));
|
|
1054
1072
|
};
|
|
1055
1073
|
File.propTypes = {
|
|
1056
|
-
className: PropTypes.string,
|
|
1057
1074
|
label: PropTypes.string,
|
|
1058
1075
|
required: PropTypes.bool,
|
|
1059
1076
|
disabled: PropTypes.bool,
|
|
1060
1077
|
onChange: PropTypes.func,
|
|
1078
|
+
maxSize: PropTypes.number,
|
|
1079
|
+
className: PropTypes.string,
|
|
1061
1080
|
errorMesage: PropTypes.string,
|
|
1062
|
-
defaultData: PropTypes.object
|
|
1081
|
+
defaultData: PropTypes.object,
|
|
1082
|
+
fileExtensions: PropTypes.arrayOf(PropTypes.string)
|
|
1063
1083
|
};
|
|
1064
1084
|
File.defaultProps = {
|
|
1065
|
-
|
|
1085
|
+
maxSize: 5,
|
|
1086
|
+
required: false,
|
|
1087
|
+
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
|
|
1066
1088
|
};
|
|
1067
1089
|
|
|
1068
1090
|
var css_248z$1 = ".modal-module_modal-wrap__IsXXf{background:rgba(0,0,0,.4);height:100%;left:0;position:fixed;top:0;width:100%;z-index:9}.modal-module_modal-top__ntDBi{background:#fbfbfb;box-sizing:border-box;display:flex;flex-direction:row;height:44px;padding:4px 10px 4px 0;width:100%}.modal-module_modal-title__r-WKl{align-items:center;color:#3c393e;display:flex;flex:1 1;font-size:20px;font-weight:500;line-height:24px;padding-right:20px}.modal-module_close-btn__Qf2UD{cursor:pointer;flex:0 0 auto;width:24px}.modal-module_close-btn__Qf2UD,.modal-module_modal-section__Bp8jN{align-items:center;display:flex;height:100%;justify-content:center}.modal-module_modal-section__Bp8jN{flex:1 1;padding:10px 0;width:100%}.modal-module_modal-content__1F-uE{align-items:center;animation:modal-module_show-popup__WrH7a .24s;background:#fff;border-radius:8px;display:flex;flex-direction:column;height:auto;left:0;margin:auto;min-height:130px;overflow:hidden;padding:10px;position:absolute;right:0;top:110px;width:fit-content}@keyframes modal-module_show-popup__WrH7a{0%{transform:translate3d(0,-30%,0)}to{opacity:1;transform:translateZ(0)}}";
|
package/dist/index.js
CHANGED
|
@@ -196,8 +196,8 @@ Typography.defaultProps = {
|
|
|
196
196
|
onClick: () => {}
|
|
197
197
|
};
|
|
198
198
|
|
|
199
|
-
var css_248z$b = ".autocomplate-module_autocomplate-content__UbIUT{display:flex;flex-direction:column;position:relative}.autocomplate-module_autocomplate-content-top__FVgCp{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.autocomplate-module_autocomplate-content-top__FVgCp.autocomplate-module_active__40fdV{border-color:#00236a}.autocomplate-module_autocomplate-content-top__FVgCp:hover{border-color:#3c393e}.autocomplate-module_autocomplate-content-bottom__yk0zP{animation:autocomplate-module_select-show__7Uap4 .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.autocomplate-module_autocomplate-content-bottom-inner__rF5IF{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes autocomplate-module_select-show__7Uap4{to{max-height:400px}}.autocomplate-module_autocomplate-content-bottom-row__dRsZa{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;height:46px;line-height:22px;margin-bottom:2px;padding:0 15px;transition:background .24s,color .24s}.autocomplate-module_autocomplate-content-bottom-row__dRsZa .autocomplate-module_no-option__xv0-E{color:red}.autocomplate-module_autocomplate-content-bottom-row__dRsZa:hover{background:unset;color:#00236a}.autocomplate-module_option-active__WuH4I .autocomplate-module_autocomplate-content-bottom-row__dRsZa{color:#00236a}.autocomplate-module_autocomplate-title__3Qxqz{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}";
|
|
200
|
-
var styles$a = {"autocomplate-content":"autocomplate-module_autocomplate-content__UbIUT","autocomplate-content-top":"autocomplate-module_autocomplate-content-top__FVgCp","active":"autocomplate-module_active__40fdV","autocomplate-content-bottom":"autocomplate-module_autocomplate-content-bottom__yk0zP","select-show":"autocomplate-module_select-show__7Uap4","autocomplate-content-bottom-inner":"autocomplate-module_autocomplate-content-bottom-inner__rF5IF","autocomplate-content-bottom-row":"autocomplate-module_autocomplate-content-bottom-row__dRsZa","no-option":"autocomplate-module_no-option__xv0-E","option-active":"autocomplate-module_option-active__WuH4I","autocomplate-title":"autocomplate-module_autocomplate-title__3Qxqz"};
|
|
199
|
+
var css_248z$b = ".autocomplate-module_autocomplate-content__UbIUT{display:flex;flex-direction:column;position:relative}.autocomplate-module_autocomplate-content-top__FVgCp{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.autocomplate-module_autocomplate-content-top__FVgCp.autocomplate-module_active__40fdV{border-color:#00236a}.autocomplate-module_autocomplate-content-top__FVgCp:hover{border-color:#3c393e}.autocomplate-module_autocomplate-content-bottom__yk0zP{animation:autocomplate-module_select-show__7Uap4 .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.autocomplate-module_autocomplate-content-bottom-inner__rF5IF{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes autocomplate-module_select-show__7Uap4{to{max-height:400px}}.autocomplate-module_autocomplate-content-bottom-row__dRsZa{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;height:46px;line-height:22px;margin-bottom:2px;padding:0 15px;transition:background .24s,color .24s}.autocomplate-module_autocomplate-content-bottom-row__dRsZa .autocomplate-module_no-option__xv0-E{color:red}.autocomplate-module_autocomplate-content-bottom-row__dRsZa:hover{background:unset;color:#00236a}.autocomplate-module_option-active__WuH4I .autocomplate-module_autocomplate-content-bottom-row__dRsZa{color:#00236a}.autocomplate-module_autocomplate-title__3Qxqz{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.autocomplate-module_errorBorder__LV-nb{border:2px solid #e00!important}.autocomplate-module_errorMessage__Gchpc{color:#e00!important}";
|
|
200
|
+
var styles$a = {"autocomplate-content":"autocomplate-module_autocomplate-content__UbIUT","autocomplate-content-top":"autocomplate-module_autocomplate-content-top__FVgCp","active":"autocomplate-module_active__40fdV","autocomplate-content-bottom":"autocomplate-module_autocomplate-content-bottom__yk0zP","select-show":"autocomplate-module_select-show__7Uap4","autocomplate-content-bottom-inner":"autocomplate-module_autocomplate-content-bottom-inner__rF5IF","autocomplate-content-bottom-row":"autocomplate-module_autocomplate-content-bottom-row__dRsZa","no-option":"autocomplate-module_no-option__xv0-E","option-active":"autocomplate-module_option-active__WuH4I","autocomplate-title":"autocomplate-module_autocomplate-title__3Qxqz","errorBorder":"autocomplate-module_errorBorder__LV-nb","errorMessage":"autocomplate-module_errorMessage__Gchpc"};
|
|
201
201
|
styleInject(css_248z$b);
|
|
202
202
|
|
|
203
203
|
const Autocomplate = ({
|
|
@@ -281,7 +281,7 @@ const Autocomplate = ({
|
|
|
281
281
|
className: `${styles$a['autocomplate-content-bottom-row']} autocomplate-content-bottom-row-rem`
|
|
282
282
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
283
283
|
className: `${styles$a['no-option']} autocomplate-no-option`
|
|
284
|
-
}, inputValue.length <= searchCount ?
|
|
284
|
+
}, inputValue.length <= searchCount ? `Լրացնել առնվազն ${searchCount} նիշ` : 'Նման տվյալ առկա չէ'))));
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
@@ -295,7 +295,7 @@ const Autocomplate = ({
|
|
|
295
295
|
}, /*#__PURE__*/React__default["default"].createElement("input", _extends({
|
|
296
296
|
id: inputId,
|
|
297
297
|
type: "text",
|
|
298
|
-
className: `${styles$a['autocomplate-content-top']} autocomplate-content-top-rem`,
|
|
298
|
+
className: `${styles$a['autocomplate-content-top']} autocomplate-content-top-rem ${errorMesage ? styles$a.errorBorder : ''}`,
|
|
299
299
|
disabled: disabled,
|
|
300
300
|
onChange: handleChange,
|
|
301
301
|
onClick: () => {
|
|
@@ -441,16 +441,23 @@ const Input = ({
|
|
|
441
441
|
regexpError,
|
|
442
442
|
errorMesage,
|
|
443
443
|
required,
|
|
444
|
+
showEye,
|
|
444
445
|
disabled,
|
|
445
446
|
type,
|
|
447
|
+
tooltip,
|
|
446
448
|
onChange,
|
|
447
449
|
value,
|
|
448
450
|
...props
|
|
449
451
|
}) => {
|
|
450
452
|
const [inputValue, setInputValue] = React.useState(value);
|
|
453
|
+
const [eyeStatus, setEyeStatus] = React.useState("");
|
|
454
|
+
const [tooltipStatus, setTooltipStatus] = React.useState(false);
|
|
451
455
|
const handleChange = event => {
|
|
452
456
|
setInputValue(event.target.value);
|
|
453
|
-
onChange ? onChange(event.target.value) :
|
|
457
|
+
onChange ? onChange(event.target.value) : "";
|
|
458
|
+
};
|
|
459
|
+
document.onmouseup = () => {
|
|
460
|
+
setEyeStatus("");
|
|
454
461
|
};
|
|
455
462
|
React.useEffect(() => {
|
|
456
463
|
setInputValue(value);
|
|
@@ -462,17 +469,17 @@ const Input = ({
|
|
|
462
469
|
const regex = new RegExp(regexp);
|
|
463
470
|
eMessage = regex.test(inputValue) ? "" : regexpError;
|
|
464
471
|
}
|
|
465
|
-
const classProps = classnames__default["default"](styles$8.input, styles$8[size], eMessage !=
|
|
472
|
+
const classProps = classnames__default["default"](styles$8.input, styles$8[size], eMessage != "" ? styles$8["error-message"] : "", className, "input-inner-rem");
|
|
466
473
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
467
|
-
className: `${styles$8[
|
|
474
|
+
className: `${styles$8["input-wrap"]} input-wrap-rem`
|
|
468
475
|
}, label ? /*#__PURE__*/React__default["default"].createElement("label", {
|
|
469
|
-
className: `${styles$8[
|
|
476
|
+
className: `${styles$8["input-title"]} input-title-rem`
|
|
470
477
|
}, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
|
|
471
478
|
style: {
|
|
472
479
|
color: "#ee0000"
|
|
473
480
|
}
|
|
474
481
|
}, "*")) : "", /*#__PURE__*/React__default["default"].createElement("input", _extends({}, props, {
|
|
475
|
-
type: type,
|
|
482
|
+
type: eyeStatus || type,
|
|
476
483
|
className: classProps,
|
|
477
484
|
style: color && {
|
|
478
485
|
color
|
|
@@ -480,7 +487,19 @@ const Input = ({
|
|
|
480
487
|
disabled: disabled ? disabled : "",
|
|
481
488
|
onChange: handleChange,
|
|
482
489
|
value: inputValue
|
|
483
|
-
})),
|
|
490
|
+
})), type === "password" && showEye ? /*#__PURE__*/React__default["default"].createElement("p", {
|
|
491
|
+
onMouseDown: () => {
|
|
492
|
+
setEyeStatus("text");
|
|
493
|
+
},
|
|
494
|
+
onMouseUp: () => {
|
|
495
|
+
setEyeStatus("");
|
|
496
|
+
}
|
|
497
|
+
}, "\uD83D\uDC41") : null, tooltip ? /*#__PURE__*/React__default["default"].createElement(Typography, {
|
|
498
|
+
variant: "p",
|
|
499
|
+
onClick: () => {
|
|
500
|
+
setTooltipStatus(!tooltipStatus);
|
|
501
|
+
}
|
|
502
|
+
}, "\u24D8") : null, tooltipStatus ? /*#__PURE__*/React__default["default"].createElement("p", null, tooltip) : null, eMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
484
503
|
className: styles$8.inputErrorMessages
|
|
485
504
|
}, eMessage) : "");
|
|
486
505
|
};
|
|
@@ -496,7 +515,9 @@ Input.propTypes = {
|
|
|
496
515
|
regexpError: PropTypes__default["default"].string,
|
|
497
516
|
label: PropTypes__default["default"].string.isRequired,
|
|
498
517
|
disabled: PropTypes__default["default"].bool,
|
|
499
|
-
value: PropTypes__default["default"].string
|
|
518
|
+
value: PropTypes__default["default"].string,
|
|
519
|
+
showEye: PropTypes__default["default"].bool,
|
|
520
|
+
tooltip: PropTypes__default["default"].string
|
|
500
521
|
};
|
|
501
522
|
Input.defaultProps = {
|
|
502
523
|
label: "",
|
|
@@ -825,8 +846,8 @@ Stepper.propTypes = {
|
|
|
825
846
|
activeSteps: PropTypes__default["default"].number
|
|
826
847
|
};
|
|
827
848
|
|
|
828
|
-
var css_248z$3 = ".select-module_select-title__c8bR7{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.select-module_select-content__GCMDX{display:flex;flex-direction:column;position:relative}.select-module_select-content-top__Aw-fB{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.select-module_select-content-top__Aw-fB.select-module_active__v2Dce{border-color:#00236a}.select-module_select-content-top__Aw-fB:hover{border-color:#3c393e}.select-module_select-content-bottom__ueZCR{animation:select-module_select-show__391hQ .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.select-module_select-content-bottom-inner__NWy2X{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes select-module_select-show__391hQ{to{max-height:400px}}.select-module_select-content-top-text__euajq{align-items:center;display:flex;flex:1;flex-direction:row;flex-wrap:nowrap}.select-module_select-content-top-icon__MBrGK{align-items:center;box-sizing:border-box;display:flex;flex:0 0 auto;padding:0 5px 0 20px}.select-module_select-content-top-icon__MBrGK>i{color:#3c393e;font-size:12px!important}.select-module_select-content-top-icon__MBrGK>i:not(:last-child){align-items:center;border-right:1px solid #eee;display:flex;height:22px;margin-right:8px;padding:0 8px}.select-module_select-content-bottom-row__eKq5L{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;line-height:22px;margin-bottom:2px;min-height:46px;padding:0 15px;transition:background .24s,color .24s}.select-module_select-content-bottom-row__eKq5L:last-child{margin-bottom:0}.select-module_select-content-bottom-row__eKq5L:hover{background:unset;color:#00236a}";
|
|
829
|
-
var styles$3 = {"select-title":"select-module_select-title__c8bR7","select-content":"select-module_select-content__GCMDX","select-content-top":"select-module_select-content-top__Aw-fB","active":"select-module_active__v2Dce","select-content-bottom":"select-module_select-content-bottom__ueZCR","select-show":"select-module_select-show__391hQ","select-content-bottom-inner":"select-module_select-content-bottom-inner__NWy2X","select-content-top-text":"select-module_select-content-top-text__euajq","select-content-top-icon":"select-module_select-content-top-icon__MBrGK","select-content-bottom-row":"select-module_select-content-bottom-row__eKq5L"};
|
|
849
|
+
var css_248z$3 = ".select-module_select-title__c8bR7{color:#3c393e;display:block;font-size:16px;font-weight:500;line-height:22px;margin-bottom:6px;text-transform:none}.select-module_select-content__GCMDX{display:flex;flex-direction:column;position:relative}.select-module_select-content-top__Aw-fB{border:2px solid #d1d1d1;border-radius:6px;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;flex-direction:row;font-size:16px;font-weight:500;height:46px;line-height:22px;max-width:400px;padding:0 15px;transition:border-color .24s}.select-module_select-content-top__Aw-fB.select-module_active__v2Dce{border-color:#00236a}.select-module_select-content-top__Aw-fB:hover{border-color:#3c393e}.select-module_select-content-bottom__ueZCR{animation:select-module_select-show__391hQ .64s linear forwards;background:#fbfbfb;border-radius:6px;box-shadow:0 0 10px rgba(60,57,62,.08);left:0;max-height:0;max-width:400px;overflow:hidden;position:absolute;top:52px;width:100%;z-index:1}.select-module_select-content-bottom-inner__NWy2X{display:flex;flex-direction:column;max-height:234px;overflow-x:hidden;overflow-y:auto}@keyframes select-module_select-show__391hQ{to{max-height:400px}}.select-module_select-content-top-text__euajq{align-items:center;display:flex;flex:1;flex-direction:row;flex-wrap:nowrap}.select-module_select-content-top-icon__MBrGK{align-items:center;box-sizing:border-box;display:flex;flex:0 0 auto;padding:0 5px 0 20px}.select-module_select-content-top-icon__MBrGK>i{color:#3c393e;font-size:12px!important}.select-module_select-content-top-icon__MBrGK>i:not(:last-child){align-items:center;border-right:1px solid #eee;display:flex;height:22px;margin-right:8px;padding:0 8px}.select-module_select-content-bottom-row__eKq5L{align-items:center;background:#fff;box-sizing:border-box;color:#3c393e;cursor:pointer;display:flex;font-size:16px;font-weight:500;line-height:22px;margin-bottom:2px;min-height:46px;padding:0 15px;transition:background .24s,color .24s}.select-module_select-content-bottom-row__eKq5L:last-child{margin-bottom:0}.select-module_select-content-bottom-row__eKq5L:hover{background:unset;color:#00236a}.select-module_error-message__-ac6X{border:2px solid #e00!important}.select-module_eMessage__Mm-F7{color:#e00}";
|
|
850
|
+
var styles$3 = {"select-title":"select-module_select-title__c8bR7","select-content":"select-module_select-content__GCMDX","select-content-top":"select-module_select-content-top__Aw-fB","active":"select-module_active__v2Dce","select-content-bottom":"select-module_select-content-bottom__ueZCR","select-show":"select-module_select-show__391hQ","select-content-bottom-inner":"select-module_select-content-bottom-inner__NWy2X","select-content-top-text":"select-module_select-content-top-text__euajq","select-content-top-icon":"select-module_select-content-top-icon__MBrGK","select-content-bottom-row":"select-module_select-content-bottom-row__eKq5L","error-message":"select-module_error-message__-ac6X","eMessage":"select-module_eMessage__Mm-F7"};
|
|
830
851
|
styleInject(css_248z$3);
|
|
831
852
|
|
|
832
853
|
const SelectTheme = {
|
|
@@ -895,7 +916,7 @@ const Select = ({
|
|
|
895
916
|
className: styles$3['select-content'],
|
|
896
917
|
id: styles$3.selector
|
|
897
918
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
898
|
-
className: `${styles$3['select-content-top']} select-content-top-rem`,
|
|
919
|
+
className: `${styles$3['select-content-top']} select-content-top-rem ${eMessage ? styles$3['error-message'] : ''}`,
|
|
899
920
|
onClick: () => {
|
|
900
921
|
setOpened(!opened);
|
|
901
922
|
}
|
|
@@ -951,51 +972,70 @@ Select.defaultProps = {
|
|
|
951
972
|
required: false
|
|
952
973
|
};
|
|
953
974
|
|
|
954
|
-
var css_248z$2 = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{bottom:0;display:block;height:190px;left:0;margin:auto;max-height:190px;position:absolute;right:0;top:0;width:auto}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
|
|
975
|
+
var css_248z$2 = ".file-module_file-form__l13d5{align-items:center;background:#fbfbfb;border:2px dashed;border-radius:6px;cursor:pointer;display:flex;flex-direction:column;height:190px;justify-content:space-between;overflow:hidden;padding:4px 0;position:relative;width:100%}.file-module_file-form-wrap__qY--B:before{background:rgba(60,57,62,.4);border-radius:6px;content:\"\";height:100%;left:0;opacity:0;pointer-events:none;position:absolute;top:0;transition:opacity .24s;width:100%;z-index:1}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover:before{opacity:1;pointer-events:unset}.file-module_file-form-wrap__qY--B.file-module_active__L1gPt:hover .file-module_delete-upload-icon__PWN66{opacity:1}.file-module_file-form-inner-upload__tq3Dn{align-items:center;display:flex;flex-direction:column;justify-content:space-between;padding-bottom:16px;padding-top:48px}.file-module_file-form-inner-upload__tq3Dn>img{display:block;margin-bottom:14px}.file-module_upload-info__a8GFs{margin-bottom:40px;max-width:150px;text-align:center}.file-module_upload-info-txt__l11uN{color:#0da574}.file-module_file-form__l13d5.file-module_default__t7KU0{border-color:#d1d1d1}.file-module_file-form__l13d5.file-module_error__H-M4Z{border-color:#e00!important}.file-module_file-form__l13d5.file-module_accept__WTW6V{border-color:#00236a}.file-module_delete-upload-icon__PWN66{align-items:center;background:#fff;border-radius:6px;cursor:pointer;display:flex;height:26px;justify-content:center;opacity:0;position:absolute;right:10px;top:10px;transition:opacity .24s;width:26px;z-index:11}.file-module_delete-upload-icon__PWN66>i{color:#00236a;font-size:16px}.file-module_upload-file-content__QHMjn{align-items:center;display:flex;height:100%;justify-content:center;max-height:190px;overflow:hidden;position:relative;width:100%}.file-module_upload-file-content__QHMjn>img{bottom:0;display:block;height:190px;left:0;margin:auto;max-height:190px;position:absolute;right:0;top:0;width:auto}.file-module_file-form-title__zWTSB{margin-bottom:10px;max-width:390px;word-break:break-all}.file-module_file-form-wrap__qY--B{position:relative;transform:translateZ(0)}";
|
|
955
976
|
var styles$2 = {"file-form-wrap":"file-module_file-form-wrap__qY--B","file-form":"file-module_file-form__l13d5","active":"file-module_active__L1gPt","delete-upload-icon":"file-module_delete-upload-icon__PWN66","file-form-inner-upload":"file-module_file-form-inner-upload__tq3Dn","upload-info":"file-module_upload-info__a8GFs","upload-info-txt":"file-module_upload-info-txt__l11uN","default":"file-module_default__t7KU0","error":"file-module_error__H-M4Z","accept":"file-module_accept__WTW6V","upload-file-content":"file-module_upload-file-content__QHMjn","file-form-title":"file-module_file-form-title__zWTSB"};
|
|
956
977
|
styleInject(css_248z$2);
|
|
957
978
|
|
|
958
979
|
const File = ({
|
|
959
|
-
|
|
980
|
+
name,
|
|
960
981
|
label,
|
|
982
|
+
maxSize,
|
|
961
983
|
required,
|
|
962
984
|
disabled,
|
|
963
985
|
onChange,
|
|
986
|
+
className,
|
|
964
987
|
defaultData,
|
|
965
988
|
errorMesage,
|
|
966
|
-
|
|
989
|
+
fileExtensions,
|
|
967
990
|
...props
|
|
968
991
|
}) => {
|
|
969
992
|
const pdfImageName = 'https://play-lh.googleusercontent.com/kIwlXqs28otssKK_9AKwdkB6gouex_U2WmtLshTACnwIJuvOqVvJEzewpzuYBXwXQQ';
|
|
970
993
|
const [image, setImage] = React.useState(defaultData ? defaultData.type != 'application/pdf' ? defaultData.url : pdfImageName : null);
|
|
971
994
|
const [error, setError] = React.useState('');
|
|
972
995
|
const [fileName, setFileName] = React.useState('no selected file');
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
996
|
+
const handleCheckFile = e => {
|
|
997
|
+
const file = e.target.files;
|
|
998
|
+
if (file[0]) {
|
|
999
|
+
if (file[0].size <= maxSize * Math.pow(2, 20)) {
|
|
1000
|
+
if (fileExtensions.includes(file[0].type.split('/')[1])) {
|
|
1001
|
+
if (file[0].type === 'application/pdf') {
|
|
1002
|
+
setError('');
|
|
1003
|
+
onChange({
|
|
1004
|
+
file
|
|
1005
|
+
});
|
|
1006
|
+
setImage(pdfImageName);
|
|
1007
|
+
} else {
|
|
1008
|
+
setError('');
|
|
1009
|
+
onChange({
|
|
1010
|
+
file
|
|
1011
|
+
});
|
|
1012
|
+
setFileName(file[0].name);
|
|
1013
|
+
setImage(URL.createObjectURL(file[0]));
|
|
1014
|
+
}
|
|
1015
|
+
} else {
|
|
1016
|
+
setImage(null);
|
|
1017
|
+
setError('ֆայլի սխալ ֆորմատ');
|
|
1018
|
+
setFileName('no selected file');
|
|
1019
|
+
}
|
|
988
1020
|
} else {
|
|
989
1021
|
setImage(null);
|
|
1022
|
+
setError('առավելագույն ծավալ');
|
|
990
1023
|
setFileName('no selected file');
|
|
991
|
-
setError('ֆայլի սխալ ֆորմատ');
|
|
992
1024
|
}
|
|
993
1025
|
} else {
|
|
994
1026
|
setImage(null);
|
|
1027
|
+
setError('Ֆայլը ընտրված չէ');
|
|
995
1028
|
setFileName('no selected file');
|
|
996
|
-
setError('առավելագույն ծավալ');
|
|
997
1029
|
}
|
|
998
|
-
}
|
|
1030
|
+
};
|
|
1031
|
+
const handleRemoveFile = () => {
|
|
1032
|
+
setImage(null);
|
|
1033
|
+
onChange({
|
|
1034
|
+
target: null
|
|
1035
|
+
});
|
|
1036
|
+
setFileName('no selected file');
|
|
1037
|
+
document.querySelector(`.${name}`).value = "";
|
|
1038
|
+
};
|
|
999
1039
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("p", {
|
|
1000
1040
|
className: `${styles$2['file-form-title']} ile-form-title-rem`
|
|
1001
1041
|
}, label, " ", required && /*#__PURE__*/React__default["default"].createElement("sup", {
|
|
@@ -1005,30 +1045,15 @@ const File = ({
|
|
|
1005
1045
|
}, "*")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1006
1046
|
className: classnames__default["default"](`${styles$2['file-form-wrap']} file-form-wrap-rem`, image ? styles$2['active'] : '')
|
|
1007
1047
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
},
|
|
1012
|
-
style: error || errorMesage ? {
|
|
1013
|
-
borderColor: 'red'
|
|
1014
|
-
} : {},
|
|
1015
|
-
onClick: () => {
|
|
1016
|
-
document.querySelector(`.${name}`).click();
|
|
1017
|
-
}
|
|
1048
|
+
onChange: e => console.log(e),
|
|
1049
|
+
className: `${styles$2['file-form']} file-form-rem ${errorMesage ? styles$2['error'] : ''}`,
|
|
1050
|
+
onClick: () => document.querySelector(`.${name}`).click()
|
|
1018
1051
|
}, /*#__PURE__*/React__default["default"].createElement("input", {
|
|
1052
|
+
hidden: true,
|
|
1019
1053
|
type: "file",
|
|
1020
1054
|
className: name,
|
|
1021
|
-
hidden: true,
|
|
1022
1055
|
disabled: disabled,
|
|
1023
|
-
onChange: (
|
|
1024
|
-
target: {
|
|
1025
|
-
files
|
|
1026
|
-
}
|
|
1027
|
-
}) => {
|
|
1028
|
-
if (files[0]) {
|
|
1029
|
-
fileType(files);
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1056
|
+
onChange: e => handleCheckFile(e)
|
|
1032
1057
|
}), image ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1033
1058
|
className: `${styles$2['upload-file-content']} upload-file-content-rem`
|
|
1034
1059
|
}, /*#__PURE__*/React__default["default"].createElement("img", {
|
|
@@ -1045,16 +1070,9 @@ const File = ({
|
|
|
1045
1070
|
className: `${styles$2['upload-info-txt']} upload-info-txt-rem`
|
|
1046
1071
|
}, "\u0532\u0565\u057C\u0576\u0565\u056C")), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1047
1072
|
className: `${styles$2['upload-info-size']} upload-info-size-rem`
|
|
1048
|
-
}, "\u0531\u057C\u0561\u057E\u0565\u056C\u0561\u0563\u0578\u0582\u0575\u0576\u0568
|
|
1073
|
+
}, "\u0531\u057C\u0561\u057E\u0565\u056C\u0561\u0563\u0578\u0582\u0575\u0576\u0568 ", maxSize, "\u0544\u0532 ( ", fileExtensions.toString().split(',').join(', '), " )"))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1049
1074
|
className: `${styles$2['delete-upload-icon']} delete-upload-icon-rem`,
|
|
1050
|
-
onClick:
|
|
1051
|
-
setFileName('no selected file');
|
|
1052
|
-
setImage(null);
|
|
1053
|
-
document.querySelector(`.${name}`).value = "";
|
|
1054
|
-
onChange({
|
|
1055
|
-
target: null
|
|
1056
|
-
});
|
|
1057
|
-
}
|
|
1075
|
+
onClick: handleRemoveFile
|
|
1058
1076
|
}, /*#__PURE__*/React__default["default"].createElement("i", {
|
|
1059
1077
|
className: "icon-delete"
|
|
1060
1078
|
})), errorMesage || error ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
@@ -1064,16 +1082,20 @@ const File = ({
|
|
|
1064
1082
|
}, errorMesage || error) : null));
|
|
1065
1083
|
};
|
|
1066
1084
|
File.propTypes = {
|
|
1067
|
-
className: PropTypes__default["default"].string,
|
|
1068
1085
|
label: PropTypes__default["default"].string,
|
|
1069
1086
|
required: PropTypes__default["default"].bool,
|
|
1070
1087
|
disabled: PropTypes__default["default"].bool,
|
|
1071
1088
|
onChange: PropTypes__default["default"].func,
|
|
1089
|
+
maxSize: PropTypes__default["default"].number,
|
|
1090
|
+
className: PropTypes__default["default"].string,
|
|
1072
1091
|
errorMesage: PropTypes__default["default"].string,
|
|
1073
|
-
defaultData: PropTypes__default["default"].object
|
|
1092
|
+
defaultData: PropTypes__default["default"].object,
|
|
1093
|
+
fileExtensions: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
|
|
1074
1094
|
};
|
|
1075
1095
|
File.defaultProps = {
|
|
1076
|
-
|
|
1096
|
+
maxSize: 5,
|
|
1097
|
+
required: false,
|
|
1098
|
+
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
|
|
1077
1099
|
};
|
|
1078
1100
|
|
|
1079
1101
|
var css_248z$1 = ".modal-module_modal-wrap__IsXXf{background:rgba(0,0,0,.4);height:100%;left:0;position:fixed;top:0;width:100%;z-index:9}.modal-module_modal-top__ntDBi{background:#fbfbfb;box-sizing:border-box;display:flex;flex-direction:row;height:44px;padding:4px 10px 4px 0;width:100%}.modal-module_modal-title__r-WKl{align-items:center;color:#3c393e;display:flex;flex:1 1;font-size:20px;font-weight:500;line-height:24px;padding-right:20px}.modal-module_close-btn__Qf2UD{cursor:pointer;flex:0 0 auto;width:24px}.modal-module_close-btn__Qf2UD,.modal-module_modal-section__Bp8jN{align-items:center;display:flex;height:100%;justify-content:center}.modal-module_modal-section__Bp8jN{flex:1 1;padding:10px 0;width:100%}.modal-module_modal-content__1F-uE{align-items:center;animation:modal-module_show-popup__WrH7a .24s;background:#fff;border-radius:8px;display:flex;flex-direction:column;height:auto;left:0;margin:auto;min-height:130px;overflow:hidden;padding:10px;position:absolute;right:0;top:110px;width:fit-content}@keyframes modal-module_show-popup__WrH7a{0%{transform:translate3d(0,-30%,0)}to{opacity:1;transform:translateZ(0)}}";
|
package/package.json
CHANGED
|
@@ -81,7 +81,7 @@ export const Autocomplate = ({
|
|
|
81
81
|
<div className={`${styles['autocomplate-content-bottom']} autocomplate-content-bottom-rem`}>
|
|
82
82
|
<div className={`${styles['autocomplate-content-bottom-inner']} autocomplate-content-bottom-inner-rem`}>
|
|
83
83
|
<div className={`${styles['autocomplate-content-bottom-row']} autocomplate-content-bottom-row-rem`}>
|
|
84
|
-
<div className={`${styles['no-option']} autocomplate-no-option`}>{inputValue.length <= searchCount ?
|
|
84
|
+
<div className={`${styles['no-option']} autocomplate-no-option`}>{inputValue.length <= searchCount ? `Լրացնել առնվազն ${searchCount} նիշ` : 'Նման տվյալ առկա չէ'}</div>
|
|
85
85
|
</div>
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
@@ -96,7 +96,7 @@ export const Autocomplate = ({
|
|
|
96
96
|
<input
|
|
97
97
|
id={inputId}
|
|
98
98
|
type="text"
|
|
99
|
-
className={`${styles['autocomplate-content-top']} autocomplate-content-top-rem`}
|
|
99
|
+
className={`${styles['autocomplate-content-top']} autocomplate-content-top-rem ${errorMesage ? styles.errorBorder : ''}`}
|
|
100
100
|
disabled={disabled}
|
|
101
101
|
onChange={handleChange}
|
|
102
102
|
onClick={() => { setShowOptions(!showOptions) }}
|
|
@@ -11,14 +11,10 @@ const Template = (args) => <File {...args} />;
|
|
|
11
11
|
export const Default = Template.bind({});
|
|
12
12
|
Default.args = {
|
|
13
13
|
label: 'ssa',
|
|
14
|
-
onChange:
|
|
15
|
-
console.log('barev', aa);
|
|
16
|
-
|
|
17
|
-
},
|
|
14
|
+
onChange: _ => _,
|
|
18
15
|
defaultData: {
|
|
19
16
|
url: 'https://images.pexels.com/photos/753626/pexels-photo-753626.jpeg?auto=compress&cs=tinysrgb&w=1600',
|
|
20
17
|
type: "image/png",
|
|
21
18
|
},
|
|
22
19
|
name: 'sss'
|
|
23
|
-
|
|
24
20
|
};
|
|
@@ -5,113 +5,125 @@ import styles from "./file.module.css";
|
|
|
5
5
|
import Icon from '../icon/Icon'
|
|
6
6
|
|
|
7
7
|
export const File = ({
|
|
8
|
-
|
|
8
|
+
name,
|
|
9
9
|
label,
|
|
10
|
+
maxSize,
|
|
10
11
|
required,
|
|
11
12
|
disabled,
|
|
12
13
|
onChange,
|
|
14
|
+
className,
|
|
13
15
|
defaultData,
|
|
14
16
|
errorMesage,
|
|
15
|
-
|
|
17
|
+
fileExtensions,
|
|
16
18
|
...props
|
|
17
19
|
}) => {
|
|
18
20
|
const pdfImageName = 'https://play-lh.googleusercontent.com/kIwlXqs28otssKK_9AKwdkB6gouex_U2WmtLshTACnwIJuvOqVvJEzewpzuYBXwXQQ'
|
|
19
|
-
const [image, setImage] = useState(defaultData ?
|
|
20
|
-
defaultData.type != 'application/pdf' ?
|
|
21
|
-
defaultData.url : pdfImageName : null);
|
|
21
|
+
const [image, setImage] = useState(defaultData ? defaultData.type != 'application/pdf' ? defaultData.url : pdfImageName : null);
|
|
22
22
|
const [error, setError] = useState('');
|
|
23
23
|
const [fileName, setFileName] = useState('no selected file');
|
|
24
|
-
function fileType(file) {
|
|
25
|
-
if (file[0].size <= 5000000) {
|
|
26
|
-
if (file[0].type === 'image/jpeg' || file[0].type === 'image/png') {
|
|
27
|
-
setFileName(file[0].name)
|
|
28
|
-
setImage(URL.createObjectURL(file[0]))
|
|
29
|
-
onChange({file})
|
|
30
|
-
setError('')
|
|
31
24
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
setImage(pdfImageName)
|
|
35
|
-
onChange({file})
|
|
36
|
-
setError('')
|
|
25
|
+
const handleCheckFile = (e) => {
|
|
26
|
+
const file = e.target.files;
|
|
37
27
|
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
if (file[0]) {
|
|
29
|
+
if (file[0].size <= maxSize * Math.pow(2, 20)) {
|
|
30
|
+
if (fileExtensions.includes(file[0].type.split('/')[1])) {
|
|
31
|
+
if (file[0].type === 'application/pdf') {
|
|
32
|
+
setError('');
|
|
33
|
+
onChange({file});
|
|
34
|
+
setImage(pdfImageName);
|
|
35
|
+
} else {
|
|
36
|
+
setError('');
|
|
37
|
+
onChange({file});
|
|
38
|
+
setFileName(file[0].name);
|
|
39
|
+
setImage(URL.createObjectURL(file[0]));
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
setImage(null)
|
|
43
|
+
setError('ֆայլի սխալ ֆորմատ');
|
|
44
|
+
setFileName('no selected file');
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
40
47
|
setImage(null)
|
|
48
|
+
setError('առավելագույն ծավալ');
|
|
41
49
|
setFileName('no selected file');
|
|
42
|
-
setError('ֆայլի սխալ ֆորմատ')
|
|
43
50
|
}
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
51
|
+
} else {
|
|
46
52
|
setImage(null)
|
|
53
|
+
setError('Ֆայլը ընտրված չէ');
|
|
47
54
|
setFileName('no selected file');
|
|
48
|
-
setError('առավելագույն ծավալ')
|
|
49
55
|
}
|
|
50
|
-
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleRemoveFile = () => {
|
|
59
|
+
setImage(null);
|
|
60
|
+
onChange({ target: null });
|
|
61
|
+
setFileName('no selected file');
|
|
62
|
+
document.querySelector(`.${name}`).value = "";
|
|
63
|
+
};
|
|
51
64
|
|
|
52
65
|
return (
|
|
53
66
|
<>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/>
|
|
67
|
+
<p className={`${styles['file-form-title']} ile-form-title-rem`}>
|
|
68
|
+
{label} {required && <sup style={{color: "#ee0000"}}>*</sup>}
|
|
69
|
+
</p>
|
|
70
|
+
<div className={classnames(`${styles['file-form-wrap']} file-form-wrap-rem`,image ? styles['active'] : '')}>
|
|
71
|
+
<div
|
|
72
|
+
onChange={(e) => console.log(e)}
|
|
73
|
+
className={`${styles['file-form']} file-form-rem ${errorMesage ? styles['error'] : '' }`}
|
|
74
|
+
onClick={() => document.querySelector(`.${name}`).click()}
|
|
75
|
+
>
|
|
76
|
+
<input
|
|
77
|
+
hidden
|
|
78
|
+
type='file'
|
|
79
|
+
className={name}
|
|
80
|
+
disabled={disabled}
|
|
81
|
+
onChange={(e) => handleCheckFile(e)}
|
|
82
|
+
/>
|
|
71
83
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
image ?
|
|
85
|
+
<div className={`${styles['upload-file-content']} upload-file-content-rem`}>
|
|
86
|
+
<img src={image} alt={fileName} />
|
|
87
|
+
</div> :
|
|
88
|
+
<div className={`${styles['file-form-inner-upload']} ile-form-inner-upload-rem`}>
|
|
89
|
+
<img src="../../assets/upload.svg" alt="" />
|
|
90
|
+
<span className={`${styles['upload-info']} upload-info-rem`}>
|
|
91
|
+
<span className={`${styles['upload-info-txt']} upload-info-txt-rem`}>Բեռնել</span>
|
|
92
|
+
</span>
|
|
93
|
+
<span className={`${styles['upload-info-size']} upload-info-size-rem`}>
|
|
94
|
+
Առավելագույնը {maxSize}ՄԲ ( { fileExtensions.toString().split(',').join(', ') } )
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
84
97
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}}>
|
|
93
|
-
<i className="icon-delete"/>
|
|
94
|
-
</div>
|
|
98
|
+
</div>
|
|
99
|
+
<div
|
|
100
|
+
className={`${styles['delete-upload-icon']} delete-upload-icon-rem`}
|
|
101
|
+
onClick={handleRemoveFile}
|
|
102
|
+
>
|
|
103
|
+
<i className="icon-delete"/>
|
|
104
|
+
</div>
|
|
95
105
|
{
|
|
96
|
-
|
|
106
|
+
errorMesage || error ? <span style={{ color: 'red' }}>{errorMesage || error}</span> : null
|
|
97
107
|
}
|
|
98
108
|
</div>
|
|
99
|
-
|
|
109
|
+
</>
|
|
100
110
|
);
|
|
101
111
|
};
|
|
102
112
|
|
|
103
113
|
File.propTypes = {
|
|
104
|
-
className: PropTypes.string,
|
|
105
114
|
label: PropTypes.string,
|
|
106
115
|
required: PropTypes.bool,
|
|
107
116
|
disabled: PropTypes.bool,
|
|
108
117
|
onChange: PropTypes.func,
|
|
118
|
+
maxSize: PropTypes.number,
|
|
119
|
+
className: PropTypes.string,
|
|
109
120
|
errorMesage: PropTypes.string,
|
|
110
|
-
defaultData: PropTypes.object
|
|
121
|
+
defaultData: PropTypes.object,
|
|
122
|
+
fileExtensions: PropTypes.arrayOf(PropTypes.string)
|
|
111
123
|
};
|
|
112
124
|
|
|
113
|
-
|
|
114
|
-
|
|
115
125
|
File.defaultProps = {
|
|
126
|
+
maxSize: 5,
|
|
116
127
|
required: false,
|
|
117
|
-
|
|
128
|
+
fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
|
|
129
|
+
};
|
|
@@ -2,98 +2,134 @@ import React, { useEffect, useState } from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import classnames from "classnames";
|
|
4
4
|
import styles from "./input.module.css";
|
|
5
|
+
import {Typography} from "../typography"
|
|
5
6
|
|
|
6
7
|
export const InputTypes = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
TEXT: "text",
|
|
9
|
+
PASSWORD: "password",
|
|
10
|
+
EMAIL: "email",
|
|
11
|
+
NUMBER: "number",
|
|
12
|
+
TEL: "tel",
|
|
12
13
|
};
|
|
13
14
|
|
|
14
15
|
export const InputSizes = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
SMALL: "size-small",
|
|
17
|
+
MEDIUM: "size-medium",
|
|
18
|
+
LARGE: "size-large",
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
export const Input = ({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
size,
|
|
23
|
+
color,
|
|
24
|
+
className,
|
|
25
|
+
label,
|
|
26
|
+
regexp,
|
|
27
|
+
regexpError,
|
|
28
|
+
errorMesage,
|
|
29
|
+
required,
|
|
30
|
+
showEye,
|
|
31
|
+
disabled,
|
|
32
|
+
type,
|
|
33
|
+
tooltip,
|
|
34
|
+
onChange,
|
|
35
|
+
value,
|
|
36
|
+
...props
|
|
34
37
|
}) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
const [inputValue, setInputValue] = useState(value);
|
|
39
|
+
const [eyeStatus, setEyeStatus] = useState("");
|
|
40
|
+
const [tooltipStatus, setTooltipStatus] = useState(false);
|
|
41
|
+
const handleChange = (event) => {
|
|
42
|
+
setInputValue(event.target.value);
|
|
43
|
+
onChange ? onChange(event.target.value) : "";
|
|
44
|
+
};
|
|
45
|
+
document.onmouseup = () => {
|
|
46
|
+
setEyeStatus("");
|
|
47
|
+
};
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setInputValue(value);
|
|
50
|
+
}, [value]);
|
|
40
51
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
let eMessage = "";
|
|
53
|
+
if (errorMesage) {
|
|
54
|
+
eMessage = errorMesage;
|
|
55
|
+
} else if (regexp) {
|
|
56
|
+
const regex = new RegExp(regexp);
|
|
57
|
+
eMessage = regex.test(inputValue) ? "" : regexpError;
|
|
58
|
+
}
|
|
44
59
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
60
|
+
const classProps = classnames(
|
|
61
|
+
styles.input,
|
|
62
|
+
styles[size],
|
|
63
|
+
eMessage != "" ? styles["error-message"] : "",
|
|
64
|
+
className,
|
|
65
|
+
"input-inner-rem"
|
|
66
|
+
);
|
|
67
|
+
return (
|
|
68
|
+
<div className={`${styles["input-wrap"]} input-wrap-rem`}>
|
|
69
|
+
{label ? (
|
|
70
|
+
<label className={`${styles["input-title"]} input-title-rem`}>
|
|
71
|
+
{label} {required && <sup style={{ color: "#ee0000" }}>*</sup>}
|
|
72
|
+
</label>
|
|
73
|
+
) : (
|
|
74
|
+
""
|
|
75
|
+
)}
|
|
76
|
+
|
|
77
|
+
<input
|
|
78
|
+
{...props}
|
|
79
|
+
type={eyeStatus || type}
|
|
80
|
+
className={classProps}
|
|
81
|
+
style={color && { color }}
|
|
82
|
+
disabled={disabled ? disabled : ""}
|
|
83
|
+
onChange={handleChange}
|
|
84
|
+
value={inputValue}
|
|
85
|
+
/>
|
|
86
|
+
{type === "password" && showEye ? (
|
|
87
|
+
<p
|
|
88
|
+
onMouseDown={() => {
|
|
89
|
+
setEyeStatus("text");
|
|
90
|
+
}}
|
|
91
|
+
onMouseUp={() => {
|
|
92
|
+
setEyeStatus("");
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
👁
|
|
96
|
+
</p>
|
|
97
|
+
) : null}
|
|
98
|
+
{tooltip ? <Typography variant="p"
|
|
99
|
+
onClick={()=> {
|
|
100
|
+
setTooltipStatus(!tooltipStatus)
|
|
101
|
+
}}
|
|
102
|
+
>ⓘ</Typography>: null}
|
|
103
|
+
{tooltipStatus ? <p>{tooltip}</p> : null}
|
|
104
|
+
{eMessage ? <span className={styles.inputErrorMessages}>{eMessage}</span> : ""}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
73
107
|
};
|
|
74
108
|
|
|
75
109
|
Input.propTypes = {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
110
|
+
type: PropTypes.oneOf(Object.values(InputTypes)),
|
|
111
|
+
size: PropTypes.oneOf(Object.values(InputSizes)),
|
|
112
|
+
color: PropTypes.string,
|
|
113
|
+
className: PropTypes.string,
|
|
114
|
+
onChange: PropTypes.func,
|
|
115
|
+
required: PropTypes.bool,
|
|
116
|
+
errorMesage: PropTypes.string,
|
|
117
|
+
regexp: PropTypes.string,
|
|
118
|
+
regexpError: PropTypes.string,
|
|
119
|
+
label: PropTypes.string.isRequired,
|
|
120
|
+
disabled: PropTypes.bool,
|
|
121
|
+
value: PropTypes.string,
|
|
122
|
+
showEye: PropTypes.bool,
|
|
123
|
+
tooltip: PropTypes.string,
|
|
88
124
|
};
|
|
89
125
|
|
|
90
126
|
Input.defaultProps = {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
127
|
+
label: "",
|
|
128
|
+
color: null,
|
|
129
|
+
size: InputSizes.MEDIUM,
|
|
130
|
+
onChange: undefined,
|
|
131
|
+
required: false,
|
|
132
|
+
errorMesage: "",
|
|
133
|
+
type: "text",
|
|
134
|
+
value: ""
|
|
99
135
|
};
|
|
@@ -78,7 +78,7 @@ export const Select = ({
|
|
|
78
78
|
<div className={`${styles['select-wrap']} select-wrap-rem`} ref={ref}>
|
|
79
79
|
<div className={styles['select-content']} id={styles.selector}>
|
|
80
80
|
<div
|
|
81
|
-
className={`${styles['select-content-top']} select-content-top-rem`}
|
|
81
|
+
className={`${styles['select-content-top']} select-content-top-rem ${eMessage ? styles['error-message'] : ''}`}
|
|
82
82
|
onClick={() => {
|
|
83
83
|
setOpened(!opened)
|
|
84
84
|
}}
|