UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 3.19 kB
{"version":3,"file":"Timeline.cjs","sources":["../../../src/components/Timeline/Timeline.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 { TimelineContext } from \"./TimelineContext\";\nimport type { TimelineItemTheme } from \"./TimelineItem\";\n\nexport interface TimelineTheme {\n root: {\n direction: {\n horizontal: string;\n vertical: string;\n };\n };\n item: TimelineItemTheme;\n}\n\nexport interface TimelineProps extends ComponentProps<\"ol\">, ThemingProps<TimelineTheme> {\n horizontal?: boolean;\n}\n\nexport const Timeline = forwardRef<HTMLOListElement, TimelineProps>((props, ref) => {\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [timelineTheme, provider.theme?.timeline, props.theme],\n [get(provider.clearTheme, \"timeline\"), props.clearTheme],\n [get(provider.applyTheme, \"timeline\"), props.applyTheme],\n );\n\n const { className, horizontal, ...restProps } = resolveProps(props, provider.props?.timeline);\n\n return (\n <TimelineContext.Provider\n value={{ theme: props.theme, clearTheme: props.clearTheme, applyTheme: props.applyTheme, horizontal }}\n >\n <ol\n ref={ref}\n data-testid=\"timeline-component\"\n className={twMerge(\n horizontal && theme.root.direction.horizontal,\n !horizontal && theme.root.direction.vertical,\n className,\n )}\n {...restProps}\n />\n </TimelineContext.Provider>\n );\n});\n\nTimeline.displayName = \"Timeline\";\n"],"names":["forwardRef","provider","useThemeProvider","theme","useResolveTheme","timelineTheme","get","resolveProps","jsx","TimelineContext","twMerge"],"mappings":";;;;;;;;;;;;AAWY,MAAC,QAAQ,GAAGA,gBAAU,CAAC,CAAC,KAAK,EAAE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