{"version":3,"file":"disabledLink.cjs","sources":["../../../../src/components/utils/disabledLink.ts"],"sourcesContent":["import React from 'react';\n\n// Disabled + href renders a PLACEHOLDER LINK: an <a> without href (valid\n// HTML), announced as a link via role (an anchor without href has no\n// implicit link role), kept focusable via tabIndex so keyboard and\n// screen-reader users can still discover the disabled control — the\n// aria-disabled pattern. The tag is forced to 'a' (a consumer tag like a\n// router Link would crash without href). `disabled` stays in the props so\n// the disabled styling/extraction still applies; getComponentConfig\n// suppresses the native disabled attr on tags that don't support it, which\n// keeps the placeholder link in the tab order. Enter/Space activation and\n// clicks are blocked.\nexport function resolveDisabledLink<T extends Record<string, unknown> & { href?: string }>(\n  props: T,\n  isDisabled: boolean\n): T {\n  if (!isDisabled || !props.href) return props;\n  const { href: _href, ...withoutHref } = props;\n  return {\n    ...withoutHref,\n    tag: 'a',\n    'aria-disabled': true,\n    role: 'link',\n    tabIndex: (props.tabIndex as number | undefined) ?? 0,\n    onClick: (e: React.MouseEvent) => {\n      e.preventDefault();\n    },\n    onKeyDown: (e: React.KeyboardEvent) => {\n      if (e.key === 'Enter' || e.key === ' ') {\n        e.preventDefault();\n      }\n    },\n  } as unknown as T;\n}\n"],"names":[],"mappings":";;AAYO,SAAS,mBAAA,CACd,OACA,UAAA,EACG;AACH,EAAA,IAAI,CAAC,UAAA,IAAc,CAAC,KAAA,CAAM,MAAM,OAAO,KAAA;AACvC,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAO,GAAG,aAAY,GAAI,KAAA;AACxC,EAAA,OAAO;AAAA,IACL,GAAG,WAAA;AAAA,IACH,GAAA,EAAK,GAAA;AAAA,IACL,eAAA,EAAiB,IAAA;AAAA,IACjB,IAAA,EAAM,MAAA;AAAA,IACN,QAAA,EAAW,MAAM,QAAA,IAAmC,CAAA;AAAA,IACpD,OAAA,EAAS,CAAC,CAAA,KAAwB;AAChC,MAAA,CAAA,CAAE,cAAA,EAAe;AAAA,IACnB,CAAA;AAAA,IACA,SAAA,EAAW,CAAC,CAAA,KAA2B;AACrC,MAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,OAAA,IAAW,CAAA,CAAE,QAAQ,GAAA,EAAK;AACtC,QAAA,CAAA,CAAE,cAAA,EAAe;AAAA,MACnB;AAAA,IACF;AAAA,GACF;AACF;;;;"}