@justeattakeaway/pie-skeleton 0.0.0 → 0.1.0

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.
package/dist/index.d.ts CHANGED
@@ -1,16 +1,173 @@
1
+ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
1
2
  import { CSSResult } from 'lit';
2
3
  import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
3
4
  import { TemplateResult } from 'lit-html';
4
5
 
6
+ export declare const aspectRatios: readonly ["1by1", "4by3", "16by9", "3by4", "9by16"];
7
+
8
+ export declare const backgroundColorClassNames: Record<typeof backgroundColors[number], string>;
9
+
10
+ export declare const backgroundColors: readonly ["default", "strong", "subtle"];
11
+
12
+ export declare const borderRadii: readonly ["radius-rounded-none", "radius-rounded-a", "radius-rounded-b", "radius-rounded-c", "radius-rounded-d", "radius-rounded-e", "radius-rounded-f", "radius-rounded-g"];
13
+
14
+ /**
15
+ * The `pie-button` size names accepted by the `pill` variant's `height`.
16
+ */
17
+ export declare const buttonSizes: readonly ["button-xsmall", "button-small-productive", "button-small-expressive", "button-medium", "button-large"];
18
+
19
+ export declare type DefaultProps = ComponentDefaultProps<SkeletonProps, keyof Omit<SkeletonProps, 'width' | 'height'>>;
20
+
21
+ export declare const defaultProps: DefaultProps;
22
+
23
+ /** The maximum number of lines the `text` variant can draw. */
24
+ export declare const LINES_MAX = 10;
25
+
26
+ /** The minimum number of lines the `text` variant can draw. */
27
+ export declare const LINES_MIN = 1;
28
+
5
29
  /**
6
30
  * @tagname pie-skeleton
7
31
  */
8
32
  export declare class PieSkeleton extends PieElement implements SkeletonProps {
33
+ variant: "box" | "circle" | "pill" | "text" | "star";
34
+ backgroundColor: "default" | "strong" | "subtle";
35
+ width: SkeletonProps['width'];
36
+ height: SkeletonProps['height'];
37
+ lines: number;
38
+ stars: number;
39
+ borderRadius: "radius-rounded-none" | "radius-rounded-a" | "radius-rounded-b" | "radius-rounded-c" | "radius-rounded-d" | "radius-rounded-e" | "radius-rounded-f" | "radius-rounded-g";
40
+ aspectRatio: "1by1" | "4by3" | "16by9" | "3by4" | "9by16";
41
+ isResponsive: boolean;
42
+ /**
43
+ * Clamps a numeric prop to the given inclusive range. Non-numeric values fall back to the minimum.
44
+ *
45
+ * @private
46
+ */
47
+ private _clamp;
48
+ /**
49
+ * The number of text lines to draw, clamped between 1 and 10.
50
+ *
51
+ * @private
52
+ */
53
+ private get _linesCount();
54
+ /**
55
+ * The number of stars to draw, clamped between 1 and 10.
56
+ *
57
+ * @private
58
+ */
59
+ private get _starsCount();
60
+ /**
61
+ * Whether a `height` value is a `pie-button` size name.
62
+ *
63
+ * @private
64
+ */
65
+ private _isButtonSize;
66
+ /**
67
+ * Whether a `height` value is a supported spacing identifier (e.g. `spacing-e`).
68
+ *
69
+ * @private
70
+ */
71
+ private _isSpacingIdentifier;
72
+ /**
73
+ * Resolves the `height` prop to a CSS length for the variants that accept absolute values,
74
+ * percentages or spacing identifiers (box, circle, pill and star).
75
+ * Returns `undefined` when the value is handled elsewhere (a `button-*` size) or isn't valid
76
+ * for the variant, so the CSS default applies.
77
+ *
78
+ * @private
79
+ */
80
+ private _resolveHeight;
81
+ /**
82
+ * The classes applied to the root element.
83
+ *
84
+ * @private
85
+ */
86
+ private get _rootClasses();
87
+ /**
88
+ * The inline styles applied to the root element.
89
+ *
90
+ * @private
91
+ */
92
+ private get _rootStyles();
93
+ /**
94
+ * Renders the text lines for the `text` variant. When there's more than one line,
95
+ * the last line is drawn at half width (handled in CSS through the `is-last` class).
96
+ *
97
+ * @private
98
+ */
99
+ private _renderTextLines;
100
+ /**
101
+ * Renders the stars for the `star` variant.
102
+ *
103
+ * @private
104
+ */
105
+ private _renderStars;
106
+ /**
107
+ * Renders the shapes drawn inside the root element. The box, circle and pill variants
108
+ * are drawn by the root element itself, so they have no children.
109
+ *
110
+ * @private
111
+ */
112
+ private _renderShapes;
9
113
  render(): TemplateResult<1>;
10
114
  static styles: CSSResult;
11
115
  }
12
116
 
13
117
  export declare interface SkeletonProps {
118
+ /**
119
+ * The shape the skeleton draws: a box, a circle, a pill, a block of text lines or a row of stars.
120
+ */
121
+ variant?: typeof variants[number];
122
+ /**
123
+ * The background colour. `strong` is darker (for nested levels) and `subtle` is lighter (for nested levels or darker surfaces).
124
+ */
125
+ backgroundColor?: typeof backgroundColors[number];
126
+ /**
127
+ * The width of the skeleton. Accepts an absolute value (e.g. `120px`) or a percentage of the container (e.g. `50%`).
128
+ * Ignored by the `circle` and `star` variants.
129
+ */
130
+ width?: string;
131
+ /**
132
+ * The height of the skeleton. The accepted formats depend on the variant. See the component documentation for the full list.
133
+ */
134
+ height?: string;
135
+ /**
136
+ * The number of text lines to draw. Applies to the `text` variant only. Values are clamped between 1 and 10.
137
+ */
138
+ lines?: number;
139
+ /**
140
+ * The number of stars to draw. Applies to the `star` variant only. Values are clamped between 1 and 10.
141
+ */
142
+ stars?: number;
143
+ /**
144
+ * The corner radius of the `box` variant, as a radius token identifier (e.g. `radius-rounded-b`).
145
+ * Ignored by the `text`, `pill`, `circle` and `star` variants.
146
+ */
147
+ borderRadius?: typeof borderRadii[number];
148
+ /**
149
+ * The aspect ratio of the `box` variant. Ignored when both `width` and `height` are set.
150
+ */
151
+ aspectRatio?: typeof aspectRatios[number];
152
+ /**
153
+ * When true, a `pill` with a `button-*` height switches to the wide button height above the `md` breakpoint,
154
+ * matching `pie-button`. Ignored otherwise.
155
+ */
156
+ isResponsive?: boolean;
14
157
  }
15
158
 
159
+ /**
160
+ * The lettered spacing tokens accepted as a `height`, written as the token name without the
161
+ * `--dt-` prefix (e.g. `spacing-e`). The numbered base tokens (`--dt-spacing-24`, etc.) are not supported.
162
+ */
163
+ export declare const spacingIdentifiers: readonly ["spacing-none", "spacing-a-small", "spacing-a", "spacing-b", "spacing-c", "spacing-d", "spacing-e", "spacing-f", "spacing-g", "spacing-h", "spacing-i", "spacing-j"];
164
+
165
+ /** The maximum number of stars the `star` variant can draw. */
166
+ export declare const STARS_MAX = 10;
167
+
168
+ /** The minimum number of stars the `star` variant can draw. */
169
+ export declare const STARS_MIN = 1;
170
+
171
+ export declare const variants: readonly ["box", "circle", "pill", "text", "star"];
172
+
16
173
  export { }
package/dist/index.js CHANGED
@@ -1,27 +1,254 @@
1
- import { LitElement as f, unsafeCSS as h, html as v } from "lit";
2
- import { safeCustomElement as c } from "@justeattakeaway/pie-webc-core";
3
- const e = class e extends f {
1
+ import { LitElement as b, unsafeCSS as m, html as v, nothing as u } from "lit";
2
+ import { validPropertyValues as g, safeCustomElement as k } from "@justeattakeaway/pie-webc-core";
3
+ import { classMap as x } from "lit/directives/class-map.js";
4
+ import { property as d } from "lit/decorators.js";
5
+ const f = class f extends b {
4
6
  willUpdate() {
5
- this.getAttribute("v") || this.setAttribute("v", e.v);
7
+ this.getAttribute("v") || this.setAttribute("v", f.v);
6
8
  }
7
9
  };
8
- e.v = "0.0.0";
9
- let r = e;
10
- const d = "*,*:after,*:before{box-sizing:inherit}:host{display:block}";
11
- var u = Object.getOwnPropertyDescriptor, b = (i, o, p, n) => {
12
- for (var t = n > 1 ? void 0 : n ? u(o, p) : o, s = i.length - 1, a; s >= 0; s--)
13
- (a = i[s]) && (t = a(t) || t);
14
- return t;
10
+ f.v = "0.1.0";
11
+ let p = f;
12
+ const y = `@charset "UTF-8";*,*:after,*:before{box-sizing:inherit}:host{display:block;pointer-events:none}.c-skeleton{--skeleton-bg: var(--dt-color-skeleton-01);--skeleton-border-radius: var(--dt-radius-rounded-b);--skeleton-text-radius: var(--dt-radius-rounded-a);--skeleton-star-size: var(--dt-spacing-e);position:relative;overflow:hidden;width:100%}.c-skeleton--backgroundDefault{--skeleton-bg: var(--dt-color-skeleton-01)}.c-skeleton--backgroundStrong{--skeleton-bg: var(--dt-color-skeleton-02)}.c-skeleton--backgroundSubtle{--skeleton-bg: var(--dt-color-skeleton-03)}.c-skeleton--box,.c-skeleton--circle,.c-skeleton--pill,.c-skeleton-star{background-color:var(--skeleton-bg)}.c-skeleton--box{border-radius:var(--skeleton-border-radius)}.c-skeleton--radius-rounded-none{--skeleton-border-radius: var(--dt-radius-rounded-none)}.c-skeleton--radius-rounded-a{--skeleton-border-radius: var(--dt-radius-rounded-a)}.c-skeleton--radius-rounded-b{--skeleton-border-radius: var(--dt-radius-rounded-b)}.c-skeleton--radius-rounded-c{--skeleton-border-radius: var(--dt-radius-rounded-c)}.c-skeleton--radius-rounded-d{--skeleton-border-radius: var(--dt-radius-rounded-d)}.c-skeleton--radius-rounded-e{--skeleton-border-radius: var(--dt-radius-rounded-e)}.c-skeleton--radius-rounded-f{--skeleton-border-radius: var(--dt-radius-rounded-f)}.c-skeleton--radius-rounded-g{--skeleton-border-radius: var(--dt-radius-rounded-g)}.c-skeleton--1by1{aspect-ratio:1/1}.c-skeleton--4by3{aspect-ratio:4/3}.c-skeleton--16by9{aspect-ratio:16/9}.c-skeleton--3by4{aspect-ratio:3/4}.c-skeleton--9by16{aspect-ratio:9/16}.c-skeleton--circle{border-radius:50%;aspect-ratio:1/1}.c-skeleton--pill{box-sizing:border-box;border-radius:var(--dt-radius-rounded-e)}.c-skeleton--button-xsmall{--btn-padding-vertical-xsmall: 6px;--btn-padding-vertical-small-expressive: 8px;--btn-padding-vertical-small-productive: 10px;--btn-padding-vertical-medium: 12px;--btn-padding-vertical-large: 16px;--btn-padding-horizontal-small: var(--dt-spacing-b);--btn-padding-horizontal-medium: var(--dt-spacing-d);--btn-padding-horizontal-large: var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-interactive-xs-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-xs-line-height) * 1px);--btn-icon-size: 16px;--icon-size-override: 16px;padding:var(--btn-padding-vertical-xsmall) var(--btn-padding-horizontal-small)}@media(min-width:769px){.c-skeleton--button-xsmall.c-skeleton--responsive{--btn-font-size: calc(var(--dt-font-interactive-s-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-s-line-height) * 1px);--btn-icon-size: 20px;--icon-size-override: 20px;padding:var(--btn-padding-vertical-small-productive) var(--btn-padding-horizontal-medium)}.c-skeleton--button-xsmall.c-skeleton--responsive.c-skeleton--expressive{--btn-font-size: calc(var(--dt-font-interactive-l-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-l-line-height) * 1px);--btn-icon-size: 20px;--icon-size-override: 20px;padding:var(--btn-padding-vertical-small-expressive) var(--btn-padding-horizontal-medium)}}.c-skeleton--button-xsmall.c-skeleton--outline,.c-skeleton--button-xsmall.c-skeleton--outline-inverse{padding:calc(var(--btn-padding-vertical-xsmall) - 1px) var(--btn-padding-horizontal-small)}@media(min-width:769px){.c-skeleton--button-xsmall.c-skeleton--outline.c-skeleton--responsive,.c-skeleton--button-xsmall.c-skeleton--outline-inverse.c-skeleton--responsive{padding:calc(var(--btn-padding-vertical-small-productive) - 1px) var(--btn-padding-horizontal-medium)}.c-skeleton--button-xsmall.c-skeleton--outline.c-skeleton--responsive.c-skeleton--expressive,.c-skeleton--button-xsmall.c-skeleton--outline-inverse.c-skeleton--responsive.c-skeleton--expressive{padding:calc(var(--btn-padding-vertical-small-expressive) - 1px) var(--btn-padding-horizontal-medium)}}.c-skeleton--button-xsmall{line-height:var(--btn-line-height)}.c-skeleton--button-xsmall:before{content:"​"}.c-skeleton--button-small-productive{--btn-padding-vertical-xsmall: 6px;--btn-padding-vertical-small-expressive: 8px;--btn-padding-vertical-small-productive: 10px;--btn-padding-vertical-medium: 12px;--btn-padding-vertical-large: 16px;--btn-padding-horizontal-small: var(--dt-spacing-b);--btn-padding-horizontal-medium: var(--dt-spacing-d);--btn-padding-horizontal-large: var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-interactive-s-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-s-line-height) * 1px);--btn-icon-size: 20px;--icon-size-override: 20px;padding:var(--btn-padding-vertical-small-productive) var(--btn-padding-horizontal-medium)}@media(min-width:769px){.c-skeleton--button-small-productive.c-skeleton--responsive{--btn-font-size: calc(var(--dt-font-interactive-l-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-l-line-height) * 1px);--btn-icon-size: 24px;--icon-size-override: 24px;padding:var(--btn-padding-vertical-medium) var(--btn-padding-horizontal-large)}}.c-skeleton--button-small-productive.c-skeleton--outline,.c-skeleton--button-small-productive.c-skeleton--outline-inverse{padding:calc(var(--btn-padding-vertical-small-productive) - 1px) var(--btn-padding-horizontal-medium)}@media(min-width:769px){.c-skeleton--button-small-productive.c-skeleton--outline.c-skeleton--responsive,.c-skeleton--button-small-productive.c-skeleton--outline-inverse.c-skeleton--responsive{padding:calc(var(--btn-padding-vertical-medium) - 1px) var(--btn-padding-horizontal-large)}}.c-skeleton--button-small-productive{line-height:var(--btn-line-height)}.c-skeleton--button-small-productive:before{content:"​"}.c-skeleton--button-small-expressive{--btn-padding-vertical-xsmall: 6px;--btn-padding-vertical-small-expressive: 8px;--btn-padding-vertical-small-productive: 10px;--btn-padding-vertical-medium: 12px;--btn-padding-vertical-large: 16px;--btn-padding-horizontal-small: var(--dt-spacing-b);--btn-padding-horizontal-medium: var(--dt-spacing-d);--btn-padding-horizontal-large: var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-interactive-l-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-l-line-height) * 1px);--btn-icon-size: 20px;--icon-size-override: 20px;padding:var(--btn-padding-vertical-small-expressive) var(--btn-padding-horizontal-medium)}@media(min-width:769px){.c-skeleton--button-small-expressive.c-skeleton--responsive{--btn-font-size: calc(var(--dt-font-interactive-l-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-l-line-height) * 1px);--btn-icon-size: 24px;--icon-size-override: 24px;padding:var(--btn-padding-vertical-medium) var(--btn-padding-horizontal-large)}}.c-skeleton--button-small-expressive.c-skeleton--outline,.c-skeleton--button-small-expressive.c-skeleton--outline-inverse{padding:calc(var(--btn-padding-vertical-small-expressive) - 1px) var(--btn-padding-horizontal-medium)}@media(min-width:769px){.c-skeleton--button-small-expressive.c-skeleton--outline.c-skeleton--responsive,.c-skeleton--button-small-expressive.c-skeleton--outline-inverse.c-skeleton--responsive{padding:calc(var(--btn-padding-vertical-medium) - 1px) var(--btn-padding-horizontal-large)}}.c-skeleton--button-small-expressive{line-height:var(--btn-line-height)}.c-skeleton--button-small-expressive:before{content:"​"}.c-skeleton--button-medium{--btn-padding-vertical-xsmall: 6px;--btn-padding-vertical-small-expressive: 8px;--btn-padding-vertical-small-productive: 10px;--btn-padding-vertical-medium: 12px;--btn-padding-vertical-large: 16px;--btn-padding-horizontal-small: var(--dt-spacing-b);--btn-padding-horizontal-medium: var(--dt-spacing-d);--btn-padding-horizontal-large: var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-interactive-l-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-l-line-height) * 1px);--btn-icon-size: 24px;--icon-size-override: 24px;padding:var(--btn-padding-vertical-medium) var(--btn-padding-horizontal-large)}@media(min-width:769px){.c-skeleton--button-medium.c-skeleton--responsive{--btn-font-size: calc(var(--dt-font-interactive-l-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-l-line-height) * 1px);--btn-icon-size: 24px;--icon-size-override: 24px;padding:var(--btn-padding-vertical-large) var(--btn-padding-horizontal-large)}}.c-skeleton--button-medium.c-skeleton--outline,.c-skeleton--button-medium.c-skeleton--outline-inverse{padding:calc(var(--btn-padding-vertical-medium) - 1px) var(--btn-padding-horizontal-large)}@media(min-width:769px){.c-skeleton--button-medium.c-skeleton--outline.c-skeleton--responsive,.c-skeleton--button-medium.c-skeleton--outline-inverse.c-skeleton--responsive{padding:calc(var(--btn-padding-vertical-large) - 1px) var(--btn-padding-horizontal-large)}}.c-skeleton--button-medium{line-height:var(--btn-line-height)}.c-skeleton--button-medium:before{content:"​"}.c-skeleton--button-large{--btn-padding-vertical-xsmall: 6px;--btn-padding-vertical-small-expressive: 8px;--btn-padding-vertical-small-productive: 10px;--btn-padding-vertical-medium: 12px;--btn-padding-vertical-large: 16px;--btn-padding-horizontal-small: var(--dt-spacing-b);--btn-padding-horizontal-medium: var(--dt-spacing-d);--btn-padding-horizontal-large: var(--dt-spacing-e);--btn-font-size: calc(var(--dt-font-interactive-l-size) * 1px);--btn-line-height: calc(var(--dt-font-interactive-l-line-height) * 1px);--btn-icon-size: 24px;--icon-size-override: 24px;padding:var(--btn-padding-vertical-large) var(--btn-padding-horizontal-large)}.c-skeleton--button-large.c-skeleton--outline,.c-skeleton--button-large.c-skeleton--outline-inverse{padding:calc(var(--btn-padding-vertical-large) - 1px) var(--btn-padding-horizontal-large)}.c-skeleton--button-large{line-height:var(--btn-line-height)}.c-skeleton--button-large:before{content:"​"}.c-skeleton-line{font-family:var(--dt-font-body-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-l-weight);font-size:calc(var(--dt-font-body-l-size) * 1px);line-height:calc(var(--dt-font-body-l-line-height) * 1px);position:relative;border-radius:var(--skeleton-text-radius)}.c-skeleton-line:before{content:"​"}.c-skeleton-line:after{content:"";position:absolute;inset-inline:0;inset-block-start:50%;translate:0 -50%;block-size:1em;border-radius:var(--skeleton-text-radius);background-color:var(--skeleton-bg)}.c-skeleton-line.is-last:after{inset-inline-end:50%}.c-skeleton-line--font-heading-xs{font-family:var(--dt-font-heading-xs-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-xs-weight);font-size:calc(var(--dt-font-heading-xs-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-xs-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-xs{font-size:calc(var(--dt-font-heading-xs-size--wide) * 1px);line-height:calc(var(--dt-font-heading-xs-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-s{font-family:var(--dt-font-heading-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-s-weight);font-size:calc(var(--dt-font-heading-s-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-s-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-s{font-size:calc(var(--dt-font-heading-s-size--wide) * 1px);line-height:calc(var(--dt-font-heading-s-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-m{font-family:var(--dt-font-heading-m-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-m-weight);font-size:calc(var(--dt-font-heading-m-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-m-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-m{font-size:calc(var(--dt-font-heading-m-size--wide) * 1px);line-height:calc(var(--dt-font-heading-m-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-l{font-family:var(--dt-font-heading-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-l-weight);font-size:calc(var(--dt-font-heading-l-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-l-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-l{font-size:calc(var(--dt-font-heading-l-size--wide) * 1px);line-height:calc(var(--dt-font-heading-l-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-xl{font-family:var(--dt-font-heading-xl-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-xl-weight);font-size:calc(var(--dt-font-heading-xl-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-xl-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-xl{font-size:calc(var(--dt-font-heading-xl-size--wide) * 1px);line-height:calc(var(--dt-font-heading-xl-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-xxl{font-family:var(--dt-font-heading-xxl-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-xxl-weight);font-size:calc(var(--dt-font-heading-xxl-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-xxl-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-xxl{font-size:calc(var(--dt-font-heading-xxl-size--wide) * 1px);line-height:calc(var(--dt-font-heading-xxl-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-xs-italic{font-family:var(--dt-font-heading-xs-italic-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-xs-italic-weight);font-style:var(--dt-font-heading-xs-italic-font-style);font-variation-settings:"slnt" -20;font-size:calc(var(--dt-font-heading-xs-italic-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-xs-italic-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-xs-italic{font-size:calc(var(--dt-font-heading-xs-italic-size--wide) * 1px);line-height:calc(var(--dt-font-heading-xs-italic-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-s-italic{font-family:var(--dt-font-heading-s-italic-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-s-italic-weight);font-style:var(--dt-font-heading-s-italic-font-style);font-variation-settings:"slnt" -20;font-size:calc(var(--dt-font-heading-s-italic-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-s-italic-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-s-italic{font-size:calc(var(--dt-font-heading-s-italic-size--wide) * 1px);line-height:calc(var(--dt-font-heading-s-italic-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-m-italic{font-family:var(--dt-font-heading-m-italic-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-m-italic-weight);font-style:var(--dt-font-heading-m-italic-font-style);font-variation-settings:"slnt" -20;font-size:calc(var(--dt-font-heading-m-italic-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-m-italic-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-m-italic{font-size:calc(var(--dt-font-heading-m-italic-size--wide) * 1px);line-height:calc(var(--dt-font-heading-m-italic-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-l-italic{font-family:var(--dt-font-heading-l-italic-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-l-italic-weight);font-style:var(--dt-font-heading-l-italic-font-style);font-variation-settings:"slnt" -20;font-size:calc(var(--dt-font-heading-l-italic-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-l-italic-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-l-italic{font-size:calc(var(--dt-font-heading-l-italic-size--wide) * 1px);line-height:calc(var(--dt-font-heading-l-italic-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-xl-italic{font-family:var(--dt-font-heading-xl-italic-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-xl-italic-weight);font-style:var(--dt-font-heading-xl-italic-font-style);font-variation-settings:"slnt" -20;font-size:calc(var(--dt-font-heading-xl-italic-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-xl-italic-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-xl-italic{font-size:calc(var(--dt-font-heading-xl-italic-size--wide) * 1px);line-height:calc(var(--dt-font-heading-xl-italic-line-height--wide) * 1px)}}.c-skeleton-line--font-heading-xxl-italic{font-family:var(--dt-font-heading-xxl-italic-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-heading-xxl-italic-weight);font-style:var(--dt-font-heading-xxl-italic-font-style);font-variation-settings:"slnt" -20;font-size:calc(var(--dt-font-heading-xxl-italic-size--narrow) * 1px);line-height:calc(var(--dt-font-heading-xxl-italic-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-heading-xxl-italic{font-size:calc(var(--dt-font-heading-xxl-italic-size--wide) * 1px);line-height:calc(var(--dt-font-heading-xxl-italic-line-height--wide) * 1px)}}.c-skeleton-line--font-subheading-s{font-family:var(--dt-font-subheading-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-subheading-s-weight);font-size:calc(var(--dt-font-subheading-s-size--narrow) * 1px);line-height:calc(var(--dt-font-subheading-s-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-subheading-s{font-size:calc(var(--dt-font-subheading-s-size--wide) * 1px);line-height:calc(var(--dt-font-subheading-s-line-height--wide) * 1px)}}.c-skeleton-line--font-subheading-l{font-family:var(--dt-font-subheading-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-subheading-l-weight);font-size:calc(var(--dt-font-subheading-l-size--narrow) * 1px);line-height:calc(var(--dt-font-subheading-l-line-height--narrow) * 1px)}@media(min-width:768px){.c-skeleton-line--font-subheading-l{font-size:calc(var(--dt-font-subheading-l-size--wide) * 1px);line-height:calc(var(--dt-font-subheading-l-line-height--wide) * 1px)}}.c-skeleton-line--font-interactive-xs{font-family:var(--dt-font-interactive-xs-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-interactive-xs-weight);font-size:calc(var(--dt-font-interactive-xs-size) * 1px);line-height:calc(var(--dt-font-interactive-xs-line-height) * 1px)}.c-skeleton-line--font-interactive-s{font-family:var(--dt-font-interactive-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-interactive-s-weight);font-size:calc(var(--dt-font-interactive-s-size) * 1px);line-height:calc(var(--dt-font-interactive-s-line-height) * 1px)}.c-skeleton-line--font-interactive-l{font-family:var(--dt-font-interactive-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-interactive-l-weight);font-size:calc(var(--dt-font-interactive-l-size) * 1px);line-height:calc(var(--dt-font-interactive-l-line-height) * 1px)}.c-skeleton-line--font-body-s{font-family:var(--dt-font-body-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-s-weight);font-size:calc(var(--dt-font-body-s-size) * 1px);line-height:calc(var(--dt-font-body-s-line-height) * 1px)}.c-skeleton-line--font-body-s-link{font-family:var(--dt-font-body-s-link-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-s-link-weight);text-decoration:var(--dt-font-body-s-link-text-decoration);font-size:calc(var(--dt-font-body-s-link-size) * 1px);line-height:calc(var(--dt-font-body-s-link-line-height) * 1px)}.c-skeleton-line--font-body-l{font-family:var(--dt-font-body-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-l-weight);font-size:calc(var(--dt-font-body-l-size) * 1px);line-height:calc(var(--dt-font-body-l-line-height) * 1px)}.c-skeleton-line--font-body-l-link{font-family:var(--dt-font-body-l-link-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-l-link-weight);text-decoration:var(--dt-font-body-l-link-text-decoration);font-size:calc(var(--dt-font-body-l-link-size) * 1px);line-height:calc(var(--dt-font-body-l-link-line-height) * 1px)}.c-skeleton-line--font-body-strong-s{font-family:var(--dt-font-body-strong-s-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-strong-s-weight);font-size:calc(var(--dt-font-body-strong-s-size) * 1px);line-height:calc(var(--dt-font-body-strong-s-line-height) * 1px)}.c-skeleton-line--font-body-strong-s-link{font-family:var(--dt-font-body-strong-s-link-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-strong-s-link-weight);text-decoration:var(--dt-font-body-strong-s-link-text-decoration);font-size:calc(var(--dt-font-body-strong-s-link-size) * 1px);line-height:calc(var(--dt-font-body-strong-s-link-line-height) * 1px)}.c-skeleton-line--font-body-strong-l{font-family:var(--dt-font-body-strong-l-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-strong-l-weight);font-size:calc(var(--dt-font-body-strong-l-size) * 1px);line-height:calc(var(--dt-font-body-strong-l-line-height) * 1px)}.c-skeleton-line--font-body-strong-l-link{font-family:var(--dt-font-body-strong-l-link-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-body-strong-l-link-weight);text-decoration:var(--dt-font-body-strong-l-link-text-decoration);font-size:calc(var(--dt-font-body-strong-l-link-size) * 1px);line-height:calc(var(--dt-font-body-strong-l-link-line-height) * 1px)}.c-skeleton-line--font-caption{font-family:var(--dt-font-caption-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-caption-weight);font-size:calc(var(--dt-font-caption-size) * 1px);line-height:calc(var(--dt-font-caption-line-height) * 1px)}.c-skeleton-line--font-caption-link{font-family:var(--dt-font-caption-link-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-caption-link-weight);text-decoration:var(--dt-font-caption-link-text-decoration);font-size:calc(var(--dt-font-caption-link-size) * 1px);line-height:calc(var(--dt-font-caption-link-line-height) * 1px)}.c-skeleton-line--font-caption-strong{font-family:var(--dt-font-caption-strong-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-caption-strong-weight);font-size:calc(var(--dt-font-caption-strong-size) * 1px);line-height:calc(var(--dt-font-caption-strong-line-height) * 1px)}.c-skeleton-line--font-caption-strong-italic{font-family:var(--dt-font-caption-strong-italic-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-caption-strong-italic-weight);font-style:var(--dt-font-caption-strong-italic-font-style);font-variation-settings:"slnt" -20;font-size:calc(var(--dt-font-caption-strong-italic-size) * 1px);line-height:calc(var(--dt-font-caption-strong-italic-line-height) * 1px)}.c-skeleton-line--font-caption-strong-link{font-family:var(--dt-font-caption-strong-link-family),var(--dt-font-family-secondary),sans-serif;font-weight:var(--dt-font-caption-strong-link-weight);text-decoration:var(--dt-font-caption-strong-link-text-decoration);font-size:calc(var(--dt-font-caption-strong-link-size) * 1px);line-height:calc(var(--dt-font-caption-strong-link-line-height) * 1px)}.c-skeleton--star{display:flex;gap:0;width:fit-content}.c-skeleton-star{flex:0 0 auto;inline-size:var(--skeleton-star-size);block-size:var(--skeleton-star-size);-webkit-mask-image:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Cpath%20d='m12.288%2014.449-4.183-2.197a.22.22%200%200%200-.21%200L3.713%2014.45%204.5%209.794a.25.25%200%200%200%200-.193L1.07%206.302l4.673-.682a.23.23%200%200%200%20.166-.114L8%201.271l2.091%204.235a.23.23%200%200%200%20.167.114l4.672.682-3.386%203.3a.25.25%200%200%200-.061.192z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Cpath%20d='m12.288%2014.449-4.183-2.197a.22.22%200%200%200-.21%200L3.713%2014.45%204.5%209.794a.25.25%200%200%200%200-.193L1.07%206.302l4.673-.682a.23.23%200%200%200%20.166-.114L8%201.271l2.091%204.235a.23.23%200%200%200%20.167.114l4.672.682-3.386%203.3a.25.25%200%200%200-.061.192z'/%3E%3C/svg%3E");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}`, z = ["box", "circle", "pill", "text", "star"], w = ["default", "strong", "subtle"], _ = {
13
+ default: "c-skeleton--backgroundDefault",
14
+ strong: "c-skeleton--backgroundStrong",
15
+ subtle: "c-skeleton--backgroundSubtle"
16
+ }, S = ["1by1", "4by3", "16by9", "3by4", "9by16"], C = [
17
+ "radius-rounded-none",
18
+ "radius-rounded-a",
19
+ "radius-rounded-b",
20
+ "radius-rounded-c",
21
+ "radius-rounded-d",
22
+ "radius-rounded-e",
23
+ "radius-rounded-f",
24
+ "radius-rounded-g"
25
+ ], R = [
26
+ "button-xsmall",
27
+ "button-small-productive",
28
+ "button-small-expressive",
29
+ "button-medium",
30
+ "button-large"
31
+ ], $ = [
32
+ "spacing-none",
33
+ "spacing-a-small",
34
+ "spacing-a",
35
+ "spacing-b",
36
+ "spacing-c",
37
+ "spacing-d",
38
+ "spacing-e",
39
+ "spacing-f",
40
+ "spacing-g",
41
+ "spacing-h",
42
+ "spacing-i",
43
+ "spacing-j"
44
+ ], L = 1, E = 10, N = 1, A = 10, l = {
45
+ variant: "box",
46
+ backgroundColor: "default",
47
+ lines: 1,
48
+ stars: 1,
49
+ borderRadius: "radius-rounded-b",
50
+ aspectRatio: "1by1",
51
+ isResponsive: !1
15
52
  };
16
- let l = class extends r {
53
+ var M = Object.defineProperty, I = Object.getOwnPropertyDescriptor, r = (t, n, i, e) => {
54
+ for (var o = e > 1 ? void 0 : e ? I(n, i) : n, c = t.length - 1, s; c >= 0; c--)
55
+ (s = t[c]) && (o = (e ? s(n, i, o) : s(o)) || o);
56
+ return e && o && M(n, i, o), o;
57
+ };
58
+ const h = "pie-skeleton", B = /^\d*\.?\d+(px|rem|em|%|vh|vw)$/;
59
+ let a = class extends p {
60
+ constructor() {
61
+ super(...arguments), this.variant = l.variant, this.backgroundColor = l.backgroundColor, this.lines = l.lines, this.stars = l.stars, this.borderRadius = l.borderRadius, this.aspectRatio = l.aspectRatio, this.isResponsive = l.isResponsive;
62
+ }
63
+ /**
64
+ * Clamps a numeric prop to the given inclusive range. Non-numeric values fall back to the minimum.
65
+ *
66
+ * @private
67
+ */
68
+ _clamp(t, n, i) {
69
+ const e = Math.trunc(Number(t));
70
+ return Number.isFinite(e) ? Math.min(Math.max(e, n), i) : n;
71
+ }
72
+ /**
73
+ * The number of text lines to draw, clamped between 1 and 10.
74
+ *
75
+ * @private
76
+ */
77
+ get _linesCount() {
78
+ return this._clamp(this.lines, L, E);
79
+ }
80
+ /**
81
+ * The number of stars to draw, clamped between 1 and 10.
82
+ *
83
+ * @private
84
+ */
85
+ get _starsCount() {
86
+ return this._clamp(this.stars, N, A);
87
+ }
88
+ /**
89
+ * Whether a `height` value is a `pie-button` size name.
90
+ *
91
+ * @private
92
+ */
93
+ _isButtonSize(t) {
94
+ return !!t && R.includes(t);
95
+ }
96
+ /**
97
+ * Whether a `height` value is a supported spacing identifier (e.g. `spacing-e`).
98
+ *
99
+ * @private
100
+ */
101
+ _isSpacingIdentifier(t) {
102
+ return !!t && $.includes(t);
103
+ }
104
+ /**
105
+ * Resolves the `height` prop to a CSS length for the variants that accept absolute values,
106
+ * percentages or spacing identifiers (box, circle, pill and star).
107
+ * Returns `undefined` when the value is handled elsewhere (a `button-*` size) or isn't valid
108
+ * for the variant, so the CSS default applies.
109
+ *
110
+ * @private
111
+ */
112
+ _resolveHeight() {
113
+ const { height: t, variant: n } = this;
114
+ if (t) {
115
+ if (this._isSpacingIdentifier(t)) return `var(--dt-${t})`;
116
+ if (!(n === "pill" && this._isButtonSize(t)) && !(n === "star" && t.endsWith("%")))
117
+ return B.test(t) ? t : void 0;
118
+ }
119
+ }
120
+ /**
121
+ * The classes applied to the root element.
122
+ *
123
+ * @private
124
+ */
125
+ get _rootClasses() {
126
+ const {
127
+ variant: t,
128
+ backgroundColor: n,
129
+ borderRadius: i,
130
+ aspectRatio: e,
131
+ isResponsive: o,
132
+ height: c
133
+ } = this, s = {
134
+ "c-skeleton": !0,
135
+ [`c-skeleton--${t}`]: !0,
136
+ [_[n]]: !0
137
+ };
138
+ return t === "box" && (s[`c-skeleton--${i}`] = !0, s[`c-skeleton--${e}`] = !0), t === "pill" && (this._isButtonSize(c) ? s[`c-skeleton--${c}`] = !0 : this._resolveHeight() || (s["c-skeleton--button-medium"] = !0), s["c-skeleton--responsive"] = o), s;
139
+ }
140
+ /**
141
+ * The inline styles applied to the root element.
142
+ *
143
+ * @private
144
+ */
145
+ get _rootStyles() {
146
+ const { variant: t, width: n } = this, i = [];
147
+ if (n && t !== "circle" && t !== "star" && i.push(`width: ${n}`), t === "circle") {
148
+ const e = this._resolveHeight();
149
+ e && i.push(`width: ${e}`, `height: ${e}`);
150
+ } else if (t === "box" || t === "pill") {
151
+ const e = this._resolveHeight();
152
+ e && i.push(`height: ${e}`);
153
+ }
154
+ if (t === "star") {
155
+ const e = this._resolveHeight();
156
+ e && i.push(`--skeleton-star-size: ${e}`);
157
+ }
158
+ return i.join("; ");
159
+ }
160
+ /**
161
+ * Renders the text lines for the `text` variant. When there's more than one line,
162
+ * the last line is drawn at half width (handled in CSS through the `is-last` class).
163
+ *
164
+ * @private
165
+ */
166
+ _renderTextLines() {
167
+ const t = this._linesCount, { height: n } = this;
168
+ return Array.from({ length: t }, (i, e) => {
169
+ const o = t > 1 && e === t - 1, c = x({
170
+ "c-skeleton-line": !0,
171
+ "is-last": o,
172
+ [`c-skeleton-line--${n}`]: !!n
173
+ });
174
+ return v`<div class="${c}"></div>`;
175
+ });
176
+ }
177
+ /**
178
+ * Renders the stars for the `star` variant.
179
+ *
180
+ * @private
181
+ */
182
+ _renderStars() {
183
+ return Array.from({ length: this._starsCount }, () => v`<div class="c-skeleton-star"></div>`);
184
+ }
185
+ /**
186
+ * Renders the shapes drawn inside the root element. The box, circle and pill variants
187
+ * are drawn by the root element itself, so they have no children.
188
+ *
189
+ * @private
190
+ */
191
+ _renderShapes() {
192
+ return this.variant === "text" ? this._renderTextLines() : this.variant === "star" ? this._renderStars() : u;
193
+ }
17
194
  render() {
18
- return v`<h1 data-test-id="pie-skeleton">Hello world!</h1>`;
195
+ return v`
196
+ <div
197
+ data-test-id="pie-skeleton"
198
+ class="${x(this._rootClasses)}"
199
+ style="${this._rootStyles}">
200
+ ${this._renderShapes()}
201
+ </div>
202
+ `;
19
203
  }
20
204
  };
21
- l.styles = h(d);
22
- l = b([
23
- c("pie-skeleton")
24
- ], l);
205
+ a.styles = m(y);
206
+ r([
207
+ d({ type: String }),
208
+ g(h, z, l.variant)
209
+ ], a.prototype, "variant", 2);
210
+ r([
211
+ d({ type: String }),
212
+ g(h, w, l.backgroundColor)
213
+ ], a.prototype, "backgroundColor", 2);
214
+ r([
215
+ d({ type: String })
216
+ ], a.prototype, "width", 2);
217
+ r([
218
+ d({ type: String })
219
+ ], a.prototype, "height", 2);
220
+ r([
221
+ d({ type: Number })
222
+ ], a.prototype, "lines", 2);
223
+ r([
224
+ d({ type: Number })
225
+ ], a.prototype, "stars", 2);
226
+ r([
227
+ d({ type: String }),
228
+ g(h, C, l.borderRadius)
229
+ ], a.prototype, "borderRadius", 2);
230
+ r([
231
+ d({ type: String }),
232
+ g(h, S, l.aspectRatio)
233
+ ], a.prototype, "aspectRatio", 2);
234
+ r([
235
+ d({ type: Boolean })
236
+ ], a.prototype, "isResponsive", 2);
237
+ a = r([
238
+ k("pie-skeleton")
239
+ ], a);
25
240
  export {
26
- l as PieSkeleton
241
+ E as LINES_MAX,
242
+ L as LINES_MIN,
243
+ a as PieSkeleton,
244
+ A as STARS_MAX,
245
+ N as STARS_MIN,
246
+ S as aspectRatios,
247
+ _ as backgroundColorClassNames,
248
+ w as backgroundColors,
249
+ C as borderRadii,
250
+ R as buttonSizes,
251
+ l as defaultProps,
252
+ $ as spacingIdentifiers,
253
+ z as variants
27
254
  };
package/dist/react.d.ts CHANGED
@@ -1,14 +1,118 @@
1
+ import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core';
1
2
  import { CSSResult } from 'lit';
2
3
  import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
3
4
  import * as React_2 from 'react';
4
5
  import { TemplateResult } from 'lit-html';
5
6
 
7
+ export declare const aspectRatios: readonly ["1by1", "4by3", "16by9", "3by4", "9by16"];
8
+
9
+ export declare const backgroundColorClassNames: Record<typeof backgroundColors[number], string>;
10
+
11
+ export declare const backgroundColors: readonly ["default", "strong", "subtle"];
12
+
13
+ export declare const borderRadii: readonly ["radius-rounded-none", "radius-rounded-a", "radius-rounded-b", "radius-rounded-c", "radius-rounded-d", "radius-rounded-e", "radius-rounded-f", "radius-rounded-g"];
14
+
15
+ /**
16
+ * The `pie-button` size names accepted by the `pill` variant's `height`.
17
+ */
18
+ export declare const buttonSizes: readonly ["button-xsmall", "button-small-productive", "button-small-expressive", "button-medium", "button-large"];
19
+
20
+ export declare type DefaultProps = ComponentDefaultProps<SkeletonProps, keyof Omit<SkeletonProps, 'width' | 'height'>>;
21
+
22
+ export declare const defaultProps: DefaultProps;
23
+
24
+ /** The maximum number of lines the `text` variant can draw. */
25
+ export declare const LINES_MAX = 10;
26
+
27
+ /** The minimum number of lines the `text` variant can draw. */
28
+ export declare const LINES_MIN = 1;
29
+
6
30
  export declare const PieSkeleton: React_2.ForwardRefExoticComponent<React_2.PropsWithChildren<Omit<React_2.PropsWithoutRef<SkeletonProps>, "children">> & React_2.RefAttributes<PieSkeleton_2> & ReactBaseType>;
7
31
 
8
32
  /**
9
33
  * @tagname pie-skeleton
10
34
  */
11
35
  declare class PieSkeleton_2 extends PieElement implements SkeletonProps {
36
+ variant: "box" | "circle" | "pill" | "text" | "star";
37
+ backgroundColor: "default" | "strong" | "subtle";
38
+ width: SkeletonProps['width'];
39
+ height: SkeletonProps['height'];
40
+ lines: number;
41
+ stars: number;
42
+ borderRadius: "radius-rounded-none" | "radius-rounded-a" | "radius-rounded-b" | "radius-rounded-c" | "radius-rounded-d" | "radius-rounded-e" | "radius-rounded-f" | "radius-rounded-g";
43
+ aspectRatio: "1by1" | "4by3" | "16by9" | "3by4" | "9by16";
44
+ isResponsive: boolean;
45
+ /**
46
+ * Clamps a numeric prop to the given inclusive range. Non-numeric values fall back to the minimum.
47
+ *
48
+ * @private
49
+ */
50
+ private _clamp;
51
+ /**
52
+ * The number of text lines to draw, clamped between 1 and 10.
53
+ *
54
+ * @private
55
+ */
56
+ private get _linesCount();
57
+ /**
58
+ * The number of stars to draw, clamped between 1 and 10.
59
+ *
60
+ * @private
61
+ */
62
+ private get _starsCount();
63
+ /**
64
+ * Whether a `height` value is a `pie-button` size name.
65
+ *
66
+ * @private
67
+ */
68
+ private _isButtonSize;
69
+ /**
70
+ * Whether a `height` value is a supported spacing identifier (e.g. `spacing-e`).
71
+ *
72
+ * @private
73
+ */
74
+ private _isSpacingIdentifier;
75
+ /**
76
+ * Resolves the `height` prop to a CSS length for the variants that accept absolute values,
77
+ * percentages or spacing identifiers (box, circle, pill and star).
78
+ * Returns `undefined` when the value is handled elsewhere (a `button-*` size) or isn't valid
79
+ * for the variant, so the CSS default applies.
80
+ *
81
+ * @private
82
+ */
83
+ private _resolveHeight;
84
+ /**
85
+ * The classes applied to the root element.
86
+ *
87
+ * @private
88
+ */
89
+ private get _rootClasses();
90
+ /**
91
+ * The inline styles applied to the root element.
92
+ *
93
+ * @private
94
+ */
95
+ private get _rootStyles();
96
+ /**
97
+ * Renders the text lines for the `text` variant. When there's more than one line,
98
+ * the last line is drawn at half width (handled in CSS through the `is-last` class).
99
+ *
100
+ * @private
101
+ */
102
+ private _renderTextLines;
103
+ /**
104
+ * Renders the stars for the `star` variant.
105
+ *
106
+ * @private
107
+ */
108
+ private _renderStars;
109
+ /**
110
+ * Renders the shapes drawn inside the root element. The box, circle and pill variants
111
+ * are drawn by the root element itself, so they have no children.
112
+ *
113
+ * @private
114
+ */
115
+ private _renderShapes;
12
116
  render(): TemplateResult<1>;
13
117
  static styles: CSSResult;
14
118
  }
@@ -16,6 +120,59 @@ declare class PieSkeleton_2 extends PieElement implements SkeletonProps {
16
120
  declare type ReactBaseType = React_2.HTMLAttributes<HTMLElement>;
17
121
 
18
122
  export declare interface SkeletonProps {
123
+ /**
124
+ * The shape the skeleton draws: a box, a circle, a pill, a block of text lines or a row of stars.
125
+ */
126
+ variant?: typeof variants[number];
127
+ /**
128
+ * The background colour. `strong` is darker (for nested levels) and `subtle` is lighter (for nested levels or darker surfaces).
129
+ */
130
+ backgroundColor?: typeof backgroundColors[number];
131
+ /**
132
+ * The width of the skeleton. Accepts an absolute value (e.g. `120px`) or a percentage of the container (e.g. `50%`).
133
+ * Ignored by the `circle` and `star` variants.
134
+ */
135
+ width?: string;
136
+ /**
137
+ * The height of the skeleton. The accepted formats depend on the variant. See the component documentation for the full list.
138
+ */
139
+ height?: string;
140
+ /**
141
+ * The number of text lines to draw. Applies to the `text` variant only. Values are clamped between 1 and 10.
142
+ */
143
+ lines?: number;
144
+ /**
145
+ * The number of stars to draw. Applies to the `star` variant only. Values are clamped between 1 and 10.
146
+ */
147
+ stars?: number;
148
+ /**
149
+ * The corner radius of the `box` variant, as a radius token identifier (e.g. `radius-rounded-b`).
150
+ * Ignored by the `text`, `pill`, `circle` and `star` variants.
151
+ */
152
+ borderRadius?: typeof borderRadii[number];
153
+ /**
154
+ * The aspect ratio of the `box` variant. Ignored when both `width` and `height` are set.
155
+ */
156
+ aspectRatio?: typeof aspectRatios[number];
157
+ /**
158
+ * When true, a `pill` with a `button-*` height switches to the wide button height above the `md` breakpoint,
159
+ * matching `pie-button`. Ignored otherwise.
160
+ */
161
+ isResponsive?: boolean;
19
162
  }
20
163
 
164
+ /**
165
+ * The lettered spacing tokens accepted as a `height`, written as the token name without the
166
+ * `--dt-` prefix (e.g. `spacing-e`). The numbered base tokens (`--dt-spacing-24`, etc.) are not supported.
167
+ */
168
+ export declare const spacingIdentifiers: readonly ["spacing-none", "spacing-a-small", "spacing-a", "spacing-b", "spacing-c", "spacing-d", "spacing-e", "spacing-f", "spacing-g", "spacing-h", "spacing-i", "spacing-j"];
169
+
170
+ /** The maximum number of stars the `star` variant can draw. */
171
+ export declare const STARS_MAX = 10;
172
+
173
+ /** The minimum number of stars the `star` variant can draw. */
174
+ export declare const STARS_MIN = 1;
175
+
176
+ export declare const variants: readonly ["box", "circle", "pill", "text", "star"];
177
+
21
178
  export { }