primeng
Version:
PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB
211 lines (200 loc) • 7.62 kB
JavaScript
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i0 from '@angular/core';
import { Injectable, inject, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
import { SharedModule } from 'primeng/api';
import { BaseComponent } from 'primeng/basecomponent';
import { BaseStyle } from 'primeng/base';
const theme = ({ dt }) => `
.p-skeleton {
overflow: hidden;
background: ${dt('skeleton.background')};
border-radius: ${dt('skeleton.border.radius')};
}
.p-skeleton::after {
content: "";
animation: p-skeleton-animation 1.2s infinite;
height: 100%;
left: 0;
position: absolute;
right: 0;
top: 0;
transform: translateX(-100%);
z-index: 1;
background: linear-gradient(90deg, rgba(255, 255, 255, 0), ${dt('skeleton.animation.background')}, rgba(255, 255, 255, 0));
}
[dir='rtl'] .p-skeleton::after {
animation-name: p-skeleton-animation-rtl;
}
.p-skeleton-circle {
border-radius: 50%;
}
.p-skeleton-animation-none::after {
animation: none;
}
@keyframes p-skeleton-animation {
from {
transform: translateX(-100%);
}
to {
transform: translateX(100%);
}
}
@keyframes p-skeleton-animation-rtl {
from {
transform: translateX(100%);
}
to {
transform: translateX(-100%);
}
}
`;
const inlineStyles = {
root: { position: 'relative' }
};
const classes = {
root: ({ props }) => [
'p-skeleton p-component',
{
'p-skeleton-circle': props.shape === 'circle',
'p-skeleton-animation-none': props.animation === 'none'
}
]
};
class SkeletonStyle extends BaseStyle {
name = 'skeleton';
theme = theme;
classes = classes;
inlineStyles = inlineStyles;
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SkeletonStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SkeletonStyle });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SkeletonStyle, decorators: [{
type: Injectable
}] });
/**
*
* Skeleton is a placeholder to display instead of the actual content.
*
* [Live Demo](https://www.primeng.org/skeleton/)
*
* @module skeletonstyle
*
*/
var SkeletonClasses;
(function (SkeletonClasses) {
/**
* Class name of the root element
*/
SkeletonClasses["root"] = "p-skeleton";
})(SkeletonClasses || (SkeletonClasses = {}));
/**
* Skeleton is a placeholder to display instead of the actual content.
* @group Components
*/
class Skeleton extends BaseComponent {
/**
* Class of the element.
* @group Props
*/
styleClass;
/**
* Inline style of the element.
* @group Props
*/
style;
/**
* Shape of the element.
* @group Props
*/
shape = 'rectangle';
/**
* Type of the animation.
* @gruop Props
*/
animation = 'wave';
/**
* Border radius of the element, defaults to value from theme.
* @group Props
*/
borderRadius;
/**
* Size of the skeleton.
* @group Props
*/
size;
/**
* Width of the element.
* @group Props
*/
width = '100%';
/**
* Height of the element.
* @group Props
*/
height = '1rem';
_componentStyle = inject(SkeletonStyle);
containerClass() {
return {
'p-skeleton p-component': true,
'p-skeleton-circle': this.shape === 'circle',
'p-skeleton-animation-none': this.animation === 'none'
};
}
get containerStyle() {
const inlineStyles = this._componentStyle?.inlineStyles['root'];
let style;
if (this.size)
style = { ...this.style, ...inlineStyles, width: this.size, height: this.size, borderRadius: this.borderRadius };
else
style = { ...inlineStyles, width: this.width, height: this.height, borderRadius: this.borderRadius, ...this.style };
return style;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: Skeleton, deps: null, target: i0.ɵɵFactoryTarget.Component });
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: Skeleton, isStandalone: true, selector: "p-skeleton", inputs: { styleClass: "styleClass", style: "style", shape: "shape", animation: "animation", borderRadius: "borderRadius", size: "size", width: "width", height: "height" }, providers: [SkeletonStyle], usesInheritance: true, ngImport: i0, template: ` <div [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="containerStyle" [attr.data-pc-name]="'skeleton'" [attr.aria-hidden]="true" [attr.data-pc-section]="'root'"></div> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: SharedModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: Skeleton, decorators: [{
type: Component,
args: [{
selector: 'p-skeleton',
standalone: true,
imports: [CommonModule, SharedModule],
template: ` <div [ngClass]="containerClass()" [class]="styleClass" [ngStyle]="containerStyle" [attr.data-pc-name]="'skeleton'" [attr.aria-hidden]="true" [attr.data-pc-section]="'root'"></div> `,
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
providers: [SkeletonStyle]
}]
}], propDecorators: { styleClass: [{
type: Input
}], style: [{
type: Input
}], shape: [{
type: Input
}], animation: [{
type: Input
}], borderRadius: [{
type: Input
}], size: [{
type: Input
}], width: [{
type: Input
}], height: [{
type: Input
}] } });
class SkeletonModule {
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SkeletonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: SkeletonModule, imports: [Skeleton, SharedModule], exports: [Skeleton, SharedModule] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SkeletonModule, imports: [Skeleton, SharedModule, SharedModule] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: SkeletonModule, decorators: [{
type: NgModule,
args: [{
imports: [Skeleton, SharedModule],
exports: [Skeleton, SharedModule]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { Skeleton, SkeletonClasses, SkeletonModule, SkeletonStyle };
//# sourceMappingURL=primeng-skeleton.mjs.map