{"version":3,"file":"GridCol.mjs","sources":["../../../../src/components/Grid/GridCol/GridCol.tsx"],"sourcesContent":["import cx from 'clsx';\nimport {\n  Box,\n  BoxProps,\n  CompoundStylesApiProps,\n  ElementProps,\n  factory,\n  Factory,\n  StyleProp,\n  useProps,\n  useRandomClassName,\n} from '../../../core';\nimport { useGridContext } from '../Grid.context';\nimport { GridColVariables } from './GridColVariables';\n\nexport type GridColStylesNames = 'col';\nexport type ColSpan = number | 'auto' | 'content';\n\nexport interface GridColProps\n  extends BoxProps,\n    CompoundStylesApiProps<GridColFactory>,\n    ElementProps<'div'> {\n  /** Column span, `12` by default */\n  span?: StyleProp<ColSpan>;\n\n  /** Column order, can be used to reorder columns at different viewport sizes */\n  order?: StyleProp<number>;\n\n  /** Column offset on the left side – number of columns that should be left empty before this column */\n  offset?: StyleProp<number>;\n}\n\nexport type GridColFactory = Factory<{\n  props: GridColProps;\n  ref: HTMLDivElement;\n  stylesNames: GridColStylesNames;\n  compound: true;\n}>;\n\nconst defaultProps: Partial<GridColProps> = {\n  span: 12,\n};\n\nexport const GridCol = factory<GridColFactory>((_props, ref) => {\n  const props = useProps('GridCol', defaultProps, _props);\n  const { classNames, className, style, styles, vars, span, order, offset, ...others } = props;\n  const ctx = useGridContext();\n  const responsiveClassName = useRandomClassName();\n  return (\n    <>\n      <GridColVariables\n        selector={`.${responsiveClassName}`}\n        span={span}\n        order={order}\n        offset={offset}\n      />\n\n      <Box\n        ref={ref}\n        {...ctx.getStyles('col', {\n          className: cx(className, responsiveClassName),\n          style,\n          classNames,\n          styles,\n        })}\n        {...others}\n      />\n    </>\n  );\n});\n\nGridCol.displayName = '@raikou/core/GridCol';\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuCA,MAAM,YAAsC,GAAA;AAAA,EAC1C,IAAM,EAAA;AACR,CAAA;AAEO,MAAM,OAAU,GAAA,OAAA,CAAwB,CAAC,MAAA,EAAQ,GAAQ,KAAA;AAC9D,EAAA,MAAM,KAAQ,GAAA,QAAA,CAAS,SAAW,EAAA,YAAA,EAAc,MAAM,CAAA;AACtD,EAAM,MAAA,EAAE,UAAY,EAAA,SAAA,EAAW,KAAO,EAAA,MAAA,EAAQ,IAAM,EAAA,IAAA,EAAM,KAAO,EAAA,MAAA,EAAQ,GAAG,MAAA,EAAW,GAAA,KAAA;AACvF,EAAA,MAAM,MAAM,cAAe,EAAA;AAC3B,EAAA,MAAM,sBAAsB,kBAAmB,EAAA;AAC/C,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,QAAA,EAAU,IAAI,mBAAmB,CAAA,CAAA;AAAA,QACjC,IAAA;AAAA,QACA,KAAA;AAAA,QACA;AAAA;AAAA,KACF;AAAA,oBAEA,GAAA;AAAA,MAAC,GAAA;AAAA,MAAA;AAAA,QACC,GAAA;AAAA,QACC,GAAG,GAAI,CAAA,SAAA,CAAU,KAAO,EAAA;AAAA,UACvB,SAAA,EAAW,EAAG,CAAA,SAAA,EAAW,mBAAmB,CAAA;AAAA,UAC5C,KAAA;AAAA,UACA,UAAA;AAAA,UACA;AAAA,SACD,CAAA;AAAA,QACA,GAAG;AAAA;AAAA;AACN,GACF,EAAA,CAAA;AAEJ,CAAC;AAED,OAAA,CAAQ,WAAc,GAAA,sBAAA;;;;"}