@activecollab/components 2.0.512 → 2.0.514
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.
- package/dist/cjs/components/Links/Link.js +13 -4
- package/dist/cjs/components/Links/Link.js.map +1 -1
- package/dist/esm/components/Links/Link.d.ts +10 -1
- package/dist/esm/components/Links/Link.d.ts.map +1 -1
- package/dist/esm/components/Links/Link.js +13 -4
- package/dist/esm/components/Links/Link.js.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,14 +8,21 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _Styles = require("./Styles");
|
|
10
10
|
var _OpenExpanded = _interopRequireDefault(require("../Icons/collection/OpenExpanded"));
|
|
11
|
-
var _excluded = ["as", "children", "variant", "size", "disabled", "className", "isExternal"];
|
|
11
|
+
var _excluded = ["as", "children", "variant", "size", "disabled", "className", "isExternal", "iconOnly"];
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
14
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
15
15
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
16
16
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
17
17
|
/**
|
|
18
|
-
* Link
|
|
18
|
+
* @component Link
|
|
19
|
+
* @description
|
|
20
|
+
* Link component renders an anchor (or the element passed in `as`) styled like a Button.
|
|
21
|
+
*
|
|
22
|
+
* @prop {variant} - adds unique look and feel to link.
|
|
23
|
+
* @prop {size} - controls the size of a link.
|
|
24
|
+
* @prop {isExternal} - renders an OpenExpanded icon to the right of children.
|
|
25
|
+
* @prop {iconOnly} - sizes the link to its icon; required for icon-only links.
|
|
19
26
|
*/
|
|
20
27
|
var Link = exports.Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
21
28
|
var as = _ref.as,
|
|
@@ -28,6 +35,8 @@ var Link = exports.Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
28
35
|
className = _ref.className,
|
|
29
36
|
_ref$isExternal = _ref.isExternal,
|
|
30
37
|
isExternal = _ref$isExternal === void 0 ? false : _ref$isExternal,
|
|
38
|
+
_ref$iconOnly = _ref.iconOnly,
|
|
39
|
+
iconOnly = _ref$iconOnly === void 0 ? false : _ref$iconOnly,
|
|
31
40
|
args = _objectWithoutProperties(_ref, _excluded);
|
|
32
41
|
var Component = as || "a";
|
|
33
42
|
return /*#__PURE__*/_react.default.createElement(_Styles.StyledLink, _extends({
|
|
@@ -43,12 +52,12 @@ var Link = exports.Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, re
|
|
|
43
52
|
"c-link--circle_raised": variant === "circle raised",
|
|
44
53
|
"c-link--big": size === "big",
|
|
45
54
|
"c-link--small": size === "small",
|
|
46
|
-
"c-link--icon-only":
|
|
55
|
+
"c-link--icon-only": iconOnly,
|
|
47
56
|
"c-link--disabled": disabled
|
|
48
57
|
}),
|
|
49
58
|
variant: variant,
|
|
50
59
|
size: size,
|
|
51
|
-
$iconOnly:
|
|
60
|
+
$iconOnly: iconOnly
|
|
52
61
|
}, args), children instanceof Array || isExternal ? /*#__PURE__*/_react.default.createElement(_Styles.StyledLinkElements, {
|
|
53
62
|
className: "c-link__elements"
|
|
54
63
|
}, (children instanceof Array ? children : [children]).map(function (value, index) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Styles","_OpenExpanded","_excluded","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","_objectWithoutProperties","_objectWithoutPropertiesLoose","getOwnPropertySymbols","indexOf","propertyIsEnumerable","Link","exports","forwardRef","_ref","ref","as","children","_ref$variant","variant","size","_ref$disabled","disabled","className","_ref$isExternal","isExternal","args","Component","createElement","StyledLink","classNames","
|
|
1
|
+
{"version":3,"file":"Link.js","names":["_react","_interopRequireWildcard","require","_classnames","_interopRequireDefault","_Styles","_OpenExpanded","_excluded","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_extends","assign","bind","arguments","length","apply","_objectWithoutProperties","_objectWithoutPropertiesLoose","getOwnPropertySymbols","indexOf","propertyIsEnumerable","Link","exports","forwardRef","_ref","ref","as","children","_ref$variant","variant","size","_ref$disabled","disabled","className","_ref$isExternal","isExternal","_ref$iconOnly","iconOnly","args","Component","createElement","StyledLink","classNames","$iconOnly","Array","StyledLinkElements","map","value","index","StyledLinkElement","key","width","height","displayName"],"sources":["../../../../src/components/Links/Link.tsx"],"sourcesContent":["import React, { BaseHTMLAttributes, ReactNode, forwardRef } from \"react\";\n\nimport classNames from \"classnames\";\n\nimport { StyledLink, StyledLinkElement, StyledLinkElements } from \"./Styles\";\nimport {\n PolymorphicComponentPropsWithRef,\n PolymorphicRef,\n} from \"../../utils/types\";\nimport OpenExpandedIcon from \"../Icons/collection/OpenExpanded\";\n\nexport interface ILinkProps extends BaseHTMLAttributes<HTMLElement> {\n /** Children type of node or string */\n children: ReactNode | string;\n /** Variant Buttons */\n variant?:\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"option\"\n | \"contained\"\n | \"outlined\"\n | \"text colored\"\n | \"text gray\"\n | \"dark transparent\"\n | \"circle raised\"\n | \"text link-primary\"\n | \"text link-gray\";\n /** Button size can be big, medium or small */\n size?: \"big\" | \"small\";\n /** Disabled prop */\n disabled?: boolean;\n /** CSS classes */\n className?: string;\n /** Renders an OpenExpanded icon to the right of children */\n isExternal?: boolean;\n /** Square link sized to its icon (32/24/40px, no padding). Required for icon-only links. */\n iconOnly?: boolean;\n}\n\nexport type LinkProps<C extends React.ElementType> =\n PolymorphicComponentPropsWithRef<C, ILinkProps>;\n\nexport type LinkComponent = <C extends React.ElementType = \"a\">(\n props: LinkProps<C>\n) => React.ReactElement | ReactNode | null;\n\n/**\n * @component Link\n * @description\n * Link component renders an anchor (or the element passed in `as`) styled like a Button.\n *\n * @prop {variant} - adds unique look and feel to link.\n * @prop {size} - controls the size of a link.\n * @prop {isExternal} - renders an OpenExpanded icon to the right of children.\n * @prop {iconOnly} - sizes the link to its icon; required for icon-only links.\n */\nexport const Link: LinkComponent & { displayName?: string } = forwardRef(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - due to @node/types making ts more strict\n <C extends React.ElementType = \"a\">(\n {\n as,\n children,\n variant = \"contained\",\n size,\n disabled = false,\n className,\n isExternal = false,\n iconOnly = false,\n ...args\n }: LinkProps<C>,\n ref?: PolymorphicRef<C>\n ) => {\n const Component = as || \"a\";\n\n return (\n <StyledLink\n ref={ref}\n as={Component}\n disabled={disabled}\n className={classNames(\"c-link\", className, {\n \"c-link--contained\": variant === \"primary\" || variant === \"contained\",\n \"c-link--outlined\": variant === \"secondary\" || variant === \"outlined\",\n \"c-link--text_colored\":\n variant === \"tertiary\" || variant === \"text colored\",\n \"c-link--text_gray\": variant === \"option\" || variant === \"text gray\",\n \"c-link--dark_transparent\": variant === \"dark transparent\",\n \"c-link--circle_raised\": variant === \"circle raised\",\n \"c-link--big\": size === \"big\",\n \"c-link--small\": size === \"small\",\n \"c-link--icon-only\": iconOnly,\n \"c-link--disabled\": disabled,\n })}\n variant={variant}\n size={size}\n $iconOnly={iconOnly}\n {...args}\n >\n {children instanceof Array || isExternal ? (\n <StyledLinkElements className=\"c-link__elements\">\n {(children instanceof Array ? children : [children]).map(\n (value, index) =>\n value ? (\n <StyledLinkElement\n className=\"c-link__elements__element\"\n key={index}\n >\n {value}\n </StyledLinkElement>\n ) : null\n )}\n {isExternal && (\n <StyledLinkElement className=\"c-link__elements__element\">\n <OpenExpandedIcon width={16} height={16} />\n </StyledLinkElement>\n )}\n </StyledLinkElements>\n ) : (\n children\n )}\n </StyledLink>\n );\n }\n);\n\nLink.displayName = \"Link\";\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,aAAA,GAAAF,sBAAA,CAAAF,OAAA;AAAgE,IAAAK,SAAA;AAAA,SAAAH,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAA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EPX,QAAQ,YAAYiB,KAAK,IAAIT,UAAU,gBACtCrD,MAAA,CAAAU,OAAA,CAAAgD,aAAA,CAACrD,OAAA,CAAA0D,kBAAkB;IAACZ,SAAS,EAAC;EAAkB,GAC7C,CAACN,QAAQ,YAAYiB,KAAK,GAAGjB,QAAQ,GAAG,CAACA,QAAQ,CAAC,EAAEmB,GAAG,CACtD,UAACC,KAAK,EAAEC,KAAK;IAAA,OACXD,KAAK,gBACHjE,MAAA,CAAAU,OAAA,CAAAgD,aAAA,CAACrD,OAAA,CAAA8D,iBAAiB;MAChBhB,SAAS,EAAC,2BAA2B;MACrCiB,GAAG,EAAEF;IAAM,GAEVD,KACgB,CAAC,GAClB,IAAI;EAAA,CACZ,CAAC,EACAZ,UAAU,iBACTrD,MAAA,CAAAU,OAAA,CAAAgD,aAAA,CAACrD,OAAA,CAAA8D,iBAAiB;IAAChB,SAAS,EAAC;EAA2B,gBACtDnD,MAAA,CAAAU,OAAA,CAAAgD,aAAA,CAACpD,aAAA,CAAAI,OAAgB;IAAC2D,KAAK,EAAE,EAAG;IAACC,MAAM,EAAE;EAAG,CAAE,CACzB,CAEH,CAAC,GAErBzB,QAEQ,CAAC;AAEjB,CACF,CAAC;AAEDN,IAAI,CAACgC,WAAW,GAAG,MAAM","ignoreList":[]}
|
|
@@ -13,11 +13,20 @@ export interface ILinkProps extends BaseHTMLAttributes<HTMLElement> {
|
|
|
13
13
|
className?: string;
|
|
14
14
|
/** Renders an OpenExpanded icon to the right of children */
|
|
15
15
|
isExternal?: boolean;
|
|
16
|
+
/** Square link sized to its icon (32/24/40px, no padding). Required for icon-only links. */
|
|
17
|
+
iconOnly?: boolean;
|
|
16
18
|
}
|
|
17
19
|
export type LinkProps<C extends React.ElementType> = PolymorphicComponentPropsWithRef<C, ILinkProps>;
|
|
18
20
|
export type LinkComponent = <C extends React.ElementType = "a">(props: LinkProps<C>) => React.ReactElement | ReactNode | null;
|
|
19
21
|
/**
|
|
20
|
-
* Link
|
|
22
|
+
* @component Link
|
|
23
|
+
* @description
|
|
24
|
+
* Link component renders an anchor (or the element passed in `as`) styled like a Button.
|
|
25
|
+
*
|
|
26
|
+
* @prop {variant} - adds unique look and feel to link.
|
|
27
|
+
* @prop {size} - controls the size of a link.
|
|
28
|
+
* @prop {isExternal} - renders an OpenExpanded icon to the right of children.
|
|
29
|
+
* @prop {iconOnly} - sizes the link to its icon; required for icon-only links.
|
|
21
30
|
*/
|
|
22
31
|
export declare const Link: LinkComponent & {
|
|
23
32
|
displayName?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../src/components/Links/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAKzE,OAAO,EACL,gCAAgC,EAEjC,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,UAAW,SAAQ,kBAAkB,CAAC,WAAW,CAAC;IACjE,sCAAsC;IACtC,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7B,sBAAsB;IACtB,OAAO,CAAC,EACJ,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,WAAW,GACX,UAAU,GACV,cAAc,GACd,WAAW,GACX,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,gBAAgB,CAAC;IACrB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACvB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../../src/components/Links/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAKzE,OAAO,EACL,gCAAgC,EAEjC,MAAM,mBAAmB,CAAC;AAG3B,MAAM,WAAW,UAAW,SAAQ,kBAAkB,CAAC,WAAW,CAAC;IACjE,sCAAsC;IACtC,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7B,sBAAsB;IACtB,OAAO,CAAC,EACJ,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,GACR,WAAW,GACX,UAAU,GACV,cAAc,GACd,WAAW,GACX,kBAAkB,GAClB,eAAe,GACf,mBAAmB,GACnB,gBAAgB,CAAC;IACrB,8CAA8C;IAC9C,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IACvB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAC/C,gCAAgC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,GAAG,EAC5D,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAChB,KAAK,CAAC,YAAY,GAAG,SAAS,GAAG,IAAI,CAAC;AAE3C;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,EAAE,aAAa,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAmExD,CAAC"}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["as", "children", "variant", "size", "disabled", "className", "isExternal"];
|
|
3
|
+
const _excluded = ["as", "children", "variant", "size", "disabled", "className", "isExternal", "iconOnly"];
|
|
4
4
|
import React, { forwardRef } from "react";
|
|
5
5
|
import classNames from "classnames";
|
|
6
6
|
import { StyledLink, StyledLinkElement, StyledLinkElements } from "./Styles";
|
|
7
7
|
import OpenExpandedIcon from "../Icons/collection/OpenExpanded";
|
|
8
8
|
/**
|
|
9
|
-
* Link
|
|
9
|
+
* @component Link
|
|
10
|
+
* @description
|
|
11
|
+
* Link component renders an anchor (or the element passed in `as`) styled like a Button.
|
|
12
|
+
*
|
|
13
|
+
* @prop {variant} - adds unique look and feel to link.
|
|
14
|
+
* @prop {size} - controls the size of a link.
|
|
15
|
+
* @prop {isExternal} - renders an OpenExpanded icon to the right of children.
|
|
16
|
+
* @prop {iconOnly} - sizes the link to its icon; required for icon-only links.
|
|
10
17
|
*/
|
|
11
18
|
export const Link = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
12
19
|
let as = _ref.as,
|
|
@@ -19,6 +26,8 @@ export const Link = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
19
26
|
className = _ref.className,
|
|
20
27
|
_ref$isExternal = _ref.isExternal,
|
|
21
28
|
isExternal = _ref$isExternal === void 0 ? false : _ref$isExternal,
|
|
29
|
+
_ref$iconOnly = _ref.iconOnly,
|
|
30
|
+
iconOnly = _ref$iconOnly === void 0 ? false : _ref$iconOnly,
|
|
22
31
|
args = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
23
32
|
const Component = as || "a";
|
|
24
33
|
return /*#__PURE__*/React.createElement(StyledLink, _extends({
|
|
@@ -34,12 +43,12 @@ export const Link = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
34
43
|
"c-link--circle_raised": variant === "circle raised",
|
|
35
44
|
"c-link--big": size === "big",
|
|
36
45
|
"c-link--small": size === "small",
|
|
37
|
-
"c-link--icon-only":
|
|
46
|
+
"c-link--icon-only": iconOnly,
|
|
38
47
|
"c-link--disabled": disabled
|
|
39
48
|
}),
|
|
40
49
|
variant: variant,
|
|
41
50
|
size: size,
|
|
42
|
-
$iconOnly:
|
|
51
|
+
$iconOnly: iconOnly
|
|
43
52
|
}, args), children instanceof Array || isExternal ? /*#__PURE__*/React.createElement(StyledLinkElements, {
|
|
44
53
|
className: "c-link__elements"
|
|
45
54
|
}, (children instanceof Array ? children : [children]).map((value, index) => value ? /*#__PURE__*/React.createElement(StyledLinkElement, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["React","forwardRef","classNames","StyledLink","StyledLinkElement","StyledLinkElements","OpenExpandedIcon","Link","_ref","ref","as","children","_ref$variant","variant","size","_ref$disabled","disabled","className","_ref$isExternal","isExternal","args","_objectWithoutPropertiesLoose","_excluded","Component","createElement","_extends","
|
|
1
|
+
{"version":3,"file":"Link.js","names":["React","forwardRef","classNames","StyledLink","StyledLinkElement","StyledLinkElements","OpenExpandedIcon","Link","_ref","ref","as","children","_ref$variant","variant","size","_ref$disabled","disabled","className","_ref$isExternal","isExternal","_ref$iconOnly","iconOnly","args","_objectWithoutPropertiesLoose","_excluded","Component","createElement","_extends","$iconOnly","Array","map","value","index","key","width","height","displayName"],"sources":["../../../../src/components/Links/Link.tsx"],"sourcesContent":["import React, { BaseHTMLAttributes, ReactNode, forwardRef } from \"react\";\n\nimport classNames from \"classnames\";\n\nimport { StyledLink, StyledLinkElement, StyledLinkElements } from \"./Styles\";\nimport {\n PolymorphicComponentPropsWithRef,\n PolymorphicRef,\n} from \"../../utils/types\";\nimport OpenExpandedIcon from \"../Icons/collection/OpenExpanded\";\n\nexport interface ILinkProps extends BaseHTMLAttributes<HTMLElement> {\n /** Children type of node or string */\n children: ReactNode | string;\n /** Variant Buttons */\n variant?:\n | \"primary\"\n | \"secondary\"\n | \"tertiary\"\n | \"option\"\n | \"contained\"\n | \"outlined\"\n | \"text colored\"\n | \"text gray\"\n | \"dark transparent\"\n | \"circle raised\"\n | \"text link-primary\"\n | \"text link-gray\";\n /** Button size can be big, medium or small */\n size?: \"big\" | \"small\";\n /** Disabled prop */\n disabled?: boolean;\n /** CSS classes */\n className?: string;\n /** Renders an OpenExpanded icon to the right of children */\n isExternal?: boolean;\n /** Square link sized to its icon (32/24/40px, no padding). Required for icon-only links. */\n iconOnly?: boolean;\n}\n\nexport type LinkProps<C extends React.ElementType> =\n PolymorphicComponentPropsWithRef<C, ILinkProps>;\n\nexport type LinkComponent = <C extends React.ElementType = \"a\">(\n props: LinkProps<C>\n) => React.ReactElement | ReactNode | null;\n\n/**\n * @component Link\n * @description\n * Link component renders an anchor (or the element passed in `as`) styled like a Button.\n *\n * @prop {variant} - adds unique look and feel to link.\n * @prop {size} - controls the size of a link.\n * @prop {isExternal} - renders an OpenExpanded icon to the right of children.\n * @prop {iconOnly} - sizes the link to its icon; required for icon-only links.\n */\nexport const Link: LinkComponent & { displayName?: string } = forwardRef(\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - due to @node/types making ts more strict\n <C extends React.ElementType = \"a\">(\n {\n as,\n children,\n variant = \"contained\",\n size,\n disabled = false,\n className,\n isExternal = false,\n iconOnly = false,\n ...args\n }: LinkProps<C>,\n ref?: PolymorphicRef<C>\n ) => {\n const Component = as || \"a\";\n\n return (\n <StyledLink\n ref={ref}\n as={Component}\n disabled={disabled}\n className={classNames(\"c-link\", className, {\n \"c-link--contained\": variant === \"primary\" || variant === \"contained\",\n \"c-link--outlined\": variant === \"secondary\" || variant === \"outlined\",\n \"c-link--text_colored\":\n variant === \"tertiary\" || variant === \"text colored\",\n \"c-link--text_gray\": variant === \"option\" || variant === \"text gray\",\n \"c-link--dark_transparent\": variant === \"dark transparent\",\n \"c-link--circle_raised\": variant === \"circle raised\",\n \"c-link--big\": size === \"big\",\n \"c-link--small\": size === \"small\",\n \"c-link--icon-only\": iconOnly,\n \"c-link--disabled\": disabled,\n })}\n variant={variant}\n size={size}\n $iconOnly={iconOnly}\n {...args}\n >\n {children instanceof Array || isExternal ? (\n <StyledLinkElements className=\"c-link__elements\">\n {(children instanceof Array ? children : [children]).map(\n (value, index) =>\n value ? (\n <StyledLinkElement\n className=\"c-link__elements__element\"\n key={index}\n >\n {value}\n </StyledLinkElement>\n ) : null\n )}\n {isExternal && (\n <StyledLinkElement className=\"c-link__elements__element\">\n <OpenExpandedIcon width={16} height={16} />\n </StyledLinkElement>\n )}\n </StyledLinkElements>\n ) : (\n children\n )}\n </StyledLink>\n );\n }\n);\n\nLink.displayName = \"Link\";\n"],"mappings":";;;AAAA,OAAOA,KAAK,IAAmCC,UAAU,QAAQ,OAAO;AAExE,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAASC,UAAU,EAAEC,iBAAiB,EAAEC,kBAAkB,QAAQ,UAAU;AAK5E,OAAOC,gBAAgB,MAAM,kCAAkC;AAsC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAA8C,gBAAGN,UAAU,CAGtE,CAAAO,IAAA,EAYEC,GAAuB,KACpB;EAAA,IAXDC,EAAE,GAAAF,IAAA,CAAFE,EAAE;IACFC,QAAQ,GAAAH,IAAA,CAARG,QAAQ;IAAAC,YAAA,GAAAJ,IAAA,CACRK,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,WAAW,GAAAA,YAAA;IACrBE,IAAI,GAAAN,IAAA,CAAJM,IAAI;IAAAC,aAAA,GAAAP,IAAA,CACJQ,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,KAAK,GAAAA,aAAA;IAChBE,SAAS,GAAAT,IAAA,CAATS,SAAS;IAAAC,eAAA,GAAAV,IAAA,CACTW,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,KAAK,GAAAA,eAAA;IAAAE,aAAA,GAAAZ,IAAA,CAClBa,QAAQ;IAARA,QAAQ,GAAAD,aAAA,cAAG,KAAK,GAAAA,aAAA;IACbE,IAAI,GAAAC,6BAAA,CAAAf,IAAA,EAAAgB,SAAA;EAIT,MAAMC,SAAS,GA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tB,iBAAiB;IAACa,SAAS,EAAC;EAA2B,gBACtDjB,KAAA,CAAA0B,aAAA,CAACpB,gBAAgB;IAAC4B,KAAK,EAAE,EAAG;IAACC,MAAM,EAAE;EAAG,CAAE,CACzB,CAEH,CAAC,GAErBxB,QAEQ,CAAC;AAEjB,CACF,CAAC;AAEDJ,IAAI,CAAC6B,WAAW,GAAG,MAAM","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -28622,9 +28622,16 @@
|
|
|
28622
28622
|
};
|
|
28623
28623
|
BackLink.displayName = "BackLink";
|
|
28624
28624
|
|
|
28625
|
-
var _excluded$P = ["as", "children", "variant", "size", "disabled", "className", "isExternal"];
|
|
28625
|
+
var _excluded$P = ["as", "children", "variant", "size", "disabled", "className", "isExternal", "iconOnly"];
|
|
28626
28626
|
/**
|
|
28627
|
-
* Link
|
|
28627
|
+
* @component Link
|
|
28628
|
+
* @description
|
|
28629
|
+
* Link component renders an anchor (or the element passed in `as`) styled like a Button.
|
|
28630
|
+
*
|
|
28631
|
+
* @prop {variant} - adds unique look and feel to link.
|
|
28632
|
+
* @prop {size} - controls the size of a link.
|
|
28633
|
+
* @prop {isExternal} - renders an OpenExpanded icon to the right of children.
|
|
28634
|
+
* @prop {iconOnly} - sizes the link to its icon; required for icon-only links.
|
|
28628
28635
|
*/
|
|
28629
28636
|
var Link = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
28630
28637
|
var as = _ref.as,
|
|
@@ -28637,6 +28644,8 @@
|
|
|
28637
28644
|
className = _ref.className,
|
|
28638
28645
|
_ref$isExternal = _ref.isExternal,
|
|
28639
28646
|
isExternal = _ref$isExternal === void 0 ? false : _ref$isExternal,
|
|
28647
|
+
_ref$iconOnly = _ref.iconOnly,
|
|
28648
|
+
iconOnly = _ref$iconOnly === void 0 ? false : _ref$iconOnly,
|
|
28640
28649
|
args = _objectWithoutProperties(_ref, _excluded$P);
|
|
28641
28650
|
var Component = as || "a";
|
|
28642
28651
|
return /*#__PURE__*/React__default["default"].createElement(StyledLink$1, _extends({
|
|
@@ -28652,12 +28661,12 @@
|
|
|
28652
28661
|
"c-link--circle_raised": variant === "circle raised",
|
|
28653
28662
|
"c-link--big": size === "big",
|
|
28654
28663
|
"c-link--small": size === "small",
|
|
28655
|
-
"c-link--icon-only":
|
|
28664
|
+
"c-link--icon-only": iconOnly,
|
|
28656
28665
|
"c-link--disabled": disabled
|
|
28657
28666
|
}),
|
|
28658
28667
|
variant: variant,
|
|
28659
28668
|
size: size,
|
|
28660
|
-
$iconOnly:
|
|
28669
|
+
$iconOnly: iconOnly
|
|
28661
28670
|
}, args), children instanceof Array || isExternal ? /*#__PURE__*/React__default["default"].createElement(StyledLinkElements, {
|
|
28662
28671
|
className: "c-link__elements"
|
|
28663
28672
|
}, (children instanceof Array ? children : [children]).map(function (value, index) {
|