@astral/ui 1.26.0 → 1.27.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 (41) hide show
  1. package/DataGrid/DataGridHeadColumn/styles.d.ts +2 -1
  2. package/DataGrid/DataGridNoData/styles.d.ts +2 -1
  3. package/DataGridPagination/styles.d.ts +2 -1
  4. package/DatePicker/DateCalendar/DateCalendarHead/styles.d.ts +2 -1
  5. package/DatePicker/DatePicker.js +1 -1
  6. package/MenuGroup/stories/styled.d.ts +2 -1
  7. package/MenuGroup/styled.d.ts +2 -1
  8. package/Notification/NotificationTemplate/styled.d.ts +2 -1
  9. package/OverflowTypography/styles.d.ts +2 -1
  10. package/Placeholder/styles.d.ts +4 -2
  11. package/Typography/Typography.d.ts +8 -0
  12. package/Typography/Typography.js +7 -3
  13. package/Typography/enums.d.ts +6 -2
  14. package/Typography/enums.js +5 -1
  15. package/esm/DataGrid/DataGridHeadColumn/styles.d.ts +2 -1
  16. package/esm/DataGrid/DataGridNoData/styles.d.ts +2 -1
  17. package/esm/DataGridPagination/styles.d.ts +2 -1
  18. package/esm/DatePicker/DateCalendar/DateCalendarHead/styles.d.ts +2 -1
  19. package/esm/DatePicker/DatePicker.js +1 -1
  20. package/esm/MenuGroup/stories/styled.d.ts +2 -1
  21. package/esm/MenuGroup/styled.d.ts +2 -1
  22. package/esm/Notification/NotificationTemplate/styled.d.ts +2 -1
  23. package/esm/OverflowTypography/styles.d.ts +2 -1
  24. package/esm/Placeholder/styles.d.ts +4 -2
  25. package/esm/Typography/Typography.d.ts +8 -0
  26. package/esm/Typography/Typography.js +7 -3
  27. package/esm/Typography/enums.d.ts +6 -2
  28. package/esm/Typography/enums.js +5 -1
  29. package/esm/utils/date/format/formatDate/formatDate.d.ts +1 -1
  30. package/esm/utils/date/format/formatDate/formatDate.js +16 -2
  31. package/esm/utils/date/format/maskDate.d.ts +8 -0
  32. package/esm/utils/date/format/maskDate.js +9 -1
  33. package/esm/utils/date/format/parseDate/parseDate.d.ts +2 -1
  34. package/esm/utils/date/format/parseDate/parseDate.js +18 -2
  35. package/package.json +2 -2
  36. package/utils/date/format/formatDate/formatDate.d.ts +1 -1
  37. package/utils/date/format/formatDate/formatDate.js +16 -5
  38. package/utils/date/format/maskDate.d.ts +8 -0
  39. package/utils/date/format/maskDate.js +10 -0
  40. package/utils/date/format/parseDate/parseDate.d.ts +2 -1
  41. package/utils/date/format/parseDate/parseDate.js +18 -5
@@ -9,7 +9,8 @@ export declare const StyledTableCell: import("@emotion/styled").StyledComponent<
9
9
  export declare const TableCellTitle: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
10
10
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
11
11
  component?: import("react").ElementType<any> | undefined;
12
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
12
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
13
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
13
14
  } & {
14
15
  theme?: import("@emotion/react").Theme | undefined;
15
16
  }, {}, {}>;
@@ -16,7 +16,8 @@ export declare const DataGridNoDataIcon: import("@emotion/styled").StyledCompone
16
16
  export declare const DataGridNoDataFigcaption: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
17
17
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
18
18
  component?: import("react").ElementType<any> | undefined;
19
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
19
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
20
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
20
21
  } & {
21
22
  theme?: import("@emotion/react").Theme | undefined;
22
23
  }, {}, {}>;
@@ -6,7 +6,8 @@ export declare const PaginationWrapper: import("@emotion/styled").StyledComponen
6
6
  export declare const Range: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
7
7
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
8
8
  component?: import("react").ElementType<any> | undefined;
9
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
9
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
10
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
10
11
  } & {
11
12
  theme?: import("@emotion/react").Theme | undefined;
12
13
  }, {}, {}>;
@@ -5,7 +5,8 @@ export declare const DateCalendarHeadBtn: import("@emotion/styled").StyledCompon
5
5
  export declare const DateCalendarHeadText: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
6
6
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
7
7
  component?: import("react").ElementType<any> | undefined;
8
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
8
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
9
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
9
10
  } & {
10
11
  theme?: import("@emotion/react").Theme | undefined;
11
12
  }, {}, {}>;
@@ -37,7 +37,7 @@ const DatePickerInner = (0, react_1.forwardRef)(({ onChange, onOpen, onBlur, onC
37
37
  const selectedBaseDate = (0, useSelectedBaseDate_1.useSelectedBaseDate)(selectedDate);
38
38
  const checkValue = (0, react_1.useCallback)((value) => {
39
39
  setMaskedDate(value);
40
- const date = (0, date_1.parseDate)(value);
40
+ const date = (0, date_1.parseDate)(value, mask);
41
41
  if (value === '' || !(0, date_1.isDate)(date)) {
42
42
  setSelectedDate(null);
43
43
  }
@@ -32,7 +32,8 @@ export declare const StyledMenuItem: import("@emotion/styled").StyledComponent<{
32
32
  export declare const StyledLabel: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
33
33
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
34
34
  component?: import("react").ElementType<any> | undefined;
35
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
35
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
36
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
36
37
  } & {
37
38
  theme?: import("@emotion/react").Theme | undefined;
38
39
  }, {}, {}>;
@@ -2,7 +2,8 @@
2
2
  export declare const StyledLabel: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
3
3
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
4
4
  component?: import("react").ElementType<any> | undefined;
5
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
5
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
6
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
6
7
  } & {
7
8
  theme?: import("@emotion/react").Theme | undefined;
8
9
  }, {}, {}>;
@@ -62,7 +62,8 @@ export declare const NotificationCloseButton: import("@emotion/styled").StyledCo
62
62
  export declare const NotificationTitle: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
63
63
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
64
64
  component?: import("react").ElementType<any> | undefined;
65
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
65
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
66
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
66
67
  } & {
67
68
  theme?: import("@emotion/react").Theme | undefined;
68
69
  }, {}, {}>;
@@ -3,7 +3,8 @@ import { OverflowedProps } from './OverflowTypography';
3
3
  export declare const OverflowTypographyWrapper: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
4
4
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
5
5
  component?: import("react").ElementType<any> | undefined;
6
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
6
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
7
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
7
8
  } & {
8
9
  theme?: import("@emotion/react").Theme | undefined;
9
10
  } & Required<OverflowedProps>, {}, {}>;
@@ -14,14 +14,16 @@ export declare const PlaceholderImage: import("@emotion/styled").StyledComponent
14
14
  export declare const PlaceholderTitle: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
15
15
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
16
16
  component?: import("react").ElementType<any> | undefined;
17
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
17
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
18
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
18
19
  } & {
19
20
  theme?: import("@emotion/react").Theme | undefined;
20
21
  }, {}, {}>;
21
22
  export declare const PlaceholderDescription: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
22
23
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
23
24
  component?: import("react").ElementType<any> | undefined;
24
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
25
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
26
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
25
27
  } & {
26
28
  theme?: import("@emotion/react").Theme | undefined;
27
29
  }, {}, {}>;
@@ -4,11 +4,19 @@ import { Variant } from '@mui/material/styles/createTypography';
4
4
  import React from 'react';
5
5
  import { Theme } from '../theme';
6
6
  import { TypographyColors } from './enums';
7
+ declare type Intensity = '900' | '800' | '700' | '600' | '500' | '400' | '300' | '200' | '100';
7
8
  export declare type TypographyColor = keyof typeof TypographyColors;
8
9
  export declare type TypographyProps = Omit<OverrideProps<TypographyTypeMap, React.ElementType>, 'variant' | 'color'> & {
9
10
  variant?: Variant | keyof TypographyPropsVariantOverrides;
10
11
  component?: React.ElementType;
11
12
  color?: TypographyColor | ((theme: Theme) => string);
13
+ /**
14
+ * @description интенсивность цвета, будет применена для цвета, у которого есть градации
15
+ * @variation 900 | 800 | 700 | 600 | 500 | 400 | 300 | 200 | 100
16
+ * @default undefined
17
+ * @example <Typography color="grey" colorIntensity="500" />
18
+ */
19
+ colorIntensity?: Intensity;
12
20
  };
13
21
  declare module '@mui/material/Typography' {
14
22
  interface TypographyPropsVariantOverrides {
@@ -17,13 +17,17 @@ const material_1 = require("@mui/material");
17
17
  const react_1 = require("react");
18
18
  const enums_1 = require("./enums");
19
19
  exports.Typography = (0, react_1.forwardRef)((_a, ref) => {
20
- var { children, color } = _a, props = __rest(_a, ["children", "color"]);
20
+ var { children, color, colorIntensity } = _a, props = __rest(_a, ["children", "color", "colorIntensity"]);
21
21
  const typographyColor = (0, react_1.useMemo)(() => {
22
22
  if (typeof color === 'function') {
23
23
  return color;
24
24
  }
25
- return (color && enums_1.TypographyColors[color]) || color;
26
- }, [color]);
25
+ const colorName = (color && enums_1.TypographyColors[color]) || color;
26
+ if (colorName && Boolean(colorIntensity)) {
27
+ return (theme) => { var _a; return ((_a = theme.palette[colorName]) === null || _a === void 0 ? void 0 : _a[colorIntensity]) || colorName; };
28
+ }
29
+ return colorName;
30
+ }, [color, colorIntensity]);
27
31
  return ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ ref: ref }, props, { color: typographyColor }, { children: children })));
28
32
  });
29
33
  exports.default = exports.Typography;
@@ -2,9 +2,13 @@ export declare enum TypographyColors {
2
2
  text = "text",
3
3
  secondary = "secondary",
4
4
  primary = "primary",
5
- error = "error",
5
+ error = "error.main",
6
6
  success = "success.main",
7
7
  warning = "warning.main",
8
8
  info = "info.main",
9
- textSecondary = "text.secondary"
9
+ textSecondary = "text.secondary",
10
+ grey = "grey",
11
+ red = "red",
12
+ green = "green",
13
+ yellow = "yellow"
10
14
  }
@@ -6,9 +6,13 @@ var TypographyColors;
6
6
  TypographyColors["text"] = "text";
7
7
  TypographyColors["secondary"] = "secondary";
8
8
  TypographyColors["primary"] = "primary";
9
- TypographyColors["error"] = "error";
9
+ TypographyColors["error"] = "error.main";
10
10
  TypographyColors["success"] = "success.main";
11
11
  TypographyColors["warning"] = "warning.main";
12
12
  TypographyColors["info"] = "info.main";
13
13
  TypographyColors["textSecondary"] = "text.secondary";
14
+ TypographyColors["grey"] = "grey";
15
+ TypographyColors["red"] = "red";
16
+ TypographyColors["green"] = "green";
17
+ TypographyColors["yellow"] = "yellow";
14
18
  })(TypographyColors = exports.TypographyColors || (exports.TypographyColors = {}));
@@ -9,7 +9,8 @@ export declare const StyledTableCell: import("@emotion/styled").StyledComponent<
9
9
  export declare const TableCellTitle: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
10
10
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
11
11
  component?: import("react").ElementType<any> | undefined;
12
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
12
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
13
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
13
14
  } & {
14
15
  theme?: import("@emotion/react").Theme | undefined;
15
16
  }, {}, {}>;
@@ -16,7 +16,8 @@ export declare const DataGridNoDataIcon: import("@emotion/styled").StyledCompone
16
16
  export declare const DataGridNoDataFigcaption: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
17
17
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
18
18
  component?: import("react").ElementType<any> | undefined;
19
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
19
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
20
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
20
21
  } & {
21
22
  theme?: import("@emotion/react").Theme | undefined;
22
23
  }, {}, {}>;
@@ -6,7 +6,8 @@ export declare const PaginationWrapper: import("@emotion/styled").StyledComponen
6
6
  export declare const Range: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
7
7
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
8
8
  component?: import("react").ElementType<any> | undefined;
9
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
9
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
10
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
10
11
  } & {
11
12
  theme?: import("@emotion/react").Theme | undefined;
12
13
  }, {}, {}>;
@@ -5,7 +5,8 @@ export declare const DateCalendarHeadBtn: import("@emotion/styled").StyledCompon
5
5
  export declare const DateCalendarHeadText: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
6
6
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
7
7
  component?: import("react").ElementType<any> | undefined;
8
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
8
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
9
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
9
10
  } & {
10
11
  theme?: import("@emotion/react").Theme | undefined;
11
12
  }, {}, {}>;
@@ -34,7 +34,7 @@ const DatePickerInner = forwardRef(({ onChange, onOpen, onBlur, onClose, mask =
34
34
  const selectedBaseDate = useSelectedBaseDate(selectedDate);
35
35
  const checkValue = useCallback((value) => {
36
36
  setMaskedDate(value);
37
- const date = parseDate(value);
37
+ const date = parseDate(value, mask);
38
38
  if (value === '' || !isDate(date)) {
39
39
  setSelectedDate(null);
40
40
  }
@@ -32,7 +32,8 @@ export declare const StyledMenuItem: import("@emotion/styled").StyledComponent<{
32
32
  export declare const StyledLabel: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
33
33
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
34
34
  component?: import("react").ElementType<any> | undefined;
35
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
35
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
36
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
36
37
  } & {
37
38
  theme?: import("@emotion/react").Theme | undefined;
38
39
  }, {}, {}>;
@@ -2,7 +2,8 @@
2
2
  export declare const StyledLabel: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
3
3
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
4
4
  component?: import("react").ElementType<any> | undefined;
5
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
5
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
6
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
6
7
  } & {
7
8
  theme?: import("@emotion/react").Theme | undefined;
8
9
  }, {}, {}>;
@@ -62,7 +62,8 @@ export declare const NotificationCloseButton: import("@emotion/styled").StyledCo
62
62
  export declare const NotificationTitle: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
63
63
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
64
64
  component?: import("react").ElementType<any> | undefined;
65
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
65
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
66
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
66
67
  } & {
67
68
  theme?: import("@emotion/react").Theme | undefined;
68
69
  }, {}, {}>;
@@ -3,7 +3,8 @@ import { OverflowedProps } from './OverflowTypography';
3
3
  export declare const OverflowTypographyWrapper: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
4
4
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
5
5
  component?: import("react").ElementType<any> | undefined;
6
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
6
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
7
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
7
8
  } & {
8
9
  theme?: import("@emotion/react").Theme | undefined;
9
10
  } & Required<OverflowedProps>, {}, {}>;
@@ -14,14 +14,16 @@ export declare const PlaceholderImage: import("@emotion/styled").StyledComponent
14
14
  export declare const PlaceholderTitle: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
15
15
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
16
16
  component?: import("react").ElementType<any> | undefined;
17
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
17
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
18
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
18
19
  } & {
19
20
  theme?: import("@emotion/react").Theme | undefined;
20
21
  }, {}, {}>;
21
22
  export declare const PlaceholderDescription: import("@emotion/styled").StyledComponent<Omit<import("@mui/material/OverridableComponent").OverrideProps<import("@mui/material").TypographyTypeMap<{}, "span">, import("react").ElementType<any>>, "color" | "variant"> & {
22
23
  variant?: import("@mui/material").TypographyVariant | keyof import("@mui/material").TypographyPropsVariantOverrides | undefined;
23
24
  component?: import("react").ElementType<any> | undefined;
24
- color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
25
+ color?: "primary" | "secondary" | "red" | "green" | "yellow" | "grey" | "error" | "warning" | "info" | "success" | "text" | "textSecondary" | ((theme: import("@mui/material").Theme) => string) | undefined;
26
+ colorIntensity?: ("900" | "100" | "700" | "800" | "200" | "500" | "400" | "300" | "600") | undefined;
25
27
  } & {
26
28
  theme?: import("@emotion/react").Theme | undefined;
27
29
  }, {}, {}>;
@@ -4,11 +4,19 @@ import { Variant } from '@mui/material/styles/createTypography';
4
4
  import React from 'react';
5
5
  import { Theme } from '../theme';
6
6
  import { TypographyColors } from './enums';
7
+ declare type Intensity = '900' | '800' | '700' | '600' | '500' | '400' | '300' | '200' | '100';
7
8
  export declare type TypographyColor = keyof typeof TypographyColors;
8
9
  export declare type TypographyProps = Omit<OverrideProps<TypographyTypeMap, React.ElementType>, 'variant' | 'color'> & {
9
10
  variant?: Variant | keyof TypographyPropsVariantOverrides;
10
11
  component?: React.ElementType;
11
12
  color?: TypographyColor | ((theme: Theme) => string);
13
+ /**
14
+ * @description интенсивность цвета, будет применена для цвета, у которого есть градации
15
+ * @variation 900 | 800 | 700 | 600 | 500 | 400 | 300 | 200 | 100
16
+ * @default undefined
17
+ * @example <Typography color="grey" colorIntensity="500" />
18
+ */
19
+ colorIntensity?: Intensity;
12
20
  };
13
21
  declare module '@mui/material/Typography' {
14
22
  interface TypographyPropsVariantOverrides {
@@ -14,13 +14,17 @@ import { Typography as MuiTypography, } from '@mui/material';
14
14
  import { forwardRef, useMemo } from 'react';
15
15
  import { TypographyColors } from './enums';
16
16
  export const Typography = forwardRef((_a, ref) => {
17
- var { children, color } = _a, props = __rest(_a, ["children", "color"]);
17
+ var { children, color, colorIntensity } = _a, props = __rest(_a, ["children", "color", "colorIntensity"]);
18
18
  const typographyColor = useMemo(() => {
19
19
  if (typeof color === 'function') {
20
20
  return color;
21
21
  }
22
- return (color && TypographyColors[color]) || color;
23
- }, [color]);
22
+ const colorName = (color && TypographyColors[color]) || color;
23
+ if (colorName && Boolean(colorIntensity)) {
24
+ return (theme) => { var _a; return ((_a = theme.palette[colorName]) === null || _a === void 0 ? void 0 : _a[colorIntensity]) || colorName; };
25
+ }
26
+ return colorName;
27
+ }, [color, colorIntensity]);
24
28
  return (_jsx(MuiTypography, Object.assign({ ref: ref }, props, { color: typographyColor }, { children: children })));
25
29
  });
26
30
  export default Typography;
@@ -2,9 +2,13 @@ export declare enum TypographyColors {
2
2
  text = "text",
3
3
  secondary = "secondary",
4
4
  primary = "primary",
5
- error = "error",
5
+ error = "error.main",
6
6
  success = "success.main",
7
7
  warning = "warning.main",
8
8
  info = "info.main",
9
- textSecondary = "text.secondary"
9
+ textSecondary = "text.secondary",
10
+ grey = "grey",
11
+ red = "red",
12
+ green = "green",
13
+ yellow = "yellow"
10
14
  }
@@ -3,9 +3,13 @@ export var TypographyColors;
3
3
  TypographyColors["text"] = "text";
4
4
  TypographyColors["secondary"] = "secondary";
5
5
  TypographyColors["primary"] = "primary";
6
- TypographyColors["error"] = "error";
6
+ TypographyColors["error"] = "error.main";
7
7
  TypographyColors["success"] = "success.main";
8
8
  TypographyColors["warning"] = "warning.main";
9
9
  TypographyColors["info"] = "info.main";
10
10
  TypographyColors["textSecondary"] = "text.secondary";
11
+ TypographyColors["grey"] = "grey";
12
+ TypographyColors["red"] = "red";
13
+ TypographyColors["green"] = "green";
14
+ TypographyColors["yellow"] = "yellow";
11
15
  })(TypographyColors || (TypographyColors = {}));
@@ -2,4 +2,4 @@ import { DateMask } from '../maskDate';
2
2
  /**
3
3
  * @description утилита для генерации строковой даты по заданной маске
4
4
  */
5
- export declare const formatDate: (date: Date, mask: DateMask) => string;
5
+ export declare const formatDate: (date: Date, mask: DateMask, separator?: string) => string;
@@ -1,5 +1,19 @@
1
- import dayjs from 'dayjs';
1
+ import { zeroPad } from '../../../zeroPad';
2
+ import { DateMaskElements } from '../maskDate';
3
+ const elementsMap = {
4
+ [DateMaskElements.day]: (date) => date.getUTCDate(),
5
+ [DateMaskElements.month]: (date) => date.getUTCMonth() + 1,
6
+ [DateMaskElements.year]: (date) => date.getUTCFullYear(),
7
+ [DateMaskElements.hour]: (date) => date.getUTCHours(),
8
+ [DateMaskElements.minute]: (date) => date.getUTCMinutes(),
9
+ [DateMaskElements.second]: (date) => date.getUTCSeconds(),
10
+ };
2
11
  /**
3
12
  * @description утилита для генерации строковой даты по заданной маске
4
13
  */
5
- export const formatDate = (date, mask) => dayjs(date).format(mask);
14
+ export const formatDate = (date, mask, separator = '.') => mask
15
+ .split(separator)
16
+ .map((element) => { var _a; return (_a = elementsMap[element]) === null || _a === void 0 ? void 0 : _a.call(elementsMap, date); })
17
+ .filter(Boolean)
18
+ .map((value) => zeroPad(value, 2))
19
+ .join(separator);
@@ -3,3 +3,11 @@
3
3
  * @example DD.MM.YYYY.hh.mm.ss
4
4
  */
5
5
  export declare type DateMask = string;
6
+ export declare enum DateMaskElements {
7
+ day = "DD",
8
+ month = "MM",
9
+ year = "YYYY",
10
+ hour = "hh",
11
+ minute = "mm",
12
+ second = "ss"
13
+ }
@@ -1 +1,9 @@
1
- export {};
1
+ export var DateMaskElements;
2
+ (function (DateMaskElements) {
3
+ DateMaskElements["day"] = "DD";
4
+ DateMaskElements["month"] = "MM";
5
+ DateMaskElements["year"] = "YYYY";
6
+ DateMaskElements["hour"] = "hh";
7
+ DateMaskElements["minute"] = "mm";
8
+ DateMaskElements["second"] = "ss";
9
+ })(DateMaskElements || (DateMaskElements = {}));
@@ -1,4 +1,5 @@
1
+ import { DateMask } from '../maskDate';
1
2
  /**
2
3
  * @description утилита конвертации строковой даты созданной по маске обратно в Date
3
4
  */
4
- export declare const parseDate: (date: string) => Date;
5
+ export declare const parseDate: (date: string, mask: DateMask, separator?: string) => Date;
@@ -1,5 +1,21 @@
1
- import dayjs from 'dayjs';
1
+ import { DateMaskElements } from '../maskDate';
2
+ import { buildIsoDate } from '../../buildIsoDate';
3
+ const orderMap = {
4
+ [DateMaskElements.year]: 'year',
5
+ [DateMaskElements.month]: 'month',
6
+ [DateMaskElements.day]: 'day',
7
+ [DateMaskElements.hour]: 'hour',
8
+ [DateMaskElements.minute]: 'minute',
9
+ [DateMaskElements.second]: 'second',
10
+ };
2
11
  /**
3
12
  * @description утилита конвертации строковой даты созданной по маске обратно в Date
4
13
  */
5
- export const parseDate = (date) => dayjs(date).toDate();
14
+ export const parseDate = (date, mask, separator = '.') => {
15
+ const dateArr = date.split(separator);
16
+ const options = { year: 1900 };
17
+ mask.split('.').forEach((element, index) => {
18
+ options[orderMap[element]] = parseInt(dateArr[index]);
19
+ });
20
+ return buildIsoDate(options);
21
+ };
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@astral/ui",
3
- "version": "1.26.0",
3
+ "version": "1.27.1",
4
4
  "browser": "./esm/index.js",
5
5
  "main": "./index.js",
6
6
  "dependencies": {
7
- "@astral/icons": "^1.26.0",
7
+ "@astral/icons": "^1.27.1",
8
8
  "@emotion/cache": "11.7.1",
9
9
  "@emotion/react": "11.9.0",
10
10
  "@emotion/server": "11.4.0",
@@ -2,4 +2,4 @@ import { DateMask } from '../maskDate';
2
2
  /**
3
3
  * @description утилита для генерации строковой даты по заданной маске
4
4
  */
5
- export declare const formatDate: (date: Date, mask: DateMask) => string;
5
+ export declare const formatDate: (date: Date, mask: DateMask, separator?: string) => string;
@@ -1,12 +1,23 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.formatDate = void 0;
7
- const dayjs_1 = __importDefault(require("dayjs"));
4
+ const zeroPad_1 = require("../../../zeroPad");
5
+ const maskDate_1 = require("../maskDate");
6
+ const elementsMap = {
7
+ [maskDate_1.DateMaskElements.day]: (date) => date.getUTCDate(),
8
+ [maskDate_1.DateMaskElements.month]: (date) => date.getUTCMonth() + 1,
9
+ [maskDate_1.DateMaskElements.year]: (date) => date.getUTCFullYear(),
10
+ [maskDate_1.DateMaskElements.hour]: (date) => date.getUTCHours(),
11
+ [maskDate_1.DateMaskElements.minute]: (date) => date.getUTCMinutes(),
12
+ [maskDate_1.DateMaskElements.second]: (date) => date.getUTCSeconds(),
13
+ };
8
14
  /**
9
15
  * @description утилита для генерации строковой даты по заданной маске
10
16
  */
11
- const formatDate = (date, mask) => (0, dayjs_1.default)(date).format(mask);
17
+ const formatDate = (date, mask, separator = '.') => mask
18
+ .split(separator)
19
+ .map((element) => { var _a; return (_a = elementsMap[element]) === null || _a === void 0 ? void 0 : _a.call(elementsMap, date); })
20
+ .filter(Boolean)
21
+ .map((value) => (0, zeroPad_1.zeroPad)(value, 2))
22
+ .join(separator);
12
23
  exports.formatDate = formatDate;
@@ -3,3 +3,11 @@
3
3
  * @example DD.MM.YYYY.hh.mm.ss
4
4
  */
5
5
  export declare type DateMask = string;
6
+ export declare enum DateMaskElements {
7
+ day = "DD",
8
+ month = "MM",
9
+ year = "YYYY",
10
+ hour = "hh",
11
+ minute = "mm",
12
+ second = "ss"
13
+ }
@@ -1,2 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DateMaskElements = void 0;
4
+ var DateMaskElements;
5
+ (function (DateMaskElements) {
6
+ DateMaskElements["day"] = "DD";
7
+ DateMaskElements["month"] = "MM";
8
+ DateMaskElements["year"] = "YYYY";
9
+ DateMaskElements["hour"] = "hh";
10
+ DateMaskElements["minute"] = "mm";
11
+ DateMaskElements["second"] = "ss";
12
+ })(DateMaskElements = exports.DateMaskElements || (exports.DateMaskElements = {}));
@@ -1,4 +1,5 @@
1
+ import { DateMask } from '../maskDate';
1
2
  /**
2
3
  * @description утилита конвертации строковой даты созданной по маске обратно в Date
3
4
  */
4
- export declare const parseDate: (date: string) => Date;
5
+ export declare const parseDate: (date: string, mask: DateMask, separator?: string) => Date;
@@ -1,12 +1,25 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.parseDate = void 0;
7
- const dayjs_1 = __importDefault(require("dayjs"));
4
+ const maskDate_1 = require("../maskDate");
5
+ const buildIsoDate_1 = require("../../buildIsoDate");
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',
13
+ };
8
14
  /**
9
15
  * @description утилита конвертации строковой даты созданной по маске обратно в Date
10
16
  */
11
- const parseDate = (date) => (0, dayjs_1.default)(date).toDate();
17
+ const parseDate = (date, mask, separator = '.') => {
18
+ 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);
24
+ };
12
25
  exports.parseDate = parseDate;