astrum-ui 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -198,7 +198,6 @@ var Checkbox = React4.forwardRef(
198
198
  ({
199
199
  checked: checkedProp,
200
200
  indeterminate = false,
201
- size = "m",
202
201
  disabled = false,
203
202
  onChange,
204
203
  className = "",
@@ -239,7 +238,7 @@ var Checkbox = React4.forwardRef(
239
238
  htmlFor: inputId,
240
239
  className: [
241
240
  "astrum-checkbox",
242
- size === "s" ? "astrum-checkbox--s" : "astrum-checkbox--m",
241
+ "astrum-checkbox--m",
243
242
  isChecked ? "astrum-checkbox--checked" : "",
244
243
  indeterminate ? "astrum-checkbox--indeterminate" : "",
245
244
  disabled ? "astrum-checkbox--disabled" : "",
@@ -382,36 +381,27 @@ var Input = React6.forwardRef(
382
381
  const handleClear = React6.useCallback(
383
382
  (e) => {
384
383
  e.stopPropagation();
385
- if (inputRef.current) {
386
- if (isControlled && onChange) {
384
+ if (!inputRef.current) return;
385
+ inputRef.current.value = "";
386
+ if (isControlled && onChange) {
387
+ const syntheticEvent = {
388
+ ...e,
389
+ target: inputRef.current,
390
+ currentTarget: inputRef.current
391
+ };
392
+ onChange(syntheticEvent);
393
+ } else {
394
+ setInternalValue("");
395
+ if (onChange) {
387
396
  const syntheticEvent = {
388
397
  ...e,
389
398
  target: inputRef.current,
390
399
  currentTarget: inputRef.current
391
400
  };
392
- Object.defineProperty(syntheticEvent.target, "value", {
393
- writable: true,
394
- value: ""
395
- });
396
401
  onChange(syntheticEvent);
397
- } else {
398
- setInternalValue("");
399
- inputRef.current.value = "";
400
- if (onChange) {
401
- const syntheticEvent = {
402
- ...e,
403
- target: inputRef.current,
404
- currentTarget: inputRef.current
405
- };
406
- Object.defineProperty(syntheticEvent.target, "value", {
407
- writable: true,
408
- value: ""
409
- });
410
- onChange(syntheticEvent);
411
- }
412
402
  }
413
- inputRef.current.focus();
414
403
  }
404
+ inputRef.current.focus();
415
405
  },
416
406
  [onChange, isControlled]
417
407
  );
@@ -663,25 +653,14 @@ InputCode.displayName = "InputCode";
663
653
 
664
654
  // src/Select/Select.tsx
665
655
  import * as React8 from "react";
666
- import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
667
- var ChevronDownIcon = () => /* @__PURE__ */ jsx8("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx8(
668
- "path",
669
- {
670
- d: "M5 7.5l5 5 5-5",
671
- stroke: "currentColor",
672
- strokeWidth: "1.5",
673
- strokeLinecap: "round",
674
- strokeLinejoin: "round"
675
- }
676
- ) });
656
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
657
+ var ChevronDownIcon = () => /* @__PURE__ */ jsx8("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx8("path", { d: "M6 9L12 15L18 9", stroke: "#5988FF", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }) });
677
658
  var Select = React8.forwardRef(
678
659
  ({
679
- label,
680
660
  error,
681
661
  required,
682
662
  options,
683
663
  placeholder,
684
- size = "m",
685
664
  className = "",
686
665
  id: idProp,
687
666
  value,
@@ -693,6 +672,7 @@ var Select = React8.forwardRef(
693
672
  const id = React8.useId();
694
673
  const selectId = idProp ?? id;
695
674
  const [isOpen, setIsOpen] = React8.useState(false);
675
+ const [internalValue, setInternalValue] = React8.useState(defaultValue ?? "");
696
676
  const selectRef = React8.useRef(null);
697
677
  const dropdownRef = React8.useRef(null);
698
678
  const containerRef = React8.useRef(null);
@@ -704,9 +684,12 @@ var Select = React8.forwardRef(
704
684
  },
705
685
  [ref]
706
686
  );
707
- const currentValue = value !== void 0 ? value : defaultValue ?? "";
687
+ const currentValue = value !== void 0 ? value : internalValue;
708
688
  const selectedOption = currentValue ? options.find((opt) => opt.value === currentValue) : null;
709
689
  const displayValue = selectedOption ? selectedOption.label : placeholder ?? "";
690
+ React8.useEffect(() => {
691
+ if (value === void 0) setInternalValue(defaultValue ?? "");
692
+ }, [value, defaultValue]);
710
693
  React8.useEffect(() => {
711
694
  const handleClickOutside = (e) => {
712
695
  if (containerRef.current && !containerRef.current.contains(e.target) && dropdownRef.current && !dropdownRef.current.contains(e.target)) {
@@ -720,6 +703,7 @@ var Select = React8.forwardRef(
720
703
  }, [isOpen]);
721
704
  const handleOptionClick = (optionValue) => {
722
705
  if (selectRef.current) {
706
+ if (value === void 0) setInternalValue(optionValue);
723
707
  const nativeEvent = new Event("change", { bubbles: true });
724
708
  Object.defineProperty(nativeEvent, "target", {
725
709
  writable: false,
@@ -747,17 +731,12 @@ var Select = React8.forwardRef(
747
731
  setIsOpen(true);
748
732
  }
749
733
  };
750
- return /* @__PURE__ */ jsxs7(Fragment3, { children: [
734
+ return /* @__PURE__ */ jsxs7("div", { ref: containerRef, className: "astrum-select__container", children: [
751
735
  /* @__PURE__ */ jsxs7(
752
736
  "div",
753
737
  {
754
- ref: containerRef,
755
- className: `astrum-select ${size === "s" ? "astrum-select--s" : size === "l" ? "astrum-select--l" : "astrum-select--m"} ${error ? "astrum-select--error" : ""} ${isOpen ? "astrum-select--open" : ""} ${className}`.trim(),
738
+ className: `astrum-select ${error ? "astrum-select--error" : ""} ${isOpen ? "astrum-select--open" : ""} ${className}`.trim(),
756
739
  children: [
757
- label != null && /* @__PURE__ */ jsxs7("label", { htmlFor: selectId, className: "astrum-select__label", children: [
758
- label,
759
- required && /* @__PURE__ */ jsx8("span", { className: "astrum-select__required", "aria-hidden": true, children: "*" })
760
- ] }),
761
740
  /* @__PURE__ */ jsxs7("div", { className: "astrum-select__wrap", children: [
762
741
  /* @__PURE__ */ jsxs7(
763
742
  "select",
@@ -768,6 +747,7 @@ var Select = React8.forwardRef(
768
747
  value: value !== void 0 ? value : void 0,
769
748
  defaultValue: value === void 0 ? defaultValue : void 0,
770
749
  onChange: (e) => {
750
+ if (value === void 0) setInternalValue(e.target.value);
771
751
  onChange?.(e);
772
752
  setIsOpen(false);
773
753
  },
@@ -813,16 +793,19 @@ var Select = React8.forwardRef(
813
793
  ]
814
794
  }
815
795
  ),
816
- isOpen && /* @__PURE__ */ jsx8("div", { ref: dropdownRef, className: "astrum-select__dropdown", role: "listbox", children: options.map((option) => /* @__PURE__ */ jsx8(
796
+ isOpen && /* @__PURE__ */ jsx8("div", { ref: dropdownRef, className: "astrum-select__dropdown", role: "listbox", children: options.map((option) => /* @__PURE__ */ jsxs7(
817
797
  "button",
818
798
  {
819
799
  type: "button",
820
800
  role: "option",
821
801
  "aria-selected": option.value === currentValue,
822
- className: `astrum-select__option ${option.value === currentValue ? "astrum-select__option--selected" : ""} ${option.disabled ? "astrum-select__option--disabled" : ""}`,
802
+ className: `astrum-select__option ${option.value === currentValue ? "astrum-select__option--selected" : ""} ${option.disabled ? "astrum-select__option--disabled" : ""} ${option.secondaryLabel != null ? "astrum-select__option--two-line" : ""}`,
823
803
  onClick: () => !option.disabled && handleOptionClick(option.value),
824
804
  disabled: option.disabled,
825
- children: option.label
805
+ children: [
806
+ /* @__PURE__ */ jsx8("span", { className: "astrum-select__option-label", children: option.label }),
807
+ option.secondaryLabel != null && /* @__PURE__ */ jsx8("span", { className: "astrum-select__option-caption", children: option.secondaryLabel })
808
+ ]
826
809
  },
827
810
  option.value
828
811
  )) })
@@ -897,39 +880,19 @@ Chips.displayName = "Chips";
897
880
 
898
881
  // src/FileUpload/FileUpload.tsx
899
882
  import * as React10 from "react";
900
- import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
901
- var UploadIcon = () => /* @__PURE__ */ jsx10("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx10(
902
- "path",
903
- {
904
- d: "M24 8v24m0 0l-8-8m8 8l8-8M8 32h32",
905
- stroke: "currentColor",
906
- strokeWidth: "2",
907
- strokeLinecap: "round",
908
- strokeLinejoin: "round"
909
- }
910
- ) });
911
- var FileIcon = () => /* @__PURE__ */ jsxs9("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: [
912
- /* @__PURE__ */ jsx10(
913
- "path",
914
- {
915
- d: "M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z",
916
- stroke: "currentColor",
917
- strokeWidth: "1.5",
918
- strokeLinecap: "round",
919
- strokeLinejoin: "round"
920
- }
921
- ),
922
- /* @__PURE__ */ jsx10("path", { d: "M14 2v6h6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
883
+ import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
884
+ var UploadIcon = () => /* @__PURE__ */ jsxs9("svg", { xmlns: "http://www.w3.org/2000/svg", width: "64", height: "64", viewBox: "0 0 64 64", fill: "none", children: [
885
+ /* @__PURE__ */ jsx10("path", { d: "M12.2666 53.1766C12.2666 54.7295 13.5372 56.0001 15.0901 56.0001H48.9725C50.5254 56.0001 51.796 54.7295 51.796 53.1766C51.796 51.6236 50.5254 50.353 48.9725 50.353H15.0901C13.5372 50.353 12.2666 51.6236 12.2666 53.1766Z", fill: "#D5D5D5" }),
886
+ /* @__PURE__ */ jsx10("path", { d: "M44.9917 26.6142H40.5023V40.7319C40.5023 42.2848 39.2317 43.5554 37.6787 43.5554H26.3846C24.8317 43.5554 23.5611 42.2848 23.5611 40.7319V26.6142H19.0717C16.5587 26.6142 15.2881 23.5648 17.067 21.786L30.027 8.82601C31.1281 7.72483 32.907 7.72483 34.0081 8.82601L46.9681 21.786C48.747 23.5648 47.5046 26.6142 44.9917 26.6142Z", fill: "#D5D5D5" })
887
+ ] });
888
+ var FileIcon = () => /* @__PURE__ */ jsxs9("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
889
+ /* @__PURE__ */ jsx10("path", { d: "M9 3.8C9 3.32261 9.18964 2.86477 9.52721 2.52721C9.86477 2.18964 10.3226 2 10.8 2H15.4548C15.932 2.00042 16.3896 2.19034 16.7268 2.528L20.4732 6.272C20.6405 6.43937 20.7731 6.63808 20.8635 6.85675C20.9539 7.07543 21.0003 7.30978 21 7.5464V14.6C21 15.0774 20.8104 15.5352 20.4728 15.8728C20.1352 16.2104 19.6774 16.4 19.2 16.4H18V12.3452C17.9998 11.3905 17.6204 10.475 16.9452 9.8L13.2 6.0548C12.525 5.37962 11.6095 5.0002 10.6548 5H9V3.8Z", fill: "#2653f2" }),
890
+ /* @__PURE__ */ jsx10("path", { d: "M4.95 7C4.43283 7 3.93684 7.19755 3.57114 7.54918C3.20545 7.90081 3 8.37772 3 8.875V20.125C3 20.6223 3.20545 21.0992 3.57114 21.4508C3.93684 21.8025 4.43283 22 4.95 22H14.05C14.5672 22 15.0632 21.8025 15.4289 21.4508C15.7946 21.0992 16 20.6223 16 20.125V12.7763C15.9995 12.2791 15.7938 11.8025 15.428 11.4513L11.372 7.54875C11.1907 7.37452 10.9754 7.23637 10.7385 7.14221C10.5016 7.04805 10.2477 6.99973 9.9914 7H4.95Z", fill: "#2653f2" })
891
+ ] });
892
+ var CloseIcon2 = () => /* @__PURE__ */ jsxs9("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
893
+ /* @__PURE__ */ jsx10("path", { d: "M6.00049 6L18.0005 18", stroke: "#818181", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }),
894
+ /* @__PURE__ */ jsx10("path", { d: "M18.0005 6L6.00049 18", stroke: "#818181", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })
923
895
  ] });
924
- var CloseIcon2 = () => /* @__PURE__ */ jsx10("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx10(
925
- "path",
926
- {
927
- d: "M4 4l8 8M12 4l-8 8",
928
- stroke: "currentColor",
929
- strokeWidth: "1.5",
930
- strokeLinecap: "round"
931
- }
932
- ) });
933
896
  var FileUpload = React10.forwardRef(
934
897
  ({
935
898
  accept,
@@ -996,8 +959,9 @@ var FileUpload = React10.forwardRef(
996
959
  inputRef.current.click();
997
960
  }
998
961
  }, [disabled]);
999
- const defaultLabel = label ?? (accept?.includes("pdf") ? "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 PDF-\u0444\u0430\u0439\u043B\u044B" : "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B");
1000
- const defaultDescription = description ?? (size === "large" ? "\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430 \u0438\u043B\u0438 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0445, \u0449\u0435\u043B\u043A\u043D\u0443\u0432 \u043C\u044B\u0448\u044C\u044E." : "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043B \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044E\u0434\u0430");
962
+ const isPdf = accept?.toLowerCase().includes("pdf");
963
+ const defaultLabel = label ?? (isPdf ? "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 PDF-\u0444\u0430\u0439\u043B\u044B" : "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B");
964
+ const defaultDescription = description ?? (size === "large" ? isPdf ? "\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 PDF-\u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430 \u0438\u043B\u0438 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0445, \u0449\u0435\u043B\u043A\u043D\u0443\u0432 \u043C\u044B\u0448\u044C\u044E." : "\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B \u0441\u044E\u0434\u0430 \u0438\u043B\u0438 \u0432\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0445, \u0449\u0435\u043B\u043A\u043D\u0443\u0432 \u043C\u044B\u0448\u044C\u044E." : "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0430\u0439\u043B \u0438\u043B\u0438 \u043F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0441\u044E\u0434\u0430");
1001
965
  return /* @__PURE__ */ jsxs9(
1002
966
  "div",
1003
967
  {
@@ -1020,7 +984,7 @@ var FileUpload = React10.forwardRef(
1020
984
  "aria-label": defaultLabel
1021
985
  }
1022
986
  ),
1023
- size === "large" ? /* @__PURE__ */ jsxs9(Fragment4, { children: [
987
+ size === "large" ? /* @__PURE__ */ jsxs9(Fragment3, { children: [
1024
988
  /* @__PURE__ */ jsx10("div", { className: "astrum-file-upload__icon", children: /* @__PURE__ */ jsx10(UploadIcon, {}) }),
1025
989
  /* @__PURE__ */ jsx10("div", { className: "astrum-file-upload__label", children: defaultLabel }),
1026
990
  /* @__PURE__ */ jsx10("div", { className: "astrum-file-upload__description", children: defaultDescription }),
@@ -1045,8 +1009,21 @@ var FileUpload = React10.forwardRef(
1045
1009
  }
1046
1010
  );
1047
1011
  FileUpload.displayName = "FileUpload";
1012
+ var IMAGE_TYPES = /^image\//i;
1048
1013
  var FileItem = React10.forwardRef(
1049
- ({ name, size, icon, onRemove, className = "" }, ref) => {
1014
+ ({ name, size, file, previewUrl: previewUrlProp, icon, onRemove, className = "" }, ref) => {
1015
+ const [objectUrl, setObjectUrl] = React10.useState(null);
1016
+ React10.useEffect(() => {
1017
+ if (previewUrlProp != null || !file || !IMAGE_TYPES.test(file.type)) return;
1018
+ const url = URL.createObjectURL(file);
1019
+ setObjectUrl(url);
1020
+ return () => {
1021
+ URL.revokeObjectURL(url);
1022
+ setObjectUrl(null);
1023
+ };
1024
+ }, [file, previewUrlProp]);
1025
+ const previewUrl = previewUrlProp ?? objectUrl;
1026
+ const showPreview = previewUrl != null && previewUrl !== "";
1050
1027
  const formatSize = React10.useCallback((sizeValue) => {
1051
1028
  if (!sizeValue) return "";
1052
1029
  if (typeof sizeValue === "string") return sizeValue;
@@ -1055,18 +1032,27 @@ var FileItem = React10.forwardRef(
1055
1032
  return `${(sizeValue / (1024 * 1024)).toFixed(1)} MB`;
1056
1033
  }, []);
1057
1034
  return /* @__PURE__ */ jsxs9("div", { ref, className: `astrum-file-item ${className}`.trim(), children: [
1058
- /* @__PURE__ */ jsx10("div", { className: "astrum-file-item__icon", children: icon ?? /* @__PURE__ */ jsx10(FileIcon, {}) }),
1035
+ /* @__PURE__ */ jsx10("div", { className: "astrum-file-item__preview-wrap", children: showPreview ? /* @__PURE__ */ jsx10(
1036
+ "img",
1037
+ {
1038
+ src: previewUrl,
1039
+ alt: "",
1040
+ className: "astrum-file-item__preview",
1041
+ decoding: "async"
1042
+ }
1043
+ ) : /* @__PURE__ */ jsx10("span", { className: "astrum-file-item__icon", children: icon ?? /* @__PURE__ */ jsx10(FileIcon, {}) }) }),
1059
1044
  /* @__PURE__ */ jsxs9("div", { className: "astrum-file-item__content", children: [
1060
1045
  /* @__PURE__ */ jsx10("div", { className: "astrum-file-item__name", children: name }),
1061
1046
  size != null && /* @__PURE__ */ jsx10("div", { className: "astrum-file-item__size", children: formatSize(size) })
1062
1047
  ] }),
1063
- onRemove != null && /* @__PURE__ */ jsx10(
1048
+ /* @__PURE__ */ jsx10(
1064
1049
  "button",
1065
1050
  {
1066
1051
  type: "button",
1067
1052
  className: "astrum-file-item__remove",
1068
1053
  onClick: onRemove,
1069
1054
  "aria-label": "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0444\u0430\u0439\u043B",
1055
+ disabled: onRemove == null,
1070
1056
  children: /* @__PURE__ */ jsx10(CloseIcon2, {})
1071
1057
  }
1072
1058
  )
@@ -1077,7 +1063,7 @@ FileItem.displayName = "FileItem";
1077
1063
 
1078
1064
  // src/Avatar/Avatar.tsx
1079
1065
  import * as React11 from "react";
1080
- import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1066
+ import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1081
1067
  function cn(...args) {
1082
1068
  return args.flatMap(
1083
1069
  (x) => typeof x === "object" && x !== null ? Object.entries(x).filter(([, v]) => v).map(([k]) => k) : x
@@ -1088,15 +1074,10 @@ var EditIcon = () => /* @__PURE__ */ jsxs10("svg", { width: "24", height: "24",
1088
1074
  /* @__PURE__ */ jsx11("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M5.293 15.619L15.619 5.29299C16.009 4.90299 16.642 4.90299 17.032 5.29299L18.708 6.96899C19.098 7.35899 19.098 7.99199 18.708 8.38199L8.381 18.707C8.194 18.895 7.94 19 7.675 19H5V16.325C5 16.06 5.105 15.806 5.293 15.619Z", stroke: "white", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }),
1089
1075
  /* @__PURE__ */ jsx11("path", { d: "M13.75 7.16016L16.84 10.2502", stroke: "white", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })
1090
1076
  ] });
1091
- var CrossIcon = () => /* @__PURE__ */ jsx11("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx11(
1092
- "path",
1093
- {
1094
- d: "M4 4l8 8M12 4l-8 8",
1095
- stroke: "currentColor",
1096
- strokeWidth: "1.5",
1097
- strokeLinecap: "round"
1098
- }
1099
- ) });
1077
+ var CrossIcon = () => /* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: [
1078
+ /* @__PURE__ */ jsx11("path", { d: "M3.00012 3L9.00012 9", stroke: "white", "stroke-linecap": "round", "stroke-linejoin": "round" }),
1079
+ /* @__PURE__ */ jsx11("path", { d: "M9.00012 3L3.00012 9", stroke: "white", "stroke-linecap": "round", "stroke-linejoin": "round" })
1080
+ ] });
1100
1081
  var Avatar = React11.forwardRef(
1101
1082
  ({
1102
1083
  src,
@@ -1171,7 +1152,7 @@ var Avatar = React11.forwardRef(
1171
1152
  className: "astrum-avatar__input"
1172
1153
  }
1173
1154
  ),
1174
- hasImage ? /* @__PURE__ */ jsxs10(Fragment5, { children: [
1155
+ hasImage ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
1175
1156
  /* @__PURE__ */ jsxs10("div", { className: "astrum-avatar__body", children: [
1176
1157
  /* @__PURE__ */ jsx11("img", { src, alt, className: "astrum-avatar__image" }),
1177
1158
  /* @__PURE__ */ jsx11("div", { className: "astrum-avatar__overlay", "aria-hidden": true }),
@@ -1198,12 +1179,527 @@ var Avatar = React11.forwardRef(
1198
1179
  }
1199
1180
  );
1200
1181
  Avatar.displayName = "Avatar";
1182
+
1183
+ // src/DatePicker/DatePicker.tsx
1184
+ import * as React12 from "react";
1185
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1186
+ var CalendarIcon = ({ isActive }) => /* @__PURE__ */ jsxs11("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
1187
+ /* @__PURE__ */ jsx12("path", { d: "M3 8.40004C3 6.70264 3 5.85485 3.5274 5.32745C4.0548 4.80005 4.9026 4.80005 6.6 4.80005H17.4C19.0974 4.80005 19.9452 4.80005 20.4726 5.32745C21 5.85485 21 6.70264 21 8.40004C21 8.82394 21 9.03634 20.8686 9.16864C20.7363 9.30004 20.523 9.30004 20.1 9.30004H3.9C3.4761 9.30004 3.2637 9.30004 3.1314 9.16864C3 9.03634 3 8.82304 3 8.40004Z", fill: isActive ? "#2653F2" : "#ABABAB" }),
1188
+ /* @__PURE__ */ jsx12("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M3.5274 19.5727C3 19.0453 3 18.1975 3 16.5001V12.0001C3 11.5762 3 11.3638 3.1314 11.2315C3.2637 11.1001 3.477 11.1001 3.9 11.1001H20.1C20.5239 11.1001 20.7363 11.1001 20.8686 11.2315C21 11.3638 21 11.5762 21 12.0001V16.5001C21 18.1975 21 19.0453 20.4726 19.5727C19.9452 20.1001 19.0974 20.1001 17.4 20.1001H6.6C4.9026 20.1001 4.0548 20.1001 3.5274 19.5727ZM8.4 14.7001C8.1613 14.7001 7.93239 14.7949 7.7636 14.9637C7.59482 15.1325 7.5 15.3614 7.5 15.6001C7.5 15.8388 7.59482 16.0677 7.7636 16.2365C7.93239 16.4053 8.1613 16.5001 8.4 16.5001H15.6C15.8387 16.5001 16.0676 16.4053 16.2364 16.2365C16.4052 16.0677 16.5 15.8388 16.5 15.6001C16.5 15.3614 16.4052 15.1325 16.2364 14.9637C16.0676 14.7949 15.8387 14.7001 15.6 14.7001H8.4Z", fill: isActive ? "#2653F2" : "#ABABAB" }),
1189
+ /* @__PURE__ */ jsx12("path", { d: "M7.5 3V5.69999M16.5 3V5.69999", stroke: isActive ? "#2653F2" : "#ABABAB", "stroke-width": "2", "stroke-linecap": "round" })
1190
+ ] });
1191
+ var ChevronLeftIcon = () => /* @__PURE__ */ jsx12("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx12("path", { d: "M15 6L9 12L15 18", stroke: "#ABABAB", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }) });
1192
+ var ChevronRightIcon = () => /* @__PURE__ */ jsx12("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx12("path", { d: "M9 18L15 12L9 6", stroke: "#ABABAB", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }) });
1193
+ var ClockIcon = () => /* @__PURE__ */ jsx12("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsx12("path", { d: "M10 2.5C14.1423 2.5 17.5 5.85777 17.5 10C17.5 14.1423 14.1423 17.5001 10 17.5001C5.85775 17.5001 2.5 14.1423 2.5 10C2.5 5.85777 5.85775 2.5 10 2.5ZM10 5.50002C9.80109 5.50002 9.61032 5.57903 9.46967 5.71969C9.32902 5.86034 9.25 6.05111 9.25 6.25002V10C9.25004 10.1989 9.32909 10.3897 9.46975 10.5303L11.7198 12.7803C11.8612 12.9169 12.0507 12.9925 12.2473 12.9908C12.4439 12.9891 12.6321 12.9102 12.7711 12.7712C12.9102 12.6321 12.989 12.444 12.9908 12.2474C12.9925 12.0507 12.9169 11.8613 12.7802 11.7198L10.75 9.68954V6.25002C10.75 6.05111 10.671 5.86034 10.5303 5.71969C10.3897 5.57903 10.1989 5.50002 10 5.50002Z", fill: "#ABABAB" }) });
1194
+ var formatDate = (date) => {
1195
+ if (!date) return "";
1196
+ const day = String(date.getDate()).padStart(2, "0");
1197
+ const month = String(date.getMonth() + 1).padStart(2, "0");
1198
+ const year = date.getFullYear();
1199
+ return `${day}.${month}.${year}`;
1200
+ };
1201
+ var parseDate = (value) => {
1202
+ const match = value.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
1203
+ if (!match) return null;
1204
+ const [, day, month, year] = match;
1205
+ const date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
1206
+ if (date.getFullYear() === parseInt(year) && date.getMonth() === parseInt(month) - 1 && date.getDate() === parseInt(day)) {
1207
+ return date;
1208
+ }
1209
+ return null;
1210
+ };
1211
+ var formatTime = (date) => {
1212
+ if (!date) return "";
1213
+ const hours = String(date.getHours()).padStart(2, "0");
1214
+ const minutes = String(date.getMinutes()).padStart(2, "0");
1215
+ return `${hours}:${minutes}`;
1216
+ };
1217
+ var parseTime = (value) => {
1218
+ const match = value.match(/^(\d{2}):(\d{2})$/);
1219
+ if (!match) return null;
1220
+ const hours = parseInt(match[1]);
1221
+ const minutes = parseInt(match[2]);
1222
+ if (hours >= 0 && hours < 24 && minutes >= 0 && minutes < 60) {
1223
+ return { hours, minutes };
1224
+ }
1225
+ return null;
1226
+ };
1227
+ var getDaysInMonth = (date) => {
1228
+ return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
1229
+ };
1230
+ var getFirstDayOfMonth = (date) => {
1231
+ const firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
1232
+ return firstDay.getDay() === 0 ? 6 : firstDay.getDay() - 1;
1233
+ };
1234
+ var isSameDay = (date1, date2) => {
1235
+ if (!date1 || !date2) return false;
1236
+ return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
1237
+ };
1238
+ var isToday = (date) => {
1239
+ const today = /* @__PURE__ */ new Date();
1240
+ return isSameDay(date, today);
1241
+ };
1242
+ var isDateInRange = (date, start, end) => {
1243
+ if (!start || !end) return false;
1244
+ const dateTime = date.getTime();
1245
+ const startTime = start.getTime();
1246
+ const endTime = end.getTime();
1247
+ return dateTime >= startTime && dateTime <= endTime;
1248
+ };
1249
+ var isDateRangeStart = (date, start, end) => {
1250
+ if (!start) return false;
1251
+ return isSameDay(date, start);
1252
+ };
1253
+ var isDateRangeEnd = (date, start, end) => {
1254
+ if (!end) return false;
1255
+ return isSameDay(date, end);
1256
+ };
1257
+ var monthNames = [
1258
+ "\u042F\u043D\u0432\u0430\u0440\u044C",
1259
+ "\u0424\u0435\u0432\u0440\u0430\u043B\u044C",
1260
+ "\u041C\u0430\u0440\u0442",
1261
+ "\u0410\u043F\u0440\u0435\u043B\u044C",
1262
+ "\u041C\u0430\u0439",
1263
+ "\u0418\u044E\u043D\u044C",
1264
+ "\u0418\u044E\u043B\u044C",
1265
+ "\u0410\u0432\u0433\u0443\u0441\u0442",
1266
+ "\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C",
1267
+ "\u041E\u043A\u0442\u044F\u0431\u0440\u044C",
1268
+ "\u041D\u043E\u044F\u0431\u0440\u044C",
1269
+ "\u0414\u0435\u043A\u0430\u0431\u0440\u044C"
1270
+ ];
1271
+ var weekDays = ["\u041F\u043D", "\u0412\u0442", "\u0421\u0440", "\u0427\u0442", "\u041F\u0442", "\u0421\u0431", "\u0412\u0441"];
1272
+ var DatePicker = React12.forwardRef(
1273
+ ({
1274
+ placeholder = "\u0414\u0430\u0442\u0430",
1275
+ placeholderFrom = "\u041E\u0442",
1276
+ placeholderTo = "\u0414\u043E",
1277
+ value,
1278
+ defaultValue,
1279
+ onChange,
1280
+ error,
1281
+ required,
1282
+ disabled,
1283
+ showTime = false,
1284
+ timeLabel = "\u0412\u0440\u0435\u043C\u044F (UTC):",
1285
+ range = false,
1286
+ className = "",
1287
+ id: idProp
1288
+ }, ref) => {
1289
+ const id = React12.useId();
1290
+ const inputId = idProp ?? id;
1291
+ const [isOpen, setIsOpen] = React12.useState(false);
1292
+ const [internalDate, setInternalDate] = React12.useState(
1293
+ range ? null : defaultValue ?? null
1294
+ );
1295
+ const [internalRange, setInternalRange] = React12.useState(
1296
+ range ? defaultValue ?? [null, null] : [null, null]
1297
+ );
1298
+ const [selectingStart, setSelectingStart] = React12.useState(true);
1299
+ const [internalTime, setInternalTime] = React12.useState(
1300
+ !range && defaultValue ? formatTime(defaultValue) : ""
1301
+ );
1302
+ const [viewDate, setViewDate] = React12.useState(() => {
1303
+ if (range) {
1304
+ const rangeValue = value ?? defaultValue;
1305
+ return rangeValue?.[0] ? new Date(rangeValue[0].getFullYear(), rangeValue[0].getMonth(), 1) : /* @__PURE__ */ new Date();
1306
+ }
1307
+ return value ? value : defaultValue ? defaultValue : /* @__PURE__ */ new Date();
1308
+ });
1309
+ const getRangeDisplayValue = (rangeValue) => {
1310
+ if (!rangeValue[0] && !rangeValue[1]) return "";
1311
+ if (rangeValue[0] && rangeValue[1]) {
1312
+ return `${formatDate(rangeValue[0])} \u2014 ${formatDate(rangeValue[1])}`;
1313
+ }
1314
+ if (rangeValue[0]) {
1315
+ return formatDate(rangeValue[0]);
1316
+ }
1317
+ return "";
1318
+ };
1319
+ const [inputValue, setInputValue] = React12.useState(() => {
1320
+ if (range) {
1321
+ const rangeValue = value ?? defaultValue;
1322
+ return rangeValue ? getRangeDisplayValue(rangeValue) : "";
1323
+ }
1324
+ return value ? formatDate(value) : defaultValue ? formatDate(defaultValue) : "";
1325
+ });
1326
+ const [timeValue, setTimeValue] = React12.useState(
1327
+ !range && value && showTime ? formatTime(value) : !range && defaultValue && showTime ? formatTime(defaultValue) : ""
1328
+ );
1329
+ const containerRef = React12.useRef(null);
1330
+ const calendarRef = React12.useRef(null);
1331
+ const inputRef = React12.useRef(null);
1332
+ const timeInputRef = React12.useRef(null);
1333
+ const isControlled = value !== void 0;
1334
+ const currentDate = range ? null : isControlled ? value : internalDate;
1335
+ const currentRange = range ? isControlled ? value : internalRange : [null, null];
1336
+ const setCombinedRef = React12.useCallback(
1337
+ (node) => {
1338
+ inputRef.current = node;
1339
+ if (typeof ref === "function") {
1340
+ ref(node);
1341
+ } else if (ref) {
1342
+ ref.current = node;
1343
+ }
1344
+ },
1345
+ [ref]
1346
+ );
1347
+ React12.useEffect(() => {
1348
+ if (range) {
1349
+ const rangeValue = value;
1350
+ if (isControlled && rangeValue) {
1351
+ setInputValue(getRangeDisplayValue(rangeValue));
1352
+ if (rangeValue[0]) {
1353
+ setViewDate(new Date(rangeValue[0].getFullYear(), rangeValue[0].getMonth(), 1));
1354
+ }
1355
+ } else if (isControlled && (!rangeValue || !rangeValue[0] && !rangeValue[1])) {
1356
+ setInputValue("");
1357
+ }
1358
+ } else {
1359
+ if (isControlled && value) {
1360
+ setInputValue(formatDate(value));
1361
+ if (showTime) {
1362
+ setTimeValue(formatTime(value));
1363
+ }
1364
+ setViewDate(new Date(value.getFullYear(), value.getMonth(), 1));
1365
+ } else if (isControlled && !value) {
1366
+ setInputValue("");
1367
+ if (showTime) {
1368
+ setTimeValue("");
1369
+ }
1370
+ }
1371
+ }
1372
+ }, [value, isControlled, showTime, range]);
1373
+ React12.useEffect(() => {
1374
+ if (range) {
1375
+ const rangeDefault = defaultValue;
1376
+ if (!isControlled && rangeDefault !== void 0) {
1377
+ setInternalRange(rangeDefault);
1378
+ setInputValue(getRangeDisplayValue(rangeDefault));
1379
+ if (rangeDefault[0]) {
1380
+ setViewDate(new Date(rangeDefault[0].getFullYear(), rangeDefault[0].getMonth(), 1));
1381
+ }
1382
+ }
1383
+ } else {
1384
+ if (!isControlled && defaultValue !== void 0) {
1385
+ setInternalDate(defaultValue);
1386
+ setInputValue(defaultValue ? formatDate(defaultValue) : "");
1387
+ if (showTime && defaultValue) {
1388
+ setTimeValue(formatTime(defaultValue));
1389
+ setInternalTime(formatTime(defaultValue));
1390
+ }
1391
+ if (defaultValue) {
1392
+ setViewDate(new Date(defaultValue.getFullYear(), defaultValue.getMonth(), 1));
1393
+ }
1394
+ }
1395
+ }
1396
+ }, [defaultValue, isControlled, showTime, range]);
1397
+ React12.useEffect(() => {
1398
+ const handleClickOutside = (e) => {
1399
+ if (containerRef.current && !containerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) {
1400
+ if (range) {
1401
+ if (currentRange[0] && currentRange[1]) {
1402
+ setIsOpen(false);
1403
+ }
1404
+ } else {
1405
+ setIsOpen(false);
1406
+ }
1407
+ }
1408
+ };
1409
+ if (isOpen) {
1410
+ document.addEventListener("mousedown", handleClickOutside);
1411
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1412
+ }
1413
+ }, [isOpen, range, currentRange]);
1414
+ const handleInputChange = (e) => {
1415
+ const newValue = e.target.value;
1416
+ setInputValue(newValue);
1417
+ if (range) {
1418
+ const rangeMatch = newValue.match(/^(\d{2}\.\d{2}\.\d{4})\s*—\s*(\d{2}\.\d{2}\.\d{4})$/);
1419
+ if (rangeMatch) {
1420
+ const parsedFrom = parseDate(rangeMatch[1]);
1421
+ const parsedTo = parseDate(rangeMatch[2]);
1422
+ const newRange = [parsedFrom, parsedTo];
1423
+ if (isControlled) {
1424
+ onChange?.(newRange);
1425
+ } else {
1426
+ setInternalRange(newRange);
1427
+ onChange?.(newRange);
1428
+ }
1429
+ if (parsedFrom) {
1430
+ setViewDate(new Date(parsedFrom.getFullYear(), parsedFrom.getMonth(), 1));
1431
+ }
1432
+ } else {
1433
+ const singleDateMatch = newValue.match(/^(\d{2}\.\d{2}\.\d{4})$/);
1434
+ if (singleDateMatch) {
1435
+ const parsed2 = parseDate(singleDateMatch[1]);
1436
+ const newRange = [parsed2, null];
1437
+ if (isControlled) {
1438
+ onChange?.(newRange);
1439
+ } else {
1440
+ setInternalRange(newRange);
1441
+ onChange?.(newRange);
1442
+ }
1443
+ if (parsed2) {
1444
+ setViewDate(new Date(parsed2.getFullYear(), parsed2.getMonth(), 1));
1445
+ }
1446
+ } else if (newValue === "") {
1447
+ const newRange = [null, null];
1448
+ if (isControlled) {
1449
+ onChange?.(newRange);
1450
+ } else {
1451
+ setInternalRange(newRange);
1452
+ onChange?.(newRange);
1453
+ }
1454
+ }
1455
+ }
1456
+ return;
1457
+ }
1458
+ const parsed = parseDate(newValue);
1459
+ if (parsed) {
1460
+ if (showTime && timeValue) {
1461
+ const time = parseTime(timeValue);
1462
+ if (time) {
1463
+ parsed.setHours(time.hours, time.minutes);
1464
+ }
1465
+ }
1466
+ if (isControlled) {
1467
+ onChange?.(parsed);
1468
+ } else {
1469
+ setInternalDate(parsed);
1470
+ onChange?.(parsed);
1471
+ }
1472
+ } else if (newValue === "") {
1473
+ if (isControlled) {
1474
+ onChange?.(null);
1475
+ } else {
1476
+ setInternalDate(null);
1477
+ onChange?.(null);
1478
+ }
1479
+ }
1480
+ };
1481
+ const handleTimeChange = (e) => {
1482
+ if (range) return;
1483
+ const newValue = e.target.value;
1484
+ setTimeValue(newValue);
1485
+ const parsed = parseTime(newValue);
1486
+ if (parsed && currentDate) {
1487
+ const newDate = new Date(currentDate);
1488
+ newDate.setHours(parsed.hours, parsed.minutes);
1489
+ if (isControlled) {
1490
+ onChange?.(newDate);
1491
+ } else {
1492
+ setInternalDate(newDate);
1493
+ onChange?.(newDate);
1494
+ }
1495
+ }
1496
+ setInternalTime(newValue);
1497
+ };
1498
+ const handleDateClick = (day, isOtherMonth) => {
1499
+ if (disabled) return;
1500
+ const newDate = new Date(viewDate);
1501
+ if (isOtherMonth) {
1502
+ if (day > 15) {
1503
+ newDate.setMonth(newDate.getMonth() - 1);
1504
+ } else {
1505
+ newDate.setMonth(newDate.getMonth() + 1);
1506
+ }
1507
+ }
1508
+ newDate.setDate(day);
1509
+ if (range) {
1510
+ let newRange;
1511
+ if (!currentRange[0]) {
1512
+ newRange = [newDate, null];
1513
+ setSelectingStart(false);
1514
+ } else if (!currentRange[1]) {
1515
+ if (newDate.getTime() < currentRange[0].getTime()) {
1516
+ newRange = [newDate, currentRange[0]];
1517
+ } else {
1518
+ newRange = [currentRange[0], newDate];
1519
+ }
1520
+ setSelectingStart(true);
1521
+ } else {
1522
+ newRange = [newDate, null];
1523
+ setSelectingStart(false);
1524
+ }
1525
+ setViewDate(new Date(newDate.getFullYear(), newDate.getMonth(), 1));
1526
+ if (isControlled) {
1527
+ onChange?.(newRange);
1528
+ } else {
1529
+ setInternalRange(newRange);
1530
+ onChange?.(newRange);
1531
+ }
1532
+ setInputValue(getRangeDisplayValue(newRange));
1533
+ if (newRange[0] && newRange[1] && !showTime) {
1534
+ setIsOpen(false);
1535
+ }
1536
+ } else {
1537
+ if (showTime && timeValue) {
1538
+ const time = parseTime(timeValue);
1539
+ if (time) {
1540
+ newDate.setHours(time.hours, time.minutes);
1541
+ }
1542
+ }
1543
+ setViewDate(new Date(newDate.getFullYear(), newDate.getMonth(), 1));
1544
+ if (isControlled) {
1545
+ onChange?.(newDate);
1546
+ } else {
1547
+ setInternalDate(newDate);
1548
+ onChange?.(newDate);
1549
+ }
1550
+ setInputValue(formatDate(newDate));
1551
+ if (!showTime) {
1552
+ setIsOpen(false);
1553
+ }
1554
+ }
1555
+ };
1556
+ const handlePrevMonth = () => {
1557
+ setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 1));
1558
+ };
1559
+ const handleNextMonth = () => {
1560
+ setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 1));
1561
+ };
1562
+ const renderCalendar = () => {
1563
+ const daysInMonth = getDaysInMonth(viewDate);
1564
+ const firstDay = getFirstDayOfMonth(viewDate);
1565
+ const days = [];
1566
+ const prevMonth = new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 0);
1567
+ const daysInPrevMonth = prevMonth.getDate();
1568
+ for (let i = firstDay - 1; i >= 0; i--) {
1569
+ days.push({ day: daysInPrevMonth - i, isOtherMonth: true });
1570
+ }
1571
+ for (let i = 1; i <= daysInMonth; i++) {
1572
+ days.push({ day: i, isOtherMonth: false });
1573
+ }
1574
+ const remainingDays = 35 - days.length;
1575
+ for (let i = 1; i <= remainingDays; i++) {
1576
+ days.push({ day: i, isOtherMonth: true });
1577
+ }
1578
+ return days;
1579
+ };
1580
+ const calendarDays = renderCalendar();
1581
+ const isActive = isOpen;
1582
+ return /* @__PURE__ */ jsxs11("div", { ref: containerRef, className: `astrum-datepicker ${range ? "astrum-datepicker--range" : ""} ${error ? "astrum-datepicker--error" : ""} ${className}`.trim(), children: [
1583
+ /* @__PURE__ */ jsxs11("div", { className: "astrum-datepicker__wrap", children: [
1584
+ /* @__PURE__ */ jsx12(
1585
+ "input",
1586
+ {
1587
+ ref: setCombinedRef,
1588
+ id: inputId,
1589
+ type: "text",
1590
+ value: inputValue,
1591
+ onChange: handleInputChange,
1592
+ onFocus: () => !disabled && setIsOpen(true),
1593
+ placeholder: range ? `${placeholderFrom} \u2014 ${placeholderTo}` : placeholder,
1594
+ disabled,
1595
+ className: `astrum-datepicker__field ${error ? "astrum-datepicker__field--invalid" : ""}`.trim(),
1596
+ "aria-invalid": !!error,
1597
+ "aria-required": required,
1598
+ "aria-describedby": error ? `${inputId}-error` : void 0,
1599
+ "aria-expanded": isOpen
1600
+ }
1601
+ ),
1602
+ /* @__PURE__ */ jsx12(
1603
+ "button",
1604
+ {
1605
+ type: "button",
1606
+ className: `astrum-datepicker__icon ${isActive ? "astrum-datepicker__icon--active" : ""}`,
1607
+ onClick: () => !disabled && setIsOpen(!isOpen),
1608
+ disabled,
1609
+ "aria-label": "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043A\u0430\u043B\u0435\u043D\u0434\u0430\u0440\u044C",
1610
+ children: /* @__PURE__ */ jsx12(CalendarIcon, { isActive })
1611
+ }
1612
+ )
1613
+ ] }),
1614
+ error != null && /* @__PURE__ */ jsx12("span", { id: `${inputId}-error`, className: "astrum-datepicker__error", role: "alert", children: error }),
1615
+ isOpen && /* @__PURE__ */ jsxs11("div", { ref: calendarRef, className: "astrum-datepicker__calendar", children: [
1616
+ /* @__PURE__ */ jsxs11("div", { className: "astrum-datepicker__calendar-header", children: [
1617
+ /* @__PURE__ */ jsx12(
1618
+ "button",
1619
+ {
1620
+ type: "button",
1621
+ className: "astrum-datepicker__calendar-nav",
1622
+ onClick: handlePrevMonth,
1623
+ "aria-label": "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u043C\u0435\u0441\u044F\u0446",
1624
+ children: /* @__PURE__ */ jsx12(ChevronLeftIcon, {})
1625
+ }
1626
+ ),
1627
+ /* @__PURE__ */ jsxs11("div", { className: "astrum-datepicker__calendar-month", children: [
1628
+ monthNames[viewDate.getMonth()],
1629
+ " ",
1630
+ viewDate.getFullYear()
1631
+ ] }),
1632
+ /* @__PURE__ */ jsx12(
1633
+ "button",
1634
+ {
1635
+ type: "button",
1636
+ className: "astrum-datepicker__calendar-nav",
1637
+ onClick: handleNextMonth,
1638
+ "aria-label": "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u043C\u0435\u0441\u044F\u0446",
1639
+ children: /* @__PURE__ */ jsx12(ChevronRightIcon, {})
1640
+ }
1641
+ )
1642
+ ] }),
1643
+ /* @__PURE__ */ jsx12("div", { className: "astrum-datepicker__calendar-weekdays", children: weekDays.map((day) => /* @__PURE__ */ jsx12("div", { className: "astrum-datepicker__calendar-weekday", children: day }, day)) }),
1644
+ /* @__PURE__ */ jsx12("div", { className: "astrum-datepicker__calendar-days", children: calendarDays.map(({ day, isOtherMonth }, index) => {
1645
+ const dayDate = new Date(viewDate.getFullYear(), viewDate.getMonth() + (isOtherMonth ? day > 15 ? -1 : 1 : 0), day);
1646
+ const isCurrentDay = !isOtherMonth && isToday(dayDate);
1647
+ let isSelected;
1648
+ let isInRange = false;
1649
+ let isRangeStart = false;
1650
+ let isRangeEnd = false;
1651
+ if (range) {
1652
+ const hasSelectedRange = currentRange[0] != null || currentRange[1] != null;
1653
+ isSelected = hasSelectedRange ? currentRange[0] != null && isSameDay(dayDate, currentRange[0]) || currentRange[1] != null && isSameDay(dayDate, currentRange[1]) || false : isCurrentDay;
1654
+ if (currentRange[0] && currentRange[1]) {
1655
+ isInRange = isDateInRange(dayDate, currentRange[0], currentRange[1]) && !isSelected;
1656
+ isRangeStart = isDateRangeStart(dayDate, currentRange[0], currentRange[1]);
1657
+ isRangeEnd = isDateRangeEnd(dayDate, currentRange[0], currentRange[1]);
1658
+ }
1659
+ } else {
1660
+ isSelected = currentDate ? isSameDay(dayDate, currentDate) : isCurrentDay;
1661
+ }
1662
+ return /* @__PURE__ */ jsx12(
1663
+ "button",
1664
+ {
1665
+ type: "button",
1666
+ className: `astrum-datepicker__calendar-day ${isOtherMonth ? "astrum-datepicker__calendar-day--other-month" : ""} ${isSelected ? "astrum-datepicker__calendar-day--selected" : ""} ${isInRange ? "astrum-datepicker__calendar-day--in-range" : ""} ${isRangeStart ? "astrum-datepicker__calendar-day--range-start" : ""} ${isRangeEnd ? "astrum-datepicker__calendar-day--range-end" : ""}`,
1667
+ onClick: () => handleDateClick(day, isOtherMonth),
1668
+ disabled,
1669
+ children: day
1670
+ },
1671
+ `${day}-${isOtherMonth}-${index}`
1672
+ );
1673
+ }) }),
1674
+ showTime && /* @__PURE__ */ jsxs11("div", { className: "astrum-datepicker__calendar-time", children: [
1675
+ /* @__PURE__ */ jsx12("label", { className: "astrum-datepicker__calendar-time-label", children: timeLabel }),
1676
+ /* @__PURE__ */ jsxs11("div", { className: "astrum-datepicker__calendar-time-input-wrap", children: [
1677
+ /* @__PURE__ */ jsx12(
1678
+ "input",
1679
+ {
1680
+ ref: timeInputRef,
1681
+ type: "text",
1682
+ value: timeValue,
1683
+ onChange: handleTimeChange,
1684
+ placeholder: "00:00",
1685
+ className: "astrum-datepicker__calendar-time-input"
1686
+ }
1687
+ ),
1688
+ /* @__PURE__ */ jsx12("span", { className: "astrum-datepicker__calendar-time-icon", "aria-hidden": true, children: /* @__PURE__ */ jsx12(ClockIcon, {}) })
1689
+ ] })
1690
+ ] })
1691
+ ] })
1692
+ ] });
1693
+ }
1694
+ );
1695
+ DatePicker.displayName = "DatePicker";
1201
1696
  export {
1202
1697
  Avatar,
1203
1698
  Button,
1204
1699
  Checkbox,
1205
1700
  Chips,
1206
1701
  ColorPicker,
1702
+ DatePicker,
1207
1703
  FileItem,
1208
1704
  FileUpload,
1209
1705
  Input,