{"version":3,"file":"Checkbox.cjs","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { forwardRef } 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 { DynamicStringEnumKeysOf, FlowbiteColors, ThemingProps } from \"../../types\";\nimport { checkboxTheme } from \"./theme\";\n\nexport interface CheckboxTheme {\n  base: string;\n  color: FlowbiteColors;\n  indeterminate: string;\n}\n\nexport interface CheckboxProps\n  extends Omit<ComponentProps<\"input\">, \"type\" | \"ref\" | \"color\">,\n    ThemingProps<CheckboxTheme> {\n  color?: DynamicStringEnumKeysOf<FlowbiteColors>;\n  indeterminate?: boolean;\n}\n\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {\n  const provider = useThemeProvider();\n  const theme = useResolveTheme(\n    [checkboxTheme, provider.theme?.checkbox, props.theme],\n    [get(provider.clearTheme, \"checkbox\"), props.clearTheme],\n    [get(provider.applyTheme, \"checkbox\"), props.applyTheme],\n  );\n\n  const { className, color = \"default\", indeterminate, ...restProps } = resolveProps(props, provider.props?.checkbox);\n\n  return (\n    <input\n      ref={ref}\n      type=\"checkbox\"\n      className={twMerge(theme.base, theme.color[color], indeterminate && theme.indeterminate, className)}\n      {...restProps}\n    />\n  );\n});\n\nCheckbox.displayName = \"Checkbox\";\n"],"names":["forwardRef","provider","useThemeProvider","theme","useResolveTheme","checkboxTheme","get","resolveProps","jsx","twMerge"],"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,mBAAa,EAAEJ,UAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC;AAC1D,IAAI,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;AAC5D,IAAI,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,KAAK,CAAC,UAAU;AAC3D,GAAG;AACH,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,aAAa,EAAE,GAAG,SAAS,EAAE,GAAGM,yBAAY,CAAC,KAAK,EAAEN,UAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;AACrH,EAAE,uBAAuBO,cAAG;AAC5B,IAAI,OAAO;AACX,IAAI;AACJ,MAAM,GAAG;AACT,MAAM,IAAI,EAAE,UAAU;AACtB,MAAM,SAAS,EAAEC,qBAAO,CAACN,OAAK,CAAC,IAAI,EAAEA,OAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,aAAa,IAAIA,OAAK,CAAC,aAAa,EAAE,SAAS,CAAC;AACzG,MAAM,GAAG;AACT;AACA,GAAG;AACH,CAAC;AACD,QAAQ,CAAC,WAAW,GAAG,UAAU;;;;"}