Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@clayui/link

Package Overview
Dependencies
Maintainers
13
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clayui/link - npm Package Compare versions

Comparing version
3.144.1
to
3.157.0-alpha.1
+35
-14
lib/cjs/Context.js
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Context_exports = {};
__export(Context_exports, {
default: () => Context_default
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
const context = /*#__PURE__*/_react.default.createContext('a');
context.displayName = 'ClayLinkContext';
var _default = exports.default = context;
module.exports = __toCommonJS(Context_exports);
var import_react = __toESM(require("react"));
const context = import_react.default.createContext("a");
context.displayName = "ClayLinkContext";
var Context_default = context;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "ClayLinkContext", {
enumerable: true,
get: function () {
return _Context.default;
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var src_exports = {};
__export(src_exports, {
ClayLinkContext: () => import_Context.default,
default: () => src_default
});
exports.default = void 0;
var _Link = _interopRequireDefault(require("./Link"));
var _Context = _interopRequireDefault(require("./Context"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
var _default = exports.default = _Link.default;
module.exports = __toCommonJS(src_exports);
var import_Link = __toESM(require("./Link"));
var import_Context = __toESM(require("./Context"));
var src_default = import_Link.default;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Link_exports = {};
__export(Link_exports, {
default: () => Link_default
});
exports.default = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _react = _interopRequireDefault(require("react"));
var _Context = _interopRequireDefault(require("./Context"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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); } /**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
module.exports = __toCommonJS(Link_exports);
var import_classnames = __toESM(require("classnames"));
var import_react = __toESM(require("react"));
var import_Context = __toESM(require("./Context"));
const LINK_PRESETS = {
danger: {
base: 'c-link text-danger',
decoration: 'underline'
base: "c-link text-danger",
decoration: "underline"
},
primary: {
base: 'c-link link-primary',
decoration: 'underline'
base: "c-link link-primary",
decoration: "underline"
},
secondary: {
base: 'c-link link-secondary',
decoration: 'underline'
base: "c-link link-secondary",
decoration: "underline"
},
tertiary: {
base: 'c-link text-tertiary',
base: "c-link text-tertiary",
decoration: null
},
unstyled: {
base: 'link-unstyled',
base: "link-unstyled",
decoration: null

@@ -38,10 +60,10 @@ }

const FONT_WEIGHTS = {
normal: 'font-weight-normal',
'semi-bold': 'font-weight-semi-bold'
"normal": "font-weight-normal",
"semi-bold": "font-weight-semi-bold"
};
const defaultMessages = {
opensNewWindow: '(Opens a new window)'
opensNewWindow: "(Opens a new window)"
};
const Link = /*#__PURE__*/_react.default.forwardRef((_ref, ref) => {
let {
const Link = import_react.default.forwardRef(
({
block,

@@ -63,45 +85,50 @@ borderless,

...otherProps
} = _ref;
const TagOrComponent = _react.default.useContext(_Context.default);
let classes;
if (button) {
button = button === true ? {} : button;
classes = {
btn: !!button,
'btn-block': button.block || block,
'btn-monospaced': button.monospaced || monospaced,
'btn-outline-borderless': borderless,
'btn-sm': button.small || small,
[`btn-${displayType}`]: displayType && !outline && !borderless,
[`btn-outline-${displayType}`]: displayType && (outline || borderless),
[FONT_WEIGHTS[weight]]: weight,
[`text-${fontSize}`]: fontSize,
[`text-decoration-${decoration}`]: decoration
};
} else {
decoration = decoration === null || outline ? undefined : decoration || LINK_PRESETS[displayType]?.decoration;
classes = {
'link-monospaced': monospaced,
'link-outline': outline,
'link-outline-borderless': borderless,
[LINK_PRESETS[displayType]?.base]: displayType && !outline,
[`link-outline-${displayType}`]: displayType && outline,
[FONT_WEIGHTS[weight]]: weight,
[`text-${fontSize}`]: fontSize,
[`text-decoration-${decoration}`]: decoration
};
}, ref) => {
const TagOrComponent = import_react.default.useContext(import_Context.default);
let classes;
if (button) {
button = button === true ? {} : button;
classes = {
"btn": !!button,
"btn-block": button.block || block,
"btn-monospaced": button.monospaced || monospaced,
"btn-outline-borderless": borderless,
"btn-sm": button.small || small,
[`btn-${displayType}`]: displayType && !outline && !borderless,
[`btn-outline-${displayType}`]: displayType && (outline || borderless),
[FONT_WEIGHTS[weight]]: weight,
[`text-${fontSize}`]: fontSize,
[`text-decoration-${decoration}`]: decoration
};
} else {
decoration = decoration === null || outline ? void 0 : decoration || LINK_PRESETS[displayType]?.decoration;
classes = {
"link-monospaced": monospaced,
"link-outline": outline,
"link-outline-borderless": borderless,
[LINK_PRESETS[displayType]?.base]: displayType && !outline,
[`link-outline-${displayType}`]: displayType && outline,
[FONT_WEIGHTS[weight]]: weight,
[`text-${fontSize}`]: fontSize,
[`text-decoration-${decoration}`]: decoration
};
}
if (target && !rel) {
rel = "noreferrer noopener";
}
return /* @__PURE__ */ import_react.default.createElement(
TagOrComponent,
{
className: (0, import_classnames.default)(className, classes),
ref,
rel,
target,
...otherProps
},
children,
target === "_blank" && /* @__PURE__ */ import_react.default.createElement("span", { className: "sr-only" }, messages.opensNewWindow)
);
}
if (target && !rel) {
rel = 'noreferrer noopener';
}
return /*#__PURE__*/_react.default.createElement(TagOrComponent, _extends({
className: (0, _classnames.default)(className, classes),
ref: ref,
rel: rel,
target: target
}, otherProps), children, target === '_blank' && /*#__PURE__*/_react.default.createElement("span", {
className: "sr-only"
}, messages.opensNewWindow));
});
Link.displayName = 'ClayLink';
var _default = exports.default = Link;
);
Link.displayName = "ClayLink";
var Link_default = Link;
/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-FileCopyrightText: (c) 2026 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/

@@ -5,0 +5,0 @@ import React from 'react';

@@ -1,9 +0,7 @@

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
import React from 'react';
const context = /*#__PURE__*/React.createContext('a');
context.displayName = 'ClayLinkContext';
export default context;
import React from "react";
const context = React.createContext("a");
context.displayName = "ClayLinkContext";
var Context_default = context;
export {
Context_default as default
};

@@ -1,7 +0,7 @@

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
import Link from "./Link.js";
export { default as ClayLinkContext } from "./Context.js";
export default Link;
import Link from "./Link";
import { default as default2 } from "./Context";
var src_default = Link;
export {
default2 as ClayLinkContext,
src_default as default
};

@@ -1,29 +0,23 @@

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); }
/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
*/
import classNames from 'classnames';
import React from 'react';
import ClayLinkContext from "./Context.js";
import classNames from "classnames";
import React from "react";
import ClayLinkContext from "./Context";
const LINK_PRESETS = {
danger: {
base: 'c-link text-danger',
decoration: 'underline'
base: "c-link text-danger",
decoration: "underline"
},
primary: {
base: 'c-link link-primary',
decoration: 'underline'
base: "c-link link-primary",
decoration: "underline"
},
secondary: {
base: 'c-link link-secondary',
decoration: 'underline'
base: "c-link link-secondary",
decoration: "underline"
},
tertiary: {
base: 'c-link text-tertiary',
base: "c-link text-tertiary",
decoration: null
},
unstyled: {
base: 'link-unstyled',
base: "link-unstyled",
decoration: null

@@ -33,10 +27,10 @@ }

const FONT_WEIGHTS = {
normal: 'font-weight-normal',
'semi-bold': 'font-weight-semi-bold'
"normal": "font-weight-normal",
"semi-bold": "font-weight-semi-bold"
};
const defaultMessages = {
opensNewWindow: '(Opens a new window)'
opensNewWindow: "(Opens a new window)"
};
const Link = /*#__PURE__*/React.forwardRef((_ref, ref) => {
let {
const Link = React.forwardRef(
({
block,

@@ -58,45 +52,53 @@ borderless,

...otherProps
} = _ref;
const TagOrComponent = React.useContext(ClayLinkContext);
let classes;
if (button) {
button = button === true ? {} : button;
classes = {
btn: !!button,
'btn-block': button.block || block,
'btn-monospaced': button.monospaced || monospaced,
'btn-outline-borderless': borderless,
'btn-sm': button.small || small,
[`btn-${displayType}`]: displayType && !outline && !borderless,
[`btn-outline-${displayType}`]: displayType && (outline || borderless),
[FONT_WEIGHTS[weight]]: weight,
[`text-${fontSize}`]: fontSize,
[`text-decoration-${decoration}`]: decoration
};
} else {
decoration = decoration === null || outline ? undefined : decoration || LINK_PRESETS[displayType]?.decoration;
classes = {
'link-monospaced': monospaced,
'link-outline': outline,
'link-outline-borderless': borderless,
[LINK_PRESETS[displayType]?.base]: displayType && !outline,
[`link-outline-${displayType}`]: displayType && outline,
[FONT_WEIGHTS[weight]]: weight,
[`text-${fontSize}`]: fontSize,
[`text-decoration-${decoration}`]: decoration
};
}, ref) => {
const TagOrComponent = React.useContext(ClayLinkContext);
let classes;
if (button) {
button = button === true ? {} : button;
classes = {
"btn": !!button,
"btn-block": button.block || block,
"btn-monospaced": button.monospaced || monospaced,
"btn-outline-borderless": borderless,
"btn-sm": button.small || small,
[`btn-${displayType}`]: displayType && !outline && !borderless,
[`btn-outline-${displayType}`]: displayType && (outline || borderless),
[FONT_WEIGHTS[weight]]: weight,
[`text-${fontSize}`]: fontSize,
[`text-decoration-${decoration}`]: decoration
};
} else {
decoration = decoration === null || outline ? void 0 : decoration || LINK_PRESETS[displayType]?.decoration;
classes = {
"link-monospaced": monospaced,
"link-outline": outline,
"link-outline-borderless": borderless,
[LINK_PRESETS[displayType]?.base]: displayType && !outline,
[`link-outline-${displayType}`]: displayType && outline,
[FONT_WEIGHTS[weight]]: weight,
[`text-${fontSize}`]: fontSize,
[`text-decoration-${decoration}`]: decoration
};
}
if (target && !rel) {
rel = "noreferrer noopener";
}
return /* @__PURE__ */ React.createElement(
TagOrComponent,
{
className: classNames(className, classes),
ref,
rel,
target,
...otherProps
},
children,
target === "_blank" && /* @__PURE__ */ React.createElement("span", { className: "sr-only" }, messages.opensNewWindow)
);
}
if (target && !rel) {
rel = 'noreferrer noopener';
}
return /*#__PURE__*/React.createElement(TagOrComponent, _extends({
className: classNames(className, classes),
ref: ref,
rel: rel,
target: target
}, otherProps), children, target === '_blank' && /*#__PURE__*/React.createElement("span", {
className: "sr-only"
}, messages.opensNewWindow));
});
Link.displayName = 'ClayLink';
export default Link;
);
Link.displayName = "ClayLink";
var Link_default = Link;
export {
Link_default as default
};
/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-FileCopyrightText: (c) 2026 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/

@@ -5,0 +5,0 @@ import Link from './Link';

/**
* SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
* SPDX-License-Identifier: BSD-3-Clause
* SPDX-FileCopyrightText: (c) 2026 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/

@@ -5,0 +5,0 @@ import React from 'react';

{
"name": "@clayui/link",
"version": "3.144.1",
"browserslist": [
"extends browserslist-config-clay"
],
"dependencies": {
"classnames": "2.3.1"
},
"description": "ClayLink component",
"files": [
"lib"
],
"keywords": [
"clay",
"react"
],
"license": "BSD-3-Clause",
"main": "lib/cjs/index.js",
"name": "@clayui/link",
"peerDependencies": {
"@clayui/css": "^3.157.0-alpha.1",
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
},
"repository": "https://github.com/liferay/clay",
"main": "lib/cjs/index.js",
"scripts": {
"build": "yarn build:cjs && yarn build:esm",
"build:cjs": "cross-env NODE_ENV=production node ../build-package-esbuild.js --format=cjs --outdir=lib/cjs",
"build:esm": "cross-env NODE_ENV=production node ../build-package-esbuild.js --format=esm --outdir=lib/esm",
"buildTypes": "cross-env NODE_ENV=production tsc --project ./tsconfig.declarations.json",
"test": "jest --config ../../jest.config.js"
},
"version": "3.157.0-alpha.1",
"module": "lib/esm/index.js",

@@ -17,29 +42,3 @@ "exports": {

"types": "lib/index.d.ts",
"ts:main": "src/index.tsx",
"files": [
"lib"
],
"scripts": {
"build": "yarn build:cjs && yarn build:esm",
"build:cjs": "babel src --root-mode upward --out-dir lib/cjs --extensions .ts,.tsx",
"build:esm": "babel src --root-mode upward --out-dir lib/esm --extensions .ts,.tsx --env-name esm",
"buildTypes": "tsc --project ./tsconfig.declarations.json",
"test": "jest --config ../../jest.config.js"
},
"keywords": [
"clay",
"react"
],
"dependencies": {
"classnames": "^2.2.6"
},
"peerDependencies": {
"@clayui/css": "3.x",
"react": "^16.0.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0"
},
"browserslist": [
"extends browserslist-config-clay"
],
"gitHead": "96b1e589bb0777fb30d4fbe050ce7670c8061fe5"
"ts:main": "src/index.tsx"
}

@@ -5,5 +5,5 @@ # `@clayui/link`

- [Documentation](https://clayui.com/docs/components/link.html)
- [Changelog](./CHANGELOG.md)
- [Breaking change schedule](./BREAKING.md)
- [Documentation](https://clayui.com/docs/components/link.html)
- [Changelog](./CHANGELOG.md)
- [Breaking change schedule](./BREAKING.md)

@@ -20,2 +20,2 @@ ## Install

We'd love to get contributions from you! Please, check our [Contributing Guidelines](https://github.com/liferay/clay/blob/master/CONTRIBUTING.md) to see how you can help us improve.
We'd love to get contributions from you! Please, check our [Contributing Guidelines](https://github.com/liferay/clay/blob/master/CONTRIBUTING.md) to see how you can help us improve.