@gravity-ui/dynamic-forms 4.1.0 → 4.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.
- package/build/cjs/lib/kit/components/Inputs/Checkbox/Checkbox.js +2 -2
- package/build/cjs/lib/kit/components/Inputs/ObjectBase/ObjectBase.css +1 -0
- package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.css +4 -1
- package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.js +1 -1
- package/build/esm/lib/kit/components/Inputs/Checkbox/Checkbox.d.ts +4 -1
- package/build/esm/lib/kit/components/Inputs/Checkbox/Checkbox.js +2 -2
- package/build/esm/lib/kit/components/Inputs/ObjectBase/ObjectBase.css +1 -0
- package/build/esm/lib/kit/hooks/useOneOf/useOneOf.css +4 -1
- package/build/esm/lib/kit/hooks/useOneOf/useOneOf.js +1 -1
- package/package.json +1 -1
|
@@ -6,10 +6,10 @@ const react_1 = tslib_1.__importDefault(require("react"));
|
|
|
6
6
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
7
7
|
const utils_1 = require("../../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('checkbox');
|
|
9
|
-
const Checkbox = ({ name, input, spec }) => {
|
|
9
|
+
const Checkbox = ({ name, input, spec, inputProps }) => {
|
|
10
10
|
const { value, onBlur, onChange, onFocus } = input;
|
|
11
11
|
const handleChange = react_1.default.useCallback((e) => onChange(e.target.checked), [onChange]);
|
|
12
12
|
return (react_1.default.createElement("div", { className: b() },
|
|
13
|
-
react_1.default.createElement(uikit_1.Checkbox, { checked: value, onChange: handleChange, onBlur: onBlur, onFocus: onFocus, disabled: spec.viewSpec.disabled, qa: name })));
|
|
13
|
+
react_1.default.createElement(uikit_1.Checkbox, Object.assign({}, inputProps, { checked: value, onChange: handleChange, onBlur: onBlur, onFocus: onFocus, disabled: spec.viewSpec.disabled, qa: name }))));
|
|
14
14
|
};
|
|
15
15
|
exports.Checkbox = Checkbox;
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
.df-use-oneof__card {
|
|
10
10
|
display: flex;
|
|
11
11
|
}
|
|
12
|
-
.df-use-oneof__card >
|
|
12
|
+
.df-use-oneof__card > * {
|
|
13
13
|
margin-right: 8px;
|
|
14
14
|
}
|
|
15
|
+
.df-use-oneof__card > :last-child {
|
|
16
|
+
margin-right: 0;
|
|
17
|
+
}
|
|
15
18
|
.df-use-oneof__checkbox {
|
|
16
19
|
height: 28px;
|
|
17
20
|
display: flex;
|
|
@@ -60,7 +60,7 @@ const useOneOf = ({ props, onTogglerChange }) => {
|
|
|
60
60
|
}), [spec.description, spec.viewSpec.order, specProperties]);
|
|
61
61
|
const togglerType = react_1.default.useMemo(() => {
|
|
62
62
|
var _a, _b, _c, _d;
|
|
63
|
-
if (((_a = spec.viewSpec.oneOfParams) === null || _a === void 0 ? void 0 : _a.toggler) === 'card' && options.length <
|
|
63
|
+
if (((_a = spec.viewSpec.oneOfParams) === null || _a === void 0 ? void 0 : _a.toggler) === 'card' && options.length < 4) {
|
|
64
64
|
return 'card';
|
|
65
65
|
}
|
|
66
66
|
if (((_b = spec.viewSpec.oneOfParams) === null || _b === void 0 ? void 0 : _b.toggler) !== 'radio' &&
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { CheckboxProps as CheckboxBaseProps } from '@gravity-ui/uikit';
|
|
1
2
|
import { BooleanInput } from '../../../../core';
|
|
2
3
|
import './Checkbox.css';
|
|
3
|
-
export
|
|
4
|
+
export interface CheckboxProps extends Omit<CheckboxBaseProps, 'checked' | 'onChange' | 'onBlur' | 'onFocus' | 'disabled' | 'qa'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const Checkbox: BooleanInput<CheckboxProps>;
|
|
@@ -3,9 +3,9 @@ import { Checkbox as CheckboxBase } from '@gravity-ui/uikit';
|
|
|
3
3
|
import { block } from '../../../utils';
|
|
4
4
|
import './Checkbox.css';
|
|
5
5
|
const b = block('checkbox');
|
|
6
|
-
export const Checkbox = ({ name, input, spec }) => {
|
|
6
|
+
export const Checkbox = ({ name, input, spec, inputProps }) => {
|
|
7
7
|
const { value, onBlur, onChange, onFocus } = input;
|
|
8
8
|
const handleChange = React.useCallback((e) => onChange(e.target.checked), [onChange]);
|
|
9
9
|
return (React.createElement("div", { className: b() },
|
|
10
|
-
React.createElement(CheckboxBase, { checked: value, onChange: handleChange, onBlur: onBlur, onFocus: onFocus, disabled: spec.viewSpec.disabled, qa: name })));
|
|
10
|
+
React.createElement(CheckboxBase, Object.assign({}, inputProps, { checked: value, onChange: handleChange, onBlur: onBlur, onFocus: onFocus, disabled: spec.viewSpec.disabled, qa: name }))));
|
|
11
11
|
};
|
|
@@ -9,9 +9,12 @@
|
|
|
9
9
|
.df-use-oneof__card {
|
|
10
10
|
display: flex;
|
|
11
11
|
}
|
|
12
|
-
.df-use-oneof__card >
|
|
12
|
+
.df-use-oneof__card > * {
|
|
13
13
|
margin-right: 8px;
|
|
14
14
|
}
|
|
15
|
+
.df-use-oneof__card > :last-child {
|
|
16
|
+
margin-right: 0;
|
|
17
|
+
}
|
|
15
18
|
.df-use-oneof__checkbox {
|
|
16
19
|
height: 28px;
|
|
17
20
|
display: flex;
|
|
@@ -57,7 +57,7 @@ export const useOneOf = ({ props, onTogglerChange }) => {
|
|
|
57
57
|
}), [spec.description, spec.viewSpec.order, specProperties]);
|
|
58
58
|
const togglerType = React.useMemo(() => {
|
|
59
59
|
var _a, _b, _c, _d;
|
|
60
|
-
if (((_a = spec.viewSpec.oneOfParams) === null || _a === void 0 ? void 0 : _a.toggler) === 'card' && options.length <
|
|
60
|
+
if (((_a = spec.viewSpec.oneOfParams) === null || _a === void 0 ? void 0 : _a.toggler) === 'card' && options.length < 4) {
|
|
61
61
|
return 'card';
|
|
62
62
|
}
|
|
63
63
|
if (((_b = spec.viewSpec.oneOfParams) === null || _b === void 0 ? void 0 : _b.toggler) !== 'radio' &&
|