@ozen-ui/kit 0.2.1 → 0.3.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.
Files changed (60) hide show
  1. package/CheckboxGroup/package.json +5 -0
  2. package/ProgressBar/package.json +5 -0
  3. package/__inner__/cjs/components/Checkbox/Checkbox.js +23 -2
  4. package/__inner__/cjs/components/Checkbox/constants.d.ts +3 -0
  5. package/__inner__/cjs/components/Checkbox/constants.js +6 -0
  6. package/__inner__/cjs/components/CheckboxGroup/CheckboxGroup.css +8 -0
  7. package/__inner__/cjs/components/CheckboxGroup/CheckboxGroup.d.ts +26 -0
  8. package/__inner__/cjs/components/CheckboxGroup/CheckboxGroup.js +46 -0
  9. package/__inner__/cjs/components/CheckboxGroup/CheckboxGroupContext.d.ts +9 -0
  10. package/__inner__/cjs/components/CheckboxGroup/CheckboxGroupContext.js +6 -0
  11. package/__inner__/cjs/components/CheckboxGroup/constants.d.ts +3 -0
  12. package/__inner__/cjs/components/CheckboxGroup/constants.js +6 -0
  13. package/__inner__/cjs/components/CheckboxGroup/index.d.ts +1 -0
  14. package/__inner__/cjs/components/CheckboxGroup/index.js +4 -0
  15. package/__inner__/cjs/components/FieldHint/FieldHint.css +1 -0
  16. package/__inner__/cjs/components/FieldLabel/FieldLabel.css +4 -2
  17. package/__inner__/cjs/components/IconButton/IconButton.css +11 -2
  18. package/__inner__/cjs/components/IconButton/IconButton.d.ts +2 -0
  19. package/__inner__/cjs/components/IconButton/IconButton.js +3 -2
  20. package/__inner__/cjs/components/ProgressBar/ProgressBar.css +40 -0
  21. package/__inner__/cjs/components/ProgressBar/ProgressBar.d.ts +11 -0
  22. package/__inner__/cjs/components/ProgressBar/ProgressBar.js +32 -0
  23. package/__inner__/cjs/components/ProgressBar/constants.d.ts +1 -0
  24. package/__inner__/cjs/components/ProgressBar/constants.js +4 -0
  25. package/__inner__/cjs/components/ProgressBar/index.d.ts +1 -0
  26. package/__inner__/cjs/components/ProgressBar/index.js +4 -0
  27. package/__inner__/cjs/components/ThemeProvider/types.d.ts +2 -0
  28. package/__inner__/cjs/hooks/useBoolean/useBoolean.js +3 -3
  29. package/__inner__/cjs/hooks/useCounter/useCounter.js +3 -3
  30. package/__inner__/cjs/hooks/useTimer/useTimer.js +6 -6
  31. package/__inner__/esm/components/Checkbox/Checkbox.js +24 -3
  32. package/__inner__/esm/components/Checkbox/constants.d.ts +3 -0
  33. package/__inner__/esm/components/Checkbox/constants.js +3 -0
  34. package/__inner__/esm/components/CheckboxGroup/CheckboxGroup.css +8 -0
  35. package/__inner__/esm/components/CheckboxGroup/CheckboxGroup.d.ts +26 -0
  36. package/__inner__/esm/components/CheckboxGroup/CheckboxGroup.js +43 -0
  37. package/__inner__/esm/components/CheckboxGroup/CheckboxGroupContext.d.ts +9 -0
  38. package/__inner__/esm/components/CheckboxGroup/CheckboxGroupContext.js +2 -0
  39. package/__inner__/esm/components/CheckboxGroup/constants.d.ts +3 -0
  40. package/__inner__/esm/components/CheckboxGroup/constants.js +3 -0
  41. package/__inner__/esm/components/CheckboxGroup/index.d.ts +1 -0
  42. package/__inner__/esm/components/CheckboxGroup/index.js +1 -0
  43. package/__inner__/esm/components/FieldHint/FieldHint.css +1 -0
  44. package/__inner__/esm/components/FieldLabel/FieldLabel.css +4 -2
  45. package/__inner__/esm/components/IconButton/IconButton.css +11 -2
  46. package/__inner__/esm/components/IconButton/IconButton.d.ts +2 -0
  47. package/__inner__/esm/components/IconButton/IconButton.js +3 -2
  48. package/__inner__/esm/components/ProgressBar/ProgressBar.css +40 -0
  49. package/__inner__/esm/components/ProgressBar/ProgressBar.d.ts +11 -0
  50. package/__inner__/esm/components/ProgressBar/ProgressBar.js +29 -0
  51. package/__inner__/esm/components/ProgressBar/constants.d.ts +1 -0
  52. package/__inner__/esm/components/ProgressBar/constants.js +1 -0
  53. package/__inner__/esm/components/ProgressBar/index.d.ts +1 -0
  54. package/__inner__/esm/components/ProgressBar/index.js +1 -0
  55. package/__inner__/esm/components/ThemeProvider/types.d.ts +2 -0
  56. package/__inner__/esm/hooks/useBoolean/useBoolean.js +4 -4
  57. package/__inner__/esm/hooks/useCounter/useCounter.js +4 -4
  58. package/__inner__/esm/hooks/useTimer/useTimer.js +7 -7
  59. package/package.json +1 -1
  60. package/useListState/package.json +5 -0
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../__inner__/cjs/components/CheckboxGroup/index.js",
3
+ "module": "../__inner__/esm/components/CheckboxGroup/index.js",
4
+ "types": "../__inner__/esm/components/CheckboxGroup/index.d.ts"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../__inner__/cjs/components/ProgressBar/index.js",
3
+ "module": "../__inner__/esm/components/ProgressBar/index.js",
4
+ "types": "../__inner__/esm/components/ProgressBar/index.d.ts"
5
+ }
@@ -6,8 +6,10 @@ require("./Checkbox.css");
6
6
  var react_1 = tslib_1.__importStar(require("react"));
7
7
  var useThemeProps_1 = require("../../hooks/useThemeProps");
8
8
  var classname_1 = require("../../utils/classname");
9
+ var CheckboxGroupContext_1 = require("../CheckboxGroup/CheckboxGroupContext");
9
10
  var FormControlLabel_1 = require("../FormControlLabel");
10
11
  var components_1 = require("./components");
12
+ var constants_1 = require("./constants");
11
13
  exports.checkboxSizeVariant = ['2xs', 'xs', 's', 'm', 'l'];
12
14
  exports.cnCheckbox = (0, classname_1.cn)('Checkbox');
13
15
  exports.Checkbox = (0, react_1.forwardRef)(function (inProps, ref) {
@@ -15,7 +17,26 @@ exports.Checkbox = (0, react_1.forwardRef)(function (inProps, ref) {
15
17
  props: inProps,
16
18
  name: 'Checkbox'
17
19
  });
18
- var _a = props.align, align = _a === void 0 ? 'center' : _a, _b = props.labelPlacement, labelPlacement = _b === void 0 ? 'right' : _b, _c = props.size, size = _c === void 0 ? 'm' : _c, className = props.className, label = props.label, labelProps = props.labelProps, disabled = props.disabled, checked = props.checked, inputRef = props.inputRef, indeterminate = props.indeterminate, other = tslib_1.__rest(props, ["align", "labelPlacement", "size", "className", "label", "labelProps", "disabled", "checked", "inputRef", "indeterminate"]);
20
+ var _a = props.align, align = _a === void 0 ? constants_1.CHECKBOX_DEFAULT_ALIGN : _a, _b = props.labelPlacement, labelPlacement = _b === void 0 ? constants_1.CHECKBOX_DEFAULT_LABEL_PLACEMENT : _b, _c = props.size, sizeProp = _c === void 0 ? constants_1.CHECKBOX_DEFAULT_SIZE : _c, className = props.className, label = props.label, labelProps = props.labelProps, disabled = props.disabled, checkedProp = props.checked, inputRef = props.inputRef, indeterminate = props.indeterminate, nameProp = props.name, onChangeProp = props.onChange, other = tslib_1.__rest(props, ["align", "labelPlacement", "size", "className", "label", "labelProps", "disabled", "checked", "inputRef", "indeterminate", "name", "onChange"]);
21
+ var checked = checkedProp;
22
+ var name = nameProp;
23
+ var size = sizeProp;
24
+ var checkboxGroup = (0, react_1.useContext)(CheckboxGroupContext_1.CheckboxGroupContext);
25
+ if (checkboxGroup) {
26
+ if (checked === undefined && checkboxGroup.value) {
27
+ checked = checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.value.includes(other === null || other === void 0 ? void 0 : other.value);
28
+ }
29
+ if (name === undefined && checkboxGroup.name) {
30
+ name = checkboxGroup.name;
31
+ }
32
+ if (inProps.size === undefined && checkboxGroup.size) {
33
+ size = checkboxGroup.size;
34
+ }
35
+ }
36
+ var onChange = function (event) {
37
+ onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(event);
38
+ checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.onChange(event);
39
+ };
19
40
  return (react_1["default"].createElement(FormControlLabel_1.FormControlLabel, tslib_1.__assign({ label: label, size: size, labelPlacement: labelPlacement, disabled: disabled, align: align, className: className, ref: ref }, labelProps),
20
41
  react_1["default"].createElement("span", { className: (0, exports.cnCheckbox)({
21
42
  size: size,
@@ -23,7 +44,7 @@ exports.Checkbox = (0, react_1.forwardRef)(function (inProps, ref) {
23
44
  checked: checked,
24
45
  indeterminate: indeterminate
25
46
  }) },
26
- react_1["default"].createElement("input", tslib_1.__assign({ type: "checkbox", className: (0, exports.cnCheckbox)('Input'), disabled: disabled, checked: checked }, other, { ref: inputRef })),
47
+ react_1["default"].createElement("input", tslib_1.__assign({ type: "checkbox", className: (0, exports.cnCheckbox)('Input'), disabled: disabled, checked: checked, onChange: onChange, name: name }, other, { ref: inputRef })),
27
48
  react_1["default"].createElement("span", { className: (0, exports.cnCheckbox)('Box') },
28
49
  react_1["default"].createElement(components_1.CheckboxIcon, { indeterminate: indeterminate, className: (0, exports.cnCheckbox)('Icon') })))));
29
50
  });
@@ -0,0 +1,3 @@
1
+ export declare const CHECKBOX_DEFAULT_ALIGN = "center";
2
+ export declare const CHECKBOX_DEFAULT_LABEL_PLACEMENT = "right";
3
+ export declare const CHECKBOX_DEFAULT_SIZE = "m";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.CHECKBOX_DEFAULT_SIZE = exports.CHECKBOX_DEFAULT_LABEL_PLACEMENT = exports.CHECKBOX_DEFAULT_ALIGN = void 0;
4
+ exports.CHECKBOX_DEFAULT_ALIGN = 'center';
5
+ exports.CHECKBOX_DEFAULT_LABEL_PLACEMENT = 'right';
6
+ exports.CHECKBOX_DEFAULT_SIZE = 'm';
@@ -0,0 +1,8 @@
1
+ .CheckboxGroup {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
5
+
6
+ .CheckboxGroup .FormGroup {
7
+ align-items: flex-start;
8
+ }
@@ -0,0 +1,26 @@
1
+ import './CheckboxGroup.css';
2
+ import type { ElementType, ReactNode } from 'react';
3
+ import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
4
+ import { type PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
5
+ import { type FormGroupProps } from '../FormGroup';
6
+ export type CheckboxGroupBaseProps = {
7
+ /** Имя группы радиокнопок (передается всем вложенным радиокнопкам) */
8
+ name: string;
9
+ /** Значение по умолчанию (неконтролируемое состояние) */
10
+ defaultValue?: (string | number)[];
11
+ /** Текущее значение */
12
+ value?: (string | number)[];
13
+ /** Заголовок группы */
14
+ title?: string;
15
+ /** Размер */
16
+ size?: FormElementSizeVariant;
17
+ /** Содержимое компонента */
18
+ children?: ReactNode;
19
+ /** Направление */
20
+ direction?: FormGroupProps['direction'];
21
+ /** Событие изменения состояния */
22
+ onChange?(value: (string | number)[]): void;
23
+ };
24
+ export type CheckboxGroupProps<As extends ElementType = 'div'> = PolymorphicComponentPropsWithoutRef<CheckboxGroupBaseProps, As>;
25
+ export declare const cnCheckboxGroup: import("@bem-react/classname").ClassNameFormatter;
26
+ export declare const CheckboxGroup: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<CheckboxGroupBaseProps, "div">;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.CheckboxGroup = exports.cnCheckboxGroup = void 0;
4
+ var tslib_1 = require("tslib");
5
+ require("./CheckboxGroup.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 CheckboxGroupContext_1 = require("./CheckboxGroupContext");
14
+ var constants_1 = require("./constants");
15
+ exports.cnCheckboxGroup = (0, classname_1.cn)('CheckboxGroup');
16
+ exports.CheckboxGroup = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (inProps, ref) {
17
+ var props = (0, useThemeProps_1.useThemeProps)({
18
+ props: inProps,
19
+ name: 'CheckboxGroup'
20
+ });
21
+ var _a = props.direction, direction = _a === void 0 ? constants_1.CHECKBOX_GROUP_DEFAULT_DIRECTION : _a, _b = props.size, size = _b === void 0 ? constants_1.CHECKBOX_GROUP_DEFAULT_SIZE : _b, _c = props.as, Tag = _c === void 0 ? constants_1.CHECKBOX_GROUP_DEFAULT_AS : _c, title = props.title, className = props.className, children = props.children, name = props.name, valueProp = props.value, defaultValue = props.defaultValue, onChange = props.onChange, other = tslib_1.__rest(props, ["direction", "size", "as", "title", "className", "children", "name", "value", "defaultValue", "onChange"]);
22
+ var _d = tslib_1.__read((0, useControlled_1.useControlled)({
23
+ value: valueProp,
24
+ defaultValue: defaultValue,
25
+ name: 'CheckboxGroup',
26
+ state: 'value'
27
+ }), 2), valueState = _d[0], setValueState = _d[1];
28
+ var handleChange = function (event) {
29
+ var itemValue = event.currentTarget.value;
30
+ var value = (valueState === null || valueState === void 0 ? void 0 : valueState.includes(itemValue))
31
+ ? valueState.filter(function (item) { return item !== itemValue; })
32
+ : tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read((valueState || [])), false), [itemValue], false);
33
+ setValueState(value);
34
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
35
+ };
36
+ return (react_1["default"].createElement(Tag, tslib_1.__assign({ className: (0, exports.cnCheckboxGroup)({ size: size }, [className]), role: "radiogroup" }, other, { ref: ref }),
37
+ react_1["default"].createElement(CheckboxGroupContext_1.CheckboxGroupContext.Provider, { value: {
38
+ value: valueState,
39
+ onChange: handleChange,
40
+ name: name,
41
+ size: size
42
+ } },
43
+ title && react_1["default"].createElement(FormTitle_1.FormTitle, { size: size }, title),
44
+ react_1["default"].createElement(FormGroup_1.FormGroup, { direction: direction, size: size }, children))));
45
+ });
46
+ exports.CheckboxGroup.displayName = 'CheckboxGroup';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
3
+ export interface CheckboxGroupContextValue {
4
+ name: string | undefined;
5
+ onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
6
+ value?: (string | number)[];
7
+ size?: FormElementSizeVariant;
8
+ }
9
+ export declare const CheckboxGroupContext: React.Context<CheckboxGroupContextValue | undefined>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.CheckboxGroupContext = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var react_1 = tslib_1.__importDefault(require("react"));
6
+ exports.CheckboxGroupContext = react_1["default"].createContext(undefined);
@@ -0,0 +1,3 @@
1
+ export declare const CHECKBOX_GROUP_DEFAULT_DIRECTION = "column";
2
+ export declare const CHECKBOX_GROUP_DEFAULT_SIZE = "m";
3
+ export declare const CHECKBOX_GROUP_DEFAULT_AS = "div";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.CHECKBOX_GROUP_DEFAULT_AS = exports.CHECKBOX_GROUP_DEFAULT_SIZE = exports.CHECKBOX_GROUP_DEFAULT_DIRECTION = void 0;
4
+ exports.CHECKBOX_GROUP_DEFAULT_DIRECTION = 'column';
5
+ exports.CHECKBOX_GROUP_DEFAULT_SIZE = 'm';
6
+ exports.CHECKBOX_GROUP_DEFAULT_AS = 'div';
@@ -0,0 +1 @@
1
+ export * from './CheckboxGroup';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./CheckboxGroup"), exports);
@@ -2,6 +2,7 @@
2
2
  .FieldHint {
3
3
  color: var(--field-hint-color, var(--color-content-secondary));
4
4
  margin: var(--field-hint-margin);
5
+ text-align: start;
5
6
  min-block-size: 16px;
6
7
  }
7
8
  .FieldHint_size_2xs {
@@ -1,12 +1,14 @@
1
1
  .FieldLabel {
2
2
  font: var(--field-label-font);
3
3
  color: var(--color-content-secondary);
4
- transition: transform var(--transition-default),
4
+ transition:
5
+ transform var(--transition-default),
5
6
  font var(--transition-default);
6
7
  position: absolute;
7
8
  box-sizing: border-box;
8
9
  inset-block-start: var(--field-label-top);
9
- inline-size: 100%;
10
+ inset-inline-start: 0;
11
+ max-inline-size: 100%;
10
12
  overflow: hidden;
11
13
  text-overflow: ellipsis;
12
14
  white-space: nowrap;
@@ -17,8 +17,10 @@
17
17
  color: var(--icon-button-font-color);
18
18
  background-color: var(--icon-button-bg-color);
19
19
  opacity: 1;
20
- transition: background-color var(--transition-default),
21
- box-shadow var(--transition-default), opacity var(--transition-default);
20
+ transition:
21
+ background-color var(--transition-default),
22
+ box-shadow var(--transition-default),
23
+ opacity var(--transition-default);
22
24
  -webkit-tap-highlight-color: transparent;
23
25
  position: relative;
24
26
  }
@@ -155,6 +157,13 @@
155
157
  box-shadow: 0 8px 32px rgb(0 0 0 / 8%);
156
158
  }
157
159
 
160
+ .IconButton_variant_contained.IconButton_rounded,
161
+ .IconButton_variant_outlined.IconButton_rounded,
162
+ .IconButton_variant_ghost.IconButton_rounded,
163
+ .IconButton_variant_floating.IconButton_rounded {
164
+ border-radius: 50%;
165
+ }
166
+
158
167
  .IconButton_variant_contained.IconButton_disabled,
159
168
  .IconButton_variant_contained.IconButton_loading,
160
169
  .IconButton_variant_outlined.IconButton_disabled,
@@ -32,6 +32,8 @@ type IconButtonBaseProps = {
32
32
  /** Дополнительные CSS-классы */
33
33
  className?: string;
34
34
  children?: never;
35
+ /** Если {true} делает компонент круглым */
36
+ rounded?: boolean;
35
37
  };
36
38
  export type IconButtonProps<As extends ElementType = typeof ICON_BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<IconButtonBaseProps, As>;
37
39
  export declare const cnIconButton: import("@bem-react/classname").ClassNameFormatter;
@@ -32,7 +32,7 @@ exports.IconButton = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
32
32
  props: inProps,
33
33
  name: 'IconButton'
34
34
  });
35
- var _a = props.size, size = _a === void 0 ? constants_1.ICON_BUTTON_DEFAULT_SIZE : _a, _b = props.variant, variant = _b === void 0 ? constants_1.ICON_BUTTON_DEFAULT_VARIANT : _b, _c = props.color, color = _c === void 0 ? constants_1.ICON_BUTTON_DEFAULT_COLOR : _c, _d = props.as, Tag = _d === void 0 ? constants_1.ICON_BUTTON_DEFAULT_TAG : _d, iconColor = props.iconColor, compressed = props.compressed, loading = props.loading, disabled = props.disabled, className = props.className, Icon = props.icon, onClick = props.onClick, other = tslib_1.__rest(props, ["size", "variant", "color", "as", "iconColor", "compressed", "loading", "disabled", "className", "icon", "onClick"]);
35
+ var _a = props.size, size = _a === void 0 ? constants_1.ICON_BUTTON_DEFAULT_SIZE : _a, _b = props.variant, variant = _b === void 0 ? constants_1.ICON_BUTTON_DEFAULT_VARIANT : _b, _c = props.color, color = _c === void 0 ? constants_1.ICON_BUTTON_DEFAULT_COLOR : _c, _d = props.as, Tag = _d === void 0 ? constants_1.ICON_BUTTON_DEFAULT_TAG : _d, iconColor = props.iconColor, compressed = props.compressed, loading = props.loading, disabled = props.disabled, className = props.className, Icon = props.icon, onClick = props.onClick, rounded = props.rounded, other = tslib_1.__rest(props, ["size", "variant", "color", "as", "iconColor", "compressed", "loading", "disabled", "className", "icon", "onClick", "rounded"]);
36
36
  var iconSize = (0, getIconSizeToFormElement_1.getIconSizeToFormElement)(size);
37
37
  var isInteractionPrevented = disabled || loading;
38
38
  var handleClick = function (event) {
@@ -55,7 +55,8 @@ exports.IconButton = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
55
55
  color: color,
56
56
  disabled: disabled,
57
57
  loading: loading,
58
- compressed: compressed
58
+ compressed: compressed,
59
+ rounded: rounded
59
60
  }, [className]), disabled: isInteractionPrevented, onClick: handleClick }, (isInteractionPrevented && { tabIndex: -1 }), other, { ref: ref }), resolvedChildren));
60
61
  });
61
62
  exports.IconButton.displayName = 'IconButton';
@@ -0,0 +1,40 @@
1
+ .ProgressBar {
2
+ --progressbar-translate-x: translateX(0%);
3
+ background-color: var(--color-background-action-light);
4
+ position: relative;
5
+ block-size: 4px;
6
+ display: block;
7
+ overflow: hidden;
8
+ }
9
+
10
+ .ProgressBar-ProgressLine {
11
+ background-color: var(--color-content-action);
12
+ border-radius: 3px;
13
+ inline-size: 100%;
14
+ display: block;
15
+ block-size: inherit;
16
+ }
17
+
18
+ .ProgressBar_filled .ProgressBar-ProgressLine {
19
+ border-radius: 0;
20
+ }
21
+
22
+ .ProgressBar_indefinite .ProgressBar-ProgressLine {
23
+ animation: progress-bar-animation 2s linear infinite;
24
+ }
25
+
26
+ .ProgressBar:not(.ProgressBar_indefinite) .ProgressBar-ProgressLine {
27
+ transition: transform var(--transition-slow);
28
+ transform: var(--progressbar-translate-x);
29
+ transform-origin: left;
30
+ }
31
+
32
+ @keyframes progress-bar-animation {
33
+ 0% {
34
+ transform: translateX(-125%);
35
+ }
36
+
37
+ 100% {
38
+ transform: translateX(125%);
39
+ }
40
+ }
@@ -0,0 +1,11 @@
1
+ import './ProgressBar.css';
2
+ import { type ElementType } from 'react';
3
+ import { PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
4
+ import { PROGRESSBAR_DEFAULT_TAG } from './constants';
5
+ export declare const cnProgressBar: import("@bem-react/classname").ClassNameFormatter;
6
+ export type ProgressBarBaseProps = {
7
+ /** Значение заполненной части 0-100 */
8
+ value?: number;
9
+ };
10
+ export type ProgressBarProps<As extends ElementType = typeof PROGRESSBAR_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<ProgressBarBaseProps, As>;
11
+ export declare const ProgressBar: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<ProgressBarBaseProps, "span">;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.ProgressBar = exports.cnProgressBar = void 0;
4
+ var tslib_1 = require("tslib");
5
+ require("./ProgressBar.css");
6
+ var react_1 = tslib_1.__importDefault(require("react"));
7
+ var classname_1 = require("../../utils/classname");
8
+ var polymorphicComponentWithRef_1 = require("../../utils/polymorphicComponentWithRef");
9
+ var constants_1 = require("./constants");
10
+ exports.cnProgressBar = (0, classname_1.cn)('ProgressBar');
11
+ exports.ProgressBar = (0, polymorphicComponentWithRef_1.polymorphicComponentWithRef)(function (_a, ref) {
12
+ var className = _a.className, _b = _a.as, Tag = _b === void 0 ? constants_1.PROGRESSBAR_DEFAULT_TAG : _b, value = _a.value, other = tslib_1.__rest(_a, ["className", "as", "value"]);
13
+ var isValueSet = value || value === 0;
14
+ var isFilled = value === 100;
15
+ var setProgressLineStyles = function () {
16
+ if (!isValueSet)
17
+ return undefined;
18
+ var translateX = Math.max(-100, Math.min(0, (value || 0) - 100));
19
+ return {
20
+ '--progressbar-translate-x': "translateX(".concat(translateX, "%)")
21
+ };
22
+ };
23
+ return (react_1["default"].createElement(Tag, tslib_1.__assign({}, (isValueSet && {
24
+ 'aria-valuemin': 0,
25
+ 'aria-valuemax': 100,
26
+ 'aria-valuenow': value
27
+ }), { className: (0, exports.cnProgressBar)({ filled: isFilled, indefinite: !isValueSet }, [
28
+ className,
29
+ ]), role: "progressbar" }, other, { ref: ref }),
30
+ react_1["default"].createElement("span", { className: (0, exports.cnProgressBar)('ProgressLine'), style: setProgressLineStyles() })));
31
+ });
32
+ exports.ProgressBar.displayName = 'ProgressBar';
@@ -0,0 +1 @@
1
+ export declare const PROGRESSBAR_DEFAULT_TAG = "span";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.PROGRESSBAR_DEFAULT_TAG = void 0;
4
+ exports.PROGRESSBAR_DEFAULT_TAG = 'span';
@@ -0,0 +1 @@
1
+ export * from './ProgressBar';
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./ProgressBar"), exports);
@@ -6,6 +6,7 @@ import type { BadgeProps } from '../Badge';
6
6
  import type { ButtonProps } from '../Button';
7
7
  import type { CardProps } from '../Card';
8
8
  import type { CheckboxProps } from '../Checkbox';
9
+ import type { CheckboxGroupProps } from '../CheckboxGroup';
9
10
  import type { ChipProps } from '../Chip';
10
11
  import type { CollapseProps } from '../Collapse';
11
12
  import type { ContainerProps } from '../Container';
@@ -64,6 +65,7 @@ export type Theme = {
64
65
  Button?: Partial<ButtonProps>;
65
66
  Card?: Partial<CardProps>;
66
67
  Checkbox?: Partial<CheckboxProps>;
68
+ CheckboxGroup?: Partial<CheckboxGroupProps>;
67
69
  Chip?: Partial<ChipProps>;
68
70
  Collapse?: Partial<CollapseProps>;
69
71
  Container?: Partial<ContainerProps>;
@@ -8,9 +8,9 @@ function useBoolean(
8
8
  defaultValue) {
9
9
  if (defaultValue === void 0) { defaultValue = false; }
10
10
  var _a = tslib_1.__read((0, react_1.useState)(defaultValue), 2), value = _a[0], setValue = _a[1];
11
- var on = function () { return setValue(true); };
12
- var off = function () { return setValue(false); };
13
- var toggle = function () { return setValue(function (value) { return !value; }); };
11
+ var on = (0, react_1.useCallback)(function () { return setValue(true); }, []);
12
+ var off = (0, react_1.useCallback)(function () { return setValue(false); }, []);
13
+ var toggle = (0, react_1.useCallback)(function () { return setValue(function (value) { return !value; }); }, []);
14
14
  return [value, { on: on, off: off, toggle: toggle }];
15
15
  }
16
16
  exports.useBoolean = useBoolean;
@@ -6,9 +6,9 @@ var react_1 = require("react");
6
6
  function useCounter(_a) {
7
7
  var _b = _a === void 0 ? {} : _a, _c = _b.initialValue, initialValue = _c === void 0 ? 0 : _c, _d = _b.step, step = _d === void 0 ? 1 : _d;
8
8
  var _e = tslib_1.__read((0, react_1.useState)(initialValue), 2), count = _e[0], setCount = _e[1];
9
- var increment = function () { return setCount(function (x) { return x + step; }); };
10
- var decrement = function () { return setCount(function (x) { return x - step; }); };
11
- var reset = function () { return setCount(initialValue); };
9
+ var increment = (0, react_1.useCallback)(function () { return setCount(function (x) { return x + step; }); }, [step]);
10
+ var decrement = (0, react_1.useCallback)(function () { return setCount(function (x) { return x - step; }); }, [step]);
11
+ var reset = (0, react_1.useCallback)(function () { return setCount(initialValue); }, [initialValue]);
12
12
  return {
13
13
  count: count,
14
14
  increment: increment,
@@ -27,16 +27,16 @@ function useTimer(_a) {
27
27
  });
28
28
  };
29
29
  (0, useInterval_1.useInterval)(timerCallback, state.isTimerRunning ? interval : null);
30
- var resetTimer = function () {
30
+ var resetTimer = (0, react_1.useCallback)(function () {
31
31
  setState(function () { return ({
32
32
  isTimerRunning: false,
33
33
  count: startTime
34
34
  }); });
35
- };
36
- var pauseTimer = function () {
35
+ }, [startTime]);
36
+ var pauseTimer = (0, react_1.useCallback)(function () {
37
37
  setState(function (state) { return (tslib_1.__assign(tslib_1.__assign({}, state), { isTimerRunning: false })); });
38
- };
39
- var startTimer = function () {
38
+ }, []);
39
+ var startTimer = (0, react_1.useCallback)(function () {
40
40
  setState(function (_a) {
41
41
  var count = _a.count;
42
42
  return ({
@@ -46,7 +46,7 @@ function useTimer(_a) {
46
46
  isTimerRunning: startTime !== endTime
47
47
  });
48
48
  });
49
- };
49
+ }, [startTime, endTime]);
50
50
  (0, react_1.useEffect)(function () {
51
51
  savedOnTimerEnd.current = onTimerEnd;
52
52
  }, [onTimerEnd]);
@@ -1,10 +1,12 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import './Checkbox.css';
3
- import React, { forwardRef } from 'react';
3
+ import React, { forwardRef, useContext } from 'react';
4
4
  import { useThemeProps } from '../../hooks/useThemeProps';
5
5
  import { cn } from '../../utils/classname';
6
+ import { CheckboxGroupContext } from '../CheckboxGroup/CheckboxGroupContext';
6
7
  import { FormControlLabel, } from '../FormControlLabel';
7
8
  import { CheckboxIcon } from './components';
9
+ import { CHECKBOX_DEFAULT_ALIGN, CHECKBOX_DEFAULT_LABEL_PLACEMENT, CHECKBOX_DEFAULT_SIZE, } from './constants';
8
10
  export var checkboxSizeVariant = ['2xs', 'xs', 's', 'm', 'l'];
9
11
  export var cnCheckbox = cn('Checkbox');
10
12
  export var Checkbox = forwardRef(function (inProps, ref) {
@@ -12,7 +14,26 @@ export var Checkbox = forwardRef(function (inProps, ref) {
12
14
  props: inProps,
13
15
  name: 'Checkbox'
14
16
  });
15
- var _a = props.align, align = _a === void 0 ? 'center' : _a, _b = props.labelPlacement, labelPlacement = _b === void 0 ? 'right' : _b, _c = props.size, size = _c === void 0 ? 'm' : _c, className = props.className, label = props.label, labelProps = props.labelProps, disabled = props.disabled, checked = props.checked, inputRef = props.inputRef, indeterminate = props.indeterminate, other = __rest(props, ["align", "labelPlacement", "size", "className", "label", "labelProps", "disabled", "checked", "inputRef", "indeterminate"]);
17
+ var _a = props.align, align = _a === void 0 ? CHECKBOX_DEFAULT_ALIGN : _a, _b = props.labelPlacement, labelPlacement = _b === void 0 ? CHECKBOX_DEFAULT_LABEL_PLACEMENT : _b, _c = props.size, sizeProp = _c === void 0 ? CHECKBOX_DEFAULT_SIZE : _c, className = props.className, label = props.label, labelProps = props.labelProps, disabled = props.disabled, checkedProp = props.checked, inputRef = props.inputRef, indeterminate = props.indeterminate, nameProp = props.name, onChangeProp = props.onChange, other = __rest(props, ["align", "labelPlacement", "size", "className", "label", "labelProps", "disabled", "checked", "inputRef", "indeterminate", "name", "onChange"]);
18
+ var checked = checkedProp;
19
+ var name = nameProp;
20
+ var size = sizeProp;
21
+ var checkboxGroup = useContext(CheckboxGroupContext);
22
+ if (checkboxGroup) {
23
+ if (checked === undefined && checkboxGroup.value) {
24
+ checked = checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.value.includes(other === null || other === void 0 ? void 0 : other.value);
25
+ }
26
+ if (name === undefined && checkboxGroup.name) {
27
+ name = checkboxGroup.name;
28
+ }
29
+ if (inProps.size === undefined && checkboxGroup.size) {
30
+ size = checkboxGroup.size;
31
+ }
32
+ }
33
+ var onChange = function (event) {
34
+ onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(event);
35
+ checkboxGroup === null || checkboxGroup === void 0 ? void 0 : checkboxGroup.onChange(event);
36
+ };
16
37
  return (React.createElement(FormControlLabel, __assign({ label: label, size: size, labelPlacement: labelPlacement, disabled: disabled, align: align, className: className, ref: ref }, labelProps),
17
38
  React.createElement("span", { className: cnCheckbox({
18
39
  size: size,
@@ -20,7 +41,7 @@ export var Checkbox = forwardRef(function (inProps, ref) {
20
41
  checked: checked,
21
42
  indeterminate: indeterminate
22
43
  }) },
23
- React.createElement("input", __assign({ type: "checkbox", className: cnCheckbox('Input'), disabled: disabled, checked: checked }, other, { ref: inputRef })),
44
+ React.createElement("input", __assign({ type: "checkbox", className: cnCheckbox('Input'), disabled: disabled, checked: checked, onChange: onChange, name: name }, other, { ref: inputRef })),
24
45
  React.createElement("span", { className: cnCheckbox('Box') },
25
46
  React.createElement(CheckboxIcon, { indeterminate: indeterminate, className: cnCheckbox('Icon') })))));
26
47
  });
@@ -0,0 +1,3 @@
1
+ export declare const CHECKBOX_DEFAULT_ALIGN = "center";
2
+ export declare const CHECKBOX_DEFAULT_LABEL_PLACEMENT = "right";
3
+ export declare const CHECKBOX_DEFAULT_SIZE = "m";
@@ -0,0 +1,3 @@
1
+ export var CHECKBOX_DEFAULT_ALIGN = 'center';
2
+ export var CHECKBOX_DEFAULT_LABEL_PLACEMENT = 'right';
3
+ export var CHECKBOX_DEFAULT_SIZE = 'm';
@@ -0,0 +1,8 @@
1
+ .CheckboxGroup {
2
+ display: flex;
3
+ flex-direction: column;
4
+ }
5
+
6
+ .CheckboxGroup .FormGroup {
7
+ align-items: flex-start;
8
+ }
@@ -0,0 +1,26 @@
1
+ import './CheckboxGroup.css';
2
+ import type { ElementType, ReactNode } from 'react';
3
+ import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
4
+ import { type PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
5
+ import { type FormGroupProps } from '../FormGroup';
6
+ export type CheckboxGroupBaseProps = {
7
+ /** Имя группы радиокнопок (передается всем вложенным радиокнопкам) */
8
+ name: string;
9
+ /** Значение по умолчанию (неконтролируемое состояние) */
10
+ defaultValue?: (string | number)[];
11
+ /** Текущее значение */
12
+ value?: (string | number)[];
13
+ /** Заголовок группы */
14
+ title?: string;
15
+ /** Размер */
16
+ size?: FormElementSizeVariant;
17
+ /** Содержимое компонента */
18
+ children?: ReactNode;
19
+ /** Направление */
20
+ direction?: FormGroupProps['direction'];
21
+ /** Событие изменения состояния */
22
+ onChange?(value: (string | number)[]): void;
23
+ };
24
+ export type CheckboxGroupProps<As extends ElementType = 'div'> = PolymorphicComponentPropsWithoutRef<CheckboxGroupBaseProps, As>;
25
+ export declare const cnCheckboxGroup: import("@bem-react/classname").ClassNameFormatter;
26
+ export declare const CheckboxGroup: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<CheckboxGroupBaseProps, "div">;
@@ -0,0 +1,43 @@
1
+ import { __assign, __read, __rest, __spreadArray } from "tslib";
2
+ import './CheckboxGroup.css';
3
+ import React from 'react';
4
+ import { useControlled } from '../../hooks/useControlled';
5
+ import { useThemeProps } from '../../hooks/useThemeProps';
6
+ import { cn } from '../../utils/classname';
7
+ import { polymorphicComponentWithRef, } from '../../utils/polymorphicComponentWithRef';
8
+ import { FormGroup } from '../FormGroup';
9
+ import { FormTitle } from '../FormTitle';
10
+ import { CheckboxGroupContext } from './CheckboxGroupContext';
11
+ import { CHECKBOX_GROUP_DEFAULT_DIRECTION, CHECKBOX_GROUP_DEFAULT_SIZE, CHECKBOX_GROUP_DEFAULT_AS, } from './constants';
12
+ export var cnCheckboxGroup = cn('CheckboxGroup');
13
+ export var CheckboxGroup = polymorphicComponentWithRef(function (inProps, ref) {
14
+ var props = useThemeProps({
15
+ props: inProps,
16
+ name: 'CheckboxGroup'
17
+ });
18
+ var _a = props.direction, direction = _a === void 0 ? CHECKBOX_GROUP_DEFAULT_DIRECTION : _a, _b = props.size, size = _b === void 0 ? CHECKBOX_GROUP_DEFAULT_SIZE : _b, _c = props.as, Tag = _c === void 0 ? CHECKBOX_GROUP_DEFAULT_AS : _c, title = props.title, className = props.className, children = props.children, name = props.name, valueProp = props.value, defaultValue = props.defaultValue, onChange = props.onChange, other = __rest(props, ["direction", "size", "as", "title", "className", "children", "name", "value", "defaultValue", "onChange"]);
19
+ var _d = __read(useControlled({
20
+ value: valueProp,
21
+ defaultValue: defaultValue,
22
+ name: 'CheckboxGroup',
23
+ state: 'value'
24
+ }), 2), valueState = _d[0], setValueState = _d[1];
25
+ var handleChange = function (event) {
26
+ var itemValue = event.currentTarget.value;
27
+ var value = (valueState === null || valueState === void 0 ? void 0 : valueState.includes(itemValue))
28
+ ? valueState.filter(function (item) { return item !== itemValue; })
29
+ : __spreadArray(__spreadArray([], __read((valueState || [])), false), [itemValue], false);
30
+ setValueState(value);
31
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
32
+ };
33
+ return (React.createElement(Tag, __assign({ className: cnCheckboxGroup({ size: size }, [className]), role: "radiogroup" }, other, { ref: ref }),
34
+ React.createElement(CheckboxGroupContext.Provider, { value: {
35
+ value: valueState,
36
+ onChange: handleChange,
37
+ name: name,
38
+ size: size
39
+ } },
40
+ title && React.createElement(FormTitle, { size: size }, title),
41
+ React.createElement(FormGroup, { direction: direction, size: size }, children))));
42
+ });
43
+ CheckboxGroup.displayName = 'CheckboxGroup';
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
3
+ export interface CheckboxGroupContextValue {
4
+ name: string | undefined;
5
+ onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
6
+ value?: (string | number)[];
7
+ size?: FormElementSizeVariant;
8
+ }
9
+ export declare const CheckboxGroupContext: React.Context<CheckboxGroupContextValue | undefined>;
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export var CheckboxGroupContext = React.createContext(undefined);
@@ -0,0 +1,3 @@
1
+ export declare const CHECKBOX_GROUP_DEFAULT_DIRECTION = "column";
2
+ export declare const CHECKBOX_GROUP_DEFAULT_SIZE = "m";
3
+ export declare const CHECKBOX_GROUP_DEFAULT_AS = "div";
@@ -0,0 +1,3 @@
1
+ export var CHECKBOX_GROUP_DEFAULT_DIRECTION = 'column';
2
+ export var CHECKBOX_GROUP_DEFAULT_SIZE = 'm';
3
+ export var CHECKBOX_GROUP_DEFAULT_AS = 'div';
@@ -0,0 +1 @@
1
+ export * from './CheckboxGroup';
@@ -0,0 +1 @@
1
+ export * from './CheckboxGroup';
@@ -2,6 +2,7 @@
2
2
  .FieldHint {
3
3
  color: var(--field-hint-color, var(--color-content-secondary));
4
4
  margin: var(--field-hint-margin);
5
+ text-align: start;
5
6
  min-block-size: 16px;
6
7
  }
7
8
  .FieldHint_size_2xs {
@@ -1,12 +1,14 @@
1
1
  .FieldLabel {
2
2
  font: var(--field-label-font);
3
3
  color: var(--color-content-secondary);
4
- transition: transform var(--transition-default),
4
+ transition:
5
+ transform var(--transition-default),
5
6
  font var(--transition-default);
6
7
  position: absolute;
7
8
  box-sizing: border-box;
8
9
  inset-block-start: var(--field-label-top);
9
- inline-size: 100%;
10
+ inset-inline-start: 0;
11
+ max-inline-size: 100%;
10
12
  overflow: hidden;
11
13
  text-overflow: ellipsis;
12
14
  white-space: nowrap;
@@ -17,8 +17,10 @@
17
17
  color: var(--icon-button-font-color);
18
18
  background-color: var(--icon-button-bg-color);
19
19
  opacity: 1;
20
- transition: background-color var(--transition-default),
21
- box-shadow var(--transition-default), opacity var(--transition-default);
20
+ transition:
21
+ background-color var(--transition-default),
22
+ box-shadow var(--transition-default),
23
+ opacity var(--transition-default);
22
24
  -webkit-tap-highlight-color: transparent;
23
25
  position: relative;
24
26
  }
@@ -155,6 +157,13 @@
155
157
  box-shadow: 0 8px 32px rgb(0 0 0 / 8%);
156
158
  }
157
159
 
160
+ .IconButton_variant_contained.IconButton_rounded,
161
+ .IconButton_variant_outlined.IconButton_rounded,
162
+ .IconButton_variant_ghost.IconButton_rounded,
163
+ .IconButton_variant_floating.IconButton_rounded {
164
+ border-radius: 50%;
165
+ }
166
+
158
167
  .IconButton_variant_contained.IconButton_disabled,
159
168
  .IconButton_variant_contained.IconButton_loading,
160
169
  .IconButton_variant_outlined.IconButton_disabled,
@@ -32,6 +32,8 @@ type IconButtonBaseProps = {
32
32
  /** Дополнительные CSS-классы */
33
33
  className?: string;
34
34
  children?: never;
35
+ /** Если {true} делает компонент круглым */
36
+ rounded?: boolean;
35
37
  };
36
38
  export type IconButtonProps<As extends ElementType = typeof ICON_BUTTON_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<IconButtonBaseProps, As>;
37
39
  export declare const cnIconButton: import("@bem-react/classname").ClassNameFormatter;
@@ -29,7 +29,7 @@ export var IconButton = polymorphicComponentWithRef(function (inProps, ref) {
29
29
  props: inProps,
30
30
  name: 'IconButton'
31
31
  });
32
- var _a = props.size, size = _a === void 0 ? ICON_BUTTON_DEFAULT_SIZE : _a, _b = props.variant, variant = _b === void 0 ? ICON_BUTTON_DEFAULT_VARIANT : _b, _c = props.color, color = _c === void 0 ? ICON_BUTTON_DEFAULT_COLOR : _c, _d = props.as, Tag = _d === void 0 ? ICON_BUTTON_DEFAULT_TAG : _d, iconColor = props.iconColor, compressed = props.compressed, loading = props.loading, disabled = props.disabled, className = props.className, Icon = props.icon, onClick = props.onClick, other = __rest(props, ["size", "variant", "color", "as", "iconColor", "compressed", "loading", "disabled", "className", "icon", "onClick"]);
32
+ var _a = props.size, size = _a === void 0 ? ICON_BUTTON_DEFAULT_SIZE : _a, _b = props.variant, variant = _b === void 0 ? ICON_BUTTON_DEFAULT_VARIANT : _b, _c = props.color, color = _c === void 0 ? ICON_BUTTON_DEFAULT_COLOR : _c, _d = props.as, Tag = _d === void 0 ? ICON_BUTTON_DEFAULT_TAG : _d, iconColor = props.iconColor, compressed = props.compressed, loading = props.loading, disabled = props.disabled, className = props.className, Icon = props.icon, onClick = props.onClick, rounded = props.rounded, other = __rest(props, ["size", "variant", "color", "as", "iconColor", "compressed", "loading", "disabled", "className", "icon", "onClick", "rounded"]);
33
33
  var iconSize = getIconSizeToFormElement(size);
34
34
  var isInteractionPrevented = disabled || loading;
35
35
  var handleClick = function (event) {
@@ -52,7 +52,8 @@ export var IconButton = polymorphicComponentWithRef(function (inProps, ref) {
52
52
  color: color,
53
53
  disabled: disabled,
54
54
  loading: loading,
55
- compressed: compressed
55
+ compressed: compressed,
56
+ rounded: rounded
56
57
  }, [className]), disabled: isInteractionPrevented, onClick: handleClick }, (isInteractionPrevented && { tabIndex: -1 }), other, { ref: ref }), resolvedChildren));
57
58
  });
58
59
  IconButton.displayName = 'IconButton';
@@ -0,0 +1,40 @@
1
+ .ProgressBar {
2
+ --progressbar-translate-x: translateX(0%);
3
+ background-color: var(--color-background-action-light);
4
+ position: relative;
5
+ block-size: 4px;
6
+ display: block;
7
+ overflow: hidden;
8
+ }
9
+
10
+ .ProgressBar-ProgressLine {
11
+ background-color: var(--color-content-action);
12
+ border-radius: 3px;
13
+ inline-size: 100%;
14
+ display: block;
15
+ block-size: inherit;
16
+ }
17
+
18
+ .ProgressBar_filled .ProgressBar-ProgressLine {
19
+ border-radius: 0;
20
+ }
21
+
22
+ .ProgressBar_indefinite .ProgressBar-ProgressLine {
23
+ animation: progress-bar-animation 2s linear infinite;
24
+ }
25
+
26
+ .ProgressBar:not(.ProgressBar_indefinite) .ProgressBar-ProgressLine {
27
+ transition: transform var(--transition-slow);
28
+ transform: var(--progressbar-translate-x);
29
+ transform-origin: left;
30
+ }
31
+
32
+ @keyframes progress-bar-animation {
33
+ 0% {
34
+ transform: translateX(-125%);
35
+ }
36
+
37
+ 100% {
38
+ transform: translateX(125%);
39
+ }
40
+ }
@@ -0,0 +1,11 @@
1
+ import './ProgressBar.css';
2
+ import { type ElementType } from 'react';
3
+ import { PolymorphicComponentPropsWithoutRef } from '../../utils/polymorphicComponentWithRef';
4
+ import { PROGRESSBAR_DEFAULT_TAG } from './constants';
5
+ export declare const cnProgressBar: import("@bem-react/classname").ClassNameFormatter;
6
+ export type ProgressBarBaseProps = {
7
+ /** Значение заполненной части 0-100 */
8
+ value?: number;
9
+ };
10
+ export type ProgressBarProps<As extends ElementType = typeof PROGRESSBAR_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<ProgressBarBaseProps, As>;
11
+ export declare const ProgressBar: import("../../utils/polymorphicComponentWithRef").PolymorphicComponentWithRef<ProgressBarBaseProps, "span">;
@@ -0,0 +1,29 @@
1
+ import { __assign, __rest } from "tslib";
2
+ import './ProgressBar.css';
3
+ import React from 'react';
4
+ import { cn } from '../../utils/classname';
5
+ import { polymorphicComponentWithRef, } from '../../utils/polymorphicComponentWithRef';
6
+ import { PROGRESSBAR_DEFAULT_TAG } from './constants';
7
+ export var cnProgressBar = cn('ProgressBar');
8
+ export var ProgressBar = polymorphicComponentWithRef(function (_a, ref) {
9
+ var className = _a.className, _b = _a.as, Tag = _b === void 0 ? PROGRESSBAR_DEFAULT_TAG : _b, value = _a.value, other = __rest(_a, ["className", "as", "value"]);
10
+ var isValueSet = value || value === 0;
11
+ var isFilled = value === 100;
12
+ var setProgressLineStyles = function () {
13
+ if (!isValueSet)
14
+ return undefined;
15
+ var translateX = Math.max(-100, Math.min(0, (value || 0) - 100));
16
+ return {
17
+ '--progressbar-translate-x': "translateX(".concat(translateX, "%)")
18
+ };
19
+ };
20
+ return (React.createElement(Tag, __assign({}, (isValueSet && {
21
+ 'aria-valuemin': 0,
22
+ 'aria-valuemax': 100,
23
+ 'aria-valuenow': value
24
+ }), { className: cnProgressBar({ filled: isFilled, indefinite: !isValueSet }, [
25
+ className,
26
+ ]), role: "progressbar" }, other, { ref: ref }),
27
+ React.createElement("span", { className: cnProgressBar('ProgressLine'), style: setProgressLineStyles() })));
28
+ });
29
+ ProgressBar.displayName = 'ProgressBar';
@@ -0,0 +1 @@
1
+ export declare const PROGRESSBAR_DEFAULT_TAG = "span";
@@ -0,0 +1 @@
1
+ export var PROGRESSBAR_DEFAULT_TAG = 'span';
@@ -0,0 +1 @@
1
+ export * from './ProgressBar';
@@ -0,0 +1 @@
1
+ export * from './ProgressBar';
@@ -6,6 +6,7 @@ import type { BadgeProps } from '../Badge';
6
6
  import type { ButtonProps } from '../Button';
7
7
  import type { CardProps } from '../Card';
8
8
  import type { CheckboxProps } from '../Checkbox';
9
+ import type { CheckboxGroupProps } from '../CheckboxGroup';
9
10
  import type { ChipProps } from '../Chip';
10
11
  import type { CollapseProps } from '../Collapse';
11
12
  import type { ContainerProps } from '../Container';
@@ -64,6 +65,7 @@ export type Theme = {
64
65
  Button?: Partial<ButtonProps>;
65
66
  Card?: Partial<CardProps>;
66
67
  Checkbox?: Partial<CheckboxProps>;
68
+ CheckboxGroup?: Partial<CheckboxGroupProps>;
67
69
  Chip?: Partial<ChipProps>;
68
70
  Collapse?: Partial<CollapseProps>;
69
71
  Container?: Partial<ContainerProps>;
@@ -1,12 +1,12 @@
1
1
  import { __read } from "tslib";
2
- import { useState } from 'react';
2
+ import { useCallback, useState } from 'react';
3
3
  export function useBoolean(
4
4
  /** Значение по умолчанию */
5
5
  defaultValue) {
6
6
  if (defaultValue === void 0) { defaultValue = false; }
7
7
  var _a = __read(useState(defaultValue), 2), value = _a[0], setValue = _a[1];
8
- var on = function () { return setValue(true); };
9
- var off = function () { return setValue(false); };
10
- var toggle = function () { return setValue(function (value) { return !value; }); };
8
+ var on = useCallback(function () { return setValue(true); }, []);
9
+ var off = useCallback(function () { return setValue(false); }, []);
10
+ var toggle = useCallback(function () { return setValue(function (value) { return !value; }); }, []);
11
11
  return [value, { on: on, off: off, toggle: toggle }];
12
12
  }
@@ -1,11 +1,11 @@
1
1
  import { __read } from "tslib";
2
- import { useState } from 'react';
2
+ import { useCallback, useState } from 'react';
3
3
  export function useCounter(_a) {
4
4
  var _b = _a === void 0 ? {} : _a, _c = _b.initialValue, initialValue = _c === void 0 ? 0 : _c, _d = _b.step, step = _d === void 0 ? 1 : _d;
5
5
  var _e = __read(useState(initialValue), 2), count = _e[0], setCount = _e[1];
6
- var increment = function () { return setCount(function (x) { return x + step; }); };
7
- var decrement = function () { return setCount(function (x) { return x - step; }); };
8
- var reset = function () { return setCount(initialValue); };
6
+ var increment = useCallback(function () { return setCount(function (x) { return x + step; }); }, [step]);
7
+ var decrement = useCallback(function () { return setCount(function (x) { return x - step; }); }, [step]);
8
+ var reset = useCallback(function () { return setCount(initialValue); }, [initialValue]);
9
9
  return {
10
10
  count: count,
11
11
  increment: increment,
@@ -1,5 +1,5 @@
1
1
  import { __assign, __read } from "tslib";
2
- import { useEffect, useRef, useState } from 'react';
2
+ import { useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { useInterval } from '../useInterval';
4
4
  import { USE_TIMER_ERROR_EQ_TIME, USE_TIMER_ERROR_MULTIPLICITY_INTERVAL_TO_END_TIME, USE_TIMER_ERROR_MULTIPLICITY_INTERVAL_TO_START_TIME, } from './constants';
5
5
  export function useTimer(_a) {
@@ -24,16 +24,16 @@ export function useTimer(_a) {
24
24
  });
25
25
  };
26
26
  useInterval(timerCallback, state.isTimerRunning ? interval : null);
27
- var resetTimer = function () {
27
+ var resetTimer = useCallback(function () {
28
28
  setState(function () { return ({
29
29
  isTimerRunning: false,
30
30
  count: startTime
31
31
  }); });
32
- };
33
- var pauseTimer = function () {
32
+ }, [startTime]);
33
+ var pauseTimer = useCallback(function () {
34
34
  setState(function (state) { return (__assign(__assign({}, state), { isTimerRunning: false })); });
35
- };
36
- var startTimer = function () {
35
+ }, []);
36
+ var startTimer = useCallback(function () {
37
37
  setState(function (_a) {
38
38
  var count = _a.count;
39
39
  return ({
@@ -43,7 +43,7 @@ export function useTimer(_a) {
43
43
  isTimerRunning: startTime !== endTime
44
44
  });
45
45
  });
46
- };
46
+ }, [startTime, endTime]);
47
47
  useEffect(function () {
48
48
  savedOnTimerEnd.current = onTimerEnd;
49
49
  }, [onTimerEnd]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozen-ui/kit",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "React component library",
5
5
  "files": [
6
6
  "*"
@@ -0,0 +1,5 @@
1
+ {
2
+ "main": "../__inner__/cjs/hooks/useListState/index.js",
3
+ "module": "../__inner__/esm/hooks/useListState/index.js",
4
+ "types": "../__inner__/esm/hooks/useListState/index.d.ts"
5
+ }