@astral/ui 4.51.0 → 4.52.1

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 (89) hide show
  1. package/components/DashboardContext/DashboardContext.d.ts +2 -0
  2. package/components/DashboardContext/DashboardContext.js +2 -0
  3. package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.d.ts +2 -2
  4. package/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +4 -1
  5. package/components/DashboardLayout/DashboardLayout.d.ts +1 -1
  6. package/components/DashboardLayout/DashboardLayout.js +2 -2
  7. package/components/DashboardLayout/Header/Header.js +28 -3
  8. package/components/DashboardLayout/Header/constants.d.ts +5 -1
  9. package/components/DashboardLayout/Header/constants.js +5 -1
  10. package/components/DashboardLayout/Header/styles.d.ts +4 -3
  11. package/components/DashboardLayout/Header/styles.js +66 -24
  12. package/components/DashboardLayout/Header/useLogic/useLogic.d.ts +4 -1
  13. package/components/DashboardLayout/Header/useLogic/useLogic.js +16 -11
  14. package/components/DashboardLayout/types.d.ts +5 -0
  15. package/components/DashboardSidebar/DashboardSidebar.js +17 -2
  16. package/components/DashboardSidebar/constants.d.ts +1 -0
  17. package/components/DashboardSidebar/constants.js +1 -0
  18. package/components/DashboardSidebar/styles.js +1 -1
  19. package/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
  20. package/components/DashboardSidebar/useLogic/useLogic.js +5 -6
  21. package/components/DatePicker/hooks/useDatePickerOptions/useDatePickerOptions.d.ts +2 -0
  22. package/components/DatePicker/hooks/useDatePickerOptions/useDatePickerOptions.js +2 -1
  23. package/components/DatePicker/hooks/useMaskedValue/useMaskedValue.d.ts +4 -0
  24. package/components/DatePicker/hooks/useMaskedValue/useMaskedValue.js +37 -8
  25. package/components/DatePicker/useLogic/useLogic.d.ts +1 -0
  26. package/components/DatePicker/useLogic/useLogic.js +19 -13
  27. package/components/DateRangePicker/useLogic/useLogic.d.ts +2 -0
  28. package/components/DateRangePicker/useLogic/useLogic.js +27 -3
  29. package/components/DateRangePicker/useLogic/utils/index.d.ts +0 -1
  30. package/components/DateRangePicker/useLogic/utils/index.js +0 -1
  31. package/components/MenuOrganization/OrganizationButton/OrganizationButton.js +1 -1
  32. package/components/MenuOrganization/constants.d.ts +1 -0
  33. package/components/MenuOrganization/constants.js +1 -0
  34. package/components/Profile/Profile.js +1 -1
  35. package/components/Profile/constants.d.ts +3 -0
  36. package/components/Profile/constants.js +3 -0
  37. package/components/utils/date/format/index.d.ts +1 -0
  38. package/components/utils/date/format/index.js +1 -0
  39. package/{node/components/DateRangePicker/useLogic/utils → components/utils/date/format}/isMaskedDateSyntacticallyComplete/isMaskedDateSyntacticallyComplete.d.ts +1 -1
  40. package/components/utils/date/format/parseDate/parseDate.d.ts +1 -0
  41. package/components/utils/date/format/parseDate/parseDate.js +42 -13
  42. package/node/components/DashboardContext/DashboardContext.d.ts +2 -0
  43. package/node/components/DashboardContext/DashboardContext.js +2 -0
  44. package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.d.ts +2 -2
  45. package/node/components/DashboardContext/DashboardContextProvider/DashboardContextProvider.js +4 -1
  46. package/node/components/DashboardLayout/DashboardLayout.d.ts +1 -1
  47. package/node/components/DashboardLayout/DashboardLayout.js +2 -2
  48. package/node/components/DashboardLayout/Header/Header.js +27 -2
  49. package/node/components/DashboardLayout/Header/constants.d.ts +5 -1
  50. package/node/components/DashboardLayout/Header/constants.js +5 -1
  51. package/node/components/DashboardLayout/Header/styles.d.ts +4 -3
  52. package/node/components/DashboardLayout/Header/styles.js +74 -32
  53. package/node/components/DashboardLayout/Header/useLogic/useLogic.d.ts +4 -1
  54. package/node/components/DashboardLayout/Header/useLogic/useLogic.js +15 -10
  55. package/node/components/DashboardLayout/types.d.ts +5 -0
  56. package/node/components/DashboardSidebar/DashboardSidebar.js +17 -2
  57. package/node/components/DashboardSidebar/constants.d.ts +1 -0
  58. package/node/components/DashboardSidebar/constants.js +1 -0
  59. package/node/components/DashboardSidebar/styles.js +1 -1
  60. package/node/components/DashboardSidebar/useLogic/useLogic.d.ts +2 -1
  61. package/node/components/DashboardSidebar/useLogic/useLogic.js +4 -5
  62. package/node/components/DatePicker/hooks/useDatePickerOptions/useDatePickerOptions.d.ts +2 -0
  63. package/node/components/DatePicker/hooks/useDatePickerOptions/useDatePickerOptions.js +2 -1
  64. package/node/components/DatePicker/hooks/useMaskedValue/useMaskedValue.d.ts +4 -0
  65. package/node/components/DatePicker/hooks/useMaskedValue/useMaskedValue.js +35 -6
  66. package/node/components/DatePicker/useLogic/useLogic.d.ts +1 -0
  67. package/node/components/DatePicker/useLogic/useLogic.js +19 -13
  68. package/node/components/DateRangePicker/useLogic/useLogic.d.ts +2 -0
  69. package/node/components/DateRangePicker/useLogic/useLogic.js +28 -4
  70. package/node/components/DateRangePicker/useLogic/utils/index.d.ts +0 -1
  71. package/node/components/DateRangePicker/useLogic/utils/index.js +0 -1
  72. package/node/components/MenuOrganization/OrganizationButton/OrganizationButton.js +1 -1
  73. package/node/components/MenuOrganization/constants.d.ts +1 -0
  74. package/node/components/MenuOrganization/constants.js +1 -0
  75. package/node/components/Profile/Profile.js +1 -1
  76. package/node/components/Profile/constants.d.ts +3 -0
  77. package/node/components/Profile/constants.js +3 -0
  78. package/node/components/utils/date/format/index.d.ts +1 -0
  79. package/node/components/utils/date/format/index.js +1 -0
  80. package/{components/DateRangePicker/useLogic/utils → node/components/utils/date/format}/isMaskedDateSyntacticallyComplete/isMaskedDateSyntacticallyComplete.d.ts +1 -1
  81. package/node/components/utils/date/format/parseDate/parseDate.d.ts +1 -0
  82. package/node/components/utils/date/format/parseDate/parseDate.js +45 -13
  83. package/package.json +1 -1
  84. /package/components/{DateRangePicker/useLogic/utils → utils/date/format}/isMaskedDateSyntacticallyComplete/index.d.ts +0 -0
  85. /package/components/{DateRangePicker/useLogic/utils → utils/date/format}/isMaskedDateSyntacticallyComplete/index.js +0 -0
  86. /package/components/{DateRangePicker/useLogic/utils → utils/date/format}/isMaskedDateSyntacticallyComplete/isMaskedDateSyntacticallyComplete.js +0 -0
  87. /package/node/components/{DateRangePicker/useLogic/utils → utils/date/format}/isMaskedDateSyntacticallyComplete/index.d.ts +0 -0
  88. /package/node/components/{DateRangePicker/useLogic/utils → utils/date/format}/isMaskedDateSyntacticallyComplete/index.js +0 -0
  89. /package/node/components/{DateRangePicker/useLogic/utils → utils/date/format}/isMaskedDateSyntacticallyComplete/isMaskedDateSyntacticallyComplete.js +0 -0
@@ -5,6 +5,7 @@ const react_1 = require("react");
5
5
  const DatePicker_1 = require("../../DatePicker");
6
6
  const useForwardedRef_1 = require("../../useForwardedRef");
7
7
  const usePopover_1 = require("../../usePopover");
8
+ const date_1 = require("../../utils/date");
8
9
  const hooks_1 = require("./hooks");
9
10
  const utils_1 = require("./utils");
10
11
  const useLogic = ({ value, minDate = DatePicker_1.DEFAULT_MIN_DATE, maxDate = DatePicker_1.DEFAULT_MAX_DATE, mask = DatePicker_1.DEFAULT_DATE_MASK, onChange, onOpen, onClose, onBlur, }, forwardedRef) => {
@@ -45,7 +46,7 @@ const useLogic = ({ value, minDate = DatePicker_1.DEFAULT_MIN_DATE, maxDate = Da
45
46
  const handleChangeStartDate = (startDateValue, startMaskString) => {
46
47
  const isStartComplete = startDateValue != null &&
47
48
  startMaskString != null &&
48
- (0, utils_1.isMaskedDateSyntacticallyComplete)(startMaskString, mask);
49
+ (0, date_1.isMaskedDateSyntacticallyComplete)(startMaskString, mask);
49
50
  if (isStartComplete &&
50
51
  value?.end &&
51
52
  startDateValue &&
@@ -58,7 +59,7 @@ const useLogic = ({ value, minDate = DatePicker_1.DEFAULT_MIN_DATE, maxDate = Da
58
59
  const handleChangeEndDate = (endDateValue, endMaskString) => {
59
60
  const isEndComplete = endDateValue != null &&
60
61
  endMaskString != null &&
61
- (0, utils_1.isMaskedDateSyntacticallyComplete)(endMaskString, mask);
62
+ (0, date_1.isMaskedDateSyntacticallyComplete)(endMaskString, mask);
62
63
  if (isEndComplete &&
63
64
  value?.start &&
64
65
  endDateValue &&
@@ -68,12 +69,12 @@ const useLogic = ({ value, minDate = DatePicker_1.DEFAULT_MIN_DATE, maxDate = Da
68
69
  }
69
70
  onChange?.({ ...value, end: endDateValue });
70
71
  };
71
- const { maskedValue: startMaskedValue, onMaskedValueChange: onMaskedStartValueChange, onMaskedDateChange: onMaskedStartDateChange, } = (0, DatePicker_1.useMaskedValue)({
72
+ const { maskedValue: startMaskedValue, onMaskedValueChange: onMaskedStartValueChange, onMaskedValueBlur: onMaskedStartValueBlur, onMaskedDateChange: onMaskedStartDateChange, } = (0, DatePicker_1.useMaskedValue)({
72
73
  currentValue: value?.start,
73
74
  mask,
74
75
  onChangeValue: handleChangeStartDate,
75
76
  });
76
- const { maskedValue: endMaskedValue, onMaskedValueChange: onMaskedEndValueChange, onMaskedDateChange: onMaskedEndDateChange, } = (0, DatePicker_1.useMaskedValue)({
77
+ const { maskedValue: endMaskedValue, onMaskedValueChange: onMaskedEndValueChange, onMaskedValueBlur: onMaskedEndValueBlur, onMaskedDateChange: onMaskedEndDateChange, } = (0, DatePicker_1.useMaskedValue)({
77
78
  currentValue: value?.end,
78
79
  mask,
79
80
  onChangeValue: handleChangeEndDate,
@@ -82,11 +83,32 @@ const useLogic = ({ value, minDate = DatePicker_1.DEFAULT_MIN_DATE, maxDate = Da
82
83
  onOpen?.();
83
84
  open(event);
84
85
  };
86
+ const flushActiveMaskedValueOnClose = () => {
87
+ if (activeInput === 'startDate') {
88
+ onMaskedStartValueBlur();
89
+ }
90
+ if (activeInput === 'endDate') {
91
+ onMaskedEndValueBlur();
92
+ }
93
+ };
85
94
  const handleClose = () => {
95
+ flushActiveMaskedValueOnClose();
86
96
  onBlur?.();
87
97
  onClose?.();
88
98
  close();
89
99
  };
100
+ const handleStartInputBlur = () => {
101
+ if (isOpen) {
102
+ return;
103
+ }
104
+ onMaskedStartValueBlur();
105
+ };
106
+ const handleEndInputBlur = () => {
107
+ if (isOpen) {
108
+ return;
109
+ }
110
+ onMaskedEndValueBlur();
111
+ };
90
112
  const handleClickStartInput = (e) => {
91
113
  setActiveInput('startDate');
92
114
  startInputRef.current?.focus();
@@ -141,12 +163,14 @@ const useLogic = ({ value, minDate = DatePicker_1.DEFAULT_MIN_DATE, maxDate = Da
141
163
  ref: startInputRef,
142
164
  value: startMaskedValue,
143
165
  onAccept: handleAcceptStart,
166
+ onBlur: handleStartInputBlur,
144
167
  onClick: handleClickStartInput,
145
168
  },
146
169
  endDatePickerInputProps: {
147
170
  ref: endInputRef,
148
171
  value: endMaskedValue,
149
172
  onAccept: handleAcceptEnd,
173
+ onBlur: handleEndInputBlur,
150
174
  onClick: handleClickEndInput,
151
175
  },
152
176
  popoverHoveredContextProviderProps: {
@@ -1,2 +1 @@
1
1
  export * from './getBoundaryDate';
2
- export * from './isMaskedDateSyntacticallyComplete';
@@ -15,4 +15,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./getBoundaryDate"), exports);
18
- __exportStar(require("./isMaskedDateSyntacticallyComplete"), exports);
@@ -16,7 +16,7 @@ exports.OrganizationButton = (0, react_1.forwardRef)(({ onClick, isOpen, current
16
16
  });
17
17
  const renderButton = () => ((0, jsx_runtime_1.jsx)(styles_2.StyledButton, { ref: ref, variant: "text", disabled: isDisabled, onClick: onClick, className: constants_1.menuOrganizationClassnames.button, endIcon: (0, jsx_runtime_1.jsx)(styles_2.StyledChevron, { isActive: isOpen, width: 24, height: 24 }), children: renderPreview ? (renderPreview(currentOrganization, {
18
18
  className: hidePersonalDataClassname,
19
- })) : ((0, jsx_runtime_1.jsxs)(styles_2.Container, { className: hidePersonalDataClassname, children: [(0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { variant: "h6", component: "div", children: name }), (0, jsx_runtime_1.jsxs)(styles_1.OrganizationData, { children: [(0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u0418\u041D\u041D ", inn] }), kpp && ((0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u041A\u041F\u041F ", kpp] }))] })] })) }));
19
+ })) : ((0, jsx_runtime_1.jsxs)(styles_2.Container, { className: hidePersonalDataClassname, children: [(0, jsx_runtime_1.jsx)(OverflowTypography_1.OverflowTypography, { variant: "h6", component: "div", children: name }), (0, jsx_runtime_1.jsxs)(styles_1.OrganizationData, { className: constants_1.menuOrganizationClassnames.organizationData, children: [(0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u0418\u041D\u041D ", inn] }), kpp && ((0, jsx_runtime_1.jsxs)(styles_2.StyledTypography, { "$isDisabled": isDisabled, variant: "caption", color: "textSecondary", children: ["\u041A\u041F\u041F ", kpp] }))] })] })) }));
20
20
  if (isDisabled && disabledReason) {
21
21
  return ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: disabledReason, withoutContainer: false, placement: "bottom", children: renderButton() }));
22
22
  }
@@ -5,4 +5,5 @@ export declare const menuOrganizationClassnames: {
5
5
  root: string;
6
6
  errorPlaceholder: string;
7
7
  button: string;
8
+ organizationData: string;
8
9
  };
@@ -9,4 +9,5 @@ exports.menuOrganizationClassnames = {
9
9
  root: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization'),
10
10
  errorPlaceholder: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__error-placeholder'),
11
11
  button: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__button'),
12
+ organizationData: (0, createUIKitClassname_1.createUIKitClassname)('menu-organization__organization-data'),
12
13
  };
@@ -29,7 +29,7 @@ const Profile = (props) => {
29
29
  if (isLoading) {
30
30
  return (0, jsx_runtime_1.jsx)(ProfileSkeleton_1.ProfileSkeleton, {});
31
31
  }
32
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, { onClickAway: handleCloseMenu, children: (0, jsx_runtime_1.jsxs)(styles_1.ProfileRoot, { ref: anchorRef, variant: "text", onClick: handleOpenMenu, children: [(0, jsx_runtime_1.jsx)(styles_1.StyledAvatar, { ...avatar }), (0, jsx_runtime_1.jsxs)(styles_1.User, { children: [(0, jsx_runtime_1.jsxs)(styles_1.Credentials, { className: hidePersonalDataClassname, children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "body1", className: constants_1.profileClassnames.credentials, children: displayName }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "caption", color: "textSecondary", className: constants_1.profileClassnames.credentials, children: annotation })] }), (0, jsx_runtime_1.jsx)(styles_1.StyledChevron, { isActive: open })] })] }) }), Menu ? ((0, jsx_runtime_1.jsx)(Menu, { open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu, anchorOrigin: {
32
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ClickAwayListener_1.default, { onClickAway: handleCloseMenu, children: (0, jsx_runtime_1.jsxs)(styles_1.ProfileRoot, { ref: anchorRef, variant: "text", onClick: handleOpenMenu, className: constants_1.profileClassnames.button, children: [(0, jsx_runtime_1.jsx)(styles_1.StyledAvatar, { ...avatar, className: constants_1.profileClassnames.avatar }), (0, jsx_runtime_1.jsxs)(styles_1.User, { className: constants_1.profileClassnames.user, children: [(0, jsx_runtime_1.jsxs)(styles_1.Credentials, { className: hidePersonalDataClassname, children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "body1", className: constants_1.profileClassnames.credentials, children: displayName }), (0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "caption", color: "textSecondary", className: constants_1.profileClassnames.credentials, children: annotation })] }), (0, jsx_runtime_1.jsx)(styles_1.StyledChevron, { isActive: open })] })] }) }), Menu ? ((0, jsx_runtime_1.jsx)(Menu, { open: open, anchorEl: anchorRef.current, onClose: handleCloseMenu, anchorOrigin: {
33
33
  vertical: 'bottom',
34
34
  horizontal: 'right',
35
35
  }, transformOrigin: {
@@ -1,3 +1,6 @@
1
1
  export declare const profileClassnames: {
2
2
  credentials: string;
3
+ button: string;
4
+ avatar: string;
5
+ user: string;
3
6
  };
@@ -4,4 +4,7 @@ exports.profileClassnames = void 0;
4
4
  const createUIKitClassname_1 = require("../utils/createUIKitClassname");
5
5
  exports.profileClassnames = {
6
6
  credentials: (0, createUIKitClassname_1.createUIKitClassname)('profile__credentials'),
7
+ button: (0, createUIKitClassname_1.createUIKitClassname)('profile__button'),
8
+ avatar: (0, createUIKitClassname_1.createUIKitClassname)('profile__avatar'),
9
+ user: (0, createUIKitClassname_1.createUIKitClassname)('profile__user'),
7
10
  };
@@ -1,3 +1,4 @@
1
1
  export * from './formatDate';
2
+ export * from './isMaskedDateSyntacticallyComplete';
2
3
  export * from './maskDate';
3
4
  export * from './parseDate';
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./formatDate"), exports);
18
+ __exportStar(require("./isMaskedDateSyntacticallyComplete"), exports);
18
19
  __exportStar(require("./maskDate"), exports);
19
20
  __exportStar(require("./parseDate"), exports);
@@ -1,4 +1,4 @@
1
- import { type DateMask } from '../../../../utils/date/format';
1
+ import { type DateMask } from '../maskDate';
2
2
  /**
3
3
  * Все ли части строки по маске заполнены цифрами полностью (без промежуточных состояний IMask).
4
4
  */
@@ -1,5 +1,6 @@
1
1
  import { type DateMask } from '../maskDate';
2
2
  /**
3
3
  * утилита конвертации строковой даты созданной по маске обратно в Date
4
+ * Строгий разбор UTC через `dayjs` + `customParseFormat`; при невалидной строке — Invalid Date
4
5
  */
5
6
  export declare const parseDate: (date: string, mask: DateMask, separator?: string) => Date;
@@ -1,25 +1,57 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.parseDate = void 0;
4
- const buildIsoDate_1 = require("../../buildIsoDate");
7
+ const dayjs_1 = __importDefault(require("dayjs"));
8
+ const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
9
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
5
10
  const maskDate_1 = require("../maskDate");
6
- const orderMap = {
7
- [maskDate_1.DateMaskElements.Year]: 'year',
8
- [maskDate_1.DateMaskElements.Month]: 'month',
9
- [maskDate_1.DateMaskElements.Day]: 'day',
10
- [maskDate_1.DateMaskElements.Hour]: 'hour',
11
- [maskDate_1.DateMaskElements.Minute]: 'minute',
12
- [maskDate_1.DateMaskElements.Second]: 'second',
11
+ dayjs_1.default.extend(customParseFormat_1.default);
12
+ dayjs_1.default.extend(utc_1.default);
13
+ /**
14
+ * Токен маски UI → литерал формата `dayjs` (strict UTC).
15
+ * В маске час — `hh`, в дате используются сутки 0–23 как в `formatDate` (UTC), поэтому `HH`.
16
+ */
17
+ const maskElementToDayjs = {
18
+ [maskDate_1.DateMaskElements.Day]: 'DD',
19
+ [maskDate_1.DateMaskElements.Month]: 'MM',
20
+ [maskDate_1.DateMaskElements.Year]: 'YYYY',
21
+ [maskDate_1.DateMaskElements.Hour]: 'HH',
22
+ [maskDate_1.DateMaskElements.Minute]: 'mm',
23
+ [maskDate_1.DateMaskElements.Second]: 'ss',
24
+ };
25
+ const buildDayjsFormat = (mask, separator) => {
26
+ const parts = mask.split(separator);
27
+ const tokens = [];
28
+ for (const part of parts) {
29
+ const t = maskElementToDayjs[part];
30
+ if (t == null) {
31
+ return null;
32
+ }
33
+ tokens.push(t);
34
+ }
35
+ return tokens.join(separator);
13
36
  };
14
37
  /**
15
38
  * утилита конвертации строковой даты созданной по маске обратно в Date
39
+ * Строгий разбор UTC через `dayjs` + `customParseFormat`; при невалидной строке — Invalid Date
16
40
  */
17
41
  const parseDate = (date, mask, separator = '.') => {
18
42
  const dateArr = date.split(separator);
19
- const options = { year: 1900 };
20
- mask.split('.').forEach((element, index) => {
21
- options[orderMap[element]] = parseInt(dateArr[index]);
22
- });
23
- return (0, buildIsoDate_1.buildIsoDate)(options);
43
+ const maskSplit = mask.split(separator);
44
+ if (dateArr.length !== maskSplit.length) {
45
+ return new Date(Number.NaN);
46
+ }
47
+ const format = buildDayjsFormat(mask, separator);
48
+ if (format == null) {
49
+ return new Date(Number.NaN);
50
+ }
51
+ const parsed = dayjs_1.default.utc(date, format, true);
52
+ if (!parsed.isValid()) {
53
+ return new Date(Number.NaN);
54
+ }
55
+ return parsed.toDate();
24
56
  };
25
57
  exports.parseDate = parseDate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "4.51.0",
3
+ "version": "4.52.1",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {