@astral/ui 1.26.0 → 1.28.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.
- package/DataGrid/DataGridHeadColumn/styles.d.ts +2 -1
- package/DataGrid/DataGridNoData/styles.d.ts +2 -1
- package/DataGridPagination/styles.d.ts +2 -1
- package/DatePicker/DateCalendar/DateCalendarHead/styles.d.ts +2 -1
- package/DatePicker/DatePicker.d.ts +2 -0
- package/DatePicker/DatePicker.js +6 -4
- package/MenuGroup/stories/styled.d.ts +2 -1
- package/MenuGroup/styled.d.ts +2 -1
- package/Notification/NotificationTemplate/styled.d.ts +2 -1
- package/OverflowTypography/styles.d.ts +2 -1
- package/Placeholder/styles.d.ts +4 -2
- package/Select/Select.d.ts +11 -2
- package/Select/Select.js +6 -7
- package/Select/index.d.ts +0 -1
- package/Select/index.js +0 -1
- package/Select/{styled.d.ts → styles.d.ts} +3 -3
- package/Select/{styled.js → styles.js} +4 -4
- package/Typography/Typography.d.ts +8 -0
- package/Typography/Typography.js +7 -3
- package/Typography/enums.d.ts +6 -2
- package/Typography/enums.js +5 -1
- package/esm/DataGrid/DataGridHeadColumn/styles.d.ts +2 -1
- package/esm/DataGrid/DataGridNoData/styles.d.ts +2 -1
- package/esm/DataGridPagination/styles.d.ts +2 -1
- package/esm/DatePicker/DateCalendar/DateCalendarHead/styles.d.ts +2 -1
- package/esm/DatePicker/DatePicker.d.ts +2 -0
- package/esm/DatePicker/DatePicker.js +6 -4
- package/esm/MenuGroup/stories/styled.d.ts +2 -1
- package/esm/MenuGroup/styled.d.ts +2 -1
- package/esm/Notification/NotificationTemplate/styled.d.ts +2 -1
- package/esm/OverflowTypography/styles.d.ts +2 -1
- package/esm/Placeholder/styles.d.ts +4 -2
- package/esm/Select/Select.d.ts +11 -2
- package/esm/Select/Select.js +6 -7
- package/esm/Select/index.d.ts +0 -1
- package/esm/Select/index.js +0 -1
- package/esm/Select/{styled.d.ts → styles.d.ts} +3 -3
- package/esm/Select/{styled.js → styles.js} +3 -3
- package/esm/Typography/Typography.d.ts +8 -0
- package/esm/Typography/Typography.js +7 -3
- package/esm/Typography/enums.d.ts +6 -2
- package/esm/Typography/enums.js +5 -1
- package/esm/utils/date/format/formatDate/formatDate.d.ts +1 -1
- package/esm/utils/date/format/formatDate/formatDate.js +16 -2
- package/esm/utils/date/format/maskDate.d.ts +8 -0
- package/esm/utils/date/format/maskDate.js +9 -1
- package/esm/utils/date/format/parseDate/parseDate.d.ts +2 -1
- package/esm/utils/date/format/parseDate/parseDate.js +18 -2
- package/package.json +2 -2
- package/utils/date/format/formatDate/formatDate.d.ts +1 -1
- package/utils/date/format/formatDate/formatDate.js +16 -5
- package/utils/date/format/maskDate.d.ts +8 -0
- package/utils/date/format/maskDate.js +10 -0
- package/utils/date/format/parseDate/parseDate.d.ts +2 -1
- package/utils/date/format/parseDate/parseDate.js +18 -5
- package/Select/types.d.ts +0 -7
- package/Select/types.js +0 -2
- package/esm/Select/types.d.ts +0 -7
- package/esm/Select/types.js +0 -1
|
@@ -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
|
}, {}, {}>;
|
|
@@ -11,6 +11,7 @@ export declare type DatePickerProps = MondayFirst & Partial<MinMaxDate> & {
|
|
|
11
11
|
onClose?: () => void;
|
|
12
12
|
inputProps?: Omit<TextFieldProps, 'ref' | 'value' | 'onChange'>;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
value?: Date;
|
|
14
15
|
};
|
|
15
16
|
export declare const DatePicker: import("react").ForwardRefExoticComponent<MondayFirst & Partial<MinMaxDate> & {
|
|
16
17
|
mask?: string | undefined;
|
|
@@ -20,4 +21,5 @@ export declare const DatePicker: import("react").ForwardRefExoticComponent<Monda
|
|
|
20
21
|
onClose?: (() => void) | undefined;
|
|
21
22
|
inputProps?: Omit<TextFieldProps, "ref" | "value" | "onChange"> | undefined;
|
|
22
23
|
disabled?: boolean | undefined;
|
|
24
|
+
value?: Date | undefined;
|
|
23
25
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
package/DatePicker/DatePicker.js
CHANGED
|
@@ -24,20 +24,21 @@ const MinMaxDateContext_1 = require("./MinMaxDateContext");
|
|
|
24
24
|
const YearMonthDayPicker_1 = require("./YearMonthDayPicker");
|
|
25
25
|
const useBaseDateInRange_1 = require("./hooks/useBaseDateInRange");
|
|
26
26
|
const useSelectedBaseDate_1 = require("./hooks/useSelectedBaseDate");
|
|
27
|
-
const DatePickerInner = (0, react_1.forwardRef)(({ onChange, onOpen, onBlur, onClose, mask = 'DD.MM.YYYY', isMondayFirst, inputProps, disabled, }, forwardedRef) => {
|
|
27
|
+
const DatePickerInner = (0, react_1.forwardRef)(({ onChange, onOpen, onBlur, onClose, mask = 'DD.MM.YYYY', isMondayFirst, inputProps, disabled, value: parentValue, }, forwardedRef) => {
|
|
28
28
|
const { maxDate, minDate } = (0, react_1.useContext)(MinMaxDateContext_1.MinMaxDateContext);
|
|
29
29
|
const ref = (0, useForwardedRef_1.useForwardedRef)(forwardedRef);
|
|
30
30
|
const [isActive, openPopper, closePopper] = (0, useToggle_1.useToggle)({
|
|
31
31
|
onActive: onOpen,
|
|
32
32
|
onInactive: onClose,
|
|
33
33
|
});
|
|
34
|
-
const [selectedDate, setSelectedDate] = (0, react_1.useState)();
|
|
34
|
+
const [selectedDate, setSelectedDate] = (0, react_1.useState)(parentValue);
|
|
35
35
|
const [maskedDate, setMaskedDate] = (0, react_1.useState)('');
|
|
36
36
|
const baseDate = (0, useBaseDateInRange_1.useBaseDateInRange)({ minDate, maxDate });
|
|
37
37
|
const selectedBaseDate = (0, useSelectedBaseDate_1.useSelectedBaseDate)(selectedDate);
|
|
38
38
|
const checkValue = (0, react_1.useCallback)((value) => {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const isString = typeof value === 'string';
|
|
40
|
+
setMaskedDate(isString ? value : (0, date_1.formatDate)(value, mask));
|
|
41
|
+
const date = isString ? (0, date_1.parseDate)(value, mask) : value;
|
|
41
42
|
if (value === '' || !(0, date_1.isDate)(date)) {
|
|
42
43
|
setSelectedDate(null);
|
|
43
44
|
}
|
|
@@ -51,6 +52,7 @@ const DatePickerInner = (0, react_1.forwardRef)(({ onChange, onOpen, onBlur, onC
|
|
|
51
52
|
closePopper();
|
|
52
53
|
};
|
|
53
54
|
(0, react_1.useEffect)(() => onChange === null || onChange === void 0 ? void 0 : onChange(selectedDate || maskedDate), [selectedDate, maskedDate]);
|
|
55
|
+
(0, react_1.useEffect)(() => checkValue(parentValue || ''), [parentValue]);
|
|
54
56
|
const blurHandler = (e) => {
|
|
55
57
|
checkValue(e.target.value);
|
|
56
58
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
@@ -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
|
}, {}, {}>;
|
package/MenuGroup/styled.d.ts
CHANGED
|
@@ -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>, {}, {}>;
|
package/Placeholder/styles.d.ts
CHANGED
|
@@ -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
|
}, {}, {}>;
|
package/Select/Select.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SelectProps } from '
|
|
3
|
-
export declare
|
|
2
|
+
import { SelectProps as MuiSelectProps } from '@mui/material';
|
|
3
|
+
export declare type SelectProps<Value> = MuiSelectProps<Value> & {
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
getOptionLabel?: (value: string | number) => string | number;
|
|
7
|
+
helperText?: string;
|
|
8
|
+
success?: boolean;
|
|
9
|
+
error?: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const Select: <Value>({ getOptionLabel, placeholder, helperText, loading, success, children, error, label, ...props }: SelectProps<Value>) => JSX.Element;
|
package/Select/Select.js
CHANGED
|
@@ -16,19 +16,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.Select = void 0;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const material_1 = require("@mui/material");
|
|
19
20
|
const react_1 = __importDefault(require("react"));
|
|
20
21
|
const icons_1 = require("@astral/icons");
|
|
21
|
-
const TextField_1 = require("../TextField");
|
|
22
22
|
const Tag_1 = require("../Tag");
|
|
23
|
+
const FormHelperText_1 = require("../FormHelperText");
|
|
23
24
|
const CircularProgress_1 = require("../CircularProgress");
|
|
24
25
|
const MenuItem_1 = require("../MenuItem");
|
|
25
|
-
const
|
|
26
|
+
const styles_1 = require("./styles");
|
|
26
27
|
const Select = (_a) => {
|
|
27
|
-
var {
|
|
28
|
-
// unknown, т.к. ts ругается на несоответствие типов. По-умолчанию в selectedOptions string или string[].
|
|
28
|
+
var { getOptionLabel = (value) => value, placeholder, helperText, loading, success, children, error, label } = _a, props = __rest(_a, ["getOptionLabel", "placeholder", "helperText", "loading", "success", "children", "error", "label"]);
|
|
29
29
|
const renderValue = (selectedOptions) => {
|
|
30
30
|
if (Array.isArray(selectedOptions) && selectedOptions.length) {
|
|
31
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.SelectTagsWrapper, { children: selectedOptions.map((option) => {
|
|
32
32
|
const optionLabel = getOptionLabel(option);
|
|
33
33
|
return (0, jsx_runtime_1.jsx)(Tag_1.Tag, { color: "grey", label: optionLabel }, option);
|
|
34
34
|
}) }));
|
|
@@ -40,7 +40,6 @@ const Select = (_a) => {
|
|
|
40
40
|
return getOptionLabel(selectedOptions);
|
|
41
41
|
};
|
|
42
42
|
const isNoData = !Boolean(react_1.default.Children.count(children));
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
44
|
-
renderValue, displayEmpty: true, IconComponent: icons_1.ChevronDOutlineMd }) }, { children: [(0, jsx_runtime_1.jsx)(styled_1.Placeholder, Object.assign({ value: "" }, { children: "placeholder" })), loading && ((0, jsx_runtime_1.jsx)(styled_1.ProgressWrapper, { children: (0, jsx_runtime_1.jsx)(CircularProgress_1.CircularProgress, { color: "primary" }) })), !loading && children, !loading && isNoData && (0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, Object.assign({ disabled: true }, { children: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" }))] })));
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, Object.assign({ error: error }, { children: [(0, jsx_runtime_1.jsx)(material_1.InputLabel, Object.assign({ htmlFor: "grouped-select" }, { children: label })), (0, jsx_runtime_1.jsxs)(material_1.Select, Object.assign({}, props, { label: label, renderValue: renderValue, IconComponent: icons_1.ChevronDOutlineMd, displayEmpty: true }, { children: [(0, jsx_runtime_1.jsx)(styles_1.SelectPlaceholder, Object.assign({ value: "" }, { children: placeholder })), loading && ((0, jsx_runtime_1.jsx)(styles_1.SelectProgressWrapper, { children: (0, jsx_runtime_1.jsx)(CircularProgress_1.CircularProgress, { color: "primary" }) })), !loading && children, !loading && isNoData && (0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, Object.assign({ disabled: true }, { children: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" }))] })), (0, jsx_runtime_1.jsx)(FormHelperText_1.FormHelperText, Object.assign({ error: error, success: success }, { children: helperText }))] })));
|
|
45
44
|
};
|
|
46
45
|
exports.Select = Select;
|
package/Select/index.d.ts
CHANGED
package/Select/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const SelectTagsWrapper: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
4
|
as?: import("react").ElementType<any> | undefined;
|
|
5
5
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const SelectProgressWrapper: import("@emotion/styled").StyledComponent<{
|
|
7
7
|
theme?: import("@emotion/react").Theme | undefined;
|
|
8
8
|
as?: import("react").ElementType<any> | undefined;
|
|
9
9
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const SelectPlaceholder: import("@emotion/styled").StyledComponent<{
|
|
11
11
|
autoFocus?: boolean | undefined;
|
|
12
12
|
classes?: Partial<import("@mui/material").MenuItemClasses> | undefined;
|
|
13
13
|
dense?: boolean | undefined;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SelectPlaceholder = exports.SelectProgressWrapper = exports.SelectTagsWrapper = void 0;
|
|
4
4
|
const styles_1 = require("../styles");
|
|
5
5
|
const MenuItem_1 = require("../MenuItem");
|
|
6
|
-
exports.
|
|
6
|
+
exports.SelectTagsWrapper = styles_1.styled.div `
|
|
7
7
|
display: flex;
|
|
8
8
|
flex-wrap: wrap;
|
|
9
9
|
margin-bottom: -${({ theme }) => theme.spacing(1)};
|
|
@@ -22,7 +22,7 @@ exports.TagsWrapper = styles_1.styled.div `
|
|
|
22
22
|
margin-right: ${({ theme }) => theme.spacing(1)};
|
|
23
23
|
}
|
|
24
24
|
`;
|
|
25
|
-
exports.
|
|
25
|
+
exports.SelectProgressWrapper = styles_1.styled.div `
|
|
26
26
|
display: flex;
|
|
27
27
|
flex-direction: column;
|
|
28
28
|
align-items: center;
|
|
@@ -34,6 +34,6 @@ exports.ProgressWrapper = styles_1.styled.div `
|
|
|
34
34
|
color: ${({ theme }) => theme.palette.grey['900']};
|
|
35
35
|
}
|
|
36
36
|
`;
|
|
37
|
-
exports.
|
|
37
|
+
exports.SelectPlaceholder = (0, styles_1.styled)(MenuItem_1.MenuItem) `
|
|
38
38
|
display: none;
|
|
39
39
|
`;
|
|
@@ -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 {
|
package/Typography/Typography.js
CHANGED
|
@@ -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
|
-
|
|
26
|
-
|
|
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;
|
package/Typography/enums.d.ts
CHANGED
|
@@ -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
|
}
|
package/Typography/enums.js
CHANGED
|
@@ -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
|
}, {}, {}>;
|
|
@@ -11,6 +11,7 @@ export declare type DatePickerProps = MondayFirst & Partial<MinMaxDate> & {
|
|
|
11
11
|
onClose?: () => void;
|
|
12
12
|
inputProps?: Omit<TextFieldProps, 'ref' | 'value' | 'onChange'>;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
value?: Date;
|
|
14
15
|
};
|
|
15
16
|
export declare const DatePicker: import("react").ForwardRefExoticComponent<MondayFirst & Partial<MinMaxDate> & {
|
|
16
17
|
mask?: string | undefined;
|
|
@@ -20,4 +21,5 @@ export declare const DatePicker: import("react").ForwardRefExoticComponent<Monda
|
|
|
20
21
|
onClose?: (() => void) | undefined;
|
|
21
22
|
inputProps?: Omit<TextFieldProps, "ref" | "value" | "onChange"> | undefined;
|
|
22
23
|
disabled?: boolean | undefined;
|
|
24
|
+
value?: Date | undefined;
|
|
23
25
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -21,20 +21,21 @@ import { MinMaxDateContext, MinMaxDateContextProvider, } from './MinMaxDateConte
|
|
|
21
21
|
import { YearMonthDayPicker } from './YearMonthDayPicker';
|
|
22
22
|
import { useBaseDateInRange } from './hooks/useBaseDateInRange';
|
|
23
23
|
import { useSelectedBaseDate } from './hooks/useSelectedBaseDate';
|
|
24
|
-
const DatePickerInner = forwardRef(({ onChange, onOpen, onBlur, onClose, mask = 'DD.MM.YYYY', isMondayFirst, inputProps, disabled, }, forwardedRef) => {
|
|
24
|
+
const DatePickerInner = forwardRef(({ onChange, onOpen, onBlur, onClose, mask = 'DD.MM.YYYY', isMondayFirst, inputProps, disabled, value: parentValue, }, forwardedRef) => {
|
|
25
25
|
const { maxDate, minDate } = useContext(MinMaxDateContext);
|
|
26
26
|
const ref = useForwardedRef(forwardedRef);
|
|
27
27
|
const [isActive, openPopper, closePopper] = useToggle({
|
|
28
28
|
onActive: onOpen,
|
|
29
29
|
onInactive: onClose,
|
|
30
30
|
});
|
|
31
|
-
const [selectedDate, setSelectedDate] = useState();
|
|
31
|
+
const [selectedDate, setSelectedDate] = useState(parentValue);
|
|
32
32
|
const [maskedDate, setMaskedDate] = useState('');
|
|
33
33
|
const baseDate = useBaseDateInRange({ minDate, maxDate });
|
|
34
34
|
const selectedBaseDate = useSelectedBaseDate(selectedDate);
|
|
35
35
|
const checkValue = useCallback((value) => {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const isString = typeof value === 'string';
|
|
37
|
+
setMaskedDate(isString ? value : formatDate(value, mask));
|
|
38
|
+
const date = isString ? parseDate(value, mask) : value;
|
|
38
39
|
if (value === '' || !isDate(date)) {
|
|
39
40
|
setSelectedDate(null);
|
|
40
41
|
}
|
|
@@ -48,6 +49,7 @@ const DatePickerInner = forwardRef(({ onChange, onOpen, onBlur, onClose, mask =
|
|
|
48
49
|
closePopper();
|
|
49
50
|
};
|
|
50
51
|
useEffect(() => onChange === null || onChange === void 0 ? void 0 : onChange(selectedDate || maskedDate), [selectedDate, maskedDate]);
|
|
52
|
+
useEffect(() => checkValue(parentValue || ''), [parentValue]);
|
|
51
53
|
const blurHandler = (e) => {
|
|
52
54
|
checkValue(e.target.value);
|
|
53
55
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
@@ -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
|
}, {}, {}>;
|
package/esm/Select/Select.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { SelectProps } from '
|
|
3
|
-
export declare
|
|
2
|
+
import { SelectProps as MuiSelectProps } from '@mui/material';
|
|
3
|
+
export declare type SelectProps<Value> = MuiSelectProps<Value> & {
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
getOptionLabel?: (value: string | number) => string | number;
|
|
7
|
+
helperText?: string;
|
|
8
|
+
success?: boolean;
|
|
9
|
+
error?: boolean;
|
|
10
|
+
label: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const Select: <Value>({ getOptionLabel, placeholder, helperText, loading, success, children, error, label, ...props }: SelectProps<Value>) => JSX.Element;
|
package/esm/Select/Select.js
CHANGED
|
@@ -10,19 +10,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { FormControl, InputLabel, Select as MuiSelect, } from '@mui/material';
|
|
13
14
|
import React from 'react';
|
|
14
15
|
import { ChevronDOutlineMd } from '@astral/icons';
|
|
15
|
-
import { TextField } from '../TextField';
|
|
16
16
|
import { Tag } from '../Tag';
|
|
17
|
+
import { FormHelperText } from '../FormHelperText';
|
|
17
18
|
import { CircularProgress } from '../CircularProgress';
|
|
18
19
|
import { MenuItem } from '../MenuItem';
|
|
19
|
-
import {
|
|
20
|
+
import { SelectPlaceholder, SelectProgressWrapper, SelectTagsWrapper, } from './styles';
|
|
20
21
|
export const Select = (_a) => {
|
|
21
|
-
var {
|
|
22
|
-
// unknown, т.к. ts ругается на несоответствие типов. По-умолчанию в selectedOptions string или string[].
|
|
22
|
+
var { getOptionLabel = (value) => value, placeholder, helperText, loading, success, children, error, label } = _a, props = __rest(_a, ["getOptionLabel", "placeholder", "helperText", "loading", "success", "children", "error", "label"]);
|
|
23
23
|
const renderValue = (selectedOptions) => {
|
|
24
24
|
if (Array.isArray(selectedOptions) && selectedOptions.length) {
|
|
25
|
-
return (_jsx(
|
|
25
|
+
return (_jsx(SelectTagsWrapper, { children: selectedOptions.map((option) => {
|
|
26
26
|
const optionLabel = getOptionLabel(option);
|
|
27
27
|
return _jsx(Tag, { color: "grey", label: optionLabel }, option);
|
|
28
28
|
}) }));
|
|
@@ -34,6 +34,5 @@ export const Select = (_a) => {
|
|
|
34
34
|
return getOptionLabel(selectedOptions);
|
|
35
35
|
};
|
|
36
36
|
const isNoData = !Boolean(React.Children.count(children));
|
|
37
|
-
return (_jsxs(
|
|
38
|
-
renderValue, displayEmpty: true, IconComponent: ChevronDOutlineMd }) }, { children: [_jsx(Placeholder, Object.assign({ value: "" }, { children: "placeholder" })), loading && (_jsx(ProgressWrapper, { children: _jsx(CircularProgress, { color: "primary" }) })), !loading && children, !loading && isNoData && _jsx(MenuItem, Object.assign({ disabled: true }, { children: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" }))] })));
|
|
37
|
+
return (_jsxs(FormControl, Object.assign({ error: error }, { children: [_jsx(InputLabel, Object.assign({ htmlFor: "grouped-select" }, { children: label })), _jsxs(MuiSelect, Object.assign({}, props, { label: label, renderValue: renderValue, IconComponent: ChevronDOutlineMd, displayEmpty: true }, { children: [_jsx(SelectPlaceholder, Object.assign({ value: "" }, { children: placeholder })), loading && (_jsx(SelectProgressWrapper, { children: _jsx(CircularProgress, { color: "primary" }) })), !loading && children, !loading && isNoData && _jsx(MenuItem, Object.assign({ disabled: true }, { children: "\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445" }))] })), _jsx(FormHelperText, Object.assign({ error: error, success: success }, { children: helperText }))] })));
|
|
39
38
|
};
|
package/esm/Select/index.d.ts
CHANGED
package/esm/Select/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const SelectTagsWrapper: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
4
|
as?: import("react").ElementType<any> | undefined;
|
|
5
5
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const SelectProgressWrapper: import("@emotion/styled").StyledComponent<{
|
|
7
7
|
theme?: import("@emotion/react").Theme | undefined;
|
|
8
8
|
as?: import("react").ElementType<any> | undefined;
|
|
9
9
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const SelectPlaceholder: import("@emotion/styled").StyledComponent<{
|
|
11
11
|
autoFocus?: boolean | undefined;
|
|
12
12
|
classes?: Partial<import("@mui/material").MenuItemClasses> | undefined;
|
|
13
13
|
dense?: boolean | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { styled } from '../styles';
|
|
2
2
|
import { MenuItem } from '../MenuItem';
|
|
3
|
-
export const
|
|
3
|
+
export const SelectTagsWrapper = styled.div `
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-wrap: wrap;
|
|
6
6
|
margin-bottom: -${({ theme }) => theme.spacing(1)};
|
|
@@ -19,7 +19,7 @@ export const TagsWrapper = styled.div `
|
|
|
19
19
|
margin-right: ${({ theme }) => theme.spacing(1)};
|
|
20
20
|
}
|
|
21
21
|
`;
|
|
22
|
-
export const
|
|
22
|
+
export const SelectProgressWrapper = styled.div `
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
align-items: center;
|
|
@@ -31,6 +31,6 @@ export const ProgressWrapper = styled.div `
|
|
|
31
31
|
color: ${({ theme }) => theme.palette.grey['900']};
|
|
32
32
|
}
|
|
33
33
|
`;
|
|
34
|
-
export const
|
|
34
|
+
export const SelectPlaceholder = styled(MenuItem) `
|
|
35
35
|
display: none;
|
|
36
36
|
`;
|
|
@@ -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
|
-
|
|
23
|
-
|
|
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
|
}
|
package/esm/Typography/enums.js
CHANGED
|
@@ -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
|
|
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) =>
|
|
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);
|
|
@@ -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
|
|
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) =>
|
|
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.
|
|
3
|
+
"version": "1.28.1",
|
|
4
4
|
"browser": "./esm/index.js",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@astral/icons": "^1.
|
|
7
|
+
"@astral/icons": "^1.28.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
|
|
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
|
|
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;
|
|
@@ -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
|
|
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
|
|
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;
|
package/Select/types.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SelectProps as MuiSelectProps } from '@mui/material';
|
|
2
|
-
import { TextFieldProps } from '../TextField';
|
|
3
|
-
export declare type SelectProps = MuiSelectProps & Pick<TextFieldProps, 'error' | 'success' | 'SelectProps' | 'helperText' | 'label'> & {
|
|
4
|
-
loading?: boolean;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
getOptionLabel?: (value: string | number) => string | number;
|
|
7
|
-
};
|
package/Select/types.js
DELETED
package/esm/Select/types.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SelectProps as MuiSelectProps } from '@mui/material';
|
|
2
|
-
import { TextFieldProps } from '../TextField';
|
|
3
|
-
export declare type SelectProps = MuiSelectProps & Pick<TextFieldProps, 'error' | 'success' | 'SelectProps' | 'helperText' | 'label'> & {
|
|
4
|
-
loading?: boolean;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
getOptionLabel?: (value: string | number) => string | number;
|
|
7
|
-
};
|
package/esm/Select/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|