@ozen-ui/kit 0.36.0 → 0.37.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/__inner__/cjs/components/Button/Button.css +12 -6
- package/__inner__/cjs/components/Button/Button.js +5 -4
- package/__inner__/cjs/components/Chip/Chip.js +4 -0
- package/__inner__/esm/components/Button/Button.css +12 -6
- package/__inner__/esm/components/Button/Button.js +5 -4
- package/__inner__/esm/components/Chip/Chip.js +4 -0
- package/package.json +3 -1
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
opacity var(--transition-default);
|
|
22
22
|
-webkit-tap-highlight-color: unset;
|
|
23
23
|
position: relative;
|
|
24
|
-
gap: var(--spacing-2xs);
|
|
25
24
|
}
|
|
26
25
|
.Button > svg {
|
|
27
26
|
flex-shrink: 0;
|
|
@@ -249,11 +248,21 @@
|
|
|
249
248
|
pointer-events: none;
|
|
250
249
|
cursor: auto;
|
|
251
250
|
}
|
|
252
|
-
.Button-
|
|
251
|
+
.Button_loading .Button-Content {
|
|
252
|
+
opacity: 0;
|
|
253
|
+
}
|
|
254
|
+
.Button-Content {
|
|
253
255
|
flex-grow: 1;
|
|
254
256
|
flex-shrink: 1;
|
|
255
|
-
|
|
257
|
+
display: flex;
|
|
256
258
|
text-align: center;
|
|
259
|
+
place-content: center;
|
|
260
|
+
align-items: center;
|
|
261
|
+
min-inline-size: 0;
|
|
262
|
+
gap: var(--spacing-2xs);
|
|
263
|
+
}
|
|
264
|
+
.Button-Label {
|
|
265
|
+
overflow: hidden;
|
|
257
266
|
text-overflow: ellipsis;
|
|
258
267
|
white-space: nowrap;
|
|
259
268
|
}
|
|
@@ -274,9 +283,6 @@
|
|
|
274
283
|
opacity: 0;
|
|
275
284
|
transition: opacity var(--transition-default);
|
|
276
285
|
}
|
|
277
|
-
.Button-Loader + * {
|
|
278
|
-
visibility: hidden;
|
|
279
|
-
}
|
|
280
286
|
.Button .Loader {
|
|
281
287
|
color: var(--color-content-disabled);
|
|
282
288
|
}
|
|
@@ -49,11 +49,12 @@ exports.Button = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(
|
|
|
49
49
|
};
|
|
50
50
|
var isInteractionPrevented = disabled || loading;
|
|
51
51
|
var childContent = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
|
+
react_1.default.createElement("span", { className: (0, exports.cnButton)('Content') },
|
|
53
|
+
renderIcon(iconLeft),
|
|
54
|
+
react_1.default.createElement("span", tslib_1.__assign({}, labelProps, { className: (0, exports.cnButton)('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelProps === null || labelProps === void 0 ? void 0 : labelProps.ref }), children),
|
|
55
|
+
renderIcon(iconRight)),
|
|
52
56
|
react_1.default.createElement(react_transition_group_1.CSSTransition, { in: loading, timeout: 120, classNames: (0, exports.cnButton)('Loader', { animation: true }), unmountOnExit: true },
|
|
53
|
-
react_1.default.createElement(Loader_1.Loader, { size: iconSize }))
|
|
54
|
-
renderIcon(iconLeft),
|
|
55
|
-
react_1.default.createElement("span", tslib_1.__assign({}, labelProps, { className: (0, exports.cnButton)('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelProps === null || labelProps === void 0 ? void 0 : labelProps.ref }), children),
|
|
56
|
-
renderIcon(iconRight)));
|
|
57
|
+
react_1.default.createElement(Loader_1.Loader, { size: iconSize, className: (0, exports.cnButton)('Loader') }))));
|
|
57
58
|
return (react_1.default.createElement(Tag, tslib_1.__assign({ disabled: isInteractionPrevented, onClick: handleClick, type: "button", className: (0, exports.cnButton)({
|
|
58
59
|
variant: variant,
|
|
59
60
|
size: size,
|
|
@@ -4,6 +4,7 @@ exports.Chip = exports.chipColorVariant = exports.chipSizeVariant = exports.cnCh
|
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
require("./Chip.css");
|
|
6
6
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
|
+
var logger_1 = require("@ozen-ui/logger");
|
|
7
8
|
var useThemeProps_1 = require("../../hooks/useThemeProps");
|
|
8
9
|
var classname_1 = require("../../utils/classname");
|
|
9
10
|
var getIconSizeToFormElement_1 = require("../../utils/getIconSizeToFormElement");
|
|
@@ -17,6 +18,9 @@ exports.chipColorVariant = ['primary', 'secondary'];
|
|
|
17
18
|
exports.Chip = (0, react_1.forwardRef)(function (inProps, ref) {
|
|
18
19
|
var _a = (0, useThemeProps_1.useThemeProps)({ name: 'Chip', props: inProps }), _b = _a.size, size = _b === void 0 ? constants_1.CHIP_DEFAULT_SIZE : _b, _c = _a.color, color = _c === void 0 ? constants_1.CHIP_DEFAULT_VARIANT : _c, _d = _a.disabled, disabled = _d === void 0 ? constants_1.CHIP_DEFAULT_DISABLED : _d, IconLeft = _a.iconLeft, IconRight = _a.iconRight, labelProps = _a.labelProps, inputRef = _a.inputRef, className = _a.className, children = _a.children, dataTestId = _a["data-testid"], other = tslib_1.__rest(_a, ["size", "color", "disabled", "iconLeft", "iconRight", "labelProps", "inputRef", "className", "children", 'data-testid']);
|
|
19
20
|
var iconSize = (0, react_1.useMemo)(function () { return (0, getIconSizeToFormElement_1.getIconSizeToFormElement)(size); }, [size]);
|
|
21
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
22
|
+
(0, logger_1.deprecate)("\u041A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442 \u00ABChip\u00BB \u0443\u0441\u0442\u0430\u0440\u0435\u043B. \u0414\u043B\u044F \u0437\u0430\u043C\u0435\u043D\u044B \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442 \u00ABChipNext\u00BB.");
|
|
23
|
+
}
|
|
20
24
|
return (react_1.default.createElement("label", tslib_1.__assign({ ref: ref, className: (0, exports.cnChip)('', { size: size, disabled: disabled, color: color }, [className]), "data-testid": dataTestId }, labelProps),
|
|
21
25
|
react_1.default.createElement("input", tslib_1.__assign({ ref: inputRef, className: (0, exports.cnChip)('Input'), disabled: disabled, type: "checkbox" }, other)),
|
|
22
26
|
react_1.default.createElement("span", { className: (0, exports.cnChip)('Content') },
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
opacity var(--transition-default);
|
|
22
22
|
-webkit-tap-highlight-color: unset;
|
|
23
23
|
position: relative;
|
|
24
|
-
gap: var(--spacing-2xs);
|
|
25
24
|
}
|
|
26
25
|
.Button > svg {
|
|
27
26
|
flex-shrink: 0;
|
|
@@ -249,11 +248,21 @@
|
|
|
249
248
|
pointer-events: none;
|
|
250
249
|
cursor: auto;
|
|
251
250
|
}
|
|
252
|
-
.Button-
|
|
251
|
+
.Button_loading .Button-Content {
|
|
252
|
+
opacity: 0;
|
|
253
|
+
}
|
|
254
|
+
.Button-Content {
|
|
253
255
|
flex-grow: 1;
|
|
254
256
|
flex-shrink: 1;
|
|
255
|
-
|
|
257
|
+
display: flex;
|
|
256
258
|
text-align: center;
|
|
259
|
+
place-content: center;
|
|
260
|
+
align-items: center;
|
|
261
|
+
min-inline-size: 0;
|
|
262
|
+
gap: var(--spacing-2xs);
|
|
263
|
+
}
|
|
264
|
+
.Button-Label {
|
|
265
|
+
overflow: hidden;
|
|
257
266
|
text-overflow: ellipsis;
|
|
258
267
|
white-space: nowrap;
|
|
259
268
|
}
|
|
@@ -274,9 +283,6 @@
|
|
|
274
283
|
opacity: 0;
|
|
275
284
|
transition: opacity var(--transition-default);
|
|
276
285
|
}
|
|
277
|
-
.Button-Loader + * {
|
|
278
|
-
visibility: hidden;
|
|
279
|
-
}
|
|
280
286
|
.Button .Loader {
|
|
281
287
|
color: var(--color-content-disabled);
|
|
282
288
|
}
|
|
@@ -46,11 +46,12 @@ export var Button = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
46
46
|
};
|
|
47
47
|
var isInteractionPrevented = disabled || loading;
|
|
48
48
|
var childContent = (React.createElement(React.Fragment, null,
|
|
49
|
+
React.createElement("span", { className: cnButton('Content') },
|
|
50
|
+
renderIcon(iconLeft),
|
|
51
|
+
React.createElement("span", __assign({}, labelProps, { className: cnButton('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelProps === null || labelProps === void 0 ? void 0 : labelProps.ref }), children),
|
|
52
|
+
renderIcon(iconRight)),
|
|
49
53
|
React.createElement(CSSTransition, { in: loading, timeout: 120, classNames: cnButton('Loader', { animation: true }), unmountOnExit: true },
|
|
50
|
-
React.createElement(Loader, { size: iconSize }))
|
|
51
|
-
renderIcon(iconLeft),
|
|
52
|
-
React.createElement("span", __assign({}, labelProps, { className: cnButton('Label', [labelProps === null || labelProps === void 0 ? void 0 : labelProps.className]), ref: labelProps === null || labelProps === void 0 ? void 0 : labelProps.ref }), children),
|
|
53
|
-
renderIcon(iconRight)));
|
|
54
|
+
React.createElement(Loader, { size: iconSize, className: cnButton('Loader') }))));
|
|
54
55
|
return (React.createElement(Tag, __assign({ disabled: isInteractionPrevented, onClick: handleClick, type: "button", className: cnButton({
|
|
55
56
|
variant: variant,
|
|
56
57
|
size: size,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import './Chip.css';
|
|
3
3
|
import React, { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { deprecate } from '@ozen-ui/logger';
|
|
4
5
|
import { useThemeProps } from '../../hooks/useThemeProps';
|
|
5
6
|
import { cn } from '../../utils/classname';
|
|
6
7
|
import { getIconSizeToFormElement } from '../../utils/getIconSizeToFormElement';
|
|
@@ -14,6 +15,9 @@ export var chipColorVariant = ['primary', 'secondary'];
|
|
|
14
15
|
export var Chip = forwardRef(function (inProps, ref) {
|
|
15
16
|
var _a = useThemeProps({ name: 'Chip', props: inProps }), _b = _a.size, size = _b === void 0 ? CHIP_DEFAULT_SIZE : _b, _c = _a.color, color = _c === void 0 ? CHIP_DEFAULT_VARIANT : _c, _d = _a.disabled, disabled = _d === void 0 ? CHIP_DEFAULT_DISABLED : _d, IconLeft = _a.iconLeft, IconRight = _a.iconRight, labelProps = _a.labelProps, inputRef = _a.inputRef, className = _a.className, children = _a.children, dataTestId = _a["data-testid"], other = __rest(_a, ["size", "color", "disabled", "iconLeft", "iconRight", "labelProps", "inputRef", "className", "children", 'data-testid']);
|
|
16
17
|
var iconSize = useMemo(function () { return getIconSizeToFormElement(size); }, [size]);
|
|
18
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
19
|
+
deprecate("\u041A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442 \u00ABChip\u00BB \u0443\u0441\u0442\u0430\u0440\u0435\u043B. \u0414\u043B\u044F \u0437\u0430\u043C\u0435\u043D\u044B \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0439\u0442\u0435 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442 \u00ABChipNext\u00BB.");
|
|
20
|
+
}
|
|
17
21
|
return (React.createElement("label", __assign({ ref: ref, className: cnChip('', { size: size, disabled: disabled, color: color }, [className]), "data-testid": dataTestId }, labelProps),
|
|
18
22
|
React.createElement("input", __assign({ ref: inputRef, className: cnChip('Input'), disabled: disabled, type: "checkbox" }, other)),
|
|
19
23
|
React.createElement("span", { className: cnChip('Content') },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozen-ui/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"description": "React component library",
|
|
5
5
|
"files": [
|
|
6
6
|
"*"
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@bem-react/classnames": "^1.3.10",
|
|
24
24
|
"@ozen-ui/fonts": "latest",
|
|
25
25
|
"@ozen-ui/icons": "latest",
|
|
26
|
+
"@ozen-ui/logger": "latest",
|
|
26
27
|
"@popperjs/core": "^2.11.8",
|
|
27
28
|
"decimal.js": "^10.4.3",
|
|
28
29
|
"react-is": "^18.2.0",
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"@ozen-ui/fonts": "latest",
|
|
35
36
|
"@ozen-ui/icons": "latest",
|
|
37
|
+
"@ozen-ui/logger": "latest",
|
|
36
38
|
"react": ">=17.0.2 <19.0.0",
|
|
37
39
|
"react-dom": ">=17.0.2 <19.0.0"
|
|
38
40
|
}
|