@gravity-ui/dynamic-forms 5.0.0-beta.0 → 5.1.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 (81) hide show
  1. package/build/cjs/lib/core/components/Form/hooks/useSearch/useSearch.css +1 -1
  2. package/build/cjs/lib/kit/components/AccordeonCard/AccordeonCard.css +1 -1
  3. package/build/cjs/lib/kit/components/Card/Card.css +2 -2
  4. package/build/cjs/lib/kit/components/CopyButton/CopyButton.css +1 -1
  5. package/build/cjs/lib/kit/components/GroupIndent/GroupIndent.css +3 -3
  6. package/build/cjs/lib/kit/components/Inputs/ArrayBase/ArrayBase.css +2 -2
  7. package/build/cjs/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +8 -2
  8. package/build/cjs/lib/kit/components/Inputs/CheckboxGroup/CheckboxGroup.css +3 -3
  9. package/build/cjs/lib/kit/components/Inputs/FileInput/FileInput.css +1 -1
  10. package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoHeader.css +1 -1
  11. package/build/cjs/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.css +1 -1
  12. package/build/cjs/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.css +1 -1
  13. package/build/cjs/lib/kit/components/Inputs/NumberWithScale/NumberWithScale.css +1 -1
  14. package/build/cjs/lib/kit/components/Inputs/OneOf/OneOf.css +4 -4
  15. package/build/cjs/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +2 -2
  16. package/build/cjs/lib/kit/components/Inputs/TextContent/TextContent.js +1 -1
  17. package/build/cjs/lib/kit/components/Layouts/Accordeon/Accordeon.js +2 -1
  18. package/build/cjs/lib/kit/components/Layouts/Column/Column.css +4 -4
  19. package/build/cjs/lib/kit/components/Layouts/Row/Row.css +6 -6
  20. package/build/cjs/lib/kit/components/Layouts/Section/Section.css +2 -2
  21. package/build/cjs/lib/kit/components/Layouts/Section/Section.js +21 -2
  22. package/build/cjs/lib/kit/components/Layouts/Transparent/Transparent.css +2 -2
  23. package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +4 -4
  24. package/build/cjs/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +2 -2
  25. package/build/cjs/lib/kit/components/TogglerCard/TogglerCard.css +2 -2
  26. package/build/cjs/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -1
  27. package/build/cjs/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.css +1 -1
  28. package/build/cjs/lib/kit/components/ViewLayouts/ViewRow/ViewRow.css +1 -1
  29. package/build/cjs/lib/kit/components/ViewLayouts/ViewTableCell/ViewTableCell.css +1 -1
  30. package/build/cjs/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.css +1 -1
  31. package/build/cjs/lib/kit/components/Views/CardOneOfView.js +13 -3
  32. package/build/cjs/lib/kit/components/Views/CheckboxGroupView/CheckboxGroupView.css +2 -2
  33. package/build/cjs/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.css +1 -1
  34. package/build/cjs/lib/kit/components/Views/TableArrayView/TableArrayView.css +1 -1
  35. package/build/cjs/lib/kit/components/Views/TextAreaView/TextAreaView.css +1 -1
  36. package/build/cjs/lib/kit/hooks/useOneOf/useOneOf.css +1 -1
  37. package/build/cjs/lib/kit/utils/common.js +9 -8
  38. package/build/esm/lib/core/components/Form/hooks/useSearch/useSearch.css +1 -1
  39. package/build/esm/lib/core/components/View/types/layout.d.ts +1 -1
  40. package/build/esm/lib/core/components/View/types/views.d.ts +1 -1
  41. package/build/esm/lib/core/types/specs.d.ts +2 -1
  42. package/build/esm/lib/kit/components/AccordeonCard/AccordeonCard.css +1 -1
  43. package/build/esm/lib/kit/components/Card/Card.css +2 -2
  44. package/build/esm/lib/kit/components/CopyButton/CopyButton.css +1 -1
  45. package/build/esm/lib/kit/components/GroupIndent/GroupIndent.css +3 -3
  46. package/build/esm/lib/kit/components/Inputs/ArrayBase/ArrayBase.css +2 -2
  47. package/build/esm/lib/kit/components/Inputs/CardOneOf/CardOneOf.js +8 -2
  48. package/build/esm/lib/kit/components/Inputs/CheckboxGroup/CheckboxGroup.css +3 -3
  49. package/build/esm/lib/kit/components/Inputs/FileInput/FileInput.css +1 -1
  50. package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoHeader.css +1 -1
  51. package/build/esm/lib/kit/components/Inputs/MonacoInput/MonacoInputDialog.css +1 -1
  52. package/build/esm/lib/kit/components/Inputs/MultiOneOf/MultiOneOf.css +1 -1
  53. package/build/esm/lib/kit/components/Inputs/NumberWithScale/NumberWithScale.css +1 -1
  54. package/build/esm/lib/kit/components/Inputs/OneOf/OneOf.css +4 -4
  55. package/build/esm/lib/kit/components/Inputs/TableArrayInput/TableArrayInput.css +2 -2
  56. package/build/esm/lib/kit/components/Inputs/TextContent/TextContent.js +1 -1
  57. package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.d.ts +6 -1
  58. package/build/esm/lib/kit/components/Layouts/Accordeon/Accordeon.js +2 -1
  59. package/build/esm/lib/kit/components/Layouts/Column/Column.css +4 -4
  60. package/build/esm/lib/kit/components/Layouts/Row/Row.css +6 -6
  61. package/build/esm/lib/kit/components/Layouts/Section/Section.css +2 -2
  62. package/build/esm/lib/kit/components/Layouts/Section/Section.js +21 -2
  63. package/build/esm/lib/kit/components/Layouts/Transparent/Transparent.css +2 -2
  64. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.css +4 -4
  65. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.d.ts +2 -0
  66. package/build/esm/lib/kit/components/SimpleVerticalAccordeon/SimpleVerticalAccordeon.js +2 -2
  67. package/build/esm/lib/kit/components/TogglerCard/TogglerCard.css +2 -2
  68. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.d.ts +7 -2
  69. package/build/esm/lib/kit/components/ViewLayouts/ViewAccordeon/ViewAccordeon.js +2 -1
  70. package/build/esm/lib/kit/components/ViewLayouts/ViewColumn/ViewColumn.css +1 -1
  71. package/build/esm/lib/kit/components/ViewLayouts/ViewRow/ViewRow.css +1 -1
  72. package/build/esm/lib/kit/components/ViewLayouts/ViewTableCell/ViewTableCell.css +1 -1
  73. package/build/esm/lib/kit/components/Views/ArrayBaseView/ArrayBaseView.css +1 -1
  74. package/build/esm/lib/kit/components/Views/CardOneOfView.js +13 -3
  75. package/build/esm/lib/kit/components/Views/CheckboxGroupView/CheckboxGroupView.css +2 -2
  76. package/build/esm/lib/kit/components/Views/MonacoInputView/MonacoViewDialog.css +1 -1
  77. package/build/esm/lib/kit/components/Views/TableArrayView/TableArrayView.css +1 -1
  78. package/build/esm/lib/kit/components/Views/TextAreaView/TextAreaView.css +1 -1
  79. package/build/esm/lib/kit/hooks/useOneOf/useOneOf.css +1 -1
  80. package/build/esm/lib/kit/utils/common.js +9 -8
  81. package/package.json +4 -4
@@ -68,7 +68,7 @@
68
68
  text-overflow: ellipsis;
69
69
  }
70
70
  .df-view-row__right > .df-view-transparent {
71
- margin-bottom: var(--df-view-row-right-child-view-transparent-margin-bottom, 6px);
71
+ margin-bottom: var(--df-view-row-right-child-view-transparent-margin-bottom, var(--g-spacing-2));
72
72
  }
73
73
  .df-view-row__right > .df-view-transparent:last-child {
74
74
  margin-bottom: var(--df-spacing-last-child, var(--g-spacing-0));
@@ -49,7 +49,7 @@
49
49
  margin-bottom: var(--df-spacing-last-child, var(--g-spacing-0));
50
50
  }
51
51
  .df-view-table-cell__inner > .df-view-transparent {
52
- margin-bottom: var(--df-view-table-cell-inner-child-view-transparent-margin-bottom, 6px);
52
+ margin-bottom: var(--df-view-table-cell-inner-child-view-transparent-margin-bottom, var(--g-spacing-2));
53
53
  }
54
54
  .df-view-table-cell__inner > .df-view-transparent:last-child {
55
55
  margin-bottom: var(--df-spacing-last-child, var(--g-spacing-0));
@@ -18,5 +18,5 @@
18
18
  */
19
19
  /* Border-radius */
20
20
  .df-array-base-view__item-prefix {
21
- margin-bottom: var(--df-array-base-view-item-prefix-margin-bottom, 6px);
21
+ margin-bottom: var(--df-array-base-view-item-prefix-margin-bottom, var(--g-spacing-2));
22
22
  }
@@ -3,7 +3,7 @@ import isObjectLike from 'lodash/isObjectLike';
3
3
  import { Card, ViewRow } from '../';
4
4
  import { ViewController } from '../../../core';
5
5
  export const CardOneOfView = (props) => {
6
- const { value = {}, spec, name } = props;
6
+ const { value = {}, spec, name, Layout } = props;
7
7
  const [open, setOpen] = React.useState(true);
8
8
  const onToggle = React.useCallback(() => setOpen((f) => !f), [setOpen]);
9
9
  const specProperties = React.useMemo(() => (isObjectLike(spec.properties) ? spec.properties : {}), [spec.properties]);
@@ -14,8 +14,18 @@ export const CardOneOfView = (props) => {
14
14
  ((_b = specProperties[valueKey]) === null || _b === void 0 ? void 0 : _b.viewSpec.layoutTitle) ||
15
15
  valueKey);
16
16
  }, [valueKey, spec.description, specProperties]);
17
- const title = React.useMemo(() => (React.createElement(ViewRow, { spec: spec, value: valueName, name: name },
18
- React.createElement(React.Fragment, null, valueName))), [spec, name, valueName]);
17
+ const title = React.useMemo(() => {
18
+ const titleProps = {
19
+ spec: spec,
20
+ value: valueName,
21
+ name: name,
22
+ children: React.createElement(React.Fragment, null, valueName),
23
+ };
24
+ if (Layout) {
25
+ return React.createElement(Layout, Object.assign({}, titleProps));
26
+ }
27
+ return React.createElement(ViewRow, Object.assign({}, titleProps));
28
+ }, [spec, name, valueName, Layout]);
19
29
  if (!value || !Object.keys(value).length) {
20
30
  return null;
21
31
  }
@@ -21,14 +21,14 @@
21
21
  display: flex;
22
22
  }
23
23
  .df-checkbox-group-view > *:not(:last-child) {
24
- margin-right: var(--df-checkbox-group-view-child-margin-right, 6px);
24
+ margin-right: var(--df-checkbox-group-view-child-margin-right, var(--g-spacing-3));
25
25
  }
26
26
  .df-checkbox-group-view_vertical {
27
27
  flex-direction: column;
28
28
  align-items: flex-start;
29
29
  }
30
30
  .df-checkbox-group-view_vertical > *:not(:last-child) {
31
- margin: var(--df-checkbox-group-view-vertical-child-margin, var(--g-spacing-0) var(--g-spacing-0) 6px);
31
+ margin: var(--df-checkbox-group-view-vertical-child-margin, var(--g-spacing-0) var(--g-spacing-0) var(--g-spacing-2));
32
32
  }
33
33
  .df-checkbox-group-view__popover {
34
34
  padding: var(--g-spacing-2);
@@ -18,7 +18,7 @@
18
18
  */
19
19
  /* Border-radius */
20
20
  .df-monaco-view-dialog .g-dialog-footer {
21
- padding: var(--df-monaco-view-dialog-footer-padding, 10px var(--g-spacing-8) var(--g-spacing-8));
21
+ padding: var(--df-monaco-view-dialog-footer-padding, var(--g-spacing-4));
22
22
  }
23
23
  .df-monaco-view-dialog__container {
24
24
  border: 1px solid var(--g-color-line-generic);
@@ -18,7 +18,7 @@
18
18
  */
19
19
  /* Border-radius */
20
20
  .df-table-array-view__table {
21
- margin-bottom: var(--df-table-array-view-table-margin-bottom, 10px);
21
+ margin-bottom: var(--df-table-array-view-table-margin-bottom, var(--g-spacing-3));
22
22
  }
23
23
  .df-table-array-view__cell {
24
24
  max-width: var(--df-table-array-view-cell-min-width, 150px);
@@ -24,7 +24,7 @@
24
24
  cursor: pointer;
25
25
  }
26
26
  .df-text-area-view__chevron {
27
- margin: var(--df-text-area-view-chevron-margin, 3px);
27
+ margin: var(--df-text-area-view-chevron-margin, var(--g-spacing-half));
28
28
  }
29
29
  .df-text-area-view__chevron_open {
30
30
  transform: rotate(180deg);
@@ -23,7 +23,7 @@
23
23
  }
24
24
  .df-use-oneof__toggler_card + .df-group-indent > .df-use-search:not(.df-group-indent) {
25
25
  padding-top: var(--df-use-oneof-card-child-padding, var(--g-spacing-0));
26
- margin-top: var(--df-spacing-inputs, 15px);
26
+ margin-top: var(--df-spacing-inputs, var(--g-spacing-4));
27
27
  }
28
28
  .df-use-oneof__card {
29
29
  display: flex;
@@ -37,7 +37,7 @@ export const isNotEmptyValue = (value, spec) => {
37
37
  return true;
38
38
  };
39
39
  export const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) => {
40
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
41
41
  if (isObjectLike(spec)) {
42
42
  const result = cloneDeep(spec);
43
43
  if (isString(result.type)) {
@@ -49,7 +49,7 @@ export const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) =
49
49
  try {
50
50
  _defaultValue = JSON.parse(result.defaultValue);
51
51
  }
52
- catch (_l) {
52
+ catch (_m) {
53
53
  _defaultValue = undefined;
54
54
  }
55
55
  }
@@ -70,20 +70,21 @@ export const prepareSpec = (spec, parseJsonDefaultValue, overridePatternError) =
70
70
  if (isString((_c = result.viewSpec) === null || _c === void 0 ? void 0 : _c.addButtonPosition)) {
71
71
  result.viewSpec.addButtonPosition = result.viewSpec.addButtonPosition.toLowerCase();
72
72
  }
73
- if (isString((_d = result.viewSpec) === null || _d === void 0 ? void 0 : _d.themeLabel)) {
74
- result.viewSpec.textContentParams = Object.assign(Object.assign({}, result.viewSpec.textContentParams), { themeLabel: result.viewSpec.themeLabel.toLowerCase() });
75
- }
76
- if (isString((_f = (_e = result.viewSpec) === null || _e === void 0 ? void 0 : _e.oneOfParams) === null || _f === void 0 ? void 0 : _f.toggler)) {
73
+ if (isString((_e = (_d = result.viewSpec) === null || _d === void 0 ? void 0 : _d.oneOfParams) === null || _e === void 0 ? void 0 : _e.toggler)) {
77
74
  result.viewSpec.oneOfParams.toggler = result.viewSpec.oneOfParams.toggler.toLowerCase();
78
75
  }
79
- if (isString((_h = (_g = result.viewSpec) === null || _g === void 0 ? void 0 : _g.textContentParams) === null || _h === void 0 ? void 0 : _h.themeLabel)) {
76
+ if (isString((_g = (_f = result.viewSpec) === null || _f === void 0 ? void 0 : _f.textContentParams) === null || _g === void 0 ? void 0 : _g.themeLabel)) {
80
77
  result.viewSpec.textContentParams.themeLabel =
81
78
  result.viewSpec.textContentParams.themeLabel.toLowerCase();
82
79
  }
83
- if (isString((_k = (_j = result.viewSpec) === null || _j === void 0 ? void 0 : _j.textContentParams) === null || _k === void 0 ? void 0 : _k.themeAlert)) {
80
+ if (isString((_j = (_h = result.viewSpec) === null || _h === void 0 ? void 0 : _h.textContentParams) === null || _j === void 0 ? void 0 : _j.themeAlert)) {
84
81
  result.viewSpec.textContentParams.themeAlert =
85
82
  result.viewSpec.textContentParams.themeAlert.toLowerCase();
86
83
  }
84
+ if (isString((_l = (_k = result.viewSpec) === null || _k === void 0 ? void 0 : _k.textContentParams) === null || _l === void 0 ? void 0 : _l.viewAlert)) {
85
+ result.viewSpec.textContentParams.viewAlert =
86
+ result.viewSpec.textContentParams.viewAlert.toLowerCase();
87
+ }
87
88
  if (isString(result.validator)) {
88
89
  result.validator = result.validator.toLowerCase();
89
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dynamic-forms",
3
- "version": "5.0.0-beta.0",
3
+ "version": "5.1.0",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/cjs/index.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@bem-react/classname": "^1.6.0",
48
- "@gravity-ui/date-components": "^3.0.0-beta.0",
48
+ "@gravity-ui/date-components": "^3.0.0",
49
49
  "@gravity-ui/date-utils": "^2.5.5",
50
50
  "@gravity-ui/i18n": "^1.2.0",
51
51
  "@gravity-ui/icons": "^2.12.0",
@@ -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.0.0-beta.5",
63
+ "@gravity-ui/uikit": "^7.1.0",
64
64
  "@playwright/experimental-ct-react": "^1.40.0",
65
65
  "@playwright/test": "^1.40.0",
66
66
  "@storybook/addon-essentials": "^7.0.27",
@@ -114,7 +114,7 @@
114
114
  "uuid": "^9.0.1"
115
115
  },
116
116
  "peerDependencies": {
117
- "@gravity-ui/uikit": "^7.0.0-beta.5",
117
+ "@gravity-ui/uikit": "^7.0.0",
118
118
  "final-form": "^4.20.2",
119
119
  "react": "^16.0.0 || ^17.0.0 || ^18.0.0",
120
120
  "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0",