@gravity-ui/dynamic-forms 4.17.0 → 5.0.0-beta.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 (67) hide show
  1. package/build/cjs/lib/kit/components/Card/Card.css +4 -2
  2. package/build/cjs/lib/kit/components/Card/Card.js +4 -3
  3. package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -8
  4. package/build/cjs/lib/kit/components/Inputs/CheckboxGroup/CheckboxGroup.css +3 -0
  5. package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +4 -2
  6. package/build/cjs/lib/kit/components/Inputs/Text/Text.js +1 -2
  7. package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.js +2 -2
  8. package/build/cjs/lib/kit/components/Layouts/Accordeon/Accordeon.js +1 -2
  9. package/build/cjs/lib/kit/components/Layouts/Column/Column.js +7 -5
  10. package/build/cjs/lib/kit/components/Layouts/Row/Row.js +7 -5
  11. package/build/cjs/lib/kit/components/Layouts/Section/Section.css +4 -6
  12. package/build/cjs/lib/kit/components/Layouts/Section/Section.js +6 -24
  13. package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +3 -0
  14. package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +6 -5
  15. package/build/cjs/lib/kit/components/TogglerCard/TogglerCard.js +4 -2
  16. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +1 -2
  17. package/build/cjs/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.js +4 -2
  18. package/build/cjs/lib/kit/components/ViewLayouts/ViewRow/ViewRow.js +4 -2
  19. package/build/cjs/lib/kit/components/Views/CardOneOfView.js +3 -13
  20. package/build/cjs/lib/kit/components/Views/CheckboxGroupView/CheckboxGroupView.css +7 -5
  21. package/build/cjs/lib/kit/components/Views/CheckboxGroupView/CheckboxGroupView.js +4 -3
  22. package/build/cjs/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.css +7 -5
  23. package/build/cjs/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.js +3 -1
  24. package/build/cjs/lib/kit/components/Views/MultiSelectView/MultiSelectView.css +7 -5
  25. package/build/cjs/lib/kit/components/Views/MultiSelectView/MultiSelectView.js +3 -1
  26. package/build/cjs/lib/kit/components/Views/NumberWithScaleView/NumberWithScaleView.css +6 -4
  27. package/build/cjs/lib/kit/components/Views/NumberWithScaleView/NumberWithScaleView.js +2 -1
  28. package/build/cjs/lib/kit/components/Views/TableArrayView/TableArrayView.js +4 -2
  29. package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.js +1 -1
  30. package/build/cjs/lib/kit/utils/common.js +8 -9
  31. package/build/esm/lib/core/components/View/types/layout.d.ts +1 -1
  32. package/build/esm/lib/core/components/View/types/views.d.ts +1 -1
  33. package/build/esm/lib/core/types/specs.d.ts +1 -2
  34. package/build/esm/lib/kit/components/Card/Card.css +4 -2
  35. package/build/esm/lib/kit/components/Card/Card.js +5 -4
  36. package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +2 -8
  37. package/build/esm/lib/kit/components/Inputs/CheckboxGroup/CheckboxGroup.css +3 -0
  38. package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.js +5 -3
  39. package/build/esm/lib/kit/components/Inputs/Text/Text.js +2 -3
  40. package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.js +2 -2
  41. package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.d.ts +1 -6
  42. package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.js +1 -2
  43. package/build/esm/lib/kit/components/Layouts/Column/Column.js +5 -3
  44. package/build/esm/lib/kit/components/Layouts/Row/Row.js +5 -3
  45. package/build/esm/lib/kit/components/Layouts/Section/Section.css +4 -6
  46. package/build/esm/lib/kit/components/Layouts/Section/Section.js +7 -25
  47. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +3 -0
  48. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.d.ts +0 -2
  49. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +7 -6
  50. package/build/esm/lib/kit/components/TogglerCard/TogglerCard.js +5 -3
  51. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.d.ts +2 -7
  52. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +1 -2
  53. package/build/esm/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.js +5 -3
  54. package/build/esm/lib/kit/components/ViewLayouts/ViewRow/ViewRow.js +5 -3
  55. package/build/esm/lib/kit/components/Views/CardOneOfView.js +3 -13
  56. package/build/esm/lib/kit/components/Views/CheckboxGroupView/CheckboxGroupView.css +7 -5
  57. package/build/esm/lib/kit/components/Views/CheckboxGroupView/CheckboxGroupView.js +5 -4
  58. package/build/esm/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.css +7 -5
  59. package/build/esm/lib/kit/components/Views/MultiOneOfView/MultiOneOfView.js +4 -2
  60. package/build/esm/lib/kit/components/Views/MultiSelectView/MultiSelectView.css +7 -5
  61. package/build/esm/lib/kit/components/Views/MultiSelectView/MultiSelectView.js +4 -2
  62. package/build/esm/lib/kit/components/Views/NumberWithScaleView/NumberWithScaleView.css +6 -4
  63. package/build/esm/lib/kit/components/Views/NumberWithScaleView/NumberWithScaleView.js +2 -1
  64. package/build/esm/lib/kit/components/Views/TableArrayView/TableArrayView.js +5 -3
  65. package/build/esm/lib/kit/hooks/useOneOf/useOneOf.js +2 -2
  66. package/build/esm/lib/kit/utils/common.js +8 -9
  67. package/package.json +5 -6
@@ -20,14 +20,16 @@
20
20
  .df-number-with-scale-view {
21
21
  display: flex;
22
22
  }
23
- .df-number-with-scale-view__tooltip {
23
+ .df-number-with-scale-view__popover {
24
+ padding: var(--g-spacing-2);
24
25
  overflow-wrap: break-word;
26
+ max-width: 300px;
25
27
  }
26
- .df-number-with-scale-view__tooltip-container {
27
- white-space: nowrap;
28
+ .df-number-with-scale-view__item {
29
+ max-width: var(--df-popover-item-max-width, 100%);
28
30
  overflow: hidden;
29
31
  text-overflow: ellipsis;
30
- max-width: var(--df-tooltip-container-max-width, 100%);
32
+ display: block;
31
33
  }
32
34
  .df-number-with-scale-view__size {
33
35
  margin-left: var(--df-number-with-scale-view-size-margin-left, var(--g-spacing-half));
@@ -11,7 +11,8 @@ const NumberWithScaleViewBase = ({ spec, value }) => {
11
11
  const { initialValue, initialType } = (0, useInitial_1.useInitial)(value || '', spec, [value]);
12
12
  const { scale } = spec.viewSpec.sizeParams;
13
13
  return (react_1.default.createElement("div", { className: b() },
14
- react_1.default.createElement(uikit_1.Popover, { placement: ['bottom', 'top'], content: initialValue, className: b('tooltip-container'), contentClassName: b('tooltip'), disabled: initialValue.length < 26 }, initialValue),
14
+ react_1.default.createElement(uikit_1.Popover, { placement: ['bottom', 'top'], content: initialValue, className: b('popover'), disabled: initialValue.length < 26, hasArrow: true },
15
+ react_1.default.createElement(uikit_1.Text, { className: b('item') }, initialValue)),
15
16
  react_1.default.createElement(uikit_1.Text, { className: b('size') }, scale[initialType].title)));
16
17
  };
17
18
  const NumberWithScaleView = (props) => (0, utils_1.isCorrectSizeParams)(props.spec) && props.value ? react_1.default.createElement(NumberWithScaleViewBase, Object.assign({}, props)) : null;
@@ -6,7 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
7
  const core_1 = require("../../../../core");
8
8
  const utils_1 = require("../../../utils");
9
- const components_1 = require("@gravity-ui/components");
9
+ const common_1 = require("../../../constants/common");
10
10
  const b = (0, utils_1.block)('table-array-view');
11
11
  const TableArrayView = ({ value = [], spec, name }) => {
12
12
  const { showLayoutDescription } = (0, core_1.useDynamicFormsCtx)();
@@ -26,7 +26,9 @@ const TableArrayView = ({ value = [], spec, name }) => {
26
26
  name: description && showLayoutDescription
27
27
  ? () => (react_1.default.createElement(uikit_1.Flex, { gap: 0.5, alignItems: "center" },
28
28
  label,
29
- react_1.default.createElement(components_1.HelpPopover, { htmlContent: description, placement: ['bottom', 'top'] })))
29
+ react_1.default.createElement(uikit_1.HelpMark, { popoverProps: {
30
+ placement: common_1.COMMON_POPOVER_PLACEMENT,
31
+ } }, description)))
30
32
  : label,
31
33
  template: (_, idx) => {
32
34
  var _a;
@@ -99,7 +99,7 @@ const useOneOf = ({ props, onTogglerChange }) => {
99
99
  return (react_1.default.createElement("div", { className: b('checkbox') },
100
100
  react_1.default.createElement(uikit_1.Checkbox, { checked: checkboxValue, onUpdate: onCheckboxChange, disabled: spec.viewSpec.disabled, qa: name })));
101
101
  }
102
- return (react_1.default.createElement(uikit_1.RadioButton, { value: oneOfValue, onChange: (event) => onOneOfChange([event.target.value]), disabled: spec.viewSpec.disabled, qa: name }, options.map((option) => (react_1.default.createElement(uikit_1.RadioButton.Option, { key: option.value, value: option.value }, option.title)))));
102
+ return (react_1.default.createElement(uikit_1.SegmentedRadioGroup, { value: oneOfValue, onChange: (event) => onOneOfChange([event.target.value]), disabled: spec.viewSpec.disabled, qa: name }, options.map((option) => (react_1.default.createElement(uikit_1.SegmentedRadioGroup.Option, { key: option.value, value: option.value }, option.title)))));
103
103
  }, [
104
104
  togglerType,
105
105
  oneOfValue,
@@ -42,7 +42,7 @@ const isNotEmptyValue = (value, spec) => {
42
42
  };
43
43
  exports.isNotEmptyValue = isNotEmptyValue;
44
44
  const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) => {
45
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
45
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
46
46
  if ((0, isObjectLike_1.default)(spec)) {
47
47
  const result = (0, cloneDeep_1.default)(spec);
48
48
  if ((0, isString_1.default)(result.type)) {
@@ -54,7 +54,7 @@ const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) => {
54
54
  try {
55
55
  _defaultValue = JSON.parse(result.defaultValue);
56
56
  }
57
- catch (_m) {
57
+ catch (_l) {
58
58
  _defaultValue = undefined;
59
59
  }
60
60
  }
@@ -75,21 +75,20 @@ const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) => {
75
75
  if ((0, isString_1.default)((_c = result.viewSpec) === null || _c === void 0 ? void 0 : _c.addButtonPosition)) {
76
76
  result.viewSpec.addButtonPosition = result.viewSpec.addButtonPosition.toLowerCase();
77
77
  }
78
- if ((0, isString_1.default)((_e = (_d = result.viewSpec) === null || _d === void 0 ? void 0 : _d.oneOfParams) === null || _e === void 0 ? void 0 : _e.toggler)) {
78
+ if ((0, isString_1.default)((_d = result.viewSpec) === null || _d === void 0 ? void 0 : _d.themeLabel)) {
79
+ result.viewSpec.textContentParams = Object.assign(Object.assign({}, result.viewSpec.textContentParams), { themeLabel: result.viewSpec.themeLabel.toLowerCase() });
80
+ }
81
+ if ((0, isString_1.default)((_f = (_e = result.viewSpec) === null || _e === void 0 ? void 0 : _e.oneOfParams) === null || _f === void 0 ? void 0 : _f.toggler)) {
79
82
  result.viewSpec.oneOfParams.toggler = result.viewSpec.oneOfParams.toggler.toLowerCase();
80
83
  }
81
- if ((0, isString_1.default)((_g = (_f = result.viewSpec) === null || _f === void 0 ? void 0 : _f.textContentParams) === null || _g === void 0 ? void 0 : _g.themeLabel)) {
84
+ if ((0, isString_1.default)((_h = (_g = result.viewSpec) === null || _g === void 0 ? void 0 : _g.textContentParams) === null || _h === void 0 ? void 0 : _h.themeLabel)) {
82
85
  result.viewSpec.textContentParams.themeLabel =
83
86
  result.viewSpec.textContentParams.themeLabel.toLowerCase();
84
87
  }
85
- if ((0, isString_1.default)((_j = (_h = result.viewSpec) === null || _h === void 0 ? void 0 : _h.textContentParams) === null || _j === void 0 ? void 0 : _j.themeAlert)) {
88
+ if ((0, isString_1.default)((_k = (_j = result.viewSpec) === null || _j === void 0 ? void 0 : _j.textContentParams) === null || _k === void 0 ? void 0 : _k.themeAlert)) {
86
89
  result.viewSpec.textContentParams.themeAlert =
87
90
  result.viewSpec.textContentParams.themeAlert.toLowerCase();
88
91
  }
89
- if ((0, isString_1.default)((_l = (_k = result.viewSpec) === null || _k === void 0 ? void 0 : _k.textContentParams) === null || _l === void 0 ? void 0 : _l.viewAlert)) {
90
- result.viewSpec.textContentParams.viewAlert =
91
- result.viewSpec.textContentParams.viewAlert.toLowerCase();
92
- }
93
92
  if ((0, isString_1.default)(result.validator)) {
94
93
  result.validator = result.validator.toLowerCase();
95
94
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { FormValue, Spec } from '../../../';
3
3
  import { ViewProps } from './';
4
- export type ViewLayoutProps<Value extends FormValue, SpecType extends Spec<undefined, undefined, Record<string, any> | undefined> = Spec> = {
4
+ export type ViewLayoutProps<Value extends FormValue, SpecType extends Spec> = {
5
5
  children: React.ReactElement;
6
6
  } & ViewProps<Value, SpecType>;
7
7
  export type ViewLayoutType<Value extends FormValue, SpecType extends Spec> = (props: ViewLayoutProps<Value, SpecType>) => React.ReactElement | null;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { FormValue, Spec } from '../../../';
3
3
  import { ViewLayoutType } from './';
4
- export type ViewProps<Value extends FormValue, SpecType extends Spec<undefined, undefined, Record<string, any> | undefined> = Spec> = {
4
+ export type ViewProps<Value extends FormValue, SpecType extends Spec> = {
5
5
  spec: SpecType;
6
6
  name: string;
7
7
  value?: Value;
@@ -1,4 +1,4 @@
1
- import type { AlertProps, LabelProps } from '@gravity-ui/uikit';
1
+ import { AlertProps, LabelProps } from '@gravity-ui/uikit';
2
2
  import { ColorTextBaseProps } from '@gravity-ui/uikit/build/esm/components/Text/colorText/colorText';
3
3
  import { ReadAsMethod, SpecTypes } from '../constants';
4
4
  import { ArrayValue, ObjectValue } from './';
@@ -151,7 +151,6 @@ export interface StringSpec<LinkType = any, InputComponentProps extends Record<s
151
151
  iconColor?: ColorTextBaseProps['color'];
152
152
  titleAlert?: string;
153
153
  themeAlert?: AlertProps['theme'];
154
- viewAlert?: AlertProps['view'];
155
154
  };
156
155
  fileInput?: {
157
156
  accept?: string;
@@ -70,8 +70,10 @@
70
70
  max-width: var(--df-card-title-max-width, 533px);
71
71
  height: var(--df-card-title-height, var(--g-spacing-5));
72
72
  }
73
- .df-card__title-popover {
74
- height: var(--df-card-title-popover-height, var(--g-spacing-5));
73
+ .df-card__popover {
74
+ padding: var(--g-spacing-2);
75
+ overflow-wrap: break-word;
76
+ max-width: 300px;
75
77
  }
76
78
  .df-card__note {
77
79
  margin-left: var(--df-card-note-margin-left, 5px);
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { HelpPopover } from '@gravity-ui/components';
3
2
  import { ChevronDown } from '@gravity-ui/icons';
4
- import { Button, Card as CardBase, Icon, Popover, Text } from '@gravity-ui/uikit';
3
+ import { Button, Card as CardBase, HelpMark, Icon, Popover, Text } from '@gravity-ui/uikit';
5
4
  import isString from 'lodash/isString';
6
5
  import { COMMON_POPOVER_PLACEMENT, COMMON_TITLE_MAX_WIDTH } from '../../constants/common';
7
6
  import { block } from '../../utils';
@@ -34,10 +33,12 @@ export const Card = ({ name, title: propsTitle, description, actions, open: prop
34
33
  const title = React.useMemo(() => {
35
34
  if (isString(propsTitle)) {
36
35
  return (React.createElement(React.Fragment, null,
37
- React.createElement(Popover, { content: propsTitle, disabled: titlePopoverDisabled, placement: COMMON_POPOVER_PLACEMENT, className: b('title-popover') },
36
+ React.createElement(Popover, { content: propsTitle, disabled: titlePopoverDisabled, placement: COMMON_POPOVER_PLACEMENT, className: b('popover') },
38
37
  React.createElement(Text, { className: b('title'), ellipsis: true, ref: titleRef, variant: "subheader-2" }, propsTitle)),
39
38
  description ? (React.createElement("div", { className: b('note') },
40
- React.createElement(HelpPopover, { htmlContent: description, placement: COMMON_POPOVER_PLACEMENT }))) : null));
39
+ React.createElement(HelpMark, { popoverProps: {
40
+ placement: COMMON_POPOVER_PLACEMENT,
41
+ } }, description))) : null));
41
42
  }
42
43
  return propsTitle;
43
44
  }, [propsTitle, titlePopoverDisabled, description]);
@@ -7,7 +7,7 @@ import { Row } from '../../Layouts';
7
7
  import { RemoveButton } from '../../RemoveButton';
8
8
  export const CardOneOf = (props) => {
9
9
  var _a;
10
- const { input, meta, spec, name, Layout } = props;
10
+ const { input, meta, spec, name } = props;
11
11
  const [open, setOpen] = React.useState(true);
12
12
  const onToggle = React.useCallback(() => setOpen((f) => !f), [setOpen]);
13
13
  const onOpen = React.useCallback(() => setOpen(true), [setOpen]);
@@ -15,13 +15,7 @@ export const CardOneOf = (props) => {
15
15
  props,
16
16
  onTogglerChange: onOpen,
17
17
  });
18
- const toggler = React.useMemo(() => {
19
- const togglerProps = Object.assign(Object.assign({}, props), { name: '__stub-name', children: togglerInput });
20
- if (Layout) {
21
- return React.createElement(Layout, Object.assign({}, togglerProps));
22
- }
23
- return React.createElement(Row, Object.assign({}, togglerProps));
24
- }, [togglerInput, props, Layout]);
18
+ const toggler = React.useMemo(() => (React.createElement(Row, Object.assign({}, props, { name: "__stub-name" }), togglerInput)), [togglerInput, props]);
25
19
  const actions = React.useMemo(() => {
26
20
  if (isArrayItem(name)) {
27
21
  return React.createElement(RemoveButton, { onDrop: input.onDrop, name: name });
@@ -22,6 +22,9 @@
22
22
  align-items: center;
23
23
  height: var(--df-checkbox-height, 28px);
24
24
  }
25
+ .df-checkbox-group .g-control-label__text {
26
+ margin-inline-start: var(--df-checkbox-margint-start, 5px);
27
+ }
25
28
  .df-checkbox-group > *:not(:last-child) {
26
29
  margin-right: var(--df-checkbox-group-child-margin-right, 6px);
27
30
  }
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Plus, TrashBin } from '@gravity-ui/icons';
3
- import { Button, Flex, Icon, Table } from '@gravity-ui/uikit';
4
- import { HelpPopover } from '@gravity-ui/components';
3
+ import { Button, Flex, HelpMark, Icon, Table } from '@gravity-ui/uikit';
5
4
  import noop from 'lodash/noop';
6
5
  import set from 'lodash/set';
7
6
  import { Controller, OBJECT_ARRAY_CNT, OBJECT_ARRAY_FLAG, isArraySpec, isBooleanSpec, isObjectSpec, transformArrIn, } from '../../../../core';
8
7
  import { useSearchContext } from '../../../../core/components/Form/hooks';
9
8
  import { block } from '../../../utils';
9
+ import { COMMON_POPOVER_PLACEMENT } from '../../../constants/common';
10
10
  import './TableArrayInput.css';
11
11
  const b = block('table-array');
12
12
  export const TableArrayInput = ({ spec, name, arrayInput, input }) => {
@@ -49,7 +49,9 @@ export const TableArrayInput = ({ spec, name, arrayInput, input }) => {
49
49
  ? label
50
50
  : () => (React.createElement(Flex, { gap: 0.5, alignItems: "center" },
51
51
  label,
52
- React.createElement(HelpPopover, { htmlContent: description, placement: ['bottom', 'top'] }))),
52
+ React.createElement(HelpMark, { popoverProps: {
53
+ placement: COMMON_POPOVER_PLACEMENT,
54
+ } }, description))),
53
55
  template: ({ key, }, idx) => {
54
56
  var _a, _b, _c;
55
57
  const entitySpec = (_a = items === null || items === void 0 ? void 0 : items.properties) === null || _a === void 0 ? void 0 : _a[property];
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
- import { PasswordInput } from '@gravity-ui/components';
3
- import { TextInput } from '@gravity-ui/uikit';
2
+ import { PasswordInput, TextInput } from '@gravity-ui/uikit';
4
3
  import isNil from 'lodash/isNil';
5
4
  export const Text = ({ name, input: { value, onBlur, onChange, onFocus }, spec, inputProps, }) => {
6
5
  const props = Object.assign(Object.assign({ hasClear: true }, inputProps), { value: isNil(value) ? '' : `${value}`, onBlur: onBlur, onFocus: onFocus, onUpdate: onChange, disabled: spec.viewSpec.disabled, placeholder: spec.viewSpec.placeholder, qa: name });
7
6
  if (spec.viewSpec.type === 'password') {
8
- return (React.createElement(PasswordInput, Object.assign({}, props, { autoComplete: "new-password", showCopyButton: true, showRevealButton: true })));
7
+ return React.createElement(PasswordInput, Object.assign({}, props, { autoComplete: "new-password" }));
9
8
  }
10
9
  return React.createElement(TextInput, Object.assign({}, props, { type: "text" }));
11
10
  };
@@ -14,7 +14,7 @@ export const TextContentComponent = ({ spec, value, Layout, }) => {
14
14
  if (!text) {
15
15
  return null;
16
16
  }
17
- const iconLib = (textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.icon) ? (React.createElement(LazyLoader, { component: loadIcon(textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.icon) })) : null;
17
+ const iconLib = (textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.icon) ? (React.createElement(LazyLoader, { component: loadIcon(textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.icon) })) : undefined;
18
18
  let content = React.createElement("span", { dangerouslySetInnerHTML: { __html: text } });
19
19
  if (textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.themeAlert) {
20
20
  const titleAlert = (textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.titleAlert) || !isEmpty(textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.titleAlert)
@@ -22,7 +22,7 @@ export const TextContentComponent = ({ spec, value, Layout, }) => {
22
22
  : undefined;
23
23
  content = (React.createElement(Alert, { icon: iconLib, message: content,
24
24
  // If the title is an empty line, then you need to explicitly write undefined, otherwise there will be an additional indent
25
- title: titleAlert, theme: textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.themeAlert, view: textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.viewAlert }));
25
+ title: titleAlert, theme: textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.themeAlert }));
26
26
  }
27
27
  else if (textContentParams === null || textContentParams === void 0 ? void 0 : textContentParams.themeLabel) {
28
28
  content = (React.createElement(Label, { size: "m", theme: textContentParams.themeLabel, className: b(), value: value, icon: iconLib }, content));
@@ -1,7 +1,2 @@
1
- import { TextProps } from '@gravity-ui/uikit';
2
1
  import { ArrayLayoutProps, ObjectLayoutProps } from '../../../../core';
3
- interface AccordeonLayoutProps {
4
- variantTitle?: TextProps['variant'];
5
- }
6
- export declare const Accordeon: <T extends ArrayLayoutProps<Record<string, any> | undefined, AccordeonLayoutProps | undefined> | ObjectLayoutProps<Record<string, any> | undefined, AccordeonLayoutProps | undefined>>({ name, spec, input, meta, children, }: T) => JSX.Element;
7
- export {};
2
+ export declare const Accordeon: <T extends ArrayLayoutProps<undefined, undefined> | ObjectLayoutProps<undefined, undefined>>({ name, spec, input, meta, children, }: T) => JSX.Element;
@@ -6,7 +6,6 @@ import { RemoveButton } from '../../RemoveButton';
6
6
  import { SimpleVerticalAccordeon } from '../../SimpleVerticalAccordeon';
7
7
  export const Accordeon = ({ name, spec, input, meta, children, }) => {
8
8
  var _a;
9
- const { variantTitle } = spec.viewSpec.layoutProps || {};
10
9
  const [open, setOpen] = React.useState(Boolean((_a = spec.viewSpec) === null || _a === void 0 ? void 0 : _a.layoutOpen));
11
10
  const onDrop = React.useCallback(() => {
12
11
  setOpen(false);
@@ -19,6 +18,6 @@ export const Accordeon = ({ name, spec, input, meta, children, }) => {
19
18
  return React.createElement(RemoveButton, { name: name, onDrop: onDrop });
20
19
  }, [spec.required, input.value, onDrop, name]);
21
20
  useErrorChecker({ name, meta, open, setOpen });
22
- return (React.createElement(SimpleVerticalAccordeon, { name: name, title: spec.viewSpec.layoutTitle || '', note: spec.viewSpec.layoutDescription || '', open: open, onOpenChange: setOpen, headerActionsTemplate: removeButton, hideInsteadOfDestroy: true, withBranchView: true, variantTitle: variantTitle },
21
+ return (React.createElement(SimpleVerticalAccordeon, { name: name, title: spec.viewSpec.layoutTitle || '', note: spec.viewSpec.layoutDescription || '', open: open, onOpenChange: setOpen, headerActionsTemplate: removeButton, hideInsteadOfDestroy: true, withBranchView: true },
23
22
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles: true }, children)));
24
23
  };
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { HelpPopover } from '@gravity-ui/components';
3
2
  import { TrashBin } from '@gravity-ui/icons';
4
- import { Button, Icon, Text } from '@gravity-ui/uikit';
3
+ import { Button, HelpMark, Icon, Text } from '@gravity-ui/uikit';
5
4
  import { isArrayItem, isArraySpec, isObjectSpec, withGenerateButton, } from '../../../../core';
6
5
  import { ErrorWrapper, GenerateRandomValueButton } from '../../../components';
7
6
  import { block } from '../../../utils';
7
+ import { COMMON_POPOVER_PLACEMENT } from '../../../constants/common';
8
8
  import './Column.css';
9
9
  const b = block('column');
10
10
  const ColumnBase = ({ name, spec, input, meta, children, }) => {
@@ -16,7 +16,9 @@ const ColumnBase = ({ name, spec, input, meta, children, }) => {
16
16
  React.createElement(Text, { className: b('title', { required: spec.required }) }, spec.viewSpec.layoutTitle),
17
17
  spec.viewSpec.layoutDescription ? (React.createElement("span", { className: b('note') },
18
18
  React.createElement(Text, { className: b('note-inner') },
19
- React.createElement(HelpPopover, { htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })))) : null)),
19
+ React.createElement(HelpMark, { popoverProps: {
20
+ placement: COMMON_POPOVER_PLACEMENT,
21
+ } }, spec.viewSpec.layoutDescription)))) : null)),
20
22
  React.createElement("div", { className: b('second-row') },
21
23
  React.createElement("div", { className: b('second-row-inner') },
22
24
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles:
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
- import { HelpPopover } from '@gravity-ui/components';
3
2
  import { TrashBin } from '@gravity-ui/icons';
4
- import { Button, Icon, Text } from '@gravity-ui/uikit';
3
+ import { Button, HelpMark, Icon, Text } from '@gravity-ui/uikit';
5
4
  import { isArrayItem, isArraySpec, isObjectSpec, withGenerateButton, } from '../../../../core';
6
5
  import { ErrorWrapper, GenerateRandomValueButton } from '../../../components';
7
6
  import { block } from '../../../utils';
7
+ import { COMMON_POPOVER_PLACEMENT } from '../../../constants/common';
8
8
  import './Row.css';
9
9
  const b = block('row');
10
10
  const RowBase = ({ name, spec, input, meta, verboseDescription, children, }) => {
@@ -16,7 +16,9 @@ const RowBase = ({ name, spec, input, meta, verboseDescription, children, }) =>
16
16
  React.createElement(Text, { className: b('title', { required: spec.required }) }, spec.viewSpec.layoutTitle),
17
17
  !verboseDescription && spec.viewSpec.layoutDescription ? (React.createElement("span", { className: b('note') },
18
18
  React.createElement(Text, { className: b('note-inner') },
19
- React.createElement(HelpPopover, { htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })))) : null)),
19
+ React.createElement(HelpMark, { popoverProps: {
20
+ placement: COMMON_POPOVER_PLACEMENT,
21
+ } }, spec.viewSpec.layoutDescription)))) : null)),
20
22
  React.createElement("div", { className: b('right') },
21
23
  React.createElement("div", { className: b('right-inner') },
22
24
  React.createElement(ErrorWrapper, { name: name, meta: meta, withoutChildErrorStyles:
@@ -37,12 +37,10 @@
37
37
  .df-section__title {
38
38
  max-width: var(--df-section-title-max-width, 533px);
39
39
  }
40
- .df-section__title-popover {
41
- display: flex;
42
- align-items: center;
43
- }
44
- .df-section__title-popover .g-popover__handler {
45
- display: flex;
40
+ .df-section__popover {
41
+ padding: var(--g-spacing-2);
42
+ overflow-wrap: break-word;
43
+ max-width: 300px;
46
44
  }
47
45
  .df-section__note {
48
46
  margin-left: var(--df-section-note-margin-left, 5px);
@@ -1,7 +1,6 @@
1
1
  import { __rest } from "tslib";
2
2
  import React from 'react';
3
- import { HelpPopover } from '@gravity-ui/components';
4
- import { Popover, Text } from '@gravity-ui/uikit';
3
+ import { HelpMark, Popover, Text } from '@gravity-ui/uikit';
5
4
  import { GroupIndent } from '../../';
6
5
  import { RemoveButton } from '../../RemoveButton';
7
6
  import { COMMON_POPOVER_PLACEMENT, COMMON_TITLE_MAX_WIDTH, ErrorWrapper } from '../../../';
@@ -17,25 +16,6 @@ const SectionBase = (_a) => {
17
16
  const arrOrObjFlag = isArraySpec(spec) || isObjectSpec(spec);
18
17
  const titleRef = React.useRef(null);
19
18
  let content = children;
20
- const { variantTitle: variantTitleProp } = spec.viewSpec.layoutProps || {};
21
- const { sizeTitle, variantTitle } = React.useMemo(() => {
22
- if (variantTitleProp) {
23
- return {
24
- sizeTitle: undefined,
25
- variantTitle: variantTitleProp,
26
- };
27
- }
28
- if (titleSize === 'm') {
29
- return {
30
- sizeTitle: titleSize,
31
- variantTitle: 'body-2',
32
- };
33
- }
34
- return {
35
- sizeTitle: titleSize,
36
- variantTitle: 'body-1',
37
- };
38
- }, [variantTitleProp, titleSize]);
39
19
  const removeButton = React.useMemo(() => {
40
20
  if ((input === null || input === void 0 ? void 0 : input.value) && (input === null || input === void 0 ? void 0 : input.onDrop) && isArrayItem(name)) {
41
21
  return (React.createElement(RemoveButton, { name: name, onDrop: input.onDrop, switcherClassName: b('remove-button') }));
@@ -57,7 +37,9 @@ const SectionBase = (_a) => {
57
37
  }
58
38
  else {
59
39
  description = (React.createElement(Text, { className: b('note') },
60
- React.createElement(HelpPopover, { htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })));
40
+ React.createElement(HelpMark, { popoverProps: {
41
+ placement: COMMON_POPOVER_PLACEMENT,
42
+ } }, spec.viewSpec.layoutDescription)));
61
43
  }
62
44
  }
63
45
  const layoutTitle = spec.viewSpec.layoutTitle;
@@ -65,10 +47,10 @@ const SectionBase = (_a) => {
65
47
  return (React.createElement("section", { className: b() },
66
48
  layoutTitle ? (React.createElement("div", { className: b('header', {
67
49
  'with-popover': !descriptionAsSubtitle,
68
- size: sizeTitle,
50
+ size: titleSize,
69
51
  }) },
70
- React.createElement(Popover, { className: b('title-popover'), content: layoutTitle, placement: COMMON_POPOVER_PLACEMENT, disabled: layoutTitlePopoverDisabled },
71
- React.createElement(Text, { className: b('title'), variant: variantTitle, ref: titleRef, ellipsis: true }, layoutTitle)),
52
+ React.createElement(Popover, { className: b('popover'), content: layoutTitle, placement: COMMON_POPOVER_PLACEMENT, disabled: layoutTitlePopoverDisabled },
53
+ React.createElement(Text, { className: b('title'), variant: titleSize === 'm' ? 'body-2' : 'body-1', ref: titleRef, ellipsis: true }, layoutTitle)),
72
54
  description,
73
55
  removeButton)) : null,
74
56
  React.createElement("div", { className: b('content') }, content)));
@@ -42,6 +42,9 @@
42
42
  .df-simple-vertical-accordeon__tooltip {
43
43
  margin: var(--df-simple-vertical-accordeon-tooltip-margin, var(--g-spacing-0) 5px);
44
44
  }
45
+ .df-simple-vertical-accordeon__popover {
46
+ padding: var(--g-spacing-2);
47
+ }
45
48
  .df-simple-vertical-accordeon__chevron {
46
49
  transform: rotate(-90deg);
47
50
  }
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { TextProps } from '@gravity-ui/uikit';
3
2
  import './SimpleVerticalAccordeon.css';
4
3
  interface SimpleVerticalAccordeonProps {
5
4
  children: React.ReactNode;
@@ -17,7 +16,6 @@ interface SimpleVerticalAccordeonProps {
17
16
  hideInsteadOfDestroy?: boolean;
18
17
  withBranchView?: boolean;
19
18
  viewLayout?: boolean;
20
- variantTitle?: TextProps['variant'];
21
19
  }
22
20
  interface SimpleVerticalAccordeonState {
23
21
  open: boolean;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
- import { HelpPopover } from '@gravity-ui/components';
3
2
  import { ChevronDown } from '@gravity-ui/icons';
4
- import { Button, Icon, Popover, Text } from '@gravity-ui/uikit';
3
+ import { Button, HelpMark, Icon, Popover, Text } from '@gravity-ui/uikit';
5
4
  import { COMMON_POPOVER_PLACEMENT } from '../../constants/common';
6
5
  import { block } from '../../utils';
7
6
  import './SimpleVerticalAccordeon.css';
@@ -49,7 +48,7 @@ export class SimpleVerticalAccordeon extends React.Component {
49
48
  }
50
49
  render() {
51
50
  var _a;
52
- const { children, headerActionsTemplate, className, contentClassName, buttonClassName, hideInsteadOfDestroy, withBranchView, viewLayout, name, variantTitle, } = this.props;
51
+ const { children, headerActionsTemplate, className, contentClassName, buttonClassName, hideInsteadOfDestroy, withBranchView, viewLayout, name, } = this.props;
53
52
  const { open, hidden, isFirstRender } = this.state;
54
53
  const content = hideInsteadOfDestroy ? (React.createElement("div", { ref: this.componentRef, className: b('body', { hidden: !open }) }, children)) : (open && (React.createElement("div", { ref: this.componentRef, className: b('body', contentClassName) }, children)));
55
54
  if (viewLayout && !isFirstRender && hidden) {
@@ -57,10 +56,10 @@ export class SimpleVerticalAccordeon extends React.Component {
57
56
  }
58
57
  const title = this.getTitle();
59
58
  const titlePopoverDisabled = (((_a = this.titleRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0) <= TITLE_TEXT_MAX_WIDTH;
60
- const currentTitleVariant = variantTitle || this.getCurrentTitleVariant();
59
+ const currentTitleVariant = this.getCurrentTitleVariant();
61
60
  return (Boolean(React.Children.count(children)) && (React.createElement("div", { className: b({ branch: withBranchView, view: viewLayout }, className) },
62
61
  React.createElement("div", { className: b('header') },
63
- React.createElement(Popover, { content: title, disabled: titlePopoverDisabled, placement: COMMON_POPOVER_PLACEMENT },
62
+ React.createElement(Popover, { content: title, disabled: titlePopoverDisabled, placement: COMMON_POPOVER_PLACEMENT, className: b('popover'), hasArrow: true },
64
63
  React.createElement(Button, { view: "flat", className: b('header-inner', buttonClassName), onClick: this.handleClick, qa: `${name}-accordeon-toggler`, width: "auto" },
65
64
  React.createElement(Text, { variant: currentTitleVariant }, title),
66
65
  React.createElement(Icon, { data: ChevronDown, className: b('chevron', { open }), size: 16 }))),
@@ -88,7 +87,9 @@ export class SimpleVerticalAccordeon extends React.Component {
88
87
  getTooltip() {
89
88
  const { note } = this.props;
90
89
  return note ? (React.createElement(Text, { className: b('tooltip') },
91
- React.createElement(HelpPopover, { htmlContent: note, placement: ['bottom', 'top'] }))) : null;
90
+ React.createElement(HelpMark, { popoverProps: {
91
+ placement: COMMON_POPOVER_PLACEMENT,
92
+ } }, note))) : null;
92
93
  }
93
94
  }
94
95
  SimpleVerticalAccordeon.defaultProps = {
@@ -1,13 +1,15 @@
1
1
  import React from 'react';
2
- import { HelpPopover } from '@gravity-ui/components';
3
- import { Card, Text } from '@gravity-ui/uikit';
2
+ import { Card, HelpMark, Text } from '@gravity-ui/uikit';
4
3
  import { block } from '../../utils';
4
+ import { COMMON_POPOVER_PLACEMENT } from '../../constants/common';
5
5
  import './TogglerCard.css';
6
6
  const b = block('toggler-card');
7
7
  export const TogglerCard = ({ description, title, text, onClick, disabled, selected, }) => {
8
8
  return (React.createElement(Card, { onClick: onClick, type: "selection", disabled: disabled ? !selected : disabled, selected: selected, size: "m", className: b() },
9
9
  React.createElement("div", { className: b('header') },
10
10
  React.createElement(Text, { variant: "subheader-2", ellipsis: true }, title),
11
- description ? (React.createElement(HelpPopover, { htmlContent: description, placement: ['bottom', 'top'] })) : null),
11
+ description ? (React.createElement(HelpMark, { popoverProps: {
12
+ placement: COMMON_POPOVER_PLACEMENT,
13
+ } }, description)) : null),
12
14
  React.createElement(Text, { variant: "body-1", color: "secondary", className: b('text') }, text)));
13
15
  };
@@ -1,7 +1,2 @@
1
- import { TextProps } from '@gravity-ui/uikit';
2
- import { ArrayValue, ObjectValue, Spec, ViewLayoutProps } from '../../../../core';
3
- interface ViewAccordeonLayoutProps {
4
- variantTitle?: TextProps['variant'];
5
- }
6
- export declare const ViewAccordeon: <T extends ViewLayoutProps<ArrayValue | ObjectValue, Spec<any, any, ViewAccordeonLayoutProps>>>({ name, value, spec, children, }: T) => JSX.Element | null;
7
- export {};
1
+ import { ArrayViewLayoutProps, ObjectViewLayoutProps } from '../../../../core';
2
+ export declare const ViewAccordeon: <T extends ArrayViewLayoutProps | ObjectViewLayoutProps>({ name, value, spec, children, }: T) => JSX.Element | null;
@@ -6,11 +6,10 @@ import { SimpleVerticalAccordeon } from '../../SimpleVerticalAccordeon';
6
6
  export const ViewAccordeon = ({ name, value, spec, children, }) => {
7
7
  const { showLayoutDescription } = useDynamicFormsCtx();
8
8
  const [open, setOpen] = React.useState(isBoolean(spec.viewSpec.layoutOpen) ? spec.viewSpec.layoutOpen : true);
9
- const { variantTitle } = spec.viewSpec.layoutProps || {};
10
9
  if (!isNotEmptyValue(value, spec)) {
11
10
  return null;
12
11
  }
13
12
  return (React.createElement(SimpleVerticalAccordeon, { name: name, title: spec.viewSpec.layoutTitle || '', note: showLayoutDescription && spec.viewSpec.layoutDescription
14
13
  ? spec.viewSpec.layoutDescription
15
- : undefined, open: open, onOpenChange: setOpen, hideInsteadOfDestroy: true, withBranchView: true, viewLayout: true, variantTitle: variantTitle }, children));
14
+ : undefined, open: open, onOpenChange: setOpen, hideInsteadOfDestroy: true, withBranchView: true, viewLayout: true }, children));
16
15
  };
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { Text } from '@gravity-ui/uikit';
3
- import { HelpPopover } from '@gravity-ui/components';
2
+ import { HelpMark, Text } from '@gravity-ui/uikit';
4
3
  import { useDynamicFormsCtx } from '../../../../core';
5
4
  import { CopyButton } from '../../../../kit';
6
5
  import { block, isNotEmptyValue } from '../../../utils';
6
+ import { COMMON_POPOVER_PLACEMENT } from '../../../constants/common';
7
7
  import './ViewColumn.css';
8
8
  const b = block('view-column');
9
9
  export const ViewColumn = ({ value, spec, children, }) => {
@@ -14,7 +14,9 @@ export const ViewColumn = ({ value, spec, children, }) => {
14
14
  return (React.createElement("div", { className: b() },
15
15
  React.createElement("div", { className: b('first-row') },
16
16
  React.createElement(Text, { color: "secondary", ellipsis: true }, spec.viewSpec.layoutTitle),
17
- showLayoutDescription && spec.viewSpec.layoutDescription ? (React.createElement(HelpPopover, { className: b('note'), htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })) : null),
17
+ showLayoutDescription && spec.viewSpec.layoutDescription ? (React.createElement(HelpMark, { className: b('note'), popoverProps: {
18
+ placement: COMMON_POPOVER_PLACEMENT,
19
+ } }, spec.viewSpec.layoutDescription)) : null),
18
20
  React.createElement("div", { className: b('second-row') }, children),
19
21
  React.createElement(CopyButton, { spec: spec, value: value })));
20
22
  };
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { Text } from '@gravity-ui/uikit';
3
- import { HelpPopover } from '@gravity-ui/components';
2
+ import { HelpMark, Text } from '@gravity-ui/uikit';
4
3
  import { useDynamicFormsCtx } from '../../../../core';
5
4
  import { CopyButton } from '../../../../kit';
6
5
  import { block, isNotEmptyValue } from '../../../utils';
6
+ import { COMMON_POPOVER_PLACEMENT } from '../../../constants/common';
7
7
  import './ViewRow.css';
8
8
  const b = block('view-row');
9
9
  export const ViewRow = ({ value, spec, children, }) => {
@@ -14,7 +14,9 @@ export const ViewRow = ({ value, spec, children, }) => {
14
14
  return (React.createElement("div", { className: b() },
15
15
  React.createElement("div", { className: b('left') },
16
16
  React.createElement(Text, { whiteSpace: "nowrap", color: "secondary", ellipsis: true }, spec.viewSpec.layoutTitle),
17
- showLayoutDescription && spec.viewSpec.layoutDescription ? (React.createElement(HelpPopover, { className: b('note'), htmlContent: spec.viewSpec.layoutDescription, placement: ['bottom', 'top'] })) : null,
17
+ showLayoutDescription && spec.viewSpec.layoutDescription ? (React.createElement(HelpMark, { className: b('note'), popoverProps: {
18
+ placement: COMMON_POPOVER_PLACEMENT,
19
+ } }, spec.viewSpec.layoutDescription)) : null,
18
20
  React.createElement("div", { className: b('dots') })),
19
21
  React.createElement("div", { className: b('right') }, children),
20
22
  React.createElement(CopyButton, { spec: spec, value: value })));