@gravity-ui/page-constructor 4.3.0 → 4.4.1
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/build/cjs/components/HTML/HTML.d.ts +3 -1
- package/build/cjs/components/HTML/HTML.js +2 -1
- package/build/cjs/components/Table/Table.js +11 -5
- package/build/cjs/components/YFMWrapper/YFMWrapper.d.ts +3 -3
- package/build/cjs/components/YFMWrapper/YFMWrapper.js +1 -1
- package/build/cjs/grid/Col/Col.d.ts +2 -4
- package/build/cjs/models/constructor-items/blocks.d.ts +4 -0
- package/build/cjs/models/constructor-items/common.d.ts +4 -1
- package/build/esm/components/HTML/HTML.d.ts +3 -1
- package/build/esm/components/HTML/HTML.js +2 -1
- package/build/esm/components/Table/Table.js +11 -5
- package/build/esm/components/YFMWrapper/YFMWrapper.d.ts +3 -3
- package/build/esm/components/YFMWrapper/YFMWrapper.js +1 -1
- package/build/esm/grid/Col/Col.d.ts +2 -4
- package/build/esm/models/constructor-items/blocks.d.ts +4 -0
- package/build/esm/models/constructor-items/common.d.ts +4 -1
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +4 -0
- package/server/models/constructor-items/common.d.ts +4 -1
- package/widget/index.js +1 -1
|
@@ -5,12 +5,14 @@ export interface HTMLProps {
|
|
|
5
5
|
block?: boolean;
|
|
6
6
|
className?: string;
|
|
7
7
|
itemProp?: string;
|
|
8
|
+
id?: string;
|
|
8
9
|
}
|
|
9
|
-
declare const HTML: ({ children, block, className, itemProp }: WithChildren<HTMLProps>) => React.DetailedReactHTMLElement<{
|
|
10
|
+
declare const HTML: ({ children, block, className, itemProp, id }: WithChildren<HTMLProps>) => React.DetailedReactHTMLElement<{
|
|
10
11
|
dangerouslySetInnerHTML: {
|
|
11
12
|
__html: string | (string & React.ReactElement<any, string | React.JSXElementConstructor<any>>) | (string & React.ReactFragment) | (string & React.ReactPortal);
|
|
12
13
|
};
|
|
13
14
|
className: string | undefined;
|
|
14
15
|
itemProp: string | undefined;
|
|
16
|
+
id: string | undefined;
|
|
15
17
|
}, HTMLElement> | null;
|
|
16
18
|
export default HTML;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
|
-
const HTML = ({ children, block = false, className, itemProp }) => {
|
|
6
|
+
const HTML = ({ children, block = false, className, itemProp, id }) => {
|
|
7
7
|
if (!children) {
|
|
8
8
|
return null;
|
|
9
9
|
}
|
|
@@ -11,6 +11,7 @@ const HTML = ({ children, block = false, className, itemProp }) => {
|
|
|
11
11
|
dangerouslySetInnerHTML: { __html: children },
|
|
12
12
|
className,
|
|
13
13
|
itemProp,
|
|
14
|
+
id,
|
|
14
15
|
});
|
|
15
16
|
};
|
|
16
17
|
exports.default = HTML;
|
|
@@ -4,28 +4,34 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const react_1 = tslib_1.__importDefault(require("react"));
|
|
5
5
|
const __1 = require("../");
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
|
+
function getMarkerId(index) {
|
|
8
|
+
if (isNaN(index)) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return `marker-${index}`;
|
|
12
|
+
}
|
|
7
13
|
const b = (0, utils_1.block)('table');
|
|
8
14
|
class Table extends react_1.default.Component {
|
|
9
15
|
render() {
|
|
10
|
-
const { content, legend, marker = 'disk', className } = this.props;
|
|
16
|
+
const { content, legend, marker = 'disk', className, caption } = this.props;
|
|
11
17
|
if (!content || !content.length || !content[0].length) {
|
|
12
18
|
return null;
|
|
13
19
|
}
|
|
14
|
-
return (react_1.default.createElement("div", { className: b(null, className) },
|
|
20
|
+
return (react_1.default.createElement("div", { className: b(null, className), role: 'table', "aria-label": caption },
|
|
15
21
|
this.renderTable(content, marker, legend),
|
|
16
22
|
legend && this.renderLegend(legend, marker)));
|
|
17
23
|
}
|
|
18
24
|
renderTable(content, marker, legend) {
|
|
19
25
|
const justify = this.getDefaultJustify(content, this.props.justify);
|
|
20
|
-
return (react_1.default.createElement("div", { className: b('table') }, content.map((row, i) => (react_1.default.createElement("div", { key: i, className: b('row') }, row.map((cell, j) => (react_1.default.createElement("div", { key: j, className: b('cell', { justify: justify[j] }) }, legend && i && j ? (this.renderMarker(marker, cell)) : (react_1.default.createElement(__1.HTML, null, cell))))))))));
|
|
26
|
+
return (react_1.default.createElement("div", { className: b('table'), role: 'rowgroup' }, content.map((row, i) => (react_1.default.createElement("div", { key: i, className: b('row'), role: 'row' }, row.map((cell, j) => (react_1.default.createElement("div", { key: j, className: b('cell', { justify: justify[j] }), role: 'cell' }, legend && i && j ? (this.renderMarker(marker, cell)) : (react_1.default.createElement(__1.HTML, null, cell))))))))));
|
|
21
27
|
}
|
|
22
28
|
renderMarker(type, cell) {
|
|
23
|
-
return react_1.default.createElement("div", { className: b('marker', { type, index: String(cell) }) });
|
|
29
|
+
return (react_1.default.createElement("div", { "aria-labelledby": getMarkerId(Number(cell)), className: b('marker', { type, index: String(cell) }) }));
|
|
24
30
|
}
|
|
25
31
|
renderLegend(legend, marker) {
|
|
26
32
|
return (react_1.default.createElement("div", { className: b('legend') }, legend.map((item, index) => (react_1.default.createElement("div", { key: item, className: b('legend-item') },
|
|
27
33
|
this.renderMarker(marker, String(index)),
|
|
28
|
-
react_1.default.createElement(__1.YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true } }))))));
|
|
34
|
+
react_1.default.createElement(__1.YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true }, id: getMarkerId(index) }))))));
|
|
29
35
|
}
|
|
30
36
|
getDefaultJustify(content, justify) {
|
|
31
37
|
return justify || new Array(content[0].length).fill('center');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ClassNameProps, Modifiers } from '../../models';
|
|
2
|
-
export interface YFMWrapperProps {
|
|
3
|
-
className?: string;
|
|
2
|
+
export interface YFMWrapperProps extends ClassNameProps {
|
|
4
3
|
content: string;
|
|
5
4
|
modifiers?: Modifiers;
|
|
6
5
|
itemProp?: string;
|
|
6
|
+
id?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const YFMWrapper: ({ content, modifiers, className, itemProp, }: YFMWrapperProps
|
|
8
|
+
declare const YFMWrapper: ({ content, modifiers, className, itemProp, id }: YFMWrapperProps) => JSX.Element;
|
|
9
9
|
export default YFMWrapper;
|
|
@@ -8,5 +8,5 @@ const bem_cn_lite_1 = tslib_1.__importDefault(require("bem-cn-lite"));
|
|
|
8
8
|
const snakecase_keys_1 = tslib_1.__importDefault(require("snakecase-keys"));
|
|
9
9
|
const components_1 = require("../../components");
|
|
10
10
|
const yfm = (0, bem_cn_lite_1.default)('yfm');
|
|
11
|
-
const YFMWrapper = ({ content, modifiers, className, itemProp, }) => (react_1.default.createElement(components_1.HTML, { className: yfm(modifiers ? (0, snakecase_keys_1.default)(modifiers) : {}, className), itemProp: itemProp }, content));
|
|
11
|
+
const YFMWrapper = ({ content, modifiers, className, itemProp, id }) => (react_1.default.createElement(components_1.HTML, { className: yfm(modifiers ? (0, snakecase_keys_1.default)(modifiers) : {}, className), itemProp: itemProp, id: id }, content));
|
|
12
12
|
exports.default = YFMWrapper;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
import { QAProps, Refable } from '../../models
|
|
3
|
-
import { WithChildren } from '../../models/react';
|
|
2
|
+
import { QAProps, Refable, Roleable, WithChildren } from '../../models';
|
|
4
3
|
import { GridColumnClassParams } from '../types';
|
|
5
|
-
export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivElement>, QAProps {
|
|
4
|
+
export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivElement>, QAProps, Roleable {
|
|
6
5
|
style?: CSSProperties;
|
|
7
6
|
children?: React.ReactNode;
|
|
8
|
-
role?: React.AriaRole;
|
|
9
7
|
}
|
|
10
8
|
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "sizes" | "className" | "hidden" | "role" | "qa" | "reset" | "visible" | "offsets" | "orders" | "alignSelf" | "justifyContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -189,6 +189,10 @@ export interface TableProps {
|
|
|
189
189
|
legend?: string[];
|
|
190
190
|
justify?: Justify[];
|
|
191
191
|
marker?: LegendTableMarkerType;
|
|
192
|
+
/**
|
|
193
|
+
* Only as accessible name, not displayed explicitly
|
|
194
|
+
*/
|
|
195
|
+
caption?: string;
|
|
192
196
|
}
|
|
193
197
|
export interface TableBlockProps {
|
|
194
198
|
title: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType, QAProps } from '../common';
|
|
@@ -64,6 +64,9 @@ export interface Animatable {
|
|
|
64
64
|
export interface Tabbable {
|
|
65
65
|
tabIndex?: number;
|
|
66
66
|
}
|
|
67
|
+
export interface Roleable {
|
|
68
|
+
role?: React.AriaRole;
|
|
69
|
+
}
|
|
67
70
|
export interface Background {
|
|
68
71
|
image?: string;
|
|
69
72
|
color?: string;
|
|
@@ -5,12 +5,14 @@ export interface HTMLProps {
|
|
|
5
5
|
block?: boolean;
|
|
6
6
|
className?: string;
|
|
7
7
|
itemProp?: string;
|
|
8
|
+
id?: string;
|
|
8
9
|
}
|
|
9
|
-
declare const HTML: ({ children, block, className, itemProp }: WithChildren<HTMLProps>) => React.DetailedReactHTMLElement<{
|
|
10
|
+
declare const HTML: ({ children, block, className, itemProp, id }: WithChildren<HTMLProps>) => React.DetailedReactHTMLElement<{
|
|
10
11
|
dangerouslySetInnerHTML: {
|
|
11
12
|
__html: string | (string & React.ReactElement<any, string | React.JSXElementConstructor<any>>) | (string & React.ReactFragment) | (string & React.ReactPortal);
|
|
12
13
|
};
|
|
13
14
|
className: string | undefined;
|
|
14
15
|
itemProp: string | undefined;
|
|
16
|
+
id: string | undefined;
|
|
15
17
|
}, HTMLElement> | null;
|
|
16
18
|
export default HTML;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { hasBlockTag } from '../../utils';
|
|
3
|
-
const HTML = ({ children, block = false, className, itemProp }) => {
|
|
3
|
+
const HTML = ({ children, block = false, className, itemProp, id }) => {
|
|
4
4
|
if (!children) {
|
|
5
5
|
return null;
|
|
6
6
|
}
|
|
@@ -8,6 +8,7 @@ const HTML = ({ children, block = false, className, itemProp }) => {
|
|
|
8
8
|
dangerouslySetInnerHTML: { __html: children },
|
|
9
9
|
className,
|
|
10
10
|
itemProp,
|
|
11
|
+
id,
|
|
11
12
|
});
|
|
12
13
|
};
|
|
13
14
|
export default HTML;
|
|
@@ -2,28 +2,34 @@ import React from 'react';
|
|
|
2
2
|
import { HTML, YFMWrapper } from '../';
|
|
3
3
|
import { block } from '../../utils';
|
|
4
4
|
import './Table.css';
|
|
5
|
+
function getMarkerId(index) {
|
|
6
|
+
if (isNaN(index)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
return `marker-${index}`;
|
|
10
|
+
}
|
|
5
11
|
const b = block('table');
|
|
6
12
|
export default class Table extends React.Component {
|
|
7
13
|
render() {
|
|
8
|
-
const { content, legend, marker = 'disk', className } = this.props;
|
|
14
|
+
const { content, legend, marker = 'disk', className, caption } = this.props;
|
|
9
15
|
if (!content || !content.length || !content[0].length) {
|
|
10
16
|
return null;
|
|
11
17
|
}
|
|
12
|
-
return (React.createElement("div", { className: b(null, className) },
|
|
18
|
+
return (React.createElement("div", { className: b(null, className), role: 'table', "aria-label": caption },
|
|
13
19
|
this.renderTable(content, marker, legend),
|
|
14
20
|
legend && this.renderLegend(legend, marker)));
|
|
15
21
|
}
|
|
16
22
|
renderTable(content, marker, legend) {
|
|
17
23
|
const justify = this.getDefaultJustify(content, this.props.justify);
|
|
18
|
-
return (React.createElement("div", { className: b('table') }, content.map((row, i) => (React.createElement("div", { key: i, className: b('row') }, row.map((cell, j) => (React.createElement("div", { key: j, className: b('cell', { justify: justify[j] }) }, legend && i && j ? (this.renderMarker(marker, cell)) : (React.createElement(HTML, null, cell))))))))));
|
|
24
|
+
return (React.createElement("div", { className: b('table'), role: 'rowgroup' }, content.map((row, i) => (React.createElement("div", { key: i, className: b('row'), role: 'row' }, row.map((cell, j) => (React.createElement("div", { key: j, className: b('cell', { justify: justify[j] }), role: 'cell' }, legend && i && j ? (this.renderMarker(marker, cell)) : (React.createElement(HTML, null, cell))))))))));
|
|
19
25
|
}
|
|
20
26
|
renderMarker(type, cell) {
|
|
21
|
-
return React.createElement("div", { className: b('marker', { type, index: String(cell) }) });
|
|
27
|
+
return (React.createElement("div", { "aria-labelledby": getMarkerId(Number(cell)), className: b('marker', { type, index: String(cell) }) }));
|
|
22
28
|
}
|
|
23
29
|
renderLegend(legend, marker) {
|
|
24
30
|
return (React.createElement("div", { className: b('legend') }, legend.map((item, index) => (React.createElement("div", { key: item, className: b('legend-item') },
|
|
25
31
|
this.renderMarker(marker, String(index)),
|
|
26
|
-
React.createElement(YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true } }))))));
|
|
32
|
+
React.createElement(YFMWrapper, { className: b('legent-item-text'), content: item, modifiers: { constructor: true }, id: getMarkerId(index) }))))));
|
|
27
33
|
}
|
|
28
34
|
getDefaultJustify(content, justify) {
|
|
29
35
|
return justify || new Array(content[0].length).fill('center');
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ClassNameProps, Modifiers } from '../../models';
|
|
2
|
-
export interface YFMWrapperProps {
|
|
3
|
-
className?: string;
|
|
2
|
+
export interface YFMWrapperProps extends ClassNameProps {
|
|
4
3
|
content: string;
|
|
5
4
|
modifiers?: Modifiers;
|
|
6
5
|
itemProp?: string;
|
|
6
|
+
id?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const YFMWrapper: ({ content, modifiers, className, itemProp, }: YFMWrapperProps
|
|
8
|
+
declare const YFMWrapper: ({ content, modifiers, className, itemProp, id }: YFMWrapperProps) => JSX.Element;
|
|
9
9
|
export default YFMWrapper;
|
|
@@ -5,5 +5,5 @@ import block from 'bem-cn-lite';
|
|
|
5
5
|
import toSnakeCase from 'snakecase-keys';
|
|
6
6
|
import { HTML } from '../../components';
|
|
7
7
|
const yfm = block('yfm');
|
|
8
|
-
const YFMWrapper = ({ content, modifiers, className, itemProp, }) => (React.createElement(HTML, { className: yfm(modifiers ? toSnakeCase(modifiers) : {}, className), itemProp: itemProp }, content));
|
|
8
|
+
const YFMWrapper = ({ content, modifiers, className, itemProp, id }) => (React.createElement(HTML, { className: yfm(modifiers ? toSnakeCase(modifiers) : {}, className), itemProp: itemProp, id: id }, content));
|
|
9
9
|
export default YFMWrapper;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
|
-
import { QAProps, Refable } from '../../models
|
|
3
|
-
import { WithChildren } from '../../models/react';
|
|
2
|
+
import { QAProps, Refable, Roleable, WithChildren } from '../../models';
|
|
4
3
|
import { GridColumnClassParams } from '../types';
|
|
5
|
-
export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivElement>, QAProps {
|
|
4
|
+
export interface GridColumnProps extends GridColumnClassParams, Refable<HTMLDivElement>, QAProps, Roleable {
|
|
6
5
|
style?: CSSProperties;
|
|
7
6
|
children?: React.ReactNode;
|
|
8
|
-
role?: React.AriaRole;
|
|
9
7
|
}
|
|
10
8
|
export declare const Col: React.ForwardRefExoticComponent<Pick<WithChildren<GridColumnProps>, "style" | "children" | "sizes" | "className" | "hidden" | "role" | "qa" | "reset" | "visible" | "offsets" | "orders" | "alignSelf" | "justifyContent"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -189,6 +189,10 @@ export interface TableProps {
|
|
|
189
189
|
legend?: string[];
|
|
190
190
|
justify?: Justify[];
|
|
191
191
|
marker?: LegendTableMarkerType;
|
|
192
|
+
/**
|
|
193
|
+
* Only as accessible name, not displayed explicitly
|
|
194
|
+
*/
|
|
195
|
+
caption?: string;
|
|
192
196
|
}
|
|
193
197
|
export interface TableBlockProps {
|
|
194
198
|
title: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType, QAProps } from '../common';
|
|
@@ -64,6 +64,9 @@ export interface Animatable {
|
|
|
64
64
|
export interface Tabbable {
|
|
65
65
|
tabIndex?: number;
|
|
66
66
|
}
|
|
67
|
+
export interface Roleable {
|
|
68
|
+
role?: React.AriaRole;
|
|
69
|
+
}
|
|
67
70
|
export interface Background {
|
|
68
71
|
image?: string;
|
|
69
72
|
color?: string;
|
package/package.json
CHANGED
|
@@ -189,6 +189,10 @@ export interface TableProps {
|
|
|
189
189
|
legend?: string[];
|
|
190
190
|
justify?: Justify[];
|
|
191
191
|
marker?: LegendTableMarkerType;
|
|
192
|
+
/**
|
|
193
|
+
* Only as accessible name, not displayed explicitly
|
|
194
|
+
*/
|
|
195
|
+
caption?: string;
|
|
192
196
|
}
|
|
193
197
|
export interface TableBlockProps {
|
|
194
198
|
title: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
1
|
+
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from '../../utils';
|
|
4
4
|
import { AnalyticsEventsBase, ClassNameProps, PixelEventType, QAProps } from '../common';
|
|
@@ -64,6 +64,9 @@ export interface Animatable {
|
|
|
64
64
|
export interface Tabbable {
|
|
65
65
|
tabIndex?: number;
|
|
66
66
|
}
|
|
67
|
+
export interface Roleable {
|
|
68
|
+
role?: React.AriaRole;
|
|
69
|
+
}
|
|
67
70
|
export interface Background {
|
|
68
71
|
image?: string;
|
|
69
72
|
color?: string;
|