@ozen-ui/kit 0.64.0 → 0.65.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/ChipGroup/package.json +5 -0
- package/Title/package.json +5 -0
- package/__inner__/cjs/components/ChipGroup/ChipGroup.css +16 -0
- package/__inner__/cjs/components/ChipGroup/ChipGroup.d.ts +4 -0
- package/__inner__/cjs/components/ChipGroup/ChipGroup.js +52 -0
- package/__inner__/cjs/components/ChipGroup/ChipGroupContext.d.ts +10 -0
- package/__inner__/cjs/components/ChipGroup/ChipGroupContext.js +5 -0
- package/__inner__/cjs/components/ChipGroup/constants.d.ts +5 -0
- package/__inner__/cjs/components/ChipGroup/constants.js +6 -0
- package/__inner__/cjs/components/ChipGroup/index.d.ts +2 -0
- package/__inner__/cjs/components/ChipGroup/index.js +5 -0
- package/__inner__/cjs/components/ChipGroup/types.d.ts +33 -0
- package/__inner__/cjs/components/ChipGroup/types.js +2 -0
- package/__inner__/cjs/components/ChipNext/Chip.css +50 -17
- package/__inner__/cjs/components/ChipNext/Chip.js +32 -5
- package/__inner__/cjs/components/ChipNext/types.d.ts +9 -5
- package/__inner__/cjs/components/ChipNext/types.js +9 -2
- package/__inner__/cjs/components/FormGroup/types.d.ts +2 -0
- package/__inner__/cjs/components/FormTitle/FormTitle.d.ts +1 -0
- package/__inner__/cjs/components/IconButtonNext/types.d.ts +4 -1
- package/__inner__/cjs/components/IconButtonNext/utils.d.ts +2 -2
- package/__inner__/cjs/components/InputOTP/constants.d.ts +1 -1
- package/__inner__/cjs/components/TagNext/types.d.ts +1 -1
- package/__inner__/cjs/components/TagNext/types.js +1 -0
- package/__inner__/cjs/components/ThemeProvider/types.d.ts +6 -2
- package/__inner__/cjs/components/Title/Title.d.ts +4 -0
- package/__inner__/cjs/components/Title/Title.js +27 -0
- package/__inner__/cjs/components/Title/TitleContext.d.ts +8 -0
- package/__inner__/cjs/components/Title/TitleContext.js +17 -0
- package/__inner__/cjs/components/Title/components/index.d.ts +1 -0
- package/__inner__/cjs/components/Title/components/index.js +4 -0
- package/__inner__/cjs/components/Title/components/variant/TitleVariant.d.ts +2 -0
- package/__inner__/cjs/components/Title/components/variant/TitleVariant.js +24 -0
- package/__inner__/cjs/components/Title/components/variant/index.d.ts +4 -0
- package/__inner__/cjs/components/Title/components/variant/index.js +7 -0
- package/__inner__/cjs/components/Title/components/variant/main/TitleMain.css +38 -0
- package/__inner__/cjs/components/Title/components/variant/main/TitleMain.d.ts +4 -0
- package/__inner__/cjs/components/Title/components/variant/main/TitleMain.js +35 -0
- package/__inner__/cjs/components/Title/components/variant/main/config.d.ts +3 -0
- package/__inner__/cjs/components/Title/components/variant/main/config.js +7 -0
- package/__inner__/cjs/components/Title/components/variant/main/index.d.ts +2 -0
- package/__inner__/cjs/components/Title/components/variant/main/index.js +5 -0
- package/__inner__/cjs/components/Title/components/variant/main/types.d.ts +13 -0
- package/__inner__/cjs/components/Title/components/variant/main/types.js +2 -0
- package/__inner__/cjs/components/Title/components/variant/secondary/TitleSecondary.css +26 -0
- package/__inner__/cjs/components/Title/components/variant/secondary/TitleSecondary.d.ts +4 -0
- package/__inner__/cjs/components/Title/components/variant/secondary/TitleSecondary.js +15 -0
- package/__inner__/cjs/components/Title/components/variant/secondary/index.d.ts +2 -0
- package/__inner__/cjs/components/Title/components/variant/secondary/index.js +5 -0
- package/__inner__/cjs/components/Title/components/variant/secondary/types.d.ts +10 -0
- package/__inner__/cjs/components/Title/components/variant/secondary/types.js +2 -0
- package/__inner__/cjs/components/Title/components/variant/types.d.ts +8 -0
- package/__inner__/cjs/components/Title/components/variant/types.js +2 -0
- package/__inner__/cjs/components/Title/constants.d.ts +4 -0
- package/__inner__/cjs/components/Title/constants.js +6 -0
- package/__inner__/cjs/components/Title/entities/icon.d.ts +3 -0
- package/__inner__/cjs/components/Title/entities/icon.js +2 -0
- package/__inner__/cjs/components/Title/entities/index.d.ts +3 -0
- package/__inner__/cjs/components/Title/entities/index.js +6 -0
- package/__inner__/cjs/components/Title/entities/size.d.ts +2 -0
- package/__inner__/cjs/components/Title/entities/size.js +4 -0
- package/__inner__/cjs/components/Title/entities/variant.d.ts +7 -0
- package/__inner__/cjs/components/Title/entities/variant.js +4 -0
- package/__inner__/cjs/components/Title/index.d.ts +4 -0
- package/__inner__/cjs/components/Title/index.js +7 -0
- package/__inner__/cjs/components/Title/modules/icon-button/TitleIconButton.d.ts +3 -0
- package/__inner__/cjs/components/Title/modules/icon-button/TitleIconButton.js +16 -0
- package/__inner__/cjs/components/Title/modules/icon-button/constants.d.ts +1 -0
- package/__inner__/cjs/components/Title/modules/icon-button/constants.js +4 -0
- package/__inner__/cjs/components/Title/modules/icon-button/index.d.ts +2 -0
- package/__inner__/cjs/components/Title/modules/icon-button/index.js +5 -0
- package/__inner__/cjs/components/Title/modules/icon-button/types.d.ts +6 -0
- package/__inner__/cjs/components/Title/modules/icon-button/types.js +2 -0
- package/__inner__/cjs/components/Title/modules/index.d.ts +2 -0
- package/__inner__/cjs/components/Title/modules/index.js +5 -0
- package/__inner__/cjs/components/Title/modules/tag/TitleTag.css +4 -0
- package/__inner__/cjs/components/Title/modules/tag/TitleTag.d.ts +3 -0
- package/__inner__/cjs/components/Title/modules/tag/TitleTag.js +11 -0
- package/__inner__/cjs/components/Title/modules/tag/constants.d.ts +1 -0
- package/__inner__/cjs/components/Title/modules/tag/constants.js +4 -0
- package/__inner__/cjs/components/Title/modules/tag/index.d.ts +2 -0
- package/__inner__/cjs/components/Title/modules/tag/index.js +5 -0
- package/__inner__/cjs/components/Title/modules/tag/types.d.ts +6 -0
- package/__inner__/cjs/components/Title/modules/tag/types.js +2 -0
- package/__inner__/cjs/components/Title/types.d.ts +10 -0
- package/__inner__/cjs/components/Title/types.js +2 -0
- package/__inner__/cjs/constants/environment/index.d.ts +2 -0
- package/__inner__/cjs/constants/environment/index.js +5 -0
- package/__inner__/cjs/constants/environment/isDev.d.ts +1 -0
- package/__inner__/cjs/constants/environment/isDev.js +5 -0
- package/__inner__/cjs/constants/environment/isProduction.d.ts +1 -0
- package/__inner__/cjs/constants/environment/isProduction.js +4 -0
- package/__inner__/cjs/types/object/withPartial.d.ts +3 -0
- package/__inner__/cjs/types/object/withPartial.js +2 -0
- package/__inner__/esm/components/ChipGroup/ChipGroup.css +16 -0
- package/__inner__/esm/components/ChipGroup/ChipGroup.d.ts +4 -0
- package/__inner__/esm/components/ChipGroup/ChipGroup.js +49 -0
- package/__inner__/esm/components/ChipGroup/ChipGroupContext.d.ts +10 -0
- package/__inner__/esm/components/ChipGroup/ChipGroupContext.js +2 -0
- package/__inner__/esm/components/ChipGroup/constants.d.ts +5 -0
- package/__inner__/esm/components/ChipGroup/constants.js +3 -0
- package/__inner__/esm/components/ChipGroup/index.d.ts +2 -0
- package/__inner__/esm/components/ChipGroup/index.js +2 -0
- package/__inner__/esm/components/ChipGroup/types.d.ts +33 -0
- package/__inner__/esm/components/ChipGroup/types.js +1 -0
- package/__inner__/esm/components/ChipNext/Chip.css +50 -17
- package/__inner__/esm/components/ChipNext/Chip.js +32 -5
- package/__inner__/esm/components/ChipNext/types.d.ts +9 -5
- package/__inner__/esm/components/ChipNext/types.js +8 -1
- package/__inner__/esm/components/FormGroup/types.d.ts +2 -0
- package/__inner__/esm/components/FormTitle/FormTitle.d.ts +1 -0
- package/__inner__/esm/components/IconButtonNext/types.d.ts +4 -1
- package/__inner__/esm/components/IconButtonNext/utils.d.ts +2 -2
- package/__inner__/esm/components/InputOTP/constants.d.ts +1 -1
- package/__inner__/esm/components/TagNext/types.d.ts +1 -1
- package/__inner__/esm/components/TagNext/types.js +1 -0
- package/__inner__/esm/components/ThemeProvider/types.d.ts +6 -2
- package/__inner__/esm/components/Title/Title.d.ts +4 -0
- package/__inner__/esm/components/Title/Title.js +24 -0
- package/__inner__/esm/components/Title/TitleContext.d.ts +8 -0
- package/__inner__/esm/components/Title/TitleContext.js +12 -0
- package/__inner__/esm/components/Title/components/index.d.ts +1 -0
- package/__inner__/esm/components/Title/components/index.js +1 -0
- package/__inner__/esm/components/Title/components/variant/TitleVariant.d.ts +2 -0
- package/__inner__/esm/components/Title/components/variant/TitleVariant.js +21 -0
- package/__inner__/esm/components/Title/components/variant/index.d.ts +4 -0
- package/__inner__/esm/components/Title/components/variant/index.js +4 -0
- package/__inner__/esm/components/Title/components/variant/main/TitleMain.css +38 -0
- package/__inner__/esm/components/Title/components/variant/main/TitleMain.d.ts +4 -0
- package/__inner__/esm/components/Title/components/variant/main/TitleMain.js +32 -0
- package/__inner__/esm/components/Title/components/variant/main/config.d.ts +3 -0
- package/__inner__/esm/components/Title/components/variant/main/config.js +4 -0
- package/__inner__/esm/components/Title/components/variant/main/index.d.ts +2 -0
- package/__inner__/esm/components/Title/components/variant/main/index.js +2 -0
- package/__inner__/esm/components/Title/components/variant/main/types.d.ts +13 -0
- package/__inner__/esm/components/Title/components/variant/main/types.js +1 -0
- package/__inner__/esm/components/Title/components/variant/secondary/TitleSecondary.css +26 -0
- package/__inner__/esm/components/Title/components/variant/secondary/TitleSecondary.d.ts +4 -0
- package/__inner__/esm/components/Title/components/variant/secondary/TitleSecondary.js +12 -0
- package/__inner__/esm/components/Title/components/variant/secondary/index.d.ts +2 -0
- package/__inner__/esm/components/Title/components/variant/secondary/index.js +2 -0
- package/__inner__/esm/components/Title/components/variant/secondary/types.d.ts +10 -0
- package/__inner__/esm/components/Title/components/variant/secondary/types.js +1 -0
- package/__inner__/esm/components/Title/components/variant/types.d.ts +8 -0
- package/__inner__/esm/components/Title/components/variant/types.js +1 -0
- package/__inner__/esm/components/Title/constants.d.ts +4 -0
- package/__inner__/esm/components/Title/constants.js +3 -0
- package/__inner__/esm/components/Title/entities/icon.d.ts +3 -0
- package/__inner__/esm/components/Title/entities/icon.js +1 -0
- package/__inner__/esm/components/Title/entities/index.d.ts +3 -0
- package/__inner__/esm/components/Title/entities/index.js +3 -0
- package/__inner__/esm/components/Title/entities/size.d.ts +2 -0
- package/__inner__/esm/components/Title/entities/size.js +1 -0
- package/__inner__/esm/components/Title/entities/variant.d.ts +7 -0
- package/__inner__/esm/components/Title/entities/variant.js +1 -0
- package/__inner__/esm/components/Title/index.d.ts +4 -0
- package/__inner__/esm/components/Title/index.js +4 -0
- package/__inner__/esm/components/Title/modules/icon-button/TitleIconButton.d.ts +3 -0
- package/__inner__/esm/components/Title/modules/icon-button/TitleIconButton.js +13 -0
- package/__inner__/esm/components/Title/modules/icon-button/constants.d.ts +1 -0
- package/__inner__/esm/components/Title/modules/icon-button/constants.js +1 -0
- package/__inner__/esm/components/Title/modules/icon-button/index.d.ts +2 -0
- package/__inner__/esm/components/Title/modules/icon-button/index.js +2 -0
- package/__inner__/esm/components/Title/modules/icon-button/types.d.ts +6 -0
- package/__inner__/esm/components/Title/modules/icon-button/types.js +1 -0
- package/__inner__/esm/components/Title/modules/index.d.ts +2 -0
- package/__inner__/esm/components/Title/modules/index.js +2 -0
- package/__inner__/esm/components/Title/modules/tag/TitleTag.css +4 -0
- package/__inner__/esm/components/Title/modules/tag/TitleTag.d.ts +3 -0
- package/__inner__/esm/components/Title/modules/tag/TitleTag.js +8 -0
- package/__inner__/esm/components/Title/modules/tag/constants.d.ts +1 -0
- package/__inner__/esm/components/Title/modules/tag/constants.js +1 -0
- package/__inner__/esm/components/Title/modules/tag/index.d.ts +2 -0
- package/__inner__/esm/components/Title/modules/tag/index.js +2 -0
- package/__inner__/esm/components/Title/modules/tag/types.d.ts +6 -0
- package/__inner__/esm/components/Title/modules/tag/types.js +1 -0
- package/__inner__/esm/components/Title/types.d.ts +10 -0
- package/__inner__/esm/components/Title/types.js +1 -0
- package/__inner__/esm/constants/environment/index.d.ts +2 -0
- package/__inner__/esm/constants/environment/index.js +2 -0
- package/__inner__/esm/constants/environment/isDev.d.ts +1 -0
- package/__inner__/esm/constants/environment/isDev.js +2 -0
- package/__inner__/esm/constants/environment/isProduction.d.ts +1 -0
- package/__inner__/esm/constants/environment/isProduction.js +1 -0
- package/__inner__/esm/types/object/withPartial.d.ts +3 -0
- package/__inner__/esm/types/object/withPartial.js +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.ChipGroup {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.ChipGroup .FormGroup {
|
|
7
|
+
align-items: flex-start;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.ChipGroup .FormGroup_size_xs, .ChipGroup .FormGroup_size_s {
|
|
11
|
+
--form-group-gap: var(--spacing-xs);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ChipGroup .FormGroup_size_m, .ChipGroup .FormGroup_size_l {
|
|
15
|
+
--form-group-gap: var(--spacing-s);
|
|
16
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import './ChipGroup.css';
|
|
2
|
+
import type { ChipGroupBaseProps } from './types';
|
|
3
|
+
export declare const cnChipGroup: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
+
export declare const ChipGroup: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<ChipGroupBaseProps, "div">;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChipGroup = exports.cnChipGroup = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
require("./ChipGroup.css");
|
|
6
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
var useControlled_1 = require("../../hooks/useControlled");
|
|
8
|
+
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
9
|
+
var classname_1 = require("../../utils/classname");
|
|
10
|
+
var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
|
|
11
|
+
var FormGroup_1 = require("../FormGroup");
|
|
12
|
+
var FormTitle_1 = require("../FormTitle");
|
|
13
|
+
var ChipGroupContext_1 = require("./ChipGroupContext");
|
|
14
|
+
var constants_1 = require("./constants");
|
|
15
|
+
exports.cnChipGroup = (0, classname_1.cn)('ChipGroup');
|
|
16
|
+
exports.ChipGroup = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
17
|
+
var props = (0, useThemeProps_1.useThemeProps)({
|
|
18
|
+
props: inProps,
|
|
19
|
+
name: 'ChipGroup',
|
|
20
|
+
});
|
|
21
|
+
var _a = props.direction, direction = _a === void 0 ? constants_1.CHIP_GROUP_DEFAULT_DIRECTION : _a, _b = props.size, size = _b === void 0 ? constants_1.CHIP_GROUP_DEFAULT_SIZE : _b, _c = props.as, Tag = _c === void 0 ? constants_1.CHIP_GROUP_DEFAULT_AS : _c, color = props.color, title = props.title, className = props.className, children = props.children, valueProp = props.value, _d = props.defaultValue, defaultValue = _d === void 0 ? [] : _d, onChange = props.onChange, disabled = props.disabled, titleProps = props.titleProps, groupProps = props.groupProps, other = tslib_1.__rest(props, ["direction", "size", "as", "color", "title", "className", "children", "value", "defaultValue", "onChange", "disabled", "titleProps", "groupProps"]);
|
|
22
|
+
var _e = tslib_1.__read((0, useControlled_1.useControlled)({
|
|
23
|
+
value: valueProp,
|
|
24
|
+
defaultValue: defaultValue,
|
|
25
|
+
name: 'ChipGroup',
|
|
26
|
+
state: 'value',
|
|
27
|
+
}), 2), valueState = _e[0], setValueState = _e[1];
|
|
28
|
+
var onClick = function (event, payload) {
|
|
29
|
+
var itemValue = payload.value;
|
|
30
|
+
if (itemValue === undefined) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
var requiredValueState = valueState !== null && valueState !== void 0 ? valueState : [];
|
|
34
|
+
var isValueAlreadyChecked = requiredValueState.includes(itemValue);
|
|
35
|
+
var value = isValueAlreadyChecked
|
|
36
|
+
? requiredValueState.filter(function (item) { return item !== itemValue; })
|
|
37
|
+
: tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(requiredValueState), false), [itemValue], false);
|
|
38
|
+
setValueState(value);
|
|
39
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
|
|
40
|
+
};
|
|
41
|
+
return (react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnChipGroup)({ size: size }, [className]), role: "group" }, other, { ref: ref }),
|
|
42
|
+
react_1.default.createElement(ChipGroupContext_1.ChipGroupContext.Provider, { value: {
|
|
43
|
+
value: valueState,
|
|
44
|
+
onClick: onClick,
|
|
45
|
+
size: size,
|
|
46
|
+
disabled: disabled,
|
|
47
|
+
color: color,
|
|
48
|
+
} },
|
|
49
|
+
title && (react_1.default.createElement(FormTitle_1.FormTitle, tslib_1.__assign({ size: size }, titleProps), title)),
|
|
50
|
+
react_1.default.createElement(FormGroup_1.FormGroup, tslib_1.__assign({ direction: direction, size: size }, groupProps), children))));
|
|
51
|
+
});
|
|
52
|
+
exports.ChipGroup.displayName = 'ChipGroup';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChipColorVariant, ChipOnClick, ChipSizeVariant } from '../ChipNext';
|
|
2
|
+
import type { ChipGroupValue } from './types';
|
|
3
|
+
export type ChipGroupContextValue = {
|
|
4
|
+
onClick: ChipOnClick;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
value?: ChipGroupValue;
|
|
7
|
+
size?: ChipSizeVariant;
|
|
8
|
+
color?: ChipColorVariant;
|
|
9
|
+
};
|
|
10
|
+
export declare const ChipGroupContext: import("react").Context<ChipGroupContextValue | undefined>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ChipSizeVariant } from '../ChipNext';
|
|
2
|
+
import type { FormGroupDirectionVariant } from '../FormGroup';
|
|
3
|
+
export declare const CHIP_GROUP_DEFAULT_DIRECTION: FormGroupDirectionVariant;
|
|
4
|
+
export declare const CHIP_GROUP_DEFAULT_SIZE: ChipSizeVariant;
|
|
5
|
+
export declare const CHIP_GROUP_DEFAULT_AS = "div";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CHIP_GROUP_DEFAULT_AS = exports.CHIP_GROUP_DEFAULT_SIZE = exports.CHIP_GROUP_DEFAULT_DIRECTION = void 0;
|
|
4
|
+
exports.CHIP_GROUP_DEFAULT_DIRECTION = 'row';
|
|
5
|
+
exports.CHIP_GROUP_DEFAULT_SIZE = 'm';
|
|
6
|
+
exports.CHIP_GROUP_DEFAULT_AS = 'div';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ElementType, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import type { PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
|
|
3
|
+
import type { ChipColorVariant, ChipSizeVariant } from '../ChipNext';
|
|
4
|
+
import type { FormGroupDirectionVariant, FormGroupProps } from '../FormGroup';
|
|
5
|
+
import type { FormTitleProps } from '../FormTitle';
|
|
6
|
+
import type { CHIP_GROUP_DEFAULT_AS } from './constants';
|
|
7
|
+
export type ChipGroupValue = string[];
|
|
8
|
+
export type ChipGroupOnChange = (value: ChipGroupValue, event: MouseEvent<HTMLElement>) => void;
|
|
9
|
+
export type ChipGroupBaseProps = {
|
|
10
|
+
/** Значение по умолчанию (неконтролируемое состояние) */
|
|
11
|
+
defaultValue?: ChipGroupValue;
|
|
12
|
+
/** Текущее значение */
|
|
13
|
+
value?: ChipGroupValue;
|
|
14
|
+
/** Вариант представления компонента */
|
|
15
|
+
color?: ChipColorVariant;
|
|
16
|
+
/** Размер */
|
|
17
|
+
size?: ChipSizeVariant;
|
|
18
|
+
/** Содержимое компонента */
|
|
19
|
+
children?: ReactNode;
|
|
20
|
+
/** Направление */
|
|
21
|
+
direction?: FormGroupDirectionVariant;
|
|
22
|
+
/** Событие изменения состояния */
|
|
23
|
+
onChange?: ChipGroupOnChange;
|
|
24
|
+
/** Если `true` делает элементы неактивными */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Идентификатор компонента для тестов */
|
|
27
|
+
'data-testid'?: string;
|
|
28
|
+
/** Свойства FormTitle */
|
|
29
|
+
titleProps?: FormTitleProps;
|
|
30
|
+
/** Свойства FormGroup */
|
|
31
|
+
groupProps?: FormGroupProps;
|
|
32
|
+
};
|
|
33
|
+
export type ChipGroupProps<As extends ElementType = typeof CHIP_GROUP_DEFAULT_AS> = PolymorphicComponentPropsWithoutRef<ChipGroupBaseProps, As>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* stylelint-disable */
|
|
2
2
|
.ChipNext {
|
|
3
|
+
--chip-outline: var(--shadow-outline-focused);
|
|
3
4
|
--chip-border-radius: 24px;
|
|
4
5
|
--chip-text-wrap: nowrap;
|
|
5
6
|
background-color: var(--chip-bg-color);
|
|
@@ -72,17 +73,53 @@
|
|
|
72
73
|
--chip-padding-x: var(--spacing-m);
|
|
73
74
|
}
|
|
74
75
|
.ChipNext_color_primary {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
--chip-bg-color: var(--color-background-action-light);
|
|
77
|
+
--chip-bg-color-hover: var(--color-background-action-light-hover);
|
|
78
|
+
--chip-bg-color-active: var(--color-background-action-light-pressed);
|
|
79
|
+
--chip-text-color: var(--color-content-action-dark);
|
|
80
|
+
}
|
|
80
81
|
.ChipNext_color_secondary {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
--chip-bg-color: var(--color-background-secondary);
|
|
83
|
+
--chip-bg-color-hover: var(--color-background-secondary-hover);
|
|
84
|
+
--chip-bg-color-active: var(--color-background-secondary-pressed);
|
|
85
|
+
--chip-text-color: var(--color-content-primary);
|
|
86
|
+
}
|
|
87
|
+
.ChipNext_color_main {
|
|
88
|
+
--chip-bg-color: var(--color-background-main);
|
|
89
|
+
--chip-bg-color-hover: var(--color-background-main-hover);
|
|
90
|
+
--chip-bg-color-active: var(--color-background-main-pressed);
|
|
91
|
+
--chip-text-color: var(--color-content-primary);
|
|
92
|
+
}
|
|
93
|
+
.ChipNext_color_overlay {
|
|
94
|
+
--chip-bg-color: var(--color-background-overlay);
|
|
95
|
+
--chip-bg-color-hover: var(--color-background-overlay);
|
|
96
|
+
--chip-bg-color-active: var(--color-background-overlay);
|
|
97
|
+
--chip-text-color: var(--color-content-action-on);
|
|
98
|
+
}
|
|
99
|
+
.ChipNext_color_primary.ChipNext_checked {
|
|
100
|
+
--chip-bg-color: var(--color-background-action);
|
|
101
|
+
--chip-bg-color-hover: var(--color-background-action);
|
|
102
|
+
--chip-bg-color-active: var(--color-background-action);
|
|
103
|
+
--chip-text-color: var(--color-content-action-on);
|
|
104
|
+
}
|
|
105
|
+
.ChipNext_color_primary.ChipNext_checked.ChipNext_disabled {
|
|
106
|
+
--chip-bg-color: var(--color-background-action-active-disabled);
|
|
107
|
+
--chip-bg-color-hover: var(--color-background-action-active-disabled);
|
|
108
|
+
--chip-bg-color-active: var(--color-background-action-active-disabled);
|
|
109
|
+
--chip-text-color: var(--color-content-primary-inverse);
|
|
110
|
+
}
|
|
111
|
+
.ChipNext_color_secondary.ChipNext_checked, .ChipNext_color_main.ChipNext_checked, .ChipNext_color_overlay.ChipNext_checked {
|
|
112
|
+
--chip-bg-color: var(--color-background-action-secondary);
|
|
113
|
+
--chip-bg-color-hover: var(--color-background-action-secondary);
|
|
114
|
+
--chip-bg-color-active: var(--color-background-action-secondary);
|
|
115
|
+
--chip-text-color: var(--color-content-action-on);
|
|
116
|
+
}
|
|
117
|
+
.ChipNext_color_secondary.ChipNext_checked.ChipNext_disabled, .ChipNext_color_main.ChipNext_checked.ChipNext_disabled, .ChipNext_color_overlay.ChipNext_checked.ChipNext_disabled {
|
|
118
|
+
--chip-bg-color: var(--color-background-action-secondary-active-disabled);
|
|
119
|
+
--chip-bg-color-hover: var(--color-background-action-secondary-active-disabled);
|
|
120
|
+
--chip-bg-color-active: var(--color-background-action-secondary-active-disabled);
|
|
121
|
+
--chip-text-color: var(--color-content-primary-inverse);
|
|
122
|
+
}
|
|
86
123
|
.ChipNext:hover {
|
|
87
124
|
--chip-bg-color: var(--chip-bg-color-hover);
|
|
88
125
|
}
|
|
@@ -90,19 +127,15 @@
|
|
|
90
127
|
--chip-bg-color: var(--chip-bg-color-active);
|
|
91
128
|
}
|
|
92
129
|
.ChipNext:focus {
|
|
93
|
-
box-shadow: var(--
|
|
130
|
+
box-shadow: var(--chip-outline);
|
|
94
131
|
}
|
|
95
132
|
.ChipNext:focus:not(:focus-visible) {
|
|
96
133
|
box-shadow: none;
|
|
97
134
|
}
|
|
98
|
-
.ChipNext_checked,
|
|
99
|
-
.ChipNext_checked:hover,
|
|
100
|
-
.ChipNext_checked:active {
|
|
101
|
-
--chip-bg-color: var(--color-background-action);
|
|
102
|
-
--chip-text-color: var(--color-content-action-on);
|
|
103
|
-
}
|
|
104
135
|
.ChipNext_disabled {
|
|
105
136
|
--chip-bg-color: var(--color-background-disabled);
|
|
137
|
+
--chip-bg-color-hover: var(--color-background-disabled);
|
|
138
|
+
--chip-bg-color-active: var(--color-background-disabled);
|
|
106
139
|
--chip-text-color: var(--color-content-disabled);
|
|
107
140
|
pointer-events: none;
|
|
108
141
|
}
|
|
@@ -3,19 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Chip = exports.cnChip = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
require("./Chip.css");
|
|
6
|
-
var react_1 = tslib_1.
|
|
6
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
var logger_1 = require("@ozen-ui/logger");
|
|
8
|
+
var environment_1 = require("../../constants/environment");
|
|
7
9
|
var useControlled_1 = require("../../hooks/useControlled");
|
|
8
10
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
9
11
|
var classname_1 = require("../../utils/classname");
|
|
10
12
|
var getIconSizeToFormElement_1 = require("../../utils/getIconSizeToFormElement");
|
|
11
13
|
var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
|
|
12
14
|
var renderContent_1 = require("../../utils/renderContent");
|
|
15
|
+
var ChipGroupContext_1 = require("../ChipGroup/ChipGroupContext");
|
|
13
16
|
var constants_1 = require("./constants");
|
|
14
17
|
exports.cnChip = (0, classname_1.cn)('ChipNext');
|
|
15
18
|
exports.Chip = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
16
|
-
var _a = (0, useThemeProps_1.useThemeProps)({ name: 'ChipNext', props: inProps }), _b = _a.size,
|
|
19
|
+
var _a = (0, useThemeProps_1.useThemeProps)({ name: 'ChipNext', props: inProps }), _b = _a.size, sizeProp = _b === void 0 ? constants_1.CHIP_DEFAULT_SIZE : _b, _c = _a.color, colorProp = _c === void 0 ? constants_1.CHIP_DEFAULT_VARIANT : _c, _d = _a.disabled, disabledProp = _d === void 0 ? constants_1.CHIP_DEFAULT_DISABLED : _d, iconLeft = _a.iconLeft, iconRight = _a.iconRight, multiline = _a.multiline, className = _a.className, children = _a.children, onClick = _a.onClick, checkedProp = _a.checked, _e = _a.as, Tag = _e === void 0 ? constants_1.CHIP_DEFAULT_TAG : _e, value = _a.value, dataTestId = _a["data-testid"], other = tslib_1.__rest(_a, ["size", "color", "disabled", "iconLeft", "iconRight", "multiline", "className", "children", "onClick", "checked", "as", "value", 'data-testid']);
|
|
20
|
+
var checked = checkedProp;
|
|
21
|
+
var size = sizeProp;
|
|
22
|
+
var disabled = disabledProp;
|
|
23
|
+
var color = colorProp;
|
|
24
|
+
var chipGroup = (0, react_1.useContext)(ChipGroupContext_1.ChipGroupContext);
|
|
25
|
+
if (chipGroup) {
|
|
26
|
+
if (environment_1.IS_DEV && value === undefined) {
|
|
27
|
+
logger_1.logger.error('Отсутствует параметр "value" для Chip, находящегося в ChipGroup.');
|
|
28
|
+
}
|
|
29
|
+
if (checked === undefined && chipGroup.value) {
|
|
30
|
+
checked = chipGroup === null || chipGroup === void 0 ? void 0 : chipGroup.value.includes(value);
|
|
31
|
+
}
|
|
32
|
+
if (inProps.size === undefined && chipGroup.size) {
|
|
33
|
+
size = chipGroup.size;
|
|
34
|
+
}
|
|
35
|
+
if (inProps.disabled === undefined && chipGroup.disabled !== undefined) {
|
|
36
|
+
disabled = chipGroup.disabled;
|
|
37
|
+
}
|
|
38
|
+
if (inProps.color === undefined && chipGroup.color) {
|
|
39
|
+
color = chipGroup.color;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
17
42
|
var _f = tslib_1.__read((0, useControlled_1.useControlled)({
|
|
18
|
-
value:
|
|
43
|
+
value: checked,
|
|
19
44
|
defaultValue: false,
|
|
20
45
|
name: 'ChipNext',
|
|
21
46
|
state: 'open',
|
|
@@ -24,8 +49,10 @@ exports.Chip = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(fu
|
|
|
24
49
|
if (disabled) {
|
|
25
50
|
return;
|
|
26
51
|
}
|
|
27
|
-
|
|
28
|
-
|
|
52
|
+
var newCheckedState = !checkedState;
|
|
53
|
+
setCheckedState(newCheckedState);
|
|
54
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event, { checked: newCheckedState, value: value });
|
|
55
|
+
chipGroup === null || chipGroup === void 0 ? void 0 : chipGroup.onClick(event, { checked: newCheckedState, value: value });
|
|
29
56
|
};
|
|
30
57
|
var renderIcon = function (content) {
|
|
31
58
|
return (0, renderContent_1.renderContent)({
|
|
@@ -3,11 +3,15 @@ import type { IconProps } from '@ozen-ui/icons';
|
|
|
3
3
|
import type { PolymorphicComponentPropsWithRef } from '../../utils/polymorphicComponentWithRef';
|
|
4
4
|
import type { RenderContentType } from '../../utils/renderContent';
|
|
5
5
|
import type { CHIP_DEFAULT_TAG } from './constants';
|
|
6
|
+
export declare const chipColorVariant: readonly ["primary", "secondary", "main", "overlay"];
|
|
7
|
+
export type ChipColorVariant = (typeof chipColorVariant)[number];
|
|
6
8
|
export declare const chipSizeVariant: readonly ["xs", "s", "m", "l"];
|
|
7
|
-
export declare const chipColorVariant: readonly ["primary", "secondary"];
|
|
8
9
|
export type ChipSizeVariant = (typeof chipSizeVariant)[number];
|
|
9
|
-
export type ChipColorVariant = (typeof chipColorVariant)[number];
|
|
10
10
|
export type ChipIcon = RenderContentType<IconProps>['content'];
|
|
11
|
+
export type ChipOnClick = (event: MouseEvent<HTMLElement>, payload: {
|
|
12
|
+
checked: boolean;
|
|
13
|
+
value: string | undefined;
|
|
14
|
+
}) => void;
|
|
11
15
|
export type ChipBaseProps = {
|
|
12
16
|
/** Размер компонента */
|
|
13
17
|
size?: ChipSizeVariant;
|
|
@@ -18,9 +22,9 @@ export type ChipBaseProps = {
|
|
|
18
22
|
/** Если `true` делает элемент выбранным */
|
|
19
23
|
checked?: boolean;
|
|
20
24
|
/** Обработчик нажатия */
|
|
21
|
-
onClick?:
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
onClick?: ChipOnClick;
|
|
26
|
+
/** Значение chip */
|
|
27
|
+
value?: string;
|
|
24
28
|
/** Иконка слева */
|
|
25
29
|
iconLeft?: ChipIcon;
|
|
26
30
|
/** Иконка справа */
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.chipSizeVariant = exports.chipColorVariant = void 0;
|
|
4
|
+
// ---- COLOR ----
|
|
5
|
+
exports.chipColorVariant = [
|
|
6
|
+
'primary',
|
|
7
|
+
'secondary',
|
|
8
|
+
'main',
|
|
9
|
+
'overlay',
|
|
10
|
+
];
|
|
11
|
+
// ---- SIZE ----
|
|
4
12
|
exports.chipSizeVariant = ['xs', 's', 'm', 'l'];
|
|
5
|
-
exports.chipColorVariant = ['primary', 'secondary'];
|
|
@@ -13,5 +13,7 @@ export type FormGroupBaseProps = {
|
|
|
13
13
|
children?: ReactNode;
|
|
14
14
|
/** Направление */
|
|
15
15
|
direction?: FormGroupDirectionVariant;
|
|
16
|
+
/** data-атрибут для тестирования */
|
|
17
|
+
'data-testid'?: string;
|
|
16
18
|
};
|
|
17
19
|
export type FormGroupProps<As extends ElementType = 'div'> = PolymorphicComponentPropsWithoutRef<FormGroupBaseProps, As>;
|
|
@@ -5,6 +5,7 @@ import { type PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphi
|
|
|
5
5
|
export type FormTitleBaseProps = {
|
|
6
6
|
/** Размер — влияет на размер шрифта и отступы заголовка */
|
|
7
7
|
size?: FormElementSizeVariant;
|
|
8
|
+
'data-testid'?: string;
|
|
8
9
|
};
|
|
9
10
|
export type FormTitleProps<As extends ElementType = 'div'> = PolymorphicComponentPropsWithoutRef<FormTitleBaseProps, As>;
|
|
10
11
|
export declare const cnFormTitle: import("@bem-react/classname").ClassNameFormatter;
|
|
@@ -8,6 +8,7 @@ export declare const iconButtonColorVariant: readonly ["primary", "secondary", "
|
|
|
8
8
|
export declare const iconButtonVariant: readonly ["contained", "contained-additional", "ghost", "function", "floating"];
|
|
9
9
|
export type IconButtonVariant = (typeof iconButtonVariant)[number];
|
|
10
10
|
export type IconButtonColorVariant = (typeof iconButtonColorVariant)[number];
|
|
11
|
+
export type IconButtonSize = FormElementSizeVariant;
|
|
11
12
|
export type IconButtonIcon = RenderContentType<IconProps>['content'];
|
|
12
13
|
export type IconButtonBaseProps = {
|
|
13
14
|
/** Иконка */
|
|
@@ -15,7 +16,7 @@ export type IconButtonBaseProps = {
|
|
|
15
16
|
/** Вариант представления компонента */
|
|
16
17
|
variant?: IconButtonVariant;
|
|
17
18
|
/** Размер */
|
|
18
|
-
size?:
|
|
19
|
+
size?: IconButtonSize;
|
|
19
20
|
/** Основной цвет компонента */
|
|
20
21
|
color?: IconButtonColorVariant;
|
|
21
22
|
/** Цвет иконки кнопки */
|
|
@@ -30,6 +31,8 @@ export type IconButtonBaseProps = {
|
|
|
30
31
|
className?: string;
|
|
31
32
|
/** Если `true` делает компонент круглым */
|
|
32
33
|
rounded?: boolean;
|
|
34
|
+
/** Идентификатор компонента для тестов */
|
|
35
|
+
'data-testid'?: string;
|
|
33
36
|
children?: never;
|
|
34
37
|
};
|
|
35
38
|
export type IconButtonProps<As extends ElementType = typeof ICON_BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<IconButtonBaseProps, As>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
2
1
|
import type { LoaderSizeVariant } from '../Loader';
|
|
2
|
+
import type { IconButtonSize } from './types';
|
|
3
3
|
export declare const loaderSizeMapper: {
|
|
4
|
-
[key in
|
|
4
|
+
[key in IconButtonSize]: LoaderSizeVariant;
|
|
5
5
|
};
|
|
@@ -2,7 +2,7 @@ import type { StackGapVariant } from '../Stack';
|
|
|
2
2
|
import type { InputOTPAutoCompleteMode, InputOTPSizeVariant } from './types';
|
|
3
3
|
export declare const INPUT_OTP_DEFAULT_TAG = "div";
|
|
4
4
|
export declare const INPUT_OTP_DEFAULT_AUTO_COMPLETE_MODE: InputOTPAutoCompleteMode;
|
|
5
|
-
export declare const INPUT_OTP_DEFAULT_DISABLE_STROKE
|
|
5
|
+
export declare const INPUT_OTP_DEFAULT_DISABLE_STROKE: boolean;
|
|
6
6
|
export declare const INPUT_OTP_DEFAULT_SIZE: InputOTPSizeVariant;
|
|
7
7
|
export declare const INPUT_OTP_SPACING_BY_SIZE: Readonly<Record<InputOTPSizeVariant, StackGapVariant>>;
|
|
8
8
|
export declare const INPUT_OTP_DEFAULT_FINISH_BEHAVIOR: ({ isFullFilled }: import("./types").InputOTPFinishBehaviorContext) => boolean;
|
|
@@ -5,7 +5,7 @@ import type { PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphi
|
|
|
5
5
|
import type { RenderContentType } from '../../utils/renderContent';
|
|
6
6
|
import type { TAG_DEFAULT_TAG } from './constants';
|
|
7
7
|
export declare const tagVariant: readonly ["primary", "secondary"];
|
|
8
|
-
export declare const tagColorVariant: readonly ["neutral", "action", "error", "warning", "success", "info"];
|
|
8
|
+
export declare const tagColorVariant: readonly ["neutral", "action", "error", "warning", "success", "info", "uncolored"];
|
|
9
9
|
export type TagVariant = (typeof tagVariant)[number];
|
|
10
10
|
export type TagColor = (typeof tagColorVariant)[number];
|
|
11
11
|
export type TagIcon = RenderContentType<IconProps>['content'];
|
|
@@ -16,7 +16,8 @@ import type { CardProps } from '../Card';
|
|
|
16
16
|
import type { CheckboxProps } from '../Checkbox';
|
|
17
17
|
import type { CheckboxGroupProps } from '../CheckboxGroup';
|
|
18
18
|
import type { ChipProps } from '../Chip';
|
|
19
|
-
import type {
|
|
19
|
+
import type { ChipGroupProps } from '../ChipGroup';
|
|
20
|
+
import type { ChipProps as ChipNextProps } from '../ChipNext';
|
|
20
21
|
import type { CollapseProps } from '../Collapse';
|
|
21
22
|
import type { ContainerProps } from '../Container';
|
|
22
23
|
import type { DataListProps } from '../DataList';
|
|
@@ -56,6 +57,7 @@ import type { TableContainerProps, TableProps, TableCaptionProps, TableCellProps
|
|
|
56
57
|
import type { TagProps } from '../Tag';
|
|
57
58
|
import type { TagProps as TagPropsNext } from '../TagNext';
|
|
58
59
|
import type { TextareaProps } from '../Textarea';
|
|
60
|
+
import type { TitleProps } from '../Title';
|
|
59
61
|
import type { ToggleProps } from '../Toggle';
|
|
60
62
|
import type { TooltipProps } from '../Tooltip';
|
|
61
63
|
import type { TypographyProps } from '../Typography';
|
|
@@ -91,7 +93,8 @@ export type Theme = {
|
|
|
91
93
|
Checkbox?: Partial<CheckboxProps>;
|
|
92
94
|
CheckboxGroup?: Partial<CheckboxGroupProps>;
|
|
93
95
|
Chip?: Partial<ChipProps>;
|
|
94
|
-
ChipNext?: Partial<
|
|
96
|
+
ChipNext?: Partial<ChipNextProps>;
|
|
97
|
+
ChipGroup?: Partial<ChipGroupProps>;
|
|
95
98
|
Collapse?: Partial<CollapseProps>;
|
|
96
99
|
Container?: Partial<ContainerProps>;
|
|
97
100
|
DataList?: Partial<DataListProps>;
|
|
@@ -140,6 +143,7 @@ export type Theme = {
|
|
|
140
143
|
Tag?: Partial<TagProps>;
|
|
141
144
|
TagNext?: Partial<TagPropsNext>;
|
|
142
145
|
Textarea?: Partial<TextareaProps>;
|
|
146
|
+
Title?: Partial<TitleProps>;
|
|
143
147
|
Toggle?: Partial<ToggleProps>;
|
|
144
148
|
Tooltip?: Partial<TooltipProps>;
|
|
145
149
|
Typography?: Partial<TypographyProps>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import './modules/tag/TitleTag.css';
|
|
2
|
+
import type { TitleBaseProps } from './types';
|
|
3
|
+
export declare const cnTitle: import("@bem-react/classname").ClassNameFormatter;
|
|
4
|
+
export declare const Title: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<TitleBaseProps, "div">;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Title = exports.cnTitle = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
require("./modules/tag/TitleTag.css");
|
|
6
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
8
|
+
var classname_1 = require("../../utils/classname");
|
|
9
|
+
var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
|
|
10
|
+
var components_1 = require("./components");
|
|
11
|
+
var constants_1 = require("./constants");
|
|
12
|
+
var TitleContext_1 = require("./TitleContext");
|
|
13
|
+
exports.cnTitle = (0, classname_1.cn)('Title');
|
|
14
|
+
exports.Title = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
|
|
15
|
+
var props = (0, useThemeProps_1.useThemeProps)({
|
|
16
|
+
props: inProps,
|
|
17
|
+
name: 'Title',
|
|
18
|
+
});
|
|
19
|
+
var _a = props.size, size = _a === void 0 ? constants_1.TITLE_DEFAULT_SIZE : _a, classNameProp = props.className, _b = props.as, as = _b === void 0 ? constants_1.TITLE_DEFAULT_TAG : _b, _c = props.variant, variant = _c === void 0 ? constants_1.TITLE_DEFAULT_VARIANT : _c, other = tslib_1.__rest(props, ["size", "className", "as", "variant"]);
|
|
20
|
+
var className = (0, exports.cnTitle)('', [classNameProp]);
|
|
21
|
+
return (react_1.default.createElement(TitleContext_1.TitleContext.Provider, { value: {
|
|
22
|
+
size: size,
|
|
23
|
+
variant: variant,
|
|
24
|
+
} },
|
|
25
|
+
react_1.default.createElement(components_1.TitleVariant, tslib_1.__assign({}, other, { ref: ref, as: as, className: className, size: size, variant: variant }))));
|
|
26
|
+
});
|
|
27
|
+
exports.Title.displayName = 'Title';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TitleVariant, TitleSizeVariant } from './entities';
|
|
3
|
+
export type TitleContextValue = {
|
|
4
|
+
variant: TitleVariant;
|
|
5
|
+
size: TitleSizeVariant;
|
|
6
|
+
};
|
|
7
|
+
export declare const TitleContext: React.Context<TitleContextValue>;
|
|
8
|
+
export declare const useTitleContext: () => TitleContextValue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTitleContext = exports.TitleContext = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
+
var environment_1 = require("../../constants/environment");
|
|
7
|
+
var constants_1 = require("./constants");
|
|
8
|
+
exports.TitleContext = react_1.default.createContext({
|
|
9
|
+
variant: constants_1.TITLE_DEFAULT_VARIANT,
|
|
10
|
+
size: constants_1.TITLE_DEFAULT_SIZE,
|
|
11
|
+
});
|
|
12
|
+
var useTitleContext = function () { return (0, react_1.useContext)(exports.TitleContext); };
|
|
13
|
+
exports.useTitleContext = useTitleContext;
|
|
14
|
+
// Именованный провайдер
|
|
15
|
+
if (environment_1.IS_DEV) {
|
|
16
|
+
exports.TitleContext.displayName = 'TitleContext';
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './variant';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TitleVariant = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
var logger_1 = require("@ozen-ui/logger");
|
|
7
|
+
var environment_1 = require("../../../../constants/environment");
|
|
8
|
+
var polymorphicComponentWithRef_1 = require("../../../../utils/polymorphicComponentWithRef");
|
|
9
|
+
var entities_1 = require("../../entities");
|
|
10
|
+
var main_1 = require("./main");
|
|
11
|
+
var secondary_1 = require("./secondary");
|
|
12
|
+
exports.TitleVariant = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (_a, ref) {
|
|
13
|
+
var variant = _a.variant, as = _a.as, other = tslib_1.__rest(_a, ["variant", "as"]);
|
|
14
|
+
if (variant === 'main') {
|
|
15
|
+
return react_1.default.createElement(main_1.TitleMain, tslib_1.__assign({}, other, { as: as, ref: ref }));
|
|
16
|
+
}
|
|
17
|
+
if (variant === 'secondary') {
|
|
18
|
+
return react_1.default.createElement(secondary_1.TitleSecondary, tslib_1.__assign({}, other, { as: as, ref: ref }));
|
|
19
|
+
}
|
|
20
|
+
if (environment_1.IS_DEV) {
|
|
21
|
+
logger_1.logger.error("\u0423 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442\u0430 'Title' \u043D\u0435\u0442 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u0430 '".concat(variant, "'. \u0414\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0435 \u0432\u0430\u0440\u0438\u0430\u043D\u0442\u044B: [").concat(entities_1.titleVariant.join(', '), "]'"));
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./main"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./secondary"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./TitleVariant"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./types"), exports);
|