flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 5.02 kB
Source Map (JSON)
{"version":3,"file":"TimelinePoint.cjs","sources":["../../../src/components/Timeline/TimelinePoint.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type ComponentProps, type FC } 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 { useTimelineContext } from \"./TimelineContext\";\nimport { useTimelineItemContext } from \"./TimelineItemContext\";\n\nexport interface TimelinePointTheme {\n horizontal: string;\n line: string;\n marker: {\n base: {\n horizontal: string;\n vertical: string;\n };\n icon: {\n base: string;\n wrapper: string;\n };\n };\n vertical: string;\n}\n\nexport interface TimelinePointProps extends ComponentProps<\"div\">, ThemingProps<TimelinePointTheme> {\n icon?: FC<ComponentProps<\"svg\">>;\n}\n\nexport const TimelinePoint = forwardRef<HTMLDivElement, TimelinePointProps>((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.point,\n provider.theme?.timeline?.item?.point,\n rootTheme?.item?.point,\n itemTheme?.point,\n props.theme,\n ],\n [\n get(provider.clearTheme, \"timeline.item.point\"),\n get(rootClearTheme, \"item.point\"),\n get(itemClearTheme, \"point\"),\n props.clearTheme,\n ],\n [\n get(provider.applyTheme, \"timeline.item.point\"),\n get(rootApplyTheme, \"item.point\"),\n get(itemApplyTheme, \"point\"),\n props.applyTheme,\n ],\n );\n\n const { children, className, icon: Icon, ...restProps } = resolveProps(props, provider.props?.timelinePoint);\n\n return (\n <div\n ref={ref}\n data-testid=\"timeline-point\"\n className={twMerge(horizontal && theme.horizontal, !horizontal && theme.vertical, className)}\n {...restProps}\n >\n {children}\n {Icon ? (\n <span className={twMerge(theme.marker.icon.wrapper)}>\n <Icon aria-hidden className={twMerge(theme.marker.icon.base)} />\n </span>\n ) : (\n <div\n className={twMerge(horizontal && theme.marker.base.horizontal, !horizontal && theme.marker.base.vertical)}\n />\n )}\n {horizontal && <div className={twMerge(theme.line)} />}\n </div>\n );\n});\n\nTimelinePoint.displayName = \"TimelinePoint\";\n"],"names":["forwardRef","useTimelineContext","useTimelineItemContext","provider","useThemeProvider","theme","useResolveTheme","timelineTheme","get","resolveProps","jsxs","twMerge","jsx"],"mappings":";;;;;;;;;;;;;AAYY,MAAC,aAAa,GAAGA,gBAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACxD,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,KAAK;AAC9B,MAAMJ,UAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK;AAC3C,MAAM,SAAS,EAAE,IAAI,EAAE,KAAK;AAC5B,MAAM,SAAS,EAAE,KAAK;AACtB,MAAM,KAAK,CAAC;AACZ,KAAK;AACL,IAAI;AACJ,MAAMK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;AACrD,MAAMK,OAAG,CAAC,cAAc,EAAE,YAAY,CA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