Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hashicorp/hashi-callouts

Package Overview
Dependencies
Maintainers
13
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hashicorp/hashi-callouts - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0-alpha.0

248

dist/index.js

@@ -5,46 +5,117 @@ 'use strict';

var preact = require('preact');
var reshapePreactComponents = require('reshape-preact-components');
var React = require('react');
var React__default = _interopDefault(React);
var marked = _interopDefault(require('marked'));
var Image = _interopDefault(require('@hashicorp/hashi-image'));
var _require = require('preact'),
h = _require.h;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function CaratIcon() {
return h(
"svg",
{
width: "15",
height: "9",
viewBox: "0 0 15 9",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
},
h("line", {
x1: "0.5",
y1: "4.5",
x2: "13.5",
y2: "4.5",
stroke: "#1563FF",
strokeLinecap: "round"
}),
h("path", {
d: "M10.3536 0.646447C10.1583 0.451184 9.84171 0.451184 9.64645 0.646447C9.45118 0.841709 9.45118 1.15829 9.64645 1.35355L10.3536 0.646447ZM13.5 4.5L13.8536 4.85355L14.2071 4.5L13.8536 4.14645L13.5 4.5ZM9.64645 7.64645C9.45118 7.84171 9.45118 8.15829 9.64645 8.35355C9.84171 8.54882 10.1583 8.54882 10.3536 8.35355L9.64645 7.64645ZM9.64645 1.35355L13.1464 4.85355L13.8536 4.14645L10.3536 0.646447L9.64645 1.35355ZM13.1464 4.14645L9.64645 7.64645L10.3536 8.35355L13.8536 4.85355L13.1464 4.14645Z",
fill: "#1563FF"
})
);
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
return target;
};
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return _extends.apply(this, arguments);
}
var Callouts = function (_Component) {
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function CaratIcon() {
return React__default.createElement("svg", {
width: "15",
height: "9",
viewBox: "0 0 15 9",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, React__default.createElement("line", {
x1: "0.5",
y1: "4.5",
x2: "13.5",
y2: "4.5",
stroke: "#1563FF",
strokeLinecap: "round"
}), React__default.createElement("path", {
d: "M10.3536 0.646447C10.1583 0.451184 9.84171 0.451184 9.64645 0.646447C9.45118 0.841709 9.45118 1.15829 9.64645 1.35355L10.3536 0.646447ZM13.5 4.5L13.8536 4.85355L14.2071 4.5L13.8536 4.14645L13.5 4.5ZM9.64645 7.64645C9.45118 7.84171 9.45118 8.15829 9.64645 8.35355C9.84171 8.54882 10.1583 8.54882 10.3536 8.35355L9.64645 7.64645ZM9.64645 1.35355L13.1464 4.85355L13.8536 4.14645L10.3536 0.646447L9.64645 1.35355ZM13.1464 4.14645L9.64645 7.64645L10.3536 8.35355L13.8536 4.85355L13.1464 4.14645Z",
fill: "#1563FF"
}));
}
var Callouts =
/*#__PURE__*/
function (_Component) {
_inherits(Callouts, _Component);

@@ -55,80 +126,55 @@

return _possibleConstructorReturn(this, (Callouts.__proto__ || Object.getPrototypeOf(Callouts)).apply(this, arguments));
return _possibleConstructorReturn(this, _getPrototypeOf(Callouts).apply(this, arguments));
}
_createClass(Callouts, [{
key: 'render',
key: "render",
value: function render() {
var data = reshapePreactComponents.decode(this.props._data);
var data = this.props.data;
var getCalloutContent = function getCalloutContent(item) {
return preact.h(
'div',
{ 'class': 'callout-content' },
item.image && preact.h(
'div',
{ 'class': 'callout-icon' },
preact.h(Image, {
src: item.image.url,
svg: item.image.format === 'svg',
alt: item.image.alt
})
),
preact.h(
'div',
{ 'class': 'callout-text' },
preact.h('h3', {
dangerouslySetInnerHTML: {
__html: marked.inlineLexer(item.title, [])
}
}),
preact.h('div', {
'class': 'callout-description',
dangerouslySetInnerHTML: {
__html: item.description ? marked(item.description) : ''
}
})
)
);
return React__default.createElement("div", {
className: "callout-content"
}, item.image && React__default.createElement("div", {
className: "callout-icon"
}, React__default.createElement(Image, {
src: item.image.url,
svg: item.image.format === 'svg',
alt: item.image.alt
})), React__default.createElement("div", {
className: "callout-text"
}, React__default.createElement("h3", {
dangerouslySetInnerHTML: {
__html: marked.inlineLexer(item.title, [])
}
}), React__default.createElement("div", {
className: "callout-description",
dangerouslySetInnerHTML: {
__html: item.description ? marked(item.description) : ''
}
})));
};
var getCalloutButton = function getCalloutButton(link, theme) {
return preact.h(
'div',
{ 'class': 'callout-button ' + (theme || '') },
preact.h(
'span',
null,
link.title
),
preact.h(CaratIcon, null)
);
return React__default.createElement("div", {
className: "callout-button ".concat(theme || '')
}, React__default.createElement("span", null, link.title), React__default.createElement(CaratIcon, null));
};
return preact.h(
'ul',
{ 'class': 'g-callouts' },
data.items.map(function (item) {
return preact.h(
'li',
{ 'class': 'callout-container', key: item.title },
item.link && preact.h(
'a',
_extends({
href: item.link.url,
'class': 'callout-box ' + (item.image ? 'has-image' : 'no-image')
}, item.link.external && { rel: 'noopener', target: '_blank' }),
getCalloutContent(item),
getCalloutButton(item.link, data.theme)
),
!item.link && preact.h(
'div',
{
'class': 'callout-box ' + (item.image ? 'has-image' : 'no-image')
},
getCalloutContent(item)
)
);
})
);
return React__default.createElement("ul", {
className: "g-callouts"
}, data.items.map(function (item) {
return React__default.createElement("li", {
className: "callout-container",
key: item.title
}, item.link && React__default.createElement("a", _extends({
href: item.link.url,
className: "callout-box ".concat(item.image ? 'has-image' : 'no-image')
}, item.link.external && {
rel: 'noopener',
target: '_blank'
}), getCalloutContent(item), getCalloutButton(item.link, data.theme)), !item.link && React__default.createElement("div", {
className: "callout-box ".concat(item.image ? 'has-image' : 'no-image')
}, getCalloutContent(item)));
}));
}

@@ -138,4 +184,4 @@ }]);

return Callouts;
}(preact.Component);
}(React.Component);
module.exports = Callouts;
{
"name": "@hashicorp/hashi-callouts",
"description": "a set of three horizontally-aligned images paired with a short title and descriptive text.",
"version": "2.1.0",
"version": "3.0.0-alpha.0",
"author": "Hashicorp - Jeff Escalante",
"dependencies": {
"marked": "^0.6.2",
"react": "^16.8.6"
},
"main": "dist",
"peerDependencies": {
"@hashicorp/hashi-image": "^1.0.0",
"marked": "~0.5.0",
"object-assign": "^4.1.1",
"preact": "^8.2.7",
"query-string": "^5.1.1",
"reshape-preact-components": "~0.6.0"
},
"publishConfig": {

@@ -21,3 +17,3 @@ "access": "public"

},
"gitHead": "63ae5285268e8b12c98d3a94ffe777bccfc4e423"
"gitHead": "5f9b5a0487251e5846a3eabd9ff839d3fe7e1e31"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc