@ozen-ui/kit 0.47.2 → 0.49.0
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/DatePicker/package.json +5 -0
- package/__inner__/cjs/components/Alert/Alert.css +11 -12
- package/__inner__/cjs/components/Alert/Alert.d.ts +13 -39
- package/__inner__/cjs/components/Alert/Alert.js +14 -14
- package/__inner__/cjs/components/Alert/constants.d.ts +1 -1
- package/__inner__/cjs/components/Alert/constants.js +2 -2
- package/__inner__/cjs/components/Alert/index.d.ts +1 -0
- package/__inner__/cjs/components/Alert/index.js +1 -0
- package/__inner__/cjs/components/Alert/types.d.ts +46 -0
- package/__inner__/cjs/components/Alert/types.js +10 -0
- package/__inner__/cjs/components/Autocomplete/Autocomplete.js +57 -63
- package/__inner__/cjs/components/Autocomplete/helper.d.ts +6 -0
- package/__inner__/cjs/components/Autocomplete/types.d.ts +1 -1
- package/__inner__/cjs/components/Calendar/types.d.ts +1 -1
- package/__inner__/cjs/components/DatePicker/DatePicker.css +11 -0
- package/__inner__/cjs/components/DatePicker/DatePicker.d.ts +39 -0
- package/__inner__/cjs/components/DatePicker/DatePicker.js +160 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/DateInput.d.ts +6 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/DateInput.js +14 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/utils/dateInputMask/dateInputMask.d.ts +2 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/utils/dateInputMask/dateInputMask.js +20 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/utils/dateInputMask/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/utils/dateInputMask/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/utils/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/components/DateInput/utils/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/components/DatePickerRenderRight/DatePickerRenderRight.d.ts +8 -0
- package/__inner__/cjs/components/DatePicker/components/DatePickerRenderRight/DatePickerRenderRight.js +26 -0
- package/__inner__/cjs/components/DatePicker/components/DatePickerRenderRight/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/components/DatePickerRenderRight/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/components/index.d.ts +2 -0
- package/__inner__/cjs/components/DatePicker/components/index.js +5 -0
- package/__inner__/cjs/components/DatePicker/constants.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/constants.js +4 -0
- package/__inner__/cjs/components/DatePicker/index.d.ts +2 -0
- package/__inner__/cjs/components/DatePicker/index.js +5 -0
- package/__inner__/cjs/components/DatePicker/types.d.ts +52 -0
- package/__inner__/cjs/components/DatePicker/types.js +2 -0
- package/__inner__/cjs/components/DatePicker/utils/formatDateToString/formatDateToString.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/utils/formatDateToString/formatDateToString.js +13 -0
- package/__inner__/cjs/components/DatePicker/utils/formatDateToString/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/utils/formatDateToString/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/utils/formatStringToDate/formatStringToDate.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/utils/formatStringToDate/formatStringToDate.js +13 -0
- package/__inner__/cjs/components/DatePicker/utils/formatStringToDate/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/utils/formatStringToDate/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/utils/index.d.ts +5 -0
- package/__inner__/cjs/components/DatePicker/utils/index.js +8 -0
- package/__inner__/cjs/components/DatePicker/utils/isInExclude/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/utils/isInExclude/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/utils/isInExclude/isInExclude.d.ts +2 -0
- package/__inner__/cjs/components/DatePicker/utils/isInExclude/isInExclude.js +14 -0
- package/__inner__/cjs/components/DatePicker/utils/isOutOfRange/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/utils/isOutOfRange/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/utils/isOutOfRange/isOutOfRange.d.ts +2 -0
- package/__inner__/cjs/components/DatePicker/utils/isOutOfRange/isOutOfRange.js +11 -0
- package/__inner__/cjs/components/DatePicker/utils/matchCalendarSizeToFormElement/index.d.ts +1 -0
- package/__inner__/cjs/components/DatePicker/utils/matchCalendarSizeToFormElement/index.js +4 -0
- package/__inner__/cjs/components/DatePicker/utils/matchCalendarSizeToFormElement/matchCalendarSizeToFormElement.d.ts +5 -0
- package/__inner__/cjs/components/DatePicker/utils/matchCalendarSizeToFormElement/matchCalendarSizeToFormElement.js +10 -0
- package/__inner__/cjs/components/Input/Input.css +0 -1
- package/__inner__/cjs/components/Input/Input.js +1 -1
- package/__inner__/cjs/components/InputNumber/utils.d.ts +1 -1
- package/__inner__/cjs/components/List/components/ListItemText/ListItemText.d.ts +5 -5
- package/__inner__/cjs/components/Slider/utils/getPositionOnRail.d.ts +1 -1
- package/__inner__/cjs/components/Snackbar/components/SnackbarItem/SnackbarItem.js +1 -1
- package/__inner__/cjs/components/ThemeProvider/types.d.ts +2 -0
- package/__inner__/cjs/components/Tooltip/Tooltip.css +5 -6
- package/__inner__/cjs/components/Tooltip/Tooltip.js +6 -2
- package/__inner__/cjs/components/Tooltip/constants.d.ts +1 -1
- package/__inner__/cjs/components/Tooltip/constants.js +2 -2
- package/__inner__/cjs/components/Tooltip/types.d.ts +11 -3
- package/__inner__/cjs/locale/locale.js +12 -0
- package/__inner__/esm/components/Alert/Alert.css +11 -12
- package/__inner__/esm/components/Alert/Alert.d.ts +13 -39
- package/__inner__/esm/components/Alert/Alert.js +14 -14
- package/__inner__/esm/components/Alert/constants.d.ts +1 -1
- package/__inner__/esm/components/Alert/constants.js +1 -1
- package/__inner__/esm/components/Alert/index.d.ts +1 -0
- package/__inner__/esm/components/Alert/index.js +1 -0
- package/__inner__/esm/components/Alert/types.d.ts +46 -0
- package/__inner__/esm/components/Alert/types.js +7 -0
- package/__inner__/esm/components/Autocomplete/Autocomplete.js +57 -63
- package/__inner__/esm/components/Autocomplete/helper.d.ts +6 -0
- package/__inner__/esm/components/Autocomplete/types.d.ts +1 -1
- package/__inner__/esm/components/Calendar/types.d.ts +1 -1
- package/__inner__/esm/components/DatePicker/DatePicker.css +11 -0
- package/__inner__/esm/components/DatePicker/DatePicker.d.ts +39 -0
- package/__inner__/esm/components/DatePicker/DatePicker.js +157 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/DateInput.d.ts +6 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/DateInput.js +11 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/index.js +1 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/utils/dateInputMask/dateInputMask.d.ts +2 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/utils/dateInputMask/dateInputMask.js +15 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/utils/dateInputMask/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/utils/dateInputMask/index.js +1 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/utils/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/components/DateInput/utils/index.js +1 -0
- package/__inner__/esm/components/DatePicker/components/DatePickerRenderRight/DatePickerRenderRight.d.ts +8 -0
- package/__inner__/esm/components/DatePicker/components/DatePickerRenderRight/DatePickerRenderRight.js +22 -0
- package/__inner__/esm/components/DatePicker/components/DatePickerRenderRight/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/components/DatePickerRenderRight/index.js +1 -0
- package/__inner__/esm/components/DatePicker/components/index.d.ts +2 -0
- package/__inner__/esm/components/DatePicker/components/index.js +2 -0
- package/__inner__/esm/components/DatePicker/constants.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/constants.js +1 -0
- package/__inner__/esm/components/DatePicker/index.d.ts +2 -0
- package/__inner__/esm/components/DatePicker/index.js +2 -0
- package/__inner__/esm/components/DatePicker/types.d.ts +52 -0
- package/__inner__/esm/components/DatePicker/types.js +1 -0
- package/__inner__/esm/components/DatePicker/utils/formatDateToString/formatDateToString.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/utils/formatDateToString/formatDateToString.js +9 -0
- package/__inner__/esm/components/DatePicker/utils/formatDateToString/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/utils/formatDateToString/index.js +1 -0
- package/__inner__/esm/components/DatePicker/utils/formatStringToDate/formatStringToDate.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/utils/formatStringToDate/formatStringToDate.js +9 -0
- package/__inner__/esm/components/DatePicker/utils/formatStringToDate/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/utils/formatStringToDate/index.js +1 -0
- package/__inner__/esm/components/DatePicker/utils/index.d.ts +5 -0
- package/__inner__/esm/components/DatePicker/utils/index.js +5 -0
- package/__inner__/esm/components/DatePicker/utils/isInExclude/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/utils/isInExclude/index.js +1 -0
- package/__inner__/esm/components/DatePicker/utils/isInExclude/isInExclude.d.ts +2 -0
- package/__inner__/esm/components/DatePicker/utils/isInExclude/isInExclude.js +10 -0
- package/__inner__/esm/components/DatePicker/utils/isOutOfRange/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/utils/isOutOfRange/index.js +1 -0
- package/__inner__/esm/components/DatePicker/utils/isOutOfRange/isOutOfRange.d.ts +2 -0
- package/__inner__/esm/components/DatePicker/utils/isOutOfRange/isOutOfRange.js +7 -0
- package/__inner__/esm/components/DatePicker/utils/matchCalendarSizeToFormElement/index.d.ts +1 -0
- package/__inner__/esm/components/DatePicker/utils/matchCalendarSizeToFormElement/index.js +1 -0
- package/__inner__/esm/components/DatePicker/utils/matchCalendarSizeToFormElement/matchCalendarSizeToFormElement.d.ts +5 -0
- package/__inner__/esm/components/DatePicker/utils/matchCalendarSizeToFormElement/matchCalendarSizeToFormElement.js +7 -0
- package/__inner__/esm/components/Input/Input.css +0 -1
- package/__inner__/esm/components/Input/Input.js +1 -1
- package/__inner__/esm/components/InputNumber/utils.d.ts +1 -1
- package/__inner__/esm/components/List/components/ListItemText/ListItemText.d.ts +5 -5
- package/__inner__/esm/components/Slider/utils/getPositionOnRail.d.ts +1 -1
- package/__inner__/esm/components/Snackbar/components/SnackbarItem/SnackbarItem.js +1 -1
- package/__inner__/esm/components/ThemeProvider/types.d.ts +2 -0
- package/__inner__/esm/components/Tooltip/Tooltip.css +5 -6
- package/__inner__/esm/components/Tooltip/Tooltip.js +7 -3
- package/__inner__/esm/components/Tooltip/constants.d.ts +1 -1
- package/__inner__/esm/components/Tooltip/constants.js +1 -1
- package/__inner__/esm/components/Tooltip/types.d.ts +11 -3
- package/__inner__/esm/locale/locale.js +12 -0
- package/package.json +4 -4
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
.Alert {
|
|
3
3
|
--alert-status-line-width: 8px;
|
|
4
4
|
--alert-status-line-gutter: var(--control-padding-xs);
|
|
5
|
+
--alert-title-text-color: var(--color-content-primary);
|
|
6
|
+
--alert-body-text-color: var(--color-content-secondary);
|
|
7
|
+
--alert-icon-color: var(--color-content-primary);
|
|
8
|
+
--alert-close-button-color: var(--color-content-primary);
|
|
5
9
|
display: flex;
|
|
6
10
|
overflow: auto;
|
|
7
11
|
inline-size: 100%;
|
|
@@ -22,18 +26,13 @@
|
|
|
22
26
|
|
|
23
27
|
text-transform: var(--typography-text-xs-text_transform, none);
|
|
24
28
|
}
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
--alert-title-text-color: var(--color-content-primary-inverse);
|
|
33
|
-
--alert-body-text-color: var(--color-content-primary-inverse);
|
|
34
|
-
--alert-icon-color: var(--color-content-primary-inverse);
|
|
35
|
-
--alert-close-button-color: var(--color-content-primary-inverse);
|
|
36
|
-
}
|
|
29
|
+
.Alert_color_dark,
|
|
30
|
+
.Alert_inverse {
|
|
31
|
+
--alert-title-text-color: var(--color-content-primary-inverse);
|
|
32
|
+
--alert-body-text-color: var(--color-content-primary-inverse);
|
|
33
|
+
--alert-icon-color: var(--color-content-primary-inverse);
|
|
34
|
+
--alert-close-button-color: var(--color-content-primary-inverse);
|
|
35
|
+
}
|
|
37
36
|
.Alert_status_info {
|
|
38
37
|
--alert-icon-color: var(--color-content-info);
|
|
39
38
|
--alert-status-line-color: var(--color-background-info);
|
|
@@ -1,43 +1,17 @@
|
|
|
1
1
|
import './Alert.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { HTMLAttributes, ReactElement, ReactNode, MouseEvent } from 'react';
|
|
4
3
|
import type { ButtonProps } from '../ButtonNext';
|
|
5
4
|
export declare const cnAlert: import("@bem-react/classname").ClassNameFormatter;
|
|
6
|
-
export declare const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
color?: AlertColorVariant;
|
|
20
|
-
/**
|
|
21
|
-
* Если {true} отображает иконку со статусом
|
|
22
|
-
* @default true
|
|
23
|
-
*/
|
|
24
|
-
showIcon?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Функция обратного вызова при нажатии на кнопку закрытия
|
|
27
|
-
*/
|
|
28
|
-
onClose?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Основное содержимое элемента
|
|
31
|
-
* @default null
|
|
32
|
-
* */
|
|
33
|
-
children?: ReactNode;
|
|
34
|
-
/** Действие: кнопка или ссылка. Свойство принимает React-элемент или рендер-функцию */
|
|
35
|
-
action?: ReactElement<ButtonProps> | (({ size, className, }: Pick<ButtonProps, 'size' | 'className'>) => ReactElement);
|
|
36
|
-
/** Дополнительные CSS-классы */
|
|
37
|
-
className?: string;
|
|
38
|
-
/** Текст для кнопки закрытия компонента */
|
|
39
|
-
closeText?: string;
|
|
40
|
-
};
|
|
41
|
-
export type AlertProps = AlertBaseProps & Omit<HTMLAttributes<HTMLDivElement>, 'title'>;
|
|
42
|
-
export declare const Alert: React.ForwardRefExoticComponent<AlertBaseProps & Omit<React.HTMLAttributes<HTMLDivElement>, "title"> & React.RefAttributes<HTMLDivElement>>;
|
|
43
|
-
export {};
|
|
5
|
+
export declare const Alert: React.ForwardRefExoticComponent<{
|
|
6
|
+
title: React.ReactNode;
|
|
7
|
+
status?: "error" | "info" | "success" | "warning" | undefined;
|
|
8
|
+
inverse?: boolean | undefined;
|
|
9
|
+
showIcon?: boolean | undefined;
|
|
10
|
+
onClose?: ((e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void) | undefined;
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
action?: React.ReactElement<ButtonProps, string | React.JSXElementConstructor<any>> | (({ size, className, }: Pick<ButtonProps, "className" | "size">) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) | undefined;
|
|
13
|
+
className?: string | undefined;
|
|
14
|
+
closeText?: string | undefined;
|
|
15
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "title" | "color"> & {
|
|
16
|
+
color?: "dark" | "light" | undefined;
|
|
17
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Alert = exports.
|
|
3
|
+
exports.Alert = exports.cnAlert = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
require("./Alert.css");
|
|
6
6
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
7
|
var icons_1 = require("@ozen-ui/icons");
|
|
8
|
+
var logger_1 = require("@ozen-ui/logger");
|
|
8
9
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
9
10
|
var classname_1 = require("../../utils/classname");
|
|
10
11
|
var IconButtonNext_1 = require("../IconButtonNext");
|
|
11
12
|
var Paper_1 = require("../Paper");
|
|
12
13
|
var constants_1 = require("./constants");
|
|
13
14
|
exports.cnAlert = (0, classname_1.cn)('Alert');
|
|
14
|
-
exports.alertStatusVariant = [
|
|
15
|
-
'success',
|
|
16
|
-
'error',
|
|
17
|
-
'warning',
|
|
18
|
-
'info',
|
|
19
|
-
];
|
|
20
|
-
exports.alertColorVariant = ['light', 'dark'];
|
|
21
15
|
var matchStatusToIcon = {
|
|
22
|
-
neutral: react_1.default.createElement(icons_1.InfoCircleFilledIcon, { size: "s" }),
|
|
23
16
|
info: react_1.default.createElement(icons_1.InfoCircleFilledIcon, { size: "s" }),
|
|
24
|
-
|
|
17
|
+
neutral: react_1.default.createElement(icons_1.InfoCircleFilledIcon, { size: "s" }),
|
|
25
18
|
success: react_1.default.createElement(icons_1.CheckCircleFilledIcon, { size: "s" }),
|
|
26
19
|
error: react_1.default.createElement(icons_1.WarningCircleFilledIcon, { size: "s" }),
|
|
20
|
+
warning: react_1.default.createElement(icons_1.WarningTriangleFilledIcon, { size: "s" }),
|
|
27
21
|
};
|
|
28
22
|
exports.Alert = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
29
23
|
var props = (0, useThemeProps_1.useThemeProps)({
|
|
30
24
|
props: inProps,
|
|
31
25
|
name: 'Alert',
|
|
32
26
|
});
|
|
33
|
-
var _a = props.status, status = _a === void 0 ? constants_1.ALERT_DEFAULT_STATUS : _a, _b = props.showIcon, showIcon = _b === void 0 ? constants_1.ALERT_DEFAULT_SHOW_ICON : _b, _c = props.
|
|
27
|
+
var _a = props.status, status = _a === void 0 ? constants_1.ALERT_DEFAULT_STATUS : _a, _b = props.showIcon, showIcon = _b === void 0 ? constants_1.ALERT_DEFAULT_SHOW_ICON : _b, _c = props.inverse, inverse = _c === void 0 ? constants_1.ALERT_DEFAULT_INVERSE : _c, color = props.color, closeText = props.closeText, children = props.children, actionProp = props.action, onClose = props.onClose, title = props.title, className = props.className, other = tslib_1.__rest(props, ["status", "showIcon", "inverse", "color", "closeText", "children", "action", "onClose", "title", "className"]);
|
|
28
|
+
if (process.env.NODE_ENV !== 'production' && color) {
|
|
29
|
+
(0, logger_1.deprecate)('Свойство «color» устарело. Для замены используйте «inverse».');
|
|
30
|
+
}
|
|
34
31
|
var action = (0, react_1.useMemo)(function () {
|
|
35
32
|
var actionProps = {
|
|
36
33
|
size: '2xs',
|
|
@@ -44,9 +41,12 @@ exports.Alert = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
|
44
41
|
}
|
|
45
42
|
return react_1.default.cloneElement(actionProp, actionProps);
|
|
46
43
|
}, [actionProp]);
|
|
47
|
-
return (react_1.default.createElement(Paper_1.Paper, tslib_1.__assign({ radius: "l", shadow: "m", role: "alert", background: color === '
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
return (react_1.default.createElement(Paper_1.Paper, tslib_1.__assign({ radius: "l", shadow: "m", role: "alert", background: "main" }, (color === 'dark' && { background: 'main-inverse' }), (inverse && { background: 'main-inverse' }), other, { className: (0, exports.cnAlert)({
|
|
45
|
+
color: color,
|
|
46
|
+
status: status,
|
|
47
|
+
inverse: inverse,
|
|
48
|
+
hasCloseButton: !!onClose,
|
|
49
|
+
}, [className]), ref: ref }),
|
|
50
50
|
showIcon && (react_1.default.createElement("div", { className: (0, exports.cnAlert)('Icon') }, matchStatusToIcon[status])),
|
|
51
51
|
react_1.default.createElement("div", { className: (0, exports.cnAlert)('Content') },
|
|
52
52
|
react_1.default.createElement("div", { className: (0, exports.cnAlert)('Title') }, title),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ALERT_DEFAULT_INVERSE = exports.ALERT_DEFAULT_SHOW_ICON = exports.ALERT_DEFAULT_STATUS = void 0;
|
|
4
4
|
exports.ALERT_DEFAULT_STATUS = 'info';
|
|
5
5
|
exports.ALERT_DEFAULT_SHOW_ICON = true;
|
|
6
|
-
exports.
|
|
6
|
+
exports.ALERT_DEFAULT_INVERSE = false;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { HTMLAttributes, MouseEvent, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { ButtonProps } from '../ButtonNext';
|
|
3
|
+
export declare const alertStatusVariant: readonly ["success", "error", "warning", "info"];
|
|
4
|
+
export declare const alertColorVariant: readonly ["light", "dark"];
|
|
5
|
+
export type AlertStatusVariant = (typeof alertStatusVariant)[number];
|
|
6
|
+
export type AlertColorVariant = (typeof alertColorVariant)[number];
|
|
7
|
+
type AlertPropsDeprecated = {
|
|
8
|
+
/**
|
|
9
|
+
* Цветовая палитра сообщения
|
|
10
|
+
* @deprecated Используйте на замену свойство «inverse»
|
|
11
|
+
* */
|
|
12
|
+
color?: AlertColorVariant;
|
|
13
|
+
};
|
|
14
|
+
type AlertBaseProps = {
|
|
15
|
+
/** Заголовок сообщения */
|
|
16
|
+
title: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Статус сообщения
|
|
19
|
+
* @default info
|
|
20
|
+
*/
|
|
21
|
+
status?: AlertStatusVariant;
|
|
22
|
+
/** Если {true} инвертирует основные цвета компонента */
|
|
23
|
+
inverse?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Если {true} отображает иконку со статусом
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
showIcon?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Функция обратного вызова при нажатии на кнопку закрытия
|
|
31
|
+
*/
|
|
32
|
+
onClose?: (e: MouseEvent<HTMLButtonElement>) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Основное содержимое элемента
|
|
35
|
+
* @default null
|
|
36
|
+
* */
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
/** Действие: кнопка или ссылка. Свойство принимает React-элемент или рендер-функцию */
|
|
39
|
+
action?: ReactElement<ButtonProps> | (({ size, className, }: Pick<ButtonProps, 'size' | 'className'>) => ReactElement);
|
|
40
|
+
/** Дополнительные CSS-классы */
|
|
41
|
+
className?: string;
|
|
42
|
+
/** Текст для кнопки закрытия компонента */
|
|
43
|
+
closeText?: string;
|
|
44
|
+
};
|
|
45
|
+
export type AlertProps = AlertBaseProps & Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'color'> & AlertPropsDeprecated;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.alertColorVariant = exports.alertStatusVariant = void 0;
|
|
4
|
+
exports.alertStatusVariant = [
|
|
5
|
+
'success',
|
|
6
|
+
'error',
|
|
7
|
+
'warning',
|
|
8
|
+
'info',
|
|
9
|
+
];
|
|
10
|
+
exports.alertColorVariant = ['light', 'dark'];
|
|
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
require("./Autocomplete.css");
|
|
6
6
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
7
|
var useControlled_1 = require("../../hooks/useControlled");
|
|
8
|
+
var useMultiRef_1 = require("../../hooks/useMultiRef");
|
|
8
9
|
var useMutableRef_1 = require("../../hooks/useMutableRef");
|
|
9
10
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
10
11
|
var classname_1 = require("../../utils/classname");
|
|
@@ -20,8 +21,10 @@ function AutocompleteRender(inProps, ref) {
|
|
|
20
21
|
props: inProps,
|
|
21
22
|
name: 'Autocomplete',
|
|
22
23
|
});
|
|
23
|
-
var _a = (0, helper_1.withDefaultGetters)(props), _b = _a.disabled, disabled = _b === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLED : _b, _c = _a.required, required = _c === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_REQUIRED : _c, _d = _a.autoFocus, autoFocus = _d === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_AUTOFOCUS : _d, _e = _a.fullWidth, fullWidth = _e === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_FULLWIDTH : _e, _f = _a.size, size = _f === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_SIZE : _f, _g = _a.allowCustomValue, allowCustomValue = _g === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_ALLOW_CUSTOM_VALUE : _g, _h = _a.disableShowChevron, disableShowChevron = _h === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLE_SHOW_CHEVRON : _h, _j = _a.disableClearButton, disableClearButton = _j === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLE_CLEAR_BUTTON : _j, _k = _a.disableShowEmptyOptionsList, disableShowEmptyOptionsList = _k === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLE_SHOW_EMPTY_OPTIONS_LIST : _k, _l = _a.disableCloseOnSelect, disableCloseOnSelect = _l === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLE_CLOSE_ON_SELECT : _l, _m = _a.renderInput, renderInput = _m === void 0 ? function (props) { return react_1.default.createElement(Input_1.Input, tslib_1.__assign({}, props, { ref: ref })); } : _m, searchFunctionProp = _a.searchFunction, renderOptionProp = _a.renderOption, inputValueProp = _a.inputValue, className = _a.className, valueProp = _a.value, options = _a.options, defaultValue = _a.defaultValue, error = _a.error, onChange = _a.onChange, onInputChange = _a.onInputChange, label = _a.label, placeholder = _a.placeholder, renderLeft = _a.renderLeft, renderRight = _a.renderRight, hint = _a.hint, getOptionKey = _a.getOptionKey, getOptionLabel = _a.getOptionLabel, getOptionDisabled = _a.getOptionDisabled, dataListProps = _a.dataListProps, onCloseProp = _a.onClose, onOpenProp = _a.onOpen, openProp = _a.open, defaultOpen = _a.defaultOpen, loading = _a.loading, inputProps = _a.inputProps, onKeyDown = _a.onKeyDown, noOptionsText = _a.noOptionsText, clearText = _a.clearText, openText = _a.openText, loadingText = _a.loadingText, closeText = _a.closeText, other = tslib_1.__rest(_a, ["disabled", "required", "autoFocus", "fullWidth", "size", "allowCustomValue", "disableShowChevron", "disableClearButton", "disableShowEmptyOptionsList", "disableCloseOnSelect", "renderInput", "searchFunction", "renderOption", "inputValue", "className", "value", "options", "defaultValue", "error", "onChange", "onInputChange", "label", "placeholder", "renderLeft", "renderRight", "hint", "getOptionKey", "getOptionLabel", "getOptionDisabled", "dataListProps", "onClose", "onOpen", "open", "defaultOpen", "loading", "inputProps", "onKeyDown", "noOptionsText", "clearText", "openText", "loadingText", "closeText"]);
|
|
24
|
+
var _a = (0, helper_1.withDefaultGetters)(props), _b = _a.disabled, disabled = _b === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLED : _b, _c = _a.required, required = _c === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_REQUIRED : _c, _d = _a.autoFocus, autoFocus = _d === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_AUTOFOCUS : _d, _e = _a.fullWidth, fullWidth = _e === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_FULLWIDTH : _e, _f = _a.size, size = _f === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_SIZE : _f, _g = _a.allowCustomValue, allowCustomValue = _g === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_ALLOW_CUSTOM_VALUE : _g, _h = _a.disableShowChevron, disableShowChevron = _h === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLE_SHOW_CHEVRON : _h, _j = _a.disableClearButton, disableClearButton = _j === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLE_CLEAR_BUTTON : _j, _k = _a.disableShowEmptyOptionsList, disableShowEmptyOptionsList = _k === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLE_SHOW_EMPTY_OPTIONS_LIST : _k, _l = _a.disableCloseOnSelect, disableCloseOnSelect = _l === void 0 ? constants_1.AUTOCOMPLETE_DEFAULT_DISABLE_CLOSE_ON_SELECT : _l, _m = _a.renderInput, renderInput = _m === void 0 ? function (props) { return react_1.default.createElement(Input_1.Input, tslib_1.__assign({}, props, { ref: ref })); } : _m, searchFunctionProp = _a.searchFunction, renderOptionProp = _a.renderOption, inputValueProp = _a.inputValue, className = _a.className, valueProp = _a.value, options = _a.options, defaultValue = _a.defaultValue, error = _a.error, onChange = _a.onChange, onInputChange = _a.onInputChange, label = _a.label, placeholder = _a.placeholder, renderLeft = _a.renderLeft, renderRight = _a.renderRight, hint = _a.hint, getOptionKey = _a.getOptionKey, getOptionLabel = _a.getOptionLabel, getOptionDisabled = _a.getOptionDisabled, dataListProps = _a.dataListProps, onCloseProp = _a.onClose, onOpenProp = _a.onOpen, openProp = _a.open, defaultOpen = _a.defaultOpen, loading = _a.loading, inputProps = _a.inputProps, bodyProps = _a.bodyProps, onKeyDown = _a.onKeyDown, noOptionsText = _a.noOptionsText, clearText = _a.clearText, openText = _a.openText, loadingText = _a.loadingText, closeText = _a.closeText, other = tslib_1.__rest(_a, ["disabled", "required", "autoFocus", "fullWidth", "size", "allowCustomValue", "disableShowChevron", "disableClearButton", "disableShowEmptyOptionsList", "disableCloseOnSelect", "renderInput", "searchFunction", "renderOption", "inputValue", "className", "value", "options", "defaultValue", "error", "onChange", "onInputChange", "label", "placeholder", "renderLeft", "renderRight", "hint", "getOptionKey", "getOptionLabel", "getOptionDisabled", "dataListProps", "onClose", "onOpen", "open", "defaultOpen", "loading", "inputProps", "bodyProps", "onKeyDown", "noOptionsText", "clearText", "openText", "loadingText", "closeText"]);
|
|
24
25
|
var anchorRef = (0, react_1.useRef)(null);
|
|
26
|
+
var lastInputValue = (0, react_1.useRef)('');
|
|
27
|
+
var inputBodyRef = (0, useMultiRef_1.useMultiRef)([anchorRef, bodyProps === null || bodyProps === void 0 ? void 0 : bodyProps.ref]);
|
|
25
28
|
var _o = tslib_1.__read((0, useControlled_1.useControlled)({
|
|
26
29
|
value: inputValueProp,
|
|
27
30
|
defaultValue: '',
|
|
@@ -54,47 +57,43 @@ function AutocompleteRender(inProps, ref) {
|
|
|
54
57
|
var showNoOptions = !hasOptions && !loading;
|
|
55
58
|
var showLoading = !hasOptions && !!loading;
|
|
56
59
|
var _s = tslib_1.__read((0, react_1.useState)(undefined), 2), search = _s[0], setSearch = _s[1];
|
|
57
|
-
|
|
60
|
+
var changeInputValue = function (e, value) {
|
|
61
|
+
var _a;
|
|
62
|
+
setInputValue(value);
|
|
63
|
+
(_a = savedOnInputChange.current) === null || _a === void 0 ? void 0 : _a.call(savedOnInputChange, e, value);
|
|
64
|
+
};
|
|
65
|
+
var callOnChange = function (e, value) {
|
|
66
|
+
var inputValue = value ? getOptionLabel(value) : '';
|
|
67
|
+
setValueState(value);
|
|
68
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e, value);
|
|
69
|
+
changeInputValue(null, inputValue);
|
|
70
|
+
};
|
|
71
|
+
/** Эффект – фильтрация списка при изменении опций */
|
|
58
72
|
(0, react_1.useEffect)(function () {
|
|
59
|
-
if (!open)
|
|
73
|
+
if (!open)
|
|
60
74
|
return;
|
|
61
|
-
}
|
|
62
75
|
setFilteredOptions(search ? search(options) : tslib_1.__spreadArray([], tslib_1.__read(options), false));
|
|
63
76
|
}, [search, options, open, searchFunctionProp]);
|
|
64
77
|
/** Эффект – синхронизируем значение текстового поля со значением в списке */
|
|
65
78
|
(0, react_1.useEffect)(function () {
|
|
66
|
-
var _a
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
(
|
|
79
|
+
var _a;
|
|
80
|
+
if (allowCustomValue)
|
|
81
|
+
return;
|
|
82
|
+
lastInputValue.current = valueState
|
|
83
|
+
? (_a = savedGetOptionLabel.current) === null || _a === void 0 ? void 0 : _a.call(savedGetOptionLabel, valueState)
|
|
84
|
+
: '';
|
|
85
|
+
if (lastInputValue.current !== inputValue) {
|
|
86
|
+
changeInputValue(null, lastInputValue.current);
|
|
74
87
|
}
|
|
75
|
-
}, [valueState]);
|
|
88
|
+
}, [valueState, allowCustomValue]);
|
|
76
89
|
/** Эффект – автофокусировка в текстовом поле */
|
|
77
90
|
(0, react_1.useEffect)(function () {
|
|
78
91
|
var _a;
|
|
79
|
-
if (autoFocus)
|
|
92
|
+
if (autoFocus)
|
|
80
93
|
(_a = anchorRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
81
|
-
}
|
|
82
94
|
}, [autoFocus]);
|
|
83
|
-
/**
|
|
84
|
-
var
|
|
85
|
-
var _a;
|
|
86
|
-
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
|
|
87
|
-
if (allowCustomValue) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
var value = valueState ? getOptionLabel(valueState) : '';
|
|
91
|
-
if (inputValue !== value) {
|
|
92
|
-
setInputValue(value);
|
|
93
|
-
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(null, value);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
/** Ждем выполнения анимации на закрытие и делаем сброс */
|
|
97
|
-
var onExited = function () {
|
|
95
|
+
/** Ждём выполнения анимации на закрытие и делаем сброс функции фильтрации */
|
|
96
|
+
var handleExited = function () {
|
|
98
97
|
var _a;
|
|
99
98
|
setSearch(undefined);
|
|
100
99
|
(_a = dataListProps === null || dataListProps === void 0 ? void 0 : dataListProps.onExited) === null || _a === void 0 ? void 0 : _a.call(dataListProps);
|
|
@@ -113,21 +112,26 @@ function AutocompleteRender(inProps, ref) {
|
|
|
113
112
|
var handleToggle = function () {
|
|
114
113
|
if (disabled)
|
|
115
114
|
return;
|
|
116
|
-
if (open)
|
|
115
|
+
if (open)
|
|
117
116
|
handleClose();
|
|
118
|
-
|
|
119
|
-
else {
|
|
117
|
+
else
|
|
120
118
|
handleOpen();
|
|
121
|
-
}
|
|
122
119
|
};
|
|
123
120
|
/** Очистка поля */
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
setInputValue('');
|
|
127
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(e, null);
|
|
128
|
-
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(null, '');
|
|
121
|
+
var handleClear = function (e) {
|
|
122
|
+
callOnChange(e, null);
|
|
129
123
|
setSearch(undefined);
|
|
130
124
|
};
|
|
125
|
+
/** Актуализация значения текстового поля после его покидания */
|
|
126
|
+
var handleBlur = function (e) {
|
|
127
|
+
var _a;
|
|
128
|
+
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
|
|
129
|
+
if (allowCustomValue)
|
|
130
|
+
return;
|
|
131
|
+
if (inputValue !== lastInputValue.current) {
|
|
132
|
+
changeInputValue(null, lastInputValue.current);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
131
135
|
/** Открытие списка по клику на текстовом поле */
|
|
132
136
|
var handleClickOnInput = function (e) {
|
|
133
137
|
var _a;
|
|
@@ -135,49 +139,39 @@ function AutocompleteRender(inProps, ref) {
|
|
|
135
139
|
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onClick) === null || _a === void 0 ? void 0 : _a.call(inputProps, e);
|
|
136
140
|
};
|
|
137
141
|
/** Управление элементом контроля через клавиатуру */
|
|
138
|
-
var handleKeyDown = function (
|
|
139
|
-
if ((0, isKeys_1.isKeys)(
|
|
140
|
-
|
|
142
|
+
var handleKeyDown = function (e) {
|
|
143
|
+
if ((0, isKeys_1.isKeys)(e, ['ArrowDown', 'ArrowUp']) && !open) {
|
|
144
|
+
e.preventDefault();
|
|
141
145
|
handleToggle();
|
|
142
146
|
}
|
|
143
|
-
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(
|
|
147
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
144
148
|
};
|
|
145
149
|
/** Событие ввода значения в текстовом поле */
|
|
146
150
|
var handleChangeInput = function (e) {
|
|
147
151
|
var value = e.target.value;
|
|
148
152
|
// Открываем список при вводе первого символа (при условии, что список еще не открыт)
|
|
149
|
-
if (value.length && !open)
|
|
153
|
+
if (value.length && !open)
|
|
150
154
|
handleOpen();
|
|
155
|
+
if (value) {
|
|
156
|
+
changeInputValue(e, value);
|
|
151
157
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
setValueState(null);
|
|
155
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(e, null);
|
|
158
|
+
else {
|
|
159
|
+
callOnChange(e, null);
|
|
156
160
|
}
|
|
157
|
-
// Назначаем значение
|
|
158
|
-
setInputValue(value);
|
|
159
|
-
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(e, value);
|
|
160
161
|
// Задаем функцию фильтрации
|
|
161
162
|
setSearch(function () { return function (options) { return searchFunction(tslib_1.__spreadArray([], tslib_1.__read(options), false), value); }; });
|
|
162
163
|
};
|
|
163
164
|
/** Событие выбора значения из раскрывающегося списка */
|
|
164
|
-
var handleChangeDataList = function (
|
|
165
|
+
var handleChangeDataList = function (e, _a) {
|
|
165
166
|
var value = _a.value;
|
|
166
167
|
var selectedOption = filteredOptions === null || filteredOptions === void 0 ? void 0 : filteredOptions.find(function (option) { return (getOptionKey === null || getOptionKey === void 0 ? void 0 : getOptionKey(option)) === value; });
|
|
167
|
-
|
|
168
|
-
var newInputValue = getOptionLabel(selectedOption);
|
|
169
|
-
setValueState(selectedOption);
|
|
170
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event, selectedOption);
|
|
171
|
-
setInputValue(newInputValue);
|
|
172
|
-
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(null, newInputValue);
|
|
173
|
-
}
|
|
168
|
+
callOnChange(e, selectedOption || null);
|
|
174
169
|
// Закрываем список после выбора
|
|
175
|
-
if (!disableCloseOnSelect)
|
|
170
|
+
if (!disableCloseOnSelect)
|
|
176
171
|
handleClose();
|
|
177
|
-
}
|
|
178
172
|
};
|
|
179
173
|
/** Отображение текстового поля */
|
|
180
|
-
var input = renderInput(tslib_1.__assign(tslib_1.__assign({ size: size, hint: hint, disabled: disabled, label: label, required: required, error: error, fullWidth: fullWidth, placeholder: placeholder, renderLeft: renderLeft }, other), { renderRight: (react_1.default.createElement(components_1.AutocompleteRenderRight, { open: open, size: size, disabled: disabled, clearText: clearText, closeText: closeText, openText: openText, hasValue: !!inputValue, onClear:
|
|
174
|
+
var input = renderInput(tslib_1.__assign(tslib_1.__assign({ size: size, hint: hint, disabled: disabled, label: label, required: required, error: error, fullWidth: fullWidth, placeholder: placeholder, renderLeft: renderLeft }, other), { renderRight: (react_1.default.createElement(components_1.AutocompleteRenderRight, { open: open, size: size, disabled: disabled, clearText: clearText, closeText: closeText, openText: openText, hasValue: !!inputValue, onClear: handleClear, onOpen: handleToggle, renderRight: renderRight, disableShowChevron: disableShowChevron, disableClearButton: disableClearButton })), onChange: handleChangeInput, onKeyDown: handleKeyDown, value: inputValue || '', inputProps: tslib_1.__assign(tslib_1.__assign({}, inputProps), { onBlur: handleBlur, onClick: handleClickOnInput }), bodyProps: tslib_1.__assign(tslib_1.__assign({ 'aria-expanded': open }, bodyProps), { ref: inputBodyRef }), className: (0, exports.cnAutocomplete)({ size: size, hasChevron: !disableShowChevron }, [
|
|
181
175
|
className,
|
|
182
176
|
]), ref: ref }));
|
|
183
177
|
/** Отображение опций */
|
|
@@ -194,7 +188,7 @@ function AutocompleteRender(inProps, ref) {
|
|
|
194
188
|
});
|
|
195
189
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
196
190
|
input,
|
|
197
|
-
react_1.default.createElement(DataList_1.DataList, tslib_1.__assign({ size: size, equalAnchorWidth: true, offset: [0, 4], placement: "bottom-start" }, dataListProps, { open: open,
|
|
191
|
+
react_1.default.createElement(DataList_1.DataList, tslib_1.__assign({ size: size, equalAnchorWidth: true, offset: [0, 4], placement: "bottom-start" }, dataListProps, { open: open, onClose: handleClose, anchorRef: anchorRef, onExited: handleExited, selected: dataListValue, onSelect: handleChangeDataList, listProps: tslib_1.__assign({ role: 'listbox' }, dataListProps === null || dataListProps === void 0 ? void 0 : dataListProps.listProps) }),
|
|
198
192
|
renderOptions,
|
|
199
193
|
!disableShowEmptyOptionsList && (react_1.default.createElement(components_1.AutocompleteNoOptions, { showNoOptions: showNoOptions, noOptionsText: noOptionsText })),
|
|
200
194
|
react_1.default.createElement(components_1.AutocompleteLoading, { showLoading: showLoading, loadingText: loadingText, size: size }))));
|
|
@@ -80,6 +80,9 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
80
80
|
} & {
|
|
81
81
|
'data-testid'?: string | undefined;
|
|
82
82
|
}) | undefined;
|
|
83
|
+
bodyProps?: (Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
|
|
84
|
+
ref?: ((instance: HTMLLabelElement | null) => void) | import("react").RefObject<HTMLLabelElement> | null | undefined;
|
|
85
|
+
}) | undefined;
|
|
83
86
|
hintProps?: Omit<import("../FieldHint").FieldHintProps, "children"> | undefined;
|
|
84
87
|
} & {
|
|
85
88
|
open?: boolean | undefined;
|
|
@@ -177,6 +180,9 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
177
180
|
} & {
|
|
178
181
|
'data-testid'?: string | undefined;
|
|
179
182
|
}) | undefined;
|
|
183
|
+
bodyProps?: (Omit<import("react").DetailedHTMLProps<import("react").LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "ref"> & {
|
|
184
|
+
ref?: ((instance: HTMLLabelElement | null) => void) | import("react").RefObject<HTMLLabelElement> | null | undefined;
|
|
185
|
+
}) | undefined;
|
|
180
186
|
hintProps?: Omit<import("../FieldHint").FieldHintProps, "children"> | undefined;
|
|
181
187
|
} & {
|
|
182
188
|
open?: undefined;
|
|
@@ -31,7 +31,7 @@ type AutocompleteOpenUncontrolledProps = {
|
|
|
31
31
|
/** Состояние открытие по умолчанию (неконтролируемый компонент) */
|
|
32
32
|
defaultOpen?: boolean;
|
|
33
33
|
};
|
|
34
|
-
type AutocompleteInputProps = Pick<InputProps, 'placeholder' | 'autoFocus' | 'fullWidth' | 'disabled' | 'label' | 'required' | 'style' | 'error' | 'hint' | 'renderLeft' | 'renderRight' | 'className' | 'inputProps' | 'hintProps' | 'onKeyDown'>;
|
|
34
|
+
type AutocompleteInputProps = Pick<InputProps, 'placeholder' | 'autoFocus' | 'fullWidth' | 'disabled' | 'label' | 'required' | 'style' | 'error' | 'hint' | 'renderLeft' | 'renderRight' | 'className' | 'inputProps' | 'hintProps' | 'bodyProps' | 'onKeyDown'>;
|
|
35
35
|
type AutocompleteDataListProps = Partial<Omit<DataListProps, 'onClose' | 'open' | 'anchorRef' | 'multiple' | 'selected' | 'onSelect'>>;
|
|
36
36
|
export type AutocompleteProps<OPTION = AutocompleteDefaultOption> = {
|
|
37
37
|
/** Список вариантов выбора (опции) */
|
|
@@ -6,7 +6,7 @@ import type { CALENDAR_DEFAULT_AS } from './constants';
|
|
|
6
6
|
export declare const calendarStepVariant: readonly ["days", "months", "years"];
|
|
7
7
|
export declare const calendarSizeVariant: readonly ["s", "m", "l"];
|
|
8
8
|
export type CalendarStepVariant = (typeof calendarStepVariant)[number];
|
|
9
|
-
export type CalendarOnChange = (date: Date) => void;
|
|
9
|
+
export type CalendarOnChange = (date: Date | null) => void;
|
|
10
10
|
export type CalendarOnOffsetDateChange = (date: Date) => void;
|
|
11
11
|
export type CalendarSizeVariant = (typeof calendarSizeVariant)[number];
|
|
12
12
|
export type CalendarExclude = DPExcludeConfig;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import './DatePicker.css';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { CalendarOnChange } from '../Calendar';
|
|
4
|
+
export declare const cnDatePicker: import("@bem-react/classname").ClassNameFormatter;
|
|
5
|
+
export declare const DatePicker: React.ForwardRefExoticComponent<(Omit<{
|
|
6
|
+
value?: Date | null | undefined;
|
|
7
|
+
defaultValue?: Date | null | undefined;
|
|
8
|
+
onChange?: CalendarOnChange | undefined;
|
|
9
|
+
onInputChange?: import("./types").DatePickerOnInputChange | undefined;
|
|
10
|
+
onClose?: (() => void) | undefined;
|
|
11
|
+
onOpen?: (() => void) | undefined;
|
|
12
|
+
calendarProps?: import("../Calendar").CalendarBaseProps | undefined;
|
|
13
|
+
popoverProps?: import("../Popover").PopoverBaseProps | undefined;
|
|
14
|
+
clearText?: string | undefined;
|
|
15
|
+
disableClearButton?: boolean | undefined;
|
|
16
|
+
onError?: import("./types").DatePickerPropOnError | undefined;
|
|
17
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
19
|
+
}, "defaultValue" | "onChange" | "onError"> & Pick<import("../Calendar").CalendarBaseProps, "exclude" | "offsetDate" | "minDate" | "maxDate"> & Pick<import("../Input").InputProps, "label" | "onKeyDown" | "disabled" | "placeholder" | "required" | "size" | "error" | "fullWidth" | "hint" | "renderLeft" | "renderRight" | "inputProps"> & {
|
|
20
|
+
open?: boolean | undefined;
|
|
21
|
+
defaultOpen?: undefined;
|
|
22
|
+
}, "ref"> | Omit<{
|
|
23
|
+
value?: Date | null | undefined;
|
|
24
|
+
defaultValue?: Date | null | undefined;
|
|
25
|
+
onChange?: CalendarOnChange | undefined;
|
|
26
|
+
onInputChange?: import("./types").DatePickerOnInputChange | undefined;
|
|
27
|
+
onClose?: (() => void) | undefined;
|
|
28
|
+
onOpen?: (() => void) | undefined;
|
|
29
|
+
calendarProps?: import("../Calendar").CalendarBaseProps | undefined;
|
|
30
|
+
popoverProps?: import("../Popover").PopoverBaseProps | undefined;
|
|
31
|
+
clearText?: string | undefined;
|
|
32
|
+
disableClearButton?: boolean | undefined;
|
|
33
|
+
onError?: import("./types").DatePickerPropOnError | undefined;
|
|
34
|
+
} & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
35
|
+
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
36
|
+
}, "defaultValue" | "onChange" | "onError"> & Pick<import("../Calendar").CalendarBaseProps, "exclude" | "offsetDate" | "minDate" | "maxDate"> & Pick<import("../Input").InputProps, "label" | "onKeyDown" | "disabled" | "placeholder" | "required" | "size" | "error" | "fullWidth" | "hint" | "renderLeft" | "renderRight" | "inputProps"> & {
|
|
37
|
+
open?: undefined;
|
|
38
|
+
defaultOpen?: boolean | undefined;
|
|
39
|
+
}, "ref">) & React.RefAttributes<HTMLDivElement>>;
|