@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,kCAAyB;AAC3D,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,kCAAyB;AAC3D,OAAO,E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me} 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"]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/* eslint-disable complexity */
|
|
3
3
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
4
|
-
import * as React from 'react';
|
|
5
4
|
import { Button, Media, RouterLink } from "../../components/index.js";
|
|
6
5
|
import HeaderBreadcrumbs from "../../components/HeaderBreadcrumbs/HeaderBreadcrumbs.js";
|
|
7
6
|
import { getMediaImage } from "../../components/Media/Image/utils.js";
|
|
8
7
|
import YFMWrapper from "../../components/YFMWrapper/YFMWrapper.js";
|
|
9
|
-
import { MobileContext } from "../../context/mobileContext/index.js";
|
|
10
8
|
import { useTheme } from "../../context/theme/index.js";
|
|
11
9
|
import { Col, Grid, Row } from "../../grid/index.js";
|
|
12
10
|
import { block, getThemedValue } from "../../utils/index.js";
|
|
13
11
|
import { mergeVideoMicrodata } from "../../utils/microdata.js";
|
|
14
12
|
import { getImageSize, getTitleSizes, titleWithImageSizes } from "./utils.js";
|
|
15
13
|
import './Header.css';
|
|
14
|
+
import { useWindowWidth } from "../../context/windowWidthContext/index.js";
|
|
15
|
+
import { BREAKPOINTS } from "../../constants.js";
|
|
16
16
|
const b = block('header-block');
|
|
17
17
|
const Background = ({ background, isMobile }) => {
|
|
18
18
|
const { url, image, fullWidthMedia, video, color } = background;
|
|
@@ -23,7 +23,8 @@ const Background = ({ background, isMobile }) => {
|
|
|
23
23
|
const FullWidthBackground = ({ background }) => (_jsx("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background?.color } }));
|
|
24
24
|
export const HeaderBlock = (props) => {
|
|
25
25
|
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;
|
|
26
|
-
const
|
|
26
|
+
const windowWidth = useWindowWidth();
|
|
27
|
+
const isMobile = windowWidth <= BREAKPOINTS.sm;
|
|
27
28
|
const theme = useTheme();
|
|
28
29
|
const hasRightSideImage = Boolean((image || video) && !centered);
|
|
29
30
|
const curImageSize = imageSize || getImageSize(width);
|
|
@@ -35,10 +36,7 @@ export const HeaderBlock = (props) => {
|
|
|
35
36
|
const backgroundThemed = background && getThemedValue(background, theme);
|
|
36
37
|
const imageThemed = image && getThemedValue(image, theme);
|
|
37
38
|
const videoThemed = video && getThemedValue(video, theme);
|
|
38
|
-
const mediaWithMicrodata = mergeVideoMicrodata({ video: videoThemed, image: imageThemed }, {
|
|
39
|
-
name: title,
|
|
40
|
-
description,
|
|
41
|
-
});
|
|
39
|
+
const mediaWithMicrodata = mergeVideoMicrodata({ video: videoThemed, image: imageThemed }, { name: title, description });
|
|
42
40
|
const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;
|
|
43
41
|
const titleId = useUniqId();
|
|
44
42
|
return (_jsxs("header", { className: b({
|
|
@@ -50,12 +48,7 @@ export const HeaderBlock = (props) => {
|
|
|
50
48
|
offset,
|
|
51
49
|
theme: textTheme,
|
|
52
50
|
'vertical-offset': curVerticalOffset,
|
|
53
|
-
}), children: _jsxs(Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && (_jsx("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? (_jsx(YFMWrapper, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: {
|
|
54
|
-
constructor: true,
|
|
55
|
-
} })) : (overtitle) })), _jsxs(YFMWrapper, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: {
|
|
56
|
-
constructor: true,
|
|
57
|
-
constructorTheme: textTheme,
|
|
58
|
-
}, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && (_jsx("div", { className: b('description', { theme: textTheme }), children: _jsx(YFMWrapper, { content: description, modifiers: {
|
|
51
|
+
}), children: _jsxs(Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && (_jsx("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? (_jsx(YFMWrapper, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: { constructor: true } })) : (overtitle) })), _jsxs(YFMWrapper, { 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 && (_jsx("div", { className: b('description', { theme: textTheme }), children: _jsx(YFMWrapper, { content: description, modifiers: {
|
|
59
52
|
constructor: true,
|
|
60
53
|
constructorTheme: textTheme,
|
|
61
54
|
} }) })), additionalInfo && (_jsx("div", { className: b('additional-info', { theme: textTheme }), children: _jsx(YFMWrapper, { 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,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC,kCAAyB;AAC3D,OAAO,iBAAiB,gEAA6D;AACrF,OAAO,EAAC,aAAa,EAAC,8CAA2C;AACjE,OAAO,UAAU,kDAA+C;AAChE,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,4BAAmB;AAE1C,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAClD,OAAO,EAAC,mBAAmB,EAAC,iCAA8B;AAE1D,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAC,mBAAgB;AACzE,OAAO,cAAc,CAAC;AAEtB,MAAM,CAAC,GAAG,KAAK,CAAC,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,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DACvB,KACG,MAAM,IAPL,KAAK,CAQZ,IAV6B,KAAK,CAW3B,CAChB,CAAC,GACA,CACT,EACA,QAAQ,IACP,GACJ,GACJ,EACL,iBAAiB,IAAI,CAClB,KAAC,KAAK,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;AAEF,eAAe,WAAW,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 {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,+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C;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,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;
|
|
@@ -6,13 +6,13 @@ import { getMediaImage } from "../Media/Image/utils.js";
|
|
|
6
6
|
import './IconWrapper.css';
|
|
7
7
|
const b = block('icon-wrapper');
|
|
8
8
|
const IconWrapper = (props) => {
|
|
9
|
-
const { icon, children, className } = props;
|
|
9
|
+
const { icon, children, className, size } = props;
|
|
10
10
|
if (!icon) {
|
|
11
11
|
return _jsx(React.Fragment, { children: children });
|
|
12
12
|
}
|
|
13
13
|
const iconProps = getMediaImage(icon.value);
|
|
14
14
|
const iconPosition = icon?.position;
|
|
15
|
-
return (_jsxs("div", { className: b({ ['icon-position']: iconPosition }, className), children: [iconProps && (_jsx(Image, { ...iconProps, containerClassName: b('icon-container'), className: b('icon', { ['icon-position']: iconPosition }) })), _jsx("div", { className: b('content', { ['icon-position']: iconPosition }), children: children })] }));
|
|
15
|
+
return (_jsxs("div", { className: b({ ['icon-position']: iconPosition }, className), children: [iconProps && (_jsx(Image, { ...iconProps, containerClassName: b('icon-container'), className: b('icon', { ['icon-position']: iconPosition, size }) })), _jsx("div", { className: b('content', { ['icon-position']: iconPosition }), children: children })] }));
|
|
16
16
|
};
|
|
17
17
|
export default IconWrapper;
|
|
18
18
|
//# sourceMappingURL=IconWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconWrapper.js","sourceRoot":"../../../../src","sources":["components/IconWrapper/IconWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,KAAK,0BAAuB;AACnC,OAAO,EAAC,aAAa,EAAC,gCAA6B;AAEnD,OAAO,mBAAmB,CAAC;AAE3B,MAAM,CAAC,GAAG,KA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YAAY,EAAC,CAAC,YAAG,QAAQ,GAAO,IAC/E,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,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"]}
|
|
@@ -11,6 +11,7 @@ import { MobileContext } from "../../context/mobileContext/index.js";
|
|
|
11
11
|
import { ProjectSettingsContext, } from "../../context/projectSettingsContext/index.js";
|
|
12
12
|
import { SSRContext } from "../../context/ssrContext/index.js";
|
|
13
13
|
import { ThemeContext } from "../../context/theme/index.js";
|
|
14
|
+
import { WindowWidthProvider } from "../../context/windowWidthContext/index.js";
|
|
14
15
|
export const PageConstructorProvider = (props) => {
|
|
15
16
|
const { isMobile, mapsContext = initialMapValue, locale = {}, location = {}, analytics = {}, ssrConfig = {}, projectSettings = {}, theme = DEFAULT_THEME, children, image = {}, forms = DEFAULT_FORMS_CONTEXT_VALUE, } = props;
|
|
16
17
|
/* eslint-disable react/jsx-key */
|
|
@@ -25,6 +26,7 @@ export const PageConstructorProvider = (props) => {
|
|
|
25
26
|
_jsx(AnalyticsContext.Provider, { value: analytics }),
|
|
26
27
|
_jsx(FormsContext.Provider, { value: forms }),
|
|
27
28
|
_jsx(SSRContext.Provider, { value: { isServer: ssrConfig?.isServer } }),
|
|
29
|
+
_jsx(WindowWidthProvider, {}),
|
|
28
30
|
].reduceRight((prev, provider) => React.cloneElement(provider, {}, prev), children);
|
|
29
31
|
/* eslint-enable react/jsx-key */
|
|
30
32
|
return _jsx(React.Fragment, { children: context });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,sCAAmC;AACzD,OAAO,EAAC,gBAAgB,EAAwB,gDAAuC;AACvF,OAAO,EACH,2BAA2B,EAC3B,YAAY,GAEf,mDAAgD;AACjD,OAAO,EAAC,YAAY,EAAoB,4CAAmC;AAC3E,OAAO,EAAC,aAAa,EAAqB,6CAAoC;AAC9E,OAAO,EAAC,eAAe,EAAuB,+CAAsC;AACpF,OAAO,EAAC,WAAW,EAAmB,eAAe,EAAC,iDAA8C;AACpG,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EACH,sBAAsB,GAEzB,sDAA6C;AAC9C,OAAO,EAAC,UAAU,EAAkB,0CAAiC;AACrE,OAAO,EAAC,YAAY,EAAC,qCAA4B;
|
|
1
|
+
{"version":3,"file":"Provider.js","sourceRoot":"../../../../src","sources":["containers/PageConstructor/Provider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,sCAAmC;AACzD,OAAO,EAAC,gBAAgB,EAAwB,gDAAuC;AACvF,OAAO,EACH,2BAA2B,EAC3B,YAAY,GAEf,mDAAgD;AACjD,OAAO,EAAC,YAAY,EAAoB,4CAAmC;AAC3E,OAAO,EAAC,aAAa,EAAqB,6CAAoC;AAC9E,OAAO,EAAC,eAAe,EAAuB,+CAAsC;AACpF,OAAO,EAAC,WAAW,EAAmB,eAA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,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAC,GAAI;QAC/D,KAAC,mBAAmB,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,KAAC,KAAK,CAAC,QAAQ,cAAE,OAAO,GAAkB,CAAC;AACtD,CAAC,CAAC","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,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import throttle from "lodash/throttle.js";
|
|
4
|
+
import { SSRContext } from "../ssrContext/index.js";
|
|
5
|
+
import { BREAKPOINTS } from "../../constants.js";
|
|
6
|
+
const DEFAULT_WIDTH = BREAKPOINTS.xl;
|
|
7
|
+
const UPDATE_FREQUENCY_MS = 100;
|
|
8
|
+
export const WindowWidthContext = React.createContext(DEFAULT_WIDTH);
|
|
9
|
+
export const WindowWidthProvider = ({ children }) => {
|
|
10
|
+
const { isServer } = React.useContext(SSRContext);
|
|
11
|
+
const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
if (isServer) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const handleResize = throttle(() => {
|
|
17
|
+
setWindowWidth(window.innerWidth);
|
|
18
|
+
}, UPDATE_FREQUENCY_MS, { leading: true });
|
|
19
|
+
handleResize();
|
|
20
|
+
window.addEventListener('resize', handleResize, { passive: true });
|
|
21
|
+
// eslint-disable-next-line consistent-return
|
|
22
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
23
|
+
}, [isServer]);
|
|
24
|
+
return (_jsx(WindowWidthContext.Provider, { value: windowWidth, children: children }));
|
|
25
|
+
};
|
|
26
|
+
export const useWindowWidth = () => React.useContext(WindowWidthContext);
|
|
27
|
+
//# sourceMappingURL=BreakpointContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BreakpointContext.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/BreakpointContext.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,QAAQ,2BAAwB;AACvC,OAAO,EAAC,UAAU,EAAC,+BAAsB;AACzC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,MAAM,aAAa,GAAG,WAAW,CAAC,EAAE,CAAC;AACrC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CAAS,aAAa,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAAC,QAAQ,EAA0B,EAAE,EAAE;IACvE,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,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,QAAQ,CACzB,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,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,WAAW,YAAG,QAAQ,GAA+B,CAC5F,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC","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,uCAAoC","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,MAAM,CAAN,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,KAAZ,YAAY,QAoBvB;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,2BAAW,CAAA;IACX,6BAAa,CAAA;AACjB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;
|
|
1
|
+
{"version":3,"file":"sub-blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/sub-blocks.ts"],"names":[],"mappings":"AA8BA,MAAM,CAAN,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,KAAZ,YAAY,QAoBvB;AAED,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACpB,2BAAW,CAAA;IACX,6BAAa,CAAA;AACjB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAYD,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;AACvB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAC,MAAM,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"]}
|
|
@@ -7,13 +7,13 @@ import Content from "../Content/Content.js";
|
|
|
7
7
|
import './BackgroundCard.css';
|
|
8
8
|
const b = block('background-card');
|
|
9
9
|
const BackgroundCard = (props) => {
|
|
10
|
-
const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, controlPosition = 'content', list, } = props;
|
|
10
|
+
const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, controlPosition = 'content', list, size = 's', } = props;
|
|
11
11
|
const titleId = useUniqId();
|
|
12
12
|
const theme = useTheme();
|
|
13
13
|
const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
|
|
14
14
|
const borderType = hasBackgroundColor ? 'none' : border;
|
|
15
15
|
const areControlsInFooter = !paddingBottom && controlPosition === 'footer';
|
|
16
|
-
return (_jsx(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), contentClassName: b('content'), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle, children: _jsxs(CardBase.Content, { children: [_jsx(BackgroundImage, { className: b('image'), ...getThemedValue(background, theme), style: { backgroundColor } }), _jsx(Content, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size:
|
|
16
|
+
return (_jsx(CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), contentClassName: b('content'), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle, children: _jsxs(CardBase.Content, { children: [_jsx(BackgroundImage, { className: b('image'), ...getThemedValue(background, theme), style: { backgroundColor } }), _jsx(Content, { 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' })] }) }));
|
|
17
17
|
};
|
|
18
18
|
export default BackgroundCard;
|
|
19
19
|
//# sourceMappingURL=BackgroundCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundCard.js","sourceRoot":"../../../../src","sources":["sub-blocks/BackgroundCard/BackgroundCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,kCAA0B;AAC5D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAE7C,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAClD,OAAO,OAAO,8BAA2B;AAEzC,OAAO,sBAAsB,CAAC;AAE9B,MAAM,CAAC,GAAG,KAAK,CAAC,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":"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AAQ,EAAE,QAAQ,YAElB,MAAC,QAAQ,CAAC,OAAO,eACb,KAAC,eAAe,IACZ,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,KACjB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,EACrC,KAAK,EAAE,EAAC,eAAe,EAAC,GAC1B,EACF,KAAC,OAAO,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,eAAe,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"]}
|
|
@@ -8,13 +8,13 @@ import Content from "../Content/Content.js";
|
|
|
8
8
|
import './BasicCard.css';
|
|
9
9
|
const b = block('basic-card');
|
|
10
10
|
const BasicCard = (props) => {
|
|
11
|
-
const { title, text, icon, additionalInfo, links, list, buttons, iconPosition = IconPosition.Top, controlPosition = 'content', ...cardParams } = props;
|
|
11
|
+
const { title, text, icon, additionalInfo, links, list, buttons, iconPosition = IconPosition.Top, controlPosition = 'content', size = 's', ...cardParams } = props;
|
|
12
12
|
const titleId = useUniqId();
|
|
13
13
|
const descriptionId = useUniqId();
|
|
14
14
|
const areControlsInFooter = controlPosition === 'footer';
|
|
15
15
|
const theme = useTheme();
|
|
16
16
|
const themedIcon = getThemedValue(icon, theme);
|
|
17
|
-
return (_jsx(CardBase, { className: b(), contentClassName: b('content'), ...cardParams, extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId }, children: _jsx(CardBase.Content, { children: _jsx(IconWrapper, { icon: themedIcon ? { value: themedIcon, position: iconPosition } : undefined, className: b('wrapper'), children: _jsx(Content, { title: title, titleId: titleId, text: text, textId: descriptionId, additionalInfo: additionalInfo, links: links, list: list, buttons: buttons, size:
|
|
17
|
+
return (_jsx(CardBase, { className: b(), contentClassName: b('content'), ...cardParams, extraProps: { 'aria-describedby': descriptionId, 'aria-labelledby': titleId }, children: _jsx(CardBase.Content, { children: _jsx(IconWrapper, { icon: themedIcon ? { value: themedIcon, position: iconPosition } : undefined, className: b('wrapper'), size: size, children: _jsx(Content, { 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' }) }) }) }));
|
|
18
18
|
};
|
|
19
19
|
export default BasicCard;
|
|
20
20
|
//# sourceMappingURL=BasicCard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicCard.js","sourceRoot":"../../../../src","sources":["sub-blocks/BasicCard/BasicCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,kCAAyB;AACvD,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAE7C,OAAO,EAAC,YAAY,EAAC,qDAAkD;AACvE,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAClD,OAAO,OAAO,8BAA2B;AAEzC,OAAO,iBAAiB,CAAC;AAEzB,MAAM,CAAC,GAAG,KAAK,CAAC,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,YAAY,CAAC,GAAG,EAC/B,eAAe,GAAG,SAAS,EAC3B,GAAG,UAAU,EAChB,GAAG,KAAK,CAAC;IACV,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAC5B,MAAM,aAAa,GAAG,SAAS,EAAE,CAAC;IAClC,MAAM,mBAAmB,GAAG,eAAe,KAAK,QAAQ,CAAC;IACzD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAE/C,OAAO,CACH,KAAC,QA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AAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAE/C,OAAO,CACH,KAAC,QAAQ,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,KAAC,QAAQ,CAAC,OAAO,cACb,KAAC,WAAW,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,KAAC,OAAO,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,eAAe,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"]}
|
|
@@ -18,7 +18,7 @@ const LayoutItem = ({ content: { links, ...content }, contentMargin = 'm', metaI
|
|
|
18
18
|
controlPosition: areControlsInFooter ? 'bottom' : 'default',
|
|
19
19
|
...content,
|
|
20
20
|
links: normalizedLinks,
|
|
21
|
-
size: 's',
|
|
21
|
+
size: content.size || 's',
|
|
22
22
|
colSizes: { all: 12, md: 12 },
|
|
23
23
|
};
|
|
24
24
|
const titleId = useUniqId();
|
|
@@ -34,7 +34,7 @@ const LayoutItem = ({ content: { links, ...content }, contentMargin = 'm', metaI
|
|
|
34
34
|
});
|
|
35
35
|
return fullscreen && hasFullscreen(themedMedia) ? (_jsx(FullscreenMedia, { showFullscreenIcon: showFullscreenIcon(themedMedia), children: ({ className: mediaClassName, fullscreen: _fullscreen, ...fullscreenMediaProps } = {}) => (_jsx(Media, { ...mediaWithMicrodata, ...fullscreenMediaProps, className: b('media', { border }, mediaClassName), analyticsEvents: analyticsEvents })) })) : (_jsx(Media, { ...themedMedia, className: b('media', { border }), analyticsEvents: analyticsEvents }));
|
|
36
36
|
};
|
|
37
|
-
return (_jsxs("div", { className: b(null, className), children: [renderMedia(), metaInfo && _jsx(MetaInfo, { items: metaInfo, className: b('meta-info') }), _jsx("div", { className: b('content', { 'no-media': !media, margin: contentMargin }), children: _jsx(IconWrapper, { icon: themedIcon, className: b('wrapper'), children: _jsx(Content, { ...contentProps, titleId: titleId }) }) })] }));
|
|
37
|
+
return (_jsxs("div", { className: b(null, className), children: [renderMedia(), metaInfo && _jsx(MetaInfo, { items: metaInfo, className: b('meta-info') }), _jsx("div", { className: b('content', { 'no-media': !media, margin: contentMargin }), children: _jsx(IconWrapper, { icon: themedIcon, className: b('wrapper'), size: contentProps.size, children: _jsx(Content, { ...contentProps, titleId: titleId }) }) })] }));
|
|
38
38
|
};
|
|
39
39
|
export default LayoutItem;
|
|
40
40
|
//# sourceMappingURL=LayoutItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayoutItem.js","sourceRoot":"../../../../src","sources":["sub-blocks/LayoutItem/LayoutItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAC,eAAe,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAC,kCAAyB;AAC/E,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAE7C,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAClD,OAAO,EAAC,mBAAmB,EAAC,iCAA8B;AAC1D,OAAO,OAAO,8BAA2B;AAEzC,OAAO,EAAC,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAC,mBAAgB;AAE9E,OAAO,kBAAkB,CAAC;AAE1B,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAE/B,MAAM,UAAU,GAAG,CAAC,EAChB,O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@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"]}
|
package/package.json
CHANGED
|
@@ -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[];
|
package/widget/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default "(self.webpackChunk_gravity_ui_page_constructor=self.webpackChunk_gravity_ui_page_constructor||[]).push([[
|
|
1
|
+
export default "(self.webpackChunk_gravity_ui_page_constructor=self.webpackChunk_gravity_ui_page_constructor||[]).push([[1349],{31349:function(_,t,Y){_.exports=function(_){\"use strict\";function t(_){return _&&\"object\"==typeof _&&\"default\"in _?_:{default:_}}var Y=t(_),e={name:\"zh-tw\",weekdays:\"星期日_星期一_星期二_星期三_星期四_星期五_星期六\".split(\"_\"),weekdaysShort:\"週日_週一_週二_週三_週四_週五_週六\".split(\"_\"),weekdaysMin:\"日_一_二_三_四_五_六\".split(\"_\"),months:\"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月\".split(\"_\"),monthsShort:\"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月\".split(\"_\"),ordinal:function(_,t){return\"W\"===t?_+\"週\":_+\"日\"},formats:{LT:\"HH:mm\",LTS:\"HH:mm:ss\",L:\"YYYY/MM/DD\",LL:\"YYYY年M月D日\",LLL:\"YYYY年M月D日 HH:mm\",LLLL:\"YYYY年M月D日dddd HH:mm\",l:\"YYYY/M/D\",ll:\"YYYY年M月D日\",lll:\"YYYY年M月D日 HH:mm\",llll:\"YYYY年M月D日dddd HH:mm\"},relativeTime:{future:\"%s內\",past:\"%s前\",s:\"幾秒\",m:\"1 分鐘\",mm:\"%d 分鐘\",h:\"1 小時\",hh:\"%d 小時\",d:\"1 天\",dd:\"%d 天\",M:\"1 個月\",MM:\"%d 個月\",y:\"1 年\",yy:\"%d 年\"},meridiem:function(_,t){var Y=100*_+t;return Y<600?\"凌晨\":Y<900?\"早上\":Y<1100?\"上午\":Y<1300?\"中午\":Y<1800?\"下午\":\"晚上\"}};return Y.default.locale(e,null,!0),e}(Y(74353))}}]);";
|