@peculiar/fortify-webcomponents
Version:
Web-components for creating CSR or Certificate and viewing certificates list using Fortify
117 lines (110 loc) • 4.09 kB
JavaScript
/*!
* © Peculiar Ventures https://peculiarventures.com/ - BSD 3-Clause License
*/
import { x as OIDs } from './ssh_certificate.js';
import { h } from '@stencil/core/internal/client';
import { T as Typography } from './typography.js';
/*!
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
*/
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function getStringByOID(value) {
const oid = OIDs[value];
if (oid) {
return `${oid} (${value})`;
}
return value;
}
/*!
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
*/
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
function isLink(value) {
return value.indexOf('http') === 0;
}
/*!
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
*/
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const Link = (props, children) => {
const { href, variant, } = props;
return (h(Typography, { component: "a", variant: variant, color: "secondary",
// @ts-expect-error - href is a string
href: href, target: "_blank", rel: "noreferrer noopener" }, children));
};
/*!
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
*/
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const TableRowTable = (_, children) => (h("tr", null, h("td", { colSpan: 2 }, h("table", null, children))));
const RowTitle = (props) => {
const { value } = props;
if (!value) {
return null;
}
return [
h("tr", { class: "title" }, h("td", { colSpan: 2 }, h(Typography, { variant: "s1", color: "black" }, value))),
h("tr", null, h("td", { colSpan: 2, class: "divider" }, h("span", null))),
];
};
const RowValue = (props) => {
const { name, value, monospace, collapse, href, extraValue, } = props;
if (!name) {
return null;
}
if (value === undefined || value === null) {
return null;
}
let elementValue;
if (collapse) {
elementValue = (h("peculiar-text-hider", null, value));
}
else {
elementValue = value;
}
const hasValue = !!value.toString();
return (h("tr", null, h("td", { colSpan: hasValue ? 1 : 2 }, h(Typography, { variant: "b2", color: "gray-9" }, name)), hasValue && (h("td", { class: { monospace } }, (isLink(value.toString()) || href)
? (h(Link, { variant: "b2", href: href || value.toString() }, value))
: (h(Typography, { variant: "b2", color: "black" }, elementValue, extraValue))))));
};
/*!
* © Peculiar Ventures https://peculiarventures.com/ - MIT License
*/
/**
* @license
* Copyright (c) Peculiar Ventures, LLC.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const DownloadIcon = (props) => {
const { color = 'secondary' } = props;
return (h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "30", fill: "none" }, h("path", { fill: `var(--pv-color-${color})`, d: "M21 12h-2c-.6 0-1 .4-1 1s.4 1 1 1h2c.6 0 1 .4 1 1v7c0 .6-.4 1-1 1H9c-.6 0-1-.4-1-1v-7c0-.6.4-1 1-1h2c.6 0 1-.4 1-1s-.4-1-1-1H9c-1.7 0-3 1.3-3 3v7c0 1.7 1.3 3 3 3h12c1.7 0 3-1.3 3-3v-7c0-1.7-1.3-3-3-3Zm-9.7 5.7 3 3c.2.2.4.3.7.3.3 0 .5-.1.7-.3l3-3c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0L16 17.6V6c0-.6-.4-1-1-1s-1 .4-1 1v11.6l-1.3-1.3c-.4-.4-1-.4-1.4 0-.4.4-.4 1 0 1.4Z" })));
};
export { DownloadIcon as D, Link as L, RowTitle as R, TableRowTable as T, RowValue as a, getStringByOID as g };
//# sourceMappingURL=download.js.map
//# sourceMappingURL=download.js.map