@hashicorp/hashi-basic-list
Advanced tools
Comparing version 1.0.5 to 2.0.0-alpha.0
@@ -5,80 +5,58 @@ 'use strict'; | ||
var preact = require('preact'); | ||
var reshapePreactComponents = require('reshape-preact-components'); | ||
var React = _interopDefault(require('react')); | ||
var strftime = _interopDefault(require('strftime')); | ||
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 _extends() { | ||
_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; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function BasicList(_ref) { | ||
var _data = _ref._data, | ||
var data = _ref.data, | ||
_ref$date_icon = _ref.date_icon, | ||
date_icon = _ref$date_icon === undefined ? 'true' : _ref$date_icon, | ||
date_icon = _ref$date_icon === void 0 ? 'true' : _ref$date_icon, | ||
expire_old = _ref.expire_old; | ||
var data = reshapePreactComponents.decode(_data); | ||
var today = new Date(); | ||
var dateIcon = date_icon === 'true' || date_icon === true; | ||
return preact.h( | ||
'ul', | ||
{ 'class': 'g-basic-list' }, | ||
data.reduce(function (acc, d) { | ||
var date = d.date ? new Date(d.date) : null; | ||
var renderTopSection = dateIcon && d.location || !dateIcon && date || d.detail; | ||
if (expire_old && date && today.getTime() > date.getTime()) return acc; | ||
acc.push(preact.h( | ||
'li', | ||
{ 'data-id': d.id ? d.id : '' }, | ||
date && dateIcon && preact.h( | ||
'div', | ||
{ 'class': 'date' }, | ||
preact.h( | ||
'span', | ||
null, | ||
strftime('%d', date) | ||
), | ||
preact.h( | ||
'span', | ||
null, | ||
strftime('%b', date) | ||
) | ||
), | ||
preact.h( | ||
'a', | ||
_extends({}, d.url && { href: d.url }, d.url && d.external && { target: '_blank', rel: 'noopener' }), | ||
preact.h( | ||
'div', | ||
{ 'class': 'content' }, | ||
renderTopSection && preact.h( | ||
'div', | ||
{ 'class': 'top' }, | ||
!dateIcon && date && preact.h( | ||
'span', | ||
null, | ||
strftime('%d %b %Y', date) | ||
), | ||
d.location && preact.h( | ||
'span', | ||
null, | ||
preact.h('i', { 'class': 'pin' }), | ||
d.location | ||
), | ||
d.detail && preact.h( | ||
'span', | ||
null, | ||
d.detail | ||
) | ||
), | ||
preact.h( | ||
'div', | ||
{ 'class': 'title' }, | ||
d.title | ||
) | ||
) | ||
) | ||
)); | ||
return acc; | ||
}, []) | ||
); | ||
return React.createElement("ul", { | ||
className: "g-basic-list" | ||
}, data.reduce(function (acc, d) { | ||
var date = d.date ? new Date(d.date) : null; | ||
var renderTopSection = dateIcon && d.location || !dateIcon && date || d.detail; | ||
if (expire_old && date && today.getTime() > date.getTime()) return acc; | ||
acc.push(React.createElement("li", { | ||
"data-id": d.id ? d.id : '' | ||
}, date && dateIcon && React.createElement("div", { | ||
className: "date" | ||
}, React.createElement("span", null, strftime('%d', date)), React.createElement("span", null, strftime('%b', date))), React.createElement("a", _extends({}, d.url && { | ||
href: d.url | ||
}, d.url && d.external && { | ||
target: '_blank', | ||
rel: 'noopener' | ||
}), React.createElement("div", { | ||
className: "content" | ||
}, renderTopSection && React.createElement("div", { | ||
className: "top" | ||
}, !dateIcon && date && React.createElement("span", null, strftime('%d %b %Y', date)), d.location && React.createElement("span", null, React.createElement("i", { | ||
className: "pin" | ||
}), d.location), d.detail && React.createElement("span", null, d.detail)), React.createElement("div", { | ||
className: "title" | ||
}, d.title))))); | ||
return acc; | ||
}, [])); | ||
} | ||
module.exports = BasicList; |
{ | ||
"name": "@hashicorp/hashi-basic-list", | ||
"description": "simple vertical list with optional date and location render", | ||
"version": "1.0.5", | ||
"version": "2.0.0-alpha.0", | ||
"dependencies": { | ||
"react": "^16.8.6", | ||
"strftime": "^0.10.0" | ||
}, | ||
"main": "dist", | ||
"peerDependencies": { | ||
"@hashicorp/hashi-global-styles": "^1.0.0", | ||
"preact": "^8.2.7", | ||
"reshape-preact-components": "~0.6.0", | ||
"strftime": "~0.10.0" | ||
}, | ||
"publishConfig": { | ||
@@ -18,3 +16,3 @@ "access": "public" | ||
}, | ||
"gitHead": "4737f67310fbdaa36a8b3e478d29faee87edccf7" | ||
"gitHead": "5f9b5a0487251e5846a3eabd9ff839d3fe7e1e31" | ||
} |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2
0
5101
116
2
+ Addedreact@^16.8.6
+ Addedstrftime@^0.10.0
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedprop-types@15.8.1(transitive)
+ Addedreact@16.14.0(transitive)
+ Addedreact-is@16.13.1(transitive)
- Removed@hashicorp/hashi-global-styles@1.0.13(transitive)
- Removedparse5@2.2.3(transitive)
- Removedpreact@8.5.3(transitive)
- Removedpreact-render-to-string@3.8.2(transitive)
- Removedpretty-format@3.8.0(transitive)
- Removedreshape-parser@0.2.1(transitive)
- Removedreshape-plugin-util@0.2.1(transitive)
- Removedreshape-preact-components@0.6.0(transitive)
- Removedwhen@3.7.8(transitive)