import {
customElement,
html,
DeesElement,
property,
TemplateResult,
cssManager,
css,
unsafeCSS,
} from '@designestate/dees-element';
import * as domtools from '@designestate/dees-domtools';
declare global {
interface HTMLElementTagNameMap {
'dees-spinner': DeesSpinner;
}
}
@customElement('dees-spinner')
export class DeesSpinner extends DeesElement {
public static demo = () => html`
`;
@property({
type: Number,
})
public size = 20;
@property({
type: String,
})
public bnw: boolean = false;
@property()
public status: 'normal' | 'pending' | 'success' | 'error' = 'normal';
constructor() {
super();
}
public static styles = [
cssManager.defaultStyles,
css`
:host {
display: block;
}
#loading {
position: relative;
transition: none;
display: flex;
justify-content: center;
align-content: center;
background: #8bc34a00;
border: 3px solid ${cssManager.bdTheme('rgba(0, 0, 0, 0.1)', 'rgba(255, 255, 255, 0.3)')};
border-radius: 50%;
border-top-color: ${cssManager.bdTheme('#333', '#fff')};
animation: spin 1s ease-in-out infinite;
-webkit-animation: spin 1s ease-in-out infinite;
}
#loading.success {
border: none;
border-radius: 50%;
animation: none;
-webkit-animation: none;
}
#loading.error {
border: none;
border-radius: 50%;
animation: none;
-webkit-animation: none;
}
@keyframes spin {
to {
-webkit-transform: rotate(360deg);
}
}
@-webkit-keyframes spin {
to {
-webkit-transform: rotate(360deg);
}
}
dees-icon {
position: absolute;
height: 100%;
width: 100%;
}
`,
];
render() {
return html`
${(() => {
if (this.status === 'success') {
return html``;
} else if (this.status === 'error') {
return html``;
}
})()}
`;
}
}