@gravity-ui/page-constructor 6.2.2 → 6.3.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.
Files changed (52) hide show
  1. package/build/cjs/blocks/Tabs/TabContent/TabContent.css +77 -0
  2. package/build/cjs/blocks/Tabs/TabContent/TabContent.d.ts +12 -0
  3. package/build/cjs/blocks/Tabs/TabContent/TabContent.js +70 -0
  4. package/build/cjs/blocks/Tabs/TabContent/TabContent.js.map +1 -0
  5. package/build/cjs/blocks/Tabs/Tabs.css +0 -72
  6. package/build/cjs/blocks/Tabs/Tabs.js +13 -57
  7. package/build/cjs/blocks/Tabs/Tabs.js.map +1 -1
  8. package/build/cjs/components/Button/Button.d.ts +1 -0
  9. package/build/cjs/components/Button/Button.js.map +1 -1
  10. package/build/cjs/components/ButtonTabs/ButtonTabs.d.ts +2 -0
  11. package/build/cjs/components/ButtonTabs/ButtonTabs.js +3 -2
  12. package/build/cjs/components/ButtonTabs/ButtonTabs.js.map +1 -1
  13. package/build/cjs/context/projectSettingsContext/ProjectSettingsContext.d.ts +1 -0
  14. package/build/cjs/context/projectSettingsContext/ProjectSettingsContext.js.map +1 -1
  15. package/build/cjs/grid/Col/Col.d.ts +3 -2
  16. package/build/cjs/grid/Col/Col.js +2 -2
  17. package/build/cjs/grid/Col/Col.js.map +1 -1
  18. package/build/cjs/grid/Row/Row.d.ts +4 -3
  19. package/build/cjs/grid/Row/Row.js +2 -2
  20. package/build/cjs/grid/Row/Row.js.map +1 -1
  21. package/build/cjs/models/constructor-items/common.d.ts +3 -0
  22. package/build/cjs/models/constructor-items/common.js.map +1 -1
  23. package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.css +2 -0
  24. package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js +13 -5
  25. package/build/cjs/navigation/components/NavigationPopup/NavigationPopup.js.map +1 -1
  26. package/build/esm/blocks/Tabs/TabContent/TabContent.css +77 -0
  27. package/build/esm/blocks/Tabs/TabContent/TabContent.d.ts +13 -0
  28. package/build/esm/blocks/Tabs/TabContent/TabContent.js +66 -0
  29. package/build/esm/blocks/Tabs/TabContent/TabContent.js.map +1 -0
  30. package/build/esm/blocks/Tabs/Tabs.css +0 -72
  31. package/build/esm/blocks/Tabs/Tabs.js +13 -57
  32. package/build/esm/blocks/Tabs/Tabs.js.map +1 -1
  33. package/build/esm/components/Button/Button.d.ts +1 -0
  34. package/build/esm/components/Button/Button.js.map +1 -1
  35. package/build/esm/components/ButtonTabs/ButtonTabs.d.ts +2 -0
  36. package/build/esm/components/ButtonTabs/ButtonTabs.js +3 -2
  37. package/build/esm/components/ButtonTabs/ButtonTabs.js.map +1 -1
  38. package/build/esm/context/projectSettingsContext/ProjectSettingsContext.d.ts +1 -0
  39. package/build/esm/context/projectSettingsContext/ProjectSettingsContext.js.map +1 -1
  40. package/build/esm/grid/Col/Col.d.ts +3 -2
  41. package/build/esm/grid/Col/Col.js +2 -2
  42. package/build/esm/grid/Col/Col.js.map +1 -1
  43. package/build/esm/grid/Row/Row.d.ts +4 -3
  44. package/build/esm/grid/Row/Row.js +2 -2
  45. package/build/esm/grid/Row/Row.js.map +1 -1
  46. package/build/esm/models/constructor-items/common.d.ts +3 -0
  47. package/build/esm/models/constructor-items/common.js.map +1 -1
  48. package/build/esm/navigation/components/NavigationPopup/NavigationPopup.css +2 -0
  49. package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js +13 -5
  50. package/build/esm/navigation/components/NavigationPopup/NavigationPopup.js.map +1 -1
  51. package/package.json +1 -1
  52. package/server/models/constructor-items/common.d.ts +3 -0
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"../../../../src","sources":["models/constructor-items/common.ts"],"names":[],"mappings":";;;AAOA,QAAQ;AACR,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,+CAA2B,CAAA;IAC3B,yCAAqB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,eAMX;AAND,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,8BAAW,CAAA;AACf,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,iCAAa,CAAA;IACb,iCAAa,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,yDAAmC,CAAA;IACnC,oEAA8C,CAAA;AAClD,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,+BAIX;AAJD,WAAY,+BAA+B;IACvC,gDAAa,CAAA;IACb,kDAAe,CAAA;IACf,oDAAiB,CAAA;AACrB,CAAC,EAJW,+BAA+B,+CAA/B,+BAA+B,QAI1C;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;AACrB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,6CAAmB,CAAA;IACnB,2CAAiB,CAAA;AACrB,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;AACpC,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB","sourcesContent":["import * as React from 'react';\n\nimport {ButtonView, ButtonProps as UikitButtonProps} from '@gravity-ui/uikit';\n\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase, AnalyticsEventsProp, ClassNameProps, QAProps} from '../common';\n\n// enums\nexport enum AuthorType {\n Column = 'column',\n Line = 'line',\n}\n\nexport enum PriceDetailsType {\n MARKED_LIST = 'marked-list',\n SETTINGS = 'settings',\n}\n\nexport enum PriceLabelColor {\n BLUE = 'blue',\n GREEN = 'green',\n YELLOW = 'yellow',\n PURPLE = 'purple',\n RED = 'red',\n}\n\nexport enum PlayButtonType {\n Default = 'default',\n Text = 'text',\n}\n\nexport enum PlayButtonThemes {\n Blue = 'blue',\n Grey = 'grey',\n}\n\nexport enum CustomControlsType {\n WithMuteButton = 'with-mute-button',\n WithPlayPauseButton = 'with-play-pause-button',\n}\n\nexport enum CustomControlsButtonPositioning {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n}\n\nexport enum MediaVideoType {\n Default = 'default',\n Player = 'player',\n}\n\nexport enum MediaVideoControlsType {\n Default = 'default',\n Custom = 'custom',\n}\n\nexport enum QuoteType {\n Chevron = 'chevron', // « »\n EnglishDouble = 'english-double', // “ ”\n}\n\n// types\nexport type TextTheme = 'light' | 'dark';\nexport type TextSize = 'xs' | 's' | 'sm' | 'm' | 'l';\nexport type DividerSize = '0' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\nexport type HeaderWidth = 's' | 'm' | 'l';\nexport type HeaderImageSize = 's' | 'm';\nexport type HeaderOffset = 'default' | 'large';\nexport type Justify = 'start' | 'center' | 'end';\nexport type ColumnsCount = 1 | 2 | 3 | 4;\nexport type LegendTableMarkerType = 'disk' | 'tick';\nexport type LinkTheme = 'file-link' | 'normal' | 'back' | 'underline';\nexport type MediaDirection = 'media-content' | 'content-media';\nexport type PriceDescriptionColor = 'cornflower' | 'black';\nexport type ContentSize = 's' | 'm' | 'l';\nexport type ContentTextSize = 's' | 'm' | 'l';\nexport type ContentTheme = 'default' | 'dark' | 'light';\nexport type FileLinkType = 'vertical' | 'horizontal';\nexport type ImageCardMargins = 's' | 'm';\nexport type LayoutItemContentMargin = 'm' | 'l';\n\n// modifiers\nexport interface Themable {\n theme?: TextTheme;\n}\n\nexport interface Justifyable {\n justify?: Justify;\n}\n\nexport interface Stylable {\n className?: string;\n}\n\nexport interface Animatable {\n animated?: boolean;\n}\n\nexport interface Tabbable {\n tabIndex?: number;\n}\n\nexport interface Roleable {\n role?: React.AriaRole;\n}\n\n//common props\nexport interface Background {\n image?: string;\n color?: string;\n}\n\nexport interface AnchorProps {\n text: string;\n url: string;\n}\n\n/**\n * @deprecated Component VideoBlock will be deleted, which uses this logic\n */\ninterface LoopProps {\n start: number;\n end?: number;\n}\n\n// images\n\nexport interface ImageInfoProps\n extends Pick<\n React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>,\n 'aria-describedby' | 'loading'\n > {\n alt?: string;\n fetchPriority?: 'high' | 'low' | 'auto';\n disableCompress?: boolean;\n}\n\nexport interface ImageObjectProps extends ImageInfoProps {\n src: string;\n}\n\nexport interface ImageDeviceProps extends ImageInfoProps {\n desktop: string;\n mobile: string;\n tablet?: string;\n}\n\nexport type ImageProps = string | ImageObjectProps | ImageDeviceProps;\nexport type ThemedImage = ThemeSupporting<ImageProps>;\n\nexport interface BackgroundImageProps\n extends React.HTMLProps<HTMLDivElement>,\n Partial<ImageDeviceProps>,\n Partial<ImageObjectProps>,\n QAProps {\n style?: React.CSSProperties;\n imageClassName?: string;\n hide?: boolean;\n}\n\n//components props\nexport interface MediaVideoProps extends AnalyticsEventsBase {\n src: string[];\n type?: MediaVideoType;\n loop?: LoopProps | boolean;\n muted?: boolean;\n autoplay?: boolean;\n elapsedTime?: number;\n playButton?: PlayButtonProps;\n controls?: MediaVideoControlsType;\n customControlsOptions?: CustomControlsOptions;\n ariaLabel?: string;\n contain?: boolean;\n}\n\n// links\nexport interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {\n url: string;\n urlTitle?: string;\n text?: string;\n textSize?: TextSize;\n theme?: LinkTheme;\n colorTheme?: TextTheme;\n arrow?: boolean;\n target?: string;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\nexport interface FileLinkProps extends ClassNameProps, Tabbable {\n href: string;\n text: React.ReactNode;\n type?: FileLinkType;\n textSize?: TextSize;\n theme?: ContentTheme;\n urlTitle?: string;\n onClick?: () => void;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\n// buttons\nexport type ButtonTheme =\n | ButtonView\n | 'github'\n | 'app-store'\n | 'google-play'\n | 'scale'\n | 'monochrome';\n\nexport interface ButtonProps\n extends AnalyticsEventsBase,\n Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {\n text: string;\n url: string;\n urlTitle?: string;\n primary?: boolean;\n theme?: ButtonTheme;\n img?: ButtonImageProps | string;\n target?: string;\n}\n\nexport type ButtonImagePosition = 'left' | 'right';\n\nexport interface ButtonImageProps {\n url: string;\n position?: ButtonImagePosition;\n alt?: string;\n}\n\nexport interface CustomControlsOptions {\n type?: CustomControlsType;\n muteButtonShown?: boolean;\n positioning?: CustomControlsButtonPositioning;\n}\n\nexport interface PlayButtonProps extends ClassNameProps {\n type?: PlayButtonType;\n theme?: PlayButtonThemes;\n text?: string;\n}\n\nexport type ThemedMediaVideoProps = ThemeSupporting<MediaVideoProps>;\n\nexport interface MediaComponentVideoProps extends AnalyticsEventsBase {\n video: MediaVideoProps;\n height?: number;\n ratio?: number | 'auto';\n previewImg?: string;\n}\n\nexport interface MediaComponentVideoIframeProps {\n videoIframe: string;\n}\n\nexport interface MediaComponentYoutubeProps {\n youtube: string;\n previewImg?: string;\n fullscreen?: boolean;\n}\n\nexport interface MediaComponentImageProps {\n image: ImageProps | ImageProps[] | ImageDeviceProps;\n video?: MediaVideoProps;\n parallax?: boolean;\n height?: number;\n disableImageSliderForArrayInput?: boolean;\n}\n\nexport interface MediaComponentDataLensProps {\n dataLens: DataLensProps;\n}\n\nexport interface MediaComponentIframeProps {\n iframe: IframeProps;\n margins?: boolean;\n}\n\nexport interface MediaProps\n extends Animatable,\n Partial<MediaComponentDataLensProps>,\n Partial<MediaComponentYoutubeProps>,\n Partial<MediaComponentVideoIframeProps>,\n Partial<MediaComponentImageProps>,\n Partial<MediaComponentIframeProps>,\n Partial<MediaComponentVideoProps> {\n color?: string;\n videoMicrodata?: {\n name?: string;\n description?: string;\n duration?: string;\n uploadDate?: string;\n contentUrl?: string;\n thumbnailUrl?: string;\n };\n}\n\nexport interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {\n fullWidthMedia?: boolean;\n className?: string;\n mediaClassName?: string;\n}\n\nexport type Coordinate = number[];\n\nexport interface MapBaseProps {\n zoom?: number;\n className?: string;\n}\n\nexport interface GMapProps extends MapBaseProps {\n address: string;\n}\n\nexport interface YMapProps extends MapBaseProps {\n markers: YMapMarker[];\n id: string;\n}\n\nexport interface YMapMarker {\n address?: string;\n coordinate?: Coordinate;\n label?: YMapMarkerLabel;\n}\n\nexport interface YMapMarkerLabel {\n iconCaption?: string;\n iconContent?: string;\n iconColor?: string;\n preset?: string;\n}\n\nexport type MapProps = GMapProps | YMapProps;\n\nexport type ThemedMediaProps = ThemeSupporting<MediaProps>;\n\nexport interface DataLensObjectProps {\n id: string;\n theme: 'dark' | 'light';\n}\n\nexport interface IframeProps {\n src: string;\n width?: number;\n height?: number;\n title?: string;\n name?: string;\n}\n\nexport type DataLensProps = string | DataLensObjectProps;\n\nexport interface AuthorItem {\n firstName: string;\n secondName: string;\n description?: string;\n avatar?: ThemeSupporting<ImageProps> | JSX.Element;\n}\n\nexport interface HeaderBreadCrumbsProps extends ClassNameProps {\n items: {\n url: string;\n text: React.ReactNode;\n }[];\n theme?: TextTheme;\n analyticsEvents?: AnalyticsEventsProp;\n}\n\nexport interface TitleItemProps extends Justifyable, TitleItemBaseProps {\n navTitle?: string;\n anchor?: string;\n}\n\nexport interface TitleItemBaseProps {\n text: string;\n textSize?: TextSize;\n url?: string;\n urlTitle?: string;\n custom?: string | React.ReactNode;\n onClick?: () => void;\n}\n\nexport type MediaView = 'fit' | 'full';\n\n// card\nexport type MediaBorder = 'shadow' | 'line' | 'none';\nexport type CardBorder = MediaBorder;\nexport type ControlPosition = 'content' | 'footer';\n\nexport interface CardBaseProps {\n border?: CardBorder;\n}\n\nexport type CardLayoutProps = {\n controlPosition?: ControlPosition;\n};\n\n//price\nexport interface PriceDescriptionProps {\n title: string;\n detailedTitle?: string;\n description: string;\n label?: {\n color: PriceLabelColor;\n text?: string;\n size?: TextSize;\n };\n}\n\nexport interface PriceDetailsSettingsProps {\n title: string;\n description: string;\n}\n\nexport interface PriceDetailsListProps {\n text: string;\n}\n\nexport interface PriceDetailsProps {\n items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[];\n}\n\nexport interface PriceItemProps\n extends PriceDetailsProps,\n PriceDescriptionProps,\n AnalyticsEventsBase {}\n\nexport interface PriceFoldableDetailsProps {\n title: string;\n size?: TextSize;\n titleColor?: PriceDescriptionColor;\n}\n\n/** @deprecated */\nexport interface PriceDetailedProps extends CardBaseProps {\n items: PriceItemProps[];\n description?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n titleColor?: PriceDescriptionColor;\n };\n details?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n };\n priceType?: PriceDetailsType;\n numberGroupItems?: 3 | 4 | 5;\n isCombined?: boolean;\n useMixedView?: boolean;\n foldable?: PriceFoldableDetailsProps;\n labelsDefaultText?: Record<PriceLabelColor, string>;\n}\n\nexport interface AuthorProps extends QAProps {\n author: AuthorItem;\n className?: string;\n authorContainerClassName?: string;\n type?: AuthorType;\n theme?: ContentTheme;\n}\n\nexport interface TitleProps {\n title?: TitleItemProps | string;\n subtitle?: string;\n}\n\nexport interface YandexFormProps extends AnalyticsEventsBase {\n id: number | string;\n containerId?: string;\n theme?: string;\n className?: string;\n headerHeight?: number;\n customFormOrigin?: string;\n customFormSection?: string;\n params?: {[key: string]: string};\n\n onSubmit?: () => void;\n onLoad?: () => void;\n}\n\nexport interface WithBorder {\n border?: MediaBorder;\n /**\n * @deprecated use custom class for media-component\n */\n disableShadow?: boolean;\n}\n"]}
1
+ {"version":3,"file":"common.js","sourceRoot":"../../../../src","sources":["models/constructor-items/common.ts"],"names":[],"mappings":";;;AAOA,QAAQ;AACR,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,+CAA2B,CAAA;IAC3B,yCAAqB,CAAA;AACzB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,eAMX;AAND,WAAY,eAAe;IACvB,gCAAa,CAAA;IACb,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,8BAAW,CAAA;AACf,CAAC,EANW,eAAe,+BAAf,eAAe,QAM1B;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;AACjB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,iCAAa,CAAA;IACb,iCAAa,CAAA;AACjB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC1B,yDAAmC,CAAA;IACnC,oEAA8C,CAAA;AAClD,CAAC,EAHW,kBAAkB,kCAAlB,kBAAkB,QAG7B;AAED,IAAY,+BAIX;AAJD,WAAY,+BAA+B;IACvC,gDAAa,CAAA;IACb,kDAAe,CAAA;IACf,oDAAiB,CAAA;AACrB,CAAC,EAJW,+BAA+B,+CAA/B,+BAA+B,QAI1C;AAED,IAAY,cAGX;AAHD,WAAY,cAAc;IACtB,qCAAmB,CAAA;IACnB,mCAAiB,CAAA;AACrB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAED,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAC9B,6CAAmB,CAAA;IACnB,2CAAiB,CAAA;AACrB,CAAC,EAHW,sBAAsB,sCAAtB,sBAAsB,QAGjC;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,gCAAmB,CAAA;IACnB,6CAAgC,CAAA;AACpC,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB","sourcesContent":["import * as React from 'react';\n\nimport {ButtonView, ButtonProps as UikitButtonProps} from '@gravity-ui/uikit';\n\nimport {ThemeSupporting} from '../../utils';\nimport {AnalyticsEventsBase, AnalyticsEventsProp, ClassNameProps, QAProps} from '../common';\n\n// enums\nexport enum AuthorType {\n Column = 'column',\n Line = 'line',\n}\n\nexport enum PriceDetailsType {\n MARKED_LIST = 'marked-list',\n SETTINGS = 'settings',\n}\n\nexport enum PriceLabelColor {\n BLUE = 'blue',\n GREEN = 'green',\n YELLOW = 'yellow',\n PURPLE = 'purple',\n RED = 'red',\n}\n\nexport enum PlayButtonType {\n Default = 'default',\n Text = 'text',\n}\n\nexport enum PlayButtonThemes {\n Blue = 'blue',\n Grey = 'grey',\n}\n\nexport enum CustomControlsType {\n WithMuteButton = 'with-mute-button',\n WithPlayPauseButton = 'with-play-pause-button',\n}\n\nexport enum CustomControlsButtonPositioning {\n Left = 'left',\n Right = 'right',\n Center = 'center',\n}\n\nexport enum MediaVideoType {\n Default = 'default',\n Player = 'player',\n}\n\nexport enum MediaVideoControlsType {\n Default = 'default',\n Custom = 'custom',\n}\n\nexport enum QuoteType {\n Chevron = 'chevron', // « »\n EnglishDouble = 'english-double', // “ ”\n}\n\n// types\nexport type TextTheme = 'light' | 'dark';\nexport type TextSize = 'xs' | 's' | 'sm' | 'm' | 'l';\nexport type DividerSize = '0' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl' | 'xxxl';\nexport type HeaderWidth = 's' | 'm' | 'l';\nexport type HeaderImageSize = 's' | 'm';\nexport type HeaderOffset = 'default' | 'large';\nexport type Justify = 'start' | 'center' | 'end';\nexport type ColumnsCount = 1 | 2 | 3 | 4;\nexport type LegendTableMarkerType = 'disk' | 'tick';\nexport type LinkTheme = 'file-link' | 'normal' | 'back' | 'underline';\nexport type MediaDirection = 'media-content' | 'content-media';\nexport type PriceDescriptionColor = 'cornflower' | 'black';\nexport type ContentSize = 's' | 'm' | 'l';\nexport type ContentTextSize = 's' | 'm' | 'l';\nexport type ContentTheme = 'default' | 'dark' | 'light';\nexport type FileLinkType = 'vertical' | 'horizontal';\nexport type ImageCardMargins = 's' | 'm';\nexport type LayoutItemContentMargin = 'm' | 'l';\n\n// modifiers\nexport interface Themable {\n theme?: TextTheme;\n}\n\nexport interface Justifyable {\n justify?: Justify;\n}\n\nexport interface Stylable {\n className?: string;\n}\n\nexport interface Animatable {\n animated?: boolean;\n}\n\nexport interface Tabbable {\n tabIndex?: number;\n}\n\nexport interface Roleable {\n role?: React.AriaRole;\n}\n\nexport interface AriaProps {\n ariaProps?: React.AriaAttributes;\n}\n\n//common props\nexport interface Background {\n image?: string;\n color?: string;\n}\n\nexport interface AnchorProps {\n text: string;\n url: string;\n}\n\n/**\n * @deprecated Component VideoBlock will be deleted, which uses this logic\n */\ninterface LoopProps {\n start: number;\n end?: number;\n}\n\n// images\n\nexport interface ImageInfoProps\n extends Pick<\n React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>,\n 'aria-describedby' | 'loading'\n > {\n alt?: string;\n fetchPriority?: 'high' | 'low' | 'auto';\n disableCompress?: boolean;\n}\n\nexport interface ImageObjectProps extends ImageInfoProps {\n src: string;\n}\n\nexport interface ImageDeviceProps extends ImageInfoProps {\n desktop: string;\n mobile: string;\n tablet?: string;\n}\n\nexport type ImageProps = string | ImageObjectProps | ImageDeviceProps;\nexport type ThemedImage = ThemeSupporting<ImageProps>;\n\nexport interface BackgroundImageProps\n extends React.HTMLProps<HTMLDivElement>,\n Partial<ImageDeviceProps>,\n Partial<ImageObjectProps>,\n QAProps {\n style?: React.CSSProperties;\n imageClassName?: string;\n hide?: boolean;\n}\n\n//components props\nexport interface MediaVideoProps extends AnalyticsEventsBase {\n src: string[];\n type?: MediaVideoType;\n loop?: LoopProps | boolean;\n muted?: boolean;\n autoplay?: boolean;\n elapsedTime?: number;\n playButton?: PlayButtonProps;\n controls?: MediaVideoControlsType;\n customControlsOptions?: CustomControlsOptions;\n ariaLabel?: string;\n contain?: boolean;\n}\n\n// links\nexport interface LinkProps extends AnalyticsEventsBase, Stylable, Tabbable {\n url: string;\n urlTitle?: string;\n text?: string;\n textSize?: TextSize;\n theme?: LinkTheme;\n colorTheme?: TextTheme;\n arrow?: boolean;\n target?: string;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\nexport interface FileLinkProps extends ClassNameProps, Tabbable {\n href: string;\n text: React.ReactNode;\n type?: FileLinkType;\n textSize?: TextSize;\n theme?: ContentTheme;\n urlTitle?: string;\n onClick?: () => void;\n extraProps?: React.HTMLProps<HTMLAnchorElement>;\n}\n\n// buttons\nexport type ButtonTheme =\n | ButtonView\n | 'github'\n | 'app-store'\n | 'google-play'\n | 'scale'\n | 'monochrome';\n\nexport interface ButtonProps\n extends AnalyticsEventsBase,\n Pick<UikitButtonProps, 'size' | 'width' | 'extraProps'> {\n text: string;\n url: string;\n urlTitle?: string;\n primary?: boolean;\n theme?: ButtonTheme;\n img?: ButtonImageProps | string;\n target?: string;\n}\n\nexport type ButtonImagePosition = 'left' | 'right';\n\nexport interface ButtonImageProps {\n url: string;\n position?: ButtonImagePosition;\n alt?: string;\n}\n\nexport interface CustomControlsOptions {\n type?: CustomControlsType;\n muteButtonShown?: boolean;\n positioning?: CustomControlsButtonPositioning;\n}\n\nexport interface PlayButtonProps extends ClassNameProps {\n type?: PlayButtonType;\n theme?: PlayButtonThemes;\n text?: string;\n}\n\nexport type ThemedMediaVideoProps = ThemeSupporting<MediaVideoProps>;\n\nexport interface MediaComponentVideoProps extends AnalyticsEventsBase {\n video: MediaVideoProps;\n height?: number;\n ratio?: number | 'auto';\n previewImg?: string;\n}\n\nexport interface MediaComponentVideoIframeProps {\n videoIframe: string;\n}\n\nexport interface MediaComponentYoutubeProps {\n youtube: string;\n previewImg?: string;\n fullscreen?: boolean;\n}\n\nexport interface MediaComponentImageProps {\n image: ImageProps | ImageProps[] | ImageDeviceProps;\n video?: MediaVideoProps;\n parallax?: boolean;\n height?: number;\n disableImageSliderForArrayInput?: boolean;\n}\n\nexport interface MediaComponentDataLensProps {\n dataLens: DataLensProps;\n}\n\nexport interface MediaComponentIframeProps {\n iframe: IframeProps;\n margins?: boolean;\n}\n\nexport interface MediaProps\n extends Animatable,\n Partial<MediaComponentDataLensProps>,\n Partial<MediaComponentYoutubeProps>,\n Partial<MediaComponentVideoIframeProps>,\n Partial<MediaComponentImageProps>,\n Partial<MediaComponentIframeProps>,\n Partial<MediaComponentVideoProps> {\n color?: string;\n videoMicrodata?: {\n name?: string;\n description?: string;\n duration?: string;\n uploadDate?: string;\n contentUrl?: string;\n thumbnailUrl?: string;\n };\n}\n\nexport interface BackgroundMediaProps extends MediaProps, Animatable, QAProps {\n fullWidthMedia?: boolean;\n className?: string;\n mediaClassName?: string;\n}\n\nexport type Coordinate = number[];\n\nexport interface MapBaseProps {\n zoom?: number;\n className?: string;\n}\n\nexport interface GMapProps extends MapBaseProps {\n address: string;\n}\n\nexport interface YMapProps extends MapBaseProps {\n markers: YMapMarker[];\n id: string;\n}\n\nexport interface YMapMarker {\n address?: string;\n coordinate?: Coordinate;\n label?: YMapMarkerLabel;\n}\n\nexport interface YMapMarkerLabel {\n iconCaption?: string;\n iconContent?: string;\n iconColor?: string;\n preset?: string;\n}\n\nexport type MapProps = GMapProps | YMapProps;\n\nexport type ThemedMediaProps = ThemeSupporting<MediaProps>;\n\nexport interface DataLensObjectProps {\n id: string;\n theme: 'dark' | 'light';\n}\n\nexport interface IframeProps {\n src: string;\n width?: number;\n height?: number;\n title?: string;\n name?: string;\n}\n\nexport type DataLensProps = string | DataLensObjectProps;\n\nexport interface AuthorItem {\n firstName: string;\n secondName: string;\n description?: string;\n avatar?: ThemeSupporting<ImageProps> | JSX.Element;\n}\n\nexport interface HeaderBreadCrumbsProps extends ClassNameProps {\n items: {\n url: string;\n text: React.ReactNode;\n }[];\n theme?: TextTheme;\n analyticsEvents?: AnalyticsEventsProp;\n}\n\nexport interface TitleItemProps extends Justifyable, TitleItemBaseProps {\n navTitle?: string;\n anchor?: string;\n}\n\nexport interface TitleItemBaseProps {\n text: string;\n textSize?: TextSize;\n url?: string;\n urlTitle?: string;\n custom?: string | React.ReactNode;\n onClick?: () => void;\n}\n\nexport type MediaView = 'fit' | 'full';\n\n// card\nexport type MediaBorder = 'shadow' | 'line' | 'none';\nexport type CardBorder = MediaBorder;\nexport type ControlPosition = 'content' | 'footer';\n\nexport interface CardBaseProps {\n border?: CardBorder;\n}\n\nexport type CardLayoutProps = {\n controlPosition?: ControlPosition;\n};\n\n//price\nexport interface PriceDescriptionProps {\n title: string;\n detailedTitle?: string;\n description: string;\n label?: {\n color: PriceLabelColor;\n text?: string;\n size?: TextSize;\n };\n}\n\nexport interface PriceDetailsSettingsProps {\n title: string;\n description: string;\n}\n\nexport interface PriceDetailsListProps {\n text: string;\n}\n\nexport interface PriceDetailsProps {\n items?: PriceDetailsSettingsProps[] | PriceDetailsListProps[];\n}\n\nexport interface PriceItemProps\n extends PriceDetailsProps,\n PriceDescriptionProps,\n AnalyticsEventsBase {}\n\nexport interface PriceFoldableDetailsProps {\n title: string;\n size?: TextSize;\n titleColor?: PriceDescriptionColor;\n}\n\n/** @deprecated */\nexport interface PriceDetailedProps extends CardBaseProps {\n items: PriceItemProps[];\n description?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n titleColor?: PriceDescriptionColor;\n };\n details?: {\n titleSize?: TextSize;\n descriptionSize?: TextSize;\n };\n priceType?: PriceDetailsType;\n numberGroupItems?: 3 | 4 | 5;\n isCombined?: boolean;\n useMixedView?: boolean;\n foldable?: PriceFoldableDetailsProps;\n labelsDefaultText?: Record<PriceLabelColor, string>;\n}\n\nexport interface AuthorProps extends QAProps {\n author: AuthorItem;\n className?: string;\n authorContainerClassName?: string;\n type?: AuthorType;\n theme?: ContentTheme;\n}\n\nexport interface TitleProps {\n title?: TitleItemProps | string;\n subtitle?: string;\n}\n\nexport interface YandexFormProps extends AnalyticsEventsBase {\n id: number | string;\n containerId?: string;\n theme?: string;\n className?: string;\n headerHeight?: number;\n customFormOrigin?: string;\n customFormSection?: string;\n params?: {[key: string]: string};\n\n onSubmit?: () => void;\n onLoad?: () => void;\n}\n\nexport interface WithBorder {\n border?: MediaBorder;\n /**\n * @deprecated use custom class for media-component\n */\n disableShadow?: boolean;\n}\n"]}
@@ -13,6 +13,8 @@ unpredictable css rules order in build */
13
13
  border-radius: calc(var(--pc-border-radius) / 2);
14
14
  background: var(--g-color-base-float);
15
15
  box-shadow: 0 3px 10px var(--g-color-sfx-shadow);
16
+ font-size: var(--g-text-body-2-font-size);
17
+ line-height: var(--g-text-body-2-line-height);
16
18
  }
17
19
  .pc-navigation-popup__list {
18
20
  margin: 0;
@@ -9,11 +9,19 @@ const models_1 = require("../../models.js");
9
9
  const NavigationItem_1 = tslib_1.__importDefault(require("../NavigationItem/index.js"));
10
10
  const b = (0, utils_1.block)('navigation-popup');
11
11
  const OFFSET_RESET = { mainAxis: 0, crossAxis: 0 };
12
- const NavigationPopup = ({ anchorRef, items, onClose, open, }) => ((0, jsx_runtime_1.jsx)(uikit_1.Popup
13
- // Workaround to recalculate position on every opening. Required for valid position calculation for scrolled header links.
14
- , {
15
- // Workaround to recalculate position on every opening. Required for valid position calculation for scrolled header links.
16
- anchorRef: open ? anchorRef : undefined, open: open, onClose: onClose, onOutsideClick: onClose, keepMounted: true, disablePortal: true, strategy: "fixed", placement: "bottom-start", offset: OFFSET_RESET, children: (0, jsx_runtime_1.jsx)("ul", { className: b('list'), children: items.map((item) => ((0, jsx_runtime_1.jsx)(NavigationItem_1.default, { className: b('link'), data: item, menuLayout: models_1.NavigationLayout.Dropdown }, item.text))) }) }));
12
+ const NavigationPopup = ({ anchorRef, items, onClose, open, }) => {
13
+ // Opening and closing is controlled by the associated button,
14
+ // but in order to give the popup control over closing as well (e.g. on click outside or escape key press)
15
+ // there needs to be an awkward looking handler like this.
16
+ const onOpenChange = (isOpen) => {
17
+ if (!isOpen) {
18
+ onClose();
19
+ }
20
+ };
21
+ return ((0, jsx_runtime_1.jsx)(uikit_1.Popup, { className: b(),
22
+ // Workaround to recalculate position on every opening. Required for valid position calculation for scrolled header links.
23
+ anchorElement: anchorRef.current, open: open, onOpenChange: onOpenChange, keepMounted: true, strategy: "fixed", placement: "bottom-start", offset: OFFSET_RESET, children: (0, jsx_runtime_1.jsx)("ul", { className: b('list'), children: items.map((item) => ((0, jsx_runtime_1.jsx)(NavigationItem_1.default, { className: b('link'), data: item, menuLayout: models_1.NavigationLayout.Dropdown }, item.text))) }) }));
24
+ };
17
25
  exports.NavigationPopup = NavigationPopup;
18
26
  exports.default = exports.NavigationPopup;
19
27
  //# sourceMappingURL=NavigationPopup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationPopup.js","sourceRoot":"../../../../../src","sources":["navigation/components/NavigationPopup/NavigationPopup.tsx"],"names":[],"mappings":";;;;;AAEA,6CAAwC;AAExC,mDAAqC;AACrC,4CAAoE;AACpE,wFAA+C;AAI/C,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,kBAAkB,CAAC,CAAC;AACpC,MAAM,YAAY,GAA4C,EAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAC,CAAC;AAEnF,MAAM,eAAe,GAAmC,CAAC,EAC5D,SAAS,EACT,KAAK,EACL,OAAO,EACP,IAAI,GACP,EAAE,EAAE,CAAC,CACF,uBAAC,aAAK;AACF,0HAA0H;;IAA1H,0HAA0H;IAC1H,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,OAAO,EACvB,WAAW,QACX,aAAa,QACb,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAC,cAAc,EACxB,MAAM,EAAE,YAAY,YAEpB,+BAAI,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,YACnB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACjB,uBAAC,wBAAc,IAEX,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EACpB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,yBAAgB,CAAC,QAAQ,IAHhC,IAAI,CAAC,IAAI,CAIhB,CACL,CAAC,GACD,GACD,CACX,CAAC;AA7BW,QAAA,eAAe,mBA6B1B;AAEF,kBAAe,uBAAe,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Popup} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils';\nimport {NavigationLayout, NavigationPopupProps} from '../../models';\nimport NavigationItem from '../NavigationItem';\n\nimport './NavigationPopup.scss';\n\nconst b = block('navigation-popup');\nconst OFFSET_RESET: {mainAxis?: number; crossAxis?: number} = {mainAxis: 0, crossAxis: 0};\n\nexport const NavigationPopup: React.FC<NavigationPopupProps> = ({\n anchorRef,\n items,\n onClose,\n open,\n}) => (\n <Popup\n // Workaround to recalculate position on every opening. Required for valid position calculation for scrolled header links.\n anchorRef={open ? anchorRef : undefined}\n open={open}\n onClose={onClose}\n onOutsideClick={onClose}\n keepMounted\n disablePortal\n strategy=\"fixed\"\n placement=\"bottom-start\"\n offset={OFFSET_RESET}\n >\n <ul className={b('list')}>\n {items.map((item) => (\n <NavigationItem\n key={item.text}\n className={b('link')}\n data={item}\n menuLayout={NavigationLayout.Dropdown}\n />\n ))}\n </ul>\n </Popup>\n);\n\nexport default NavigationPopup;\n"]}
1
+ {"version":3,"file":"NavigationPopup.js","sourceRoot":"../../../../../src","sources":["navigation/components/NavigationPopup/NavigationPopup.tsx"],"names":[],"mappings":";;;;;AAEA,6CAAwC;AAExC,mDAAqC;AACrC,4CAAoE;AACpE,wFAA+C;AAI/C,MAAM,CAAC,GAAG,IAAA,aAAK,EAAC,kBAAkB,CAAC,CAAC;AACpC,MAAM,YAAY,GAA4C,EAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAC,CAAC;AAEnF,MAAM,eAAe,GAAmC,CAAC,EAC5D,SAAS,EACT,KAAK,EACL,OAAO,EACP,IAAI,GACP,EAAE,EAAE;IACD,8DAA8D;IAC9D,0GAA0G;IAC1G,0DAA0D;IAC1D,MAAM,YAAY,GAAG,CAAC,MAAe,EAAE,EAAE;QACrC,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACH,uBAAC,aAAK,IACF,SAAS,EAAE,CAAC,EAAE;QACd,0HAA0H;QAC1H,aAAa,EAAE,SAAS,CAAC,OAAO,EAChC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,WAAW,QACX,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAC,cAAc,EACxB,MAAM,EAAE,YAAY,YAEpB,+BAAI,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,YACnB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACjB,uBAAC,wBAAc,IAEX,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EACpB,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,yBAAgB,CAAC,QAAQ,IAHhC,IAAI,CAAC,IAAI,CAIhB,CACL,CAAC,GACD,GACD,CACX,CAAC;AACN,CAAC,CAAC;AAvCW,QAAA,eAAe,mBAuC1B;AAEF,kBAAe,uBAAe,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {Popup} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils';\nimport {NavigationLayout, NavigationPopupProps} from '../../models';\nimport NavigationItem from '../NavigationItem';\n\nimport './NavigationPopup.scss';\n\nconst b = block('navigation-popup');\nconst OFFSET_RESET: {mainAxis?: number; crossAxis?: number} = {mainAxis: 0, crossAxis: 0};\n\nexport const NavigationPopup: React.FC<NavigationPopupProps> = ({\n anchorRef,\n items,\n onClose,\n open,\n}) => {\n // Opening and closing is controlled by the associated button,\n // but in order to give the popup control over closing as well (e.g. on click outside or escape key press)\n // there needs to be an awkward looking handler like this.\n const onOpenChange = (isOpen: boolean) => {\n if (!isOpen) {\n onClose();\n }\n };\n\n return (\n <Popup\n className={b()}\n // Workaround to recalculate position on every opening. Required for valid position calculation for scrolled header links.\n anchorElement={anchorRef.current}\n open={open}\n onOpenChange={onOpenChange}\n keepMounted\n strategy=\"fixed\"\n placement=\"bottom-start\"\n offset={OFFSET_RESET}\n >\n <ul className={b('list')}>\n {items.map((item) => (\n <NavigationItem\n key={item.text}\n className={b('link')}\n data={item}\n menuLayout={NavigationLayout.Dropdown}\n />\n ))}\n </ul>\n </Popup>\n );\n};\n\nexport default NavigationPopup;\n"]}
@@ -0,0 +1,77 @@
1
+ /* use this for style redefinitions to awoid problems with
2
+ unpredictable css rules order in build */
3
+ .pc-tab-content__col_centered {
4
+ margin: 0 auto;
5
+ }
6
+ .pc-tab-content__image {
7
+ width: 100%;
8
+ height: auto;
9
+ object-fit: cover;
10
+ display: block;
11
+ }
12
+ .pc-tab-content__image_border_shadow, .pc-tab-content__media_border_shadow {
13
+ box-shadow: 0 2px 8px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
14
+ overflow-x: hidden;
15
+ border-radius: var(--pc-border-radius);
16
+ }
17
+ .pc-tab-content__image_border_line, .pc-tab-content__media_border_line {
18
+ border-radius: var(--pc-border-radius);
19
+ border: 1px solid var(--g-color-line-generic);
20
+ }
21
+ .pc-tab-content__image_border_none, .pc-tab-content__media_border_none {
22
+ border-radius: var(--pc-border-radius);
23
+ }
24
+ .pc-tab-content__caption {
25
+ font-size: var(--g-text-body-2-font-size);
26
+ line-height: var(--g-text-body-2-line-height);
27
+ margin: 12px 0 0;
28
+ }
29
+ .pc-tab-content__caption.pc-tab-content__caption .yfm,
30
+ .pc-tab-content__caption.pc-tab-content__caption .yfm > * {
31
+ color: var(--g-color-text-secondary);
32
+ }
33
+ .pc-tab-content__caption.pc-tab-content__caption .yfm a {
34
+ color: var(--g-color-text-secondary);
35
+ text-decoration: underline;
36
+ }
37
+ .pc-tab-content__caption.pc-tab-content__caption .yfm a:hover {
38
+ color: var(--g-color-text-primary);
39
+ }
40
+
41
+ .pc-tab-content__row_hidden {
42
+ display: none;
43
+ }
44
+ .pc-tab-content__row_reverse {
45
+ flex-direction: row-reverse;
46
+ }
47
+ @media (max-width: 769px) {
48
+ .pc-tab-content__row_reverse {
49
+ flex-direction: column-reverse;
50
+ }
51
+ }
52
+ @media (min-width: 769px) {
53
+ .pc-tab-content.pc-AnimateBlock .pc-tab-content__media, .pc-AnimateBlock .pc-tab-content .pc-tab-content__media {
54
+ position: relative;
55
+ top: 100px;
56
+ opacity: 0;
57
+ }
58
+ .pc-tab-content.pc-AnimateBlock.animate .pc-tab-content__media, .pc-AnimateBlock .pc-tab-content.animate .pc-tab-content__media {
59
+ top: 0;
60
+ opacity: 1;
61
+ transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
62
+ transition-delay: 0s;
63
+ }
64
+ }
65
+ @media (min-width: 769px) {
66
+ .pc-tab-content.pc-AnimateBlock .pc-tab-content__image, .pc-AnimateBlock .pc-tab-content .pc-tab-content__image {
67
+ position: relative;
68
+ top: 100px;
69
+ opacity: 0;
70
+ }
71
+ .pc-tab-content.pc-AnimateBlock.animate .pc-tab-content__image, .pc-AnimateBlock .pc-tab-content.animate .pc-tab-content__image {
72
+ top: 0;
73
+ opacity: 1;
74
+ transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
75
+ transition-delay: 0s;
76
+ }
77
+ }
@@ -0,0 +1,13 @@
1
+ import { ContentSize, TabsBlockItem } from "../../../models/index.js";
2
+ import './TabContent.css';
3
+ export interface TabContentProps {
4
+ tabData: TabsBlockItem;
5
+ isActive: boolean;
6
+ isReverse: boolean;
7
+ contentSize: ContentSize;
8
+ centered?: boolean;
9
+ play: boolean;
10
+ getTabElementId?: (tabId: string) => string;
11
+ getTabContentElementId?: (tabId: string) => string;
12
+ }
13
+ export declare const TabContent: ({ tabData, isActive, isReverse, contentSize, centered, play, getTabElementId, getTabContentElementId, }: TabContentProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,66 @@
1
+ import { createElement as _createElement } from "react";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { ProjectSettingsContext } from "../../../context/projectSettingsContext/index.js";
5
+ import { block, getThemedValue } from "../../../utils/index.js";
6
+ 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
+ import { Col, GridColumnOrderClasses, Row } from "../../../grid/index.js";
11
+ import Media from "../../../components/Media/Media.js";
12
+ import { mergeVideoMicrodata } from "../../../utils/microdata.js";
13
+ import { FullscreenImage, YFMWrapper } from "../../../components/index.js";
14
+ import { useUniqId } from '@gravity-ui/uikit';
15
+ import './TabContent.css';
16
+ const b = block('tab-content');
17
+ export const TabContent = ({ tabData, isActive, isReverse, contentSize, centered, play, getTabElementId, getTabContentElementId, }) => {
18
+ const { tabName } = tabData;
19
+ const mediaContainerRef = React.useRef(null);
20
+ const theme = useTheme();
21
+ const { renderInvisibleBlocks } = React.useContext(ProjectSettingsContext);
22
+ const captionId = useUniqId();
23
+ const mediaWidth = mediaContainerRef?.current?.offsetWidth;
24
+ const [minImageHeight, setMinImageHeight] = React.useState(mediaContainerRef?.current?.offsetHeight);
25
+ const shouldRender = renderInvisibleBlocks || isActive;
26
+ const themedImage = getThemedValue(tabData.image, theme);
27
+ const themedMedia = getThemedValue(tabData.media, theme);
28
+ const hasNoImage = !themedMedia?.image && !tabData.image;
29
+ const mediaVideoHeight = hasNoImage && mediaWidth && getHeight(mediaWidth);
30
+ // TODO remove property support activeTabData?.image. Use only activeTabData?.media?.image
31
+ const imageProps = React.useMemo(() => {
32
+ const imagePropsResult = themedImage && getMediaImage(themedImage);
33
+ if (tabData.caption && imagePropsResult) {
34
+ Object.assign(imagePropsResult, {
35
+ 'aria-describedby': captionId,
36
+ });
37
+ }
38
+ return imagePropsResult;
39
+ }, [captionId, tabData.caption, themedImage]);
40
+ const handleImageHeight = React.useCallback(() => {
41
+ if (minImageHeight !== mediaContainerRef?.current?.offsetHeight) {
42
+ setMinImageHeight(mediaContainerRef?.current?.offsetHeight);
43
+ }
44
+ }, [minImageHeight]);
45
+ React.useEffect(() => {
46
+ handleImageHeight();
47
+ }, [isActive, handleImageHeight]);
48
+ if (!shouldRender) {
49
+ return null;
50
+ }
51
+ const showMedia = isActive && Boolean(tabData.media || imageProps);
52
+ const showText = Boolean(tabData.text);
53
+ const border = tabData.border || 'shadow';
54
+ const textContent = showText && (_jsx(TabsTextContent, { showMedia: showMedia, data: tabData, imageProps: imageProps || undefined, isReverse: isReverse, contentSize: contentSize, centered: centered }));
55
+ const mediaContent = showMedia && (_jsxs(Col, { sizes: { all: 12, md: 8 }, orders: {
56
+ all: GridColumnOrderClasses.Last,
57
+ md: GridColumnOrderClasses.First,
58
+ }, className: b('col', { centered: centered }), children: [tabData.media && (_jsx("div", { style: { minHeight: mediaVideoHeight || minImageHeight }, children: _jsx("div", { ref: mediaContainerRef, children: _createElement(Media, { ...mergeVideoMicrodata(getThemedValue(tabData.media, theme), {
59
+ name: tabData.tabName,
60
+ description: tabData.caption ? tabData.caption : undefined,
61
+ }), key: tabName, className: b('media', { border }), playVideo: play, height: mediaVideoHeight || undefined, onImageLoad: handleImageHeight }) }) })), imageProps && (_jsx(React.Fragment, { children: _jsx(FullscreenImage, { ...imageProps, imageClassName: b('image', { border }) }) })), tabData.caption && (_jsx("p", { className: b('caption'), id: captionId, children: _jsx(YFMWrapper, { content: tabData.caption, modifiers: { constructor: true }, id: captionId }) }))] }));
62
+ return (_jsxs(Row, { className: b('row', { reverse: isReverse, hidden: !isActive }), id: getTabContentElementId?.(tabName), role: "tabpanel", ariaProps: {
63
+ 'aria-labelledby': getTabElementId?.(tabName),
64
+ }, children: [mediaContent, textContent] }, tabName));
65
+ };
66
+ //# sourceMappingURL=TabContent.js.map
@@ -0,0 +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,sBAAsB,EAAC,yDAAgD;AAC/E,OAAO,EAAC,KAAK,EAAE,cAAc,EAAC,gCAAuB;AACrD,OAAO,EAAC,QAAQ,EAAC,wCAA+B;AAChD,OAAO,EAAC,SAAS,EAAC,qDAAkD;AACpE,OAAO,EAAC,aAAa,EAAC,iDAA8C;AACpE,OAAO,eAAe,8CAA2C;AACjE,OAAO,EAAC,GAAG,EAAE,sBAAsB,EAAE,GAAG,EAAC,+BAAsB;AAC/D,OAAO,KAAK,2CAAwC;AACpD,OAAO,EAAC,mBAAmB,EAAC,oCAAiC;AAC7D,OAAO,EAAC,eAAe,EAAE,UAAU,EAAC,qCAA4B;AAChE,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,kBAAkB,CAAC;AAE1B,MAAM,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC;AAa/B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACvB,OAAO,EACP,QAAQ,EACR,SAAS,E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5D,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';\nimport {ContentSize, TabsBlockItem} from '../../../models';\nimport {ProjectSettingsContext} from '../../../context/projectSettingsContext';\nimport {block, getThemedValue} from '../../../utils';\nimport {useTheme} from '../../../context/theme';\nimport {getHeight} from '../../../components/VideoBlock/VideoBlock';\nimport {getMediaImage} from '../../../components/Media/Image/utils';\nimport TabsTextContent from '../TabsTextContent/TabsTextContent';\nimport {Col, GridColumnOrderClasses, Row} from '../../../grid';\nimport Media from '../../../components/Media/Media';\nimport {mergeVideoMicrodata} from '../../../utils/microdata';\nimport {FullscreenImage, YFMWrapper} from '../../../components';\nimport {useUniqId} from '@gravity-ui/uikit';\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 <p className={b('caption')} id={captionId}>\n <YFMWrapper\n content={tabData.caption}\n modifiers={{constructor: true}}\n id={captionId}\n />\n </p>\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"]}
@@ -36,76 +36,4 @@ unpredictable css rules order in build */
36
36
  padding-left: 24px;
37
37
  padding-right: 16px;
38
38
  }
39
- }
40
- .pc-tabs-block__row_reverse {
41
- flex-direction: row-reverse;
42
- }
43
- .pc-tabs-block__image {
44
- width: 100%;
45
- height: auto;
46
- object-fit: cover;
47
- display: block;
48
- }
49
- .pc-tabs-block__image_border_shadow, .pc-tabs-block__media_border_shadow {
50
- box-shadow: 0 2px 8px var(--pc-color-sfx-shadow), 0 4px 24px var(--pc-color-sfx-shadow);
51
- overflow-x: hidden;
52
- border-radius: var(--pc-border-radius);
53
- }
54
- .pc-tabs-block__image_border_line, .pc-tabs-block__media_border_line {
55
- border-radius: var(--pc-border-radius);
56
- border: 1px solid var(--g-color-line-generic);
57
- }
58
- .pc-tabs-block__image_border_none, .pc-tabs-block__media_border_none {
59
- border-radius: var(--pc-border-radius);
60
- }
61
- .pc-tabs-block__caption {
62
- font-size: var(--g-text-body-2-font-size);
63
- line-height: var(--g-text-body-2-line-height);
64
- margin: 12px 0 0;
65
- }
66
- .pc-tabs-block__caption.pc-tabs-block__caption .yfm,
67
- .pc-tabs-block__caption.pc-tabs-block__caption .yfm > * {
68
- color: var(--g-color-text-secondary);
69
- }
70
- .pc-tabs-block__caption.pc-tabs-block__caption .yfm a {
71
- color: var(--g-color-text-secondary);
72
- text-decoration: underline;
73
- }
74
- .pc-tabs-block__caption.pc-tabs-block__caption .yfm a:hover {
75
- color: var(--g-color-text-primary);
76
- }
77
-
78
- .pc-tabs-block__col_centered {
79
- margin: 0 auto;
80
- }
81
- @media (max-width: 769px) {
82
- .pc-tabs-block__row_reverse {
83
- flex-direction: column-reverse;
84
- }
85
- }
86
- @media (min-width: 769px) {
87
- .pc-tabs-block.pc-AnimateBlock .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__media {
88
- position: relative;
89
- top: 100px;
90
- opacity: 0;
91
- }
92
- .pc-tabs-block.pc-AnimateBlock.animate .pc-tabs-block__media, .pc-AnimateBlock .pc-tabs-block.animate .pc-tabs-block__media {
93
- top: 0;
94
- opacity: 1;
95
- transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
96
- transition-delay: 0s;
97
- }
98
- }
99
- @media (min-width: 769px) {
100
- .pc-tabs-block.pc-AnimateBlock .pc-tabs-block__image, .pc-AnimateBlock .pc-tabs-block .pc-tabs-block__image {
101
- position: relative;
102
- top: 100px;
103
- opacity: 0;
104
- }
105
- .pc-tabs-block.pc-AnimateBlock.animate .pc-tabs-block__image, .pc-AnimateBlock .pc-tabs-block.animate .pc-tabs-block__image {
106
- top: 0;
107
- opacity: 1;
108
- transition: top 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
109
- transition-delay: 0s;
110
- }
111
39
  }
@@ -1,78 +1,34 @@
1
- import { createElement as _createElement } from "react";
2
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useUniqId } from '@gravity-ui/uikit';
4
2
  import * as React from 'react';
5
3
  import AnimateBlock from "../../components/AnimateBlock/AnimateBlock.js";
6
4
  import ButtonTabs from "../../components/ButtonTabs/ButtonTabs.js";
7
- import FullscreenImage from "../../components/FullscreenImage/FullscreenImage.js";
8
- import { getMediaImage } from "../../components/Media/Image/utils.js";
9
- import Media from "../../components/Media/Media.js";
10
5
  import Title from "../../components/Title/Title.js";
11
- import { getHeight } from "../../components/VideoBlock/VideoBlock.js";
12
- import YFMWrapper from "../../components/YFMWrapper/YFMWrapper.js";
13
- import { useTheme } from "../../context/theme/index.js";
14
- import { Col, GridColumnOrderClasses, GridJustifyContent, Row } from "../../grid/index.js";
15
- import { block, getThemedValue } from "../../utils/index.js";
16
- import { mergeVideoMicrodata } from "../../utils/microdata.js";
17
- import TabsTextContent from "./TabsTextContent/TabsTextContent.js";
6
+ import { Col, GridJustifyContent, Row } from "../../grid/index.js";
7
+ import { block } from "../../utils/index.js";
18
8
  import './Tabs.css';
9
+ import { TabContent } from "./TabContent/TabContent.js";
10
+ import { getUniqId } from '@gravity-ui/uikit';
19
11
  const b = block('tabs-block');
20
- // eslint-disable-next-line complexity
21
12
  export const TabsBlock = ({ items, title, description, animated, tabsColSizes, centered, direction = 'media-content', contentSize = 's', }) => {
22
13
  const [activeTab, setActiveTab] = React.useState(items[0].tabName);
23
14
  const [play, setPlay] = React.useState(false);
24
- const theme = useTheme();
25
15
  const tabs = items.map(({ tabName }) => ({ title: tabName, id: tabName }));
26
- const activeTabData = items.find(({ tabName }) => tabName === activeTab);
27
16
  const isReverse = direction === 'content-media';
28
- const ref = React.useRef(null);
29
- const mediaWidth = ref?.current?.offsetWidth;
30
- const captionId = useUniqId();
31
- const themedMedia = getThemedValue(activeTabData?.media, theme);
32
- const hasNoImage = !themedMedia?.image && !activeTabData?.image;
33
- const mediaVideoHeight = hasNoImage && mediaWidth && getHeight(mediaWidth);
34
- const [minImageHeight, setMinImageHeight] = React.useState(ref?.current?.offsetHeight);
35
- // TODO remove property support activeTabData?.image. Use only activeTabData?.media?.image
36
- let imageProps;
37
- const handleImageHeight = React.useCallback(() => {
38
- if (minImageHeight !== ref?.current?.offsetHeight) {
39
- setMinImageHeight(ref?.current?.offsetHeight);
40
- }
41
- }, [minImageHeight]);
42
- const onSelectTab = React.useCallback((id, e) => {
43
- setActiveTab(id);
17
+ const tabIds = React.useMemo(() => items.reduce((acc, { tabName }) => Object.assign(acc, { [tabName]: getUniqId() }), {}), [items]);
18
+ const getTabElementId = (tabId) => `${tabIds[tabId]}`;
19
+ const getTabContentElementId = (tabId) => `${tabIds[tabId]}-content`;
20
+ const onSelectTab = React.useCallback((tabId, e) => {
21
+ setActiveTab(tabId);
44
22
  e.currentTarget.scrollIntoView({
45
23
  inline: 'center',
46
24
  behavior: 'smooth',
47
25
  block: 'nearest',
48
26
  });
49
27
  }, []);
50
- React.useEffect(() => {
51
- handleImageHeight();
52
- }, [activeTab, handleImageHeight]);
53
- if (activeTabData) {
54
- const themedImage = getThemedValue(activeTabData?.image, theme);
55
- imageProps = themedImage && getMediaImage(themedImage);
56
- if (activeTabData.caption && imageProps) {
57
- Object.assign(imageProps, {
58
- 'aria-describedby': captionId,
59
- });
60
- }
61
- }
62
- const showMedia = Boolean(activeTabData?.media || imageProps);
63
- const showText = Boolean(activeTabData?.text);
64
- const border = activeTabData?.border || 'shadow';
65
- const textContent = showText && (_jsx(TabsTextContent, { showMedia: showMedia, data: activeTabData, imageProps: imageProps ? imageProps : undefined, isReverse: isReverse, contentSize: contentSize, centered: centered }));
66
- const mediaContent = showMedia && (_jsxs(Col, { sizes: { all: 12, md: 8 }, orders: {
67
- all: GridColumnOrderClasses.Last,
68
- md: GridColumnOrderClasses.First,
69
- }, className: b('col', { centered: centered }), children: [activeTabData?.media && (_jsx("div", { style: { minHeight: mediaVideoHeight || minImageHeight }, children: _jsx("div", { ref: ref, children: _createElement(Media, { ...mergeVideoMicrodata(getThemedValue(activeTabData.media, theme), {
70
- name: activeTabData.tabName,
71
- description: activeTabData.caption
72
- ? activeTabData.caption
73
- : undefined,
74
- }), key: activeTab, className: b('media', { border }), playVideo: play, height: mediaVideoHeight || undefined, onImageLoad: handleImageHeight }) }) })), imageProps && (_jsx(React.Fragment, { children: _jsx(FullscreenImage, { ...imageProps, imageClassName: b('image', { border }) }) })), activeTabData?.caption && (_jsx("p", { className: b('caption'), id: captionId, children: _jsx(YFMWrapper, { content: activeTabData.caption, modifiers: { constructor: true }, id: captionId }) }))] }));
75
- return (_jsxs(AnimateBlock, { className: b(), onScroll: () => setPlay(true), animate: animated, children: [_jsx(Title, { title: title, subtitle: description, className: b('title', { centered: centered }) }), _jsx(Row, { justifyContent: centered ? GridJustifyContent.Center : undefined, children: _jsx(Col, { sizes: tabsColSizes, children: _jsx(ButtonTabs, { items: tabs, onSelectTab: onSelectTab, activeTab: activeTab, className: b('tabs', { centered: centered }) }) }) }), activeTabData && (_jsxs(Row, { className: b('row', { reverse: isReverse }), children: [mediaContent, textContent] }))] }));
28
+ return (_jsxs(AnimateBlock, { className: b(), onScroll: () => setPlay(true), animate: animated, children: [_jsx(Title, { title: title, subtitle: description, className: b('title', { centered: centered }) }), _jsx(Row, { justifyContent: centered ? GridJustifyContent.Center : undefined, children: _jsx(Col, { sizes: tabsColSizes, children: _jsx(ButtonTabs, { items: tabs, onSelectTab: onSelectTab, activeTab: activeTab, className: b('tabs', { centered: centered }), getTabElementId: getTabElementId, getTabContentElementId: getTabContentElementId }) }) }), items.map((tabData) => {
29
+ const { tabName } = tabData;
30
+ return (_jsx(TabContent, { tabData: tabData, isActive: tabName === activeTab, isReverse: isReverse, contentSize: contentSize, centered: centered, play: play, getTabElementId: getTabElementId, getTabContentElementId: getTabContentElementId }, tabName));
31
+ })] }));
76
32
  };
77
33
  export default TabsBlock;
78
34
  //# sourceMappingURL=Tabs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","sourceRoot":"../../../../src","sources":["blocks/Tabs/Tabs.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,YAAY,sDAAmD;AACtE,OAAO,UAAiC,kDAA+C;AACvF,OAAO,eAAe,4DAAyD;AAC/E,OAAO,EAAC,aAAa,EAAC,8CAA2C;AACjE,OAAO,KAAK,wCAAqC;AACjD,OAAO,KAAK,wCAAqC;AACjD,OAAO,EAAC,SAAS,EAAC,kDAA+C;AACjE,OAAO,UAAU,kDAA+C;AAChE,OAAO,EAAC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AAK,EAAE,IAAI,EACX,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC,GAC5C,GACA,GACJ,EACL,aAAa,IAAI,CACd,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,CAAC,KAAK,EAAE,EAAC,OAAO,EAAE,SAAS,EAAC,CAAC,aACzC,YAAY,EACZ,WAAW,IACV,CACT,IACU,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {useUniqId} from '@gravity-ui/uikit';\nimport * as React from 'react';\n\nimport AnimateBlock from '../../components/AnimateBlock/AnimateBlock';\nimport ButtonTabs, {ButtonTabsItemProps} from '../../components/ButtonTabs/ButtonTabs';\nimport FullscreenImage from '../../components/FullscreenImage/FullscreenImage';\nimport {getMediaImage} from '../../components/Media/Image/utils';\nimport Media from '../../components/Media/Media';\nimport Title from '../../components/Title/Title';\nimport {getHeight} from '../../components/VideoBlock/VideoBlock';\nimport YFMWrapper from '../../components/YFMWrapper/YFMWrapper';\nimport {useTheme} from '../../context/theme';\nimport {Col, GridColumnOrderClasses, GridJustifyContent, Row} from '../../grid';\nimport {TabsBlockProps} from '../../models';\nimport {block, getThemedValue} from '../../utils';\nimport {mergeVideoMicrodata} from '../../utils/microdata';\n\nimport TabsTextContent from './TabsTextContent/TabsTextContent';\nimport './Tabs.scss';\n\nconst b = block('tabs-block');\n\n// eslint-disable-next-line complexity\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 const theme = useTheme();\n const tabs: ButtonTabsItemProps[] = items.map(({tabName}) => ({title: tabName, id: tabName}));\n const activeTabData = items.find(({tabName}) => tabName === activeTab);\n const isReverse = direction === 'content-media';\n const ref = React.useRef<HTMLDivElement>(null);\n const mediaWidth = ref?.current?.offsetWidth;\n const captionId = useUniqId();\n const themedMedia = getThemedValue(activeTabData?.media, theme);\n const hasNoImage = !themedMedia?.image && !activeTabData?.image;\n const mediaVideoHeight = hasNoImage && mediaWidth && getHeight(mediaWidth);\n const [minImageHeight, setMinImageHeight] = React.useState(ref?.current?.offsetHeight);\n // TODO remove property support activeTabData?.image. Use only activeTabData?.media?.image\n let imageProps;\n\n const handleImageHeight = React.useCallback(() => {\n if (minImageHeight !== ref?.current?.offsetHeight) {\n setMinImageHeight(ref?.current?.offsetHeight);\n }\n }, [minImageHeight]);\n\n const onSelectTab = React.useCallback(\n (id: string | null, e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n setActiveTab(id);\n e.currentTarget.scrollIntoView({\n inline: 'center',\n behavior: 'smooth',\n block: 'nearest',\n });\n },\n [],\n );\n\n React.useEffect(() => {\n handleImageHeight();\n }, [activeTab, handleImageHeight]);\n\n if (activeTabData) {\n const themedImage = getThemedValue(activeTabData?.image, theme);\n\n imageProps = themedImage && getMediaImage(themedImage);\n\n if (activeTabData.caption && imageProps) {\n Object.assign(imageProps, {\n 'aria-describedby': captionId,\n });\n }\n }\n\n const showMedia = Boolean(activeTabData?.media || imageProps);\n const showText = Boolean(activeTabData?.text);\n const border = activeTabData?.border || 'shadow';\n\n const textContent = showText && (\n <TabsTextContent\n showMedia={showMedia}\n data={activeTabData}\n imageProps={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 {activeTabData?.media && (\n <div style={{minHeight: mediaVideoHeight || minImageHeight}}>\n <div ref={ref}>\n <Media\n {...mergeVideoMicrodata(getThemedValue(activeTabData.media, theme), {\n name: activeTabData.tabName,\n description: activeTabData.caption\n ? activeTabData.caption\n : undefined,\n })}\n key={activeTab}\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 {activeTabData?.caption && (\n <p className={b('caption')} id={captionId}>\n <YFMWrapper\n content={activeTabData.caption}\n modifiers={{constructor: true}}\n id={captionId}\n />\n </p>\n )}\n </Col>\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 />\n </Col>\n </Row>\n {activeTabData && (\n <Row className={b('row', {reverse: isReverse})}>\n {mediaContent}\n {textContent}\n </Row>\n )}\n </AnimateBlock>\n );\n};\n\nexport default TabsBlock;\n"]}
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;AACtE,OAAO,UAAiC,kDAA+C;AACvF,OAAO,KAAK,wCAAqC;AACjD,OAAO,EAAC,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAC,4BAAmB;AAExD,OAAO,EAAC,KAAK,EAAC,6BAAoB;AAClC,OAAO,YAAY,CAAC;AACpB,OAAO,EAAC,UAAU,EAAC,mCAAgC;AACnD,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,MAAM,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAE9B,MAAM,CAAC,MAAM,SAAS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C,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import * as React from 'react';\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';\nimport './Tabs.scss';\nimport {TabContent} from './TabContent/TabContent';\nimport {getUniqId} from '@gravity-ui/uikit';\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"]}
@@ -3,6 +3,7 @@ import { ButtonProps as ButtonParams, QAProps } from "../../models/index.js";
3
3
  import './Button.css';
4
4
  export interface ButtonProps extends Omit<ButtonParams, 'url'>, QAProps {
5
5
  className?: string;
6
+ id?: string;
6
7
  url?: string;
7
8
  onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"../../../../src","sources":["components/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAClD,OAAO,EACH,MAAM,IAAI,YAAY,EACtB,IAAI,EACJ,QAAQ,GAEX,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,aAAa,EAAC,qDAAkD;AACxE,OAAO,EAAC,YAAY,EAAC,6BAAoB;AACzC,OAAO,EAAC,MAAM,EAAC,6BAAoB;AACnC,OAAO,EAA8B,iBAAiB,EAAU,8BAAqB;AACrF,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,6BAAoB;AAE7C,OAAO,EAAC,IAAI,EAAC,wBAAe;AAC5B,OAAO,EAAC,OAAO,EAAiC,YAAY,EAAE,YAAY,EAAC,mBAAgB;AAE3F,OAAO,cAAc,CAAC;AAQtB,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAEhC,sCAAsC;AACtC,MAAM,MAAM,GAAG,CAAC,KAAkB,EAAE,EAAE;IAClC,MAAM,EAAC,GAAG,EAAC,GAAG,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,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EACpD,gBAAM,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,aACxB,KAAK,IAAI,SAAS,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EACtD,eAAM,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,YAAG,IAAI,GAAQ,EACxC,KAAK,IAAI,SAAS,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,IACpD,EACN,IAAI,IAAI,SAAS,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAC1C,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import * as React from 'react';\n\nimport {StoreBadge} from '@gravity-ui/components';\nimport {\n Button as CommonButton,\n Icon,\n Platform,\n ButtonProps as UIKitButtonProps,\n} from '@gravity-ui/uikit';\n\nimport {LocaleContext} from '../../context/localeContext/localeContext';\nimport {useAnalytics} from '../../hooks';\nimport {Github} from '../../icons';\nimport {ButtonProps as ButtonParams, DefaultEventNames, QAProps} from '../../models';\nimport {block, setUrlTld} from '../../utils';\n\nimport {i18n} from './i18n';\nimport {ICON_QA, OldButtonSize, OldButtonTheme, toCommonSize, toCommonView} from './utils';\n\nimport './Button.scss';\n\nexport interface ButtonProps extends Omit<ButtonParams, 'url'>, QAProps {\n className?: string;\n url?: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;\n}\n\nconst b = block('button-block');\n\n// eslint-disable-next-line complexity\nconst Button = (props: ButtonProps) => {\n const {tld} = React.useContext(LocaleContext);\n const {\n className,\n analyticsEvents,\n size = 'l',\n theme = 'normal',\n url,\n urlTitle,\n img,\n onClick: onClickOrigin,\n text,\n width,\n ...rest\n } = props;\n const defaultImgPosition = 'left';\n const handleAnalytics = useAnalytics(DefaultEventNames.Button, url);\n const onClick = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n handleAnalytics(analyticsEvents);\n\n if (onClickOrigin) {\n onClickOrigin(e);\n }\n },\n [handleAnalytics, analyticsEvents, onClickOrigin],\n );\n\n const buttonModifiers = {size, theme, width};\n\n const buttonImg =\n img instanceof Object\n ? {url: img.url, position: img.position || defaultImgPosition, alt: img.alt}\n : {url: img, position: defaultImgPosition};\n\n const buttonClass = img\n ? b({position: buttonImg.position, ...buttonModifiers}, className)\n : b({...buttonModifiers}, className);\n\n const buttonProps = {\n ...rest,\n href: url ? setUrlTld(url, tld) : undefined,\n onClick,\n };\n\n if (theme === 'app-store' || theme === 'google-play') {\n const platform = theme === 'app-store' ? Platform.IOS : Platform.ANDROID;\n\n return <StoreBadge className={buttonClass} platform={platform} href={url as string} />;\n }\n\n let icon;\n let image = img && (\n <img className={b('image')} src={buttonImg.url} alt={buttonImg.alt || i18n('image-alt')} />\n );\n\n if (theme === 'github') {\n icon = <Icon className={b('icon')} data={Github} size={24} qa={ICON_QA} />;\n image = undefined;\n }\n\n const buttonTheme = theme === 'scale' ? 'accent' : theme;\n\n return (\n <CommonButton\n className={buttonClass}\n view={toCommonView(buttonTheme as OldButtonTheme)}\n size={toCommonSize(size as OldButtonSize)}\n title={urlTitle}\n width={width}\n {...(buttonProps as UIKitButtonProps)}\n >\n {icon && buttonImg.position === 'left' ? icon : null}\n <span className={b('content')}>\n {image && buttonImg.position === 'left' ? image : null}\n <span className={b('text')}>{text}</span>\n {image && buttonImg.position === 'right' ? image : null}\n </span>\n {icon && buttonImg.position === 'right' ? icon : null}\n </CommonButton>\n );\n};\n\nexport default Button;\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"../../../../src","sources":["components/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,UA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Icon,\n Platform,\n ButtonProps as UIKitButtonProps,\n} from '@gravity-ui/uikit';\n\nimport {LocaleContext} from '../../context/localeContext/localeContext';\nimport {useAnalytics} from '../../hooks';\nimport {Github} from '../../icons';\nimport {ButtonProps as ButtonParams, DefaultEventNames, QAProps} from '../../models';\nimport {block, setUrlTld} from '../../utils';\n\nimport {i18n} from './i18n';\nimport {ICON_QA, OldButtonSize, OldButtonTheme, toCommonSize, toCommonView} from './utils';\n\nimport './Button.scss';\n\nexport interface ButtonProps extends Omit<ButtonParams, 'url'>, QAProps {\n className?: string;\n id?: string;\n url?: string;\n onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;\n}\n\nconst b = block('button-block');\n\n// eslint-disable-next-line complexity\nconst Button = (props: ButtonProps) => {\n const {tld} = React.useContext(LocaleContext);\n const {\n className,\n analyticsEvents,\n size = 'l',\n theme = 'normal',\n url,\n urlTitle,\n img,\n onClick: onClickOrigin,\n text,\n width,\n ...rest\n } = props;\n const defaultImgPosition = 'left';\n const handleAnalytics = useAnalytics(DefaultEventNames.Button, url);\n const onClick = React.useCallback(\n (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n handleAnalytics(analyticsEvents);\n\n if (onClickOrigin) {\n onClickOrigin(e);\n }\n },\n [handleAnalytics, analyticsEvents, onClickOrigin],\n );\n\n const buttonModifiers = {size, theme, width};\n\n const buttonImg =\n img instanceof Object\n ? {url: img.url, position: img.position || defaultImgPosition, alt: img.alt}\n : {url: img, position: defaultImgPosition};\n\n const buttonClass = img\n ? b({position: buttonImg.position, ...buttonModifiers}, className)\n : b({...buttonModifiers}, className);\n\n const buttonProps = {\n ...rest,\n href: url ? setUrlTld(url, tld) : undefined,\n onClick,\n };\n\n if (theme === 'app-store' || theme === 'google-play') {\n const platform = theme === 'app-store' ? Platform.IOS : Platform.ANDROID;\n\n return <StoreBadge className={buttonClass} platform={platform} href={url as string} />;\n }\n\n let icon;\n let image = img && (\n <img className={b('image')} src={buttonImg.url} alt={buttonImg.alt || i18n('image-alt')} />\n );\n\n if (theme === 'github') {\n icon = <Icon className={b('icon')} data={Github} size={24} qa={ICON_QA} />;\n image = undefined;\n }\n\n const buttonTheme = theme === 'scale' ? 'accent' : theme;\n\n return (\n <CommonButton\n className={buttonClass}\n view={toCommonView(buttonTheme as OldButtonTheme)}\n size={toCommonSize(size as OldButtonSize)}\n title={urlTitle}\n width={width}\n {...(buttonProps as UIKitButtonProps)}\n >\n {icon && buttonImg.position === 'left' ? icon : null}\n <span className={b('content')}>\n {image && buttonImg.position === 'left' ? image : null}\n <span className={b('text')}>{text}</span>\n {image && buttonImg.position === 'right' ? image : null}\n </span>\n {icon && buttonImg.position === 'right' ? icon : null}\n </CommonButton>\n );\n};\n\nexport default Button;\n"]}
@@ -12,6 +12,8 @@ export interface ButtonTabsProps extends QAProps {
12
12
  activeTab?: string | null;
13
13
  onSelectTab?: (tabId: string | null, e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
14
14
  tabSize?: ButtonSize;
15
+ getTabElementId?: (tabId: string) => string;
16
+ getTabContentElementId?: (tabId: string) => string;
15
17
  }
16
18
  declare const ButtonTabs: React.FC<ButtonTabsProps>;
17
19
  export default ButtonTabs;
@@ -4,7 +4,7 @@ import { block } from "../../utils/index.js";
4
4
  import { Button } from "../index.js";
5
5
  import './ButtonTabs.css';
6
6
  const b = block('button-tabs');
7
- const ButtonTabs = ({ className, items, activeTab, onSelectTab, tabSize = 'l', qa, }) => {
7
+ const ButtonTabs = ({ className, items, activeTab, onSelectTab, tabSize = 'l', qa, getTabElementId, getTabContentElementId, }) => {
8
8
  const activeTabId = React.useMemo(() => {
9
9
  if (activeTab) {
10
10
  return activeTab;
@@ -18,9 +18,10 @@ const ButtonTabs = ({ className, items, activeTab, onSelectTab, tabSize = 'l', q
18
18
  }, [onSelectTab]);
19
19
  return (_jsx("div", { className: b(null, className), role: "tablist", "data-qa": qa, children: items.map(({ id, title }) => {
20
20
  const isActive = id === activeTabId;
21
- return (_jsx(Button, { text: title, className: b('item', { active: isActive }), size: tabSize, onClick: handleClick(id), extraProps: {
21
+ return (_jsx(Button, { text: title, className: b('item', { active: isActive }), size: tabSize, onClick: handleClick(id), id: getTabElementId?.(id ?? ''), extraProps: {
22
22
  role: 'tab',
23
23
  'aria-selected': isActive,
24
+ 'aria-controls': getTabContentElementId?.(id ?? ''),
24
25
  } }, title));
25
26
  }) }));
26
27
  };