{"version":3,"file":"Progress.cjs","sources":["../../../src/components/Progress/Progress.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { forwardRef, useId } 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, FlowbiteSizes, ThemingProps } from \"../../types\";\nimport { progressTheme } from \"./theme\";\n\nexport interface ProgressTheme {\n  base: string;\n  label: string;\n  bar: string;\n  color: ProgressColor;\n  size: ProgressSizes;\n}\n\nexport interface ProgressColor\n  extends Pick<\n    FlowbiteColors,\n    \"dark\" | \"blue\" | \"red\" | \"green\" | \"yellow\" | \"indigo\" | \"purple\" | \"cyan\" | \"gray\" | \"lime\" | \"pink\" | \"teal\"\n  > {\n  [key: string]: string;\n  default: string;\n}\n\nexport interface ProgressSizes extends Pick<FlowbiteSizes, \"sm\" | \"md\" | \"lg\" | \"xl\"> {\n  [key: string]: string;\n}\n\nexport interface ProgressProps extends ComponentProps<\"div\">, ThemingProps<ProgressTheme> {\n  color?: DynamicStringEnumKeysOf<ProgressColor>;\n  labelProgress?: boolean;\n  labelText?: boolean;\n  progress: number;\n  progressLabelPosition?: \"inside\" | \"outside\";\n  size?: DynamicStringEnumKeysOf<ProgressSizes>;\n  textLabel?: string;\n  textLabelPosition?: \"inside\" | \"outside\";\n}\n\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>((props, ref) => {\n  const id = useId();\n  const provider = useThemeProvider();\n  const theme = useResolveTheme(\n    [progressTheme, provider.theme?.progress, props.theme],\n    [get(provider.clearTheme, \"progress\"), props.clearTheme],\n    [get(provider.applyTheme, \"progress\"), props.applyTheme],\n  );\n\n  const {\n    className,\n    color = \"default\",\n    labelProgress = false,\n    labelText = false,\n    progress,\n    progressLabelPosition = \"inside\",\n    size = \"md\",\n    textLabel = \"progressbar\",\n    textLabelPosition = \"inside\",\n    ...restProps\n  } = resolveProps(props, provider.props?.progress);\n\n  return (\n    <div ref={ref} id={id} aria-label={textLabel} aria-valuenow={progress} role=\"progressbar\" {...restProps}>\n      {((textLabel && labelText && textLabelPosition === \"outside\") ||\n        (progress > 0 && labelProgress && progressLabelPosition === \"outside\")) && (\n        <div className={theme.label} data-testid=\"flowbite-progress-outer-label-container\">\n          {textLabel && labelText && textLabelPosition === \"outside\" && (\n            <span data-testid=\"flowbite-progress-outer-text-label\">{textLabel}</span>\n          )}\n          {labelProgress && progressLabelPosition === \"outside\" && (\n            <span data-testid=\"flowbite-progress-outer-progress-label\">{progress}%</span>\n          )}\n        </div>\n      )}\n      <div className={twMerge(theme.base, theme.size[size], className)}>\n        <div style={{ width: `${progress}%` }} className={twMerge(theme.bar, theme.color[color], theme.size[size])}>\n          {textLabel && labelText && textLabelPosition === \"inside\" && (\n            <span data-testid=\"flowbite-progress-inner-text-label\">{textLabel}</span>\n          )}\n          {progress > 0 && labelProgress && progressLabelPosition === \"inside\" && (\n            <span data-testid=\"flowbite-progress-inner-progress-label\">{progress}%</span>\n          )}\n        </div>\n      </div>\n    </div>\n  );\n});\n\nProgress.displayName = \"Progress\";\n"],"names":["forwardRef","useId","provider","useThemeProvider","theme","useResolveTheme","progressTheme","get","resolveProps","jsxs","jsx","twMerge"],"mappings":";;;;;;;;;;;AAUY,MAAC,QAAQ,GAAGA,gBAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACnD,EAAE,MAAM,EAAE,GAAGC,WAAK,EAAE;AACpB,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,U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