@workday/canvas-kit-react
Version:
The parent module that contains all Workday Canvas Kit React components
26 lines (25 loc) • 2.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExternalHyperlink = exports.externalHyperlinkStencil = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const common_1 = require("@workday/canvas-kit-react/common");
const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
const icon_1 = require("@workday/canvas-kit-react/icon");
const Hyperlink_1 = require("./Hyperlink");
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
exports.externalHyperlinkStencil = (0, canvas_kit_styling_1.createStencil)({
extends: Hyperlink_1.hyperlinkStencil,
parts: {
externalHyperlinkIcon: 'external-hyperlink-icon',
},
base: { name: "2kr2no", styles: "box-sizing:border-box;[data-part=\"external-hyperlink-icon\"]{vertical-align:text-top;--color-system-icon-3a4847:currentColor;--size-svg-8fcab8:1em;width:calc(1em - 0.0625rem);min-width:calc(var(--cnvs-sys-space-x4) - 0.0625rem);margin-inline-start:calc(var(--cnvs-sys-space-x1) - 0.125rem);& > svg{min-width:var(--cnvs-sys-space-x4);min-height:var(--cnvs-sys-space-x4);}:dir(rtl){transform:rotate(270deg);}}" }
}, "external-hyperlink-170667");
/**
* `ExternalHyperlink`s also have an `inverse` variant. Use this variant when you need to place the
* link on a dark or colorful background such as `blueberry400`.
*/
exports.ExternalHyperlink = (0, common_1.createComponent)('a')({
displayName: 'ExternalHyperlink',
Component: ({ children, iconLabel, variant, ...elemProps }, ref, Element) => ((0, jsx_runtime_1.jsxs)(Element, { ref: ref, target: "_blank", rel: "noreferrer", ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, (0, exports.externalHyperlinkStencil)({ variant })), children: [(0, jsx_runtime_1.jsx)("span", { "data-part": "external-hyperlink-children", children: children }), (0, jsx_runtime_1.jsx)(icon_1.SystemIcon, { icon: canvas_system_icons_web_1.extLinkIcon, role: "img", "aria-label": iconLabel, ...exports.externalHyperlinkStencil.parts.externalHyperlinkIcon })] })),
});