@astral/ui 4.18.1 → 4.18.3

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 (65) hide show
  1. package/components/DatePicker/DayPicker/DayPicker.js +2 -1
  2. package/components/DatePicker/MonthPicker/MonthPicker.js +1 -1
  3. package/components/DatePicker/YearPicker/YearPicker.js +1 -1
  4. package/components/DatePicker/hooks/useBaseDateInRange/useBaseDateInRange.js +1 -1
  5. package/components/DatePicker/hooks/useMaskedValue/useMaskedValue.js +1 -1
  6. package/components/DatePicker/hooks/useSelectedBaseDate/useSelectedBaseDate.js +1 -1
  7. package/components/DateRangePicker/useLogic/hooks/useBaseRangeDates/useBaseRangeDates.js +1 -1
  8. package/components/DateRangePicker/useLogic/utils/getBoundaryDate/getBoundaryDate.js +2 -1
  9. package/components/EmailOrPhoneField/useLogic/useLogic.js +4 -1
  10. package/components/OverflowTypography/hooks/useOverflowed/useOverflowed.js +1 -1
  11. package/components/StaticCalendar/StaticDaysCalendar/useLogic/utils/makeEdgeDates/makeEdgeDates.js +1 -1
  12. package/components/StaticCalendar/StaticDaysCalendar/useLogic/utils/optimizeRangeDates/optimizeRangeDates.js +1 -1
  13. package/components/fileUploading/FileInfo/FileInfo.js +1 -1
  14. package/components/fileUploading/FileUploaderDropzone/HintPlaceholder/HintPlaceholder.js +1 -1
  15. package/components/fileUploading/FileUploaderDropzone/HintPlaceholder/useLogic/useLogic.js +1 -1
  16. package/components/fileUploading/FileUploaderFile/Actions/useLogic/useLogic.js +1 -1
  17. package/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/HintPlaceholder.js +1 -1
  18. package/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/useLogic/useLogic.js +1 -1
  19. package/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js +1 -1
  20. package/components/fileUploading/hooks/useFileUploader/useFileUploader.js +2 -1
  21. package/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.js +2 -1
  22. package/components/fileUploading/restrictions/restrictFileType/restrictFileType.js +1 -1
  23. package/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.js +1 -1
  24. package/components/fileUploading/utils/declensionFile/declensionFile.js +1 -1
  25. package/components/hooks/useAsyncOptions/useAsyncOptions.js +1 -1
  26. package/components/placeholders/InternalErrorPlaceholder/InternalErrorPlaceholder.js +1 -1
  27. package/components/theme/components/MuiAutocomplete.js +2 -0
  28. package/components/utils/date/areDatesSame/areDatesSame.js +1 -1
  29. package/components/utils/date/buildDaysCalendarGrid/buildDaysCalendarGrid.js +1 -1
  30. package/components/utils/date/buildIsoDate/buildIsoDateString.js +1 -1
  31. package/components/utils/date/checkIsDateInRange/checkIsDateInRange.js +1 -1
  32. package/components/utils/date/format/formatDate/formatDate.js +1 -1
  33. package/node/components/DatePicker/DayPicker/DayPicker.js +4 -3
  34. package/node/components/DatePicker/MonthPicker/MonthPicker.js +2 -2
  35. package/node/components/DatePicker/YearPicker/YearPicker.js +2 -2
  36. package/node/components/DatePicker/hooks/useBaseDateInRange/useBaseDateInRange.js +2 -2
  37. package/node/components/DatePicker/hooks/useMaskedValue/useMaskedValue.js +2 -2
  38. package/node/components/DatePicker/hooks/useSelectedBaseDate/useSelectedBaseDate.js +2 -2
  39. package/node/components/DateRangePicker/useLogic/hooks/useBaseRangeDates/useBaseRangeDates.js +3 -3
  40. package/node/components/DateRangePicker/useLogic/utils/getBoundaryDate/getBoundaryDate.js +4 -3
  41. package/node/components/EmailOrPhoneField/useLogic/useLogic.js +10 -7
  42. package/node/components/OverflowTypography/hooks/useOverflowed/useOverflowed.js +2 -2
  43. package/node/components/StaticCalendar/StaticDaysCalendar/useLogic/utils/makeEdgeDates/makeEdgeDates.js +3 -3
  44. package/node/components/StaticCalendar/StaticDaysCalendar/useLogic/utils/optimizeRangeDates/optimizeRangeDates.js +3 -3
  45. package/node/components/fileUploading/FileInfo/FileInfo.js +2 -2
  46. package/node/components/fileUploading/FileUploaderDropzone/HintPlaceholder/HintPlaceholder.js +4 -4
  47. package/node/components/fileUploading/FileUploaderDropzone/HintPlaceholder/useLogic/useLogic.js +2 -2
  48. package/node/components/fileUploading/FileUploaderFile/Actions/useLogic/useLogic.js +4 -4
  49. package/node/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/HintPlaceholder.js +2 -2
  50. package/node/components/fileUploading/PreviewFileUploaderDropZone/HintPlaceholder/useLogic/useLogic.js +2 -2
  51. package/node/components/fileUploading/PreviewFileUploaderFile/FilePreview/useLogic/useLogic.js +5 -5
  52. package/node/components/fileUploading/hooks/useFileUploader/useFileUploader.js +8 -7
  53. package/node/components/fileUploading/hooks/usePreviewFileUploader/usePreviewFileUploader.js +8 -7
  54. package/node/components/fileUploading/restrictions/restrictFileType/restrictFileType.js +5 -5
  55. package/node/components/fileUploading/restrictions/restrictFileType/utils/getFileTypeFromName/getFileTypeFromName.js +2 -2
  56. package/node/components/fileUploading/utils/declensionFile/declensionFile.js +2 -2
  57. package/node/components/hooks/useAsyncOptions/useAsyncOptions.js +2 -2
  58. package/node/components/placeholders/InternalErrorPlaceholder/InternalErrorPlaceholder.js +2 -2
  59. package/node/components/theme/components/MuiAutocomplete.js +2 -0
  60. package/node/components/utils/date/areDatesSame/areDatesSame.js +2 -2
  61. package/node/components/utils/date/buildDaysCalendarGrid/buildDaysCalendarGrid.js +2 -2
  62. package/node/components/utils/date/buildIsoDate/buildIsoDateString.js +7 -7
  63. package/node/components/utils/date/checkIsDateInRange/checkIsDateInRange.js +3 -3
  64. package/node/components/utils/date/format/formatDate/formatDate.js +2 -2
  65. package/package.json +2 -2
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { addMonths, addYears } from '@astral/utils';
2
+ import { addMonths } from '@astral/utils/date/addMonths';
3
+ import { addYears } from '@astral/utils/date/addYears';
3
4
  import { useCallback, useContext, useEffect, useMemo } from 'react';
4
5
  import { ConfigContext } from '../../ConfigProvider';
5
6
  import { useLocaleDateTimeFormat } from '../../hooks';
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { addYears } from '@astral/utils';
2
+ import { addYears } from '@astral/utils/date/addYears';
3
3
  import { useContext } from 'react';
4
4
  import { ConfigContext } from '../../ConfigProvider';
5
5
  import { useLocaleDateTimeFormat } from '../../hooks';
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { addYears } from '@astral/utils';
2
+ import { addYears } from '@astral/utils/date/addYears';
3
3
  import { useContext } from 'react';
4
4
  import { ConfigContext } from '../../ConfigProvider';
5
5
  import { datePickerClassnames, ELEMENTS_COUNT_IN_ROW_IN_LARGE_GRID, } from '../constants';
@@ -1,4 +1,4 @@
1
- import { addMonths } from '@astral/utils';
1
+ import { addMonths } from '@astral/utils/date/addMonths';
2
2
  import { useMemo } from 'react';
3
3
  import { buildIsoDate } from '../../../utils/date';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { isDate } from '@astral/utils';
1
+ import { isDate } from '@astral/utils/date/isDate';
2
2
  import { useEffect, useState } from 'react';
3
3
  import { formatDate, parseDate } from '../../../utils/date';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { isDate } from '@astral/utils';
1
+ import { isDate } from '@astral/utils/date/isDate';
2
2
  import { useEffect, useState } from 'react';
3
3
  import { areDatesSame, DateCompareDeep, isDateOutOfRange, } from '../../../utils/date';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { addMonths } from '@astral/utils';
1
+ import { addMonths } from '@astral/utils/date/addMonths';
2
2
  import { useEffect, useMemo, useState } from 'react';
3
3
  import { useBaseDateInRange } from '../../../../DatePicker/hooks';
4
4
  /**
@@ -1,4 +1,5 @@
1
- import { addDays, isDate } from '@astral/utils';
1
+ import { addDays } from '@astral/utils/date/addDays';
2
+ import { isDate } from '@astral/utils/date/isDate';
2
3
  /**
3
4
  * Утилита проверки целевой даты.
4
5
  * Если целевая дата в наличии, то возвращается дата со смещением равным offset.
@@ -1,4 +1,7 @@
1
- import { checkPhone, checkProbablyEmail, formatPhoneToView, normalizePhone, } from '@astral/utils';
1
+ import { checkProbablyEmail } from '@astral/utils/email/checkProbablyEmail';
2
+ import { checkPhone } from '@astral/utils/phone/checkPhone';
3
+ import { formatPhoneToView } from '@astral/utils/phone/formatPhoneToView';
4
+ import { normalizePhone } from '@astral/utils/phone/normalizePhone';
2
5
  export const useLogic = (props) => {
3
6
  const { onBlur, onChange, value, inputProps, isHidePersonalData, ...restProps } = props;
4
7
  const getFieldType = (targetValue) => {
@@ -1,4 +1,4 @@
1
- import { debounce } from '@astral/utils';
1
+ import { debounce } from '@astral/utils/debounce';
2
2
  import { useLayoutEffect, useRef, useState } from 'react';
3
3
  import { useFirstMountState } from '../../../hooks';
4
4
  export const useOverflowed = (forwardedRef, hasMultipleRows = false, hasVisibleLastSymbols = false) => {
@@ -1,4 +1,4 @@
1
- import { addDays } from '@astral/utils';
1
+ import { addDays } from '@astral/utils/date/addDays';
2
2
  import { DAYS_IN_WEEK } from '../../../../../constants';
3
3
  import { buildIsoDate, DAYS_CALENDAR_ITEMS_COUNT, } from '../../../../../utils/date';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { addDays } from '@astral/utils';
1
+ import { addDays } from '@astral/utils/date/addDays';
2
2
  import { makeEdgeDates } from '../makeEdgeDates';
3
3
  const getFromAccumulator = (date, accumulator) => {
4
4
  const key = date.toISOString();
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { formatFileSizeToView } from '@astral/utils';
2
+ import { formatFileSizeToView } from '@astral/utils/file/formatFileSizeToView';
3
3
  import { DotIcon, FileSize, StyledFilename, Wrapper } from './styles';
4
4
  export const FileInfo = ({ className, fileName, fileSize }) => {
5
5
  return (_jsxs(Wrapper, { className: className, children: [_jsx(StyledFilename, { children: fileName }), fileSize && (_jsxs(FileSize, { children: [_jsx(DotIcon, {}), formatFileSizeToView(fileSize)] }))] }));
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { formatFileSizeToView } from '@astral/utils';
2
+ import { formatFileSizeToView } from '@astral/utils/file/formatFileSizeToView';
3
3
  import { Typography } from '../../../Typography';
4
4
  import { declensionFile } from '../../utils';
5
5
  import { Extensions } from './styles';
@@ -1,4 +1,4 @@
1
- import { formatFileTypeToView } from '@astral/utils';
1
+ import { formatFileTypeToView } from '@astral/utils/file/formatFileTypeToView';
2
2
  export const useLogic = ({ accept, ...restProps }) => {
3
3
  const extensions = accept.map(formatFileTypeToView).join(', ');
4
4
  return { extensions, ...restProps };
@@ -1,4 +1,4 @@
1
- import { getFileExtension } from '@astral/utils';
1
+ import { getFileExtension } from '@astral/utils/file/getFileExtension';
2
2
  import { useContext } from 'react';
3
3
  import { ConfigContext } from '../../../../ConfigProvider';
4
4
  import { ABORT_ERROR_MESSAGE, EXTENSIONS_IN_NEW_TAB, VIEW_NEW_TAB_ERROR_MESSAGE, } from '../../../constants';
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { formatFileSizeToView } from '@astral/utils';
2
+ import { formatFileSizeToView } from '@astral/utils/file/formatFileSizeToView';
3
3
  import { Typography } from '../../../Typography';
4
4
  import { Extensions, Wrapper } from './styles';
5
5
  import { useLogic } from './useLogic';
@@ -1,4 +1,4 @@
1
- import { formatFileTypeToView } from '@astral/utils';
1
+ import { formatFileTypeToView } from '@astral/utils/file/formatFileTypeToView';
2
2
  import { useContext, useMemo } from 'react';
3
3
  import { ConfigContext, } from '../../../../ConfigProvider';
4
4
  import { Image, setDefaultImageStyles } from '../styles';
@@ -1,4 +1,4 @@
1
- import { getFileExtension } from '@astral/utils';
1
+ import { getFileExtension } from '@astral/utils/file/getFileExtension';
2
2
  import { useContext } from 'react';
3
3
  import { ConfigContext } from '../../../../ConfigProvider';
4
4
  import { EXTENSIONS_IN_NEW_TAB, VIEW_NEW_TAB_ERROR_MESSAGE, } from '../../../constants';
@@ -1,4 +1,5 @@
1
- import { declensionOfWords, formatFileSizeToView } from '@astral/utils';
1
+ import { declensionOfWords } from '@astral/utils/declension/declensionOfWords';
2
+ import { formatFileSizeToView } from '@astral/utils/file/formatFileSizeToView';
2
3
  import { useMemo } from 'react';
3
4
  import { useGenerateLocalId } from '../../../hooks/useGenerateLocalId';
4
5
  import { useId } from '../../../hooks/useId';
@@ -1,4 +1,5 @@
1
- import { declensionOfWords, formatFileSizeToView } from '@astral/utils';
1
+ import { declensionOfWords } from '@astral/utils/declension/declensionOfWords';
2
+ import { formatFileSizeToView } from '@astral/utils/file/formatFileSizeToView';
2
3
  import { useMemo, } from 'react';
3
4
  import { useGenerateLocalId } from '../../../hooks/useGenerateLocalId';
4
5
  import { useId } from '../../../hooks/useId';
@@ -1,4 +1,4 @@
1
- import { getFileType } from '@astral/utils';
1
+ import { getFileType } from '@astral/utils/file/getFileType';
2
2
  import { FILE_TYPE_ERROR_INFO } from './constants';
3
3
  import { getFileTypeFromFile, prepareType } from './utils';
4
4
  const getGeneralType = (type) => type.split('/')[0];
@@ -1,4 +1,4 @@
1
- import { getFileType } from '@astral/utils';
1
+ import { getFileType } from '@astral/utils/file/getFileType';
2
2
  /**
3
3
  * Возвращает формат файла из названия файла
4
4
  */
@@ -1,4 +1,4 @@
1
- import { declensionOfWords } from '@astral/utils';
1
+ import { declensionOfWords } from '@astral/utils/declension/declensionOfWords';
2
2
  // cSpell:ignore файлa
3
3
  // Записываем в родительском падеже
4
4
  export const declensionFile = declensionOfWords(['файлa', 'файлов', 'файлов']);
@@ -1,4 +1,4 @@
1
- import { debounce } from '@astral/utils';
1
+ import { debounce } from '@astral/utils/debounce';
2
2
  import { useCallback, useRef, useState } from 'react';
3
3
  import { useLoadingState } from '../../hooks';
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { formatPhoneToView } from '@astral/utils';
2
+ import { formatPhoneToView } from '@astral/utils/phone/formatPhoneToView';
3
3
  import { Link } from '@mui/material';
4
4
  import { useContext } from 'react';
5
5
  import { Button } from '../../Button';
@@ -34,6 +34,8 @@ export const MuiAutocomplete = {
34
34
  alignItems: 'center',
35
35
  justifyContent: 'flex-end',
36
36
  color: theme.palette.grey[800],
37
+ transform: 'unset',
38
+ top: 'unset',
37
39
  right: '8px !important',
38
40
  flexGrow: 1,
39
41
  '.MuiButtonBase-root': {
@@ -1,4 +1,4 @@
1
- import { isDate } from '@astral/utils';
1
+ import { isDate } from '@astral/utils/date/isDate';
2
2
  /**
3
3
  * утилита для сверки совпадения дат, или их отсутствия
4
4
  */
@@ -1,4 +1,4 @@
1
- import { isDate } from '@astral/utils';
1
+ import { isDate } from '@astral/utils/date/isDate';
2
2
  import { DAYS_IN_WEEK } from '../../../constants';
3
3
  import { buildIsoDate } from '../buildIsoDate';
4
4
  import { checkIsDateInRange } from '../checkIsDateInRange';
@@ -1,4 +1,4 @@
1
- import { zeroPad } from '@astral/utils';
1
+ import { zeroPad } from '@astral/utils/zeroPad';
2
2
  /**
3
3
  * утилита генерирующая строковую дату в формате ISO
4
4
  */
@@ -1,4 +1,4 @@
1
- import { isDate } from '@astral/utils';
1
+ import { isDate } from '@astral/utils/date/isDate';
2
2
  import { isDateOutOfRange } from '../../../utils/date';
3
3
  /**
4
4
  * утилита проверки даты на то, что она попадает в указанный диапазон
@@ -1,4 +1,4 @@
1
- import { zeroPad } from '@astral/utils';
1
+ import { zeroPad } from '@astral/utils/zeroPad';
2
2
  import { DateMaskElements } from '../maskDate';
3
3
  const elementsMap = {
4
4
  [DateMaskElements.Day]: (date) => date.getUTCDate(),
@@ -2,7 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DayPicker = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const utils_1 = require("@astral/utils");
5
+ const addMonths_1 = require("@astral/utils/date/addMonths");
6
+ const addYears_1 = require("@astral/utils/date/addYears");
6
7
  const react_1 = require("react");
7
8
  const ConfigProvider_1 = require("../../ConfigProvider");
8
9
  const hooks_1 = require("../../hooks");
@@ -26,8 +27,8 @@ const DayPicker = ({ date: initialDate, selectedDate, onChange, isMondayFirst, r
26
27
  const { month: monthCaption, year: yearCaption } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext).datePickerLanguageMap;
27
28
  const { baseDate, handlePrevClick, handleNextClick, handleDoubleNextClick, handleDoublePrevClick, } = (0, useCalendarNavigate_1.useCalendarNavigate)({
28
29
  date: initialDate,
29
- addCb: utils_1.addMonths,
30
- addDoubleCb: isDoubleNavigationButtonsEnabled ? utils_1.addYears : undefined,
30
+ addCb: addMonths_1.addMonths,
31
+ addDoubleCb: isDoubleNavigationButtonsEnabled ? addYears_1.addYears : undefined,
31
32
  });
32
33
  const { popoverHovered } = (0, react_1.useContext)(PopoverHoveredContext_1.PopoverHoveredContext);
33
34
  const { maxDate, minDate } = (0, react_1.useContext)(MinMaxDateContext_1.MinMaxDateContext);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MonthPicker = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const utils_1 = require("@astral/utils");
5
+ const addYears_1 = require("@astral/utils/date/addYears");
6
6
  const react_1 = require("react");
7
7
  const ConfigProvider_1 = require("../../ConfigProvider");
8
8
  const hooks_1 = require("../../hooks");
@@ -20,7 +20,7 @@ const MonthPicker = ({ date: initialDate, selectedDate, onChange, rangeDate, ...
20
20
  });
21
21
  const { baseDate, handlePrevClick, handleNextClick } = (0, useCalendarNavigate_1.useCalendarNavigate)({
22
22
  date: initialDate,
23
- addCb: utils_1.addYears,
23
+ addCb: addYears_1.addYears,
24
24
  });
25
25
  const grid = (0, hooks_2.useMonthsGrid)({
26
26
  baseDate,
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.YearPicker = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const utils_1 = require("@astral/utils");
5
+ const addYears_1 = require("@astral/utils/date/addYears");
6
6
  const react_1 = require("react");
7
7
  const ConfigProvider_1 = require("../../ConfigProvider");
8
8
  const constants_1 = require("../constants");
@@ -13,7 +13,7 @@ const hooks_1 = require("./hooks");
13
13
  const YearPicker = ({ date: initialDate, selectedDate, onChange, rangeDate, ...headProps }) => {
14
14
  const { baseDate, handlePrevClick, handleNextClick } = (0, useCalendarNavigate_1.useCalendarNavigate)({
15
15
  date: initialDate,
16
- addCb: (date, direction) => (0, utils_1.addYears)(date, constants_2.YEARS_IN_GRID * direction),
16
+ addCb: (date, direction) => (0, addYears_1.addYears)(date, constants_2.YEARS_IN_GRID * direction),
17
17
  });
18
18
  const grid = (0, hooks_1.useYearsGrid)({
19
19
  baseDate,
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useBaseDateInRange = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const addMonths_1 = require("@astral/utils/date/addMonths");
5
5
  const react_1 = require("react");
6
6
  const date_1 = require("../../../utils/date");
7
7
  /**
8
8
  * хук который выдаст нам опорную дату, которая будет в пределах от минимальной, до максимальной, пригодится, когда текущая дата меньше минимальной, или больше максимальной.
9
9
  */
10
10
  const useBaseDateInRange = ({ minDate, maxDate, monthOffset = 0, initialDate, }) => (0, react_1.useMemo)(() => {
11
- const currentDate = (0, utils_1.addMonths)(initialDate || new Date(), monthOffset);
11
+ const currentDate = (0, addMonths_1.addMonths)(initialDate || new Date(), monthOffset);
12
12
  const baseDate = (0, date_1.buildIsoDate)({
13
13
  year: currentDate.getUTCFullYear(),
14
14
  month: currentDate.getUTCMonth() + 1,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useMaskedValue = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const isDate_1 = require("@astral/utils/date/isDate");
5
5
  const react_1 = require("react");
6
6
  const date_1 = require("../../../utils/date");
7
7
  /**
@@ -32,7 +32,7 @@ const useMaskedValue = ({ currentValue, mask, onChangeValue, }) => {
32
32
  }
33
33
  // здесь обрабатывается сценарий, когда в инпут вводится невалидная дата и при этом currentValue становится Invalid Date
34
34
  // в таком случае сравнить даты напрямую не получится
35
- if (!(0, utils_1.isDate)(currentValue) && maskedValue) {
35
+ if (!(0, isDate_1.isDate)(currentValue) && maskedValue) {
36
36
  return;
37
37
  }
38
38
  // проверяем равны ли даты
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useSelectedBaseDate = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const isDate_1 = require("@astral/utils/date/isDate");
5
5
  const react_1 = require("react");
6
6
  const date_1 = require("../../../utils/date");
7
7
  /**
@@ -12,7 +12,7 @@ const date_1 = require("../../../utils/date");
12
12
  const useSelectedBaseDate = ({ currentValue, minDate, maxDate, }) => {
13
13
  const [baseDate, setBaseDate] = (0, react_1.useState)(currentValue);
14
14
  (0, react_1.useEffect)(() => {
15
- if (!(0, utils_1.isDate)(currentValue)) {
15
+ if (!(0, isDate_1.isDate)(currentValue)) {
16
16
  setBaseDate(null);
17
17
  return;
18
18
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useBaseRangeDates = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const addMonths_1 = require("@astral/utils/date/addMonths");
5
5
  const react_1 = require("react");
6
6
  const hooks_1 = require("../../../../DatePicker/hooks");
7
7
  /**
@@ -12,7 +12,7 @@ const useBaseRangeDates = ({ minDate, maxDate, shouldReturnPrevValues, selectedS
12
12
  const [endBaseDate, setEndBaseDate] = (0, react_1.useState)();
13
13
  const startBaseInitial = (0, react_1.useMemo)(() => {
14
14
  if (!selectedStartDate && selectedEndDate) {
15
- return (0, utils_1.addMonths)(selectedEndDate, -monthOffset);
15
+ return (0, addMonths_1.addMonths)(selectedEndDate, -monthOffset);
16
16
  }
17
17
  return selectedStartDate;
18
18
  }, [monthOffset, selectedEndDate, selectedStartDate]);
@@ -20,7 +20,7 @@ const useBaseRangeDates = ({ minDate, maxDate, shouldReturnPrevValues, selectedS
20
20
  if (!selectedStartDate && selectedEndDate) {
21
21
  return selectedEndDate;
22
22
  }
23
- return (0, utils_1.addMonths)(selectedStartDate || new Date(), monthOffset);
23
+ return (0, addMonths_1.addMonths)(selectedStartDate || new Date(), monthOffset);
24
24
  }, [monthOffset, selectedEndDate, selectedStartDate]);
25
25
  const startBaseDateCandidate = (0, hooks_1.useBaseDateInRange)({
26
26
  minDate,
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getBoundaryDate = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const addDays_1 = require("@astral/utils/date/addDays");
5
+ const isDate_1 = require("@astral/utils/date/isDate");
5
6
  /**
6
7
  * Утилита проверки целевой даты.
7
8
  * Если целевая дата в наличии, то возвращается дата со смещением равным offset.
8
9
  * Если целевая дата отсутствует, то вернется reserve дата.
9
10
  */
10
11
  const getBoundaryDate = ({ reserve, target, offset = 0, }) => {
11
- if ((0, utils_1.isDate)(target)) {
12
- return (0, utils_1.addDays)(target, offset);
12
+ if ((0, isDate_1.isDate)(target)) {
13
+ return (0, addDays_1.addDays)(target, offset);
13
14
  }
14
15
  return reserve;
15
16
  };
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const checkProbablyEmail_1 = require("@astral/utils/email/checkProbablyEmail");
5
+ const checkPhone_1 = require("@astral/utils/phone/checkPhone");
6
+ const formatPhoneToView_1 = require("@astral/utils/phone/formatPhoneToView");
7
+ const normalizePhone_1 = require("@astral/utils/phone/normalizePhone");
5
8
  const useLogic = (props) => {
6
9
  const { onBlur, onChange, value, inputProps, isHidePersonalData, ...restProps } = props;
7
10
  const getFieldType = (targetValue) => {
8
- if ((0, utils_1.checkProbablyEmail)(targetValue)) {
11
+ if ((0, checkProbablyEmail_1.checkProbablyEmail)(targetValue)) {
9
12
  return 'email';
10
13
  }
11
- const normalizedValue = (0, utils_1.normalizePhone)(targetValue);
12
- if ((0, utils_1.checkPhone)(normalizedValue)) {
14
+ const normalizedValue = (0, normalizePhone_1.normalizePhone)(targetValue);
15
+ if ((0, checkPhone_1.checkPhone)(normalizedValue)) {
13
16
  return 'phone';
14
17
  }
15
18
  return 'unknown';
@@ -19,7 +22,7 @@ const useLogic = (props) => {
19
22
  const type = getFieldType(targetValue);
20
23
  onChange?.({
21
24
  value: targetValue,
22
- normalizedValue: type === 'phone' ? (0, utils_1.normalizePhone)(targetValue) : targetValue,
25
+ normalizedValue: type === 'phone' ? (0, normalizePhone_1.normalizePhone)(targetValue) : targetValue,
23
26
  type,
24
27
  });
25
28
  };
@@ -27,8 +30,8 @@ const useLogic = (props) => {
27
30
  const targetValue = event.target.value;
28
31
  const type = getFieldType(targetValue);
29
32
  if (type === 'phone') {
30
- const normalizedValue = (0, utils_1.normalizePhone)(targetValue);
31
- const formattedValue = (0, utils_1.formatPhoneToView)(normalizedValue) || '';
33
+ const normalizedValue = (0, normalizePhone_1.normalizePhone)(targetValue);
34
+ const formattedValue = (0, formatPhoneToView_1.formatPhoneToView)(normalizedValue) || '';
32
35
  onChange?.({
33
36
  value: formattedValue,
34
37
  normalizedValue,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useOverflowed = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const debounce_1 = require("@astral/utils/debounce");
5
5
  const react_1 = require("react");
6
6
  const hooks_1 = require("../../../hooks");
7
7
  const useOverflowed = (forwardedRef, hasMultipleRows = false, hasVisibleLastSymbols = false) => {
@@ -38,7 +38,7 @@ const useOverflowed = (forwardedRef, hasMultipleRows = false, hasVisibleLastSymb
38
38
  checkOverflow([resizeEntry]);
39
39
  }
40
40
  else {
41
- resizeObserver = new ResizeObserver((0, utils_1.debounce)(checkOverflow, 500));
41
+ resizeObserver = new ResizeObserver((0, debounce_1.debounce)(checkOverflow, 500));
42
42
  resizeObserver.observe(node);
43
43
  }
44
44
  //функция очистки должна обязательно возвращаться в теле хука, иначе она не вызывается
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeEdgeDates = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const addDays_1 = require("@astral/utils/date/addDays");
5
5
  const constants_1 = require("../../../../../constants");
6
6
  const date_1 = require("../../../../../utils/date");
7
7
  /**
@@ -22,8 +22,8 @@ const makeEdgeDates = (baseDate, isMondayFirst) => {
22
22
  ? constants_1.DAYS_IN_WEEK - 1
23
23
  : weekBaseDate + firstDayCompensate - 1;
24
24
  const addDayCount = offset * -1;
25
- const startDate = (0, utils_1.addDays)(optimizedBaseDate, addDayCount);
26
- const endDate = (0, utils_1.addDays)(startDate, date_1.DAYS_CALENDAR_ITEMS_COUNT - 1);
25
+ const startDate = (0, addDays_1.addDays)(optimizedBaseDate, addDayCount);
26
+ const endDate = (0, addDays_1.addDays)(startDate, date_1.DAYS_CALENDAR_ITEMS_COUNT - 1);
27
27
  return {
28
28
  startDate,
29
29
  endDate,
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.optimizeRangeDates = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const addDays_1 = require("@astral/utils/date/addDays");
5
5
  const makeEdgeDates_1 = require("../makeEdgeDates");
6
6
  const getFromAccumulator = (date, accumulator) => {
7
7
  const key = date.toISOString();
@@ -29,8 +29,8 @@ const optimizeRangeDates = ({ baseDate, dateA, dateB, isMondayFirst, accumulator
29
29
  return { dateA: null, dateB: null };
30
30
  }
31
31
  const { startDate, endDate } = (0, makeEdgeDates_1.makeEdgeDates)(baseDate, isMondayFirst);
32
- const beforeStart = getFromAccumulator((0, utils_1.addDays)(startDate, -1), accumulator);
33
- const afterEnd = getFromAccumulator((0, utils_1.addDays)(endDate, 1), accumulator);
32
+ const beforeStart = getFromAccumulator((0, addDays_1.addDays)(startDate, -1), accumulator);
33
+ const afterEnd = getFromAccumulator((0, addDays_1.addDays)(endDate, 1), accumulator);
34
34
  if (dateA && dateB) {
35
35
  const isALessThanStart = dateA < startDate;
36
36
  const isBLessThanStart = dateB < startDate;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FileInfo = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const utils_1 = require("@astral/utils");
5
+ const formatFileSizeToView_1 = require("@astral/utils/file/formatFileSizeToView");
6
6
  const styles_1 = require("./styles");
7
7
  const FileInfo = ({ className, fileName, fileSize }) => {
8
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, children: [(0, jsx_runtime_1.jsx)(styles_1.StyledFilename, { children: fileName }), fileSize && ((0, jsx_runtime_1.jsxs)(styles_1.FileSize, { children: [(0, jsx_runtime_1.jsx)(styles_1.DotIcon, {}), (0, utils_1.formatFileSizeToView)(fileSize)] }))] }));
8
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, children: [(0, jsx_runtime_1.jsx)(styles_1.StyledFilename, { children: fileName }), fileSize && ((0, jsx_runtime_1.jsxs)(styles_1.FileSize, { children: [(0, jsx_runtime_1.jsx)(styles_1.DotIcon, {}), (0, formatFileSizeToView_1.formatFileSizeToView)(fileSize)] }))] }));
9
9
  };
10
10
  exports.FileInfo = FileInfo;
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HintPlaceholder = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const utils_1 = require("@astral/utils");
5
+ const formatFileSizeToView_1 = require("@astral/utils/file/formatFileSizeToView");
6
6
  const Typography_1 = require("../../../Typography");
7
- const utils_2 = require("../../utils");
7
+ const utils_1 = require("../../utils");
8
8
  const styles_1 = require("./styles");
9
9
  const useLogic_1 = require("./useLogic");
10
10
  const HintPlaceholder = (props) => {
@@ -13,8 +13,8 @@ const HintPlaceholder = (props) => {
13
13
  return ((0, jsx_runtime_1.jsx)(Typography_1.Typography, { className: className, color: "grey", colorIntensity: "600", variant: "caption", align: "center", children: placeholder }));
14
14
  }
15
15
  if (isMultiple) {
16
- return ((0, jsx_runtime_1.jsxs)(Typography_1.Typography, { className: className, color: "grey", colorIntensity: "600", variant: "caption", align: "center", children: ["\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B. \u041D\u0435 \u0431\u043E\u043B\u0435\u0435 ", maxFileCount, ' ', (0, utils_2.declensionFile)(maxFileCount), " \u0440\u0430\u0437\u043C\u0435\u0440\u043E\u043C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435", ' ', (0, utils_1.formatFileSizeToView)(maxFileSize), extensions && ' в формате ', (0, jsx_runtime_1.jsx)(styles_1.Extensions, { children: extensions })] }));
16
+ return ((0, jsx_runtime_1.jsxs)(Typography_1.Typography, { className: className, color: "grey", colorIntensity: "600", variant: "caption", align: "center", children: ["\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u044B. \u041D\u0435 \u0431\u043E\u043B\u0435\u0435 ", maxFileCount, ' ', (0, utils_1.declensionFile)(maxFileCount), " \u0440\u0430\u0437\u043C\u0435\u0440\u043E\u043C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435", ' ', (0, formatFileSizeToView_1.formatFileSizeToView)(maxFileSize), extensions && ' в формате ', (0, jsx_runtime_1.jsx)(styles_1.Extensions, { children: extensions })] }));
17
17
  }
18
- return ((0, jsx_runtime_1.jsxs)(Typography_1.Typography, { className: className, color: "grey", colorIntensity: "600", variant: "caption", align: "center", children: ["\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0444\u0430\u0439\u043B. \u0420\u0430\u0437\u043C\u0435\u0440\u043E\u043C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435", ' ', (0, utils_1.formatFileSizeToView)(maxFileSize), extensions && ' в формате ', (0, jsx_runtime_1.jsx)(styles_1.Extensions, { children: extensions })] }));
18
+ return ((0, jsx_runtime_1.jsxs)(Typography_1.Typography, { className: className, color: "grey", colorIntensity: "600", variant: "caption", align: "center", children: ["\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0444\u0430\u0439\u043B. \u0420\u0430\u0437\u043C\u0435\u0440\u043E\u043C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435", ' ', (0, formatFileSizeToView_1.formatFileSizeToView)(maxFileSize), extensions && ' в формате ', (0, jsx_runtime_1.jsx)(styles_1.Extensions, { children: extensions })] }));
19
19
  };
20
20
  exports.HintPlaceholder = HintPlaceholder;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const formatFileTypeToView_1 = require("@astral/utils/file/formatFileTypeToView");
5
5
  const useLogic = ({ accept, ...restProps }) => {
6
- const extensions = accept.map(utils_1.formatFileTypeToView).join(', ');
6
+ const extensions = accept.map(formatFileTypeToView_1.formatFileTypeToView).join(', ');
7
7
  return { extensions, ...restProps };
8
8
  };
9
9
  exports.useLogic = useLogic;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const getFileExtension_1 = require("@astral/utils/file/getFileExtension");
5
5
  const react_1 = require("react");
6
6
  const ConfigProvider_1 = require("../../../../ConfigProvider");
7
7
  const constants_1 = require("../../../constants");
8
8
  const hooks_1 = require("../../../hooks");
9
- const utils_2 = require("../../../utils");
9
+ const utils_1 = require("../../../utils");
10
10
  const useLogic = ({ fileId, file, fileUrl, isUploadError, generateDownloadLink, onDelete, onRetry, onView, setErrorStatusFile, selfFiles, isLoading, isError, fileName, }) => {
11
11
  const { captureException } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
12
12
  const { generateUrl } = (0, hooks_1.useGenerateLocalFileURL)();
@@ -45,11 +45,11 @@ const useLogic = ({ fileId, file, fileUrl, isUploadError, generateDownloadLink,
45
45
  if (onView) {
46
46
  return { isShowViewButton: true, onClick: handleView };
47
47
  }
48
- const extension = file && (0, utils_1.getFileExtension)(file?.type);
48
+ const extension = file && (0, getFileExtension_1.getFileExtension)(file?.type);
49
49
  if (checkIsAcceptedExtension(extension)) {
50
50
  return {
51
51
  isShowViewButton: true,
52
- ...(0, utils_2.generateAttrLinkNewTab)(downloadLink),
52
+ ...(0, utils_1.generateAttrLinkNewTab)(downloadLink),
53
53
  };
54
54
  }
55
55
  return {
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HintPlaceholder = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const utils_1 = require("@astral/utils");
5
+ const formatFileSizeToView_1 = require("@astral/utils/file/formatFileSizeToView");
6
6
  const Typography_1 = require("../../../Typography");
7
7
  const styles_1 = require("./styles");
8
8
  const useLogic_1 = require("./useLogic");
9
9
  const HintPlaceholder = (props) => {
10
10
  const { extensions, imageProps, maxFileSize, placeholder, className, RenderImage, } = (0, useLogic_1.useLogic)(props);
11
- return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, children: [(0, jsx_runtime_1.jsx)(RenderImage, { ...imageProps, alt: "\u0424\u0430\u0439\u043B\u044B \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438" }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, { component: "p", color: "textSecondary", variant: "caption", align: "center", children: placeholder || ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0444\u0430\u0439\u043B. \u0420\u0430\u0437\u043C\u0435\u0440\u043E\u043C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435", ' ', (0, utils_1.formatFileSizeToView)(maxFileSize), extensions && ' в формате ', (0, jsx_runtime_1.jsx)(styles_1.Extensions, { children: extensions })] })) })] }));
11
+ return ((0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { className: className, children: [(0, jsx_runtime_1.jsx)(RenderImage, { ...imageProps, alt: "\u0424\u0430\u0439\u043B\u044B \u0434\u043B\u044F \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438" }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, { component: "p", color: "textSecondary", variant: "caption", align: "center", children: placeholder || ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u041F\u0435\u0440\u0435\u0442\u0430\u0449\u0438\u0442\u0435 \u0438\u043B\u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u0435 \u0444\u0430\u0439\u043B. \u0420\u0430\u0437\u043C\u0435\u0440\u043E\u043C \u043D\u0435 \u0431\u043E\u043B\u0435\u0435", ' ', (0, formatFileSizeToView_1.formatFileSizeToView)(maxFileSize), extensions && ' в формате ', (0, jsx_runtime_1.jsx)(styles_1.Extensions, { children: extensions })] })) })] }));
12
12
  };
13
13
  exports.HintPlaceholder = HintPlaceholder;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const formatFileTypeToView_1 = require("@astral/utils/file/formatFileTypeToView");
5
5
  const react_1 = require("react");
6
6
  const ConfigProvider_1 = require("../../../../ConfigProvider");
7
7
  const styles_1 = require("../styles");
@@ -10,7 +10,7 @@ const useLogic = ({ accept, placeholderImgSrc, ...rest }) => {
10
10
  const { uploadFileImgSrc } = imagesMap;
11
11
  const configRenderImage = components?.placeholder?.defaultProps?.renderImage;
12
12
  const RenderImage = (0, react_1.useMemo)(() => configRenderImage ? (0, styles_1.setDefaultImageStyles)(configRenderImage) : styles_1.Image, [configRenderImage]);
13
- const extensions = accept?.map(utils_1.formatFileTypeToView).join(', ');
13
+ const extensions = accept?.map(formatFileTypeToView_1.formatFileTypeToView).join(', ');
14
14
  return {
15
15
  RenderImage,
16
16
  extensions,
@@ -1,16 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useLogic = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const getFileExtension_1 = require("@astral/utils/file/getFileExtension");
5
5
  const react_1 = require("react");
6
6
  const ConfigProvider_1 = require("../../../../ConfigProvider");
7
7
  const constants_1 = require("../../../constants");
8
8
  const hooks_1 = require("../../../hooks");
9
- const utils_2 = require("../../../utils");
9
+ const utils_1 = require("../../../utils");
10
10
  const useLogic = ({ fileId, file, fileUrl, generateDownloadLink, onDelete, onView, fileType, }) => {
11
11
  const { captureException } = (0, react_1.useContext)(ConfigProvider_1.ConfigContext);
12
12
  const { generateUrl } = (0, hooks_1.useGenerateLocalFileURL)();
13
- const extensionFile = (0, utils_1.getFileExtension)((file?.type || fileType));
13
+ const extensionFile = (0, getFileExtension_1.getFileExtension)((file?.type || fileType));
14
14
  const isPdfFile = Object.is(extensionFile, 'pdf');
15
15
  const isImageFile = fileType.includes('image/');
16
16
  const isOtherFile = !isImageFile && !isPdfFile;
@@ -42,9 +42,9 @@ const useLogic = ({ fileId, file, fileUrl, generateDownloadLink, onDelete, onVie
42
42
  if (onView) {
43
43
  return { onClick: handleView };
44
44
  }
45
- const extension = (0, utils_1.getFileExtension)((file?.type || fileType));
45
+ const extension = (0, getFileExtension_1.getFileExtension)((file?.type || fileType));
46
46
  if (checkIsAcceptedExtension(extension)) {
47
- return (0, utils_2.generateAttrLinkNewTab)(downloadLink);
47
+ return (0, utils_1.generateAttrLinkNewTab)(downloadLink);
48
48
  }
49
49
  return {
50
50
  onClick: () => {
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useFileUploader = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const declensionOfWords_1 = require("@astral/utils/declension/declensionOfWords");
5
+ const formatFileSizeToView_1 = require("@astral/utils/file/formatFileSizeToView");
5
6
  const react_1 = require("react");
6
7
  const useGenerateLocalId_1 = require("../../../hooks/useGenerateLocalId");
7
8
  const useId_1 = require("../../../hooks/useId");
8
9
  const constants_1 = require("../../constants");
9
10
  const restrictions_1 = require("../../restrictions");
10
- const utils_2 = require("../../utils");
11
+ const utils_1 = require("../../utils");
11
12
  const useDnD_1 = require("../useDnD");
12
13
  const useUploadFiles_1 = require("../useUploadFiles");
13
14
  const useFileUploader = ({ value, isDisabled, isMultiple, accept, restrictions = [], maxFileSize, maxFileCount = 1, // для случая, когда isMultiple=false
@@ -15,16 +16,16 @@ inputRef, notify, onChange, onUploadFile, name, isError, onView, generateDownloa
15
16
  const inputId = (0, useId_1.useId)();
16
17
  const { generateId } = (0, useGenerateLocalId_1.useGenerateLocalId)();
17
18
  // Преобразуем value к массиву
18
- const files = (0, react_1.useMemo)(() => (0, utils_2.toArray)(value), [value]);
19
+ const files = (0, react_1.useMemo)(() => (0, utils_1.toArray)(value), [value]);
19
20
  // true, если достигли лимита по кол-ву файлов при isMultiple=true
20
21
  const isLimitMaxFileCount = isMultiple ? files.length >= maxFileCount : false;
21
22
  const isVisibleAddFile = isMultiple ? !isLimitMaxFileCount : !files.length;
22
23
  const isVisibleFileList = Boolean(files.length);
23
24
  const restrict = (file) => {
24
- return (0, utils_2.rulePipe)((0, restrictions_1.restrictFileMaxSize)(utils_1.formatFileSizeToView, maxFileSize), (0, restrictions_1.restrictFileType)(accept), ...restrictions)(file);
25
+ return (0, utils_1.rulePipe)((0, restrictions_1.restrictFileMaxSize)(formatFileSizeToView_1.formatFileSizeToView, maxFileSize), (0, restrictions_1.restrictFileType)(accept), ...restrictions)(file);
25
26
  };
26
- const declensionFile = (0, utils_1.declensionOfWords)(['файл', 'файла', 'файлов']);
27
- const declensionAdded = (0, utils_1.declensionOfWords)([
27
+ const declensionFile = (0, declensionOfWords_1.declensionOfWords)(['файл', 'файла', 'файлов']);
28
+ const declensionAdded = (0, declensionOfWords_1.declensionOfWords)([
28
29
  'Добавлен',
29
30
  'Добавлено',
30
31
  'Добавлено',
@@ -56,7 +57,7 @@ inputRef, notify, onChange, onUploadFile, name, isError, onView, generateDownloa
56
57
  });
57
58
  const handleChange = (event) => {
58
59
  // Преобразуем к массиву и удаляем дубликаты
59
- const droppedFiles = Array.from(event.target.files || []).filter((droppedFile) => !files.find((file) => (0, utils_2.compareFile)(droppedFile, file)));
60
+ const droppedFiles = Array.from(event.target.files || []).filter((droppedFile) => !files.find((file) => (0, utils_1.compareFile)(droppedFile, file)));
60
61
  const addedFiles = droppedFiles
61
62
  .slice(0, maxFileCount - files.length)
62
63
  .reduce((acc, droppedFile) => {
@@ -1,27 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.usePreviewFileUploader = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const declensionOfWords_1 = require("@astral/utils/declension/declensionOfWords");
5
+ const formatFileSizeToView_1 = require("@astral/utils/file/formatFileSizeToView");
5
6
  const react_1 = require("react");
6
7
  const useGenerateLocalId_1 = require("../../../hooks/useGenerateLocalId");
7
8
  const useId_1 = require("../../../hooks/useId");
8
9
  const constants_1 = require("../../constants");
9
10
  const restrictions_1 = require("../../restrictions");
10
- const utils_2 = require("../../utils");
11
+ const utils_1 = require("../../utils");
11
12
  const useDnD_1 = require("../useDnD");
12
13
  const useUploadFiles_1 = require("../useUploadFiles");
13
14
  const usePreviewFileUploader = ({ value, isDisabled, accept, restrictions = [], maxFileSize, inputRef, notify, onChange, onUploadFile, label, isError, generateDownloadLink, onView, name, helperText, className, placeholder, placeholderImgSrc, isHidePersonalData, PdfViewer, }) => {
14
15
  const inputId = (0, useId_1.useId)();
15
16
  const { generateId } = (0, useGenerateLocalId_1.useGenerateLocalId)();
16
17
  // Преобразуем value к массиву
17
- const files = (0, react_1.useMemo)(() => (0, utils_2.toArray)(value), [value]);
18
+ const files = (0, react_1.useMemo)(() => (0, utils_1.toArray)(value), [value]);
18
19
  const isVisibleAddFile = !files.length;
19
20
  const isVisibleFileList = Boolean(files.length);
20
21
  const restrict = (file) => {
21
- return (0, utils_2.rulePipe)((0, restrictions_1.restrictFileMaxSize)(utils_1.formatFileSizeToView, maxFileSize), ...(accept ? [(0, restrictions_1.restrictFileType)(accept)] : []), ...restrictions)(file);
22
+ return (0, utils_1.rulePipe)((0, restrictions_1.restrictFileMaxSize)(formatFileSizeToView_1.formatFileSizeToView, maxFileSize), ...(accept ? [(0, restrictions_1.restrictFileType)(accept)] : []), ...restrictions)(file);
22
23
  };
23
- const declensionFile = (0, utils_1.declensionOfWords)(['файл', 'файла', 'файлов']);
24
- const declensionAdded = (0, utils_1.declensionOfWords)([
24
+ const declensionFile = (0, declensionOfWords_1.declensionOfWords)(['файл', 'файла', 'файлов']);
25
+ const declensionAdded = (0, declensionOfWords_1.declensionOfWords)([
25
26
  'Добавлен',
26
27
  'Добавлено',
27
28
  'Добавлено',
@@ -48,7 +49,7 @@ const usePreviewFileUploader = ({ value, isDisabled, accept, restrictions = [],
48
49
  });
49
50
  const handleChange = (event) => {
50
51
  // Преобразуем к массиву и удаляем дубликаты
51
- const droppedFiles = Array.from(event.target.files || []).filter((droppedFile) => !files.find((file) => (0, utils_2.compareFile)(droppedFile, file)));
52
+ const droppedFiles = Array.from(event.target.files || []).filter((droppedFile) => !files.find((file) => (0, utils_1.compareFile)(droppedFile, file)));
52
53
  const addedFiles = droppedFiles
53
54
  .slice(0, 1 - files.length)
54
55
  .reduce((acc, droppedFile) => {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.restrictFileType = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const getFileType_1 = require("@astral/utils/file/getFileType");
5
5
  const constants_1 = require("./constants");
6
- const utils_2 = require("./utils");
6
+ const utils_1 = require("./utils");
7
7
  const getGeneralType = (type) => type.split('/')[0];
8
8
  const compareFileType = (fileTypeA, fileTypeB) => {
9
- if (Object.is((0, utils_2.prepareType)(fileTypeA), (0, utils_2.prepareType)(fileTypeB))) {
9
+ if (Object.is((0, utils_1.prepareType)(fileTypeA), (0, utils_1.prepareType)(fileTypeB))) {
10
10
  return true;
11
11
  }
12
12
  const isGeneralType = /^[\w.-]+\/\*$/.test(fileTypeA);
@@ -50,9 +50,9 @@ const restrictFileType = (accept) => (file) => {
50
50
  if (acceptType.includes('/')) {
51
51
  return acceptType;
52
52
  }
53
- return (0, utils_1.getFileType)(acceptType) || acceptType;
53
+ return (0, getFileType_1.getFileType)(acceptType) || acceptType;
54
54
  });
55
- const fileType = (0, utils_2.getFileTypeFromFile)(file);
55
+ const fileType = (0, utils_1.getFileTypeFromFile)(file);
56
56
  const isValid = acceptedTypes.some((acceptedType) => {
57
57
  return compareFileType(acceptedType, fileType);
58
58
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFileTypeFromName = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const getFileType_1 = require("@astral/utils/file/getFileType");
5
5
  /**
6
6
  * Возвращает формат файла из названия файла
7
7
  */
@@ -12,6 +12,6 @@ const getFileTypeFromName = (filename) => {
12
12
  }
13
13
  // Берём всё после последней точки
14
14
  const extension = filename.slice(lastDotIndex + 1);
15
- return (0, utils_1.getFileType)(extension) || extension;
15
+ return (0, getFileType_1.getFileType)(extension) || extension;
16
16
  };
17
17
  exports.getFileTypeFromName = getFileTypeFromName;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.declensionFile = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const declensionOfWords_1 = require("@astral/utils/declension/declensionOfWords");
5
5
  // cSpell:ignore файлa
6
6
  // Записываем в родительском падеже
7
- exports.declensionFile = (0, utils_1.declensionOfWords)(['файлa', 'файлов', 'файлов']);
7
+ exports.declensionFile = (0, declensionOfWords_1.declensionOfWords)(['файлa', 'файлов', 'файлов']);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useAsyncOptions = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const debounce_1 = require("@astral/utils/debounce");
5
5
  const react_1 = require("react");
6
6
  const hooks_1 = require("../../hooks");
7
7
  /**
@@ -20,7 +20,7 @@ const useAsyncOptions = ({ fetchOptions, fetchDelayMs, minSymbolsToFetch, onData
20
20
  const optionsAdapter = (0, react_1.useCallback)((response) => {
21
21
  return Array.isArray(response) ? { options: response } : response;
22
22
  }, []);
23
- const debouncedFetchOptions = (0, react_1.useCallback)((0, utils_1.debounce)((search) => {
23
+ const debouncedFetchOptions = (0, react_1.useCallback)((0, debounce_1.debounce)((search) => {
24
24
  abortControllerRef.current?.abort();
25
25
  const controller = new AbortController();
26
26
  abortControllerRef.current = controller;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InternalErrorPlaceholder = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const utils_1 = require("@astral/utils");
5
+ const formatPhoneToView_1 = require("@astral/utils/phone/formatPhoneToView");
6
6
  const material_1 = require("@mui/material");
7
7
  const react_1 = require("react");
8
8
  const Button_1 = require("../../Button");
@@ -14,6 +14,6 @@ const InternalErrorPlaceholder = () => {
14
14
  const handleClickRefresh = () => {
15
15
  location.reload();
16
16
  };
17
- return ((0, jsx_runtime_1.jsx)(Placeholder_1.Placeholder, { title: "\u041F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u0430 \u043D\u0435\u043F\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430", description: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, { children: "\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0438\u043B\u0438 \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u0432 \u0442\u0435\u0445\u043D\u0438\u0447\u0435\u0441\u043A\u0443\u044E \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443:" }), (0, jsx_runtime_1.jsxs)(Typography_1.Typography, { children: ["email\u00A0", (0, jsx_runtime_1.jsx)(material_1.Link, { href: `mailto:${techSup.email}`, children: techSup.email }), ", \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u00A0", (0, jsx_runtime_1.jsx)(material_1.Link, { href: `tel:${techSup.phone}`, children: (0, utils_1.formatPhoneToView)(techSup.phone) })] })] }), imgAlt: "\u041D\u0435\u043F\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430", imgSrc: imagesMap.defaultErrorImgSrc, size: "medium", Actions: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: handleClickRefresh, children: "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443" }) }));
17
+ return ((0, jsx_runtime_1.jsx)(Placeholder_1.Placeholder, { title: "\u041F\u0440\u043E\u0438\u0437\u043E\u0448\u043B\u0430 \u043D\u0435\u043F\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430", description: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, { children: "\u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 \u0438\u043B\u0438 \u043E\u0431\u0440\u0430\u0442\u0438\u0442\u0435\u0441\u044C \u0432 \u0442\u0435\u0445\u043D\u0438\u0447\u0435\u0441\u043A\u0443\u044E \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u0443:" }), (0, jsx_runtime_1.jsxs)(Typography_1.Typography, { children: ["email\u00A0", (0, jsx_runtime_1.jsx)(material_1.Link, { href: `mailto:${techSup.email}`, children: techSup.email }), ", \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u00A0", (0, jsx_runtime_1.jsx)(material_1.Link, { href: `tel:${techSup.phone}`, children: (0, formatPhoneToView_1.formatPhoneToView)(techSup.phone) })] })] }), imgAlt: "\u041D\u0435\u043F\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043D\u043D\u0430\u044F \u043E\u0448\u0438\u0431\u043A\u0430", imgSrc: imagesMap.defaultErrorImgSrc, size: "medium", Actions: (0, jsx_runtime_1.jsx)(Button_1.Button, { onClick: handleClickRefresh, children: "\u041E\u0431\u043D\u043E\u0432\u0438\u0442\u044C \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443" }) }));
18
18
  };
19
19
  exports.InternalErrorPlaceholder = InternalErrorPlaceholder;
@@ -37,6 +37,8 @@ exports.MuiAutocomplete = {
37
37
  alignItems: 'center',
38
38
  justifyContent: 'flex-end',
39
39
  color: theme.palette.grey[800],
40
+ transform: 'unset',
41
+ top: 'unset',
40
42
  right: '8px !important',
41
43
  flexGrow: 1,
42
44
  '.MuiButtonBase-root': {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.areDatesSame = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const isDate_1 = require("@astral/utils/date/isDate");
5
5
  /**
6
6
  * утилита для сверки совпадения дат, или их отсутствия
7
7
  */
8
- const areDatesSame = (a, b) => ((0, utils_1.isDate)(a) && (0, utils_1.isDate)(b) && Number(a) === Number(b)) || a === b;
8
+ const areDatesSame = (a, b) => ((0, isDate_1.isDate)(a) && (0, isDate_1.isDate)(b) && Number(a) === Number(b)) || a === b;
9
9
  exports.areDatesSame = areDatesSame;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildDaysCalendarGrid = exports.DAYS_CALENDAR_ITEMS_COUNT = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const isDate_1 = require("@astral/utils/date/isDate");
5
5
  const constants_1 = require("../../../constants");
6
6
  const buildIsoDate_1 = require("../buildIsoDate");
7
7
  const checkIsDateInRange_1 = require("../checkIsDateInRange");
@@ -56,7 +56,7 @@ const buildDaysCalendarGrid = ({ minDate, maxDate, selectedDate, selectedRanges,
56
56
  ...productionCalendarDay,
57
57
  isOutOfAvailableRange: dateMonth !== month,
58
58
  index,
59
- isSelected: (((0, utils_1.isDate)(selectedDate) &&
59
+ isSelected: (((0, isDate_1.isDate)(selectedDate) &&
60
60
  (0, compareDateDayByUTC_1.compareDateDayByUTC)(selectedDate, date)) ||
61
61
  selectedRanges?.some(({ dateA, dateB }) => (0, compareDateDayByUTC_1.compareDateDayByUTC)(dateA, date) ||
62
62
  (0, compareDateDayByUTC_1.compareDateDayByUTC)(dateB, date))) ??
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildIsoDateString = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const zeroPad_1 = require("@astral/utils/zeroPad");
5
5
  /**
6
6
  * утилита генерирующая строковую дату в формате ISO
7
7
  */
8
8
  const buildIsoDateString = ({ year, month = 1, day = 1, hour = 0, minute = 0, second = 0, }) => {
9
- const YYYY = (0, utils_1.zeroPad)(year, 4);
10
- const MM = (0, utils_1.zeroPad)(month, 2);
11
- const DD = (0, utils_1.zeroPad)(day, 2);
12
- const HH = (0, utils_1.zeroPad)(hour, 2);
13
- const mm = (0, utils_1.zeroPad)(minute, 2);
14
- const ss = (0, utils_1.zeroPad)(second, 2);
9
+ const YYYY = (0, zeroPad_1.zeroPad)(year, 4);
10
+ const MM = (0, zeroPad_1.zeroPad)(month, 2);
11
+ const DD = (0, zeroPad_1.zeroPad)(day, 2);
12
+ const HH = (0, zeroPad_1.zeroPad)(hour, 2);
13
+ const mm = (0, zeroPad_1.zeroPad)(minute, 2);
14
+ const ss = (0, zeroPad_1.zeroPad)(second, 2);
15
15
  return `${YYYY}-${MM}-${DD}T${HH}:${mm}:${ss}.000Z`;
16
16
  };
17
17
  exports.buildIsoDateString = buildIsoDateString;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkIsDateInRange = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const isDate_1 = require("@astral/utils/date/isDate");
5
5
  const date_1 = require("../../../utils/date");
6
6
  /**
7
7
  * утилита проверки даты на то, что она попадает в указанный диапазон
8
8
  */
9
- const checkIsDateInRange = ({ dateA, dateB, date, deep, }) => (0, utils_1.isDate)(dateA) &&
10
- (0, utils_1.isDate)(dateB) &&
9
+ const checkIsDateInRange = ({ dateA, dateB, date, deep, }) => (0, isDate_1.isDate)(dateA) &&
10
+ (0, isDate_1.isDate)(dateB) &&
11
11
  !(0, date_1.isDateOutOfRange)({ date, dateA: dateA, dateB: dateB, deep });
12
12
  exports.checkIsDateInRange = checkIsDateInRange;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatDate = void 0;
4
- const utils_1 = require("@astral/utils");
4
+ const zeroPad_1 = require("@astral/utils/zeroPad");
5
5
  const maskDate_1 = require("../maskDate");
6
6
  const elementsMap = {
7
7
  [maskDate_1.DateMaskElements.Day]: (date) => date.getUTCDate(),
@@ -18,6 +18,6 @@ const formatDate = (date, mask, separator = '.') => mask
18
18
  .split(separator)
19
19
  .map((element) => elementsMap[element]?.(date))
20
20
  .filter(Number.isInteger)
21
- .map((value) => (0, utils_1.zeroPad)(value, 2))
21
+ .map((value) => (0, zeroPad_1.zeroPad)(value, 2))
22
22
  .join(separator);
23
23
  exports.formatDate = formatDate;
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.18.1",
3
+ "version": "4.18.3",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {
7
- "@astral/utils": "^1.17.0",
7
+ "@astral/utils": "^1.18.1",
8
8
  "@emotion/cache": "^11.13.5",
9
9
  "@emotion/react": "^11.13.5",
10
10
  "@emotion/hash": "0.9.2",