{"version":3,"file":"CustomFieldOption.mjs","sources":["../../../../admin/src/components/AttributeOptions/CustomFieldOption.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { StrapiAppContextValue } from '@strapi/admin/strapi-admin';\nimport { Box, Flex, Typography } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { AttributeIcon, IconByType } from '../AttributeIcon';\nimport { useFormModalNavigation } from '../FormModalNavigation/useFormModalNavigation';\n\nimport { OptionBoxWrapper } from './OptionBoxWrapper';\n\nexport type CustomFieldOption = {\n  name: string;\n  type: IconByType;\n  icon: React.ComponentType;\n  intlLabel: {\n    id: string;\n    defaultMessage: string;\n  };\n  intlDescription: {\n    id: string;\n    defaultMessage: string;\n  };\n};\n\ntype CustomFieldOptionProps = {\n  customFieldUid: string;\n  customField: NonNullable<ReturnType<StrapiAppContextValue['customFields']['get']>>;\n};\n\nexport const CustomFieldOption = ({ customFieldUid, customField }: CustomFieldOptionProps) => {\n  const { type, intlLabel, intlDescription } = customField;\n  const { formatMessage } = useIntl();\n\n  const { onClickSelectCustomField } = useFormModalNavigation();\n\n  const handleClick = () => {\n    onClickSelectCustomField({\n      attributeType: type,\n      customFieldUid,\n    });\n  };\n\n  return (\n    <OptionBoxWrapper padding={4} tag=\"button\" hasRadius type=\"button\" onClick={handleClick}>\n      <Flex>\n        <AttributeIcon type={type} customField={customFieldUid} />\n        <Box paddingLeft={4}>\n          <Flex>\n            <Typography fontWeight=\"bold\" textColor=\"neutral800\">\n              {formatMessage(intlLabel)}\n            </Typography>\n          </Flex>\n          <Flex>\n            <Typography variant=\"pi\" textColor=\"neutral600\">\n              {formatMessage(intlDescription)}\n            </Typography>\n          </Flex>\n        </Box>\n      </Flex>\n    </OptionBoxWrapper>\n  );\n};\n"],"names":["CustomFieldOption","customFieldUid","customField","type","intlLabel","intlDescription","formatMessage","useIntl","onClickSelectCustomField","useFormModalNavigation","handleClick","attributeType","_jsx","OptionBoxWrapper","padding","tag","hasRadius","onClick","_jsxs","Flex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