@gravity-ui/page-constructor 7.13.0 → 7.14.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/Media/Media.js +1 -1
- package/build/cjs/blocks/Media/Media.js.map +1 -1
- package/build/cjs/components/DefaultVideo/DefaultVideo.js +7 -0
- package/build/cjs/components/DefaultVideo/DefaultVideo.js.map +1 -1
- package/build/cjs/models/constructor-items/blocks.d.ts +1 -2
- package/build/cjs/models/constructor-items/blocks.js.map +1 -1
- package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +5 -2
- package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js.map +1 -1
- package/build/esm/blocks/Media/Media.js +1 -1
- package/build/esm/blocks/Media/Media.js.map +1 -1
- package/build/esm/components/DefaultVideo/DefaultVideo.js +7 -0
- package/build/esm/components/DefaultVideo/DefaultVideo.js.map +1 -1
- package/build/esm/models/constructor-items/blocks.d.ts +1 -2
- package/build/esm/models/constructor-items/blocks.js.map +1 -1
- package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js +5 -2
- package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js.map +1 -1
- package/package.json +1 -1
- package/server/models/constructor-items/blocks.d.ts +1 -2
|
@@ -21,7 +21,7 @@ const MediaBlock = (props) => {
|
|
|
21
21
|
const theme = (0, theme_1.useTheme)();
|
|
22
22
|
const mediaThemed = (0, utils_1.getThemedValue)(media, theme);
|
|
23
23
|
const mediaWithMicrodata = (0, microdata_1.mergeVideoMicrodata)(mediaThemed, {
|
|
24
|
-
name: title,
|
|
24
|
+
name: typeof title === 'object' ? title.text : title,
|
|
25
25
|
description,
|
|
26
26
|
});
|
|
27
27
|
return ((0, jsx_runtime_1.jsx)(MediaBase_1.default, { ...props, onScroll: () => setPlay(true), children: (0, jsx_runtime_1.jsx)(MediaBase_1.default.Card, { children: (0, jsx_runtime_1.jsx)(Media_1.default, { imageClassName: b('image'), ...mediaWithMicrodata, playVideo: play, className: b({ border: borderSelected }) }) }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Media.js","sourceRoot":"../../../../src","sources":["blocks/Media/Media.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,oFAAiD;AACjD,gGAA6D;AAC7D,wDAA6C;AAE7C,gDAAkD;AAClD,kEAA0D;AAC1D,wDAA0D;AAI1D,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,aAAa,CAAC,CAAC;AAExB,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACjD,MAAM,EAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAC,GAAG,KAAK,CAAC;IACjE,MAAM,cAAc,GAAG,IAAA,+BAAc,EAAC;QAClC,MAAM;QACN,aAAa;KAChB,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,IAAA,gBAAQ,GAAE,CAAC;IACzB,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,kBAAkB,GAAG,IAAA,+BAAmB,EAAC,WAAW,EAAE;QACxD,IAAI,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"Media.js","sourceRoot":"../../../../src","sources":["blocks/Media/Media.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,oFAAiD;AACjD,gGAA6D;AAC7D,wDAA6C;AAE7C,gDAAkD;AAClD,kEAA0D;AAC1D,wDAA0D;AAI1D,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,aAAa,CAAC,CAAC;AAExB,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACjD,MAAM,EAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAC,GAAG,KAAK,CAAC;IACjE,MAAM,cAAc,GAAG,IAAA,+BAAc,EAAC;QAClC,MAAM;QACN,aAAa;KAChB,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,IAAA,gBAAQ,GAAE,CAAC;IACzB,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,kBAAkB,GAAG,IAAA,+BAAmB,EAAC,WAAW,EAAE;QACxD,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK;QACpD,WAAW;KACd,CAAC,CAAC;IAEH,OAAO,CACH,uBAAC,mBAAS,OAAK,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,YAC/C,uBAAC,mBAAS,CAAC,IAAI,cACX,uBAAC,eAAK,IACF,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KACtB,kBAAkB,EACtB,SAAS,EAAE,IAAI,EACf,SAAS,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,cAAc,EAAC,CAAC,GACxC,GACW,GACT,CACf,CAAC;AACN,CAAC,CAAC;AA3BW,QAAA,UAAU,cA2BrB;AAEF,kBAAe,kBAAU,CAAC","sourcesContent":["import * as React from 'react';\n\nimport Media from '../../components/Media/Media';\nimport MediaBase from '../../components/MediaBase/MediaBase';\nimport {useTheme} from '../../context/theme';\nimport {MediaBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {getMediaBorder} from '../../utils/borderSelector';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport './Media.scss';\n\nconst b = block('media-block');\n\nexport const MediaBlock = (props: MediaBlockProps) => {\n const {media, border, disableShadow, title, description} = props;\n const borderSelected = getMediaBorder({\n border,\n disableShadow,\n });\n\n const [play, setPlay] = React.useState<boolean>(false);\n const theme = useTheme();\n const mediaThemed = getThemedValue(media, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(mediaThemed, {\n name: typeof title === 'object' ? title.text : title,\n description,\n });\n\n return (\n <MediaBase {...props} onScroll={() => setPlay(true)}>\n <MediaBase.Card>\n <Media\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n playVideo={play}\n className={b({border: borderSelected})}\n />\n </MediaBase.Card>\n </MediaBase>\n );\n};\n\nexport default MediaBlock;\n"]}
|
|
@@ -41,6 +41,13 @@ exports.DefaultVideo = React.forwardRef((props, ref) => {
|
|
|
41
41
|
videoElement.removeEventListener('ended', handleVideoEnd);
|
|
42
42
|
};
|
|
43
43
|
}, [videoRef, onVideoEnd]);
|
|
44
|
+
// to guarantee setting a muted attribute in HTML. https://github.com/facebook/react/issues/10389
|
|
45
|
+
React.useEffect(() => {
|
|
46
|
+
const videoElement = videoRef.current;
|
|
47
|
+
if (videoElement && initiallyMuted) {
|
|
48
|
+
videoElement.defaultMuted = true;
|
|
49
|
+
}
|
|
50
|
+
}, [videoRef, initiallyMuted]);
|
|
44
51
|
const onPlayToggle = React.useCallback(() => {
|
|
45
52
|
setIsPaused((value) => {
|
|
46
53
|
if (value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultVideo.js","sourceRoot":"../../../../src","sources":["components/DefaultVideo/DefaultVideo.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,kDAAyF;AACzF,gDAAkC;AAClC,mDAA+D;AAC/D,oGAAiE;AAIjE,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,eAAe,CAAC,CAAC;AAWpB,QAAA,YAAY,GAAG,KAAK,CAAC,UAAU,CACxC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACX,MAAM,EAAC,KAAK,EAAE,EAAE,EAAE,0BAA0B,EAAC,GAA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AC9D,mCAAoB,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,aAAW,EAAE,IAAxC,KAAK,CAAuC,CAC5D,CAAC,EACF,kCAAO,OAAO,QAAC,IAAI,EAAC,UAAU,GAAG,IAC7B,EAEP,QAAQ,KAAK,+BAAsB,CAAC,MAAM,IAAI,CAC3C,uBAAC,2BAAiB,IACd,SAAS,EAAE,0BAA0B,EACrC,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,YAAY,EACzB,eAAe,EAAE,eAAe,EAChC,KAAK,QACL,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE;oBACF,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;oBACzB,UAAU,EAAE,YAAY;iBAC3B,GACH,CACL,IACY,CACpB,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {CustomControlsType, MediaVideoControlsType, MediaVideoProps} from '../../models';\nimport {block} from '../../utils';\nimport {getVideoTypesWithPriority} from '../Media/Video/utils';\nimport CustomBarControls from '../ReactPlayer/CustomBarControls';\n\nimport './DefaultVideo.scss';\n\nconst b = block('default-video');\n\ntype DefaultVideoRefType = HTMLVideoElement | undefined;\n\ninterface DefaultVideoProps {\n video: MediaVideoProps;\n qa?: string;\n customBarControlsClassName?: string;\n className?: string;\n}\n\nexport const DefaultVideo = React.forwardRef<DefaultVideoRefType, DefaultVideoProps>(\n (props, ref) => {\n const {video, qa, customBarControlsClassName} = props;\n const {controls, customControlsOptions, muted: initiallyMuted = true, onVideoEnd} = video;\n const {\n muteButtonShown,\n positioning,\n type: customControlsType,\n } = customControlsOptions || {};\n const [isPaused, setIsPaused] = React.useState(false);\n const [isMuted, setIsMuted] = React.useState(initiallyMuted);\n const videoRef = React.useRef<HTMLVideoElement>(null);\n\n // one may not use this hook and work with `ref` variable only, but\n // in this case one should support both function type and object type,\n // according to ForwardedRef type.\n // Currently used way with extra ref and useImperativeHandle is more\n // convenient and allows us to work with object typed ref only,\n // avoiding typeof ref === 'function' statements\n React.useImperativeHandle(ref, () => {\n if (!videoRef?.current) {\n return undefined;\n }\n\n return videoRef.current;\n }, [videoRef]);\n\n React.useEffect(() => {\n const videoElement = videoRef.current;\n if (!videoElement || !onVideoEnd) {\n return undefined;\n }\n\n const handleVideoEnd = () => {\n onVideoEnd?.();\n };\n\n videoElement.addEventListener('ended', handleVideoEnd);\n return () => {\n videoElement.removeEventListener('ended', handleVideoEnd);\n };\n }, [videoRef, onVideoEnd]);\n\n const onPlayToggle = React.useCallback(() => {\n setIsPaused((value) => {\n if (value) {\n videoRef?.current?.play();\n } else {\n videoRef?.current?.pause();\n }\n\n return !value;\n });\n }, [videoRef]);\n const onMuteToggle = React.useCallback(() => {\n setIsMuted((value) => !value);\n }, []);\n\n const onClick = React.useCallback(() => {\n if (customControlsType === CustomControlsType.WithPlayPauseButton) {\n onPlayToggle();\n }\n }, [onPlayToggle, customControlsType]);\n\n return (\n <React.Fragment>\n <video\n disablePictureInPicture\n playsInline\n // @ts-ignore\n // eslint-disable-next-line react/no-unknown-property\n pip=\"false\"\n className={b()}\n ref={videoRef}\n preload=\"metadata\"\n muted={isMuted}\n aria-label={video.ariaLabel}\n onClick={onClick}\n >\n {getVideoTypesWithPriority(video.src).map(({src, type}, index) => (\n <source key={index} src={src} type={type} data-qa={qa} />\n ))}\n <track default kind=\"captions\" />\n </video>\n\n {controls === MediaVideoControlsType.Custom && (\n <CustomBarControls\n className={customBarControlsClassName}\n type={customControlsType}\n isPaused={isPaused}\n onPlayClick={onPlayToggle}\n muteButtonShown={muteButtonShown}\n shown\n positioning={positioning}\n mute={{\n isMuted: Boolean(isMuted),\n changeMute: onMuteToggle,\n }}\n />\n )}\n </React.Fragment>\n );\n },\n);\n\nDefaultVideo.displayName = 'DefaultVideo';\n"]}
|
|
1
|
+
{"version":3,"file":"DefaultVideo.js","sourceRoot":"../../../../src","s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'../../models';\nimport {block} from '../../utils';\nimport {getVideoTypesWithPriority} from '../Media/Video/utils';\nimport CustomBarControls from '../ReactPlayer/CustomBarControls';\n\nimport './DefaultVideo.scss';\n\nconst b = block('default-video');\n\ntype DefaultVideoRefType = HTMLVideoElement | undefined;\n\ninterface DefaultVideoProps {\n video: MediaVideoProps;\n qa?: string;\n customBarControlsClassName?: string;\n className?: string;\n}\n\nexport const DefaultVideo = React.forwardRef<DefaultVideoRefType, DefaultVideoProps>(\n (props, ref) => {\n const {video, qa, customBarControlsClassName} = props;\n const {controls, customControlsOptions, muted: initiallyMuted = true, onVideoEnd} = video;\n const {\n muteButtonShown,\n positioning,\n type: customControlsType,\n } = customControlsOptions || {};\n const [isPaused, setIsPaused] = React.useState(false);\n const [isMuted, setIsMuted] = React.useState(initiallyMuted);\n const videoRef = React.useRef<HTMLVideoElement>(null);\n\n // one may not use this hook and work with `ref` variable only, but\n // in this case one should support both function type and object type,\n // according to ForwardedRef type.\n // Currently used way with extra ref and useImperativeHandle is more\n // convenient and allows us to work with object typed ref only,\n // avoiding typeof ref === 'function' statements\n React.useImperativeHandle(ref, () => {\n if (!videoRef?.current) {\n return undefined;\n }\n\n return videoRef.current;\n }, [videoRef]);\n\n React.useEffect(() => {\n const videoElement = videoRef.current;\n if (!videoElement || !onVideoEnd) {\n return undefined;\n }\n\n const handleVideoEnd = () => {\n onVideoEnd?.();\n };\n\n videoElement.addEventListener('ended', handleVideoEnd);\n return () => {\n videoElement.removeEventListener('ended', handleVideoEnd);\n };\n }, [videoRef, onVideoEnd]);\n\n // to guarantee setting a muted attribute in HTML. https://github.com/facebook/react/issues/10389\n React.useEffect(() => {\n const videoElement = videoRef.current;\n\n if (videoElement && initiallyMuted) {\n videoElement.defaultMuted = true;\n }\n }, [videoRef, initiallyMuted]);\n\n const onPlayToggle = React.useCallback(() => {\n setIsPaused((value) => {\n if (value) {\n videoRef?.current?.play();\n } else {\n videoRef?.current?.pause();\n }\n\n return !value;\n });\n }, [videoRef]);\n const onMuteToggle = React.useCallback(() => {\n setIsMuted((value) => !value);\n }, []);\n\n const onClick = React.useCallback(() => {\n if (customControlsType === CustomControlsType.WithPlayPauseButton) {\n onPlayToggle();\n }\n }, [onPlayToggle, customControlsType]);\n\n return (\n <React.Fragment>\n <video\n disablePictureInPicture\n playsInline\n // @ts-ignore\n // eslint-disable-next-line react/no-unknown-property\n pip=\"false\"\n className={b()}\n ref={videoRef}\n preload=\"metadata\"\n muted={isMuted}\n aria-label={video.ariaLabel}\n onClick={onClick}\n >\n {getVideoTypesWithPriority(video.src).map(({src, type}, index) => (\n <source key={index} src={src} type={type} data-qa={qa} />\n ))}\n <track default kind=\"captions\" />\n </video>\n\n {controls === MediaVideoControlsType.Custom && (\n <CustomBarControls\n className={customBarControlsClassName}\n type={customControlsType}\n isPaused={isPaused}\n onPlayClick={onPlayToggle}\n muteButtonShown={muteButtonShown}\n shown\n positioning={positioning}\n mute={{\n isMuted: Boolean(isMuted),\n changeMute: onMuteToggle,\n }}\n />\n )}\n </React.Fragment>\n );\n },\n);\n\nDefaultVideo.displayName = 'DefaultVideo';\n"]}
|
|
@@ -208,8 +208,7 @@ export interface MediaBaseBlockProps extends Animatable, MediaContentProps {
|
|
|
208
208
|
mediaOnly?: boolean;
|
|
209
209
|
mediaOnlyColSizes?: GridColumnSizesType;
|
|
210
210
|
}
|
|
211
|
-
export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | '
|
|
212
|
-
title: string;
|
|
211
|
+
export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered'> {
|
|
213
212
|
description?: string;
|
|
214
213
|
/** @deprecated Use array of buttons from ContentBlockProps instead**/
|
|
215
214
|
button?: ButtonProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/blocks.ts"],"names":[],"mappings":";;;AA4CA,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACj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ACvB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,kDAA4B,CAAA;IAC5B,kDAA4B,CAAA;IAC5B,uCAAiB,CAAA;AACrB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B","sourcesContent":["import * as React from 'react';\n\nimport {ButtonSize} from '@gravity-ui/uikit';\n\nimport {GridColumnSize, GridColumnSizesType, IndentValue} from '../../grid/types';\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {\n AnchorProps,\n Animatable,\n BackgroundImageProps,\n ButtonProps,\n CardBorder,\n ContentSize,\n ContentTextSize,\n ContentTheme,\n FileLinkProps,\n GravityIconProps,\n HeaderBreadCrumbsProps,\n HeaderImageSize,\n HeaderOffset,\n HeaderWidth,\n ImageDeviceProps,\n ImageProps,\n Justify,\n LegendTableMarkerType,\n LinkProps,\n MapProps,\n MediaDirection,\n MediaProps,\n MediaView,\n TextSize,\n TextTheme,\n ThemedImage,\n ThemedMediaProps,\n ThemedMediaVideoProps,\n TitleItemBaseProps,\n TitleItemProps,\n WithBorder,\n YandexFormProps,\n} from './common';\nimport {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub-blocks';\n\nexport enum BlockType {\n PromoFeaturesBlock = 'promo-features-block',\n ExtendedFeaturesBlock = 'extended-features-block',\n /** @deprecated */\n SliderOldBlock = 'slider-old-block',\n SliderBlock = 'slider-block',\n QuestionsBlock = 'questions-block',\n FoldableListBlock = 'foldable-list-block',\n BannerBlock = 'banner-block',\n CompaniesBlock = 'companies-block',\n MediaBlock = 'media-block',\n InfoBlock = 'info-block',\n TableBlock = 'table-block',\n TabsBlock = 'tabs-block',\n HeaderSliderBlock = 'header-slider-block',\n HeaderBlock = 'header-block',\n IconsBlock = 'icons-block',\n CardLayoutBlock = 'card-layout-block',\n ContentLayoutBlock = 'content-layout-block',\n ShareBlock = 'share-block',\n MapBlock = 'map-block',\n FilterBlock = 'filter-block',\n FormBlock = 'form-block',\n}\n\nexport const BlockTypes = Object.values(BlockType);\nexport const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];\n\nexport interface Childable {\n children?: SubBlock[];\n}\n\n//block props\nexport interface BlockBaseProps {\n anchor?: AnchorProps;\n visible?: GridColumnSize;\n /** @deprecated */\n resetPaddings?: boolean;\n indent?: {\n top?: IndentValue;\n bottom?: IndentValue;\n };\n qa?: string;\n}\n\nexport interface LoadableProps {\n source: string;\n /**\n * @deprecated Will be moved to params\n */\n serviceId?: number;\n params?: Record<string, string | number | boolean | object>;\n}\n\nexport interface LoadableChildren {\n loadable?: LoadableProps;\n}\n\nexport enum SliderBreakpointNames {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n Xl = 'xl',\n}\n\nexport enum SliderType {\n MediaCard = 'media-card',\n HeaderCard = 'header-card',\n FullscreenCard = 'fullscreen-card',\n}\n\nexport type SliderBreakpointParams = Record<SliderBreakpointNames, number>;\nexport type SlidesToShow = Partial<SliderBreakpointParams> | number;\n\nexport interface SliderOldProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface SliderProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface HeaderSliderBlockProps extends Omit<SliderOldProps, 'title' | 'description'> {\n items: HeaderBlockProps[];\n}\n\ninterface HeaderBackgroundProps {\n /** @deprecated replaced by Media Props image */\n url?: string;\n /** @deprecated replaced by Media Props image */\n disableCompress?: boolean;\n}\n\nexport interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {\n fullWidth?: boolean;\n fullWidthMedia?: boolean;\n}\n\nexport type ThemedHeaderBlockBackground = ThemeSupporting<HeaderBlockBackground>;\n\nexport interface HeaderBlockVideoIframe {\n src: string;\n autoplay?: boolean;\n previewImg?: string;\n height?: number;\n}\n\nexport interface HeaderBlockProps {\n title: string;\n overtitle?: string | JSX.Element;\n description?: string;\n additionalInfo?: string;\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];\n width?: HeaderWidth;\n /** @deprecated imageSize now depends on width */\n imageSize?: HeaderImageSize;\n /**\n * @deprecated used only on the main page\n * TODO: delete after the possibility to remove padding-bottom in the block\n */\n offset?: HeaderOffset;\n image?: ThemedImage;\n video?: ThemedMediaVideoProps;\n videoIframe?: HeaderBlockVideoIframe;\n mediaView?: MediaView;\n centered?: boolean;\n background?: ThemedHeaderBlockBackground;\n theme?: 'light' | 'dark';\n verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl';\n breadcrumbs?: HeaderBreadCrumbsProps;\n status?: JSX.Element;\n renderTitle?: (title: string) => React.ReactNode;\n}\n\nexport interface ExtendedFeaturesItem\n extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {\n title: string;\n label?: string;\n icon?: ThemedImage;\n /** @deprecated **/\n link?: LinkProps;\n}\n\nexport interface ExtendedFeaturesProps extends Animatable {\n items: ExtendedFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n colSizes?: GridColumnSizesType;\n}\n\nexport interface PromoFeaturesItem {\n title: string;\n text: string;\n theme?: 'accent' | 'accent-light' | 'primary';\n media?: ThemeSupporting<MediaProps>;\n}\n\nexport interface PromoFeaturesProps extends Animatable {\n items: PromoFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n theme?: 'grey' | 'default';\n}\n\nexport interface QuestionItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface QuestionsProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: QuestionItem[];\n}\n\nexport interface QuestionBlockItemProps extends QuestionItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface FoldableListItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface FoldableListProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: FoldableListItem[];\n}\n\nexport interface FoldableListBlockItemProps extends FoldableListItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface BannerBlockProps extends BannerCardProps, Animatable {}\n\nexport interface CompaniesBlockProps extends Animatable {\n title: string;\n description?: string;\n images: ThemeSupporting<ImageDeviceProps>;\n}\n\nexport interface MediaBaseBlockProps extends Animatable, MediaContentProps {\n direction?: MediaDirection;\n mobileDirection?: MediaDirection;\n largeMedia?: boolean;\n mediaOnly?: boolean;\n mediaOnlyColSizes?: GridColumnSizesType;\n}\n\nexport interface MediaContentProps\n extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'title' | 'theme' | 'centered'> {\n title: string;\n description?: string;\n /** @deprecated Use array of buttons from ContentBlockProps instead**/\n button?: ButtonProps;\n}\n\nexport interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {\n media: ThemeSupporting<MediaProps>;\n}\n\nexport interface MapBlockProps extends MediaBaseBlockProps, WithBorder {\n map: MapProps;\n}\n\nexport interface InfoBlockProps {\n theme?: TextTheme;\n backgroundColor?: ThemeSupporting<string>;\n /** @deprecated **/\n title?: string;\n /** @deprecated **/\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme'>[];\n /** @deprecated **/\n sectionsTitle?: string;\n /** @deprecated **/\n links?: Pick<LinkProps, 'text' | 'url'>[];\n leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n}\n\nexport interface TableProps {\n content: string[][];\n legend?: string[];\n hideLegend?: boolean;\n justify?: Justify[];\n marker?: LegendTableMarkerType;\n /**\n * Only as accessible name, not displayed explicitly\n */\n caption?: string;\n}\n\nexport interface TableBlockProps {\n title: string;\n table: TableProps;\n}\n\nexport interface TabsBlockItem\n extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'>,\n WithBorder {\n tabName: string;\n /**\n * @deprecated Use array links from ContentBlockProps instead\n */\n link?: LinkProps;\n image?: ThemedImage;\n caption?: string;\n media?: ThemedMediaProps;\n}\n\nexport interface TabsBlockProps extends Animatable {\n title?: TitleItemProps | string;\n description?: string;\n tabsColSizes?: GridColumnSizesType;\n centered?: boolean;\n direction?: MediaDirection;\n items: TabsBlockItem[];\n contentSize?: ContentSize;\n}\n\nexport interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n titleClassName?: string;\n description?: string;\n colSizes?: GridColumnSizesType;\n background?: ThemeSupporting<\n BackgroundImageProps & {\n border?: CardBorder;\n }\n >;\n}\n\nexport type FilterTag = {\n id: string;\n label: string;\n};\n\nexport type FilterItem = {\n tags: string[];\n card: SubBlockModels;\n};\n\nexport interface FilterBlockProps extends Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n description?: string;\n tags: FilterTag[];\n items: FilterItem[];\n tagButtonSize?: ButtonSize;\n allTag?: boolean | string;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n}\n\nexport interface IconsBlockItemProps extends AnalyticsEventsBase {\n url: string;\n text: string;\n src: ThemeSupporting<string>;\n}\n\nexport interface IconsBlockProps {\n title?: string;\n description?: string;\n size?: 's' | 'm' | 'l';\n items: IconsBlockItemProps[];\n colSizes?: GridColumnSizesType;\n}\n\ninterface ContentLayoutBlockParams {\n size?: ContentSize;\n background?: ThemeSupporting<BackgroundImageProps>;\n centered?: boolean;\n theme?: ContentTheme;\n textWidth?: ContentTextSize;\n}\n\nexport interface ContentLayoutBlockProps extends ContentLayoutBlockParams {\n textContent: ContentBlockProps;\n fileContent?: FileLinkProps[];\n}\n\nexport type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;\n\nexport interface ContentItemProps {\n title?: string;\n text?: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentListProps {\n list: ContentItemProps[];\n size: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentBlockProps {\n title?: TitleItemBaseProps | string;\n titleId?: string;\n text?: string;\n textId?: string;\n additionalInfo?: string;\n links?: LinkProps[];\n buttons?: ButtonProps[];\n size?: ContentSize;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n theme?: ContentTheme;\n list?: ContentItemProps[];\n controlPosition?: 'default' | 'bottom';\n}\n\nexport enum PCShareSocialNetwork {\n Vk = 'vk',\n Telegram = 'telegram',\n Twitter = 'twitter',\n Facebook = 'facebook',\n LinkedIn = 'linkedin',\n}\n\nexport interface ShareBlockProps {\n items: PCShareSocialNetwork[];\n title?: string;\n}\n\nexport enum FormBlockDataTypes {\n YANDEX = 'yandex',\n HUBSPOT = 'hubspot',\n}\n\nexport enum FormBlockDirection {\n FormContent = 'form-content',\n ContentForm = 'content-form',\n Center = 'center',\n}\n\nexport interface FormBlockYandexData {\n yandex: ThemeSupporting<YandexFormProps>;\n}\n\nexport interface FormBlockHubspotData {\n hubspot: ThemeSupporting<HubspotFormProps>;\n}\n\nexport type FormBlockData = FormBlockYandexData | FormBlockHubspotData;\n\nexport interface FormBlockProps {\n formData: FormBlockData;\n title?: string;\n textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;\n direction?: FormBlockDirection;\n background?: ThemeSupporting<BackgroundImageProps>;\n}\n\n//block models\nexport type HeaderBlockModel = {\n type: BlockType.HeaderBlock;\n} & HeaderBlockProps;\n\nexport type SliderOldBlockModel = {\n type: BlockType.SliderOldBlock;\n} & SliderOldProps;\n\nexport type ExtendedFeaturesBlockModel = {\n type: BlockType.ExtendedFeaturesBlock;\n} & ExtendedFeaturesProps;\n\nexport type PromoFeaturesBlockModel = {\n type: BlockType.PromoFeaturesBlock;\n} & PromoFeaturesProps;\n\nexport type QuestionsBlockModel = {\n type: BlockType.QuestionsBlock;\n} & QuestionsProps;\n\nexport type FoldableListBlockModel = {\n type: BlockType.FoldableListBlock;\n} & FoldableListProps;\n\nexport type BannerBlockModel = {\n type: BlockType.BannerBlock;\n} & BannerBlockProps;\n\nexport type CompaniesBlockModel = {\n type: BlockType.CompaniesBlock;\n} & CompaniesBlockProps;\n\nexport type MediaBlockModel = {\n type: BlockType.MediaBlock;\n} & MediaBlockProps;\n\nexport type MapBlockModel = {\n type: BlockType.MapBlock;\n} & MapBlockProps;\n\nexport type InfoBlockModel = {\n type: BlockType.InfoBlock;\n} & InfoBlockProps;\n\nexport type TableBlockModel = {\n type: BlockType.TableBlock;\n} & TableBlockProps;\n\nexport type TabsBlockModel = {\n type: BlockType.TabsBlock;\n} & TabsBlockProps;\n\nexport type CardLayoutBlockModel = {\n type: BlockType.CardLayoutBlock;\n} & CardLayoutBlockProps;\n\nexport type FilterBlockModel = {\n type: BlockType.FilterBlock;\n} & FilterBlockProps;\n\nexport type IconsBlockModel = {\n type: BlockType.IconsBlock;\n} & IconsBlockProps;\n\nexport type HeaderSliderBlockModel = {\n type: BlockType.HeaderSliderBlock;\n} & HeaderSliderBlockProps;\n\nexport type ContentLayoutBlockModel = {\n type: BlockType.ContentLayoutBlock;\n} & ContentLayoutBlockProps;\n\nexport type ShareBLockModel = {\n type: BlockType.ShareBlock;\n} & ShareBlockProps;\n\nexport type FormBlockModel = {\n type: BlockType.FormBlock;\n} & FormBlockProps;\n\nexport type SliderBlockModel = {\n type: BlockType.SliderBlock;\n} & SliderProps;\n\ntype BlockModels =\n | SliderOldBlockModel\n | SliderBlockModel\n | ExtendedFeaturesBlockModel\n | PromoFeaturesBlockModel\n | QuestionsBlockModel\n | FoldableListBlockModel\n | BannerBlockModel\n | CompaniesBlockModel\n | MediaBlockModel\n | MapBlockModel\n | InfoBlockModel\n | TableBlockModel\n | TabsBlockModel\n | HeaderBlockModel\n | IconsBlockModel\n | HeaderSliderBlockModel\n | CardLayoutBlockModel\n | ContentLayoutBlockModel\n | ShareBLockModel\n | FilterBlockModel\n | FormBlockModel;\n\nexport type Block = BlockModels & BlockBaseProps;\n"]}
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/blocks.ts"],"names":[],"mappings":";;;AA4CA,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACjB,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,kBAAkB;IAClB,gDAAmC,CAAA;IACnC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IAC1B,kDAAqC,CAAA;IACrC,wDAA2C,CAAA;IAC3C,uCAA0B,CAAA;IAC1B,mCAAsB,CAAA;IACtB,yCAA4B,CAAA;IAC5B,qCAAwB,CAAA;AAC5B,CAAC,EAvBW,SAAS,yBAAT,SAAS,QAuBpB;AAEY,QAAA,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACtC,QAAA,gBAAgB,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAgCrF,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,kCAAS,CAAA;IACT,kCAAS,CAAA;IACT,kCAAS,CAAA;IACT,kCAAS,CAAA;AACb,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC;AAED,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,sCAAwB,CAAA;IACxB,wCAA0B,CAAA;IAC1B,gDAAkC,CAAA;AACtC,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AA0UD,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC5B,iCAAS,CAAA;IACT,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;AACzB,CAAC,EANW,oBAAoB,oCAApB,oBAAoB,QAM/B;AAOD,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;AACvB,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,kDAA4B,CAAA;IAC5B,kDAA4B,CAAA;IAC5B,uCAAiB,CAAA;AACrB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B","sourcesContent":["import * as React from 'react';\n\nimport {ButtonSize} from '@gravity-ui/uikit';\n\nimport {GridColumnSize, GridColumnSizesType, IndentValue} from '../../grid/types';\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {\n AnchorProps,\n Animatable,\n BackgroundImageProps,\n ButtonProps,\n CardBorder,\n ContentSize,\n ContentTextSize,\n ContentTheme,\n FileLinkProps,\n GravityIconProps,\n HeaderBreadCrumbsProps,\n HeaderImageSize,\n HeaderOffset,\n HeaderWidth,\n ImageDeviceProps,\n ImageProps,\n Justify,\n LegendTableMarkerType,\n LinkProps,\n MapProps,\n MediaDirection,\n MediaProps,\n MediaView,\n TextSize,\n TextTheme,\n ThemedImage,\n ThemedMediaProps,\n ThemedMediaVideoProps,\n TitleItemBaseProps,\n TitleItemProps,\n WithBorder,\n YandexFormProps,\n} from './common';\nimport {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub-blocks';\n\nexport enum BlockType {\n PromoFeaturesBlock = 'promo-features-block',\n ExtendedFeaturesBlock = 'extended-features-block',\n /** @deprecated */\n SliderOldBlock = 'slider-old-block',\n SliderBlock = 'slider-block',\n QuestionsBlock = 'questions-block',\n FoldableListBlock = 'foldable-list-block',\n BannerBlock = 'banner-block',\n CompaniesBlock = 'companies-block',\n MediaBlock = 'media-block',\n InfoBlock = 'info-block',\n TableBlock = 'table-block',\n TabsBlock = 'tabs-block',\n HeaderSliderBlock = 'header-slider-block',\n HeaderBlock = 'header-block',\n IconsBlock = 'icons-block',\n CardLayoutBlock = 'card-layout-block',\n ContentLayoutBlock = 'content-layout-block',\n ShareBlock = 'share-block',\n MapBlock = 'map-block',\n FilterBlock = 'filter-block',\n FormBlock = 'form-block',\n}\n\nexport const BlockTypes = Object.values(BlockType);\nexport const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];\n\nexport interface Childable {\n children?: SubBlock[];\n}\n\n//block props\nexport interface BlockBaseProps {\n anchor?: AnchorProps;\n visible?: GridColumnSize;\n /** @deprecated */\n resetPaddings?: boolean;\n indent?: {\n top?: IndentValue;\n bottom?: IndentValue;\n };\n qa?: string;\n}\n\nexport interface LoadableProps {\n source: string;\n /**\n * @deprecated Will be moved to params\n */\n serviceId?: number;\n params?: Record<string, string | number | boolean | object>;\n}\n\nexport interface LoadableChildren {\n loadable?: LoadableProps;\n}\n\nexport enum SliderBreakpointNames {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n Xl = 'xl',\n}\n\nexport enum SliderType {\n MediaCard = 'media-card',\n HeaderCard = 'header-card',\n FullscreenCard = 'fullscreen-card',\n}\n\nexport type SliderBreakpointParams = Record<SliderBreakpointNames, number>;\nexport type SlidesToShow = Partial<SliderBreakpointParams> | number;\n\nexport interface SliderOldProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface SliderProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface HeaderSliderBlockProps extends Omit<SliderOldProps, 'title' | 'description'> {\n items: HeaderBlockProps[];\n}\n\ninterface HeaderBackgroundProps {\n /** @deprecated replaced by Media Props image */\n url?: string;\n /** @deprecated replaced by Media Props image */\n disableCompress?: boolean;\n}\n\nexport interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {\n fullWidth?: boolean;\n fullWidthMedia?: boolean;\n}\n\nexport type ThemedHeaderBlockBackground = ThemeSupporting<HeaderBlockBackground>;\n\nexport interface HeaderBlockVideoIframe {\n src: string;\n autoplay?: boolean;\n previewImg?: string;\n height?: number;\n}\n\nexport interface HeaderBlockProps {\n title: string;\n overtitle?: string | JSX.Element;\n description?: string;\n additionalInfo?: string;\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];\n width?: HeaderWidth;\n /** @deprecated imageSize now depends on width */\n imageSize?: HeaderImageSize;\n /**\n * @deprecated used only on the main page\n * TODO: delete after the possibility to remove padding-bottom in the block\n */\n offset?: HeaderOffset;\n image?: ThemedImage;\n video?: ThemedMediaVideoProps;\n videoIframe?: HeaderBlockVideoIframe;\n mediaView?: MediaView;\n centered?: boolean;\n background?: ThemedHeaderBlockBackground;\n theme?: 'light' | 'dark';\n verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl';\n breadcrumbs?: HeaderBreadCrumbsProps;\n status?: JSX.Element;\n renderTitle?: (title: string) => React.ReactNode;\n}\n\nexport interface ExtendedFeaturesItem\n extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {\n title: string;\n label?: string;\n icon?: ThemedImage;\n /** @deprecated **/\n link?: LinkProps;\n}\n\nexport interface ExtendedFeaturesProps extends Animatable {\n items: ExtendedFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n colSizes?: GridColumnSizesType;\n}\n\nexport interface PromoFeaturesItem {\n title: string;\n text: string;\n theme?: 'accent' | 'accent-light' | 'primary';\n media?: ThemeSupporting<MediaProps>;\n}\n\nexport interface PromoFeaturesProps extends Animatable {\n items: PromoFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n theme?: 'grey' | 'default';\n}\n\nexport interface QuestionItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface QuestionsProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: QuestionItem[];\n}\n\nexport interface QuestionBlockItemProps extends QuestionItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface FoldableListItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface FoldableListProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: FoldableListItem[];\n}\n\nexport interface FoldableListBlockItemProps extends FoldableListItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface BannerBlockProps extends BannerCardProps, Animatable {}\n\nexport interface CompaniesBlockProps extends Animatable {\n title: string;\n description?: string;\n images: ThemeSupporting<ImageDeviceProps>;\n}\n\nexport interface MediaBaseBlockProps extends Animatable, MediaContentProps {\n direction?: MediaDirection;\n mobileDirection?: MediaDirection;\n largeMedia?: boolean;\n mediaOnly?: boolean;\n mediaOnlyColSizes?: GridColumnSizesType;\n}\n\nexport interface MediaContentProps\n extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered'> {\n description?: string;\n /** @deprecated Use array of buttons from ContentBlockProps instead**/\n button?: ButtonProps;\n}\n\nexport interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {\n media: ThemeSupporting<MediaProps>;\n}\n\nexport interface MapBlockProps extends MediaBaseBlockProps, WithBorder {\n map: MapProps;\n}\n\nexport interface InfoBlockProps {\n theme?: TextTheme;\n backgroundColor?: ThemeSupporting<string>;\n /** @deprecated **/\n title?: string;\n /** @deprecated **/\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme'>[];\n /** @deprecated **/\n sectionsTitle?: string;\n /** @deprecated **/\n links?: Pick<LinkProps, 'text' | 'url'>[];\n leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n}\n\nexport interface TableProps {\n content: string[][];\n legend?: string[];\n hideLegend?: boolean;\n justify?: Justify[];\n marker?: LegendTableMarkerType;\n /**\n * Only as accessible name, not displayed explicitly\n */\n caption?: string;\n}\n\nexport interface TableBlockProps {\n title: string;\n table: TableProps;\n}\n\nexport interface TabsBlockItem\n extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'>,\n WithBorder {\n tabName: string;\n /**\n * @deprecated Use array links from ContentBlockProps instead\n */\n link?: LinkProps;\n image?: ThemedImage;\n caption?: string;\n media?: ThemedMediaProps;\n}\n\nexport interface TabsBlockProps extends Animatable {\n title?: TitleItemProps | string;\n description?: string;\n tabsColSizes?: GridColumnSizesType;\n centered?: boolean;\n direction?: MediaDirection;\n items: TabsBlockItem[];\n contentSize?: ContentSize;\n}\n\nexport interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n titleClassName?: string;\n description?: string;\n colSizes?: GridColumnSizesType;\n background?: ThemeSupporting<\n BackgroundImageProps & {\n border?: CardBorder;\n }\n >;\n}\n\nexport type FilterTag = {\n id: string;\n label: string;\n};\n\nexport type FilterItem = {\n tags: string[];\n card: SubBlockModels;\n};\n\nexport interface FilterBlockProps extends Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n description?: string;\n tags: FilterTag[];\n items: FilterItem[];\n tagButtonSize?: ButtonSize;\n allTag?: boolean | string;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n}\n\nexport interface IconsBlockItemProps extends AnalyticsEventsBase {\n url: string;\n text: string;\n src: ThemeSupporting<string>;\n}\n\nexport interface IconsBlockProps {\n title?: string;\n description?: string;\n size?: 's' | 'm' | 'l';\n items: IconsBlockItemProps[];\n colSizes?: GridColumnSizesType;\n}\n\ninterface ContentLayoutBlockParams {\n size?: ContentSize;\n background?: ThemeSupporting<BackgroundImageProps>;\n centered?: boolean;\n theme?: ContentTheme;\n textWidth?: ContentTextSize;\n}\n\nexport interface ContentLayoutBlockProps extends ContentLayoutBlockParams {\n textContent: ContentBlockProps;\n fileContent?: FileLinkProps[];\n}\n\nexport type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;\n\nexport interface ContentItemProps {\n title?: string;\n text?: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentListProps {\n list: ContentItemProps[];\n size: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentBlockProps {\n title?: TitleItemBaseProps | string;\n titleId?: string;\n text?: string;\n textId?: string;\n additionalInfo?: string;\n links?: LinkProps[];\n buttons?: ButtonProps[];\n size?: ContentSize;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n theme?: ContentTheme;\n list?: ContentItemProps[];\n controlPosition?: 'default' | 'bottom';\n}\n\nexport enum PCShareSocialNetwork {\n Vk = 'vk',\n Telegram = 'telegram',\n Twitter = 'twitter',\n Facebook = 'facebook',\n LinkedIn = 'linkedin',\n}\n\nexport interface ShareBlockProps {\n items: PCShareSocialNetwork[];\n title?: string;\n}\n\nexport enum FormBlockDataTypes {\n YANDEX = 'yandex',\n HUBSPOT = 'hubspot',\n}\n\nexport enum FormBlockDirection {\n FormContent = 'form-content',\n ContentForm = 'content-form',\n Center = 'center',\n}\n\nexport interface FormBlockYandexData {\n yandex: ThemeSupporting<YandexFormProps>;\n}\n\nexport interface FormBlockHubspotData {\n hubspot: ThemeSupporting<HubspotFormProps>;\n}\n\nexport type FormBlockData = FormBlockYandexData | FormBlockHubspotData;\n\nexport interface FormBlockProps {\n formData: FormBlockData;\n title?: string;\n textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;\n direction?: FormBlockDirection;\n background?: ThemeSupporting<BackgroundImageProps>;\n}\n\n//block models\nexport type HeaderBlockModel = {\n type: BlockType.HeaderBlock;\n} & HeaderBlockProps;\n\nexport type SliderOldBlockModel = {\n type: BlockType.SliderOldBlock;\n} & SliderOldProps;\n\nexport type ExtendedFeaturesBlockModel = {\n type: BlockType.ExtendedFeaturesBlock;\n} & ExtendedFeaturesProps;\n\nexport type PromoFeaturesBlockModel = {\n type: BlockType.PromoFeaturesBlock;\n} & PromoFeaturesProps;\n\nexport type QuestionsBlockModel = {\n type: BlockType.QuestionsBlock;\n} & QuestionsProps;\n\nexport type FoldableListBlockModel = {\n type: BlockType.FoldableListBlock;\n} & FoldableListProps;\n\nexport type BannerBlockModel = {\n type: BlockType.BannerBlock;\n} & BannerBlockProps;\n\nexport type CompaniesBlockModel = {\n type: BlockType.CompaniesBlock;\n} & CompaniesBlockProps;\n\nexport type MediaBlockModel = {\n type: BlockType.MediaBlock;\n} & MediaBlockProps;\n\nexport type MapBlockModel = {\n type: BlockType.MapBlock;\n} & MapBlockProps;\n\nexport type InfoBlockModel = {\n type: BlockType.InfoBlock;\n} & InfoBlockProps;\n\nexport type TableBlockModel = {\n type: BlockType.TableBlock;\n} & TableBlockProps;\n\nexport type TabsBlockModel = {\n type: BlockType.TabsBlock;\n} & TabsBlockProps;\n\nexport type CardLayoutBlockModel = {\n type: BlockType.CardLayoutBlock;\n} & CardLayoutBlockProps;\n\nexport type FilterBlockModel = {\n type: BlockType.FilterBlock;\n} & FilterBlockProps;\n\nexport type IconsBlockModel = {\n type: BlockType.IconsBlock;\n} & IconsBlockProps;\n\nexport type HeaderSliderBlockModel = {\n type: BlockType.HeaderSliderBlock;\n} & HeaderSliderBlockProps;\n\nexport type ContentLayoutBlockModel = {\n type: BlockType.ContentLayoutBlock;\n} & ContentLayoutBlockProps;\n\nexport type ShareBLockModel = {\n type: BlockType.ShareBlock;\n} & ShareBlockProps;\n\nexport type FormBlockModel = {\n type: BlockType.FormBlock;\n} & FormBlockProps;\n\nexport type SliderBlockModel = {\n type: BlockType.SliderBlock;\n} & SliderProps;\n\ntype BlockModels =\n | SliderOldBlockModel\n | SliderBlockModel\n | ExtendedFeaturesBlockModel\n | PromoFeaturesBlockModel\n | QuestionsBlockModel\n | FoldableListBlockModel\n | BannerBlockModel\n | CompaniesBlockModel\n | MediaBlockModel\n | MapBlockModel\n | InfoBlockModel\n | TableBlockModel\n | TabsBlockModel\n | HeaderBlockModel\n | IconsBlockModel\n | HeaderSliderBlockModel\n | CardLayoutBlockModel\n | ContentLayoutBlockModel\n | ShareBLockModel\n | FilterBlockModel\n | FormBlockModel;\n\nexport type Block = BlockModels & BlockBaseProps;\n"]}
|
package/build/cjs/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js
CHANGED
|
@@ -15,12 +15,15 @@ const ContentWrapper_1 = require("../ContentWrapper/ContentWrapper.js");
|
|
|
15
15
|
const b = (0, utils_2.block)('navigation-link');
|
|
16
16
|
const NavigationLink = (props) => {
|
|
17
17
|
const { hostname, Link } = React.useContext(locationContext_1.LocationContext);
|
|
18
|
-
const { url, text, icon, arrow, target, className, iconSize, urlTitle, analyticsEvents, ...rest } = props;
|
|
18
|
+
const { url, text, icon, arrow, target, className, iconSize, urlTitle, analyticsEvents, onClick: onClickOrigin, ...rest } = props;
|
|
19
19
|
const linkExtraProps = (0, utils_2.getLinkProps)(url, hostname, target);
|
|
20
20
|
const iconData = icon && (0, utils_1.getMediaImage)(icon);
|
|
21
21
|
const handleAnalytics = (0, hooks_1.useAnalytics)(models_1.DefaultEventNames.Link, url);
|
|
22
|
-
const onClick = () => {
|
|
22
|
+
const onClick = (e) => {
|
|
23
23
|
handleAnalytics(analyticsEvents);
|
|
24
|
+
if (onClickOrigin && e) {
|
|
25
|
+
onClickOrigin?.(e);
|
|
26
|
+
}
|
|
24
27
|
};
|
|
25
28
|
const classes = b(null, className);
|
|
26
29
|
const content = ((0, jsx_runtime_1.jsxs)(React.Fragment, { children: [(0, jsx_runtime_1.jsx)(ContentWrapper_1.ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }), arrow && (0, jsx_runtime_1.jsx)(icons_1.NavigationArrow, { className: b('arrow') })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationLink.js","sourceRoot":"../../../../../../../src","sources":["navigation/components/NavigationItem/components/NavigationLink/NavigationLink.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,mEAAqD;AACrD,0EAA0E;AAC1E,qFAAuE;AACvE,yDAAkD;AAClD,yDAAqD;AACrD,2DAA4E;AAC5E,yDAAyD;AAEzD,wEAAgE;AAIhE,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,iBAAiB,CAAC,CAAC;AAI5B,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,EAAE;IACzD,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,iCAAe,CAAC,CAAC;IAC3D,MAAM,EACF,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,GAAG,IAAI,EACV,GAAG,KAAK,CAAC;IAEV,MAAM,cAAc,GAAG,IAAA,oBAAY,EAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,IAAI,IAAI,IAAA,qBAAa,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,eAAe,GAAG,IAAA,oBAAY,EAAC,0BAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAElE,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"NavigationLink.js","sourceRoot":"../../../../../../../src","sources":["navigation/components/NavigationItem/components/NavigationLink/NavigationLink.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,mEAAqD;AACrD,0EAA0E;AAC1E,qFAAuE;AACvE,yDAAkD;AAClD,yDAAqD;AACrD,2DAA4E;AAC5E,yDAAyD;AAEzD,wEAAgE;AAIhE,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,iBAAiB,CAAC,CAAC;AAI5B,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,EAAE;IACzD,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,iCAAe,CAAC,CAAC;IAC3D,MAAM,EACF,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,OAAO,EAAE,aAAa,EACtB,GAAG,IAAI,EACV,GAAG,KAAK,CAAC;IAEV,MAAM,cAAc,GAAG,IAAA,oBAAY,EAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,IAAI,IAAI,IAAA,qBAAa,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,eAAe,GAAG,IAAA,oBAAY,EAAC,0BAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAElE,MAAM,OAAO,GAAG,CAAC,CAAoB,EAAE,EAAE;QACrC,eAAe,CAAC,eAAe,CAAC,CAAC;QACjC,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;YACrB,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,CACZ,wBAAC,KAAK,CAAC,QAAQ,eACX,uBAAC,+BAAc,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,EACjE,KAAK,IAAI,uBAAC,uBAAe,IAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,GAAI,IACvC,CACpB,CAAC;IAEF,IAAI,cAAc,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClC,OAAO,CACH,8BACI,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,QAAQ,IAAI,IAAI,EACvB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,OAAO,KACZ,IAAI,KACJ,cAAc,YAEjB,OAAO,GACR,CACP,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,CACH,uBAAC,uBAAU,IAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,kBAC3B,8BACI,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,QAAQ,IAAI,IAAI,KACnB,IAAI,EACR,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,OAAO,EAAE,YAE/C,OAAO,GACR,GACK,CAChB,CAAC;IACN,CAAC;AACL,CAAC,CAAC;AAjEW,QAAA,cAAc,kBAiEzB","sourcesContent":["import * as React from 'react';\n\nimport {RouterLink} from '../../../../../components';\nimport {getMediaImage} from '../../../../../components/Media/Image/utils';\nimport {LocationContext} from '../../../../../context/locationContext';\nimport {useAnalytics} from '../../../../../hooks';\nimport {NavigationArrow} from '../../../../../icons';\nimport {DefaultEventNames, NavigationLinkItem} from '../../../../../models';\nimport {block, getLinkProps} from '../../../../../utils';\nimport {NavigationItemProps} from '../../../../models';\nimport {ContentWrapper} from '../ContentWrapper/ContentWrapper';\n\nimport './NavigationLink.scss';\n\nconst b = block('navigation-link');\n\ntype NavigationLinkProps = NavigationItemProps & NavigationLinkItem;\n\nexport const NavigationLink = (props: NavigationLinkProps) => {\n const {hostname, Link} = React.useContext(LocationContext);\n const {\n url,\n text,\n icon,\n arrow,\n target,\n className,\n iconSize,\n urlTitle,\n analyticsEvents,\n onClick: onClickOrigin,\n ...rest\n } = props;\n\n const linkExtraProps = getLinkProps(url, hostname, target);\n const iconData = icon && getMediaImage(icon);\n const handleAnalytics = useAnalytics(DefaultEventNames.Link, url);\n\n const onClick = (e?: React.MouseEvent) => {\n handleAnalytics(analyticsEvents);\n if (onClickOrigin && e) {\n onClickOrigin?.(e);\n }\n };\n\n const classes = b(null, className);\n const content = (\n <React.Fragment>\n <ContentWrapper text={text} icon={iconData} iconSize={iconSize} />\n {arrow && <NavigationArrow className={b('arrow')} />}\n </React.Fragment>\n );\n\n if (linkExtraProps?.target || !Link) {\n return (\n <a\n href={url}\n title={urlTitle || text}\n className={classes}\n onClick={onClick}\n {...rest}\n {...linkExtraProps}\n >\n {content}\n </a>\n );\n } else {\n return (\n <RouterLink href={url} passHref>\n <a\n role=\"link\"\n title={urlTitle || text}\n {...rest}\n className={classes}\n tabIndex={0}\n onClick={onClick}\n onKeyDown={(e) => e.key === 'Enter' && onClick()}\n >\n {content}\n </a>\n </RouterLink>\n );\n }\n};\n"]}
|
|
@@ -18,7 +18,7 @@ export const MediaBlock = (props) => {
|
|
|
18
18
|
const theme = useTheme();
|
|
19
19
|
const mediaThemed = getThemedValue(media, theme);
|
|
20
20
|
const mediaWithMicrodata = mergeVideoMicrodata(mediaThemed, {
|
|
21
|
-
name: title,
|
|
21
|
+
name: typeof title === 'object' ? title.text : title,
|
|
22
22
|
description,
|
|
23
23
|
});
|
|
24
24
|
return (_jsx(MediaBase, { ...props, onScroll: () => setPlay(true), children: _jsx(MediaBase.Card, { children: _jsx(Media, { imageClassName: b('image'), ...mediaWithMicrodata, playVideo: play, className: b({ border: borderSelected }) }) }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Media.js","sourceRoot":"../../../../src","sources":["blocks/Media/Media.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,wCAAqC;AACjD,OAAO,SAAS,gDAA6C;AAC7D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAE7C,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAClD,OAAO,EAAC,cAAc,EAAC,sCAAmC;AAC1D,OAAO,EAAC,mBAAmB,EAAC,iCAA8B;AAE1D,OAAO,aAAa,CAAC;AAErB,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IACjD,MAAM,EAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAC,GAAG,KAAK,CAAC;IACjE,MAAM,cAAc,GAAG,cAAc,CAAC;QAClC,MAAM;QACN,aAAa;KAChB,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAU,KAAK,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjD,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,WAAW,EAAE;QACxD,IAAI,EAAE,KAAK;
|
|
1
|
+
{"version":3,"file":"Media.js","sourceRoot":"../../../../src","sources":["blocks/Media/Media.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,wCAAqC;AACjD,OAAO,SAAS,gDAA6C;AAC7D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAE7C,OAAO,EA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aBase from '../../components/MediaBase/MediaBase';\nimport {useTheme} from '../../context/theme';\nimport {MediaBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {getMediaBorder} from '../../utils/borderSelector';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport './Media.scss';\n\nconst b = block('media-block');\n\nexport const MediaBlock = (props: MediaBlockProps) => {\n const {media, border, disableShadow, title, description} = props;\n const borderSelected = getMediaBorder({\n border,\n disableShadow,\n });\n\n const [play, setPlay] = React.useState<boolean>(false);\n const theme = useTheme();\n const mediaThemed = getThemedValue(media, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(mediaThemed, {\n name: typeof title === 'object' ? title.text : title,\n description,\n });\n\n return (\n <MediaBase {...props} onScroll={() => setPlay(true)}>\n <MediaBase.Card>\n <Media\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n playVideo={play}\n className={b({border: borderSelected})}\n />\n </MediaBase.Card>\n </MediaBase>\n );\n};\n\nexport default MediaBlock;\n"]}
|
|
@@ -38,6 +38,13 @@ export const DefaultVideo = React.forwardRef((props, ref) => {
|
|
|
38
38
|
videoElement.removeEventListener('ended', handleVideoEnd);
|
|
39
39
|
};
|
|
40
40
|
}, [videoRef, onVideoEnd]);
|
|
41
|
+
// to guarantee setting a muted attribute in HTML. https://github.com/facebook/react/issues/10389
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
const videoElement = videoRef.current;
|
|
44
|
+
if (videoElement && initiallyMuted) {
|
|
45
|
+
videoElement.defaultMuted = true;
|
|
46
|
+
}
|
|
47
|
+
}, [videoRef, initiallyMuted]);
|
|
41
48
|
const onPlayToggle = React.useCallback(() => {
|
|
42
49
|
setIsPaused((value) => {
|
|
43
50
|
if (value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultVideo.js","sourceRoot":"../../../../src","sources":["components/DefaultVideo/DefaultVideo.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CA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EvC,OAAO,CACH,MAAC,KAAK,CAAC,QAAQ,eACX,iBACI,uBAAuB,QACvB,WAAW;gBACX,aAAa;gBACb,qDAAqD;gBACrD,GAAG,EAAC,OAAO,EACX,SAAS,EAAE,CAAC,EAAE,EACd,GAAG,EAAE,QAAQ,EACb,OAAO,EAAC,UAAU,EAClB,KAAK,EAAE,OAAO,gBACF,KAAK,CAAC,SAAS,EAC3B,OAAO,EAAE,OAAO,aAEf,yBAAyB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,GAAG,EAAE,IAAI,EAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAC9D,iBAAoB,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,aAAW,EAAE,IAAxC,KAAK,CAAuC,CAC5D,CAAC,EACF,gBAAO,OAAO,QAAC,IAAI,EAAC,UAAU,GAAG,IAC7B,EAEP,QAAQ,KAAK,sBAAsB,CAAC,MAAM,IAAI,CAC3C,KAAC,iBAAiB,IACd,SAAS,EAAE,0BAA0B,EACrC,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,YAAY,EACzB,eAAe,EAAE,eAAe,EAChC,KAAK,QACL,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE;oBACF,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;oBACzB,UAAU,EAAE,YAAY;iBAC3B,GACH,CACL,IACY,CACpB,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {CustomControlsType, MediaVideoControlsType, MediaVideoProps} from '../../models';\nimport {block} from '../../utils';\nimport {getVideoTypesWithPriority} from '../Media/Video/utils';\nimport CustomBarControls from '../ReactPlayer/CustomBarControls';\n\nimport './DefaultVideo.scss';\n\nconst b = block('default-video');\n\ntype DefaultVideoRefType = HTMLVideoElement | undefined;\n\ninterface DefaultVideoProps {\n video: MediaVideoProps;\n qa?: string;\n customBarControlsClassName?: string;\n className?: string;\n}\n\nexport const DefaultVideo = React.forwardRef<DefaultVideoRefType, DefaultVideoProps>(\n (props, ref) => {\n const {video, qa, customBarControlsClassName} = props;\n const {controls, customControlsOptions, muted: initiallyMuted = true, onVideoEnd} = video;\n const {\n muteButtonShown,\n positioning,\n type: customControlsType,\n } = customControlsOptions || {};\n const [isPaused, setIsPaused] = React.useState(false);\n const [isMuted, setIsMuted] = React.useState(initiallyMuted);\n const videoRef = React.useRef<HTMLVideoElement>(null);\n\n // one may not use this hook and work with `ref` variable only, but\n // in this case one should support both function type and object type,\n // according to ForwardedRef type.\n // Currently used way with extra ref and useImperativeHandle is more\n // convenient and allows us to work with object typed ref only,\n // avoiding typeof ref === 'function' statements\n React.useImperativeHandle(ref, () => {\n if (!videoRef?.current) {\n return undefined;\n }\n\n return videoRef.current;\n }, [videoRef]);\n\n React.useEffect(() => {\n const videoElement = videoRef.current;\n if (!videoElement || !onVideoEnd) {\n return undefined;\n }\n\n const handleVideoEnd = () => {\n onVideoEnd?.();\n };\n\n videoElement.addEventListener('ended', handleVideoEnd);\n return () => {\n videoElement.removeEventListener('ended', handleVideoEnd);\n };\n }, [videoRef, onVideoEnd]);\n\n const onPlayToggle = React.useCallback(() => {\n setIsPaused((value) => {\n if (value) {\n videoRef?.current?.play();\n } else {\n videoRef?.current?.pause();\n }\n\n return !value;\n });\n }, [videoRef]);\n const onMuteToggle = React.useCallback(() => {\n setIsMuted((value) => !value);\n }, []);\n\n const onClick = React.useCallback(() => {\n if (customControlsType === CustomControlsType.WithPlayPauseButton) {\n onPlayToggle();\n }\n }, [onPlayToggle, customControlsType]);\n\n return (\n <React.Fragment>\n <video\n disablePictureInPicture\n playsInline\n // @ts-ignore\n // eslint-disable-next-line react/no-unknown-property\n pip=\"false\"\n className={b()}\n ref={videoRef}\n preload=\"metadata\"\n muted={isMuted}\n aria-label={video.ariaLabel}\n onClick={onClick}\n >\n {getVideoTypesWithPriority(video.src).map(({src, type}, index) => (\n <source key={index} src={src} type={type} data-qa={qa} />\n ))}\n <track default kind=\"captions\" />\n </video>\n\n {controls === MediaVideoControlsType.Custom && (\n <CustomBarControls\n className={customBarControlsClassName}\n type={customControlsType}\n isPaused={isPaused}\n onPlayClick={onPlayToggle}\n muteButtonShown={muteButtonShown}\n shown\n positioning={positioning}\n mute={{\n isMuted: Boolean(isMuted),\n changeMute: onMuteToggle,\n }}\n />\n )}\n </React.Fragment>\n );\n },\n);\n\nDefaultVideo.displayName = 'DefaultVideo';\n"]}
|
|
1
|
+
{"version":3,"file":"DefaultVideo.js","sourceRoot":"../../../../src","sources":["components/DefaultVideo/DefaultVideo.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,kBAAkB,EAAE,sBAAsB,EAAkB,8BAAqB;AACzF,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,EAAC,yBAAyB,EAAC,gCAA6B;AAC/D,OAAO,iBAAiB,4CAAyC;AAEjE,OAAO,oBAAoB,CAAC;AAE5B,MAAM,CAAC,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAWjC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CACxC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACX,MAAM,EAAC,KAAK,EAAE,EAAE,EAAE,0BAA0B,EAAC,GAAG,KAAK,CAAC;IACtD,MAAM,EAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK,EAAE,cAAc,GAAG,IAAI,EAAE,UAAU,EAAC,GAAG,KAAK,CAAC;IAC1F,MAAM,EACF,eAAe,EACf,WAAW,EACX,IAAI,EAAE,kBAAkB,GAC3B,GAAG,qBAAqB,IAAI,EAAE,CAAC;IAChC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,O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,CAAuC,CAC5D,CAAC,EACF,gBAAO,OAAO,QAAC,IAAI,EAAC,UAAU,GAAG,IAC7B,EAEP,QAAQ,KAAK,sBAAsB,CAAC,MAAM,IAAI,CAC3C,KAAC,iBAAiB,IACd,SAAS,EAAE,0BAA0B,EACrC,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,YAAY,EACzB,eAAe,EAAE,eAAe,EAChC,KAAK,QACL,WAAW,EAAE,WAAW,EACxB,IAAI,EAAE;oBACF,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;oBACzB,UAAU,EAAE,YAAY;iBAC3B,GACH,CACL,IACY,CACpB,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {CustomControlsType, MediaVideoControlsType, MediaVideoProps} from '../../models';\nimport {block} from '../../utils';\nimport {getVideoTypesWithPriority} from '../Media/Video/utils';\nimport CustomBarControls from '../ReactPlayer/CustomBarControls';\n\nimport './DefaultVideo.scss';\n\nconst b = block('default-video');\n\ntype DefaultVideoRefType = HTMLVideoElement | undefined;\n\ninterface DefaultVideoProps {\n video: MediaVideoProps;\n qa?: string;\n customBarControlsClassName?: string;\n className?: string;\n}\n\nexport const DefaultVideo = React.forwardRef<DefaultVideoRefType, DefaultVideoProps>(\n (props, ref) => {\n const {video, qa, customBarControlsClassName} = props;\n const {controls, customControlsOptions, muted: initiallyMuted = true, onVideoEnd} = video;\n const {\n muteButtonShown,\n positioning,\n type: customControlsType,\n } = customControlsOptions || {};\n const [isPaused, setIsPaused] = React.useState(false);\n const [isMuted, setIsMuted] = React.useState(initiallyMuted);\n const videoRef = React.useRef<HTMLVideoElement>(null);\n\n // one may not use this hook and work with `ref` variable only, but\n // in this case one should support both function type and object type,\n // according to ForwardedRef type.\n // Currently used way with extra ref and useImperativeHandle is more\n // convenient and allows us to work with object typed ref only,\n // avoiding typeof ref === 'function' statements\n React.useImperativeHandle(ref, () => {\n if (!videoRef?.current) {\n return undefined;\n }\n\n return videoRef.current;\n }, [videoRef]);\n\n React.useEffect(() => {\n const videoElement = videoRef.current;\n if (!videoElement || !onVideoEnd) {\n return undefined;\n }\n\n const handleVideoEnd = () => {\n onVideoEnd?.();\n };\n\n videoElement.addEventListener('ended', handleVideoEnd);\n return () => {\n videoElement.removeEventListener('ended', handleVideoEnd);\n };\n }, [videoRef, onVideoEnd]);\n\n // to guarantee setting a muted attribute in HTML. https://github.com/facebook/react/issues/10389\n React.useEffect(() => {\n const videoElement = videoRef.current;\n\n if (videoElement && initiallyMuted) {\n videoElement.defaultMuted = true;\n }\n }, [videoRef, initiallyMuted]);\n\n const onPlayToggle = React.useCallback(() => {\n setIsPaused((value) => {\n if (value) {\n videoRef?.current?.play();\n } else {\n videoRef?.current?.pause();\n }\n\n return !value;\n });\n }, [videoRef]);\n const onMuteToggle = React.useCallback(() => {\n setIsMuted((value) => !value);\n }, []);\n\n const onClick = React.useCallback(() => {\n if (customControlsType === CustomControlsType.WithPlayPauseButton) {\n onPlayToggle();\n }\n }, [onPlayToggle, customControlsType]);\n\n return (\n <React.Fragment>\n <video\n disablePictureInPicture\n playsInline\n // @ts-ignore\n // eslint-disable-next-line react/no-unknown-property\n pip=\"false\"\n className={b()}\n ref={videoRef}\n preload=\"metadata\"\n muted={isMuted}\n aria-label={video.ariaLabel}\n onClick={onClick}\n >\n {getVideoTypesWithPriority(video.src).map(({src, type}, index) => (\n <source key={index} src={src} type={type} data-qa={qa} />\n ))}\n <track default kind=\"captions\" />\n </video>\n\n {controls === MediaVideoControlsType.Custom && (\n <CustomBarControls\n className={customBarControlsClassName}\n type={customControlsType}\n isPaused={isPaused}\n onPlayClick={onPlayToggle}\n muteButtonShown={muteButtonShown}\n shown\n positioning={positioning}\n mute={{\n isMuted: Boolean(isMuted),\n changeMute: onMuteToggle,\n }}\n />\n )}\n </React.Fragment>\n );\n },\n);\n\nDefaultVideo.displayName = 'DefaultVideo';\n"]}
|
|
@@ -208,8 +208,7 @@ export interface MediaBaseBlockProps extends Animatable, MediaContentProps {
|
|
|
208
208
|
mediaOnly?: boolean;
|
|
209
209
|
mediaOnlyColSizes?: GridColumnSizesType;
|
|
210
210
|
}
|
|
211
|
-
export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | '
|
|
212
|
-
title: string;
|
|
211
|
+
export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered'> {
|
|
213
212
|
description?: string;
|
|
214
213
|
/** @deprecated Use array of buttons from ContentBlockProps instead**/
|
|
215
214
|
button?: ButtonProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/blocks.ts"],"names":[],"mappings":"AA4CA,MAAM,CAAN,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACjB,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,kBAAkB;IAClB,gDAAmC,CAAA;IACnC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,uCAA0B,CAAA;IAC1B,qCAAwB,CAAA;IACxB,sDAAyC,CAAA;IACzC,yCAA4B,CAAA;IAC5B,uCAA0B,CAAA;IAC1B,kDAAqC,CAAA;IACrC,wDAA2C,CAAA;IAC3C,uCAA0B,CAAA;IAC1B,mCAAsB,CAAA;IACtB,yCAA4B,CAAA;IAC5B,qCAAwB,CAAA;AAC5B,CAAC,EAvBW,SAAS,KAAT,SAAS,QAuBpB;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAgCrF,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC7B,kCAAS,CAAA;IACT,kCAAS,CAAA;IACT,kCAAS,CAAA;IACT,kCAAS,CAAA;AACb,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC;AAED,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,sCAAwB,CAAA;IACxB,wCAA0B,CAAA;IAC1B,gDAAkC,CAAA;AACtC,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AA2UD,MAAM,CAAN,IAAY,oBAMX;AAND,WAAY,oBAAoB;IAC5B,iCAAS,CAAA;IACT,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,6CAAqB,CAAA;IACrB,6CAAqB,CAAA;AACzB,CAAC,EANW,oBAAoB,KAApB,oBAAoB,QAM/B;AAOD,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;AACvB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC1B,kDAA4B,CAAA;IAC5B,kDAA4B,CAAA;IAC5B,uCAAiB,CAAA;AACrB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B","sourcesContent":["import * as React from 'react';\n\nimport {ButtonSize} from '@gravity-ui/uikit';\n\nimport {GridColumnSize, GridColumnSizesType, IndentValue} from '../../grid/types';\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {\n AnchorProps,\n Animatable,\n BackgroundImageProps,\n ButtonProps,\n CardBorder,\n ContentSize,\n ContentTextSize,\n ContentTheme,\n FileLinkProps,\n GravityIconProps,\n HeaderBreadCrumbsProps,\n HeaderImageSize,\n HeaderOffset,\n HeaderWidth,\n ImageDeviceProps,\n ImageProps,\n Justify,\n LegendTableMarkerType,\n LinkProps,\n MapProps,\n MediaDirection,\n MediaProps,\n MediaView,\n TextSize,\n TextTheme,\n ThemedImage,\n ThemedMediaProps,\n ThemedMediaVideoProps,\n TitleItemBaseProps,\n TitleItemProps,\n WithBorder,\n YandexFormProps,\n} from './common';\nimport {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub-blocks';\n\nexport enum BlockType {\n PromoFeaturesBlock = 'promo-features-block',\n ExtendedFeaturesBlock = 'extended-features-block',\n /** @deprecated */\n SliderOldBlock = 'slider-old-block',\n SliderBlock = 'slider-block',\n QuestionsBlock = 'questions-block',\n FoldableListBlock = 'foldable-list-block',\n BannerBlock = 'banner-block',\n CompaniesBlock = 'companies-block',\n MediaBlock = 'media-block',\n InfoBlock = 'info-block',\n TableBlock = 'table-block',\n TabsBlock = 'tabs-block',\n HeaderSliderBlock = 'header-slider-block',\n HeaderBlock = 'header-block',\n IconsBlock = 'icons-block',\n CardLayoutBlock = 'card-layout-block',\n ContentLayoutBlock = 'content-layout-block',\n ShareBlock = 'share-block',\n MapBlock = 'map-block',\n FilterBlock = 'filter-block',\n FormBlock = 'form-block',\n}\n\nexport const BlockTypes = Object.values(BlockType);\nexport const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];\n\nexport interface Childable {\n children?: SubBlock[];\n}\n\n//block props\nexport interface BlockBaseProps {\n anchor?: AnchorProps;\n visible?: GridColumnSize;\n /** @deprecated */\n resetPaddings?: boolean;\n indent?: {\n top?: IndentValue;\n bottom?: IndentValue;\n };\n qa?: string;\n}\n\nexport interface LoadableProps {\n source: string;\n /**\n * @deprecated Will be moved to params\n */\n serviceId?: number;\n params?: Record<string, string | number | boolean | object>;\n}\n\nexport interface LoadableChildren {\n loadable?: LoadableProps;\n}\n\nexport enum SliderBreakpointNames {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n Xl = 'xl',\n}\n\nexport enum SliderType {\n MediaCard = 'media-card',\n HeaderCard = 'header-card',\n FullscreenCard = 'fullscreen-card',\n}\n\nexport type SliderBreakpointParams = Record<SliderBreakpointNames, number>;\nexport type SlidesToShow = Partial<SliderBreakpointParams> | number;\n\nexport interface SliderOldProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface SliderProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface HeaderSliderBlockProps extends Omit<SliderOldProps, 'title' | 'description'> {\n items: HeaderBlockProps[];\n}\n\ninterface HeaderBackgroundProps {\n /** @deprecated replaced by Media Props image */\n url?: string;\n /** @deprecated replaced by Media Props image */\n disableCompress?: boolean;\n}\n\nexport interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {\n fullWidth?: boolean;\n fullWidthMedia?: boolean;\n}\n\nexport type ThemedHeaderBlockBackground = ThemeSupporting<HeaderBlockBackground>;\n\nexport interface HeaderBlockVideoIframe {\n src: string;\n autoplay?: boolean;\n previewImg?: string;\n height?: number;\n}\n\nexport interface HeaderBlockProps {\n title: string;\n overtitle?: string | JSX.Element;\n description?: string;\n additionalInfo?: string;\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];\n width?: HeaderWidth;\n /** @deprecated imageSize now depends on width */\n imageSize?: HeaderImageSize;\n /**\n * @deprecated used only on the main page\n * TODO: delete after the possibility to remove padding-bottom in the block\n */\n offset?: HeaderOffset;\n image?: ThemedImage;\n video?: ThemedMediaVideoProps;\n videoIframe?: HeaderBlockVideoIframe;\n mediaView?: MediaView;\n centered?: boolean;\n background?: ThemedHeaderBlockBackground;\n theme?: 'light' | 'dark';\n verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl';\n breadcrumbs?: HeaderBreadCrumbsProps;\n status?: JSX.Element;\n renderTitle?: (title: string) => React.ReactNode;\n}\n\nexport interface ExtendedFeaturesItem\n extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {\n title: string;\n label?: string;\n icon?: ThemedImage;\n /** @deprecated **/\n link?: LinkProps;\n}\n\nexport interface ExtendedFeaturesProps extends Animatable {\n items: ExtendedFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n colSizes?: GridColumnSizesType;\n}\n\nexport interface PromoFeaturesItem {\n title: string;\n text: string;\n theme?: 'accent' | 'accent-light' | 'primary';\n media?: ThemeSupporting<MediaProps>;\n}\n\nexport interface PromoFeaturesProps extends Animatable {\n items: PromoFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n theme?: 'grey' | 'default';\n}\n\nexport interface QuestionItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface QuestionsProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: QuestionItem[];\n}\n\nexport interface QuestionBlockItemProps extends QuestionItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface FoldableListItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface FoldableListProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: FoldableListItem[];\n}\n\nexport interface FoldableListBlockItemProps extends FoldableListItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface BannerBlockProps extends BannerCardProps, Animatable {}\n\nexport interface CompaniesBlockProps extends Animatable {\n title: string;\n description?: string;\n images: ThemeSupporting<ImageDeviceProps>;\n}\n\nexport interface MediaBaseBlockProps extends Animatable, MediaContentProps {\n direction?: MediaDirection;\n mobileDirection?: MediaDirection;\n largeMedia?: boolean;\n mediaOnly?: boolean;\n mediaOnlyColSizes?: GridColumnSizesType;\n}\n\nexport interface MediaContentProps\n extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'title' | 'theme' | 'centered'> {\n title: string;\n description?: string;\n /** @deprecated Use array of buttons from ContentBlockProps instead**/\n button?: ButtonProps;\n}\n\nexport interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {\n media: ThemeSupporting<MediaProps>;\n}\n\nexport interface MapBlockProps extends MediaBaseBlockProps, WithBorder {\n map: MapProps;\n}\n\nexport interface InfoBlockProps {\n theme?: TextTheme;\n backgroundColor?: ThemeSupporting<string>;\n /** @deprecated **/\n title?: string;\n /** @deprecated **/\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme'>[];\n /** @deprecated **/\n sectionsTitle?: string;\n /** @deprecated **/\n links?: Pick<LinkProps, 'text' | 'url'>[];\n leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n}\n\nexport interface TableProps {\n content: string[][];\n legend?: string[];\n hideLegend?: boolean;\n justify?: Justify[];\n marker?: LegendTableMarkerType;\n /**\n * Only as accessible name, not displayed explicitly\n */\n caption?: string;\n}\n\nexport interface TableBlockProps {\n title: string;\n table: TableProps;\n}\n\nexport interface TabsBlockItem\n extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'>,\n WithBorder {\n tabName: string;\n /**\n * @deprecated Use array links from ContentBlockProps instead\n */\n link?: LinkProps;\n image?: ThemedImage;\n caption?: string;\n media?: ThemedMediaProps;\n}\n\nexport interface TabsBlockProps extends Animatable {\n title?: TitleItemProps | string;\n description?: string;\n tabsColSizes?: GridColumnSizesType;\n centered?: boolean;\n direction?: MediaDirection;\n items: TabsBlockItem[];\n contentSize?: ContentSize;\n}\n\nexport interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n titleClassName?: string;\n description?: string;\n colSizes?: GridColumnSizesType;\n background?: ThemeSupporting<\n BackgroundImageProps & {\n border?: CardBorder;\n }\n >;\n}\n\nexport type FilterTag = {\n id: string;\n label: string;\n};\n\nexport type FilterItem = {\n tags: string[];\n card: SubBlockModels;\n};\n\nexport interface FilterBlockProps extends Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n description?: string;\n tags: FilterTag[];\n items: FilterItem[];\n tagButtonSize?: ButtonSize;\n allTag?: boolean | string;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n}\n\nexport interface IconsBlockItemProps extends AnalyticsEventsBase {\n url: string;\n text: string;\n src: ThemeSupporting<string>;\n}\n\nexport interface IconsBlockProps {\n title?: string;\n description?: string;\n size?: 's' | 'm' | 'l';\n items: IconsBlockItemProps[];\n colSizes?: GridColumnSizesType;\n}\n\ninterface ContentLayoutBlockParams {\n size?: ContentSize;\n background?: ThemeSupporting<BackgroundImageProps>;\n centered?: boolean;\n theme?: ContentTheme;\n textWidth?: ContentTextSize;\n}\n\nexport interface ContentLayoutBlockProps extends ContentLayoutBlockParams {\n textContent: ContentBlockProps;\n fileContent?: FileLinkProps[];\n}\n\nexport type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;\n\nexport interface ContentItemProps {\n title?: string;\n text?: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentListProps {\n list: ContentItemProps[];\n size: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentBlockProps {\n title?: TitleItemBaseProps | string;\n titleId?: string;\n text?: string;\n textId?: string;\n additionalInfo?: string;\n links?: LinkProps[];\n buttons?: ButtonProps[];\n size?: ContentSize;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n theme?: ContentTheme;\n list?: ContentItemProps[];\n controlPosition?: 'default' | 'bottom';\n}\n\nexport enum PCShareSocialNetwork {\n Vk = 'vk',\n Telegram = 'telegram',\n Twitter = 'twitter',\n Facebook = 'facebook',\n LinkedIn = 'linkedin',\n}\n\nexport interface ShareBlockProps {\n items: PCShareSocialNetwork[];\n title?: string;\n}\n\nexport enum FormBlockDataTypes {\n YANDEX = 'yandex',\n HUBSPOT = 'hubspot',\n}\n\nexport enum FormBlockDirection {\n FormContent = 'form-content',\n ContentForm = 'content-form',\n Center = 'center',\n}\n\nexport interface FormBlockYandexData {\n yandex: ThemeSupporting<YandexFormProps>;\n}\n\nexport interface FormBlockHubspotData {\n hubspot: ThemeSupporting<HubspotFormProps>;\n}\n\nexport type FormBlockData = FormBlockYandexData | FormBlockHubspotData;\n\nexport interface FormBlockProps {\n formData: FormBlockData;\n title?: string;\n textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;\n direction?: FormBlockDirection;\n background?: ThemeSupporting<BackgroundImageProps>;\n}\n\n//block models\nexport type HeaderBlockModel = {\n type: BlockType.HeaderBlock;\n} & HeaderBlockProps;\n\nexport type SliderOldBlockModel = {\n type: BlockType.SliderOldBlock;\n} & SliderOldProps;\n\nexport type ExtendedFeaturesBlockModel = {\n type: BlockType.ExtendedFeaturesBlock;\n} & ExtendedFeaturesProps;\n\nexport type PromoFeaturesBlockModel = {\n type: BlockType.PromoFeaturesBlock;\n} & PromoFeaturesProps;\n\nexport type QuestionsBlockModel = {\n type: BlockType.QuestionsBlock;\n} & QuestionsProps;\n\nexport type FoldableListBlockModel = {\n type: BlockType.FoldableListBlock;\n} & FoldableListProps;\n\nexport type BannerBlockModel = {\n type: BlockType.BannerBlock;\n} & BannerBlockProps;\n\nexport type CompaniesBlockModel = {\n type: BlockType.CompaniesBlock;\n} & CompaniesBlockProps;\n\nexport type MediaBlockModel = {\n type: BlockType.MediaBlock;\n} & MediaBlockProps;\n\nexport type MapBlockModel = {\n type: BlockType.MapBlock;\n} & MapBlockProps;\n\nexport type InfoBlockModel = {\n type: BlockType.InfoBlock;\n} & InfoBlockProps;\n\nexport type TableBlockModel = {\n type: BlockType.TableBlock;\n} & TableBlockProps;\n\nexport type TabsBlockModel = {\n type: BlockType.TabsBlock;\n} & TabsBlockProps;\n\nexport type CardLayoutBlockModel = {\n type: BlockType.CardLayoutBlock;\n} & CardLayoutBlockProps;\n\nexport type FilterBlockModel = {\n type: BlockType.FilterBlock;\n} & FilterBlockProps;\n\nexport type IconsBlockModel = {\n type: BlockType.IconsBlock;\n} & IconsBlockProps;\n\nexport type HeaderSliderBlockModel = {\n type: BlockType.HeaderSliderBlock;\n} & HeaderSliderBlockProps;\n\nexport type ContentLayoutBlockModel = {\n type: BlockType.ContentLayoutBlock;\n} & ContentLayoutBlockProps;\n\nexport type ShareBLockModel = {\n type: BlockType.ShareBlock;\n} & ShareBlockProps;\n\nexport type FormBlockModel = {\n type: BlockType.FormBlock;\n} & FormBlockProps;\n\nexport type SliderBlockModel = {\n type: BlockType.SliderBlock;\n} & SliderProps;\n\ntype BlockModels =\n | SliderOldBlockModel\n | SliderBlockModel\n | ExtendedFeaturesBlockModel\n | PromoFeaturesBlockModel\n | QuestionsBlockModel\n | FoldableListBlockModel\n | BannerBlockModel\n | CompaniesBlockModel\n | MediaBlockModel\n | MapBlockModel\n | InfoBlockModel\n | TableBlockModel\n | TabsBlockModel\n | HeaderBlockModel\n | IconsBlockModel\n | HeaderSliderBlockModel\n | CardLayoutBlockModel\n | ContentLayoutBlockModel\n | ShareBLockModel\n | FilterBlockModel\n | FormBlockModel;\n\nexport type Block = BlockModels & BlockBaseProps;\n"]}
|
|
1
|
+
{"version":3,"file":"blocks.js","sourceRoot":"../../../../src","sources":["models/constructor-items/blocks.ts"],"names":[],"mappings":"AA4CA,MAAM,CAAN,IAAY,SAuBX;AAvBD,WAAY,SAAS;IACjB,wDAA2C,CAAA;IAC3C,8DAAiD,CAAA;IACjD,kBAAkB;IAClB,gDAAmC,CAAA;IACnC,yCAA4B,CAAA;IAC5B,+CAAkC,CAAA;IAClC,sDAAyC,CAAA;IACzC,yCAA4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D,WAAY,kBAAkB;IAC1B,kDAA4B,CAAA;IAC5B,kDAA4B,CAAA;IAC5B,uCAAiB,CAAA;AACrB,CAAC,EAJW,kBAAkB,KAAlB,kBAAkB,QAI7B","sourcesContent":["import * as React from 'react';\n\nimport {ButtonSize} from '@gravity-ui/uikit';\n\nimport {GridColumnSize, GridColumnSizesType, IndentValue} from '../../grid/types';\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase} from '../common';\n\nimport {\n AnchorProps,\n Animatable,\n BackgroundImageProps,\n ButtonProps,\n CardBorder,\n ContentSize,\n ContentTextSize,\n ContentTheme,\n FileLinkProps,\n GravityIconProps,\n HeaderBreadCrumbsProps,\n HeaderImageSize,\n HeaderOffset,\n HeaderWidth,\n ImageDeviceProps,\n ImageProps,\n Justify,\n LegendTableMarkerType,\n LinkProps,\n MapProps,\n MediaDirection,\n MediaProps,\n MediaView,\n TextSize,\n TextTheme,\n ThemedImage,\n ThemedMediaProps,\n ThemedMediaVideoProps,\n TitleItemBaseProps,\n TitleItemProps,\n WithBorder,\n YandexFormProps,\n} from './common';\nimport {BannerCardProps, HubspotFormProps, SubBlock, SubBlockModels} from './sub-blocks';\n\nexport enum BlockType {\n PromoFeaturesBlock = 'promo-features-block',\n ExtendedFeaturesBlock = 'extended-features-block',\n /** @deprecated */\n SliderOldBlock = 'slider-old-block',\n SliderBlock = 'slider-block',\n QuestionsBlock = 'questions-block',\n FoldableListBlock = 'foldable-list-block',\n BannerBlock = 'banner-block',\n CompaniesBlock = 'companies-block',\n MediaBlock = 'media-block',\n InfoBlock = 'info-block',\n TableBlock = 'table-block',\n TabsBlock = 'tabs-block',\n HeaderSliderBlock = 'header-slider-block',\n HeaderBlock = 'header-block',\n IconsBlock = 'icons-block',\n CardLayoutBlock = 'card-layout-block',\n ContentLayoutBlock = 'content-layout-block',\n ShareBlock = 'share-block',\n MapBlock = 'map-block',\n FilterBlock = 'filter-block',\n FormBlock = 'form-block',\n}\n\nexport const BlockTypes = Object.values(BlockType);\nexport const HeaderBlockTypes = [BlockType.HeaderBlock, BlockType.HeaderSliderBlock];\n\nexport interface Childable {\n children?: SubBlock[];\n}\n\n//block props\nexport interface BlockBaseProps {\n anchor?: AnchorProps;\n visible?: GridColumnSize;\n /** @deprecated */\n resetPaddings?: boolean;\n indent?: {\n top?: IndentValue;\n bottom?: IndentValue;\n };\n qa?: string;\n}\n\nexport interface LoadableProps {\n source: string;\n /**\n * @deprecated Will be moved to params\n */\n serviceId?: number;\n params?: Record<string, string | number | boolean | object>;\n}\n\nexport interface LoadableChildren {\n loadable?: LoadableProps;\n}\n\nexport enum SliderBreakpointNames {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n Xl = 'xl',\n}\n\nexport enum SliderType {\n MediaCard = 'media-card',\n HeaderCard = 'header-card',\n FullscreenCard = 'fullscreen-card',\n}\n\nexport type SliderBreakpointParams = Record<SliderBreakpointNames, number>;\nexport type SlidesToShow = Partial<SliderBreakpointParams> | number;\n\nexport interface SliderOldProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface SliderProps extends Childable, Animatable, LoadableChildren {\n dots?: boolean;\n arrows?: boolean;\n slidesToShow?: SlidesToShow;\n disclaimer?: {\n text: string;\n size?: TextSize;\n };\n title?: TitleItemBaseProps | string;\n description?: string;\n autoplay?: number;\n //for server transforms\n randomOrder?: boolean;\n adaptive?: boolean;\n}\n\nexport interface HeaderSliderBlockProps extends Omit<SliderOldProps, 'title' | 'description'> {\n items: HeaderBlockProps[];\n}\n\ninterface HeaderBackgroundProps {\n /** @deprecated replaced by Media Props image */\n url?: string;\n /** @deprecated replaced by Media Props image */\n disableCompress?: boolean;\n}\n\nexport interface HeaderBlockBackground extends Partial<HeaderBackgroundProps>, Partial<MediaProps> {\n fullWidth?: boolean;\n fullWidthMedia?: boolean;\n}\n\nexport type ThemedHeaderBlockBackground = ThemeSupporting<HeaderBlockBackground>;\n\nexport interface HeaderBlockVideoIframe {\n src: string;\n autoplay?: boolean;\n previewImg?: string;\n height?: number;\n}\n\nexport interface HeaderBlockProps {\n title: string;\n overtitle?: string | JSX.Element;\n description?: string;\n additionalInfo?: string;\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme' | 'primary' | 'size' | 'extraProps'>[];\n width?: HeaderWidth;\n /** @deprecated imageSize now depends on width */\n imageSize?: HeaderImageSize;\n /**\n * @deprecated used only on the main page\n * TODO: delete after the possibility to remove padding-bottom in the block\n */\n offset?: HeaderOffset;\n image?: ThemedImage;\n video?: ThemedMediaVideoProps;\n videoIframe?: HeaderBlockVideoIframe;\n mediaView?: MediaView;\n centered?: boolean;\n background?: ThemedHeaderBlockBackground;\n theme?: 'light' | 'dark';\n verticalOffset?: '0' | 's' | 'm' | 'l' | 'xl';\n breadcrumbs?: HeaderBreadCrumbsProps;\n status?: JSX.Element;\n renderTitle?: (title: string) => React.ReactNode;\n}\n\nexport interface ExtendedFeaturesItem\n extends Omit<ContentBlockProps, 'theme' | 'centered' | 'colSizes' | 'size' | 'title'> {\n title: string;\n label?: string;\n icon?: ThemedImage;\n /** @deprecated **/\n link?: LinkProps;\n}\n\nexport interface ExtendedFeaturesProps extends Animatable {\n items: ExtendedFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n colSizes?: GridColumnSizesType;\n}\n\nexport interface PromoFeaturesItem {\n title: string;\n text: string;\n theme?: 'accent' | 'accent-light' | 'primary';\n media?: ThemeSupporting<MediaProps>;\n}\n\nexport interface PromoFeaturesProps extends Animatable {\n items: PromoFeaturesItem[];\n title?: TitleItemProps | string;\n description?: string;\n theme?: 'grey' | 'default';\n}\n\nexport interface QuestionItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface QuestionsProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: QuestionItem[];\n}\n\nexport interface QuestionBlockItemProps extends QuestionItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface FoldableListItem {\n title: string;\n text: string;\n listStyle?: 'dash' | 'disk';\n link?: LinkProps;\n}\n\nexport interface FoldableListProps\n extends Omit<ContentBlockProps, 'colSizes' | 'centered' | 'size' | 'theme'> {\n items: FoldableListItem[];\n}\n\nexport interface FoldableListBlockItemProps extends FoldableListItem {\n isOpened: boolean;\n onClick: () => void;\n}\n\nexport interface BannerBlockProps extends BannerCardProps, Animatable {}\n\nexport interface CompaniesBlockProps extends Animatable {\n title: string;\n description?: string;\n images: ThemeSupporting<ImageDeviceProps>;\n}\n\nexport interface MediaBaseBlockProps extends Animatable, MediaContentProps {\n direction?: MediaDirection;\n mobileDirection?: MediaDirection;\n largeMedia?: boolean;\n mediaOnly?: boolean;\n mediaOnlyColSizes?: GridColumnSizesType;\n}\n\nexport interface MediaContentProps\n extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered'> {\n description?: string;\n /** @deprecated Use array of buttons from ContentBlockProps instead**/\n button?: ButtonProps;\n}\n\nexport interface MediaBlockProps extends MediaBaseBlockProps, WithBorder {\n media: ThemeSupporting<MediaProps>;\n}\n\nexport interface MapBlockProps extends MediaBaseBlockProps, WithBorder {\n map: MapProps;\n}\n\nexport interface InfoBlockProps {\n theme?: TextTheme;\n backgroundColor?: ThemeSupporting<string>;\n /** @deprecated **/\n title?: string;\n /** @deprecated **/\n buttons?: Pick<ButtonProps, 'url' | 'text' | 'theme'>[];\n /** @deprecated **/\n sectionsTitle?: string;\n /** @deprecated **/\n links?: Pick<LinkProps, 'text' | 'url'>[];\n leftContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n rightContent?: Omit<ContentBlockProps, 'colSizes' | 'theme' | 'size'>;\n}\n\nexport interface TableProps {\n content: string[][];\n legend?: string[];\n hideLegend?: boolean;\n justify?: Justify[];\n marker?: LegendTableMarkerType;\n /**\n * Only as accessible name, not displayed explicitly\n */\n caption?: string;\n}\n\nexport interface TableBlockProps {\n title: string;\n table: TableProps;\n}\n\nexport interface TabsBlockItem\n extends Omit<ContentBlockProps, 'size' | 'colSizes' | 'centered' | 'theme'>,\n WithBorder {\n tabName: string;\n /**\n * @deprecated Use array links from ContentBlockProps instead\n */\n link?: LinkProps;\n image?: ThemedImage;\n caption?: string;\n media?: ThemedMediaProps;\n}\n\nexport interface TabsBlockProps extends Animatable {\n title?: TitleItemProps | string;\n description?: string;\n tabsColSizes?: GridColumnSizesType;\n centered?: boolean;\n direction?: MediaDirection;\n items: TabsBlockItem[];\n contentSize?: ContentSize;\n}\n\nexport interface CardLayoutBlockProps extends Childable, Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n titleClassName?: string;\n description?: string;\n colSizes?: GridColumnSizesType;\n background?: ThemeSupporting<\n BackgroundImageProps & {\n border?: CardBorder;\n }\n >;\n}\n\nexport type FilterTag = {\n id: string;\n label: string;\n};\n\nexport type FilterItem = {\n tags: string[];\n card: SubBlockModels;\n};\n\nexport interface FilterBlockProps extends Animatable, LoadableChildren {\n title?: TitleItemProps | string;\n description?: string;\n tags: FilterTag[];\n items: FilterItem[];\n tagButtonSize?: ButtonSize;\n allTag?: boolean | string;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n}\n\nexport interface IconsBlockItemProps extends AnalyticsEventsBase {\n url: string;\n text: string;\n src: ThemeSupporting<string>;\n}\n\nexport interface IconsBlockProps {\n title?: string;\n description?: string;\n size?: 's' | 'm' | 'l';\n items: IconsBlockItemProps[];\n colSizes?: GridColumnSizesType;\n}\n\ninterface ContentLayoutBlockParams {\n size?: ContentSize;\n background?: ThemeSupporting<BackgroundImageProps>;\n centered?: boolean;\n theme?: ContentTheme;\n textWidth?: ContentTextSize;\n}\n\nexport interface ContentLayoutBlockProps extends ContentLayoutBlockParams {\n textContent: ContentBlockProps;\n fileContent?: FileLinkProps[];\n}\n\nexport type SVGIcon = (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;\n\nexport interface ContentItemProps {\n title?: string;\n text?: string;\n icon?: ThemeSupporting<ImageProps | SVGIcon>;\n gravityIcon?: ThemeSupporting<GravityIconProps>;\n}\n\nexport interface ContentListProps {\n list: ContentItemProps[];\n size: ContentSize;\n theme?: ContentTheme;\n}\n\nexport interface ContentBlockProps {\n title?: TitleItemBaseProps | string;\n titleId?: string;\n text?: string;\n textId?: string;\n additionalInfo?: string;\n links?: LinkProps[];\n buttons?: ButtonProps[];\n size?: ContentSize;\n colSizes?: GridColumnSizesType;\n centered?: boolean;\n theme?: ContentTheme;\n list?: ContentItemProps[];\n controlPosition?: 'default' | 'bottom';\n}\n\nexport enum PCShareSocialNetwork {\n Vk = 'vk',\n Telegram = 'telegram',\n Twitter = 'twitter',\n Facebook = 'facebook',\n LinkedIn = 'linkedin',\n}\n\nexport interface ShareBlockProps {\n items: PCShareSocialNetwork[];\n title?: string;\n}\n\nexport enum FormBlockDataTypes {\n YANDEX = 'yandex',\n HUBSPOT = 'hubspot',\n}\n\nexport enum FormBlockDirection {\n FormContent = 'form-content',\n ContentForm = 'content-form',\n Center = 'center',\n}\n\nexport interface FormBlockYandexData {\n yandex: ThemeSupporting<YandexFormProps>;\n}\n\nexport interface FormBlockHubspotData {\n hubspot: ThemeSupporting<HubspotFormProps>;\n}\n\nexport type FormBlockData = FormBlockYandexData | FormBlockHubspotData;\n\nexport interface FormBlockProps {\n formData: FormBlockData;\n title?: string;\n textContent?: Omit<ContentBlockProps, 'centered' | 'colSizes' | 'size'>;\n direction?: FormBlockDirection;\n background?: ThemeSupporting<BackgroundImageProps>;\n}\n\n//block models\nexport type HeaderBlockModel = {\n type: BlockType.HeaderBlock;\n} & HeaderBlockProps;\n\nexport type SliderOldBlockModel = {\n type: BlockType.SliderOldBlock;\n} & SliderOldProps;\n\nexport type ExtendedFeaturesBlockModel = {\n type: BlockType.ExtendedFeaturesBlock;\n} & ExtendedFeaturesProps;\n\nexport type PromoFeaturesBlockModel = {\n type: BlockType.PromoFeaturesBlock;\n} & PromoFeaturesProps;\n\nexport type QuestionsBlockModel = {\n type: BlockType.QuestionsBlock;\n} & QuestionsProps;\n\nexport type FoldableListBlockModel = {\n type: BlockType.FoldableListBlock;\n} & FoldableListProps;\n\nexport type BannerBlockModel = {\n type: BlockType.BannerBlock;\n} & BannerBlockProps;\n\nexport type CompaniesBlockModel = {\n type: BlockType.CompaniesBlock;\n} & CompaniesBlockProps;\n\nexport type MediaBlockModel = {\n type: BlockType.MediaBlock;\n} & MediaBlockProps;\n\nexport type MapBlockModel = {\n type: BlockType.MapBlock;\n} & MapBlockProps;\n\nexport type InfoBlockModel = {\n type: BlockType.InfoBlock;\n} & InfoBlockProps;\n\nexport type TableBlockModel = {\n type: BlockType.TableBlock;\n} & TableBlockProps;\n\nexport type TabsBlockModel = {\n type: BlockType.TabsBlock;\n} & TabsBlockProps;\n\nexport type CardLayoutBlockModel = {\n type: BlockType.CardLayoutBlock;\n} & CardLayoutBlockProps;\n\nexport type FilterBlockModel = {\n type: BlockType.FilterBlock;\n} & FilterBlockProps;\n\nexport type IconsBlockModel = {\n type: BlockType.IconsBlock;\n} & IconsBlockProps;\n\nexport type HeaderSliderBlockModel = {\n type: BlockType.HeaderSliderBlock;\n} & HeaderSliderBlockProps;\n\nexport type ContentLayoutBlockModel = {\n type: BlockType.ContentLayoutBlock;\n} & ContentLayoutBlockProps;\n\nexport type ShareBLockModel = {\n type: BlockType.ShareBlock;\n} & ShareBlockProps;\n\nexport type FormBlockModel = {\n type: BlockType.FormBlock;\n} & FormBlockProps;\n\nexport type SliderBlockModel = {\n type: BlockType.SliderBlock;\n} & SliderProps;\n\ntype BlockModels =\n | SliderOldBlockModel\n | SliderBlockModel\n | ExtendedFeaturesBlockModel\n | PromoFeaturesBlockModel\n | QuestionsBlockModel\n | FoldableListBlockModel\n | BannerBlockModel\n | CompaniesBlockModel\n | MediaBlockModel\n | MapBlockModel\n | InfoBlockModel\n | TableBlockModel\n | TabsBlockModel\n | HeaderBlockModel\n | IconsBlockModel\n | HeaderSliderBlockModel\n | CardLayoutBlockModel\n | ContentLayoutBlockModel\n | ShareBLockModel\n | FilterBlockModel\n | FormBlockModel;\n\nexport type Block = BlockModels & BlockBaseProps;\n"]}
|
package/build/esm/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.js
CHANGED
|
@@ -12,12 +12,15 @@ import './NavigationLink.css';
|
|
|
12
12
|
const b = block('navigation-link');
|
|
13
13
|
export const NavigationLink = (props) => {
|
|
14
14
|
const { hostname, Link } = React.useContext(LocationContext);
|
|
15
|
-
const { url, text, icon, arrow, target, className, iconSize, urlTitle, analyticsEvents, ...rest } = props;
|
|
15
|
+
const { url, text, icon, arrow, target, className, iconSize, urlTitle, analyticsEvents, onClick: onClickOrigin, ...rest } = props;
|
|
16
16
|
const linkExtraProps = getLinkProps(url, hostname, target);
|
|
17
17
|
const iconData = icon && getMediaImage(icon);
|
|
18
18
|
const handleAnalytics = useAnalytics(DefaultEventNames.Link, url);
|
|
19
|
-
const onClick = () => {
|
|
19
|
+
const onClick = (e) => {
|
|
20
20
|
handleAnalytics(analyticsEvents);
|
|
21
|
+
if (onClickOrigin && e) {
|
|
22
|
+
onClickOrigin?.(e);
|
|
23
|
+
}
|
|
21
24
|
};
|
|
22
25
|
const classes = b(null, className);
|
|
23
26
|
const content = (_jsxs(React.Fragment, { children: [_jsx(ContentWrapper, { text: text, icon: iconData, iconSize: iconSize }), arrow && _jsx(NavigationArrow, { className: b('arrow') })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationLink.js","sourceRoot":"../../../../../../../src","sources":["navigation/components/NavigationItem/components/NavigationLink/NavigationLink.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,UAAU,EAAC,2CAAkC;AACrD,OAAO,EAAC,aAAa,EAAC,uDAAoD;AAC1E,OAAO,EAAC,eAAe,EAAC,wDAA+C;AACvE,OAAO,EAAC,YAAY,EAAC,sCAA6B;AAClD,OAAO,EAAC,eAAe,EAAC,sCAA6B;AACrD,OAAO,EAAC,iBAAiB,EAAqB,uCAA8B;AAC5E,OAAO,EAAC,KAAK,EAAE,YAAY,EAAC,sCAA6B;AAEzD,OAAO,EAAC,cAAc,EAAC,4CAAyC;AAEhE,OAAO,sBAAsB,CAAC;AAE9B,MAAM,CAAC,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAInC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAA0B,EAAE,EAAE;IACzD,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,KAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;IAC3D,MAAM,EACF,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,GAAG,IAAI,EACV,GAAG,KAAK,CAAC;IAEV,MAAM,cAAc,GAAG,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,eAAe,GAAG,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAElE,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"NavigationLink.js","sourceRoot":"../../../../../../../src","sources":["navigation/components/NavigationItem/components/NavigationLink/NavigationLink.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,UAAU,EAAC,2CAAkC;AACrD,OAAO,EAAC,aAAa,EAAC,uDAAoD;AAC1E,OAAO,EAAC,eAAe,EAAC,wDAA+C;AACvE,OAAO,EAAC,YAAY,EAAC,sCAA6B;AAClD,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EACjE,KAAK,IAAI,KAAC,eAAe,IAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,GAAI,IACvC,CACpB,CAAC;IAEF,IAAI,cAAc,EAAE,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAClC,OAAO,CACH,YACI,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,QAAQ,IAAI,IAAI,EACvB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,OAAO,KACZ,IAAI,KACJ,cAAc,YAEjB,OAAO,GACR,CACP,CAAC;IACN,CAAC;SAAM,CAAC;QACJ,OAAO,CACH,KAAC,UAAU,IAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,kBAC3B,YACI,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,QAAQ,IAAI,IAAI,KACnB,IAAI,EACR,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,OAAO,EAAE,YAE/C,OAAO,GACR,GACK,CAChB,CAAC;IACN,CAAC;AACL,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {RouterLink} from '../../../../../components';\nimport {getMediaImage} from '../../../../../components/Media/Image/utils';\nimport {LocationContext} from '../../../../../context/locationContext';\nimport {useAnalytics} from '../../../../../hooks';\nimport {NavigationArrow} from '../../../../../icons';\nimport {DefaultEventNames, NavigationLinkItem} from '../../../../../models';\nimport {block, getLinkProps} from '../../../../../utils';\nimport {NavigationItemProps} from '../../../../models';\nimport {ContentWrapper} from '../ContentWrapper/ContentWrapper';\n\nimport './NavigationLink.scss';\n\nconst b = block('navigation-link');\n\ntype NavigationLinkProps = NavigationItemProps & NavigationLinkItem;\n\nexport const NavigationLink = (props: NavigationLinkProps) => {\n const {hostname, Link} = React.useContext(LocationContext);\n const {\n url,\n text,\n icon,\n arrow,\n target,\n className,\n iconSize,\n urlTitle,\n analyticsEvents,\n onClick: onClickOrigin,\n ...rest\n } = props;\n\n const linkExtraProps = getLinkProps(url, hostname, target);\n const iconData = icon && getMediaImage(icon);\n const handleAnalytics = useAnalytics(DefaultEventNames.Link, url);\n\n const onClick = (e?: React.MouseEvent) => {\n handleAnalytics(analyticsEvents);\n if (onClickOrigin && e) {\n onClickOrigin?.(e);\n }\n };\n\n const classes = b(null, className);\n const content = (\n <React.Fragment>\n <ContentWrapper text={text} icon={iconData} iconSize={iconSize} />\n {arrow && <NavigationArrow className={b('arrow')} />}\n </React.Fragment>\n );\n\n if (linkExtraProps?.target || !Link) {\n return (\n <a\n href={url}\n title={urlTitle || text}\n className={classes}\n onClick={onClick}\n {...rest}\n {...linkExtraProps}\n >\n {content}\n </a>\n );\n } else {\n return (\n <RouterLink href={url} passHref>\n <a\n role=\"link\"\n title={urlTitle || text}\n {...rest}\n className={classes}\n tabIndex={0}\n onClick={onClick}\n onKeyDown={(e) => e.key === 'Enter' && onClick()}\n >\n {content}\n </a>\n </RouterLink>\n );\n }\n};\n"]}
|
package/package.json
CHANGED
|
@@ -208,8 +208,7 @@ export interface MediaBaseBlockProps extends Animatable, MediaContentProps {
|
|
|
208
208
|
mediaOnly?: boolean;
|
|
209
209
|
mediaOnlyColSizes?: GridColumnSizesType;
|
|
210
210
|
}
|
|
211
|
-
export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | '
|
|
212
|
-
title: string;
|
|
211
|
+
export interface MediaContentProps extends Omit<ContentBlockProps, 'colSizes' | 'text' | 'theme' | 'centered'> {
|
|
213
212
|
description?: string;
|
|
214
213
|
/** @deprecated Use array of buttons from ContentBlockProps instead**/
|
|
215
214
|
button?: ButtonProps;
|