@lifecorner/angular-ui-kit 3.22.1 → 3.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,38 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { ChangeDetectionStrategy, Component, computed, input } from "@angular/core";
3
+ const SKELETON_DEFAULTS = {
4
+ line: {
5
+ w: "100%",
6
+ h: "0.875rem",
7
+ r: "0.25rem"
8
+ },
9
+ circle: {
10
+ w: "40px",
11
+ h: "40px",
12
+ r: "50%"
13
+ },
14
+ rect: {
15
+ w: "100%",
16
+ h: "100px",
17
+ r: "0.5rem"
18
+ }
19
+ };
3
20
  var SkeletonComponent = class SkeletonComponent {
4
21
  variant = input("line", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
5
22
  width = input(...ngDevMode ? [void 0, { debugName: "width" }] : /* istanbul ignore next */ []);
6
23
  height = input(...ngDevMode ? [void 0, { debugName: "height" }] : /* istanbul ignore next */ []);
7
24
  borderRadius = input(...ngDevMode ? [void 0, { debugName: "borderRadius" }] : /* istanbul ignore next */ []);
8
25
  variantClass = computed(() => `lc-skeleton--${this.variant()}`, ...ngDevMode ? [{ debugName: "variantClass" }] : /* istanbul ignore next */ []);
26
+ defaults = computed(() => SKELETON_DEFAULTS[this.variant()], ...ngDevMode ? [{ debugName: "defaults" }] : /* istanbul ignore next */ []);
9
27
  styles = computed(() => {
10
- const d = {
11
- line: {
12
- w: "100%",
13
- h: "0.875rem",
14
- r: "0.25rem"
15
- },
16
- circle: {
17
- w: "40px",
18
- h: "40px",
19
- r: "50%"
20
- },
21
- rect: {
22
- w: "100%",
23
- h: "100px",
24
- r: "0.5rem"
25
- }
26
- }[this.variant()];
28
+ const d = this.defaults();
27
29
  return {
28
- width: this.width() ?? d.w,
30
+ width: "100%",
29
31
  height: this.height() ?? d.h,
30
32
  "border-radius": this.borderRadius() ?? d.r
31
33
  };
32
34
  }, ...ngDevMode ? [{ debugName: "styles" }] : /* istanbul ignore next */ []);
33
- hostWidth = computed(() => this.styles().width, ...ngDevMode ? [{ debugName: "hostWidth" }] : /* istanbul ignore next */ []);
35
+ hostWidth = computed(() => this.width() ?? this.defaults().w, ...ngDevMode ? [{ debugName: "hostWidth" }] : /* istanbul ignore next */ []);
34
36
  static ɵfac = i0.ɵɵngDeclareFactory({
35
37
  minVersion: "12.0.0",
36
38
  version: "22.2.2",
@@ -1 +1 @@
1
- {"version":3,"file":"lifecorner-angular-ui-kit-skeleton.mjs","names":[],"sources":["../../../../libs/angular-ui-kit/src/lib/skeleton/skeleton.component.ts","../../../../libs/angular-ui-kit/src/lib/skeleton/skeleton.component.html"],"sourcesContent":["import { Component, ChangeDetectionStrategy, input, computed } from '@angular/core';\n\nexport type SkeletonVariant = 'line' | 'circle' | 'rect';\n\n/**\n * Skeleton loader component for placeholder loading states.\n *\n * Features:\n * - Variant shapes (text, rect, circle)\n * - Shimmer animation effect; a static fill under `prefers-reduced-motion`\n * - Colours from `--color-skeleton` / `--color-skeleton-highlight`, overridable\n * with the `--lc-skeleton-bg` / `--lc-skeleton-highlight` hooks\n * - Custom width, height, and border radius\n * - `--lc-skeleton-height` hook: the height from CSS (a container query, `cqi`),\n * winning over the `height` input; set it on the `lc-skeleton` element (on a\n * wrapper it reaches every skeleton inside)\n * - Composable for building complex loading layouts\n * - Dark mode compatible\n *\n * @example\n * ```html\n * <lc-skeleton />\n * <lc-skeleton variant=\"circle\" width=\"40px\" height=\"40px\" />\n * <lc-skeleton variant=\"rect\" width=\"100%\" height=\"400px\" />\n * ```\n */\n@Component({\n selector: 'lc-skeleton',\n standalone: true,\n templateUrl: './skeleton.component.html',\n styleUrl: './skeleton.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n // The host mirrors the box width so the skeleton sizes correctly inside\n // flex layouts, and never shrinks below it.\n '[style.width]': 'hostWidth()',\n '[style.flex-shrink]': '\"0\"',\n },\n})\nexport class SkeletonComponent {\n /** Shape variant. */\n readonly variant = input<SkeletonVariant>('line');\n\n /** Width (CSS value). Defaults to '100%' for line/rect, '40px' for circle. */\n readonly width = input<string>();\n\n /**\n * Height (CSS value). Defaults to '0.875rem' for line, '40px' for circle, '100px' for rect.\n * The `--lc-skeleton-height` custom property, when set, wins over it.\n */\n readonly height = input<string>();\n\n /** Border radius override (CSS value). */\n readonly borderRadius = input<string>();\n\n protected readonly variantClass = computed(() => `lc-skeleton--${this.variant()}`);\n\n protected readonly styles = computed(() => {\n const v = this.variant();\n const defaults: Record<SkeletonVariant, { w: string; h: string; r: string }> = {\n line: { w: '100%', h: '0.875rem', r: '0.25rem' },\n circle: { w: '40px', h: '40px', r: '50%' },\n rect: { w: '100%', h: '100px', r: '0.5rem' },\n };\n const d = defaults[v];\n return {\n width: this.width() ?? d.w,\n height: this.height() ?? d.h,\n 'border-radius': this.borderRadius() ?? d.r,\n };\n });\n\n protected readonly hostWidth = computed(() => this.styles().width);\n}\n","<div class=\"lc-skeleton\" [class]=\"variantClass()\" [style]=\"styles()\"></div>\n"],"mappings":";;AAuCA,IAAa,oBAAb,MAAa,kBAAiB;CAEnB,UAAU,MAAuB,QAAO,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAGxC,QAAQ,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAMvB,SAAS,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAGxB,eAAe,MAAe,GAAA,YAAA,CAAA,QAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAEpB,eAAe,eAAe,gBAAgB,KAAK,QAAO,KAAK,GAAA,YAAA,CAAA,EAAA,WAAA,eAAA,CAAA,+BAAA,CAAA,CAAA;CAE/D,SAAS,eAAc;EAOxC,MAAM,IAAI;GAJR,MAAM;IAAE,GAAG;IAAQ,GAAG;IAAY,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A;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAb7B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,YACX;GAAI,iBAGC,wBAAwB;GAAM,MACzC;IAGJ,iBAAiB;IACjB,uBAAuB;GACxB;GAAA,UAAA;GAAA,QAAA,CAAA,8sBAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"lifecorner-angular-ui-kit-skeleton.mjs","names":[],"sources":["../../../../libs/angular-ui-kit/src/lib/skeleton/skeleton.component.ts","../../../../libs/angular-ui-kit/src/lib/skeleton/skeleton.component.html"],"sourcesContent":["import { Component, ChangeDetectionStrategy, input, computed } from '@angular/core';\n\nexport type SkeletonVariant = 'line' | 'circle' | 'rect';\n\n/** Per-variant defaults: width (on the host), height and border radius (on the fill). */\nconst SKELETON_DEFAULTS: Record<SkeletonVariant, { w: string; h: string; r: string }> = {\n line: { w: '100%', h: '0.875rem', r: '0.25rem' },\n circle: { w: '40px', h: '40px', r: '50%' },\n rect: { w: '100%', h: '100px', r: '0.5rem' },\n};\n\n/**\n * Skeleton loader component for placeholder loading states.\n *\n * Features:\n * - Variant shapes (text, rect, circle)\n * - Shimmer animation effect; a static fill under `prefers-reduced-motion`\n * - Colours from `--color-skeleton` / `--color-skeleton-highlight`, overridable\n * with the `--lc-skeleton-bg` / `--lc-skeleton-highlight` hooks\n * - Custom width, height, and border radius\n * - `--lc-skeleton-height` hook: the height from CSS (a container query, `cqi`),\n * winning over the `height` input; set it on the `lc-skeleton` element (on a\n * wrapper it reaches every skeleton inside)\n * - Composable for building complex loading layouts\n * - Dark mode compatible\n *\n * @example\n * ```html\n * <lc-skeleton />\n * <lc-skeleton variant=\"circle\" width=\"40px\" height=\"40px\" />\n * <lc-skeleton variant=\"rect\" width=\"100%\" height=\"400px\" />\n * ```\n */\n@Component({\n selector: 'lc-skeleton',\n standalone: true,\n templateUrl: './skeleton.component.html',\n styleUrl: './skeleton.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n // The host takes the width once, so the skeleton sizes correctly inside\n // flex layouts and never shrinks below it; the fill spans it (3.22.2:\n // before, the fill took the width again, so a percentage applied twice).\n '[style.width]': 'hostWidth()',\n '[style.flex-shrink]': '\"0\"',\n },\n})\nexport class SkeletonComponent {\n /**\n * Shape variant.\n * @default 'line'\n */\n readonly variant = input<SkeletonVariant>('line');\n\n /**\n * Width (CSS value), applied once, to the host: a percentage is a share of the\n * containing block and the fill always spans the host (since 3.22.2; before, a\n * percentage applied twice, so `30%` drew 9 %).\n * @default '100%' for line and rect, '40px' for circle\n */\n readonly width = input<string>();\n\n /**\n * Height (CSS value). Defaults to '0.875rem' for line, '40px' for circle, '100px' for rect.\n * The `--lc-skeleton-height` custom property, when set, wins over it.\n * @default '0.875rem' for line, '40px' for circle, '100px' for rect\n */\n readonly height = input<string>();\n\n /**\n * Border radius override (CSS value).\n * @default '0.25rem' for line, '50%' for circle, '0.5rem' for rect\n */\n readonly borderRadius = input<string>();\n\n protected readonly variantClass = computed(() => `lc-skeleton--${this.variant()}`);\n\n private readonly defaults = computed(() => SKELETON_DEFAULTS[this.variant()]);\n\n /** The fill's inline styles: it always spans the host, which holds the width. */\n protected readonly styles = computed(() => {\n const d = this.defaults();\n return {\n width: '100%',\n height: this.height() ?? d.h,\n 'border-radius': this.borderRadius() ?? d.r,\n };\n });\n\n protected readonly hostWidth = computed(() => this.width() ?? this.defaults().w);\n}\n","<div class=\"lc-skeleton\" [class]=\"variantClass()\" [style]=\"styles()\"></div>\n"],"mappings":";;AAKA,MAAM,oBAAkF;CACtF,MAAM;EAAE,GAAG;EAAQ,GAAG;EAAY,GAAG;CAAS;CAC9C,QAAQ;EAAE,GAAG;EAAQ,GAAG;EAAQ,GAAG;CAAK;CACxC,MAAM;EAAE,GAAG;EAAQ,GAAG;EAAS,GAAG;CAAQ;AAC3C;AAsCD,IAAa,oBAAb,MAAa,kBAAiB;CAKnB,UAAU,MAAuB,QAAO,GAAA,YAAA,CAAA,EAAA,WAAA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A,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,cAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA,EAAA,YAAA;GAAA,eAAA;GAAA,qBAAA;EAAA,EAAA;EAAA,UAAA;EAAA,UC/C9B;EACA,QAAA,CAAA,8sBAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AD8Ca,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAiB,YAAA,CAAA;EAd7B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAa,YACX;GAAI,iBAGC,wBAAwB;GAAM,MACzC;IAIJ,iBAAiB;IACjB,uBAAuB;GACxB;GAAA,UAAA;GAAA,QAAA,CAAA,8sBAAA;EAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifecorner/angular-ui-kit",
3
- "version": "3.22.1",
3
+ "version": "3.22.2",
4
4
  "description": "LifeCorner Design System – Angular UI component library",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,18 +23,32 @@ export type SkeletonVariant = 'line' | 'circle' | 'rect';
23
23
  * ```
24
24
  */
25
25
  export declare class SkeletonComponent {
26
- /** Shape variant. */
26
+ /**
27
+ * Shape variant.
28
+ * @default 'line'
29
+ */
27
30
  readonly variant: import("@angular/core").InputSignal<SkeletonVariant>;
28
- /** Width (CSS value). Defaults to '100%' for line/rect, '40px' for circle. */
31
+ /**
32
+ * Width (CSS value), applied once, to the host: a percentage is a share of the
33
+ * containing block and the fill always spans the host (since 3.22.2; before, a
34
+ * percentage applied twice, so `30%` drew 9 %).
35
+ * @default '100%' for line and rect, '40px' for circle
36
+ */
29
37
  readonly width: import("@angular/core").InputSignal<string | undefined>;
30
38
  /**
31
39
  * Height (CSS value). Defaults to '0.875rem' for line, '40px' for circle, '100px' for rect.
32
40
  * The `--lc-skeleton-height` custom property, when set, wins over it.
41
+ * @default '0.875rem' for line, '40px' for circle, '100px' for rect
33
42
  */
34
43
  readonly height: import("@angular/core").InputSignal<string | undefined>;
35
- /** Border radius override (CSS value). */
44
+ /**
45
+ * Border radius override (CSS value).
46
+ * @default '0.25rem' for line, '50%' for circle, '0.5rem' for rect
47
+ */
36
48
  readonly borderRadius: import("@angular/core").InputSignal<string | undefined>;
37
49
  protected readonly variantClass: import("@angular/core").Signal<string>;
50
+ private readonly defaults;
51
+ /** The fill's inline styles: it always spans the host, which holds the width. */
38
52
  protected readonly styles: import("@angular/core").Signal<{
39
53
  width: string;
40
54
  height: string;