You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
5.5 KiB
1 line
5.5 KiB
{"ast":null,"code":"const _excluded = [\"onKeyDown\"];\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}\n\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n\n/* eslint-disable jsx-a11y/anchor-has-content */\nimport * as React from 'react';\nimport { useEventCallback } from '@restart/hooks';\nimport { useButtonProps } from './Button';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function isTrivialHref(href) {\n return !href || href.trim() === '#';\n}\n\n/**\n * An generic `<a>` component that covers a few A11y cases, ensuring that\n * cases where the `href` is missing or trivial like \"#\" are treated like buttons.\n */\nconst Anchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {\n let {\n onKeyDown\n } = _ref,\n props = _objectWithoutPropertiesLoose(_ref, _excluded);\n const [buttonProps] = useButtonProps(Object.assign({\n tagName: 'a'\n }, props));\n const handleKeyDown = useEventCallback(e => {\n buttonProps.onKeyDown(e);\n onKeyDown == null ? void 0 : onKeyDown(e);\n });\n if (isTrivialHref(props.href) || props.role === 'button') {\n return /*#__PURE__*/_jsx(\"a\", Object.assign({\n ref: ref\n }, props, buttonProps, {\n onKeyDown: handleKeyDown\n }));\n }\n return /*#__PURE__*/_jsx(\"a\", Object.assign({\n ref: ref\n }, props, {\n onKeyDown: onKeyDown\n }));\n});\nAnchor.displayName = 'Anchor';\nexport default Anchor;","map":{"version":3,"names":["_excluded","_objectWithoutPropertiesLoose","source","excluded","target","sourceKeys","Object","keys","key","i","length","indexOf","React","useEventCallback","useButtonProps","jsx","_jsx","isTrivialHref","href","trim","Anchor","forwardRef","_ref","ref","onKeyDown","props","buttonProps","assign","tagName","handleKeyDown","e","role","displayName"],"sources":["C:/Cours/SAE/SAE-3.01/Scripted/Scripted/website/node_modules/@restart/ui/esm/Anchor.js"],"sourcesContent":["const _excluded = [\"onKeyDown\"];\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* eslint-disable jsx-a11y/no-static-element-interactions */\n\n/* eslint-disable jsx-a11y/anchor-has-content */\nimport * as React from 'react';\nimport { useEventCallback } from '@restart/hooks';\nimport { useButtonProps } from './Button';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function isTrivialHref(href) {\n return !href || href.trim() === '#';\n}\n\n/**\n * An generic `<a>` component that covers a few A11y cases, ensuring that\n * cases where the `href` is missing or trivial like \"#\" are treated like buttons.\n */\nconst Anchor = /*#__PURE__*/React.forwardRef((_ref, ref) => {\n let {\n onKeyDown\n } = _ref,\n props = _objectWithoutPropertiesLoose(_ref, _excluded);\n\n const [buttonProps] = useButtonProps(Object.assign({\n tagName: 'a'\n }, props));\n const handleKeyDown = useEventCallback(e => {\n buttonProps.onKeyDown(e);\n onKeyDown == null ? void 0 : onKeyDown(e);\n });\n\n if (isTrivialHref(props.href) || props.role === 'button') {\n return /*#__PURE__*/_jsx(\"a\", Object.assign({\n ref: ref\n }, props, buttonProps, {\n onKeyDown: handleKeyDown\n }));\n }\n\n return /*#__PURE__*/_jsx(\"a\", Object.assign({\n ref: ref\n }, props, {\n onKeyDown: onKeyDown\n }));\n});\nAnchor.displayName = 'Anchor';\nexport default Anchor;"],"mappings":"AAAA,MAAMA,SAAS,GAAG,CAAC,WAAW,CAAC;AAE/B,SAASC,6BAA6B,CAACC,MAAM,EAAEC,QAAQ,EAAE;EAAE,IAAID,MAAM,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;EAAE,IAAIE,MAAM,GAAG,CAAC,CA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