{"version":3,"file":"ThemeIcon.cjs","sources":["../../../src/components/ThemeIcon/ThemeIcon.tsx"],"sourcesContent":["import {\n  Box,\n  BoxProps,\n  createVarsResolver,\n  ElementProps,\n  factory,\n  Factory,\n  getRadius,\n  getSize,\n  RaikouColor,\n  RaikouGradient,\n  RaikouRadius,\n  RaikouSize,\n  StylesApiProps,\n  useProps,\n  useStyles,\n} from '../../core';\nimport { ThemeIconRootStyle } from './ThemeIcon.css';\n\nexport type ThemeIconStylesNames = 'root';\nexport type ThemeIconVariant =\n  | 'filled'\n  | 'light'\n  | 'outline'\n  | 'transparent'\n  | 'white'\n  | 'default'\n  | 'gradient';\n\nexport type ThemeIconCssVariables = {\n  root: '--ti-radius' | '--ti-size' | '--ti-bg' | '--ti-color' | '--ti-bd';\n};\n\nexport interface ThemeIconProps\n  extends BoxProps,\n    StylesApiProps<ThemeIconFactory>,\n    ElementProps<'div'> {\n  /** Controls width and height of the button. Numbers are converted to rem. `'md'` by default. */\n  size?: RaikouSize | (string & {}) | number;\n\n  /** Key of `theme.colors` or any valid CSS color. Default value is `theme.primaryColor`.  */\n  color?: RaikouColor;\n\n  /** Key of `theme.radius` or any valid CSS value to set border-radius. Numbers are converted to rem. `theme.defaultRadius` by default. */\n  radius?: RaikouRadius;\n\n  /** Gradient data used when `variant=\"gradient\"`, default value is `theme.defaultGradient` */\n  gradient?: RaikouGradient;\n\n  /** Icon displayed inside the component */\n  children?: React.ReactNode;\n\n  /** Determines whether button text color with filled variant 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\nexport type ThemeIconFactory = Factory<{\n  props: ThemeIconProps;\n  ref: HTMLDivElement;\n  stylesNames: ThemeIconStylesNames;\n  vars: ThemeIconCssVariables;\n  variant: ThemeIconVariant;\n}>;\n\nconst defaultProps: Partial<ThemeIconProps> = {};\n\nconst varsResolver = createVarsResolver<ThemeIconFactory>(\n  (theme, { size, radius, variant, gradient, color, autoContrast }) => {\n    const colors = theme.variantColorResolver({\n      color: color || theme.primaryColor,\n      theme,\n      gradient,\n      variant: variant || 'filled',\n      autoContrast,\n    });\n\n    return {\n      root: {\n        '--ti-size': getSize(size, 'ti-size'),\n        '--ti-radius': radius === undefined ? undefined : getRadius(radius),\n        '--ti-bg': color || variant ? colors.background : undefined,\n        '--ti-color': color || variant ? colors.color : undefined,\n        '--ti-bd': color || variant ? colors.border : undefined,\n      },\n    };\n  }\n);\n\nexport const ThemeIcon = factory<ThemeIconFactory>((_props, ref) => {\n  const props = useProps('ThemeIcon', defaultProps, _props);\n  const { classNames, className, style, styles, unstyled, vars, autoContrast, ...others } = props;\n\n  const getStyles = useStyles<ThemeIconFactory>({\n    name: 'ThemeIcon',\n    classes: {\n      root: ThemeIconRootStyle,\n    },\n    props,\n    className,\n    style,\n    classNames,\n    styles,\n    unstyled,\n    vars,\n    varsResolver,\n  });\n\n  return <Box ref={ref} {...getStyles('root')} {...others} />;\n});\n\nThemeIcon.displayName = '@raikou/core/ThemeIcon';\n"],"names":["createVarsResolver","getSize","getRadius","factory","useProps","useStyles","ThemeIconRootStyle","jsx","Box"],"mappings":";;;;;;;;;;;;;;;AAgEA,MAAM,eAAwC,EAAC;AAE/C,MAAM,YAAe,GAAAA,qCAAA;AAAA,EACnB,CAAC,OAAO,EAAE,IAAA,EAAM,QAAQ,OAAS,EAAA,QAAA,EAAU,KAAO,EAAA,YAAA,EAAmB,KAAA;AACnE,IAAM,MAAA,MAAA,GAAS,MAAM,oBAAqB,CAAA;AAAA,MACxC,KAAA,EAAO,SAAS,KAAM,CAAA,YAAA;AAAA,MACtB,KAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAS,OAAW,IAAA,QAAA;AAAA,MACpB;AAAA,KACD,CAAA;AAED,IAAO,OAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,WAAA,EAAaC,eAAQ,CAAA,IAAA,EAAM,SAAS,CAAA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