@gravity-ui/page-constructor 1.12.1 → 1.13.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 +13 -1
- package/build/cjs/blocks/Slider/Slider.d.ts +1 -6
- package/build/cjs/components/Author/Author.js +2 -2
- 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/grid/Grid/Grid.css +16 -16
- package/build/cjs/models/constructor-items/common.d.ts +1 -0
- package/build/esm/blocks/Slider/Slider.d.ts +1 -6
- package/build/esm/components/Author/Author.js +2 -2
- 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/grid/Grid/Grid.css +16 -16
- package/build/esm/models/constructor-items/common.d.ts +1 -0
- package/package.json +2 -3
- package/server/models/constructor-items/common.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.13.0](https://github.com/gravity-ui/page-constructor/compare/v1.12.1...v1.13.0) (2023-01-18)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* remove matchMedia artefact ([#114](https://github.com/gravity-ui/page-constructor/issues/114)) ([8ff3117](https://github.com/gravity-ui/page-constructor/commit/8ff3117261f9681f0dbb452c3c722ee80845da80))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* delete unused dependency ([#112](https://github.com/gravity-ui/page-constructor/issues/112)) ([300085c](https://github.com/gravity-ui/page-constructor/commit/300085c456877ef617f4225a603fcc3d52393848))
|
|
14
|
+
|
|
3
15
|
## [1.12.1](https://github.com/gravity-ui/page-constructor/compare/v1.12.0...v1.12.1) (2023-01-11)
|
|
4
16
|
|
|
5
17
|
|
|
@@ -542,7 +554,7 @@ In the `Content`, if the `text` block has no `title`, the `margin-top` property
|
|
|
542
554
|
### Breaking changes
|
|
543
555
|
|
|
544
556
|
- `PageConstructorProvider` is now a separate component. For the `PageConstructor` to run properly, wrap it in this provider.
|
|
545
|
-
For details, see the [readme](https://github.
|
|
557
|
+
For details, see the [readme](https://github.com/gravity-ui/page-constructor#getting-started) file.
|
|
546
558
|
|
|
547
559
|
- Deleted the `system` theme (the `light` theme is used instead by default).
|
|
548
560
|
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Settings } from 'react-slick';
|
|
2
2
|
import { Refable, SliderProps as SliderParams, ClassNameProps, WithChildren } from '../../models';
|
|
3
|
-
export interface SlickSliderFull extends SlickSlider {
|
|
4
|
-
innerSlider?: {
|
|
5
|
-
list: HTMLElement;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
3
|
export interface SliderProps extends Omit<SliderParams, 'children'>, Refable<HTMLDivElement>, ClassNameProps, Pick<Settings, 'lazyLoad'> {
|
|
9
4
|
type?: string;
|
|
10
5
|
anchorId?: string;
|
|
@@ -7,10 +7,10 @@ const models_1 = require("../../models");
|
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
8
|
const b = (0, utils_1.block)('author');
|
|
9
9
|
const Author = (props) => {
|
|
10
|
-
const { author, className, authorContainerClassName, type = models_1.AuthorType.Column } = props;
|
|
10
|
+
const { author, className, authorContainerClassName, type = models_1.AuthorType.Column, dataQa } = props;
|
|
11
11
|
const { firstName, secondName, description, avatar } = author;
|
|
12
12
|
const name = secondName ? `${firstName} ${secondName}` : firstName;
|
|
13
|
-
return (react_1.default.createElement("div", { className: b({ type }, className) },
|
|
13
|
+
return (react_1.default.createElement("div", { className: b({ type }, className), "data-qa": dataQa },
|
|
14
14
|
avatar && (react_1.default.createElement("div", { className: b('avatar', authorContainerClassName) }, typeof avatar === 'string' ? react_1.default.createElement(index_1.Image, { src: avatar }) : avatar)),
|
|
15
15
|
react_1.default.createElement("div", { className: b('label') },
|
|
16
16
|
react_1.default.createElement("div", { className: b('name') }, name),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
const react_2 = require("@testing-library/react");
|
|
6
|
+
const models_1 = require("../../../models");
|
|
7
|
+
const Author_1 = tslib_1.__importDefault(require("../Author"));
|
|
8
|
+
const testId = 'author';
|
|
9
|
+
const author = {
|
|
10
|
+
firstName: 'John',
|
|
11
|
+
secondName: 'Doe',
|
|
12
|
+
description: 'Web designer',
|
|
13
|
+
avatar: 'https://storage.yandexcloud.net/cloud-www-assets/constructor/storybook/images/img-gray.png',
|
|
14
|
+
};
|
|
15
|
+
describe('Author', () => {
|
|
16
|
+
test('Render author by default', async () => {
|
|
17
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
18
|
+
const object = react_2.screen.getByTestId(testId);
|
|
19
|
+
expect(object).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
test('Has full name', async () => {
|
|
22
|
+
const name = `${author.firstName} ${author.secondName}`;
|
|
23
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
24
|
+
const object = react_2.screen.getByText(name);
|
|
25
|
+
expect(object).toBeInTheDocument();
|
|
26
|
+
});
|
|
27
|
+
test('Has first name only', async () => {
|
|
28
|
+
const name = author.firstName;
|
|
29
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: Object.assign(Object.assign({}, author), { secondName: '' }), dataQa: testId }));
|
|
30
|
+
const object = react_2.screen.getByText(name);
|
|
31
|
+
expect(object).toBeInTheDocument();
|
|
32
|
+
});
|
|
33
|
+
test('Has avatar', async () => {
|
|
34
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
35
|
+
const avatar = react_2.screen.getByRole('img');
|
|
36
|
+
expect(avatar).toBeInTheDocument();
|
|
37
|
+
expect(avatar).toHaveAttribute('src', author.avatar);
|
|
38
|
+
});
|
|
39
|
+
test('Has description', async () => {
|
|
40
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId }));
|
|
41
|
+
const object = react_2.screen.getByText(author.description);
|
|
42
|
+
expect(object).toBeInTheDocument();
|
|
43
|
+
});
|
|
44
|
+
test.each(new Array(models_1.AuthorType.Column, models_1.AuthorType.Line))('Render with given "%s" type', (type) => {
|
|
45
|
+
(0, react_2.render)(react_1.default.createElement(Author_1.default, { author: author, dataQa: testId, type: type }));
|
|
46
|
+
const object = react_2.screen.getByTestId(testId);
|
|
47
|
+
expect(object).toHaveClass(`pc-author_type_${type}`);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -21,64 +21,64 @@
|
|
|
21
21
|
}
|
|
22
22
|
@media only screen and (max-width: 577px) {
|
|
23
23
|
.pc-Grid .container,
|
|
24
|
-
.pc-Grid .container-fluid {
|
|
24
|
+
.pc-Grid .container-fluid {
|
|
25
25
|
padding: 0 16px;
|
|
26
26
|
}
|
|
27
27
|
.pc-Grid .col,
|
|
28
|
-
.pc-Grid .col-sm-auto,
|
|
29
|
-
.pc-Grid .col-auto {
|
|
28
|
+
.pc-Grid .col-sm-auto,
|
|
29
|
+
.pc-Grid .col-auto {
|
|
30
30
|
padding: 0 8px;
|
|
31
31
|
}
|
|
32
32
|
.pc-Grid .col-sm-0,
|
|
33
|
-
.pc-Grid .col-0 {
|
|
33
|
+
.pc-Grid .col-0 {
|
|
34
34
|
padding: 0 8px;
|
|
35
35
|
}
|
|
36
36
|
.pc-Grid .col-sm-1,
|
|
37
|
-
.pc-Grid .col-1 {
|
|
37
|
+
.pc-Grid .col-1 {
|
|
38
38
|
padding: 0 8px;
|
|
39
39
|
}
|
|
40
40
|
.pc-Grid .col-sm-2,
|
|
41
|
-
.pc-Grid .col-2 {
|
|
41
|
+
.pc-Grid .col-2 {
|
|
42
42
|
padding: 0 8px;
|
|
43
43
|
}
|
|
44
44
|
.pc-Grid .col-sm-3,
|
|
45
|
-
.pc-Grid .col-3 {
|
|
45
|
+
.pc-Grid .col-3 {
|
|
46
46
|
padding: 0 8px;
|
|
47
47
|
}
|
|
48
48
|
.pc-Grid .col-sm-4,
|
|
49
|
-
.pc-Grid .col-4 {
|
|
49
|
+
.pc-Grid .col-4 {
|
|
50
50
|
padding: 0 8px;
|
|
51
51
|
}
|
|
52
52
|
.pc-Grid .col-sm-5,
|
|
53
|
-
.pc-Grid .col-5 {
|
|
53
|
+
.pc-Grid .col-5 {
|
|
54
54
|
padding: 0 8px;
|
|
55
55
|
}
|
|
56
56
|
.pc-Grid .col-sm-6,
|
|
57
|
-
.pc-Grid .col-6 {
|
|
57
|
+
.pc-Grid .col-6 {
|
|
58
58
|
padding: 0 8px;
|
|
59
59
|
}
|
|
60
60
|
.pc-Grid .col-sm-7,
|
|
61
|
-
.pc-Grid .col-7 {
|
|
61
|
+
.pc-Grid .col-7 {
|
|
62
62
|
padding: 0 8px;
|
|
63
63
|
}
|
|
64
64
|
.pc-Grid .col-sm-8,
|
|
65
|
-
.pc-Grid .col-8 {
|
|
65
|
+
.pc-Grid .col-8 {
|
|
66
66
|
padding: 0 8px;
|
|
67
67
|
}
|
|
68
68
|
.pc-Grid .col-sm-9,
|
|
69
|
-
.pc-Grid .col-9 {
|
|
69
|
+
.pc-Grid .col-9 {
|
|
70
70
|
padding: 0 8px;
|
|
71
71
|
}
|
|
72
72
|
.pc-Grid .col-sm-10,
|
|
73
|
-
.pc-Grid .col-10 {
|
|
73
|
+
.pc-Grid .col-10 {
|
|
74
74
|
padding: 0 8px;
|
|
75
75
|
}
|
|
76
76
|
.pc-Grid .col-sm-11,
|
|
77
|
-
.pc-Grid .col-11 {
|
|
77
|
+
.pc-Grid .col-11 {
|
|
78
78
|
padding: 0 8px;
|
|
79
79
|
}
|
|
80
80
|
.pc-Grid .col-sm-12,
|
|
81
|
-
.pc-Grid .col-12 {
|
|
81
|
+
.pc-Grid .col-12 {
|
|
82
82
|
padding: 0 8px;
|
|
83
83
|
}
|
|
84
84
|
.pc-Grid .row .row {
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Settings } from 'react-slick';
|
|
2
2
|
import { Refable, SliderProps as SliderParams, ClassNameProps, WithChildren } from '../../models';
|
|
3
3
|
import './slick.css';
|
|
4
4
|
import './Slider.css';
|
|
5
|
-
export interface SlickSliderFull extends SlickSlider {
|
|
6
|
-
innerSlider?: {
|
|
7
|
-
list: HTMLElement;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
5
|
export interface SliderProps extends Omit<SliderParams, 'children'>, Refable<HTMLDivElement>, ClassNameProps, Pick<Settings, 'lazyLoad'> {
|
|
11
6
|
type?: string;
|
|
12
7
|
anchorId?: string;
|
|
@@ -5,10 +5,10 @@ import { block } from '../../utils';
|
|
|
5
5
|
import './Author.css';
|
|
6
6
|
const b = block('author');
|
|
7
7
|
const Author = (props) => {
|
|
8
|
-
const { author, className, authorContainerClassName, type = AuthorType.Column } = props;
|
|
8
|
+
const { author, className, authorContainerClassName, type = AuthorType.Column, dataQa } = props;
|
|
9
9
|
const { firstName, secondName, description, avatar } = author;
|
|
10
10
|
const name = secondName ? `${firstName} ${secondName}` : firstName;
|
|
11
|
-
return (React.createElement("div", { className: b({ type }, className) },
|
|
11
|
+
return (React.createElement("div", { className: b({ type }, className), "data-qa": dataQa },
|
|
12
12
|
avatar && (React.createElement("div", { className: b('avatar', authorContainerClassName) }, typeof avatar === 'string' ? React.createElement(Image, { src: avatar }) : avatar)),
|
|
13
13
|
React.createElement("div", { className: b('label') },
|
|
14
14
|
React.createElement("div", { className: b('name') }, name),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
});
|
|
@@ -21,64 +21,64 @@
|
|
|
21
21
|
}
|
|
22
22
|
@media only screen and (max-width: 577px) {
|
|
23
23
|
.pc-Grid .container,
|
|
24
|
-
.pc-Grid .container-fluid {
|
|
24
|
+
.pc-Grid .container-fluid {
|
|
25
25
|
padding: 0 16px;
|
|
26
26
|
}
|
|
27
27
|
.pc-Grid .col,
|
|
28
|
-
.pc-Grid .col-sm-auto,
|
|
29
|
-
.pc-Grid .col-auto {
|
|
28
|
+
.pc-Grid .col-sm-auto,
|
|
29
|
+
.pc-Grid .col-auto {
|
|
30
30
|
padding: 0 8px;
|
|
31
31
|
}
|
|
32
32
|
.pc-Grid .col-sm-0,
|
|
33
|
-
.pc-Grid .col-0 {
|
|
33
|
+
.pc-Grid .col-0 {
|
|
34
34
|
padding: 0 8px;
|
|
35
35
|
}
|
|
36
36
|
.pc-Grid .col-sm-1,
|
|
37
|
-
.pc-Grid .col-1 {
|
|
37
|
+
.pc-Grid .col-1 {
|
|
38
38
|
padding: 0 8px;
|
|
39
39
|
}
|
|
40
40
|
.pc-Grid .col-sm-2,
|
|
41
|
-
.pc-Grid .col-2 {
|
|
41
|
+
.pc-Grid .col-2 {
|
|
42
42
|
padding: 0 8px;
|
|
43
43
|
}
|
|
44
44
|
.pc-Grid .col-sm-3,
|
|
45
|
-
.pc-Grid .col-3 {
|
|
45
|
+
.pc-Grid .col-3 {
|
|
46
46
|
padding: 0 8px;
|
|
47
47
|
}
|
|
48
48
|
.pc-Grid .col-sm-4,
|
|
49
|
-
.pc-Grid .col-4 {
|
|
49
|
+
.pc-Grid .col-4 {
|
|
50
50
|
padding: 0 8px;
|
|
51
51
|
}
|
|
52
52
|
.pc-Grid .col-sm-5,
|
|
53
|
-
.pc-Grid .col-5 {
|
|
53
|
+
.pc-Grid .col-5 {
|
|
54
54
|
padding: 0 8px;
|
|
55
55
|
}
|
|
56
56
|
.pc-Grid .col-sm-6,
|
|
57
|
-
.pc-Grid .col-6 {
|
|
57
|
+
.pc-Grid .col-6 {
|
|
58
58
|
padding: 0 8px;
|
|
59
59
|
}
|
|
60
60
|
.pc-Grid .col-sm-7,
|
|
61
|
-
.pc-Grid .col-7 {
|
|
61
|
+
.pc-Grid .col-7 {
|
|
62
62
|
padding: 0 8px;
|
|
63
63
|
}
|
|
64
64
|
.pc-Grid .col-sm-8,
|
|
65
|
-
.pc-Grid .col-8 {
|
|
65
|
+
.pc-Grid .col-8 {
|
|
66
66
|
padding: 0 8px;
|
|
67
67
|
}
|
|
68
68
|
.pc-Grid .col-sm-9,
|
|
69
|
-
.pc-Grid .col-9 {
|
|
69
|
+
.pc-Grid .col-9 {
|
|
70
70
|
padding: 0 8px;
|
|
71
71
|
}
|
|
72
72
|
.pc-Grid .col-sm-10,
|
|
73
|
-
.pc-Grid .col-10 {
|
|
73
|
+
.pc-Grid .col-10 {
|
|
74
74
|
padding: 0 8px;
|
|
75
75
|
}
|
|
76
76
|
.pc-Grid .col-sm-11,
|
|
77
|
-
.pc-Grid .col-11 {
|
|
77
|
+
.pc-Grid .col-11 {
|
|
78
78
|
padding: 0 8px;
|
|
79
79
|
}
|
|
80
80
|
.pc-Grid .col-sm-12,
|
|
81
|
-
.pc-Grid .col-12 {
|
|
81
|
+
.pc-Grid .col-12 {
|
|
82
82
|
padding: 0 8px;
|
|
83
83
|
}
|
|
84
84
|
.pc-Grid .row .row {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/page-constructor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Gravity UI Page Constructor",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@commitlint/cli": "^17.1.2",
|
|
68
68
|
"@commitlint/config-conventional": "^17.1.0",
|
|
69
|
-
"@doc-tools/transform": "
|
|
69
|
+
"@doc-tools/transform": "2.12.0",
|
|
70
70
|
"@gravity-ui/eslint-config": "^1.0.2",
|
|
71
71
|
"@gravity-ui/prettier-config": "^1.0.1",
|
|
72
72
|
"@gravity-ui/stylelint-config": "^1.0.0",
|
|
@@ -103,7 +103,6 @@
|
|
|
103
103
|
"lint-staged": "^11.2.6",
|
|
104
104
|
"markdown-loader": "^6.0.0",
|
|
105
105
|
"move-file-cli": "^3.0.0",
|
|
106
|
-
"mq-polyfill": "^1.1.8",
|
|
107
106
|
"npm-run-all": "^4.1.5",
|
|
108
107
|
"postcss": "^8.4.16",
|
|
109
108
|
"postcss-scss": "^4.0.4",
|