{"version":3,"file":"TableScrollContainer.cjs","names":["createVarsResolver","rem","factory","useProps","useStyles","Box","ScrollArea","classes"],"sources":["../../../src/components/Table/TableScrollContainer.tsx"],"sourcesContent":["import {\n  Box,\n  BoxProps,\n  createVarsResolver,\n  ElementProps,\n  factory,\n  Factory,\n  rem,\n  StylesApiProps,\n  useProps,\n  useStyles,\n} from '../../core';\nimport { ScrollArea, ScrollAreaProps } from '../ScrollArea';\nimport classes from './Table.module.css';\n\nexport type TableScrollContainerStylesNames = 'scrollContainer' | 'scrollContainerInner';\nexport type TableScrollContainerCssVariables = {\n  scrollContainer: '--table-min-width' | '--table-max-height' | '--table-overflow';\n};\n\nexport interface TableScrollContainerProps\n  extends BoxProps, StylesApiProps<TableScrollContainerFactory>, ElementProps<'div'> {\n  /** `min-width` of the `Table` at which it should become scrollable */\n  minWidth: React.CSSProperties['minWidth'];\n\n  /** `max-height` of the `Table` at which it should become scrollable */\n  maxHeight?: React.CSSProperties['maxHeight'];\n\n  /** Type of the scroll container, `native` to use native scrollbars, `scrollarea` to use `ScrollArea` component @default 'scrollarea' */\n  type?: 'native' | 'scrollarea';\n\n  /** Props passed down to `ScrollArea` component, not applicable with `type=\"native\"` */\n  scrollAreaProps?: ScrollAreaProps;\n}\n\nexport type TableScrollContainerFactory = Factory<{\n  props: TableScrollContainerProps;\n  ref: HTMLDivElement;\n  stylesNames: TableScrollContainerStylesNames;\n  vars: TableScrollContainerCssVariables;\n}>;\n\nconst defaultProps = {\n  type: 'scrollarea',\n} satisfies Partial<TableScrollContainerProps>;\n\nconst varsResolver = createVarsResolver<TableScrollContainerFactory>(\n  (_, { minWidth, maxHeight, type }) => ({\n    scrollContainer: {\n      '--table-min-width': rem(minWidth),\n      '--table-max-height': rem(maxHeight),\n      '--table-overflow': type === 'native' ? 'auto' : undefined,\n    },\n  })\n);\n\nexport const TableScrollContainer = factory<TableScrollContainerFactory>((_props) => {\n  const props = useProps('TableScrollContainer', defaultProps, _props);\n  const {\n    classNames,\n    className,\n    style,\n    styles,\n    unstyled,\n    vars,\n    children,\n    minWidth,\n    maxHeight,\n    type,\n    scrollAreaProps,\n    attributes,\n    ...others\n  } = props;\n\n  const getStyles = useStyles<TableScrollContainerFactory>({\n    name: 'TableScrollContainer',\n    classes,\n    props,\n    className,\n    style,\n    classNames,\n    styles,\n    unstyled,\n    attributes,\n    vars,\n    varsResolver,\n    rootSelector: 'scrollContainer',\n  });\n\n  return (\n    <Box<any>\n      component={type === 'scrollarea' ? ScrollArea : 'div'}\n      {...(type === 'scrollarea'\n        ? maxHeight\n          ? { offsetScrollbars: 'xy', ...scrollAreaProps }\n          : { offsetScrollbars: 'x', ...scrollAreaProps }\n        : {})}\n      {...getStyles('scrollContainer')}\n      {...others}\n    >\n      <div {...getStyles('scrollContainerInner')}>{children}</div>\n    </Box>\n  );\n});\n\nTableScrollContainer.classes = classes;\nTableScrollContainer.varsResolver = varsResolver;\nTableScrollContainer.displayName = '@mantine/core/TableScrollContainer';\n"],"mappings":";;;;;;;;;;;;AA0CA,MAAM,eAAe,EACnB,MAAM,cACP;AAED,MAAM,eAAeA,6BAAAA,oBAClB,GAAG,EAAE,UAAU,WAAW,YAAY,EACrC,iBAAiB;CACf,qBAAqBC,YAAAA,IAAI,SAAS;CAClC,sBAAsBA,YAAAA,IAAI,UAAU;CACpC,oBAAoB,SAAS,WAAW,SAAS,KAAA;CAClD,EACF,EACF;AAED,MAAa,uBAAuBC,gBAAAA,SAAsC,WAAW;CACnF,MAAM,QAAQC,kBAAAA,SAAS,wBAAwB,cAAc,OAAO;CACpE,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,UACA,UACA,WACA,MACA,iBACA,YACA,GAAG,WACD;CAEJ,MAAM,YAAYC,mBAAAA,UAAuC;EACvD,MAAM;EACN,SAAA,qBAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACf,CAAC;AAEF,QACE,iBAAA,GAAA,kBAAA,KAACC,YAAAA,KAAD;EACE,WAAW,SAAS,eAAeC,mBAAAA,aAAa;EAChD,GAAK,SAAS,eACV,YACE;GAAE,kBAAkB;GAAM,GAAG;GAAiB,GAC9C;GAAE,kBAAkB;GAAK,GAAG;GAAiB,GAC/C,EAAE;EACN,GAAI,UAAU,kBAAkB;EAChC,GAAI;YAEJ,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,GAAI,UAAU,uBAAuB;GAAG;GAAe,CAAA;EACxD,CAAA;EAER;AAEF,qBAAqB,UAAUC,qBAAAA;AAC/B,qBAAqB,eAAe;AACpC,qBAAqB,cAAc"}