{"version":3,"file":"index.mjs","sources":["../src/helpers/requiredLinkField.ts","../src/components/CustomLinkInput.tsx","../src/components/LinkInput.tsx","../src/components/LinkTypeInput.tsx","../src/linkField.tsx"],"sourcesContent":["import type {CustomValidatorResult} from 'sanity'\n\nimport type {LinkValue} from '../types'\nimport {isCustomLink, isEmailLink, isExternalLink, isInternalLink, isPhoneLink} from './typeGuards'\n\n/**\n * Helper to create a required link field.\n */\nexport const requiredLinkField = (field: unknown): CustomValidatorResult => {\n  const link = field as LinkValue\n\n  if (!link || !link.type) {\n    return 'Link is required'\n  }\n\n  if (isInternalLink(link) && !link.internalLink) {\n    return {\n      message: 'Link is required',\n      path: 'internalLink',\n    }\n  }\n\n  if (isExternalLink(link) && !link.url) {\n    return {\n      message: 'URL is required',\n      path: 'url',\n    }\n  }\n\n  if (isEmailLink(link) && !link.email) {\n    return {\n      message: 'E-mail is required',\n      path: 'email',\n    }\n  }\n\n  if (isPhoneLink(link) && !link.phone) {\n    return {\n      message: 'Phone is required',\n      path: 'phone',\n    }\n  }\n\n  if (isCustomLink(link) && !link.value) {\n    return {\n      message: 'Value is required',\n      path: 'value',\n    }\n  }\n\n  return true\n}\n","import {Select, Spinner} from '@sanity/ui'\nimport {useEffect, useState} from 'react'\nimport {SanityDocument, set, type StringInputProps, useFormValue, useWorkspace} from 'sanity'\nimport styled from 'styled-components'\n\nimport {CustomLinkType, CustomLinkTypeOptions, LinkValue} from '../types'\n\nconst OptionsSpinner = styled(Spinner)`\n  margin-left: 0.5rem;\n`\n\n/**\n * Custom input component used for custom link types.\n * Renders a dropdown with the available options for the custom link type.\n */\nexport function CustomLinkInput(\n  props: StringInputProps & {\n    customLinkTypes: CustomLinkType[]\n  },\n) {\n  const workspace = useWorkspace()\n  const document = useFormValue([]) as SanityDocument\n  const linkValue = useFormValue(props.path.slice(0, -1)) as LinkValue | null\n  const [options, setOptions] = useState<CustomLinkTypeOptions[] | null>(null)\n\n  const customLinkType = props.customLinkTypes.find((type) => type.value === linkValue!.type)\n\n  useEffect(() => {\n    if (customLinkType) {\n      if (Array.isArray(customLinkType?.options)) {\n        setOptions(customLinkType.options)\n      } else {\n        customLinkType\n          .options(document, props.path, workspace.currentUser)\n          .then((options) => setOptions(options))\n      }\n    }\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [customLinkType, props.path, workspace.currentUser])\n\n  return options ? (\n    <Select\n      onChange={(e) => {\n        props.onChange(set(e.currentTarget.value || ''))\n      }}\n    >\n      <>\n        <option value=\"\" selected={props.value === ''} disabled hidden />\n        {options.map((option) => (\n          <option key={option.value} value={option.value} selected={props.value === option.value}>\n            {option.title}\n          </option>\n        ))}\n      </>\n    </Select>\n  ) : (\n    <OptionsSpinner />\n  )\n}\n","import {Box, Flex, Stack, Text} from '@sanity/ui'\nimport {type FieldMember, FormFieldValidationStatus, ObjectInputMember} from 'sanity'\nimport styled from 'styled-components'\n\nimport {isCustomLink} from '../helpers/typeGuards'\nimport {LinkInputProps} from '../types'\n\nconst ValidationErrorWrapper = styled(Box)`\n  contain: size;\n  margin-bottom: 6px;\n  margin-left: auto;\n  margin-right: 12px;\n`\n\nconst FullWidthStack = styled(Stack)`\n  width: 100%;\n`\n\n/**\n * Custom input component for the link object.\n * Nicely renders the type and link fields next to each other, with the\n * description and any validation errors for the link field below them.\n *\n * The rest of the fields (\"blank\" and \"advanced\") are rendered as usual.\n */\nexport function LinkInput(props: LinkInputProps) {\n  const [textField, typeField, linkField, ...otherFields] = props.members as FieldMember[]\n  const {options} = props.schemaType\n\n  const {\n    field: {\n      validation: linkFieldValidation,\n      schemaType: {description: linkFieldDescription},\n    },\n  } = linkField\n\n  const description =\n    // If a custom link type is used, use its description if it has one.\n    props.value && isCustomLink(props.value)\n      ? props.customLinkTypes.find((type) => type.value === props.value?.type)?.description\n      : // Fallback to the description of the current link type field.\n        linkFieldDescription\n\n  const renderProps = {\n    renderAnnotation: props.renderAnnotation,\n    renderBlock: props.renderBlock,\n    renderField: props.renderField,\n    renderInlineBlock: props.renderInlineBlock,\n    renderInput: props.renderInput,\n    renderItem: props.renderItem,\n    renderPreview: props.renderPreview,\n  }\n\n  return (\n    <Stack space={4}>\n      {/* Render the text field if enabled */}\n      {options?.enableText && (\n        <ObjectInputMember\n          member={{\n            ...textField,\n            field: {\n              ...textField.field,\n              schemaType: {\n                ...textField.field.schemaType,\n                title: options?.textLabel || textField.field.schemaType.title,\n              },\n            },\n          }}\n          {...renderProps}\n        />\n      )}\n\n      <Stack space={3}>\n        {/* Render a label for the link field if there's also a text field enabled. */}\n        {/* If there's no text field, the label here is irrelevant */}\n        {options?.enableText && (\n          <Text as=\"label\" weight=\"medium\" size={1}>\n            Link\n          </Text>\n        )}\n\n        <Flex gap={2} align=\"flex-start\">\n          {/* Render the type field (without its label) */}\n          <ObjectInputMember\n            member={{\n              ...typeField,\n              field: {\n                ...typeField.field,\n                schemaType: {\n                  ...typeField.field.schemaType,\n                  title: undefined,\n                },\n              },\n            }}\n            {...renderProps}\n          />\n\n          <FullWidthStack space={2}>\n            {/* Render the input for the selected type of link (withouts its label) */}\n            <ObjectInputMember\n              member={{\n                ...linkField,\n                field: {\n                  ...linkField.field,\n                  schemaType: {\n                    ...linkField.field.schemaType,\n                    title: undefined,\n                  },\n                },\n              }}\n              {...renderProps}\n            />\n\n            {/* Render any validation errors for the link field */}\n            {linkFieldValidation.length > 0 && (\n              <ValidationErrorWrapper>\n                <FormFieldValidationStatus\n                  fontSize={1}\n                  placement=\"top\"\n                  validation={linkFieldValidation}\n                />\n              </ValidationErrorWrapper>\n            )}\n          </FullWidthStack>\n        </Flex>\n\n        {/* Render the description of the selected link field, if any */}\n        {description && (\n          <Text muted size={1}>\n            {description}\n          </Text>\n        )}\n      </Stack>\n\n      {/* Render the rest of the fields as usual */}\n      {otherFields.map((field) => (\n        <ObjectInputMember key={field.key} member={field} {...renderProps} />\n      ))}\n    </Stack>\n  )\n}\n","import {ChevronDownIcon} from '@sanity/icons'\nimport {Button, Menu, MenuButton, MenuItem} from '@sanity/ui'\nimport {AtSignIcon, GlobeIcon, LinkIcon, PhoneIcon} from 'lucide-react'\nimport {set, type StringInputProps} from 'sanity'\nimport styled from 'styled-components'\n\nimport {CustomLinkType, LinkFieldPluginOptions, LinkType} from '../types'\n\nconst defaultLinkTypes: LinkType[] = [\n  {title: 'Internal', value: 'internal', icon: LinkIcon},\n  {title: 'URL', value: 'external', icon: GlobeIcon},\n  {title: 'Email', value: 'email', icon: AtSignIcon},\n  {title: 'Phone', value: 'phone', icon: PhoneIcon},\n]\n\nconst LinkTypeButton = styled(Button)`\n  height: 35px;\n\n  svg.lucide {\n    width: 1rem;\n    height: 1rem;\n  }\n`\n\nconst LinkTypeMenuItem = styled(MenuItem)`\n  svg.lucide {\n    width: 1rem;\n    height: 1rem;\n  }\n`\n\n/**\n * Custom input component for the \"type\" field on the link object.\n * Renders a button with an icon and a dropdown menu to select the link type.\n */\nexport function LinkTypeInput({\n  value,\n  onChange,\n  customLinkTypes = [],\n  linkableSchemaTypes,\n}: StringInputProps & {\n  customLinkTypes?: CustomLinkType[]\n  linkableSchemaTypes: LinkFieldPluginOptions['linkableSchemaTypes']\n}) {\n  const linkTypes = [\n    // Disable internal links if not enabled for any schema types\n    ...defaultLinkTypes.filter(\n      ({value}) => value !== 'internal' || linkableSchemaTypes?.length > 0,\n    ),\n    ...customLinkTypes,\n  ]\n\n  const selectedType = linkTypes.find((type) => type.value === value) || linkTypes[0]\n\n  return (\n    <MenuButton\n      button={\n        <LinkTypeButton\n          type=\"button\"\n          mode=\"ghost\"\n          icon={selectedType.icon}\n          iconRight={ChevronDownIcon}\n          title=\"Select link type\"\n          aria-label={`Select link type (currently: ${selectedType.title})`}\n        />\n      }\n      id=\"link-type\"\n      menu={\n        <Menu>\n          {linkTypes.map((type) => (\n            <LinkTypeMenuItem\n              key={type.value}\n              text={type.title}\n              icon={type.icon}\n              onClick={() => {\n                onChange(set(type.value))\n              }}\n            />\n          ))}\n        </Menu>\n      }\n    />\n  )\n}\n","import {defineField, definePlugin, defineType, type ObjectInputProps} from 'sanity'\n\nimport {CustomLinkInput} from './components/CustomLinkInput'\nimport {LinkInput} from './components/LinkInput'\nimport {LinkTypeInput} from './components/LinkTypeInput'\nimport {isCustomLink} from './helpers/typeGuards'\nimport type {LinkFieldPluginOptions, LinkValue} from './types'\n\n/**\n * A plugin that adds a custom Link field for creating internal and external links,\n * as well as `mailto` and `tel`-links, all using the same intuitive UI.\n *\n * @param options - Options for the plugin. See {@link LinkFieldPluginOptions}\n *\n * @example Minimal example\n * ```ts\n * // sanity.config.ts\n * import { defineConfig } from 'sanity'\n * import { linkField } from 'sanity-plugin-link-field'\n *\n * export default defineConfig((\n *  // ...\n *  plugins: [\n *    linkField()\n *  ]\n * })\n *\n * // mySchema.ts\n * import { defineField, defineType } from 'sanity';\n *\n * export const mySchema = defineType({\n *  // ...\n *  fields: [\n *    // ...\n *    defineField({\n *      name: 'link',\n *      title: 'Link',\n *      type: 'link'\n *    }),\n *  ]\n *});\n * ```\n */\nexport const linkField = definePlugin<LinkFieldPluginOptions | void>((opts) => {\n  const {\n    linkableSchemaTypes = ['page'],\n    weakReferences = false,\n    referenceFilterOptions,\n    descriptions = {\n      internal: 'Link to another page or document on the website.',\n      external: 'Link to an absolute URL to a page on another website.',\n      email: 'Link to send an e-mail to the given address.',\n      phone: 'Link to call the given phone number.',\n      advanced: 'Optional. Add anchor links and custom parameters.',\n      parameters: 'Optional. Add custom parameters to the URL, such as UTM tags.',\n      anchor: 'Optional. Add an anchor to link to a specific section on the page.',\n    },\n    enableLinkParameters = true,\n    enableAnchorLinks = true,\n    customLinkTypes = [],\n    icon,\n    preview,\n  } = opts || {}\n\n  const linkType = defineType({\n    name: 'link',\n    title: 'Link',\n    type: 'object',\n    icon,\n    preview,\n    fieldsets: [\n      {\n        name: 'advanced',\n        title: 'Advanced',\n        description: descriptions.advanced,\n        options: {\n          collapsible: true,\n          collapsed: true,\n        },\n      },\n    ],\n    fields: [\n      defineField({\n        name: 'text',\n        type: 'string',\n        description: descriptions.text,\n      }),\n\n      defineField({\n        name: 'type',\n        type: 'string',\n        initialValue: 'internal',\n        validation: (Rule) => Rule.required(),\n        components: {\n          input: (props) => LinkTypeInput({customLinkTypes, linkableSchemaTypes, ...props}),\n        },\n      }),\n\n      // Internal\n      defineField({\n        name: 'internalLink',\n        type: 'reference',\n        to: linkableSchemaTypes.map((type) => ({\n          type,\n        })),\n        weak: weakReferences,\n        options: {\n          disableNew: true,\n          ...referenceFilterOptions,\n        },\n        description: descriptions?.internal,\n        hidden: ({parent}) => !!parent?.type && parent?.type !== 'internal',\n      }),\n\n      // External\n      defineField({\n        name: 'url',\n        type: 'url',\n        description: descriptions?.external,\n        validation: (rule) =>\n          rule.uri({\n            allowRelative: true,\n            scheme: ['https', 'http'],\n          }),\n        hidden: ({parent}) => parent?.type !== 'external',\n      }),\n\n      // E-mail\n      defineField({\n        name: 'email',\n        type: 'email',\n        description: descriptions?.email,\n        hidden: ({parent}) => parent?.type !== 'email',\n      }),\n\n      // Phone\n      defineField({\n        name: 'phone',\n        type: 'string',\n        description: descriptions?.phone,\n        validation: (rule) =>\n          rule.custom((value, context) => {\n            // eslint-disable-next-line @typescript-eslint/no-explicit-any\n            if (!value || (context.parent as any)?.type !== 'phone') {\n              return true\n            }\n\n            return (\n              (new RegExp(/^\\+?[0-9\\s-]*$/).test(value) &&\n                !value.startsWith('-') &&\n                !value.endsWith('-')) ||\n              'Must be a valid phone number'\n            )\n          }),\n        hidden: ({parent}) => parent?.type !== 'phone',\n      }),\n\n      // Custom\n      defineField({\n        name: 'value',\n        type: 'string',\n        description: descriptions?.external,\n        hidden: ({parent}) => !parent || !isCustomLink(parent as LinkValue),\n        components: {\n          input: (props) => CustomLinkInput({customLinkTypes, ...props}),\n        },\n      }),\n\n      // New tab\n      defineField({\n        title: 'Open in new window',\n        name: 'blank',\n        type: 'boolean',\n        initialValue: false,\n        description: descriptions.blank,\n        hidden: ({parent}) => parent?.type === 'email' || parent?.type === 'phone',\n      }),\n\n      // Parameters\n      ...(enableLinkParameters || enableAnchorLinks\n        ? [\n            ...(enableLinkParameters\n              ? [\n                  defineField({\n                    title: 'Parameters',\n                    name: 'parameters',\n                    type: 'string',\n                    description: descriptions.parameters,\n                    validation: (rule) =>\n                      rule.custom((value, context) => {\n                        if (\n                          !value ||\n                          // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                          (context.parent as any)?.type === 'email' ||\n                          // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                          (context.parent as any)?.type === 'phone'\n                        ) {\n                          return true\n                        }\n\n                        if (value.indexOf('?') !== 0) {\n                          return 'Must start with ?; eg. ?utm_source=example.com&utm_medium=referral'\n                        }\n\n                        if (value.length === 1) {\n                          return 'Must contain at least one parameter'\n                        }\n\n                        return true\n                      }),\n                    hidden: ({parent}) => parent?.type === 'email' || parent?.type === 'phone',\n                    fieldset: 'advanced',\n                  }),\n                ]\n              : []),\n\n            // Anchor\n            ...(enableAnchorLinks\n              ? [\n                  defineField({\n                    title: 'Anchor',\n                    name: 'anchor',\n                    type: 'string',\n                    description: descriptions.anchor,\n                    validation: (rule) =>\n                      rule.custom((value, context) => {\n                        if (\n                          !value ||\n                          // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                          (context.parent as any)?.type === 'email' ||\n                          // eslint-disable-next-line @typescript-eslint/no-explicit-any\n                          (context.parent as any)?.type === 'phone'\n                        ) {\n                          return true\n                        }\n\n                        if (value.indexOf('#') !== 0) {\n                          return 'Must start with #; eg. #page-section-1'\n                        }\n\n                        if (value.length === 1) {\n                          return 'Must contain at least one character'\n                        }\n\n                        return (\n                          new RegExp(/^([-?/:@._~!$&'()*+,;=a-zA-Z0-9]|%[0-9a-fA-F]{2})*$/).test(\n                            value.replace(/^#/, ''),\n                          ) || 'Invalid URL fragment'\n                        )\n                      }),\n                    hidden: ({parent}) => parent?.type === 'email' || parent?.type === 'phone',\n                    fieldset: 'advanced',\n                  }),\n                ]\n              : []),\n          ]\n        : []),\n    ],\n    components: {\n      input: (props: ObjectInputProps) =>\n        LinkInput({customLinkTypes, ...props, value: props.value as LinkValue}),\n    },\n  })\n\n  return {\n    name: 'link-field',\n    schema: {\n      types: [linkType],\n    },\n  }\n})\n"],"names":["options","linkField","_a","value"],"mappings":";;;;;;;;AAQa,MAAA,oBAAoB,CAAC,UAA0C;AAC1E,QAAM,OAAO;AAET,SAAA,CAAC,QAAQ,CAAC,KAAK,OACV,qBAGL,eAAe,IAAI,KAAK,CAAC,KAAK,eACzB;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,MAIN,eAAe,IAAI,KAAK,CAAC,KAAK,MACzB;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,MAIN,YAAY,IAAI,KAAK,CAAC,KAAK,QACtB;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,MAIN,YAAY,IAAI,KAAK,CAAC,KAAK,QACtB;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,MAIN,aAAa,IAAI,KAAK,CAAC,KAAK,QACvB;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,EAIH,IAAA;AACT,GC5CM,iBAAiB,OAAO,OAAO;AAAA;AAAA;AAQ9B,SAAS,gBACd,OAGA;AACA,QAAM,YAAY,aACZ,GAAA,WAAW,aAAa,CAAE,CAAA,GAC1B,YAAY,aAAa,MAAM,KAAK,MAAM,GAAG,EAAE,CAAC,GAChD,CAAC,SAAS,UAAU,IAAI,SAAyC,IAAI,GAErE,iBAAiB,MAAM,gBAAgB,KAAK,CAAC,SAAS,KAAK,UAAU,UAAW,IAAI;AAE1F,SAAA,UAAU,MAAM;AACV,uBACE,MAAM,QAAQ,kBAAA,OAAA,SAAA,eAAgB,OAAO,IACvC,WAAW,eAAe,OAAO,IAEjC,eACG,QAAQ,UAAU,MAAM,MAAM,UAAU,WAAW,EACnD,KAAK,CAACA,aAAY,WAAWA,QAAO,CAAC;AAAA,EAAA,GAI3C,CAAC,gBAAgB,MAAM,MAAM,UAAU,WAAW,CAA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