@gravity-ui/page-constructor 7.6.2 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/build/cjs/blocks/CardLayout/CardLayout.js.map +1 -1
- package/build/cjs/blocks/Companies/schema.d.ts +1 -0
- package/build/cjs/blocks/Companies/schema.js +2 -1
- package/build/cjs/blocks/Companies/schema.js.map +1 -1
- package/build/cjs/blocks/ContentLayout/ContentLayout.js +2 -2
- package/build/cjs/blocks/ContentLayout/ContentLayout.js.map +1 -1
- package/build/cjs/blocks/FilterBlock/FilterBlock.js.map +1 -1
- package/build/cjs/blocks/Header/Header.d.ts +7 -1
- package/build/cjs/blocks/Header/Header.js +6 -7
- package/build/cjs/blocks/Header/Header.js.map +1 -1
- package/build/cjs/blocks/Tabs/TabContent/TabContent.js +12 -12
- package/build/cjs/blocks/Tabs/TabContent/TabContent.js.map +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js +1 -1
- package/build/cjs/blocks/Tabs/Tabs.js.map +1 -1
- package/build/cjs/components/UnpublishedLabel/UnpublishedLabel.js.map +1 -1
- package/build/cjs/components/YandexForm/YandexForm.js +1 -1
- package/build/cjs/components/YandexForm/YandexForm.js.map +1 -1
- package/build/cjs/containers/PageConstructor/Provider.js.map +1 -1
- package/build/cjs/context/windowWidthContext/BreakpointContext.js +1 -1
- package/build/cjs/context/windowWidthContext/BreakpointContext.js.map +1 -1
- package/build/cjs/grid/Grid/Grid.js.map +1 -1
- package/build/cjs/grid/Row/Row.d.ts +1 -1
- package/build/cjs/grid/Row/Row.js.map +1 -1
- package/build/cjs/models/navigation.d.ts +1 -1
- package/build/cjs/models/navigation.js.map +1 -1
- package/build/esm/blocks/CardLayout/CardLayout.js.map +1 -1
- package/build/esm/blocks/Companies/schema.d.ts +1 -0
- package/build/esm/blocks/Companies/schema.js +2 -1
- package/build/esm/blocks/Companies/schema.js.map +1 -1
- package/build/esm/blocks/ContentLayout/ContentLayout.js +2 -2
- package/build/esm/blocks/ContentLayout/ContentLayout.js.map +1 -1
- package/build/esm/blocks/FilterBlock/FilterBlock.js.map +1 -1
- package/build/esm/blocks/Header/Header.d.ts +7 -1
- package/build/esm/blocks/Header/Header.js +6 -7
- package/build/esm/blocks/Header/Header.js.map +1 -1
- package/build/esm/blocks/Tabs/TabContent/TabContent.js +7 -7
- package/build/esm/blocks/Tabs/TabContent/TabContent.js.map +1 -1
- package/build/esm/blocks/Tabs/Tabs.js +2 -2
- package/build/esm/blocks/Tabs/Tabs.js.map +1 -1
- package/build/esm/components/UnpublishedLabel/UnpublishedLabel.js.map +1 -1
- package/build/esm/components/YandexForm/YandexForm.js +1 -1
- package/build/esm/components/YandexForm/YandexForm.js.map +1 -1
- package/build/esm/containers/PageConstructor/Provider.js.map +1 -1
- package/build/esm/context/windowWidthContext/BreakpointContext.js +1 -1
- package/build/esm/context/windowWidthContext/BreakpointContext.js.map +1 -1
- package/build/esm/grid/Grid/Grid.d.ts +1 -1
- package/build/esm/grid/Grid/Grid.js +1 -1
- package/build/esm/grid/Grid/Grid.js.map +1 -1
- package/build/esm/grid/Row/Row.d.ts +1 -1
- package/build/esm/grid/Row/Row.js.map +1 -1
- package/build/esm/models/navigation.d.ts +1 -1
- package/build/esm/models/navigation.js.map +1 -1
- package/package.json +1 -1
- package/schema/index.js +1 -1
- package/server/models/navigation.d.ts +1 -1
- package/widget/index.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreakpointContext.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/BreakpointContext.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;
|
|
1
|
+
{"version":3,"file":"BreakpointContext.js","sourceRoot":"../../../../src","sources":["context/windowWidthContext/BreakpointContext.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAE/B,0EAAuC;AAEvC,kDAA4C;AAC5C,uDAAyC;AAEzC,MAAM,aAAa,GAAG,uBAAW,CAAC,EA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OINTS} from '../../constants';\nimport {SSRContext} from '../ssrContext';\n\nconst DEFAULT_WIDTH = BREAKPOINTS.xl;\nconst UPDATE_FREQUENCY_MS = 100;\n\nexport const WindowWidthContext = React.createContext<number>(DEFAULT_WIDTH);\n\nexport const WindowWidthProvider = ({children}: React.PropsWithChildren) => {\n const {isServer} = React.useContext(SSRContext);\n\n const [windowWidth, setWindowWidth] = React.useState(DEFAULT_WIDTH);\n\n React.useEffect(() => {\n if (isServer) {\n return;\n }\n\n const handleResize = throttle(\n () => {\n setWindowWidth(window.innerWidth);\n },\n UPDATE_FREQUENCY_MS,\n {leading: true},\n );\n\n handleResize();\n\n window.addEventListener('resize', handleResize, {passive: true});\n\n // eslint-disable-next-line consistent-return\n return () => window.removeEventListener('resize', handleResize);\n }, [isServer]);\n\n return (\n <WindowWidthContext.Provider value={windowWidth}>{children}</WindowWidthContext.Provider>\n );\n};\n\nexport const useWindowWidth = () => React.useContext(WindowWidthContext);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.js","sourceRoot":"../../../../src","sources":["grid/Grid/Grid.tsx"],"names":[],"mappings":";;;;AAEA,gDAAkC;AAKlC,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,MAAM,CAAC,CAAC;AASjB,MAAM,IAAI,GAAG,CAAC,EACjB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,KAAK,EACL,cAAc,GAAG,EAAE,GACc,EAAE,EAAE,CAAC,CACtC,gCAAK,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,SAAS,CAAC,YAC/C,gCAAK,SAAS,EAAE,mBAAmB,cAAc,EAAE,YAAG,QAAQ,GAAO,GACnE,CACT,CAAC;AAVW,QAAA,IAAI,QAUf","sourcesContent":["import * as React from 'react';\n\nimport {block} from '../../utils';\n\nimport '
|
|
1
|
+
{"version":3,"file":"Grid.js","sourceRoot":"../../../../src","sources":["grid/Grid/Grid.tsx"],"names":[],"mappings":";;;;AAEA,gDAAkC;AAKlC,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,MAAM,CAAC,CAAC;AASjB,MAAM,IAAI,GAAG,CAAC,EACjB,KAAK,EACL,QAAQ,EACR,SAAS,EACT,KAAK,EACL,cAAc,GAAG,EAAE,GACc,EAAE,EAAE,CAAC,CACtC,gCAAK,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,SAAS,CAAC,YAC/C,gCAAK,SAAS,EAAE,mBAAmB,cAAc,EAAE,YAAG,QAAQ,GAAO,GACnE,CACT,CAAC;AAVW,QAAA,IAAI,QAUf","sourcesContent":["import * as React from 'react';\n\nimport {block} from '../../utils';\n\nimport './Grid.scss';\nimport '../styles/bootstrap.scss';\n\nconst b = block('Grid');\n\nexport interface GridProps {\n debug?: boolean;\n className?: string;\n containerClass?: string;\n style?: React.CSSProperties;\n}\n\nexport const Grid = ({\n debug,\n children,\n className,\n style,\n containerClass = '',\n}: React.PropsWithChildren<GridProps>) => (\n <div style={style} className={b({debug}, className)}>\n <div className={`container-fluid ${containerClass}`}>{children}</div>\n </div>\n);\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { AriaProps, Roleable } from "../../models/index.js";
|
|
2
3
|
import { ClassNameProps, Refable } from "../../models/common.js";
|
|
3
4
|
import { GridAlignItems, GridJustifyContent } from "../types.js";
|
|
4
|
-
import { AriaProps, Roleable } from "../../models/index.js";
|
|
5
5
|
export interface RowProps extends ClassNameProps, Refable<HTMLDivElement>, Roleable, AriaProps {
|
|
6
6
|
id?: string;
|
|
7
7
|
justifyContent?: GridJustifyContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Row.js","sourceRoot":"../../../../src","sources":["grid/Row/Row.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAelB,QAAA,GAAG,GAAG,KAAK,CAAC,UAAU,CAA2B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACzE,MAAM,EAAC,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC,GACzF,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,IAAI,WAAW,CAAC;aACzE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtD,OAAO,CACH,gCAAK,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,KAAM,SAAS,YACpF,QAAQ,GACP,CACT,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,WAAG,CAAC,WAAW,GAAG,KAAK,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"Row.js","sourceRoot":"../../../../src","sources":["grid/Row/Row.tsx"],"names":[],"mappings":";;;;;AAAA,qDAA+B;AAelB,QAAA,GAAG,GAAG,KAAK,CAAC,UAAU,CAA2B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACzE,MAAM,EAAC,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC,GACzF,KAAK,CAAC;IAEV,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACxC,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,IAAI,WAAW,CAAC;aACzE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEtD,OAAO,CACH,gCAAK,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,KAAM,SAAS,YACpF,QAAQ,GACP,CACT,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,WAAG,CAAC,WAAW,GAAG,KAAK,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {AriaProps, Roleable} from '../../models';\nimport {ClassNameProps, Refable} from '../../models/common';\nimport {GridAlignItems, GridJustifyContent} from '../types';\n\nexport interface RowProps extends ClassNameProps, Refable<HTMLDivElement>, Roleable, AriaProps {\n id?: string;\n justifyContent?: GridJustifyContent;\n alignItems?: GridAlignItems;\n noGutter?: boolean;\n style?: React.CSSProperties;\n children?: React.ReactNode;\n}\n\nexport const Row = React.forwardRef<HTMLDivElement, RowProps>((props, ref) => {\n const {id, className, justifyContent, alignItems, noGutter, style, role, ariaProps, children} =\n props;\n\n const getClassName = React.useCallback(() => {\n return ['row', className, justifyContent, alignItems, noGutter && 'no-gutter']\n .filter(Boolean)\n .join(' ');\n }, [className, justifyContent, alignItems, noGutter]);\n\n return (\n <div ref={ref} id={id} className={getClassName()} style={style} role={role} {...ariaProps}>\n {children}\n </div>\n );\n});\n\nRow.displayName = 'Row';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ThemeSupporting } from "../utils/index.js";
|
|
2
|
-
import { ButtonProps, ImageProps } from "./constructor-items/index.js";
|
|
3
2
|
import { AnalyticsEventsBase } from "./common.js";
|
|
3
|
+
import { ButtonProps, ImageProps } from "./constructor-items/index.js";
|
|
4
4
|
export declare enum NavigationItemType {
|
|
5
5
|
Link = "link",
|
|
6
6
|
Dropdown = "dropdown",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sourceRoot":"../../../src","sources":["models/navigation.ts"],"names":[],"mappings":";;;AAKA,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;IACjB,oDAA8B,CAAA;AAClC,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B;AAEY,QAAA,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AASrE,IAAY,0BAWX;AAXD,WAAY,0BAA0B;IAClC,qDAAuB,CAAA;IACvB,iDAAmB,CAAA;IACnB,mDAAqB,CAAA;IACrB,0DAA4B,CAAA;IAC5B,4DAA8B,CAAA;IAC9B,oEAAsC,CAAA;IACtC,2DAA6B,CAAA;IAC7B,yDAA2B,CAAA;IAC3B,gEAAkC,CAAA;IAClC,mDAAqB,CAAA;AACzB,CAAC,EAXW,0BAA0B,0CAA1B,0BAA0B,QAWrC","sourcesContent":["import {ThemeSupporting} from '../utils';\n\nimport {
|
|
1
|
+
{"version":3,"file":"navigation.js","sourceRoot":"../../../src","sources":["models/navigation.ts"],"names":[],"mappings":";;;AAKA,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC1B,mCAAa,CAAA;IACb,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;IACjB,uCAAiB,CAAA;IACjB,oDAA8B,CAAA;AAClC,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B;AAEY,QAAA,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AASrE,IAAY,0BAWX;AAXD,WAAY,0BAA0B;IAClC,qDAAuB,CAAA;IACvB,iDAAmB,CAAA;IACnB,mDAAqB,CAAA;IACrB,0DAA4B,CAAA;IAC5B,4DAA8B,CAAA;IAC9B,oEAAsC,CAAA;IACtC,2DAA6B,CAAA;IAC7B,yDAA2B,CAAA;IAC3B,gEAAkC,CAAA;IAClC,mDAAqB,CAAA;AACzB,CAAC,EAXW,0BAA0B,0CAA1B,0BAA0B,QAWrC","sourcesContent":["import {ThemeSupporting} from '../utils';\n\nimport {AnalyticsEventsBase} from './common';\nimport {ButtonProps, ImageProps} from './constructor-items';\n\nexport enum NavigationItemType {\n Link = 'link',\n Dropdown = 'dropdown',\n Button = 'button',\n Social = 'social',\n GithubButton = 'github-button',\n}\n\nexport const NavigationItemTypes = Object.values(NavigationItemType);\n\nexport interface NavigationItemBase {\n text: string;\n icon?: ImageProps;\n url?: string;\n iconSize?: number;\n}\n\nexport enum NavigationGithubButtonIcon {\n heart = 'octicon-heart',\n eye = 'octicon-eye',\n star = 'octicon-star',\n fork = 'octicon-repo-forked',\n issue = 'octicon-issue-opened',\n comment = 'octicon-comment-discussion',\n download = 'octicon-download',\n package = 'octicon-package',\n template = 'octicon-repo-template',\n play = 'octicon-play',\n}\n\nexport interface NavigationGithubButton extends Omit<NavigationItemBase, 'icon'> {\n type: NavigationItemType.GithubButton;\n url: string;\n urlTitle?: string;\n label?: string;\n icon?: keyof typeof NavigationGithubButtonIcon;\n size?: string;\n}\n\nexport interface NavigationLinkItem extends Omit<NavigationItemBase, 'url'>, AnalyticsEventsBase {\n type: NavigationItemType.Link;\n url: string;\n urlTitle?: string;\n arrow?: boolean;\n target?: string;\n}\n\nexport interface NavigationButtonItem extends ButtonProps {\n type: NavigationItemType.Button;\n}\n\nexport interface NavigationDropdownItem extends NavigationItemBase {\n type: NavigationItemType.Dropdown;\n items: NavigationLinkItem[];\n hidePopup: () => void;\n isActive: boolean;\n}\n\nexport interface NavigationSocialItem extends Omit<NavigationItemBase, 'text'> {\n type: NavigationItemType.Social;\n icon: ImageProps;\n url: string;\n urlTitle?: string;\n}\n\nexport type NavigationItemModel =\n | NavigationLinkItem\n | NavigationButtonItem\n | NavigationDropdownItem;\n\nexport type NavigationItemData =\n | NavigationLinkItem\n | NavigationButtonItem\n | NavigationSocialItem\n | NavigationDropdownItem;\n\nexport interface NavigationLogoData {\n icon: ImageProps;\n text?: string;\n url?: string;\n urlTitle?: string;\n alt?: string;\n}\n\nexport type ThemedNavigationLogoData = NavigationLogoData & ThemeSupporting<NavigationLogoData>;\n\nexport interface HeaderData {\n leftItems: NavigationItemModel[];\n rightItems?: NavigationItemModel[];\n\n /**\n * Items for the navigation header on mobile devices.\n * They are located to the right of the Logo and to the left of the MobileMenuButton.\n * @type {NavigationItemModel[]}\n */\n customMobileHeaderItems?: NavigationItemModel[];\n iconSize?: number;\n withBorder?: boolean;\n withBorderOnScroll?: boolean;\n}\n\nexport interface FooterColumn {\n title: string;\n links: NavigationItemModel[];\n}\n\nexport interface FooterUnderline {\n links?: NavigationItemModel[];\n copyright?: string;\n}\n\nexport interface FooterData {\n columns: FooterColumn[];\n social?: NavigationSocialItem[];\n underline?: FooterUnderline;\n}\n\nexport interface NavigationData {\n logo: ThemedNavigationLogoData;\n header: HeaderData;\n footer?: FooterData;\n renderNavigation?: () => React.ReactNode;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardLayout.js","sourceRoot":"../../../../src","sources":["blocks/CardLayout/CardLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CardLayout.js","sourceRoot":"../../../../src","sources":["blocks/CardLayout/CardLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,OAAO,0BAAuB;AAErC,OAAO,EAAC,YAAY,EAAE,eAAe,EAAE,KAAK,EAAC,kCAAyB;AACtE,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAuB,GAAG,EAAC,4BAAmB;AAEzD,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAA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B,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import * as React from 'react';\n\nimport isEmpty from 'lodash/isEmpty';\n\nimport {AnimateBlock, BackgroundImage, Title} from '../../components';\nimport {useTheme} from '../../context/theme';\nimport {Col, GridColumnSizesType, Row} from '../../grid';\nimport {CardLayoutBlockProps as CardLayoutBlockParams, ClassNameProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\n\nimport './CardLayout.scss';\n\nconst DEFAULT_SIZES: GridColumnSizesType = {\n all: 12,\n sm: 6,\n md: 4,\n};\nexport type CardLayoutBlockProps = React.PropsWithChildren<\n Omit<CardLayoutBlockParams, 'children'>\n> &\n ClassNameProps;\n\nconst b = block('card-layout-block');\n\nconst CardLayout = ({\n title,\n description,\n animated,\n colSizes = DEFAULT_SIZES,\n children,\n className,\n titleClassName,\n background,\n}: CardLayoutBlockProps) => {\n const theme = useTheme();\n const {border, ...backgroundImageProps} = getThemedValue(background || {}, theme);\n return (\n <AnimateBlock className={b(null, className)} animate={animated}>\n {(title || description) && (\n <Title title={title} subtitle={description} className={titleClassName} />\n )}\n <div\n className={b('content', {\n 'with-background': !isEmpty(background),\n })}\n >\n <BackgroundImage className={b('image', {border})} {...backgroundImageProps} />\n <Row>\n {React.Children.map(children, (child, index) => (\n <Col key={index} sizes={colSizes} className={b('item')}>\n {child}\n </Col>\n ))}\n </Row>\n </div>\n </AnimateBlock>\n );\n};\n\nexport default CardLayout;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/Companies/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,SAAS,EAAE,SAAS,EAAC,0CAAuC;AAErF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,iBAAiB,EAAE;QACf,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC7B,UAAU,EAAE;YACR,GAAG,SAAS;YACZ,GAAG,eAAe;YAClB,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,MAAM;aACtB;YACD,WAAW,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"../../../../src","sources":["blocks/Companies/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,SAAS,EAAE,SAAS,EAAC,0CAAuC;AAErF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,iBAAiB,EAAE;QACf,oBAAoB,EAAE,KAAK;QAC3B,QAAQ,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC7B,UAAU,EAAE;YACR,GAAG,SAAS;YACZ,GAAG,eAAe;YAClB,KAAK,EAAE;gBACH,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,MAAM;aACtB;YACD,WAAW,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,KAAK;gBAClB,SAAS,EAAE,UAAU;aACxB;YACD,MAAM,EAAE,SAAS,CAAC;gBACd,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC;gBACzC,UAAU,EAAE;oBACR,OAAO,EAAE;wBACL,IAAI,EAAE,QAAQ;qBACjB;oBACD,MAAM,EAAE;wBACJ,IAAI,EAAE,QAAQ;qBACjB;oBACD,MAAM,EAAE;wBACJ,IAAI,EAAE,QAAQ;qBACjB;oBACD,GAAG,EAAE;wBACD,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,MAAM;qBACtB;iBACJ;aACJ,CAAC;SACL;KACJ;CACJ,CAAC","sourcesContent":["import {AnimatableProps, BaseProps, withTheme} from '../../schema/validators/common';\n\nexport const CompaniesBlock = {\n 'companies-block': {\n additionalProperties: false,\n required: ['title', 'images'],\n properties: {\n ...BaseProps,\n ...AnimatableProps,\n title: {\n type: 'string',\n contentType: 'text',\n },\n description: {\n type: 'string',\n contentType: 'yfm',\n inputType: 'textarea',\n },\n images: withTheme({\n type: 'object',\n required: ['desktop', 'tablet', 'mobile'],\n properties: {\n desktop: {\n type: 'string',\n },\n tablet: {\n type: 'string',\n },\n mobile: {\n type: 'string',\n },\n alt: {\n type: 'string',\n contentType: 'text',\n },\n },\n }),\n },\n },\n};\n"]}
|
|
@@ -2,13 +2,13 @@ import { createElement as _createElement } from "react";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { BackgroundImage, FileLink } from "../../components/index.js";
|
|
5
|
+
import { BREAKPOINTS } from "../../constants.js";
|
|
5
6
|
import { useTheme } from "../../context/theme/index.js";
|
|
7
|
+
import { useWindowWidth } from "../../context/windowWidthContext/index.js";
|
|
6
8
|
import { Col } from "../../grid/index.js";
|
|
7
9
|
import { Content } from "../../sub-blocks/index.js";
|
|
8
10
|
import { block, getThemedValue } from "../../utils/index.js";
|
|
9
11
|
import './ContentLayout.css';
|
|
10
|
-
import { useWindowWidth } from "../../context/windowWidthContext/index.js";
|
|
11
|
-
import { BREAKPOINTS } from "../../constants.js";
|
|
12
12
|
const b = block('content-layout-block');
|
|
13
13
|
function getFileTextSize(size) {
|
|
14
14
|
switch (size) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentLayout.js","sourceRoot":"../../../../src","sources":["blocks/ContentLayout/ContentLayout.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAE,QAAQ,EAAC,kCAAyB;AAC3D,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,GAAG,EAAC,4BAAmB;AAE/B,OAAO,EAAC,OAAO,EAAC,kCAAyB;AACzC,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAElD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AAC,eAAe,IACZ,SAAS,EAAE,CAAC,CAAC,iBAAiB,CAAC,KAC3B,gBAAgB,EACpB,IAAI,EAAE,QAAQ,GAChB,GACA,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;AACF,eAAe,kBAAkB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {BackgroundImage, FileLink} from '../../components';\nimport {BREAKPOINTS} from '../../constants';\nimport {useTheme} from '../../context/theme';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {Col} from '../../grid';\nimport {ContentLayoutBlockProps, ContentSize, ContentTextSize} from '../../models';\nimport {Content} from '../../sub-blocks';\nimport {block, getThemedValue} from '../../utils';\n\nimport './ContentLayout.scss';\n\nconst b = block('content-layout-block');\n\nfunction getFileTextSize(size: ContentSize) {\n switch (size) {\n case 's':\n return 's';\n case 'l':\n default:\n return 'l';\n }\n}\n\nfunction getTextWidth(size: ContentTextSize) {\n switch (size) {\n case 's':\n return {all: 12, md: 6};\n case 'l':\n return {all: 12, md: 12};\n case 'm':\n default:\n return {all: 12, md: 8};\n }\n}\n\nexport const ContentLayoutBlock = (props: ContentLayoutBlockProps) => {\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n\n const {\n textContent,\n fileContent,\n size = 'l',\n background,\n centered,\n theme = 'default',\n textWidth = 'm',\n } = props;\n\n const colSizes = React.useMemo(() => getTextWidth(textWidth), [textWidth]);\n const globalTheme = useTheme();\n const themedBackground = getThemedValue(background, globalTheme);\n\n return (\n <div className={b({size, theme, background: Boolean(background)})}>\n <Content\n className={b('content')}\n {...textContent}\n size={size}\n centered={centered}\n colSizes={colSizes}\n theme={theme}\n />\n {fileContent && (\n <Col className={b('files', {size, centered})} reset sizes={colSizes}>\n {fileContent.map((file) => (\n <FileLink\n className={b('file')}\n {...file}\n key={file.href}\n type=\"horizontal\"\n textSize={getFileTextSize(size)}\n theme={theme}\n />\n ))}\n </Col>\n )}\n {background && (\n <div className={b('background')}>\n <BackgroundImage\n className={b('background-item')}\n {...themedBackground}\n hide={isMobile}\n />\n </div>\n )}\n </div>\n );\n};\nexport default ContentLayoutBlock;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBlock.js","sourceRoot":"../../../../src","sources":["blocks/FilterBlock/FilterBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAC,oBAAW;AACnC,OAAO,EAAC,YAAY,EAAE,KAAK,EAAC,kCAAyB;AACrD,OAAO,UAAiC,kDAA+C;AACvF,OAAO,EAAC,eAAe,EAAC,6EAAoE;AAC5F,OAAO,EAAC,GAAG,EAAE,GAAG,EAAC,4BAAmB;AAEpC,OAAO,EAAC,KAAK,EAAE,WAAW,EAAC,6BAAoB;AAE/C,OAAO,EAAC,IAAI,EAAC,wBAAe;
|
|
1
|
+
{"version":3,"file":"FilterBlock.js","sourceRoot":"../../../../src","sources":["blocks/FilterBlock/FilterBlock.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAC,oBAAW;AACnC,OAAO,EAAC,YAAY,EAAE,KAAK,EAAC,kCAAyB;AACrD,OAAO,UAAiC,kDAA+C;AACvF,OAAO,EAAC,eAAe,EAAC,6EAAoE;AAC5F,OAAO,EAAC,GAAG,EAAE,GAAG,EAAC,4BAAmB;AAEpC,OAAO,EAAC,KAAK,EAAE,WAAW,EAAC,6BAAoB;AAE/C,OAAO,EAAC,IAAI,EAAC,wBAAe;AAE5B,OAAO,mBAAmB,CAAC;AAE3B,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAEhC,MAAM,WAAW,GAAG,CAAC,EACjB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,aAAa,EACb,MAAM,EACN,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,GACO,EAAE,EAAE;IACnB,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AC,IAAI,EAAE,KAAK,CAAC,CAAC;wBAErC,OAAO,KAAC,eAAe,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAO,GAAG,CAAI,CAAC;oBACpE,CAAC,CAAC,GACY,GAChB,IACK,CAClB,CAAC;AACN,CAAC,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {CardLayoutBlock} from '..';\nimport {AnimateBlock, Title} from '../../components';\nimport ButtonTabs, {ButtonTabsItemProps} from '../../components/ButtonTabs/ButtonTabs';\nimport {ConstructorItem} from '../../containers/PageConstructor/components/ConstructorItem';\nimport {Col, Row} from '../../grid';\nimport {FilterBlockProps, FilterItem} from '../../models';\nimport {block, getBlockKey} from '../../utils';\n\nimport {i18n} from './i18n';\n\nimport './FilterBlock.scss';\n\nconst b = block('filter-block');\n\nconst FilterBlock = ({\n title,\n description,\n tags,\n tagButtonSize,\n allTag,\n items,\n colSizes,\n centered,\n animated,\n}: FilterBlockProps) => {\n const tabButtons = React.useMemo(() => {\n const allButton: ButtonTabsItemProps | undefined = allTag\n ? {id: null, title: typeof allTag === 'boolean' ? i18n('label-all-tag') : allTag}\n : undefined;\n const otherButtons: ButtonTabsItemProps[] | undefined =\n tags && tags.map((tag) => ({id: tag.id, title: tag.label}));\n return [...(allButton ? [allButton] : []), ...(otherButtons ? otherButtons : [])];\n }, [allTag, tags]);\n\n const [selectedTag, setSelectedTag] = React.useState(\n tabButtons.length ? tabButtons[0].id : null,\n );\n\n const actualTag: string | null = React.useMemo(() => {\n return tabButtons.length && !tabButtons.find((tab) => tab.id === selectedTag)\n ? tabButtons[0].id\n : selectedTag;\n }, [tabButtons, selectedTag]);\n\n const cards = React.useMemo(() => {\n const itemsToShow: FilterItem[] = actualTag\n ? items.filter((item) => item.tags.includes(actualTag))\n : items;\n\n return itemsToShow.map((item) => item.card);\n }, [actualTag, items]);\n\n return (\n <AnimateBlock className={b()} animate={animated}>\n {title && (\n <Title\n className={b('title', {centered: centered})}\n title={title}\n subtitle={description}\n />\n )}\n {tabButtons.length && (\n <Row>\n <Col>\n <ButtonTabs\n className={b('tabs', {centered: centered})}\n items={tabButtons}\n activeTab={selectedTag}\n onSelectTab={setSelectedTag}\n tabSize={tagButtonSize}\n />\n </Col>\n </Row>\n )}\n <Row className={b('block-container')}>\n <CardLayoutBlock title=\"\" colSizes={colSizes} className={b('cards-container')}>\n {cards.map((card, index) => {\n const key = getBlockKey(card, index);\n\n return <ConstructorItem data={card} blockKey={key} key={key} />;\n })}\n </CardLayoutBlock>\n </Row>\n </AnimateBlock>\n );\n};\nexport default FilterBlock;\n"]}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ClassNameProps, HeaderBlockProps } from "../../models/index.js";
|
|
3
3
|
import './Header.css';
|
|
4
|
-
|
|
4
|
+
type ElementsClassName = {
|
|
5
|
+
gridClassName?: string;
|
|
6
|
+
mediaClassName?: string;
|
|
7
|
+
contentWrapperClassName?: string;
|
|
8
|
+
contentInnerClassName?: string;
|
|
9
|
+
};
|
|
10
|
+
export type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps & ElementsClassName;
|
|
5
11
|
export declare const HeaderBlock: (props: React.PropsWithChildren<HeaderBlockFullProps>) => import("react/jsx-runtime").JSX.Element;
|
|
6
12
|
export default HeaderBlock;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable complexity */
|
|
3
2
|
import { useUniqId } from '@gravity-ui/uikit';
|
|
4
3
|
import { Button, Media, RouterLink } from "../../components/index.js";
|
|
5
4
|
import HeaderBreadcrumbs from "../../components/HeaderBreadcrumbs/HeaderBreadcrumbs.js";
|
|
6
5
|
import { getMediaImage } from "../../components/Media/Image/utils.js";
|
|
7
6
|
import YFMWrapper from "../../components/YFMWrapper/YFMWrapper.js";
|
|
7
|
+
import { BREAKPOINTS } from "../../constants.js";
|
|
8
8
|
import { useTheme } from "../../context/theme/index.js";
|
|
9
|
+
import { useWindowWidth } from "../../context/windowWidthContext/index.js";
|
|
9
10
|
import { Col, Grid, Row } from "../../grid/index.js";
|
|
10
11
|
import { block, getThemedValue } from "../../utils/index.js";
|
|
11
12
|
import { mergeVideoMicrodata } from "../../utils/microdata.js";
|
|
12
13
|
import { getImageSize, getTitleSizes, titleWithImageSizes } from "./utils.js";
|
|
13
14
|
import './Header.css';
|
|
14
|
-
import { useWindowWidth } from "../../context/windowWidthContext/index.js";
|
|
15
|
-
import { BREAKPOINTS } from "../../constants.js";
|
|
16
15
|
const b = block('header-block');
|
|
17
16
|
const Background = ({ background, isMobile }) => {
|
|
18
17
|
const { url, image, fullWidthMedia, video, color } = background;
|
|
@@ -22,7 +21,7 @@ const Background = ({ background, isMobile }) => {
|
|
|
22
21
|
};
|
|
23
22
|
const FullWidthBackground = ({ background }) => (_jsx("div", { className: b('background', { ['full-width']: true }), style: { backgroundColor: background?.color } }));
|
|
24
23
|
export const HeaderBlock = (props) => {
|
|
25
|
-
const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, breadcrumbs, status, renderTitle, children, mediaView = 'full', centered, additionalInfo, } = props;
|
|
24
|
+
const { title, overtitle, description, buttons, image, video, width = 'm', imageSize, offset = 'default', background, theme: textTheme = 'light', verticalOffset = 'm', className, gridClassName, breadcrumbs, status, renderTitle, children, mediaView = 'full', centered, additionalInfo, mediaClassName, contentWrapperClassName, contentInnerClassName, } = props;
|
|
26
25
|
const windowWidth = useWindowWidth();
|
|
27
26
|
const isMobile = windowWidth <= BREAKPOINTS.sm;
|
|
28
27
|
const theme = useTheme();
|
|
@@ -44,11 +43,11 @@ export const HeaderBlock = (props) => {
|
|
|
44
43
|
['full-width']: fullWidth,
|
|
45
44
|
['media-view']: mediaView,
|
|
46
45
|
['controls-view']: textTheme,
|
|
47
|
-
}, className), children: [backgroundThemed && fullWidth && _jsx(FullWidthBackground, { background: backgroundThemed }), backgroundThemed && _jsx(Background, { background: backgroundThemed, isMobile: isMobile }), _jsxs(Grid, { containerClass: b('container-fluid'), children: [breadcrumbs && (_jsx(Row, { className: b('breadcrumbs'), children: _jsx(Col, { children: _jsx(HeaderBreadcrumbs, { ...breadcrumbs, theme: textTheme }) }) })), _jsx(Row, { children: _jsxs(Col, { reset: true, className: b('content-wrapper'), children: [_jsx(Row, { children: _jsx(Col, { className: b('content', {
|
|
46
|
+
}, className), children: [backgroundThemed && fullWidth && _jsx(FullWidthBackground, { background: backgroundThemed }), backgroundThemed && _jsx(Background, { background: backgroundThemed, isMobile: isMobile }), _jsxs(Grid, { containerClass: b('container-fluid'), className: b(null, gridClassName), children: [breadcrumbs && (_jsx(Row, { className: b('breadcrumbs'), children: _jsx(Col, { children: _jsx(HeaderBreadcrumbs, { ...breadcrumbs, theme: textTheme }) }) })), _jsx(Row, { children: _jsxs(Col, { reset: true, className: b('content-wrapper', contentWrapperClassName), children: [_jsx(Row, { children: _jsx(Col, { className: b('content', {
|
|
48
47
|
offset,
|
|
49
48
|
theme: textTheme,
|
|
50
49
|
'vertical-offset': curVerticalOffset,
|
|
51
|
-
}), children: _jsxs(Col, { sizes: titleSizes, className: b('content-inner', { centered }), children: [overtitle && (_jsx("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? (_jsx(YFMWrapper, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: { constructor: true } })) : (overtitle) })), _jsxs(YFMWrapper, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: { constructor: true, constructorTheme: textTheme }, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && (_jsx("div", { className: b('description', { theme: textTheme }), children: _jsx(YFMWrapper, { content: description, modifiers: {
|
|
50
|
+
}), children: _jsxs(Col, { sizes: titleSizes, className: b('content-inner', { centered }, contentInnerClassName), children: [overtitle && (_jsx("div", { className: b('overtitle'), children: typeof overtitle === 'string' ? (_jsx(YFMWrapper, { tagName: "div", className: b('overtitle'), content: overtitle, modifiers: { constructor: true } })) : (overtitle) })), _jsxs(YFMWrapper, { content: title, contentClassName: b('title'), className: b('title-container'), modifiers: { constructor: true, constructorTheme: textTheme }, tagName: "h1", contentPosition: "end", children: [status, renderTitle ? renderTitle(title) : null] }), description && (_jsx("div", { className: b('description', { theme: textTheme }), children: _jsx(YFMWrapper, { content: description, modifiers: {
|
|
52
51
|
constructor: true,
|
|
53
52
|
constructorTheme: textTheme,
|
|
54
53
|
} }) })), additionalInfo && (_jsx("div", { className: b('additional-info', { theme: textTheme }), children: _jsx(YFMWrapper, { content: additionalInfo, modifiers: {
|
|
@@ -57,7 +56,7 @@ export const HeaderBlock = (props) => {
|
|
|
57
56
|
} }) })), buttons && (_jsx("div", { className: b('buttons'), "data-qa": "header-buttons", children: buttons.map((button, index) => (_jsx(RouterLink, { href: button.url, children: _jsx(Button, { className: b('button'), size: "xl", extraProps: {
|
|
58
57
|
'aria-describedby': titleId,
|
|
59
58
|
...button.extraProps,
|
|
60
|
-
}, ...button }, index) }, index))) })), children] }) }) }), hasRightSideImage && (_jsx(Media, { className: b('media', { [curImageSize]: true }), videoClassName: b('video'), imageClassName: b('image'), ...mediaWithMicrodata }))] }) })] })] }));
|
|
59
|
+
}, ...button }, index) }, index))) })), children] }) }) }), hasRightSideImage && (_jsx(Media, { className: b('media', { [curImageSize]: true }, mediaClassName), videoClassName: b('video'), imageClassName: b('image'), ...mediaWithMicrodata }))] }) })] })] }));
|
|
61
60
|
};
|
|
62
61
|
export default HeaderBlock;
|
|
63
62
|
//# sourceMappingURL=Header.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sourceRoot":"../../../../src","sources":["blocks/Header/Header.tsx"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,UAAU,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AAC,CAAC,YAChD,KAAC,UAAU,IACP,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE;4DACP,WAAW,EAAE,IAAI;4DACjB,gBAAgB,EAAE,SAAS;yDAC9B,GACH,GACA,CACT,EACA,cAAc,IAAI,CACf,cAAK,SAAS,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,YACpD,KAAC,UAAU,IACP,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE;4DACP,WAAW,EAAE,IAAI;4DACjB,gBAAgB,EAAE,SAAS;yDAC9B,GACH,GACA,CACT,EACA,OAAO,IAAI,CACR,cAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,aAAU,gBAAgB,YACjD,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5B,KAAC,UAAU,IAAC,IAAI,EAAE,MAAM,CAAC,GAAG,YACxB,KAAC,MAAM,IAEH,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,EACtB,IAAI,EAAC,IAAI,EACT,UAAU,EAAE;gEACR,kBAAkB,EAAE,OAAO;gEAC3B,GAAG,MAAM,CAAC,UAAU;6DACvB,KACG,MAAM,IAPL,KAAK,CAQZ,IAV6B,KAAK,CAW3B,CAChB,CAAC,GACA,CACT,EACA,QAAQ,IACP,GACJ,GACJ,EACL,iBAAiB,IAAI,CAClB,KAAC,KAAK,IACF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAC,CAAC,EAC7C,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KACtB,kBAAkB,GACxB,CACL,IACC,GACJ,IACH,IACF,CACZ,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport {useUniqId} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport {Button, Media, RouterLink} from '../../components';\nimport HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {useTheme} from '../../context/theme';\nimport {Col, Grid, Row} from '../../grid';\nimport {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';\nimport './Header.scss';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {BREAKPOINTS} from '../../constants';\n\nconst b = block('header-block');\n\nexport type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps;\n\ninterface BackgroundProps {\n background: HeaderBlockBackground;\n isMobile: boolean;\n}\n\nconst Background = ({background, isMobile}: BackgroundProps) => {\n const {url, image, fullWidthMedia, video, color} = background;\n const imageObject = url ? getMediaImage(url) : image;\n const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);\n\n return (\n <div\n className={b('background', {media: true, 'full-width-media': fullWidthMedia})}\n style={{backgroundColor: color}}\n >\n {renderMedia && (\n <Media\n {...background}\n className={b('background-media')}\n imageClassName={b('image')}\n videoClassName={b('video')}\n isBackground={true}\n parallax={false}\n video={isMobile ? undefined : video}\n image={imageObject}\n />\n )}\n </div>\n );\n};\n\ninterface FullWidthBackgroundProps {\n background: HeaderBlockBackground;\n}\n\nconst FullWidthBackground = ({background}: FullWidthBackgroundProps) => (\n <div\n className={b('background', {['full-width']: true})}\n style={{backgroundColor: background?.color}}\n />\n);\n\nexport const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>) => {\n const {\n title,\n overtitle,\n description,\n buttons,\n image,\n video,\n width = 'm',\n imageSize,\n offset = 'default',\n background,\n theme: textTheme = 'light',\n verticalOffset = 'm',\n className,\n breadcrumbs,\n status,\n renderTitle,\n children,\n mediaView = 'full',\n centered,\n additionalInfo,\n } = props;\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n const theme = useTheme();\n const hasRightSideImage = Boolean((image || video) && !centered);\n const curImageSize = imageSize || getImageSize(width);\n const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);\n let curVerticalOffset = verticalOffset;\n\n if (hasRightSideImage && !verticalOffset) {\n curVerticalOffset = 'm';\n }\n\n const backgroundThemed = background && getThemedValue(background, theme);\n const imageThemed = image && getThemedValue(image, theme);\n const videoThemed = video && getThemedValue(video, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(\n {video: videoThemed, image: imageThemed},\n {name: title, description},\n );\n const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;\n const titleId = useUniqId();\n\n return (\n <header\n className={b(\n {\n ['has-media']: hasRightSideImage,\n ['full-width']: fullWidth,\n ['media-view']: mediaView,\n ['controls-view']: textTheme,\n },\n className,\n )}\n >\n {backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}\n {backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}\n <Grid containerClass={b('container-fluid')}>\n {breadcrumbs && (\n <Row className={b('breadcrumbs')}>\n <Col>\n <HeaderBreadcrumbs {...breadcrumbs} theme={textTheme} />\n </Col>\n </Row>\n )}\n <Row>\n <Col reset className={b('content-wrapper')}>\n <Row>\n <Col\n className={b('content', {\n offset,\n theme: textTheme,\n 'vertical-offset': curVerticalOffset,\n })}\n >\n <Col sizes={titleSizes} className={b('content-inner', {centered})}>\n {overtitle && (\n <div className={b('overtitle')}>\n {typeof overtitle === 'string' ? (\n <YFMWrapper\n tagName=\"div\"\n className={b('overtitle')}\n content={overtitle}\n modifiers={{constructor: true}}\n />\n ) : (\n overtitle\n )}\n </div>\n )}\n <YFMWrapper\n content={title}\n contentClassName={b('title')}\n className={b('title-container')}\n modifiers={{constructor: true, constructorTheme: textTheme}}\n tagName=\"h1\"\n contentPosition=\"end\"\n >\n {status}\n {renderTitle ? renderTitle(title) : null}\n </YFMWrapper>\n {description && (\n <div className={b('description', {theme: textTheme})}>\n <YFMWrapper\n content={description}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {additionalInfo && (\n <div className={b('additional-info', {theme: textTheme})}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {buttons && (\n <div className={b('buttons')} data-qa=\"header-buttons\">\n {buttons.map((button, index) => (\n <RouterLink href={button.url} key={index}>\n <Button\n key={index}\n className={b('button')}\n size=\"xl\"\n extraProps={{\n 'aria-describedby': titleId,\n ...button.extraProps,\n }}\n {...button}\n />\n </RouterLink>\n ))}\n </div>\n )}\n {children}\n </Col>\n </Col>\n </Row>\n {hasRightSideImage && (\n <Media\n className={b('media', {[curImageSize]: true})}\n videoClassName={b('video')}\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n />\n )}\n </Col>\n </Row>\n </Grid>\n </header>\n );\n};\n\nexport default HeaderBlock;\n"]}
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"../../../../src","sources":["blocks/Header/Header.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAC,kCAAyB;AAC3D,OAAO,iBAAiB,gEAA6D;AACrF,OAAO,EAAC,aAAa,EAAC,8CAA2C;AACjE,OAAO,UAAU,kDAA+C;AAChE,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAC,QAAQ,EAAC,qCAA4B;AAC7C,OAAO,EAAC,cAAc,EAAC,kDAAyC;AAChE,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAC,4BAAmB;AAE1C,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,6BAAoB;AAClD,OAA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K,EAAE,SAAS,EAAC,CAAC,YACpD,KAAC,UAAU,IACP,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE;4DACP,WAAW,EAAE,IAAI;4DACjB,gBAAgB,EAAE,SAAS;yDAC9B,GACH,GACA,CACT,EACA,OAAO,IAAI,CACR,cAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,aAAU,gBAAgB,YACjD,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5B,KAAC,UAAU,IAAC,IAAI,EAAE,MAAM,CAAC,GAAG,YACxB,KAAC,MAAM,IAEH,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,EACtB,IAAI,EAAC,IAAI,EACT,UAAU,EAAE;gEACR,kBAAkB,EAAE,OAAO;gEAC3B,GAAG,MAAM,CAAC,UAAU;6DACvB,KACG,MAAM,IAPL,KAAK,CAQZ,IAV6B,KAAK,CAW3B,CAChB,CAAC,GACA,CACT,EACA,QAAQ,IACP,GACJ,GACJ,EACL,iBAAiB,IAAI,CAClB,KAAC,KAAK,IACF,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,EAAC,CAAC,YAAY,CAAC,EAAE,IAAI,EAAC,EAAE,cAAc,CAAC,EAC7D,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,EAC1B,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,KACtB,kBAAkB,GACxB,CACL,IACC,GACJ,IACH,IACF,CACZ,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["/* eslint-disable complexity */\nimport * as React from 'react';\n\nimport {useUniqId} from '@gravity-ui/uikit';\n\nimport {Button, Media, RouterLink} from '../../components';\nimport HeaderBreadcrumbs from '../../components/HeaderBreadcrumbs/HeaderBreadcrumbs';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {BREAKPOINTS} from '../../constants';\nimport {useTheme} from '../../context/theme';\nimport {useWindowWidth} from '../../context/windowWidthContext';\nimport {Col, Grid, Row} from '../../grid';\nimport {ClassNameProps, HeaderBlockBackground, HeaderBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport {getImageSize, getTitleSizes, titleWithImageSizes} from './utils';\n\nimport './Header.scss';\n\nconst b = block('header-block');\n\ntype ElementsClassName = {\n gridClassName?: string;\n mediaClassName?: string;\n contentWrapperClassName?: string;\n contentInnerClassName?: string;\n};\n\nexport type HeaderBlockFullProps = HeaderBlockProps & ClassNameProps & ElementsClassName;\n\ninterface BackgroundProps {\n background: HeaderBlockBackground;\n isMobile: boolean;\n}\n\nconst Background = ({background, isMobile}: BackgroundProps) => {\n const {url, image, fullWidthMedia, video, color} = background;\n const imageObject = url ? getMediaImage(url) : image;\n const renderMedia = !isMobile || (typeof image === 'object' && 'mobile' in image);\n\n return (\n <div\n className={b('background', {media: true, 'full-width-media': fullWidthMedia})}\n style={{backgroundColor: color}}\n >\n {renderMedia && (\n <Media\n {...background}\n className={b('background-media')}\n imageClassName={b('image')}\n videoClassName={b('video')}\n isBackground={true}\n parallax={false}\n video={isMobile ? undefined : video}\n image={imageObject}\n />\n )}\n </div>\n );\n};\n\ninterface FullWidthBackgroundProps {\n background: HeaderBlockBackground;\n}\n\nconst FullWidthBackground = ({background}: FullWidthBackgroundProps) => (\n <div\n className={b('background', {['full-width']: true})}\n style={{backgroundColor: background?.color}}\n />\n);\n\nexport const HeaderBlock = (props: React.PropsWithChildren<HeaderBlockFullProps>) => {\n const {\n title,\n overtitle,\n description,\n buttons,\n image,\n video,\n width = 'm',\n imageSize,\n offset = 'default',\n background,\n theme: textTheme = 'light',\n verticalOffset = 'm',\n className,\n gridClassName,\n breadcrumbs,\n status,\n renderTitle,\n children,\n mediaView = 'full',\n centered,\n additionalInfo,\n mediaClassName,\n contentWrapperClassName,\n contentInnerClassName,\n } = props;\n const windowWidth = useWindowWidth();\n const isMobile = windowWidth <= BREAKPOINTS.sm;\n const theme = useTheme();\n const hasRightSideImage = Boolean((image || video) && !centered);\n const curImageSize = imageSize || getImageSize(width);\n const titleSizes = hasRightSideImage ? titleWithImageSizes(curImageSize) : getTitleSizes(width);\n let curVerticalOffset = verticalOffset;\n\n if (hasRightSideImage && !verticalOffset) {\n curVerticalOffset = 'm';\n }\n\n const backgroundThemed = background && getThemedValue(background, theme);\n const imageThemed = image && getThemedValue(image, theme);\n const videoThemed = video && getThemedValue(video, theme);\n const mediaWithMicrodata = mergeVideoMicrodata(\n {video: videoThemed, image: imageThemed},\n {name: title, description},\n );\n const fullWidth = backgroundThemed?.fullWidth || backgroundThemed?.fullWidthMedia;\n const titleId = useUniqId();\n\n return (\n <header\n className={b(\n {\n ['has-media']: hasRightSideImage,\n ['full-width']: fullWidth,\n ['media-view']: mediaView,\n ['controls-view']: textTheme,\n },\n className,\n )}\n >\n {backgroundThemed && fullWidth && <FullWidthBackground background={backgroundThemed} />}\n {backgroundThemed && <Background background={backgroundThemed} isMobile={isMobile} />}\n <Grid containerClass={b('container-fluid')} className={b(null, gridClassName)}>\n {breadcrumbs && (\n <Row className={b('breadcrumbs')}>\n <Col>\n <HeaderBreadcrumbs {...breadcrumbs} theme={textTheme} />\n </Col>\n </Row>\n )}\n <Row>\n <Col reset className={b('content-wrapper', contentWrapperClassName)}>\n <Row>\n <Col\n className={b('content', {\n offset,\n theme: textTheme,\n 'vertical-offset': curVerticalOffset,\n })}\n >\n <Col\n sizes={titleSizes}\n className={b(\n 'content-inner',\n {centered},\n contentInnerClassName,\n )}\n >\n {overtitle && (\n <div className={b('overtitle')}>\n {typeof overtitle === 'string' ? (\n <YFMWrapper\n tagName=\"div\"\n className={b('overtitle')}\n content={overtitle}\n modifiers={{constructor: true}}\n />\n ) : (\n overtitle\n )}\n </div>\n )}\n <YFMWrapper\n content={title}\n contentClassName={b('title')}\n className={b('title-container')}\n modifiers={{constructor: true, constructorTheme: textTheme}}\n tagName=\"h1\"\n contentPosition=\"end\"\n >\n {status}\n {renderTitle ? renderTitle(title) : null}\n </YFMWrapper>\n {description && (\n <div className={b('description', {theme: textTheme})}>\n <YFMWrapper\n content={description}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {additionalInfo && (\n <div className={b('additional-info', {theme: textTheme})}>\n <YFMWrapper\n content={additionalInfo}\n modifiers={{\n constructor: true,\n constructorTheme: textTheme,\n }}\n />\n </div>\n )}\n {buttons && (\n <div className={b('buttons')} data-qa=\"header-buttons\">\n {buttons.map((button, index) => (\n <RouterLink href={button.url} key={index}>\n <Button\n key={index}\n className={b('button')}\n size=\"xl\"\n extraProps={{\n 'aria-describedby': titleId,\n ...button.extraProps,\n }}\n {...button}\n />\n </RouterLink>\n ))}\n </div>\n )}\n {children}\n </Col>\n </Col>\n </Row>\n {hasRightSideImage && (\n <Media\n className={b('media', {[curImageSize]: true}, mediaClassName)}\n videoClassName={b('video')}\n imageClassName={b('image')}\n {...mediaWithMicrodata}\n />\n )}\n </Col>\n </Row>\n </Grid>\n </header>\n );\n};\n\nexport default HeaderBlock;\n"]}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createElement as _createElement } from "react";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import { useUniqId } from '@gravity-ui/uikit';
|
|
5
|
+
import { FullscreenImage, YFMWrapper } from "../../../components/index.js";
|
|
6
|
+
import { getMediaImage } from "../../../components/Media/Image/utils.js";
|
|
7
|
+
import Media from "../../../components/Media/Media.js";
|
|
8
|
+
import { getHeight } from "../../../components/VideoBlock/VideoBlock.js";
|
|
4
9
|
import { ProjectSettingsContext } from "../../../context/projectSettingsContext/index.js";
|
|
5
|
-
import { block, getThemedValue } from "../../../utils/index.js";
|
|
6
10
|
import { useTheme } from "../../../context/theme/index.js";
|
|
7
|
-
import { getHeight } from "../../../components/VideoBlock/VideoBlock.js";
|
|
8
|
-
import { getMediaImage } from "../../../components/Media/Image/utils.js";
|
|
9
|
-
import TabsTextContent from "../TabsTextContent/TabsTextContent.js";
|
|
10
11
|
import { Col, GridColumnOrderClasses, Row } from "../../../grid/index.js";
|
|
11
|
-
import
|
|
12
|
+
import { block, getThemedValue } from "../../../utils/index.js";
|
|
12
13
|
import { mergeVideoMicrodata } from "../../../utils/microdata.js";
|
|
13
|
-
import
|
|
14
|
-
import { useUniqId } from '@gravity-ui/uikit';
|
|
14
|
+
import TabsTextContent from "../TabsTextContent/TabsTextContent.js";
|
|
15
15
|
import './TabContent.css';
|
|
16
16
|
const b = block('tab-content');
|
|
17
17
|
export const TabContent = ({ tabData, isActive, isReverse, contentSize, centered, play, getTabElementId, getTabContentElementId, }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabContent.js","sourceRoot":"../../../../../src","sources":["blocks/Tabs/TabContent/TabContent.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"TabContent.js","sourceRoot":"../../../../../src","sources":["blocks/Tabs/TabContent/TabContent.tsx"],"names":[],"mappings":";;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAC,eAAe,EAAE,UAAU,EAAC,qCAA4B;AAChE,OAAO,EAAC,aAAa,EAAC,iDAA8C;AACpE,OAAO,KAAK,2CAAwC;AACpD,OAAO,EAAC,SAAS,EAAC,qDAAkD;AACpE,OAAO,EAAC,sBAAsB,EAAC,yDAAgD;AAC/E,OAAO,EAAC,QAAQ,EAAC,wCAA+B;AAChD,OAAO,EAAC,GAAG,EAAE,sBAAsB,EAAE,GAAG,EAAC,+BAAsB;AAE/D,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,gCAAuB;AACrD,OAAO,EAAC,m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E,IAAI,EAAC,EAC9B,EAAE,EAAE,SAAS,GACf,GACA,CACT,IACC,CACT,CAAC;IAEF,OAAO,CACH,MAAC,GAAG,IAEA,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,EAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAC,CAAC,EAC5D,EAAE,EAAE,sBAAsB,EAAE,CAAC,OAAO,CAAC,EACrC,IAAI,EAAC,UAAU,EACf,SAAS,EAAE;YACP,iBAAiB,EAAE,eAAe,EAAE,CAAC,OAAO,CAAC;SAChD,aAEA,YAAY,EACZ,WAAW,KATP,OAAO,CAUV,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {useUniqId} from '@gravity-ui/uikit';\n\nimport {FullscreenImage, YFMWrapper} from '../../../components';\nimport {getMediaImage} from '../../../components/Media/Image/utils';\nimport Media from '../../../components/Media/Media';\nimport {getHeight} from '../../../components/VideoBlock/VideoBlock';\nimport {ProjectSettingsContext} from '../../../context/projectSettingsContext';\nimport {useTheme} from '../../../context/theme';\nimport {Col, GridColumnOrderClasses, Row} from '../../../grid';\nimport {ContentSize, TabsBlockItem} from '../../../models';\nimport {block, getThemedValue} from '../../../utils';\nimport {mergeVideoMicrodata} from '../../../utils/microdata';\nimport TabsTextContent from '../TabsTextContent/TabsTextContent';\n\nimport './TabContent.scss';\n\nconst b = block('tab-content');\n\nexport interface TabContentProps {\n tabData: TabsBlockItem;\n isActive: boolean;\n isReverse: boolean;\n contentSize: ContentSize;\n centered?: boolean;\n play: boolean;\n getTabElementId?: (tabId: string) => string;\n getTabContentElementId?: (tabId: string) => string;\n}\n\nexport const TabContent = ({\n tabData,\n isActive,\n isReverse,\n contentSize,\n centered,\n play,\n getTabElementId,\n getTabContentElementId,\n}: TabContentProps) => {\n const {tabName} = tabData;\n\n const mediaContainerRef = React.useRef<HTMLDivElement>(null);\n const theme = useTheme();\n const {renderInvisibleBlocks} = React.useContext(ProjectSettingsContext);\n\n const captionId = useUniqId();\n\n const mediaWidth = mediaContainerRef?.current?.offsetWidth;\n const [minImageHeight, setMinImageHeight] = React.useState(\n mediaContainerRef?.current?.offsetHeight,\n );\n\n const shouldRender = renderInvisibleBlocks || isActive;\n\n const themedImage = getThemedValue(tabData.image, theme);\n const themedMedia = getThemedValue(tabData.media, theme);\n\n const hasNoImage = !themedMedia?.image && !tabData.image;\n const mediaVideoHeight = hasNoImage && mediaWidth && getHeight(mediaWidth);\n\n // TODO remove property support activeTabData?.image. Use only activeTabData?.media?.image\n const imageProps = React.useMemo(() => {\n const imagePropsResult = themedImage && getMediaImage(themedImage);\n\n if (tabData.caption && imagePropsResult) {\n Object.assign(imagePropsResult, {\n 'aria-describedby': captionId,\n });\n }\n\n return imagePropsResult;\n }, [captionId, tabData.caption, themedImage]);\n\n const handleImageHeight = React.useCallback(() => {\n if (minImageHeight !== mediaContainerRef?.current?.offsetHeight) {\n setMinImageHeight(mediaContainerRef?.current?.offsetHeight);\n }\n }, [minImageHeight]);\n\n React.useEffect(() => {\n handleImageHeight();\n }, [isActive, handleImageHeight]);\n\n if (!shouldRender) {\n return null;\n }\n\n const showMedia = isActive && Boolean(tabData.media || imageProps);\n const showText = Boolean(tabData.text);\n const border = tabData.border || 'shadow';\n\n const textContent = showText && (\n <TabsTextContent\n showMedia={showMedia}\n data={tabData}\n imageProps={imageProps || undefined}\n isReverse={isReverse}\n contentSize={contentSize}\n centered={centered}\n />\n );\n\n const mediaContent = showMedia && (\n <Col\n sizes={{all: 12, md: 8}}\n orders={{\n all: GridColumnOrderClasses.Last,\n md: GridColumnOrderClasses.First,\n }}\n className={b('col', {centered: centered})}\n >\n {tabData.media && (\n <div style={{minHeight: mediaVideoHeight || minImageHeight}}>\n <div ref={mediaContainerRef}>\n <Media\n {...mergeVideoMicrodata(getThemedValue(tabData.media, theme), {\n name: tabData.tabName,\n description: tabData.caption ? tabData.caption : undefined,\n })}\n key={tabName}\n className={b('media', {border})}\n playVideo={play}\n height={mediaVideoHeight || undefined}\n onImageLoad={handleImageHeight}\n />\n </div>\n </div>\n )}\n {imageProps && (\n <React.Fragment>\n <FullscreenImage {...imageProps} imageClassName={b('image', {border})} />\n </React.Fragment>\n )}\n {tabData.caption && (\n <div className={b('caption')} id={captionId}>\n <YFMWrapper\n content={tabData.caption}\n modifiers={{constructor: true}}\n id={captionId}\n />\n </div>\n )}\n </Col>\n );\n\n return (\n <Row\n key={tabName}\n className={b('row', {reverse: isReverse, hidden: !isActive})}\n id={getTabContentElementId?.(tabName)}\n role=\"tabpanel\"\n ariaProps={{\n 'aria-labelledby': getTabElementId?.(tabName),\n }}\n >\n {mediaContent}\n {textContent}\n </Row>\n );\n};\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import { getUniqId } from '@gravity-ui/uikit';
|
|
3
4
|
import AnimateBlock from "../../components/AnimateBlock/AnimateBlock.js";
|
|
4
5
|
import ButtonTabs from "../../components/ButtonTabs/ButtonTabs.js";
|
|
5
6
|
import Title from "../../components/Title/Title.js";
|
|
6
7
|
import { Col, GridJustifyContent, Row } from "../../grid/index.js";
|
|
7
8
|
import { block } from "../../utils/index.js";
|
|
8
|
-
import './Tabs.css';
|
|
9
9
|
import { TabContent } from "./TabContent/TabContent.js";
|
|
10
|
-
import
|
|
10
|
+
import './Tabs.css';
|
|
11
11
|
const b = block('tabs-block');
|
|
12
12
|
export const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', contentSize = 's', }) => {
|
|
13
13
|
const [activeTab, setActiveTab] = React.useState(items[0].tabName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sourceRoot":"../../../../src","sources":["blocks/Tabs/Tabs.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,YAAY,sDAAmD;AAC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,KAAK,EAAE,YAAY,YACpB,KAAC,UAAU,IACP,KAAK,EAAE,IAAI,EACX,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC,EAC1C,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,GAChD,GACA,GACJ,EACL,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;gBACnB,MAAM,EAAC,OAAO,EAAC,GAAG,OAAO,CAAC;gBAE1B,OAAO,CACH,KAAC,UAAU,IAEP,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,OAAO,KAAK,SAAS,EAC/B,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,IARzC,OAAO,CASd,CACL,CAAC;YACN,CAAC,CAAC,IACS,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {getUniqId} from '@gravity-ui/uikit';\n\nimport AnimateBlock from '../../components/AnimateBlock/AnimateBlock';\nimport ButtonTabs, {ButtonTabsItemProps} from '../../components/ButtonTabs/ButtonTabs';\nimport Title from '../../components/Title/Title';\nimport {Col, GridJustifyContent, Row} from '../../grid';\nimport {TabsBlockProps} from '../../models';\nimport {block} from '../../utils';\n\nimport {TabContent} from './TabContent/TabContent';\n\nimport './Tabs.scss';\n\nconst b = block('tabs-block');\n\nexport const TabsBlock = ({\n items,\n title,\n description,\n animated,\n tabsColSizes,\n centered,\n direction = 'media-content',\n contentSize = 's',\n}: TabsBlockProps) => {\n const [activeTab, setActiveTab] = React.useState<string | null>(items[0].tabName);\n const [play, setPlay] = React.useState<boolean>(false);\n\n const tabs: ButtonTabsItemProps[] = items.map(({tabName}) => ({title: tabName, id: tabName}));\n const isReverse = direction === 'content-media';\n\n const tabIds = React.useMemo(\n () =>\n items.reduce(\n (acc, {tabName}) => Object.assign(acc, {[tabName]: getUniqId()}),\n {} as Record<string, string>,\n ),\n [items],\n );\n\n const getTabElementId = (tabId: string) => `${tabIds[tabId]}`;\n const getTabContentElementId = (tabId: string) => `${tabIds[tabId]}-content`;\n\n const onSelectTab = React.useCallback(\n (tabId: string | null, e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n setActiveTab(tabId);\n e.currentTarget.scrollIntoView({\n inline: 'center',\n behavior: 'smooth',\n block: 'nearest',\n });\n },\n [],\n );\n\n return (\n <AnimateBlock className={b()} onScroll={() => setPlay(true)} animate={animated}>\n <Title\n title={title}\n subtitle={description}\n className={b('title', {centered: centered})}\n />\n <Row justifyContent={centered ? GridJustifyContent.Center : undefined}>\n <Col sizes={tabsColSizes}>\n <ButtonTabs\n items={tabs}\n onSelectTab={onSelectTab}\n activeTab={activeTab}\n className={b('tabs', {centered: centered})}\n getTabElementId={getTabElementId}\n getTabContentElementId={getTabContentElementId}\n />\n </Col>\n </Row>\n {items.map((tabData) => {\n const {tabName} = tabData;\n\n return (\n <TabContent\n key={tabName}\n tabData={tabData}\n isActive={tabName === activeTab}\n isReverse={isReverse}\n contentSize={contentSize}\n centered={centered}\n play={play}\n getTabElementId={getTabElementId}\n getTabContentElementId={getTabContentElementId}\n />\n );\n })}\n </AnimateBlock>\n );\n};\n\nexport default TabsBlock;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnpublishedLabel.js","sourceRoot":"../../../../src","sources":["components/UnpublishedLabel/UnpublishedLabel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAElC,OAAO,EAAC,IAAI,EAAC,wBAAe;
|
|
1
|
+
{"version":3,"file":"UnpublishedLabel.js","sourceRoot":"../../../../src","sources":["components/UnpublishedLabel/UnpublishedLabel.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAElC,OAAO,EAAC,IAAI,EAAC,wBAAe;AAE5B,OAAO,wBAAwB,CAAC;AAEhC,MAAM,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAC,CAAC;AASrC,MAAM,gBAAgB,GAAG,CAAC,EACtB,SAAS,EACT,QAAQ,EACR,IAAI,GAAG,MAAM,GACgC,EAAE,EAAE,CAAC,CAClD,cAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAC,EAAE,SAAS,CAAC,YAAG,QAAQ,IAAI,IAAI,CAAC,qBAAqB,CAAC,GAAO,CACxF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {block} from '../../utils';\n\nimport {i18n} from './i18n';\n\nimport './UnpublishedLabel.scss';\n\nconst b = block('unpublished-label');\n\nexport type LabeLType = 'label' | 'line';\n\nexport interface UnpublishedLabelProps {\n type?: LabeLType;\n className?: string;\n}\n\nconst UnpublishedLabel = ({\n className,\n children,\n type = 'line',\n}: React.PropsWithChildren<UnpublishedLabelProps>) => (\n <div className={b({type}, className)}>{children || i18n('label_non_published')}</div>\n);\n\nexport default UnpublishedLabel;\n"]}
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { LocaleContext } from "../../context/localeContext/index.js";
|
|
4
4
|
import { MobileContext } from "../../context/mobileContext/index.js";
|
|
5
|
+
import { ProjectSettingsContext } from "../../context/projectSettingsContext/index.js";
|
|
5
6
|
import { useAnalytics } from "../../hooks/index.js";
|
|
6
7
|
import { DefaultEventNames } from "../../models/common.js";
|
|
7
8
|
import { block } from "../../utils/index.js";
|
|
8
9
|
import { HEADER_HEIGHT } from "../constants.js";
|
|
9
|
-
import { ProjectSettingsContext } from "../../context/projectSettingsContext/index.js";
|
|
10
10
|
export const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';
|
|
11
11
|
export const YANDEX_FORM_SECTION = 'surveys';
|
|
12
12
|
const CONTAINER_ID = 'pc-yandex-form-container';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YandexForm.js","sourceRoot":"../../../../src","sources":["components/YandexForm/YandexForm.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,YAAY,EAAC,6BAAoB;AAEzC,OAAO,EAAC,iBAAiB,EAAC,+BAA4B;AACtD,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,EAAC,aAAa,EAAC,wBAAqB;AAC3C,OAAO,EAAC,sBAAsB,EAAC,sDAA6C;AAE5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAC7C,MAAM,YAAY,GAAG,0BAA0B,CAAC;AAEhD,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAE/B,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IAC1C,MAAM,EACF,MAAM,EACN,EAAE,EACF,MAAM,EACN,SAAS,EACT,KAAK,EACL,WAAW,GAAG,YAAY,EAC1B,YAAY,GAAG,aAAa,EAC5B,QAAQ,EACR,eAAe,EACf,gBAAgB,EAChB,iBAAiB,GACpB,GAAG,KAAK,CAAC;IACV,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC5D,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,EAAqB,CAAC;IACpD,MAAM,YAAY,GAAG,gBAAgB,IAAI,kBAAkB,CAAC;IAC5D,MAAM,aAAa,GAAG,iBAAiB,IAAI,mBAAmB,CAAC;IAE/D,MAAM,eAAe,GAAG,YAAY,CAAC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AM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;QACvE,CAAC;IACL,CAAC,EAAE,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC;IAEtC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,SAAS,EAAE,CAAC;QACZ,wCAAwC;QACxC,qFAAqF;QACrF,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC;QAEnC,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;IACtE,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAE3C,OAAO,cAAK,GAAG,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,GAAI,CAAC;AACzE,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {LocaleContext} from '../../context/localeContext';\nimport {MobileContext} from '../../context/mobileContext';\nimport {useAnalytics} from '../../hooks';\nimport {YandexFormProps} from '../../models';\nimport {DefaultEventNames} from '../../models/common';\nimport {block} from '../../utils';\nimport {HEADER_HEIGHT} from '../constants';\nimport {ProjectSettingsContext} from '../../context/projectSettingsContext';\n\nexport const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';\nexport const YANDEX_FORM_SECTION = 'surveys';\nconst CONTAINER_ID = 'pc-yandex-form-container';\n\nconst b = block('yandex-form');\n\nconst YandexForm = (props: YandexFormProps) => {\n const {\n onLoad,\n id,\n params,\n className,\n theme,\n containerId = CONTAINER_ID,\n headerHeight = HEADER_HEIGHT,\n onSubmit,\n analyticsEvents,\n customFormOrigin,\n customFormSection,\n } = props;\n const formContainerRef = React.useRef<HTMLDivElement>(null);\n const iframeRef = React.useRef<HTMLIFrameElement>();\n const yaFormOrigin = customFormOrigin || YANDEX_FORM_ORIGIN;\n const yaFormSection = customFormSection || YANDEX_FORM_SECTION;\n\n const handleAnalytics = useAnalytics(DefaultEventNames.YandexFormSubmit);\n const isMobile = React.useContext(MobileContext);\n const locale = React.useContext(LocaleContext);\n const {defaultYandexFormTheme} = React.useContext(ProjectSettingsContext);\n\n const updateFormIframe = React.useCallback(\n (container: HTMLDivElement) => {\n const queryParams = new URLSearchParams(location.search);\n const url = location.origin + location.pathname;\n const formTheme = theme || defaultYandexFormTheme;\n\n queryParams.set('url', url);\n queryParams.set('iframe', '1');\n\n if (locale?.lang) {\n queryParams.set('lang', locale.lang);\n }\n\n if (formTheme) {\n queryParams.set('theme', formTheme);\n }\n\n if (isMobile) {\n queryParams.set('media-type', 'mobile');\n }\n\n if (params) {\n Object.keys(params).forEach((param) => {\n queryParams.set(param, params[param]);\n });\n }\n\n const src = `${yaFormOrigin}/${yaFormSection}/${id}/?${queryParams}`;\n\n if (iframeRef.current) {\n iframeRef.current.src = src;\n } else {\n iframeRef.current = document.createElement('iframe');\n iframeRef.current.src = src;\n iframeRef.current.id = containerId;\n iframeRef.current.name = `form${id}`;\n iframeRef.current.setAttribute('loading', 'lazy');\n iframeRef.current.frameBorder = '0';\n iframeRef.current.scrolling = 'no';\n iframeRef.current.width = '100%';\n container.appendChild(iframeRef.current);\n }\n },\n [\n theme,\n defaultYandexFormTheme,\n locale.lang,\n isMobile,\n params,\n yaFormOrigin,\n yaFormSection,\n id,\n containerId,\n ],\n );\n\n const handleSubmit = React.useCallback(() => {\n if (formContainerRef && formContainerRef.current) {\n const {top} = formContainerRef.current.getBoundingClientRect();\n window.scrollBy(0, top - headerHeight);\n }\n\n handleAnalytics(analyticsEvents);\n\n if (onSubmit) {\n onSubmit();\n }\n }, [handleAnalytics, analyticsEvents, onSubmit, headerHeight]);\n\n const handleMessage = React.useCallback(\n ({origin, data}: MessageEvent) => {\n if (origin !== yaFormOrigin) {\n return;\n }\n\n try {\n const parsed = JSON.parse(data);\n const height = parsed['iframe-height'];\n const {message, name, redirectUrl} = parsed;\n if (name !== `form${id}`) {\n return;\n }\n\n if (iframeRef.current && height && !message) {\n iframeRef.current.height = `${height}px`;\n onLoad?.();\n }\n\n if (message === 'sent' || redirectUrl) {\n // event with redirectUrl is comming when form with redirect is used\n // otherwise, message: 'sent' is not comming on such sort of forms\n // to catch this event and handle analytics redirectUrl is added to condition\n handleSubmit();\n }\n } catch {\n return;\n }\n },\n [yaFormOrigin, id, onLoad, handleSubmit],\n );\n\n const addIframe = React.useCallback(() => {\n const container = formContainerRef.current;\n\n if (container) {\n updateFormIframe(container);\n window.addEventListener('message', handleMessage, {passive: true});\n }\n }, [updateFormIframe, handleMessage]);\n\n React.useEffect(() => {\n addIframe();\n // Crunch for mobile chrome in lite mode\n // https://support.google.com/chrome/answer/2392284?co=GENIE.Platform%3DAndroid&oco=1\n setTimeout(() => onLoad?.(), 1000);\n\n return () => window.removeEventListener('message', handleMessage);\n }, [id, addIframe, handleMessage, onLoad]);\n\n return <div ref={formContainerRef} className={b(null, className)} />;\n};\n\nexport default YandexForm;\n"]}
|
|
1
|
+
{"version":3,"file":"YandexForm.js","sourceRoot":"../../../../src","sources":["components/YandexForm/YandexForm.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,aAAa,EAAC,6CAAoC;AAC1D,OAAO,EAAC,sBAAsB,EAAC,sDAA6C;AAC5E,OAAO,EAAC,YAAY,EAAC,6BAAoB;AAEzC,OAAO,EAAC,iBAAiB,EAAC,+BAA4B;AACtD,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,EAAC,aAAa,EAAC,wBAAqB;AAE3C,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAC7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AC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {LocaleContext} from '../../context/localeContext';\nimport {MobileContext} from '../../context/mobileContext';\nimport {ProjectSettingsContext} from '../../context/projectSettingsContext';\nimport {useAnalytics} from '../../hooks';\nimport {YandexFormProps} from '../../models';\nimport {DefaultEventNames} from '../../models/common';\nimport {block} from '../../utils';\nimport {HEADER_HEIGHT} from '../constants';\n\nexport const YANDEX_FORM_ORIGIN = 'https://forms.yandex.ru';\nexport const YANDEX_FORM_SECTION = 'surveys';\nconst CONTAINER_ID = 'pc-yandex-form-container';\n\nconst b = block('yandex-form');\n\nconst YandexForm = (props: YandexFormProps) => {\n const {\n onLoad,\n id,\n params,\n className,\n theme,\n containerId = CONTAINER_ID,\n headerHeight = HEADER_HEIGHT,\n onSubmit,\n analyticsEvents,\n customFormOrigin,\n customFormSection,\n } = props;\n const formContainerRef = React.useRef<HTMLDivElement>(null);\n const iframeRef = React.useRef<HTMLIFrameElement>();\n const yaFormOrigin = customFormOrigin || YANDEX_FORM_ORIGIN;\n const yaFormSection = customFormSection || YANDEX_FORM_SECTION;\n\n const handleAnalytics = useAnalytics(DefaultEventNames.YandexFormSubmit);\n const isMobile = React.useContext(MobileContext);\n const locale = React.useContext(LocaleContext);\n const {defaultYandexFormTheme} = React.useContext(ProjectSettingsContext);\n\n const updateFormIframe = React.useCallback(\n (container: HTMLDivElement) => {\n const queryParams = new URLSearchParams(location.search);\n const url = location.origin + location.pathname;\n const formTheme = theme || defaultYandexFormTheme;\n\n queryParams.set('url', url);\n queryParams.set('iframe', '1');\n\n if (locale?.lang) {\n queryParams.set('lang', locale.lang);\n }\n\n if (formTheme) {\n queryParams.set('theme', formTheme);\n }\n\n if (isMobile) {\n queryParams.set('media-type', 'mobile');\n }\n\n if (params) {\n Object.keys(params).forEach((param) => {\n queryParams.set(param, params[param]);\n });\n }\n\n const src = `${yaFormOrigin}/${yaFormSection}/${id}/?${queryParams}`;\n\n if (iframeRef.current) {\n iframeRef.current.src = src;\n } else {\n iframeRef.current = document.createElement('iframe');\n iframeRef.current.src = src;\n iframeRef.current.id = containerId;\n iframeRef.current.name = `form${id}`;\n iframeRef.current.setAttribute('loading', 'lazy');\n iframeRef.current.frameBorder = '0';\n iframeRef.current.scrolling = 'no';\n iframeRef.current.width = '100%';\n container.appendChild(iframeRef.current);\n }\n },\n [\n theme,\n defaultYandexFormTheme,\n locale.lang,\n isMobile,\n params,\n yaFormOrigin,\n yaFormSection,\n id,\n containerId,\n ],\n );\n\n const handleSubmit = React.useCallback(() => {\n if (formContainerRef && formContainerRef.current) {\n const {top} = formContainerRef.current.getBoundingClientRect();\n window.scrollBy(0, top - headerHeight);\n }\n\n handleAnalytics(analyticsEvents);\n\n if (onSubmit) {\n onSubmit();\n }\n }, [handleAnalytics, analyticsEvents, onSubmit, headerHeight]);\n\n const handleMessage = React.useCallback(\n ({origin, data}: MessageEvent) => {\n if (origin !== yaFormOrigin) {\n return;\n }\n\n try {\n const parsed = JSON.parse(data);\n const height = parsed['iframe-height'];\n const {message, name, redirectUrl} = parsed;\n if (name !== `form${id}`) {\n return;\n }\n\n if (iframeRef.current && height && !message) {\n iframeRef.current.height = `${height}px`;\n onLoad?.();\n }\n\n if (message === 'sent' || redirectUrl) {\n // event with redirectUrl is comming when form with redirect is used\n // otherwise, message: 'sent' is not comming on such sort of forms\n // to catch this event and handle analytics redirectUrl is added to condition\n handleSubmit();\n }\n } catch {\n return;\n }\n },\n [yaFormOrigin, id, onLoad, handleSubmit],\n );\n\n const addIframe = React.useCallback(() => {\n const container = formContainerRef.current;\n\n if (container) {\n updateFormIframe(container);\n window.addEventListener('message', handleMessage, {passive: true});\n }\n }, [updateFormIframe, handleMessage]);\n\n React.useEffect(() => {\n addIframe();\n // Crunch for mobile chrome in lite mode\n // https://support.google.com/chrome/answer/2392284?co=GENIE.Platform%3DAndroid&oco=1\n setTimeout(() => onLoad?.(), 1000);\n\n return () => window.removeEventListener('message', handleMessage);\n }, [id, addIframe, handleMessage, onLoad]);\n\n return <div ref={formContainerRef} className={b(null, className)} />;\n};\n\nexport default YandexForm;\n"]}
|