@justeattakeaway/pie-skeleton 0.0.1 → 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/README.md +62 -9
- package/custom-elements.json +448 -3
- package/dist/index.d.ts +157 -0
- package/dist/index.js +245 -18
- package/dist/react.d.ts +157 -0
- package/dist/react.js +19 -6
- package/package.json +2 -2
- package/src/defs.ts +125 -3
- package/src/index.ts +246 -7
- package/src/skeleton.scss +199 -2
package/README.md
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
- [CSS Variables](#css-variables)
|
|
19
19
|
- [Events](#events)
|
|
20
20
|
- [Usage Examples](#usage-examples)
|
|
21
|
+
- [Avoiding layout shift](#avoiding-layout-shift)
|
|
21
22
|
- [Questions and Support](#questions-and-support)
|
|
22
23
|
- [Contributing](#contributing)
|
|
23
24
|
|
|
@@ -30,22 +31,58 @@ Ideally, you should install the component using the **`@justeattakeaway/pie-webc
|
|
|
30
31
|
## Documentation
|
|
31
32
|
|
|
32
33
|
### Properties
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
A skeleton is a placeholder shape shown while content loads. It reserves the space of the real content, so the page doesn't shift when the content arrives, and shows that something is loading. The consumer decides when to replace the skeleton with the real content.
|
|
36
|
+
|
|
37
|
+
| Prop | Options | Description | Default |
|
|
38
|
+
|------|---------|-------------|---------|
|
|
39
|
+
| `variant` | `"box"`, `"circle"`, `"pill"`, `"text"`, `"star"` | The shape the skeleton draws. | `"box"` |
|
|
40
|
+
| `backgroundColor` | `"default"`, `"strong"`, `"subtle"` | The background colour. `"strong"` is darker (for nested levels) and `"subtle"` is lighter (for nested levels or darker surfaces). | `"default"` |
|
|
41
|
+
| `width` | An absolute value (e.g. `"120px"`) or a percentage of the container (e.g. `"50%"`) | The width of the skeleton. Ignored by the `circle` and `star` variants. | — |
|
|
42
|
+
| `height` | Depends on the variant (see below) | The height of the skeleton. | — |
|
|
43
|
+
| `lines` | A number between 1 and 10 | The number of text lines to draw. Applies to the `text` variant only. Values outside the range are clamped, and non-numeric values fall back to `1`. | `1` |
|
|
44
|
+
| `stars` | A number between 1 and 10 | The number of stars to draw. Applies to the `star` variant only. Values outside the range are clamped, and non-numeric values fall back to `1`. | `1` |
|
|
45
|
+
| `borderRadius` | `"radius-rounded-none"`, `"radius-rounded-a"` to `"radius-rounded-g"` | The corner radius of the `box` variant, as a radius token identifier. Ignored by the other variants. | `"radius-rounded-b"` |
|
|
46
|
+
| `aspectRatio` | `"1by1"`, `"4by3"`, `"16by9"`, `"3by4"`, `"9by16"` | The aspect ratio of the `box` variant. Ignored when both `width` and `height` are set. | `"1by1"` |
|
|
47
|
+
| `isResponsive` | `true`, `false` | When true, a `pill` with a `button-*` height switches to the wide button height above the `md` breakpoint, like `pie-button`. Ignored otherwise by other skeleton variants. | `false` |
|
|
48
|
+
|
|
49
|
+
#### `height`
|
|
50
|
+
|
|
51
|
+
The accepted `height` values depend on the variant:
|
|
52
|
+
|
|
53
|
+
| `variant` | Accepted `height` values | Examples |
|
|
54
|
+
|-----------|--------------------------|----------|
|
|
55
|
+
| `box` | Absolute, percentage, spacing identifier | `"40px"`, `"50%"`, `"spacing-e"` |
|
|
56
|
+
| `circle` | Absolute, percentage, spacing identifier | `"80px"`, `"spacing-i"` |
|
|
57
|
+
| `pill` | Absolute, spacing identifier, `pie-button` size | `"48px"`, `"spacing-e"`, `"button-medium"` |
|
|
58
|
+
| `text` | Typography identifier only | `"font-body-l"` |
|
|
59
|
+
| `star` | Absolute, spacing identifier | `"24px"`, `"spacing-e"` |
|
|
60
|
+
|
|
61
|
+
- **Spacing identifiers** are the lettered spacing tokens written without the `--dt-` prefix, e.g. `"spacing-e"` for `--dt-spacing-e`.
|
|
62
|
+
- **Typography identifiers** are the meaningful part of a typography token, e.g. `"font-body-l"` for `--dt-font-body-l-size`. The gap between lines comes from the token's line height, so the skeleton matches the real text.
|
|
63
|
+
- **`button-*` sizes** match the equivalent `pie-button` size: `"button-xsmall"`, `"button-small-productive"`, `"button-small-expressive"`, `"button-medium"` and `"button-large"`.
|
|
64
|
+
|
|
65
|
+
When `height` is missing, or is a value the variant doesn't accept, the variant falls back to a default:
|
|
66
|
+
|
|
67
|
+
| `variant` | Default height |
|
|
68
|
+
|-----------|----------------|
|
|
69
|
+
| `box` | `width: 100%` with a 1:1 ratio |
|
|
70
|
+
| `circle` | `width: 100%` with a 1:1 ratio |
|
|
71
|
+
| `pill` | `"button-medium"` |
|
|
72
|
+
| `star` | `"spacing-e"` (24px) |
|
|
73
|
+
| `text` | `"font-body-l"` |
|
|
36
74
|
|
|
37
75
|
### Slots
|
|
38
76
|
|
|
39
77
|
This component does not expose any slots.
|
|
40
78
|
|
|
41
79
|
### CSS Variables
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
| | | |
|
|
80
|
+
|
|
81
|
+
This component does not expose any CSS variables for style overrides.
|
|
45
82
|
|
|
46
83
|
### Events
|
|
47
84
|
|
|
48
|
-
This component does not emit any custom events.
|
|
85
|
+
This component does not emit any custom events.
|
|
49
86
|
|
|
50
87
|
## Usage Examples
|
|
51
88
|
|
|
@@ -58,7 +95,10 @@ import '@justeattakeaway/pie-webc/components/skeleton.js'
|
|
|
58
95
|
|
|
59
96
|
```html
|
|
60
97
|
<!-- pass js file into <script> tag -->
|
|
61
|
-
|
|
98
|
+
<pie-skeleton variant="box" height="200px"></pie-skeleton>
|
|
99
|
+
<pie-skeleton variant="text" height="font-body-l" lines="3"></pie-skeleton>
|
|
100
|
+
<pie-skeleton variant="star" stars="5"></pie-skeleton>
|
|
101
|
+
<pie-skeleton variant="pill" height="button-medium"></pie-skeleton>
|
|
62
102
|
<script type="module" src="/main.js"></script>
|
|
63
103
|
```
|
|
64
104
|
|
|
@@ -66,8 +106,9 @@ import '@justeattakeaway/pie-webc/components/skeleton.js'
|
|
|
66
106
|
|
|
67
107
|
```js
|
|
68
108
|
// Vue templates (using Nuxt 3)
|
|
69
|
-
import '@justeattakeaway/pie-webc/components/skeleton.js'
|
|
109
|
+
import '@justeattakeaway/pie-webc/components/skeleton.js';
|
|
70
110
|
|
|
111
|
+
<pie-skeleton variant="box" height="200px"></pie-skeleton>
|
|
71
112
|
```
|
|
72
113
|
|
|
73
114
|
**For React Applications:**
|
|
@@ -75,8 +116,20 @@ import '@justeattakeaway/pie-webc/components/skeleton.js'
|
|
|
75
116
|
```jsx
|
|
76
117
|
import { PieSkeleton } from '@justeattakeaway/pie-webc/react/skeleton.js';
|
|
77
118
|
|
|
119
|
+
<PieSkeleton variant="box" height="200px"></PieSkeleton>
|
|
78
120
|
```
|
|
79
121
|
|
|
122
|
+
## Avoiding layout shift
|
|
123
|
+
|
|
124
|
+
A skeleton's job is to reserve the space of the content it stands in for, so the page doesn't shift when the content arrives. Cumulative Layout Shift (CLS) is measured when that space changes, so matching it exactly matters.
|
|
125
|
+
|
|
126
|
+
- **Match heights as close as possible.** A height mismatch pushes all content below the skeleton when it is replaced. Width matters much less, except in rows (flex/inline) where a wider element can wrap.
|
|
127
|
+
- **Use typography identifiers for text.** Setting `height` to the same identifier as the real text (e.g. `height="font-body-l"`) makes each line take the same vertical space as the real text (font size plus line gap), including the narrow/wide changes for headings and subheadings.
|
|
128
|
+
- **Control the number of lines.** Text of varying length can wrap to more lines than the skeleton shows. Cap the real text (e.g. with `line-clamp`) or reserve a `min-height` on the container.
|
|
129
|
+
- **Reserve space for images.** Give a `box` skeleton the same size or aspect ratio as the image, and keep that space reserved on the image itself.
|
|
130
|
+
- **Reserve space on the container.** A fixed or minimum height (or aspect ratio) on the container stops small differences inside it from moving content outside it.
|
|
131
|
+
- **Small mismatches add up.** One 4px difference is negligible (around 0.003 CLS), but the same difference repeated across a list of 10 cards can reach around 0.04 — almost half of the 0.1 "good" threshold.
|
|
132
|
+
|
|
80
133
|
## Questions and Support
|
|
81
134
|
|
|
82
135
|
If you work at Just Eat Takeaway.com, please contact us on **#help-designsystem**. Otherwise, please raise an issue on [Github](https://github.com/justeattakeaway/pie/issues).
|
package/custom-elements.json
CHANGED
|
@@ -11,8 +11,208 @@
|
|
|
11
11
|
{
|
|
12
12
|
"kind": "javascript-module",
|
|
13
13
|
"path": "src/defs.js",
|
|
14
|
-
"declarations": [
|
|
15
|
-
|
|
14
|
+
"declarations": [
|
|
15
|
+
{
|
|
16
|
+
"kind": "variable",
|
|
17
|
+
"name": "variants",
|
|
18
|
+
"type": {
|
|
19
|
+
"text": "['box', 'circle', 'pill', 'text', 'star']"
|
|
20
|
+
},
|
|
21
|
+
"default": "['box', 'circle', 'pill', 'text', 'star']"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"kind": "variable",
|
|
25
|
+
"name": "backgroundColors",
|
|
26
|
+
"type": {
|
|
27
|
+
"text": "['default', 'strong', 'subtle']"
|
|
28
|
+
},
|
|
29
|
+
"default": "['default', 'strong', 'subtle']"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"kind": "variable",
|
|
33
|
+
"name": "backgroundColorClassNames",
|
|
34
|
+
"type": {
|
|
35
|
+
"text": "Record<typeof backgroundColors[number], string>"
|
|
36
|
+
},
|
|
37
|
+
"default": "{ default: 'c-skeleton--backgroundDefault', strong: 'c-skeleton--backgroundStrong', subtle: 'c-skeleton--backgroundSubtle', }"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"kind": "variable",
|
|
41
|
+
"name": "aspectRatios",
|
|
42
|
+
"type": {
|
|
43
|
+
"text": "['1by1', '4by3', '16by9', '3by4', '9by16']"
|
|
44
|
+
},
|
|
45
|
+
"default": "['1by1', '4by3', '16by9', '3by4', '9by16']"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"kind": "variable",
|
|
49
|
+
"name": "borderRadii",
|
|
50
|
+
"type": {
|
|
51
|
+
"text": "[\n 'radius-rounded-none',\n 'radius-rounded-a',\n 'radius-rounded-b',\n 'radius-rounded-c',\n 'radius-rounded-d',\n 'radius-rounded-e',\n 'radius-rounded-f',\n 'radius-rounded-g',\n]"
|
|
52
|
+
},
|
|
53
|
+
"default": "[ 'radius-rounded-none', 'radius-rounded-a', 'radius-rounded-b', 'radius-rounded-c', 'radius-rounded-d', 'radius-rounded-e', 'radius-rounded-f', 'radius-rounded-g', ]"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"kind": "variable",
|
|
57
|
+
"name": "buttonSizes",
|
|
58
|
+
"type": {
|
|
59
|
+
"text": "[\n 'button-xsmall',\n 'button-small-productive',\n 'button-small-expressive',\n 'button-medium',\n 'button-large',\n]"
|
|
60
|
+
},
|
|
61
|
+
"default": "[ 'button-xsmall', 'button-small-productive', 'button-small-expressive', 'button-medium', 'button-large', ]",
|
|
62
|
+
"description": "The `pie-button` size names accepted by the `pill` variant's `height`."
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"kind": "variable",
|
|
66
|
+
"name": "spacingIdentifiers",
|
|
67
|
+
"type": {
|
|
68
|
+
"text": "[\n 'spacing-none',\n 'spacing-a-small',\n 'spacing-a',\n 'spacing-b',\n 'spacing-c',\n 'spacing-d',\n 'spacing-e',\n 'spacing-f',\n 'spacing-g',\n 'spacing-h',\n 'spacing-i',\n 'spacing-j',\n]"
|
|
69
|
+
},
|
|
70
|
+
"default": "[ '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', ]",
|
|
71
|
+
"description": "The lettered spacing tokens accepted as a `height`, written as the token name without the\n`--dt-` prefix (e.g. `spacing-e`). The numbered base tokens (`--dt-spacing-24`, etc.) are not supported."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"kind": "variable",
|
|
75
|
+
"name": "LINES_MIN",
|
|
76
|
+
"type": {
|
|
77
|
+
"text": "number"
|
|
78
|
+
},
|
|
79
|
+
"default": "1",
|
|
80
|
+
"description": "The minimum number of lines the `text` variant can draw."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"kind": "variable",
|
|
84
|
+
"name": "LINES_MAX",
|
|
85
|
+
"type": {
|
|
86
|
+
"text": "number"
|
|
87
|
+
},
|
|
88
|
+
"default": "10",
|
|
89
|
+
"description": "The maximum number of lines the `text` variant can draw."
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"kind": "variable",
|
|
93
|
+
"name": "STARS_MIN",
|
|
94
|
+
"type": {
|
|
95
|
+
"text": "number"
|
|
96
|
+
},
|
|
97
|
+
"default": "1",
|
|
98
|
+
"description": "The minimum number of stars the `star` variant can draw."
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"kind": "variable",
|
|
102
|
+
"name": "STARS_MAX",
|
|
103
|
+
"type": {
|
|
104
|
+
"text": "number"
|
|
105
|
+
},
|
|
106
|
+
"default": "10",
|
|
107
|
+
"description": "The maximum number of stars the `star` variant can draw."
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"kind": "variable",
|
|
111
|
+
"name": "defaultProps",
|
|
112
|
+
"type": {
|
|
113
|
+
"text": "DefaultProps"
|
|
114
|
+
},
|
|
115
|
+
"default": "{ variant: 'box', backgroundColor: 'default', lines: 1, stars: 1, borderRadius: 'radius-rounded-b', aspectRatio: '1by1', isResponsive: false, }"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"exports": [
|
|
119
|
+
{
|
|
120
|
+
"kind": "js",
|
|
121
|
+
"name": "variants",
|
|
122
|
+
"declaration": {
|
|
123
|
+
"name": "variants",
|
|
124
|
+
"module": "src/defs.js"
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"kind": "js",
|
|
129
|
+
"name": "backgroundColors",
|
|
130
|
+
"declaration": {
|
|
131
|
+
"name": "backgroundColors",
|
|
132
|
+
"module": "src/defs.js"
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"kind": "js",
|
|
137
|
+
"name": "backgroundColorClassNames",
|
|
138
|
+
"declaration": {
|
|
139
|
+
"name": "backgroundColorClassNames",
|
|
140
|
+
"module": "src/defs.js"
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"kind": "js",
|
|
145
|
+
"name": "aspectRatios",
|
|
146
|
+
"declaration": {
|
|
147
|
+
"name": "aspectRatios",
|
|
148
|
+
"module": "src/defs.js"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"kind": "js",
|
|
153
|
+
"name": "borderRadii",
|
|
154
|
+
"declaration": {
|
|
155
|
+
"name": "borderRadii",
|
|
156
|
+
"module": "src/defs.js"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"kind": "js",
|
|
161
|
+
"name": "buttonSizes",
|
|
162
|
+
"declaration": {
|
|
163
|
+
"name": "buttonSizes",
|
|
164
|
+
"module": "src/defs.js"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"kind": "js",
|
|
169
|
+
"name": "spacingIdentifiers",
|
|
170
|
+
"declaration": {
|
|
171
|
+
"name": "spacingIdentifiers",
|
|
172
|
+
"module": "src/defs.js"
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"kind": "js",
|
|
177
|
+
"name": "LINES_MIN",
|
|
178
|
+
"declaration": {
|
|
179
|
+
"name": "LINES_MIN",
|
|
180
|
+
"module": "src/defs.js"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"kind": "js",
|
|
185
|
+
"name": "LINES_MAX",
|
|
186
|
+
"declaration": {
|
|
187
|
+
"name": "LINES_MAX",
|
|
188
|
+
"module": "src/defs.js"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"kind": "js",
|
|
193
|
+
"name": "STARS_MIN",
|
|
194
|
+
"declaration": {
|
|
195
|
+
"name": "STARS_MIN",
|
|
196
|
+
"module": "src/defs.js"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
"kind": "js",
|
|
201
|
+
"name": "STARS_MAX",
|
|
202
|
+
"declaration": {
|
|
203
|
+
"name": "STARS_MAX",
|
|
204
|
+
"module": "src/defs.js"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"kind": "js",
|
|
209
|
+
"name": "defaultProps",
|
|
210
|
+
"declaration": {
|
|
211
|
+
"name": "defaultProps",
|
|
212
|
+
"module": "src/defs.js"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
]
|
|
16
216
|
},
|
|
17
217
|
{
|
|
18
218
|
"kind": "javascript-module",
|
|
@@ -22,7 +222,252 @@
|
|
|
22
222
|
"kind": "class",
|
|
23
223
|
"description": "",
|
|
24
224
|
"name": "PieSkeleton",
|
|
25
|
-
"members": [
|
|
225
|
+
"members": [
|
|
226
|
+
{
|
|
227
|
+
"kind": "field",
|
|
228
|
+
"name": "variant",
|
|
229
|
+
"privacy": "public",
|
|
230
|
+
"attribute": "variant"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"kind": "field",
|
|
234
|
+
"name": "backgroundColor",
|
|
235
|
+
"privacy": "public",
|
|
236
|
+
"attribute": "backgroundColor"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"kind": "field",
|
|
240
|
+
"name": "width",
|
|
241
|
+
"type": {
|
|
242
|
+
"text": "SkeletonProps['width']"
|
|
243
|
+
},
|
|
244
|
+
"privacy": "public",
|
|
245
|
+
"attribute": "width"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"kind": "field",
|
|
249
|
+
"name": "height",
|
|
250
|
+
"type": {
|
|
251
|
+
"text": "SkeletonProps['height']"
|
|
252
|
+
},
|
|
253
|
+
"privacy": "public",
|
|
254
|
+
"attribute": "height"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"kind": "field",
|
|
258
|
+
"name": "lines",
|
|
259
|
+
"privacy": "public",
|
|
260
|
+
"attribute": "lines"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"kind": "field",
|
|
264
|
+
"name": "stars",
|
|
265
|
+
"privacy": "public",
|
|
266
|
+
"attribute": "stars"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"kind": "field",
|
|
270
|
+
"name": "borderRadius",
|
|
271
|
+
"privacy": "public",
|
|
272
|
+
"attribute": "borderRadius"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"kind": "field",
|
|
276
|
+
"name": "aspectRatio",
|
|
277
|
+
"privacy": "public",
|
|
278
|
+
"attribute": "aspectRatio"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"kind": "field",
|
|
282
|
+
"name": "isResponsive",
|
|
283
|
+
"privacy": "public",
|
|
284
|
+
"attribute": "isResponsive"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"kind": "method",
|
|
288
|
+
"name": "_clamp",
|
|
289
|
+
"privacy": "private",
|
|
290
|
+
"return": {
|
|
291
|
+
"type": {
|
|
292
|
+
"text": "number"
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"parameters": [
|
|
296
|
+
{
|
|
297
|
+
"name": "value",
|
|
298
|
+
"type": {
|
|
299
|
+
"text": "number"
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": "min",
|
|
304
|
+
"type": {
|
|
305
|
+
"text": "number"
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"name": "max",
|
|
310
|
+
"type": {
|
|
311
|
+
"text": "number"
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
],
|
|
315
|
+
"description": "Clamps a numeric prop to the given inclusive range. Non-numeric values fall back to the minimum."
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"kind": "field",
|
|
319
|
+
"name": "_linesCount",
|
|
320
|
+
"type": {
|
|
321
|
+
"text": "number"
|
|
322
|
+
},
|
|
323
|
+
"privacy": "private",
|
|
324
|
+
"description": "The number of text lines to draw, clamped between 1 and 10.",
|
|
325
|
+
"readonly": true
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"kind": "field",
|
|
329
|
+
"name": "_starsCount",
|
|
330
|
+
"type": {
|
|
331
|
+
"text": "number"
|
|
332
|
+
},
|
|
333
|
+
"privacy": "private",
|
|
334
|
+
"description": "The number of stars to draw, clamped between 1 and 10.",
|
|
335
|
+
"readonly": true
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"kind": "method",
|
|
339
|
+
"name": "_isButtonSize",
|
|
340
|
+
"privacy": "private",
|
|
341
|
+
"return": {
|
|
342
|
+
"type": {
|
|
343
|
+
"text": "value is typeof buttonSizes[number]"
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
"parameters": [
|
|
347
|
+
{
|
|
348
|
+
"name": "value",
|
|
349
|
+
"optional": true,
|
|
350
|
+
"type": {
|
|
351
|
+
"text": "string"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
],
|
|
355
|
+
"description": "Whether a `height` value is a `pie-button` size name."
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"kind": "method",
|
|
359
|
+
"name": "_isSpacingIdentifier",
|
|
360
|
+
"privacy": "private",
|
|
361
|
+
"return": {
|
|
362
|
+
"type": {
|
|
363
|
+
"text": "boolean"
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
"parameters": [
|
|
367
|
+
{
|
|
368
|
+
"name": "value",
|
|
369
|
+
"optional": true,
|
|
370
|
+
"type": {
|
|
371
|
+
"text": "string"
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
],
|
|
375
|
+
"description": "Whether a `height` value is a supported spacing identifier (e.g. `spacing-e`)."
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"kind": "method",
|
|
379
|
+
"name": "_resolveHeight",
|
|
380
|
+
"privacy": "private",
|
|
381
|
+
"return": {
|
|
382
|
+
"type": {
|
|
383
|
+
"text": "string | undefined"
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"description": "Resolves the `height` prop to a CSS length for the variants that accept absolute values,\npercentages or spacing identifiers (box, circle, pill and star).\nReturns `undefined` when the value is handled elsewhere (a `button-*` size) or isn't valid\nfor the variant, so the CSS default applies."
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"kind": "field",
|
|
390
|
+
"name": "_rootClasses",
|
|
391
|
+
"type": {
|
|
392
|
+
"text": "Record<string, boolean>"
|
|
393
|
+
},
|
|
394
|
+
"privacy": "private",
|
|
395
|
+
"description": "The classes applied to the root element.",
|
|
396
|
+
"readonly": true
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"kind": "field",
|
|
400
|
+
"name": "_rootStyles",
|
|
401
|
+
"type": {
|
|
402
|
+
"text": "string"
|
|
403
|
+
},
|
|
404
|
+
"privacy": "private",
|
|
405
|
+
"description": "The inline styles applied to the root element.",
|
|
406
|
+
"readonly": true
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"kind": "method",
|
|
410
|
+
"name": "_renderTextLines",
|
|
411
|
+
"privacy": "private",
|
|
412
|
+
"description": "Renders the text lines for the `text` variant. When there's more than one line,\nthe last line is drawn at half width (handled in CSS through the `is-last` class)."
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"kind": "method",
|
|
416
|
+
"name": "_renderStars",
|
|
417
|
+
"privacy": "private",
|
|
418
|
+
"description": "Renders the stars for the `star` variant."
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"kind": "method",
|
|
422
|
+
"name": "_renderShapes",
|
|
423
|
+
"privacy": "private",
|
|
424
|
+
"description": "Renders the shapes drawn inside the root element. The box, circle and pill variants\nare drawn by the root element itself, so they have no children."
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
"attributes": [
|
|
428
|
+
{
|
|
429
|
+
"name": "variant",
|
|
430
|
+
"fieldName": "variant"
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"name": "backgroundColor",
|
|
434
|
+
"fieldName": "backgroundColor"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
"name": "width",
|
|
438
|
+
"type": {
|
|
439
|
+
"text": "SkeletonProps['width']"
|
|
440
|
+
},
|
|
441
|
+
"fieldName": "width"
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"name": "height",
|
|
445
|
+
"type": {
|
|
446
|
+
"text": "SkeletonProps['height']"
|
|
447
|
+
},
|
|
448
|
+
"fieldName": "height"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"name": "lines",
|
|
452
|
+
"fieldName": "lines"
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"name": "stars",
|
|
456
|
+
"fieldName": "stars"
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
"name": "borderRadius",
|
|
460
|
+
"fieldName": "borderRadius"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "aspectRatio",
|
|
464
|
+
"fieldName": "aspectRatio"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"name": "isResponsive",
|
|
468
|
+
"fieldName": "isResponsive"
|
|
469
|
+
}
|
|
470
|
+
],
|
|
26
471
|
"superclass": {
|
|
27
472
|
"name": "PieElement",
|
|
28
473
|
"package": "@justeattakeaway/pie-webc-core/src/internals/PieElement"
|