@ozen-ui/kit 0.41.0 → 0.43.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/README.md +1 -1
- package/__inner__/cjs/components/Accordion/Accordion.css +1 -1
- package/__inner__/cjs/components/Alert/Alert.css +40 -21
- package/__inner__/cjs/components/Alert/Alert.d.ts +3 -1
- package/__inner__/cjs/components/Alert/Alert.js +5 -5
- package/__inner__/cjs/components/Autocomplete/components/AutocompleteRenderRight/AutocompleteRenderRight.js +3 -3
- package/__inner__/cjs/components/Autocomplete/helper.d.ts +2 -0
- package/__inner__/cjs/components/Autocomplete/types.d.ts +2 -2
- package/__inner__/cjs/components/Breadcrumbs/components/BreadcrumbItem.d.ts +1 -1
- package/__inner__/cjs/components/Button/Button.css +7 -1
- package/__inner__/cjs/components/ButtonNext/Button.css +7 -1
- package/__inner__/cjs/components/DataList/DataList.js +3 -1
- package/__inner__/cjs/components/Dialog/Dialog.css +1 -1
- package/__inner__/cjs/components/Dialog/Dialog.d.ts +1 -1
- package/__inner__/cjs/components/Dialog/Dialog.js +3 -3
- package/__inner__/cjs/components/Drawer/Drawer.css +9 -4
- package/__inner__/cjs/components/Drawer/Drawer.d.ts +1 -1
- package/__inner__/cjs/components/Drawer/Drawer.js +4 -4
- package/__inner__/cjs/components/FieldControl/FieldControl.css +6 -6
- package/__inner__/cjs/components/File/File.css +3 -3
- package/__inner__/cjs/components/FilePicker/FilePicker.d.ts +4 -2
- package/__inner__/cjs/components/FilePicker/FilePicker.js +2 -2
- package/__inner__/cjs/components/FilePicker/types.d.ts +4 -1
- package/__inner__/cjs/components/IconButton/IconButton.css +7 -1
- package/__inner__/cjs/components/IconButtonNext/IconButton.css +9 -1
- package/__inner__/cjs/components/IconButtonNext/IconButton.d.ts +1 -2
- package/__inner__/cjs/components/Indicator/Indicator.d.ts +1 -1
- package/__inner__/cjs/components/Input/Input.js +2 -2
- package/__inner__/cjs/components/Input/types.d.ts +3 -0
- package/__inner__/cjs/components/InputNumber/InputNumber.css +3 -3
- package/__inner__/cjs/components/InputNumber/InputNumber.js +5 -5
- package/__inner__/cjs/components/InputNumber/types.d.ts +4 -1
- package/__inner__/cjs/components/List/List.css +13 -9
- package/__inner__/cjs/components/Menu/Menu.d.ts +7 -0
- package/__inner__/cjs/components/Menu/Menu.js +12 -5
- package/__inner__/cjs/components/Menu/constants.d.ts +1 -0
- package/__inner__/cjs/components/Menu/constants.js +4 -0
- package/__inner__/cjs/components/Modal/components/ModalConsumer.js +1 -1
- package/__inner__/cjs/components/Pagination/Pagination.css +9 -9
- package/__inner__/cjs/components/Pagination/Pagination.d.ts +2 -2
- package/__inner__/cjs/components/Pagination/Pagination.js +21 -11
- package/__inner__/cjs/components/Pagination/components/PaginationItem/PaginationItem.css +21 -15
- package/__inner__/cjs/components/Pagination/components/PaginationItem/PaginationItem.js +7 -6
- package/__inner__/cjs/components/Pagination/constants.d.ts +4 -0
- package/__inner__/cjs/components/Pagination/constants.js +5 -1
- package/__inner__/cjs/components/Pagination/helpers/getItemAriaLabel/getItemAriaLabel.js +4 -4
- package/__inner__/cjs/components/Pagination/types.d.ts +6 -3
- package/__inner__/cjs/components/Paper/Paper.css +4 -0
- package/__inner__/cjs/components/Paper/Paper.d.ts +1 -1
- package/__inner__/cjs/components/Paper/Paper.js +1 -1
- package/__inner__/cjs/components/Popover/Popover.js +1 -1
- package/__inner__/cjs/components/SectionMessage/SectionMessage.css +9 -5
- package/__inner__/cjs/components/SectionMessage/SectionMessage.d.ts +1 -1
- package/__inner__/cjs/components/Segment/Segment.css +20 -5
- package/__inner__/cjs/components/Segment/components/SegmentItem.css +17 -14
- package/__inner__/cjs/components/Select/Select.js +2 -2
- package/__inner__/cjs/components/Select/components/SelectInput/SelectInput.js +2 -2
- package/__inner__/cjs/components/Select/components/SelectInput/types.d.ts +5 -1
- package/__inner__/cjs/components/Select/types.d.ts +2 -2
- package/__inner__/cjs/components/Tabs/components/ScrollButton/ScrollButton.css +13 -49
- package/__inner__/cjs/components/Tabs/components/ScrollButton/ScrollButton.d.ts +3 -3
- package/__inner__/cjs/components/Tabs/components/ScrollButton/ScrollButton.js +2 -2
- package/__inner__/cjs/components/Tabs/components/Tab/Tab.css +6 -2
- package/__inner__/cjs/components/Tag/Tag.css +9 -6
- package/__inner__/cjs/components/Textarea/Textarea.js +2 -2
- package/__inner__/cjs/components/Textarea/components/TextareaConsumer.js +2 -2
- package/__inner__/cjs/components/Textarea/types.d.ts +4 -1
- package/__inner__/cjs/components/Tooltip/Tooltip.js +1 -1
- package/__inner__/cjs/locale/locale.js +67 -0
- package/__inner__/cjs/utils/getPaperSizeToFormElement.d.ts +3 -0
- package/__inner__/cjs/utils/getPaperSizeToFormElement.js +12 -0
- package/__inner__/esm/components/Accordion/Accordion.css +1 -1
- package/__inner__/esm/components/Alert/Alert.css +40 -21
- package/__inner__/esm/components/Alert/Alert.d.ts +3 -1
- package/__inner__/esm/components/Alert/Alert.js +5 -5
- package/__inner__/esm/components/Autocomplete/Autocomplete.js +2 -2
- package/__inner__/esm/components/Autocomplete/components/AutocompleteRenderRight/AutocompleteRenderRight.js +1 -1
- package/__inner__/esm/components/Autocomplete/helper.d.ts +2 -0
- package/__inner__/esm/components/Autocomplete/types.d.ts +2 -2
- package/__inner__/esm/components/Breadcrumbs/components/BreadcrumbItem.d.ts +1 -1
- package/__inner__/esm/components/Button/Button.css +7 -1
- package/__inner__/esm/components/ButtonNext/Button.css +7 -1
- package/__inner__/esm/components/DataList/DataList.js +3 -1
- package/__inner__/esm/components/Dialog/Dialog.css +1 -1
- package/__inner__/esm/components/Dialog/Dialog.d.ts +1 -1
- package/__inner__/esm/components/Dialog/Dialog.js +2 -2
- package/__inner__/esm/components/Drawer/Drawer.css +9 -4
- package/__inner__/esm/components/Drawer/Drawer.d.ts +1 -1
- package/__inner__/esm/components/Drawer/Drawer.js +3 -3
- package/__inner__/esm/components/FieldControl/FieldControl.css +6 -6
- package/__inner__/esm/components/File/File.css +3 -3
- package/__inner__/esm/components/FilePicker/FilePicker.d.ts +4 -2
- package/__inner__/esm/components/FilePicker/FilePicker.js +4 -4
- package/__inner__/esm/components/FilePicker/types.d.ts +4 -1
- package/__inner__/esm/components/IconButton/IconButton.css +7 -1
- package/__inner__/esm/components/IconButtonNext/IconButton.css +9 -1
- package/__inner__/esm/components/IconButtonNext/IconButton.d.ts +1 -2
- package/__inner__/esm/components/Indicator/Indicator.d.ts +1 -1
- package/__inner__/esm/components/Input/Input.js +2 -2
- package/__inner__/esm/components/Input/types.d.ts +3 -0
- package/__inner__/esm/components/InputNumber/InputNumber.css +3 -3
- package/__inner__/esm/components/InputNumber/InputNumber.js +6 -6
- package/__inner__/esm/components/InputNumber/types.d.ts +4 -1
- package/__inner__/esm/components/List/List.css +13 -9
- package/__inner__/esm/components/Menu/Menu.d.ts +7 -0
- package/__inner__/esm/components/Menu/Menu.js +12 -5
- package/__inner__/esm/components/Menu/constants.d.ts +1 -0
- package/__inner__/esm/components/Menu/constants.js +1 -0
- package/__inner__/esm/components/Modal/components/ModalConsumer.js +1 -1
- package/__inner__/esm/components/Pagination/Pagination.css +9 -9
- package/__inner__/esm/components/Pagination/Pagination.d.ts +2 -2
- package/__inner__/esm/components/Pagination/Pagination.js +23 -13
- package/__inner__/esm/components/Pagination/components/PaginationItem/PaginationItem.css +21 -15
- package/__inner__/esm/components/Pagination/components/PaginationItem/PaginationItem.js +8 -7
- package/__inner__/esm/components/Pagination/constants.d.ts +4 -0
- package/__inner__/esm/components/Pagination/constants.js +4 -0
- package/__inner__/esm/components/Pagination/helpers/getItemAriaLabel/getItemAriaLabel.js +4 -4
- package/__inner__/esm/components/Pagination/types.d.ts +6 -3
- package/__inner__/esm/components/Paper/Paper.css +4 -0
- package/__inner__/esm/components/Paper/Paper.d.ts +1 -1
- package/__inner__/esm/components/Paper/Paper.js +1 -1
- package/__inner__/esm/components/Popover/Popover.js +1 -1
- package/__inner__/esm/components/SectionMessage/SectionMessage.css +9 -5
- package/__inner__/esm/components/SectionMessage/SectionMessage.d.ts +1 -1
- package/__inner__/esm/components/Segment/Segment.css +20 -5
- package/__inner__/esm/components/Segment/components/SegmentItem.css +17 -14
- package/__inner__/esm/components/Select/Select.js +3 -3
- package/__inner__/esm/components/Select/components/SelectInput/SelectInput.js +2 -2
- package/__inner__/esm/components/Select/components/SelectInput/types.d.ts +5 -1
- package/__inner__/esm/components/Select/types.d.ts +2 -2
- package/__inner__/esm/components/Tabs/components/ScrollButton/ScrollButton.css +13 -49
- package/__inner__/esm/components/Tabs/components/ScrollButton/ScrollButton.d.ts +3 -3
- package/__inner__/esm/components/Tabs/components/ScrollButton/ScrollButton.js +2 -2
- package/__inner__/esm/components/Tabs/components/Tab/Tab.css +6 -2
- package/__inner__/esm/components/Tag/Tag.css +9 -6
- package/__inner__/esm/components/Textarea/Textarea.js +2 -2
- package/__inner__/esm/components/Textarea/components/TextareaConsumer.js +2 -2
- package/__inner__/esm/components/Textarea/types.d.ts +4 -1
- package/__inner__/esm/components/Tooltip/Tooltip.js +1 -1
- package/__inner__/esm/locale/locale.js +67 -0
- package/__inner__/esm/utils/getPaperSizeToFormElement.d.ts +3 -0
- package/__inner__/esm/utils/getPaperSizeToFormElement.js +8 -0
- package/package.json +4 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChangeEventHandler, ComponentPropsWithRef, HTMLAttributes, KeyboardEvent, MouseEvent, ReactNode, Ref } from 'react';
|
|
2
2
|
import type { ExtendableProps } from '../../types/ExtendableProps';
|
|
3
3
|
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
4
|
+
import type { FieldHintProps } from '../FieldHint';
|
|
4
5
|
import type { FieldIconProps } from '../FieldIcon';
|
|
5
6
|
import type { FieldLabelProps } from '../FieldLabel';
|
|
6
7
|
export type FilePickerSizeVariant = FormElementSizeVariant;
|
|
@@ -61,6 +62,8 @@ export type FilePickerBaseProps = {
|
|
|
61
62
|
disabled?: boolean;
|
|
62
63
|
/** Свойства FieldLabel */
|
|
63
64
|
labelProps?: FieldLabelProps;
|
|
65
|
+
/** Cвойства FieldHint */
|
|
66
|
+
hintProps?: Omit<FieldHintProps, 'children'>;
|
|
64
67
|
/** Функция */
|
|
65
68
|
renderValue?: FilePickerRenderValue;
|
|
66
69
|
/** Текст для кнопки очистки поля */
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
justify-content: center;
|
|
14
14
|
cursor: pointer;
|
|
15
|
-
border-radius: var(--border-radius-xs);
|
|
16
15
|
border: none;
|
|
17
16
|
color: var(--icon-button-font-color);
|
|
18
17
|
background-color: var(--icon-button-bg-color);
|
|
19
18
|
opacity: 1;
|
|
19
|
+
border-radius: var(--icon-button-border-radius);
|
|
20
20
|
transition:
|
|
21
21
|
background-color var(--transition-default),
|
|
22
22
|
box-shadow var(--transition-default),
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
.IconButton_size_2xs {
|
|
29
29
|
--icon-button-size: 32px;
|
|
30
|
+
--icon-button-border-radius: var(--border-radius-m);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
.IconButton_size_2xs.IconButton_compressed:not(.IconButton_variant_function) {
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
|
|
36
37
|
.IconButton_size_xs {
|
|
37
38
|
--icon-button-size: 40px;
|
|
39
|
+
--icon-button-border-radius: var(--border-radius-m);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
.IconButton_size_xs.IconButton_compressed:not(.IconButton_variant_function) {
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
|
|
44
46
|
.IconButton_size_s {
|
|
45
47
|
--icon-button-size: 48px;
|
|
48
|
+
--icon-button-border-radius: var(--border-radius-l);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
.IconButton_size_s.IconButton_compressed:not(.IconButton_variant_function) {
|
|
@@ -51,6 +54,7 @@
|
|
|
51
54
|
|
|
52
55
|
.IconButton_size_m {
|
|
53
56
|
--icon-button-size: 56px;
|
|
57
|
+
--icon-button-border-radius: var(--border-radius-l);
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
.IconButton_size_m.IconButton_compressed:not(.IconButton_variant_function) {
|
|
@@ -59,6 +63,7 @@
|
|
|
59
63
|
|
|
60
64
|
.IconButton_size_l {
|
|
61
65
|
--icon-button-size: 64px;
|
|
66
|
+
--icon-button-border-radius: var(--border-radius-l);
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
.IconButton_size_l.IconButton_compressed:not(.IconButton_variant_function) {
|
|
@@ -116,6 +121,7 @@
|
|
|
116
121
|
|
|
117
122
|
.IconButton_variant_function {
|
|
118
123
|
--icon-button-size: auto;
|
|
124
|
+
--icon-button-border-radius: var(--border-radius-xs);
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
.IconButton_variant_function:hover {
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
align-items: center;
|
|
13
13
|
justify-content: center;
|
|
14
14
|
cursor: pointer;
|
|
15
|
-
border-radius: var(--border-radius-xs);
|
|
16
15
|
border: none;
|
|
17
16
|
color: var(--icon-button-font-color);
|
|
18
17
|
background-color: var(--icon-button-bg-color);
|
|
19
18
|
opacity: 1;
|
|
19
|
+
border-radius: var(--icon-button-border-radius);
|
|
20
20
|
transition:
|
|
21
21
|
background-color var(--transition-default),
|
|
22
22
|
box-shadow var(--transition-default),
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
.IconButtonNext_size_2xs {
|
|
29
29
|
--icon-button-size: 32px;
|
|
30
|
+
--icon-button-border-radius: var(--border-radius-m);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
.IconButtonNext_size_2xs.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
|
|
36
37
|
.IconButtonNext_size_xs {
|
|
37
38
|
--icon-button-size: 40px;
|
|
39
|
+
--icon-button-border-radius: var(--border-radius-m);
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
.IconButtonNext_size_xs.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
|
|
44
46
|
.IconButtonNext_size_s {
|
|
45
47
|
--icon-button-size: 48px;
|
|
48
|
+
--icon-button-border-radius: var(--border-radius-l);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
.IconButtonNext_size_s.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
|
|
@@ -51,6 +54,7 @@
|
|
|
51
54
|
|
|
52
55
|
.IconButtonNext_size_m {
|
|
53
56
|
--icon-button-size: 56px;
|
|
57
|
+
--icon-button-border-radius: var(--border-radius-l);
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
.IconButtonNext_size_m.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
|
|
@@ -59,6 +63,7 @@
|
|
|
59
63
|
|
|
60
64
|
.IconButtonNext_size_l {
|
|
61
65
|
--icon-button-size: 64px;
|
|
66
|
+
--icon-button-border-radius: var(--border-radius-m);
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
.IconButtonNext_size_l.IconButtonNext_compressed:not(.IconButtonNext_variant_function) {
|
|
@@ -209,6 +214,7 @@
|
|
|
209
214
|
|
|
210
215
|
.IconButtonNext_variant_function {
|
|
211
216
|
--icon-button-size: auto;
|
|
217
|
+
--icon-button-border-radius: var(--border-radius-xs);
|
|
212
218
|
}
|
|
213
219
|
|
|
214
220
|
.IconButtonNext_variant_function.IconButtonNext_color_primary,
|
|
@@ -258,6 +264,7 @@
|
|
|
258
264
|
--icon-button-bg-color: var(--color-background-main);
|
|
259
265
|
--icon-button-bg-color-hover: var(--color-background-main-hover);
|
|
260
266
|
--icon-button-bg-color-active: var(--color-background-main-pressed);
|
|
267
|
+
--icon-button-bg-color-focus: var(--color-background-main);
|
|
261
268
|
--icon-button-font-color: var(--color-content-primary);
|
|
262
269
|
--icon-button-font-color-active: var(--color-content-primary);
|
|
263
270
|
--icon-button-font-color-focus: var(--color-content-primary);
|
|
@@ -325,6 +332,7 @@
|
|
|
325
332
|
.IconButtonNext:focus:not(:focus-visible, :active, :hover) {
|
|
326
333
|
box-shadow: none;
|
|
327
334
|
color: var(--icon-button-font-color);
|
|
335
|
+
background-color: var(--icon-button-bg-color);
|
|
328
336
|
}
|
|
329
337
|
|
|
330
338
|
.IconButtonNext:focus {
|
|
@@ -12,7 +12,7 @@ export type IconButtonColorVariant = (typeof iconButtonColorVariant)[number];
|
|
|
12
12
|
export type IconButtonIcon = RenderContentType<IconProps & {
|
|
13
13
|
size?: IconSize;
|
|
14
14
|
}>['content'];
|
|
15
|
-
type IconButtonBaseProps = {
|
|
15
|
+
export type IconButtonBaseProps = {
|
|
16
16
|
/** Иконка */
|
|
17
17
|
icon: IconButtonIcon;
|
|
18
18
|
/** Вариант представления компонента */
|
|
@@ -38,4 +38,3 @@ type IconButtonBaseProps = {
|
|
|
38
38
|
export type IconButtonProps<As extends ElementType = typeof ICON_BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<IconButtonBaseProps, As>;
|
|
39
39
|
export declare const cnIconButton: import("@bem-react/classname").ClassNameFormatter;
|
|
40
40
|
export declare const IconButton: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<IconButtonBaseProps, "button">;
|
|
41
|
-
export {};
|
|
@@ -23,7 +23,7 @@ export declare const Indicator: React.ForwardRefExoticComponent<{
|
|
|
23
23
|
/** Цветовой вариант индикатор
|
|
24
24
|
* @default success
|
|
25
25
|
* */
|
|
26
|
-
variant?: "
|
|
26
|
+
variant?: "error" | "info" | "success" | "warning" | "neutral" | undefined;
|
|
27
27
|
/** Размер
|
|
28
28
|
* @default m
|
|
29
29
|
* */
|
|
@@ -21,7 +21,7 @@ exports.Input = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
|
21
21
|
props: inProps,
|
|
22
22
|
name: 'Input',
|
|
23
23
|
});
|
|
24
|
-
var _a = props.size, size = _a === void 0 ? constants_1.INPUT_DEFAULT_SIZE : _a, label = props.label, error = props.error, autoFocus = props.autoFocus, placeholder = props.placeholder, id = props.id, name = props.name, type = props.type, renderLeft = props.renderLeft, renderRight = props.renderRight, fullWidth = props.fullWidth, disabled = props.disabled, hint = props.hint, required = props.required, className = props.className, value = props.value, defaultValue = props.defaultValue, onChange = props.onChange, inputProps = props.inputProps, bodyProps = props.bodyProps, labelProps = props.labelProps, maxLength = props.maxLength, minLength = props.minLength, inputRef = props.inputRef, labelRef = props.labelRef, other = tslib_1.__rest(props, ["size", "label", "error", "autoFocus", "placeholder", "id", "name", "type", "renderLeft", "renderRight", "fullWidth", "disabled", "hint", "required", "className", "value", "defaultValue", "onChange", "inputProps", "bodyProps", "labelProps", "maxLength", "minLength", "inputRef", "labelRef"]);
|
|
24
|
+
var _a = props.size, size = _a === void 0 ? constants_1.INPUT_DEFAULT_SIZE : _a, label = props.label, error = props.error, autoFocus = props.autoFocus, placeholder = props.placeholder, id = props.id, name = props.name, type = props.type, renderLeft = props.renderLeft, renderRight = props.renderRight, fullWidth = props.fullWidth, disabled = props.disabled, hint = props.hint, required = props.required, className = props.className, value = props.value, defaultValue = props.defaultValue, onChange = props.onChange, inputProps = props.inputProps, bodyProps = props.bodyProps, labelProps = props.labelProps, hintProps = props.hintProps, maxLength = props.maxLength, minLength = props.minLength, inputRef = props.inputRef, labelRef = props.labelRef, other = tslib_1.__rest(props, ["size", "label", "error", "autoFocus", "placeholder", "id", "name", "type", "renderLeft", "renderRight", "fullWidth", "disabled", "hint", "required", "className", "value", "defaultValue", "onChange", "inputProps", "bodyProps", "labelProps", "hintProps", "maxLength", "minLength", "inputRef", "labelRef"]);
|
|
25
25
|
var bodyInnerRef = (0, react_1.useRef)(null);
|
|
26
26
|
var fieldInnerRef = (0, react_1.useRef)(null);
|
|
27
27
|
/* Хук useEventListener необходим для того, чтобы при нажатии на кнопку мыши
|
|
@@ -48,6 +48,6 @@ exports.Input = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
|
48
48
|
react_1.default.createElement(FieldInput_1.FieldInput, tslib_1.__assign({ id: id, name: name, autoFocus: autoFocus, value: value, type: type, defaultValue: defaultValue, placeholder: placeholder, onChange: onChange, maxLength: maxLength, minLength: minLength }, inputProps, { className: (0, exports.cnInput)('Field', [inputProps === null || inputProps === void 0 ? void 0 : inputProps.className]), ref: (0, useMultiRef_1.useMultiRef)([inputRef || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref), fieldInnerRef]) }))),
|
|
49
49
|
react_1.default.createElement(FieldIcon_1.FieldIcon, { icon: renderRight }),
|
|
50
50
|
react_1.default.createElement(Fieldset_1.Fieldset, null)),
|
|
51
|
-
react_1.default.createElement(FieldHint_1.FieldHint,
|
|
51
|
+
react_1.default.createElement(FieldHint_1.FieldHint, tslib_1.__assign({}, hintProps), hint)));
|
|
52
52
|
});
|
|
53
53
|
exports.Input.displayName = 'Input';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, Ref } from 'react';
|
|
2
2
|
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
3
3
|
import type { FIELD_CONTROL_DEFAULT_TAG } from '../FieldControl';
|
|
4
|
+
import type { FieldHintProps } from '../FieldHint';
|
|
4
5
|
import type { FieldIconProps } from '../FieldIcon';
|
|
5
6
|
import type { FieldLabelProps } from '../FieldLabel';
|
|
6
7
|
export declare const inputTypeVariant: readonly ["number", "date", "datetime-local", "time", "text", "tel", "password", "email"];
|
|
@@ -66,6 +67,8 @@ export type InputProps = Omit<ComponentPropsWithRef<typeof FIELD_CONTROL_DEFAULT
|
|
|
66
67
|
labelProps?: FieldLabelProps;
|
|
67
68
|
/** Cвойства Body */
|
|
68
69
|
bodyProps?: ComponentPropsWithRef<'label'>;
|
|
70
|
+
/** Cвойства FieldHint */
|
|
71
|
+
hintProps?: Omit<FieldHintProps, 'children'>;
|
|
69
72
|
/** data-атрибут для тестирования */
|
|
70
73
|
'data-testid'?: string;
|
|
71
74
|
} & InputPropsDeprecated;
|
|
@@ -94,12 +94,12 @@
|
|
|
94
94
|
row-gap: var(--input-number-button-gap);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
.
|
|
98
|
-
.
|
|
97
|
+
.IconButtonNext.InputNumber-Increment,
|
|
98
|
+
.IconButtonNext.InputNumber-Decrement {
|
|
99
99
|
inline-size: var(--input-number-button-inline-size);
|
|
100
100
|
block-size: var(--input-number-button-block-size);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
.
|
|
103
|
+
.IconButtonNext.InputNumber-Increment *, .IconButtonNext.InputNumber-Decrement * {
|
|
104
104
|
pointer-events: none;
|
|
105
105
|
}
|
|
@@ -18,7 +18,7 @@ var FieldIcon_1 = require("../FieldIcon");
|
|
|
18
18
|
var FieldInput_1 = require("../FieldInput");
|
|
19
19
|
var FieldLabel_1 = require("../FieldLabel");
|
|
20
20
|
var Fieldset_1 = require("../Fieldset");
|
|
21
|
-
var
|
|
21
|
+
var IconButtonNext_1 = require("../IconButtonNext");
|
|
22
22
|
var constants_1 = require("./constants");
|
|
23
23
|
var utils_1 = require("./utils");
|
|
24
24
|
exports.cnInputNumber = (0, classname_1.cn)('InputNumber');
|
|
@@ -27,7 +27,7 @@ exports.InputNumber = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
|
27
27
|
props: inProps,
|
|
28
28
|
name: 'InputNumber',
|
|
29
29
|
});
|
|
30
|
-
var _a = props.size, size = _a === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_SIZE : _a, _b = props.step, step = _b === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_STEP : _b, _c = props.autoFocus, autoFocus = _c === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_AUTO_FOCUS : _c, _d = props.error, error = _d === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_ERROR : _d, _e = props.required, required = _e === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_REQUIRED : _e, _f = props.disabled, disabled = _f === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_DISABLED : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_FULL_WIDTH : _g, _h = props.defaultValue, defaultValue = _h === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_VALUE : _h, _j = props.min, min = _j === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_MIN : _j, _k = props.max, max = _k === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_MAX : _k, label = props.label, placeholder = props.placeholder, id = props.id, name = props.name, renderLeft = props.renderLeft, renderRight = props.renderRight, hint = props.hint, className = props.className, inputProps = props.inputProps, valueProp = props.value, onChange = props.onChange, labelRef = props.labelRef, labelProps = props.labelProps, bodyProps = props.bodyProps, incrementButtonText = props.incrementButtonText, decrementButtonText = props.decrementButtonText, other = tslib_1.__rest(props, ["size", "step", "autoFocus", "error", "required", "disabled", "fullWidth", "defaultValue", "min", "max", "label", "placeholder", "id", "name", "renderLeft", "renderRight", "hint", "className", "inputProps", "value", "onChange", "labelRef", "labelProps", "bodyProps", "incrementButtonText", "decrementButtonText"]);
|
|
30
|
+
var _a = props.size, size = _a === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_SIZE : _a, _b = props.step, step = _b === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_STEP : _b, _c = props.autoFocus, autoFocus = _c === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_AUTO_FOCUS : _c, _d = props.error, error = _d === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_ERROR : _d, _e = props.required, required = _e === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_REQUIRED : _e, _f = props.disabled, disabled = _f === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_DISABLED : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_FULL_WIDTH : _g, _h = props.defaultValue, defaultValue = _h === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_VALUE : _h, _j = props.min, min = _j === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_MIN : _j, _k = props.max, max = _k === void 0 ? constants_1.INPUT_NUMBER_DEFAULT_MAX : _k, label = props.label, placeholder = props.placeholder, id = props.id, name = props.name, renderLeft = props.renderLeft, renderRight = props.renderRight, hint = props.hint, className = props.className, inputProps = props.inputProps, valueProp = props.value, onChange = props.onChange, labelRef = props.labelRef, labelProps = props.labelProps, bodyProps = props.bodyProps, hintProps = props.hintProps, incrementButtonText = props.incrementButtonText, decrementButtonText = props.decrementButtonText, other = tslib_1.__rest(props, ["size", "step", "autoFocus", "error", "required", "disabled", "fullWidth", "defaultValue", "min", "max", "label", "placeholder", "id", "name", "renderLeft", "renderRight", "hint", "className", "inputProps", "value", "onChange", "labelRef", "labelProps", "bodyProps", "hintProps", "incrementButtonText", "decrementButtonText"]);
|
|
31
31
|
var _l = tslib_1.__read((0, useBoolean_1.useBoolean)(false), 2), focused = _l[0], _m = _l[1], onFocus = _m.on, offFocus = _m.off;
|
|
32
32
|
var _o = tslib_1.__read((0, react_1.useState)(null), 2), timeoutId = _o[0], setTimeoutId = _o[1];
|
|
33
33
|
var _p = tslib_1.__read((0, react_1.useState)(null), 2), countDirection = _p[0], setCountDirection = _p[1];
|
|
@@ -137,9 +137,9 @@ exports.InputNumber = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
|
137
137
|
react_1.default.createElement(FieldInput_1.FieldInput, tslib_1.__assign({ id: id, min: min, max: max, step: step, name: name, type: "number", value: valueState, autoFocus: autoFocus, placeholder: placeholder }, inputProps, { onBlur: handleBlur, onFocus: handleFocus, onChange: handleChange, onKeyDown: handleKeyDown, ref: (0, useMultiRef_1.useMultiRef)([inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref, fieldInnerRef]), className: (0, exports.cnInputNumber)('Field', [inputProps === null || inputProps === void 0 ? void 0 : inputProps.className]) }))),
|
|
138
138
|
react_1.default.createElement(FieldIcon_1.FieldIcon, { icon: renderRight }),
|
|
139
139
|
react_1.default.createElement("span", { className: (0, exports.cnInputNumber)('Controls') },
|
|
140
|
-
react_1.default.createElement(
|
|
141
|
-
react_1.default.createElement(
|
|
140
|
+
react_1.default.createElement(IconButtonNext_1.IconButton, { size: size, type: "button", tabIndex: -1, variant: "ghost", icon: icons_1.SortUpIcon, disabled: disabled, "aria-label": incrementButtonText, className: (0, exports.cnInputNumber)('Increment'), onMouseDown: handleMouseDown('increment') }),
|
|
141
|
+
react_1.default.createElement(IconButtonNext_1.IconButton, { size: size, tabIndex: -1, type: "button", variant: "ghost", icon: icons_1.SortDownIcon, disabled: disabled, "aria-label": decrementButtonText, className: (0, exports.cnInputNumber)('Decrement'), onMouseDown: handleMouseDown('decrement') })),
|
|
142
142
|
react_1.default.createElement(Fieldset_1.Fieldset, { className: (0, exports.cnInputNumber)('Fieldset') })),
|
|
143
|
-
react_1.default.createElement(FieldHint_1.FieldHint,
|
|
143
|
+
react_1.default.createElement(FieldHint_1.FieldHint, tslib_1.__assign({}, hintProps), hint)));
|
|
144
144
|
});
|
|
145
145
|
exports.InputNumber.displayName = 'InputNumber';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChangeEvent, ComponentPropsWithRef, HTMLAttributes, MouseEvent, Ref } from 'react';
|
|
2
2
|
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
3
|
+
import type { FieldHintProps } from '../FieldHint';
|
|
3
4
|
import type { FieldIconProps } from '../FieldIcon';
|
|
4
5
|
import type { FieldLabelProps } from '../FieldLabel';
|
|
5
6
|
type InputNumberPropsDeprecated = {
|
|
@@ -59,6 +60,8 @@ export type InputNumberProps = {
|
|
|
59
60
|
labelProps?: FieldLabelProps;
|
|
60
61
|
/** Cвойства Body */
|
|
61
62
|
bodyProps?: ComponentPropsWithRef<'label'>;
|
|
63
|
+
/** Cвойства FieldHint */
|
|
64
|
+
hintProps?: Omit<FieldHintProps, 'children'>;
|
|
62
65
|
/** Шаг инкремента/декремента */
|
|
63
66
|
step?: number;
|
|
64
67
|
/** Минимально допустимое значение */
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
.List {
|
|
2
|
-
--list-item-color: var(--color-content-primary);
|
|
3
|
-
--list-item-border-radius: var(--border-radius-xs);
|
|
4
2
|
--list-item-bg-color: transparent;
|
|
3
|
+
--list-item-color: var(--color-content-primary);
|
|
4
|
+
--list-pipka-bg-color: var(--color-content-action);
|
|
5
|
+
--list-item-bg-color-disabled: var(--color-content-tertiary);
|
|
5
6
|
--list-item-bg-color-hover: var(--color-background-main-hover);
|
|
6
7
|
--list-item-bg-color-active: var(--color-background-main-pressed);
|
|
7
|
-
--list-item-bg-color-disabled: var(--color-content-tertiary);
|
|
8
|
-
--list-pipka-bg-color: var(--color-content-action);
|
|
9
8
|
--list-pipka-border-radius: 0 var(--border-radius-xs) var(--border-radius-xs)
|
|
10
9
|
0;
|
|
11
10
|
display: flex;
|
|
@@ -30,57 +29,62 @@
|
|
|
30
29
|
|
|
31
30
|
.List_size_2xs {
|
|
32
31
|
--list-gutter: var(--spacing-3xs);
|
|
33
|
-
--list-item-min-height:
|
|
32
|
+
--list-item-min-height: var(--control-height-2xs);
|
|
34
33
|
--list-item-icon-min-width: 16px;
|
|
35
34
|
--list-item-avatar-min-width: 16px;
|
|
36
35
|
--list-item-padding: 0 8px;
|
|
37
36
|
--list-item-children-margin-right: 8px;
|
|
38
37
|
--list-pipka-height: 32px;
|
|
39
38
|
--list-pipka-width: 4px;
|
|
39
|
+
--list-item-border-radius: var(--border-radius-m);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
.List_size_xs {
|
|
43
43
|
--list-gutter: var(--spacing-3xs);
|
|
44
|
-
--list-item-min-height:
|
|
44
|
+
--list-item-min-height: var(--control-height-xs);
|
|
45
45
|
--list-item-icon-min-width: 16px;
|
|
46
46
|
--list-item-avatar-min-width: 24px;
|
|
47
47
|
--list-item-padding: 4px 8px;
|
|
48
48
|
--list-item-children-margin-right: 8px;
|
|
49
49
|
--list-pipka-height: 40px;
|
|
50
50
|
--list-pipka-width: 4px;
|
|
51
|
+
--list-item-border-radius: var(--border-radius-m);
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
.List_size_s {
|
|
54
55
|
--list-gutter: var(--spacing-3xs);
|
|
55
|
-
--list-item-min-height:
|
|
56
|
+
--list-item-min-height: var(--control-height-s);
|
|
56
57
|
--list-item-icon-min-width: 16px;
|
|
57
58
|
--list-item-avatar-min-width: 32px;
|
|
58
59
|
--list-item-padding: 6px 12px;
|
|
59
60
|
--list-item-children-margin-right: 12px;
|
|
60
61
|
--list-pipka-height: 40px;
|
|
61
62
|
--list-pipka-width: 4px;
|
|
63
|
+
--list-item-border-radius: var(--border-radius-l);
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
.List_size_m {
|
|
65
67
|
--list-gutter: var(--spacing-2xs);
|
|
66
|
-
--list-item-min-height:
|
|
68
|
+
--list-item-min-height: var(--control-height-m);
|
|
67
69
|
--list-item-icon-min-width: 24px;
|
|
68
70
|
--list-item-avatar-min-width: 40px;
|
|
69
71
|
--list-item-padding: 8px 12px;
|
|
70
72
|
--list-item-children-margin-right: 12px;
|
|
71
73
|
--list-pipka-height: 48px;
|
|
72
74
|
--list-pipka-width: 4px;
|
|
75
|
+
--list-item-border-radius: var(--border-radius-l);
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
.List_size_l {
|
|
76
79
|
--list-gutter: var(--spacing-2xs);
|
|
77
|
-
--list-item-min-height:
|
|
80
|
+
--list-item-min-height: var(--control-height-l);
|
|
78
81
|
--list-item-icon-min-width: 24px;
|
|
79
82
|
--list-item-avatar-min-width: 48px;
|
|
80
83
|
--list-item-padding: 8px 16px;
|
|
81
84
|
--list-item-children-margin-right: 16px;
|
|
82
85
|
--list-pipka-height: 48px;
|
|
83
86
|
--list-pipka-width: 4px;
|
|
87
|
+
--list-item-border-radius: var(--border-radius-l);
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
.List_disablePadding,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import './Menu.css';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { RefObject, ComponentPropsWithRef } from 'react';
|
|
4
|
+
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
4
5
|
import { type PopoverBaseProps } from '../Popover';
|
|
5
6
|
import type { PORTAL_DEFAULT_TAG } from '../Portal';
|
|
6
7
|
import { type MenuListProps } from './components';
|
|
@@ -8,6 +9,12 @@ export declare const cnMenu: import("@bem-react/classname").ClassNameFormatter;
|
|
|
8
9
|
export type MenuProps = {
|
|
9
10
|
/** Свойства компонента MenuList */
|
|
10
11
|
menuListProps?: Omit<MenuListProps, 'children'>;
|
|
12
|
+
/**
|
|
13
|
+
* Ссылка на компонент MenuList
|
|
14
|
+
* @deprecated Используйте menuListProps.ref
|
|
15
|
+
* */
|
|
11
16
|
menuListRef?: RefObject<HTMLDivElement>;
|
|
17
|
+
/** Размер компонента */
|
|
18
|
+
size?: FormElementSizeVariant;
|
|
12
19
|
} & Omit<PopoverBaseProps, 'disableEnforceFocus'> & ComponentPropsWithRef<typeof PORTAL_DEFAULT_TAG>;
|
|
13
20
|
export declare const Menu: React.ForwardRefExoticComponent<Omit<MenuProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -4,15 +4,18 @@ exports.Menu = exports.cnMenu = void 0;
|
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
require("./Menu.css");
|
|
6
6
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
var logger_1 = require("@ozen-ui/logger");
|
|
7
8
|
var useEventListener_1 = require("../../hooks/useEventListener");
|
|
8
9
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
9
10
|
var classname_1 = require("../../utils/classname");
|
|
11
|
+
var getPaperSizeToFormElement_1 = require("../../utils/getPaperSizeToFormElement");
|
|
10
12
|
var isKey_1 = require("../../utils/isKey");
|
|
11
13
|
var Popover_1 = require("../Popover");
|
|
12
14
|
var components_1 = require("./components");
|
|
15
|
+
var constants_1 = require("./constants");
|
|
13
16
|
exports.cnMenu = (0, classname_1.cn)('Menu');
|
|
14
17
|
var MenuContextConsumer = function (_a) {
|
|
15
|
-
var children = _a.children,
|
|
18
|
+
var children = _a.children, onClose = _a.onClose, menuListProps = _a.menuListProps;
|
|
16
19
|
var isTop = (0, Popover_1.usePopover)().isTop;
|
|
17
20
|
var docRef = (0, react_1.useRef)(document);
|
|
18
21
|
(0, useEventListener_1.useEventListener)({
|
|
@@ -26,12 +29,16 @@ var MenuContextConsumer = function (_a) {
|
|
|
26
29
|
element: docRef,
|
|
27
30
|
active: isTop,
|
|
28
31
|
});
|
|
29
|
-
return (react_1.default.createElement(components_1.MenuList, tslib_1.__assign({}, menuListProps, {
|
|
32
|
+
return (react_1.default.createElement(components_1.MenuList, tslib_1.__assign({}, menuListProps, { autoFocus: true }), children));
|
|
30
33
|
};
|
|
31
34
|
exports.Menu = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
32
35
|
var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'Menu' });
|
|
33
|
-
var open = props.open, menuListProps = props.menuListProps, menuListRef = props.menuListRef, onClose = props.onClose, children = props.children, className = props.className, other = tslib_1.__rest(props, ["open", "menuListProps", "menuListRef", "onClose", "children", "className"]);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
var _a = props.size, size = _a === void 0 ? constants_1.MENU_DEFAULT_SIZE : _a, open = props.open, menuListProps = props.menuListProps, menuListRef = props.menuListRef, onClose = props.onClose, children = props.children, className = props.className, other = tslib_1.__rest(props, ["size", "open", "menuListProps", "menuListRef", "onClose", "children", "className"]);
|
|
37
|
+
var radius = (0, getPaperSizeToFormElement_1.getPaperSizeToFormElement)(size);
|
|
38
|
+
if (process.env.NODE_ENV !== 'production' && menuListRef) {
|
|
39
|
+
(0, logger_1.deprecate)('Свойство «menuListRef» устарело. Для замены используйте «menuListProps.ref».');
|
|
40
|
+
}
|
|
41
|
+
return (react_1.default.createElement(Popover_1.Popover, tslib_1.__assign({ offset: [0, 4], radius: radius }, other, { open: open, onClose: onClose, className: (0, exports.cnMenu)('', [className]), disableEnforceFocus: true, ref: ref }),
|
|
42
|
+
react_1.default.createElement(MenuContextConsumer, { onClose: onClose, menuListRef: menuListRef, menuListProps: tslib_1.__assign(tslib_1.__assign({ size: size }, menuListProps), { ref: menuListRef || (menuListProps === null || menuListProps === void 0 ? void 0 : menuListProps.ref) }) }, children)));
|
|
36
43
|
});
|
|
37
44
|
exports.Menu.displayName = 'Menu';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MENU_DEFAULT_SIZE = "m";
|
|
@@ -7,6 +7,6 @@ var Paper_1 = require("../../Paper");
|
|
|
7
7
|
var index_1 = require("../index");
|
|
8
8
|
exports.ModalConsumer = (0, react_1.forwardRef)(function (_a, ref) {
|
|
9
9
|
var children = _a.children, className = _a.className, other = tslib_1.__rest(_a, ["children", "className"]);
|
|
10
|
-
return (react_1.default.createElement(Paper_1.Paper, tslib_1.__assign({ radius: "
|
|
10
|
+
return (react_1.default.createElement(Paper_1.Paper, tslib_1.__assign({ radius: "l", background: "main" }, other, { className: (0, index_1.cnModal)('Window', [className]), tabIndex: -1, ref: ref }), children));
|
|
11
11
|
});
|
|
12
12
|
exports.ModalConsumer.displayName = 'ModalConsumer';
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
display: block;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.Pagination-List {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
5
|
+
.Pagination-List {
|
|
6
|
+
margin: 0;
|
|
7
|
+
padding: 0;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
list-style: none;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: var(--spacing-4xs);
|
|
13
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import './Pagination.css';
|
|
2
|
+
import type { PaginationBaseProps } from './types';
|
|
3
3
|
export declare const cnPagination: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
-
export declare const Pagination:
|
|
4
|
+
export declare const Pagination: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<PaginationBaseProps, "nav">;
|
|
@@ -2,35 +2,36 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Pagination = exports.cnPagination = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
require("./Pagination.css");
|
|
5
6
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
7
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
7
8
|
var classname_1 = require("../../utils/classname");
|
|
8
9
|
var isNumber_1 = require("../../utils/isNumber");
|
|
10
|
+
var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
|
|
9
11
|
var components_1 = require("./components");
|
|
10
12
|
var constants_1 = require("./constants");
|
|
11
13
|
var createPaginationRange_1 = require("./helpers/createPaginationRange");
|
|
12
14
|
var getItemAriaLabel_1 = require("./helpers/getItemAriaLabel");
|
|
13
15
|
var withNavigationButtons_1 = require("./helpers/withNavigationButtons/withNavigationButtons");
|
|
14
|
-
require("./Pagination.css");
|
|
15
16
|
exports.cnPagination = (0, classname_1.cn)('Pagination');
|
|
16
|
-
exports.Pagination = (0,
|
|
17
|
+
exports.Pagination = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
17
18
|
var props = (0, useThemeProps_1.useThemeProps)({ props: inProps, name: 'Pagination' });
|
|
18
|
-
var _a = props.
|
|
19
|
+
var _a = props.as, Tag = _a === void 0 ? constants_1.PAGINATION_DEFAULT_TAG : _a, _b = props.page, page = _b === void 0 ? constants_1.PAGINATION_DEFAULT_PAGE : _b, _c = props.size, size = _c === void 0 ? constants_1.PAGINATION_DEFAULT_SIZE : _c, _d = props.siblingCount, siblingCount = _d === void 0 ? constants_1.PAGINATION_DEFAULT_SIBLING_COUNT : _d, pageSize = props.pageSize, totalCount = props.totalCount, className = props.className, disabledProp = props.disabled, onPageChange = props.onPageChange, _e = props.getItemAriaLabel, getItemAriaLabel = _e === void 0 ? getItemAriaLabel_1.getItemAriaLabel : _e,
|
|
19
20
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20
|
-
|
|
21
|
+
_f = props.renderComponent,
|
|
21
22
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
22
|
-
renderComponent =
|
|
23
|
+
renderComponent = _f === void 0 ? function (_a) {
|
|
23
24
|
var className = _a.className, rest = tslib_1.__rest(_a, ["className"]);
|
|
24
25
|
return (react_1.default.createElement(components_1.PaginationItem, tslib_1.__assign({}, rest)));
|
|
25
|
-
} :
|
|
26
|
-
var
|
|
26
|
+
} : _f, otherProps = tslib_1.__rest(props, ["as", "page", "size", "siblingCount", "pageSize", "totalCount", "className", "disabled", "onPageChange", "getItemAriaLabel", "renderComponent"]);
|
|
27
|
+
var _g = (0, react_1.useMemo)(function () {
|
|
27
28
|
var selected = page + 1;
|
|
28
29
|
return {
|
|
29
30
|
selected: selected,
|
|
30
31
|
previous: selected - 1,
|
|
31
32
|
next: selected + 1,
|
|
32
33
|
};
|
|
33
|
-
}, [page]), selected =
|
|
34
|
+
}, [page]), selected = _g.selected, previous = _g.previous, next = _g.next;
|
|
34
35
|
var range = (0, react_1.useMemo)(function () {
|
|
35
36
|
return (0, createPaginationRange_1.createPaginationRange)({
|
|
36
37
|
page: selected,
|
|
@@ -63,7 +64,7 @@ exports.Pagination = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
|
63
64
|
size: size,
|
|
64
65
|
selected: isSelected,
|
|
65
66
|
page: mapper[type],
|
|
66
|
-
disabled: mapperDisabled[type],
|
|
67
|
+
disabled: disabledProp || mapperDisabled[type],
|
|
67
68
|
'aria-label': getItemAriaLabel({
|
|
68
69
|
page: mapper[type],
|
|
69
70
|
selected: isSelected,
|
|
@@ -73,8 +74,17 @@ exports.Pagination = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
|
73
74
|
className: (0, components_1.cnPaginationItem)({ size: size, selected: isSelected }),
|
|
74
75
|
};
|
|
75
76
|
});
|
|
76
|
-
}, [
|
|
77
|
-
|
|
77
|
+
}, [
|
|
78
|
+
range,
|
|
79
|
+
selected,
|
|
80
|
+
disabledProp,
|
|
81
|
+
previous,
|
|
82
|
+
next,
|
|
83
|
+
size,
|
|
84
|
+
getItemAriaLabel,
|
|
85
|
+
onPageChange,
|
|
86
|
+
]);
|
|
87
|
+
return (react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnPagination)({}, [className]), ref: ref }, otherProps),
|
|
78
88
|
react_1.default.createElement("ul", { className: (0, exports.cnPagination)('List') }, paginationPropsRange.map(function (item, index) { return (react_1.default.createElement("li", { key: item.type === constants_1.ELLIPSIS ? index : item.page + item.type }, renderComponent(item))); }))));
|
|
79
89
|
});
|
|
80
90
|
exports.Pagination.displayName = 'Pagination';
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
/* stylelint-disable */
|
|
2
2
|
.PaginationItem {
|
|
3
3
|
--pagination-item-background: transparent;
|
|
4
|
-
|
|
4
|
+
outline: none;
|
|
5
5
|
display: flex;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
text-align: center;
|
|
6
8
|
align-items: center;
|
|
7
|
-
|
|
9
|
+
text-decoration: none;
|
|
8
10
|
box-sizing: border-box;
|
|
9
|
-
|
|
11
|
+
justify-content: center;
|
|
12
|
+
color: var(--color-content-primary);
|
|
10
13
|
block-size: var(--pagination-item-size);
|
|
11
|
-
|
|
14
|
+
min-inline-size: var(--pagination-item-size);
|
|
12
15
|
border-radius: var(--pagination-item-border-radius);
|
|
13
|
-
color: var(--color-content-primary);
|
|
14
16
|
background-color: var(--pagination-item-background);
|
|
15
|
-
|
|
16
|
-
text-decoration: none;
|
|
17
|
-
text-align: center;
|
|
18
|
-
outline: none;
|
|
17
|
+
border: var(--border-width-s) solid var(--pagination-item-border-color);
|
|
19
18
|
}
|
|
20
19
|
.PaginationItem_size_s {
|
|
21
20
|
font: var(--typography-text-s-font);
|
|
22
21
|
letter-spacing: var(--typography-text-s-letter_spacing, 0);
|
|
23
22
|
text-transform: var(--typography-text-s-text_transform, none);
|
|
24
23
|
|
|
25
|
-
--pagination-item-size:
|
|
26
|
-
--pagination-item-border-radius: var(--border-radius-
|
|
24
|
+
--pagination-item-size: var(--control-height-2xs);
|
|
25
|
+
--pagination-item-border-radius: var(--border-radius-m);
|
|
27
26
|
}
|
|
28
27
|
.PaginationItem_size_l {
|
|
29
28
|
font: var(--typography-text-l-font);
|
|
30
29
|
letter-spacing: var(--typography-text-l-letter_spacing, 0);
|
|
31
30
|
text-transform: var(--typography-text-l-text_transform, none);
|
|
32
31
|
|
|
33
|
-
--pagination-item-size:
|
|
34
|
-
--pagination-item-border-radius: var(--border-radius-
|
|
32
|
+
--pagination-item-size: var(--control-height-m);
|
|
33
|
+
--pagination-item-border-radius: var(--border-radius-l);
|
|
35
34
|
}
|
|
36
35
|
.PaginationItem:hover:not(.PaginationItem_selected) {
|
|
37
36
|
--pagination-item-background: var(--color-background-primary-hover);
|
|
@@ -46,7 +45,14 @@
|
|
|
46
45
|
box-shadow: none;
|
|
47
46
|
}
|
|
48
47
|
.PaginationItem_selected {
|
|
49
|
-
border: var(--
|
|
50
|
-
var(--color-background-action);
|
|
48
|
+
--pagination-item-border-color: var(--color-border-action);
|
|
51
49
|
cursor: initial;
|
|
52
50
|
}
|
|
51
|
+
.PaginationItem_disabled {
|
|
52
|
+
cursor: auto;
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
color: var(--color-content-disabled);
|
|
55
|
+
}
|
|
56
|
+
.PaginationItem_disabled.PaginationItem_selected {
|
|
57
|
+
--pagination-item-border-color: var(--color-border-disabled);
|
|
58
|
+
}
|