flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 2.58 kB
Source Map (JSON)
{"version":3,"file":"Kbd.cjs","sources":["../../../src/components/Kbd/Kbd.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 { kbdTheme } from \"./theme\";\n\nexport interface KbdTheme {\n root: KbdRootTheme;\n}\n\nexport interface KbdRootTheme {\n base: string;\n icon: string;\n}\n\nexport interface KbdProps extends ComponentProps<\"span\">, ThemingProps<KbdTheme> {\n icon?: FC<ComponentProps<\"svg\">>;\n}\n\nexport const Kbd = forwardRef<HTMLSpanElement, KbdProps>((props, ref) => {\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [kbdTheme, provider.theme?.kbd, props.theme],\n [get(provider.clearTheme, \"kbd\"), props.clearTheme],\n [get(provider.applyTheme, \"kbd\"), props.applyTheme],\n );\n\n const { children, className, icon: Icon, ...restProps } = resolveProps(props, provider.props?.hr);\n\n return (\n <span ref={ref} className={twMerge(theme.root.base, className)} data-testid=\"flowbite-kbd\" {...restProps}>\n {Icon && <Icon className={theme.root.icon} data-testid=\"flowbite-kbd-icon\" />}\n {children}\n </span>\n );\n});\n\nKbd.displayName = \"Kbd\";\n"],"names":["forwardRef","provider","useThemeProvider","theme","useResolveTheme","kbdTheme","get","resolveProps","jsxs","twMerge","jsx"],"mappings":";;;;;;;;;;;AAUY,MAAC,GAAG,GAAGA,gBAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AAC9C,EAAE,MAAMC,UAAQ,GAAGC,yBAAgB,EAAE;AACrC,EAAE,MAAMC,OAAK,GAAGC,4BAAe;AAC/B,IAAI,CAACC,cAAQ,EAAEJ,UAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC;AAChD,IAAI,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;AACvD,IAAI,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC,UAAU;AACtD,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,EAAE,CAAC;AACnG,EAAE,uBAAuBO,eAAI,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAEC,qBAAO,CAACN,OAAK,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,GAAG,SAAS,EAAE,QAAQ,EAAE;AACpJ,IAAI,IAAI,oBAAoBO,cAAG,CAAC,IAAI,EAAE,EAAE,SAAS,EAAEP,OAAK,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,mBAAmB,EAAE,CAAC;AACzG,IAAI;AACJ,GAAG,EAAE,CAAC;AACN,CAAC;AACD,GAAG,CAAC,WAAW,GAAG,KAAK;;;;"}