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.js CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  Checkbox: () => Checkbox,
37
37
  Chips: () => Chips,
38
38
  ColorPicker: () => ColorPicker,
39
+ DatePicker: () => DatePicker,
39
40
  FileItem: () => FileItem,
40
41
  FileUpload: () => FileUpload,
41
42
  Input: () => Input,
@@ -245,7 +246,6 @@ var Checkbox = React4.forwardRef(
245
246
  ({
246
247
  checked: checkedProp,
247
248
  indeterminate = false,
248
- size = "m",
249
249
  disabled = false,
250
250
  onChange,
251
251
  className = "",
@@ -286,7 +286,7 @@ var Checkbox = React4.forwardRef(
286
286
  htmlFor: inputId,
287
287
  className: [
288
288
  "astrum-checkbox",
289
- size === "s" ? "astrum-checkbox--s" : "astrum-checkbox--m",
289
+ "astrum-checkbox--m",
290
290
  isChecked ? "astrum-checkbox--checked" : "",
291
291
  indeterminate ? "astrum-checkbox--indeterminate" : "",
292
292
  disabled ? "astrum-checkbox--disabled" : "",
@@ -429,36 +429,27 @@ var Input = React6.forwardRef(
429
429
  const handleClear = React6.useCallback(
430
430
  (e) => {
431
431
  e.stopPropagation();
432
- if (inputRef.current) {
433
- if (isControlled && onChange) {
432
+ if (!inputRef.current) return;
433
+ inputRef.current.value = "";
434
+ if (isControlled && onChange) {
435
+ const syntheticEvent = {
436
+ ...e,
437
+ target: inputRef.current,
438
+ currentTarget: inputRef.current
439
+ };
440
+ onChange(syntheticEvent);
441
+ } else {
442
+ setInternalValue("");
443
+ if (onChange) {
434
444
  const syntheticEvent = {
435
445
  ...e,
436
446
  target: inputRef.current,
437
447
  currentTarget: inputRef.current
438
448
  };
439
- Object.defineProperty(syntheticEvent.target, "value", {
440
- writable: true,
441
- value: ""
442
- });
443
449
  onChange(syntheticEvent);
444
- } else {
445
- setInternalValue("");
446
- inputRef.current.value = "";
447
- if (onChange) {
448
- const syntheticEvent = {
449
- ...e,
450
- target: inputRef.current,
451
- currentTarget: inputRef.current
452
- };
453
- Object.defineProperty(syntheticEvent.target, "value", {
454
- writable: true,
455
- value: ""
456
- });
457
- onChange(syntheticEvent);
458
- }
459
450
  }
460
- inputRef.current.focus();
461
451
  }
452
+ inputRef.current.focus();
462
453
  },
463
454
  [onChange, isControlled]
464
455
  );
@@ -711,24 +702,13 @@ InputCode.displayName = "InputCode";
711
702
  // src/Select/Select.tsx
712
703
  var React8 = __toESM(require("react"));
713
704
  var import_jsx_runtime8 = require("react/jsx-runtime");
714
- var ChevronDownIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
715
- "path",
716
- {
717
- d: "M5 7.5l5 5 5-5",
718
- stroke: "currentColor",
719
- strokeWidth: "1.5",
720
- strokeLinecap: "round",
721
- strokeLinejoin: "round"
722
- }
723
- ) });
705
+ var ChevronDownIcon = () => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("path", { d: "M6 9L12 15L18 9", stroke: "#5988FF", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }) });
724
706
  var Select = React8.forwardRef(
725
707
  ({
726
- label,
727
708
  error,
728
709
  required,
729
710
  options,
730
711
  placeholder,
731
- size = "m",
732
712
  className = "",
733
713
  id: idProp,
734
714
  value,
@@ -740,6 +720,7 @@ var Select = React8.forwardRef(
740
720
  const id = React8.useId();
741
721
  const selectId = idProp ?? id;
742
722
  const [isOpen, setIsOpen] = React8.useState(false);
723
+ const [internalValue, setInternalValue] = React8.useState(defaultValue ?? "");
743
724
  const selectRef = React8.useRef(null);
744
725
  const dropdownRef = React8.useRef(null);
745
726
  const containerRef = React8.useRef(null);
@@ -751,9 +732,12 @@ var Select = React8.forwardRef(
751
732
  },
752
733
  [ref]
753
734
  );
754
- const currentValue = value !== void 0 ? value : defaultValue ?? "";
735
+ const currentValue = value !== void 0 ? value : internalValue;
755
736
  const selectedOption = currentValue ? options.find((opt) => opt.value === currentValue) : null;
756
737
  const displayValue = selectedOption ? selectedOption.label : placeholder ?? "";
738
+ React8.useEffect(() => {
739
+ if (value === void 0) setInternalValue(defaultValue ?? "");
740
+ }, [value, defaultValue]);
757
741
  React8.useEffect(() => {
758
742
  const handleClickOutside = (e) => {
759
743
  if (containerRef.current && !containerRef.current.contains(e.target) && dropdownRef.current && !dropdownRef.current.contains(e.target)) {
@@ -767,6 +751,7 @@ var Select = React8.forwardRef(
767
751
  }, [isOpen]);
768
752
  const handleOptionClick = (optionValue) => {
769
753
  if (selectRef.current) {
754
+ if (value === void 0) setInternalValue(optionValue);
770
755
  const nativeEvent = new Event("change", { bubbles: true });
771
756
  Object.defineProperty(nativeEvent, "target", {
772
757
  writable: false,
@@ -794,17 +779,12 @@ var Select = React8.forwardRef(
794
779
  setIsOpen(true);
795
780
  }
796
781
  };
797
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
782
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { ref: containerRef, className: "astrum-select__container", children: [
798
783
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
799
784
  "div",
800
785
  {
801
- ref: containerRef,
802
- 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(),
786
+ className: `astrum-select ${error ? "astrum-select--error" : ""} ${isOpen ? "astrum-select--open" : ""} ${className}`.trim(),
803
787
  children: [
804
- label != null && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("label", { htmlFor: selectId, className: "astrum-select__label", children: [
805
- label,
806
- required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "astrum-select__required", "aria-hidden": true, children: "*" })
807
- ] }),
808
788
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "astrum-select__wrap", children: [
809
789
  /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
810
790
  "select",
@@ -815,6 +795,7 @@ var Select = React8.forwardRef(
815
795
  value: value !== void 0 ? value : void 0,
816
796
  defaultValue: value === void 0 ? defaultValue : void 0,
817
797
  onChange: (e) => {
798
+ if (value === void 0) setInternalValue(e.target.value);
818
799
  onChange?.(e);
819
800
  setIsOpen(false);
820
801
  },
@@ -860,16 +841,19 @@ var Select = React8.forwardRef(
860
841
  ]
861
842
  }
862
843
  ),
863
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: dropdownRef, className: "astrum-select__dropdown", role: "listbox", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
844
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { ref: dropdownRef, className: "astrum-select__dropdown", role: "listbox", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
864
845
  "button",
865
846
  {
866
847
  type: "button",
867
848
  role: "option",
868
849
  "aria-selected": option.value === currentValue,
869
- className: `astrum-select__option ${option.value === currentValue ? "astrum-select__option--selected" : ""} ${option.disabled ? "astrum-select__option--disabled" : ""}`,
850
+ 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" : ""}`,
870
851
  onClick: () => !option.disabled && handleOptionClick(option.value),
871
852
  disabled: option.disabled,
872
- children: option.label
853
+ children: [
854
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "astrum-select__option-label", children: option.label }),
855
+ option.secondaryLabel != null && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "astrum-select__option-caption", children: option.secondaryLabel })
856
+ ]
873
857
  },
874
858
  option.value
875
859
  )) })
@@ -945,38 +929,18 @@ Chips.displayName = "Chips";
945
929
  // src/FileUpload/FileUpload.tsx
946
930
  var React10 = __toESM(require("react"));
947
931
  var import_jsx_runtime10 = require("react/jsx-runtime");
948
- var UploadIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
949
- "path",
950
- {
951
- d: "M24 8v24m0 0l-8-8m8 8l8-8M8 32h32",
952
- stroke: "currentColor",
953
- strokeWidth: "2",
954
- strokeLinecap: "round",
955
- strokeLinejoin: "round"
956
- }
957
- ) });
958
- var FileIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: [
959
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
960
- "path",
961
- {
962
- d: "M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6z",
963
- stroke: "currentColor",
964
- strokeWidth: "1.5",
965
- strokeLinecap: "round",
966
- strokeLinejoin: "round"
967
- }
968
- ),
969
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M14 2v6h6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
932
+ var UploadIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "64", height: "64", viewBox: "0 0 64 64", fill: "none", children: [
933
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" }),
934
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" })
935
+ ] });
936
+ var FileIcon = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
937
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" }),
938
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("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" })
939
+ ] });
940
+ var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
941
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M6.00049 6L18.0005 18", stroke: "#818181", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }),
942
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("path", { d: "M18.0005 6L6.00049 18", stroke: "#818181", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" })
970
943
  ] });
971
- var CloseIcon2 = () => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
972
- "path",
973
- {
974
- d: "M4 4l8 8M12 4l-8 8",
975
- stroke: "currentColor",
976
- strokeWidth: "1.5",
977
- strokeLinecap: "round"
978
- }
979
- ) });
980
944
  var FileUpload = React10.forwardRef(
981
945
  ({
982
946
  accept,
@@ -1043,8 +1007,9 @@ var FileUpload = React10.forwardRef(
1043
1007
  inputRef.current.click();
1044
1008
  }
1045
1009
  }, [disabled]);
1046
- 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");
1047
- 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");
1010
+ const isPdf = accept?.toLowerCase().includes("pdf");
1011
+ 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");
1012
+ 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");
1048
1013
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1049
1014
  "div",
1050
1015
  {
@@ -1092,8 +1057,21 @@ var FileUpload = React10.forwardRef(
1092
1057
  }
1093
1058
  );
1094
1059
  FileUpload.displayName = "FileUpload";
1060
+ var IMAGE_TYPES = /^image\//i;
1095
1061
  var FileItem = React10.forwardRef(
1096
- ({ name, size, icon, onRemove, className = "" }, ref) => {
1062
+ ({ name, size, file, previewUrl: previewUrlProp, icon, onRemove, className = "" }, ref) => {
1063
+ const [objectUrl, setObjectUrl] = React10.useState(null);
1064
+ React10.useEffect(() => {
1065
+ if (previewUrlProp != null || !file || !IMAGE_TYPES.test(file.type)) return;
1066
+ const url = URL.createObjectURL(file);
1067
+ setObjectUrl(url);
1068
+ return () => {
1069
+ URL.revokeObjectURL(url);
1070
+ setObjectUrl(null);
1071
+ };
1072
+ }, [file, previewUrlProp]);
1073
+ const previewUrl = previewUrlProp ?? objectUrl;
1074
+ const showPreview = previewUrl != null && previewUrl !== "";
1097
1075
  const formatSize = React10.useCallback((sizeValue) => {
1098
1076
  if (!sizeValue) return "";
1099
1077
  if (typeof sizeValue === "string") return sizeValue;
@@ -1102,18 +1080,27 @@ var FileItem = React10.forwardRef(
1102
1080
  return `${(sizeValue / (1024 * 1024)).toFixed(1)} MB`;
1103
1081
  }, []);
1104
1082
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { ref, className: `astrum-file-item ${className}`.trim(), children: [
1105
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "astrum-file-item__icon", children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FileIcon, {}) }),
1083
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "astrum-file-item__preview-wrap", children: showPreview ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1084
+ "img",
1085
+ {
1086
+ src: previewUrl,
1087
+ alt: "",
1088
+ className: "astrum-file-item__preview",
1089
+ decoding: "async"
1090
+ }
1091
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "astrum-file-item__icon", children: icon ?? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FileIcon, {}) }) }),
1106
1092
  /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "astrum-file-item__content", children: [
1107
1093
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "astrum-file-item__name", children: name }),
1108
1094
  size != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "astrum-file-item__size", children: formatSize(size) })
1109
1095
  ] }),
1110
- onRemove != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1096
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1111
1097
  "button",
1112
1098
  {
1113
1099
  type: "button",
1114
1100
  className: "astrum-file-item__remove",
1115
1101
  onClick: onRemove,
1116
1102
  "aria-label": "\u0423\u0434\u0430\u043B\u0438\u0442\u044C \u0444\u0430\u0439\u043B",
1103
+ disabled: onRemove == null,
1117
1104
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CloseIcon2, {})
1118
1105
  }
1119
1106
  )
@@ -1135,15 +1122,10 @@ var EditIcon = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { wid
1135
1122
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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" }),
1136
1123
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M13.75 7.16016L16.84 10.2502", stroke: "white", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" })
1137
1124
  ] });
1138
- var CrossIcon = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1139
- "path",
1140
- {
1141
- d: "M4 4l8 8M12 4l-8 8",
1142
- stroke: "currentColor",
1143
- strokeWidth: "1.5",
1144
- strokeLinecap: "round"
1145
- }
1146
- ) });
1125
+ var CrossIcon = () => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: [
1126
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M3.00012 3L9.00012 9", stroke: "white", "stroke-linecap": "round", "stroke-linejoin": "round" }),
1127
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", { d: "M9.00012 3L3.00012 9", stroke: "white", "stroke-linecap": "round", "stroke-linejoin": "round" })
1128
+ ] });
1147
1129
  var Avatar = React11.forwardRef(
1148
1130
  ({
1149
1131
  src,
@@ -1245,6 +1227,520 @@ var Avatar = React11.forwardRef(
1245
1227
  }
1246
1228
  );
1247
1229
  Avatar.displayName = "Avatar";
1230
+
1231
+ // src/DatePicker/DatePicker.tsx
1232
+ var React12 = __toESM(require("react"));
1233
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1234
+ var CalendarIcon = ({ isActive }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: [
1235
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }),
1236
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }),
1237
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M7.5 3V5.69999M16.5 3V5.69999", stroke: isActive ? "#2653F2" : "#ABABAB", "stroke-width": "2", "stroke-linecap": "round" })
1238
+ ] });
1239
+ var ChevronLeftIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M15 6L9 12L15 18", stroke: "#ABABAB", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }) });
1240
+ var ChevronRightIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("path", { d: "M9 18L15 12L9 6", stroke: "#ABABAB", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round" }) });
1241
+ var ClockIcon = () => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" }) });
1242
+ var formatDate = (date) => {
1243
+ if (!date) return "";
1244
+ const day = String(date.getDate()).padStart(2, "0");
1245
+ const month = String(date.getMonth() + 1).padStart(2, "0");
1246
+ const year = date.getFullYear();
1247
+ return `${day}.${month}.${year}`;
1248
+ };
1249
+ var parseDate = (value) => {
1250
+ const match = value.match(/^(\d{2})\.(\d{2})\.(\d{4})$/);
1251
+ if (!match) return null;
1252
+ const [, day, month, year] = match;
1253
+ const date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
1254
+ if (date.getFullYear() === parseInt(year) && date.getMonth() === parseInt(month) - 1 && date.getDate() === parseInt(day)) {
1255
+ return date;
1256
+ }
1257
+ return null;
1258
+ };
1259
+ var formatTime = (date) => {
1260
+ if (!date) return "";
1261
+ const hours = String(date.getHours()).padStart(2, "0");
1262
+ const minutes = String(date.getMinutes()).padStart(2, "0");
1263
+ return `${hours}:${minutes}`;
1264
+ };
1265
+ var parseTime = (value) => {
1266
+ const match = value.match(/^(\d{2}):(\d{2})$/);
1267
+ if (!match) return null;
1268
+ const hours = parseInt(match[1]);
1269
+ const minutes = parseInt(match[2]);
1270
+ if (hours >= 0 && hours < 24 && minutes >= 0 && minutes < 60) {
1271
+ return { hours, minutes };
1272
+ }
1273
+ return null;
1274
+ };
1275
+ var getDaysInMonth = (date) => {
1276
+ return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
1277
+ };
1278
+ var getFirstDayOfMonth = (date) => {
1279
+ const firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
1280
+ return firstDay.getDay() === 0 ? 6 : firstDay.getDay() - 1;
1281
+ };
1282
+ var isSameDay = (date1, date2) => {
1283
+ if (!date1 || !date2) return false;
1284
+ return date1.getFullYear() === date2.getFullYear() && date1.getMonth() === date2.getMonth() && date1.getDate() === date2.getDate();
1285
+ };
1286
+ var isToday = (date) => {
1287
+ const today = /* @__PURE__ */ new Date();
1288
+ return isSameDay(date, today);
1289
+ };
1290
+ var isDateInRange = (date, start, end) => {
1291
+ if (!start || !end) return false;
1292
+ const dateTime = date.getTime();
1293
+ const startTime = start.getTime();
1294
+ const endTime = end.getTime();
1295
+ return dateTime >= startTime && dateTime <= endTime;
1296
+ };
1297
+ var isDateRangeStart = (date, start, end) => {
1298
+ if (!start) return false;
1299
+ return isSameDay(date, start);
1300
+ };
1301
+ var isDateRangeEnd = (date, start, end) => {
1302
+ if (!end) return false;
1303
+ return isSameDay(date, end);
1304
+ };
1305
+ var monthNames = [
1306
+ "\u042F\u043D\u0432\u0430\u0440\u044C",
1307
+ "\u0424\u0435\u0432\u0440\u0430\u043B\u044C",
1308
+ "\u041C\u0430\u0440\u0442",
1309
+ "\u0410\u043F\u0440\u0435\u043B\u044C",
1310
+ "\u041C\u0430\u0439",
1311
+ "\u0418\u044E\u043D\u044C",
1312
+ "\u0418\u044E\u043B\u044C",
1313
+ "\u0410\u0432\u0433\u0443\u0441\u0442",
1314
+ "\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C",
1315
+ "\u041E\u043A\u0442\u044F\u0431\u0440\u044C",
1316
+ "\u041D\u043E\u044F\u0431\u0440\u044C",
1317
+ "\u0414\u0435\u043A\u0430\u0431\u0440\u044C"
1318
+ ];
1319
+ var weekDays = ["\u041F\u043D", "\u0412\u0442", "\u0421\u0440", "\u0427\u0442", "\u041F\u0442", "\u0421\u0431", "\u0412\u0441"];
1320
+ var DatePicker = React12.forwardRef(
1321
+ ({
1322
+ placeholder = "\u0414\u0430\u0442\u0430",
1323
+ placeholderFrom = "\u041E\u0442",
1324
+ placeholderTo = "\u0414\u043E",
1325
+ value,
1326
+ defaultValue,
1327
+ onChange,
1328
+ error,
1329
+ required,
1330
+ disabled,
1331
+ showTime = false,
1332
+ timeLabel = "\u0412\u0440\u0435\u043C\u044F (UTC):",
1333
+ range = false,
1334
+ className = "",
1335
+ id: idProp
1336
+ }, ref) => {
1337
+ const id = React12.useId();
1338
+ const inputId = idProp ?? id;
1339
+ const [isOpen, setIsOpen] = React12.useState(false);
1340
+ const [internalDate, setInternalDate] = React12.useState(
1341
+ range ? null : defaultValue ?? null
1342
+ );
1343
+ const [internalRange, setInternalRange] = React12.useState(
1344
+ range ? defaultValue ?? [null, null] : [null, null]
1345
+ );
1346
+ const [selectingStart, setSelectingStart] = React12.useState(true);
1347
+ const [internalTime, setInternalTime] = React12.useState(
1348
+ !range && defaultValue ? formatTime(defaultValue) : ""
1349
+ );
1350
+ const [viewDate, setViewDate] = React12.useState(() => {
1351
+ if (range) {
1352
+ const rangeValue = value ?? defaultValue;
1353
+ return rangeValue?.[0] ? new Date(rangeValue[0].getFullYear(), rangeValue[0].getMonth(), 1) : /* @__PURE__ */ new Date();
1354
+ }
1355
+ return value ? value : defaultValue ? defaultValue : /* @__PURE__ */ new Date();
1356
+ });
1357
+ const getRangeDisplayValue = (rangeValue) => {
1358
+ if (!rangeValue[0] && !rangeValue[1]) return "";
1359
+ if (rangeValue[0] && rangeValue[1]) {
1360
+ return `${formatDate(rangeValue[0])} \u2014 ${formatDate(rangeValue[1])}`;
1361
+ }
1362
+ if (rangeValue[0]) {
1363
+ return formatDate(rangeValue[0]);
1364
+ }
1365
+ return "";
1366
+ };
1367
+ const [inputValue, setInputValue] = React12.useState(() => {
1368
+ if (range) {
1369
+ const rangeValue = value ?? defaultValue;
1370
+ return rangeValue ? getRangeDisplayValue(rangeValue) : "";
1371
+ }
1372
+ return value ? formatDate(value) : defaultValue ? formatDate(defaultValue) : "";
1373
+ });
1374
+ const [timeValue, setTimeValue] = React12.useState(
1375
+ !range && value && showTime ? formatTime(value) : !range && defaultValue && showTime ? formatTime(defaultValue) : ""
1376
+ );
1377
+ const containerRef = React12.useRef(null);
1378
+ const calendarRef = React12.useRef(null);
1379
+ const inputRef = React12.useRef(null);
1380
+ const timeInputRef = React12.useRef(null);
1381
+ const isControlled = value !== void 0;
1382
+ const currentDate = range ? null : isControlled ? value : internalDate;
1383
+ const currentRange = range ? isControlled ? value : internalRange : [null, null];
1384
+ const setCombinedRef = React12.useCallback(
1385
+ (node) => {
1386
+ inputRef.current = node;
1387
+ if (typeof ref === "function") {
1388
+ ref(node);
1389
+ } else if (ref) {
1390
+ ref.current = node;
1391
+ }
1392
+ },
1393
+ [ref]
1394
+ );
1395
+ React12.useEffect(() => {
1396
+ if (range) {
1397
+ const rangeValue = value;
1398
+ if (isControlled && rangeValue) {
1399
+ setInputValue(getRangeDisplayValue(rangeValue));
1400
+ if (rangeValue[0]) {
1401
+ setViewDate(new Date(rangeValue[0].getFullYear(), rangeValue[0].getMonth(), 1));
1402
+ }
1403
+ } else if (isControlled && (!rangeValue || !rangeValue[0] && !rangeValue[1])) {
1404
+ setInputValue("");
1405
+ }
1406
+ } else {
1407
+ if (isControlled && value) {
1408
+ setInputValue(formatDate(value));
1409
+ if (showTime) {
1410
+ setTimeValue(formatTime(value));
1411
+ }
1412
+ setViewDate(new Date(value.getFullYear(), value.getMonth(), 1));
1413
+ } else if (isControlled && !value) {
1414
+ setInputValue("");
1415
+ if (showTime) {
1416
+ setTimeValue("");
1417
+ }
1418
+ }
1419
+ }
1420
+ }, [value, isControlled, showTime, range]);
1421
+ React12.useEffect(() => {
1422
+ if (range) {
1423
+ const rangeDefault = defaultValue;
1424
+ if (!isControlled && rangeDefault !== void 0) {
1425
+ setInternalRange(rangeDefault);
1426
+ setInputValue(getRangeDisplayValue(rangeDefault));
1427
+ if (rangeDefault[0]) {
1428
+ setViewDate(new Date(rangeDefault[0].getFullYear(), rangeDefault[0].getMonth(), 1));
1429
+ }
1430
+ }
1431
+ } else {
1432
+ if (!isControlled && defaultValue !== void 0) {
1433
+ setInternalDate(defaultValue);
1434
+ setInputValue(defaultValue ? formatDate(defaultValue) : "");
1435
+ if (showTime && defaultValue) {
1436
+ setTimeValue(formatTime(defaultValue));
1437
+ setInternalTime(formatTime(defaultValue));
1438
+ }
1439
+ if (defaultValue) {
1440
+ setViewDate(new Date(defaultValue.getFullYear(), defaultValue.getMonth(), 1));
1441
+ }
1442
+ }
1443
+ }
1444
+ }, [defaultValue, isControlled, showTime, range]);
1445
+ React12.useEffect(() => {
1446
+ const handleClickOutside = (e) => {
1447
+ if (containerRef.current && !containerRef.current.contains(e.target) && calendarRef.current && !calendarRef.current.contains(e.target)) {
1448
+ if (range) {
1449
+ if (currentRange[0] && currentRange[1]) {
1450
+ setIsOpen(false);
1451
+ }
1452
+ } else {
1453
+ setIsOpen(false);
1454
+ }
1455
+ }
1456
+ };
1457
+ if (isOpen) {
1458
+ document.addEventListener("mousedown", handleClickOutside);
1459
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1460
+ }
1461
+ }, [isOpen, range, currentRange]);
1462
+ const handleInputChange = (e) => {
1463
+ const newValue = e.target.value;
1464
+ setInputValue(newValue);
1465
+ if (range) {
1466
+ const rangeMatch = newValue.match(/^(\d{2}\.\d{2}\.\d{4})\s*—\s*(\d{2}\.\d{2}\.\d{4})$/);
1467
+ if (rangeMatch) {
1468
+ const parsedFrom = parseDate(rangeMatch[1]);
1469
+ const parsedTo = parseDate(rangeMatch[2]);
1470
+ const newRange = [parsedFrom, parsedTo];
1471
+ if (isControlled) {
1472
+ onChange?.(newRange);
1473
+ } else {
1474
+ setInternalRange(newRange);
1475
+ onChange?.(newRange);
1476
+ }
1477
+ if (parsedFrom) {
1478
+ setViewDate(new Date(parsedFrom.getFullYear(), parsedFrom.getMonth(), 1));
1479
+ }
1480
+ } else {
1481
+ const singleDateMatch = newValue.match(/^(\d{2}\.\d{2}\.\d{4})$/);
1482
+ if (singleDateMatch) {
1483
+ const parsed2 = parseDate(singleDateMatch[1]);
1484
+ const newRange = [parsed2, null];
1485
+ if (isControlled) {
1486
+ onChange?.(newRange);
1487
+ } else {
1488
+ setInternalRange(newRange);
1489
+ onChange?.(newRange);
1490
+ }
1491
+ if (parsed2) {
1492
+ setViewDate(new Date(parsed2.getFullYear(), parsed2.getMonth(), 1));
1493
+ }
1494
+ } else if (newValue === "") {
1495
+ const newRange = [null, null];
1496
+ if (isControlled) {
1497
+ onChange?.(newRange);
1498
+ } else {
1499
+ setInternalRange(newRange);
1500
+ onChange?.(newRange);
1501
+ }
1502
+ }
1503
+ }
1504
+ return;
1505
+ }
1506
+ const parsed = parseDate(newValue);
1507
+ if (parsed) {
1508
+ if (showTime && timeValue) {
1509
+ const time = parseTime(timeValue);
1510
+ if (time) {
1511
+ parsed.setHours(time.hours, time.minutes);
1512
+ }
1513
+ }
1514
+ if (isControlled) {
1515
+ onChange?.(parsed);
1516
+ } else {
1517
+ setInternalDate(parsed);
1518
+ onChange?.(parsed);
1519
+ }
1520
+ } else if (newValue === "") {
1521
+ if (isControlled) {
1522
+ onChange?.(null);
1523
+ } else {
1524
+ setInternalDate(null);
1525
+ onChange?.(null);
1526
+ }
1527
+ }
1528
+ };
1529
+ const handleTimeChange = (e) => {
1530
+ if (range) return;
1531
+ const newValue = e.target.value;
1532
+ setTimeValue(newValue);
1533
+ const parsed = parseTime(newValue);
1534
+ if (parsed && currentDate) {
1535
+ const newDate = new Date(currentDate);
1536
+ newDate.setHours(parsed.hours, parsed.minutes);
1537
+ if (isControlled) {
1538
+ onChange?.(newDate);
1539
+ } else {
1540
+ setInternalDate(newDate);
1541
+ onChange?.(newDate);
1542
+ }
1543
+ }
1544
+ setInternalTime(newValue);
1545
+ };
1546
+ const handleDateClick = (day, isOtherMonth) => {
1547
+ if (disabled) return;
1548
+ const newDate = new Date(viewDate);
1549
+ if (isOtherMonth) {
1550
+ if (day > 15) {
1551
+ newDate.setMonth(newDate.getMonth() - 1);
1552
+ } else {
1553
+ newDate.setMonth(newDate.getMonth() + 1);
1554
+ }
1555
+ }
1556
+ newDate.setDate(day);
1557
+ if (range) {
1558
+ let newRange;
1559
+ if (!currentRange[0]) {
1560
+ newRange = [newDate, null];
1561
+ setSelectingStart(false);
1562
+ } else if (!currentRange[1]) {
1563
+ if (newDate.getTime() < currentRange[0].getTime()) {
1564
+ newRange = [newDate, currentRange[0]];
1565
+ } else {
1566
+ newRange = [currentRange[0], newDate];
1567
+ }
1568
+ setSelectingStart(true);
1569
+ } else {
1570
+ newRange = [newDate, null];
1571
+ setSelectingStart(false);
1572
+ }
1573
+ setViewDate(new Date(newDate.getFullYear(), newDate.getMonth(), 1));
1574
+ if (isControlled) {
1575
+ onChange?.(newRange);
1576
+ } else {
1577
+ setInternalRange(newRange);
1578
+ onChange?.(newRange);
1579
+ }
1580
+ setInputValue(getRangeDisplayValue(newRange));
1581
+ if (newRange[0] && newRange[1] && !showTime) {
1582
+ setIsOpen(false);
1583
+ }
1584
+ } else {
1585
+ if (showTime && timeValue) {
1586
+ const time = parseTime(timeValue);
1587
+ if (time) {
1588
+ newDate.setHours(time.hours, time.minutes);
1589
+ }
1590
+ }
1591
+ setViewDate(new Date(newDate.getFullYear(), newDate.getMonth(), 1));
1592
+ if (isControlled) {
1593
+ onChange?.(newDate);
1594
+ } else {
1595
+ setInternalDate(newDate);
1596
+ onChange?.(newDate);
1597
+ }
1598
+ setInputValue(formatDate(newDate));
1599
+ if (!showTime) {
1600
+ setIsOpen(false);
1601
+ }
1602
+ }
1603
+ };
1604
+ const handlePrevMonth = () => {
1605
+ setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 1));
1606
+ };
1607
+ const handleNextMonth = () => {
1608
+ setViewDate(new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 1));
1609
+ };
1610
+ const renderCalendar = () => {
1611
+ const daysInMonth = getDaysInMonth(viewDate);
1612
+ const firstDay = getFirstDayOfMonth(viewDate);
1613
+ const days = [];
1614
+ const prevMonth = new Date(viewDate.getFullYear(), viewDate.getMonth() - 1, 0);
1615
+ const daysInPrevMonth = prevMonth.getDate();
1616
+ for (let i = firstDay - 1; i >= 0; i--) {
1617
+ days.push({ day: daysInPrevMonth - i, isOtherMonth: true });
1618
+ }
1619
+ for (let i = 1; i <= daysInMonth; i++) {
1620
+ days.push({ day: i, isOtherMonth: false });
1621
+ }
1622
+ const remainingDays = 35 - days.length;
1623
+ for (let i = 1; i <= remainingDays; i++) {
1624
+ days.push({ day: i, isOtherMonth: true });
1625
+ }
1626
+ return days;
1627
+ };
1628
+ const calendarDays = renderCalendar();
1629
+ const isActive = isOpen;
1630
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref: containerRef, className: `astrum-datepicker ${range ? "astrum-datepicker--range" : ""} ${error ? "astrum-datepicker--error" : ""} ${className}`.trim(), children: [
1631
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "astrum-datepicker__wrap", children: [
1632
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1633
+ "input",
1634
+ {
1635
+ ref: setCombinedRef,
1636
+ id: inputId,
1637
+ type: "text",
1638
+ value: inputValue,
1639
+ onChange: handleInputChange,
1640
+ onFocus: () => !disabled && setIsOpen(true),
1641
+ placeholder: range ? `${placeholderFrom} \u2014 ${placeholderTo}` : placeholder,
1642
+ disabled,
1643
+ className: `astrum-datepicker__field ${error ? "astrum-datepicker__field--invalid" : ""}`.trim(),
1644
+ "aria-invalid": !!error,
1645
+ "aria-required": required,
1646
+ "aria-describedby": error ? `${inputId}-error` : void 0,
1647
+ "aria-expanded": isOpen
1648
+ }
1649
+ ),
1650
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1651
+ "button",
1652
+ {
1653
+ type: "button",
1654
+ className: `astrum-datepicker__icon ${isActive ? "astrum-datepicker__icon--active" : ""}`,
1655
+ onClick: () => !disabled && setIsOpen(!isOpen),
1656
+ disabled,
1657
+ "aria-label": "\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u043A\u0430\u043B\u0435\u043D\u0434\u0430\u0440\u044C",
1658
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CalendarIcon, { isActive })
1659
+ }
1660
+ )
1661
+ ] }),
1662
+ error != null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { id: `${inputId}-error`, className: "astrum-datepicker__error", role: "alert", children: error }),
1663
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { ref: calendarRef, className: "astrum-datepicker__calendar", children: [
1664
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "astrum-datepicker__calendar-header", children: [
1665
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1666
+ "button",
1667
+ {
1668
+ type: "button",
1669
+ className: "astrum-datepicker__calendar-nav",
1670
+ onClick: handlePrevMonth,
1671
+ "aria-label": "\u041F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439 \u043C\u0435\u0441\u044F\u0446",
1672
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronLeftIcon, {})
1673
+ }
1674
+ ),
1675
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "astrum-datepicker__calendar-month", children: [
1676
+ monthNames[viewDate.getMonth()],
1677
+ " ",
1678
+ viewDate.getFullYear()
1679
+ ] }),
1680
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1681
+ "button",
1682
+ {
1683
+ type: "button",
1684
+ className: "astrum-datepicker__calendar-nav",
1685
+ onClick: handleNextMonth,
1686
+ "aria-label": "\u0421\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439 \u043C\u0435\u0441\u044F\u0446",
1687
+ children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronRightIcon, {})
1688
+ }
1689
+ )
1690
+ ] }),
1691
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "astrum-datepicker__calendar-weekdays", children: weekDays.map((day) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "astrum-datepicker__calendar-weekday", children: day }, day)) }),
1692
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "astrum-datepicker__calendar-days", children: calendarDays.map(({ day, isOtherMonth }, index) => {
1693
+ const dayDate = new Date(viewDate.getFullYear(), viewDate.getMonth() + (isOtherMonth ? day > 15 ? -1 : 1 : 0), day);
1694
+ const isCurrentDay = !isOtherMonth && isToday(dayDate);
1695
+ let isSelected;
1696
+ let isInRange = false;
1697
+ let isRangeStart = false;
1698
+ let isRangeEnd = false;
1699
+ if (range) {
1700
+ const hasSelectedRange = currentRange[0] != null || currentRange[1] != null;
1701
+ isSelected = hasSelectedRange ? currentRange[0] != null && isSameDay(dayDate, currentRange[0]) || currentRange[1] != null && isSameDay(dayDate, currentRange[1]) || false : isCurrentDay;
1702
+ if (currentRange[0] && currentRange[1]) {
1703
+ isInRange = isDateInRange(dayDate, currentRange[0], currentRange[1]) && !isSelected;
1704
+ isRangeStart = isDateRangeStart(dayDate, currentRange[0], currentRange[1]);
1705
+ isRangeEnd = isDateRangeEnd(dayDate, currentRange[0], currentRange[1]);
1706
+ }
1707
+ } else {
1708
+ isSelected = currentDate ? isSameDay(dayDate, currentDate) : isCurrentDay;
1709
+ }
1710
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1711
+ "button",
1712
+ {
1713
+ type: "button",
1714
+ 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" : ""}`,
1715
+ onClick: () => handleDateClick(day, isOtherMonth),
1716
+ disabled,
1717
+ children: day
1718
+ },
1719
+ `${day}-${isOtherMonth}-${index}`
1720
+ );
1721
+ }) }),
1722
+ showTime && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "astrum-datepicker__calendar-time", children: [
1723
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { className: "astrum-datepicker__calendar-time-label", children: timeLabel }),
1724
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "astrum-datepicker__calendar-time-input-wrap", children: [
1725
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1726
+ "input",
1727
+ {
1728
+ ref: timeInputRef,
1729
+ type: "text",
1730
+ value: timeValue,
1731
+ onChange: handleTimeChange,
1732
+ placeholder: "00:00",
1733
+ className: "astrum-datepicker__calendar-time-input"
1734
+ }
1735
+ ),
1736
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "astrum-datepicker__calendar-time-icon", "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ClockIcon, {}) })
1737
+ ] })
1738
+ ] })
1739
+ ] })
1740
+ ] });
1741
+ }
1742
+ );
1743
+ DatePicker.displayName = "DatePicker";
1248
1744
  // Annotate the CommonJS export names for ESM import in node:
1249
1745
  0 && (module.exports = {
1250
1746
  Avatar,
@@ -1252,6 +1748,7 @@ Avatar.displayName = "Avatar";
1252
1748
  Checkbox,
1253
1749
  Chips,
1254
1750
  ColorPicker,
1751
+ DatePicker,
1255
1752
  FileItem,
1256
1753
  FileUpload,
1257
1754
  Input,