UNPKG

@enonic/react-components

Version:

Library of React components for handling Enonic XP data and page components

83 lines (63 loc) 5.02 kB
import { C as ComponentProps, a as ContentTypeData, L as LayoutData, M as MacroComponentParams, P as PageData, b as PartData, T as TextData, c as ComponentRegistry$1, d as ComponentDefinitionParams, e as ComponentDefinition, f as ComponentDataAndProps, g as MetaData, I as ImageComponentParams, h as LinkComponentParams, R as RichTextParams } from './nashorn-CCPK4uup.js'; export { J as COMPONENT_DATA_TYPE, j as ComponentData, i as ContentUri, E as ErrorData, B as ExtendedRichTextData, F as FragmentData, n as ImageComponent, o as ImageContent, p as ImageData, q as ImageStyle, r as LinkComponent, s as LinkData, t as LinkDataMedia, u as MacroComponent, m as MacroComponentData, v as MacroConfig, H as MacroData, w as MediaUri, l as RegionData, k as RegionsData, x as Replacer, y as ReplacerResult, G as RichTextComponentProps, A as RichTextData, D as RichTextMetaData, z as RichtextContent, X as XP_REQUEST_MODE } from './nashorn-CCPK4uup.js'; import * as react_jsx_runtime from 'react/jsx-runtime'; import * as React from 'react'; import React__default, { ReactNode, JSX } from 'react'; import { ClassValue } from 'clsx'; import { Component } from '@enonic-types/core'; import 'html-react-parser'; declare function ErrorComponent({ children, html, ...extraProps }: { children?: ReactNode; html?: string; }): react_jsx_runtime.JSX.Element; declare function HtmlComment({ comment }: { comment: string; }): React__default.JSX.Element; declare function BaseComponent({ component, data, common, meta }: ComponentProps): react_jsx_runtime.JSX.Element; declare const BaseContentType: ({ component, data, common, meta }: ComponentProps<ContentTypeData>) => JSX.Element; declare function BaseLayout({ component, data, common, meta }: ComponentProps<LayoutData>): JSX.Element | undefined; declare function BaseMacro<RestProps = Record<string, unknown>>({ children, meta, data, common, component, ...restProps }: MacroComponentParams<RestProps>): react_jsx_runtime.JSX.Element; declare function BasePage({ component, data, common, meta }: ComponentProps<PageData>): JSX.Element | undefined; declare function BasePart({ component, data, common, meta }: ComponentProps<PartData>): JSX.Element | undefined; declare const BaseText: ({ component, data, common, meta }: ComponentProps<TextData>) => JSX.Element; declare class ComponentRegistry implements ComponentRegistry$1 { private _contentTypes; private _pages; private _parts; private _layouts; private _macros; addContentType<PROPS = {}>(name: string, obj: ComponentDefinitionParams<PROPS>): void; addMacro<PROPS = {}>(name: string, obj: ComponentDefinitionParams<PROPS>): void; addLayout<PROPS = {}>(name: string, obj: ComponentDefinitionParams<PROPS>): void; addPage<PROPS = {}>(name: string, obj: ComponentDefinitionParams<PROPS>): void; addPart<PROPS = {}>(name: string, obj: ComponentDefinitionParams<PROPS>): void; getContentType<PROPS = {}>(name: string): ComponentDefinition<PROPS> | undefined; getLayout<PROPS = {}>(name: string): ComponentDefinition<PROPS> | undefined; getMacro<PROPS = {}>(name: string): ComponentDefinition<PROPS> | undefined; getPage<PROPS = {}>(name: string): ComponentDefinition<PROPS> | undefined; getPart<PROPS = {}>(name: string): ComponentDefinition<PROPS> | undefined; hasContentType(name: string): boolean; hasMacro(name: string): boolean; hasLayout(name: string): boolean; hasPage(name: string): boolean; hasPart(name: string): boolean; } interface RegionProps { as?: string; className?: ClassValue; data: ComponentDataAndProps[]; common?: Record<string, unknown>; meta: MetaData; name: string; } declare const Region: ({ as, className, common, meta, data, name }: RegionProps) => react_jsx_runtime.JSX.Element; declare function Regions({ common, component, meta }: ComponentProps): react_jsx_runtime.JSX.Element[] | null; declare function XpFallback({ data }: { data?: Component; }): JSX.Element | null; declare const Image: ({ alt, sizes, src, srcSet, style }: ImageComponentParams) => react_jsx_runtime.JSX.Element; declare const Link: ({ content: _content, media: _media, uri: _uri, ...aProps }: LinkComponentParams) => react_jsx_runtime.JSX.Element; declare function RichText<RestProps = Record<string, unknown>>({ tag, className, Image, Link, Macro, data, ...restProps }: RichTextParams<RestProps>): react_jsx_runtime.JSX.Element; declare function cssToReactStyle(cssString?: string): React.CSSProperties; declare const sanitizeGraphqlName: (text: string) => string; export { BaseComponent, BaseContentType, BaseLayout, BaseMacro, BasePage, BasePart, BaseText, ComponentDataAndProps, ComponentProps, ComponentRegistry, ContentTypeData, ErrorComponent, HtmlComment, Image, ImageComponentParams, LayoutData, Link, LinkComponentParams, MacroComponentParams, MetaData, PageData, PartData, Region, Regions, RichText, RichTextParams, TextData, XpFallback, cssToReactStyle, sanitizeGraphqlName };