@xfers/design-system 4.4.1-dev.856958a21b → 4.4.1-dev.cb00412c99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -28,13 +28,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
var react_1 = require("react");
|
|
30
30
|
var styled_1 = require("@emotion/styled");
|
|
31
|
-
var
|
|
32
|
-
var
|
|
31
|
+
var Typography_1 = require("src/constants/Typography/Typography");
|
|
32
|
+
var theme_1 = require("src/theme/theme");
|
|
33
33
|
var Link = function (_a) {
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
|
|
34
|
+
var _b = _a.typographyType, typographyType = _b === void 0 ? 'body' : _b, _c = _a.size, size = _c === void 0 ? 'md' : _c, textContent = _a.textContent, children = _a.children, href = _a.href, target = _a.target, rel = _a.rel, _d = _a.isUnderlined, isUnderlined = _d === void 0 ? false : _d, icon = _a.icon, _e = _a.iconPlacement, iconPlacement = _e === void 0 ? 'left' : _e, onClick = _a.onClick, props = __rest(_a, ["typographyType", "size", "textContent", "children", "href", "target", "rel", "isUnderlined", "icon", "iconPlacement", "onClick"]);
|
|
35
|
+
var StyledLink = styled_1.default.a(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: ", ";\n align-items: center;\n gap: 4px;\n .material-symbols-rounded {\n color: ", " !important;\n }\n text-decoration: ", ";\n text-decoration-color: ", ";\n :hover {\n text-decoration: ", ";\n }\n user-select: none;\n "], ["\n display: ", ";\n align-items: center;\n gap: 4px;\n .material-symbols-rounded {\n color: ", " !important;\n }\n text-decoration: ", ";\n text-decoration-color: ", ";\n :hover {\n text-decoration: ", ";\n }\n user-select: none;\n "])), icon ? 'flex' : 'inline-flex', theme_1.straitsXTheme.color.base.link, isUnderlined ? 'underline' : 'none', theme_1.straitsXTheme.color.base.link, isUnderlined ? 'underline' : 'none');
|
|
36
|
+
var toShowIconOnLeft = icon && iconPlacement === 'left';
|
|
37
|
+
var toShowIconOnRight = icon && iconPlacement === 'right';
|
|
38
|
+
var content = textContent || children;
|
|
39
|
+
return (react_1.default.createElement(StyledLink, __assign({ href: href, target: target, rel: rel, onClick: onClick }, props),
|
|
40
|
+
toShowIconOnLeft && icon,
|
|
41
|
+
typographyType === 'body' && (react_1.default.createElement(Typography_1.Typography.Body, { size: size, color: theme_1.straitsXTheme.color.base.link }, content)),
|
|
42
|
+
typographyType === 'label' && (react_1.default.createElement(Typography_1.Typography.Label, { size: size, color: theme_1.straitsXTheme.color.base.link }, content)),
|
|
43
|
+
toShowIconOnRight && icon));
|
|
38
44
|
};
|
|
39
45
|
exports.default = Link;
|
|
40
46
|
var templateObject_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Link/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyB;AACzB,0CAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Link/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAyB;AACzB,0CAAoC;AACpC,kEAAgE;AAChE,yCAA+C;AAgB/C,IAAM,IAAI,GAAG,UAAC,EAaN;IAZN,IAAA,sBAAuB,EAAvB,cAAc,mBAAG,MAAM,KAAA,EACvB,YAAW,EAAX,IAAI,mBAAG,IAAI,KAAA,EACX,WAAW,iBAAA,EACX,QAAQ,cAAA,EACR,IAAI,UAAA,EACJ,MAAM,YAAA,EACN,GAAG,SAAA,EACH,oBAAoB,EAApB,YAAY,mBAAG,KAAK,KAAA,EACpB,IAAI,UAAA,EACJ,qBAAsB,EAAtB,aAAa,mBAAG,MAAM,KAAA,EACtB,OAAO,aAAA,EACJ,KAAK,cAZI,kIAab,CADS;IAER,IAAM,UAAU,GAAG,gBAAM,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
|
-
|
|
2
|
+
type Props = {
|
|
3
|
+
typographyType?: 'body' | 'label';
|
|
4
|
+
size?: 'md' | 'sm';
|
|
5
|
+
textContent?: string;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
href?: string;
|
|
8
|
+
target?: string;
|
|
9
|
+
rel?: string;
|
|
10
|
+
isUnderlined?: boolean;
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
iconPlacement?: 'left' | 'right';
|
|
13
|
+
onClick?: () => void;
|
|
4
14
|
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
5
|
-
declare const Link: ({ size, children, ...props }:
|
|
15
|
+
declare const Link: ({ typographyType, size, textContent, children, href, target, rel, isUnderlined, icon, iconPlacement, onClick, ...props }: Props) => React.JSX.Element;
|
|
6
16
|
export default Link;
|