@gravity-ui/page-constructor 6.9.1 → 6.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/blocks/CardLayout/schema.d.ts +76 -0
- package/build/cjs/blocks/ContentLayout/schema.d.ts +76 -0
- package/build/cjs/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/cjs/components/BackgroundImage/BackgroundImage.js.map +1 -1
- package/build/cjs/components/Image/Image.d.ts +3 -1
- package/build/cjs/components/Image/Image.js +25 -8
- package/build/cjs/components/Image/Image.js.map +1 -1
- package/build/cjs/components/Image/schema.d.ts +95 -0
- package/build/cjs/components/Image/schema.js +15 -0
- package/build/cjs/components/Image/schema.js.map +1 -1
- package/build/cjs/models/constructor-items/common.d.ts +13 -6
- package/build/cjs/models/constructor-items/common.js +8 -1
- package/build/cjs/models/constructor-items/common.js.map +1 -1
- package/build/cjs/schema/constants.d.ts +19 -0
- package/build/cjs/sub-blocks/BackgroundCard/schema.d.ts +19 -0
- package/build/cjs/text-transform/config.js +5 -0
- package/build/cjs/text-transform/config.js.map +1 -1
- package/build/esm/blocks/CardLayout/schema.d.ts +76 -0
- package/build/esm/blocks/ContentLayout/schema.d.ts +76 -0
- package/build/esm/components/BackgroundImage/BackgroundImage.js +2 -2
- package/build/esm/components/BackgroundImage/BackgroundImage.js.map +1 -1
- package/build/esm/components/Image/Image.d.ts +3 -1
- package/build/esm/components/Image/Image.js +24 -8
- package/build/esm/components/Image/Image.js.map +1 -1
- package/build/esm/components/Image/schema.d.ts +95 -0
- package/build/esm/components/Image/schema.js +15 -0
- package/build/esm/components/Image/schema.js.map +1 -1
- package/build/esm/models/constructor-items/common.d.ts +13 -6
- package/build/esm/models/constructor-items/common.js +7 -0
- package/build/esm/models/constructor-items/common.js.map +1 -1
- package/build/esm/schema/constants.d.ts +19 -0
- package/build/esm/sub-blocks/BackgroundCard/schema.d.ts +19 -0
- package/build/esm/text-transform/config.js +5 -0
- 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 +13 -6
- package/server/models/constructor-items/common.js +8 -1
- package/server/text-transform/config.js +5 -0
- package/widget/index.js +1 -1
|
@@ -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","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 interface ImageInfoProps\n extends Pick<\n React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>,\n 'aria-describedby' | 'loading'\n > {\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 desktop: string;\n mobile: string;\n tablet?: string;\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 style?: React.CSSProperties;\n imageClassName?: string;\n hide?: boolean;\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, 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"]}
|
|
@@ -804,6 +804,25 @@ export declare const cardSchemas: {
|
|
|
804
804
|
type: string;
|
|
805
805
|
enum: string[];
|
|
806
806
|
};
|
|
807
|
+
hide: {
|
|
808
|
+
oneOf: ({
|
|
809
|
+
type: string;
|
|
810
|
+
properties?: undefined;
|
|
811
|
+
} | {
|
|
812
|
+
type: string;
|
|
813
|
+
properties: {
|
|
814
|
+
mobile: {
|
|
815
|
+
type: string;
|
|
816
|
+
};
|
|
817
|
+
tablet: {
|
|
818
|
+
type: string;
|
|
819
|
+
};
|
|
820
|
+
desktop: {
|
|
821
|
+
type: string;
|
|
822
|
+
};
|
|
823
|
+
};
|
|
824
|
+
})[];
|
|
825
|
+
};
|
|
807
826
|
};
|
|
808
827
|
} & {
|
|
809
828
|
optionName: string;
|
|
@@ -53,6 +53,25 @@ export declare const BackgroundCard: {
|
|
|
53
53
|
type: string;
|
|
54
54
|
enum: string[];
|
|
55
55
|
};
|
|
56
|
+
hide: {
|
|
57
|
+
oneOf: ({
|
|
58
|
+
type: string;
|
|
59
|
+
properties?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
type: string;
|
|
62
|
+
properties: {
|
|
63
|
+
mobile: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
tablet: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
desktop: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
})[];
|
|
74
|
+
};
|
|
56
75
|
};
|
|
57
76
|
} & {
|
|
58
77
|
optionName: string;
|
|
@@ -128,6 +128,11 @@ exports.config = {
|
|
|
128
128
|
parser: parseBackgroundCardItems,
|
|
129
129
|
transformer: common_1.typografTransformer,
|
|
130
130
|
},
|
|
131
|
+
{
|
|
132
|
+
fields: ['list'],
|
|
133
|
+
transformer: common_1.yfmTransformer,
|
|
134
|
+
parser: (0, common_1.createItemsParser)(['text']),
|
|
135
|
+
},
|
|
131
136
|
],
|
|
132
137
|
[models_1.SubBlockType.ImageCard]: [
|
|
133
138
|
{
|
|
@@ -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,eAAe,CAAC,WAAwB,EAAE,OAAmB;IAClE,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,aAAa,CAAC,WAAwB,EAAE,KAA6B;IAC1E,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAC,EAAE,EAAE,CAAC,CAAC;QAC1C,KAAK,EAAE,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC;QAClC,IAAI,EAAE,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC;QAC/B,GAAG,IAAI;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AAED,SAAS,kBAAkB,CAAC,WAAwB,EAAE,KAA0B;IAC5E,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAE,GAAG,IAAI,EAAC,EAAE,EAAE,CAAC,CAAC;QACnC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC;QACvB,GAAG,IAAI;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,WAAwB,EAAE,KAA8B,EAAE,EAAE,CAC5E,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK;IACxC,CAAC,CAAC,EAAC,GAAG,KAA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,CAAC;YACjB,WAAW,EAAE,4BAAmB;SACnC;QACD;YACI,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,uBAAc;YAC3B,MAAM,EAAE,IAAA,0BAAiB,EAAC,CAAC,MAAM,CAAC,CAAC;SACtC;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,4BAAmB;YAChC,MAAM,EAAE,uBAAuB;SAClC;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 parseTableBlock(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 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: typografTransformer,\n parser: parseTitle,\n },\n {\n fields: ['description'],\n transformer: yfmTransformer,\n },\n];\n\ninterface BlockConfig {\n transformer: TransformerRaw;\n fields?: string[];\n parser?: Parser;\n}\n\nexport type BlocksConfig = Record<string, BlockConfig | BlockConfig[]>;\n\nexport const config: BlocksConfig = {\n [SubBlockType.BasicCard]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.BackgroundCard]: [\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['list'],\n parser: parseBackgroundCardItems,\n transformer: typografTransformer,\n },\n ],\n [SubBlockType.ImageCard]: [\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['title'],\n transformer: typografTransformer,\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: typografTransformer,\n },\n {\n fields: ['metaInfo'],\n parser: createItemsParser([]),\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.Quote]: [\n {\n fields: ['text'],\n transformer: typografTransformer,\n },\n {\n fields: ['yfmText'],\n transformer: yfmTransformer,\n },\n ],\n [BlockType.ExtendedFeaturesBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: typografTransformer,\n parser: createItemsParser(['title']),\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text', 'additionalInfo']),\n },\n ],\n [BlockType.PromoFeaturesBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parsePromoFeatures,\n },\n ],\n [BlockType.SliderBlock]: blockHeaderTransformer,\n [BlockType.CompaniesBlock]: blockHeaderTransformer,\n [BlockType.QuestionsBlock]: [\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 [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: typografTransformer,\n },\n {\n fields: ['subtitle'],\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.BannerCard]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['subtitle'],\n transformer: yfmTransformer,\n },\n ],\n [BlockType.MediaBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['title', '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: typografTransformer,\n parser: parseItemsTitle,\n },\n ],\n [BlockType.TableBlock]: [\n {\n fields: ['table'],\n transformer: yfmTransformer,\n parser: parseTableBlock,\n },\n ],\n [BlockType.HeaderSliderBlock]: [\n {\n fields: ['items'],\n transformer: typografTransformer,\n parser: createItemsParser(['title', 'overtitle']),\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['description']),\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 [BlockType.ContentLayoutBlock]: [\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['textContent'],\n transformer: typografTransformer,\n parser: parseContentLayoutTitle,\n },\n ],\n [SubBlockType.Content]: [\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['title'],\n transformer: typografTransformer,\n parser: parseTitle,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title', 'text']),\n },\n ],\n [BlockType.InfoBlock]: [\n {\n fields: ['rightContent', 'leftContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['rightContent', 'leftContent'],\n transformer: typografTransformer,\n parser: parseContentLayoutTitle,\n },\n ],\n [BlockType.ShareBlock]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n ],\n [BlockType.CardLayoutBlock]: blockHeaderTransformer,\n [BlockType.FilterBlock]: blockHeaderTransformer,\n [BlockType.IconsBlock]: blockHeaderTransformer,\n [SubBlockType.PriceCard]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text']),\n },\n ],\n [BlockType.FormBlock]: [\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['textContent'],\n transformer: typografTransformer,\n parser: parseContentLayoutTitle,\n },\n ],\n};\n"]}
|
|
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,eAAe,CAAC,WAAwB,EAAE,OAAmB;IAClE,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,CAA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,aAAa,CAAC;YACvB,WAAW,EAAE,4BAAmB;YAChC,MAAM,EAAE,uBAAuB;SAClC;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 parseTableBlock(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 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: typografTransformer,\n parser: parseTitle,\n },\n {\n fields: ['description'],\n transformer: yfmTransformer,\n },\n];\n\ninterface BlockConfig {\n transformer: TransformerRaw;\n fields?: string[];\n parser?: Parser;\n}\n\nexport type BlocksConfig = Record<string, BlockConfig | BlockConfig[]>;\n\nexport const config: BlocksConfig = {\n [SubBlockType.BasicCard]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.BackgroundCard]: [\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['title'],\n transformer: typografTransformer,\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: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['title'],\n transformer: typografTransformer,\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: typografTransformer,\n },\n {\n fields: ['metaInfo'],\n parser: createItemsParser([]),\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.Quote]: [\n {\n fields: ['text'],\n transformer: typografTransformer,\n },\n {\n fields: ['yfmText'],\n transformer: yfmTransformer,\n },\n ],\n [BlockType.ExtendedFeaturesBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: typografTransformer,\n parser: createItemsParser(['title']),\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text', 'additionalInfo']),\n },\n ],\n [BlockType.PromoFeaturesBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: parsePromoFeatures,\n },\n ],\n [BlockType.SliderBlock]: blockHeaderTransformer,\n [BlockType.CompaniesBlock]: blockHeaderTransformer,\n [BlockType.QuestionsBlock]: [\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 [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: typografTransformer,\n },\n {\n fields: ['subtitle'],\n transformer: yfmTransformer,\n },\n ],\n [SubBlockType.BannerCard]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['subtitle'],\n transformer: yfmTransformer,\n },\n ],\n [BlockType.MediaBlock]: [\n ...blockHeaderTransformer,\n {\n fields: ['title', '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: typografTransformer,\n parser: parseItemsTitle,\n },\n ],\n [BlockType.TableBlock]: [\n {\n fields: ['table'],\n transformer: yfmTransformer,\n parser: parseTableBlock,\n },\n ],\n [BlockType.HeaderSliderBlock]: [\n {\n fields: ['items'],\n transformer: typografTransformer,\n parser: createItemsParser(['title', 'overtitle']),\n },\n {\n fields: ['items'],\n transformer: yfmTransformer,\n parser: createItemsParser(['description']),\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 [BlockType.ContentLayoutBlock]: [\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['textContent'],\n transformer: typografTransformer,\n parser: parseContentLayoutTitle,\n },\n ],\n [SubBlockType.Content]: [\n {\n fields: ['text', 'additionalInfo'],\n transformer: yfmTransformer,\n },\n {\n fields: ['title'],\n transformer: typografTransformer,\n parser: parseTitle,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['title', 'text']),\n },\n ],\n [BlockType.InfoBlock]: [\n {\n fields: ['rightContent', 'leftContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['rightContent', 'leftContent'],\n transformer: typografTransformer,\n parser: parseContentLayoutTitle,\n },\n ],\n [BlockType.ShareBlock]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n ],\n [BlockType.CardLayoutBlock]: blockHeaderTransformer,\n [BlockType.FilterBlock]: blockHeaderTransformer,\n [BlockType.IconsBlock]: blockHeaderTransformer,\n [SubBlockType.PriceCard]: [\n {\n fields: ['title'],\n transformer: typografTransformer,\n },\n {\n fields: ['list'],\n transformer: yfmTransformer,\n parser: createItemsParser(['text']),\n },\n ],\n [BlockType.FormBlock]: [\n {\n fields: ['textContent'],\n transformer: yfmTransformer,\n parser: parseContentLayout,\n },\n {\n fields: ['textContent'],\n transformer: typografTransformer,\n parser: parseContentLayoutTitle,\n },\n ],\n};\n"]}
|
|
@@ -52,6 +52,25 @@ export declare const CardLayoutProps: {
|
|
|
52
52
|
type: string;
|
|
53
53
|
enum: string[];
|
|
54
54
|
};
|
|
55
|
+
hide: {
|
|
56
|
+
oneOf: ({
|
|
57
|
+
type: string;
|
|
58
|
+
properties?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
type: string;
|
|
61
|
+
properties: {
|
|
62
|
+
mobile: {
|
|
63
|
+
type: string;
|
|
64
|
+
};
|
|
65
|
+
tablet: {
|
|
66
|
+
type: string;
|
|
67
|
+
};
|
|
68
|
+
desktop: {
|
|
69
|
+
type: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
})[];
|
|
73
|
+
};
|
|
55
74
|
};
|
|
56
75
|
optionName: string;
|
|
57
76
|
type: string;
|
|
@@ -89,6 +108,25 @@ export declare const CardLayoutProps: {
|
|
|
89
108
|
type: string;
|
|
90
109
|
enum: string[];
|
|
91
110
|
};
|
|
111
|
+
hide: {
|
|
112
|
+
oneOf: ({
|
|
113
|
+
type: string;
|
|
114
|
+
properties?: undefined;
|
|
115
|
+
} | {
|
|
116
|
+
type: string;
|
|
117
|
+
properties: {
|
|
118
|
+
mobile: {
|
|
119
|
+
type: string;
|
|
120
|
+
};
|
|
121
|
+
tablet: {
|
|
122
|
+
type: string;
|
|
123
|
+
};
|
|
124
|
+
desktop: {
|
|
125
|
+
type: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
})[];
|
|
129
|
+
};
|
|
92
130
|
};
|
|
93
131
|
optionName: string;
|
|
94
132
|
type: string;
|
|
@@ -240,6 +278,25 @@ export declare const CardLayoutBlock: {
|
|
|
240
278
|
type: string;
|
|
241
279
|
enum: string[];
|
|
242
280
|
};
|
|
281
|
+
hide: {
|
|
282
|
+
oneOf: ({
|
|
283
|
+
type: string;
|
|
284
|
+
properties?: undefined;
|
|
285
|
+
} | {
|
|
286
|
+
type: string;
|
|
287
|
+
properties: {
|
|
288
|
+
mobile: {
|
|
289
|
+
type: string;
|
|
290
|
+
};
|
|
291
|
+
tablet: {
|
|
292
|
+
type: string;
|
|
293
|
+
};
|
|
294
|
+
desktop: {
|
|
295
|
+
type: string;
|
|
296
|
+
};
|
|
297
|
+
};
|
|
298
|
+
})[];
|
|
299
|
+
};
|
|
243
300
|
};
|
|
244
301
|
optionName: string;
|
|
245
302
|
type: string;
|
|
@@ -277,6 +334,25 @@ export declare const CardLayoutBlock: {
|
|
|
277
334
|
type: string;
|
|
278
335
|
enum: string[];
|
|
279
336
|
};
|
|
337
|
+
hide: {
|
|
338
|
+
oneOf: ({
|
|
339
|
+
type: string;
|
|
340
|
+
properties?: undefined;
|
|
341
|
+
} | {
|
|
342
|
+
type: string;
|
|
343
|
+
properties: {
|
|
344
|
+
mobile: {
|
|
345
|
+
type: string;
|
|
346
|
+
};
|
|
347
|
+
tablet: {
|
|
348
|
+
type: string;
|
|
349
|
+
};
|
|
350
|
+
desktop: {
|
|
351
|
+
type: string;
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
})[];
|
|
355
|
+
};
|
|
280
356
|
};
|
|
281
357
|
optionName: string;
|
|
282
358
|
type: string;
|
|
@@ -50,6 +50,25 @@ export declare const ContentLayoutBlock: {
|
|
|
50
50
|
type: string;
|
|
51
51
|
enum: string[];
|
|
52
52
|
};
|
|
53
|
+
hide: {
|
|
54
|
+
oneOf: ({
|
|
55
|
+
type: string;
|
|
56
|
+
properties?: undefined;
|
|
57
|
+
} | {
|
|
58
|
+
type: string;
|
|
59
|
+
properties: {
|
|
60
|
+
mobile: {
|
|
61
|
+
type: string;
|
|
62
|
+
};
|
|
63
|
+
tablet: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
desktop: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
})[];
|
|
71
|
+
};
|
|
53
72
|
};
|
|
54
73
|
} | {
|
|
55
74
|
optionName: string;
|
|
@@ -84,6 +103,25 @@ export declare const ContentLayoutBlock: {
|
|
|
84
103
|
type: string;
|
|
85
104
|
enum: string[];
|
|
86
105
|
};
|
|
106
|
+
hide: {
|
|
107
|
+
oneOf: ({
|
|
108
|
+
type: string;
|
|
109
|
+
properties?: undefined;
|
|
110
|
+
} | {
|
|
111
|
+
type: string;
|
|
112
|
+
properties: {
|
|
113
|
+
mobile: {
|
|
114
|
+
type: string;
|
|
115
|
+
};
|
|
116
|
+
tablet: {
|
|
117
|
+
type: string;
|
|
118
|
+
};
|
|
119
|
+
desktop: {
|
|
120
|
+
type: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
})[];
|
|
124
|
+
};
|
|
87
125
|
};
|
|
88
126
|
})[];
|
|
89
127
|
};
|
|
@@ -256,6 +294,25 @@ export declare const ContentLayoutBlock: {
|
|
|
256
294
|
type: string;
|
|
257
295
|
enum: string[];
|
|
258
296
|
};
|
|
297
|
+
hide: {
|
|
298
|
+
oneOf: ({
|
|
299
|
+
type: string;
|
|
300
|
+
properties?: undefined;
|
|
301
|
+
} | {
|
|
302
|
+
type: string;
|
|
303
|
+
properties: {
|
|
304
|
+
mobile: {
|
|
305
|
+
type: string;
|
|
306
|
+
};
|
|
307
|
+
tablet: {
|
|
308
|
+
type: string;
|
|
309
|
+
};
|
|
310
|
+
desktop: {
|
|
311
|
+
type: string;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
})[];
|
|
315
|
+
};
|
|
259
316
|
};
|
|
260
317
|
} | {
|
|
261
318
|
optionName: string;
|
|
@@ -290,6 +347,25 @@ export declare const ContentLayoutBlock: {
|
|
|
290
347
|
type: string;
|
|
291
348
|
enum: string[];
|
|
292
349
|
};
|
|
350
|
+
hide: {
|
|
351
|
+
oneOf: ({
|
|
352
|
+
type: string;
|
|
353
|
+
properties?: undefined;
|
|
354
|
+
} | {
|
|
355
|
+
type: string;
|
|
356
|
+
properties: {
|
|
357
|
+
mobile: {
|
|
358
|
+
type: string;
|
|
359
|
+
};
|
|
360
|
+
tablet: {
|
|
361
|
+
type: string;
|
|
362
|
+
};
|
|
363
|
+
desktop: {
|
|
364
|
+
type: string;
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
})[];
|
|
368
|
+
};
|
|
293
369
|
};
|
|
294
370
|
})[];
|
|
295
371
|
};
|
|
@@ -5,9 +5,9 @@ import './BackgroundImage.css';
|
|
|
5
5
|
export const qaIdByDefault = 'background-image';
|
|
6
6
|
const b = block('storage-background-image');
|
|
7
7
|
const BackgroundImage = (props) => {
|
|
8
|
-
const { children, src, desktop, className, imageClassName, style,
|
|
8
|
+
const { children, src, desktop, className, imageClassName, style, qa } = props;
|
|
9
9
|
const qaAttributes = getQaAttrubutes(qa || qaIdByDefault);
|
|
10
|
-
return (_jsxs("div", { className: b(null, className), style: style, "data-qa": qa || qaIdByDefault, children: [(src || desktop) &&
|
|
10
|
+
return (_jsxs("div", { className: b(null, className), style: style, "data-qa": qa || qaIdByDefault, children: [(src || desktop) && (_jsx(Image, { ...props, className: b('img', imageClassName), qa: qaAttributes.image })), children && _jsx("div", { className: b('container'), children: children })] }));
|
|
11
11
|
};
|
|
12
12
|
export default BackgroundImage;
|
|
13
13
|
//# sourceMappingURL=BackgroundImage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundImage.js","sourceRoot":"../../../../src","sources":["components/BackgroundImage/BackgroundImage.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,6BAAoB;AACnD,OAAO,KAAK,0BAAuB;AAEnC,OAAO,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEhD,MAAM,CAAC,GAAG,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAE5C,MAAM,eAAe,GAAG,CAAC,KAAoD,EAAE,EAAE;IAC7E,MAAM,EAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"BackgroundImage.js","sourceRoot":"../../../../src","sources":["components/BackgroundImage/BackgroundImage.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,KAAK,EAAE,eAAe,EAAC,6BAAoB;AACnD,OAAO,KAAK,0BAAuB;AAEnC,OAAO,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,aAAa,GAAG,kBAAkB,CAAC;AAEhD,MAAM,CAAC,GAAG,KAAK,CAAC,0BAA0B,CAAC,CAAC;AAE5C,MAAM,eAAe,GAAG,CAAC,KAAoD,EAAE,EAAE;IAC7E,MAAM,EAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,EAAC,GAAG,KAAK,CAAC;IAC7E,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,IAAI,aAAa,CAAC,CAAC;IAE1D,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,aAAW,EAAE,IAAI,aAAa,aACzE,CAAC,GAAG,IAAI,OAAO,CAAC,IAAI,CACjB,KAAC,KAAK,OAAK,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,cAAc,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,KAAK,GAAI,CACpF,EACA,QAAQ,IAAI,cAAK,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,YAAG,QAAQ,GAAO,IAC3D,CACT,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImageProps} from '../../models';\nimport {block, getQaAttrubutes} from '../../utils';\nimport Image from '../Image/Image';\n\nimport './BackgroundImage.scss';\n\nexport const qaIdByDefault = 'background-image';\n\nconst b = block('storage-background-image');\n\nconst BackgroundImage = (props: React.PropsWithChildren<BackgroundImageProps>) => {\n const {children, src, desktop, className, imageClassName, style, qa} = props;\n const qaAttributes = getQaAttrubutes(qa || qaIdByDefault);\n\n return (\n <div className={b(null, className)} style={style} data-qa={qa || qaIdByDefault}>\n {(src || desktop) && (\n <Image {...props} className={b('img', imageClassName)} qa={qaAttributes.image} />\n )}\n {children && <div className={b('container')}>{children}</div>}\n </div>\n );\n};\n\nexport default BackgroundImage;\n"]}
|
|
@@ -10,7 +10,9 @@ export interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDevi
|
|
|
10
10
|
export interface DeviceSpecificFragmentProps extends QAProps {
|
|
11
11
|
disableWebp: boolean;
|
|
12
12
|
src: string;
|
|
13
|
-
|
|
13
|
+
maxBreakpoint?: number;
|
|
14
|
+
minBreakpoint?: number;
|
|
14
15
|
}
|
|
16
|
+
export declare const EMPTY_IMG = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPjwvc3ZnPg==";
|
|
15
17
|
declare const Image: (props: ImageProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
18
|
export default Image;
|
|
@@ -2,27 +2,43 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { BREAKPOINTS } from "../../constants.js";
|
|
4
4
|
import { ProjectSettingsContext } from "../../context/projectSettingsContext/index.js";
|
|
5
|
+
import { Device } from "../../models/index.js";
|
|
5
6
|
import { getQaAttrubutes } from "../../utils/index.js";
|
|
6
7
|
import { isCompressible } from "../../utils/imageCompress.js";
|
|
7
8
|
import ImageBase from "../ImageBase/ImageBase.js";
|
|
8
9
|
const checkWebP = (src) => {
|
|
9
10
|
return src.endsWith('.webp') ? src : src + '.webp';
|
|
10
11
|
};
|
|
11
|
-
const
|
|
12
|
+
export const EMPTY_IMG = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPjwvc3ZnPg==';
|
|
13
|
+
const DeviceSpecificFragment = ({ disableWebp, src, maxBreakpoint, minBreakpoint, qa, }) => {
|
|
14
|
+
const media = [];
|
|
15
|
+
if (maxBreakpoint) {
|
|
16
|
+
media.push(`(max-width: ${maxBreakpoint}px)`);
|
|
17
|
+
}
|
|
18
|
+
if (minBreakpoint) {
|
|
19
|
+
media.push(`(min-width: ${minBreakpoint}px)`);
|
|
20
|
+
}
|
|
21
|
+
const mediaString = media.join(' and ');
|
|
22
|
+
return (_jsxs(React.Fragment, { children: [!disableWebp && (_jsx("source", { srcSet: checkWebP(src), type: "image/webp", media: mediaString, "data-qa": `${qa}-compressed` })), _jsx("source", { srcSet: src, media: mediaString, "data-qa": qa })] }));
|
|
23
|
+
};
|
|
12
24
|
const Image = (props) => {
|
|
13
25
|
const projectSettings = React.useContext(ProjectSettingsContext);
|
|
14
|
-
const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, onLoad, containerClassName, qa, fetchPriority, loading, } = props;
|
|
26
|
+
const { src: imageSrc, alt, disableCompress, tablet, desktop, mobile, style, className, onClick, onLoad, containerClassName, qa, fetchPriority, loading, hide, } = props;
|
|
15
27
|
const [imgLoadingError, setImgLoadingError] = React.useState(false);
|
|
16
28
|
const src = imageSrc || desktop;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const qaAttributes = getQaAttrubutes(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', 'desktop-source-compressed');
|
|
21
|
-
const disableWebp =
|
|
29
|
+
const hideDevices = typeof hide === 'boolean' || !hide
|
|
30
|
+
? Object.values(Device).reduce((acc, device) => ({ ...acc, [device]: Boolean(hide) }), {})
|
|
31
|
+
: hide;
|
|
32
|
+
const qaAttributes = getQaAttrubutes(qa, 'mobile-webp-source', 'mobile-source', 'tablet-webp-source', 'tablet-source', 'desktop-source', 'desktop-source-compressed');
|
|
33
|
+
const disableWebp = !src ||
|
|
34
|
+
projectSettings.disableCompress ||
|
|
22
35
|
disableCompress ||
|
|
23
36
|
!isCompressible(src) ||
|
|
24
37
|
imgLoadingError;
|
|
25
|
-
|
|
38
|
+
if (!src) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
return (_jsxs("picture", { className: containerClassName, "data-qa": qa, children: [(mobile || hideDevices.mobile) && (_jsx(DeviceSpecificFragment, { src: mobile || EMPTY_IMG, disableWebp: disableWebp || Boolean(hideDevices.mobile), maxBreakpoint: BREAKPOINTS.sm, qa: qaAttributes.mobileSource })), (tablet || hideDevices.tablet) && (_jsx(DeviceSpecificFragment, { src: tablet || EMPTY_IMG, disableWebp: disableWebp || Boolean(hideDevices.tablet), maxBreakpoint: BREAKPOINTS.md, minBreakpoint: BREAKPOINTS.sm, qa: qaAttributes.tabletSource })), hideDevices.desktop && (_jsx(DeviceSpecificFragment, { src: EMPTY_IMG, disableWebp: true, minBreakpoint: BREAKPOINTS.md, qa: qaAttributes.desktopSource })), src && !disableWebp && (_jsx("source", { srcSet: checkWebP(src), type: "image/webp", "data-qa": qaAttributes.desktopSourceCompressed })), _jsx(ImageBase, { className: className, alt: alt, src: src, style: style, fetchPriority: fetchPriority, loading: loading, onClick: onClick, onError: () => setImgLoadingError(true), onLoad: onLoad })] }));
|
|
26
42
|
};
|
|
27
43
|
export default Image;
|
|
28
44
|
//# sourceMappingURL=Image.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sourceRoot":"../../../../src","sources":["components/Image/Image.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAC,sBAAsB,EAAC,sDAA6C;
|
|
1
|
+
{"version":3,"file":"Image.js","sourceRoot":"../../../../src","sources":["components/Image/Image.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAC,sBAAsB,EAAC,sDAA6C;AAC5E,OAAO,EAAC,MAAM,EAA8C,8BAAqB;AACjF,OAAO,EAAC,eAAe,EAAC,6BAAoB;AAC5C,OAAO,EAAC,cAAc,EAAC,qCAAkC;AACzD,OAAO,SAAS,kCAA+B;AAiB/C,MAAM,SAAS,GAAG,CAAC,GAAW,EAAE,EAAE;IAC9B,OAAO,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC;AACvD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAClB,wHAAwH,CAAC;AAE7H,MAAM,sBAAsB,GAAG,CAAC,EAC5B,WAAW,EACX,GAAG,EACH,aAAa,EACb,aAAa,EACb,EAAE,GACwB,EAAE,EAAE;IAC9B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,IAAI,aAAa,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,eAAe,aAAa,KAAK,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E,SAAS,CAAC,GAAG,CAAC,EACtB,IAAI,EAAC,YAAY,aACR,YAAY,CAAC,uBAAuB,GAC/C,CACL,EACD,KAAC,SAAS,IACN,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EACvC,MAAM,EAAE,MAAM,GAChB,IACI,CACb,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,KAAK,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BREAKPOINTS} from '../../constants';\nimport {ProjectSettingsContext} from '../../context/projectSettingsContext';\nimport {Device, ImageDeviceProps, ImageObjectProps, QAProps} from '../../models';\nimport {getQaAttrubutes} from '../../utils';\nimport {isCompressible} from '../../utils/imageCompress';\nimport ImageBase from '../ImageBase/ImageBase';\n\nexport interface ImageProps extends Partial<ImageObjectProps>, Partial<ImageDeviceProps>, QAProps {\n style?: React.CSSProperties;\n className?: string;\n onClick?: React.MouseEventHandler;\n onLoad?: React.ReactEventHandler<HTMLDivElement>;\n containerClassName?: string;\n}\n\nexport interface DeviceSpecificFragmentProps extends QAProps {\n disableWebp: boolean;\n src: string;\n maxBreakpoint?: number;\n minBreakpoint?: number;\n}\n\nconst checkWebP = (src: string) => {\n return src.endsWith('.webp') ? src : src + '.webp';\n};\n\nexport const EMPTY_IMG =\n 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPjwvc3ZnPg==';\n\nconst DeviceSpecificFragment = ({\n disableWebp,\n src,\n maxBreakpoint,\n minBreakpoint,\n qa,\n}: DeviceSpecificFragmentProps) => {\n const media: string[] = [];\n\n if (maxBreakpoint) {\n media.push(`(max-width: ${maxBreakpoint}px)`);\n }\n\n if (minBreakpoint) {\n media.push(`(min-width: ${minBreakpoint}px)`);\n }\n\n const mediaString = media.join(' and ');\n\n return (\n <React.Fragment>\n {!disableWebp && (\n <source\n srcSet={checkWebP(src)}\n type=\"image/webp\"\n media={mediaString}\n data-qa={`${qa}-compressed`}\n />\n )}\n <source srcSet={src} media={mediaString} data-qa={qa} />\n </React.Fragment>\n );\n};\n\nconst Image = (props: ImageProps) => {\n const projectSettings = React.useContext(ProjectSettingsContext);\n const {\n src: imageSrc,\n alt,\n disableCompress,\n tablet,\n desktop,\n mobile,\n style,\n className,\n onClick,\n onLoad,\n containerClassName,\n qa,\n fetchPriority,\n loading,\n hide,\n } = props;\n const [imgLoadingError, setImgLoadingError] = React.useState(false);\n\n const src = imageSrc || desktop;\n\n const hideDevices =\n typeof hide === 'boolean' || !hide\n ? Object.values(Device).reduce(\n (acc, device) => ({...acc, [device]: Boolean(hide)}),\n {} as Record<Device, boolean>,\n )\n : hide;\n\n const qaAttributes = getQaAttrubutes(\n qa,\n 'mobile-webp-source',\n 'mobile-source',\n 'tablet-webp-source',\n 'tablet-source',\n 'desktop-source',\n 'desktop-source-compressed',\n );\n\n const disableWebp =\n !src ||\n projectSettings.disableCompress ||\n disableCompress ||\n !isCompressible(src) ||\n imgLoadingError;\n\n if (!src) {\n return null;\n }\n\n return (\n <picture className={containerClassName} data-qa={qa}>\n {(mobile || hideDevices.mobile) && (\n <DeviceSpecificFragment\n src={mobile || EMPTY_IMG}\n disableWebp={disableWebp || Boolean(hideDevices.mobile)}\n maxBreakpoint={BREAKPOINTS.sm}\n qa={qaAttributes.mobileSource}\n />\n )}\n {(tablet || hideDevices.tablet) && (\n <DeviceSpecificFragment\n src={tablet || EMPTY_IMG}\n disableWebp={disableWebp || Boolean(hideDevices.tablet)}\n maxBreakpoint={BREAKPOINTS.md}\n minBreakpoint={BREAKPOINTS.sm}\n qa={qaAttributes.tabletSource}\n />\n )}\n {hideDevices.desktop && (\n <DeviceSpecificFragment\n src={EMPTY_IMG}\n disableWebp\n minBreakpoint={BREAKPOINTS.md}\n qa={qaAttributes.desktopSource}\n />\n )}\n {src && !disableWebp && (\n <source\n srcSet={checkWebP(src)}\n type=\"image/webp\"\n data-qa={qaAttributes.desktopSourceCompressed}\n />\n )}\n <ImageBase\n className={className}\n alt={alt}\n src={src}\n style={style}\n fetchPriority={fetchPriority}\n loading={loading}\n onClick={onClick}\n onError={() => setImgLoadingError(true)}\n onLoad={onLoad}\n />\n </picture>\n );\n};\n\nexport default Image;\n"]}
|