{"version":3,"file":"InlineInput.cjs","names":["classes","useStyles","Box","getFontSize","getSize","Input"],"sources":["../../../src/utils/InlineInput/InlineInput.tsx"],"sourcesContent":["import { Input } from '../../components/Input';\nimport {\n  Box,\n  BoxProps,\n  ElementProps,\n  Factory,\n  getFontSize,\n  getSize,\n  MantineSize,\n  StylesApiProps,\n  useStyles,\n} from '../../core';\nimport classes from './InlineInput.module.css';\n\nexport const InlineInputClasses = classes;\n\nexport type InlineInputStylesNames =\n  | 'root'\n  | 'body'\n  | 'labelWrapper'\n  | 'label'\n  | 'description'\n  | 'error';\n\nexport interface InlineInputProps\n  extends BoxProps, StylesApiProps<InlineInputFactory>, ElementProps<'div'> {\n  __staticSelector: string;\n  __stylesApiProps: Record<string, any>;\n  label: React.ReactNode;\n  description: React.ReactNode;\n  id: string;\n  disabled: boolean | undefined;\n  error: React.ReactNode;\n  size: MantineSize | (string & {}) | undefined;\n  labelPosition?: 'left' | 'right';\n  bodyElement?: any;\n  labelElement?: any;\n}\n\nexport type InlineInputFactory = Factory<{\n  props: any;\n  stylesNames: InlineInputStylesNames;\n}>;\n\nexport function InlineInput({\n  __staticSelector,\n  __stylesApiProps,\n  className,\n  classNames,\n  styles,\n  unstyled,\n  children,\n  label,\n  description,\n  id,\n  disabled,\n  error,\n  size,\n  labelPosition = 'left',\n  bodyElement = 'div',\n  labelElement = 'label',\n  variant,\n  style,\n  vars,\n  mod,\n  attributes,\n  ...others\n}: InlineInputProps) {\n  const getStyles = useStyles<InlineInputFactory>({\n    name: __staticSelector,\n    props: __stylesApiProps,\n    className,\n    style,\n    classes,\n    classNames,\n    styles,\n    unstyled,\n    attributes,\n  });\n\n  return (\n    <Box\n      {...getStyles('root')}\n      __vars={{\n        '--label-fz': getFontSize(size),\n        '--label-lh': getSize(size, 'label-lh'),\n      }}\n      mod={[{ 'label-position': labelPosition }, mod]}\n      variant={variant}\n      size={size}\n      {...others}\n    >\n      <Box\n        component={bodyElement}\n        htmlFor={bodyElement === 'label' ? id : undefined}\n        {...getStyles('body')}\n      >\n        {children}\n\n        <div {...getStyles('labelWrapper')} data-disabled={disabled || undefined}>\n          {label && (\n            <Box\n              component={labelElement}\n              htmlFor={labelElement === 'label' ? id : undefined}\n              {...getStyles('label')}\n              data-disabled={disabled || undefined}\n            >\n              {label}\n            </Box>\n          )}\n\n          {description && (\n            <Input.Description size={size} __inheritStyles={false} {...getStyles('description')}>\n              {description}\n            </Input.Description>\n          )}\n\n          {error && typeof error !== 'boolean' && (\n            <Input.Error size={size} __inheritStyles={false} {...getStyles('error')}>\n              {error}\n            </Input.Error>\n          )}\n        </div>\n      </Box>\n    </Box>\n  );\n}\n\nInlineInput.displayName = '@mantine/core/InlineInput';\n"],"mappings":";;;;;;;;;AAcA,MAAa,qBAAqBA,2BAAAA;AA8BlC,SAAgB,YAAY,EAC1B,kBACA,kBACA,WACA,YACA,QACA,UACA,UACA,OACA,aACA,IACA,UACA,OACA,MACA,gBAAgB,QAChB,cAAc,OACd,eAAe,SACf,SACA,OACA,MACA,KACA,YACA,GAAG,UACgB;CACnB,MAAM,YAAYC,mBAAAA,UAA8B;EAC9C,MAAM;EACN,OAAO;EACP;EACA;EACA,SAAA,2BAAA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,QACE,iBAAA,GAAA,kBAAA,KAACC,YAAAA,KAAD;EACE,GAAI,UAAU,OAAO;EACrB,QAAQ;GACN,cAAcC,iBAAAA,YAAY,KAAK;GAC/B,cAAcC,iBAAAA,QAAQ,MAAM,WAAW;GACxC;EACD,KAAK,CAAC,EAAE,kBAAkB,eAAe,EAAE,IAAI;EACtC;EACH;EACN,GAAI;YAEJ,iBAAA,GAAA,kBAAA,MAACF,YAAAA,KAAD;GACE,WAAW;GACX,SAAS,gBAAgB,UAAU,KAAK,KAAA;GACxC,GAAI,UAAU,OAAO;aAHvB,CAKG,UAED,iBAAA,GAAA,kBAAA,MAAC,OAAD;IAAK,GAAI,UAAU,eAAe;IAAE,iBAAe,YAAY,KAAA;cAA/D;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