@gravity-ui/page-constructor 7.21.1 → 7.23.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/build/cjs/blocks/CardLayout/CardLayout.css +6 -0
- package/build/cjs/blocks/CardLayout/CardLayout.d.ts +1 -1
- package/build/cjs/blocks/CardLayout/CardLayout.js +2 -2
- package/build/cjs/blocks/CardLayout/CardLayout.js.map +1 -1
- package/build/cjs/blocks/ContentLayout/schema.d.ts +11 -0
- package/build/cjs/blocks/FoldableList/schema.d.ts +11 -0
- package/build/cjs/blocks/Form/Form.css +5 -2
- package/build/cjs/blocks/Form/Form.js +12 -9
- package/build/cjs/blocks/Form/Form.js.map +1 -1
- package/build/cjs/blocks/Form/schema.d.ts +12 -4
- package/build/cjs/blocks/Form/schema.js +1 -4
- package/build/cjs/blocks/Form/schema.js.map +1 -1
- package/build/cjs/blocks/Form/utils.d.ts +3 -0
- package/build/cjs/blocks/Form/utils.js +20 -0
- package/build/cjs/blocks/Form/utils.js.map +1 -0
- package/build/cjs/blocks/Info/schema.d.ts +22 -0
- package/build/cjs/blocks/Map/schema.d.ts +11 -0
- package/build/cjs/blocks/Media/schema.d.ts +22 -0
- package/build/cjs/blocks/Questions/schema.d.ts +11 -0
- package/build/cjs/blocks/Tabs/schema.d.ts +11 -0
- package/build/cjs/components/{ContentList/ContentListItemIcon.d.ts → ContentIcon/ContentIcon.d.ts} +3 -3
- package/build/cjs/components/{ContentList/ContentListItemIcon.js → ContentIcon/ContentIcon.js} +3 -3
- package/build/cjs/components/ContentIcon/ContentIcon.js.map +1 -0
- package/build/cjs/components/ContentLabels/ContentLabels.css +53 -0
- package/build/cjs/components/ContentLabels/ContentLabels.d.ts +3 -0
- package/build/cjs/components/ContentLabels/ContentLabels.js +16 -0
- package/build/cjs/components/ContentLabels/ContentLabels.js.map +1 -0
- package/build/cjs/components/ContentList/ContentList.js +2 -2
- package/build/cjs/components/ContentList/ContentList.js.map +1 -1
- package/build/cjs/components/Title/Title.d.ts +3 -2
- package/build/cjs/components/Title/Title.js +2 -2
- package/build/cjs/components/Title/Title.js.map +1 -1
- package/build/cjs/constructor-items.d.ts +1 -1
- package/build/cjs/context/windowWidthContext/{BreakpointContext.js → WindowWidthContext.js} +2 -7
- package/build/cjs/context/windowWidthContext/WindowWidthContext.js.map +1 -0
- package/build/cjs/context/windowWidthContext/index.d.ts +1 -1
- package/build/cjs/context/windowWidthContext/index.js +1 -1
- package/build/cjs/context/windowWidthContext/index.js.map +1 -1
- package/build/cjs/hooks/useDeviceValue.d.ts +2 -0
- package/build/cjs/hooks/useDeviceValue.js +33 -0
- package/build/cjs/hooks/useDeviceValue.js.map +1 -0
- package/build/cjs/models/constructor-items/blocks.d.ts +26 -9
- package/build/cjs/models/constructor-items/blocks.js.map +1 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +5 -5
- package/build/cjs/models/constructor-items/sub-blocks.js.map +1 -1
- package/build/cjs/schema/constants.d.ts +33 -0
- package/build/cjs/schema/validators/common.d.ts +12 -1
- package/build/cjs/schema/validators/common.js +21 -0
- package/build/cjs/schema/validators/common.js.map +1 -1
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +11 -0
- package/build/cjs/sub-blocks/BasicCard/schema.d.ts +11 -0
- package/build/cjs/sub-blocks/Content/Content.css +16 -0
- package/build/cjs/sub-blocks/Content/Content.js +12 -3
- package/build/cjs/sub-blocks/Content/Content.js.map +1 -1
- package/build/cjs/sub-blocks/Content/schema.d.ts +103 -1
- package/build/cjs/sub-blocks/Content/schema.js +22 -2
- package/build/cjs/sub-blocks/Content/schema.js.map +1 -1
- package/build/cjs/sub-blocks/ImageCard/schema.d.ts +11 -0
- package/build/cjs/sub-blocks/LayoutItem/schema.d.ts +11 -0
- package/build/cjs/utils/breakpoint.d.ts +7 -0
- package/build/cjs/utils/breakpoint.js +12 -0
- package/build/cjs/utils/breakpoint.js.map +1 -0
- package/build/cjs/utils/index.d.ts +1 -0
- package/build/cjs/utils/index.js +1 -0
- package/build/cjs/utils/index.js.map +1 -1
- package/build/esm/blocks/CardLayout/CardLayout.css +6 -0
- package/build/esm/blocks/CardLayout/CardLayout.d.ts +1 -1
- package/build/esm/blocks/CardLayout/CardLayout.js +3 -3
- package/build/esm/blocks/CardLayout/CardLayout.js.map +1 -1
- package/build/esm/blocks/ContentLayout/schema.d.ts +11 -0
- package/build/esm/blocks/FoldableList/schema.d.ts +11 -0
- package/build/esm/blocks/Form/Form.css +5 -2
- package/build/esm/blocks/Form/Form.js +12 -9
- package/build/esm/blocks/Form/Form.js.map +1 -1
- package/build/esm/blocks/Form/schema.d.ts +12 -4
- package/build/esm/blocks/Form/schema.js +1 -4
- package/build/esm/blocks/Form/schema.js.map +1 -1
- package/build/esm/blocks/Form/utils.d.ts +3 -0
- package/build/esm/blocks/Form/utils.js +16 -0
- package/build/esm/blocks/Form/utils.js.map +1 -0
- package/build/esm/blocks/Info/schema.d.ts +22 -0
- package/build/esm/blocks/Map/schema.d.ts +11 -0
- package/build/esm/blocks/Media/schema.d.ts +22 -0
- package/build/esm/blocks/Questions/schema.d.ts +11 -0
- package/build/esm/blocks/Tabs/schema.d.ts +11 -0
- package/build/esm/components/{ContentList/ContentListItemIcon.d.ts → ContentIcon/ContentIcon.d.ts} +3 -3
- package/build/esm/components/{ContentList/ContentListItemIcon.js → ContentIcon/ContentIcon.js} +3 -3
- package/build/esm/components/ContentIcon/ContentIcon.js.map +1 -0
- package/build/esm/components/ContentLabels/ContentLabels.css +53 -0
- package/build/esm/components/ContentLabels/ContentLabels.d.ts +4 -0
- package/build/esm/components/ContentLabels/ContentLabels.js +14 -0
- package/build/esm/components/ContentLabels/ContentLabels.js.map +1 -0
- package/build/esm/components/ContentList/ContentList.js +2 -2
- package/build/esm/components/ContentList/ContentList.js.map +1 -1
- package/build/esm/components/Title/Title.d.ts +3 -2
- package/build/esm/components/Title/Title.js +2 -2
- package/build/esm/components/Title/Title.js.map +1 -1
- package/build/esm/constructor-items.d.ts +1 -1
- package/build/esm/context/windowWidthContext/{BreakpointContext.js → WindowWidthContext.js} +2 -7
- package/build/esm/context/windowWidthContext/WindowWidthContext.js.map +1 -0
- package/build/esm/context/windowWidthContext/index.d.ts +1 -1
- package/build/esm/context/windowWidthContext/index.js +1 -1
- package/build/esm/context/windowWidthContext/index.js.map +1 -1
- package/build/esm/hooks/useDeviceValue.d.ts +2 -0
- package/build/esm/hooks/useDeviceValue.js +29 -0
- package/build/esm/hooks/useDeviceValue.js.map +1 -0
- package/build/esm/models/constructor-items/blocks.d.ts +26 -9
- package/build/esm/models/constructor-items/blocks.js.map +1 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +5 -5
- package/build/esm/models/constructor-items/sub-blocks.js.map +1 -1
- package/build/esm/schema/constants.d.ts +33 -0
- package/build/esm/schema/validators/common.d.ts +12 -1
- package/build/esm/schema/validators/common.js +21 -1
- package/build/esm/schema/validators/common.js.map +1 -1
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +11 -0
- package/build/esm/sub-blocks/BasicCard/schema.d.ts +11 -0
- package/build/esm/sub-blocks/Content/Content.css +16 -0
- package/build/esm/sub-blocks/Content/Content.js +11 -3
- package/build/esm/sub-blocks/Content/Content.js.map +1 -1
- package/build/esm/sub-blocks/Content/schema.d.ts +103 -1
- package/build/esm/sub-blocks/Content/schema.js +21 -1
- package/build/esm/sub-blocks/Content/schema.js.map +1 -1
- package/build/esm/sub-blocks/ImageCard/schema.d.ts +11 -0
- package/build/esm/sub-blocks/LayoutItem/schema.d.ts +11 -0
- package/build/esm/utils/breakpoint.d.ts +7 -0
- package/build/esm/utils/breakpoint.js +9 -0
- package/build/esm/utils/breakpoint.js.map +1 -0
- package/build/esm/utils/index.d.ts +1 -0
- package/build/esm/utils/index.js +1 -0
- package/build/esm/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/constructor-items/blocks.d.ts +26 -9
- package/server/models/constructor-items/sub-blocks.d.ts +5 -5
- package/server/utils/breakpoint.d.ts +7 -0
- package/server/utils/breakpoint.js +11 -0
- package/server/utils/index.d.ts +1 -0
- package/server/utils/index.js +1 -0
- package/widget/index.js +1 -1
- package/build/cjs/components/ContentList/ContentListItemIcon.js.map +0 -1
- package/build/cjs/context/windowWidthContext/BreakpointContext.js.map +0 -1
- package/build/esm/components/ContentList/ContentListItemIcon.js.map +0 -1
- package/build/esm/context/windowWidthContext/BreakpointContext.js.map +0 -1
- /package/build/cjs/context/windowWidthContext/{BreakpointContext.d.ts → WindowWidthContext.d.ts} +0 -0
- /package/build/esm/context/windowWidthContext/{BreakpointContext.d.ts → WindowWidthContext.d.ts} +0 -0
|
@@ -14,6 +14,12 @@ unpredictable css rules order in build */
|
|
|
14
14
|
padding: 8px 32px 48px;
|
|
15
15
|
margin-top: 24px;
|
|
16
16
|
}
|
|
17
|
+
.pc-card-layout-block__title_centered {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
17
23
|
.pc-card-layout-block__image {
|
|
18
24
|
position: absolute;
|
|
19
25
|
top: 0;
|
|
@@ -2,5 +2,5 @@ import * as React from 'react';
|
|
|
2
2
|
import { CardLayoutBlockProps as CardLayoutBlockParams, ClassNameProps } from "../../models/index.js";
|
|
3
3
|
import './CardLayout.css';
|
|
4
4
|
export type CardLayoutBlockProps = React.PropsWithChildren<Omit<CardLayoutBlockParams, 'children'>> & ClassNameProps;
|
|
5
|
-
declare const CardLayout: ({ title, description, animated, colSizes, children, className, titleClassName, background, }: CardLayoutBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare const CardLayout: ({ title, description, animated, colSizes, children, className, titleClassName, background, centered, }: CardLayoutBlockProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export default CardLayout;
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import isEmpty from "lodash/isEmpty.js";
|
|
4
4
|
import { AnimateBlock, BackgroundImage, Title } from "../../components/index.js";
|
|
5
5
|
import { useTheme } from "../../context/theme/index.js";
|
|
6
|
-
import { Col, Row } from "../../grid/index.js";
|
|
6
|
+
import { Col, GridJustifyContent, Row } from "../../grid/index.js";
|
|
7
7
|
import { block, getThemedValue } from "../../utils/index.js";
|
|
8
8
|
import './CardLayout.css';
|
|
9
9
|
const DEFAULT_SIZES = {
|
|
@@ -12,10 +12,10 @@ const DEFAULT_SIZES = {
|
|
|
12
12
|
md: 4,
|
|
13
13
|
};
|
|
14
14
|
const b = block('card-layout-block');
|
|
15
|
-
const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, titleClassName, background, }) => {
|
|
15
|
+
const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, titleClassName, background, centered = false, }) => {
|
|
16
16
|
const theme = useTheme();
|
|
17
17
|
const { border, ...backgroundImageProps } = getThemedValue(background || {}, theme);
|
|
18
|
-
return (_jsxs(AnimateBlock, { className: b(null, className), animate: animated, children: [(title || description) && (_jsx(Title, { title: title, subtitle: description, className: titleClassName })), _jsxs("div", { className: b('content', {
|
|
18
|
+
return (_jsxs(AnimateBlock, { className: b(null, className), animate: animated, children: [(title || description) && (_jsx(Title, { title: title, subtitle: description, className: b('title', { centered }, titleClassName), colJustifyContent: centered ? GridJustifyContent.Center : GridJustifyContent.Start })), _jsxs("div", { className: b('content', {
|
|
19
19
|
'with-background': !isEmpty(background),
|
|
20
20
|
}), children: [_jsx(BackgroundImage, { className: b('image', { border }), ...backgroundImageProps }), _jsx(Row, { children: React.Children.map(children, (child, index) => (_jsx(Col, { sizes: colSizes, className: b('item'), children: child }, index))) })] })] }));
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardLayout.js","sourceRoot":"../../../../src","sources":["blocks/CardLayout/CardLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE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AI,CACvB,KAAC,KAAK,IACF,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,WAAW,EACrB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,QAAQ,EAAC,EAAE,cAAc,CAAC,EACjD,iBAAiB,EACb,QAAQ,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,GAErE,CACL,EACD,eACI,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE;oBACpB,iBAAiB,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;iBAC1C,CAAC,aAEF,KAAC,eAAe,IAAC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,MAAM,EAAC,CAAC,KAAM,oBAAoB,GAAI,EAC9E,KAAC,GAAG,cACC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5C,KAAC,GAAG,IAAa,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,YACjD,KAAK,IADA,KAAK,CAET,CACT,CAAC,GACA,IACJ,IACK,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import * as React from 'react';\n\nimport isEmpty from 'lodash/isEmpty';\n\nimport {AnimateBlock, BackgroundImage, Title} from '../../components';\nimport {useTheme} from '../../context/theme';\nimport {Col, GridColumnSizesType, GridJustifyContent, Row} from '../../grid';\nimport {CardLayoutBlockProps as CardLayoutBlockParams, ClassNameProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\n\nimport './CardLayout.scss';\n\nconst DEFAULT_SIZES: GridColumnSizesType = {\n all: 12,\n sm: 6,\n md: 4,\n};\n\nexport type CardLayoutBlockProps = React.PropsWithChildren<\n Omit<CardLayoutBlockParams, 'children'>\n> &\n ClassNameProps;\n\nconst b = block('card-layout-block');\n\nconst CardLayout = ({\n title,\n description,\n animated,\n colSizes = DEFAULT_SIZES,\n children,\n className,\n titleClassName,\n background,\n centered = false,\n}: CardLayoutBlockProps) => {\n const theme = useTheme();\n const {border, ...backgroundImageProps} = getThemedValue(background || {}, theme);\n return (\n <AnimateBlock className={b(null, className)} animate={animated}>\n {(title || description) && (\n <Title\n title={title}\n subtitle={description}\n className={b('title', {centered}, titleClassName)}\n colJustifyContent={\n centered ? GridJustifyContent.Center : GridJustifyContent.Start\n }\n />\n )}\n <div\n className={b('content', {\n 'with-background': !isEmpty(background),\n })}\n >\n <BackgroundImage className={b('image', {border})} {...backgroundImageProps} />\n <Row>\n {React.Children.map(children, (child, index) => (\n <Col key={index} sizes={colSizes} className={b('item')}>\n {child}\n </Col>\n ))}\n </Row>\n </div>\n </AnimateBlock>\n );\n};\n\nexport default CardLayout;\n"]}
|
|
@@ -225,6 +225,17 @@ export declare const ContentLayoutBlock: {
|
|
|
225
225
|
};
|
|
226
226
|
};
|
|
227
227
|
};
|
|
228
|
+
labels: {
|
|
229
|
+
type: string;
|
|
230
|
+
items: {
|
|
231
|
+
type: string;
|
|
232
|
+
properties: {
|
|
233
|
+
when: {
|
|
234
|
+
type: string;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
};
|
|
228
239
|
controlPosition: {
|
|
229
240
|
type: string;
|
|
230
241
|
enum: string[];
|
|
@@ -51,6 +51,17 @@ export declare const FoldableListBlock: {
|
|
|
51
51
|
contentType: string;
|
|
52
52
|
inputType: string;
|
|
53
53
|
};
|
|
54
|
+
labels: {
|
|
55
|
+
type: string;
|
|
56
|
+
items: {
|
|
57
|
+
type: string;
|
|
58
|
+
properties: {
|
|
59
|
+
when: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
54
65
|
additionalInfo: {
|
|
55
66
|
type: string;
|
|
56
67
|
contentType: string;
|
|
@@ -69,7 +69,7 @@ unpredictable css rules order in build */
|
|
|
69
69
|
width: fit-content;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
@media (max-width:
|
|
72
|
+
@media (max-width: 1080px) and (min-width: 769px) {
|
|
73
73
|
.pc-form-block__row {
|
|
74
74
|
flex-direction: column;
|
|
75
75
|
}
|
|
@@ -94,11 +94,14 @@ unpredictable css rules order in build */
|
|
|
94
94
|
text-align: center;
|
|
95
95
|
padding-bottom: 32px;
|
|
96
96
|
}
|
|
97
|
+
.pc-form-block_with-background .pc-form-block__row .pc-form-block__content-wrapper .pc-content-labels, .pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper .pc-content-labels {
|
|
98
|
+
justify-content: center;
|
|
99
|
+
}
|
|
97
100
|
.pc-form-block:not(.pc-form-block_with-background) .pc-form-block__row .pc-form-block__content-wrapper {
|
|
98
101
|
padding: 0 0 32px 0;
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
@media (max-width:
|
|
104
|
+
@media (max-width: 768px) {
|
|
102
105
|
.pc-form-block__full-form {
|
|
103
106
|
padding: 32px;
|
|
104
107
|
}
|
|
@@ -5,26 +5,29 @@ import InnerForm from "../../components/InnerForm/InnerForm.js";
|
|
|
5
5
|
import { MobileContext } from "../../context/mobileContext/index.js";
|
|
6
6
|
import { useTheme } from "../../context/theme/index.js";
|
|
7
7
|
import { Col, Grid, GridAlignItems, GridColumnSize, Row } from "../../grid/index.js";
|
|
8
|
+
import { useDeviceValue } from "../../hooks/useDeviceValue.js";
|
|
8
9
|
import { FormBlockDataTypes, FormBlockDirection, isHubspotDataForm, isYandexDataForm, } from "../../models/index.js";
|
|
9
10
|
import { Content } from "../../sub-blocks/index.js";
|
|
10
11
|
import { block, getThemedValue } from "../../utils/index.js";
|
|
12
|
+
import { hasBackgroundCSS } from "./utils.js";
|
|
11
13
|
import './Form.css';
|
|
12
14
|
const b = block('form-block');
|
|
13
15
|
const colSizes = { [GridColumnSize.Lg]: 6, [GridColumnSize.All]: 12 };
|
|
14
16
|
const Form = (props) => {
|
|
15
|
-
const { formData, title, textContent, direction = FormBlockDirection.Center, background } = props;
|
|
17
|
+
const { formData, title, textContent, direction = FormBlockDirection.Center, background, customFormNode, } = props;
|
|
16
18
|
const [contentLoaded, setContentLoaded] = React.useState(false);
|
|
17
19
|
const isMobile = React.useContext(MobileContext);
|
|
18
20
|
const theme = useTheme();
|
|
19
21
|
const themedBackground = getThemedValue(background, theme) || undefined;
|
|
22
|
+
const themedBackgroundStyle = useDeviceValue(themedBackground?.style) || undefined;
|
|
20
23
|
const withBackground = Boolean(themedBackground &&
|
|
21
24
|
(themedBackground.src ||
|
|
22
25
|
themedBackground.desktop ||
|
|
23
|
-
|
|
26
|
+
hasBackgroundCSS(themedBackgroundStyle ?? {})));
|
|
24
27
|
const onContentLoad = React.useCallback(() => {
|
|
25
28
|
setContentLoaded(true);
|
|
26
29
|
}, []);
|
|
27
|
-
if (!formData) {
|
|
30
|
+
if (!formData && !customFormNode) {
|
|
28
31
|
return null;
|
|
29
32
|
}
|
|
30
33
|
let formType;
|
|
@@ -37,16 +40,16 @@ const Form = (props) => {
|
|
|
37
40
|
return (_jsxs("div", { className: b({
|
|
38
41
|
'with-background': withBackground,
|
|
39
42
|
'form-type': formType,
|
|
40
|
-
}), children: [themedBackground && (_jsx(BackgroundImage, { ...themedBackground, className: b('media'), imageClassName: b('image') })), _jsx(Grid, { children: _jsxs(Row, { alignItems: direction === FormBlockDirection.Center
|
|
43
|
+
}), children: [themedBackground && (_jsx(BackgroundImage, { ...themedBackground, style: themedBackgroundStyle, className: b('media'), imageClassName: b('image') })), _jsx(Grid, { children: _jsxs(Row, { alignItems: direction === FormBlockDirection.Center
|
|
41
44
|
? GridAlignItems.Center
|
|
42
45
|
: GridAlignItems.Start, className: b('row', {
|
|
43
46
|
direction,
|
|
44
|
-
}), children: [_jsx(Col, { sizes: colSizes, className: b('content-col'), children: textContent && (_jsx("div", { className: b('content-wrapper'), children: _jsx(Content, { theme: "default", ...textContent, centered: direction === FormBlockDirection.Center, colSizes: { all: 12 }, className: b('content') }) })) }), _jsx(Col, { sizes: colSizes, className: b('form-col'), children: _jsx("div", { className: b('form-wrapper'), children:
|
|
47
|
+
}), children: [_jsx(Col, { sizes: colSizes, className: b('content-col'), children: textContent && (_jsx("div", { className: b('content-wrapper'), children: _jsx(Content, { theme: "default", ...textContent, centered: direction === FormBlockDirection.Center, colSizes: { all: 12 }, className: b('content') }) })) }), _jsx(Col, { sizes: colSizes, className: b('form-col'), children: _jsx("div", { className: b('form-wrapper'), children: _jsx("div", { className: b('full-form', {
|
|
45
48
|
hidden: !contentLoaded,
|
|
46
|
-
}), children: [title && (_jsx(Title, { title: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
}), children: customFormNode || (_jsxs(React.Fragment, { children: [title && (_jsx(Title, { title: {
|
|
50
|
+
text: title,
|
|
51
|
+
textSize: 's',
|
|
52
|
+
}, className: b('title', { mobile: isMobile }), colSizes: { all: 12 } })), _jsx(InnerForm, { className: b('form'), formData: formData, onContentLoad: onContentLoad })] })) }) }) })] }) })] }));
|
|
50
53
|
};
|
|
51
54
|
export default Form;
|
|
52
55
|
//# sourceMappingURL=Form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.js","sourceRoot":"../../../../src","sources":["blocks/Form/Form.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,KAAK,EAAC,kCAAyB;AACxD,OAAO,SAAS,gDAA6C;AAC7D,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,EAAC,4BAAmB;
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"../../../../src","sources":["blocks/Form/Form.tsx"],"names":[],"mappings":";AAAA,OA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AAG,IAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,aAAa,CAAC,YAC5C,WAAW,IAAI,CACZ,cAAK,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,YAChC,KAAC,OAAO,IACJ,KAAK,EAAC,SAAS,KACX,WAAW,EACf,QAAQ,EAAE,SAAS,KAAK,kBAAkB,CAAC,MAAM,EACjD,QAAQ,EAAE,EAAC,GAAG,EAAE,EAAE,EAAC,EACnB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,GACzB,GACA,CACT,GACC,EACN,KAAC,GAAG,IAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,YAC1C,cAAK,SAAS,EAAE,CAAC,CAAC,cAAc,CAAC,YAC7B,cACI,SAAS,EAAE,CAAC,CAAC,WAAW,EAAE;wCACtB,MAAM,EAAE,CAAC,aAAa;qCACzB,CAAC,YAED,cAAc,IAAI,CACf,MAAC,KAAK,CAAC,QAAQ,eACV,KAAK,IAAI,CACN,KAAC,KAAK,IACF,KAAK,EAAE;oDACH,IAAI,EAAE,KAAK;oDACX,QAAQ,EAAE,GAAG;iDAChB,EACD,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,CAAC,EACzC,QAAQ,EAAE,EAAC,GAAG,EAAE,EAAE,EAAC,GACrB,CACL,EACD,KAAC,SAAS,IACN,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EACpB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,GAC9B,IACW,CACpB,GACC,GACJ,GACJ,IACJ,GACH,IACL,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, Title} from '../../components';\nimport InnerForm from '../../components/InnerForm/InnerForm';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, GridAlignItems, GridColumnSize, Row} from '../../grid';\nimport {useDeviceValue} from '../../hooks/useDeviceValue';\nimport type {FormBlockProps} from '../../models';\nimport {\n FormBlockDataTypes,\n FormBlockDirection,\n isHubspotDataForm,\n isYandexDataForm,\n} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport {hasBackgroundCSS} from './utils';\n\nimport './Form.scss';\n\nconst b = block('form-block');\n\nconst colSizes = {[GridColumnSize.Lg]: 6, [GridColumnSize.All]: 12};\n\nconst Form = (props: FormBlockProps) => {\n const {\n formData,\n title,\n textContent,\n direction = FormBlockDirection.Center,\n background,\n customFormNode,\n } = props;\n const [contentLoaded, setContentLoaded] = React.useState(false);\n const isMobile = React.useContext(MobileContext);\n const theme = useTheme();\n\n const themedBackground = getThemedValue(background, theme) || undefined;\n const themedBackgroundStyle = useDeviceValue(themedBackground?.style) || undefined;\n\n const withBackground = Boolean(\n themedBackground &&\n (themedBackground.src ||\n themedBackground.desktop ||\n hasBackgroundCSS(themedBackgroundStyle ?? {})),\n );\n\n const onContentLoad = React.useCallback(() => {\n setContentLoaded(true);\n }, []);\n\n if (!formData && !customFormNode) {\n return null;\n }\n\n let formType;\n\n if (isYandexDataForm(formData)) {\n formType = FormBlockDataTypes.YANDEX;\n } else if (isHubspotDataForm(formData)) {\n formType = FormBlockDataTypes.HUBSPOT;\n }\n\n return (\n <div\n className={b({\n 'with-background': withBackground,\n 'form-type': formType,\n })}\n >\n {themedBackground && (\n <BackgroundImage\n {...themedBackground}\n style={themedBackgroundStyle}\n className={b('media')}\n imageClassName={b('image')}\n />\n )}\n <Grid>\n <Row\n alignItems={\n direction === FormBlockDirection.Center\n ? GridAlignItems.Center\n : GridAlignItems.Start\n }\n className={b('row', {\n direction,\n })}\n >\n <Col sizes={colSizes} className={b('content-col')}>\n {textContent && (\n <div className={b('content-wrapper')}>\n <Content\n theme=\"default\"\n {...textContent}\n centered={direction === FormBlockDirection.Center}\n colSizes={{all: 12}}\n className={b('content')}\n />\n </div>\n )}\n </Col>\n <Col sizes={colSizes} className={b('form-col')}>\n <div className={b('form-wrapper')}>\n <div\n className={b('full-form', {\n hidden: !contentLoaded,\n })}\n >\n {customFormNode || (\n <React.Fragment>\n {title && (\n <Title\n title={{\n text: title,\n textSize: 's',\n }}\n className={b('title', {mobile: isMobile})}\n colSizes={{all: 12}}\n />\n )}\n <InnerForm\n className={b('form')}\n formData={formData}\n onContentLoad={onContentLoad}\n />\n </React.Fragment>\n )}\n </div>\n </div>\n </Col>\n </Row>\n </Grid>\n </div>\n );\n};\n\nexport default Form;\n"]}
|
|
@@ -164,6 +164,17 @@ export declare const FormBlock: {
|
|
|
164
164
|
};
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
|
+
labels: {
|
|
168
|
+
type: string;
|
|
169
|
+
items: {
|
|
170
|
+
type: string;
|
|
171
|
+
properties: {
|
|
172
|
+
when: {
|
|
173
|
+
type: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
};
|
|
167
178
|
controlPosition: {
|
|
168
179
|
type: string;
|
|
169
180
|
enum: string[];
|
|
@@ -173,7 +184,7 @@ export declare const FormBlock: {
|
|
|
173
184
|
direction: {
|
|
174
185
|
enum: string[];
|
|
175
186
|
};
|
|
176
|
-
|
|
187
|
+
background: {
|
|
177
188
|
oneOf: ({
|
|
178
189
|
type: string;
|
|
179
190
|
properties: {
|
|
@@ -200,9 +211,6 @@ export declare const FormBlock: {
|
|
|
200
211
|
pattern?: undefined;
|
|
201
212
|
})[];
|
|
202
213
|
};
|
|
203
|
-
backgroundColor: {
|
|
204
|
-
type: string;
|
|
205
|
-
};
|
|
206
214
|
anchor: {
|
|
207
215
|
type: string;
|
|
208
216
|
additionalProperties: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/Form/schema.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,uBAAoB;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AuC;AACzE,OAAO,EAAC,WAAW,EAAC,2CAAwC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,+CAA4C;AAErE,MAAM,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAElF,MAAM,CAAC,MAAM,SAAS,GAAG;IACrB,YAAY,EAAE;QACV,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,UAAU,EAAE;YACR,GAAG,cAAc;YACjB,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;aACjB;YACD,QAAQ,EAAE;gBACN,KAAK,EAAE;oBACH;wBACI,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,QAAQ;wBACpB,UAAU,EAAE;4BACR,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC;yBACrC;qBACJ;oBACD;wBACI,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,SAAS;wBACrB,UAAU,EAAE;4BACR,OAAO,EAAE,SAAS,CAAC,gBAAgB,CAAC;yBACvC;qBACJ;iBACJ;aACJ;YACD,WAAW,EAAE;gBACT,oBAAoB,EAAE,KAAK;gBAC3B,UAAU,EAAE,qBAAqB;aACpC;YACD,SAAS,EAAE;gBACP,IAAI,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,QAAQ,CAAC;aACnD;YACD,UAAU,EAAE,UAAU;SACzB;KACJ;CACJ,CAAC","sourcesContent":["import omit from 'lodash/omit';\n\nimport {ImageProps} from '../../components/Image/schema';\nimport {YandexFormProps} from '../../components/YandexForm/schema';\nimport {BlockBaseProps, withTheme} from '../../schema/validators/common';\nimport {ContentBase} from '../../sub-blocks/Content/schema';\nimport {HubspotFormProps} from '../../sub-blocks/HubspotForm/schema';\n\nconst FormBlockContentProps = omit(ContentBase, ['size', 'centered', 'colSizes']);\n\nexport const FormBlock = {\n 'form-block': {\n additionalProperties: false,\n required: ['formData'],\n properties: {\n ...BlockBaseProps,\n title: {\n type: 'string',\n },\n formData: {\n oneOf: [\n {\n type: 'object',\n optionName: 'yandex',\n properties: {\n yandex: withTheme(YandexFormProps),\n },\n },\n {\n type: 'object',\n optionName: 'hubspot',\n properties: {\n hubspot: withTheme(HubspotFormProps),\n },\n },\n ],\n },\n textContent: {\n additionalProperties: false,\n properties: FormBlockContentProps,\n },\n direction: {\n enum: ['content-form', 'form-content', 'center'],\n },\n background: ImageProps,\n },\n },\n};\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const BACKGROUND_STYLE_PROPS: readonly ["background", "backgroundAttachment", "backgroundBlendMode", "backgroundClip", "backgroundColor", "backgroundImage", "backgroundOrigin", "backgroundPositionX", "backgroundPositionY", "backgroundRepeat", "backgroundSize", "backgroundPosition"];
|
|
3
|
+
export declare const hasBackgroundCSS: (style: React.CSSProperties) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const BACKGROUND_STYLE_PROPS = [
|
|
2
|
+
'background',
|
|
3
|
+
'backgroundAttachment',
|
|
4
|
+
'backgroundBlendMode',
|
|
5
|
+
'backgroundClip',
|
|
6
|
+
'backgroundColor',
|
|
7
|
+
'backgroundImage',
|
|
8
|
+
'backgroundOrigin',
|
|
9
|
+
'backgroundPositionX',
|
|
10
|
+
'backgroundPositionY',
|
|
11
|
+
'backgroundRepeat',
|
|
12
|
+
'backgroundSize',
|
|
13
|
+
'backgroundPosition',
|
|
14
|
+
];
|
|
15
|
+
export const hasBackgroundCSS = (style) => BACKGROUND_STYLE_PROPS.some((backgroundStyleProp) => backgroundStyleProp in style);
|
|
16
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"../../../../src","sources":["blocks/Form/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,YAAY;IACZ,sBAAsB;IACtB,qBAAqB;IACrB,gBAAgB;IAChB,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,qBAAqB;IACrB,qBAAqB;IACrB,kBAAkB;IAClB,gBAAgB;IAChB,oBAAoB;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAA0B,EAAE,EAAE,CAC3D,sBAAsB,CAAC,IAAI,CAAC,CAAC,mBAAmB,EAAE,EAAE,CAAC,mBAAmB,IAAI,KAAK,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nexport const BACKGROUND_STYLE_PROPS = [\n 'background',\n 'backgroundAttachment',\n 'backgroundBlendMode',\n 'backgroundClip',\n 'backgroundColor',\n 'backgroundImage',\n 'backgroundOrigin',\n 'backgroundPositionX',\n 'backgroundPositionY',\n 'backgroundRepeat',\n 'backgroundSize',\n 'backgroundPosition',\n] as const;\n\nexport const hasBackgroundCSS = (style: React.CSSProperties) =>\n BACKGROUND_STYLE_PROPS.some((backgroundStyleProp) => backgroundStyleProp in style);\n"]}
|
|
@@ -135,6 +135,17 @@ export declare const InfoBlock: {
|
|
|
135
135
|
};
|
|
136
136
|
};
|
|
137
137
|
};
|
|
138
|
+
labels: {
|
|
139
|
+
type: string;
|
|
140
|
+
items: {
|
|
141
|
+
type: string;
|
|
142
|
+
properties: {
|
|
143
|
+
when: {
|
|
144
|
+
type: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
};
|
|
138
149
|
controlPosition: {
|
|
139
150
|
type: string;
|
|
140
151
|
enum: string[];
|
|
@@ -226,6 +237,17 @@ export declare const InfoBlock: {
|
|
|
226
237
|
};
|
|
227
238
|
};
|
|
228
239
|
};
|
|
240
|
+
labels: {
|
|
241
|
+
type: string;
|
|
242
|
+
items: {
|
|
243
|
+
type: string;
|
|
244
|
+
properties: {
|
|
245
|
+
when: {
|
|
246
|
+
type: string;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
};
|
|
229
251
|
controlPosition: {
|
|
230
252
|
type: string;
|
|
231
253
|
enum: string[];
|
|
@@ -421,6 +421,17 @@ export declare const MapBlock: {
|
|
|
421
421
|
type: string;
|
|
422
422
|
enum: string[];
|
|
423
423
|
};
|
|
424
|
+
labels: {
|
|
425
|
+
type: string;
|
|
426
|
+
items: {
|
|
427
|
+
type: string;
|
|
428
|
+
properties: {
|
|
429
|
+
when: {
|
|
430
|
+
type: string;
|
|
431
|
+
};
|
|
432
|
+
};
|
|
433
|
+
};
|
|
434
|
+
};
|
|
424
435
|
additionalInfo: {
|
|
425
436
|
type: string;
|
|
426
437
|
contentType: string;
|
|
@@ -537,6 +537,17 @@ export declare const MediaBlockBaseProps: {
|
|
|
537
537
|
type: string;
|
|
538
538
|
enum: string[];
|
|
539
539
|
};
|
|
540
|
+
labels: {
|
|
541
|
+
type: string;
|
|
542
|
+
items: {
|
|
543
|
+
type: string;
|
|
544
|
+
properties: {
|
|
545
|
+
when: {
|
|
546
|
+
type: string;
|
|
547
|
+
};
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
};
|
|
540
551
|
additionalInfo: {
|
|
541
552
|
type: string;
|
|
542
553
|
contentType: string;
|
|
@@ -1178,6 +1189,17 @@ export declare const MediaBlock: {
|
|
|
1178
1189
|
type: string;
|
|
1179
1190
|
enum: string[];
|
|
1180
1191
|
};
|
|
1192
|
+
labels: {
|
|
1193
|
+
type: string;
|
|
1194
|
+
items: {
|
|
1195
|
+
type: string;
|
|
1196
|
+
properties: {
|
|
1197
|
+
when: {
|
|
1198
|
+
type: string;
|
|
1199
|
+
};
|
|
1200
|
+
};
|
|
1201
|
+
};
|
|
1202
|
+
};
|
|
1181
1203
|
additionalInfo: {
|
|
1182
1204
|
type: string;
|
|
1183
1205
|
contentType: string;
|
|
@@ -51,6 +51,17 @@ export declare const QuestionsBlock: {
|
|
|
51
51
|
contentType: string;
|
|
52
52
|
inputType: string;
|
|
53
53
|
};
|
|
54
|
+
labels: {
|
|
55
|
+
type: string;
|
|
56
|
+
items: {
|
|
57
|
+
type: string;
|
|
58
|
+
properties: {
|
|
59
|
+
when: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
54
65
|
additionalInfo: {
|
|
55
66
|
type: string;
|
|
56
67
|
contentType: string;
|
|
@@ -571,6 +571,17 @@ export declare const tabsItem: {
|
|
|
571
571
|
};
|
|
572
572
|
};
|
|
573
573
|
} | undefined;
|
|
574
|
+
labels?: {
|
|
575
|
+
type: string;
|
|
576
|
+
items: {
|
|
577
|
+
type: string;
|
|
578
|
+
properties: {
|
|
579
|
+
when: {
|
|
580
|
+
type: string;
|
|
581
|
+
};
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
} | undefined;
|
|
574
585
|
controlPosition?: {
|
|
575
586
|
type: string;
|
|
576
587
|
enum: string[];
|
package/build/esm/components/{ContentList/ContentListItemIcon.d.ts → ContentIcon/ContentIcon.d.ts}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ClassNameProps, GravityIconProps, ImageProps, QAProps, SVGIcon } from "../../models/index.js";
|
|
2
2
|
import { ThemeSupporting } from "../../utils/index.js";
|
|
3
|
-
interface
|
|
3
|
+
interface ContentIconProps extends QAProps, ClassNameProps {
|
|
4
4
|
icon?: ThemeSupporting<ImageProps | SVGIcon>;
|
|
5
5
|
gravityIcon?: ThemeSupporting<GravityIconProps>;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
7
|
+
declare const ContentIcon: ({ icon, className, qa, gravityIcon }: ContentIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default ContentIcon;
|
package/build/esm/components/{ContentList/ContentListItemIcon.js → ContentIcon/ContentIcon.js}
RENAMED
|
@@ -5,7 +5,7 @@ import Icon from "../Icon/Icon.js";
|
|
|
5
5
|
function isIconSvg(icon) {
|
|
6
6
|
return typeof icon === 'function';
|
|
7
7
|
}
|
|
8
|
-
const
|
|
8
|
+
const ContentIcon = ({ icon, className, qa, gravityIcon }) => {
|
|
9
9
|
const theme = useTheme();
|
|
10
10
|
const iconThemed = getThemedValue(icon, theme);
|
|
11
11
|
const gravityIconThemed = getThemedValue(gravityIcon, theme);
|
|
@@ -15,5 +15,5 @@ const ContentListItemIcon = ({ icon, className, qa, gravityIcon }) => {
|
|
|
15
15
|
}
|
|
16
16
|
return _jsx(Icon, { icon: iconThemed, gravityIcon: gravityIconThemed, className: className, qa: qa });
|
|
17
17
|
};
|
|
18
|
-
export default
|
|
19
|
-
//# sourceMappingURL=
|
|
18
|
+
export default ContentIcon;
|
|
19
|
+
//# sourceMappingURL=ContentIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentIcon.js","sourceRoot":"../../../../src","sources":["components/ContentIcon/ContentIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAE7C,OAAO,EAAkB,cAAc,EAAC,6BAAoB;AAC5D,OAAO,IAAI,wBAAqB;AAOhC,SAAS,SAAS,CAAC,IAA0B;IACzC,OAAO,OAAO,IAAI,KAAK,UAAU,CAAC;AACtC,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,WAAW,EAAmB,EAAE,EAAE;IACzE,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC/C,MAAM,iBAAiB,GAAG,cAAc,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAE7D,IAAI,UAAU,IAAI,SAAS,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,MAAM,aAAa,GAAG,UAAU,CAAC;QACjC,OAAO,CACH,wBACI,KAAC,aAAa,IAAC,SAAS,EAAE,SAAS,GAAI,GACrC,CACT,CAAC;IACN,CAAC;IAED,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,GAAI,CAAC;AACpG,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import {useTheme} from '../../context/theme';\nimport {ClassNameProps, GravityIconProps, ImageProps, QAProps, SVGIcon} from '../../models';\nimport {ThemeSupporting, getThemedValue} from '../../utils';\nimport Icon from '../Icon/Icon';\n\ninterface ContentIconProps extends QAProps, ClassNameProps {\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nfunction isIconSvg(icon: ImageProps | SVGIcon): icon is SVGIcon {\n return typeof icon === 'function';\n}\n\nconst ContentIcon = ({icon, className, qa, gravityIcon}: ContentIconProps) => {\n const theme = useTheme();\n const iconThemed = getThemedValue(icon, theme);\n const gravityIconThemed = getThemedValue(gravityIcon, theme);\n\n if (iconThemed && isIconSvg(iconThemed)) {\n const IconComponent = iconThemed;\n return (\n <div>\n <IconComponent className={className} />\n </div>\n );\n }\n\n return <Icon icon={iconThemed} gravityIcon={gravityIconThemed} className={className} qa={qa} />;\n};\n\nexport default ContentIcon;\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* use this for style redefinitions to awoid problems with
|
|
2
|
+
unpredictable css rules order in build */
|
|
3
|
+
.pc-content-labels {
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
}
|
|
8
|
+
.pc-content-labels__label {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
flex-wrap: nowrap;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
padding: 5px 11px;
|
|
14
|
+
background-color: var(--g-color-base-generic);
|
|
15
|
+
border-radius: 6px;
|
|
16
|
+
}
|
|
17
|
+
.pc-content-labels__label, .pc-content-labels__label-text {
|
|
18
|
+
color: var(--g-color-text-primary);
|
|
19
|
+
}
|
|
20
|
+
.pc-content-labels__label > .pc-icon, .pc-content-labels__label > picture {
|
|
21
|
+
display: flex;
|
|
22
|
+
}
|
|
23
|
+
.pc-content-labels__label-icon {
|
|
24
|
+
width: 16px;
|
|
25
|
+
height: 16px;
|
|
26
|
+
margin-inline-end: 6px;
|
|
27
|
+
}
|
|
28
|
+
.pc-content-labels__label_theme_light {
|
|
29
|
+
background-color: var(--g-color-private-black-50);
|
|
30
|
+
}
|
|
31
|
+
.pc-content-labels__label_theme_light,
|
|
32
|
+
.pc-content-labels__label_theme_light .pc-content-labels__label-text {
|
|
33
|
+
color: var(--g-color-text-dark-primary);
|
|
34
|
+
}
|
|
35
|
+
.pc-content-labels__label_theme_dark {
|
|
36
|
+
background-color: var(--g-color-private-white-100);
|
|
37
|
+
}
|
|
38
|
+
.pc-content-labels__label_theme_dark,
|
|
39
|
+
.pc-content-labels__label_theme_dark .pc-content-labels__label-text {
|
|
40
|
+
color: var(--g-color-text-light-primary);
|
|
41
|
+
}
|
|
42
|
+
.pc-content-labels_size_l .pc-content-labels__label, .pc-content-labels_size_m .pc-content-labels__label {
|
|
43
|
+
font-family: var(--g-text-body-font-family);
|
|
44
|
+
font-weight: var(--g-text-body-font-weight);
|
|
45
|
+
font-size: var(--g-text-body-3-font-size);
|
|
46
|
+
line-height: var(--g-text-body-3-line-height);
|
|
47
|
+
}
|
|
48
|
+
.pc-content-labels_size_s .pc-content-labels__label {
|
|
49
|
+
font-family: var(--g-text-body-font-family);
|
|
50
|
+
font-weight: var(--g-text-body-font-weight);
|
|
51
|
+
font-size: var(--g-text-body-2-font-size);
|
|
52
|
+
line-height: var(--g-text-body-2-line-height);
|
|
53
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ClassNameProps, ContentLabelsProps, QAProps } from "../../models/index.js";
|
|
2
|
+
import './ContentLabels.css';
|
|
3
|
+
declare const ContentLabels: ({ className, labels, theme, size, qa, }: ContentLabelsProps & ClassNameProps & QAProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default ContentLabels;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block, getQaAttrubutes } from "../../utils/index.js";
|
|
3
|
+
import ContentIcon from "../ContentIcon/ContentIcon.js";
|
|
4
|
+
import './ContentLabels.css';
|
|
5
|
+
const b = block('content-labels');
|
|
6
|
+
const ContentLabels = ({ className, labels, theme, size = 'l', qa, }) => {
|
|
7
|
+
const qaAttributes = getQaAttrubutes(qa, ['icon', 'text']);
|
|
8
|
+
return (_jsx("div", { className: b({ size }, className), children: labels.map((label) => {
|
|
9
|
+
const { text, icon, gravityIcon } = label;
|
|
10
|
+
return (_jsxs("div", { className: b('label', { theme }), children: [_jsx(ContentIcon, { className: b('label-icon'), icon: icon, gravityIcon: gravityIcon, qa: qaAttributes.icon }), _jsx("span", { className: b('label-text'), "data-qa": qaAttributes.text, children: text })] }, text));
|
|
11
|
+
}) }));
|
|
12
|
+
};
|
|
13
|
+
export default ContentLabels;
|
|
14
|
+
//# sourceMappingURL=ContentLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentLabels.js","sourceRoot":"../../../../src","sources":["components/ContentLabels/ContentLabels.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,6BAAoB;AACnD,OAAO,WAAW,sCAAmC;AAErD,OAAO,qBAAqB,CAAC;AAE7B,MAAM,CAAC,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAElC,MAAM,aAAa,GAAG,CAAC,EACnB,SAAS,EACT,MAAM,EACN,KAAK,EACL,IAAI,GAAG,GAAG,EACV,EAAE,GAC0C,EAAE,EAAE;IAChD,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAE3D,OAAO,CACH,cAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAC,EAAE,SAAS,CAAC,YAC/B,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAClB,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAC,GAAG,KAAK,CAAC;YAExC,OAAO,CACH,eAAgB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,KAAK,EAAC,CAAC,aAC1C,KAAC,WAAW,IACR,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,EAC1B,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,YAAY,CAAC,IAAI,GACvB,EACF,eAAM,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,aAAW,YAAY,CAAC,IAAI,YACvD,IAAI,GACF,KATD,IAAI,CAUR,CACT,CAAC;QACN,CAAC,CAAC,GACA,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {ClassNameProps, ContentLabelsProps, QAProps} from '../../models';\nimport {block, getQaAttrubutes} from '../../utils';\nimport ContentIcon from '../ContentIcon/ContentIcon';\n\nimport './ContentLabels.scss';\n\nconst b = block('content-labels');\n\nconst ContentLabels = ({\n className,\n labels,\n theme,\n size = 'l',\n qa,\n}: ContentLabelsProps & ClassNameProps & QAProps) => {\n const qaAttributes = getQaAttrubutes(qa, ['icon', 'text']);\n\n return (\n <div className={b({size}, className)}>\n {labels.map((label) => {\n const {text, icon, gravityIcon} = label;\n\n return (\n <div key={text} className={b('label', {theme})}>\n <ContentIcon\n className={b('label-icon')}\n icon={icon}\n gravityIcon={gravityIcon}\n qa={qaAttributes.icon}\n />\n <span className={b('label-text')} data-qa={qaAttributes.text}>\n {text}\n </span>\n </div>\n );\n })}\n </div>\n );\n};\n\nexport default ContentLabels;\n"]}
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
import { block } from "../../utils/index.js";
|
|
5
5
|
import { getQaAttrubutes } from "../../utils/blocks.js";
|
|
6
|
+
import ContentIcon from "../ContentIcon/ContentIcon.js";
|
|
6
7
|
import YFMWrapper from "../YFMWrapper/YFMWrapper.js";
|
|
7
|
-
import ItemIcon from "./ContentListItemIcon.js";
|
|
8
8
|
import './ContentList.css';
|
|
9
9
|
const b = block('content-list');
|
|
10
10
|
function getHeadingLevel(size) {
|
|
@@ -20,7 +20,7 @@ const ContentList = ({ list, size = 'l', qa, theme }) => {
|
|
|
20
20
|
const qaAttributes = getQaAttrubutes(qa, ['image', 'title', 'text']);
|
|
21
21
|
return (_jsx("div", { className: b({ size, theme }), "data-qa": qa, children: list?.map((item) => {
|
|
22
22
|
const { icon, title, text, gravityIcon } = item;
|
|
23
|
-
return (_jsxs("div", { className: b('item', { 'without-title': !title }), children: [_jsx(
|
|
23
|
+
return (_jsxs("div", { className: b('item', { 'without-title': !title }), children: [_jsx(ContentIcon, { icon: icon, className: b('icon'), qa: qaAttributes.image, gravityIcon: gravityIcon }), _jsxs("div", { children: [title &&
|
|
24
24
|
React.createElement(getHeadingLevel(size), { className: b('title'), 'data-qa': qaAttributes.title }, _jsx(YFMWrapper, { content: title, modifiers: { constructor: true } })), text && (_jsx(YFMWrapper, { contentClassName: b('text', { 'without-title': !title }), content: text, modifiers: { constructor: true }, qa: qaAttributes.text }))] })] }, uuidv4()));
|
|
25
25
|
}) }));
|
|
26
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentList.js","sourceRoot":"../../../../src","sources":["components/ContentList/ContentList.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,EAAE,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,EAAC,eAAe,EAAC,8BAA2B;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"ContentList.js","sourceRoot":"../../../../src","sources":["components/ContentList/ContentList.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,EAAE,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,EAAC,eAAe,EAAC,8BAA2B;AACnD,OAAO,WAAW,sCAAmC;AACrD,OAAO,UAAU,oCAAiC;AAElD,OAAO,mBAAmB,CAAC;AAE3B,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAEhC,SAAS,eAAe,CAAC,IAAiB;IACtC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,IAAI,CAAC;QAChB,KAAK,GAAG,CAAC;QACT;YACI,OAAO,IAAI,CAAC;IACpB,CAAC;AACL,CAAC;AAED,MAAM,WAAW,GAAG,CAAC,EAAC,IAAI,EAAE,IAAI,GAAG,GAAG,EAAE,EAAE,EAAE,KAAK,EAA6B,EAAE,EAAE;IAC9E,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IAErE,OAAO,CACH,cAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,aAAW,EAAE,YACxC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAC,GAAG,IAAI,CAAC;YAC9C,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAC,eAAe,EAAE,CAAC,KAAK,EAAC,CAAC,aAChD,KAAC,WAAW,IACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EACpB,EAAE,EAAE,YAAY,CAAC,KAAK,EACtB,WAAW,EAAE,WAAW,GAC1B,EACF,0BACK,KAAK;gCACF,KAAK,CAAC,aAAa,CACf,eAAe,CAAC,IAAI,CAAC,EACrB,EAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,YAAY,CAAC,KAAK,EAAC,EACtD,KAAC,UAAU,IAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAC,WAAW,EAAE,IAAI,EAAC,GAAI,CACjE,EACJ,IAAI,IAAI,CACL,KAAC,UAAU,IACP,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,EAAC,eAAe,EAAE,CAAC,KAAK,EAAC,CAAC,EACtD,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,EAAC,WAAW,EAAE,IAAI,EAAC,EAC9B,EAAE,EAAE,YAAY,CAAC,IAAI,GACvB,CACL,IACC,KAtBiD,MAAM,EAAE,CAuB7D,CACT,CAAC;QACN,CAAC,CAAC,GACA,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {v4 as uuidv4} from 'uuid';\n\nimport {ContentListProps, ContentSize} from '../../models';\nimport {QAProps} from '../../models/common';\nimport {block} from '../../utils';\nimport {getQaAttrubutes} from '../../utils/blocks';\nimport ContentIcon from '../ContentIcon/ContentIcon';\nimport YFMWrapper from '../YFMWrapper/YFMWrapper';\n\nimport './ContentList.scss';\n\nconst b = block('content-list');\n\nfunction getHeadingLevel(size: ContentSize) {\n switch (size) {\n case 's':\n return 'h4';\n case 'l':\n default:\n return 'h3';\n }\n}\n\nconst ContentList = ({list, size = 'l', qa, theme}: ContentListProps & QAProps) => {\n const qaAttributes = getQaAttrubutes(qa, ['image', 'title', 'text']);\n\n return (\n <div className={b({size, theme})} data-qa={qa}>\n {list?.map((item) => {\n const {icon, title, text, gravityIcon} = item;\n return (\n <div className={b('item', {'without-title': !title})} key={uuidv4()}>\n <ContentIcon\n icon={icon}\n className={b('icon')}\n qa={qaAttributes.image}\n gravityIcon={gravityIcon}\n />\n <div>\n {title &&\n React.createElement(\n getHeadingLevel(size),\n {className: b('title'), 'data-qa': qaAttributes.title},\n <YFMWrapper content={title} modifiers={{constructor: true}} />,\n )}\n {text && (\n <YFMWrapper\n contentClassName={b('text', {'without-title': !title})}\n content={text}\n modifiers={{constructor: true}}\n qa={qaAttributes.text}\n />\n )}\n </div>\n </div>\n );\n })}\n </div>\n );\n};\n\nexport default ContentList;\n"]}
|