@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.js CHANGED
@@ -491,7 +491,7 @@ const Typography = ({
491
491
  textTransform: textTransform ? textTransform : configStyles.TYPOGRAPHY['textTransform' + variant],
492
492
  textDecoration: textDecoration ? textDecoration : configStyles.TYPOGRAPHY['textDecoration' + variant],
493
493
  backgroundColor: backgroundColor ? backgroundColor : configStyles.TYPOGRAPHY['backgroundColor' + variant],
494
- color: isHover ? colorHover ? colorHover : configStyles.TYPOGRAPHY['colorHover' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
494
+ color: isHover ? colorHover ? colorHover : color ? color : configStyles.TYPOGRAPHY['color' + variant] : color ? color : configStyles.TYPOGRAPHY['color' + variant]
495
495
  },
496
496
  ...props,
497
497
  className: classProps,
@@ -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,
@@ -1285,7 +1291,13 @@ const Select = ({
1285
1291
  }
1286
1292
  }, [opened]);
1287
1293
  React.useEffect(() => {
1288
- selected && selected.length > 0 && setNewSelected(isObjectEmpty(selected[0]) ? [] : selected);
1294
+ if (selected) {
1295
+ if (selected.length > 0) {
1296
+ setNewSelected(isObjectEmpty(selected[0]) ? [] : selected);
1297
+ } else {
1298
+ setNewSelected([]);
1299
+ }
1300
+ }
1289
1301
  if (!multiple) {
1290
1302
  options && options.length > 0 && setExistOptions(options);
1291
1303
  } else {
@@ -1302,7 +1314,7 @@ const Select = ({
1302
1314
  });
1303
1315
  setExistOptions(modifiedOptions);
1304
1316
  }
1305
- }, [options, multiple, selected]);
1317
+ }, [options, multiple, selected, selected.length]);
1306
1318
  return /*#__PURE__*/React__default["default"].createElement("div", {
1307
1319
  className: classProps
1308
1320
  }, label ? /*#__PURE__*/React__default["default"].createElement("label", {
@@ -2189,53 +2201,47 @@ function v4(options, buf, offset) {
2189
2201
  return stringify(rnds);
2190
2202
  }
2191
2203
 
2192
- const SvgUpload = ({
2204
+ const SvgListItemPdf = ({
2193
2205
  title,
2194
2206
  titleId,
2195
2207
  ...props
2196
2208
  }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2197
- width: "51",
2198
- height: "35",
2199
- viewBox: "0 0 51 35",
2209
+ width: "32",
2210
+ height: "42",
2211
+ viewBox: "0 0 32 42",
2200
2212
  fill: "none",
2201
2213
  xmlns: "http://www.w3.org/2000/svg",
2202
2214
  "aria-labelledby": titleId
2203
2215
  }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2204
2216
  id: titleId
2205
2217
  }, 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
2218
  fillRule: "evenodd",
2210
2219
  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"
2220
+ 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",
2221
+ fill: "#051942"
2213
2222
  }));
2214
2223
 
2215
- const SvgRemoveFile = ({
2224
+ const SvgListItemJpg = ({
2216
2225
  title,
2217
2226
  titleId,
2218
2227
  ...props
2219
2228
  }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2220
- width: "26",
2221
- height: "26",
2222
- viewBox: "0 0 26 26",
2229
+ width: "32",
2230
+ height: "42",
2231
+ viewBox: "0 0 32 42",
2223
2232
  fill: "none",
2224
2233
  xmlns: "http://www.w3.org/2000/svg",
2225
2234
  "aria-labelledby": titleId
2226
2235
  }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2227
2236
  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"
2237
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2238
+ fillRule: "evenodd",
2239
+ clipRule: "evenodd",
2240
+ 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",
2241
+ fill: "#051942"
2236
2242
  }));
2237
2243
 
2238
- const SvgListItemPdf = ({
2244
+ const SvgListItemPng = ({
2239
2245
  title,
2240
2246
  titleId,
2241
2247
  ...props
@@ -2251,18 +2257,18 @@ const SvgListItemPdf = ({
2251
2257
  }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2252
2258
  fillRule: "evenodd",
2253
2259
  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",
2260
+ 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
2261
  fill: "#051942"
2256
2262
  }));
2257
2263
 
2258
- const SvgListItemJpg = ({
2264
+ const SvgListItemJpeg = ({
2259
2265
  title,
2260
2266
  titleId,
2261
2267
  ...props
2262
2268
  }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2263
- width: "32",
2269
+ width: "33",
2264
2270
  height: "42",
2265
- viewBox: "0 0 32 42",
2271
+ viewBox: "0 0 33 42",
2266
2272
  fill: "none",
2267
2273
  xmlns: "http://www.w3.org/2000/svg",
2268
2274
  "aria-labelledby": titleId
@@ -2271,7 +2277,7 @@ const SvgListItemJpg = ({
2271
2277
  }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2272
2278
  fillRule: "evenodd",
2273
2279
  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",
2280
+ 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
2281
  fill: "#051942"
2276
2282
  }));
2277
2283
 
@@ -2293,6 +2299,206 @@ const SvgListItemDelete = ({
2293
2299
  fill: "#051942"
2294
2300
  }));
2295
2301
 
2302
+ const FileItem = /*#__PURE__*/React__default["default"].memo(({
2303
+ size,
2304
+ name,
2305
+ uuid,
2306
+ check,
2307
+ radius,
2308
+ status,
2309
+ removeFile,
2310
+ fileFormat,
2311
+ progressColor,
2312
+ listItemHeight,
2313
+ listItemPadding,
2314
+ progressFontSize,
2315
+ listItemErrorSize,
2316
+ listItemErrorColor,
2317
+ progressTrackColor,
2318
+ progressFailedColor,
2319
+ progressSuccessColor,
2320
+ progressLoadingColor,
2321
+ listItemBackgroundColor,
2322
+ listItemBackgroundErrorColor
2323
+ }) => {
2324
+ const [i, setI] = React.useState(_ => _);
2325
+ const [t, setT] = React.useState(_ => _);
2326
+ const [progress, setProgress] = React.useState(7);
2327
+ const handleRemoveItem = id => {
2328
+ removeFile(id);
2329
+ };
2330
+ React.useEffect(() => {
2331
+ let time = Math.floor(Math.random() * (1100 - 900 + 1)) + 900;
2332
+ let fileSizeInMB = Math.round(size / (1024 * 1024));
2333
+ if (fileSizeInMB > 5) {
2334
+ 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];
2335
+ const index = Math.min(Math.floor((size - 1) / 15), times.length - 1);
2336
+ time = times[index];
2337
+ }
2338
+ setI(setInterval(() => {
2339
+ setProgress(prev => {
2340
+ return prev += 7;
2341
+ });
2342
+ }, time));
2343
+ return () => {
2344
+ setI(_ => _);
2345
+ clearTimeout(t);
2346
+ clearInterval(i);
2347
+ };
2348
+ }, []);
2349
+ React.useEffect(() => {
2350
+ if (progress > 84) {
2351
+ clearInterval(i);
2352
+ }
2353
+ }, [progress]);
2354
+ React.useEffect(() => {
2355
+ if (status === 'success') {
2356
+ setProgress(100);
2357
+ clearInterval(i);
2358
+ }
2359
+ if (status === 'failed') {
2360
+ setProgress(0);
2361
+ clearInterval(i);
2362
+ }
2363
+ }, [status]);
2364
+ React.useEffect(() => {
2365
+ if (check !== '') {
2366
+ setT(setTimeout(() => {
2367
+ removeFile(uuid);
2368
+ }, 3500));
2369
+ }
2370
+ }, [check]);
2371
+ return /*#__PURE__*/React__default["default"].createElement("div", {
2372
+ style: {
2373
+ width: '100%',
2374
+ display: 'flex',
2375
+ marginTop: '6px',
2376
+ alignItems: 'center',
2377
+ borderRadius: radius,
2378
+ height: listItemHeight,
2379
+ boxSizing: 'border-box',
2380
+ padding: listItemPadding,
2381
+ flexDirection: check !== '' ? 'column' : 'row',
2382
+ justifyContent: check !== '' ? 'space-around' : 'space-between',
2383
+ backgroundColor: check !== '' ? listItemBackgroundErrorColor : listItemBackgroundColor
2384
+ }
2385
+ }, check !== '' ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("p", {
2386
+ style: {
2387
+ margin: '0px',
2388
+ color: listItemErrorColor,
2389
+ fontSize: listItemErrorSize
2390
+ }
2391
+ }, name), /*#__PURE__*/React__default["default"].createElement("p", {
2392
+ style: {
2393
+ margin: '0px',
2394
+ color: listItemErrorColor,
2395
+ fontSize: listItemErrorSize
2396
+ }
2397
+ }, check)) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
2398
+ style: {
2399
+ width: '32px'
2400
+ }
2401
+ }, 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", {
2402
+ style: {
2403
+ position: 'relative',
2404
+ display: 'flex',
2405
+ height: '40px',
2406
+ margin: '0px 14px',
2407
+ alignItems: 'flex-end',
2408
+ width: 'calc(100% - 82px)'
2409
+ }
2410
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
2411
+ style: {
2412
+ width: '100%',
2413
+ height: '100%',
2414
+ display: 'flex',
2415
+ paddingTop: '5px',
2416
+ color: progressColor,
2417
+ boxSizing: 'border-box',
2418
+ alignItems: 'flex-start',
2419
+ fontSize: progressFontSize,
2420
+ justifyContent: 'space-between'
2421
+ }
2422
+ }, /*#__PURE__*/React__default["default"].createElement("p", {
2423
+ style: {
2424
+ margin: '0px',
2425
+ overflow: 'hidden',
2426
+ whiteSpace: 'nowrap',
2427
+ textOverflow: 'ellipsis',
2428
+ maxWidth: 'calc(100% - 56px)'
2429
+ }
2430
+ }, name), /*#__PURE__*/React__default["default"].createElement("span", null, progress, " %")), /*#__PURE__*/React__default["default"].createElement("div", {
2431
+ style: {
2432
+ position: 'absolute',
2433
+ left: '0px',
2434
+ bottom: '5px',
2435
+ width: '100%',
2436
+ height: '4px',
2437
+ borderRadius: '10px',
2438
+ backgroundColor: progressTrackColor
2439
+ }
2440
+ }, /*#__PURE__*/React__default["default"].createElement("div", {
2441
+ style: {
2442
+ height: '100%',
2443
+ borderRadius: '10px',
2444
+ width: status === 'failed' ? '100%' : progress + '%',
2445
+ backgroundColor: status === 'success' ? progressSuccessColor : status === 'failed' ? progressFailedColor : progressLoadingColor
2446
+ }
2447
+ }))), /*#__PURE__*/React__default["default"].createElement("div", {
2448
+ style: {
2449
+ width: '22px',
2450
+ cursor: 'pointer'
2451
+ },
2452
+ onClick: () => handleRemoveItem(uuid)
2453
+ }, /*#__PURE__*/React__default["default"].createElement(SvgListItemDelete, null))));
2454
+ });
2455
+
2456
+ const SvgUpload = ({
2457
+ title,
2458
+ titleId,
2459
+ ...props
2460
+ }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2461
+ width: "51",
2462
+ height: "35",
2463
+ viewBox: "0 0 51 35",
2464
+ fill: "none",
2465
+ xmlns: "http://www.w3.org/2000/svg",
2466
+ "aria-labelledby": titleId
2467
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2468
+ id: titleId
2469
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2470
+ 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",
2471
+ fill: "#D1D1D1"
2472
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2473
+ fillRule: "evenodd",
2474
+ clipRule: "evenodd",
2475
+ 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",
2476
+ fill: "#0DA574"
2477
+ }));
2478
+
2479
+ const SvgRemoveFile = ({
2480
+ title,
2481
+ titleId,
2482
+ ...props
2483
+ }) => /*#__PURE__*/React__namespace.createElement("svg", _extends({
2484
+ width: "26",
2485
+ height: "26",
2486
+ viewBox: "0 0 26 26",
2487
+ fill: "none",
2488
+ xmlns: "http://www.w3.org/2000/svg",
2489
+ "aria-labelledby": titleId
2490
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2491
+ id: titleId
2492
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("rect", {
2493
+ width: 26,
2494
+ height: 26,
2495
+ rx: 6,
2496
+ fill: "#FBFBFB"
2497
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2498
+ 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",
2499
+ fill: "#00236A"
2500
+ }));
2501
+
2296
2502
  const SvgDeleteComponent = ({
2297
2503
  title,
2298
2504
  titleId,
@@ -2319,6 +2525,7 @@ const SvgDeleteComponent = ({
2319
2525
  }));
2320
2526
 
2321
2527
  const NewFile = ({
2528
+ or,
2322
2529
  size,
2323
2530
  name,
2324
2531
  color,
@@ -2329,36 +2536,55 @@ const NewFile = ({
2329
2536
  radius,
2330
2537
  change,
2331
2538
  border,
2539
+ upload,
2332
2540
  maxSize,
2333
2541
  disabled,
2334
2542
  multiple,
2335
2543
  required,
2336
2544
  errorSize,
2337
2545
  labelSize,
2546
+ removeFile,
2338
2547
  labelColor,
2339
2548
  errorColor,
2340
2549
  filesArray,
2550
+ putFileHere,
2341
2551
  borderColor,
2342
2552
  uploadColor,
2343
2553
  defaultData,
2554
+ formatError,
2344
2555
  errorMessage,
2556
+ fileSizeText,
2557
+ maxSizeError,
2558
+ progressColor,
2559
+ noChoosenFile,
2345
2560
  fileExtensions,
2561
+ listItemHeight,
2346
2562
  backgroundColor,
2347
2563
  deleteComponent,
2564
+ listItemPadding,
2565
+ progressFontSize,
2348
2566
  borderHoverColor,
2567
+ listItemErrorSize,
2349
2568
  progressTrackColor,
2569
+ fileAreaImageWidth,
2570
+ listItemErrorColor,
2350
2571
  labelRequiredColor,
2572
+ progressFailedColor,
2573
+ fileAreaImageHeight,
2574
+ progressSuccessColor,
2575
+ progressLoadingColor,
2351
2576
  hiddenBackgroundColor,
2352
2577
  extentionsRowMarginTop,
2353
- listItemBackgroundColor
2578
+ listItemBackgroundColor,
2579
+ listItemBackgroundErrorColor
2354
2580
  }) => {
2355
2581
  const ref = React.useRef(null);
2356
2582
  const inpRef = React.useRef(null);
2583
+ const memoizedItems = React.useMemo(() => filesArray, [filesArray]);
2357
2584
  const [error, setError] = React.useState('');
2358
- const [image, setImage] = React.useState('');
2359
- const [progress, setProgress] = React.useState(5);
2360
2585
  const [isHover, setIsHover] = React.useState(false);
2361
- const [multipleFiles, setMultipleFiles] = React.useState([]);
2586
+ const [singleFile, setSingleFile] = React.useState(null);
2587
+ const [image, setImage] = React.useState(!multiple ? defaultData ? defaultData.type !== 'application/pdf' ? defaultData.url : 'pdf' : null : null);
2362
2588
  const configStyles = compereConfigs();
2363
2589
  const handleRemoveComponent = () => {
2364
2590
  const node = ReactDOM__default["default"].findDOMNode(ref.current);
@@ -2366,45 +2592,68 @@ const NewFile = ({
2366
2592
  parent.removeChild(node);
2367
2593
  };
2368
2594
  const handleRemoveFile = () => {
2369
- if (!multiple) {
2370
- setImage('');
2371
- onChange(null);
2372
- }
2595
+ setImage(null);
2596
+ removeFile(singleFile);
2373
2597
  };
2374
2598
  const handleChange = e => {
2375
2599
  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
- });
2600
+ if (multiple) {
2601
+ setError('');
2602
+ setImage(null);
2603
+ for (let ix = 0; ix < file.length; ix++) {
2604
+ if (file[ix]) {
2605
+ if (file[ix].size <= maxSize * Math.pow(2, 20)) {
2606
+ if (fileExtensions.includes(file[ix].type.split('/')[1])) {
2607
+ change({
2608
+ id: '',
2609
+ check: '',
2610
+ status: '',
2611
+ file: file[ix],
2612
+ uuid: v4()
2613
+ });
2614
+ } else {
2615
+ change({
2616
+ file: file[ix],
2617
+ uuid: v4(),
2618
+ check: formatError
2619
+ });
2620
+ }
2385
2621
  } else {
2386
2622
  change({
2387
- file
2623
+ file: file[ix],
2624
+ uuid: v4(),
2625
+ check: maxSizeError
2388
2626
  });
2627
+ }
2628
+ }
2629
+ }
2630
+ if (file.length === 0 && memoizedItems.length === 0) {
2631
+ setError(noChoosenFile);
2632
+ }
2633
+ } else {
2634
+ if (file[0]) {
2635
+ if (file[0].size <= maxSize * Math.pow(2, 20)) {
2636
+ if (fileExtensions.includes(file[0].type.split('/')[1])) {
2637
+ setError('');
2638
+ change(file);
2639
+ setSingleFile(file);
2389
2640
  if (file[0].type === 'application/pdf') {
2390
2641
  setImage('pdf');
2391
2642
  } else {
2392
2643
  setImage(URL.createObjectURL(file[0]));
2393
2644
  }
2645
+ } else {
2646
+ setImage(null);
2647
+ setError(formatError);
2394
2648
  }
2395
2649
  } else {
2396
- setImage('');
2397
- setError('ֆայլի սխալ ֆորմատ');
2650
+ setImage(null);
2651
+ setError(maxSizeError);
2398
2652
  }
2399
- } else {
2400
- setImage('');
2401
- setError('առավելագույն ծավալ');
2402
2653
  }
2403
- } else {
2404
- // TODO:
2405
- if (!multiple || multiple && filesArray && filesArray.length === 0) {
2406
- setImage('');
2407
- setError('Ֆայլը ընտրված չէ');
2654
+ if (file.length === 0) {
2655
+ setImage(null);
2656
+ setError(noChoosenFile);
2408
2657
  }
2409
2658
  }
2410
2659
  };
@@ -2413,6 +2662,21 @@ const NewFile = ({
2413
2662
  inpRef.current.click();
2414
2663
  }
2415
2664
  };
2665
+ const handleDrop = e => {
2666
+ if (!disabled) {
2667
+ e.preventDefault();
2668
+ handleChange({
2669
+ target: {
2670
+ files: e.dataTransfer.files
2671
+ }
2672
+ });
2673
+ }
2674
+ };
2675
+ const handleDragOver = e => {
2676
+ if (!disabled) {
2677
+ e.preventDefault();
2678
+ }
2679
+ };
2416
2680
  const handleMouseEnter = () => {
2417
2681
  setIsHover(true);
2418
2682
  };
@@ -2424,17 +2688,18 @@ const NewFile = ({
2424
2688
  };
2425
2689
  React.useEffect(() => {
2426
2690
  if (!multiple && defaultData) {
2427
- if (defaultData.type && defaultData.type !== 'application/pdf') {
2428
- setImage(defaultData.url);
2429
- } else {
2430
- setImage('pdf');
2691
+ if (!defaultData.type) {
2692
+ alert('Please add type in defaultData prop');
2693
+ }
2694
+ if (!defaultData.url) {
2695
+ alert('Please add url in defaultData prop');
2431
2696
  }
2432
2697
  }
2433
2698
  if (multiple && !filesArray) {
2434
2699
  alert('In multiple mode, you should add filesArray prop for drawing files');
2435
2700
  }
2436
- if (filesArray) {
2437
- setMultipleFiles(filesArray);
2701
+ if (multiple) {
2702
+ setSingleFile(null);
2438
2703
  }
2439
2704
  }, [multiple, filesArray && filesArray.length, defaultData]);
2440
2705
  React.useEffect(() => {
@@ -2448,8 +2713,10 @@ const NewFile = ({
2448
2713
  if (!change) {
2449
2714
  alert('Please add change prop on File component');
2450
2715
  }
2451
- }, [change]);
2452
- console.log(multipleFiles, 'multipleFiles');
2716
+ if (!removeFile) {
2717
+ alert('Please add removeFile prop on File component');
2718
+ }
2719
+ }, [change, removeFile]);
2453
2720
  return /*#__PURE__*/React__default["default"].createElement("div", {
2454
2721
  ref: ref,
2455
2722
  style: {
@@ -2491,7 +2758,9 @@ const NewFile = ({
2491
2758
  backgroundColor: backgroundColor ? backgroundColor : configStyles.File.backgroundColor,
2492
2759
  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
2760
  },
2761
+ onDrop: handleDrop,
2494
2762
  onClick: handleClick,
2763
+ onDragOver: handleDragOver,
2495
2764
  onMouseEnter: handleMouseEnter,
2496
2765
  onMouseLeave: handleMouseLeave
2497
2766
  }, /*#__PURE__*/React__default["default"].createElement("input", {
@@ -2500,6 +2769,7 @@ const NewFile = ({
2500
2769
  type: "file",
2501
2770
  ref: inpRef,
2502
2771
  disabled: disabled,
2772
+ multiple: multiple,
2503
2773
  onChange: handleChange
2504
2774
  }), /*#__PURE__*/React__default["default"].createElement("div", {
2505
2775
  style: {
@@ -2514,21 +2784,26 @@ const NewFile = ({
2514
2784
  fontSize: size ? size : configStyles.File.size,
2515
2785
  fontWeight: weight ? weight : configStyles.File.weight
2516
2786
  }
2517
- }, !multiple && image ? image === 'pdf' ? /*#__PURE__*/React__default["default"].createElement(PDF, null) : /*#__PURE__*/React__default["default"].createElement("img", {
2787
+ }, !multiple && image ? image === 'pdf' ? /*#__PURE__*/React__default["default"].createElement(SvgPdf, null) : /*#__PURE__*/React__default["default"].createElement("img", {
2518
2788
  src: image,
2519
2789
  style: {
2520
- maxHeight: '100%'
2790
+ display: 'block',
2791
+ maxWidth: '100%',
2792
+ maxHeight: '95%',
2793
+ objectFit: 'contain',
2794
+ width: fileAreaImageWidth ? fileAreaImageWidth : configStyles.File.fileAreaImageWidth,
2795
+ height: fileAreaImageHeight ? fileAreaImageHeight : configStyles.File.fileAreaImageHeight
2521
2796
  },
2522
2797
  alt: "file preview"
2523
2798
  }) : /*#__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
2799
  style: {
2525
2800
  margin: '0px'
2526
2801
  }
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", {
2802
+ }, putFileHere ? putFileHere : configStyles.File.putFileHere, /*#__PURE__*/React__default["default"].createElement("br", null), or ? or : configStyles.File.or, " ", /*#__PURE__*/React__default["default"].createElement("span", {
2528
2803
  style: {
2529
2804
  color: uploadColor ? uploadColor : configStyles.File.uploadColor
2530
2805
  }
2531
- }, "\u0532\u0565\u057C\u0576\u0565\u056C"))), /*#__PURE__*/React__default["default"].createElement("div", {
2806
+ }, upload ? upload : configStyles.File.upload))), /*#__PURE__*/React__default["default"].createElement("div", {
2532
2807
  style: {
2533
2808
  marginTop: extentionsRowMarginTop ? extentionsRowMarginTop : configStyles.File.extentionsRowMarginTop
2534
2809
  }
@@ -2536,7 +2811,7 @@ const NewFile = ({
2536
2811
  style: {
2537
2812
  margin: '0px'
2538
2813
  }
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", {
2814
+ }, fileSizeText ? fileSizeText : configStyles.File.fileSizeText, " ", maxSize, "\u0544\u0532 ( ", fileExtensions.toString().split(',').join(', '), " )")))), /*#__PURE__*/React__default["default"].createElement("div", {
2540
2815
  style: {
2541
2816
  position: 'absolute',
2542
2817
  top: '0px',
@@ -2566,62 +2841,34 @@ const NewFile = ({
2566
2841
  color: errorColor ? errorColor : configStyles.File.errorColor,
2567
2842
  fontSize: errorSize ? errorSize : configStyles.File.errorSize
2568
2843
  }
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)));
2844
+ }, error) : '', multiple && memoizedItems && memoizedItems.length > 0 && memoizedItems.map(item => {
2845
+ return /*#__PURE__*/React__default["default"].createElement(FileItem, {
2846
+ key: item.uuid,
2847
+ uuid: item.uuid,
2848
+ check: item.check,
2849
+ status: item.status,
2850
+ size: item.file.size,
2851
+ name: item.file.name,
2852
+ removeFile: removeFile,
2853
+ radius: radius ? radius : configStyles.File.radius,
2854
+ fileFormat: item.file.type.split('/')[1].toLowerCase(),
2855
+ progressColor: progressColor ? progressColor : configStyles.File.progressColor,
2856
+ listItemHeight: listItemHeight ? listItemHeight : configStyles.File.listItemHeight,
2857
+ listItemPadding: listItemPadding ? listItemPadding : configStyles.File.listItemPadding,
2858
+ progressFontSize: progressFontSize ? progressFontSize : configStyles.File.progressFontSize,
2859
+ listItemErrorSize: listItemErrorSize ? listItemErrorSize : configStyles.File.listItemErrorSize,
2860
+ listItemErrorColor: listItemErrorColor ? listItemErrorColor : configStyles.File.listItemErrorColor,
2861
+ progressTrackColor: progressTrackColor ? progressTrackColor : configStyles.File.progressTrackColor,
2862
+ progressFailedColor: progressFailedColor ? progressFailedColor : configStyles.File.progressFailedColor,
2863
+ progressSuccessColor: progressSuccessColor ? progressSuccessColor : configStyles.File.progressSuccessColor,
2864
+ progressLoadingColor: progressLoadingColor ? progressLoadingColor : configStyles.File.progressLoadingColor,
2865
+ listItemBackgroundColor: listItemBackgroundColor ? listItemBackgroundColor : configStyles.File.listItemBackgroundColor,
2866
+ listItemBackgroundErrorColor: listItemBackgroundErrorColor ? listItemBackgroundErrorColor : configStyles.File.listItemBackgroundErrorColor
2867
+ });
2622
2868
  }));
2623
2869
  };
2624
2870
  NewFile.propTypes = {
2871
+ or: PropTypes__default["default"].string,
2625
2872
  size: PropTypes__default["default"].string,
2626
2873
  label: PropTypes__default["default"].string,
2627
2874
  width: PropTypes__default["default"].string,
@@ -2631,30 +2878,49 @@ NewFile.propTypes = {
2631
2878
  radius: PropTypes__default["default"].string,
2632
2879
  border: PropTypes__default["default"].string,
2633
2880
  required: PropTypes__default["default"].bool,
2881
+ upload: PropTypes__default["default"].string,
2634
2882
  weight: PropTypes__default["default"].number,
2635
2883
  maxSize: PropTypes__default["default"].number,
2636
2884
  errorSize: PropTypes__default["default"].string,
2637
2885
  labelSize: PropTypes__default["default"].string,
2638
2886
  labelColor: PropTypes__default["default"].string,
2639
2887
  errorColor: PropTypes__default["default"].string,
2888
+ formatError: PropTypes__default["default"].string,
2889
+ putFileHere: PropTypes__default["default"].string,
2640
2890
  borderColor: PropTypes__default["default"].string,
2641
2891
  uploadColor: PropTypes__default["default"].string,
2642
2892
  defaultData: PropTypes__default["default"].object,
2893
+ maxSizeError: PropTypes__default["default"].string,
2643
2894
  errorMessage: PropTypes__default["default"].string,
2895
+ fileSizeText: PropTypes__default["default"].string,
2896
+ noChoosenFile: PropTypes__default["default"].string,
2897
+ progressColor: PropTypes__default["default"].string,
2644
2898
  deleteComponent: PropTypes__default["default"].bool,
2899
+ listItemHeight: PropTypes__default["default"].string,
2645
2900
  backgroundColor: PropTypes__default["default"].string,
2646
2901
  change: PropTypes__default["default"].func.isRequired,
2902
+ listItemPadding: PropTypes__default["default"].string,
2903
+ progressFontSize: PropTypes__default["default"].string,
2647
2904
  borderHoverColor: PropTypes__default["default"].string,
2905
+ listItemErrorSize: PropTypes__default["default"].string,
2648
2906
  labelRequiredColor: PropTypes__default["default"].string,
2649
2907
  progressTrackColor: PropTypes__default["default"].string,
2908
+ fileAreaImageWidth: PropTypes__default["default"].string,
2909
+ listItemErrorColor: PropTypes__default["default"].string,
2910
+ removeFile: PropTypes__default["default"].func.isRequired,
2911
+ fileAreaImageHeight: PropTypes__default["default"].string,
2912
+ progressFailedColor: PropTypes__default["default"].string,
2913
+ progressSuccessColor: PropTypes__default["default"].string,
2914
+ progressLoadingColor: PropTypes__default["default"].string,
2650
2915
  hiddenBackgroundColor: PropTypes__default["default"].string,
2651
2916
  extentionsRowMarginTop: PropTypes__default["default"].string,
2652
2917
  listItemBackgroundColor: PropTypes__default["default"].string,
2918
+ listItemBackgroundErrorColor: PropTypes__default["default"].string,
2653
2919
  filesArray: PropTypes__default["default"].arrayOf(PropTypes__default["default"].object),
2654
2920
  fileExtensions: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string)
2655
2921
  };
2656
2922
  NewFile.defaultProps = {
2657
- maxSize: 5,
2923
+ maxSize: 50,
2658
2924
  fileExtensions: ['jpg', 'jpeg', 'png', 'pdf']
2659
2925
  };
2660
2926
 
@@ -2680,17 +2946,21 @@ const Textarea = ({
2680
2946
  boxSizing,
2681
2947
  maxLength,
2682
2948
  labelSize,
2949
+ errorSize,
2683
2950
  labelColor,
2951
+ errorColor,
2684
2952
  borderColor,
2685
2953
  labelWeight,
2686
2954
  placeholder,
2687
2955
  labelDisplay,
2956
+ errorMesaage,
2688
2957
  backgroundColor,
2689
2958
  borderFocusColor,
2690
2959
  borderHoverColor,
2691
2960
  showCharacterCount,
2692
2961
  labelRequiredColor
2693
2962
  }) => {
2963
+ const [error, setError] = React.useState('');
2694
2964
  const [isHover, setIsHover] = React.useState(false);
2695
2965
  const [isFocus, setIsFocus] = React.useState(false);
2696
2966
  const [innerValue, setInnerValue] = React.useState('');
@@ -2713,10 +2983,16 @@ const Textarea = ({
2713
2983
  if (maxLength) {
2714
2984
  if (value.length > maxLength) {
2715
2985
  onChange(value.substr(0, maxLength));
2986
+ setError('Նիշերի քանակը գերազանցում է');
2987
+ } else {
2988
+ setError('');
2716
2989
  }
2717
2990
  } else {
2718
2991
  if (value.length > configStyles.TEXTAREA.maxLength) {
2992
+ setError('Նիշերի քանակը գերազանցում է');
2719
2993
  onChange(value.substr(0, configStyles.TEXTAREA.maxLength));
2994
+ } else {
2995
+ setError('');
2720
2996
  }
2721
2997
  }
2722
2998
  };
@@ -2729,6 +3005,13 @@ const Textarea = ({
2729
3005
  }
2730
3006
  setInnerValue(value);
2731
3007
  }, [value, onChange]);
3008
+ React.useEffect(() => {
3009
+ if (errorMesaage) {
3010
+ setError(errorMesaage);
3011
+ } else {
3012
+ setError('');
3013
+ }
3014
+ }, [errorMesaage]);
2732
3015
  return /*#__PURE__*/React__default["default"].createElement("div", {
2733
3016
  style: {
2734
3017
  width: width ? width : configStyles.TEXTAREA.width
@@ -2771,7 +3054,7 @@ const Textarea = ({
2771
3054
  maxHeight: maxHeight ? maxHeight : configStyles.TEXTAREA.maxHeight,
2772
3055
  boxSizing: boxSizing ? boxSizing : configStyles.TEXTAREA.boxSizing,
2773
3056
  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,
3057
+ 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
3058
  resize: resize ? resize : configStyles.TEXTAREA.resize
2776
3059
  },
2777
3060
  value: innerValue,
@@ -2781,7 +3064,14 @@ const Textarea = ({
2781
3064
  placeholder: placeholder,
2782
3065
  onMouseEnter: handleMouseEnter,
2783
3066
  onMouseLeave: handleMouseLeave
2784
- }));
3067
+ }), error ? /*#__PURE__*/React__default["default"].createElement("span", {
3068
+ style: {
3069
+ marginTop: '6px',
3070
+ display: 'inline-block',
3071
+ fontSize: errorSize ? errorSize : configStyles.TEXTAREA.errorSize,
3072
+ color: errorColor ? errorColor : configStyles.TEXTAREA.errorColor
3073
+ }
3074
+ }, error) : '');
2785
3075
  };
2786
3076
  Textarea.propTypes = {
2787
3077
  size: PropTypes__default["default"].string,
@@ -2814,7 +3104,7 @@ Textarea.propTypes = {
2814
3104
  labelRequiredColor: PropTypes__default["default"].string
2815
3105
  };
2816
3106
 
2817
- 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}";
3107
+ 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}";
2818
3108
  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"};
2819
3109
  styleInject(css_248z$1);
2820
3110
 
@@ -2903,6 +3193,7 @@ const SvgNextarrow = ({
2903
3193
  }));
2904
3194
 
2905
3195
  const Pagination = ({
3196
+ goTo,
2906
3197
  onChange,
2907
3198
  totalCount,
2908
3199
  siblingCount,
@@ -2910,6 +3201,8 @@ const Pagination = ({
2910
3201
  offset,
2911
3202
  className
2912
3203
  }) => {
3204
+ const [inpVal, setInpVal] = React.useState('');
3205
+ const [error, setError] = React.useState(false);
2913
3206
  const [siblingCountNumber, setSibilingCountNumber] = React.useState(siblingCount);
2914
3207
  const [currentPageNumber, setCurrentPage] = React.useState(currentPage);
2915
3208
  const [currentTotalCount, setcurrentTotalCount] = React.useState(totalCount);
@@ -2952,6 +3245,40 @@ const Pagination = ({
2952
3245
  const onPreviousFive = e => {
2953
3246
  currentPageNumber !== 5 ? onPageChange(currentPageNumber - 5) : onPageChange(currentPageNumber - 4);
2954
3247
  };
3248
+ const handleChangeInput = e => {
3249
+ setError(false);
3250
+ if (e.target.value.trim() !== '') {
3251
+ const val = parseInt(e.target.value);
3252
+ if (Number.isInteger(val)) {
3253
+ setInpVal(val);
3254
+ } else {
3255
+ setInpVal('');
3256
+ }
3257
+ } else {
3258
+ setInpVal('');
3259
+ }
3260
+ };
3261
+ const handleKeyDown = e => {
3262
+ const forbiddenKeys = ["e", ".", "+", "-"];
3263
+ if (forbiddenKeys.includes(e.key)) {
3264
+ e.preventDefault();
3265
+ }
3266
+ if (e.keyCode === 13) {
3267
+ if (inpVal === '') {
3268
+ setError(true);
3269
+ } else {
3270
+ if (inpVal <= 1) {
3271
+ setInpVal(1);
3272
+ onPageChange(1);
3273
+ } else if (inpVal >= totalCount / offset) {
3274
+ setInpVal(Math.ceil(totalCount / offset));
3275
+ onPageChange(Math.ceil(totalCount / offset));
3276
+ } else {
3277
+ onPageChange(inpVal);
3278
+ }
3279
+ }
3280
+ }
3281
+ };
2955
3282
  let lastPage = paginationRange[paginationRange.length - 1];
2956
3283
  return /*#__PURE__*/React__default["default"].createElement("ul", {
2957
3284
  className: classProps
@@ -2959,9 +3286,9 @@ const Pagination = ({
2959
3286
  style: {
2960
3287
  transform: 'rotate(180deg)'
2961
3288
  },
2962
- className: `${styles$1["pagination-btn"]} pagination-btn-rem`,
2963
3289
  onClick: onPrevious,
2964
- disabled: currentPage === 1 ? true : false
3290
+ disabled: currentPage === 1 ? true : false,
3291
+ className: `${styles$1["pagination-btn"]} pagination-btn-rem`
2965
3292
  }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null)), paginationRange.map((pageNumber, id) => {
2966
3293
  if (pageNumber === Dots) {
2967
3294
  let currentPageIndex = paginationRange.indexOf(currentPageNumber);
@@ -2990,11 +3317,35 @@ const Pagination = ({
2990
3317
  }, pageNumber);
2991
3318
  }), /*#__PURE__*/React__default["default"].createElement("button", {
2992
3319
  onClick: onNext,
2993
- className: `${styles$1["pagination-btn"]} pagination-btn-rem`,
2994
- disabled: currentPageNumber === lastPage ? true : false
2995
- }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null)));
3320
+ disabled: currentPageNumber === lastPage ? true : false,
3321
+ className: `${styles$1["pagination-btn"]} pagination-btn-rem`
3322
+ }, /*#__PURE__*/React__default["default"].createElement(SvgNextarrow, null)), goTo && /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("input", {
3323
+ onKeyDown: handleKeyDown,
3324
+ onInput: handleChangeInput,
3325
+ type: "number",
3326
+ style: {
3327
+ width: '53px',
3328
+ height: '30px',
3329
+ outline: 'none',
3330
+ color: '#3C393E',
3331
+ fontSize: '13px',
3332
+ margin: '0px 6px',
3333
+ fontWeight: '500',
3334
+ textAlign: 'center',
3335
+ border: '1px solid',
3336
+ borderRadius: '6px',
3337
+ borderColor: error ? 'red' : '#00236a'
3338
+ },
3339
+ value: inpVal
3340
+ }), /*#__PURE__*/React__default["default"].createElement("span", {
3341
+ style: {
3342
+ color: '#3C393E',
3343
+ fontSize: '13px'
3344
+ }
3345
+ }, "\u0537\u057B")));
2996
3346
  };
2997
3347
  Pagination.propTypes = {
3348
+ goTo: PropTypes__default["default"].bool,
2998
3349
  offset: PropTypes__default["default"].number,
2999
3350
  totalCount: PropTypes__default["default"].number,
3000
3351
  className: PropTypes__default["default"].string,
@@ -3144,6 +3495,7 @@ Autocomplate.defaultProps = {
3144
3495
 
3145
3496
  const NewAutocomplete = ({
3146
3497
  label,
3498
+ change,
3147
3499
  options,
3148
3500
  getItem,
3149
3501
  required,
@@ -3217,6 +3569,7 @@ const NewAutocomplete = ({
3217
3569
  const [isHover, setIsHover] = React.useState(false);
3218
3570
  const [isFocus, setIsFocus] = React.useState(false);
3219
3571
  const [innerValue, setInnerValue] = React.useState('');
3572
+ const [innerOptions, setInnerOptions] = React.useState([]);
3220
3573
  const configStyles = compereConfigs();
3221
3574
  const showOption = styled.keyframes`
3222
3575
  100% {
@@ -3250,13 +3603,18 @@ const NewAutocomplete = ({
3250
3603
  const value = e.target.value;
3251
3604
  value.length > 0 ? setShow(true) : setShow(false);
3252
3605
  setInnerValue(value);
3606
+ if (value.length >= searchCount) {
3607
+ change(value);
3608
+ } else {
3609
+ change('');
3610
+ }
3253
3611
  };
3254
3612
  const handleClick = selectedValue => {
3255
3613
  setShow(false);
3256
3614
  getItem(selectedValue);
3257
- setInnerValue(selectedValue.value);
3615
+ setInnerValue(selectedValue.name);
3258
3616
  };
3259
- const optionList = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, show && options && options.length > 0 && /*#__PURE__*/React__default["default"].createElement("div", {
3617
+ const optionList = /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, show && innerOptions ? innerOptions.length > 0 ? /*#__PURE__*/React__default["default"].createElement("div", {
3260
3618
  style: {
3261
3619
  left: contentBottomLeft ? contentBottomLeft : configStyles.NEWAUTOCOMPLETE.contentBottomLeft,
3262
3620
  width: contentBottomWidth ? contentBottomWidth : configStyles.NEWAUTOCOMPLETE.contentBottomWidth,
@@ -3279,9 +3637,9 @@ const NewAutocomplete = ({
3279
3637
  maxHeight: contentBottomInnerMaxHeight ? contentBottomInnerMaxHeight : configStyles.NEWAUTOCOMPLETE.contentBottomInnerMaxHeight,
3280
3638
  flexDirection: contentBottomInnerDirection ? contentBottomInnerDirection : configStyles.NEWAUTOCOMPLETE.contentBottomInnerDirection
3281
3639
  }
3282
- }, innerValue.length >= searchCount ? options.filter(item => item.value.includes(innerValue)).length > 0 ? options.filter(item => item.value.includes(innerValue)).map((item, index) => {
3640
+ }, innerOptions.map(item => {
3283
3641
  return /*#__PURE__*/React__default["default"].createElement("p", {
3284
- key: `${item}_${index}`,
3642
+ key: item.id,
3285
3643
  onMouseEnter: handleRowMouseEnter,
3286
3644
  onMouseLeave: handleRowMouseLeave,
3287
3645
  onClick: () => handleClick(item),
@@ -3301,40 +3659,37 @@ const NewAutocomplete = ({
3301
3659
  marginBottom: contentBottomRowMarginBottom ? contentBottomRowMarginBottom : configStyles.NEWAUTOCOMPLETE.contentBottomRowMarginBottom,
3302
3660
  backgroundColor: contentBottomRowBackgroundColor ? contentBottomRowBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomRowBackgroundColor
3303
3661
  }
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", {
3662
+ }, item.name);
3663
+ }))) : innerOptions.length <= 0 ? /*#__PURE__*/React__default["default"].createElement("p", {
3314
3664
  style: {
3665
+ margin: '0px',
3315
3666
  color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
3316
3667
  fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
3317
3668
  height: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
3318
3669
  padding: contentBottomRowPadding ? contentBottomRowPadding : configStyles.NEWAUTOCOMPLETE.contentBottomRowPadding,
3319
- lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight
3670
+ lineHeight: contentBottomRowHeight ? contentBottomRowHeight : configStyles.NEWAUTOCOMPLETE.contentBottomRowHeight,
3671
+ backgroundColor: contentBottomBackgroundColor ? contentBottomBackgroundColor : configStyles.NEWAUTOCOMPLETE.contentBottomBackgroundColor
3320
3672
  }
3321
- }, innerValue.length < searchCount && `Լրացնել առնվազն ${searchCount} նիշ`))));
3673
+ }, innerValue.length >= searchCount ? 'Նման տվյալ առկա չէ' : `Լրացնել առնվազն ${searchCount} նիշ`) : '' : '');
3322
3674
  React.useEffect(() => {
3323
- if (!options) {
3324
- alert('Please add array of options');
3325
- }
3326
- if (options.length === 0) {
3327
- alert('Please fill options array');
3675
+ if (options === undefined) {
3676
+ alert('Please add options prop');
3328
3677
  }
3329
3678
  options && options.length > 0 && options.map(item => {
3330
- if (!item.hasOwnProperty('value')) {
3331
- alert('Please add value property in items of options array');
3679
+ if (!item.hasOwnProperty('name')) {
3680
+ alert('Please add name property in items of options array');
3332
3681
  }
3333
3682
  });
3334
3683
  if (!getItem) {
3335
3684
  alert('Please add getItem function for get choosen item from autocomplete');
3336
3685
  }
3337
- }, [options, getItem]);
3686
+ options && setInnerOptions(options);
3687
+ }, [options, options.length, getItem]);
3688
+ React.useEffect(() => {
3689
+ if (!change) {
3690
+ alert('Please add change prop on New Autocomplete component');
3691
+ }
3692
+ }, [change]);
3338
3693
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label ? /*#__PURE__*/React__default["default"].createElement("label", {
3339
3694
  style: {
3340
3695
  color: labelColor ? labelColor : configStyles.NEWAUTOCOMPLETE.labelColor,
@@ -3342,6 +3697,7 @@ const NewAutocomplete = ({
3342
3697
  display: labelDisplay ? labelDisplay : configStyles.NEWAUTOCOMPLETE.labelDisplay,
3343
3698
  fontWeight: labelWeight ? labelWeight : configStyles.NEWAUTOCOMPLETE.labelWeight,
3344
3699
  lineHeight: labelLineHeight ? labelLineHeight : configStyles.NEWAUTOCOMPLETE.labelLineHeight,
3700
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
3345
3701
  marginBottom: labelMarginBottom ? labelMarginBottom : configStyles.NEWAUTOCOMPLETE.labelMarginBottom,
3346
3702
  textTransform: labelTextTransform ? labelTextTransform : configStyles.NEWAUTOCOMPLETE.labelTextTransform
3347
3703
  }
@@ -3353,7 +3709,8 @@ const NewAutocomplete = ({
3353
3709
  style: {
3354
3710
  display: contentDisplay ? contentDisplay : configStyles.NEWAUTOCOMPLETE.contentDisplay,
3355
3711
  position: contentPosition ? contentPosition : configStyles.NEWAUTOCOMPLETE.contentPosition,
3356
- flexDirection: contentDirection ? contentDirection : configStyles.NEWAUTOCOMPLETE.contentDirection
3712
+ flexDirection: contentDirection ? contentDirection : configStyles.NEWAUTOCOMPLETE.contentDirection,
3713
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
3357
3714
  }
3358
3715
  }, /*#__PURE__*/React__default["default"].createElement("input", _extends({
3359
3716
  type: "text",
@@ -3362,11 +3719,12 @@ const NewAutocomplete = ({
3362
3719
  onBlur: handleBlur,
3363
3720
  onFocus: handleFocus,
3364
3721
  onInput: handleChange,
3365
- placeholder: placeHolder ? placeHolder : '',
3366
- autoComplete: autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete,
3367
3722
  onMouseEnter: handleMouseEnter,
3368
3723
  onMouseLeave: handleMouseLeave,
3724
+ placeholder: placeHolder ? placeHolder : '',
3725
+ autoComplete: autoComplete ? autoComplete : configStyles.NEWAUTOCOMPLETE.autoComplete,
3369
3726
  style: {
3727
+ maxWidth: '100%',
3370
3728
  transition: 'all 240ms',
3371
3729
  cursor: disabled ? 'not-allowed' : 'auto',
3372
3730
  color: contentTopColor ? contentTopColor : configStyles.NEWAUTOCOMPLETE.contentTopColor,
@@ -3377,7 +3735,6 @@ const NewAutocomplete = ({
3377
3735
  display: contentTopDisplay ? contentTopDisplay : configStyles.NEWAUTOCOMPLETE.contentTopDisplay,
3378
3736
  fontWeight: contentTopWeight ? contentTopWeight : configStyles.NEWAUTOCOMPLETE.contentTopWeight,
3379
3737
  borderRadius: contentTopRadius ? contentTopRadius : configStyles.NEWAUTOCOMPLETE.contentTopRadius,
3380
- maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth,
3381
3738
  boxSizing: contentTopBoxSizing ? contentTopBoxSizing : configStyles.NEWAUTOCOMPLETE.contentTopBoxSizing,
3382
3739
  lineHeight: contentTopLineHeight ? contentTopLineHeight : configStyles.NEWAUTOCOMPLETE.contentTopLineHeight,
3383
3740
  flexDirection: contentTopDirection ? contentTopDirection : configStyles.NEWAUTOCOMPLETE.contentTopDirection,
@@ -3385,8 +3742,11 @@ const NewAutocomplete = ({
3385
3742
  }
3386
3743
  }, props)), errorMessage ? /*#__PURE__*/React__default["default"].createElement("span", {
3387
3744
  style: {
3745
+ margin: '0px',
3746
+ display: 'inline-block',
3388
3747
  color: errorColor ? errorColor : configStyles.NEWAUTOCOMPLETE.errorColor,
3389
- fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize
3748
+ fontSize: errorSize ? errorSize : configStyles.NEWAUTOCOMPLETE.errorSize,
3749
+ maxWidth: contentTopMaxWidth ? contentTopMaxWidth : configStyles.NEWAUTOCOMPLETE.contentTopMaxWidth
3390
3750
  }
3391
3751
  }, errorMessage) : '', optionList));
3392
3752
  };
@@ -3409,6 +3769,7 @@ NewAutocomplete.propTypes = {
3409
3769
  contentPosition: PropTypes__default["default"].string,
3410
3770
  labelLineHeight: PropTypes__default["default"].string,
3411
3771
  contentTopColor: PropTypes__default["default"].string,
3772
+ change: PropTypes__default["default"].func.isRequired,
3412
3773
  contentDirection: PropTypes__default["default"].string,
3413
3774
  contentTopWeight: PropTypes__default["default"].number,
3414
3775
  contentTopRadius: PropTypes__default["default"].string,