{"version":3,"file":"ProgressRoot.cjs","sources":["../../../../src/components/Progress/ProgressRoot/ProgressRoot.tsx"],"sourcesContent":["import {\n  Box,\n  BoxProps,\n  createVarsResolver,\n  ElementProps,\n  factory,\n  Factory,\n  getRadius,\n  getSize,\n  RaikouRadius,\n  RaikouSize,\n  StylesApiProps,\n  useProps,\n  useStyles,\n} from '../../../core';\nimport { ProgressProvider } from '../Progress.context';\nimport { ProgressLabelStyle, ProgressRootStyle, ProgressSectionStyle } from '../Progress.css';\n\nexport type ProgressRootStylesNames = 'root' | 'section' | 'label';\nexport type ProgressRootCssVariables = {\n  root: '--progress-size' | '--progress-radius' | '--progress-transition-duration';\n};\n\nexport interface __ProgressRootProps extends BoxProps, ElementProps<'div'> {\n  /** Controls track height, `'md'` by default */\n  size?: RaikouSize | (string & {}) | number;\n\n  /** Key of `theme.radius` or any valid CSS value to set `border-radius`, `theme.defaultRadius` by default */\n  radius?: RaikouRadius;\n\n  /** Determines whether label text color should depend on `background-color`. If luminosity of the `color` prop is less than `theme.luminosityThreshold`, then `theme.white` will be used for text color, otherwise `theme.black`. Overrides `theme.autoContrast`. */\n  autoContrast?: boolean;\n\n  /** Controls sections width transition duration, value is specified in ms, `100` by default */\n  transitionDuration?: number;\n}\n\nexport interface ProgressRootProps\n  extends __ProgressRootProps,\n    StylesApiProps<ProgressRootFactory> {}\n\nexport type ProgressRootFactory = Factory<{\n  props: ProgressRootProps;\n  ref: HTMLDivElement;\n  stylesNames: ProgressRootStylesNames;\n  vars: ProgressRootCssVariables;\n}>;\n\nconst defaultProps: Partial<ProgressRootProps> = {};\n\nconst varsResolver = createVarsResolver<ProgressRootFactory>(\n  (_, { size, radius, transitionDuration }) => ({\n    root: {\n      '--progress-size': getSize(size, 'progress-size'),\n      '--progress-radius': radius === undefined ? undefined : getRadius(radius),\n      '--progress-transition-duration':\n        typeof transitionDuration === 'number' ? `${transitionDuration}ms` : undefined,\n    },\n  })\n);\n\nexport const ProgressRoot = factory<ProgressRootFactory>((_props, ref) => {\n  const props = useProps('ProgressRoot', defaultProps, _props);\n  const {\n    classNames,\n    className,\n    style,\n    styles,\n    unstyled,\n    vars,\n    autoContrast,\n    transitionDuration,\n    ...others\n  } = props;\n\n  const getStyles = useStyles<ProgressRootFactory>({\n    name: 'Progress',\n    classes: {\n      root: ProgressRootStyle,\n      section: ProgressSectionStyle,\n      label: ProgressLabelStyle,\n    },\n    props,\n    className,\n    style,\n    classNames,\n    styles,\n    unstyled,\n    vars,\n    varsResolver,\n  });\n\n  return (\n    <ProgressProvider value={{ getStyles, autoContrast }}>\n      <Box ref={ref} {...getStyles('root')} {...others} />\n    </ProgressProvider>\n  );\n});\n\nProgressRoot.displayName = '@raikou/core/ProgressRoot';\n"],"names":["createVarsResolver","getSize","getRadius","factory","useProps","useStyles","ProgressRootStyle","ProgressSectionStyle","ProgressLabelStyle","ProgressProvider","jsx","Box"],"mappings":";;;;;;;;;;;;;;;;AAgDA,MAAM,eAA2C,EAAC;AAElD,MAAM,YAAe,GAAAA,qCAAA;AAAA,EACnB,CAAC,CAAG,EAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,oBAA0B,MAAA;AAAA,IAC5C,IAAM,EAAA;AAAA,MACJ,iBAAA,EAAmBC,eAAQ,CAAA,IAAA,EAAM,eAAe,CAAA;AAAA,MAChD,mBAAqB,EAAA,MAAA,KAAW,KAAY,CAAA,GAAA,KAAA,CAAA,GAAYC,kBAAU,MAAM,CAAA;AAAA,MACxE,kCACE,OAAO,kBAAA,KAAuB,QAAW,GAAA,CAAA,EAAG,kBAAkB,CAAO,EAAA,CAAA,GAAA,KAAA;AAAA;AACzE,GACF;AACF,CAAA;AAEO,MAAM,YAAe,GAAAC,eAAA,CAA6B,CAAC,MAAA,EAAQ,GAAQ,KAAA;AACxE,EAAA,MAAM,KAAQ,GAAAC,iBAAA,CAAS,cAAgB,EAAA,YAAA,EAAc,MAAM,CAAA;AAC3D,EAAM,MAAA;AAAA,IACJ,UAAA;AAAA,IACA,SAAA;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