@ozen-ui/kit 0.41.0 → 0.42.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/Autocomplete/helper.d.ts +2 -0
- package/__inner__/cjs/components/Autocomplete/types.d.ts +2 -2
- 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/IconButtonNext/IconButton.css +1 -0
- 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.js +2 -2
- package/__inner__/cjs/components/InputNumber/types.d.ts +4 -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 +19 -13
- 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/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/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/locale/locale.js +58 -0
- package/__inner__/esm/components/Autocomplete/Autocomplete.js +2 -2
- package/__inner__/esm/components/Autocomplete/helper.d.ts +2 -0
- package/__inner__/esm/components/Autocomplete/types.d.ts +2 -2
- 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/IconButtonNext/IconButton.css +1 -0
- 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.js +5 -5
- package/__inner__/esm/components/InputNumber/types.d.ts +4 -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 +19 -13
- 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/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/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/locale/locale.js +58 -0
- package/package.json +4 -4
|
@@ -12,7 +12,7 @@ var Fieldset_1 = require("../../Fieldset");
|
|
|
12
12
|
var Textarea_1 = require("../../Textarea");
|
|
13
13
|
var index_1 = require("./index");
|
|
14
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;
|
|
15
|
+
var labelProps = _a.labelProps, hintProps = _a.hintProps, 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
16
|
var fieldRef = (0, react_1.useRef)(null);
|
|
17
17
|
var context = (0, FieldControl_1.useFieldControl)();
|
|
18
18
|
var _b = tslib_1.__read(context, 1), value = _b[0].value;
|
|
@@ -29,7 +29,7 @@ var TextareaConsumer = function (_a) {
|
|
|
29
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
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
31
|
react_1.default.createElement(Fieldset_1.Fieldset, null)),
|
|
32
|
-
react_1.default.createElement(FieldHint_1.FieldHint,
|
|
32
|
+
react_1.default.createElement(FieldHint_1.FieldHint, tslib_1.__assign({}, hintProps),
|
|
33
33
|
hint,
|
|
34
34
|
maxLength && react_1.default.createElement(index_1.TextareaCounter, { maxLength: maxLength }))));
|
|
35
35
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
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 { FieldLabelProps } from '../FieldLabel';
|
|
5
6
|
export type TextareaSizeVariant = FormElementSizeVariant;
|
|
6
7
|
export declare const textareaExpandVariant: readonly ["autoSize", "verticalResize"];
|
|
@@ -61,6 +62,8 @@ export type TextareaProps = Omit<ComponentPropsWithRef<typeof FIELD_CONTROL_DEFA
|
|
|
61
62
|
};
|
|
62
63
|
/** Свойства FieldLabel */
|
|
63
64
|
labelProps?: FieldLabelProps;
|
|
65
|
+
/** Cвойства FieldHint */
|
|
66
|
+
hintProps?: Omit<FieldHintProps, 'children'>;
|
|
64
67
|
/** data-атрибут для тестирования */
|
|
65
68
|
'data-testid'?: string;
|
|
66
69
|
} & TextareaPropsDeprecated;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enUS = exports.kkKZ = exports.ruRU = void 0;
|
|
4
|
+
var constants_1 = require("../components/Pagination/constants");
|
|
4
5
|
exports.ruRU = {
|
|
5
6
|
defaultProps: {
|
|
6
7
|
Autocomplete: {
|
|
@@ -31,6 +32,25 @@ exports.ruRU = {
|
|
|
31
32
|
incrementButtonText: 'Увеличить',
|
|
32
33
|
decrementButtonText: 'Уменьшить',
|
|
33
34
|
},
|
|
35
|
+
Pagination: {
|
|
36
|
+
'aria-label': 'Навигация по страницам',
|
|
37
|
+
getItemAriaLabel: function (_a) {
|
|
38
|
+
var page = _a.page, type = _a.type, selected = _a.selected;
|
|
39
|
+
if (type === constants_1.NEXT) {
|
|
40
|
+
return 'Перейти на следующую страницу';
|
|
41
|
+
}
|
|
42
|
+
if (type === constants_1.PREVIOUS) {
|
|
43
|
+
return 'Перейти на предыдущую страницу';
|
|
44
|
+
}
|
|
45
|
+
if (selected) {
|
|
46
|
+
return "\u0421\u0442\u0440\u0430\u043D\u0438\u0446\u0430 ".concat(page);
|
|
47
|
+
}
|
|
48
|
+
if (type === constants_1.PAGE) {
|
|
49
|
+
return "\u041F\u0435\u0440\u0435\u0439\u0442\u0438 \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0443 ".concat(page);
|
|
50
|
+
}
|
|
51
|
+
return '';
|
|
52
|
+
},
|
|
53
|
+
},
|
|
34
54
|
},
|
|
35
55
|
};
|
|
36
56
|
exports.kkKZ = {
|
|
@@ -63,6 +83,25 @@ exports.kkKZ = {
|
|
|
63
83
|
incrementButtonText: 'Үлкейту',
|
|
64
84
|
decrementButtonText: 'Азайту',
|
|
65
85
|
},
|
|
86
|
+
Pagination: {
|
|
87
|
+
'aria-label': 'Беттерді шарлау',
|
|
88
|
+
getItemAriaLabel: function (_a) {
|
|
89
|
+
var page = _a.page, type = _a.type, selected = _a.selected;
|
|
90
|
+
if (type === constants_1.NEXT) {
|
|
91
|
+
return 'Келесі бетке өтіңіз';
|
|
92
|
+
}
|
|
93
|
+
if (type === constants_1.PREVIOUS) {
|
|
94
|
+
return 'Алдыңғы бетке өтіңіз';
|
|
95
|
+
}
|
|
96
|
+
if (selected) {
|
|
97
|
+
return "".concat(page, " \u0431\u0435\u0442");
|
|
98
|
+
}
|
|
99
|
+
if (type === constants_1.PAGE) {
|
|
100
|
+
return "".concat(page, "-\u0431\u0435\u0442\u043A\u0435 \u04E9\u0442\u0456\u04A3\u0456\u0437");
|
|
101
|
+
}
|
|
102
|
+
return '';
|
|
103
|
+
},
|
|
104
|
+
},
|
|
66
105
|
},
|
|
67
106
|
};
|
|
68
107
|
exports.enUS = {
|
|
@@ -95,5 +134,24 @@ exports.enUS = {
|
|
|
95
134
|
incrementButtonText: 'Increment',
|
|
96
135
|
decrementButtonText: 'Decrement',
|
|
97
136
|
},
|
|
137
|
+
Pagination: {
|
|
138
|
+
'aria-label': 'Pagination navigation',
|
|
139
|
+
getItemAriaLabel: function (_a) {
|
|
140
|
+
var page = _a.page, type = _a.type, selected = _a.selected;
|
|
141
|
+
if (type === constants_1.NEXT) {
|
|
142
|
+
return 'Go to next page';
|
|
143
|
+
}
|
|
144
|
+
if (type === constants_1.PREVIOUS) {
|
|
145
|
+
return 'Go to previous page';
|
|
146
|
+
}
|
|
147
|
+
if (selected) {
|
|
148
|
+
return "Page ".concat(page);
|
|
149
|
+
}
|
|
150
|
+
if (type === constants_1.PAGE) {
|
|
151
|
+
return "Go to page ".concat(page);
|
|
152
|
+
}
|
|
153
|
+
return '';
|
|
154
|
+
},
|
|
155
|
+
},
|
|
98
156
|
},
|
|
99
157
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __read, __rest, __spreadArray } from "tslib";
|
|
2
2
|
import './Autocomplete.css';
|
|
3
|
-
import React, { useEffect, useRef,
|
|
3
|
+
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
4
4
|
import { useControlled } from '../../hooks/useControlled';
|
|
5
5
|
import { useMutableRef } from '../../hooks/useMutableRef';
|
|
6
6
|
import { useThemeProps } from '../../hooks/useThemeProps';
|
|
@@ -9,7 +9,7 @@ import { isKeys } from '../../utils/isKeys';
|
|
|
9
9
|
import { DataList, DataListOption } from '../DataList';
|
|
10
10
|
import { Input } from '../Input';
|
|
11
11
|
import { AutocompleteLoading, AutocompleteNoOptions, AutocompleteRenderRight, } from './components';
|
|
12
|
-
import {
|
|
12
|
+
import { AUTOCOMPLETE_DEFAULT_ALLOW_CUSTOM_VALUE, AUTOCOMPLETE_DEFAULT_AUTOFOCUS, AUTOCOMPLETE_DEFAULT_DISABLE_CLEAR_BUTTON, AUTOCOMPLETE_DEFAULT_DISABLE_CLOSE_ON_SELECT, AUTOCOMPLETE_DEFAULT_DISABLE_SHOW_CHEVRON, AUTOCOMPLETE_DEFAULT_DISABLE_SHOW_EMPTY_OPTIONS_LIST, AUTOCOMPLETE_DEFAULT_DISABLED, AUTOCOMPLETE_DEFAULT_FULLWIDTH, AUTOCOMPLETE_DEFAULT_REQUIRED, AUTOCOMPLETE_DEFAULT_SIZE, } from './constants';
|
|
13
13
|
import { withDefaultGetters } from './helper';
|
|
14
14
|
export var cnAutocomplete = cn('Autocomplete');
|
|
15
15
|
function AutocompleteRender(inProps, ref) {
|
|
@@ -80,6 +80,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
80
80
|
} & {
|
|
81
81
|
'data-testid'?: string | undefined;
|
|
82
82
|
}) | undefined;
|
|
83
|
+
hintProps?: Omit<import("../FieldHint").FieldHintProps, "children"> | undefined;
|
|
83
84
|
} & {
|
|
84
85
|
open?: boolean | undefined;
|
|
85
86
|
defaultOpen?: undefined;
|
|
@@ -176,6 +177,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
176
177
|
} & {
|
|
177
178
|
'data-testid'?: string | undefined;
|
|
178
179
|
}) | undefined;
|
|
180
|
+
hintProps?: Omit<import("../FieldHint").FieldHintProps, "children"> | undefined;
|
|
179
181
|
} & {
|
|
180
182
|
open?: undefined;
|
|
181
183
|
defaultOpen?: boolean | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ChangeEvent, ReactElement, ReactNode, SyntheticEvent } from 'react';
|
|
2
2
|
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
3
3
|
import type { DataListProps } from '../DataList';
|
|
4
4
|
import type { InputProps } from '../Input';
|
|
@@ -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' | 'onKeyDown'>;
|
|
34
|
+
type AutocompleteInputProps = Pick<InputProps, 'placeholder' | 'autoFocus' | 'fullWidth' | 'disabled' | 'label' | 'required' | 'style' | 'error' | 'hint' | 'renderLeft' | 'renderRight' | 'className' | 'inputProps' | 'hintProps' | 'onKeyDown'>;
|
|
35
35
|
type AutocompleteDataListProps = Partial<Omit<DataListProps, 'onClose' | 'open' | 'anchorRef' | 'multiple' | 'selected' | 'onSelect'>>;
|
|
36
36
|
export type AutocompleteProps<OPTION = AutocompleteDefaultOption> = {
|
|
37
37
|
/** Список вариантов выбора (опции) */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import './FilePicker.css';
|
|
2
|
+
import type { KeyboardEvent, MouseEvent } from 'react';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
export declare const cnFilePicker: import("@bem-react/classname").ClassNameFormatter;
|
|
4
5
|
export declare const FilePicker: React.ForwardRefExoticComponent<{
|
|
@@ -56,9 +57,10 @@ export declare const FilePicker: React.ForwardRefExoticComponent<{
|
|
|
56
57
|
error?: boolean | undefined;
|
|
57
58
|
disabled?: boolean | undefined;
|
|
58
59
|
labelProps?: import("../FieldLabel").FieldLabelProps | undefined;
|
|
60
|
+
hintProps?: Omit<import("../FieldHint").FieldHintProps, "children"> | undefined;
|
|
59
61
|
renderValue?: import("./types").FilePickerRenderValue | undefined;
|
|
60
62
|
clearText?: string | undefined;
|
|
61
|
-
onClear?: ((e:
|
|
63
|
+
onClear?: ((e: KeyboardEvent<HTMLInputElement> | MouseEvent<HTMLButtonElement, globalThis.MouseEvent>, payload: {
|
|
62
64
|
name?: string | undefined;
|
|
63
65
|
}) => void) | undefined;
|
|
64
66
|
className?: string | undefined;
|
|
@@ -66,7 +68,7 @@ export declare const FilePicker: React.ForwardRefExoticComponent<{
|
|
|
66
68
|
} & {
|
|
67
69
|
labelRef?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
68
70
|
inputRef?: React.Ref<HTMLInputElement> | undefined;
|
|
69
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "name" | "label" | "className" | "id" | "onChange" | "autoFocus" | "disabled" | "accept" | "multiple" | "placeholder" | "required" | "size" | "error" | "fullWidth" | "labelProps" | "data-testid" | "hint" | "renderLeft" | "renderRight" | "inputProps" | "clearText" | "onClear" | "fileList" | "disableTruncate" | "renderValue" | keyof {
|
|
71
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "name" | "label" | "className" | "id" | "onChange" | "autoFocus" | "disabled" | "accept" | "multiple" | "placeholder" | "required" | "size" | "error" | "fullWidth" | "labelProps" | "data-testid" | "hint" | "renderLeft" | "renderRight" | "inputProps" | "hintProps" | "clearText" | "onClear" | "fileList" | "disableTruncate" | "renderValue" | keyof {
|
|
70
72
|
labelRef?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
|
|
71
73
|
inputRef?: React.Ref<HTMLInputElement> | undefined;
|
|
72
74
|
}> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import './FilePicker.css';
|
|
3
|
-
import React, { forwardRef,
|
|
3
|
+
import React, { forwardRef, useRef, useState } from 'react';
|
|
4
4
|
import { AttachmentIcon, CrossIcon } from '@ozen-ui/icons';
|
|
5
5
|
import { deprecate } from '@ozen-ui/logger';
|
|
6
6
|
import { useMultiRef } from '../../hooks/useMultiRef';
|
|
@@ -13,13 +13,13 @@ import { FieldIcon } from '../FieldIcon';
|
|
|
13
13
|
import { FieldLabel } from '../FieldLabel';
|
|
14
14
|
import { Fieldset } from '../Fieldset';
|
|
15
15
|
import { IconButton } from '../IconButtonNext';
|
|
16
|
-
import {
|
|
16
|
+
import { FILE_PICKER_DEFAULT_DISABLE_TRUNCATE, FILE_PICKER_DEFAULT_DISABLED, FILE_PICKER_DEFAULT_FULL_WIDTH, FILE_PICKER_DEFAULT_MULTIPLE, FILE_PICKER_DEFAULT_REQUIRED, FILE_PICKER_DEFAULT_SIZE, FILE_PICKER_DEFAULT_VALUE_RENDERER, } from './constants';
|
|
17
17
|
export var cnFilePicker = cn('FilePicker');
|
|
18
18
|
export var FilePicker = forwardRef(function (inProps, ref) {
|
|
19
19
|
var _a = useThemeProps({
|
|
20
20
|
props: inProps,
|
|
21
21
|
name: 'FilePicker',
|
|
22
|
-
}), _b = _a.size, size = _b === void 0 ? FILE_PICKER_DEFAULT_SIZE : _b, _c = _a.disabled, disabled = _c === void 0 ? FILE_PICKER_DEFAULT_DISABLED : _c, _d = _a.required, required = _d === void 0 ? FILE_PICKER_DEFAULT_REQUIRED : _d, _e = _a.fullWidth, fullWidth = _e === void 0 ? FILE_PICKER_DEFAULT_FULL_WIDTH : _e, _f = _a.disableTruncate, disableTruncate = _f === void 0 ? FILE_PICKER_DEFAULT_DISABLE_TRUNCATE : _f, _g = _a.multiple, multiple = _g === void 0 ? FILE_PICKER_DEFAULT_MULTIPLE : _g, placeholder = _a.placeholder, clearText = _a.clearText, _h = _a.renderRight, renderRight = _h === void 0 ? AttachmentIcon : _h, renderValueProp = _a.renderValue, onChangeProp = _a.onChange, onClearProp = _a.onClear, inputRef = _a.inputRef, fileList = _a.fileList, accept = _a.accept, id = _a.id, name = _a.name, label = _a.label, autoFocus = _a.autoFocus, error = _a.error, hint = _a.hint, renderLeft = _a.renderLeft, labelProps = _a.labelProps, inputProps = _a.inputProps, labelRef = _a.labelRef, className = _a.className, other = __rest(_a, ["size", "disabled", "required", "fullWidth", "disableTruncate", "multiple", "placeholder", "clearText", "renderRight", "renderValue", "onChange", "onClear", "inputRef", "fileList", "accept", "id", "name", "label", "autoFocus", "error", "hint", "renderLeft", "labelProps", "inputProps", "labelRef", "className"]);
|
|
22
|
+
}), _b = _a.size, size = _b === void 0 ? FILE_PICKER_DEFAULT_SIZE : _b, _c = _a.disabled, disabled = _c === void 0 ? FILE_PICKER_DEFAULT_DISABLED : _c, _d = _a.required, required = _d === void 0 ? FILE_PICKER_DEFAULT_REQUIRED : _d, _e = _a.fullWidth, fullWidth = _e === void 0 ? FILE_PICKER_DEFAULT_FULL_WIDTH : _e, _f = _a.disableTruncate, disableTruncate = _f === void 0 ? FILE_PICKER_DEFAULT_DISABLE_TRUNCATE : _f, _g = _a.multiple, multiple = _g === void 0 ? FILE_PICKER_DEFAULT_MULTIPLE : _g, placeholder = _a.placeholder, clearText = _a.clearText, _h = _a.renderRight, renderRight = _h === void 0 ? AttachmentIcon : _h, renderValueProp = _a.renderValue, onChangeProp = _a.onChange, onClearProp = _a.onClear, inputRef = _a.inputRef, fileList = _a.fileList, accept = _a.accept, id = _a.id, name = _a.name, label = _a.label, autoFocus = _a.autoFocus, error = _a.error, hint = _a.hint, renderLeft = _a.renderLeft, labelProps = _a.labelProps, inputProps = _a.inputProps, hintProps = _a.hintProps, labelRef = _a.labelRef, className = _a.className, other = __rest(_a, ["size", "disabled", "required", "fullWidth", "disableTruncate", "multiple", "placeholder", "clearText", "renderRight", "renderValue", "onChange", "onClear", "inputRef", "fileList", "accept", "id", "name", "label", "autoFocus", "error", "hint", "renderLeft", "labelProps", "inputProps", "hintProps", "labelRef", "className"]);
|
|
23
23
|
if (process.env.NODE_ENV !== 'production' && labelRef) {
|
|
24
24
|
deprecate('Свойство «labelRef» устарело. Для замены используйте «labelProps.ref».');
|
|
25
25
|
}
|
|
@@ -72,6 +72,6 @@ export var FilePicker = forwardRef(function (inProps, ref) {
|
|
|
72
72
|
}) })),
|
|
73
73
|
React.createElement(FieldIcon, { icon: renderRight })),
|
|
74
74
|
React.createElement(Fieldset, null)),
|
|
75
|
-
React.createElement(FieldHint,
|
|
75
|
+
React.createElement(FieldHint, __assign({}, hintProps), hint)));
|
|
76
76
|
});
|
|
77
77
|
FilePicker.displayName = 'FilePicker';
|
|
@@ -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
|
/** Текст для кнопки очистки поля */
|
|
@@ -18,7 +18,7 @@ export var Input = forwardRef(function (inProps, ref) {
|
|
|
18
18
|
props: inProps,
|
|
19
19
|
name: 'Input',
|
|
20
20
|
});
|
|
21
|
-
var _a = props.size, size = _a === void 0 ? 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 = __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"]);
|
|
21
|
+
var _a = props.size, size = _a === void 0 ? 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 = __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"]);
|
|
22
22
|
var bodyInnerRef = useRef(null);
|
|
23
23
|
var fieldInnerRef = useRef(null);
|
|
24
24
|
/* Хук useEventListener необходим для того, чтобы при нажатии на кнопку мыши
|
|
@@ -45,6 +45,6 @@ export var Input = forwardRef(function (inProps, ref) {
|
|
|
45
45
|
React.createElement(FieldInput, __assign({ id: id, name: name, autoFocus: autoFocus, value: value, type: type, defaultValue: defaultValue, placeholder: placeholder, onChange: onChange, maxLength: maxLength, minLength: minLength }, inputProps, { className: cnInput('Field', [inputProps === null || inputProps === void 0 ? void 0 : inputProps.className]), ref: useMultiRef([inputRef || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.ref), fieldInnerRef]) }))),
|
|
46
46
|
React.createElement(FieldIcon, { icon: renderRight }),
|
|
47
47
|
React.createElement(Fieldset, null)),
|
|
48
|
-
React.createElement(FieldHint,
|
|
48
|
+
React.createElement(FieldHint, __assign({}, hintProps), hint)));
|
|
49
49
|
});
|
|
50
50
|
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;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __read, __rest } from "tslib";
|
|
2
2
|
import './InputNumber.css';
|
|
3
|
-
import React, {
|
|
4
|
-
import {
|
|
3
|
+
import React, { forwardRef, useRef, useState } from 'react';
|
|
4
|
+
import { SortDownIcon, SortUpIcon } from '@ozen-ui/icons';
|
|
5
5
|
import { useBoolean } from '../../hooks/useBoolean';
|
|
6
6
|
import { useControlled } from '../../hooks/useControlled';
|
|
7
7
|
import { useEventListener } from '../../hooks/useEventListener';
|
|
@@ -16,7 +16,7 @@ import { FieldInput } from '../FieldInput';
|
|
|
16
16
|
import { FieldLabel } from '../FieldLabel';
|
|
17
17
|
import { Fieldset } from '../Fieldset';
|
|
18
18
|
import { IconButton } from '../IconButton';
|
|
19
|
-
import {
|
|
19
|
+
import { INPUT_NUMBER_DEFAULT_AUTO_FOCUS, INPUT_NUMBER_DEFAULT_DISABLED, INPUT_NUMBER_DEFAULT_ERROR, INPUT_NUMBER_DEFAULT_FULL_WIDTH, INPUT_NUMBER_DEFAULT_MAX, INPUT_NUMBER_DEFAULT_MIN, INPUT_NUMBER_DEFAULT_REQUIRED, INPUT_NUMBER_DEFAULT_SIZE, INPUT_NUMBER_DEFAULT_STEP, INPUT_NUMBER_DEFAULT_VALUE, } from './constants';
|
|
20
20
|
import { getValue, isInputInvalid, isValidValue } from './utils';
|
|
21
21
|
export var cnInputNumber = cn('InputNumber');
|
|
22
22
|
export var InputNumber = forwardRef(function (inProps, ref) {
|
|
@@ -24,7 +24,7 @@ export var InputNumber = forwardRef(function (inProps, ref) {
|
|
|
24
24
|
props: inProps,
|
|
25
25
|
name: 'InputNumber',
|
|
26
26
|
});
|
|
27
|
-
var _a = props.size, size = _a === void 0 ? INPUT_NUMBER_DEFAULT_SIZE : _a, _b = props.step, step = _b === void 0 ? INPUT_NUMBER_DEFAULT_STEP : _b, _c = props.autoFocus, autoFocus = _c === void 0 ? INPUT_NUMBER_DEFAULT_AUTO_FOCUS : _c, _d = props.error, error = _d === void 0 ? INPUT_NUMBER_DEFAULT_ERROR : _d, _e = props.required, required = _e === void 0 ? INPUT_NUMBER_DEFAULT_REQUIRED : _e, _f = props.disabled, disabled = _f === void 0 ? INPUT_NUMBER_DEFAULT_DISABLED : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? INPUT_NUMBER_DEFAULT_FULL_WIDTH : _g, _h = props.defaultValue, defaultValue = _h === void 0 ? INPUT_NUMBER_DEFAULT_VALUE : _h, _j = props.min, min = _j === void 0 ? INPUT_NUMBER_DEFAULT_MIN : _j, _k = props.max, max = _k === void 0 ? 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 = __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"]);
|
|
27
|
+
var _a = props.size, size = _a === void 0 ? INPUT_NUMBER_DEFAULT_SIZE : _a, _b = props.step, step = _b === void 0 ? INPUT_NUMBER_DEFAULT_STEP : _b, _c = props.autoFocus, autoFocus = _c === void 0 ? INPUT_NUMBER_DEFAULT_AUTO_FOCUS : _c, _d = props.error, error = _d === void 0 ? INPUT_NUMBER_DEFAULT_ERROR : _d, _e = props.required, required = _e === void 0 ? INPUT_NUMBER_DEFAULT_REQUIRED : _e, _f = props.disabled, disabled = _f === void 0 ? INPUT_NUMBER_DEFAULT_DISABLED : _f, _g = props.fullWidth, fullWidth = _g === void 0 ? INPUT_NUMBER_DEFAULT_FULL_WIDTH : _g, _h = props.defaultValue, defaultValue = _h === void 0 ? INPUT_NUMBER_DEFAULT_VALUE : _h, _j = props.min, min = _j === void 0 ? INPUT_NUMBER_DEFAULT_MIN : _j, _k = props.max, max = _k === void 0 ? 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 = __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"]);
|
|
28
28
|
var _l = __read(useBoolean(false), 2), focused = _l[0], _m = _l[1], onFocus = _m.on, offFocus = _m.off;
|
|
29
29
|
var _o = __read(useState(null), 2), timeoutId = _o[0], setTimeoutId = _o[1];
|
|
30
30
|
var _p = __read(useState(null), 2), countDirection = _p[0], setCountDirection = _p[1];
|
|
@@ -137,6 +137,6 @@ export var InputNumber = forwardRef(function (inProps, ref) {
|
|
|
137
137
|
React.createElement(IconButton, { size: size, type: "button", tabIndex: -1, variant: "ghost", icon: SortUpIcon, disabled: disabled, "aria-label": incrementButtonText, className: cnInputNumber('Increment'), onMouseDown: handleMouseDown('increment') }),
|
|
138
138
|
React.createElement(IconButton, { size: size, tabIndex: -1, type: "button", variant: "ghost", icon: SortDownIcon, disabled: disabled, "aria-label": decrementButtonText, className: cnInputNumber('Decrement'), onMouseDown: handleMouseDown('decrement') })),
|
|
139
139
|
React.createElement(Fieldset, { className: cnInputNumber('Fieldset') })),
|
|
140
|
-
React.createElement(FieldHint,
|
|
140
|
+
React.createElement(FieldHint, __assign({}, hintProps), hint)));
|
|
141
141
|
});
|
|
142
142
|
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
|
/** Минимально допустимое значение */
|
|
@@ -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">;
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
|
-
import
|
|
2
|
+
import './Pagination.css';
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
3
4
|
import { useThemeProps } from '../../hooks/useThemeProps';
|
|
4
5
|
import { cn } from '../../utils/classname';
|
|
5
6
|
import { isNumber } from '../../utils/isNumber';
|
|
7
|
+
import { polymorphicComponentWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
6
8
|
import { PaginationItem, cnPaginationItem, } from './components';
|
|
7
|
-
import { PAGINATION_DEFAULT_PAGE, PAGINATION_DEFAULT_SIBLING_COUNT, PAGINATION_DEFAULT_SIZE, ELLIPSIS, NEXT, PAGE, PREVIOUS, } from './constants';
|
|
9
|
+
import { PAGINATION_DEFAULT_TAG, PAGINATION_DEFAULT_PAGE, PAGINATION_DEFAULT_SIBLING_COUNT, PAGINATION_DEFAULT_SIZE, ELLIPSIS, NEXT, PAGE, PREVIOUS, } from './constants';
|
|
8
10
|
import { createPaginationRange } from './helpers/createPaginationRange';
|
|
9
11
|
import { getItemAriaLabel as createAriaLabel } from './helpers/getItemAriaLabel';
|
|
10
12
|
import { withNavigationButton } from './helpers/withNavigationButtons/withNavigationButtons';
|
|
11
|
-
import './Pagination.css';
|
|
12
13
|
export var cnPagination = cn('Pagination');
|
|
13
|
-
export var Pagination =
|
|
14
|
+
export var Pagination = polymorphicComponentWithRef(function (inProps, ref) {
|
|
14
15
|
var props = useThemeProps({ props: inProps, name: 'Pagination' });
|
|
15
|
-
var _a = props.
|
|
16
|
+
var _a = props.as, Tag = _a === void 0 ? PAGINATION_DEFAULT_TAG : _a, _b = props.page, page = _b === void 0 ? PAGINATION_DEFAULT_PAGE : _b, _c = props.size, size = _c === void 0 ? PAGINATION_DEFAULT_SIZE : _c, _d = props.siblingCount, siblingCount = _d === void 0 ? 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 ? createAriaLabel : _e,
|
|
16
17
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
-
|
|
18
|
+
_f = props.renderComponent,
|
|
18
19
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
-
renderComponent =
|
|
20
|
+
renderComponent = _f === void 0 ? function (_a) {
|
|
20
21
|
var className = _a.className, rest = __rest(_a, ["className"]);
|
|
21
22
|
return (React.createElement(PaginationItem, __assign({}, rest)));
|
|
22
|
-
} :
|
|
23
|
-
var
|
|
23
|
+
} : _f, otherProps = __rest(props, ["as", "page", "size", "siblingCount", "pageSize", "totalCount", "className", "disabled", "onPageChange", "getItemAriaLabel", "renderComponent"]);
|
|
24
|
+
var _g = useMemo(function () {
|
|
24
25
|
var selected = page + 1;
|
|
25
26
|
return {
|
|
26
27
|
selected: selected,
|
|
27
28
|
previous: selected - 1,
|
|
28
29
|
next: selected + 1,
|
|
29
30
|
};
|
|
30
|
-
}, [page]), selected =
|
|
31
|
+
}, [page]), selected = _g.selected, previous = _g.previous, next = _g.next;
|
|
31
32
|
var range = useMemo(function () {
|
|
32
33
|
return createPaginationRange({
|
|
33
34
|
page: selected,
|
|
@@ -60,7 +61,7 @@ export var Pagination = forwardRef(function (inProps, ref) {
|
|
|
60
61
|
size: size,
|
|
61
62
|
selected: isSelected,
|
|
62
63
|
page: mapper[type],
|
|
63
|
-
disabled: mapperDisabled[type],
|
|
64
|
+
disabled: disabledProp || mapperDisabled[type],
|
|
64
65
|
'aria-label': getItemAriaLabel({
|
|
65
66
|
page: mapper[type],
|
|
66
67
|
selected: isSelected,
|
|
@@ -70,8 +71,17 @@ export var Pagination = forwardRef(function (inProps, ref) {
|
|
|
70
71
|
className: cnPaginationItem({ size: size, selected: isSelected }),
|
|
71
72
|
};
|
|
72
73
|
});
|
|
73
|
-
}, [
|
|
74
|
-
|
|
74
|
+
}, [
|
|
75
|
+
range,
|
|
76
|
+
selected,
|
|
77
|
+
disabledProp,
|
|
78
|
+
previous,
|
|
79
|
+
next,
|
|
80
|
+
size,
|
|
81
|
+
getItemAriaLabel,
|
|
82
|
+
onPageChange,
|
|
83
|
+
]);
|
|
84
|
+
return (React.createElement(Tag, __assign({ className: cnPagination({}, [className]), ref: ref }, otherProps),
|
|
75
85
|
React.createElement("ul", { className: cnPagination('List') }, paginationPropsRange.map(function (item, index) { return (React.createElement("li", { key: item.type === ELLIPSIS ? index : item.page + item.type }, renderComponent(item))); }))));
|
|
76
86
|
});
|
|
77
87
|
Pagination.displayName = 'Pagination';
|
|
@@ -1,28 +1,27 @@
|
|
|
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:
|
|
24
|
+
--pagination-item-size: var(--control-height-2xs);
|
|
26
25
|
--pagination-item-border-radius: var(--border-radius-xs);
|
|
27
26
|
}
|
|
28
27
|
.PaginationItem_size_l {
|
|
@@ -30,7 +29,7 @@
|
|
|
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:
|
|
32
|
+
--pagination-item-size: var(--control-height-m);
|
|
34
33
|
--pagination-item-border-radius: var(--border-radius-s);
|
|
35
34
|
}
|
|
36
35
|
.PaginationItem:hover:not(.PaginationItem_selected) {
|
|
@@ -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
|
+
}
|
|
@@ -4,8 +4,9 @@ import React, { forwardRef } from 'react';
|
|
|
4
4
|
import { ChevronLeftIcon, ChevronRightIcon, MenuHorizontalIcon, } from '@ozen-ui/icons';
|
|
5
5
|
import { cn } from '../../../../utils/classname';
|
|
6
6
|
import { isNumber } from '../../../../utils/isNumber';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { ButtonBase } from '../../../ButtonBase';
|
|
8
|
+
import { IconButton } from '../../../IconButtonNext';
|
|
9
|
+
import { NEXT, PAGE, LAST, FIRST, ELLIPSIS, PREVIOUS, PAGINATION_ITEM_DEFAULT_SELECTED, PAGINATION_ITEM_DEFAULT_DISABLED, PAGINATION_ITEM_DEFAULT_SIZE, } from '../../constants';
|
|
9
10
|
import './PaginationItem.css';
|
|
10
11
|
export var paginationVariant = [
|
|
11
12
|
PREVIOUS,
|
|
@@ -32,16 +33,16 @@ var iconsMapper = (_a = {},
|
|
|
32
33
|
_a[ELLIPSIS] = MenuHorizontalIcon,
|
|
33
34
|
_a);
|
|
34
35
|
export var PaginationItem = forwardRef(function (_a, ref) {
|
|
35
|
-
var
|
|
36
|
+
var _b = _a.selected, selected = _b === void 0 ? PAGINATION_ITEM_DEFAULT_SELECTED : _b, _c = _a.disabled, disabled = _c === void 0 ? PAGINATION_ITEM_DEFAULT_DISABLED : _c, _d = _a.size, size = _d === void 0 ? PAGINATION_ITEM_DEFAULT_SIZE : _d, type = _a.type, page = _a.page, onClick = _a.onClick, className = _a.className, otherProps = __rest(_a, ["selected", "disabled", "size", "type", "page", "onClick", "className"]);
|
|
36
37
|
var sizeConfig = sizeMapper[size];
|
|
37
38
|
var handleClick = function () {
|
|
38
|
-
if (
|
|
39
|
-
onClick(page - 1);
|
|
39
|
+
if (!selected && isNumber(page)) {
|
|
40
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(page - 1);
|
|
40
41
|
}
|
|
41
42
|
};
|
|
42
43
|
if (type === PREVIOUS || type === NEXT || type === ELLIPSIS) {
|
|
43
|
-
return (React.createElement(IconButton, __assign({ disabled: disabled,
|
|
44
|
+
return (React.createElement(IconButton, __assign({ disabled: disabled, icon: iconsMapper[type], size: sizeConfig.size, onClick: handleClick, ref: ref }, otherProps, { color: "secondary" })));
|
|
44
45
|
}
|
|
45
|
-
return (React.createElement(
|
|
46
|
+
return (React.createElement(ButtonBase, __assign({ disabled: disabled, className: cnPaginationItem({ size: size, selected: selected, disabled: disabled }, [className]), tabIndex: selected ? -1 : 0, onClick: handleClick, "aria-current": selected, ref: ref }, otherProps), page));
|
|
46
47
|
});
|
|
47
48
|
PaginationItem.displayName = 'PaginationItem';
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
export declare const PAGINATION_DEFAULT_TAG = "nav";
|
|
1
2
|
export declare const PAGINATION_DEFAULT_SIZE = "s";
|
|
2
3
|
export declare const PAGINATION_DEFAULT_SIBLING_COUNT = 2;
|
|
3
4
|
export declare const PAGINATION_DEFAULT_PAGE = 0;
|
|
5
|
+
export declare const PAGINATION_ITEM_DEFAULT_SIZE = "s";
|
|
6
|
+
export declare const PAGINATION_ITEM_DEFAULT_SELECTED = false;
|
|
7
|
+
export declare const PAGINATION_ITEM_DEFAULT_DISABLED = false;
|
|
4
8
|
export declare const ELLIPSIS = "Ellipsis";
|
|
5
9
|
export declare const PREVIOUS = "Previous";
|
|
6
10
|
export declare const NEXT = "Next";
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
export var PAGINATION_DEFAULT_TAG = 'nav';
|
|
1
2
|
export var PAGINATION_DEFAULT_SIZE = 's';
|
|
2
3
|
export var PAGINATION_DEFAULT_SIBLING_COUNT = 2;
|
|
3
4
|
export var PAGINATION_DEFAULT_PAGE = 0;
|
|
5
|
+
export var PAGINATION_ITEM_DEFAULT_SIZE = 's';
|
|
6
|
+
export var PAGINATION_ITEM_DEFAULT_SELECTED = false;
|
|
7
|
+
export var PAGINATION_ITEM_DEFAULT_DISABLED = false;
|
|
4
8
|
export var ELLIPSIS = 'Ellipsis';
|
|
5
9
|
export var PREVIOUS = 'Previous';
|
|
6
10
|
export var NEXT = 'Next';
|