@xaypay/tui 0.0.71 → 0.0.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -604,6 +604,9 @@ const InputTypes = {
604
604
  TEXT: "text",
605
605
  PASSWORD: "password"
606
606
  };
607
+ const P = styled__default["default"].p`
608
+ animation: ${props => props.errorAnimation ? props.animation : 'none'};
609
+ `;
607
610
  const Input = ({
608
611
  type,
609
612
  size,
@@ -615,12 +618,12 @@ const Input = ({
615
618
  regexp,
616
619
  height,
617
620
  radius,
621
+ change,
618
622
  padding,
619
623
  tooltip,
620
624
  leftIcon,
621
625
  required,
622
626
  disabled,
623
- onChange,
624
627
  transform,
625
628
  iconWidth,
626
629
  rightIcon,
@@ -677,12 +680,12 @@ const Input = ({
677
680
  const animation = _ => styled.css`
678
681
  ${errorShow} ${errorAnimationDuration ? errorAnimationDuration : configStyles.INPUT.errorAnimationDuration} forwards
679
682
  `;
680
- const P = styled__default["default"].p`
681
- animation: ${errorAnimation ? animation : 'none'};
682
- `;
683
683
  const handleChange = event => {
684
684
  const currentValue = event.target.value;
685
685
  setInnerValue(currentValue);
686
+ if (change) {
687
+ change(currentValue);
688
+ }
686
689
  if (type === 'tel') {
687
690
  if (!phoneNumberRegex.test(currentValue)) {
688
691
  telErrorMessage && setInnerErrorMessage(telErrorMessage);
@@ -691,27 +694,27 @@ const Input = ({
691
694
  setInnerErrorMessage('');
692
695
  if (currentValue.length > 8) {
693
696
  setInnerValue(currentValue.substr(0, 8));
694
- if (onChange) {
695
- onChange(currentValue.substr(0, 8));
697
+ if (change) {
698
+ change(currentValue.substr(0, 8));
696
699
  }
697
700
  } else {
698
701
  setInnerValue(currentValue);
699
- if (onChange) {
700
- onChange(currentValue);
702
+ if (change) {
703
+ change(currentValue);
701
704
  }
702
705
  }
703
706
  }
704
707
  }
705
708
  if (maxLength && currentValue.length > maxLength && type !== 'tel') {
706
709
  setInnerValue(currentValue.substr(0, maxLength));
707
- if (onChange) {
708
- onChange(currentValue.substr(0, maxLength));
710
+ if (change) {
711
+ change(currentValue.substr(0, maxLength));
709
712
  }
710
713
  }
711
714
  if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
712
715
  !regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
713
- if (onChange) {
714
- onChange(currentValue);
716
+ if (change) {
717
+ change(currentValue);
715
718
  }
716
719
  }
717
720
  };
@@ -730,7 +733,7 @@ const Input = ({
730
733
  if (value !== undefined && value !== null) {
731
734
  setInnerValue(value);
732
735
  if (type === 'tel') {
733
- if (!phoneNumberRegex.test(currentValue)) {
736
+ if (!phoneNumberRegex.test(value)) {
734
737
  telErrorMessage && setInnerErrorMessage(telErrorMessage);
735
738
  setInnerValue('');
736
739
  } else {
@@ -841,7 +844,10 @@ const Input = ({
841
844
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
842
845
  }
843
846
  }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default["default"].createElement(P, {
847
+ errorAnimation: errorAnimation,
848
+ animation: animation,
844
849
  style: {
850
+ margin: '0px',
845
851
  left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
846
852
  color: errorColor ? errorColor : configStyles.INPUT.errorColor,
847
853
  fontSize: errorSize ? errorSize : configStyles.INPUT.errorSize,
@@ -856,11 +862,11 @@ const Input = ({
856
862
  };
857
863
  Input.propTypes = {
858
864
  name: PropTypes__default["default"].string,
865
+ change: PropTypes__default["default"].func,
859
866
  color: PropTypes__default["default"].string,
860
867
  value: PropTypes__default["default"].string,
861
868
  width: PropTypes__default["default"].string,
862
869
  label: PropTypes__default["default"].string,
863
- onChange: PropTypes__default["default"].func,
864
870
  required: PropTypes__default["default"].bool,
865
871
  disabled: PropTypes__default["default"].bool,
866
872
  height: PropTypes__default["default"].string,
@@ -2189,53 +2195,47 @@ function v4(options, buf, offset) {
2189
2195
  return stringify(rnds);
2190
2196
  }
2191
2197
 
2192
- const SvgUpload = ({
2198
+ const SvgListItemPdf = ({
2193
2199
  title,
2194
2200
  titleId,
2195
2201
  ...props
2196
2202
  }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2197
- width: "51",
2198
- height: "35",
2199
- viewBox: "0 0 51 35",
2203
+ width: "32",
2204
+ height: "42",
2205
+ viewBox: "0 0 32 42",
2200
2206
  fill: "none",
2201
2207
  xmlns: "http://www.w3.org/2000/svg",
2202
2208
  "aria-labelledby": titleId
2203
2209
  }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2204
2210
  id: titleId
2205
2211
  }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2206
- d: "M41.54 11.842h-.017c-.23-3.225-2.902-5.772-6.167-5.772-1.08 0-2.095.28-2.979.77C30.267 2.774 26.041 0 21.167 0 14.318 0 8.742 5.483 8.534 12.326 3.758 12.708 0 16.726 0 21.63c0 5.155 4.153 9.334 9.277 9.334h22.625a10.987 10.987 0 0 1-.888-4.334c0-6.059 4.899-10.987 10.918-10.987 3.773 0 7.106 1.938 9.068 4.875-.444-4.864-4.508-8.675-9.46-8.675ZM15.654 6.975c-.072.06-.144.12-.211.185-.266.259-.512.53-.705.849-.741 1.218-.882 2.523-.72 3.927.156 1.35-1.942 1.334-2.095 0-.289-2.493.504-5.307 2.664-6.775 1.12-.763 2.164 1.052 1.067 1.814Zm-.022.015c-.047.035-.111.093 0 0Z",
2207
- fill: "#D1D1D1"
2208
- }), /*#__PURE__*/React__namespace.createElement("path", {
2209
2212
  fillRule: "evenodd",
2210
2213
  clipRule: "evenodd",
2211
- d: "M41.822 17.245c-4.864 0-8.822 3.982-8.822 8.878C33 31.018 36.958 35 41.822 35c4.864 0 8.822-3.982 8.822-8.877 0-4.896-3.959-8.878-8.822-8.878Zm-.536 13.005v-6.689l-3.067 3.22a.69.69 0 0 1-1.01 0 .777.777 0 0 1 0-1.06l4.286-4.5A.71.71 0 0 1 42 21a.684.684 0 0 1 .505.22l4.286 4.5a.777.777 0 0 1 0 1.06.69.69 0 0 1-1.01 0l-3.067-3.22v6.69c0 .414-.32.75-.714.75-.395 0-.714-.336-.714-.75Z",
2212
- fill: "#0DA574"
2214
+ d: "M31.862 10.64c.007.01.015.02.022.027l.116.108v28.328c0 .768-.306 1.505-.852 2.049a2.917 2.917 0 0 1-2.057.848H2.909a2.917 2.917 0 0 1-2.057-.848A2.891 2.891 0 0 1 0 39.103V2.897C0 2.128.306 1.392.852.848A2.917 2.917 0 0 1 2.909 0h18.27l.108.116.03.025.028.026.025.02.026.023L31.79 10.558c.02.018.037.037.052.058l.02.025Zm-1.743 29.486a1.45 1.45 0 0 0 .427-1.022v-8.77H13.95a.716.716 0 0 1-.546-.246l-1.963-2.238H1.455v11.254c.001.383.155.751.427 1.022.273.272.642.425 1.027.426h26.182a1.463 1.463 0 0 0 1.027-.426ZM4.364 17.633c0 .4.324.724.724.724h21.825a.724.724 0 1 0 0-1.448H5.088c-.4 0-.724.324-.724.724Zm23.273 3.186c0-.4-.325-.724-.724-.724H15.48a.724.724 0 0 0 0 1.448h11.432c.4 0 .724-.324.724-.724Zm-.724-5.641a.724.724 0 1 0 0-1.449H5.088a.724.724 0 1 0 0 1.449h21.825Zm-22.55-3.91c0 .4.325.723.725.723H16.52a.724.724 0 0 0 0-1.448H5.088c-.4 0-.724.324-.724.724Zm17.672-1.345c.272.27.642.423 1.027.425h6.458l-7.913-7.879V8.9c.002.384.155.752.428 1.024ZM10.43 36.013H9.103v2.385H8V32h2.43c.495 0 .916.088 1.261.264.349.172.614.413.796.72.181.305.272.654.272 1.046 0 .413-.09.768-.272 1.064a1.754 1.754 0 0 1-.796.68c-.345.16-.766.238-1.26.238Zm-1.327-3.134v2.259h1.327c.29 0 .525-.047.703-.14a.877.877 0 0 0 .391-.388c.085-.167.128-.357.128-.57 0-.203-.043-.392-.128-.568a.971.971 0 0 0-.39-.43c-.18-.109-.414-.163-.704-.163H9.103Zm6.504 5.52h-1.859V32H15.646c.425 0 .813.072 1.165.215.352.141.655.345.91.611.258.267.455.586.593.958.138.372.206.788.206 1.248v.339c0 .46-.068.876-.206 1.248a2.714 2.714 0 0 1-.593.958 2.662 2.662 0 0 1-.923.61c-.355.141-.752.211-1.191.211Zm0-.875h-.756v-4.645h.795c.285 0 .535.047.752.14.22.094.404.232.554.414a1.8 1.8 0 0 1 .342.672c.08.267.12.573.12.918v.348c0 .445-.07.829-.208 1.151-.134.322-.336.57-.606.743-.267.172-.598.259-.993.259Zm5.124-2.725v-1.92h2.975V32h-4.078v6.398h1.103v-2.724h2.61v-.875h-2.61Z",
2215
+ fill: "#051942"
2213
2216
  }));
2214
2217
 
2215
- const SvgRemoveFile = ({
2218
+ const SvgListItemJpg = ({
2216
2219
  title,
2217
2220
  titleId,
2218
2221
  ...props
2219
2222
  }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2220
- width: "26",
2221
- height: "26",
2222
- viewBox: "0 0 26 26",
2223
+ width: "32",
2224
+ height: "42",
2225
+ viewBox: "0 0 32 42",
2223
2226
  fill: "none",
2224
2227
  xmlns: "http://www.w3.org/2000/svg",
2225
2228
  "aria-labelledby": titleId
2226
2229
  }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2227
2230
  id: titleId
2228
- }, title) : null, /*#__PURE__*/React__namespace.createElement("rect", {
2229
- width: 26,
2230
- height: 26,
2231
- rx: 6,
2232
- fill: "#FBFBFB"
2233
- }), /*#__PURE__*/React__namespace.createElement("path", {
2234
- d: "M13 4c.822 0 1.611.296 2.206.826s.95 1.255.99 2.024l.005.15h4c.204 0 .4.073.548.205.148.13.238.31.25.501a.72.72 0 0 1-.185.525.817.817 0 0 1-.52.264l-.093.005h-.68l-.943 10.915a2.75 2.75 0 0 1-.957 1.84 3.114 3.114 0 0 1-2.034.745h-5.173c-.754 0-1.48-.266-2.034-.745a2.75 2.75 0 0 1-.957-1.84L6.478 8.5H5.8a.831.831 0 0 1-.531-.19.736.736 0 0 1-.263-.472L5 7.75c0-.184.072-.361.202-.498a.818.818 0 0 1 .504-.247L5.8 7h4c0-.796.337-1.559.938-2.121A3.312 3.312 0 0 1 13 4Zm-1.8 6.938a.623.623 0 0 0-.394.138.553.553 0 0 0-.2.348l-.006.076v6l.006.076c.02.135.09.258.2.348.11.09.25.138.394.138.145 0 .285-.049.395-.138.109-.09.18-.213.2-.348l.005-.076v-6l-.005-.076a.553.553 0 0 0-.2-.348.624.624 0 0 0-.395-.139Zm3.6 0a.623.623 0 0 0-.394.138.553.553 0 0 0-.2.348l-.005.076v6l.005.076c.02.135.091.258.2.348.11.09.25.138.394.138.145 0 .286-.049.395-.138.11-.09.18-.213.2-.348l.006-.076v-6l-.006-.076a.553.553 0 0 0-.2-.348.624.624 0 0 0-.395-.139ZM13 5.5a1.66 1.66 0 0 0-1.088.4c-.296.257-.477.61-.508.987L11.4 7h3.2l-.003-.112a1.465 1.465 0 0 0-.508-.988A1.66 1.66 0 0 0 13 5.5Z",
2235
- fill: "#00236A"
2231
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2232
+ fillRule: "evenodd",
2233
+ clipRule: "evenodd",
2234
+ d: "M31.862 10.64c.007.01.015.02.022.027l.116.108v28.328c0 .768-.306 1.505-.852 2.049a2.917 2.917 0 0 1-2.057.848H2.909a2.917 2.917 0 0 1-2.057-.848A2.891 2.891 0 0 1 0 39.103V2.897C0 2.128.306 1.392.852.848A2.917 2.917 0 0 1 2.909 0h18.27l.108.116.03.025.028.026.025.02.026.023L31.79 10.558c.02.018.037.037.052.058l.02.025Zm-1.743 29.486a1.45 1.45 0 0 0 .427-1.022v-8.77H13.95a.716.716 0 0 1-.546-.246l-1.963-2.238H1.455v11.254c.001.383.155.751.427 1.022.273.272.642.425 1.027.426h26.182a1.463 1.463 0 0 0 1.027-.426ZM4.364 17.633c0 .4.324.724.724.724h21.825a.724.724 0 1 0 0-1.448H5.088c-.4 0-.724.324-.724.724Zm23.273 3.186c0-.4-.325-.724-.724-.724H15.48a.724.724 0 0 0 0 1.448h11.432c.4 0 .724-.324.724-.724Zm-.724-5.641a.724.724 0 1 0 0-1.449H5.088a.724.724 0 1 0 0 1.449h21.825Zm-22.55-3.91c0 .4.325.723.725.723H16.52a.724.724 0 0 0 0-1.448H5.088c-.4 0-.724.324-.724.724Zm17.672-1.345c.272.27.642.423 1.027.425h6.458l-7.913-7.879V8.9c.002.384.155.752.428 1.024Zm2.071 27.737v-2.443h-2.43v.822h1.331v1.27a1.19 1.19 0 0 1-.224.175c-.094.059-.221.11-.382.154a2.579 2.579 0 0 1-.62.062c-.258 0-.489-.047-.694-.14a1.408 1.408 0 0 1-.523-.427 2.062 2.062 0 0 1-.325-.69 3.614 3.614 0 0 1-.11-.936v-.453c0-.346.032-.653.097-.923.064-.27.16-.498.285-.685.13-.188.29-.33.484-.426.193-.097.417-.146.672-.146.296 0 .536.052.72.154.188.1.332.238.431.413.103.176.172.375.207.598h1.081a2.633 2.633 0 0 0-.356-1.055 1.913 1.913 0 0 0-.8-.72c-.343-.176-.776-.264-1.3-.264-.41 0-.778.069-1.104.206a2.204 2.204 0 0 0-.826.598 2.742 2.742 0 0 0-.527.967c-.12.378-.18.809-.18 1.292v.444c0 .486.066.92.197 1.3.132.378.318.7.559.963.243.264.531.464.865.602.334.135.702.202 1.103.202.472 0 .866-.051 1.182-.154.317-.102.57-.224.76-.364a2.13 2.13 0 0 0 .427-.396Zm-13.03-1.094v-4.478h1.099v4.478c0 .425-.091.786-.273 1.085-.181.3-.429.528-.742.686-.314.158-.67.237-1.068.237-.407 0-.77-.069-1.086-.206a1.622 1.622 0 0 1-.738-.633C8.09 37.45 8 37.09 8 36.654h1.107c0 .252.04.455.12.61a.755.755 0 0 0 .342.335c.15.067.324.1.523.1a.99.99 0 0 0 .505-.127.909.909 0 0 0 .352-.382c.085-.17.127-.378.127-.624Zm4.799-.466h-1.327v2.386h-1.103v-6.398h2.43c.495 0 .916.088 1.261.264.349.172.614.413.796.72.181.305.272.654.272 1.046 0 .413-.09.768-.272 1.064a1.753 1.753 0 0 1-.796.68c-.345.159-.766.238-1.261.238Zm-1.327-3.133v2.259h1.327c.29 0 .524-.047.703-.141a.876.876 0 0 0 .391-.387c.085-.167.128-.357.128-.571 0-.202-.043-.391-.128-.567a.97.97 0 0 0-.39-.43c-.18-.109-.414-.163-.704-.163h-1.327Z",
2235
+ fill: "#051942"
2236
2236
  }));
2237
2237
 
2238
- const SvgListItemPdf = ({
2238
+ const SvgListItemPng = ({
2239
2239
  title,
2240
2240
  titleId,
2241
2241
  ...props
@@ -2251,18 +2251,18 @@ const SvgListItemPdf = ({
2251
2251
  }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2252
2252
  fillRule: "evenodd",
2253
2253
  clipRule: "evenodd",
2254
- d: "M31.862 10.64c.007.01.015.02.022.027l.116.108v28.328c0 .768-.306 1.505-.852 2.049a2.917 2.917 0 0 1-2.057.848H2.909a2.917 2.917 0 0 1-2.057-.848A2.891 2.891 0 0 1 0 39.103V2.897C0 2.128.306 1.392.852.848A2.917 2.917 0 0 1 2.909 0h18.27l.108.116.03.025.028.026.025.02.026.023L31.79 10.558c.02.018.037.037.052.058l.02.025Zm-1.743 29.486a1.45 1.45 0 0 0 .427-1.022v-8.77H13.95a.716.716 0 0 1-.546-.246l-1.963-2.238H1.455v11.254c.001.383.155.751.427 1.022.273.272.642.425 1.027.426h26.182a1.463 1.463 0 0 0 1.027-.426ZM4.364 17.633c0 .4.324.724.724.724h21.825a.724.724 0 1 0 0-1.448H5.088c-.4 0-.724.324-.724.724Zm23.273 3.186c0-.4-.325-.724-.724-.724H15.48a.724.724 0 0 0 0 1.448h11.432c.4 0 .724-.324.724-.724Zm-.724-5.641a.724.724 0 1 0 0-1.449H5.088a.724.724 0 1 0 0 1.449h21.825Zm-22.55-3.91c0 .4.325.723.725.723H16.52a.724.724 0 0 0 0-1.448H5.088c-.4 0-.724.324-.724.724Zm17.672-1.345c.272.27.642.423 1.027.425h6.458l-7.913-7.879V8.9c.002.384.155.752.428 1.024ZM10.43 36.013H9.103v2.385H8V32h2.43c.495 0 .916.088 1.261.264.349.172.614.413.796.72.181.305.272.654.272 1.046 0 .413-.09.768-.272 1.064a1.754 1.754 0 0 1-.796.68c-.345.16-.766.238-1.26.238Zm-1.327-3.134v2.259h1.327c.29 0 .525-.047.703-.14a.877.877 0 0 0 .391-.388c.085-.167.128-.357.128-.57 0-.203-.043-.392-.128-.568a.971.971 0 0 0-.39-.43c-.18-.109-.414-.163-.704-.163H9.103Zm6.504 5.52h-1.859V32H15.646c.425 0 .813.072 1.165.215.352.141.655.345.91.611.258.267.455.586.593.958.138.372.206.788.206 1.248v.339c0 .46-.068.876-.206 1.248a2.714 2.714 0 0 1-.593.958 2.662 2.662 0 0 1-.923.61c-.355.141-.752.211-1.191.211Zm0-.875h-.756v-4.645h.795c.285 0 .535.047.752.14.22.094.404.232.554.414a1.8 1.8 0 0 1 .342.672c.08.267.12.573.12.918v.348c0 .445-.07.829-.208 1.151-.134.322-.336.57-.606.743-.267.172-.598.259-.993.259Zm5.124-2.725v-1.92h2.975V32h-4.078v6.398h1.103v-2.724h2.61v-.875h-2.61Z",
2254
+ d: "m31.873 10.655-.011-.014c-.007-.01-.014-.018-.021-.025a.356.356 0 0 0-.052-.058L21.396.21 21.37.188l-.025-.021a.476.476 0 0 0-.029-.025l-.029-.026L21.178 0H2.91C2.138 0 1.398.305.852.848A2.891 2.891 0 0 0 0 2.897v36.206c0 .768.306 1.505.852 2.049A2.917 2.917 0 0 0 2.909 42h26.182c.771 0 1.511-.305 2.057-.848.546-.544.852-1.28.852-2.049V10.775l-.116-.108a.21.21 0 0 1-.01-.012Zm-1.327 28.449a1.45 1.45 0 0 1-.427 1.022 1.463 1.463 0 0 1-1.028.426H2.91a1.463 1.463 0 0 1-1.027-.426 1.45 1.45 0 0 1-.427-1.022V27.85h9.986l1.963 2.238a.716.716 0 0 0 .546.246h16.596v8.77ZM5.088 18.357a.724.724 0 1 1 0-1.448h21.825a.724.724 0 1 1 0 1.448H5.088Zm21.825 1.738a.724.724 0 0 1 0 1.448H15.48a.724.724 0 0 1 0-1.448h11.432Zm.724-5.641c0 .4-.325.724-.724.724H5.088a.724.724 0 1 1 0-1.449h21.825c.4 0 .724.325.724.725ZM5.088 11.99a.724.724 0 1 1 0-1.448H16.52a.724.724 0 0 1 0 1.449H5.088Zm17.974-1.643A1.451 1.451 0 0 1 21.607 8.9V2.47l7.913 7.878h-6.458ZM9.103 36.012h1.327c.495 0 .916-.079 1.261-.237.349-.158.614-.385.796-.681.181-.296.272-.65.272-1.064 0-.392-.09-.74-.272-1.046a1.85 1.85 0 0 0-.796-.72c-.345-.176-.766-.264-1.26-.264H8v6.398h1.103v-2.386Zm0-.874v-2.26h1.327c.29 0 .525.055.703.163.179.109.31.253.391.431.085.176.128.365.128.567 0 .214-.043.404-.128.571a.877.877 0 0 1-.39.387c-.18.094-.414.14-.704.14H9.103ZM13.7 32h1.09l3.292 5.106a63.566 63.566 0 0 1-.044-1.379V32h.956v6.398h-1.1l-3.303-4.9.002.044c.012.134.02.279.027.435l.018.468c.006.163.009.327.009.49v3.463H13.7V32Zm11.393 5.66v-2.443h-2.43v.822h1.332v1.27a1.19 1.19 0 0 1-.225.175c-.093.059-.22.11-.382.154a2.578 2.578 0 0 1-.62.062c-.257 0-.489-.047-.694-.14a1.408 1.408 0 0 1-.523-.427 2.062 2.062 0 0 1-.325-.69 3.614 3.614 0 0 1-.11-.936v-.453c0-.346.032-.653.097-.923.064-.27.16-.498.285-.685.13-.188.29-.33.484-.426.193-.097.417-.146.672-.146.296 0 .536.052.721.154.188.1.331.238.43.413a1.7 1.7 0 0 1 .207.598h1.081a2.633 2.633 0 0 0-.356-1.055 1.913 1.913 0 0 0-.8-.72c-.342-.176-.776-.264-1.3-.264-.41 0-.778.069-1.103.206a2.204 2.204 0 0 0-.826.598 2.742 2.742 0 0 0-.528.967c-.12.378-.18.809-.18 1.292v.444c0 .486.066.92.198 1.3.132.378.318.7.558.963.243.264.532.464.866.602.334.135.701.202 1.103.202.471 0 .865-.051 1.182-.154.316-.102.57-.224.76-.364.193-.144.335-.276.426-.396Z",
2255
2255
  fill: "#051942"
2256
2256
  }));
2257
2257
 
2258
- const SvgListItemJpg = ({
2258
+ const SvgListItemJpeg = ({
2259
2259
  title,
2260
2260
  titleId,
2261
2261
  ...props
2262
2262
  }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2263
- width: "32",
2263
+ width: "33",
2264
2264
  height: "42",
2265
- viewBox: "0 0 32 42",
2265
+ viewBox: "0 0 33 42",
2266
2266
  fill: "none",
2267
2267
  xmlns: "http://www.w3.org/2000/svg",
2268
2268
  "aria-labelledby": titleId
@@ -2271,7 +2271,7 @@ const SvgListItemJpg = ({
2271
2271
  }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2272
2272
  fillRule: "evenodd",
2273
2273
  clipRule: "evenodd",
2274
- d: "M31.862 10.64c.007.01.015.02.022.027l.116.108v28.328c0 .768-.306 1.505-.852 2.049a2.917 2.917 0 0 1-2.057.848H2.909a2.917 2.917 0 0 1-2.057-.848A2.891 2.891 0 0 1 0 39.103V2.897C0 2.128.306 1.392.852.848A2.917 2.917 0 0 1 2.909 0h18.27l.108.116.03.025.028.026.025.02.026.023L31.79 10.558c.02.018.037.037.052.058l.02.025Zm-1.743 29.486a1.45 1.45 0 0 0 .427-1.022v-8.77H13.95a.716.716 0 0 1-.546-.246l-1.963-2.238H1.455v11.254c.001.383.155.751.427 1.022.273.272.642.425 1.027.426h26.182a1.463 1.463 0 0 0 1.027-.426ZM4.364 17.633c0 .4.324.724.724.724h21.825a.724.724 0 1 0 0-1.448H5.088c-.4 0-.724.324-.724.724Zm23.273 3.186c0-.4-.325-.724-.724-.724H15.48a.724.724 0 0 0 0 1.448h11.432c.4 0 .724-.324.724-.724Zm-.724-5.641a.724.724 0 1 0 0-1.449H5.088a.724.724 0 1 0 0 1.449h21.825Zm-22.55-3.91c0 .4.325.723.725.723H16.52a.724.724 0 0 0 0-1.448H5.088c-.4 0-.724.324-.724.724Zm17.672-1.345c.272.27.642.423 1.027.425h6.458l-7.913-7.879V8.9c.002.384.155.752.428 1.024Zm2.071 27.737v-2.443h-2.43v.822h1.331v1.27a1.19 1.19 0 0 1-.224.175c-.094.059-.221.11-.382.154a2.579 2.579 0 0 1-.62.062c-.258 0-.489-.047-.694-.14a1.408 1.408 0 0 1-.523-.427 2.062 2.062 0 0 1-.325-.69 3.614 3.614 0 0 1-.11-.936v-.453c0-.346.032-.653.097-.923.064-.27.16-.498.285-.685.13-.188.29-.33.484-.426.193-.097.417-.146.672-.146.296 0 .536.052.72.154.188.1.332.238.431.413.103.176.172.375.207.598h1.081a2.633 2.633 0 0 0-.356-1.055 1.913 1.913 0 0 0-.8-.72c-.343-.176-.776-.264-1.3-.264-.41 0-.778.069-1.104.206a2.204 2.204 0 0 0-.826.598 2.742 2.742 0 0 0-.527.967c-.12.378-.18.809-.18 1.292v.444c0 .486.066.92.197 1.3.132.378.318.7.559.963.243.264.531.464.865.602.334.135.702.202 1.103.202.472 0 .866-.051 1.182-.154.317-.102.57-.224.76-.364a2.13 2.13 0 0 0 .427-.396Zm-13.03-1.094v-4.478h1.099v4.478c0 .425-.091.786-.273 1.085-.181.3-.429.528-.742.686-.314.158-.67.237-1.068.237-.407 0-.77-.069-1.086-.206a1.622 1.622 0 0 1-.738-.633C8.09 37.45 8 37.09 8 36.654h1.107c0 .252.04.455.12.61a.755.755 0 0 0 .342.335c.15.067.324.1.523.1a.99.99 0 0 0 .505-.127.909.909 0 0 0 .352-.382c.085-.17.127-.378.127-.624Zm4.799-.466h-1.327v2.386h-1.103v-6.398h2.43c.495 0 .916.088 1.261.264.349.172.614.413.796.72.181.305.272.654.272 1.046 0 .413-.09.768-.272 1.064a1.753 1.753 0 0 1-.796.68c-.345.159-.766.238-1.261.238Zm-1.327-3.133v2.259h1.327c.29 0 .524-.047.703-.141a.876.876 0 0 0 .391-.387c.085-.167.128-.357.128-.571 0-.202-.043-.391-.128-.567a.97.97 0 0 0-.39-.43c-.18-.109-.414-.163-.704-.163h-1.327Z",
2274
+ d: "m32.384 10.667-.022-.026-.021-.025a.356.356 0 0 0-.052-.058L21.896.21 21.87.188l-.025-.021-.029-.026a.477.477 0 0 1-.029-.025L21.678 0H3.41c-.771 0-1.511.305-2.057.848A2.891 2.891 0 0 0 .5 2.897v36.206c0 .768.306 1.505.852 2.049A2.917 2.917 0 0 0 3.409 42h26.182c.771 0 1.511-.305 2.057-.848.546-.544.852-1.28.852-2.049V10.775l-.116-.108Zm-1.338 28.437a1.45 1.45 0 0 1-.427 1.022 1.463 1.463 0 0 1-1.028.426H3.41a1.463 1.463 0 0 1-1.027-.426 1.45 1.45 0 0 1-.427-1.022V27.85h9.986l1.963 2.238a.716.716 0 0 0 .546.246h16.596v8.77ZM5.588 18.357a.724.724 0 1 1 0-1.448h21.825a.724.724 0 1 1 0 1.448H5.588Zm21.825 1.738a.724.724 0 0 1 0 1.448H15.98a.724.724 0 0 1 0-1.448h11.432Zm.724-5.641c0 .4-.325.724-.724.724H5.588a.724.724 0 1 1 0-1.449h21.825c.4 0 .724.325.724.725ZM5.588 11.99a.724.724 0 1 1 0-1.448H17.02a.724.724 0 0 1 0 1.449H5.588Zm17.974-1.643A1.451 1.451 0 0 1 22.107 8.9V2.47l7.913 7.878h-6.458ZM8.576 32.088v4.478c0 .246-.042.454-.127.624a.91.91 0 0 1-.352.382.99.99 0 0 1-.505.128c-.2 0-.374-.034-.523-.101a.755.755 0 0 1-.343-.334c-.079-.156-.119-.36-.119-.611H5.5c0 .436.09.797.268 1.08.179.285.425.496.738.634.317.137.679.206 1.086.206.398 0 .754-.079 1.068-.237.313-.158.56-.387.742-.686.182-.299.273-.66.273-1.085v-4.478H8.576Zm3.472 4.012h1.327c.495 0 .915-.079 1.261-.237.349-.158.614-.386.796-.681.181-.296.272-.65.272-1.064 0-.392-.09-.741-.272-1.046a1.849 1.849 0 0 0-.796-.72c-.345-.176-.766-.264-1.261-.264h-2.43v6.398h1.103V36.1Zm0-.874v-2.26h1.327c.29 0 .524.055.703.163a.97.97 0 0 1 .391.431c.085.176.128.365.128.567 0 .214-.043.404-.128.571a.876.876 0 0 1-.39.387c-.18.094-.414.14-.704.14h-1.327Zm14.545.087v2.444c-.09.12-.233.252-.426.395-.19.141-.444.263-.76.365-.317.103-.71.154-1.182.154-.402 0-.77-.068-1.103-.202a2.415 2.415 0 0 1-.866-.602 2.755 2.755 0 0 1-.558-.963 3.964 3.964 0 0 1-.198-1.3v-.444c0-.484.06-.914.18-1.292.123-.381.299-.703.527-.967.229-.264.504-.463.827-.598a2.805 2.805 0 0 1 1.103-.206c.524 0 .958.088 1.3.263.346.173.613.413.8.721.188.308.307.66.356 1.055h-1.08a1.7 1.7 0 0 0-.207-.598 1.046 1.046 0 0 0-.431-.413c-.185-.102-.425-.154-.72-.154-.256 0-.48.049-.673.145a1.271 1.271 0 0 0-.483.426 2.093 2.093 0 0 0-.286.686c-.065.27-.097.577-.097.923v.452c0 .352.037.664.11.937.076.272.185.502.325.69.144.187.318.33.523.426.205.093.437.14.695.14.252 0 .458-.02.62-.061.16-.044.288-.095.381-.154.097-.062.172-.12.225-.176v-1.27h-1.332v-.822h2.43ZM16.7 32.085h3.791v.884h-2.78v1.754h2.618v.875H17.71v2.033h2.781v.884h-3.79v-6.43Z",
2275
2275
  fill: "#051942"
2276
2276
  }));
2277
2277
 
@@ -2293,6 +2293,206 @@ const SvgListItemDelete = ({
2293
2293
  fill: "#051942"
2294
2294
  }));
2295
2295
 
2296
+ const FileItem = /*#__PURE__*/React__default["default"].memo(({
2297
+ size,
2298
+ name,
2299
+ uuid,
2300
+ check,
2301
+ radius,
2302
+ status,
2303
+ removeFile,
2304
+ fileFormat,
2305
+ progressColor,
2306
+ listItemHeight,
2307
+ listItemPadding,
2308
+ progressFontSize,
2309
+ listItemErrorSize,
2310
+ listItemErrorColor,
2311
+ progressTrackColor,
2312
+ progressFailedColor,
2313
+ progressSuccessColor,
2314
+ progressLoadingColor,
2315
+ listItemBackgroundColor,
2316
+ listItemBackgroundErrorColor
2317
+ }) => {
2318
+ const [i, setI] = React.useState(_ => _);
2319
+ const [t, setT] = React.useState(_ => _);
2320
+ const [progress, setProgress] = React.useState(7);
2321
+ const handleRemoveItem = id => {
2322
+ removeFile(id);
2323
+ };
2324
+ React.useEffect(() => {
2325
+ let time = Math.floor(Math.random() * (1100 - 900 + 1)) + 900;
2326
+ let fileSizeInMB = Math.round(size / (1024 * 1024));
2327
+ if (fileSizeInMB > 5) {
2328
+ const times = [Math.floor(Math.random() * (1700 - 1300 + 1)) + 1300, Math.floor(Math.random() * (3200 - 2800 + 1)) + 2800, Math.floor(Math.random() * (4700 - 4300 + 1)) + 4300, Math.floor(Math.random() * (6200 - 5800 + 1)) + 5800, Math.floor(Math.random() * (7700 - 7300 + 1)) + 7300];
2329
+ const index = Math.min(Math.floor((size - 1) / 15), times.length - 1);
2330
+ time = times[index];
2331
+ }
2332
+ setI(setInterval(() => {
2333
+ setProgress(prev => {
2334
+ return prev += 7;
2335
+ });
2336
+ }, time));
2337
+ return () => {
2338
+ setI(_ => _);
2339
+ clearTimeout(t);
2340
+ clearInterval(i);
2341
+ };
2342
+ }, []);
2343
+ React.useEffect(() => {
2344
+ if (progress > 84) {
2345
+ clearInterval(i);
2346
+ }
2347
+ }, [progress]);
2348
+ React.useEffect(() => {
2349
+ if (status === 'success') {
2350
+ setProgress(100);
2351
+ clearInterval(i);
2352
+ }
2353
+ if (status === 'failed') {
2354
+ setProgress(0);
2355
+ clearInterval(i);
2356
+ }
2357
+ }, [status]);
2358
+ React.useEffect(() => {
2359
+ if (check !== '') {
2360
+ setT(setTimeout(() => {
2361
+ removeFile(uuid);
2362
+ }, 3500));
2363
+ }
2364
+ }, [check]);
2365
+ return /*#__PURE__*/React__default["default"].createElement("div", {
2366
+ style: {
2367
+ width: '100%',
2368
+ display: 'flex',
2369
+ marginTop: '6px',
2370
+ alignItems: 'center',
2371
+ borderRadius: radius,
2372
+ height: listItemHeight,
2373
+ boxSizing: 'border-box',
2374
+ padding: listItemPadding,
2375
+ flexDirection: check !== '' ? 'column' : 'row',
2376
+ justifyContent: check !== '' ? 'space-around' : 'space-between',
2377
+ backgroundColor: check !== '' ? listItemBackgroundErrorColor : listItemBackgroundColor
2378
+ }
2379
+ }, check !== '' ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("p", {
2380
+ style: {
2381
+ margin: '0px',
2382
+ color: listItemErrorColor,
2383
+ fontSize: listItemErrorSize
2384
+ }
2385
+ }, name), /*#__PURE__*/React__default["default"].createElement("p", {
2386
+ style: {
2387
+ margin: '0px',
2388
+ color: listItemErrorColor,
2389
+ fontSize: listItemErrorSize
2390
+ }
2391
+ }, check)) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
2392
+ style: {
2393
+ width: '32px'
2394
+ }
2395
+ }, fileFormat === 'pdf' ? /*#__PURE__*/React__default["default"].createElement(SvgListItemPdf, null) : fileFormat === 'jpg' ? /*#__PURE__*/React__default["default"].createElement(SvgListItemJpg, null) : fileFormat === 'png' ? /*#__PURE__*/React__default["default"].createElement(SvgListItemPng, null) : fileFormat === 'jpeg' ? /*#__PURE__*/React__default["default"].createElement(SvgListItemJpeg, null) : ''), /*#__PURE__*/React__default["default"].createElement("div", {
2396
+ style: {
2397
+ position: 'relative',
2398
+ display: 'flex',
2399
+ height: '40px',
2400
+ margin: '0px 14px',
2401
+ alignItems: 'flex-end',
2402
+ width: 'calc(100% - 82px)'
2403
+ }
2404
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
2405
+ style: {
2406
+ width: '100%',
2407
+ height: '100%',
2408
+ display: 'flex',
2409
+ paddingTop: '5px',
2410
+ color: progressColor,
2411
+ boxSizing: 'border-box',
2412
+ alignItems: 'flex-start',
2413
+ fontSize: progressFontSize,
2414
+ justifyContent: 'space-between'
2415
+ }
2416
+ }, /*#__PURE__*/React__default["default"].createElement("p", {
2417
+ style: {
2418
+ margin: '0px',
2419
+ overflow: 'hidden',
2420
+ whiteSpace: 'nowrap',
2421
+ textOverflow: 'ellipsis',
2422
+ maxWidth: 'calc(100% - 56px)'
2423
+ }
2424
+ }, name), /*#__PURE__*/React__default["default"].createElement("span", null, progress, " %")), /*#__PURE__*/React__default["default"].createElement("div", {
2425
+ style: {
2426
+ position: 'absolute',
2427
+ left: '0px',
2428
+ bottom: '5px',
2429
+ width: '100%',
2430
+ height: '4px',
2431
+ borderRadius: '10px',
2432
+ backgroundColor: progressTrackColor
2433
+ }
2434
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
2435
+ style: {
2436
+ height: '100%',
2437
+ borderRadius: '10px',
2438
+ width: status === 'failed' ? '100%' : progress + '%',
2439
+ backgroundColor: status === 'success' ? progressSuccessColor : status === 'failed' ? progressFailedColor : progressLoadingColor
2440
+ }
2441
+ }))), /*#__PURE__*/React__default["default"].createElement("div", {
2442
+ style: {
2443
+ width: '22px',
2444
+ cursor: 'pointer'
2445
+ },
2446
+ onClick: () => handleRemoveItem(uuid)
2447
+ }, /*#__PURE__*/React__default["default"].createElement(SvgListItemDelete, null))));
2448
+ });
2449
+
2450
+ const SvgUpload = ({
2451
+ title,
2452
+ titleId,
2453
+ ...props
2454
+ }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2455
+ width: "51",
2456
+ height: "35",
2457
+ viewBox: "0 0 51 35",
2458
+ fill: "none",
2459
+ xmlns: "http://www.w3.org/2000/svg",
2460
+ "aria-labelledby": titleId
2461
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2462
+ id: titleId
2463
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2464
+ d: "M41.54 11.842h-.017c-.23-3.225-2.902-5.772-6.167-5.772-1.08 0-2.095.28-2.979.77C30.267 2.774 26.041 0 21.167 0 14.318 0 8.742 5.483 8.534 12.326 3.758 12.708 0 16.726 0 21.63c0 5.155 4.153 9.334 9.277 9.334h22.625a10.987 10.987 0 0 1-.888-4.334c0-6.059 4.899-10.987 10.918-10.987 3.773 0 7.106 1.938 9.068 4.875-.444-4.864-4.508-8.675-9.46-8.675ZM15.654 6.975c-.072.06-.144.12-.211.185-.266.259-.512.53-.705.849-.741 1.218-.882 2.523-.72 3.927.156 1.35-1.942 1.334-2.095 0-.289-2.493.504-5.307 2.664-6.775 1.12-.763 2.164 1.052 1.067 1.814Zm-.022.015c-.047.035-.111.093 0 0Z",
2465
+ fill: "#D1D1D1"
2466
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2467
+ fillRule: "evenodd",
2468
+ clipRule: "evenodd",
2469
+ d: "M41.822 17.245c-4.864 0-8.822 3.982-8.822 8.878C33 31.018 36.958 35 41.822 35c4.864 0 8.822-3.982 8.822-8.877 0-4.896-3.959-8.878-8.822-8.878Zm-.536 13.005v-6.689l-3.067 3.22a.69.69 0 0 1-1.01 0 .777.777 0 0 1 0-1.06l4.286-4.5A.71.71 0 0 1 42 21a.684.684 0 0 1 .505.22l4.286 4.5a.777.777 0 0 1 0 1.06.69.69 0 0 1-1.01 0l-3.067-3.22v6.69c0 .414-.32.75-.714.75-.395 0-.714-.336-.714-.75Z",
2470
+ fill: "#0DA574"
2471
+ }));
2472
+
2473
+ const SvgRemoveFile = ({
2474
+ title,
2475
+ titleId,
2476
+ ...props
2477
+ }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2478
+ width: "26",
2479
+ height: "26",
2480
+ viewBox: "0 0 26 26",
2481
+ fill: "none",
2482
+ xmlns: "http://www.w3.org/2000/svg",
2483
+ "aria-labelledby": titleId
2484
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2485
+ id: titleId
2486
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("rect", {
2487
+ width: 26,
2488
+ height: 26,
2489
+ rx: 6,
2490
+ fill: "#FBFBFB"
2491
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2492
+ d: "M13 4c.822 0 1.611.296 2.206.826s.95 1.255.99 2.024l.005.15h4c.204 0 .4.073.548.205.148.13.238.31.25.501a.72.72 0 0 1-.185.525.817.817 0 0 1-.52.264l-.093.005h-.68l-.943 10.915a2.75 2.75 0 0 1-.957 1.84 3.114 3.114 0 0 1-2.034.745h-5.173c-.754 0-1.48-.266-2.034-.745a2.75 2.75 0 0 1-.957-1.84L6.478 8.5H5.8a.831.831 0 0 1-.531-.19.736.736 0 0 1-.263-.472L5 7.75c0-.184.072-.361.202-.498a.818.818 0 0 1 .504-.247L5.8 7h4c0-.796.337-1.559.938-2.121A3.312 3.312 0 0 1 13 4Zm-1.8 6.938a.623.623 0 0 0-.394.138.553.553 0 0 0-.2.348l-.006.076v6l.006.076c.02.135.09.258.2.348.11.09.25.138.394.138.145 0 .285-.049.395-.138.109-.09.18-.213.2-.348l.005-.076v-6l-.005-.076a.553.553 0 0 0-.2-.348.624.624 0 0 0-.395-.139Zm3.6 0a.623.623 0 0 0-.394.138.553.553 0 0 0-.2.348l-.005.076v6l.005.076c.02.135.091.258.2.348.11.09.25.138.394.138.145 0 .286-.049.395-.138.11-.09.18-.213.2-.348l.006-.076v-6l-.006-.076a.553.553 0 0 0-.2-.348.624.624 0 0 0-.395-.139ZM13 5.5a1.66 1.66 0 0 0-1.088.4c-.296.257-.477.61-.508.987L11.4 7h3.2l-.003-.112a1.465 1.465 0 0 0-.508-.988A1.66 1.66 0 0 0 13 5.5Z",
2493
+ fill: "#00236A"
2494
+ }));
2495
+
2296
2496
  const SvgDeleteComponent = ({
2297
2497
  title,
2298
2498
  titleId,
@@ -2319,6 +2519,7 @@ const SvgDeleteComponent = ({
2319
2519
  }));
2320
2520
 
2321
2521
  const NewFile = ({
2522
+ or,
2322
2523
  size,
2323
2524
  name,
2324
2525
  color,
@@ -2329,36 +2530,52 @@ const NewFile = ({
2329
2530
  radius,
2330
2531
  change,
2331
2532
  border,
2533
+ upload,
2332
2534
  maxSize,
2333
2535
  disabled,
2334
2536
  multiple,
2335
2537
  required,
2336
2538
  errorSize,
2337
2539
  labelSize,
2540
+ removeFile,
2338
2541
  labelColor,
2339
2542
  errorColor,
2340
2543
  filesArray,
2544
+ putFileHere,
2341
2545
  borderColor,
2342
2546
  uploadColor,
2343
2547
  defaultData,
2344
2548
  errorMessage,
2549
+ fileSizeText,
2550
+ progressColor,
2345
2551
  fileExtensions,
2552
+ listItemHeight,
2346
2553
  backgroundColor,
2347
2554
  deleteComponent,
2555
+ listItemPadding,
2556
+ progressFontSize,
2348
2557
  borderHoverColor,
2558
+ listItemErrorSize,
2349
2559
  progressTrackColor,
2560
+ fileAreaImageWidth,
2561
+ listItemErrorColor,
2350
2562
  labelRequiredColor,
2563
+ progressFailedColor,
2564
+ fileAreaImageHeight,
2565
+ progressSuccessColor,
2566
+ progressLoadingColor,
2351
2567
  hiddenBackgroundColor,
2352
2568
  extentionsRowMarginTop,
2353
- listItemBackgroundColor
2569
+ listItemBackgroundColor,
2570
+ listItemBackgroundErrorColor
2354
2571
  }) => {
2355
2572
  const ref = React.useRef(null);
2356
2573
  const inpRef = React.useRef(null);
2574
+ const memoizedItems = React.useMemo(() => filesArray, [filesArray]);
2357
2575
  const [error, setError] = React.useState('');
2358
- const [image, setImage] = React.useState('');
2359
- const [progress, setProgress] = React.useState(5);
2360
2576
  const [isHover, setIsHover] = React.useState(false);
2361
- const [multipleFiles, setMultipleFiles] = React.useState([]);
2577
+ const [singleFile, setSingleFile] = React.useState(null);
2578
+ const [image, setImage] = React.useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
2362
2579
  const configStyles = compereConfigs();
2363
2580
  const handleRemoveComponent = () => {
2364
2581
  const node = ReactDOM__default["default"].findDOMNode(ref.current);
@@ -2366,44 +2583,67 @@ const NewFile = ({
2366
2583
  parent.removeChild(node);
2367
2584
  };
2368
2585
  const handleRemoveFile = () => {
2369
- if (!multiple) {
2370
- setImage('');
2371
- onChange(null);
2372
- }
2586
+ setImage(null);
2587
+ removeFile(singleFile);
2373
2588
  };
2374
2589
  const handleChange = e => {
2375
2590
  const file = e.target.files;
2376
- if (file[0]) {
2377
- if (file[0].size <= maxSize * Math.pow(2, 20)) {
2378
- if (fileExtensions.includes(file[0].type.split('/')[1])) {
2379
- setError('');
2380
- if (multiple) {
2381
- change({
2382
- uuid: v4(),
2383
- file: file[0]
2384
- });
2591
+ if (multiple) {
2592
+ setError('');
2593
+ setImage(null);
2594
+ for (let ix = 0; ix < file.length; ix++) {
2595
+ if (file[ix]) {
2596
+ if (file[ix].size <= maxSize * Math.pow(2, 20)) {
2597
+ if (fileExtensions.includes(file[ix].type.split('/')[1])) {
2598
+ change({
2599
+ id: '',
2600
+ check: '',
2601
+ status: '',
2602
+ file: file[ix],
2603
+ uuid: v4()
2604
+ });
2605
+ } else {
2606
+ change({
2607
+ file: file[ix],
2608
+ uuid: v4(),
2609
+ check: 'ֆայլի սխալ ֆորմատ'
2610
+ });
2611
+ }
2385
2612
  } else {
2386
2613
  change({
2387
- file
2614
+ file: file[ix],
2615
+ uuid: v4(),
2616
+ check: 'առավելագույն ծավալ'
2388
2617
  });
2618
+ }
2619
+ }
2620
+ }
2621
+ if (file.length === 0 && memoizedItems.length === 0) {
2622
+ setError('Ֆայլը ընտրված չէ');
2623
+ }
2624
+ } else {
2625
+ if (file[0]) {
2626
+ if (file[0].size <= maxSize * Math.pow(2, 20)) {
2627
+ if (fileExtensions.includes(file[0].type.split('/')[1])) {
2628
+ setError('');
2629
+ change(file);
2630
+ setSingleFile(file);
2389
2631
  if (file[0].type === 'application/pdf') {
2390
2632
  setImage('pdf');
2391
2633
  } else {
2392
2634
  setImage(URL.createObjectURL(file[0]));
2393
2635
  }
2636
+ } else {
2637
+ setImage(null);
2638
+ setError('ֆայլի սխալ ֆորմատ');
2394
2639
  }
2395
2640
  } else {
2396
- setImage('');
2397
- setError('ֆայլի սխալ ֆորմատ');
2641
+ setImage(null);
2642
+ setError('առավելագույն ծավալ');
2398
2643
  }
2399
- } else {
2400
- setImage('');
2401
- setError('առավելագույն ծավալ');
2402
2644
  }
2403
- } else {
2404
- // TODO:
2405
- if (!multiple || multiple && filesArray && filesArray.length === 0) {
2406
- setImage('');
2645
+ if (file.length === 0) {
2646
+ setImage(null);
2407
2647
  setError('Ֆայլը ընտրված չէ');
2408
2648
  }
2409
2649
  }
@@ -2413,6 +2653,21 @@ const NewFile = ({
2413
2653
  inpRef.current.click();
2414
2654
  }
2415
2655
  };
2656
+ const handleDrop = e => {
2657
+ if (!disabled) {
2658
+ e.preventDefault();
2659
+ handleChange({
2660
+ target: {
2661
+ files: e.dataTransfer.files
2662
+ }
2663
+ });
2664
+ }
2665
+ };
2666
+ const handleDragOver = e => {
2667
+ if (!disabled) {
2668
+ e.preventDefault();
2669
+ }
2670
+ };
2416
2671
  const handleMouseEnter = () => {
2417
2672
  setIsHover(true);
2418
2673
  };
@@ -2424,17 +2679,18 @@ const NewFile = ({
2424
2679
  };
2425
2680
  React.useEffect(() => {
2426
2681
  if (!multiple && defaultData) {
2427
- if (defaultData.type && defaultData.type !== 'application/pdf') {
2428
- setImage(defaultData.url);
2429
- } else {
2430
- setImage('pdf');
2682
+ if (!defaultData.type) {
2683
+ alert('Please add type in defaultData prop');
2684
+ }
2685
+ if (!defaultData.url) {
2686
+ alert('Please add url in defaultData prop');
2431
2687
  }
2432
2688
  }
2433
2689
  if (multiple && !filesArray) {
2434
2690
  alert('In multiple mode, you should add filesArray prop for drawing files');
2435
2691
  }
2436
- if (filesArray) {
2437
- setMultipleFiles(filesArray);
2692
+ if (multiple) {
2693
+ setSingleFile(null);
2438
2694
  }
2439
2695
  }, [multiple, filesArray && filesArray.length, defaultData]);
2440
2696
  React.useEffect(() => {
@@ -2448,8 +2704,10 @@ const NewFile = ({
2448
2704
  if (!change) {
2449
2705
  alert('Please add change prop on File component');
2450
2706
  }
2451
- }, [change]);
2452
- console.log(multipleFiles, 'multipleFiles');
2707
+ if (!removeFile) {
2708
+ alert('Please add removeFile prop on File component');
2709
+ }
2710
+ }, [change, removeFile]);
2453
2711
  return /*#__PURE__*/React__default["default"].createElement("div", {
2454
2712
  ref: ref,
2455
2713
  style: {
@@ -2491,7 +2749,9 @@ const NewFile = ({
2491
2749
  backgroundColor: backgroundColor ? backgroundColor : configStyles.File.backgroundColor,
2492
2750
  borderColor: error ? errorColor ? errorColor : configStyles.File.errorColor : disabled ? borderColor ? borderColor : configStyles.File.borderColor : isHover ? borderHoverColor ? borderHoverColor : configStyles.File.borderHoverColor : borderColor ? borderColor : configStyles.File.borderColor
2493
2751
  },
2752
+ onDrop: handleDrop,
2494
2753
  onClick: handleClick,
2754
+ onDragOver: handleDragOver,
2495
2755
  onMouseEnter: handleMouseEnter,
2496
2756
  onMouseLeave: handleMouseLeave
2497
2757
  }, /*#__PURE__*/React__default["default"].createElement("input", {
@@ -2500,6 +2760,7 @@ const NewFile = ({
2500
2760
  type: "file",
2501
2761
  ref: inpRef,
2502
2762
  disabled: disabled,
2763
+ multiple: multiple,
2503
2764
  onChange: handleChange
2504
2765
  }), /*#__PURE__*/React__default["default"].createElement("div", {
2505
2766
  style: {
@@ -2514,21 +2775,26 @@ const NewFile = ({
2514
2775
  fontSize: size ? size : configStyles.File.size,
2515
2776
  fontWeight: weight ? weight : configStyles.File.weight
2516
2777
  }
2517
- }, !multiple && image ? image === 'pdf' ? /*#__PURE__*/React__default["default"].createElement(PDF, null) : /*#__PURE__*/React__default["default"].createElement("img", {
2778
+ }, !multiple && image ? image === 'pdf' ? /*#__PURE__*/React__default["default"].createElement(SvgPdf, null) : /*#__PURE__*/React__default["default"].createElement("img", {
2518
2779
  src: image,
2519
2780
  style: {
2520
- maxHeight: '100%'
2781
+ display: 'block',
2782
+ maxWidth: '100%',
2783
+ maxHeight: '95%',
2784
+ objectFit: 'contain',
2785
+ width: fileAreaImageWidth ? fileAreaImageWidth : configStyles.File.fileAreaImageWidth,
2786
+ height: fileAreaImageHeight ? fileAreaImageHeight : configStyles.File.fileAreaImageHeight
2521
2787
  },
2522
2788
  alt: "file preview"
2523
2789
  }) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement(SvgUpload, null)), /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("p", {
2524
2790
  style: {
2525
2791
  margin: '0px'
2526
2792
  }
2527
- }, "\u054F\u0565\u0572\u0561\u0564\u0580\u0565\u056C \u0586\u0561\u0575\u056C\u0568 \u0561\u0575\u057D\u057F\u0565\u0572", /*#__PURE__*/React__default["default"].createElement("br", null), "\u056F\u0561\u0574 ", /*#__PURE__*/React__default["default"].createElement("span", {
2793
+ }, putFileHere ? putFileHere : configStyles.File.putFileHere, /*#__PURE__*/React__default["default"].createElement("br", null), or ? or : configStyles.File.or, " ", /*#__PURE__*/React__default["default"].createElement("span", {
2528
2794
  style: {
2529
2795
  color: uploadColor ? uploadColor : configStyles.File.uploadColor
2530
2796
  }
2531
- }, "\u0532\u0565\u057C\u0576\u0565\u056C"))), /*#__PURE__*/React__default["default"].createElement("div", {
2797
+ }, upload ? upload : configStyles.File.upload))), /*#__PURE__*/React__default["default"].createElement("div", {
2532
2798
  style: {
2533
2799
  marginTop: extentionsRowMarginTop ? extentionsRowMarginTop : configStyles.File.extentionsRowMarginTop
2534
2800
  }
@@ -2536,7 +2802,7 @@ const NewFile = ({
2536
2802
  style: {
2537
2803
  margin: '0px'
2538
2804
  }
2539
- }, "\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", {
2805
+ }, fileSizeText ? fileSizeText : configStyles.File.fileSizeText, " ", maxSize, "\u0544\u0532 ( ", fileExtensions.toString().split(',').join(', '), " )")))), /*#__PURE__*/React__default["default"].createElement("div", {
2540
2806
  style: {
2541
2807
  position: 'absolute',
2542
2808
  top: '0px',
@@ -2566,62 +2832,34 @@ const NewFile = ({
2566
2832
  color: errorColor ? errorColor : configStyles.File.errorColor,
2567
2833
  fontSize: errorSize ? errorSize : configStyles.File.errorSize
2568
2834
  }
2569
- }, error) : '', multiple && multipleFiles && multipleFiles.length > 0 && multipleFiles.map((item, index) => {
2570
- return /*#__PURE__*/React__default["default"].createElement("div", {
2571
- key: `${item.file.name}_${index}`,
2572
- style: {
2573
- display: 'flex',
2574
- width: '100%',
2575
- height: '70px',
2576
- marginTop: '6px',
2577
- alignItems: 'center',
2578
- padding: '14px 20px',
2579
- boxSizing: 'border-box',
2580
- justifyContent: 'space-between',
2581
- borderRadius: radius ? radius : configStyles.File.radius,
2582
- backgroundColor: listItemBackgroundColor ? listItemBackgroundColor : configStyles.File.listItemBackgroundColor
2583
- }
2584
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2585
- style: {
2586
- width: '32px'
2587
- }
2588
- }, item.file.type.split('/')[1].toLowerCase() === 'pdf' ? /*#__PURE__*/React__default["default"].createElement(SvgListItemPdf, null) : item.file.type.split('/')[1].toLowerCase() === 'jpeg' ? /*#__PURE__*/React__default["default"].createElement(SvgListItemJpg, null) : ''), /*#__PURE__*/React__default["default"].createElement("div", {
2589
- style: {
2590
- position: 'relative',
2591
- display: 'flex',
2592
- height: '40px',
2593
- margin: '0px 14px',
2594
- alignItems: 'flex-end',
2595
- width: 'calc(100% - 82px)'
2596
- }
2597
- }, /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("p", {
2598
- className: "new"
2599
- }, item.file.name)), /*#__PURE__*/React__default["default"].createElement("div", {
2600
- style: {
2601
- position: 'absolute',
2602
- left: '0px',
2603
- bottom: '5px',
2604
- width: '100%',
2605
- height: '4px',
2606
- borderRadius: '10px',
2607
- backgroundColor: progressTrackColor ? progressTrackColor : configStyles.File.progressTrackColor
2608
- }
2609
- }, /*#__PURE__*/React__default["default"].createElement("div", {
2610
- style: {
2611
- width: progress + '%',
2612
- height: '100%',
2613
- borderRadius: '10px',
2614
- backgroundColor: 'green'
2615
- }
2616
- }))), /*#__PURE__*/React__default["default"].createElement("div", {
2617
- style: {
2618
- width: '22px',
2619
- cursor: 'pointer'
2620
- }
2621
- }, /*#__PURE__*/React__default["default"].createElement(SvgListItemDelete, null)));
2835
+ }, error) : '', multiple && memoizedItems && memoizedItems.length > 0 && memoizedItems.map(item => {
2836
+ return /*#__PURE__*/React__default["default"].createElement(FileItem, {
2837
+ key: item.uuid,
2838
+ uuid: item.uuid,
2839
+ check: item.check,
2840
+ status: item.status,
2841
+ size: item.file.size,
2842
+ name: item.file.name,
2843
+ removeFile: removeFile,
2844
+ radius: radius ? radius : configStyles.File.radius,
2845
+ fileFormat: item.file.type.split('/')[1].toLowerCase(),
2846
+ progressColor: progressColor ? progressColor : configStyles.File.progressColor,
2847
+ listItemHeight: listItemHeight ? listItemHeight : configStyles.File.listItemHeight,
2848
+ listItemPadding: listItemPadding ? listItemPadding : configStyles.File.listItemPadding,
2849
+ progressFontSize: progressFontSize ? progressFontSize : configStyles.File.progressFontSize,
2850
+ listItemErrorSize: listItemErrorSize ? listItemErrorSize : configStyles.File.listItemErrorSize,
2851
+ listItemErrorColor: listItemErrorColor ? listItemErrorColor : configStyles.File.listItemErrorColor,
2852
+ progressTrackColor: progressTrackColor ? progressTrackColor : configStyles.File.progressTrackColor,
2853
+ progressFailedColor: progressFailedColor ? progressFailedColor : configStyles.File.progressFailedColor,
2854
+ progressSuccessColor: progressSuccessColor ? progressSuccessColor : configStyles.File.progressSuccessColor,
2855
+ progressLoadingColor: progressLoadingColor ? progressLoadingColor : configStyles.File.progressLoadingColor,
2856
+ listItemBackgroundColor: listItemBackgroundColor ? listItemBackgroundColor : configStyles.File.listItemBackgroundColor,
2857
+ listItemBackgroundErrorColor: listItemBackgroundErrorColor ? listItemBackgroundErrorColor : configStyles.File.listItemBackgroundErrorColor
2858
+ });
2622
2859
  }));
2623
2860
  };
2624
2861
  NewFile.propTypes = {
2862
+ or: PropTypes__default["default"].string,
2625
2863
  size: PropTypes__default["default"].string,
2626
2864
  label: PropTypes__default["default"].string,
2627
2865
  width: PropTypes__default["default"].string,
@@ -2631,30 +2869,46 @@ NewFile.propTypes = {
2631
2869
  radius: PropTypes__default["default"].string,
2632
2870
  border: PropTypes__default["default"].string,
2633
2871
  required: PropTypes__default["default"].bool,
2872
+ upload: PropTypes__default["default"].string,
2634
2873
  weight: PropTypes__default["default"].number,
2635
2874
  maxSize: PropTypes__default["default"].number,
2636
2875
  errorSize: PropTypes__default["default"].string,
2637
2876
  labelSize: PropTypes__default["default"].string,
2638
2877
  labelColor: PropTypes__default["default"].string,
2639
2878
  errorColor: PropTypes__default["default"].string,
2879
+ putFileHere: PropTypes__default["default"].string,
2640
2880
  borderColor: PropTypes__default["default"].string,
2641
2881
  uploadColor: PropTypes__default["default"].string,
2642
2882
  defaultData: PropTypes__default["default"].object,
2643
2883
  errorMessage: PropTypes__default["default"].string,
2884
+ fileSizeText: PropTypes__default["default"].string,
2885
+ progressColor: PropTypes__default["default"].string,
2644
2886
  deleteComponent: PropTypes__default["default"].bool,
2887
+ listItemHeight: PropTypes__default["default"].string,
2645
2888
  backgroundColor: PropTypes__default["default"].string,
2646
2889
  change: PropTypes__default["default"].func.isRequired,
2890
+ listItemPadding: PropTypes__default["default"].string,
2891
+ progressFontSize: PropTypes__default["default"].string,
2647
2892
  borderHoverColor: PropTypes__default["default"].string,
2893
+ listItemErrorSize: PropTypes__default["default"].string,
2648
2894
  labelRequiredColor: PropTypes__default["default"].string,
2649
2895
  progressTrackColor: PropTypes__default["default"].string,
2896
+ fileAreaImageWidth: PropTypes__default["default"].string,
2897
+ listItemErrorColor: PropTypes__default["default"].string,
2898
+ removeFile: PropTypes__default["default"].func.isRequired,
2899
+ fileAreaImageHeight: PropTypes__default["default"].string,
2900
+ progressFailedColor: PropTypes__default["default"].string,
2901
+ progressSuccessColor: PropTypes__default["default"].string,
2902
+ progressLoadingColor: PropTypes__default["default"].string,
2650
2903
  hiddenBackgroundColor: PropTypes__default["default"].string,
2651
2904
  extentionsRowMarginTop: PropTypes__default["default"].string,
2652
2905
  listItemBackgroundColor: PropTypes__default["default"].string,
2906
+ listItemBackgroundErrorColor: PropTypes__default["default"].string,
2653
2907
  filesArray: PropTypes__default["default"].arrayOf(PropTypes__default["default"].object),
2654
2908
  fileExtensions: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
2655
2909
  };
2656
2910
  NewFile.defaultProps = {
2657
- maxSize: 5,
2911
+ maxSize: 50,
2658
2912
  fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
2659
2913
  };
2660
2914
 
@@ -2680,17 +2934,21 @@ const Textarea = ({
2680
2934
  boxSizing,
2681
2935
  maxLength,
2682
2936
  labelSize,
2937
+ errorSize,
2683
2938
  labelColor,
2939
+ errorColor,
2684
2940
  borderColor,
2685
2941
  labelWeight,
2686
2942
  placeholder,
2687
2943
  labelDisplay,
2944
+ errorMesaage,
2688
2945
  backgroundColor,
2689
2946
  borderFocusColor,
2690
2947
  borderHoverColor,
2691
2948
  showCharacterCount,
2692
2949
  labelRequiredColor
2693
2950
  }) => {
2951
+ const [error, setError] = React.useState('');
2694
2952
  const [isHover, setIsHover] = React.useState(false);
2695
2953
  const [isFocus, setIsFocus] = React.useState(false);
2696
2954
  const [innerValue, setInnerValue] = React.useState('');
@@ -2713,10 +2971,16 @@ const Textarea = ({
2713
2971
  if (maxLength) {
2714
2972
  if (value.length > maxLength) {
2715
2973
  onChange(value.substr(0, maxLength));
2974
+ setError('Նիշերի քանակը գերազանցում է');
2975
+ } else {
2976
+ setError('');
2716
2977
  }
2717
2978
  } else {
2718
2979
  if (value.length > configStyles.TEXTAREA.maxLength) {
2980
+ setError('Նիշերի քանակը գերազանցում է');
2719
2981
  onChange(value.substr(0, configStyles.TEXTAREA.maxLength));
2982
+ } else {
2983
+ setError('');
2720
2984
  }
2721
2985
  }
2722
2986
  };
@@ -2729,6 +2993,13 @@ const Textarea = ({
2729
2993
  }
2730
2994
  setInnerValue(value);
2731
2995
  }, [value, onChange]);
2996
+ React.useEffect(() => {
2997
+ if (errorMesaage) {
2998
+ setError(errorMesaage);
2999
+ } else {
3000
+ setError('');
3001
+ }
3002
+ }, [errorMesaage]);
2732
3003
  return /*#__PURE__*/React__default["default"].createElement("div", {
2733
3004
  style: {
2734
3005
  width: width ? width : configStyles.TEXTAREA.width
@@ -2771,7 +3042,7 @@ const Textarea = ({
2771
3042
  maxHeight: maxHeight ? maxHeight : configStyles.TEXTAREA.maxHeight,
2772
3043
  boxSizing: boxSizing ? boxSizing : configStyles.TEXTAREA.boxSizing,
2773
3044
  backgroundColor: backgroundColor ? backgroundColor : configStyles.TEXTAREA.backgroundColor,
2774
- borderColor: isFocus ? borderFocusColor ? borderFocusColor : configStyles.TEXTAREA.borderFocusColor : isHover ? borderHoverColor ? borderHoverColor : configStyles.TEXTAREA.borderHoverColor : borderColor ? borderColor : configStyles.TEXTAREA.borderColor,
3045
+ borderColor: error ? errorColor ? errorColor : configStyles.TEXTAREA.errorColor : isFocus ? borderFocusColor ? borderFocusColor : configStyles.TEXTAREA.borderFocusColor : isHover ? borderHoverColor ? borderHoverColor : configStyles.TEXTAREA.borderHoverColor : borderColor ? borderColor : configStyles.TEXTAREA.borderColor,
2775
3046
  resize: resize ? resize : configStyles.TEXTAREA.resize
2776
3047
  },
2777
3048
  value: innerValue,
@@ -2781,7 +3052,14 @@ const Textarea = ({
2781
3052
  placeholder: placeholder,
2782
3053
  onMouseEnter: handleMouseEnter,
2783
3054
  onMouseLeave: handleMouseLeave
2784
- }));
3055
+ }), error ? /*#__PURE__*/React__default["default"].createElement("span", {
3056
+ style: {
3057
+ marginTop: '6px',
3058
+ display: 'inline-block',
3059
+ fontSize: errorSize ? errorSize : configStyles.TEXTAREA.errorSize,
3060
+ color: errorColor ? errorColor : configStyles.TEXTAREA.errorColor
3061
+ }
3062
+ }, error) : '');
2785
3063
  };
2786
3064
  Textarea.propTypes = {
2787
3065
  size: PropTypes__default["default"].string,
@@ -3144,6 +3422,7 @@ Autocomplate.defaultProps = {
3144
3422
 
3145
3423
  const NewAutocomplete = ({
3146
3424
  label,
3425
+ change,
3147
3426
  options,
3148
3427
  getItem,
3149
3428
  required,
@@ -3217,6 +3496,7 @@ const NewAutocomplete = ({
3217
3496
  const [isHover, setIsHover] = React.useState(false);
3218
3497
  const [isFocus, setIsFocus] = React.useState(false);
3219
3498
  const [innerValue, setInnerValue] = React.useState('');
3499
+ const [innerOptions, setInnerOptions] = React.useState([]);
3220
3500
  const configStyles = compereConfigs();
3221
3501
  const showOption = styled.keyframes`
3222
3502
  100% {
@@ -3250,13 +3530,18 @@ const NewAutocomplete = ({
3250
3530
  const value = e.target.value;
3251
3531
  value.length > 0 ? setShow(true) : setShow(false);
3252
3532
  setInnerValue(value);
3533
+ if (value.length >= searchCount) {
3534
+ change(value);
3535
+ } else {
3536
+ change('');
3537
+ }
3253
3538
  };
3254
3539
  const handleClick = selectedValue => {
3255
3540
  setShow(false);
3256
3541
  getItem(selectedValue);
3257
- setInnerValue(selectedValue.value);
3542
+ setInnerValue(selectedValue.name);
3258
3543
  };
3259
- const optionList = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, show && options && options.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
3544
+ const optionList = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, show && innerOptions ? innerOptions.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
3260
3545
  style: {
3261
3546
  left: contentBottomLeft ? contentBottomLeft : configStyles.NEWAUTOCOMPLETE.contentBottomLeft,
3262
3547
  width: contentBottomWidth ? contentBottomWidth : configStyles.NEWAUTOCOMPLETE.contentBottomWidth,
@@ -3279,9 +3564,9 @@ const NewAutocomplete = ({
3279
3564
  maxHeight: contentBottomInnerMaxHeight ? contentBottomInnerMaxHeight : configStyles.NEWAUTOCOMPLETE.contentBottomInnerMaxHeight,
3280
3565
  flexDirection: contentBottomInnerDirection ? contentBottomInnerDirection : configStyles.NEWAUTOCOMPLETE.contentBottomInnerDirection
3281
3566
  }
3282
- }, innerValue.length >= searchCount ? options.filter(item => item.value.includes(innerValue)).length > 0 ? options.filter(item => item.value.includes(innerValue)).map((item, index) => {
3567
+ }, innerOptions.map(item => {
3283
3568
  return /*#__PURE__*/React__default["default"].createElement("p", {
3284
- key: `${item}_${index}`,
3569
+ key: item.id,
3285
3570
  onMouseEnter: handleRowMouseEnter,
3286
3571
  onMouseLeave: handleRowMouseLeave,
3287
3572
  onClick: () => handleClick(item),
@@ -3301,40 +3586,37 @@ const NewAutocomplete = ({
3301
3586
  marginBottom: contentBottomRowMarginBottom ? contentBottomRowMarginBottom : configStyles.NEWAUTOCOMPLETE.contentBottomRowMarginBottom,
3302
3587
  backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
3303
3588
  }
3304
- }, item.value);
3305
- }) : /*#__PURE__*/React__default["default"].createElement("p", {
3306
- style: {
3307
- color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
3308
- fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
3309
- height: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
3310
- padding: contentBottomRowPadding ? contentBottomRowPadding : configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
3311
- lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight
3312
- }
3313
- }, "\u0546\u0574\u0561\u0576 \u057F\u057E\u0575\u0561\u056C \u0561\u057C\u056F\u0561 \u0579\u0567") : /*#__PURE__*/React__default["default"].createElement("p", {
3589
+ }, item.name);
3590
+ }))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default["default"].createElement("p", {
3314
3591
  style: {
3592
+ margin: '0px',
3315
3593
  color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
3316
3594
  fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
3317
3595
  height: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
3318
3596
  padding: contentBottomRowPadding ? contentBottomRowPadding : configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
3319
- lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight
3597
+ lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
3598
+ backgroundColor: contentBottomBackgroundColor ? contentBottomBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomBackgroundColor
3320
3599
  }
3321
- }, innerValue.length < searchCount && `Լրացնել առնվազն ${searchCount} նիշ`))));
3600
+ }, innerValue.length >= searchCount ? 'Նման տվյալ առկա չէ' : `Լրացնել առնվազն ${searchCount} նիշ`) : '' : '');
3322
3601
  React.useEffect(() => {
3323
- if (!options) {
3324
- alert('Please add array of options');
3325
- }
3326
- if (options.length === 0) {
3327
- alert('Please fill options array');
3602
+ if (options === undefined) {
3603
+ alert('Please add options prop');
3328
3604
  }
3329
3605
  options && options.length > 0 && options.map(item => {
3330
- if (!item.hasOwnProperty('value')) {
3331
- alert('Please add value property in items of options array');
3606
+ if (!item.hasOwnProperty('name')) {
3607
+ alert('Please add name property in items of options array');
3332
3608
  }
3333
3609
  });
3334
3610
  if (!getItem) {
3335
3611
  alert('Please add getItem function for get choosen item from autocomplete');
3336
3612
  }
3337
- }, [options, getItem]);
3613
+ options && setInnerOptions(options);
3614
+ }, [options, options.length, getItem]);
3615
+ React.useEffect(() => {
3616
+ if (!change) {
3617
+ alert('Please add change prop on New Autocomplete component');
3618
+ }
3619
+ }, [change]);
3338
3620
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
3339
3621
  style: {
3340
3622
  color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
@@ -3342,6 +3624,7 @@ const NewAutocomplete = ({
3342
3624
  display: labelDisplay ? labelDisplay : configStyles.NEWAUTOCOMPLETE.labelDisplay,
3343
3625
  fontWeight: labelWeight ? labelWeight : configStyles.NEWAUTOCOMPLETE.labelWeight,
3344
3626
  lineHeight: labelLineHeight ? labelLineHeight : configStyles.NEWAUTOCOMPLETE.labelLineHeight,
3627
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
3345
3628
  marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.NEWAUTOCOMPLETE.labelMarginBottom,
3346
3629
  textTransform: labelTextTransform ? labelTextTransform : configStyles.NEWAUTOCOMPLETE.labelTextTransform
3347
3630
  }
@@ -3353,7 +3636,8 @@ const NewAutocomplete = ({
3353
3636
  style: {
3354
3637
  display: contentDisplay ? contentDisplay : configStyles.NEWAUTOCOMPLETE.contentDisplay,
3355
3638
  position: contentPosition ? contentPosition : configStyles.NEWAUTOCOMPLETE.contentPosition,
3356
- flexDirection: contentDirection ? contentDirection : configStyles.NEWAUTOCOMPLETE.contentDirection
3639
+ flexDirection: contentDirection ? contentDirection : configStyles.NEWAUTOCOMPLETE.contentDirection,
3640
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
3357
3641
  }
3358
3642
  }, /*#__PURE__*/React__default["default"].createElement("input", _extends({
3359
3643
  type: "text",
@@ -3362,11 +3646,12 @@ const NewAutocomplete = ({
3362
3646
  onBlur: handleBlur,
3363
3647
  onFocus: handleFocus,
3364
3648
  onInput: handleChange,
3365
- placeholder: placeHolder ? placeHolder : '',
3366
- autoComplete: autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete,
3367
3649
  onMouseEnter: handleMouseEnter,
3368
3650
  onMouseLeave: handleMouseLeave,
3651
+ placeholder: placeHolder ? placeHolder : '',
3652
+ autoComplete: autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete,
3369
3653
  style: {
3654
+ maxWidth: '100%',
3370
3655
  transition: 'all 240ms',
3371
3656
  cursor: disabled ? 'not-allowed' : 'auto',
3372
3657
  color: contentTopColor ? contentTopColor : configStyles.NEWAUTOCOMPLETE.contentTopColor,
@@ -3377,7 +3662,6 @@ const NewAutocomplete = ({
3377
3662
  display: contentTopDisplay ? contentTopDisplay : configStyles.NEWAUTOCOMPLETE.contentTopDisplay,
3378
3663
  fontWeight: contentTopWeight ? contentTopWeight : configStyles.NEWAUTOCOMPLETE.contentTopWeight,
3379
3664
  borderRadius: contentTopRadius ? contentTopRadius : configStyles.NEWAUTOCOMPLETE.contentTopRadius,
3380
- maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
3381
3665
  boxSizing: contentTopBoxSizing ? contentTopBoxSizing : configStyles.NEWAUTOCOMPLETE.contentTopBoxSizing,
3382
3666
  lineHeight: contentTopLineHeight ? contentTopLineHeight : configStyles.NEWAUTOCOMPLETE.contentTopLineHeight,
3383
3667
  flexDirection: contentTopDirection ? contentTopDirection : configStyles.NEWAUTOCOMPLETE.contentTopDirection,
@@ -3385,8 +3669,11 @@ const NewAutocomplete = ({
3385
3669
  }
3386
3670
  }, props)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
3387
3671
  style: {
3672
+ margin: '0px',
3673
+ display: 'inline-block',
3388
3674
  color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
3389
- fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize
3675
+ fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
3676
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
3390
3677
  }
3391
3678
  }, errorMessage) : '', optionList));
3392
3679
  };
@@ -3409,6 +3696,7 @@ NewAutocomplete.propTypes = {
3409
3696
  contentPosition: PropTypes__default["default"].string,
3410
3697
  labelLineHeight: PropTypes__default["default"].string,
3411
3698
  contentTopColor: PropTypes__default["default"].string,
3699
+ change: PropTypes__default["default"].func.isRequired,
3412
3700
  contentDirection: PropTypes__default["default"].string,
3413
3701
  contentTopWeight: PropTypes__default["default"].number,
3414
3702
  contentTopRadius: PropTypes__default["default"].string,