@gravity-ui/page-constructor 7.7.0 → 7.8.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/components/Button/Button.css +2 -7
- package/build/cjs/components/Button/Button.js +19 -2
- package/build/cjs/components/Button/Button.js.map +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +5 -2
- package/build/cjs/models/constructor-items/common.js.map +1 -1
- package/build/cjs/models/constructor-items/sub-blocks.d.ts +1 -1
- package/build/cjs/models/constructor-items/sub-blocks.js.map +1 -1
- package/build/cjs/schema/constants.d.ts +5 -0
- 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/BackgroundCard/schema.d.ts +5 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js +1 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.js.map +1 -1
- package/build/cjs/text-transform/config.js +0 -9
- package/build/cjs/text-transform/config.js.map +1 -1
- package/build/esm/components/Button/Button.css +2 -7
- package/build/esm/components/Button/Button.js +19 -2
- package/build/esm/components/Button/Button.js.map +1 -1
- package/build/esm/models/constructor-items/common.d.ts +5 -2
- package/build/esm/models/constructor-items/common.js.map +1 -1
- package/build/esm/models/constructor-items/sub-blocks.d.ts +1 -1
- package/build/esm/models/constructor-items/sub-blocks.js.map +1 -1
- package/build/esm/schema/constants.d.ts +5 -0
- 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/BackgroundCard/schema.d.ts +5 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.js +2 -1
- package/build/esm/sub-blocks/BackgroundCard/schema.js.map +1 -1
- package/build/esm/text-transform/config.js +0 -9
- package/build/esm/text-transform/config.js.map +1 -1
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/constructor-items/common.d.ts +5 -2
- package/server/models/constructor-items/sub-blocks.d.ts +1 -1
- package/server/text-transform/config.js +0 -9
|
@@ -6,13 +6,8 @@ unpredictable css rules order in build */
|
|
|
6
6
|
.pc-button-block__content {
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
width: 18px;
|
|
12
|
-
height: 18px;
|
|
13
|
-
}
|
|
14
|
-
.pc-button-block__image + .pc-button-block__text, .pc-button-block__text + .pc-button-block__image {
|
|
15
|
-
margin-left: var(--btn-image-margin);
|
|
9
|
+
justify-content: center;
|
|
10
|
+
gap: var(--g-spacing-2);
|
|
16
11
|
}
|
|
17
12
|
.pc-button-block_theme_github.pc-button-block_theme_github.pc-button-block_theme_github.pc-button-block_theme_github {
|
|
18
13
|
--g-button-background-color: var(--pc-monochrome-button-background-color);
|
|
@@ -12,6 +12,7 @@ const models_1 = require("../../models/index.js");
|
|
|
12
12
|
const utils_1 = require("../../utils/index.js");
|
|
13
13
|
const i18n_1 = require("./i18n/index.js");
|
|
14
14
|
const utils_2 = require("./utils.js");
|
|
15
|
+
const DEFAULT_IMG_SIZE = 16;
|
|
15
16
|
const b = (0, utils_1.block)('button-block');
|
|
16
17
|
// eslint-disable-next-line complexity
|
|
17
18
|
const Button = (props) => {
|
|
@@ -27,7 +28,14 @@ const Button = (props) => {
|
|
|
27
28
|
}, [handleAnalytics, analyticsEvents, onClickOrigin]);
|
|
28
29
|
const buttonModifiers = { size, theme, width };
|
|
29
30
|
const buttonImg = img instanceof Object
|
|
30
|
-
? {
|
|
31
|
+
? {
|
|
32
|
+
url: img.url,
|
|
33
|
+
iconData: img.iconData,
|
|
34
|
+
iconSize: img.iconSize,
|
|
35
|
+
className: img.className,
|
|
36
|
+
position: img.position || defaultImgPosition,
|
|
37
|
+
alt: img.alt,
|
|
38
|
+
}
|
|
31
39
|
: { url: img, position: defaultImgPosition };
|
|
32
40
|
const buttonClass = img
|
|
33
41
|
? b({ position: buttonImg.position, ...buttonModifiers }, className)
|
|
@@ -42,7 +50,16 @@ const Button = (props) => {
|
|
|
42
50
|
return (0, jsx_runtime_1.jsx)(components_1.StoreBadge, { className: buttonClass, platform: platform, href: url });
|
|
43
51
|
}
|
|
44
52
|
let icon;
|
|
45
|
-
let image
|
|
53
|
+
let image;
|
|
54
|
+
if (img && buttonImg.iconData) {
|
|
55
|
+
const iconSize = buttonImg.iconSize;
|
|
56
|
+
const iconClassName = buttonImg.className ? b('icon', buttonImg.className) : b('icon');
|
|
57
|
+
icon = ((0, jsx_runtime_1.jsx)(uikit_1.Icon, { className: iconClassName, data: buttonImg.iconData, size: iconSize, qa: utils_2.ICON_QA }));
|
|
58
|
+
}
|
|
59
|
+
else if (img && buttonImg.url) {
|
|
60
|
+
image = ((0, jsx_runtime_1.jsx)("img", { className: b('image'), width: buttonImg.iconSize || DEFAULT_IMG_SIZE, height: buttonImg.iconSize || DEFAULT_IMG_SIZE, src: buttonImg.url, alt: buttonImg.alt || (0, i18n_1.i18n)('image-alt') }));
|
|
61
|
+
}
|
|
62
|
+
// Special handling for github theme (for backwards compatibility)
|
|
46
63
|
if (theme === 'github') {
|
|
47
64
|
icon = (0, jsx_runtime_1.jsx)(uikit_1.Icon, { className: b('icon'), data: icons_1.Github, size: 24, qa: utils_2.ICON_QA });
|
|
48
65
|
image = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"../../../../src","sources":["components/Button/Button.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAE/B,uDAAkD;AAClD,6CAK2B;AAE3B,gFAAwE;AACxE,gDAAyC;AACzC,gDAAmC;AACnC,kDAAqF;AACrF,gDAA6C;AAE7C,0CAA4B;AAC5B,sCAA2F;
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"../../../../src","sources":["components/Button/Button.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAE/B,uDAAkD;AAClD,6CAK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AS,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EACtD,iCAAM,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,YAAG,IAAI,GAAQ,EACxC,KAAK,IAAI,SAAS,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IACpD,EACN,IAAI,IAAI,SAAS,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAC1C,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,kBAAe,MAAM,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {StoreBadge} from '@gravity-ui/components';\nimport {\n Button as CommonButton,\n Icon,\n Platform,\n ButtonProps as UIKitButtonProps,\n} from '@gravity-ui/uikit';\n\nimport {LocaleContext} from '../../context/localeContext/localeContext';\nimport {useAnalytics} from '../../hooks';\nimport {Github} from '../../icons';\nimport {ButtonProps as ButtonParams, DefaultEventNames, QAProps} from '../../models';\nimport {block, setUrlTld} from '../../utils';\n\nimport {i18n} from './i18n';\nimport {ICON_QA, OldButtonSize, OldButtonTheme, toCommonSize, toCommonView} from './utils';\n\nimport './Button.scss';\n\nconst DEFAULT_IMG_SIZE = 16;\n\nexport interface ButtonProps extends Omit<ButtonParams, 'url'>, QAProps {\n className?: string;\n id?: string;\n url?: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;\n}\n\nconst b = block('button-block');\n\n// eslint-disable-next-line complexity\nconst Button = (props: ButtonProps) => {\n const {tld} = React.useContext(LocaleContext);\n const {\n className,\n analyticsEvents,\n size = 'l',\n theme = 'normal',\n url,\n urlTitle,\n img,\n onClick: onClickOrigin,\n text,\n width,\n ...rest\n } = props;\n const defaultImgPosition = 'left';\n const handleAnalytics = useAnalytics(DefaultEventNames.Button, url);\n const onClick = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n handleAnalytics(analyticsEvents);\n\n if (onClickOrigin) {\n onClickOrigin(e);\n }\n },\n [handleAnalytics, analyticsEvents, onClickOrigin],\n );\n\n const buttonModifiers = {size, theme, width};\n\n const buttonImg =\n img instanceof Object\n ? {\n url: img.url,\n iconData: img.iconData,\n iconSize: img.iconSize,\n className: img.className,\n position: img.position || defaultImgPosition,\n alt: img.alt,\n }\n : {url: img, position: defaultImgPosition};\n\n const buttonClass = img\n ? b({position: buttonImg.position, ...buttonModifiers}, className)\n : b({...buttonModifiers}, className);\n\n const buttonProps = {\n ...rest,\n href: url ? setUrlTld(url, tld) : undefined,\n onClick,\n };\n\n if (theme === 'app-store' || theme === 'google-play') {\n const platform = theme === 'app-store' ? Platform.IOS : Platform.ANDROID;\n\n return <StoreBadge className={buttonClass} platform={platform} href={url as string} />;\n }\n\n let icon;\n let image;\n\n if (img && buttonImg.iconData) {\n const iconSize = buttonImg.iconSize;\n const iconClassName = buttonImg.className ? b('icon', buttonImg.className) : b('icon');\n icon = (\n <Icon\n className={iconClassName}\n data={buttonImg.iconData}\n size={iconSize}\n qa={ICON_QA}\n />\n );\n } else if (img && buttonImg.url) {\n image = (\n <img\n className={b('image')}\n width={buttonImg.iconSize || DEFAULT_IMG_SIZE}\n height={buttonImg.iconSize || DEFAULT_IMG_SIZE}\n src={buttonImg.url}\n alt={buttonImg.alt || i18n('image-alt')}\n />\n );\n }\n\n // Special handling for github theme (for backwards compatibility)\n if (theme === 'github') {\n icon = <Icon className={b('icon')} data={Github} size={24} qa={ICON_QA} />;\n image = undefined;\n }\n\n const buttonTheme = theme === 'scale' ? 'accent' : theme;\n\n return (\n <CommonButton\n className={buttonClass}\n view={toCommonView(buttonTheme as OldButtonTheme)}\n size={toCommonSize(size as OldButtonSize)}\n title={urlTitle}\n width={width}\n {...(buttonProps as UIKitButtonProps)}\n >\n {icon && buttonImg.position === 'left' ? icon : null}\n <span className={b('content')}>\n {image && buttonImg.position === 'left' ? image : null}\n <span className={b('text')}>{text}</span>\n {image && buttonImg.position === 'right' ? image : null}\n </span>\n {icon && buttonImg.position === 'right' ? icon : null}\n </CommonButton>\n );\n};\n\nexport default Button;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { ButtonView, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
2
|
+
import { ButtonView, IconData, ButtonProps as UikitButtonProps } from '@gravity-ui/uikit';
|
|
3
3
|
import { ThemeSupporting } from "../../utils/index.js";
|
|
4
4
|
import { AnalyticsEventsBase, AnalyticsEventsProp, ClassNameProps, QAProps } from "../common.js";
|
|
5
5
|
export declare enum AuthorType {
|
|
@@ -173,9 +173,12 @@ export interface ButtonProps extends AnalyticsEventsBase, Pick<UikitButtonProps,
|
|
|
173
173
|
}
|
|
174
174
|
export type ButtonImagePosition = 'left' | 'right';
|
|
175
175
|
export interface ButtonImageProps {
|
|
176
|
-
url
|
|
176
|
+
url?: string;
|
|
177
177
|
position?: ButtonImagePosition;
|
|
178
178
|
alt?: string;
|
|
179
|
+
iconData?: IconData;
|
|
180
|
+
iconSize?: number;
|
|
181
|
+
className?: string;
|
|
179
182
|
}
|
|
180
183
|
export interface CustomControlsOptions {
|
|
181
184
|
type?: CustomControlsType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"../../../../src","sources":["models/constructor-items/common.ts"],"names":[],"mappings":";;;AAOA,QAAQ;AACR,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,+CAA2B,CAAA;IAC3B,yCAAqB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,eAMX;AAND,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,8BAAW,CAAA;AACf,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,iCAAa,CAAA;IACb,iCAAa,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,yDAAmC,CAAA;IACnC,oEAA8C,CAAA;AAClD,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,+BAIX;AAJD,WAAY,+BAA+B;IACvC,gDAAa,CAAA;IACb,kDAAe,CAAA;IACf,oDAAiB,CAAA;AACrB,CAAC,EAJW,+BAA+B,+CAA/B,+BAA+B,QAI1C;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;AACrB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,6CAAmB,CAAA;IACnB,2CAAiB,CAAA;AACrB,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;AACpC,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAsED,SAAS;AAET,IAAY,MAIX;AAJD,WAAY,MAAM;IACd,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;AACrB,CAAC,EAJW,MAAM,sBAAN,MAAM,QAIjB","sourcesContent":["import * as React from 'react';\n\nimport {ButtonView, ButtonProps as UikitButtonProps} from '@gravity-ui/uikit';\n\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase, AnalyticsEventsProp, ClassNameProps, QAProps} from '../common';\n\n// enums\nexport enum AuthorType {\n Column = 'column',\n Line = 'line',\n}\n\nexport enum PriceDetailsType {\n MARKED_LIST = 'marked-list',\n SETTINGS = 'settings',\n}\n\nexport enum PriceLabelColor {\n BLUE = 'blue',\n GREEN = 'green',\n YELLOW = 'yellow',\n PURPLE = 'purple',\n RED = 'red',\n}\n\nexport enum PlayButtonType {\n Default = 'default',\n Text = 'text',\n}\n\nexport enum PlayButtonThemes {\n Blue = 'blue',\n Grey = 'grey',\n}\n\nexport enum CustomControlsType {\n WithMuteButton = 'with-mute-button',\n WithPlayPauseButton = 'with-play-pause-button',\n}\n\nexport enum CustomControlsButtonPositioning {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n}\n\nexport enum MediaVideoType {\n Default = 'default',\n Player = 'player',\n}\n\nexport enum MediaVideoControlsType {\n Default = 'default',\n Custom = 'custom',\n}\n\nexport enum QuoteType {\n Chevron = 'chevron', // « »\n EnglishDouble = 'english-double', // “ ”\n}\n\n// types\nexport type TextTheme = 'light' | 'dark';\nexport type TextSize = 'xs' | 's' | 'sm' | 'm' | 'l';\nexport type DividerSize = '0' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\nexport type HeaderWidth = 's' | 'm' | 'l';\nexport type HeaderImageSize = 's' | 'm';\nexport type HeaderOffset = 'default' | 'large';\nexport type Justify = 'start' | 'center' | 'end';\nexport type ColumnsCount = 1 | 2 | 3 | 4;\nexport type LegendTableMarkerType = 'disk' | 'tick';\nexport type LinkTheme = 'file-link' | 'normal' | 'back' | 'underline';\nexport type MediaDirection = 'media-content' | 'content-media';\nexport type PriceDescriptionColor = 'cornflower' | 'black';\nexport type ContentSize = 's' | 'm' | 'l';\nexport type ContentTextSize = 's' | 'm' | 'l';\nexport type ContentTheme = 'default' | 'dark' | 'light';\nexport type FileLinkType = 'vertical' | 'horizontal';\nexport type ImageCardMargins = 's' | 'm';\nexport type LayoutItemContentMargin = 'm' | 'l';\n\n// modifiers\nexport interface Themable {\n theme?: TextTheme;\n}\n\nexport interface Justifyable {\n justify?: Justify;\n}\n\nexport interface Stylable {\n className?: string;\n}\n\nexport interface Animatable {\n animated?: boolean;\n}\n\nexport interface Tabbable {\n tabIndex?: number;\n}\n\nexport interface Roleable {\n role?: React.AriaRole;\n}\n\nexport interface AriaProps {\n ariaProps?: React.AriaAttributes;\n}\n\n//common props\nexport interface Background {\n image?: string;\n color?: string;\n}\n\nexport interface AnchorProps {\n text: string;\n url: string;\n}\n\n/**\n * @deprecated Component VideoBlock will be deleted, which uses this logic\n */\ninterface LoopProps {\n start: number;\n end?: number;\n}\n\n// images\n\nexport enum Device {\n Desktop = 'desktop',\n Mobile = 'mobile',\n Tablet = 'tablet',\n}\n\nexport interface ImageInfoProps\n extends Pick<\n React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>,\n 'aria-describedby' | 'loading'\n >,\n ImageDevicesVisibleProps {\n alt?: string;\n fetchPriority?: 'high' | 'low' | 'auto';\n disableCompress?: boolean;\n}\n\nexport interface ImageObjectProps extends ImageInfoProps {\n src: string;\n}\n\nexport interface ImageDeviceProps extends ImageInfoProps {\n [Device.Desktop]: string;\n [Device.Mobile]: string;\n [Device.Tablet]?: string;\n}\n\nexport interface ImageDevicesVisibleProps {\n hide?: boolean | Partial<Record<Device, boolean>>;\n}\n\nexport type ImageProps = string | ImageObjectProps | ImageDeviceProps;\nexport type ThemedImage = ThemeSupporting<ImageProps>;\n\nexport interface BackgroundImageProps\n extends React.HTMLProps<HTMLDivElement>,\n Partial<ImageDeviceProps>,\n Partial<ImageObjectProps>,\n QAProps,\n ImageDevicesVisibleProps {\n style?: React.CSSProperties;\n imageClassName?: string;\n}\n\n//components props\nexport interface MediaVideoProps extends AnalyticsEventsBase {\n src: string[];\n type?: MediaVideoType;\n loop?: LoopProps | boolean;\n muted?: boolean;\n autoplay?: boolean;\n elapsedTime?: number;\n playButton?: PlayButtonProps;\n controls?: MediaVideoControlsType;\n customControlsOptions?: CustomControlsOptions;\n ariaLabel?: string;\n contain?: boolean;\n}\n\n// links\nexport interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {\n url: string;\n urlTitle?: string;\n text?: string;\n textSize?: TextSize;\n theme?: LinkTheme;\n colorTheme?: TextTheme;\n arrow?: boolean;\n target?: string;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\nexport interface FileLinkProps extends ClassNameProps, Tabbable {\n href: string;\n text: React.ReactNode;\n type?: FileLinkType;\n textSize?: TextSize;\n theme?: ContentTheme;\n urlTitle?: string;\n onClick?: () => void;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\n// buttons\nexport type ButtonTheme =\n | ButtonView\n | 'github'\n | 'app-store'\n | 'google-play'\n | 'scale'\n | 'monochrome';\n\nexport interface ButtonProps\n extends AnalyticsEventsBase,\n Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {\n text: string;\n url: string;\n urlTitle?: string;\n primary?: boolean;\n theme?: ButtonTheme;\n img?: ButtonImageProps | string;\n target?: string;\n}\n\nexport type ButtonImagePosition = 'left' | 'right';\n\nexport interface ButtonImageProps {\n url: string;\n position?: ButtonImagePosition;\n alt?: string;\n}\n\nexport interface CustomControlsOptions {\n type?: CustomControlsType;\n muteButtonShown?: boolean;\n positioning?: CustomControlsButtonPositioning;\n}\n\nexport interface PlayButtonProps extends ClassNameProps {\n type?: PlayButtonType;\n theme?: PlayButtonThemes;\n text?: string;\n}\n\nexport type ThemedMediaVideoProps = ThemeSupporting<MediaVideoProps>;\n\nexport interface MediaComponentVideoProps extends AnalyticsEventsBase {\n video: MediaVideoProps;\n height?: number;\n ratio?: number | 'auto';\n previewImg?: string;\n}\n\nexport interface MediaComponentVideoIframeProps {\n videoIframe: string;\n}\n\nexport interface MediaComponentYoutubeProps {\n youtube: string;\n previewImg?: string;\n fullscreen?: boolean;\n}\n\nexport interface MediaComponentImageProps {\n image: ImageProps | ImageProps[] | ImageDeviceProps;\n video?: MediaVideoProps;\n parallax?: boolean;\n height?: number;\n disableImageSliderForArrayInput?: boolean;\n}\n\nexport interface MediaComponentDataLensProps {\n dataLens: DataLensProps;\n}\n\nexport interface MediaComponentIframeProps {\n iframe: IframeProps;\n margins?: boolean;\n}\n\nexport interface MediaProps\n extends Animatable,\n Partial<MediaComponentDataLensProps>,\n Partial<MediaComponentYoutubeProps>,\n Partial<MediaComponentVideoIframeProps>,\n Partial<MediaComponentImageProps>,\n Partial<MediaComponentIframeProps>,\n Partial<MediaComponentVideoProps> {\n color?: string;\n videoMicrodata?: {\n name?: string;\n description?: string;\n duration?: string;\n uploadDate?: string;\n contentUrl?: string;\n thumbnailUrl?: string;\n };\n}\n\nexport interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {\n fullWidthMedia?: boolean;\n className?: string;\n mediaClassName?: string;\n}\n\nexport type Coordinate = number[];\n\nexport interface MapBaseProps {\n zoom?: number;\n className?: string;\n}\n\nexport interface GMapProps extends MapBaseProps {\n address: string;\n}\n\nexport interface YMapProps extends MapBaseProps {\n markers: YMapMarker[];\n id: string;\n}\n\nexport interface YMapMarker {\n address?: string;\n coordinate?: Coordinate;\n label?: YMapMarkerLabel;\n}\n\nexport interface YMapMarkerLabel {\n iconCaption?: string;\n iconContent?: string;\n iconColor?: string;\n preset?: string;\n}\n\nexport type MapProps = GMapProps | YMapProps;\n\nexport type ThemedMediaProps = ThemeSupporting<MediaProps>;\n\nexport interface DataLensObjectProps {\n id: string;\n theme: 'dark' | 'light';\n}\n\nexport interface IframeProps {\n src: string;\n width?: number;\n height?: number;\n title?: string;\n name?: string;\n}\n\nexport type DataLensProps = string | DataLensObjectProps;\n\nexport interface AuthorItem {\n firstName: string;\n secondName: string;\n description?: string;\n avatar?: ThemeSupporting<ImageProps> | JSX.Element;\n}\n\nexport interface HeaderBreadCrumbsProps extends ClassNameProps {\n items: {\n url: string;\n text: React.ReactNode;\n }[];\n theme?: TextTheme;\n analyticsEvents?: AnalyticsEventsProp;\n}\n\nexport interface TitleItemProps extends Justifyable, TitleItemBaseProps {\n navTitle?: string;\n anchor?: string;\n}\n\nexport interface TitleItemBaseProps {\n text: string;\n textSize?: TextSize;\n url?: string;\n urlTitle?: string;\n custom?: string | React.ReactNode;\n onClick?: () => void;\n}\n\nexport type MediaView = 'fit' | 'full';\n\n// card\nexport type MediaBorder = 'shadow' | 'line' | 'none';\nexport type CardBorder = MediaBorder;\nexport type ControlPosition = 'content' | 'footer';\n\nexport interface CardBaseProps {\n border?: CardBorder;\n}\n\nexport type CardLayoutProps = {\n controlPosition?: ControlPosition;\n};\n\n//price\nexport interface PriceDescriptionProps {\n title: string;\n detailedTitle?: string;\n description: string;\n label?: {\n color: PriceLabelColor;\n text?: string;\n size?: TextSize;\n };\n}\n\nexport interface PriceDetailsSettingsProps {\n title: string;\n description: string;\n}\n\nexport interface PriceDetailsListProps {\n text: string;\n}\n\nexport interface PriceDetailsProps {\n items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[];\n}\n\nexport interface PriceItemProps\n extends PriceDetailsProps,\n PriceDescriptionProps,\n AnalyticsEventsBase {}\n\nexport interface PriceFoldableDetailsProps {\n title: string;\n size?: TextSize;\n titleColor?: PriceDescriptionColor;\n}\n\n/** @deprecated */\nexport interface PriceDetailedProps extends CardBaseProps {\n items: PriceItemProps[];\n description?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n titleColor?: PriceDescriptionColor;\n };\n details?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n };\n priceType?: PriceDetailsType;\n numberGroupItems?: 3 | 4 | 5;\n isCombined?: boolean;\n useMixedView?: boolean;\n foldable?: PriceFoldableDetailsProps;\n labelsDefaultText?: Record<PriceLabelColor, string>;\n}\n\nexport interface AuthorProps extends QAProps {\n author: AuthorItem;\n className?: string;\n authorContainerClassName?: string;\n type?: AuthorType;\n theme?: ContentTheme;\n}\n\nexport interface TitleProps {\n title?: TitleItemProps | string;\n subtitle?: string;\n}\n\nexport interface YandexFormProps extends AnalyticsEventsBase {\n id: number | string;\n containerId?: string;\n theme?: string;\n className?: string;\n headerHeight?: number;\n customFormOrigin?: string;\n customFormSection?: string;\n params?: {[key: string]: string};\n\n onSubmit?: () => void;\n onLoad?: () => void;\n}\n\nexport interface WithBorder {\n border?: MediaBorder;\n /**\n * @deprecated use custom class for media-component\n */\n disableShadow?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"../../../../src","sources":["models/constructor-items/common.ts"],"names":[],"mappings":";;;AAOA,QAAQ;AACR,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,+CAA2B,CAAA;IAC3B,yCAAqB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,eAMX;AAND,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,8BAAW,CAAA;AACf,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,iCAAa,CAAA;IACb,iCAAa,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,yDAAmC,CAAA;IACnC,oEAA8C,CAAA;AAClD,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,+BAIX;AAJD,WAAY,+BAA+B;IACvC,gDAAa,CAAA;IACb,kDAAe,CAAA;IACf,oDAAiB,CAAA;AACrB,CAAC,EAJW,+BAA+B,+CAA/B,+BAA+B,QAI1C;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;AACrB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,6CAAmB,CAAA;IACnB,2CAAiB,CAAA;AACrB,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;AACpC,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAsED,SAAS;AAET,IAAY,MAIX;AAJD,WAAY,MAAM;IACd,6BAAmB,CAAA;IACnB,2BAAiB,CAAA;IACjB,2BAAiB,CAAA;AACrB,CAAC,EAJW,MAAM,sBAAN,MAAM,QAIjB","sourcesContent":["import * as React from 'react';\n\nimport {ButtonView, IconData, ButtonProps as UikitButtonProps} from '@gravity-ui/uikit';\n\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase, AnalyticsEventsProp, ClassNameProps, QAProps} from '../common';\n\n// enums\nexport enum AuthorType {\n Column = 'column',\n Line = 'line',\n}\n\nexport enum PriceDetailsType {\n MARKED_LIST = 'marked-list',\n SETTINGS = 'settings',\n}\n\nexport enum PriceLabelColor {\n BLUE = 'blue',\n GREEN = 'green',\n YELLOW = 'yellow',\n PURPLE = 'purple',\n RED = 'red',\n}\n\nexport enum PlayButtonType {\n Default = 'default',\n Text = 'text',\n}\n\nexport enum PlayButtonThemes {\n Blue = 'blue',\n Grey = 'grey',\n}\n\nexport enum CustomControlsType {\n WithMuteButton = 'with-mute-button',\n WithPlayPauseButton = 'with-play-pause-button',\n}\n\nexport enum CustomControlsButtonPositioning {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n}\n\nexport enum MediaVideoType {\n Default = 'default',\n Player = 'player',\n}\n\nexport enum MediaVideoControlsType {\n Default = 'default',\n Custom = 'custom',\n}\n\nexport enum QuoteType {\n Chevron = 'chevron', // « »\n EnglishDouble = 'english-double', // “ ”\n}\n\n// types\nexport type TextTheme = 'light' | 'dark';\nexport type TextSize = 'xs' | 's' | 'sm' | 'm' | 'l';\nexport type DividerSize = '0' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\nexport type HeaderWidth = 's' | 'm' | 'l';\nexport type HeaderImageSize = 's' | 'm';\nexport type HeaderOffset = 'default' | 'large';\nexport type Justify = 'start' | 'center' | 'end';\nexport type ColumnsCount = 1 | 2 | 3 | 4;\nexport type LegendTableMarkerType = 'disk' | 'tick';\nexport type LinkTheme = 'file-link' | 'normal' | 'back' | 'underline';\nexport type MediaDirection = 'media-content' | 'content-media';\nexport type PriceDescriptionColor = 'cornflower' | 'black';\nexport type ContentSize = 's' | 'm' | 'l';\nexport type ContentTextSize = 's' | 'm' | 'l';\nexport type ContentTheme = 'default' | 'dark' | 'light';\nexport type FileLinkType = 'vertical' | 'horizontal';\nexport type ImageCardMargins = 's' | 'm';\nexport type LayoutItemContentMargin = 'm' | 'l';\n\n// modifiers\nexport interface Themable {\n theme?: TextTheme;\n}\n\nexport interface Justifyable {\n justify?: Justify;\n}\n\nexport interface Stylable {\n className?: string;\n}\n\nexport interface Animatable {\n animated?: boolean;\n}\n\nexport interface Tabbable {\n tabIndex?: number;\n}\n\nexport interface Roleable {\n role?: React.AriaRole;\n}\n\nexport interface AriaProps {\n ariaProps?: React.AriaAttributes;\n}\n\n//common props\nexport interface Background {\n image?: string;\n color?: string;\n}\n\nexport interface AnchorProps {\n text: string;\n url: string;\n}\n\n/**\n * @deprecated Component VideoBlock will be deleted, which uses this logic\n */\ninterface LoopProps {\n start: number;\n end?: number;\n}\n\n// images\n\nexport enum Device {\n Desktop = 'desktop',\n Mobile = 'mobile',\n Tablet = 'tablet',\n}\n\nexport interface ImageInfoProps\n extends Pick<\n React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>,\n 'aria-describedby' | 'loading'\n >,\n ImageDevicesVisibleProps {\n alt?: string;\n fetchPriority?: 'high' | 'low' | 'auto';\n disableCompress?: boolean;\n}\n\nexport interface ImageObjectProps extends ImageInfoProps {\n src: string;\n}\n\nexport interface ImageDeviceProps extends ImageInfoProps {\n [Device.Desktop]: string;\n [Device.Mobile]: string;\n [Device.Tablet]?: string;\n}\n\nexport interface ImageDevicesVisibleProps {\n hide?: boolean | Partial<Record<Device, boolean>>;\n}\n\nexport type ImageProps = string | ImageObjectProps | ImageDeviceProps;\nexport type ThemedImage = ThemeSupporting<ImageProps>;\n\nexport interface BackgroundImageProps\n extends React.HTMLProps<HTMLDivElement>,\n Partial<ImageDeviceProps>,\n Partial<ImageObjectProps>,\n QAProps,\n ImageDevicesVisibleProps {\n style?: React.CSSProperties;\n imageClassName?: string;\n}\n\n//components props\nexport interface MediaVideoProps extends AnalyticsEventsBase {\n src: string[];\n type?: MediaVideoType;\n loop?: LoopProps | boolean;\n muted?: boolean;\n autoplay?: boolean;\n elapsedTime?: number;\n playButton?: PlayButtonProps;\n controls?: MediaVideoControlsType;\n customControlsOptions?: CustomControlsOptions;\n ariaLabel?: string;\n contain?: boolean;\n}\n\n// links\nexport interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {\n url: string;\n urlTitle?: string;\n text?: string;\n textSize?: TextSize;\n theme?: LinkTheme;\n colorTheme?: TextTheme;\n arrow?: boolean;\n target?: string;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\nexport interface FileLinkProps extends ClassNameProps, Tabbable {\n href: string;\n text: React.ReactNode;\n type?: FileLinkType;\n textSize?: TextSize;\n theme?: ContentTheme;\n urlTitle?: string;\n onClick?: () => void;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\n// buttons\nexport type ButtonTheme =\n | ButtonView\n | 'github'\n | 'app-store'\n | 'google-play'\n | 'scale'\n | 'monochrome';\n\nexport interface ButtonProps\n extends AnalyticsEventsBase,\n Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {\n text: string;\n url: string;\n urlTitle?: string;\n primary?: boolean;\n theme?: ButtonTheme;\n img?: ButtonImageProps | string;\n target?: string;\n}\n\nexport type ButtonImagePosition = 'left' | 'right';\n\nexport interface ButtonImageProps {\n url?: string;\n position?: ButtonImagePosition;\n alt?: string;\n iconData?: IconData;\n iconSize?: number;\n className?: string;\n}\n\nexport interface CustomControlsOptions {\n type?: CustomControlsType;\n muteButtonShown?: boolean;\n positioning?: CustomControlsButtonPositioning;\n}\n\nexport interface PlayButtonProps extends ClassNameProps {\n type?: PlayButtonType;\n theme?: PlayButtonThemes;\n text?: string;\n}\n\nexport type ThemedMediaVideoProps = ThemeSupporting<MediaVideoProps>;\n\nexport interface MediaComponentVideoProps extends AnalyticsEventsBase {\n video: MediaVideoProps;\n height?: number;\n ratio?: number | 'auto';\n previewImg?: string;\n}\n\nexport interface MediaComponentVideoIframeProps {\n videoIframe: string;\n}\n\nexport interface MediaComponentYoutubeProps {\n youtube: string;\n previewImg?: string;\n fullscreen?: boolean;\n}\n\nexport interface MediaComponentImageProps {\n image: ImageProps | ImageProps[] | ImageDeviceProps;\n video?: MediaVideoProps;\n parallax?: boolean;\n height?: number;\n disableImageSliderForArrayInput?: boolean;\n}\n\nexport interface MediaComponentDataLensProps {\n dataLens: DataLensProps;\n}\n\nexport interface MediaComponentIframeProps {\n iframe: IframeProps;\n margins?: boolean;\n}\n\nexport interface MediaProps\n extends Animatable,\n Partial<MediaComponentDataLensProps>,\n Partial<MediaComponentYoutubeProps>,\n Partial<MediaComponentVideoIframeProps>,\n Partial<MediaComponentImageProps>,\n Partial<MediaComponentIframeProps>,\n Partial<MediaComponentVideoProps> {\n color?: string;\n videoMicrodata?: {\n name?: string;\n description?: string;\n duration?: string;\n uploadDate?: string;\n contentUrl?: string;\n thumbnailUrl?: string;\n };\n}\n\nexport interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {\n fullWidthMedia?: boolean;\n className?: string;\n mediaClassName?: string;\n}\n\nexport type Coordinate = number[];\n\nexport interface MapBaseProps {\n zoom?: number;\n className?: string;\n}\n\nexport interface GMapProps extends MapBaseProps {\n address: string;\n}\n\nexport interface YMapProps extends MapBaseProps {\n markers: YMapMarker[];\n id: string;\n}\n\nexport interface YMapMarker {\n address?: string;\n coordinate?: Coordinate;\n label?: YMapMarkerLabel;\n}\n\nexport interface YMapMarkerLabel {\n iconCaption?: string;\n iconContent?: string;\n iconColor?: string;\n preset?: string;\n}\n\nexport type MapProps = GMapProps | YMapProps;\n\nexport type ThemedMediaProps = ThemeSupporting<MediaProps>;\n\nexport interface DataLensObjectProps {\n id: string;\n theme: 'dark' | 'light';\n}\n\nexport interface IframeProps {\n src: string;\n width?: number;\n height?: number;\n title?: string;\n name?: string;\n}\n\nexport type DataLensProps = string | DataLensObjectProps;\n\nexport interface AuthorItem {\n firstName: string;\n secondName: string;\n description?: string;\n avatar?: ThemeSupporting<ImageProps> | JSX.Element;\n}\n\nexport interface HeaderBreadCrumbsProps extends ClassNameProps {\n items: {\n url: string;\n text: React.ReactNode;\n }[];\n theme?: TextTheme;\n analyticsEvents?: AnalyticsEventsProp;\n}\n\nexport interface TitleItemProps extends Justifyable, TitleItemBaseProps {\n navTitle?: string;\n anchor?: string;\n}\n\nexport interface TitleItemBaseProps {\n text: string;\n textSize?: TextSize;\n url?: string;\n urlTitle?: string;\n custom?: string | React.ReactNode;\n onClick?: () => void;\n}\n\nexport type MediaView = 'fit' | 'full';\n\n// card\nexport type MediaBorder = 'shadow' | 'line' | 'none';\nexport type CardBorder = MediaBorder;\nexport type ControlPosition = 'content' | 'footer';\n\nexport interface CardBaseProps {\n border?: CardBorder;\n}\n\nexport type CardLayoutProps = {\n controlPosition?: ControlPosition;\n};\n\n//price\nexport interface PriceDescriptionProps {\n title: string;\n detailedTitle?: string;\n description: string;\n label?: {\n color: PriceLabelColor;\n text?: string;\n size?: TextSize;\n };\n}\n\nexport interface PriceDetailsSettingsProps {\n title: string;\n description: string;\n}\n\nexport interface PriceDetailsListProps {\n text: string;\n}\n\nexport interface PriceDetailsProps {\n items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[];\n}\n\nexport interface PriceItemProps\n extends PriceDetailsProps,\n PriceDescriptionProps,\n AnalyticsEventsBase {}\n\nexport interface PriceFoldableDetailsProps {\n title: string;\n size?: TextSize;\n titleColor?: PriceDescriptionColor;\n}\n\n/** @deprecated */\nexport interface PriceDetailedProps extends CardBaseProps {\n items: PriceItemProps[];\n description?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n titleColor?: PriceDescriptionColor;\n };\n details?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n };\n priceType?: PriceDetailsType;\n numberGroupItems?: 3 | 4 | 5;\n isCombined?: boolean;\n useMixedView?: boolean;\n foldable?: PriceFoldableDetailsProps;\n labelsDefaultText?: Record<PriceLabelColor, string>;\n}\n\nexport interface AuthorProps extends QAProps {\n author: AuthorItem;\n className?: string;\n authorContainerClassName?: string;\n type?: AuthorType;\n theme?: ContentTheme;\n}\n\nexport interface TitleProps {\n title?: TitleItemProps | string;\n subtitle?: string;\n}\n\nexport interface YandexFormProps extends AnalyticsEventsBase {\n id: number | string;\n containerId?: string;\n theme?: string;\n className?: string;\n headerHeight?: number;\n customFormOrigin?: string;\n customFormSection?: string;\n params?: {[key: string]: string};\n\n onSubmit?: () => void;\n onLoad?: () => void;\n}\n\nexport interface WithBorder {\n border?: MediaBorder;\n /**\n * @deprecated use custom class for media-component\n */\n disableShadow?: boolean;\n}\n"]}
|
|
@@ -98,7 +98,7 @@ export interface QuoteProps extends Themable, CardBaseProps {
|
|
|
98
98
|
quoteType?: QuoteType;
|
|
99
99
|
button?: ButtonProps;
|
|
100
100
|
}
|
|
101
|
-
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, '
|
|
101
|
+
export interface BackgroundCardProps extends CardBaseProps, AnalyticsEventsBase, CardLayoutProps, Omit<ContentBlockProps, 'centered' | 'controlPosition'> {
|
|
102
102
|
url?: string;
|
|
103
103
|
urlTitle?: string;
|
|
104
104
|
background?: ThemeSupporting<ImageObjectProps>;
|
|
@@ -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;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, '
|
|
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, '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, size = 's', } = props;
|
|
12
|
+
const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, colSizes = { all: 12, md: 12 }, 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: size, theme: cardTheme, links: links, buttons: buttons, list: list, colSizes:
|
|
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: colSizes, 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,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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AAK,EAAE,SAAS,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,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 colSizes = {all: 12, md: 12},\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={colSizes}\n controlPosition={areControlsInFooter ? 'bottom' : 'default'}\n />\n </CardBase.Content>\n </CardBase>\n );\n};\n\nexport default BackgroundCard;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["sub-blocks/BackgroundCard/schema.ts"],"names":[],"mappings":";;;;AAAA,kEAA+B;AAE/B,6DAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["sub-blocks/BackgroundCard/schema.ts"],"names":[],"mappings":";;;;AAAA,kEAA+B;AAE/B,6DAA+D;AAC/D,8DAMwC;AACxC,4DAAmE;AACnE,iDAA8C;AAE9C,MAAM,0BAA0B,GAAG,IAAA,cAAI,EAAC,oBAAW,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAErE,QAAA,cAAc,GAAG;IAC1B,iBAAiB,EAAE;QACf,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;QAC3B,UAAU,EAAE;YACR,GAAG,kBAAS;YACZ,GAAG,iBAAQ;YACX,GAAG,wBAAe;YAClB,GAAG,0BAA0B;YAC7B,GAAG,EAAE;gBACD,IAAI,EAAE,QAAQ;aACjB;YACD,QAAQ,EAAE;gBACN,IAAI,EAAE,QAAQ;aACjB;YACD,UAAU,EAAE,IAAA,kBAAS,EAAC,yBAAgB,CAAC;YACvC,eAAe,EAAE;gBACb,IAAI,EAAE,QAAQ;aACjB;YACD,aAAa,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC;aAC9B;YACD,eAAe,EAAE;gBACb,KAAK,EAAE;oBACH;wBACI,GAAG,4BAAoB;wBACvB,UAAU,EAAE,QAAQ;qBACvB;oBACD;wBACI,IAAI,EAAE,OAAO;wBACb,KAAK,EAAE,4BAAoB;wBAC3B,UAAU,EAAE,MAAM;qBACrB;iBACJ;aACJ;YACD,eAAe,EAAE;gBACb,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;aAC9B;YACD,QAAQ,EAAE,6BAAoB;SACjC;KACJ;CACJ,CAAC","sourcesContent":["import omit from 'lodash/omit';\n\nimport {ImageObjectProps} from '../../components/Image/schema';\nimport {\n BaseProps,\n CardBase,\n CardLayoutProps,\n containerSizesObject,\n withTheme,\n} from '../../schema/validators/common';\nimport {AnalyticsEventSchema} from '../../schema/validators/event';\nimport {ContentBase} from '../Content/schema';\n\nconst BackgroundCardContentProps = omit(ContentBase, ['size', 'controlPosition']);\n\nexport const BackgroundCard = {\n 'background-card': {\n additionalProperties: false,\n required: ['title', 'text'],\n properties: {\n ...BaseProps,\n ...CardBase,\n ...CardLayoutProps,\n ...BackgroundCardContentProps,\n url: {\n type: 'string',\n },\n urlTitle: {\n type: 'string',\n },\n background: withTheme(ImageObjectProps),\n backgroundColor: {\n type: 'string',\n },\n paddingBottom: {\n type: 'string',\n enum: ['s', 'm', 'l', 'xl'],\n },\n analyticsEvents: {\n oneOf: [\n {\n ...AnalyticsEventSchema,\n optionName: 'single',\n },\n {\n type: 'array',\n items: AnalyticsEventSchema,\n optionName: 'list',\n },\n ],\n },\n controlPosition: {\n type: 'string',\n enum: ['content', 'footer'],\n },\n colSizes: containerSizesObject,\n },\n },\n};\n"]}
|
|
@@ -107,10 +107,6 @@ function parseContentLayoutTitle(transformer, content) {
|
|
|
107
107
|
}
|
|
108
108
|
return content;
|
|
109
109
|
}
|
|
110
|
-
const parseBackgroundCardItems = (transformer, items) => items.map(({ text, ...rest }) => ({
|
|
111
|
-
text: text && parseTitle(transformer, text),
|
|
112
|
-
...rest,
|
|
113
|
-
}));
|
|
114
110
|
exports.blockHeaderTransformer = [
|
|
115
111
|
{
|
|
116
112
|
fields: ['title'],
|
|
@@ -140,11 +136,6 @@ exports.config = {
|
|
|
140
136
|
fields: ['title', 'text', 'additionalInfo'],
|
|
141
137
|
transformer: common_1.yfmTransformer,
|
|
142
138
|
},
|
|
143
|
-
{
|
|
144
|
-
fields: ['list'],
|
|
145
|
-
parser: parseBackgroundCardItems,
|
|
146
|
-
transformer: common_1.typografTransformer,
|
|
147
|
-
},
|
|
148
139
|
{
|
|
149
140
|
fields: ['list'],
|
|
150
141
|
transformer: common_1.yfmTransformer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"../../../src","sources":["text-transform/config.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,4EAA4E;;;AAE5E,+CAYmB;AAEnB,wCAOkB;AAElB,SAAS,qBAAqB,CAAC,WAAwB,EAAE,OAAmB;IACxE,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAE/B,OAAO;QACH,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;QAClB,MAAM,EAAE,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KAChE,CAAC;AACN,CAAC;AAED,SAAS,sBAAsB,CAAC,WAAwB,EAAE,OAAmB;IACzE,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAC/B,MAAM,YAAY,GAAG,OAAO,EAAE,OAAO,CAAC;IAEtC,OAAO;QACH,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;QAClB,OAAO,EACH,YAAY;YACZ,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CACxB,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;gBAChB,IAAI,MAAM,EAAE,CAAC;oBACT,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;wBACrB,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;oBAC7B,CAAC;oBACD,OAAO,IAAI,CAAC;gBAChB,CAAC;qBAAM,CAAC;oBACJ,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC7B,CAAC;YACL,CAAC,CAAC,CACL;KACR,CAAC;AACN,CAAC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AI;SACrB;KACJ;IACD,CAAC,kBAAS,CAAC,eAAe,CAAC,EAAE,8BAAsB;IACnD,CAAC,kBAAS,CAAC,WAAW,CAAC,EAAE,8BAAsB;IAC/C,CAAC,kBAAS,CAAC,UAAU,CAAC,EAAE,8BAAsB;IAC9C,CAAC,qBAAY,CAAC,SAAS,CAAC,EAAE;QACtB;YACI,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,WAAW,EAAE,uBAAc;YAC3B,YAAY,EAAE,IAAI;SACrB;QACD;YACI,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,uBAAc;YAC3B,MAAM,EAAE,IAAA,0BAAiB,EAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAC/C;KACJ;IACD,CAAC,kBAAS,CAAC,SAAS,CAAC,EAAE;QACnB;YACI,MAAM,EAAE,CAAC,aAAa,CAAC;YACvB,WAAW,EAAE,uBAAc;YAC3B,MAAM,EAAE,kBAAkB;SAC7B;QACD;YACI,MAAM,EAAE,CAAC,aAAa,CAAC;YACvB,WAAW,EAAE,uBAAc;YAC3B,MAAM,EAAE,uBAAuB;YAC/B,YAAY,EAAE,IAAI;SACrB;KACJ;CACJ,CAAC","sourcesContent":["/* eslint-disable no-param-reassign */\n/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */\n\nimport {\n BlockType,\n ContentBlockProps,\n ContentItemProps,\n ExtendedFeaturesItem,\n PriceDetailedProps,\n PriceDetailsListProps,\n PriceDetailsSettingsProps,\n PromoFeaturesItem,\n SubBlockType,\n TableProps,\n TitleItemProps,\n} from '../models';\n\nimport {\n Parser,\n Transformer,\n TransformerRaw,\n createItemsParser,\n typografTransformer,\n yfmTransformer,\n} from './common';\n\nfunction parseTableBlockLegend(transformer: Transformer, content: TableProps) {\n const legend = content?.legend;\n\n return {\n ...(content || {}),\n legend: legend && legend.map((string) => transformer(string)),\n };\n}\n\nfunction parseTableBlockContent(transformer: Transformer, content: TableProps) {\n const legend = content?.legend;\n const tableContent = content?.content;\n\n return {\n ...(content || {}),\n content:\n tableContent &&\n tableContent.map((row, i) =>\n row.map((cell, j) => {\n if (legend) {\n if (i === 0 || j === 0) {\n return transformer(cell);\n }\n return cell;\n } else {\n return transformer(cell);\n }\n }),\n ),\n };\n}\n\nfunction parseFeatures(transformer: Transformer, items: ExtendedFeaturesItem[]) {\n return items.map(({title, text, ...rest}) => ({\n title: title && transformer(title),\n text: text && transformer(text),\n ...rest,\n }));\n}\n\nfunction parsePromoFeatures(transformer: Transformer, items: PromoFeaturesItem[]) {\n return items.map(({text, ...rest}) => ({\n text: transformer(text),\n ...rest,\n }));\n}\n\nconst parseTitle = (transformer: Transformer, title: TitleItemProps | string) =>\n typeof title === 'object' && 'text' in title\n ? {...title, text: transformer(title.text)}\n : title && transformer(title);\n\nconst parseItemsTitle = (transformer: Transformer, items: ExtendedFeaturesItem[]) =>\n items.map(({title, ...rest}) => ({\n title: title && parseTitle(transformer, title),\n ...rest,\n }));\n\nfunction parsePriceDetailedBlock(transformer: Transformer, block: PriceDetailedProps) {\n const {priceType} = block;\n\n /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */\n block.items = block.items.map((item) => {\n const {description, items: details = []} = item;\n\n if (priceType === 'marked-list') {\n item.items = (details as PriceDetailsListProps[]).map((detail) => {\n detail.text = detail.text && transformer(detail.text);\n\n return detail;\n });\n } else {\n item.items = (details as PriceDetailsSettingsProps[]).map((detail) => {\n detail.description = detail.description && transformer(detail.description);\n\n return detail;\n });\n }\n\n item.description = transformer(description);\n\n return item;\n });\n /* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */\n\n return block;\n}\n\nconst parseContentLayout = (transformer: Transformer, content: ContentBlockProps) => {\n if (content) {\n const {text, additionalInfo, list} = content;\n\n /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */\n if (text) {\n content.text = transformer(text);\n }\n\n if (additionalInfo) {\n content.additionalInfo = transformer(additionalInfo);\n }\n\n if (list) {\n content.list = list.map((item) => {\n if (item?.text) {\n return {\n ...item,\n text: transformer(item.text),\n };\n }\n\n return item;\n });\n }\n /* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */\n }\n\n return content;\n};\n\nfunction parseContentLayoutTitle(transformer: Transformer, content: ContentBlockProps) {\n if (content?.title) {\n const {title} = content;\n\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign\n content.title = title && parseTitle(transformer, title);\n }\n\n return content;\n}\n\nconst parseBackgroundCardItems = (transformer: Transformer, items: ContentItemProps[]) =>\n items.map(({text, ...rest}) => ({\n text: text && parseTitle(transformer, text),\n ...rest,\n }));\n\nexport const blockHeaderTransformer = [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n parser: parseTitle,\n renderInline: true,\n },\n {\n fields: ['description'],\n transformer: yfmTransformer,\n },\n];\n\ninterface BlockConfig {\n transformer: TransformerRaw;\n fields?: string[];\n parser?: Parser;\n renderInline?: boolean;\n}\n\nexport type BlocksConfig = Record<string, BlockConfig | BlockConfig[]>;\n\nexport const config: BlocksConfig = {\n [SubBlockType.BasicCard]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.BackgroundCard]: [\n {\n fields: ['title', 'text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['list'],\n parser: parseBackgroundCardItems,\n transformer: typografTransformer,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text']),\n },\n ],\n [SubBlockType.ImageCard]: [\n {\n fields: ['title', 'text', 'additionalInfo'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n ],\n [SubBlockType.LayoutItem]: [\n {\n fields: ['content'],\n parser: parseContentLayout,\n transformer: yfmTransformer,\n },\n {\n fields: ['content'],\n parser: parseContentLayoutTitle,\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['metaInfo'],\n parser: createItemsParser([]),\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.Quote]: [\n {\n fields: ['text', 'yfmText'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n ],\n [BlockType.ExtendedFeaturesBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title']),\n renderInline: true,\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text', 'additionalInfo']),\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['list.text']),\n renderInline: true,\n },\n ],\n [BlockType.PromoFeaturesBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parsePromoFeatures,\n },\n ],\n [BlockType.SliderOldBlock]: blockHeaderTransformer,\n [BlockType.SliderBlock]: blockHeaderTransformer,\n [BlockType.CompaniesBlock]: blockHeaderTransformer,\n [BlockType.QuestionsBlock]: [\n {\n fields: ['title', 'text', 'additionalInfo'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parseFeatures,\n },\n ],\n [BlockType.FoldableListBlock]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parseFeatures,\n },\n ],\n\n [BlockType.BannerBlock]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['subtitle'],\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.BannerCard]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['subtitle'],\n transformer: yfmTransformer,\n },\n ],\n [BlockType.MediaBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text']),\n },\n ],\n [BlockType.MapBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['title', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n ],\n [BlockType.TabsBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text', 'additionalInfo', 'caption']),\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parseItemsTitle,\n renderInline: true,\n },\n ],\n [BlockType.TableBlock]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['table'],\n transformer: yfmTransformer,\n parser: parseTableBlockLegend,\n },\n {\n fields: ['table'],\n transformer: yfmTransformer,\n parser: parseTableBlockContent,\n renderInline: true,\n },\n ],\n [BlockType.HeaderSliderBlock]: [\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title', 'overtitle', 'description']),\n renderInline: true,\n },\n ],\n [SubBlockType.PriceDetailed]: [\n {\n transformer: yfmTransformer,\n parser: parsePriceDetailedBlock,\n },\n ],\n [BlockType.HeaderBlock]: [\n {\n fields: ['description', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['overtitle', 'title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n ],\n [BlockType.ContentLayoutBlock]: [\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayoutTitle,\n renderInline: true,\n },\n ],\n [SubBlockType.Content]: [\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['title'],\n transformer: yfmTransformer,\n parser: parseTitle,\n renderInline: true,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title', 'text']),\n },\n ],\n [BlockType.InfoBlock]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['rightContent', 'leftContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['rightContent', 'leftContent'],\n transformer: yfmTransformer,\n parser: parseContentLayoutTitle,\n renderInline: true,\n },\n ],\n [BlockType.ShareBlock]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n ],\n [BlockType.CardLayoutBlock]: blockHeaderTransformer,\n [BlockType.FilterBlock]: blockHeaderTransformer,\n [BlockType.IconsBlock]: blockHeaderTransformer,\n [SubBlockType.PriceCard]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title', 'text']),\n },\n ],\n [BlockType.FormBlock]: [\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayoutTitle,\n renderInline: true,\n },\n ],\n};\n"]}
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"../../../src","sources":["text-transform/config.ts"],"names":[],"mappings":";AAAA,sCAAsC;AACtC,4EAA4E;;;AAE5E,+CAWmB;AAEnB,wCAOkB;AAElB,SAAS,qBAAqB,CAAC,WAAwB,EAAE,OAAmB;IACxE,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAE/B,OAAO;QACH,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;QAClB,MAAM,EAAE,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;KAChE,CAAC;AACN,CAAC;AAED,SAAS,sBAAsB,CAAC,WAAwB,EAAE,OAAmB;IACzE,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAC/B,MAAM,YAAY,GAAG,OAAO,EAAE,OAAO,CAAC;IAEtC,OAAO;QACH,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC;QAClB,OAAO,EACH,YAAY;YACZ,YAAY,C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AO,CAAC;YACjB,WAAW,EAAE,uBAAc;YAC3B,YAAY,EAAE,IAAI;SACrB;KACJ;IACD,CAAC,kBAAS,CAAC,eAAe,CAAC,EAAE,8BAAsB;IACnD,CAAC,kBAAS,CAAC,WAAW,CAAC,EAAE,8BAAsB;IAC/C,CAAC,kBAAS,CAAC,UAAU,CAAC,EAAE,8BAAsB;IAC9C,CAAC,qBAAY,CAAC,SAAS,CAAC,EAAE;QACtB;YACI,MAAM,EAAE,CAAC,OAAO,CAAC;YACjB,WAAW,EAAE,uBAAc;YAC3B,YAAY,EAAE,IAAI;SACrB;QACD;YACI,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,uBAAc;YAC3B,MAAM,EAAE,IAAA,0BAAiB,EAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAC/C;KACJ;IACD,CAAC,kBAAS,CAAC,SAAS,CAAC,EAAE;QACnB;YACI,MAAM,EAAE,CAAC,aAAa,CAAC;YACvB,WAAW,EAAE,uBAAc;YAC3B,MAAM,EAAE,kBAAkB;SAC7B;QACD;YACI,MAAM,EAAE,CAAC,aAAa,CAAC;YACvB,WAAW,EAAE,uBAAc;YAC3B,MAAM,EAAE,uBAAuB;YAC/B,YAAY,EAAE,IAAI;SACrB;KACJ;CACJ,CAAC","sourcesContent":["/* eslint-disable no-param-reassign */\n/* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */\n\nimport {\n BlockType,\n ContentBlockProps,\n ExtendedFeaturesItem,\n PriceDetailedProps,\n PriceDetailsListProps,\n PriceDetailsSettingsProps,\n PromoFeaturesItem,\n SubBlockType,\n TableProps,\n TitleItemProps,\n} from '../models';\n\nimport {\n Parser,\n Transformer,\n TransformerRaw,\n createItemsParser,\n typografTransformer,\n yfmTransformer,\n} from './common';\n\nfunction parseTableBlockLegend(transformer: Transformer, content: TableProps) {\n const legend = content?.legend;\n\n return {\n ...(content || {}),\n legend: legend && legend.map((string) => transformer(string)),\n };\n}\n\nfunction parseTableBlockContent(transformer: Transformer, content: TableProps) {\n const legend = content?.legend;\n const tableContent = content?.content;\n\n return {\n ...(content || {}),\n content:\n tableContent &&\n tableContent.map((row, i) =>\n row.map((cell, j) => {\n if (legend) {\n if (i === 0 || j === 0) {\n return transformer(cell);\n }\n return cell;\n } else {\n return transformer(cell);\n }\n }),\n ),\n };\n}\n\nfunction parseFeatures(transformer: Transformer, items: ExtendedFeaturesItem[]) {\n return items.map(({title, text, ...rest}) => ({\n title: title && transformer(title),\n text: text && transformer(text),\n ...rest,\n }));\n}\n\nfunction parsePromoFeatures(transformer: Transformer, items: PromoFeaturesItem[]) {\n return items.map(({text, ...rest}) => ({\n text: transformer(text),\n ...rest,\n }));\n}\n\nconst parseTitle = (transformer: Transformer, title: TitleItemProps | string) =>\n typeof title === 'object' && 'text' in title\n ? {...title, text: transformer(title.text)}\n : title && transformer(title);\n\nconst parseItemsTitle = (transformer: Transformer, items: ExtendedFeaturesItem[]) =>\n items.map(({title, ...rest}) => ({\n title: title && parseTitle(transformer, title),\n ...rest,\n }));\n\nfunction parsePriceDetailedBlock(transformer: Transformer, block: PriceDetailedProps) {\n const {priceType} = block;\n\n /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */\n block.items = block.items.map((item) => {\n const {description, items: details = []} = item;\n\n if (priceType === 'marked-list') {\n item.items = (details as PriceDetailsListProps[]).map((detail) => {\n detail.text = detail.text && transformer(detail.text);\n\n return detail;\n });\n } else {\n item.items = (details as PriceDetailsSettingsProps[]).map((detail) => {\n detail.description = detail.description && transformer(detail.description);\n\n return detail;\n });\n }\n\n item.description = transformer(description);\n\n return item;\n });\n /* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */\n\n return block;\n}\n\nconst parseContentLayout = (transformer: Transformer, content: ContentBlockProps) => {\n if (content) {\n const {text, additionalInfo, list} = content;\n\n /* eslint-disable no-not-accumulator-reassign/no-not-accumulator-reassign */\n if (text) {\n content.text = transformer(text);\n }\n\n if (additionalInfo) {\n content.additionalInfo = transformer(additionalInfo);\n }\n\n if (list) {\n content.list = list.map((item) => {\n if (item?.text) {\n return {\n ...item,\n text: transformer(item.text),\n };\n }\n\n return item;\n });\n }\n /* eslint-enable no-not-accumulator-reassign/no-not-accumulator-reassign */\n }\n\n return content;\n};\n\nfunction parseContentLayoutTitle(transformer: Transformer, content: ContentBlockProps) {\n if (content?.title) {\n const {title} = content;\n\n // eslint-disable-next-line no-not-accumulator-reassign/no-not-accumulator-reassign\n content.title = title && parseTitle(transformer, title);\n }\n\n return content;\n}\n\nexport const blockHeaderTransformer = [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n parser: parseTitle,\n renderInline: true,\n },\n {\n fields: ['description'],\n transformer: yfmTransformer,\n },\n];\n\ninterface BlockConfig {\n transformer: TransformerRaw;\n fields?: string[];\n parser?: Parser;\n renderInline?: boolean;\n}\n\nexport type BlocksConfig = Record<string, BlockConfig | BlockConfig[]>;\n\nexport const config: BlocksConfig = {\n [SubBlockType.BasicCard]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.BackgroundCard]: [\n {\n fields: ['title', 'text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text']),\n },\n ],\n [SubBlockType.ImageCard]: [\n {\n fields: ['title', 'text', 'additionalInfo'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n ],\n [SubBlockType.LayoutItem]: [\n {\n fields: ['content'],\n parser: parseContentLayout,\n transformer: yfmTransformer,\n },\n {\n fields: ['content'],\n parser: parseContentLayoutTitle,\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['metaInfo'],\n parser: createItemsParser([]),\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.Quote]: [\n {\n fields: ['text', 'yfmText'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n ],\n [BlockType.ExtendedFeaturesBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title']),\n renderInline: true,\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text', 'additionalInfo']),\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['list.text']),\n renderInline: true,\n },\n ],\n [BlockType.PromoFeaturesBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parsePromoFeatures,\n },\n ],\n [BlockType.SliderOldBlock]: blockHeaderTransformer,\n [BlockType.SliderBlock]: blockHeaderTransformer,\n [BlockType.CompaniesBlock]: blockHeaderTransformer,\n [BlockType.QuestionsBlock]: [\n {\n fields: ['title', 'text', 'additionalInfo'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parseFeatures,\n },\n ],\n [BlockType.FoldableListBlock]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parseFeatures,\n },\n ],\n\n [BlockType.BannerBlock]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['subtitle'],\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.BannerCard]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['subtitle'],\n transformer: yfmTransformer,\n },\n ],\n [BlockType.MediaBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text']),\n },\n ],\n [BlockType.MapBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['title', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n ],\n [BlockType.TabsBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text', 'additionalInfo', 'caption']),\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parseItemsTitle,\n renderInline: true,\n },\n ],\n [BlockType.TableBlock]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['table'],\n transformer: yfmTransformer,\n parser: parseTableBlockLegend,\n },\n {\n fields: ['table'],\n transformer: yfmTransformer,\n parser: parseTableBlockContent,\n renderInline: true,\n },\n ],\n [BlockType.HeaderSliderBlock]: [\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title', 'overtitle', 'description']),\n renderInline: true,\n },\n ],\n [SubBlockType.PriceDetailed]: [\n {\n transformer: yfmTransformer,\n parser: parsePriceDetailedBlock,\n },\n ],\n [BlockType.HeaderBlock]: [\n {\n fields: ['description', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['overtitle', 'title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n ],\n [BlockType.ContentLayoutBlock]: [\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayoutTitle,\n renderInline: true,\n },\n ],\n [SubBlockType.Content]: [\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['title'],\n transformer: yfmTransformer,\n parser: parseTitle,\n renderInline: true,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title', 'text']),\n },\n ],\n [BlockType.InfoBlock]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['rightContent', 'leftContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['rightContent', 'leftContent'],\n transformer: yfmTransformer,\n parser: parseContentLayoutTitle,\n renderInline: true,\n },\n ],\n [BlockType.ShareBlock]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n ],\n [BlockType.CardLayoutBlock]: blockHeaderTransformer,\n [BlockType.FilterBlock]: blockHeaderTransformer,\n [BlockType.IconsBlock]: blockHeaderTransformer,\n [SubBlockType.PriceCard]: [\n {\n fields: ['title'],\n transformer: yfmTransformer,\n renderInline: true,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title', 'text']),\n },\n ],\n [BlockType.FormBlock]: [\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayoutTitle,\n renderInline: true,\n },\n ],\n};\n"]}
|
|
@@ -6,13 +6,8 @@ unpredictable css rules order in build */
|
|
|
6
6
|
.pc-button-block__content {
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
width: 18px;
|
|
12
|
-
height: 18px;
|
|
13
|
-
}
|
|
14
|
-
.pc-button-block__image + .pc-button-block__text, .pc-button-block__text + .pc-button-block__image {
|
|
15
|
-
margin-left: var(--btn-image-margin);
|
|
9
|
+
justify-content: center;
|
|
10
|
+
gap: var(--g-spacing-2);
|
|
16
11
|
}
|
|
17
12
|
.pc-button-block_theme_github.pc-button-block_theme_github.pc-button-block_theme_github.pc-button-block_theme_github {
|
|
18
13
|
--g-button-background-color: var(--pc-monochrome-button-background-color);
|
|
@@ -10,6 +10,7 @@ import { block, setUrlTld } from "../../utils/index.js";
|
|
|
10
10
|
import { i18n } from "./i18n/index.js";
|
|
11
11
|
import { ICON_QA, toCommonSize, toCommonView } from "./utils.js";
|
|
12
12
|
import './Button.css';
|
|
13
|
+
const DEFAULT_IMG_SIZE = 16;
|
|
13
14
|
const b = block('button-block');
|
|
14
15
|
// eslint-disable-next-line complexity
|
|
15
16
|
const Button = (props) => {
|
|
@@ -25,7 +26,14 @@ const Button = (props) => {
|
|
|
25
26
|
}, [handleAnalytics, analyticsEvents, onClickOrigin]);
|
|
26
27
|
const buttonModifiers = { size, theme, width };
|
|
27
28
|
const buttonImg = img instanceof Object
|
|
28
|
-
? {
|
|
29
|
+
? {
|
|
30
|
+
url: img.url,
|
|
31
|
+
iconData: img.iconData,
|
|
32
|
+
iconSize: img.iconSize,
|
|
33
|
+
className: img.className,
|
|
34
|
+
position: img.position || defaultImgPosition,
|
|
35
|
+
alt: img.alt,
|
|
36
|
+
}
|
|
29
37
|
: { url: img, position: defaultImgPosition };
|
|
30
38
|
const buttonClass = img
|
|
31
39
|
? b({ position: buttonImg.position, ...buttonModifiers }, className)
|
|
@@ -40,7 +48,16 @@ const Button = (props) => {
|
|
|
40
48
|
return _jsx(StoreBadge, { className: buttonClass, platform: platform, href: url });
|
|
41
49
|
}
|
|
42
50
|
let icon;
|
|
43
|
-
let image
|
|
51
|
+
let image;
|
|
52
|
+
if (img && buttonImg.iconData) {
|
|
53
|
+
const iconSize = buttonImg.iconSize;
|
|
54
|
+
const iconClassName = buttonImg.className ? b('icon', buttonImg.className) : b('icon');
|
|
55
|
+
icon = (_jsx(Icon, { className: iconClassName, data: buttonImg.iconData, size: iconSize, qa: ICON_QA }));
|
|
56
|
+
}
|
|
57
|
+
else if (img && buttonImg.url) {
|
|
58
|
+
image = (_jsx("img", { className: b('image'), width: buttonImg.iconSize || DEFAULT_IMG_SIZE, height: buttonImg.iconSize || DEFAULT_IMG_SIZE, src: buttonImg.url, alt: buttonImg.alt || i18n('image-alt') }));
|
|
59
|
+
}
|
|
60
|
+
// Special handling for github theme (for backwards compatibility)
|
|
44
61
|
if (theme === 'github') {
|
|
45
62
|
icon = _jsx(Icon, { className: b('icon'), data: Github, size: 24, qa: ICON_QA });
|
|
46
63
|
image = undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"../../../../src","sources":["components/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,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AAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAC1C,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {StoreBadge} from '@gravity-ui/components';\nimport {\n Button as CommonButton,\n Icon,\n Platform,\n ButtonProps as UIKitButtonProps,\n} from '@gravity-ui/uikit';\n\nimport {LocaleContext} from '../../context/localeContext/localeContext';\nimport {useAnalytics} from '../../hooks';\nimport {Github} from '../../icons';\nimport {ButtonProps as ButtonParams, DefaultEventNames, QAProps} from '../../models';\nimport {block, setUrlTld} from '../../utils';\n\nimport {i18n} from './i18n';\nimport {ICON_QA, OldButtonSize, OldButtonTheme, toCommonSize, toCommonView} from './utils';\n\nimport './Button.scss';\n\nconst DEFAULT_IMG_SIZE = 16;\n\nexport interface ButtonProps extends Omit<ButtonParams, 'url'>, QAProps {\n className?: string;\n id?: string;\n url?: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;\n}\n\nconst b = block('button-block');\n\n// eslint-disable-next-line complexity\nconst Button = (props: ButtonProps) => {\n const {tld} = React.useContext(LocaleContext);\n const {\n className,\n analyticsEvents,\n size = 'l',\n theme = 'normal',\n url,\n urlTitle,\n img,\n onClick: onClickOrigin,\n text,\n width,\n ...rest\n } = props;\n const defaultImgPosition = 'left';\n const handleAnalytics = useAnalytics(DefaultEventNames.Button, url);\n const onClick = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n handleAnalytics(analyticsEvents);\n\n if (onClickOrigin) {\n onClickOrigin(e);\n }\n },\n [handleAnalytics, analyticsEvents, onClickOrigin],\n );\n\n const buttonModifiers = {size, theme, width};\n\n const buttonImg =\n img instanceof Object\n ? {\n url: img.url,\n iconData: img.iconData,\n iconSize: img.iconSize,\n className: img.className,\n position: img.position || defaultImgPosition,\n alt: img.alt,\n }\n : {url: img, position: defaultImgPosition};\n\n const buttonClass = img\n ? b({position: buttonImg.position, ...buttonModifiers}, className)\n : b({...buttonModifiers}, className);\n\n const buttonProps = {\n ...rest,\n href: url ? setUrlTld(url, tld) : undefined,\n onClick,\n };\n\n if (theme === 'app-store' || theme === 'google-play') {\n const platform = theme === 'app-store' ? Platform.IOS : Platform.ANDROID;\n\n return <StoreBadge className={buttonClass} platform={platform} href={url as string} />;\n }\n\n let icon;\n let image;\n\n if (img && buttonImg.iconData) {\n const iconSize = buttonImg.iconSize;\n const iconClassName = buttonImg.className ? b('icon', buttonImg.className) : b('icon');\n icon = (\n <Icon\n className={iconClassName}\n data={buttonImg.iconData}\n size={iconSize}\n qa={ICON_QA}\n />\n );\n } else if (img && buttonImg.url) {\n image = (\n <img\n className={b('image')}\n width={buttonImg.iconSize || DEFAULT_IMG_SIZE}\n height={buttonImg.iconSize || DEFAULT_IMG_SIZE}\n src={buttonImg.url}\n alt={buttonImg.alt || i18n('image-alt')}\n />\n );\n }\n\n // Special handling for github theme (for backwards compatibility)\n if (theme === 'github') {\n icon = <Icon className={b('icon')} data={Github} size={24} qa={ICON_QA} />;\n image = undefined;\n }\n\n const buttonTheme = theme === 'scale' ? 'accent' : theme;\n\n return (\n <CommonButton\n className={buttonClass}\n view={toCommonView(buttonTheme as OldButtonTheme)}\n size={toCommonSize(size as OldButtonSize)}\n title={urlTitle}\n width={width}\n {...(buttonProps as UIKitButtonProps)}\n >\n {icon && buttonImg.position === 'left' ? icon : null}\n <span className={b('content')}>\n {image && buttonImg.position === 'left' ? image : null}\n <span className={b('text')}>{text}</span>\n {image && buttonImg.position === 'right' ? image : null}\n </span>\n {icon && buttonImg.position === 'right' ? icon : null}\n </CommonButton>\n );\n};\n\nexport default Button;\n"]}
|