@ozen-ui/kit 0.8.0 → 0.9.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/FieldControl/package.json +5 -0
- package/FieldInput/package.json +5 -0
- package/Fieldset/package.json +5 -0
- package/__inner__/cjs/components/Backdrop/Backdrop.d.ts +2 -2
- package/__inner__/cjs/components/Breadcrumbs/types.d.ts +2 -2
- package/__inner__/cjs/components/DataList/DataList.d.ts +1 -1
- package/__inner__/cjs/components/DataList/DataListProvider.d.ts +5 -5
- package/__inner__/cjs/components/FieldControl/FieldControl.css +135 -0
- package/__inner__/cjs/components/FieldControl/FieldControl.d.ts +13 -0
- package/__inner__/cjs/components/FieldControl/FieldControl.js +82 -0
- package/__inner__/cjs/components/FieldControl/FieldControlContext.d.ts +15 -0
- package/__inner__/cjs/components/FieldControl/FieldControlContext.js +6 -0
- package/__inner__/cjs/components/FieldControl/index.d.ts +2 -0
- package/__inner__/cjs/components/FieldControl/index.js +5 -0
- package/__inner__/cjs/components/FieldHint/FieldHint.d.ts +6 -9
- package/__inner__/cjs/components/FieldHint/FieldHint.js +24 -4
- package/__inner__/cjs/components/FieldIcon/FieldIcon.css +1 -21
- package/__inner__/cjs/components/FieldIcon/FieldIcon.d.ts +8 -12
- package/__inner__/cjs/components/FieldIcon/FieldIcon.js +15 -4
- package/__inner__/cjs/components/FieldInput/FieldInput.d.ts +11 -0
- package/__inner__/cjs/components/FieldInput/FieldInput.js +55 -0
- package/__inner__/cjs/components/FieldInput/index.d.ts +1 -0
- package/__inner__/cjs/components/FieldInput/index.js +4 -0
- package/__inner__/cjs/components/FieldLabel/FieldLabel.d.ts +7 -5
- package/__inner__/cjs/components/FieldLabel/FieldLabel.js +40 -10
- package/__inner__/cjs/components/Fieldset/Fieldset.css +13 -0
- package/__inner__/cjs/components/Fieldset/Fieldset.d.ts +10 -0
- package/__inner__/cjs/components/Fieldset/Fieldset.js +15 -0
- package/__inner__/cjs/components/Fieldset/index.d.ts +1 -0
- package/__inner__/cjs/components/Fieldset/index.js +4 -0
- package/__inner__/cjs/components/FilePicker/FilePicker.css +48 -59
- package/__inner__/cjs/components/FilePicker/FilePicker.js +2 -1
- package/__inner__/cjs/components/Input/Input.css +9 -121
- package/__inner__/cjs/components/Input/Input.d.ts +1 -62
- package/__inner__/cjs/components/Input/Input.js +32 -53
- package/__inner__/cjs/components/Input/constants.d.ts +1 -0
- package/__inner__/cjs/components/Input/constants.js +4 -0
- package/__inner__/cjs/components/Input/index.d.ts +1 -0
- package/__inner__/cjs/components/Input/index.js +1 -0
- package/__inner__/cjs/components/Input/types.d.ts +71 -0
- package/__inner__/cjs/components/Input/types.js +13 -0
- package/__inner__/cjs/components/InputNumber/InputNumber.css +61 -74
- package/__inner__/cjs/components/InputNumber/InputNumber.js +2 -1
- package/__inner__/cjs/components/InputNumber/utils.d.ts +2 -2
- package/__inner__/cjs/components/Link/Link.d.ts +1 -1
- package/__inner__/cjs/components/List/components/ListItem/ListItem.d.ts +1 -2
- package/__inner__/cjs/components/List/components/ListItemButton/ListItemButton.d.ts +1 -2
- package/__inner__/cjs/components/List/types.d.ts +3 -3
- package/__inner__/cjs/components/Menu/components/MenuItem/MenuItem.d.ts +1 -1
- package/__inner__/cjs/components/Menu/components/MenuList/MenuList.d.ts +1 -1
- package/__inner__/cjs/components/Modal/Modal.d.ts +1 -1
- package/__inner__/cjs/components/Modal/Modal.js +1 -1
- package/__inner__/cjs/components/Modal/components/ModalConsumer.d.ts +2 -2
- package/__inner__/cjs/components/Pagination/helpers/createPaginationRange/createPaginationRange.d.ts +1 -1
- package/__inner__/cjs/components/Pagination/types.d.ts +5 -5
- package/__inner__/cjs/components/Popover/types.d.ts +4 -5
- package/__inner__/cjs/components/ProgressBar/ProgressBar.d.ts +2 -2
- package/__inner__/cjs/components/Select/Select.css +5 -16
- package/__inner__/cjs/components/Select/components/SelectInput/SelectInput.js +2 -1
- package/__inner__/cjs/components/Select/types.d.ts +3 -4
- package/__inner__/cjs/components/Slider/types.d.ts +1 -1
- package/__inner__/cjs/components/Snackbar/types.d.ts +1 -1
- package/__inner__/cjs/components/Tag/components/RemoveButton/RemoveButton.d.ts +1 -1
- package/__inner__/cjs/components/Textarea/Textarea.css +3 -107
- package/__inner__/cjs/components/Textarea/Textarea.d.ts +1 -59
- package/__inner__/cjs/components/Textarea/Textarea.js +8 -62
- package/__inner__/cjs/components/Textarea/components/TextareaConsumer.d.ts +3 -0
- package/__inner__/cjs/components/Textarea/components/TextareaConsumer.js +36 -0
- package/__inner__/cjs/components/Textarea/components/TextareaCounter.d.ts +7 -0
- package/__inner__/cjs/components/Textarea/components/TextareaCounter.js +25 -0
- package/__inner__/cjs/components/Textarea/components/index.d.ts +2 -0
- package/__inner__/cjs/components/Textarea/components/index.js +5 -0
- package/__inner__/cjs/components/Textarea/constants.d.ts +1 -0
- package/__inner__/cjs/components/Textarea/constants.js +4 -0
- package/__inner__/cjs/components/Textarea/index.d.ts +1 -0
- package/__inner__/cjs/components/Textarea/index.js +1 -0
- package/__inner__/cjs/components/Textarea/types.d.ts +69 -0
- package/__inner__/cjs/components/Textarea/types.js +4 -0
- package/__inner__/cjs/components/ThemeProvider/ThemeProvider.d.ts +2 -1
- package/__inner__/cjs/components/ThemeProvider/types.d.ts +2 -0
- package/__inner__/cjs/components/Tooltip/types.d.ts +1 -1
- package/__inner__/cjs/hooks/useMultiRef/useMultiRef.d.ts +2 -3
- package/__inner__/cjs/types/ResponsiveValue.d.ts +1 -1
- package/__inner__/cjs/utils/isKey.d.ts +2 -2
- package/__inner__/cjs/utils/polymorphicComponentWithRef.d.ts +0 -1
- package/__inner__/esm/components/Backdrop/Backdrop.d.ts +2 -2
- package/__inner__/esm/components/Backdrop/Backdrop.js +1 -1
- package/__inner__/esm/components/Breadcrumbs/types.d.ts +2 -2
- package/__inner__/esm/components/DataList/DataList.d.ts +1 -1
- package/__inner__/esm/components/DataList/DataListProvider.d.ts +5 -5
- package/__inner__/esm/components/FieldControl/FieldControl.css +135 -0
- package/__inner__/esm/components/FieldControl/FieldControl.d.ts +13 -0
- package/__inner__/esm/components/FieldControl/FieldControl.js +79 -0
- package/__inner__/esm/components/FieldControl/FieldControlContext.d.ts +15 -0
- package/__inner__/esm/components/FieldControl/FieldControlContext.js +2 -0
- package/__inner__/esm/components/FieldControl/index.d.ts +2 -0
- package/__inner__/esm/components/FieldControl/index.js +2 -0
- package/__inner__/esm/components/FieldHint/FieldHint.d.ts +6 -9
- package/__inner__/esm/components/FieldHint/FieldHint.js +25 -5
- package/__inner__/esm/components/FieldIcon/FieldIcon.css +1 -21
- package/__inner__/esm/components/FieldIcon/FieldIcon.d.ts +8 -12
- package/__inner__/esm/components/FieldIcon/FieldIcon.js +16 -5
- package/__inner__/esm/components/FieldInput/FieldInput.d.ts +11 -0
- package/__inner__/esm/components/FieldInput/FieldInput.js +52 -0
- package/__inner__/esm/components/FieldInput/index.d.ts +1 -0
- package/__inner__/esm/components/FieldInput/index.js +1 -0
- package/__inner__/esm/components/FieldLabel/FieldLabel.d.ts +7 -5
- package/__inner__/esm/components/FieldLabel/FieldLabel.js +39 -8
- package/__inner__/esm/components/Fieldset/Fieldset.css +13 -0
- package/__inner__/esm/components/Fieldset/Fieldset.d.ts +10 -0
- package/__inner__/esm/components/Fieldset/Fieldset.js +12 -0
- package/__inner__/esm/components/Fieldset/index.d.ts +1 -0
- package/__inner__/esm/components/Fieldset/index.js +1 -0
- package/__inner__/esm/components/FilePicker/FilePicker.css +48 -59
- package/__inner__/esm/components/FilePicker/FilePicker.js +2 -1
- package/__inner__/esm/components/Input/Input.css +9 -121
- package/__inner__/esm/components/Input/Input.d.ts +1 -62
- package/__inner__/esm/components/Input/Input.js +33 -54
- package/__inner__/esm/components/Input/constants.d.ts +1 -0
- package/__inner__/esm/components/Input/constants.js +1 -0
- package/__inner__/esm/components/Input/index.d.ts +1 -0
- package/__inner__/esm/components/Input/index.js +1 -0
- package/__inner__/esm/components/Input/types.d.ts +71 -0
- package/__inner__/esm/components/Input/types.js +10 -0
- package/__inner__/esm/components/InputNumber/InputNumber.css +61 -74
- package/__inner__/esm/components/InputNumber/InputNumber.js +2 -1
- package/__inner__/esm/components/InputNumber/utils.d.ts +2 -2
- package/__inner__/esm/components/Link/Link.d.ts +1 -1
- package/__inner__/esm/components/List/components/ListItem/ListItem.d.ts +1 -2
- package/__inner__/esm/components/List/components/ListItemButton/ListItemButton.d.ts +1 -2
- package/__inner__/esm/components/List/types.d.ts +3 -3
- package/__inner__/esm/components/Menu/components/MenuItem/MenuItem.d.ts +1 -1
- package/__inner__/esm/components/Menu/components/MenuList/MenuList.d.ts +1 -1
- package/__inner__/esm/components/Modal/Modal.d.ts +1 -1
- package/__inner__/esm/components/Modal/Modal.js +1 -1
- package/__inner__/esm/components/Modal/components/ModalConsumer.d.ts +2 -2
- package/__inner__/esm/components/Pagination/helpers/createPaginationRange/createPaginationRange.d.ts +1 -1
- package/__inner__/esm/components/Pagination/types.d.ts +5 -5
- package/__inner__/esm/components/Popover/types.d.ts +4 -5
- package/__inner__/esm/components/ProgressBar/ProgressBar.d.ts +2 -2
- package/__inner__/esm/components/ProgressBar/ProgressBar.js +1 -1
- package/__inner__/esm/components/Select/Select.css +5 -16
- package/__inner__/esm/components/Select/components/SelectInput/SelectInput.js +2 -1
- package/__inner__/esm/components/Select/types.d.ts +3 -4
- package/__inner__/esm/components/Slider/types.d.ts +1 -1
- package/__inner__/esm/components/Snackbar/types.d.ts +1 -1
- package/__inner__/esm/components/Tag/components/RemoveButton/RemoveButton.d.ts +1 -1
- package/__inner__/esm/components/Textarea/Textarea.css +3 -107
- package/__inner__/esm/components/Textarea/Textarea.d.ts +1 -59
- package/__inner__/esm/components/Textarea/Textarea.js +9 -63
- package/__inner__/esm/components/Textarea/components/TextareaConsumer.d.ts +3 -0
- package/__inner__/esm/components/Textarea/components/TextareaConsumer.js +32 -0
- package/__inner__/esm/components/Textarea/components/TextareaCounter.d.ts +7 -0
- package/__inner__/esm/components/Textarea/components/TextareaCounter.js +21 -0
- package/__inner__/esm/components/Textarea/components/index.d.ts +2 -0
- package/__inner__/esm/components/Textarea/components/index.js +2 -0
- package/__inner__/esm/components/Textarea/constants.d.ts +1 -0
- package/__inner__/esm/components/Textarea/constants.js +1 -0
- package/__inner__/esm/components/Textarea/index.d.ts +1 -0
- package/__inner__/esm/components/Textarea/index.js +1 -0
- package/__inner__/esm/components/Textarea/types.d.ts +69 -0
- package/__inner__/esm/components/Textarea/types.js +1 -0
- package/__inner__/esm/components/ThemeProvider/ThemeProvider.d.ts +2 -1
- package/__inner__/esm/components/ThemeProvider/types.d.ts +2 -0
- package/__inner__/esm/components/Tooltip/Tooltip.js +1 -1
- package/__inner__/esm/components/Tooltip/types.d.ts +1 -1
- package/__inner__/esm/hooks/useMultiRef/useMultiRef.d.ts +2 -3
- package/__inner__/esm/types/ResponsiveValue.d.ts +1 -1
- package/__inner__/esm/utils/isKey.d.ts +2 -2
- package/__inner__/esm/utils/polymorphicComponentWithRef.d.ts +0 -1
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
--textfield-background-color: var(--color-background-primary);
|
|
5
5
|
--textfield-border-width: var(--border-width-s);
|
|
6
6
|
--textfield-border-color: var(--color-border-main);
|
|
7
|
+
font: var(--textfield-input-font);
|
|
7
8
|
display: inline-flex;
|
|
8
9
|
vertical-align: top;
|
|
9
10
|
flex-direction: column;
|
|
@@ -21,19 +22,6 @@
|
|
|
21
22
|
inline-size: 100%;
|
|
22
23
|
box-sizing: border-box;
|
|
23
24
|
}
|
|
24
|
-
.Select-Fieldset {
|
|
25
|
-
position: absolute;
|
|
26
|
-
inset-block-end: 0;
|
|
27
|
-
inset-inline-end: 0;
|
|
28
|
-
inset-block-start: 0;
|
|
29
|
-
inset-inline-start: 0;
|
|
30
|
-
margin: 0;
|
|
31
|
-
padding: 0;
|
|
32
|
-
pointer-events: none;
|
|
33
|
-
border-radius: var(--border-radius-xs);
|
|
34
|
-
border: var(--textfield-border-width) solid var(--textfield-border-color);
|
|
35
|
-
transition: border var(--transition-default);
|
|
36
|
-
}
|
|
37
25
|
.Select-Body {
|
|
38
26
|
position: relative;
|
|
39
27
|
display: flex;
|
|
@@ -64,7 +52,6 @@
|
|
|
64
52
|
color: var(--textfield-color);
|
|
65
53
|
box-sizing: border-box;
|
|
66
54
|
block-size: var(--textfield-input-block-size);
|
|
67
|
-
font: var(--textfield-input-font);
|
|
68
55
|
align-items: center;
|
|
69
56
|
}
|
|
70
57
|
.Select-Field span {
|
|
@@ -176,7 +163,8 @@
|
|
|
176
163
|
}
|
|
177
164
|
.Select_animation-enter-active {
|
|
178
165
|
opacity: 1;
|
|
179
|
-
transition:
|
|
166
|
+
transition:
|
|
167
|
+
opacity var(--transition-default),
|
|
180
168
|
transform var(--transition-default);
|
|
181
169
|
transform: translate(0);
|
|
182
170
|
pointer-events: none;
|
|
@@ -192,7 +180,8 @@
|
|
|
192
180
|
}
|
|
193
181
|
.Select_animation-exit-active {
|
|
194
182
|
opacity: 0;
|
|
195
|
-
transition:
|
|
183
|
+
transition:
|
|
184
|
+
opacity var(--transition-default),
|
|
196
185
|
transform var(--transition-default);
|
|
197
186
|
transform: translate(0, calc(var(--space-s) * -1));
|
|
198
187
|
pointer-events: none;
|
|
@@ -10,6 +10,7 @@ var useMultiRef_1 = require("../../../../hooks/useMultiRef");
|
|
|
10
10
|
var FieldHint_1 = require("../../../FieldHint");
|
|
11
11
|
var FieldIcon_1 = require("../../../FieldIcon");
|
|
12
12
|
var FieldLabel_1 = require("../../../FieldLabel");
|
|
13
|
+
var Fieldset_1 = require("../../../Fieldset");
|
|
13
14
|
var index_1 = require("../../index");
|
|
14
15
|
exports.SelectInput = (0, react_1.forwardRef)(function (_a, ref) {
|
|
15
16
|
var _b = _a.size, size = _b === void 0 ? 'm' : _b, _c = _a.multiline, multiline = _c === void 0 ? false : _c, label = _a.label, error = _a.error, id = _a.id, name = _a.name, renderLeft = _a.renderLeft, renderRight = _a.renderRight, inputRef = _a.inputRef, fieldRef = _a.fieldRef, fullWidth = _a.fullWidth, disabled = _a.disabled, hint = _a.hint, required = _a.required, className = _a.className, inputProps = _a.inputProps, valueProp = _a.value, defaultValue = _a.defaultValue, onFocus = _a.onFocus, onBlur = _a.onBlur, onKeyDown = _a.onKeyDown, labelRef = _a.labelRef, labelProps = _a.labelProps, fieldProps = _a.fieldProps, onClick = _a.onClick, focused = _a.focused, placeholderProp = _a.placeholder, renderedValue = _a.renderedValue, bodyProps = _a.bodyProps, bodyRefProp = _a.bodyRef, open = _a.open, other = tslib_1.__rest(_a, ["size", "multiline", "label", "error", "id", "name", "renderLeft", "renderRight", "inputRef", "fieldRef", "fullWidth", "disabled", "hint", "required", "className", "inputProps", "value", "defaultValue", "onFocus", "onBlur", "onKeyDown", "labelRef", "labelProps", "fieldProps", "onClick", "focused", "placeholder", "renderedValue", "bodyProps", "bodyRef", "open"]);
|
|
@@ -35,7 +36,7 @@ exports.SelectInput = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
35
36
|
react_1["default"].createElement("input", tslib_1.__assign({ id: id, name: name, defaultValue: defaultValue, value: valueProp, disabled: disabled, required: required, tabIndex: -1, "aria-hidden": true, readOnly: true }, inputProps, { className: (0, index_1.cnSelect)('Input', [inputProps === null || inputProps === void 0 ? void 0 : inputProps.className]), ref: inputRef }))),
|
|
36
37
|
react_1["default"].createElement(FieldIcon_1.FieldIcon, { className: (0, index_1.cnSelect)('RenderRight'), icon: renderRight, size: size }),
|
|
37
38
|
react_1["default"].createElement(FieldIcon_1.FieldIcon, { className: (0, classnames_1.classnames)((0, index_1.cnSelect)('RenderRight'), (0, index_1.cnSelect)('DropDownIcon', { open: open })), icon: icons_1.ChevronDownIcon, size: size }),
|
|
38
|
-
react_1["default"].createElement(
|
|
39
|
+
react_1["default"].createElement(Fieldset_1.Fieldset, { className: (0, index_1.cnSelect)('Fieldset') })),
|
|
39
40
|
react_1["default"].createElement(FieldHint_1.FieldHint, { size: size, error: error, disabled: disabled }, hint)));
|
|
40
41
|
});
|
|
41
42
|
exports.SelectInput.displayName = 'SelectInput';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { HTMLAttributes } from 'react';
|
|
1
|
+
import type { HTMLAttributes, SyntheticEvent, ReactNode } from 'react';
|
|
3
2
|
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
4
3
|
import type { MenuProps } from '../Menu';
|
|
5
4
|
import type { SelectInputProps } from './components';
|
|
@@ -10,7 +9,7 @@ export type SelectedOptionProp = {
|
|
|
10
9
|
label?: SelectPropLabel;
|
|
11
10
|
value?: SelectPropValue;
|
|
12
11
|
};
|
|
13
|
-
export type SelectRenderValue = (option: SelectedOptionProp) =>
|
|
12
|
+
export type SelectRenderValue = (option: SelectedOptionProp) => ReactNode | null;
|
|
14
13
|
type SelectOpenControlledProps = {
|
|
15
14
|
/** Текущее состояние списка. Если `true`, список отображается. */
|
|
16
15
|
open?: boolean;
|
|
@@ -47,7 +46,7 @@ export type SelectProps = {
|
|
|
47
46
|
/** Рендер-функция для выбранного значения */
|
|
48
47
|
renderValue?: SelectRenderValue;
|
|
49
48
|
/** Содержимое компонента */
|
|
50
|
-
children?:
|
|
49
|
+
children?: ReactNode;
|
|
51
50
|
/** Свойства компонента Menu */
|
|
52
51
|
menuProps?: Omit<MenuProps, 'onClose' | 'open' | 'anchorRef'>;
|
|
53
52
|
/** Функция обратного вызова, которая будет вызвана когда компонент запрашивает закрытие */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ElementType, ComponentPropsWithRef, ChangeEvent } from 'react';
|
|
2
2
|
import type { PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
|
|
3
3
|
import type { TooltipProps } from '../Tooltip';
|
|
4
|
-
import { SLIDER_DEFAULT_TAG } from './constants';
|
|
4
|
+
import type { SLIDER_DEFAULT_TAG } from './constants';
|
|
5
5
|
export declare const sliderSizeVariant: readonly ["m", "l"];
|
|
6
6
|
export type SliderSizeVariant = (typeof sliderSizeVariant)[number];
|
|
7
7
|
export type SliderValue = number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SnackbarItemProps } from './components/SnackbarItem';
|
|
1
|
+
import type { SnackbarItemProps } from './components/SnackbarItem';
|
|
2
2
|
export declare const snackbarVerticalAlignVariant: readonly ["top", "bottom"];
|
|
3
3
|
export declare const snackbarHorizontalAlignVariant: readonly ["left", "center", "right"];
|
|
4
4
|
export declare const snackbarStatusVariant: readonly ["success", "info", "warning", "error"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
1
|
+
import type { FC } from 'react';
|
|
2
2
|
import type { IconProps } from '@ozen-ui/icons';
|
|
3
3
|
export declare const removeButtonSizeVariant: readonly ["s", "xs", "2xs"];
|
|
4
4
|
export type RemoveButtonSizeVariant = (typeof removeButtonSizeVariant)[number];
|
|
@@ -1,39 +1,13 @@
|
|
|
1
1
|
.Textarea {
|
|
2
|
-
--textfield-color: var(--color-content-primary);
|
|
3
|
-
--textfield-background-color: var(--color-background-primary);
|
|
4
|
-
--textfield-border-width: var(--border-width-s);
|
|
5
|
-
--textfield-border-color: var(--color-border-main);
|
|
6
2
|
--textfield-scroll-size: 12px;
|
|
7
|
-
min-block-size: var(--textfield-input-
|
|
8
|
-
display: inline-flex;
|
|
9
|
-
vertical-align: top;
|
|
10
|
-
flex-direction: column;
|
|
3
|
+
min-block-size: var(--textfield-input-height);
|
|
11
4
|
position: relative;
|
|
12
|
-
cursor: text;
|
|
13
5
|
}
|
|
14
6
|
|
|
15
|
-
.Textarea > * {
|
|
16
|
-
cursor: text;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
7
|
.Textarea-Label {
|
|
20
8
|
padding: 0 var(--textfield-gutter-x);
|
|
21
9
|
}
|
|
22
10
|
|
|
23
|
-
.Textarea-Fieldset {
|
|
24
|
-
position: absolute;
|
|
25
|
-
inset-block-end: 0;
|
|
26
|
-
inset-inline-end: 0;
|
|
27
|
-
inset-block-start: 0;
|
|
28
|
-
inset-inline-start: 0;
|
|
29
|
-
margin: 0;
|
|
30
|
-
padding: 0;
|
|
31
|
-
pointer-events: none;
|
|
32
|
-
border-radius: var(--border-radius-xs);
|
|
33
|
-
border: var(--textfield-border-width) solid var(--textfield-border-color);
|
|
34
|
-
transition: border var(--transition-default);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
11
|
.Textarea-Body,
|
|
38
12
|
.Textarea-Field {
|
|
39
13
|
transition: background-color var(--transition-slow);
|
|
@@ -50,10 +24,9 @@
|
|
|
50
24
|
transition: background-color var(--transition-slow);
|
|
51
25
|
color: var(--textfield-color);
|
|
52
26
|
border-radius: var(--border-radius-xs);
|
|
53
|
-
padding-block-start: 16px;
|
|
54
|
-
padding-block-end: 16px;
|
|
55
27
|
min-block-size: inherit;
|
|
56
28
|
block-size: inherit;
|
|
29
|
+
padding: var(--textfield-input-padding);
|
|
57
30
|
}
|
|
58
31
|
|
|
59
32
|
.Textarea-Field {
|
|
@@ -95,7 +68,7 @@
|
|
|
95
68
|
border: none;
|
|
96
69
|
display: flex;
|
|
97
70
|
outline: none;
|
|
98
|
-
font:
|
|
71
|
+
font: inherit;
|
|
99
72
|
background-color: var(--textfield-background-color);
|
|
100
73
|
color: var(--textfield-color);
|
|
101
74
|
padding: 0 var(--textfield-gutter-x);
|
|
@@ -126,80 +99,3 @@
|
|
|
126
99
|
resize: vertical;
|
|
127
100
|
overflow: hidden;
|
|
128
101
|
}
|
|
129
|
-
|
|
130
|
-
.Textarea_hasLabel .Textarea-Field::placeholder {
|
|
131
|
-
opacity: 0;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.Textarea_hasLabel .Textarea-Field:focus::placeholder {
|
|
135
|
-
opacity: 1;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.Textarea_hasLabel .Textarea-Body {
|
|
139
|
-
padding: var(--textfield-input-padding);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.Textarea_fullWidth {
|
|
143
|
-
inline-size: 100%;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.Textarea_size_2xs {
|
|
147
|
-
--textfield-gutter-x: 12px;
|
|
148
|
-
--textfield-input-block-size: 32px;
|
|
149
|
-
--textfield-input-font: var(--typography-text-2xs-font);
|
|
150
|
-
--textfield-input-padding: 8px 0 8px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.Textarea_size_xs {
|
|
154
|
-
--textfield-gutter-x: 12px;
|
|
155
|
-
--textfield-input-block-size: 40px;
|
|
156
|
-
--textfield-input-font: var(--typography-text-xs-font);
|
|
157
|
-
--textfield-input-padding: 19px 0 4px;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.Textarea_size_s {
|
|
161
|
-
--textfield-gutter-x: 16px;
|
|
162
|
-
--textfield-input-block-size: 48px;
|
|
163
|
-
--textfield-input-font: var(--typography-text-s-font);
|
|
164
|
-
--textfield-input-padding: 21px 0 6px;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.Textarea_size_m {
|
|
168
|
-
--textfield-gutter-x: 20px;
|
|
169
|
-
--textfield-input-block-size: 56px;
|
|
170
|
-
--textfield-input-font: var(--typography-text-m-font);
|
|
171
|
-
--textfield-input-padding: 24px 0 6px;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.Textarea_size_l {
|
|
175
|
-
--textfield-gutter-x: 24px;
|
|
176
|
-
--textfield-input-block-size: 64px;
|
|
177
|
-
--textfield-input-font: var(--typography-text-l-font);
|
|
178
|
-
--textfield-input-padding: 26px 0 6px;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.Textarea:hover {
|
|
182
|
-
--textfield-border-color: var(--color-border-main-hover);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.Textarea_focused,
|
|
186
|
-
.Textarea_focused:hover {
|
|
187
|
-
--textfield-border-width: var(--border-width-m);
|
|
188
|
-
--textfield-background-color: var(--color-background-main);
|
|
189
|
-
--textfield-border-color: var(--color-border-action);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.Textarea_error,
|
|
193
|
-
.Textarea_error.Textarea:hover,
|
|
194
|
-
.Textarea_error.Textarea_focused,
|
|
195
|
-
.Textarea_error.Textarea_focused:hover {
|
|
196
|
-
--textfield-border-color: var(--color-border-error);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
.Textarea_disabled {
|
|
200
|
-
--textfield-border-color: var(--color-border-disabled);
|
|
201
|
-
--textfield-background-color: var(--color-background-disabled);
|
|
202
|
-
--textfield-color: var(--color-content-secondary);
|
|
203
|
-
pointer-events: none;
|
|
204
|
-
cursor: default;
|
|
205
|
-
}
|
|
@@ -1,63 +1,5 @@
|
|
|
1
1
|
import './Textarea.css';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type {
|
|
4
|
-
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
5
|
-
import { type FieldLabelProps } from '../FieldLabel';
|
|
3
|
+
import type { TextareaProps } from './index';
|
|
6
4
|
export declare const cnTextarea: import("@bem-react/classname").ClassNameFormatter;
|
|
7
|
-
export type TextareaSizeVariant = FormElementSizeVariant;
|
|
8
|
-
export declare const textareaExpandVariant: readonly ["autoSize", "verticalResize"];
|
|
9
|
-
export type TextareaExpandVariant = (typeof textareaExpandVariant)[number];
|
|
10
|
-
type TextareaElement = TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
11
|
-
export type TextareaProps = {
|
|
12
|
-
/** Атрибут id для элемента input */
|
|
13
|
-
id?: string;
|
|
14
|
-
/** Атрибут name для элемента input */
|
|
15
|
-
name?: string;
|
|
16
|
-
/** Лейбл */
|
|
17
|
-
label?: string;
|
|
18
|
-
/** Размер компонента */
|
|
19
|
-
size?: TextareaSizeVariant;
|
|
20
|
-
/** Подсказка. Отображается, когда вариант не выбран */
|
|
21
|
-
placeholder?: string;
|
|
22
|
-
/** Если {true} устанавливает автофокус */
|
|
23
|
-
autoFocus?: boolean;
|
|
24
|
-
/** Если {true} переводит поле в состояние ошибки */
|
|
25
|
-
error?: boolean;
|
|
26
|
-
/** Если {true} растягивает поле на всю ширину */
|
|
27
|
-
fullWidth?: boolean;
|
|
28
|
-
/** Дополнительное описание к полю */
|
|
29
|
-
hint?: string | null | undefined;
|
|
30
|
-
/** Если {true} делает элемент неактивным */
|
|
31
|
-
disabled?: boolean;
|
|
32
|
-
/** Если {true} делает элемент обязательным к заполнению */
|
|
33
|
-
required?: boolean;
|
|
34
|
-
/** Устанавливает максимальное число символов, которое может быть введено пользователем в текстовом поле. */
|
|
35
|
-
maxLength?: number;
|
|
36
|
-
/** Количество колонок */
|
|
37
|
-
cols?: number;
|
|
38
|
-
/** Количество строк */
|
|
39
|
-
rows?: number;
|
|
40
|
-
/** Расширяемость поля */
|
|
41
|
-
expand?: TextareaExpandVariant;
|
|
42
|
-
/** Выбранное значение */
|
|
43
|
-
value?: string;
|
|
44
|
-
/** Значение по умолчанию (неконтролируемый компонент) */
|
|
45
|
-
defaultValue?: string;
|
|
46
|
-
/** Обработчик события на изменение значения поля */
|
|
47
|
-
onChange?: TextareaElement['onChange'];
|
|
48
|
-
/** Ссылка на элемент textarea */
|
|
49
|
-
textareaRef?: Ref<HTMLTextAreaElement>;
|
|
50
|
-
/** Свойства элемента textarea */
|
|
51
|
-
textareaProps?: TextareaElement & {
|
|
52
|
-
'data-testid'?: string;
|
|
53
|
-
};
|
|
54
|
-
/** Ссылка на FieldLabel */
|
|
55
|
-
labelRef?: FieldLabelProps['ref'];
|
|
56
|
-
/** Свойства FieldLabel */
|
|
57
|
-
labelProps?: FieldLabelProps;
|
|
58
|
-
/** Ссылка на корневой DOM-элемент компонента */
|
|
59
|
-
ref?: Ref<HTMLDivElement>;
|
|
60
|
-
'data-testid'?: string;
|
|
61
|
-
} & Omit<HTMLAttributes<HTMLDivElement>, 'value' | 'defaultValue' | 'onChange'>;
|
|
62
5
|
export declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
63
|
-
export {};
|
|
@@ -1,78 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
exports.__esModule = true;
|
|
3
|
-
exports.Textarea = exports.
|
|
3
|
+
exports.Textarea = exports.cnTextarea = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
require("./Textarea.css");
|
|
6
6
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
-
var useMultiRef_1 = require("../../hooks/useMultiRef");
|
|
8
7
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
9
8
|
var classname_1 = require("../../utils/classname");
|
|
10
|
-
var
|
|
11
|
-
var
|
|
9
|
+
var FieldControl_1 = require("../FieldControl");
|
|
10
|
+
var components_1 = require("./components");
|
|
11
|
+
var constants_1 = require("./constants");
|
|
12
12
|
exports.cnTextarea = (0, classname_1.cn)('Textarea');
|
|
13
|
-
exports.textareaExpandVariant = ['autoSize', 'verticalResize'];
|
|
14
13
|
exports.Textarea = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
15
14
|
var props = (0, useThemeProps_1.useThemeProps)({
|
|
16
15
|
props: inProps,
|
|
17
16
|
name: 'Textarea'
|
|
18
17
|
});
|
|
19
|
-
var _a = props.size, size = _a === void 0 ?
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _b = tslib_1.__read((0, react_1.useState)(), 2), focused = _b[0], setFocused = _b[1];
|
|
23
|
-
var _c = tslib_1.__read((0, react_1.useState)(defaultValue), 2), valueState = _c[0], setValueState = _c[1];
|
|
24
|
-
var filled = isControlled ? !!valueProp : !!valueState;
|
|
25
|
-
// autoSize
|
|
26
|
-
(0, react_1.useEffect)(function () {
|
|
27
|
-
if (fieldRef.current && expand === 'autoSize') {
|
|
28
|
-
fieldRef.current.style.blockSize = '0px';
|
|
29
|
-
var scrollHeight = fieldRef.current.scrollHeight;
|
|
30
|
-
fieldRef.current.style.blockSize = "".concat(scrollHeight, "px");
|
|
31
|
-
}
|
|
32
|
-
}, [valueProp, valueState]);
|
|
33
|
-
// maxLength
|
|
34
|
-
var counter = (0, react_1.useMemo)(function () {
|
|
35
|
-
var _a;
|
|
36
|
-
var value = valueProp || valueState;
|
|
37
|
-
return maxLength ? "".concat((_a = value === null || value === void 0 ? void 0 : value.length) !== null && _a !== void 0 ? _a : 0, " / ").concat(maxLength) : undefined;
|
|
38
|
-
}, [maxLength, valueProp, valueState]);
|
|
39
|
-
var handleFocus = (0, react_1.useCallback)(function (e) {
|
|
40
|
-
var _a;
|
|
41
|
-
setFocused(true);
|
|
42
|
-
(_a = textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps.onFocus) === null || _a === void 0 ? void 0 : _a.call(textareaProps, e);
|
|
43
|
-
}, [textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps.onFocus]);
|
|
44
|
-
var handleBlur = (0, react_1.useCallback)(function (e) {
|
|
45
|
-
var _a;
|
|
46
|
-
setFocused(false);
|
|
47
|
-
(_a = textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps.onBlur) === null || _a === void 0 ? void 0 : _a.call(textareaProps, e);
|
|
48
|
-
}, [textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps.onBlur]);
|
|
49
|
-
var handleChange = (0, react_1.useCallback)(function (e) {
|
|
50
|
-
if (disabled)
|
|
51
|
-
return;
|
|
52
|
-
var value = e.target.value;
|
|
53
|
-
if (!isControlled || maxLength || expand === 'autoSize') {
|
|
54
|
-
setValueState(value);
|
|
55
|
-
}
|
|
56
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
57
|
-
}, [onChange, isControlled, disabled, maxLength, expand]);
|
|
58
|
-
return (react_1["default"].createElement("div", tslib_1.__assign({}, other, { className: (0, exports.cnTextarea)({
|
|
59
|
-
size: size,
|
|
60
|
-
required: required,
|
|
61
|
-
fullWidth: fullWidth,
|
|
62
|
-
error: error,
|
|
63
|
-
disabled: disabled,
|
|
64
|
-
hasLabel: !!label,
|
|
65
|
-
expand: expand,
|
|
66
|
-
focused: focused
|
|
18
|
+
var _a = props.size, size = _a === void 0 ? constants_1.TEXTAREA_DEFAULT_SIZE : _a, autoFocus = props.autoFocus, maxLength = props.maxLength, expand = props.expand, placeholder = props.placeholder, id = props.id, name = props.name, error = props.error, fullWidth = props.fullWidth, cols = props.cols, rows = props.rows, className = props.className, label = props.label, hint = props.hint, value = props.value, defaultValue = props.defaultValue, onChange = props.onChange, required = props.required, textareaRef = props.textareaRef, disabled = props.disabled, textareaProps = props.textareaProps, labelRef = props.labelRef, labelProps = props.labelProps, other = tslib_1.__rest(props, ["size", "autoFocus", "maxLength", "expand", "placeholder", "id", "name", "error", "fullWidth", "cols", "rows", "className", "label", "hint", "value", "defaultValue", "onChange", "required", "textareaRef", "disabled", "textareaProps", "labelRef", "labelProps"]);
|
|
19
|
+
return (react_1["default"].createElement(FieldControl_1.FieldControl, tslib_1.__assign({ size: size, error: error, disabled: disabled, required: required, fullWidth: fullWidth }, other, { className: (0, exports.cnTextarea)({
|
|
20
|
+
expand: expand
|
|
67
21
|
}, [className]), ref: ref }),
|
|
68
|
-
react_1["default"].createElement(
|
|
69
|
-
label && (react_1["default"].createElement(FieldLabel_1.FieldLabel, tslib_1.__assign({ filled: filled, focused: focused, required: required, disabled: disabled, size: size }, labelProps, { className: (0, exports.cnTextarea)('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelRef }), label)),
|
|
70
|
-
react_1["default"].createElement("textarea", tslib_1.__assign({ id: id, name: name, cols: cols, rows: rows, disabled: disabled, value: valueProp, required: required, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder, autoFocus: autoFocus }, textareaProps, { className: (0, exports.cnTextarea)('Field', { filled: filled }, [
|
|
71
|
-
textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps.className,
|
|
72
|
-
]), onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, ref: (0, useMultiRef_1.useMultiRef)([textareaRef, fieldRef]) })),
|
|
73
|
-
react_1["default"].createElement("fieldset", { className: (0, exports.cnTextarea)('Fieldset') })),
|
|
74
|
-
(hint || maxLength) && (react_1["default"].createElement(FieldHint_1.FieldHint, { size: size, error: error, disabled: disabled },
|
|
75
|
-
hint,
|
|
76
|
-
maxLength && (react_1["default"].createElement("span", { className: (0, exports.cnTextarea)('Counter', { disabled: disabled }) }, counter))))));
|
|
22
|
+
react_1["default"].createElement(components_1.TextareaConsumer, { autoFocus: autoFocus, maxLength: maxLength, placeholder: placeholder, id: id, name: name, cols: cols, expand: expand, rows: rows, label: label, hint: hint, value: value, defaultValue: defaultValue, onChange: onChange, textareaRef: textareaRef, textareaProps: textareaProps, labelRef: labelRef, labelProps: labelProps })));
|
|
77
23
|
});
|
|
78
24
|
exports.Textarea.displayName = 'Textarea';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.TextareaConsumer = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
var useMultiRef_1 = require("../../../hooks/useMultiRef");
|
|
7
|
+
var FieldControl_1 = require("../../FieldControl");
|
|
8
|
+
var FieldHint_1 = require("../../FieldHint");
|
|
9
|
+
var FieldInput_1 = require("../../FieldInput");
|
|
10
|
+
var FieldLabel_1 = require("../../FieldLabel");
|
|
11
|
+
var Fieldset_1 = require("../../Fieldset");
|
|
12
|
+
var Textarea_1 = require("../../Textarea");
|
|
13
|
+
var index_1 = require("./index");
|
|
14
|
+
var TextareaConsumer = function (_a) {
|
|
15
|
+
var labelProps = _a.labelProps, labelRef = _a.labelRef, maxLength = _a.maxLength, label = _a.label, id = _a.id, name = _a.name, cols = _a.cols, rows = _a.rows, disabled = _a.disabled, valueProp = _a.value, required = _a.required, defaultValue = _a.defaultValue, placeholder = _a.placeholder, autoFocus = _a.autoFocus, textareaProps = _a.textareaProps, onChange = _a.onChange, textareaRef = _a.textareaRef, expand = _a.expand, hint = _a.hint;
|
|
16
|
+
var fieldRef = (0, react_1.useRef)(null);
|
|
17
|
+
var context = (0, react_1.useContext)(FieldControl_1.FieldControlContext);
|
|
18
|
+
var _b = tslib_1.__read(context, 1), value = _b[0].value;
|
|
19
|
+
// autoSize
|
|
20
|
+
(0, react_1.useEffect)(function () {
|
|
21
|
+
if (fieldRef.current && expand === 'autoSize') {
|
|
22
|
+
fieldRef.current.style.blockSize = '0px';
|
|
23
|
+
var scrollHeight = fieldRef.current.scrollHeight;
|
|
24
|
+
fieldRef.current.style.blockSize = "".concat(scrollHeight, "px");
|
|
25
|
+
}
|
|
26
|
+
}, [value]);
|
|
27
|
+
return (react_1["default"].createElement(react_1["default"].Fragment, null,
|
|
28
|
+
react_1["default"].createElement("label", { className: (0, Textarea_1.cnTextarea)('Body') },
|
|
29
|
+
react_1["default"].createElement(FieldLabel_1.FieldLabel, tslib_1.__assign({}, labelProps, { className: (0, Textarea_1.cnTextarea)('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelRef || (labelProps === null || labelProps === void 0 ? void 0 : labelProps.ref) }), label),
|
|
30
|
+
react_1["default"].createElement(FieldInput_1.FieldInput, tslib_1.__assign({ as: "textarea", id: id, name: name, cols: cols, rows: rows, disabled: disabled, value: valueProp, required: required, defaultValue: defaultValue, maxLength: maxLength, placeholder: placeholder, autoFocus: autoFocus, onChange: onChange }, textareaProps, { className: (0, Textarea_1.cnTextarea)('Field', {}, [textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps.className]), ref: (0, useMultiRef_1.useMultiRef)([textareaRef || (textareaProps === null || textareaProps === void 0 ? void 0 : textareaProps.ref), fieldRef]) })),
|
|
31
|
+
react_1["default"].createElement(Fieldset_1.Fieldset, null)),
|
|
32
|
+
react_1["default"].createElement(FieldHint_1.FieldHint, null,
|
|
33
|
+
hint,
|
|
34
|
+
maxLength && react_1["default"].createElement(index_1.TextareaCounter, { maxLength: maxLength }))));
|
|
35
|
+
};
|
|
36
|
+
exports.TextareaConsumer = TextareaConsumer;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, FC } from 'react';
|
|
2
|
+
import type { TextareaProps } from '../index';
|
|
3
|
+
export type TextareaCounter = ComponentPropsWithRef<'span'> & {
|
|
4
|
+
maxLength: TextareaProps['maxLength'];
|
|
5
|
+
disabled?: TextareaProps['disabled'];
|
|
6
|
+
};
|
|
7
|
+
export declare const TextareaCounter: FC<TextareaCounter>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.TextareaCounter = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
var FieldControl_1 = require("../../FieldControl");
|
|
7
|
+
var index_1 = require("../index");
|
|
8
|
+
var TextareaCounter = function (_a) {
|
|
9
|
+
var _b, _c, _d;
|
|
10
|
+
var maxLength = _a.maxLength, disabledProp = _a.disabled;
|
|
11
|
+
var context = (0, react_1.useContext)(FieldControl_1.FieldControlContext);
|
|
12
|
+
var _e = tslib_1.__read(context, 1), fieldControl = _e[0];
|
|
13
|
+
var disabled = disabledProp;
|
|
14
|
+
// maxLength
|
|
15
|
+
var counter = maxLength
|
|
16
|
+
? "".concat((_d = (_c = (_b = fieldControl.value) === null || _b === void 0 ? void 0 : _b.toString()) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0, " / ").concat(maxLength)
|
|
17
|
+
: undefined;
|
|
18
|
+
if (fieldControl) {
|
|
19
|
+
if (disabled === undefined && fieldControl.disabled) {
|
|
20
|
+
disabled = fieldControl.disabled;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return react_1["default"].createElement("span", { className: (0, index_1.cnTextarea)('Counter', { disabled: disabled }) }, counter);
|
|
24
|
+
};
|
|
25
|
+
exports.TextareaCounter = TextareaCounter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const TEXTAREA_DEFAULT_SIZE = "m";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Ref, ComponentPropsWithRef, ComponentRef } from 'react';
|
|
2
|
+
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
3
|
+
import type { FIELD_CONTROL_DEFAULT_TAG } from '../FieldControl';
|
|
4
|
+
import type { FieldLabelProps } from '../FieldLabel';
|
|
5
|
+
export type TextareaSizeVariant = FormElementSizeVariant;
|
|
6
|
+
export declare const textareaExpandVariant: readonly ["autoSize", "verticalResize"];
|
|
7
|
+
export type TextareaExpandVariant = (typeof textareaExpandVariant)[number];
|
|
8
|
+
type TextareaPropsDeprecated = {
|
|
9
|
+
/**
|
|
10
|
+
* deprecated
|
|
11
|
+
* Ссылка на FieldLabel
|
|
12
|
+
* */
|
|
13
|
+
labelRef?: FieldLabelProps['ref'];
|
|
14
|
+
/**
|
|
15
|
+
* deprecated
|
|
16
|
+
* Ссылка на элемент textarea
|
|
17
|
+
* */
|
|
18
|
+
textareaRef?: Ref<HTMLTextAreaElement>;
|
|
19
|
+
};
|
|
20
|
+
type TextareaElement = ComponentPropsWithRef<'textarea'>;
|
|
21
|
+
export type TextareaProps = Omit<ComponentPropsWithRef<typeof FIELD_CONTROL_DEFAULT_TAG>, 'size' | 'onChange'> & {
|
|
22
|
+
/** Атрибут id для элемента input */
|
|
23
|
+
id?: string;
|
|
24
|
+
/** Атрибут name для элемента input */
|
|
25
|
+
name?: string;
|
|
26
|
+
/** Лейбл */
|
|
27
|
+
label?: string;
|
|
28
|
+
/** Размер компонента */
|
|
29
|
+
size?: TextareaSizeVariant;
|
|
30
|
+
/** Подсказка. Отображается, когда вариант не выбран */
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
/** Если {true} устанавливает автофокус */
|
|
33
|
+
autoFocus?: boolean;
|
|
34
|
+
/** Если {true} переводит поле в состояние ошибки */
|
|
35
|
+
error?: boolean;
|
|
36
|
+
/** Если {true} растягивает поле на всю ширину */
|
|
37
|
+
fullWidth?: boolean;
|
|
38
|
+
/** Дополнительное описание к полю */
|
|
39
|
+
hint?: string | null | undefined;
|
|
40
|
+
/** Если {true} делает элемент неактивным */
|
|
41
|
+
disabled?: boolean;
|
|
42
|
+
/** Если {true} делает элемент обязательным к заполнению */
|
|
43
|
+
required?: boolean;
|
|
44
|
+
/** Устанавливает максимальное число символов, которое может быть введено пользователем в текстовом поле. */
|
|
45
|
+
maxLength?: number;
|
|
46
|
+
/** Количество колонок */
|
|
47
|
+
cols?: number;
|
|
48
|
+
/** Количество строк */
|
|
49
|
+
rows?: number;
|
|
50
|
+
/** Расширяемость поля */
|
|
51
|
+
expand?: TextareaExpandVariant;
|
|
52
|
+
/** Выбранное значение */
|
|
53
|
+
value?: string;
|
|
54
|
+
/** Значение по умолчанию (неконтролируемый компонент) */
|
|
55
|
+
defaultValue?: string;
|
|
56
|
+
/** Обработчик события на изменение значения поля */
|
|
57
|
+
onChange?: TextareaElement['onChange'];
|
|
58
|
+
/** Свойства элемента textarea */
|
|
59
|
+
textareaProps?: TextareaElement & {
|
|
60
|
+
'data-testid'?: string;
|
|
61
|
+
};
|
|
62
|
+
/** Свойства FieldLabel */
|
|
63
|
+
labelProps?: FieldLabelProps;
|
|
64
|
+
/** Ссылка на корневой DOM-элемент компонента */
|
|
65
|
+
ref?: ComponentRef<typeof FIELD_CONTROL_DEFAULT_TAG>;
|
|
66
|
+
/** data-атрибут для тестирования */
|
|
67
|
+
'data-testid'?: string;
|
|
68
|
+
} & TextareaPropsDeprecated;
|
|
69
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './ThemeProvider.css';
|
|
2
|
-
import
|
|
2
|
+
import type { ComponentRef, ElementType } from 'react';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import { type PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
|
|
4
5
|
import type { Theme } from './types';
|
|
5
6
|
export declare const THEME_DEFAULT_TAG = "div";
|
|
@@ -12,6 +12,7 @@ import type { CollapseProps } from '../Collapse';
|
|
|
12
12
|
import type { ContainerProps } from '../Container';
|
|
13
13
|
import type { DataListProps } from '../DataList';
|
|
14
14
|
import type { DividerProps } from '../Divider';
|
|
15
|
+
import type { FieldControlProps } from '../FieldControl';
|
|
15
16
|
import type { FileProps } from '../File';
|
|
16
17
|
import type { FilePickerProps } from '../FilePicker';
|
|
17
18
|
import type { FormGroupProps } from '../FormGroup';
|
|
@@ -72,6 +73,7 @@ export type Theme = {
|
|
|
72
73
|
Container?: Partial<ContainerProps>;
|
|
73
74
|
DataList?: Partial<DataListProps>;
|
|
74
75
|
Divider?: Partial<DividerProps>;
|
|
76
|
+
FieldControl?: Partial<FieldControlProps>;
|
|
75
77
|
File?: Partial<FileProps>;
|
|
76
78
|
FilePicker?: Partial<FilePickerProps>;
|
|
77
79
|
FormGroup?: Partial<FormGroupProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref, ReactNode, ReactElement, ComponentPropsWithRef } from 'react';
|
|
2
2
|
import type { PopoverBaseProps } from '../Popover';
|
|
3
|
-
import { TOOLTIP_DEFAULT_TAG } from './constants';
|
|
3
|
+
import type { TOOLTIP_DEFAULT_TAG } from './constants';
|
|
4
4
|
export declare const tooltipSizeVariant: readonly ["xs", "s"];
|
|
5
5
|
export type TooltipSizeVariant = (typeof tooltipSizeVariant)[number];
|
|
6
6
|
export declare const tooltipVariant: readonly ["light", "dark"];
|