@ozen-ui/kit 0.55.0 → 0.56.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/Autocomplete/helper.d.ts +2 -2
- package/__inner__/cjs/components/Autocomplete/types.d.ts +1 -1
- package/__inner__/cjs/components/ButtonBase/ButtonBase.js +13 -8
- package/__inner__/cjs/components/Calendar/components/CalendarGridItem/types.d.ts +1 -1
- package/__inner__/cjs/components/DataList/components/DataListOption/DataListOption.css +0 -1
- package/__inner__/cjs/components/FieldInput/FieldInput.js +2 -2
- package/__inner__/cjs/components/Select/types.d.ts +2 -1
- package/__inner__/cjs/components/Snackbar/SnackbarContext.js +1 -4
- package/__inner__/cjs/hooks/useControlled/useControlled.js +1 -1
- package/__inner__/esm/components/Autocomplete/helper.d.ts +2 -2
- package/__inner__/esm/components/Autocomplete/types.d.ts +1 -1
- package/__inner__/esm/components/ButtonBase/ButtonBase.js +13 -8
- package/__inner__/esm/components/Calendar/components/CalendarGridItem/types.d.ts +1 -1
- package/__inner__/esm/components/DataList/components/DataListOption/DataListOption.css +0 -1
- package/__inner__/esm/components/FieldInput/FieldInput.js +2 -2
- package/__inner__/esm/components/Select/types.d.ts +2 -1
- package/__inner__/esm/components/Snackbar/SnackbarContext.js +1 -4
- package/__inner__/esm/hooks/useControlled/useControlled.js +1 -1
- package/package.json +4 -4
|
@@ -69,7 +69,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
69
69
|
}) & (OPTION extends {
|
|
70
70
|
disabled: boolean | undefined;
|
|
71
71
|
} ? Record<string, unknown> : {
|
|
72
|
-
getOptionDisabled?:
|
|
72
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION> | undefined;
|
|
73
73
|
}) & {
|
|
74
74
|
getOptionLabel: AutocompletePropGetOptionLabel<AutocompleteDefaultOption> | AutocompletePropGetOptionLabel<OPTION>;
|
|
75
75
|
getOptionKey: AutocompletePropGetOptionKey<AutocompleteDefaultOption> | AutocompletePropGetOptionKey<OPTION>;
|
|
@@ -140,7 +140,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
140
140
|
}) & (OPTION extends {
|
|
141
141
|
disabled: boolean | undefined;
|
|
142
142
|
} ? Record<string, unknown> : {
|
|
143
|
-
getOptionDisabled?:
|
|
143
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION> | undefined;
|
|
144
144
|
}) & {
|
|
145
145
|
getOptionLabel: AutocompletePropGetOptionLabel<AutocompleteDefaultOption> | AutocompletePropGetOptionLabel<OPTION>;
|
|
146
146
|
getOptionKey: AutocompletePropGetOptionKey<AutocompleteDefaultOption> | AutocompletePropGetOptionKey<OPTION>;
|
|
@@ -99,7 +99,7 @@ export type AutocompleteProps<OPTION = AutocompleteDefaultOption> = {
|
|
|
99
99
|
}) & (OPTION extends {
|
|
100
100
|
disabled: AutocompleteDefaultOption['disabled'];
|
|
101
101
|
} ? Record<string, unknown> : {
|
|
102
|
-
getOptionDisabled?:
|
|
102
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION>;
|
|
103
103
|
});
|
|
104
104
|
export type AutocompleteComponent = <OPTION = AutocompleteDefaultOption>(props: AutocompleteProps<OPTION>) => ReactElement | null;
|
|
105
105
|
export {};
|
|
@@ -14,17 +14,22 @@ exports.ButtonBase = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
|
|
|
14
14
|
props: inProps,
|
|
15
15
|
name: 'Button',
|
|
16
16
|
});
|
|
17
|
-
var _a = props.as, Tag = _a === void 0 ? constants_1.BUTTON_BASE_DEFAULT_TAG : _a,
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
var _a = props.as, Tag = _a === void 0 ? constants_1.BUTTON_BASE_DEFAULT_TAG : _a, loadingProp = props.loading, disabledProp = props.disabled, children = props.children, className = props.className, onClick = props.onClick, unstyled = props.unstyled, other = tslib_1.__rest(props, ["as", "loading", "disabled", "children", "className", "onClick", "unstyled"]);
|
|
18
|
+
var loading = Boolean(loadingProp);
|
|
19
|
+
var disabled = Boolean(disabledProp || loadingProp);
|
|
20
|
+
// TODO: подумать на тем, чтобы не блокировать кнопку в «заблокированном состоянии»,
|
|
21
|
+
// чтобы не терять установленный на неё фокус
|
|
22
|
+
var onDisabledClick = function (event) {
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
event.stopPropagation();
|
|
25
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
22
26
|
};
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
return (react_1.default.createElement(Tag, tslib_1.__assign({ disabled: disabled, onClick: disabled ? onDisabledClick : onClick }, (disabled && {
|
|
28
|
+
'aria-disabled': true,
|
|
29
|
+
}), { type: "button", className: (0, exports.cnButtonBase)({
|
|
25
30
|
disabled: disabled,
|
|
26
31
|
loading: loading,
|
|
27
32
|
unstyled: unstyled,
|
|
28
|
-
}, [className]) }, (
|
|
33
|
+
}, [className]) }, (disabled && { tabIndex: -1 }), other, { ref: ref }), children));
|
|
29
34
|
});
|
|
30
35
|
exports.ButtonBase.displayName = 'ButtonBase';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentRef } from 'react';
|
|
2
|
-
import type { DPDayRange } from '@rehookify/datepicker
|
|
2
|
+
import type { DPDayRange } from '@rehookify/datepicker';
|
|
3
3
|
import type { ExtendableComponentPropsWithRef } from '../../../../types/ExtendableComponentPropsWithRef';
|
|
4
4
|
import type { CalendarSizeVariant } from '../../index';
|
|
5
5
|
export type CalendarGridItemRef = ComponentRef<'button'>;
|
|
@@ -20,7 +20,7 @@ exports.FieldInput = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
|
|
|
20
20
|
name: 'FieldInput',
|
|
21
21
|
state: 'value',
|
|
22
22
|
defaultValue: defaultValue,
|
|
23
|
-
}),
|
|
23
|
+
}), 3), valueState = _e[0], setValueState = _e[1], isControlled = _e[2];
|
|
24
24
|
var filled = !!valueState || valueState === 0;
|
|
25
25
|
var required = requiredProp;
|
|
26
26
|
var disabled = disabledProp;
|
|
@@ -50,6 +50,6 @@ exports.FieldInput = (0, polymorphicComponentWithRef_1.polymorphicComponentWithR
|
|
|
50
50
|
setFocused(false);
|
|
51
51
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
52
52
|
}, [onBlur]);
|
|
53
|
-
return (react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnFieldInput)({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, value: valueState }, other, { ref: ref }), children));
|
|
53
|
+
return (react_1.default.createElement(Tag, tslib_1.__assign({ className: (0, exports.cnFieldInput)({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange }, (isControlled ? { value: valueState } : { defaultValue: defaultValue }), other, { ref: ref }), children));
|
|
54
54
|
});
|
|
55
55
|
exports.FieldInput.displayName = 'FieldInput';
|
|
@@ -2,7 +2,7 @@ import type { ReactElement, ReactNode, SyntheticEvent } from 'react';
|
|
|
2
2
|
import type { ExtendableComponentPropsWithRef } from '../../types/ExtendableComponentPropsWithRef';
|
|
3
3
|
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
4
4
|
import type { DataListBaseProps, DataListSelected } from '../DataList';
|
|
5
|
-
import type { SelectInputProps } from './components';
|
|
5
|
+
import type { SelectInputProps, SelectInputRef } from './components';
|
|
6
6
|
export type SelectSizeVariant = FormElementSizeVariant;
|
|
7
7
|
export type SelectLabel = string | number | undefined;
|
|
8
8
|
export type SelectPropLabel<MULTIPLE extends boolean> = (MULTIPLE extends true ? SelectLabel[] : SelectLabel) | undefined;
|
|
@@ -47,6 +47,7 @@ type SelectPropsDeprecated<MULTIPLE extends boolean = false> = {
|
|
|
47
47
|
* */
|
|
48
48
|
menuProps?: Partial<Omit<DataListBaseProps<MULTIPLE>, 'onClose' | 'open' | 'anchorRef' | 'multiple' | 'selected' | 'onSelect'>>;
|
|
49
49
|
};
|
|
50
|
+
export type SelectRef = SelectInputRef;
|
|
50
51
|
export type SelectProps<MULTIPLE extends boolean = false> = ExtendableComponentPropsWithRef<{
|
|
51
52
|
/** Если {true} устанавливает автофокус */
|
|
52
53
|
autoFocus?: boolean;
|
|
@@ -3,10 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useSnackbar = exports.SnackbarContext = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var react_1 = tslib_1.__importStar(require("react"));
|
|
6
|
-
exports.SnackbarContext = react_1.default.createContext({
|
|
7
|
-
pushMessage: function () { return ''; },
|
|
8
|
-
closeMessage: function () { return undefined; },
|
|
9
|
-
});
|
|
6
|
+
exports.SnackbarContext = react_1.default.createContext({});
|
|
10
7
|
var useSnackbar = function () { return (0, react_1.useContext)(exports.SnackbarContext); };
|
|
11
8
|
exports.useSnackbar = useSnackbar;
|
|
12
9
|
// Именованный провайдер
|
|
@@ -69,7 +69,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
69
69
|
}) & (OPTION extends {
|
|
70
70
|
disabled: boolean | undefined;
|
|
71
71
|
} ? Record<string, unknown> : {
|
|
72
|
-
getOptionDisabled?:
|
|
72
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION> | undefined;
|
|
73
73
|
}) & {
|
|
74
74
|
getOptionLabel: AutocompletePropGetOptionLabel<AutocompleteDefaultOption> | AutocompletePropGetOptionLabel<OPTION>;
|
|
75
75
|
getOptionKey: AutocompletePropGetOptionKey<AutocompleteDefaultOption> | AutocompletePropGetOptionKey<OPTION>;
|
|
@@ -140,7 +140,7 @@ export declare function withDefaultGetters<OPTION>(props: AutocompleteProps<OPTI
|
|
|
140
140
|
}) & (OPTION extends {
|
|
141
141
|
disabled: boolean | undefined;
|
|
142
142
|
} ? Record<string, unknown> : {
|
|
143
|
-
getOptionDisabled?:
|
|
143
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION> | undefined;
|
|
144
144
|
}) & {
|
|
145
145
|
getOptionLabel: AutocompletePropGetOptionLabel<AutocompleteDefaultOption> | AutocompletePropGetOptionLabel<OPTION>;
|
|
146
146
|
getOptionKey: AutocompletePropGetOptionKey<AutocompleteDefaultOption> | AutocompletePropGetOptionKey<OPTION>;
|
|
@@ -99,7 +99,7 @@ export type AutocompleteProps<OPTION = AutocompleteDefaultOption> = {
|
|
|
99
99
|
}) & (OPTION extends {
|
|
100
100
|
disabled: AutocompleteDefaultOption['disabled'];
|
|
101
101
|
} ? Record<string, unknown> : {
|
|
102
|
-
getOptionDisabled?:
|
|
102
|
+
getOptionDisabled?: AutocompletePropGetOptionDisabled<OPTION>;
|
|
103
103
|
});
|
|
104
104
|
export type AutocompleteComponent = <OPTION = AutocompleteDefaultOption>(props: AutocompleteProps<OPTION>) => ReactElement | null;
|
|
105
105
|
export {};
|
|
@@ -11,17 +11,22 @@ export var ButtonBase = polymorphicComponentWithRef(function (inProps, ref) {
|
|
|
11
11
|
props: inProps,
|
|
12
12
|
name: 'Button',
|
|
13
13
|
});
|
|
14
|
-
var _a = props.as, Tag = _a === void 0 ? BUTTON_BASE_DEFAULT_TAG : _a,
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
var _a = props.as, Tag = _a === void 0 ? BUTTON_BASE_DEFAULT_TAG : _a, loadingProp = props.loading, disabledProp = props.disabled, children = props.children, className = props.className, onClick = props.onClick, unstyled = props.unstyled, other = __rest(props, ["as", "loading", "disabled", "children", "className", "onClick", "unstyled"]);
|
|
15
|
+
var loading = Boolean(loadingProp);
|
|
16
|
+
var disabled = Boolean(disabledProp || loadingProp);
|
|
17
|
+
// TODO: подумать на тем, чтобы не блокировать кнопку в «заблокированном состоянии»,
|
|
18
|
+
// чтобы не терять установленный на неё фокус
|
|
19
|
+
var onDisabledClick = function (event) {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
event.stopPropagation();
|
|
22
|
+
event.nativeEvent.stopImmediatePropagation();
|
|
19
23
|
};
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
return (React.createElement(Tag, __assign({ disabled: disabled, onClick: disabled ? onDisabledClick : onClick }, (disabled && {
|
|
25
|
+
'aria-disabled': true,
|
|
26
|
+
}), { type: "button", className: cnButtonBase({
|
|
22
27
|
disabled: disabled,
|
|
23
28
|
loading: loading,
|
|
24
29
|
unstyled: unstyled,
|
|
25
|
-
}, [className]) }, (
|
|
30
|
+
}, [className]) }, (disabled && { tabIndex: -1 }), other, { ref: ref }), children));
|
|
26
31
|
});
|
|
27
32
|
ButtonBase.displayName = 'ButtonBase';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentRef } from 'react';
|
|
2
|
-
import type { DPDayRange } from '@rehookify/datepicker
|
|
2
|
+
import type { DPDayRange } from '@rehookify/datepicker';
|
|
3
3
|
import type { ExtendableComponentPropsWithRef } from '../../../../types/ExtendableComponentPropsWithRef';
|
|
4
4
|
import type { CalendarSizeVariant } from '../../index';
|
|
5
5
|
export type CalendarGridItemRef = ComponentRef<'button'>;
|
|
@@ -17,7 +17,7 @@ export var FieldInput = polymorphicComponentWithRef(function (_a, ref) {
|
|
|
17
17
|
name: 'FieldInput',
|
|
18
18
|
state: 'value',
|
|
19
19
|
defaultValue: defaultValue,
|
|
20
|
-
}),
|
|
20
|
+
}), 3), valueState = _e[0], setValueState = _e[1], isControlled = _e[2];
|
|
21
21
|
var filled = !!valueState || valueState === 0;
|
|
22
22
|
var required = requiredProp;
|
|
23
23
|
var disabled = disabledProp;
|
|
@@ -47,6 +47,6 @@ export var FieldInput = polymorphicComponentWithRef(function (_a, ref) {
|
|
|
47
47
|
setFocused(false);
|
|
48
48
|
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
49
49
|
}, [onBlur]);
|
|
50
|
-
return (React.createElement(Tag, __assign({ className: cnFieldInput({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange, value: valueState }, other, { ref: ref }), children));
|
|
50
|
+
return (React.createElement(Tag, __assign({ className: cnFieldInput({}, [className]), required: required, disabled: disabled, onFocus: handleFocus, onBlur: handleBlur, onChange: handleChange }, (isControlled ? { value: valueState } : { defaultValue: defaultValue }), other, { ref: ref }), children));
|
|
51
51
|
});
|
|
52
52
|
FieldInput.displayName = 'FieldInput';
|
|
@@ -2,7 +2,7 @@ import type { ReactElement, ReactNode, SyntheticEvent } from 'react';
|
|
|
2
2
|
import type { ExtendableComponentPropsWithRef } from '../../types/ExtendableComponentPropsWithRef';
|
|
3
3
|
import type { FormElementSizeVariant } from '../../types/FormElementSizeVariant';
|
|
4
4
|
import type { DataListBaseProps, DataListSelected } from '../DataList';
|
|
5
|
-
import type { SelectInputProps } from './components';
|
|
5
|
+
import type { SelectInputProps, SelectInputRef } from './components';
|
|
6
6
|
export type SelectSizeVariant = FormElementSizeVariant;
|
|
7
7
|
export type SelectLabel = string | number | undefined;
|
|
8
8
|
export type SelectPropLabel<MULTIPLE extends boolean> = (MULTIPLE extends true ? SelectLabel[] : SelectLabel) | undefined;
|
|
@@ -47,6 +47,7 @@ type SelectPropsDeprecated<MULTIPLE extends boolean = false> = {
|
|
|
47
47
|
* */
|
|
48
48
|
menuProps?: Partial<Omit<DataListBaseProps<MULTIPLE>, 'onClose' | 'open' | 'anchorRef' | 'multiple' | 'selected' | 'onSelect'>>;
|
|
49
49
|
};
|
|
50
|
+
export type SelectRef = SelectInputRef;
|
|
50
51
|
export type SelectProps<MULTIPLE extends boolean = false> = ExtendableComponentPropsWithRef<{
|
|
51
52
|
/** Если {true} устанавливает автофокус */
|
|
52
53
|
autoFocus?: boolean;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import React, { useContext } from 'react';
|
|
2
|
-
export var SnackbarContext = React.createContext({
|
|
3
|
-
pushMessage: function () { return ''; },
|
|
4
|
-
closeMessage: function () { return undefined; },
|
|
5
|
-
});
|
|
2
|
+
export var SnackbarContext = React.createContext({});
|
|
6
3
|
export var useSnackbar = function () { return useContext(SnackbarContext); };
|
|
7
4
|
// Именованный провайдер
|
|
8
5
|
if (process.env.NODE_ENV !== 'production') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozen-ui/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.0",
|
|
4
4
|
"description": "React component library",
|
|
5
5
|
"files": [
|
|
6
6
|
"*"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"react-popper": "^2.3.0",
|
|
28
28
|
"react-transition-group": "^4.4.5",
|
|
29
29
|
"tslib": "^2.6.2",
|
|
30
|
-
"@ozen-ui/fonts": "0.
|
|
31
|
-
"@ozen-ui/
|
|
32
|
-
"@ozen-ui/
|
|
30
|
+
"@ozen-ui/fonts": "0.56.0",
|
|
31
|
+
"@ozen-ui/logger": "0.56.0",
|
|
32
|
+
"@ozen-ui/icons": "0.56.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=17.0.2 <19.0.0",
|