{"version":3,"file":"PillsInput.cjs","names":["factory","useProps","PillsInputContext","InputBase","PillsInputField"],"sources":["../../../src/components/PillsInput/PillsInput.tsx"],"sourcesContent":["import { useRef } from 'react';\nimport { BoxProps, ElementProps, factory, Factory, StylesApiProps, useProps } from '../../core';\nimport { __BaseInputProps, __InputStylesNames } from '../Input';\nimport { InputBase } from '../InputBase';\nimport { PillsInputContext } from './PillsInput.context';\nimport { PillsInputField } from './PillsInputField/PillsInputField';\n\nexport interface PillsInputProps\n  extends\n    BoxProps,\n    __BaseInputProps,\n    StylesApiProps<PillsInputFactory>,\n    ElementProps<'div', 'size'> {\n  __stylesApiProps?: Record<string, any>;\n  __staticSelector?: string;\n}\n\nexport type PillsInputFactory = Factory<{\n  props: PillsInputProps;\n  ref: HTMLDivElement;\n  stylesNames: __InputStylesNames;\n  staticComponents: {\n    Field: typeof PillsInputField;\n  };\n}>;\n\nconst defaultProps = {\n  size: 'sm',\n} satisfies Partial<PillsInputProps>;\n\nexport const PillsInput = factory<PillsInputFactory>((_props) => {\n  const props = useProps('PillsInput', defaultProps, _props);\n  const {\n    children,\n    onMouseDown,\n    onClick,\n    size,\n    disabled,\n    __staticSelector,\n    error,\n    variant,\n    ...others\n  } = props;\n\n  const fieldRef = useRef<HTMLInputElement>(null);\n\n  return (\n    <PillsInputContext value={{ fieldRef, size, disabled, hasError: !!error, variant }}>\n      <InputBase\n        size={size}\n        error={error}\n        variant={variant}\n        component=\"div\"\n        data-no-overflow\n        onMouseDown={(event) => {\n          event.preventDefault();\n          onMouseDown?.(event);\n          fieldRef.current?.focus();\n        }}\n        onClick={(event) => {\n          event.preventDefault();\n          const fieldset = event.currentTarget.closest('fieldset');\n          if (!fieldset?.disabled) {\n            fieldRef.current?.focus();\n            onClick?.(event);\n          }\n        }}\n        {...others}\n        multiline\n        disabled={disabled}\n        __staticSelector={__staticSelector || 'PillsInput'}\n        withAria={false}\n      >\n        {children}\n      </InputBase>\n    </PillsInputContext>\n  );\n});\n\nPillsInput.displayName = '@mantine/core/PillsInput';\nPillsInput.classes = InputBase.classes;\nPillsInput.Field = PillsInputField;\n"],"mappings":";;;;;;;;;;AA0BA,MAAM,eAAe,EACnB,MAAM,MACP;AAED,MAAa,aAAaA,gBAAAA,SAA4B,WAAW;CAE/D,MAAM,EACJ,UACA,aACA,SACA,MACA,UACA,kBACA,OACA,SACA,GAAG,WAVSC,kBAAAA,SAAS,cAAc,cAAc,OAAO;CAa1D,MAAM,YAAA,GAAA,MAAA,QAAoC,KAAK;AAE/C,QACE,iBAAA,GAAA,kBAAA,KAACC,2BAAAA,mBAAD;EAAmB,OAAO;GAAE;GAAU;GAAM;GAAU,UAAU,CAAC,CAAC;GAAO;GAAS;YAChF,iBAAA,GAAA,kBAAA,KAACC,kBAAAA,WAAD;GACQ;GACC;GACE;GACT,WAAU;GACV,oBAAA;GACA,cAAc,UAAU;AACtB,UAAM,gBAAgB;AACtB,kBAAc,MAAM;AACpB,aAAS,SAAS,OAAO;;GAE3B,UAAU,UAAU;AAClB,UAAM,gBAAgB;AAEtB,QAAI,CADa,MAAM,cAAc,QAAQ,WAAW,EACzC,UAAU;AACvB,cAAS,SAAS,OAAO;AACzB,eAAU,MAAM;;;GAGpB,GAAI;GACJ,WAAA;GACU;GACV,kBAAkB,oBAAoB;GACtC,UAAU;GAET;GACS,CAAA;EACM,CAAA;EAEtB;AAEF,WAAW,cAAc;AACzB,WAAW,UAAUA,kBAAAA,UAAU;AAC/B,WAAW,QAAQC,wBAAAA"}