@gravity-ui/page-constructor 2.18.0 → 3.0.0-alpha.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/CHANGELOG.md +0 -19
- package/build/cjs/blocks/index.d.ts +0 -4
- package/build/cjs/blocks/index.js +1 -9
- package/build/cjs/blocks/validators.d.ts +0 -4
- package/build/cjs/blocks/validators.js +0 -4
- package/build/cjs/components/Anchor/Anchor.d.ts +2 -2
- package/build/cjs/components/Anchor/Anchor.js +1 -1
- package/build/cjs/components/Anchor/__tests__/Anchor.test.d.ts +1 -0
- package/build/cjs/components/Anchor/__tests__/Anchor.test.js +21 -0
- package/build/cjs/components/AnimateBlock/__tests__/AnimateBlock.test.d.ts +1 -0
- package/build/cjs/components/AnimateBlock/__tests__/AnimateBlock.test.js +36 -0
- package/build/cjs/components/Author/__tests__/Author.test.d.ts +1 -0
- package/build/cjs/components/Author/__tests__/Author.test.js +49 -0
- package/build/cjs/components/BackLink/__tests__/BackLink.test.d.ts +1 -0
- package/build/cjs/components/BackLink/__tests__/BackLink.test.js +63 -0
- package/build/cjs/components/BlockBase/__tests__/BlockBase.test.d.ts +1 -0
- package/build/cjs/components/BlockBase/__tests__/BlockBase.test.js +44 -0
- package/build/cjs/components/Button/__tests__/Button.test.d.ts +1 -0
- package/build/cjs/components/Button/__tests__/Button.test.js +91 -0
- package/build/cjs/components/ButtonTabs/__tests__/ButtonTabs.test.d.ts +1 -0
- package/build/cjs/components/ButtonTabs/__tests__/ButtonTabs.test.js +58 -0
- package/build/cjs/components/index.d.ts +0 -1
- package/build/cjs/components/index.js +1 -3
- package/build/cjs/constructor-items.d.ts +0 -16
- package/build/cjs/constructor-items.js +0 -16
- package/build/cjs/grid/Col/Col.d.ts +1 -1
- package/build/cjs/hooks/index.d.ts +1 -1
- package/build/cjs/hooks/index.js +3 -3
- package/build/cjs/internal-typings/global.d.ts +16 -18
- package/build/cjs/models/constructor-items/blocks.d.ts +2 -50
- package/build/cjs/models/constructor-items/blocks.js +0 -4
- package/build/cjs/models/constructor-items/common.d.ts +0 -14
- package/build/cjs/models/constructor-items/common.js +1 -6
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -46
- package/build/cjs/models/constructor-items/sub-blocks.js +2 -11
- package/build/cjs/schema/index.js +2 -8
- package/build/cjs/schema/validators/blocks.d.ts +0 -4
- package/build/cjs/schema/validators/blocks.js +0 -4
- package/build/cjs/schema/validators/sub-blocks.d.ts +0 -3
- package/build/cjs/schema/validators/sub-blocks.js +0 -3
- package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -2
- package/build/cjs/sub-blocks/HubspotForm/HubspotFormContainer.js +2 -5
- package/build/cjs/sub-blocks/HubspotForm/index.d.ts +1 -1
- package/build/cjs/sub-blocks/HubspotForm/index.js +5 -6
- package/build/cjs/sub-blocks/index.d.ts +0 -3
- package/build/cjs/sub-blocks/index.js +1 -7
- package/build/cjs/text-transform/{blocks.d.ts → common.d.ts} +1 -4
- package/build/cjs/text-transform/common.js +31 -0
- package/build/cjs/text-transform/config.d.ts +28 -0
- package/build/cjs/text-transform/config.js +291 -0
- package/build/cjs/text-transform/index.d.ts +3 -1
- package/build/cjs/text-transform/index.js +3 -1
- package/build/cjs/text-transform/transformers.d.ts +16 -0
- package/build/cjs/text-transform/transformers.js +61 -0
- package/build/cjs/utils/index.d.ts +0 -1
- package/build/cjs/utils/index.js +0 -1
- package/build/esm/blocks/index.d.ts +0 -4
- package/build/esm/blocks/index.js +0 -4
- package/build/esm/blocks/validators.d.ts +0 -4
- package/build/esm/blocks/validators.js +0 -4
- package/build/esm/components/Anchor/Anchor.d.ts +2 -2
- package/build/esm/components/Anchor/Anchor.js +1 -1
- package/build/esm/components/Anchor/__tests__/Anchor.test.d.ts +1 -0
- package/build/esm/components/Anchor/__tests__/Anchor.test.js +18 -0
- package/build/esm/components/AnimateBlock/__tests__/AnimateBlock.test.d.ts +1 -0
- package/build/esm/components/AnimateBlock/__tests__/AnimateBlock.test.js +33 -0
- package/build/esm/components/Author/__tests__/Author.test.d.ts +1 -0
- package/build/esm/components/Author/__tests__/Author.test.js +46 -0
- package/build/esm/components/BackLink/__tests__/BackLink.test.d.ts +1 -0
- package/build/esm/components/BackLink/__tests__/BackLink.test.js +60 -0
- package/build/esm/components/BlockBase/__tests__/BlockBase.test.d.ts +1 -0
- package/build/esm/components/BlockBase/__tests__/BlockBase.test.js +41 -0
- package/build/esm/components/Button/__tests__/Button.test.d.ts +1 -0
- package/build/esm/components/Button/__tests__/Button.test.js +88 -0
- package/build/esm/components/ButtonTabs/__tests__/ButtonTabs.test.d.ts +1 -0
- package/build/esm/components/ButtonTabs/__tests__/ButtonTabs.test.js +55 -0
- package/build/esm/components/index.d.ts +0 -1
- package/build/esm/components/index.js +0 -1
- package/build/esm/constructor-items.d.ts +0 -16
- package/build/esm/constructor-items.js +2 -18
- package/build/esm/grid/Col/Col.d.ts +1 -1
- package/build/esm/hooks/index.d.ts +1 -1
- package/build/esm/hooks/index.js +1 -1
- package/build/esm/internal-typings/global.d.ts +16 -18
- package/build/esm/models/constructor-items/blocks.d.ts +2 -50
- package/build/esm/models/constructor-items/blocks.js +0 -4
- package/build/esm/models/constructor-items/common.d.ts +0 -14
- package/build/esm/models/constructor-items/common.js +0 -5
- package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -46
- package/build/esm/models/constructor-items/sub-blocks.js +2 -11
- package/build/esm/schema/index.js +4 -10
- package/build/esm/schema/validators/blocks.d.ts +0 -4
- package/build/esm/schema/validators/blocks.js +0 -4
- package/build/esm/schema/validators/sub-blocks.d.ts +0 -3
- package/build/esm/schema/validators/sub-blocks.js +0 -3
- package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.d.ts +1 -2
- package/build/esm/sub-blocks/HubspotForm/HubspotFormContainer.js +3 -6
- package/build/esm/sub-blocks/HubspotForm/index.d.ts +1 -1
- package/build/esm/sub-blocks/HubspotForm/index.js +6 -7
- package/build/esm/sub-blocks/index.d.ts +0 -3
- package/build/esm/sub-blocks/index.js +0 -3
- package/build/esm/text-transform/{blocks.d.ts → common.d.ts} +1 -4
- package/build/esm/text-transform/common.js +25 -0
- package/build/esm/text-transform/config.d.ts +28 -0
- package/build/esm/text-transform/{blocks.js → config.js} +15 -123
- package/build/esm/text-transform/index.d.ts +3 -1
- package/build/esm/text-transform/index.js +3 -1
- package/build/esm/text-transform/transformers.d.ts +16 -0
- package/build/esm/text-transform/transformers.js +56 -0
- package/build/esm/utils/index.d.ts +0 -1
- package/build/esm/utils/index.js +0 -1
- package/package.json +4 -1
- package/server/models/constructor-items/blocks.d.ts +2 -50
- package/server/models/constructor-items/blocks.js +0 -4
- package/server/models/constructor-items/common.d.ts +0 -14
- package/server/models/constructor-items/common.js +1 -6
- package/server/models/constructor-items/sub-blocks.d.ts +5 -46
- package/server/models/constructor-items/sub-blocks.js +2 -11
- package/server/text-transform/{blocks.d.ts → common.d.ts} +1 -4
- package/server/text-transform/common.js +31 -0
- package/server/text-transform/config.d.ts +28 -0
- package/server/text-transform/config.js +301 -0
- package/server/text-transform/index.d.ts +3 -1
- package/server/text-transform/index.js +3 -1
- package/server/text-transform/transformers.d.ts +16 -0
- package/server/text-transform/transformers.js +63 -0
- package/server/utils/index.d.ts +0 -1
- package/server/utils/index.js +0 -1
- package/build/cjs/blocks/LinkTable/LinkTable.css +0 -3
- package/build/cjs/blocks/LinkTable/LinkTable.d.ts +0 -3
- package/build/cjs/blocks/LinkTable/LinkTable.js +0 -22
- package/build/cjs/blocks/LinkTable/schema.d.ts +0 -77
- package/build/cjs/blocks/LinkTable/schema.js +0 -15
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.css +0 -50
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.d.ts +0 -13
- package/build/cjs/blocks/Preview/MediaContent/MediaContent.js +0 -49
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.css +0 -106
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.d.ts +0 -11
- package/build/cjs/blocks/Preview/MediaContent/PreviewContent.js +0 -17
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.css +0 -54
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.d.ts +0 -9
- package/build/cjs/blocks/Preview/MediaContent/PreviewMedia.js +0 -13
- package/build/cjs/blocks/Preview/Preview.css +0 -50
- package/build/cjs/blocks/Preview/Preview.d.ts +0 -3
- package/build/cjs/blocks/Preview/Preview.js +0 -130
- package/build/cjs/blocks/Preview/schema.d.ts +0 -40
- package/build/cjs/blocks/Preview/schema.js +0 -53
- package/build/cjs/blocks/Security/Security.css +0 -142
- package/build/cjs/blocks/Security/Security.d.ts +0 -3
- package/build/cjs/blocks/Security/Security.js +0 -29
- package/build/cjs/blocks/Security/schema.d.ts +0 -170
- package/build/cjs/blocks/Security/schema.js +0 -32
- package/build/cjs/blocks/Simple/Simple.css +0 -22
- package/build/cjs/blocks/Simple/Simple.d.ts +0 -3
- package/build/cjs/blocks/Simple/Simple.js +0 -22
- package/build/cjs/blocks/Simple/schema.d.ts +0 -68
- package/build/cjs/blocks/Simple/schema.js +0 -14
- package/build/cjs/components/HeightCalculator/HeightCalculator.css +0 -9
- package/build/cjs/components/HeightCalculator/HeightCalculator.d.ts +0 -10
- package/build/cjs/components/HeightCalculator/HeightCalculator.js +0 -44
- package/build/cjs/context/breakpointContext/breakpointContext.d.ts +0 -2
- package/build/cjs/context/breakpointContext/breakpointContext.js +0 -7
- package/build/cjs/context/breakpointContext/index.d.ts +0 -1
- package/build/cjs/context/breakpointContext/index.js +0 -4
- package/build/cjs/hooks/useIntersection.d.ts +0 -1
- package/build/cjs/hooks/useIntersection.js +0 -21
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.css +0 -19
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.d.ts +0 -3
- package/build/cjs/sub-blocks/CardWithImage/CardWithImage.js +0 -16
- package/build/cjs/sub-blocks/CardWithImage/schema.d.ts +0 -154
- package/build/cjs/sub-blocks/CardWithImage/schema.js +0 -46
- package/build/cjs/sub-blocks/Partner/Partner.css +0 -8
- package/build/cjs/sub-blocks/Partner/Partner.d.ts +0 -3
- package/build/cjs/sub-blocks/Partner/Partner.js +0 -15
- package/build/cjs/sub-blocks/Partner/schema.d.ts +0 -30
- package/build/cjs/sub-blocks/Partner/schema.js +0 -17
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.css +0 -20
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.d.ts +0 -3
- package/build/cjs/sub-blocks/TutorialCard/TutorialCard.js +0 -23
- package/build/cjs/sub-blocks/TutorialCard/schema.d.ts +0 -34
- package/build/cjs/sub-blocks/TutorialCard/schema.js +0 -20
- package/build/cjs/text-transform/blocks.js +0 -404
- package/build/cjs/utils/scroll.d.ts +0 -15
- package/build/cjs/utils/scroll.js +0 -35
- package/build/esm/blocks/LinkTable/LinkTable.css +0 -3
- package/build/esm/blocks/LinkTable/LinkTable.d.ts +0 -4
- package/build/esm/blocks/LinkTable/LinkTable.js +0 -21
- package/build/esm/blocks/LinkTable/schema.d.ts +0 -77
- package/build/esm/blocks/LinkTable/schema.js +0 -12
- package/build/esm/blocks/Preview/MediaContent/MediaContent.css +0 -50
- package/build/esm/blocks/Preview/MediaContent/MediaContent.d.ts +0 -14
- package/build/esm/blocks/Preview/MediaContent/MediaContent.js +0 -47
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.css +0 -106
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.d.ts +0 -12
- package/build/esm/blocks/Preview/MediaContent/PreviewContent.js +0 -15
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.css +0 -54
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.d.ts +0 -10
- package/build/esm/blocks/Preview/MediaContent/PreviewMedia.js +0 -11
- package/build/esm/blocks/Preview/Preview.css +0 -50
- package/build/esm/blocks/Preview/Preview.d.ts +0 -4
- package/build/esm/blocks/Preview/Preview.js +0 -126
- package/build/esm/blocks/Preview/schema.d.ts +0 -40
- package/build/esm/blocks/Preview/schema.js +0 -50
- package/build/esm/blocks/Security/Security.css +0 -142
- package/build/esm/blocks/Security/Security.d.ts +0 -4
- package/build/esm/blocks/Security/Security.js +0 -25
- package/build/esm/blocks/Security/schema.d.ts +0 -170
- package/build/esm/blocks/Security/schema.js +0 -28
- package/build/esm/blocks/Simple/Simple.css +0 -22
- package/build/esm/blocks/Simple/Simple.d.ts +0 -4
- package/build/esm/blocks/Simple/Simple.js +0 -18
- package/build/esm/blocks/Simple/schema.d.ts +0 -68
- package/build/esm/blocks/Simple/schema.js +0 -11
- package/build/esm/components/HeightCalculator/HeightCalculator.css +0 -9
- package/build/esm/components/HeightCalculator/HeightCalculator.d.ts +0 -11
- package/build/esm/components/HeightCalculator/HeightCalculator.js +0 -42
- package/build/esm/context/breakpointContext/breakpointContext.d.ts +0 -2
- package/build/esm/context/breakpointContext/breakpointContext.js +0 -3
- package/build/esm/context/breakpointContext/index.d.ts +0 -1
- package/build/esm/context/breakpointContext/index.js +0 -1
- package/build/esm/hooks/useIntersection.d.ts +0 -1
- package/build/esm/hooks/useIntersection.js +0 -17
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.css +0 -19
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.d.ts +0 -4
- package/build/esm/sub-blocks/CardWithImage/CardWithImage.js +0 -14
- package/build/esm/sub-blocks/CardWithImage/schema.d.ts +0 -154
- package/build/esm/sub-blocks/CardWithImage/schema.js +0 -43
- package/build/esm/sub-blocks/Partner/Partner.css +0 -8
- package/build/esm/sub-blocks/Partner/Partner.d.ts +0 -4
- package/build/esm/sub-blocks/Partner/Partner.js +0 -13
- package/build/esm/sub-blocks/Partner/schema.d.ts +0 -30
- package/build/esm/sub-blocks/Partner/schema.js +0 -14
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.css +0 -20
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.d.ts +0 -4
- package/build/esm/sub-blocks/TutorialCard/TutorialCard.js +0 -21
- package/build/esm/sub-blocks/TutorialCard/schema.d.ts +0 -34
- package/build/esm/sub-blocks/TutorialCard/schema.js +0 -17
- package/build/esm/utils/scroll.d.ts +0 -15
- package/build/esm/utils/scroll.js +0 -31
- package/server/text-transform/blocks.js +0 -417
- package/server/utils/scroll.d.ts +0 -15
- package/server/utils/scroll.js +0 -35
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { AuthorType } from '../../../models';
|
|
4
|
+
import Author from '../Author';
|
|
5
|
+
const testId = 'author';
|
|
6
|
+
const author = {
|
|
7
|
+
firstName: 'John',
|
|
8
|
+
secondName: 'Doe',
|
|
9
|
+
description: 'Web designer',
|
|
10
|
+
avatar: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-gray.png',
|
|
11
|
+
};
|
|
12
|
+
describe('Author', () => {
|
|
13
|
+
test('Render author by default', async () => {
|
|
14
|
+
render(React.createElement(Author, { author: author, dataQa: testId }));
|
|
15
|
+
const object = screen.getByTestId(testId);
|
|
16
|
+
expect(object).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
test('Has full name', async () => {
|
|
19
|
+
const name = `${author.firstName} ${author.secondName}`;
|
|
20
|
+
render(React.createElement(Author, { author: author, dataQa: testId }));
|
|
21
|
+
const object = screen.getByText(name);
|
|
22
|
+
expect(object).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
test('Has first name only', async () => {
|
|
25
|
+
const name = author.firstName;
|
|
26
|
+
render(React.createElement(Author, { author: Object.assign(Object.assign({}, author), { secondName: '' }), dataQa: testId }));
|
|
27
|
+
const object = screen.getByText(name);
|
|
28
|
+
expect(object).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
test('Has avatar', async () => {
|
|
31
|
+
render(React.createElement(Author, { author: author, dataQa: testId }));
|
|
32
|
+
const avatar = screen.getByRole('img');
|
|
33
|
+
expect(avatar).toBeInTheDocument();
|
|
34
|
+
expect(avatar).toHaveAttribute('src', author.avatar);
|
|
35
|
+
});
|
|
36
|
+
test('Has description', async () => {
|
|
37
|
+
render(React.createElement(Author, { author: author, dataQa: testId }));
|
|
38
|
+
const object = screen.getByText(author.description);
|
|
39
|
+
expect(object).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
test.each(new Array(AuthorType.Column, AuthorType.Line))('Render with given "%s" type', (type) => {
|
|
42
|
+
render(React.createElement(Author, { author: author, dataQa: testId, type: type }));
|
|
43
|
+
const object = screen.getByTestId(testId);
|
|
44
|
+
expect(object).toHaveClass(`pc-author_type_${type}`);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import { LocationContext } from '../../../context/locationContext';
|
|
5
|
+
import BackLink from '../BackLink';
|
|
6
|
+
const backLinkProps = {
|
|
7
|
+
url: '#',
|
|
8
|
+
title: 'Button Title',
|
|
9
|
+
theme: 'default',
|
|
10
|
+
size: 's',
|
|
11
|
+
className: 'customClassName',
|
|
12
|
+
shouldHandleBackAction: true,
|
|
13
|
+
onClick: () => { },
|
|
14
|
+
};
|
|
15
|
+
describe('BackLink', () => {
|
|
16
|
+
test('Default render', async () => {
|
|
17
|
+
render(React.createElement(BackLink, Object.assign({}, backLinkProps)));
|
|
18
|
+
const backLink = screen.getByRole('button');
|
|
19
|
+
expect(backLink).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
test('Has custom class', async () => {
|
|
22
|
+
render(React.createElement(BackLink, Object.assign({}, backLinkProps)));
|
|
23
|
+
const backLink = screen.getByRole('button');
|
|
24
|
+
expect(backLink).toHaveClass(backLinkProps.className);
|
|
25
|
+
});
|
|
26
|
+
test('Should render <a /> tag', async () => {
|
|
27
|
+
render(React.createElement(BackLink, Object.assign({}, backLinkProps, { shouldHandleBackAction: false })));
|
|
28
|
+
const backLink = screen.getByRole('link');
|
|
29
|
+
expect(backLink).toBeVisible();
|
|
30
|
+
expect(backLink).toHaveAttribute('href', backLinkProps.url);
|
|
31
|
+
});
|
|
32
|
+
test('Should render title', async () => {
|
|
33
|
+
render(React.createElement(BackLink, Object.assign({}, backLinkProps)));
|
|
34
|
+
const backLink = screen.getByText(backLinkProps.title);
|
|
35
|
+
expect(backLink).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
test('Call onClick', async () => {
|
|
38
|
+
const user = userEvent.setup();
|
|
39
|
+
const handleClick = jest.fn();
|
|
40
|
+
render(React.createElement(LocationContext.Provider, { value: { history: { push: jest.fn() } } },
|
|
41
|
+
React.createElement(BackLink, Object.assign({}, backLinkProps, { onClick: handleClick }))));
|
|
42
|
+
const backLink = screen.getByRole('button');
|
|
43
|
+
await user.click(backLink);
|
|
44
|
+
expect(handleClick).toHaveBeenCalledTimes(1);
|
|
45
|
+
});
|
|
46
|
+
test.each(new Array('s', 'm', 'l', 'xl'))('Render with given "%s" size', (size) => {
|
|
47
|
+
render(React.createElement(BackLink, Object.assign({}, backLinkProps, { size: size })));
|
|
48
|
+
const backLink = screen.getByRole('button');
|
|
49
|
+
expect(backLink).toHaveClass(`yc-button_size_${size}`);
|
|
50
|
+
});
|
|
51
|
+
test.each(new Array('default', 'special'))('Render with given "%s" theme', (theme) => {
|
|
52
|
+
const matchView = {
|
|
53
|
+
default: 'flat-secondary',
|
|
54
|
+
special: 'flat-contrast',
|
|
55
|
+
};
|
|
56
|
+
render(React.createElement(BackLink, Object.assign({}, backLinkProps, { theme: theme })));
|
|
57
|
+
const backLink = screen.getByRole('button');
|
|
58
|
+
expect(backLink).toHaveClass(`yc-button_view_${matchView[theme]}`);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { qaIdByDefault } from '../../../components/Anchor/Anchor';
|
|
4
|
+
import { GridColumnSize } from '../../../grid';
|
|
5
|
+
import BlockBase from '../BlockBase';
|
|
6
|
+
const qaId = 'block-base-component';
|
|
7
|
+
describe('BlockBase', () => {
|
|
8
|
+
test('render component by default', async () => {
|
|
9
|
+
render(React.createElement(BlockBase, { qa: qaId }));
|
|
10
|
+
const component = screen.getByTestId(qaId);
|
|
11
|
+
expect(component).toBeInTheDocument();
|
|
12
|
+
expect(component).toBeVisible();
|
|
13
|
+
expect(component).not.toBeDisabled();
|
|
14
|
+
});
|
|
15
|
+
test('add className', () => {
|
|
16
|
+
const className = 'my-class';
|
|
17
|
+
render(React.createElement(BlockBase, { qa: qaId, className: className }));
|
|
18
|
+
const component = screen.getByTestId(qaId);
|
|
19
|
+
expect(component).toHaveClass(className);
|
|
20
|
+
});
|
|
21
|
+
test('should reset paddings', () => {
|
|
22
|
+
render(React.createElement(BlockBase, { qa: qaId, resetPaddings: true }));
|
|
23
|
+
const component = screen.getByTestId(qaId);
|
|
24
|
+
expect(component).toHaveClass('pc-block-base_reset-paddings');
|
|
25
|
+
});
|
|
26
|
+
test.each(new Array(...Object.values(GridColumnSize)))('render with given "%s" size', (size) => {
|
|
27
|
+
render(React.createElement(BlockBase, { qa: qaId, visible: size }));
|
|
28
|
+
const component = screen.getByTestId(qaId);
|
|
29
|
+
expect(component).toHaveClass(`d-${size}-block`);
|
|
30
|
+
});
|
|
31
|
+
test('should have anchor', () => {
|
|
32
|
+
const anchor = {
|
|
33
|
+
text: 'anchor',
|
|
34
|
+
url: 'https://github.com/gravity-ui/',
|
|
35
|
+
};
|
|
36
|
+
render(React.createElement(BlockBase, { anchor: anchor }));
|
|
37
|
+
const component = screen.getByTestId(qaIdByDefault);
|
|
38
|
+
expect(component).toBeInTheDocument();
|
|
39
|
+
expect(component).toHaveAttribute('id', anchor.url);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import Button from '../Button';
|
|
5
|
+
import { ICON_QA } from '../utils';
|
|
6
|
+
const qaId = 'button-component';
|
|
7
|
+
const buttonProps = {
|
|
8
|
+
text: 'Button Text',
|
|
9
|
+
url: 'https://github.com/gravity-ui/',
|
|
10
|
+
target: '_blank',
|
|
11
|
+
img: {
|
|
12
|
+
url: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/icon_1_light.svg',
|
|
13
|
+
position: 'left',
|
|
14
|
+
alt: 'alt-text',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const buttonViews = [
|
|
18
|
+
'normal',
|
|
19
|
+
'action',
|
|
20
|
+
'outlined',
|
|
21
|
+
'outlined-info',
|
|
22
|
+
'outlined-danger',
|
|
23
|
+
'raised',
|
|
24
|
+
'flat',
|
|
25
|
+
'flat-info',
|
|
26
|
+
'flat-danger',
|
|
27
|
+
'flat-secondary',
|
|
28
|
+
'normal-contrast',
|
|
29
|
+
'outlined-contrast',
|
|
30
|
+
'flat-contrast',
|
|
31
|
+
'github',
|
|
32
|
+
'scale',
|
|
33
|
+
'monochrome',
|
|
34
|
+
];
|
|
35
|
+
describe('Button', () => {
|
|
36
|
+
test('render button by default', async () => {
|
|
37
|
+
render(React.createElement(Button, { text: buttonProps.text }));
|
|
38
|
+
const button = screen.getByRole('button');
|
|
39
|
+
expect(button).toBeInTheDocument();
|
|
40
|
+
expect(button).toBeVisible();
|
|
41
|
+
expect(button).not.toBeDisabled();
|
|
42
|
+
});
|
|
43
|
+
test('should render <a /> tag', async () => {
|
|
44
|
+
render(React.createElement(Button, { text: buttonProps.text, url: buttonProps.url, target: buttonProps.target }));
|
|
45
|
+
const button = screen.getByRole('link');
|
|
46
|
+
expect(button).toBeVisible();
|
|
47
|
+
expect(button).toHaveAttribute('href', buttonProps.url);
|
|
48
|
+
expect(button).toHaveAttribute('target', buttonProps.target);
|
|
49
|
+
});
|
|
50
|
+
test('call onClick', async () => {
|
|
51
|
+
const user = userEvent.setup();
|
|
52
|
+
const handleOnClick = jest.fn();
|
|
53
|
+
render(React.createElement(Button, { text: buttonProps.text, onClick: handleOnClick }));
|
|
54
|
+
const button = screen.getByRole('button');
|
|
55
|
+
await user.click(button);
|
|
56
|
+
expect(handleOnClick).toHaveBeenCalledTimes(1);
|
|
57
|
+
});
|
|
58
|
+
test.each(new Array('s', 'm', 'l', 'xl'))('render with given "%s" size', (size) => {
|
|
59
|
+
render(React.createElement(Button, { text: buttonProps.text, size: size, qa: qaId }));
|
|
60
|
+
const button = screen.getByTestId(qaId);
|
|
61
|
+
expect(button).toHaveClass(`pc-button-block_size_${size}`);
|
|
62
|
+
});
|
|
63
|
+
test.each(new Array(...buttonViews))('render with given "%s" view', (theme) => {
|
|
64
|
+
render(React.createElement(Button, { text: buttonProps.text, theme: theme, qa: qaId }));
|
|
65
|
+
const button = screen.getByTestId(qaId);
|
|
66
|
+
expect(button).toHaveClass(`pc-button-block_theme_${theme}`);
|
|
67
|
+
});
|
|
68
|
+
test('add className', () => {
|
|
69
|
+
const className = 'my-class';
|
|
70
|
+
render(React.createElement(Button, { text: buttonProps.text, className: className, qa: qaId }));
|
|
71
|
+
const button = screen.getByTestId(qaId);
|
|
72
|
+
expect(button).toHaveClass(className);
|
|
73
|
+
});
|
|
74
|
+
test('should render icon', () => {
|
|
75
|
+
render(React.createElement(Button, { text: buttonProps.text, img: buttonProps.img }));
|
|
76
|
+
const button = screen.getByRole('button');
|
|
77
|
+
const iconComponent = screen.getByRole('img');
|
|
78
|
+
expect(iconComponent).toBeVisible();
|
|
79
|
+
expect(button).toContainElement(iconComponent);
|
|
80
|
+
});
|
|
81
|
+
test('should render github icon', () => {
|
|
82
|
+
render(React.createElement(Button, { text: buttonProps.text, img: buttonProps.img, theme: "github" }));
|
|
83
|
+
const button = screen.getByRole('button');
|
|
84
|
+
const iconComponent = screen.getByTestId(ICON_QA);
|
|
85
|
+
expect(iconComponent).toBeVisible();
|
|
86
|
+
expect(button).toContainElement(iconComponent);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import userEvent from '@testing-library/user-event';
|
|
4
|
+
import ButtonTabs from '../ButtonTabs';
|
|
5
|
+
const qaId = 'button-tabs-component';
|
|
6
|
+
const items = [
|
|
7
|
+
{
|
|
8
|
+
id: '0',
|
|
9
|
+
title: 'tab-1',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: '1',
|
|
13
|
+
title: 'tab-2',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: '2',
|
|
17
|
+
title: 'tab-3',
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
describe('ButtonTabs', () => {
|
|
21
|
+
test('render ButtonTabs by default', async () => {
|
|
22
|
+
render(React.createElement(ButtonTabs, { items: items, qa: qaId }));
|
|
23
|
+
const buttonTabs = screen.getByTestId(qaId);
|
|
24
|
+
expect(buttonTabs).toBeInTheDocument();
|
|
25
|
+
expect(buttonTabs).toBeVisible();
|
|
26
|
+
expect(buttonTabs).not.toBeDisabled();
|
|
27
|
+
});
|
|
28
|
+
test('has active tab', async () => {
|
|
29
|
+
const activeTabId = 1;
|
|
30
|
+
render(React.createElement(ButtonTabs, { items: items, qa: qaId, activeTab: String(activeTabId) }));
|
|
31
|
+
const buttons = screen.getAllByRole('button');
|
|
32
|
+
buttons.forEach((button, index) => {
|
|
33
|
+
if (index === activeTabId) {
|
|
34
|
+
expect(button).toHaveClass('pc-button-tabs__item_active');
|
|
35
|
+
}
|
|
36
|
+
expect(button).toHaveClass('pc-button-block_theme_normal');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
test('add className', () => {
|
|
40
|
+
const className = 'my-class';
|
|
41
|
+
render(React.createElement(ButtonTabs, { items: items, qa: qaId, className: className }));
|
|
42
|
+
const buttonTabs = screen.getByTestId(qaId);
|
|
43
|
+
expect(buttonTabs).toHaveClass(className);
|
|
44
|
+
});
|
|
45
|
+
test('call onSelectTab', async () => {
|
|
46
|
+
const user = userEvent.setup();
|
|
47
|
+
const handleOnClick = jest.fn();
|
|
48
|
+
render(React.createElement(ButtonTabs, { items: items, qa: qaId, onSelectTab: handleOnClick }));
|
|
49
|
+
const buttons = screen.getAllByRole('button');
|
|
50
|
+
buttons.forEach(async (button, i) => {
|
|
51
|
+
await user.click(button);
|
|
52
|
+
expect(handleOnClick).toHaveBeenCalledTimes(i + 1);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
@@ -14,7 +14,6 @@ export { default as Foldable } from './Foldable/Foldable';
|
|
|
14
14
|
export { default as FullscreenImage } from './FullscreenImage/FullscreenImage';
|
|
15
15
|
export { default as FullWidthBackground } from './FullWidthBackground/FullWidthBackground';
|
|
16
16
|
export { default as HeaderBreadcrumbs } from './HeaderBreadcrumbs/HeaderBreadcrumbs';
|
|
17
|
-
export { default as HeightCalculator } from './HeightCalculator/HeightCalculator';
|
|
18
17
|
export { default as Image } from './Image/Image';
|
|
19
18
|
export { default as ImageBase } from './ImageBase/ImageBase';
|
|
20
19
|
export { default as Link } from './Link/Link';
|
|
@@ -14,7 +14,6 @@ export { default as Foldable } from './Foldable/Foldable';
|
|
|
14
14
|
export { default as FullscreenImage } from './FullscreenImage/FullscreenImage';
|
|
15
15
|
export { default as FullWidthBackground } from './FullWidthBackground/FullWidthBackground';
|
|
16
16
|
export { default as HeaderBreadcrumbs } from './HeaderBreadcrumbs/HeaderBreadcrumbs';
|
|
17
|
-
export { default as HeightCalculator } from './HeightCalculator/HeightCalculator';
|
|
18
17
|
export { default as Image } from './Image/Image';
|
|
19
18
|
export { default as ImageBase } from './ImageBase/ImageBase';
|
|
20
19
|
export { default as Link } from './Link/Link';
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
export declare const blockMap: {
|
|
2
2
|
"slider-block": (props: import("./models").WithChildren<import("./blocks/Slider/Slider").SliderProps>) => JSX.Element;
|
|
3
|
-
"simple-block": (props: import("./models").WithChildren<import("./models").SimpleBlockProps>) => JSX.Element;
|
|
4
3
|
"extended-features-block": ({ title, description, items, colSizes, animated, }: import("./models").ExtendedFeaturesProps) => JSX.Element;
|
|
5
4
|
"promo-features-block": (props: import("./models").PromoFeaturesProps) => JSX.Element;
|
|
6
5
|
"questions-block": (props: import("./models").QuestionsProps) => JSX.Element;
|
|
7
6
|
"banner-block": (props: import("./models").BannerBlockProps) => JSX.Element;
|
|
8
7
|
"companies-block": ({ title, images, animated }: import("./models").CompaniesBlockProps) => JSX.Element;
|
|
9
8
|
"media-block": (props: import("./models").MediaBlockProps) => JSX.Element;
|
|
10
|
-
"preview-block": (props: import("./models").PreviewBlockProps) => JSX.Element;
|
|
11
9
|
"info-block": (props: import("./models").InfoBlockProps) => JSX.Element;
|
|
12
|
-
"security-block": (props: import("./models").SecurityBlockProps) => JSX.Element;
|
|
13
10
|
"table-block": (props: import("./models").TableBlockProps) => JSX.Element;
|
|
14
11
|
"tabs-block": ({ items, title, description, animated, tabsColSizes, centered, direction, }: import("./models").TabsBlockProps) => JSX.Element;
|
|
15
|
-
"link-table-block": ({ items, title, description, linkTheme }: import("./models").LinkTableBlockProps) => JSX.Element;
|
|
16
12
|
"header-block": (props: import("./models").WithChildren<import("./models").HeaderBlockProps & import("./models").ClassNameProps>) => JSX.Element;
|
|
17
13
|
"icons-block": ({ title, size, items }: import("./models").IconsBlockProps) => JSX.Element;
|
|
18
14
|
"header-slider-block": ({ items, arrows, ...props }: import("./models").HeaderSliderBlockProps) => JSX.Element;
|
|
@@ -24,23 +20,11 @@ export declare const blockMap: {
|
|
|
24
20
|
};
|
|
25
21
|
export declare const subBlockMap: {
|
|
26
22
|
divider: ({ size, border }: import("./models").DividerProps) => JSX.Element;
|
|
27
|
-
/**
|
|
28
|
-
* @deprecated Will be removed, use basic card instead
|
|
29
|
-
*/
|
|
30
|
-
"tutoral-card": (props: import("./models").TutorialCardProps) => JSX.Element;
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated Will be removed, use basic card instead
|
|
33
|
-
*/
|
|
34
|
-
partner: ({ text, logo, url, border }: import("./models").PartnerProps) => JSX.Element;
|
|
35
23
|
"price-detailed": (props: import("./models").PriceDetailedProps) => JSX.Element;
|
|
36
24
|
"media-card": ({ border, ...mediaProps }: import("./models").MediaCardProps) => JSX.Element;
|
|
37
25
|
"banner-card": (props: import("./models").BannerCardProps) => JSX.Element;
|
|
38
26
|
"news-card": (props: import("./models").NewsCardProps) => JSX.Element;
|
|
39
27
|
"layout-item": ({ content: { links, ...content }, metaInfo, media, border, fullScreen, className, }: import("./models").LayoutItemProps) => JSX.Element;
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated Use LayoutItem
|
|
42
|
-
*/
|
|
43
|
-
"card-with-image": ({ title, description, image, disableCompress, links, border, fullScreen, className, additionalInfo, buttons, }: import("./models").CardWithImageProps) => JSX.Element;
|
|
44
28
|
"background-card": (props: import("./models").BackgroundCardProps) => JSX.Element;
|
|
45
29
|
"basic-card": (props: import("./models").BasicCardProps) => JSX.Element;
|
|
46
30
|
content: (props: import("./models").ContentBlockProps & import("./models").ClassNameProps) => JSX.Element;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { BannerBlock, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock,
|
|
1
|
+
import { BannerBlock, CardLayoutBlock, CompaniesBlock, ContentLayoutBlock, ExtendedFeaturesBlock, FilterBlock, HeaderBlock, HeaderSliderBlock, IconsBlock, InfoBlock, MapBlock, MediaBlock, PromoFeaturesBlock, QuestionsBlock, ShareBlock, SliderBlock, TableBlock, TabsBlock, } from './blocks';
|
|
2
2
|
import { BlockType, SubBlockType } from './models';
|
|
3
|
-
import { BackgroundCard, BannerCard, BasicCard,
|
|
3
|
+
import { BackgroundCard, BannerCard, BasicCard, Content, Divider, LayoutItem, MediaCard, NewsCard, PriceDetailed, Quote, } from './sub-blocks';
|
|
4
4
|
export const blockMap = {
|
|
5
5
|
[BlockType.SliderBlock]: SliderBlock,
|
|
6
|
-
[BlockType.SimpleBlock]: SimpleBlock,
|
|
7
6
|
[BlockType.ExtendedFeaturesBlock]: ExtendedFeaturesBlock,
|
|
8
7
|
[BlockType.PromoFeaturesBlock]: PromoFeaturesBlock,
|
|
9
8
|
[BlockType.QuestionsBlock]: QuestionsBlock,
|
|
10
9
|
[BlockType.BannerBlock]: BannerBlock,
|
|
11
10
|
[BlockType.CompaniesBlock]: CompaniesBlock,
|
|
12
11
|
[BlockType.MediaBlock]: MediaBlock,
|
|
13
|
-
[BlockType.PreviewBlock]: PreviewBlock,
|
|
14
12
|
[BlockType.InfoBlock]: InfoBlock,
|
|
15
|
-
[BlockType.SecurityBlock]: SecurityBlock,
|
|
16
13
|
[BlockType.TableBlock]: TableBlock,
|
|
17
14
|
[BlockType.TabsBlock]: TabsBlock,
|
|
18
|
-
[BlockType.LinkTableBlock]: LinkTableBlock,
|
|
19
15
|
[BlockType.HeaderBlock]: HeaderBlock,
|
|
20
16
|
[BlockType.IconsBlock]: IconsBlock,
|
|
21
17
|
[BlockType.HeaderSliderBlock]: HeaderSliderBlock,
|
|
@@ -27,23 +23,11 @@ export const blockMap = {
|
|
|
27
23
|
};
|
|
28
24
|
export const subBlockMap = {
|
|
29
25
|
[SubBlockType.Divider]: Divider,
|
|
30
|
-
/**
|
|
31
|
-
* @deprecated Will be removed, use basic card instead
|
|
32
|
-
*/
|
|
33
|
-
[SubBlockType.TutorialCard]: TutorialCard,
|
|
34
|
-
/**
|
|
35
|
-
* @deprecated Will be removed, use basic card instead
|
|
36
|
-
*/
|
|
37
|
-
[SubBlockType.Partner]: Partner,
|
|
38
26
|
[SubBlockType.PriceDetailed]: PriceDetailed,
|
|
39
27
|
[SubBlockType.MediaCard]: MediaCard,
|
|
40
28
|
[SubBlockType.BannerCard]: BannerCard,
|
|
41
29
|
[SubBlockType.NewsCard]: NewsCard,
|
|
42
30
|
[SubBlockType.LayoutItem]: LayoutItem,
|
|
43
|
-
/**
|
|
44
|
-
* @deprecated Use LayoutItem
|
|
45
|
-
*/
|
|
46
|
-
[SubBlockType.CardWithImage]: CardWithImage,
|
|
47
31
|
[SubBlockType.BackgroundCard]: BackgroundCard,
|
|
48
32
|
[SubBlockType.BasicCard]: BasicCard,
|
|
49
33
|
[SubBlockType.Content]: Content,
|
|
@@ -7,4 +7,4 @@ export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivE
|
|
|
7
7
|
dataQa?: string;
|
|
8
8
|
children?: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "className" | "reset" | "sizes" | "offsets" | "orders" | "hidden" | "visible" | "alignSelf" | "justifyContent"
|
|
10
|
+
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "className" | "dataQa" | "reset" | "sizes" | "offsets" | "orders" | "hidden" | "visible" | "alignSelf" | "justifyContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as useFocus } from './useFocus';
|
|
2
2
|
export { default as useWindowBreakpoint } from './useWindowBreakpoint';
|
|
3
|
-
export { useIntersection } from './useIntersection';
|
|
4
3
|
export { default as useMount } from './useMount';
|
|
4
|
+
export { default as useHeightCalculator } from './useHeightCalculator';
|
|
5
5
|
export * from './useAnalytics';
|
|
6
6
|
export * from './hubspot';
|
package/build/esm/hooks/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default as useFocus } from './useFocus';
|
|
2
2
|
export { default as useWindowBreakpoint } from './useWindowBreakpoint';
|
|
3
|
-
export { useIntersection } from './useIntersection';
|
|
4
3
|
export { default as useMount } from './useMount';
|
|
4
|
+
export { default as useHeightCalculator } from './useHeightCalculator';
|
|
5
5
|
export * from './useAnalytics';
|
|
6
6
|
export * from './hubspot';
|
|
@@ -10,17 +10,22 @@ declare module '*.svg' {
|
|
|
10
10
|
export default path;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
interface CreateFormProps {
|
|
14
|
+
portalId: string;
|
|
15
|
+
formId: string;
|
|
16
|
+
region?: string;
|
|
17
|
+
target?: string;
|
|
18
|
+
cssClass?: string;
|
|
19
|
+
formInstanceId?: string;
|
|
20
|
+
}
|
|
14
21
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
formInstanceId?: string;
|
|
23
|
-
}
|
|
22
|
+
interface Window {
|
|
23
|
+
hbspt?: {
|
|
24
|
+
forms: {
|
|
25
|
+
create: (args: CreateFormProps) => unknown;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
ymaps: Ymaps;
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
declare namespace Ymaps {
|
|
@@ -58,11 +63,4 @@ declare namespace Ymaps {
|
|
|
58
63
|
}
|
|
59
64
|
}
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
hbspt?: {
|
|
63
|
-
forms: {
|
|
64
|
-
create: (args: Hbspt.CreateFormProps) => unknown;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
ymaps: Ymaps;
|
|
68
|
-
}
|
|
66
|
+
declare module '*.md';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { ButtonSize } from '@gravity-ui/uikit';
|
|
3
3
|
import { GridColumnSize, GridColumnSizesType } from '../../grid/types';
|
|
4
4
|
import { ThemeSupporting } from '../../utils';
|
|
5
|
-
import { AnchorProps, Animatable, BackgroundImageProps, BlockHeaderProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps,
|
|
5
|
+
import { AnchorProps, Animatable, BackgroundImageProps, BlockHeaderProps, ButtonProps, ContentSize, ContentTextSize, ContentTheme, FileLinkProps, HeaderBreadCrumbsProps, HeaderImageSize, HeaderOffset, HeaderWidth, ImageDeviceProps, Justify, LegendTableMarkerType, LinkProps, MapProps, MediaDirection, MediaProps, TextSize, TextTheme, ThemedImage, ThemedMediaProps, ThemedMediaVideoProps, TitleBaseProps, TitleProps } from './common';
|
|
6
6
|
import { BannerCardProps, SubBlock, SubBlockModels } from './sub-blocks';
|
|
7
7
|
export declare enum BlockType {
|
|
8
8
|
PromoFeaturesBlock = "promo-features-block",
|
|
@@ -14,14 +14,10 @@ export declare enum BlockType {
|
|
|
14
14
|
BannerBlock = "banner-block",
|
|
15
15
|
CompaniesBlock = "companies-block",
|
|
16
16
|
MediaBlock = "media-block",
|
|
17
|
-
PreviewBlock = "preview-block",
|
|
18
17
|
InfoBlock = "info-block",
|
|
19
|
-
SecurityBlock = "security-block",
|
|
20
18
|
TableBlock = "table-block",
|
|
21
19
|
TabsBlock = "tabs-block",
|
|
22
|
-
SimpleBlock = "simple-block",
|
|
23
20
|
HeaderSliderBlock = "header-slider-block",
|
|
24
|
-
LinkTableBlock = "link-table-block",
|
|
25
21
|
HeaderBlock = "header-block",
|
|
26
22
|
IconsBlock = "icons-block",
|
|
27
23
|
CardLayoutBlock = "card-layout-block",
|
|
@@ -115,10 +111,6 @@ export interface HeaderBlockProps {
|
|
|
115
111
|
status?: JSX.Element;
|
|
116
112
|
}
|
|
117
113
|
export type CalculatorProps = Animatable;
|
|
118
|
-
export interface SimpleBlockProps extends Animatable, Childable {
|
|
119
|
-
title: TitleBaseProps;
|
|
120
|
-
description: string;
|
|
121
|
-
}
|
|
122
114
|
export interface ExtendedFeaturesItem extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {
|
|
123
115
|
title: string;
|
|
124
116
|
label?: string;
|
|
@@ -181,15 +173,6 @@ export interface MediaBlockProps extends MediaBaseBlockProps {
|
|
|
181
173
|
export interface MapBlockProps extends MediaBaseBlockProps {
|
|
182
174
|
map: MapProps;
|
|
183
175
|
}
|
|
184
|
-
export interface PreviewBlockProps extends Animatable {
|
|
185
|
-
title: string;
|
|
186
|
-
items: PreviewItemProps[];
|
|
187
|
-
description?: string;
|
|
188
|
-
direction?: MediaDirection;
|
|
189
|
-
ratioMediaContent?: PreviewRatioMediaContent;
|
|
190
|
-
stopVideo?: boolean;
|
|
191
|
-
showImmediately?: boolean;
|
|
192
|
-
}
|
|
193
176
|
export interface InfoBlockProps {
|
|
194
177
|
theme?: TextTheme;
|
|
195
178
|
backgroundColor?: ThemeSupporting<string>;
|
|
@@ -204,21 +187,6 @@ export interface InfoBlockProps {
|
|
|
204
187
|
leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;
|
|
205
188
|
rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;
|
|
206
189
|
}
|
|
207
|
-
export interface SecurityBlockPoint {
|
|
208
|
-
img: string;
|
|
209
|
-
text: string;
|
|
210
|
-
link: {
|
|
211
|
-
text: string;
|
|
212
|
-
url: string;
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
export interface SecurityBlockProps extends Animatable {
|
|
216
|
-
theme?: TextTheme;
|
|
217
|
-
backgroundColor?: string;
|
|
218
|
-
title: string;
|
|
219
|
-
points?: SecurityBlockPoint[];
|
|
220
|
-
media: MediaProps;
|
|
221
|
-
}
|
|
222
190
|
export interface TableProps {
|
|
223
191
|
content: string[][];
|
|
224
192
|
legend?: string[];
|
|
@@ -245,10 +213,6 @@ export interface TabsBlockProps extends BlockHeaderProps, Animatable {
|
|
|
245
213
|
direction?: MediaDirection;
|
|
246
214
|
items: TabsBlockItem[];
|
|
247
215
|
}
|
|
248
|
-
export interface LinkTableBlockProps extends BlockHeaderProps {
|
|
249
|
-
items: LinkProps[][];
|
|
250
|
-
linkTheme?: LinkTheme;
|
|
251
|
-
}
|
|
252
216
|
export interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {
|
|
253
217
|
title: TitleProps | string;
|
|
254
218
|
description?: string;
|
|
@@ -347,27 +311,15 @@ export type MediaBlockModel = {
|
|
|
347
311
|
export type MapBlockModel = {
|
|
348
312
|
type: BlockType.MapBlock;
|
|
349
313
|
} & MapBlockProps;
|
|
350
|
-
export type PreviewBlockModel = {
|
|
351
|
-
type: BlockType.PreviewBlock;
|
|
352
|
-
} & PreviewBlockProps;
|
|
353
314
|
export type InfoBlockModel = {
|
|
354
315
|
type: BlockType.InfoBlock;
|
|
355
316
|
} & InfoBlockProps;
|
|
356
|
-
export type SecurityBlockModel = {
|
|
357
|
-
type: BlockType.SecurityBlock;
|
|
358
|
-
} & SecurityBlockProps;
|
|
359
317
|
export type TableBlockModel = {
|
|
360
318
|
type: BlockType.TableBlock;
|
|
361
319
|
} & TableBlockProps;
|
|
362
320
|
export type TabsBlockModel = {
|
|
363
321
|
type: BlockType.TabsBlock;
|
|
364
322
|
} & TabsBlockProps;
|
|
365
|
-
export type SimpleBlockModel = {
|
|
366
|
-
type: BlockType.SimpleBlock;
|
|
367
|
-
} & SimpleBlockProps;
|
|
368
|
-
export type LinkTableBlockModel = {
|
|
369
|
-
type: BlockType.LinkTableBlock;
|
|
370
|
-
} & LinkTableBlockProps;
|
|
371
323
|
export type CardLayoutBlockModel = {
|
|
372
324
|
type: BlockType.CardLayoutBlock;
|
|
373
325
|
} & CardLayoutBlockProps;
|
|
@@ -386,6 +338,6 @@ export type ContentLayoutBlockModel = {
|
|
|
386
338
|
export type ShareBLockModel = {
|
|
387
339
|
type: BlockType.ShareBlock;
|
|
388
340
|
} & ShareBlockProps;
|
|
389
|
-
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel |
|
|
341
|
+
type BlockModels = SliderBlockModel | ServiceDemoBlockModel | ExtendedFeaturesBlockModel | PromoFeaturesBlockModel | QuestionsBlockModel | CalculatorBlockModel | BannerBlockModel | CompaniesBlockModel | MediaBlockModel | MapBlockModel | InfoBlockModel | TableBlockModel | TabsBlockModel | HeaderBlockModel | IconsBlockModel | HeaderSliderBlockModel | CardLayoutBlockModel | ContentLayoutBlockModel | ShareBLockModel | FilterBlockModel;
|
|
390
342
|
export type Block = BlockModels & BlockBaseProps;
|
|
391
343
|
export {};
|
|
@@ -9,14 +9,10 @@ export var BlockType;
|
|
|
9
9
|
BlockType["BannerBlock"] = "banner-block";
|
|
10
10
|
BlockType["CompaniesBlock"] = "companies-block";
|
|
11
11
|
BlockType["MediaBlock"] = "media-block";
|
|
12
|
-
BlockType["PreviewBlock"] = "preview-block";
|
|
13
12
|
BlockType["InfoBlock"] = "info-block";
|
|
14
|
-
BlockType["SecurityBlock"] = "security-block";
|
|
15
13
|
BlockType["TableBlock"] = "table-block";
|
|
16
14
|
BlockType["TabsBlock"] = "tabs-block";
|
|
17
|
-
BlockType["SimpleBlock"] = "simple-block";
|
|
18
15
|
BlockType["HeaderSliderBlock"] = "header-slider-block";
|
|
19
|
-
BlockType["LinkTableBlock"] = "link-table-block";
|
|
20
16
|
BlockType["HeaderBlock"] = "header-block";
|
|
21
17
|
BlockType["IconsBlock"] = "icons-block";
|
|
22
18
|
BlockType["CardLayoutBlock"] = "card-layout-block";
|