@gravity-ui/page-constructor 7.4.0 → 7.6.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/ContentLayout/ContentLayout.js +4 -2
- package/build/cjs/blocks/ContentLayout/ContentLayout.js.map +1 -1
- package/build/cjs/blocks/Header/Header.js +6 -13
- package/build/cjs/blocks/Header/Header.js.map +1 -1
- package/build/cjs/components/IconWrapper/IconWrapper.css +13 -1
- package/build/cjs/components/IconWrapper/IconWrapper.js +2 -2
- package/build/cjs/components/IconWrapper/IconWrapper.js.map +1 -1
- package/build/cjs/containers/PageConstructor/Provider.js +2 -0
- package/build/cjs/containers/PageConstructor/Provider.js.map +1 -1
- package/build/cjs/context/windowWidthContext/BreakpointContext.d.ts +4 -0
- package/build/cjs/context/windowWidthContext/BreakpointContext.js +33 -0
- package/build/cjs/context/windowWidthContext/BreakpointContext.js.map +1 -0
- package/build/cjs/context/windowWidthContext/index.d.ts +1 -0
- package/build/cjs/context/windowWidthContext/index.js +5 -0
- package/build/cjs/context/windowWidthContext/index.js.map +1 -0
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +3 -2
- package/build/cjs/models/constructor-items/sub-blocks.js.map +1 -1
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js +2 -2
- package/build/cjs/sub-blocks/BackgroundCard/BackgroundCard.js.map +1 -1
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js +2 -2
- package/build/cjs/sub-blocks/BasicCard/BasicCard.js.map +1 -1
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js +2 -2
- package/build/cjs/sub-blocks/LayoutItem/LayoutItem.js.map +1 -1
- package/build/esm/blocks/ContentLayout/ContentLayout.js +4 -2
- package/build/esm/blocks/ContentLayout/ContentLayout.js.map +1 -1
- package/build/esm/blocks/Header/Header.js +6 -13
- package/build/esm/blocks/Header/Header.js.map +1 -1
- package/build/esm/components/IconWrapper/IconWrapper.css +13 -1
- package/build/esm/components/IconWrapper/IconWrapper.js +2 -2
- package/build/esm/components/IconWrapper/IconWrapper.js.map +1 -1
- package/build/esm/containers/PageConstructor/Provider.js +2 -0
- package/build/esm/containers/PageConstructor/Provider.js.map +1 -1
- package/build/esm/context/windowWidthContext/BreakpointContext.d.ts +4 -0
- package/build/esm/context/windowWidthContext/BreakpointContext.js +27 -0
- package/build/esm/context/windowWidthContext/BreakpointContext.js.map +1 -0
- package/build/esm/context/windowWidthContext/index.d.ts +1 -0
- package/build/esm/context/windowWidthContext/index.js +2 -0
- package/build/esm/context/windowWidthContext/index.js.map +1 -0
- package/build/esm/models/constructor-items/sub-blocks.d.ts +3 -2
- package/build/esm/models/constructor-items/sub-blocks.js.map +1 -1
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js +2 -2
- package/build/esm/sub-blocks/BackgroundCard/BackgroundCard.js.map +1 -1
- package/build/esm/sub-blocks/BasicCard/BasicCard.js +2 -2
- package/build/esm/sub-blocks/BasicCard/BasicCard.js.map +1 -1
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js +2 -2
- package/build/esm/sub-blocks/LayoutItem/LayoutItem.js.map +1 -1
- package/package.json +1 -1
- package/server/models/constructor-items/sub-blocks.d.ts +3 -2
- package/widget/index.js +1 -1
|
@@ -6,11 +6,12 @@ const react_1 = require("react");
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const React = tslib_1.__importStar(require("react"));
|
|
8
8
|
const components_1 = require("../../components/index.js");
|
|
9
|
-
const mobileContext_1 = require("../../context/mobileContext/index.js");
|
|
10
9
|
const theme_1 = require("../../context/theme/index.js");
|
|
11
10
|
const grid_1 = require("../../grid/index.js");
|
|
12
11
|
const sub_blocks_1 = require("../../sub-blocks/index.js");
|
|
13
12
|
const utils_1 = require("../../utils/index.js");
|
|
13
|
+
const windowWidthContext_1 = require("../../context/windowWidthContext/index.js");
|
|
14
|
+
const constants_1 = require("../../constants.js");
|
|
14
15
|
const b = (0, utils_1.block)('content-layout-block');
|
|
15
16
|
function getFileTextSize(size) {
|
|
16
17
|
switch (size) {
|
|
@@ -33,7 +34,8 @@ function getTextWidth(size) {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
const ContentLayoutBlock = (props) => {
|
|
36
|
-
const
|
|
37
|
+
const windowWidth = (0, windowWidthContext_1.useWindowWidth)();
|
|
38
|
+
const isMobile = windowWidth <= constants_1.BREAKPOINTS.sm;
|
|
37
39
|
const { textContent, fileContent, size = 'l', background, centered, theme = 'default', textWidth = 'm', } = props;
|
|
38
40
|
const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);
|
|
39
41
|
const globalTheme = (0, theme_1.useTheme)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAA+B;AAE/B,0DAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;;;;;AAAA,qDAA+B;AAE/B,0DAA2D;AAC3D,wDAA6C;AAC7C,8CAA+B;AAE/B,0DAAyC;AACzC,gDAAkD;AAGlD,kFAAgE;AAChE,kDAA4C;AAE5C,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,sBAAsB,CAAC,CAAC;AAExC,SAAS,eAAe,CAAC,IAAiB;IACtC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,GAAG,CAAC;QACf,KAAK,GAAG,CAAC;QACT;YACI,OAAO,GAAG,CAAC;IACnB,CAAC;AACL,CAAC;AAED,SAAS,YAAY,CAAC,IAAqB;IACvC,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,GAAG;YACJ,OAAO,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAC,CAAC;QAC5B,K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AAQ,YAC9D,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACvB,2BAAC,qBAAQ,IACL,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,KAChB,IAAI,EACR,GAAG,EAAE,IAAI,CAAC,IAAI,EACd,IAAI,EAAC,YAAY,EACjB,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC,EAC/B,KAAK,EAAE,KAAK,GACd,CACL,CAAC,GACA,CACT,EACA,UAAU,IAAI,CACX,gCAAK,SAAS,EAAE,CAAC,CAAC,YAAY,CAAC,YAC3B,uBAAC,4BAAe,IACZ,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,KAC3B,gBAAgB,EACpB,IAAI,EAAE,QAAQ,GAChB,GACA,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;AArDW,QAAA,kBAAkB,sBAqD7B;AACF,kBAAe,0BAAkB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, FileLink} from '../../components';\nimport {useTheme} from '../../context/theme';\nimport {Col} from '../../grid';\nimport {ContentLayoutBlockProps, ContentSize, ContentTextSize} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport './ContentLayout.scss';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst b = block('content-layout-block');\n\nfunction getFileTextSize(size: ContentSize) {\n switch (size) {\n case 's':\n return 's';\n case 'l':\n default:\n return 'l';\n }\n}\n\nfunction getTextWidth(size: ContentTextSize) {\n switch (size) {\n case 's':\n return {all: 12, md: 6};\n case 'l':\n return {all: 12, md: 12};\n case 'm':\n default:\n return {all: 12, md: 8};\n }\n}\n\nexport const ContentLayoutBlock = (props: ContentLayoutBlockProps) => {\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n\n const {\n textContent,\n fileContent,\n size = 'l',\n background,\n centered,\n theme = 'default',\n textWidth = 'm',\n } = props;\n\n const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);\n const globalTheme = useTheme();\n const themedBackground = getThemedValue(background, globalTheme);\n\n return (\n <div className={b({size, theme, background: Boolean(background)})}>\n <Content\n className={b('content')}\n {...textContent}\n size={size}\n centered={centered}\n colSizes={colSizes}\n theme={theme}\n />\n {fileContent && (\n <Col className={b('files', {size, centered})} reset sizes={colSizes}>\n {fileContent.map((file) => (\n <FileLink\n className={b('file')}\n {...file}\n key={file.href}\n type=\"horizontal\"\n textSize={getFileTextSize(size)}\n theme={theme}\n />\n ))}\n </Col>\n )}\n {background && (\n <div className={b('background')}>\n <BackgroundImage\n className={b('background-item')}\n {...themedBackground}\n hide={isMobile}\n />\n </div>\n )}\n </div>\n );\n};\nexport default ContentLayoutBlock;\n"]}
|
|
@@ -5,17 +5,17 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
/* eslint-disable complexity */
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
|
-
const React = tslib_1.__importStar(require("react"));
|
|
9
8
|
const components_1 = require("../../components/index.js");
|
|
10
9
|
const HeaderBreadcrumbs_1 = tslib_1.__importDefault(require("../../components/HeaderBreadcrumbs/HeaderBreadcrumbs.js"));
|
|
11
10
|
const utils_1 = require("../../components/Media/Image/utils.js");
|
|
12
11
|
const YFMWrapper_1 = tslib_1.__importDefault(require("../../components/YFMWrapper/YFMWrapper.js"));
|
|
13
|
-
const mobileContext_1 = require("../../context/mobileContext/index.js");
|
|
14
12
|
const theme_1 = require("../../context/theme/index.js");
|
|
15
13
|
const grid_1 = require("../../grid/index.js");
|
|
16
14
|
const utils_2 = require("../../utils/index.js");
|
|
17
15
|
const microdata_1 = require("../../utils/microdata.js");
|
|
18
16
|
const utils_3 = require("./utils.js");
|
|
17
|
+
const windowWidthContext_1 = require("../../context/windowWidthContext/index.js");
|
|
18
|
+
const constants_1 = require("../../constants.js");
|
|
19
19
|
const b = (0, utils_2.block)('header-block');
|
|
20
20
|
const Background = ({ background, isMobile }) => {
|
|
21
21
|
const { url, image, fullWidthMedia, video, color } = background;
|
|
@@ -26,7 +26,8 @@ const Background = ({ background, isMobile }) => {
|
|
|
26
26
|
const FullWidthBackground = ({ background }) => ((0, jsx_runtime_1.jsx)("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background?.color } }));
|
|
27
27
|
const HeaderBlock = (props) => {
|
|
28
28
|
const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, renderTitle, children, mediaView = 'full', centered, additionalInfo, } = props;
|
|
29
|
-
const
|
|
29
|
+
const windowWidth = (0, windowWidthContext_1.useWindowWidth)();
|
|
30
|
+
const isMobile = windowWidth <= constants_1.BREAKPOINTS.sm;
|
|
30
31
|
const theme = (0, theme_1.useTheme)();
|
|
31
32
|
const hasRightSideImage = Boolean((image || video) && !centered);
|
|
32
33
|
const curImageSize = imageSize || (0, utils_3.getImageSize)(width);
|
|
@@ -38,10 +39,7 @@ const HeaderBlock = (props) => {
|
|
|
38
39
|
const backgroundThemed = background && (0, utils_2.getThemedValue)(background, theme);
|
|
39
40
|
const imageThemed = image && (0, utils_2.getThemedValue)(image, theme);
|
|
40
41
|
const videoThemed = video && (0, utils_2.getThemedValue)(video, theme);
|
|
41
|
-
const mediaWithMicrodata = (0, microdata_1.mergeVideoMicrodata)({ video: videoThemed, image: imageThemed }, {
|
|
42
|
-
name: title,
|
|
43
|
-
description,
|
|
44
|
-
});
|
|
42
|
+
const mediaWithMicrodata = (0, microdata_1.mergeVideoMicrodata)({ video: videoThemed, image: imageThemed }, { name: title, description });
|
|
45
43
|
const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;
|
|
46
44
|
const titleId = (0, uikit_1.useUniqId)();
|
|
47
45
|
return ((0, jsx_runtime_1.jsxs)("header", { className: b({
|
|
@@ -53,12 +51,7 @@ const HeaderBlock = (props) => {
|
|
|
53
51
|
offset,
|
|
54
52
|
theme: textTheme,
|
|
55
53
|
'vertical-offset': curVerticalOffset,
|
|
56
|
-
}), children: (0, jsx_runtime_1.jsxs)(grid_1.Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && ((0, jsx_runtime_1.jsx)("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? ((0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: {
|
|
57
|
-
constructor: true,
|
|
58
|
-
} })) : (overtitle) })), (0, jsx_runtime_1.jsxs)(YFMWrapper_1.default, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: {
|
|
59
|
-
constructor: true,
|
|
60
|
-
constructorTheme: textTheme,
|
|
61
|
-
}, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && ((0, jsx_runtime_1.jsx)("div", { className: b('description', { theme: textTheme }), children: (0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { content: description, modifiers: {
|
|
54
|
+
}), children: (0, jsx_runtime_1.jsxs)(grid_1.Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && ((0, jsx_runtime_1.jsx)("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? ((0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: { constructor: true } })) : (overtitle) })), (0, jsx_runtime_1.jsxs)(YFMWrapper_1.default, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: { constructor: true, constructorTheme: textTheme }, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && ((0, jsx_runtime_1.jsx)("div", { className: b('description', { theme: textTheme }), children: (0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { content: description, modifiers: {
|
|
62
55
|
constructor: true,
|
|
63
56
|
constructorTheme: textTheme,
|
|
64
57
|
} }) })), additionalInfo && ((0, jsx_runtime_1.jsx)("div", { className: b('additional-info', { theme: textTheme }), children: (0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { content: additionalInfo, modifiers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"../../../../src","sources":["blocks/Header/Header.tsx"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,6CAA4C;AAC5C,qDAA+B;AAE/B,0DAA2D;AAC3D,wHAAqF;AACrF,iEAAiE;AACjE,mGAAgE;AAChE,wEAA0D;AAC1D,wDAA6C;AAC7C,8CAA0C;AAE1C,gDAAkD;AAClD,wDAA0D;AAE1D,sCAAyE;AAGzE,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,cAAc,CAAC,CAAC;AAShC,MAAM,UAAU,GAAG,CAAC,EAAC,UAAU,EAAE,QAAQ,EAAkB,EAAE,EAAE;IAC3D,MAAM,EAAC,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAC,GAAG,UAAU,CAAC;IAC9D,MAAM,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC,IAAA,qBAAa,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACrD,MAAM,WAAW,GAAG,CAAC,QAAQ,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,QAAQ,IAAI,KAAK,CAAC,CAAC;IAElF,OAAO,CACH,gCACI,SAAS,EAAE,CAAC,CAAC,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,cAAc,EAAC,CAAC,EAC7E,KAAK,EAAE,EAAC,eAAe,EAAE,KAAK,EAAC,YAE9B,WAAW,IAAI,CACZ,uBAAC,kBAAK,OACE,UAAU,EACd,SAAS,EAAE,CAAC,CAAC,kBAAkB,CAAC,EAChC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,YAAY,EAAE,IA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@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {Button, Media, RouterLink} from '../../components';\nimport HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, Row} from '../../grid';\nimport {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';\nimport './Header.scss';\n\nconst b = block('header-block');\n\nexport type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps;\n\ninterface BackgroundProps {\n background: HeaderBlockBackground;\n isMobile: boolean;\n}\n\nconst Background = ({background, isMobile}: BackgroundProps) => {\n const {url, image, fullWidthMedia, video, color} = background;\n const imageObject = url ? getMediaImage(url) : image;\n const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);\n\n return (\n <div\n className={b('background', {media: true, 'full-width-media': fullWidthMedia})}\n style={{backgroundColor: color}}\n >\n {renderMedia && (\n <Media\n {...background}\n className={b('background-media')}\n imageClassName={b('image')}\n videoClassName={b('video')}\n isBackground={true}\n parallax={false}\n video={isMobile ? undefined : video}\n image={imageObject}\n />\n )}\n </div>\n );\n};\n\ninterface FullWidthBackgroundProps {\n background: HeaderBlockBackground;\n}\n\nconst FullWidthBackground = ({background}: FullWidthBackgroundProps) => (\n <div\n className={b('background', {['full-width']: true})}\n style={{backgroundColor: background?.color}}\n />\n);\n\nexport const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>) => {\n const {\n title,\n overtitle,\n description,\n buttons,\n image,\n video,\n width = 'm',\n imageSize,\n offset = 'default',\n background,\n theme: textTheme = 'light',\n verticalOffset = 'm',\n className,\n breadcrumbs,\n status,\n renderTitle,\n children,\n mediaView = 'full',\n centered,\n additionalInfo,\n } = props;\n const isMobile = React.useContext(MobileContext);\n const theme = useTheme();\n const hasRightSideImage = Boolean((image || video) && !centered);\n const curImageSize = imageSize || getImageSize(width);\n const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);\n let curVerticalOffset = verticalOffset;\n\n if (hasRightSideImage && !verticalOffset) {\n curVerticalOffset = 'm';\n }\n\n const backgroundThemed = background && getThemedValue(background, theme);\n const imageThemed = image && getThemedValue(image, theme);\n const videoThemed = video && getThemedValue(video, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(\n {video: videoThemed, image: imageThemed},\n {\n name: title,\n description,\n },\n );\n const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;\n const titleId = useUniqId();\n\n return (\n <header\n className={b(\n {\n ['has-media']: hasRightSideImage,\n ['full-width']: fullWidth,\n ['media-view']: mediaView,\n ['controls-view']: textTheme,\n },\n className,\n )}\n >\n {backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}\n {backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}\n <Grid containerClass={b('container-fluid')}>\n {breadcrumbs && (\n <Row className={b('breadcrumbs')}>\n <Col>\n <HeaderBreadcrumbs {...breadcrumbs} theme={textTheme} />\n </Col>\n </Row>\n )}\n <Row>\n <Col reset className={b('content-wrapper')}>\n <Row>\n <Col\n className={b('content', {\n offset,\n theme: textTheme,\n 'vertical-offset': curVerticalOffset,\n })}\n >\n <Col sizes={titleSizes} className={b('content-inner', {centered})}>\n {overtitle && (\n <div className={b('overtitle')}>\n {typeof overtitle === 'string' ? (\n <YFMWrapper\n tagName=\"div\"\n className={b('overtitle')}\n content={overtitle}\n modifiers={{\n constructor: true,\n }}\n />\n ) : (\n overtitle\n )}\n </div>\n )}\n <YFMWrapper\n content={title}\n contentClassName={b('title')}\n className={b('title-container')}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n tagName=\"h1\"\n contentPosition=\"end\"\n >\n {status}\n {renderTitle ? renderTitle(title) : null}\n </YFMWrapper>\n {description && (\n <div className={b('description', {theme: textTheme})}>\n <YFMWrapper\n content={description}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {additionalInfo && (\n <div className={b('additional-info', {theme: textTheme})}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {buttons && (\n <div className={b('buttons')} data-qa=\"header-buttons\">\n {buttons.map((button, index) => (\n <RouterLink href={button.url} key={index}>\n <Button\n key={index}\n className={b('button')}\n size=\"xl\"\n extraProps={{\n 'aria-describedby': titleId,\n ...button.extraProps,\n }}\n {...button}\n />\n </RouterLink>\n ))}\n </div>\n )}\n {children}\n </Col>\n </Col>\n </Row>\n {hasRightSideImage && (\n <Media\n className={b('media', {[curImageSize]: true})}\n videoClassName={b('video')}\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n />\n )}\n </Col>\n </Row>\n </Grid>\n </header>\n );\n};\n\nexport default HeaderBlock;\n"]}
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"../../../../src","sources":["blocks/Header/Header.tsx"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,6CAA4C;AAG5C,0DAA2D;AAC3D,wHAAqF;AACrF,iEAAiE;AACjE,mGAAgE;AAChE,wDAA6C;AAC7C,8CAA0C;AAE1C,gDAAkD;AAClD,wDAA0D;AAE1D,sCAAyE;AAEzE,kFAAgE;AAChE,kDAA4C;AAE5C,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,cAAc,CAAC,CAAC;AAShC,MAAM,UAAU,GAAG,CAAC,EAAC,UAAU,EAAE,QAAQ,EAAkB,EAAE,EAAE;IAC3D,MAAM,EAAC,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,EAAC,GAAG,UAAU,CAAC;IAC9D,MAAM,WAAW,GAAG,GAAG,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CAAC,QAAQ,CAAC,EACtB,IAAI,EAAC,IAAI,EACT,UAAU,EAAE;gEACR,kBAAkB,EAAE,OAAO;gEAC3B,GAAG,MAAM,CAAC,UAAU;6DACvB,KACG,MAAM,IAPL,KAAK,CAQZ,IAV6B,KAAK,CAW3B,CAChB,CAAC,GACA,CACT,EACA,QAAQ,IACP,GACJ,GACJ,EACL,iBAAiB,IAAI,CAClB,uBAAC,kBAAK,IACF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAC,CAAC,EAC7C,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KACtB,kBAAkB,GACxB,CACL,IACC,GACJ,IACH,IACF,CACZ,CAAC;AACN,CAAC,CAAC;AAhKW,QAAA,WAAW,eAgKtB;AAEF,kBAAe,mBAAW,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport {useUniqId} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {Button, Media, RouterLink} from '../../components';\nimport HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, Row} from '../../grid';\nimport {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';\nimport './Header.scss';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst b = block('header-block');\n\nexport type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps;\n\ninterface BackgroundProps {\n background: HeaderBlockBackground;\n isMobile: boolean;\n}\n\nconst Background = ({background, isMobile}: BackgroundProps) => {\n const {url, image, fullWidthMedia, video, color} = background;\n const imageObject = url ? getMediaImage(url) : image;\n const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);\n\n return (\n <div\n className={b('background', {media: true, 'full-width-media': fullWidthMedia})}\n style={{backgroundColor: color}}\n >\n {renderMedia && (\n <Media\n {...background}\n className={b('background-media')}\n imageClassName={b('image')}\n videoClassName={b('video')}\n isBackground={true}\n parallax={false}\n video={isMobile ? undefined : video}\n image={imageObject}\n />\n )}\n </div>\n );\n};\n\ninterface FullWidthBackgroundProps {\n background: HeaderBlockBackground;\n}\n\nconst FullWidthBackground = ({background}: FullWidthBackgroundProps) => (\n <div\n className={b('background', {['full-width']: true})}\n style={{backgroundColor: background?.color}}\n />\n);\n\nexport const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>) => {\n const {\n title,\n overtitle,\n description,\n buttons,\n image,\n video,\n width = 'm',\n imageSize,\n offset = 'default',\n background,\n theme: textTheme = 'light',\n verticalOffset = 'm',\n className,\n breadcrumbs,\n status,\n renderTitle,\n children,\n mediaView = 'full',\n centered,\n additionalInfo,\n } = props;\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n const theme = useTheme();\n const hasRightSideImage = Boolean((image || video) && !centered);\n const curImageSize = imageSize || getImageSize(width);\n const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);\n let curVerticalOffset = verticalOffset;\n\n if (hasRightSideImage && !verticalOffset) {\n curVerticalOffset = 'm';\n }\n\n const backgroundThemed = background && getThemedValue(background, theme);\n const imageThemed = image && getThemedValue(image, theme);\n const videoThemed = video && getThemedValue(video, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(\n {video: videoThemed, image: imageThemed},\n {name: title, description},\n );\n const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;\n const titleId = useUniqId();\n\n return (\n <header\n className={b(\n {\n ['has-media']: hasRightSideImage,\n ['full-width']: fullWidth,\n ['media-view']: mediaView,\n ['controls-view']: textTheme,\n },\n className,\n )}\n >\n {backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}\n {backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}\n <Grid containerClass={b('container-fluid')}>\n {breadcrumbs && (\n <Row className={b('breadcrumbs')}>\n <Col>\n <HeaderBreadcrumbs {...breadcrumbs} theme={textTheme} />\n </Col>\n </Row>\n )}\n <Row>\n <Col reset className={b('content-wrapper')}>\n <Row>\n <Col\n className={b('content', {\n offset,\n theme: textTheme,\n 'vertical-offset': curVerticalOffset,\n })}\n >\n <Col sizes={titleSizes} className={b('content-inner', {centered})}>\n {overtitle && (\n <div className={b('overtitle')}>\n {typeof overtitle === 'string' ? (\n <YFMWrapper\n tagName=\"div\"\n className={b('overtitle')}\n content={overtitle}\n modifiers={{constructor: true}}\n />\n ) : (\n overtitle\n )}\n </div>\n )}\n <YFMWrapper\n content={title}\n contentClassName={b('title')}\n className={b('title-container')}\n modifiers={{constructor: true, constructorTheme: textTheme}}\n tagName=\"h1\"\n contentPosition=\"end\"\n >\n {status}\n {renderTitle ? renderTitle(title) : null}\n </YFMWrapper>\n {description && (\n <div className={b('description', {theme: textTheme})}>\n <YFMWrapper\n content={description}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {additionalInfo && (\n <div className={b('additional-info', {theme: textTheme})}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {buttons && (\n <div className={b('buttons')} data-qa=\"header-buttons\">\n {buttons.map((button, index) => (\n <RouterLink href={button.url} key={index}>\n <Button\n key={index}\n className={b('button')}\n size=\"xl\"\n extraProps={{\n 'aria-describedby': titleId,\n ...button.extraProps,\n }}\n {...button}\n />\n </RouterLink>\n ))}\n </div>\n )}\n {children}\n </Col>\n </Col>\n </Row>\n {hasRightSideImage && (\n <Media\n className={b('media', {[curImageSize]: true})}\n videoClassName={b('video')}\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n />\n )}\n </Col>\n </Row>\n </Grid>\n </header>\n );\n};\n\nexport default HeaderBlock;\n"]}
|
|
@@ -20,7 +20,19 @@ unpredictable css rules order in build */
|
|
|
20
20
|
.pc-icon-wrapper__icon_icon-position_left {
|
|
21
21
|
height: 22px;
|
|
22
22
|
width: 22px;
|
|
23
|
-
margin: 1px 12px 1px
|
|
23
|
+
margin: 1px 12px 1px 0;
|
|
24
|
+
}
|
|
25
|
+
.pc-icon-wrapper__icon_icon-position_left.pc-icon-wrapper__icon_size_m {
|
|
26
|
+
height: 28px;
|
|
27
|
+
width: 28px;
|
|
28
|
+
margin-bottom: 4px;
|
|
29
|
+
margin-top: 4px;
|
|
30
|
+
}
|
|
31
|
+
.pc-icon-wrapper__icon_icon-position_left.pc-icon-wrapper__icon_size_l {
|
|
32
|
+
height: 30px;
|
|
33
|
+
width: 30px;
|
|
34
|
+
margin-bottom: 4px;
|
|
35
|
+
margin-top: 4px;
|
|
24
36
|
}
|
|
25
37
|
.pc-icon-wrapper__content {
|
|
26
38
|
display: flex;
|
|
@@ -8,13 +8,13 @@ const Image_1 = tslib_1.__importDefault(require("../Image/Image.js"));
|
|
|
8
8
|
const utils_2 = require("../Media/Image/utils.js");
|
|
9
9
|
const b = (0, utils_1.block)('icon-wrapper');
|
|
10
10
|
const IconWrapper = (props) => {
|
|
11
|
-
const { icon, children, className } = props;
|
|
11
|
+
const { icon, children, className, size } = props;
|
|
12
12
|
if (!icon) {
|
|
13
13
|
return (0, jsx_runtime_1.jsx)(React.Fragment, { children: children });
|
|
14
14
|
}
|
|
15
15
|
const iconProps = (0, utils_2.getMediaImage)(icon.value);
|
|
16
16
|
const iconPosition = icon?.position;
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: b({ ['icon-position']: iconPosition }, className), children: [iconProps && ((0, jsx_runtime_1.jsx)(Image_1.default, { ...iconProps, containerClassName: b('icon-container'), className: b('icon', { ['icon-position']: iconPosition }) })), (0, jsx_runtime_1.jsx)("div", { className: b('content', { ['icon-position']: iconPosition }), children: children })] }));
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: b({ ['icon-position']: iconPosition }, className), children: [iconProps && ((0, jsx_runtime_1.jsx)(Image_1.default, { ...iconProps, containerClassName: b('icon-container'), className: b('icon', { ['icon-position']: iconPosition, size }) })), (0, jsx_runtime_1.jsx)("div", { className: b('content', { ['icon-position']: iconPosition }), children: children })] }));
|
|
18
18
|
};
|
|
19
19
|
exports.default = IconWrapper;
|
|
20
20
|
//# sourceMappingURL=IconWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWrapper.js","sourceRoot":"../../../../src","sources":["components/IconWrapper/IconWrapper.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAG/B,gDAAkC;AAClC,sEAAmC;AACnC,mDAAmD;AAInD,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,cAAc,CAAC,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC,KAAiE,EAAE,EAAE;IACtF,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAC,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"IconWrapper.js","sourceRoot":"../../../../src","sources":["components/IconWrapper/IconWrapper.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAG/B,gDAAkC;AAClC,sEAAmC;AACnC,mDAAmD;AAInD,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,cAAc,CAAC,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC,KAAiE,EAAE,EAAE;IACtF,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAC,GAAG,KAAK,CAAC;IAChD,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,uBAAC,KAAK,CAAC,QAAQ,cAAE,QAAQ,GAAkB,CAAC;IACvD,CAAC;IAED,MAAM,SAAS,GAAG,IAAA,qBAAa,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,YAAY,GAAG,IAAI,EAAE,QAAQ,CAAC;IAEpC,OAAO,CACH,iCAAK,SAAS,EAAE,CAAC,CAAC,EAAC,CAAC,eAAe,CAAC,EAAE,YAAY,EAAC,EAAE,SAAS,CAAC,aAC1D,SAAS,IAAI,CACV,uBAAC,eAAK,OACE,SAAS,EACb,kBAAkB,EAAE,CAAC,CAAC,gBAAgB,CAAC,EACvC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAC,CAAC,eAAe,CAAC,EAAE,YAAY,EAAE,IAAI,EAAC,CAAC,GAC/D,CACL,EACD,gCAAK,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,EAAC,CAAC,eAAe,CAAC,EAAE,YAAY,EAAC,CAAC,YAAG,QAAQ,GAAO,IAC/E,CACT,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,WAAW,CAAC","sourcesContent":["import * as React from 'react';\n\nimport type {ClassNameProps, IconWrapperProps} from '../../models';\nimport {block} from '../../utils';\nimport Image from '../Image/Image';\nimport {getMediaImage} from '../Media/Image/utils';\n\nimport './IconWrapper.scss';\n\nconst b = block('icon-wrapper');\n\nconst IconWrapper = (props: React.PropsWithChildren<IconWrapperProps> & ClassNameProps) => {\n const {icon, children, className, size} = props;\n if (!icon) {\n return <React.Fragment>{children}</React.Fragment>;\n }\n\n const iconProps = getMediaImage(icon.value);\n const iconPosition = icon?.position;\n\n return (\n <div className={b({['icon-position']: iconPosition}, className)}>\n {iconProps && (\n <Image\n {...iconProps}\n containerClassName={b('icon-container')}\n className={b('icon', {['icon-position']: iconPosition, size})}\n />\n )}\n <div className={b('content', {['icon-position']: iconPosition})}>{children}</div>\n </div>\n );\n};\n\nexport default IconWrapper;\n"]}
|
|
@@ -15,6 +15,7 @@ const mobileContext_1 = require("../../context/mobileContext/index.js");
|
|
|
15
15
|
const projectSettingsContext_1 = require("../../context/projectSettingsContext/index.js");
|
|
16
16
|
const ssrContext_1 = require("../../context/ssrContext/index.js");
|
|
17
17
|
const theme_1 = require("../../context/theme/index.js");
|
|
18
|
+
const windowWidthContext_1 = require("../../context/windowWidthContext/index.js");
|
|
18
19
|
const PageConstructorProvider = (props) => {
|
|
19
20
|
const { isMobile, mapsContext = mapsContext_1.initialMapValue, locale = {}, location = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = constants_1.DEFAULT_THEME, children, image = {}, forms = FormsContext_1.DEFAULT_FORMS_CONTEXT_VALUE, } = props;
|
|
20
21
|
/* eslint-disable react/jsx-key */
|
|
@@ -29,6 +30,7 @@ const PageConstructorProvider = (props) => {
|
|
|
29
30
|
(0, jsx_runtime_1.jsx)(analyticsContext_1.AnalyticsContext.Provider, { value: analytics }),
|
|
30
31
|
(0, jsx_runtime_1.jsx)(FormsContext_1.FormsContext.Provider, { value: forms }),
|
|
31
32
|
(0, jsx_runtime_1.jsx)(ssrContext_1.SSRContext.Provider, { value: { isServer: ssrConfig?.isServer } }),
|
|
33
|
+
(0, jsx_runtime_1.jsx)(windowWidthContext_1.WindowWidthProvider, {}),
|
|
32
34
|
].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
|
|
33
35
|
/* eslint-enable react/jsx-key */
|
|
34
36
|
return (0, jsx_runtime_1.jsx)(React.Fragment, { children: context });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,6DAAyD;AACzD,8EAAuF;AACvF,6EAIiD;AACjD,sEAA2E;AAC3E,wEAA8E;AAC9E,4EAAoF;AACpF,0EAAoG;AACpG,wEAA0D;AAC1D,0FAG8C;AAC9C,kEAAqE;AACrE,wDAAiD;
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AA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AAS,EAAE,QAAQ,EAAC,GAAI;QAC/D,uBAAC,wCAAmB,KAAG;KAC1B,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IACpF,iCAAiC;IAEjC,OAAO,uBAAC,KAAK,CAAC,QAAQ,cAAE,OAAO,GAAkB,CAAC;AACtD,CAAC,CAAC;AAlCW,QAAA,uBAAuB,2BAkClC","sourcesContent":["import * as React from 'react';\n\nimport {DEFAULT_THEME} from '../../components/constants';\nimport {AnalyticsContext, AnalyticsContextProps} from '../../context/analyticsContext';\nimport {\n DEFAULT_FORMS_CONTEXT_VALUE,\n FormsContext,\n FormsContextProps,\n} from '../../context/formsContext/FormsContext';\nimport {ImageContext, ImageContextProps} from '../../context/imageContext';\nimport {LocaleContext, LocaleContextProps} from '../../context/localeContext';\nimport {LocationContext, LocationContextProps} from '../../context/locationContext';\nimport {MapsContext, MapsContextType, initialMapValue} from '../../context/mapsContext/mapsContext';\nimport {MobileContext} from '../../context/mobileContext';\nimport {\n ProjectSettingsContext,\n ProjectSettingsContextProps,\n} from '../../context/projectSettingsContext';\nimport {SSRContext, SSRContextProps} from '../../context/ssrContext';\nimport {ThemeContext} from '../../context/theme';\nimport {Theme} from '../../models';\nimport {WindowWidthProvider} from '../../context/windowWidthContext';\n\nexport interface PageConstructorProviderProps {\n isMobile?: boolean;\n locale?: LocaleContextProps;\n location?: LocationContextProps;\n ssrConfig?: SSRContextProps;\n theme?: Theme;\n mapsContext?: MapsContextType;\n projectSettings?: ProjectSettingsContextProps;\n analytics?: AnalyticsContextProps;\n forms?: FormsContextProps;\n image?: ImageContextProps;\n}\n\nexport const PageConstructorProvider = (\n props: React.PropsWithChildren<PageConstructorProviderProps>,\n) => {\n const {\n isMobile,\n mapsContext = initialMapValue,\n locale = {},\n location = {},\n analytics = {},\n ssrConfig = {},\n projectSettings = {},\n theme = DEFAULT_THEME,\n children,\n image = {},\n forms = DEFAULT_FORMS_CONTEXT_VALUE,\n } = props;\n\n /* eslint-disable react/jsx-key */\n const context = [\n <ThemeContext.Provider value={{theme}} />,\n <ProjectSettingsContext.Provider value={projectSettings} />,\n <LocaleContext.Provider value={locale} />,\n <ImageContext.Provider value={image} />,\n <LocationContext.Provider value={location} />,\n <MobileContext.Provider value={Boolean(isMobile)} />,\n <MapsContext.Provider value={mapsContext} />,\n <AnalyticsContext.Provider value={analytics} />,\n <FormsContext.Provider value={forms} />,\n <SSRContext.Provider value={{isServer: ssrConfig?.isServer}} />,\n <WindowWidthProvider />,\n ].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);\n /* eslint-enable react/jsx-key */\n\n return <React.Fragment>{context}</React.Fragment>;\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const WindowWidthContext: React.Context<number>;
|
|
3
|
+
export declare const WindowWidthProvider: ({ children }: React.PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare const useWindowWidth: () => number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useWindowWidth = exports.WindowWidthProvider = exports.WindowWidthContext = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const React = tslib_1.__importStar(require("react"));
|
|
7
|
+
const throttle_1 = tslib_1.__importDefault(require("lodash/throttle.js"));
|
|
8
|
+
const ssrContext_1 = require("../ssrContext/index.js");
|
|
9
|
+
const constants_1 = require("../../constants.js");
|
|
10
|
+
const DEFAULT_WIDTH = constants_1.BREAKPOINTS.xl;
|
|
11
|
+
const UPDATE_FREQUENCY_MS = 100;
|
|
12
|
+
exports.WindowWidthContext = React.createContext(DEFAULT_WIDTH);
|
|
13
|
+
const WindowWidthProvider = ({ children }) => {
|
|
14
|
+
const { isServer } = React.useContext(ssrContext_1.SSRContext);
|
|
15
|
+
const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
if (isServer) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const handleResize = (0, throttle_1.default)(() => {
|
|
21
|
+
setWindowWidth(window.innerWidth);
|
|
22
|
+
}, UPDATE_FREQUENCY_MS, { leading: true });
|
|
23
|
+
handleResize();
|
|
24
|
+
window.addEventListener('resize', handleResize, { passive: true });
|
|
25
|
+
// eslint-disable-next-line consistent-return
|
|
26
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
27
|
+
}, [isServer]);
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(exports.WindowWidthContext.Provider, { value: windowWidth, children: children }));
|
|
29
|
+
};
|
|
30
|
+
exports.WindowWidthProvider = WindowWidthProvider;
|
|
31
|
+
const useWindowWidth = () => React.useContext(exports.WindowWidthContext);
|
|
32
|
+
exports.useWindowWidth = useWindowWidth;
|
|
33
|
+
//# sourceMappingURL=BreakpointContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BreakpointContext.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/BreakpointContext.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAC/B,0EAAuC;AACvC,uDAAyC;AACzC,kDAA4C;AAE5C,MAAM,aAAa,GAAG,uBAAW,CAAC,EAAE,CAAC;AACrC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEnB,QAAA,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAS,aAAa,CAAC,CAAC;AAEtE,MAAM,mBAAmB,GAAG,CAAC,EAAC,QAAQ,EAA0B,EAAE,EAAE;IACvE,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,uBAAU,CAAC,CAAC;IAEhD,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,QAAQ,EAAE,CAAC;YACX,OAAO;QACX,CAAC;QAED,MAAM,YAAY,GAAG,IAAA,kBAAQ,EACzB,GAAG,EAAE;YACD,cAAc,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACtC,CAAC,EACD,mBAAmB,EACnB,EAAC,OAAO,EAAE,IAAI,EAAC,CAClB,CAAC;QAEF,YAAY,EAAE,CAAC;QAEf,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QAEjE,6CAA6C;QAC7C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACpE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACH,uBAAC,0BAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YAAG,QAAQ,GAA+B,CAC5F,CAAC;AACN,CAAC,CAAC;AA7BW,QAAA,mBAAmB,uBA6B9B;AAEK,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,0BAAkB,CAAC,CAAC;AAA5D,QAAA,cAAc,kBAA8C","sourcesContent":["import * as React from 'react';\nimport throttle from 'lodash/throttle';\nimport {SSRContext} from '../ssrContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst DEFAULT_WIDTH = BREAKPOINTS.xl;\nconst UPDATE_FREQUENCY_MS = 100;\n\nexport const WindowWidthContext = React.createContext<number>(DEFAULT_WIDTH);\n\nexport const WindowWidthProvider = ({children}: React.PropsWithChildren) => {\n const {isServer} = React.useContext(SSRContext);\n\n const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);\n\n React.useEffect(() => {\n if (isServer) {\n return;\n }\n\n const handleResize = throttle(\n () => {\n setWindowWidth(window.innerWidth);\n },\n UPDATE_FREQUENCY_MS,\n {leading: true},\n );\n\n handleResize();\n\n window.addEventListener('resize', handleResize, {passive: true});\n\n // eslint-disable-next-line consistent-return\n return () => window.removeEventListener('resize', handleResize);\n }, [isServer]);\n\n return (\n <WindowWidthContext.Provider value={windowWidth}>{children}</WindowWidthContext.Provider>\n );\n};\n\nexport const useWindowWidth = () => React.useContext(WindowWidthContext);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./BreakpointContext.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/index.ts"],"names":[],"mappings":";;;AAAA,iEAAoC","sourcesContent":["export * from './BreakpointContext';\n"]}
|
|
@@ -35,6 +35,7 @@ export interface PositionedIcon {
|
|
|
35
35
|
}
|
|
36
36
|
export interface IconWrapperProps {
|
|
37
37
|
icon?: PositionedIcon;
|
|
38
|
+
size?: 's' | 'm' | 'l';
|
|
38
39
|
}
|
|
39
40
|
export declare enum ImageCardDirection {
|
|
40
41
|
Direct = "direct",
|
|
@@ -104,7 +105,7 @@ export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase,
|
|
|
104
105
|
paddingBottom?: 's' | 'm' | 'l' | 'xl';
|
|
105
106
|
backgroundColor?: string;
|
|
106
107
|
}
|
|
107
|
-
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | '
|
|
108
|
+
export interface BasicCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'colSizes' | 'centered' | 'theme' | 'controlPosition'> {
|
|
108
109
|
url: string;
|
|
109
110
|
urlTitle?: string;
|
|
110
111
|
icon?: ThemeSupporting<ImageProps>;
|
|
@@ -136,7 +137,7 @@ export interface PriceCardProps extends CardBaseProps, Pick<ContentBlockProps, '
|
|
|
136
137
|
list?: string[];
|
|
137
138
|
}
|
|
138
139
|
export interface LayoutItemProps extends ClassNameProps, CardLayoutProps, AnalyticsEventsBase {
|
|
139
|
-
content: Omit<ContentBlockProps, 'colSizes' | 'centered'
|
|
140
|
+
content: Omit<ContentBlockProps, 'colSizes' | 'centered'>;
|
|
140
141
|
contentMargin?: LayoutItemContentMargin;
|
|
141
142
|
media?: ThemeSupporting<MediaProps>;
|
|
142
143
|
metaInfo?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sub-blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/sub-blocks.ts"],"names":[],"mappings":";;;AA8BA,IAAY,YAoBX;AApBD,WAAY,YAAY;IACpB,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf;;OAEG;IACH,gDAAgC,CAAA;IAChC,wCAAwB,CAAA;IACxB,0CAA0B,CAAA;IAC1B,0CAA0B,CAAA;IAC1B,kDAAkC,CAAA;IAClC,wCAAwB,CAAA;IACxB,mCAAmB,CAAA;IACnB,4CAA4B,CAAA;IAC5B;;OAEG;IACH,6BAAa,CAAA;IACb,wCAAwB,CAAA;IACxB,wCAAwB,CAAA;AAC5B,CAAC,EApBW,YAAY,4BAAZ,YAAY,QAoBvB;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,2BAAW,CAAA;IACX,6BAAa,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;
|
|
1
|
+
{"version":3,"file":"sub-blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/sub-blocks.ts"],"names":[],"mappings":";;;AA8BA,IAAY,YAoBX;AApBD,WAAY,YAAY;IACpB,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf;;OAEG;IACH,gDAAgC,CAAA;IAChC,wCAAwB,CAAA;IACxB,0CAA0B,CAAA;IAC1B,0CAA0B,CAAA;IAC1B,kDAAkC,CAAA;IAClC,wCAAwB,CAAA;IACxB,mCAAmB,CAAA;IACnB,4CAA4B,CAAA;IAC5B;;OAEG;IACH,6BAAa,CAAA;IACb,wCAAwB,CAAA;IACxB,wCAAwB,CAAA;AAC5B,CAAC,EApBW,YAAY,4BAAZ,YAAY,QAoBvB;AAED,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,2BAAW,CAAA;IACX,6BAAa,CAAA;AACjB,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAYD,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;AACvB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAEY,QAAA,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import {ClassNameProps, QuoteType} from '../../models';\nimport {ThemeSupporting} from '../../utils';\nimport {\n HubspotEventData,\n HubspotEventHandlers,\n HubspotFormDefaultValues,\n} from '../../utils/hubspot';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {ContentBlockProps} from './blocks';\nimport {\n AuthorItem,\n ButtonProps,\n CardBaseProps,\n CardLayoutProps,\n ContentTheme,\n DividerSize,\n ImageCardMargins,\n ImageObjectProps,\n ImageProps,\n LayoutItemContentMargin,\n LinkProps,\n MediaProps,\n MediaView,\n PriceDetailedProps,\n TextTheme,\n Themable,\n ThemedImage,\n} from './common';\n\nexport enum SubBlockType {\n Divider = 'divider',\n Quote = 'quote',\n /**\n * @deprecated Will be removed\n */\n PriceDetailed = 'price-detailed',\n MediaCard = 'media-card',\n BannerCard = 'banner-card',\n LayoutItem = 'layout-item',\n BackgroundCard = 'background-card',\n BasicCard = 'basic-card',\n Content = 'content',\n HubspotForm = 'hubspot-form',\n /**\n * @deprecated Will be removed, use BasicCard instead\n */\n Card = 'card',\n PriceCard = 'price-card',\n ImageCard = 'image-card',\n}\n\nexport enum IconPosition {\n Top = 'top',\n Left = 'left',\n}\n\nexport interface PositionedIcon {\n value: ImageProps;\n position?: IconPosition;\n}\n\nexport interface IconWrapperProps {\n icon?: PositionedIcon;\n size?: 's' | 'm' | 'l';\n}\n\nexport enum ImageCardDirection {\n Direct = 'direct',\n Reverse = 'reverse',\n}\n\nexport const SubBlockTypes = Object.values(SubBlockType);\n\nexport interface DividerProps {\n size?: DividerSize;\n border?: boolean;\n}\n\nexport interface HubspotFormProps extends HubspotEventHandlers, AnalyticsEventsBase {\n className?: string;\n theme?: ContentTheme;\n isMobile?: boolean;\n region?: string;\n portalId: string;\n formId: string;\n formInstanceId?: string;\n formClassName?: string;\n\n /**\n * To use this handler for component that is rendered in iframe, set up useLoopBackHubspotEvents hook on top level frame\n */\n onBeforeLoad?: (arg: HubspotEventData) => void;\n\n /**\n * To use this handler for component that is rendered in iframe, set up useLoopBackHubspotEvents hook on top level frame\n */\n onBeforeSubmit?: (arg: HubspotEventData) => void;\n\n /**\n * To use this handler for component that is rendered in iframe, set up useLoopBackHubspotEvents hook on top level frame\n */\n onSubmit?: (arg: HubspotEventData) => void;\n\n /**\n * To use this handler for component that is rendered in iframe, set up useLoopBackHubspotEvents hook on top level frame\n */\n onLoad?: (arg: HubspotEventData) => void;\n hubspotEvents?: string[];\n createDOMElement?: boolean;\n defaultValues?: HubspotFormDefaultValues;\n}\n\n//cards\nexport interface QuoteProps extends Themable, CardBaseProps {\n text?: string;\n // for backward compatibility, yfmText will become property 'text' in major\n yfmText?: string;\n image: ThemedImage;\n logo: ThemeSupporting<ImageProps>;\n color?: string;\n /**\n * @deprecated use property button instead\n */\n url?: string;\n /**\n * @deprecated use property button instead\n */\n urlTitle?: string;\n author?: AuthorItem;\n /**\n * @deprecated use property button instead\n */\n buttonText?: string;\n theme?: TextTheme;\n quoteType?: QuoteType;\n button?: ButtonProps;\n}\n\nexport interface BackgroundCardProps\n extends CardBaseProps,\n AnalyticsEventsBase,\n CardLayoutProps,\n Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {\n url?: string;\n urlTitle?: string;\n background?: ThemeSupporting<ImageObjectProps>;\n paddingBottom?: 's' | 'm' | 'l' | 'xl';\n backgroundColor?: string;\n}\n\nexport interface BasicCardProps\n extends CardBaseProps,\n AnalyticsEventsBase,\n CardLayoutProps,\n Omit<ContentBlockProps, 'colSizes' | 'centered' | 'theme' | 'controlPosition'> {\n url: string;\n urlTitle?: string;\n icon?: ThemeSupporting<ImageProps>;\n target?: string;\n iconPosition?: IconPosition;\n}\n\nexport interface BannerCardProps {\n title: string;\n subtitle?: string;\n className?: string;\n image?: ThemeSupporting<string>;\n disableCompress?: boolean;\n color?: ThemeSupporting<string>;\n theme?: TextTheme;\n button?: Pick<ButtonProps, 'text' | 'url' | 'target' | 'theme'>;\n mediaView?: MediaView;\n}\n\nexport interface MediaCardProps extends MediaProps, AnalyticsEventsBase, CardBaseProps {}\n\nexport interface PriceCardProps extends CardBaseProps, Pick<ContentBlockProps, 'theme'> {\n title: string;\n price: string;\n pricePeriod?: string;\n priceDetails?: string;\n description?: string;\n buttons?: ButtonProps[];\n links?: LinkProps[];\n backgroundColor?: string;\n list?: string[];\n}\n\nexport interface LayoutItemProps extends ClassNameProps, CardLayoutProps, AnalyticsEventsBase {\n content: Omit<ContentBlockProps, 'colSizes' | 'centered'>;\n contentMargin?: LayoutItemContentMargin;\n media?: ThemeSupporting<MediaProps>;\n metaInfo?: string[];\n border?: boolean;\n fullscreen?: boolean;\n icon?: ThemeSupporting<PositionedIcon>;\n}\n\nexport interface ImageCardProps\n extends CardBaseProps,\n CardLayoutProps,\n Omit<ContentBlockProps, 'colSizes' | 'centered' | 'controlPosition'> {\n image: ThemeSupporting<ImageProps>;\n enableImageBorderRadius?: boolean;\n margins?: ImageCardMargins;\n direction?: ImageCardDirection;\n backgroundColor?: string;\n url?: string;\n urlTitle?: string;\n target?: string;\n}\n\n// sub-block models\nexport type DividerModel = {\n type: SubBlockType.Divider;\n} & DividerProps;\n\nexport type QuoteModel = {\n type: SubBlockType.Quote;\n} & QuoteProps;\n\nexport type LayoutItemModel = {\n type: SubBlockType.LayoutItem;\n} & LayoutItemProps;\n\nexport type BackgroundCardModel = {\n type: SubBlockType.BackgroundCard;\n} & BackgroundCardProps;\n\n/** @deprecated */\nexport type PriceDetailedModel = {\n type: SubBlockType.PriceDetailed;\n} & PriceDetailedProps;\n\nexport type MediaCardModel = {\n type: SubBlockType.MediaCard;\n} & MediaCardProps;\n\nexport type HubspotFormModel = {\n type: SubBlockType.HubspotForm;\n} & HubspotFormProps;\n\nexport type BannerCardModel = {\n type: SubBlockType.BannerCard;\n} & BannerCardProps;\n\nexport type BasicCardModel = {\n type: SubBlockType.BasicCard;\n} & BasicCardProps;\n\nexport type PriceCardModel = {\n type: SubBlockType.PriceCard;\n} & PriceCardProps;\n\nexport type ImageCardModel = {\n type: SubBlockType.ImageCard;\n} & ImageCardProps;\n\nexport type SubBlockModels =\n | DividerModel\n | QuoteModel\n | PriceDetailedModel\n | MediaCardModel\n | BackgroundCardModel\n | HubspotFormModel\n | BannerCardModel\n | BasicCardModel\n | PriceCardModel\n | LayoutItemModel\n | ImageCardModel;\n\nexport type SubBlock = SubBlockModels;\n"]}
|
|
@@ -9,13 +9,13 @@ const utils_1 = require("../../utils/index.js");
|
|
|
9
9
|
const Content_1 = tslib_1.__importDefault(require("../Content/Content.js"));
|
|
10
10
|
const b = (0, utils_1.block)('background-card');
|
|
11
11
|
const BackgroundCard = (props) => {
|
|
12
|
-
const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, controlPosition = 'content', list, } = props;
|
|
12
|
+
const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, controlPosition = 'content', list, size = 's', } = props;
|
|
13
13
|
const titleId = (0, uikit_1.useUniqId)();
|
|
14
14
|
const theme = (0, theme_1.useTheme)();
|
|
15
15
|
const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
|
|
16
16
|
const borderType = hasBackgroundColor ? 'none' : border;
|
|
17
17
|
const areControlsInFooter = !paddingBottom && controlPosition === 'footer';
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(components_1.CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), contentClassName: b('content'), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle, children: (0, jsx_runtime_1.jsxs)(components_1.CardBase.Content, { children: [(0, jsx_runtime_1.jsx)(components_1.BackgroundImage, { className: b('image'), ...(0, utils_1.getThemedValue)(background, theme), style: { backgroundColor } }), (0, jsx_runtime_1.jsx)(Content_1.default, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size:
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(components_1.CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), contentClassName: b('content'), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle, children: (0, jsx_runtime_1.jsxs)(components_1.CardBase.Content, { children: [(0, jsx_runtime_1.jsx)(components_1.BackgroundImage, { className: b('image'), ...(0, utils_1.getThemedValue)(background, theme), style: { backgroundColor } }), (0, jsx_runtime_1.jsx)(Content_1.default, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size: size, theme: cardTheme, links: links, buttons: buttons, list: list, colSizes: { all: 12, md: 12 }, controlPosition: areControlsInFooter ? 'bottom' : 'default' })] }) }));
|
|
19
19
|
};
|
|
20
20
|
exports.default = BackgroundCard;
|
|
21
21
|
//# sourceMappingURL=BackgroundCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundCard.js","sourceRoot":"../../../../src","sources":["sub-blocks/BackgroundCard/BackgroundCard.tsx"],"names":[],"mappings":";;;;AAAA,6CAA4C;AAE5C,0DAA4D;AAC5D,wDAA6C;AAE7C,gDAAkD;AAClD,4EAAyC;AAIzC,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,iBAAiB,CAAC,CAAC;AAEnC,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,EAAE;IAClD,MAAM,EACF,GAAG,EACH,KAAK,EACL,IAAI,EACJ,MAAM,EACN,UAAU,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,KAAK,EACL,OAAO,EACP,eAAe,EACf,QAAQ,EACR,eAAe,GAAG,SAAS,EAC3B,IAAI,
|
|
1
|
+
{"version":3,"file":"BackgroundCard.js","sourceRoot":"../../../../src","sources":["sub-blocks/BackgroundCard/BackgroundCard.tsx"],"names":[],"mappings":";;;;AAAA,6CAA4C;AAE5C,0DAA4D;AAC5D,wDAA6C;AAE7C,gDAAkD;AAClD,4EAAyC;AAIzC,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,iBAAiB,CAAC,CAAC;AAEnC,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,EAAE;IAClD,MAAM,EACF,GAAG,EACH,KAAK,EACL,IAAI,EACJ,MAAM,EACN,UAAU,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,KAAK,EAAE,SAAS,GAAG,SAAS,EAC5B,KAAK,EACL,OAAO,EACP,eAAe,EACf,QAAQ,EACR,eAAe,GAAG,SAAS,EAC3B,IAAI,EACJ,IAAI,GAAG,GAAG,GACb,GAAG,KAAK,CAAC;IAEV,MAAM,OAAO,GAAG,IAAA,iBAAS,GAAE,CAAC;IAE5B,MAAM,KAAK,GAAG,IAAA,gBAAQ,GAAE,CAAC;IACzB,MAAM,kBAAkB,GAAG,eAAe,IAAI,SAAS,KAAK,SAAS,CAAC;IACtE,MAAM,UAAU,GAAG,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACxD,MAAM,mBAAmB,GAAG,CAAC,aAAa,IAAI,eAAe,KAAK,QAAQ,CAAC;IAE3E,OAAO,CACH,uBAAC,qBAAQ,IACL,SAAS,EAAE,CAAC,CAAC,EAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAC,CAAC,EACxD,gBAAgB,EAAE,CAAC,CAAC,SAAS,CAAC,EAC9B,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,UAAU,EAClB,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,QAAQ,YAElB,wBAAC,qBAAQ,CAAC,OAAO,eACb,uBAAC,4BAAe,IACZ,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,KACjB,IAAA,sBAAc,EAAC,UAAU,EAAE,KAAK,CAAC,EACrC,KAAK,EAAE,EAAC,eAAe,EAAC,GAC1B,EACF,uBAAC,iBAAO,IACJ,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,cAAc,EAAE,cAAc,EAC9B,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,EAC3B,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAC7D,IACa,GACZ,CACd,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC","sourcesContent":["import {useUniqId} from '@gravity-ui/uikit';\n\nimport {BackgroundImage, CardBase} from '../../components/';\nimport {useTheme} from '../../context/theme';\nimport {BackgroundCardProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport Content from '../Content/Content';\n\nimport './BackgroundCard.scss';\n\nconst b = block('background-card');\n\nconst BackgroundCard = (props: BackgroundCardProps) => {\n const {\n url,\n title,\n text,\n border,\n background,\n paddingBottom,\n backgroundColor,\n additionalInfo,\n theme: cardTheme = 'default',\n links,\n buttons,\n analyticsEvents,\n urlTitle,\n controlPosition = 'content',\n list,\n size = 's',\n } = props;\n\n const titleId = useUniqId();\n\n const theme = useTheme();\n const hasBackgroundColor = backgroundColor || cardTheme !== 'default';\n const borderType = hasBackgroundColor ? 'none' : border;\n const areControlsInFooter = !paddingBottom && controlPosition === 'footer';\n\n return (\n <CardBase\n className={b({padding: paddingBottom, theme: cardTheme})}\n contentClassName={b('content')}\n url={url}\n border={borderType}\n analyticsEvents={analyticsEvents}\n urlTitle={urlTitle}\n >\n <CardBase.Content>\n <BackgroundImage\n className={b('image')}\n {...getThemedValue(background, theme)}\n style={{backgroundColor}}\n />\n <Content\n titleId={titleId}\n title={title}\n text={text}\n additionalInfo={additionalInfo}\n size={size}\n theme={cardTheme}\n links={links}\n buttons={buttons}\n list={list}\n colSizes={{all: 12, md: 12}}\n controlPosition={areControlsInFooter ? 'bottom' : 'default'}\n />\n </CardBase.Content>\n </CardBase>\n );\n};\n\nexport default BackgroundCard;\n"]}
|
|
@@ -10,13 +10,13 @@ const utils_1 = require("../../utils/index.js");
|
|
|
10
10
|
const Content_1 = tslib_1.__importDefault(require("../Content/Content.js"));
|
|
11
11
|
const b = (0, utils_1.block)('basic-card');
|
|
12
12
|
const BasicCard = (props) => {
|
|
13
|
-
const { title, text, icon, additionalInfo, links, list, buttons, iconPosition = sub_blocks_1.IconPosition.Top, controlPosition = 'content', ...cardParams } = props;
|
|
13
|
+
const { title, text, icon, additionalInfo, links, list, buttons, iconPosition = sub_blocks_1.IconPosition.Top, controlPosition = 'content', size = 's', ...cardParams } = props;
|
|
14
14
|
const titleId = (0, uikit_1.useUniqId)();
|
|
15
15
|
const descriptionId = (0, uikit_1.useUniqId)();
|
|
16
16
|
const areControlsInFooter = controlPosition === 'footer';
|
|
17
17
|
const theme = (0, theme_1.useTheme)();
|
|
18
18
|
const themedIcon = (0, utils_1.getThemedValue)(icon, theme);
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(components_1.CardBase, { className: b(), contentClassName: b('content'), ...cardParams, extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId }, children: (0, jsx_runtime_1.jsx)(components_1.CardBase.Content, { children: (0, jsx_runtime_1.jsx)(components_1.IconWrapper, { icon: themedIcon ? { value: themedIcon, position: iconPosition } : undefined, className: b('wrapper'), children: (0, jsx_runtime_1.jsx)(Content_1.default, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, size:
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(components_1.CardBase, { className: b(), contentClassName: b('content'), ...cardParams, extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId }, children: (0, jsx_runtime_1.jsx)(components_1.CardBase.Content, { children: (0, jsx_runtime_1.jsx)(components_1.IconWrapper, { icon: themedIcon ? { value: themedIcon, position: iconPosition } : undefined, className: b('wrapper'), size: size, children: (0, jsx_runtime_1.jsx)(Content_1.default, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, size: size, colSizes: { all: 12, md: 12 }, controlPosition: areControlsInFooter ? 'bottom' : 'default' }) }) }) }));
|
|
20
20
|
};
|
|
21
21
|
exports.default = BasicCard;
|
|
22
22
|
//# sourceMappingURL=BasicCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicCard.js","sourceRoot":"../../../../src","sources":["sub-blocks/BasicCard/BasicCard.tsx"],"names":[],"mappings":";;;;AAAA,6CAA4C;AAE5C,0DAAuD;AACvD,wDAA6C;AAE7C,6EAAuE;AACvE,gDAAkD;AAClD,4EAAyC;AAIzC,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,YAAY,CAAC,CAAC;AAE9B,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACxC,MAAM,EACF,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,cAAc,EACd,KAAK,EACL,IAAI,EACJ,OAAO,EACP,YAAY,GAAG,yBAAY,CAAC,GAAG,EAC/B,eAAe,GAAG,SAAS,EAC3B,GAAG,UAAU,EAChB,GAAG,KAAK,CAAC;IACV,MAAM,OAAO,GAAG,IAAA,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5B,MAAM,aAAa,GAAG,IAAA,iBAAS,GAAE,CAAC;IAClC,MAAM,mBAAmB,GAAG,eAAe,KAAK,QAAQ,CAAC;IACzD,MAAM,KAAK,GAAG,IAAA,gBAAQ,GAAE,CAAC;IACzB,MAAM,UAAU,GAAG,IAAA,sBAAc,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAE/C,OAAO,CACH,uBAAC,qBAAQ,IACL,SAAS,EAAE,CAAC,EAAE,EACd,gBAAgB,EAAE,CAAC,CAAC,SAAS,CAAC,KAC1B,UAAU,EACd,UAAU,EAAE,EAAC,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,OAAO,EAAC,YAE3E,uBAAC,qBAAQ,CAAC,OAAO,cACb,uBAAC,wBAAW,IACR,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAC,CAAC,CAAC,CAAC,SAAS,EAC1E,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EACvB,IAAI,EAAE,IAAI,YAEV,uBAAC,iBAAO,IACJ,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,EAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAC,EAC3B,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAC7D,GACQ,GACC,GACZ,CACd,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["import {useUniqId} from '@gravity-ui/uikit';\n\nimport {CardBase, IconWrapper} from '../../components';\nimport {useTheme} from '../../context/theme';\nimport {BasicCardProps} from '../../models';\nimport {IconPosition} from '../../models/constructor-items/sub-blocks';\nimport {block, getThemedValue} from '../../utils';\nimport Content from '../Content/Content';\n\nimport './BasicCard.scss';\n\nconst b = block('basic-card');\n\nconst BasicCard = (props: BasicCardProps) => {\n const {\n title,\n text,\n icon,\n additionalInfo,\n links,\n list,\n buttons,\n iconPosition = IconPosition.Top,\n controlPosition = 'content',\n size = 's',\n ...cardParams\n } = props;\n const titleId = useUniqId();\n const descriptionId = useUniqId();\n const areControlsInFooter = controlPosition === 'footer';\n const theme = useTheme();\n const themedIcon = getThemedValue(icon, theme);\n\n return (\n <CardBase\n className={b()}\n contentClassName={b('content')}\n {...cardParams}\n extraProps={{'aria-describedby': descriptionId, 'aria-labelledby': titleId}}\n >\n <CardBase.Content>\n <IconWrapper\n icon={themedIcon ? {value: themedIcon, position: iconPosition} : undefined}\n className={b('wrapper')}\n size={size}\n >\n <Content\n title={title}\n titleId={titleId}\n text={text}\n textId={descriptionId}\n additionalInfo={additionalInfo}\n links={links}\n list={list}\n buttons={buttons}\n size={size}\n colSizes={{all: 12, md: 12}}\n controlPosition={areControlsInFooter ? 'bottom' : 'default'}\n />\n </IconWrapper>\n </CardBase.Content>\n </CardBase>\n );\n};\n\nexport default BasicCard;\n"]}
|
|
@@ -20,7 +20,7 @@ const LayoutItem = ({ content: { links, ...content }, contentMargin = 'm', metaI
|
|
|
20
20
|
controlPosition: areControlsInFooter ? 'bottom' : 'default',
|
|
21
21
|
...content,
|
|
22
22
|
links: normalizedLinks,
|
|
23
|
-
size: 's',
|
|
23
|
+
size: content.size || 's',
|
|
24
24
|
colSizes: { all: 12, md: 12 },
|
|
25
25
|
};
|
|
26
26
|
const titleId = (0, uikit_1.useUniqId)();
|
|
@@ -36,7 +36,7 @@ const LayoutItem = ({ content: { links, ...content }, contentMargin = 'm', metaI
|
|
|
36
36
|
});
|
|
37
37
|
return fullscreen && (0, utils_2.hasFullscreen)(themedMedia) ? ((0, jsx_runtime_1.jsx)(components_1.FullscreenMedia, { showFullscreenIcon: (0, utils_2.showFullscreenIcon)(themedMedia), children: ({ className: mediaClassName, fullscreen: _fullscreen, ...fullscreenMediaProps } = {}) => ((0, jsx_runtime_1.jsx)(components_1.Media, { ...mediaWithMicrodata, ...fullscreenMediaProps, className: b('media', { border }, mediaClassName), analyticsEvents: analyticsEvents })) })) : ((0, jsx_runtime_1.jsx)(components_1.Media, { ...themedMedia, className: b('media', { border }), analyticsEvents: analyticsEvents }));
|
|
38
38
|
};
|
|
39
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: b(null, className), children: [renderMedia(), metaInfo && (0, jsx_runtime_1.jsx)(components_1.MetaInfo, { items: metaInfo, className: b('meta-info') }), (0, jsx_runtime_1.jsx)("div", { className: b('content', { 'no-media': !media, margin: contentMargin }), children: (0, jsx_runtime_1.jsx)(components_1.IconWrapper, { icon: themedIcon, className: b('wrapper'), children: (0, jsx_runtime_1.jsx)(Content_1.default, { ...contentProps, titleId: titleId }) }) })] }));
|
|
39
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: b(null, className), children: [renderMedia(), metaInfo && (0, jsx_runtime_1.jsx)(components_1.MetaInfo, { items: metaInfo, className: b('meta-info') }), (0, jsx_runtime_1.jsx)("div", { className: b('content', { 'no-media': !media, margin: contentMargin }), children: (0, jsx_runtime_1.jsx)(components_1.IconWrapper, { icon: themedIcon, className: b('wrapper'), size: contentProps.size, children: (0, jsx_runtime_1.jsx)(Content_1.default, { ...contentProps, titleId: titleId }) }) })] }));
|
|
40
40
|
};
|
|
41
41
|
exports.default = LayoutItem;
|
|
42
42
|
//# sourceMappingURL=LayoutItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutItem.js","sourceRoot":"../../../../src","sources":["sub-blocks/LayoutItem/LayoutItem.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAE/B,6CAA4C;AAE5C,0DAA+E;AAC/E,wDAA6C;AAE7C,gDAAkD;AAClD,wDAA0D;AAC1D,4EAA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C,CAC9C,uBAAC,4BAAe,IAAC,kBAAkB,EAAE,IAAA,0BAAkB,EAAC,WAAW,CAAC,YAC/D,CAAC,EACE,SAAS,EAAE,cAAc,EACzB,UAAU,EAAE,WAAW,EACvB,GAAG,oBAAoB,EAC1B,GAAG,EAAE,EAAE,EAAE,CAAC,CACP,uBAAC,kBAAK,OACE,kBAAkB,KAClB,oBAAoB,EACxB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,MAAM,EAAC,EAAE,cAAc,CAAC,EAC/C,eAAe,EAAE,eAAe,GAClC,CACL,GACa,CACrB,CAAC,CAAC,CAAC,CACA,uBAAC,kBAAK,OACE,WAAW,EACf,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,MAAM,EAAC,CAAC,EAC/B,eAAe,EAAE,eAAe,GAClC,CACL,CAAC;IACN,CAAC,CAAC;IACF,OAAO,CACH,iCAAK,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,aAC7B,WAAW,EAAE,EACb,QAAQ,IAAI,uBAAC,qBAAQ,IAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,GAAI,EACrE,gCAAK,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,EAAC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAC,CAAC,YACrE,uBAAC,wBAAW,IAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,YAC3E,uBAAC,iBAAO,OAAK,YAAY,EAAE,OAAO,EAAE,OAAO,GAAI,GACrC,GACZ,IACJ,CACT,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {useUniqId} from '@gravity-ui/uikit';\n\nimport {FullscreenMedia, IconWrapper, Media, MetaInfo} from '../../components';\nimport {useTheme} from '../../context/theme';\nimport {ContentBlockProps, LayoutItemProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\nimport Content from '../Content/Content';\n\nimport {getLayoutItemLinks, hasFullscreen, showFullscreenIcon} from './utils';\n\nimport './LayoutItem.scss';\n\nconst b = block('layout-item');\n\nconst LayoutItem = ({\n content: {links, ...content},\n contentMargin = 'm',\n metaInfo,\n media,\n border,\n fullscreen,\n icon,\n className,\n analyticsEvents,\n controlPosition = 'content',\n}: LayoutItemProps) => {\n const normalizedLinks = React.useMemo(() => getLayoutItemLinks(links), [links]);\n const areControlsInFooter = controlPosition === 'footer';\n const theme = useTheme();\n const themedIcon = getThemedValue(icon, theme);\n\n const contentProps: ContentBlockProps = {\n controlPosition: areControlsInFooter ? 'bottom' : 'default',\n ...content,\n links: normalizedLinks,\n size: content.size || 's',\n colSizes: {all: 12, md: 12},\n };\n const titleId = useUniqId();\n const renderMedia = () => {\n if (!media) {\n return null;\n }\n const themedMedia = getThemedValue(media, theme);\n const {title} = content;\n const mediaWithMicrodata = mergeVideoMicrodata(themedMedia, {\n name: typeof title === 'string' ? title : title?.text,\n description: content.text,\n });\n\n return fullscreen && hasFullscreen(themedMedia) ? (\n <FullscreenMedia showFullscreenIcon={showFullscreenIcon(themedMedia)}>\n {({\n className: mediaClassName,\n fullscreen: _fullscreen,\n ...fullscreenMediaProps\n } = {}) => (\n <Media\n {...mediaWithMicrodata}\n {...fullscreenMediaProps}\n className={b('media', {border}, mediaClassName)}\n analyticsEvents={analyticsEvents}\n />\n )}\n </FullscreenMedia>\n ) : (\n <Media\n {...themedMedia}\n className={b('media', {border})}\n analyticsEvents={analyticsEvents}\n />\n );\n };\n return (\n <div className={b(null, className)}>\n {renderMedia()}\n {metaInfo && <MetaInfo items={metaInfo} className={b('meta-info')} />}\n <div className={b('content', {'no-media': !media, margin: contentMargin})}>\n <IconWrapper icon={themedIcon} className={b('wrapper')} size={contentProps.size}>\n <Content {...contentProps} titleId={titleId} />\n </IconWrapper>\n </div>\n </div>\n );\n};\n\nexport default LayoutItem;\n"]}
|
|
@@ -2,12 +2,13 @@ import { createElement as _createElement } from "react";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { BackgroundImage, FileLink } from "../../components/index.js";
|
|
5
|
-
import { MobileContext } from "../../context/mobileContext/index.js";
|
|
6
5
|
import { useTheme } from "../../context/theme/index.js";
|
|
7
6
|
import { Col } from "../../grid/index.js";
|
|
8
7
|
import { Content } from "../../sub-blocks/index.js";
|
|
9
8
|
import { block, getThemedValue } from "../../utils/index.js";
|
|
10
9
|
import './ContentLayout.css';
|
|
10
|
+
import { useWindowWidth } from "../../context/windowWidthContext/index.js";
|
|
11
|
+
import { BREAKPOINTS } from "../../constants.js";
|
|
11
12
|
const b = block('content-layout-block');
|
|
12
13
|
function getFileTextSize(size) {
|
|
13
14
|
switch (size) {
|
|
@@ -30,7 +31,8 @@ function getTextWidth(size) {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
export const ContentLayoutBlock = (props) => {
|
|
33
|
-
const
|
|
34
|
+
const windowWidth = useWindowWidth();
|
|
35
|
+
const isMobile = windowWidth <= BREAKPOINTS.sm;
|
|
34
36
|
const { textContent, fileContent, size = 'l', background, centered, theme = 'default', textWidth = 'm', } = props;
|
|
35
37
|
const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);
|
|
36
38
|
const globalTheme = useTheme();
|