Skip to content

Commit d270cfa

Browse files
authored
Merge branch 'main' into hide-storybook-actions
2 parents 3b3799a + ac75f76 commit d270cfa

File tree

33 files changed

+212
-7
lines changed

33 files changed

+212
-7
lines changed

.github/workflows/pr-playwright-report.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@ jobs:
1616
uses: actions/download-artifact@v4
1717
with:
1818
github-token: ${{ secrets.GRAVITY_UI_BOT_GITHUB_TOKEN }}
19-
run_id: ${{ github.event.workflow_run.id }}
19+
run-id: ${{ github.event.workflow_run.id }}
2020
- name: Extract PR Number
2121
id: pr
2222
run: echo "::set-output name=id::$(<pr/pr-id.txt)"
2323
shell: bash
24+
- name: Install AWS CLI
25+
uses: unfor19/install-aws-cli-action@v1
26+
with:
27+
version: 2.22.35
28+
arch: amd64
2429
- name: Upload to S3
2530
env:
2631
AWS_ACCESS_KEY_ID: ${{ secrets.STORYBOOK_S3_KEY_ID }}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## [4.16.0](https://github.com/gravity-ui/dynamic-forms/compare/v4.15.0...v4.16.0) (2025-01-22)
4+
5+
6+
### Features
7+
8+
* added new view text content alert ([#265](https://github.com/gravity-ui/dynamic-forms/issues/265)) ([2c19763](https://github.com/gravity-ui/dynamic-forms/commit/2c197632e6b5d718f94ddf7e652f6352bc5e9a6f))
9+
* css api ([#254](https://github.com/gravity-ui/dynamic-forms/issues/254)) ([c5608e7](https://github.com/gravity-ui/dynamic-forms/commit/c5608e7eee86f61348dacd79e2c13665ef054b22))
10+
11+
12+
### Bug Fixes
13+
14+
* playwright ci ([#263](https://github.com/gravity-ui/dynamic-forms/issues/263)) ([a47ec49](https://github.com/gravity-ui/dynamic-forms/commit/a47ec49cfe982ae38b5d878bd1ab40312f4c8d56))
15+
* upload s3 playwright tests ([#259](https://github.com/gravity-ui/dynamic-forms/issues/259)) ([33b8173](https://github.com/gravity-ui/dynamic-forms/commit/33b8173cf38f0c72d68bfb294cbe9831c3ae7d7b))
16+
317
## [4.15.0](https://github.com/gravity-ui/dynamic-forms/compare/v4.14.3...v4.15.0) (2024-12-12)
418

519

README-ru.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# @gravity-ui/dynamic-forms &middot; [![npm package](https://img.shields.io/npm/v/@gravity-ui/dynamic-forms)](https://www.npmjs.com/package/@gravity-ui/dynamic-forms) [![CI](https://img.shields.io/github/actions/workflow/status/gravity-ui/dynamic-forms/.github/workflows/ci.yml?label=CI&logo=github)](https://github.com/gravity-ui/dynamic-forms/actions/workflows/ci.yml?query=branch:main) [![storybook](https://img.shields.io/badge/Storybook-deployed-ff4685)](https://preview.gravity-ui.com/dynamic-forms/)
2+
3+
Библиотека для рендеринга форм и их значений на основе `JSON Schema`.
4+
5+
## Установка
6+
7+
```shell
8+
npm install --save-dev @gravity-ui/dynamic-forms
9+
```
10+
11+
## Использование
12+
13+
```jsx
14+
import {DynamicField, Spec, dynamicConfig} from '@gravity-ui/dynamic-forms';
15+
16+
// To embed in a final-form
17+
<DynamicField name={name} spec={spec} config={config} />;
18+
19+
import {DynamicView, dynamicViewConfig} from '@gravity-ui/dynamic-forms';
20+
21+
// To get an overview of the values
22+
<DynamicView value={value} spec={spec} config={dynamicViewConfig} />;
23+
```
24+
25+
### I18N
26+
27+
Некоторые компоненты содержат текстовые токены, доступные на двух языках: `en` (по умолчанию) и `ru`. Для настройки языка используйте функцию `configure`:
28+
29+
```js
30+
// index.js
31+
32+
import {configure, Lang} from '@gravity-ui/dynamic-forms';
33+
34+
configure({lang: Lang.Ru});
35+
```
36+
37+
## Разработка
38+
39+
Для запуска Storybook в режиме разработки выполните следующую команду:
40+
41+
```shell
42+
npm ci
43+
npm run dev
44+
```

docs/spec.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ You can provide all props of [original component](https://preview.gravity-ui.com
182182
| text | `string` | yes | Text for input |
183183
| icon | `string` | | Icon name from the [library](https://gravity-ui.com/icons) |
184184
| iconColor | `'primary'` `'complementary'` `'secondary'` `'hint'` `'info'` `'info-heavy'` `'positive'` `'positive-heavy'` `'warning'` `'warning-heavy'` `'danger'` `'danger-heavy'` `'utility'` `'utility-heavy'` `'misc'` `'misc-heavy'` `'brand'` `'dark-primary'` `'dark-complementary'` `'dark-secondary'` | | The color of the icon, if it does not have the themeLabel parameter |
185+
| themeIcon | `'normal'` `'info'` `'success'` `'warning'` `'danger'` `'utility'` | | Alert color |
186+
| titleAlert | `string` | | Alert title |
185187

186188
#### SelectParams
187189

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gravity-ui/dynamic-forms",
3-
"version": "4.15.0",
3+
"version": "4.16.0",
44
"description": "",
55
"license": "MIT",
66
"main": "build/cjs/index.js",

src/lib/core/types/specs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {LabelProps} from '@gravity-ui/uikit';
1+
import {AlertProps, LabelProps} from '@gravity-ui/uikit';
22
import {ColorTextBaseProps} from '@gravity-ui/uikit/build/esm/components/Text/colorText/colorText';
33

44
import {ReadAsMethod, SpecTypes} from '../constants';
@@ -173,6 +173,8 @@ export interface StringSpec<
173173
text: string;
174174
icon?: string;
175175
iconColor?: ColorTextBaseProps['color'];
176+
titleAlert?: string;
177+
themeAlert?: AlertProps['theme'];
176178
};
177179
fileInput?: {
178180
accept?: string;

src/lib/kit/components/Inputs/TextContent/TextContent.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react';
22

3-
import {Label, Text} from '@gravity-ui/uikit';
3+
import {isEmpty} from 'lodash';
4+
5+
import {Alert, Label, Text} from '@gravity-ui/uikit';
46
import cloneDeep from 'lodash/cloneDeep';
57

68
import {StringIndependentInput, StringSpec} from '../../../../core';
@@ -41,7 +43,22 @@ export const TextContentComponent: React.FC<TextContentComponentProps> = ({
4143

4244
let content = <span dangerouslySetInnerHTML={{__html: text}} />;
4345

44-
if (textContentParams?.themeLabel) {
46+
if (textContentParams?.themeAlert) {
47+
const titleAlert =
48+
textContentParams?.titleAlert || !isEmpty(textContentParams?.titleAlert)
49+
? textContentParams.titleAlert
50+
: undefined;
51+
52+
content = (
53+
<Alert
54+
icon={iconLib}
55+
message={content}
56+
// If the title is an empty line, then you need to explicitly write undefined, otherwise there will be an additional indent
57+
title={titleAlert}
58+
theme={textContentParams?.themeAlert}
59+
/>
60+
);
61+
} else if (textContentParams?.themeLabel) {
4562
content = (
4663
<Label
4764
size="m"
Loading
Loading

0 commit comments

Comments
 (0)