UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 3.21 kB
{"version":3,"file":"NavbarCollapse.cjs","sources":["../../../src/components/Navbar/NavbarCollapse.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 { FlowbiteBoolean, ThemingProps } from \"../../types\";\nimport { useNavbarContext } from \"./NavbarContext\";\nimport { navbarTheme } from \"./theme\";\n\nexport interface NavbarCollapseTheme {\n base: string;\n list: string;\n hidden: FlowbiteBoolean;\n}\n\nexport interface NavbarCollapseProps extends ComponentProps<\"div\">, ThemingProps<NavbarCollapseTheme> {}\n\nexport const NavbarCollapse = forwardRef<HTMLDivElement, NavbarCollapseProps>((props, ref) => {\n const { theme: rootTheme, clearTheme: rootClearTheme, applyTheme: rootApplyTheme, isOpen } = useNavbarContext();\n\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [navbarTheme.collapse, provider.theme?.navbar?.collapse, rootTheme?.collapse, props.theme],\n [get(provider.clearTheme, \"navbar.collapse\"), get(rootClearTheme, \"collapse\"), props.clearTheme],\n [get(provider.applyTheme, \"navbar.collapse\"), get(rootApplyTheme, \"collapse\"), props.applyTheme],\n );\n\n const { children, className, ...restProps } = resolveProps(props, provider.props?.navbarCollapse);\n\n return (\n <div\n ref={ref}\n data-testid=\"flowbite-navbar-collapse\"\n className={twMerge(theme.base, theme.hidden[!isOpen ? \"on\" : \"off\"], className)}\n {...restProps}\n >\n <ul className={theme.list}>{children}</ul>\n </div>\n );\n});\n\nNavbarCollapse.displayName = \"NavbarCollapse\";\n"],"names":["forwardRef","useNavbarContext","provider","useThemeProvider","theme","useResolveTheme","navbarTheme","get","resolveProps","jsx","twMerge"],"mappings":";;;;;;;;;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