@gravity-ui/dynamic-forms 5.16.0 → 5.17.1
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/ColorPicker/ColorPicker.js +21 -0
- package/build/cjs/lib/kit/components/Inputs/ColorPicker/index.js +4 -0
- package/build/cjs/lib/kit/components/Inputs/index.js +1 -0
- package/build/cjs/lib/kit/components/Views/ColorPickerView/ColorPickerView.css +31 -0
- package/build/cjs/lib/kit/components/Views/ColorPickerView/ColorPickerView.js +12 -0
- package/build/cjs/lib/kit/components/Views/ColorPickerView/index.js +4 -0
- package/build/cjs/lib/kit/components/Views/index.js +1 -0
- package/build/cjs/lib/kit/constants/config.js +2 -0
- package/build/esm/lib/kit/components/Inputs/ColorPicker/ColorPicker.d.ts +6 -0
- package/build/esm/lib/kit/components/Inputs/ColorPicker/ColorPicker.js +16 -0
- package/build/esm/lib/kit/components/Inputs/ColorPicker/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Inputs/ColorPicker/index.js +1 -0
- package/build/esm/lib/kit/components/Inputs/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Inputs/index.js +1 -0
- package/build/esm/lib/kit/components/Views/ColorPickerView/ColorPickerView.css +31 -0
- package/build/esm/lib/kit/components/Views/ColorPickerView/ColorPickerView.d.ts +3 -0
- package/build/esm/lib/kit/components/Views/ColorPickerView/ColorPickerView.js +8 -0
- package/build/esm/lib/kit/components/Views/ColorPickerView/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Views/ColorPickerView/index.js +1 -0
- package/build/esm/lib/kit/components/Views/index.d.ts +1 -0
- package/build/esm/lib/kit/components/Views/index.js +1 -0
- package/build/esm/lib/kit/constants/config.js +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColorPicker = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const unstable_1 = require("@gravity-ui/uikit/unstable");
|
|
7
|
+
const ColorPicker = ({ input, spec, inputProps }) => {
|
|
8
|
+
const { value, onChange, onBlur, onFocus } = input;
|
|
9
|
+
const handleOpenChange = react_1.default.useCallback((open) => {
|
|
10
|
+
var _a;
|
|
11
|
+
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(inputProps, open);
|
|
12
|
+
if (open) {
|
|
13
|
+
onFocus();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
onBlur();
|
|
17
|
+
}
|
|
18
|
+
}, [inputProps, onBlur, onFocus]);
|
|
19
|
+
return (react_1.default.createElement(unstable_1.unstable_ColorPicker, Object.assign({}, inputProps, { value: value || '', onUpdate: onChange, onOpenChange: handleOpenChange, disabled: spec.viewSpec.disabled })));
|
|
20
|
+
};
|
|
21
|
+
exports.ColorPicker = ColorPicker;
|
|
@@ -7,6 +7,7 @@ tslib_1.__exportStar(require("./Checkbox"), exports);
|
|
|
7
7
|
tslib_1.__exportStar(require("./CheckboxGroup"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./FileInput"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./DateInput"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./ColorPicker"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./MonacoInput"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./MultiOneOf"), exports);
|
|
12
13
|
tslib_1.__exportStar(require("./MultiSelect"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
@mixin variables {
|
|
3
|
+
--g-spacing-base: 4px;
|
|
4
|
+
|
|
5
|
+
--g-spacing-0: calc(var(--g-spacing-base) * 0); //0px
|
|
6
|
+
--g-spacing-half: calc(var(--g-spacing-base) * 0.5); //2px
|
|
7
|
+
--g-spacing-1: var(--g-spacing-base); // 4px
|
|
8
|
+
--g-spacing-2: calc(var(--g-spacing-base) * 2); // 8px
|
|
9
|
+
--g-spacing-3: calc(var(--g-spacing-base) * 3); // 12px
|
|
10
|
+
--g-spacing-4: calc(var(--g-spacing-base) * 4); // 16px
|
|
11
|
+
--g-spacing-5: calc(var(--g-spacing-base) * 5); // 20px
|
|
12
|
+
--g-spacing-6: calc(var(--g-spacing-base) * 6); // 24px
|
|
13
|
+
--g-spacing-7: calc(var(--g-spacing-base) * 7); // 28px
|
|
14
|
+
--g-spacing-8: calc(var(--g-spacing-base) * 8); // 32px
|
|
15
|
+
--g-spacing-9: calc(var(--g-spacing-base) * 9); // 36px
|
|
16
|
+
--g-spacing-10: calc(var(--g-spacing-base) * 10); // 40px
|
|
17
|
+
}
|
|
18
|
+
*/
|
|
19
|
+
/* Border-radius */
|
|
20
|
+
.df-color-picker-view {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: var(--g-spacing-2);
|
|
24
|
+
}
|
|
25
|
+
.df-color-picker-view__preview {
|
|
26
|
+
width: 16px;
|
|
27
|
+
height: 16px;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
border: 1px solid var(--g-color-line-generic);
|
|
30
|
+
border-radius: var(--g-border-radius-xs);
|
|
31
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColorPickerView = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
const components_1 = require("../../../components");
|
|
7
|
+
const utils_1 = require("../../../utils");
|
|
8
|
+
const b = (0, utils_1.block)('color-picker-view');
|
|
9
|
+
const ColorPickerView = ({ value = '' }) => (react_1.default.createElement("div", { className: b() },
|
|
10
|
+
value ? react_1.default.createElement("div", { className: b('preview'), style: { backgroundColor: value } }) : null,
|
|
11
|
+
react_1.default.createElement(components_1.LongValue, { value: value })));
|
|
12
|
+
exports.ColorPickerView = ColorPickerView;
|
|
@@ -6,6 +6,7 @@ tslib_1.__exportStar(require("./BaseView"), exports);
|
|
|
6
6
|
tslib_1.__exportStar(require("./CheckboxGroupView"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./CardOneOfView"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./FileInputView"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./ColorPickerView"), exports);
|
|
9
10
|
tslib_1.__exportStar(require("./MonacoInputView"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./MultiOneOfView"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./MultiSelectView"), exports);
|
|
@@ -103,6 +103,7 @@ exports.dynamicConfig = {
|
|
|
103
103
|
base: { Component: components_1.Text },
|
|
104
104
|
file_input: { Component: components_1.FileInput },
|
|
105
105
|
date_input: { Component: components_1.DateInput },
|
|
106
|
+
color_picker: { Component: components_1.ColorPicker },
|
|
106
107
|
number_with_scale: { Component: components_1.NumberWithScale },
|
|
107
108
|
monaco_input: { Component: components_1.MonacoInput },
|
|
108
109
|
text_content: { Component: components_1.TextContent, independent: true },
|
|
@@ -214,6 +215,7 @@ exports.dynamicViewConfig = {
|
|
|
214
215
|
select: { Component: components_1.BaseView },
|
|
215
216
|
base: { Component: components_1.BaseView },
|
|
216
217
|
date_input: { Component: components_1.DateView },
|
|
218
|
+
color_picker: { Component: components_1.ColorPickerView },
|
|
217
219
|
file_input: { Component: components_1.FileInputView },
|
|
218
220
|
number_with_scale: { Component: components_1.NumberWithScaleView },
|
|
219
221
|
monaco_input: { Component: components_1.MonacoView },
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { unstable_ColorPicker as ColorPickerBase } from '@gravity-ui/uikit/unstable';
|
|
3
|
+
import type { StringInput } from '../../../../core';
|
|
4
|
+
export interface ColorPickerProps extends Omit<React.ComponentProps<typeof ColorPickerBase>, 'value' | 'onUpdate' | 'disabled'> {
|
|
5
|
+
}
|
|
6
|
+
export declare const ColorPicker: StringInput<ColorPickerProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { unstable_ColorPicker as ColorPickerBase } from '@gravity-ui/uikit/unstable';
|
|
3
|
+
export const ColorPicker = ({ input, spec, inputProps }) => {
|
|
4
|
+
const { value, onChange, onBlur, onFocus } = input;
|
|
5
|
+
const handleOpenChange = React.useCallback((open) => {
|
|
6
|
+
var _a;
|
|
7
|
+
(_a = inputProps === null || inputProps === void 0 ? void 0 : inputProps.onOpenChange) === null || _a === void 0 ? void 0 : _a.call(inputProps, open);
|
|
8
|
+
if (open) {
|
|
9
|
+
onFocus();
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
onBlur();
|
|
13
|
+
}
|
|
14
|
+
}, [inputProps, onBlur, onFocus]);
|
|
15
|
+
return (React.createElement(ColorPickerBase, Object.assign({}, inputProps, { value: value || '', onUpdate: onChange, onOpenChange: handleOpenChange, disabled: spec.viewSpec.disabled })));
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ColorPicker';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ColorPicker';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
@mixin variables {
|
|
3
|
+
--g-spacing-base: 4px;
|
|
4
|
+
|
|
5
|
+
--g-spacing-0: calc(var(--g-spacing-base) * 0); //0px
|
|
6
|
+
--g-spacing-half: calc(var(--g-spacing-base) * 0.5); //2px
|
|
7
|
+
--g-spacing-1: var(--g-spacing-base); // 4px
|
|
8
|
+
--g-spacing-2: calc(var(--g-spacing-base) * 2); // 8px
|
|
9
|
+
--g-spacing-3: calc(var(--g-spacing-base) * 3); // 12px
|
|
10
|
+
--g-spacing-4: calc(var(--g-spacing-base) * 4); // 16px
|
|
11
|
+
--g-spacing-5: calc(var(--g-spacing-base) * 5); // 20px
|
|
12
|
+
--g-spacing-6: calc(var(--g-spacing-base) * 6); // 24px
|
|
13
|
+
--g-spacing-7: calc(var(--g-spacing-base) * 7); // 28px
|
|
14
|
+
--g-spacing-8: calc(var(--g-spacing-base) * 8); // 32px
|
|
15
|
+
--g-spacing-9: calc(var(--g-spacing-base) * 9); // 36px
|
|
16
|
+
--g-spacing-10: calc(var(--g-spacing-base) * 10); // 40px
|
|
17
|
+
}
|
|
18
|
+
*/
|
|
19
|
+
/* Border-radius */
|
|
20
|
+
.df-color-picker-view {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: var(--g-spacing-2);
|
|
24
|
+
}
|
|
25
|
+
.df-color-picker-view__preview {
|
|
26
|
+
width: 16px;
|
|
27
|
+
height: 16px;
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
border: 1px solid var(--g-color-line-generic);
|
|
30
|
+
border-radius: var(--g-border-radius-xs);
|
|
31
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LongValue } from '../../../components';
|
|
3
|
+
import { block } from '../../../utils';
|
|
4
|
+
import './ColorPickerView.css';
|
|
5
|
+
const b = block('color-picker-view');
|
|
6
|
+
export const ColorPickerView = ({ value = '' }) => (React.createElement("div", { className: b() },
|
|
7
|
+
value ? React.createElement("div", { className: b('preview'), style: { backgroundColor: value } }) : null,
|
|
8
|
+
React.createElement(LongValue, { value: value })));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ColorPickerView';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ColorPickerView';
|
|
@@ -3,6 +3,7 @@ export * from './BaseView';
|
|
|
3
3
|
export * from './CheckboxGroupView';
|
|
4
4
|
export * from './CardOneOfView';
|
|
5
5
|
export * from './FileInputView';
|
|
6
|
+
export * from './ColorPickerView';
|
|
6
7
|
export * from './MonacoInputView';
|
|
7
8
|
export * from './MultiOneOfView';
|
|
8
9
|
export * from './MultiSelectView';
|
|
@@ -3,6 +3,7 @@ export * from './BaseView';
|
|
|
3
3
|
export * from './CheckboxGroupView';
|
|
4
4
|
export * from './CardOneOfView';
|
|
5
5
|
export * from './FileInputView';
|
|
6
|
+
export * from './ColorPickerView';
|
|
6
7
|
export * from './MonacoInputView';
|
|
7
8
|
export * from './MultiOneOfView';
|
|
8
9
|
export * from './MultiSelectView';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accordeon, AccordeonCardForm, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, CheckboxGroup, CheckboxGroupView, Column, DateInput, DateView, FileInput, FileInputView, Group, Group2, MonacoInput, MonacoView, MultiOneOf, MultiOneOfFlat, MultiOneOfFlatView, MultiOneOfView, MultiSelect, MultiSelectView, NumInput, NumberWithScale, NumberWithScaleView, ObjectBase, ObjectBaseView, ObjectInline, ObjectInlineView, ObjectValueInput, ObjectValueInputView, OneOf, OneOfFlat, OneOfFlatView, OneOfView, RadioGroup, RangeInputPicker, RangeInputPickerNumber, RangeInputPickerNumberView, RangeInputPickerView, Row, RowVerbose, Secret, Section, Section2, Select, Switch, TableArrayInput, TableArrayView, TableCell, Text, TextArea, TextAreaView, TextContent, TextContentView, TextLink, TextLinkView, TimeRangeSelector, TimeRangeSelectorView, Transparent, ViewAccordeon, ViewAccordeonCard, ViewCardAccordeon, ViewCardSection, ViewColumn, ViewGroup, ViewGroup2, ViewRow, ViewSection, ViewSection2, ViewTableCell, ViewTransparent, } from '../components';
|
|
1
|
+
import { Accordeon, AccordeonCardForm, ArrayBase, ArrayBaseView, BaseView, CardAccordeon, CardOneOf, CardOneOfView, CardSection, Checkbox, CheckboxGroup, CheckboxGroupView, ColorPicker, ColorPickerView, Column, DateInput, DateView, FileInput, FileInputView, Group, Group2, MonacoInput, MonacoView, MultiOneOf, MultiOneOfFlat, MultiOneOfFlatView, MultiOneOfView, MultiSelect, MultiSelectView, NumInput, NumberWithScale, NumberWithScaleView, ObjectBase, ObjectBaseView, ObjectInline, ObjectInlineView, ObjectValueInput, ObjectValueInputView, OneOf, OneOfFlat, OneOfFlatView, OneOfView, RadioGroup, RangeInputPicker, RangeInputPickerNumber, RangeInputPickerNumberView, RangeInputPickerView, Row, RowVerbose, Secret, Section, Section2, Select, Switch, TableArrayInput, TableArrayView, TableCell, Text, TextArea, TextAreaView, TextContent, TextContentView, TextLink, TextLinkView, TimeRangeSelector, TimeRangeSelectorView, Transparent, ViewAccordeon, ViewAccordeonCard, ViewCardAccordeon, ViewCardSection, ViewColumn, ViewGroup, ViewGroup2, ViewRow, ViewSection, ViewSection2, ViewTableCell, ViewTransparent, } from '../components';
|
|
2
2
|
import { getArrayValidator, getBooleanValidator, getNumberValidator, getNumberWithScaleValidator, getObjectValidator, getStringValidator, } from '../validators';
|
|
3
3
|
export const dynamicConfig = {
|
|
4
4
|
array: {
|
|
@@ -100,6 +100,7 @@ export const dynamicConfig = {
|
|
|
100
100
|
base: { Component: Text },
|
|
101
101
|
file_input: { Component: FileInput },
|
|
102
102
|
date_input: { Component: DateInput },
|
|
103
|
+
color_picker: { Component: ColorPicker },
|
|
103
104
|
number_with_scale: { Component: NumberWithScale },
|
|
104
105
|
monaco_input: { Component: MonacoInput },
|
|
105
106
|
text_content: { Component: TextContent, independent: true },
|
|
@@ -211,6 +212,7 @@ export const dynamicViewConfig = {
|
|
|
211
212
|
select: { Component: BaseView },
|
|
212
213
|
base: { Component: BaseView },
|
|
213
214
|
date_input: { Component: DateView },
|
|
215
|
+
color_picker: { Component: ColorPickerView },
|
|
214
216
|
file_input: { Component: FileInputView },
|
|
215
217
|
number_with_scale: { Component: NumberWithScaleView },
|
|
216
218
|
monaco_input: { Component: MonacoView },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/dynamic-forms",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.17.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "build/cjs/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@gravity-ui/prettier-config": "^1.1.0",
|
|
61
61
|
"@gravity-ui/stylelint-config": "^4.0.1",
|
|
62
62
|
"@gravity-ui/tsconfig": "^1.0.0",
|
|
63
|
-
"@gravity-ui/uikit": "^7.
|
|
63
|
+
"@gravity-ui/uikit": "^7.41.0",
|
|
64
64
|
"@playwright/experimental-ct-react": "^1.40.0",
|
|
65
65
|
"@playwright/test": "^1.40.0",
|
|
66
66
|
"@storybook/addon-essentials": "^8.6.4",
|