@xaypay/tui 0.0.71 → 0.0.73

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.
Files changed (32) hide show
  1. package/dist/index.es.js +537 -176
  2. package/dist/index.js +537 -176
  3. package/package.json +1 -1
  4. package/src/components/autocomplate/autocomplate.stories.js +1 -1
  5. package/src/components/icon/ListItemJpeg.js +21 -0
  6. package/src/components/icon/ListItemPng.js +21 -0
  7. package/src/components/icon/index.js +2 -1
  8. package/src/components/input/index.js +22 -15
  9. package/src/components/input/input.stories.js +11 -5
  10. package/src/components/newAutocomplete/NewAutocomplete.stories.js +26 -26
  11. package/src/components/newAutocomplete/index.js +113 -92
  12. package/src/components/newFile/fileItem.js +213 -0
  13. package/src/components/newFile/index.js +161 -130
  14. package/src/components/newFile/newFile.stories.js +6 -3
  15. package/src/components/pagination/index.js +74 -3
  16. package/src/components/pagination/pagination.module.css +13 -1
  17. package/src/components/pagination/pagination.stories.js +4 -2
  18. package/src/components/select/index.js +9 -2
  19. package/src/components/select/select.stories.js +0 -1
  20. package/src/components/textarea/index.js +30 -1
  21. package/src/components/typography/index.js +1 -1
  22. package/src/components/typography/typography.stories.js +2 -1
  23. package/src/stories/configuration.stories.mdx +45 -0
  24. package/src/stories/static/autocomplete-usage.png +0 -0
  25. package/src/stories/static/file-single-usage.png +0 -0
  26. package/src/stories/static/file-usage.png +0 -0
  27. package/src/stories/static/input-usage.png +0 -0
  28. package/src/stories/static/tooltip-usage.png +0 -0
  29. package/src/stories/usage.stories.mdx +17 -8
  30. package/tui.config.js +31 -19
  31. package/src/stories/static/input-tooltip-usage.png +0 -0
  32. package/src/stories/static/new-autocomplete-usage.png +0 -0
package/dist/index.es.js CHANGED
@@ -461,7 +461,7 @@ const Typography = ({
461
461
  textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
462
462
  textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
463
463
  backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor' + variant],
464
- color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
464
+ color: isHover ? colorHover ? colorHover : color ? color : configStyles.TYPOGRAPHY['color' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
465
465
  },
466
466
  ...props,
467
467
  className: classProps,
@@ -574,6 +574,9 @@ const InputTypes = {
574
574
  TEXT: "text",
575
575
  PASSWORD: "password"
576
576
  };
577
+ const P = styled.p`
578
+ animation: ${props => props.errorAnimation ? props.animation : 'none'};
579
+ `;
577
580
  const Input = ({
578
581
  type,
579
582
  size,
@@ -585,12 +588,12 @@ const Input = ({
585
588
  regexp,
586
589
  height,
587
590
  radius,
591
+ change,
588
592
  padding,
589
593
  tooltip,
590
594
  leftIcon,
591
595
  required,
592
596
  disabled,
593
- onChange,
594
597
  transform,
595
598
  iconWidth,
596
599
  rightIcon,
@@ -647,12 +650,12 @@ const Input = ({
647
650
  const animation = _ => css`
648
651
  ${errorShow} ${errorAnimationDuration ? errorAnimationDuration : configStyles.INPUT.errorAnimationDuration} forwards
649
652
  `;
650
- const P = styled.p`
651
- animation: ${errorAnimation ? animation : 'none'};
652
- `;
653
653
  const handleChange = event => {
654
654
  const currentValue = event.target.value;
655
655
  setInnerValue(currentValue);
656
+ if (change) {
657
+ change(currentValue);
658
+ }
656
659
  if (type === 'tel') {
657
660
  if (!phoneNumberRegex.test(currentValue)) {
658
661
  telErrorMessage && setInnerErrorMessage(telErrorMessage);
@@ -661,27 +664,27 @@ const Input = ({
661
664
  setInnerErrorMessage('');
662
665
  if (currentValue.length > 8) {
663
666
  setInnerValue(currentValue.substr(0, 8));
664
- if (onChange) {
665
- onChange(currentValue.substr(0, 8));
667
+ if (change) {
668
+ change(currentValue.substr(0, 8));
666
669
  }
667
670
  } else {
668
671
  setInnerValue(currentValue);
669
- if (onChange) {
670
- onChange(currentValue);
672
+ if (change) {
673
+ change(currentValue);
671
674
  }
672
675
  }
673
676
  }
674
677
  }
675
678
  if (maxLength && currentValue.length > maxLength && type !== 'tel') {
676
679
  setInnerValue(currentValue.substr(0, maxLength));
677
- if (onChange) {
678
- onChange(currentValue.substr(0, maxLength));
680
+ if (change) {
681
+ change(currentValue.substr(0, maxLength));
679
682
  }
680
683
  }
681
684
  if (regexp && regexpErrorMessage && !maxLength && type !== 'tel') {
682
685
  !regexp.test(currentValue) ? setInnerErrorMessage(regexpErrorMessage) : setInnerErrorMessage('');
683
- if (onChange) {
684
- onChange(currentValue);
686
+ if (change) {
687
+ change(currentValue);
685
688
  }
686
689
  }
687
690
  };
@@ -700,7 +703,7 @@ const Input = ({
700
703
  if (value !== undefined && value !== null) {
701
704
  setInnerValue(value);
702
705
  if (type === 'tel') {
703
- if (!phoneNumberRegex.test(currentValue)) {
706
+ if (!phoneNumberRegex.test(value)) {
704
707
  telErrorMessage && setInnerErrorMessage(telErrorMessage);
705
708
  setInnerValue('');
706
709
  } else {
@@ -811,7 +814,10 @@ const Input = ({
811
814
  backgroundColor: disabled ? '#FBFBFB' : backgroundColor ? backgroundColor : configStyles.INPUT.backgroundColor
812
815
  }
813
816
  }, type === 'password' ? show ? rightIcon[1] : rightIcon[0] : rightIcon[0]) : ''), tooltip ? tooltip : '', innerErrorMessage ? /*#__PURE__*/React__default.createElement(P, {
817
+ errorAnimation: errorAnimation,
818
+ animation: animation,
814
819
  style: {
820
+ margin: '0px',
815
821
  left: errorLeft ? errorLeft : configStyles.INPUT.errorLeft,
816
822
  color: errorColor ? errorColor : configStyles.INPUT.errorColor,
817
823
  fontSize: errorSize ? errorSize : configStyles.INPUT.errorSize,
@@ -826,11 +832,11 @@ const Input = ({
826
832
  };
827
833
  Input.propTypes = {
828
834
  name: PropTypes.string,
835
+ change: PropTypes.func,
829
836
  color: PropTypes.string,
830
837
  value: PropTypes.string,
831
838
  width: PropTypes.string,
832
839
  label: PropTypes.string,
833
- onChange: PropTypes.func,
834
840
  required: PropTypes.bool,
835
841
  disabled: PropTypes.bool,
836
842
  height: PropTypes.string,
@@ -1255,7 +1261,13 @@ const Select = ({
1255
1261
  }
1256
1262
  }, [opened]);
1257
1263
  useEffect(() => {
1258
- selected && selected.length > 0 && setNewSelected(isObjectEmpty(selected[0]) ? [] : selected);
1264
+ if (selected) {
1265
+ if (selected.length > 0) {
1266
+ setNewSelected(isObjectEmpty(selected[0]) ? [] : selected);
1267
+ } else {
1268
+ setNewSelected([]);
1269
+ }
1270
+ }
1259
1271
  if (!multiple) {
1260
1272
  options && options.length > 0 && setExistOptions(options);
1261
1273
  } else {
@@ -1272,7 +1284,7 @@ const Select = ({
1272
1284
  });
1273
1285
  setExistOptions(modifiedOptions);
1274
1286
  }
1275
- }, [options, multiple, selected]);
1287
+ }, [options, multiple, selected, selected.length]);
1276
1288
  return /*#__PURE__*/React__default.createElement("div", {
1277
1289
  className: classProps
1278
1290
  }, label ? /*#__PURE__*/React__default.createElement("label", {
@@ -2159,53 +2171,47 @@ function v4(options, buf, offset) {
2159
2171
  return stringify(rnds);
2160
2172
  }
2161
2173
 
2162
- const SvgUpload = ({
2174
+ const SvgListItemPdf = ({
2163
2175
  title,
2164
2176
  titleId,
2165
2177
  ...props
2166
2178
  }) => /*#__PURE__*/React.createElement("svg", _extends({
2167
- width: "51",
2168
- height: "35",
2169
- viewBox: "0 0 51 35",
2179
+ width: "32",
2180
+ height: "42",
2181
+ viewBox: "0 0 32 42",
2170
2182
  fill: "none",
2171
2183
  xmlns: "http://www.w3.org/2000/svg",
2172
2184
  "aria-labelledby": titleId
2173
2185
  }, props), title ? /*#__PURE__*/React.createElement("title", {
2174
2186
  id: titleId
2175
2187
  }, title) : null, /*#__PURE__*/React.createElement("path", {
2176
- 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",
2177
- fill: "#D1D1D1"
2178
- }), /*#__PURE__*/React.createElement("path", {
2179
2188
  fillRule: "evenodd",
2180
2189
  clipRule: "evenodd",
2181
- 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",
2182
- fill: "#0DA574"
2190
+ 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",
2191
+ fill: "#051942"
2183
2192
  }));
2184
2193
 
2185
- const SvgRemoveFile = ({
2194
+ const SvgListItemJpg = ({
2186
2195
  title,
2187
2196
  titleId,
2188
2197
  ...props
2189
2198
  }) => /*#__PURE__*/React.createElement("svg", _extends({
2190
- width: "26",
2191
- height: "26",
2192
- viewBox: "0 0 26 26",
2199
+ width: "32",
2200
+ height: "42",
2201
+ viewBox: "0 0 32 42",
2193
2202
  fill: "none",
2194
2203
  xmlns: "http://www.w3.org/2000/svg",
2195
2204
  "aria-labelledby": titleId
2196
2205
  }, props), title ? /*#__PURE__*/React.createElement("title", {
2197
2206
  id: titleId
2198
- }, title) : null, /*#__PURE__*/React.createElement("rect", {
2199
- width: 26,
2200
- height: 26,
2201
- rx: 6,
2202
- fill: "#FBFBFB"
2203
- }), /*#__PURE__*/React.createElement("path", {
2204
- 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",
2205
- fill: "#00236A"
2207
+ }, title) : null, /*#__PURE__*/React.createElement("path", {
2208
+ fillRule: "evenodd",
2209
+ clipRule: "evenodd",
2210
+ 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",
2211
+ fill: "#051942"
2206
2212
  }));
2207
2213
 
2208
- const SvgListItemPdf = ({
2214
+ const SvgListItemPng = ({
2209
2215
  title,
2210
2216
  titleId,
2211
2217
  ...props
@@ -2221,18 +2227,18 @@ const SvgListItemPdf = ({
2221
2227
  }, title) : null, /*#__PURE__*/React.createElement("path", {
2222
2228
  fillRule: "evenodd",
2223
2229
  clipRule: "evenodd",
2224
- 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",
2230
+ 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",
2225
2231
  fill: "#051942"
2226
2232
  }));
2227
2233
 
2228
- const SvgListItemJpg = ({
2234
+ const SvgListItemJpeg = ({
2229
2235
  title,
2230
2236
  titleId,
2231
2237
  ...props
2232
2238
  }) => /*#__PURE__*/React.createElement("svg", _extends({
2233
- width: "32",
2239
+ width: "33",
2234
2240
  height: "42",
2235
- viewBox: "0 0 32 42",
2241
+ viewBox: "0 0 33 42",
2236
2242
  fill: "none",
2237
2243
  xmlns: "http://www.w3.org/2000/svg",
2238
2244
  "aria-labelledby": titleId
@@ -2241,7 +2247,7 @@ const SvgListItemJpg = ({
2241
2247
  }, title) : null, /*#__PURE__*/React.createElement("path", {
2242
2248
  fillRule: "evenodd",
2243
2249
  clipRule: "evenodd",
2244
- 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",
2250
+ 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",
2245
2251
  fill: "#051942"
2246
2252
  }));
2247
2253
 
@@ -2263,6 +2269,206 @@ const SvgListItemDelete = ({
2263
2269
  fill: "#051942"
2264
2270
  }));
2265
2271
 
2272
+ const FileItem = /*#__PURE__*/React__default.memo(({
2273
+ size,
2274
+ name,
2275
+ uuid,
2276
+ check,
2277
+ radius,
2278
+ status,
2279
+ removeFile,
2280
+ fileFormat,
2281
+ progressColor,
2282
+ listItemHeight,
2283
+ listItemPadding,
2284
+ progressFontSize,
2285
+ listItemErrorSize,
2286
+ listItemErrorColor,
2287
+ progressTrackColor,
2288
+ progressFailedColor,
2289
+ progressSuccessColor,
2290
+ progressLoadingColor,
2291
+ listItemBackgroundColor,
2292
+ listItemBackgroundErrorColor
2293
+ }) => {
2294
+ const [i, setI] = useState(_ => _);
2295
+ const [t, setT] = useState(_ => _);
2296
+ const [progress, setProgress] = useState(7);
2297
+ const handleRemoveItem = id => {
2298
+ removeFile(id);
2299
+ };
2300
+ useEffect(() => {
2301
+ let time = Math.floor(Math.random() * (1100 - 900 + 1)) + 900;
2302
+ let fileSizeInMB = Math.round(size / (1024 * 1024));
2303
+ if (fileSizeInMB > 5) {
2304
+ 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];
2305
+ const index = Math.min(Math.floor((size - 1) / 15), times.length - 1);
2306
+ time = times[index];
2307
+ }
2308
+ setI(setInterval(() => {
2309
+ setProgress(prev => {
2310
+ return prev += 7;
2311
+ });
2312
+ }, time));
2313
+ return () => {
2314
+ setI(_ => _);
2315
+ clearTimeout(t);
2316
+ clearInterval(i);
2317
+ };
2318
+ }, []);
2319
+ useEffect(() => {
2320
+ if (progress > 84) {
2321
+ clearInterval(i);
2322
+ }
2323
+ }, [progress]);
2324
+ useEffect(() => {
2325
+ if (status === 'success') {
2326
+ setProgress(100);
2327
+ clearInterval(i);
2328
+ }
2329
+ if (status === 'failed') {
2330
+ setProgress(0);
2331
+ clearInterval(i);
2332
+ }
2333
+ }, [status]);
2334
+ useEffect(() => {
2335
+ if (check !== '') {
2336
+ setT(setTimeout(() => {
2337
+ removeFile(uuid);
2338
+ }, 3500));
2339
+ }
2340
+ }, [check]);
2341
+ return /*#__PURE__*/React__default.createElement("div", {
2342
+ style: {
2343
+ width: '100%',
2344
+ display: 'flex',
2345
+ marginTop: '6px',
2346
+ alignItems: 'center',
2347
+ borderRadius: radius,
2348
+ height: listItemHeight,
2349
+ boxSizing: 'border-box',
2350
+ padding: listItemPadding,
2351
+ flexDirection: check !== '' ? 'column' : 'row',
2352
+ justifyContent: check !== '' ? 'space-around' : 'space-between',
2353
+ backgroundColor: check !== '' ? listItemBackgroundErrorColor : listItemBackgroundColor
2354
+ }
2355
+ }, check !== '' ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("p", {
2356
+ style: {
2357
+ margin: '0px',
2358
+ color: listItemErrorColor,
2359
+ fontSize: listItemErrorSize
2360
+ }
2361
+ }, name), /*#__PURE__*/React__default.createElement("p", {
2362
+ style: {
2363
+ margin: '0px',
2364
+ color: listItemErrorColor,
2365
+ fontSize: listItemErrorSize
2366
+ }
2367
+ }, check)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
2368
+ style: {
2369
+ width: '32px'
2370
+ }
2371
+ }, fileFormat === 'pdf' ? /*#__PURE__*/React__default.createElement(SvgListItemPdf, null) : fileFormat === 'jpg' ? /*#__PURE__*/React__default.createElement(SvgListItemJpg, null) : fileFormat === 'png' ? /*#__PURE__*/React__default.createElement(SvgListItemPng, null) : fileFormat === 'jpeg' ? /*#__PURE__*/React__default.createElement(SvgListItemJpeg, null) : ''), /*#__PURE__*/React__default.createElement("div", {
2372
+ style: {
2373
+ position: 'relative',
2374
+ display: 'flex',
2375
+ height: '40px',
2376
+ margin: '0px 14px',
2377
+ alignItems: 'flex-end',
2378
+ width: 'calc(100% - 82px)'
2379
+ }
2380
+ }, /*#__PURE__*/React__default.createElement("div", {
2381
+ style: {
2382
+ width: '100%',
2383
+ height: '100%',
2384
+ display: 'flex',
2385
+ paddingTop: '5px',
2386
+ color: progressColor,
2387
+ boxSizing: 'border-box',
2388
+ alignItems: 'flex-start',
2389
+ fontSize: progressFontSize,
2390
+ justifyContent: 'space-between'
2391
+ }
2392
+ }, /*#__PURE__*/React__default.createElement("p", {
2393
+ style: {
2394
+ margin: '0px',
2395
+ overflow: 'hidden',
2396
+ whiteSpace: 'nowrap',
2397
+ textOverflow: 'ellipsis',
2398
+ maxWidth: 'calc(100% - 56px)'
2399
+ }
2400
+ }, name), /*#__PURE__*/React__default.createElement("span", null, progress, " %")), /*#__PURE__*/React__default.createElement("div", {
2401
+ style: {
2402
+ position: 'absolute',
2403
+ left: '0px',
2404
+ bottom: '5px',
2405
+ width: '100%',
2406
+ height: '4px',
2407
+ borderRadius: '10px',
2408
+ backgroundColor: progressTrackColor
2409
+ }
2410
+ }, /*#__PURE__*/React__default.createElement("div", {
2411
+ style: {
2412
+ height: '100%',
2413
+ borderRadius: '10px',
2414
+ width: status === 'failed' ? '100%' : progress + '%',
2415
+ backgroundColor: status === 'success' ? progressSuccessColor : status === 'failed' ? progressFailedColor : progressLoadingColor
2416
+ }
2417
+ }))), /*#__PURE__*/React__default.createElement("div", {
2418
+ style: {
2419
+ width: '22px',
2420
+ cursor: 'pointer'
2421
+ },
2422
+ onClick: () => handleRemoveItem(uuid)
2423
+ }, /*#__PURE__*/React__default.createElement(SvgListItemDelete, null))));
2424
+ });
2425
+
2426
+ const SvgUpload = ({
2427
+ title,
2428
+ titleId,
2429
+ ...props
2430
+ }) => /*#__PURE__*/React.createElement("svg", _extends({
2431
+ width: "51",
2432
+ height: "35",
2433
+ viewBox: "0 0 51 35",
2434
+ fill: "none",
2435
+ xmlns: "http://www.w3.org/2000/svg",
2436
+ "aria-labelledby": titleId
2437
+ }, props), title ? /*#__PURE__*/React.createElement("title", {
2438
+ id: titleId
2439
+ }, title) : null, /*#__PURE__*/React.createElement("path", {
2440
+ 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",
2441
+ fill: "#D1D1D1"
2442
+ }), /*#__PURE__*/React.createElement("path", {
2443
+ fillRule: "evenodd",
2444
+ clipRule: "evenodd",
2445
+ 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",
2446
+ fill: "#0DA574"
2447
+ }));
2448
+
2449
+ const SvgRemoveFile = ({
2450
+ title,
2451
+ titleId,
2452
+ ...props
2453
+ }) => /*#__PURE__*/React.createElement("svg", _extends({
2454
+ width: "26",
2455
+ height: "26",
2456
+ viewBox: "0 0 26 26",
2457
+ fill: "none",
2458
+ xmlns: "http://www.w3.org/2000/svg",
2459
+ "aria-labelledby": titleId
2460
+ }, props), title ? /*#__PURE__*/React.createElement("title", {
2461
+ id: titleId
2462
+ }, title) : null, /*#__PURE__*/React.createElement("rect", {
2463
+ width: 26,
2464
+ height: 26,
2465
+ rx: 6,
2466
+ fill: "#FBFBFB"
2467
+ }), /*#__PURE__*/React.createElement("path", {
2468
+ 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",
2469
+ fill: "#00236A"
2470
+ }));
2471
+
2266
2472
  const SvgDeleteComponent = ({
2267
2473
  title,
2268
2474
  titleId,
@@ -2289,6 +2495,7 @@ const SvgDeleteComponent = ({
2289
2495
  }));
2290
2496
 
2291
2497
  const NewFile = ({
2498
+ or,
2292
2499
  size,
2293
2500
  name,
2294
2501
  color,
@@ -2299,36 +2506,55 @@ const NewFile = ({
2299
2506
  radius,
2300
2507
  change,
2301
2508
  border,
2509
+ upload,
2302
2510
  maxSize,
2303
2511
  disabled,
2304
2512
  multiple,
2305
2513
  required,
2306
2514
  errorSize,
2307
2515
  labelSize,
2516
+ removeFile,
2308
2517
  labelColor,
2309
2518
  errorColor,
2310
2519
  filesArray,
2520
+ putFileHere,
2311
2521
  borderColor,
2312
2522
  uploadColor,
2313
2523
  defaultData,
2524
+ formatError,
2314
2525
  errorMessage,
2526
+ fileSizeText,
2527
+ maxSizeError,
2528
+ progressColor,
2529
+ noChoosenFile,
2315
2530
  fileExtensions,
2531
+ listItemHeight,
2316
2532
  backgroundColor,
2317
2533
  deleteComponent,
2534
+ listItemPadding,
2535
+ progressFontSize,
2318
2536
  borderHoverColor,
2537
+ listItemErrorSize,
2319
2538
  progressTrackColor,
2539
+ fileAreaImageWidth,
2540
+ listItemErrorColor,
2320
2541
  labelRequiredColor,
2542
+ progressFailedColor,
2543
+ fileAreaImageHeight,
2544
+ progressSuccessColor,
2545
+ progressLoadingColor,
2321
2546
  hiddenBackgroundColor,
2322
2547
  extentionsRowMarginTop,
2323
- listItemBackgroundColor
2548
+ listItemBackgroundColor,
2549
+ listItemBackgroundErrorColor
2324
2550
  }) => {
2325
2551
  const ref = useRef(null);
2326
2552
  const inpRef = useRef(null);
2553
+ const memoizedItems = useMemo(() => filesArray, [filesArray]);
2327
2554
  const [error, setError] = useState('');
2328
- const [image, setImage] = useState('');
2329
- const [progress, setProgress] = useState(5);
2330
2555
  const [isHover, setIsHover] = useState(false);
2331
- const [multipleFiles, setMultipleFiles] = useState([]);
2556
+ const [singleFile, setSingleFile] = useState(null);
2557
+ const [image, setImage] = useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
2332
2558
  const configStyles = compereConfigs();
2333
2559
  const handleRemoveComponent = () => {
2334
2560
  const node = ReactDOM.findDOMNode(ref.current);
@@ -2336,45 +2562,68 @@ const NewFile = ({
2336
2562
  parent.removeChild(node);
2337
2563
  };
2338
2564
  const handleRemoveFile = () => {
2339
- if (!multiple) {
2340
- setImage('');
2341
- onChange(null);
2342
- }
2565
+ setImage(null);
2566
+ removeFile(singleFile);
2343
2567
  };
2344
2568
  const handleChange = e => {
2345
2569
  const file = e.target.files;
2346
- if (file[0]) {
2347
- if (file[0].size <= maxSize * Math.pow(2, 20)) {
2348
- if (fileExtensions.includes(file[0].type.split('/')[1])) {
2349
- setError('');
2350
- if (multiple) {
2351
- change({
2352
- uuid: v4(),
2353
- file: file[0]
2354
- });
2570
+ if (multiple) {
2571
+ setError('');
2572
+ setImage(null);
2573
+ for (let ix = 0; ix < file.length; ix++) {
2574
+ if (file[ix]) {
2575
+ if (file[ix].size <= maxSize * Math.pow(2, 20)) {
2576
+ if (fileExtensions.includes(file[ix].type.split('/')[1])) {
2577
+ change({
2578
+ id: '',
2579
+ check: '',
2580
+ status: '',
2581
+ file: file[ix],
2582
+ uuid: v4()
2583
+ });
2584
+ } else {
2585
+ change({
2586
+ file: file[ix],
2587
+ uuid: v4(),
2588
+ check: formatError
2589
+ });
2590
+ }
2355
2591
  } else {
2356
2592
  change({
2357
- file
2593
+ file: file[ix],
2594
+ uuid: v4(),
2595
+ check: maxSizeError
2358
2596
  });
2597
+ }
2598
+ }
2599
+ }
2600
+ if (file.length === 0 && memoizedItems.length === 0) {
2601
+ setError(noChoosenFile);
2602
+ }
2603
+ } else {
2604
+ if (file[0]) {
2605
+ if (file[0].size <= maxSize * Math.pow(2, 20)) {
2606
+ if (fileExtensions.includes(file[0].type.split('/')[1])) {
2607
+ setError('');
2608
+ change(file);
2609
+ setSingleFile(file);
2359
2610
  if (file[0].type === 'application/pdf') {
2360
2611
  setImage('pdf');
2361
2612
  } else {
2362
2613
  setImage(URL.createObjectURL(file[0]));
2363
2614
  }
2615
+ } else {
2616
+ setImage(null);
2617
+ setError(formatError);
2364
2618
  }
2365
2619
  } else {
2366
- setImage('');
2367
- setError('ֆայլի սխալ ֆորմատ');
2620
+ setImage(null);
2621
+ setError(maxSizeError);
2368
2622
  }
2369
- } else {
2370
- setImage('');
2371
- setError('առավելագույն ծավալ');
2372
2623
  }
2373
- } else {
2374
- // TODO:
2375
- if (!multiple || multiple && filesArray && filesArray.length === 0) {
2376
- setImage('');
2377
- setError('Ֆայլը ընտրված չէ');
2624
+ if (file.length === 0) {
2625
+ setImage(null);
2626
+ setError(noChoosenFile);
2378
2627
  }
2379
2628
  }
2380
2629
  };
@@ -2383,6 +2632,21 @@ const NewFile = ({
2383
2632
  inpRef.current.click();
2384
2633
  }
2385
2634
  };
2635
+ const handleDrop = e => {
2636
+ if (!disabled) {
2637
+ e.preventDefault();
2638
+ handleChange({
2639
+ target: {
2640
+ files: e.dataTransfer.files
2641
+ }
2642
+ });
2643
+ }
2644
+ };
2645
+ const handleDragOver = e => {
2646
+ if (!disabled) {
2647
+ e.preventDefault();
2648
+ }
2649
+ };
2386
2650
  const handleMouseEnter = () => {
2387
2651
  setIsHover(true);
2388
2652
  };
@@ -2394,17 +2658,18 @@ const NewFile = ({
2394
2658
  };
2395
2659
  useEffect(() => {
2396
2660
  if (!multiple && defaultData) {
2397
- if (defaultData.type && defaultData.type !== 'application/pdf') {
2398
- setImage(defaultData.url);
2399
- } else {
2400
- setImage('pdf');
2661
+ if (!defaultData.type) {
2662
+ alert('Please add type in defaultData prop');
2663
+ }
2664
+ if (!defaultData.url) {
2665
+ alert('Please add url in defaultData prop');
2401
2666
  }
2402
2667
  }
2403
2668
  if (multiple && !filesArray) {
2404
2669
  alert('In multiple mode, you should add filesArray prop for drawing files');
2405
2670
  }
2406
- if (filesArray) {
2407
- setMultipleFiles(filesArray);
2671
+ if (multiple) {
2672
+ setSingleFile(null);
2408
2673
  }
2409
2674
  }, [multiple, filesArray && filesArray.length, defaultData]);
2410
2675
  useEffect(() => {
@@ -2418,8 +2683,10 @@ const NewFile = ({
2418
2683
  if (!change) {
2419
2684
  alert('Please add change prop on File component');
2420
2685
  }
2421
- }, [change]);
2422
- console.log(multipleFiles, 'multipleFiles');
2686
+ if (!removeFile) {
2687
+ alert('Please add removeFile prop on File component');
2688
+ }
2689
+ }, [change, removeFile]);
2423
2690
  return /*#__PURE__*/React__default.createElement("div", {
2424
2691
  ref: ref,
2425
2692
  style: {
@@ -2461,7 +2728,9 @@ const NewFile = ({
2461
2728
  backgroundColor: backgroundColor ? backgroundColor : configStyles.File.backgroundColor,
2462
2729
  borderColor: error ? errorColor ? errorColor : configStyles.File.errorColor : disabled ? borderColor ? borderColor : configStyles.File.borderColor : isHover ? borderHoverColor ? borderHoverColor : configStyles.File.borderHoverColor : borderColor ? borderColor : configStyles.File.borderColor
2463
2730
  },
2731
+ onDrop: handleDrop,
2464
2732
  onClick: handleClick,
2733
+ onDragOver: handleDragOver,
2465
2734
  onMouseEnter: handleMouseEnter,
2466
2735
  onMouseLeave: handleMouseLeave
2467
2736
  }, /*#__PURE__*/React__default.createElement("input", {
@@ -2470,6 +2739,7 @@ const NewFile = ({
2470
2739
  type: "file",
2471
2740
  ref: inpRef,
2472
2741
  disabled: disabled,
2742
+ multiple: multiple,
2473
2743
  onChange: handleChange
2474
2744
  }), /*#__PURE__*/React__default.createElement("div", {
2475
2745
  style: {
@@ -2484,21 +2754,26 @@ const NewFile = ({
2484
2754
  fontSize: size ? size : configStyles.File.size,
2485
2755
  fontWeight: weight ? weight : configStyles.File.weight
2486
2756
  }
2487
- }, !multiple && image ? image === 'pdf' ? /*#__PURE__*/React__default.createElement(PDF, null) : /*#__PURE__*/React__default.createElement("img", {
2757
+ }, !multiple && image ? image === 'pdf' ? /*#__PURE__*/React__default.createElement(SvgPdf, null) : /*#__PURE__*/React__default.createElement("img", {
2488
2758
  src: image,
2489
2759
  style: {
2490
- maxHeight: '100%'
2760
+ display: 'block',
2761
+ maxWidth: '100%',
2762
+ maxHeight: '95%',
2763
+ objectFit: 'contain',
2764
+ width: fileAreaImageWidth ? fileAreaImageWidth : configStyles.File.fileAreaImageWidth,
2765
+ height: fileAreaImageHeight ? fileAreaImageHeight : configStyles.File.fileAreaImageHeight
2491
2766
  },
2492
2767
  alt: "file preview"
2493
2768
  }) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(SvgUpload, null)), /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
2494
2769
  style: {
2495
2770
  margin: '0px'
2496
2771
  }
2497
- }, "\u054F\u0565\u0572\u0561\u0564\u0580\u0565\u056C \u0586\u0561\u0575\u056C\u0568 \u0561\u0575\u057D\u057F\u0565\u0572", /*#__PURE__*/React__default.createElement("br", null), "\u056F\u0561\u0574 ", /*#__PURE__*/React__default.createElement("span", {
2772
+ }, putFileHere ? putFileHere : configStyles.File.putFileHere, /*#__PURE__*/React__default.createElement("br", null), or ? or : configStyles.File.or, " ", /*#__PURE__*/React__default.createElement("span", {
2498
2773
  style: {
2499
2774
  color: uploadColor ? uploadColor : configStyles.File.uploadColor
2500
2775
  }
2501
- }, "\u0532\u0565\u057C\u0576\u0565\u056C"))), /*#__PURE__*/React__default.createElement("div", {
2776
+ }, upload ? upload : configStyles.File.upload))), /*#__PURE__*/React__default.createElement("div", {
2502
2777
  style: {
2503
2778
  marginTop: extentionsRowMarginTop ? extentionsRowMarginTop : configStyles.File.extentionsRowMarginTop
2504
2779
  }
@@ -2506,7 +2781,7 @@ const NewFile = ({
2506
2781
  style: {
2507
2782
  margin: '0px'
2508
2783
  }
2509
- }, "\u0531\u057C\u0561\u057E\u0565\u056C\u0561\u0563\u0578\u0582\u0575\u0576\u0568 ", maxSize, "\u0544\u0532 ( ", fileExtensions.toString().split(',').join(', '), " )")))), /*#__PURE__*/React__default.createElement("div", {
2784
+ }, fileSizeText ? fileSizeText : configStyles.File.fileSizeText, " ", maxSize, "\u0544\u0532 ( ", fileExtensions.toString().split(',').join(', '), " )")))), /*#__PURE__*/React__default.createElement("div", {
2510
2785
  style: {
2511
2786
  position: 'absolute',
2512
2787
  top: '0px',
@@ -2536,62 +2811,34 @@ const NewFile = ({
2536
2811
  color: errorColor ? errorColor : configStyles.File.errorColor,
2537
2812
  fontSize: errorSize ? errorSize : configStyles.File.errorSize
2538
2813
  }
2539
- }, error) : '', multiple && multipleFiles && multipleFiles.length > 0 && multipleFiles.map((item, index) => {
2540
- return /*#__PURE__*/React__default.createElement("div", {
2541
- key: `${item.file.name}_${index}`,
2542
- style: {
2543
- display: 'flex',
2544
- width: '100%',
2545
- height: '70px',
2546
- marginTop: '6px',
2547
- alignItems: 'center',
2548
- padding: '14px 20px',
2549
- boxSizing: 'border-box',
2550
- justifyContent: 'space-between',
2551
- borderRadius: radius ? radius : configStyles.File.radius,
2552
- backgroundColor: listItemBackgroundColor ? listItemBackgroundColor : configStyles.File.listItemBackgroundColor
2553
- }
2554
- }, /*#__PURE__*/React__default.createElement("div", {
2555
- style: {
2556
- width: '32px'
2557
- }
2558
- }, item.file.type.split('/')[1].toLowerCase() === 'pdf' ? /*#__PURE__*/React__default.createElement(SvgListItemPdf, null) : item.file.type.split('/')[1].toLowerCase() === 'jpeg' ? /*#__PURE__*/React__default.createElement(SvgListItemJpg, null) : ''), /*#__PURE__*/React__default.createElement("div", {
2559
- style: {
2560
- position: 'relative',
2561
- display: 'flex',
2562
- height: '40px',
2563
- margin: '0px 14px',
2564
- alignItems: 'flex-end',
2565
- width: 'calc(100% - 82px)'
2566
- }
2567
- }, /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("p", {
2568
- className: "new"
2569
- }, item.file.name)), /*#__PURE__*/React__default.createElement("div", {
2570
- style: {
2571
- position: 'absolute',
2572
- left: '0px',
2573
- bottom: '5px',
2574
- width: '100%',
2575
- height: '4px',
2576
- borderRadius: '10px',
2577
- backgroundColor: progressTrackColor ? progressTrackColor : configStyles.File.progressTrackColor
2578
- }
2579
- }, /*#__PURE__*/React__default.createElement("div", {
2580
- style: {
2581
- width: progress + '%',
2582
- height: '100%',
2583
- borderRadius: '10px',
2584
- backgroundColor: 'green'
2585
- }
2586
- }))), /*#__PURE__*/React__default.createElement("div", {
2587
- style: {
2588
- width: '22px',
2589
- cursor: 'pointer'
2590
- }
2591
- }, /*#__PURE__*/React__default.createElement(SvgListItemDelete, null)));
2814
+ }, error) : '', multiple && memoizedItems && memoizedItems.length > 0 && memoizedItems.map(item => {
2815
+ return /*#__PURE__*/React__default.createElement(FileItem, {
2816
+ key: item.uuid,
2817
+ uuid: item.uuid,
2818
+ check: item.check,
2819
+ status: item.status,
2820
+ size: item.file.size,
2821
+ name: item.file.name,
2822
+ removeFile: removeFile,
2823
+ radius: radius ? radius : configStyles.File.radius,
2824
+ fileFormat: item.file.type.split('/')[1].toLowerCase(),
2825
+ progressColor: progressColor ? progressColor : configStyles.File.progressColor,
2826
+ listItemHeight: listItemHeight ? listItemHeight : configStyles.File.listItemHeight,
2827
+ listItemPadding: listItemPadding ? listItemPadding : configStyles.File.listItemPadding,
2828
+ progressFontSize: progressFontSize ? progressFontSize : configStyles.File.progressFontSize,
2829
+ listItemErrorSize: listItemErrorSize ? listItemErrorSize : configStyles.File.listItemErrorSize,
2830
+ listItemErrorColor: listItemErrorColor ? listItemErrorColor : configStyles.File.listItemErrorColor,
2831
+ progressTrackColor: progressTrackColor ? progressTrackColor : configStyles.File.progressTrackColor,
2832
+ progressFailedColor: progressFailedColor ? progressFailedColor : configStyles.File.progressFailedColor,
2833
+ progressSuccessColor: progressSuccessColor ? progressSuccessColor : configStyles.File.progressSuccessColor,
2834
+ progressLoadingColor: progressLoadingColor ? progressLoadingColor : configStyles.File.progressLoadingColor,
2835
+ listItemBackgroundColor: listItemBackgroundColor ? listItemBackgroundColor : configStyles.File.listItemBackgroundColor,
2836
+ listItemBackgroundErrorColor: listItemBackgroundErrorColor ? listItemBackgroundErrorColor : configStyles.File.listItemBackgroundErrorColor
2837
+ });
2592
2838
  }));
2593
2839
  };
2594
2840
  NewFile.propTypes = {
2841
+ or: PropTypes.string,
2595
2842
  size: PropTypes.string,
2596
2843
  label: PropTypes.string,
2597
2844
  width: PropTypes.string,
@@ -2601,30 +2848,49 @@ NewFile.propTypes = {
2601
2848
  radius: PropTypes.string,
2602
2849
  border: PropTypes.string,
2603
2850
  required: PropTypes.bool,
2851
+ upload: PropTypes.string,
2604
2852
  weight: PropTypes.number,
2605
2853
  maxSize: PropTypes.number,
2606
2854
  errorSize: PropTypes.string,
2607
2855
  labelSize: PropTypes.string,
2608
2856
  labelColor: PropTypes.string,
2609
2857
  errorColor: PropTypes.string,
2858
+ formatError: PropTypes.string,
2859
+ putFileHere: PropTypes.string,
2610
2860
  borderColor: PropTypes.string,
2611
2861
  uploadColor: PropTypes.string,
2612
2862
  defaultData: PropTypes.object,
2863
+ maxSizeError: PropTypes.string,
2613
2864
  errorMessage: PropTypes.string,
2865
+ fileSizeText: PropTypes.string,
2866
+ noChoosenFile: PropTypes.string,
2867
+ progressColor: PropTypes.string,
2614
2868
  deleteComponent: PropTypes.bool,
2869
+ listItemHeight: PropTypes.string,
2615
2870
  backgroundColor: PropTypes.string,
2616
2871
  change: PropTypes.func.isRequired,
2872
+ listItemPadding: PropTypes.string,
2873
+ progressFontSize: PropTypes.string,
2617
2874
  borderHoverColor: PropTypes.string,
2875
+ listItemErrorSize: PropTypes.string,
2618
2876
  labelRequiredColor: PropTypes.string,
2619
2877
  progressTrackColor: PropTypes.string,
2878
+ fileAreaImageWidth: PropTypes.string,
2879
+ listItemErrorColor: PropTypes.string,
2880
+ removeFile: PropTypes.func.isRequired,
2881
+ fileAreaImageHeight: PropTypes.string,
2882
+ progressFailedColor: PropTypes.string,
2883
+ progressSuccessColor: PropTypes.string,
2884
+ progressLoadingColor: PropTypes.string,
2620
2885
  hiddenBackgroundColor: PropTypes.string,
2621
2886
  extentionsRowMarginTop: PropTypes.string,
2622
2887
  listItemBackgroundColor: PropTypes.string,
2888
+ listItemBackgroundErrorColor: PropTypes.string,
2623
2889
  filesArray: PropTypes.arrayOf(PropTypes.object),
2624
2890
  fileExtensions: PropTypes.arrayOf(PropTypes.string)
2625
2891
  };
2626
2892
  NewFile.defaultProps = {
2627
- maxSize: 5,
2893
+ maxSize: 50,
2628
2894
  fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
2629
2895
  };
2630
2896
 
@@ -2650,17 +2916,21 @@ const Textarea = ({
2650
2916
  boxSizing,
2651
2917
  maxLength,
2652
2918
  labelSize,
2919
+ errorSize,
2653
2920
  labelColor,
2921
+ errorColor,
2654
2922
  borderColor,
2655
2923
  labelWeight,
2656
2924
  placeholder,
2657
2925
  labelDisplay,
2926
+ errorMesaage,
2658
2927
  backgroundColor,
2659
2928
  borderFocusColor,
2660
2929
  borderHoverColor,
2661
2930
  showCharacterCount,
2662
2931
  labelRequiredColor
2663
2932
  }) => {
2933
+ const [error, setError] = useState('');
2664
2934
  const [isHover, setIsHover] = useState(false);
2665
2935
  const [isFocus, setIsFocus] = useState(false);
2666
2936
  const [innerValue, setInnerValue] = useState('');
@@ -2683,10 +2953,16 @@ const Textarea = ({
2683
2953
  if (maxLength) {
2684
2954
  if (value.length > maxLength) {
2685
2955
  onChange(value.substr(0, maxLength));
2956
+ setError('Նիշերի քանակը գերազանցում է');
2957
+ } else {
2958
+ setError('');
2686
2959
  }
2687
2960
  } else {
2688
2961
  if (value.length > configStyles.TEXTAREA.maxLength) {
2962
+ setError('Նիշերի քանակը գերազանցում է');
2689
2963
  onChange(value.substr(0, configStyles.TEXTAREA.maxLength));
2964
+ } else {
2965
+ setError('');
2690
2966
  }
2691
2967
  }
2692
2968
  };
@@ -2699,6 +2975,13 @@ const Textarea = ({
2699
2975
  }
2700
2976
  setInnerValue(value);
2701
2977
  }, [value, onChange]);
2978
+ useEffect(() => {
2979
+ if (errorMesaage) {
2980
+ setError(errorMesaage);
2981
+ } else {
2982
+ setError('');
2983
+ }
2984
+ }, [errorMesaage]);
2702
2985
  return /*#__PURE__*/React__default.createElement("div", {
2703
2986
  style: {
2704
2987
  width: width ? width : configStyles.TEXTAREA.width
@@ -2741,7 +3024,7 @@ const Textarea = ({
2741
3024
  maxHeight: maxHeight ? maxHeight : configStyles.TEXTAREA.maxHeight,
2742
3025
  boxSizing: boxSizing ? boxSizing : configStyles.TEXTAREA.boxSizing,
2743
3026
  backgroundColor: backgroundColor ? backgroundColor : configStyles.TEXTAREA.backgroundColor,
2744
- borderColor: isFocus ? borderFocusColor ? borderFocusColor : configStyles.TEXTAREA.borderFocusColor : isHover ? borderHoverColor ? borderHoverColor : configStyles.TEXTAREA.borderHoverColor : borderColor ? borderColor : configStyles.TEXTAREA.borderColor,
3027
+ borderColor: error ? errorColor ? errorColor : configStyles.TEXTAREA.errorColor : isFocus ? borderFocusColor ? borderFocusColor : configStyles.TEXTAREA.borderFocusColor : isHover ? borderHoverColor ? borderHoverColor : configStyles.TEXTAREA.borderHoverColor : borderColor ? borderColor : configStyles.TEXTAREA.borderColor,
2745
3028
  resize: resize ? resize : configStyles.TEXTAREA.resize
2746
3029
  },
2747
3030
  value: innerValue,
@@ -2751,7 +3034,14 @@ const Textarea = ({
2751
3034
  placeholder: placeholder,
2752
3035
  onMouseEnter: handleMouseEnter,
2753
3036
  onMouseLeave: handleMouseLeave
2754
- }));
3037
+ }), error ? /*#__PURE__*/React__default.createElement("span", {
3038
+ style: {
3039
+ marginTop: '6px',
3040
+ display: 'inline-block',
3041
+ fontSize: errorSize ? errorSize : configStyles.TEXTAREA.errorSize,
3042
+ color: errorColor ? errorColor : configStyles.TEXTAREA.errorColor
3043
+ }
3044
+ }, error) : '');
2755
3045
  };
2756
3046
  Textarea.propTypes = {
2757
3047
  size: PropTypes.string,
@@ -2784,7 +3074,7 @@ Textarea.propTypes = {
2784
3074
  labelRequiredColor: PropTypes.string
2785
3075
  };
2786
3076
 
2787
- var css_248z$1 = ".pagination-module_listItem__b1-WN:focus{background-color:#4caf50;color:#fff}.pagination-module_listItem__b1-WN:hover:not(.pagination-module_active__KwBDp){background-color:#ddd}.pagination-module_pagination-bar__MrtYT{display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;justify-content:center}.pagination-module_pagination-btn__w8Yh8{border:none;border-radius:6px;outline:none}.pagination-module_pagination-btn__w8Yh8,.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{align-items:center;background-color:#fff;box-shadow:0 0 0 1px #eee;cursor:pointer;display:flex;height:34px;justify-content:center;width:34px}.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{border-radius:6px;flex:0 0 auto;font-size:13px;line-height:16px;position:relative;transition:background-color .24s}.pagination-module_pagination-item__t3emS:hover{background-color:#eee}.pagination-module_pagination-item__t3emS.pagination-module_selected__EXzCA{background-color:#00236a;color:#fff}.pagination-module_pagination-jump-next-arrow__aEVD8,.pagination-module_pagination-jump-next-txt__e7nFj{align-items:center;bottom:0;display:flex;font-size:12px;justify-content:center;left:0;line-height:14px;margin:auto;position:absolute;right:0;top:0;transition:opacity .24s,color .24s}.pagination-module_pagination-jump-next-arrow__aEVD8{opacity:0}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-arrow__aEVD8{opacity:1}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-txt__e7nFj{opacity:0}i{color:#3c393e;font-size:12px;line-height:12px}";
3077
+ var css_248z$1 = ".pagination-module_listItem__b1-WN:focus{background-color:#4caf50;color:#fff}.pagination-module_listItem__b1-WN:hover:not(.pagination-module_active__KwBDp){background-color:#ddd}.pagination-module_pagination-bar__MrtYT{display:flex;flex-direction:row;flex-wrap:nowrap;gap:8px;justify-content:center}.pagination-module_pagination-btn__w8Yh8{border:none;border-radius:6px;outline:none}.pagination-module_pagination-btn__w8Yh8,.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{align-items:center;background-color:#fff;box-shadow:0 0 0 1px #eee;cursor:pointer;display:flex;height:34px;justify-content:center;width:34px}.pagination-module_pagination-item__t3emS,.pagination-module_pagination-jump-next__LAb9Z{border-radius:6px;flex:0 0 auto;font-size:13px;line-height:16px;position:relative;transition:background-color .24s}.pagination-module_pagination-item__t3emS:hover{background-color:#eee}.pagination-module_pagination-item__t3emS.pagination-module_selected__EXzCA{background-color:#00236a;color:#fff}.pagination-module_pagination-jump-next-arrow__aEVD8,.pagination-module_pagination-jump-next-txt__e7nFj{align-items:center;bottom:0;display:flex;font-size:12px;justify-content:center;left:0;line-height:14px;margin:auto;position:absolute;right:0;top:0;transition:opacity .24s,color .24s}.pagination-module_pagination-jump-next-arrow__aEVD8{opacity:0}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-arrow__aEVD8{opacity:1}.pagination-module_pagination-jump-next__LAb9Z:hover .pagination-module_pagination-jump-next-txt__e7nFj{opacity:0}i{color:#3c393e;font-size:12px;line-height:12px}input::-webkit-inner-spin-button,input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield}";
2788
3078
  var styles$1 = {"listItem":"pagination-module_listItem__b1-WN","active":"pagination-module_active__KwBDp","pagination-bar":"pagination-module_pagination-bar__MrtYT","pagination-btn":"pagination-module_pagination-btn__w8Yh8","pagination-item":"pagination-module_pagination-item__t3emS","pagination-jump-next":"pagination-module_pagination-jump-next__LAb9Z","selected":"pagination-module_selected__EXzCA","pagination-jump-next-txt":"pagination-module_pagination-jump-next-txt__e7nFj","pagination-jump-next-arrow":"pagination-module_pagination-jump-next-arrow__aEVD8"};
2789
3079
  styleInject(css_248z$1);
2790
3080
 
@@ -2873,6 +3163,7 @@ const SvgNextarrow = ({
2873
3163
  }));
2874
3164
 
2875
3165
  const Pagination = ({
3166
+ goTo,
2876
3167
  onChange,
2877
3168
  totalCount,
2878
3169
  siblingCount,
@@ -2880,6 +3171,8 @@ const Pagination = ({
2880
3171
  offset,
2881
3172
  className
2882
3173
  }) => {
3174
+ const [inpVal, setInpVal] = useState('');
3175
+ const [error, setError] = useState(false);
2883
3176
  const [siblingCountNumber, setSibilingCountNumber] = useState(siblingCount);
2884
3177
  const [currentPageNumber, setCurrentPage] = useState(currentPage);
2885
3178
  const [currentTotalCount, setcurrentTotalCount] = useState(totalCount);
@@ -2922,6 +3215,40 @@ const Pagination = ({
2922
3215
  const onPreviousFive = e => {
2923
3216
  currentPageNumber !== 5 ? onPageChange(currentPageNumber - 5) : onPageChange(currentPageNumber - 4);
2924
3217
  };
3218
+ const handleChangeInput = e => {
3219
+ setError(false);
3220
+ if (e.target.value.trim() !== '') {
3221
+ const val = parseInt(e.target.value);
3222
+ if (Number.isInteger(val)) {
3223
+ setInpVal(val);
3224
+ } else {
3225
+ setInpVal('');
3226
+ }
3227
+ } else {
3228
+ setInpVal('');
3229
+ }
3230
+ };
3231
+ const handleKeyDown = e => {
3232
+ const forbiddenKeys = ["e", ".", "+", "-"];
3233
+ if (forbiddenKeys.includes(e.key)) {
3234
+ e.preventDefault();
3235
+ }
3236
+ if (e.keyCode === 13) {
3237
+ if (inpVal === '') {
3238
+ setError(true);
3239
+ } else {
3240
+ if (inpVal <= 1) {
3241
+ setInpVal(1);
3242
+ onPageChange(1);
3243
+ } else if (inpVal >= totalCount / offset) {
3244
+ setInpVal(Math.ceil(totalCount / offset));
3245
+ onPageChange(Math.ceil(totalCount / offset));
3246
+ } else {
3247
+ onPageChange(inpVal);
3248
+ }
3249
+ }
3250
+ }
3251
+ };
2925
3252
  let lastPage = paginationRange[paginationRange.length - 1];
2926
3253
  return /*#__PURE__*/React__default.createElement("ul", {
2927
3254
  className: classProps
@@ -2929,9 +3256,9 @@ const Pagination = ({
2929
3256
  style: {
2930
3257
  transform: 'rotate(180deg)'
2931
3258
  },
2932
- className: `${styles$1["pagination-btn"]} pagination-btn-rem`,
2933
3259
  onClick: onPrevious,
2934
- disabled: currentPage === 1 ? true : false
3260
+ disabled: currentPage === 1 ? true : false,
3261
+ className: `${styles$1["pagination-btn"]} pagination-btn-rem`
2935
3262
  }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null)), paginationRange.map((pageNumber, id) => {
2936
3263
  if (pageNumber === Dots) {
2937
3264
  let currentPageIndex = paginationRange.indexOf(currentPageNumber);
@@ -2960,11 +3287,35 @@ const Pagination = ({
2960
3287
  }, pageNumber);
2961
3288
  }), /*#__PURE__*/React__default.createElement("button", {
2962
3289
  onClick: onNext,
2963
- className: `${styles$1["pagination-btn"]} pagination-btn-rem`,
2964
- disabled: currentPageNumber === lastPage ? true : false
2965
- }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null)));
3290
+ disabled: currentPageNumber === lastPage ? true : false,
3291
+ className: `${styles$1["pagination-btn"]} pagination-btn-rem`
3292
+ }, /*#__PURE__*/React__default.createElement(SvgNextarrow, null)), goTo && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("input", {
3293
+ onKeyDown: handleKeyDown,
3294
+ onInput: handleChangeInput,
3295
+ type: "number",
3296
+ style: {
3297
+ width: '53px',
3298
+ height: '30px',
3299
+ outline: 'none',
3300
+ color: '#3C393E',
3301
+ fontSize: '13px',
3302
+ margin: '0px 6px',
3303
+ fontWeight: '500',
3304
+ textAlign: 'center',
3305
+ border: '1px solid',
3306
+ borderRadius: '6px',
3307
+ borderColor: error ? 'red' : '#00236a'
3308
+ },
3309
+ value: inpVal
3310
+ }), /*#__PURE__*/React__default.createElement("span", {
3311
+ style: {
3312
+ color: '#3C393E',
3313
+ fontSize: '13px'
3314
+ }
3315
+ }, "\u0537\u057B")));
2966
3316
  };
2967
3317
  Pagination.propTypes = {
3318
+ goTo: PropTypes.bool,
2968
3319
  offset: PropTypes.number,
2969
3320
  totalCount: PropTypes.number,
2970
3321
  className: PropTypes.string,
@@ -3114,6 +3465,7 @@ Autocomplate.defaultProps = {
3114
3465
 
3115
3466
  const NewAutocomplete = ({
3116
3467
  label,
3468
+ change,
3117
3469
  options,
3118
3470
  getItem,
3119
3471
  required,
@@ -3187,6 +3539,7 @@ const NewAutocomplete = ({
3187
3539
  const [isHover, setIsHover] = useState(false);
3188
3540
  const [isFocus, setIsFocus] = useState(false);
3189
3541
  const [innerValue, setInnerValue] = useState('');
3542
+ const [innerOptions, setInnerOptions] = useState([]);
3190
3543
  const configStyles = compereConfigs();
3191
3544
  const showOption = keyframes`
3192
3545
  100% {
@@ -3220,13 +3573,18 @@ const NewAutocomplete = ({
3220
3573
  const value = e.target.value;
3221
3574
  value.length > 0 ? setShow(true) : setShow(false);
3222
3575
  setInnerValue(value);
3576
+ if (value.length >= searchCount) {
3577
+ change(value);
3578
+ } else {
3579
+ change('');
3580
+ }
3223
3581
  };
3224
3582
  const handleClick = selectedValue => {
3225
3583
  setShow(false);
3226
3584
  getItem(selectedValue);
3227
- setInnerValue(selectedValue.value);
3585
+ setInnerValue(selectedValue.name);
3228
3586
  };
3229
- const optionList = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, show && options && options.length > 0 && /*#__PURE__*/React__default.createElement("div", {
3587
+ const optionList = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, show && innerOptions ? innerOptions.length > 0 ? /*#__PURE__*/React__default.createElement("div", {
3230
3588
  style: {
3231
3589
  left: contentBottomLeft ? contentBottomLeft : configStyles.NEWAUTOCOMPLETE.contentBottomLeft,
3232
3590
  width: contentBottomWidth ? contentBottomWidth : configStyles.NEWAUTOCOMPLETE.contentBottomWidth,
@@ -3249,9 +3607,9 @@ const NewAutocomplete = ({
3249
3607
  maxHeight: contentBottomInnerMaxHeight ? contentBottomInnerMaxHeight : configStyles.NEWAUTOCOMPLETE.contentBottomInnerMaxHeight,
3250
3608
  flexDirection: contentBottomInnerDirection ? contentBottomInnerDirection : configStyles.NEWAUTOCOMPLETE.contentBottomInnerDirection
3251
3609
  }
3252
- }, innerValue.length >= searchCount ? options.filter(item => item.value.includes(innerValue)).length > 0 ? options.filter(item => item.value.includes(innerValue)).map((item, index) => {
3610
+ }, innerOptions.map(item => {
3253
3611
  return /*#__PURE__*/React__default.createElement("p", {
3254
- key: `${item}_${index}`,
3612
+ key: item.id,
3255
3613
  onMouseEnter: handleRowMouseEnter,
3256
3614
  onMouseLeave: handleRowMouseLeave,
3257
3615
  onClick: () => handleClick(item),
@@ -3271,40 +3629,37 @@ const NewAutocomplete = ({
3271
3629
  marginBottom: contentBottomRowMarginBottom ? contentBottomRowMarginBottom : configStyles.NEWAUTOCOMPLETE.contentBottomRowMarginBottom,
3272
3630
  backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
3273
3631
  }
3274
- }, item.value);
3275
- }) : /*#__PURE__*/React__default.createElement("p", {
3276
- style: {
3277
- color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
3278
- fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
3279
- height: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
3280
- padding: contentBottomRowPadding ? contentBottomRowPadding : configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
3281
- lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight
3282
- }
3283
- }, "\u0546\u0574\u0561\u0576 \u057F\u057E\u0575\u0561\u056C \u0561\u057C\u056F\u0561 \u0579\u0567") : /*#__PURE__*/React__default.createElement("p", {
3632
+ }, item.name);
3633
+ }))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default.createElement("p", {
3284
3634
  style: {
3635
+ margin: '0px',
3285
3636
  color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
3286
3637
  fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
3287
3638
  height: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
3288
3639
  padding: contentBottomRowPadding ? contentBottomRowPadding : configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
3289
- lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight
3640
+ lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
3641
+ backgroundColor: contentBottomBackgroundColor ? contentBottomBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomBackgroundColor
3290
3642
  }
3291
- }, innerValue.length < searchCount && `Լրացնել առնվազն ${searchCount} նիշ`))));
3643
+ }, innerValue.length >= searchCount ? 'Նման տվյալ առկա չէ' : `Լրացնել առնվազն ${searchCount} նիշ`) : '' : '');
3292
3644
  useEffect(() => {
3293
- if (!options) {
3294
- alert('Please add array of options');
3295
- }
3296
- if (options.length === 0) {
3297
- alert('Please fill options array');
3645
+ if (options === undefined) {
3646
+ alert('Please add options prop');
3298
3647
  }
3299
3648
  options && options.length > 0 && options.map(item => {
3300
- if (!item.hasOwnProperty('value')) {
3301
- alert('Please add value property in items of options array');
3649
+ if (!item.hasOwnProperty('name')) {
3650
+ alert('Please add name property in items of options array');
3302
3651
  }
3303
3652
  });
3304
3653
  if (!getItem) {
3305
3654
  alert('Please add getItem function for get choosen item from autocomplete');
3306
3655
  }
3307
- }, [options, getItem]);
3656
+ options && setInnerOptions(options);
3657
+ }, [options, options.length, getItem]);
3658
+ useEffect(() => {
3659
+ if (!change) {
3660
+ alert('Please add change prop on New Autocomplete component');
3661
+ }
3662
+ }, [change]);
3308
3663
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, label ? /*#__PURE__*/React__default.createElement("label", {
3309
3664
  style: {
3310
3665
  color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
@@ -3312,6 +3667,7 @@ const NewAutocomplete = ({
3312
3667
  display: labelDisplay ? labelDisplay : configStyles.NEWAUTOCOMPLETE.labelDisplay,
3313
3668
  fontWeight: labelWeight ? labelWeight : configStyles.NEWAUTOCOMPLETE.labelWeight,
3314
3669
  lineHeight: labelLineHeight ? labelLineHeight : configStyles.NEWAUTOCOMPLETE.labelLineHeight,
3670
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
3315
3671
  marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.NEWAUTOCOMPLETE.labelMarginBottom,
3316
3672
  textTransform: labelTextTransform ? labelTextTransform : configStyles.NEWAUTOCOMPLETE.labelTextTransform
3317
3673
  }
@@ -3323,7 +3679,8 @@ const NewAutocomplete = ({
3323
3679
  style: {
3324
3680
  display: contentDisplay ? contentDisplay : configStyles.NEWAUTOCOMPLETE.contentDisplay,
3325
3681
  position: contentPosition ? contentPosition : configStyles.NEWAUTOCOMPLETE.contentPosition,
3326
- flexDirection: contentDirection ? contentDirection : configStyles.NEWAUTOCOMPLETE.contentDirection
3682
+ flexDirection: contentDirection ? contentDirection : configStyles.NEWAUTOCOMPLETE.contentDirection,
3683
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
3327
3684
  }
3328
3685
  }, /*#__PURE__*/React__default.createElement("input", _extends({
3329
3686
  type: "text",
@@ -3332,11 +3689,12 @@ const NewAutocomplete = ({
3332
3689
  onBlur: handleBlur,
3333
3690
  onFocus: handleFocus,
3334
3691
  onInput: handleChange,
3335
- placeholder: placeHolder ? placeHolder : '',
3336
- autoComplete: autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete,
3337
3692
  onMouseEnter: handleMouseEnter,
3338
3693
  onMouseLeave: handleMouseLeave,
3694
+ placeholder: placeHolder ? placeHolder : '',
3695
+ autoComplete: autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete,
3339
3696
  style: {
3697
+ maxWidth: '100%',
3340
3698
  transition: 'all 240ms',
3341
3699
  cursor: disabled ? 'not-allowed' : 'auto',
3342
3700
  color: contentTopColor ? contentTopColor : configStyles.NEWAUTOCOMPLETE.contentTopColor,
@@ -3347,7 +3705,6 @@ const NewAutocomplete = ({
3347
3705
  display: contentTopDisplay ? contentTopDisplay : configStyles.NEWAUTOCOMPLETE.contentTopDisplay,
3348
3706
  fontWeight: contentTopWeight ? contentTopWeight : configStyles.NEWAUTOCOMPLETE.contentTopWeight,
3349
3707
  borderRadius: contentTopRadius ? contentTopRadius : configStyles.NEWAUTOCOMPLETE.contentTopRadius,
3350
- maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
3351
3708
  boxSizing: contentTopBoxSizing ? contentTopBoxSizing : configStyles.NEWAUTOCOMPLETE.contentTopBoxSizing,
3352
3709
  lineHeight: contentTopLineHeight ? contentTopLineHeight : configStyles.NEWAUTOCOMPLETE.contentTopLineHeight,
3353
3710
  flexDirection: contentTopDirection ? contentTopDirection : configStyles.NEWAUTOCOMPLETE.contentTopDirection,
@@ -3355,8 +3712,11 @@ const NewAutocomplete = ({
3355
3712
  }
3356
3713
  }, props)), errorMessage ? /*#__PURE__*/React__default.createElement("span", {
3357
3714
  style: {
3715
+ margin: '0px',
3716
+ display: 'inline-block',
3358
3717
  color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
3359
- fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize
3718
+ fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
3719
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
3360
3720
  }
3361
3721
  }, errorMessage) : '', optionList));
3362
3722
  };
@@ -3379,6 +3739,7 @@ NewAutocomplete.propTypes = {
3379
3739
  contentPosition: PropTypes.string,
3380
3740
  labelLineHeight: PropTypes.string,
3381
3741
  contentTopColor: PropTypes.string,
3742
+ change: PropTypes.func.isRequired,
3382
3743
  contentDirection: PropTypes.string,
3383
3744
  contentTopWeight: PropTypes.number,
3384
3745
  contentTopRadius: PropTypes.string,