@umbraco-ui/uui-symbol-file
Version:
Umbraco symbol-file custom element, displays a file
80 lines (74 loc) • 2.34 kB
JavaScript
import { css, LitElement, html } from 'lit';
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
import { property } from 'lit/decorators.js';
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result) __defProp(target, key, result);
return result;
};
let UUISymbolFileElement = class extends LitElement {
constructor() {
super(...arguments);
this.type = "";
}
render() {
return html`
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="0.6"
stroke-linecap="round"
stroke-linejoin="round"
id="icon">
<path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" />
<path d="M14 2v4a2 2 0 0 0 2 2h4" />
</svg>
${this.type ? html`<small id="file-type" class="uui-small"
>${this.type.toUpperCase()}</small
>` : ""}
`;
}
};
UUISymbolFileElement.styles = [
UUITextStyles,
css`
:host {
position: relative;
display: block;
box-sizing: border-box;
}
#file-type {
position: absolute;
bottom: 20%;
left: 12%;
margin-left: calc(var(--uui-size-3,9px) * -1);
padding: 0px var(--uui-size-3,9px);
font-weight: 700;
background-color: var(--uui-color-surface-alt,#f3f3f5);
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
border-radius: var(--uui-border-radius,3px);
}
#icon {
width: 100%;
color: var(--uui-color-border-standalone,#c2c2c2);
}
`
];
__decorateClass([
property({ type: String })
], UUISymbolFileElement.prototype, "type", 2);
UUISymbolFileElement = __decorateClass([
defineElement("uui-symbol-file")
], UUISymbolFileElement);
export { UUISymbolFileElement };