UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 2.63 kB
{"version":3,"file":"ListItem.cjs","sources":["../../../src/components/List/ListItem.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 { listTheme } from \"./theme\";\n\nexport interface ListItemTheme {\n icon: string;\n withIcon: {\n on: string;\n off: string;\n };\n}\n\nexport interface ListItemProps extends ComponentProps<\"li\">, ThemingProps<ListItemTheme> {\n className?: string;\n icon?: FC<ComponentProps<\"svg\">>;\n}\n\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>((props, ref) => {\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [listTheme.item, provider.theme?.list?.item, props.theme],\n [get(provider.clearTheme, \"list.item\"), props.clearTheme],\n [get(provider.applyTheme, \"list.item\"), props.applyTheme],\n );\n\n const { children, className, icon: Icon, ...restProps } = resolveProps(props, provider.props?.listItem);\n\n return (\n <li ref={ref} className={twMerge(theme.withIcon[Icon ? \"on\" : \"off\"], className)} {...restProps}>\n {Icon && <Icon className={twMerge(theme.icon)} />}\n {children}\n </li>\n );\n});\n\nListItem.displayName = \"ListItem\";\n"],"names":["forwardRef","provider","useThemeProvider","theme","useResolveTheme","listTheme","get","resolveProps","jsxs","twMerge","jsx"],"mappings":";;;;;;;;;;;AAUY,MAAC,QAAQ,GAAGA,gBAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACnD,EAAE,MAAMC,UAAQ,GAAGC,yBAAgB,EAAE;AACrC,EAAE,MAAMC,OAAK,GAAGC,4BAAe;AAC/B,IAAI,CAACC,eAAS,CAAC,IAAI,EAAEJ,UAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC;AAC7D,IAAI,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;AAC7D,IAAI,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,UAAU;AAC5D,GAAG;AACH,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,SAAS,EAAE,GAAGM,yBAAY,CAAC,KAAK,EAAEN,UAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;AACzG,EAAE,uBAAuBO,eAAI,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAEC,qBAAO,CAACN,OAAK,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE;AACvI,IAAI,IAAI,oBAAoBO,cAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAED,qBAAO,CAACN,OAAK,CAAC,IAAI,CAAC,EAAE,CAAC;AACzE,IAAI;AACJ,GAAG,EAAE,CAAC;AACN,CAAC;AACD,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}