UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 4.6 kB
{"version":3,"file":"TimelineContent.cjs","sources":["../../../src/components/Timeline/TimelineContent.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type ComponentProps } from \"react\";\nimport { get } from \"../../helpers/get\";\nimport { resolveProps } from \"../../helpers/resolve-props\";\nimport { useResolveTheme } from \"../../helpers/resolve-theme\";\nimport { twMerge } from \"../../helpers/tailwind-merge\";\nimport { useThemeProvider } from \"../../theme/provider\";\nimport type { ThemingProps } from \"../../types\";\nimport { timelineTheme } from \"./theme\";\nimport type { TimelineBodyTheme } from \"./TimelineBody\";\nimport { TimelineContentContext } from \"./TimelineContentContext\";\nimport { useTimelineContext } from \"./TimelineContext\";\nimport { useTimelineItemContext } from \"./TimelineItemContext\";\nimport type { TimelineTimeTheme } from \"./TimelineTime\";\nimport type { TimelineTitleTheme } from \"./TimelineTitle\";\n\nexport interface TimelineContentTheme {\n root: {\n base: string;\n horizontal: string;\n vertical: string;\n };\n time: TimelineTitleTheme;\n title: TimelineTimeTheme;\n body: TimelineBodyTheme;\n}\n\nexport interface TimelineContentProps extends ComponentProps<\"div\">, ThemingProps<TimelineContentTheme> {}\n\nexport const TimelineContent = forwardRef<HTMLDivElement, TimelineContentProps>((props, ref) => {\n const { theme: rootTheme, clearTheme: rootClearTheme, applyTheme: rootApplyTheme, horizontal } = useTimelineContext();\n const { theme: itemTheme, clearTheme: itemClearTheme, applyTheme: itemApplyTheme } = useTimelineItemContext();\n\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [\n timelineTheme.item.content,\n provider.theme?.timeline?.item?.content,\n rootTheme?.item?.content,\n itemTheme?.content,\n props.theme,\n ],\n [\n get(provider.clearTheme, \"timeline.item.content\"),\n get(rootClearTheme, \"item.content\"),\n get(itemClearTheme, \"content\"),\n props.clearTheme,\n ],\n [\n get(provider.applyTheme, \"timeline.item.content\"),\n get(rootApplyTheme, \"item.content\"),\n get(itemApplyTheme, \"content\"),\n props.applyTheme,\n ],\n );\n\n const { className, ...restProps } = resolveProps(props, provider.props?.timelineContent);\n\n return (\n <TimelineContentContext.Provider\n value={{ theme: props.theme, clearTheme: props.clearTheme, applyTheme: props.applyTheme }}\n >\n <div\n ref={ref}\n data-testid=\"timeline-content\"\n className={twMerge(theme.root.base, horizontal ? theme.root.horizontal : theme.root.vertical, className)}\n {...restProps}\n />\n </TimelineContentContext.Provider>\n );\n});\n\nTimelineContent.displayName = \"TimelineContent\";\n"],"names":["forwardRef","useTimelineContext","useTimelineItemContext","provider","useThemeProvider","theme","useResolveTheme","timelineTheme","get","resolveProps","jsx","TimelineContentContext","twMerge"],"mappings":";;;;;;;;;;;;;;AAaY,MAAC,eAAe,GAAGA,gBAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC1D,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,GAAGC,kCAAkB,EAAE;AACvH,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,GAAGC,0CAAsB,EAAE;AAC/G,EAAE,MAAMC,UAAQ,GAAGC,yBAAgB,EAAE;AACrC,EAAE,MAAMC,OAAK,GAAGC,4BAAe;AAC/B,IAAI;AACJ,MAAMC,mBAAa,CAAC,IAAI,CAAC,OAAO;AAChC,MAAMJ,UAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;AAC7C,MAAM,SAAS,EAAE,IAAI,EAAE,OAAO;AAC9B,MAAM,SAAS,EAAE,OAAO;AACxB,MAAM,KAAK,CAAC;AACZ,KAAK;AACL,IAAI;AACJ,MAAMK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,uBAAuB,CAAC;AACvD,MAAMK,OAAG,CAAC,cAAc,EAAE,cAAc,CAAC;AACzC,MAAMA,OAAG,CAA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