@justeattakeaway/pie-skeleton 0.0.0-stage → 0.0.1
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 +85 -2
- package/custom-elements.json +54 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +27 -0
- package/dist/react.d.ts +21 -0
- package/dist/react.js +13 -0
- package/package.json +47 -4
- package/src/defs-react.ts +8 -0
- package/src/defs.ts +3 -0
- package/src/index.ts +32 -0
- package/src/react.ts +19 -0
- package/src/skeleton.scss +7 -0
package/README.md
CHANGED
|
@@ -1,3 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @justeattakeaway/pie-skeleton
|
|
2
|
+
[Source Code](https://github.com/justeattakeaway/pie/tree/main/packages/components/pie-skeleton) | [Design Documentation](https://pie.design/components/skeleton) | [NPM](https://www.npmjs.com/package/@justeattakeaway/pie-skeleton)
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://www.npmjs.com/@justeattakeaway/pie-skeleton">
|
|
6
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-skeleton.svg">
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
`@justeattakeaway/pie-skeleton` is a Web Component built using the Lit library. It offers a simple and accessible `skeleton` component for web applications.
|
|
11
|
+
|
|
12
|
+
## Table of Contents
|
|
13
|
+
|
|
14
|
+
- [Installation](#installation)
|
|
15
|
+
- [Documentation](#documentation)
|
|
16
|
+
- [Properties](#properties)
|
|
17
|
+
- [Slots](#slots)
|
|
18
|
+
- [CSS Variables](#css-variables)
|
|
19
|
+
- [Events](#events)
|
|
20
|
+
- [Usage Examples](#usage-examples)
|
|
21
|
+
- [Questions and Support](#questions-and-support)
|
|
22
|
+
- [Contributing](#contributing)
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
> To install any of our web components in your application, we would suggest following the [getting started guide](https://webc.pie.design/?path=/docs/introduction-getting-started--docs) to set up your project.
|
|
27
|
+
|
|
28
|
+
Ideally, you should install the component using the **`@justeattakeaway/pie-webc`** package, which includes all of the components. Or you can install the individual component package.
|
|
29
|
+
|
|
30
|
+
## Documentation
|
|
31
|
+
|
|
32
|
+
### Properties
|
|
33
|
+
| Prop | Options | Description | Default |
|
|
34
|
+
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
|
|
35
|
+
| | | | |
|
|
36
|
+
|
|
37
|
+
### Slots
|
|
38
|
+
|
|
39
|
+
This component does not expose any slots.
|
|
40
|
+
|
|
41
|
+
### CSS Variables
|
|
42
|
+
| Variable | Description | Default |
|
|
43
|
+
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
|
|
44
|
+
| | | |
|
|
45
|
+
|
|
46
|
+
### Events
|
|
47
|
+
|
|
48
|
+
This component does not emit any custom events.
|
|
49
|
+
|
|
50
|
+
## Usage Examples
|
|
51
|
+
|
|
52
|
+
**For HTML:**
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
// import as module into a js file e.g. main.js
|
|
56
|
+
import '@justeattakeaway/pie-webc/components/skeleton.js'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
```html
|
|
60
|
+
<!-- pass js file into <script> tag -->
|
|
61
|
+
|
|
62
|
+
<script type="module" src="/main.js"></script>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**For Native JS Applications, Vue, Angular, Svelte etc.:**
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
// Vue templates (using Nuxt 3)
|
|
69
|
+
import '@justeattakeaway/pie-webc/components/skeleton.js'
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**For React Applications:**
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
import { PieSkeleton } from '@justeattakeaway/pie-webc/react/skeleton.js';
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Questions and Support
|
|
81
|
+
|
|
82
|
+
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).
|
|
83
|
+
|
|
84
|
+
## Contributing
|
|
85
|
+
|
|
86
|
+
Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/defs-react.js",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": []
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"kind": "javascript-module",
|
|
13
|
+
"path": "src/defs.js",
|
|
14
|
+
"declarations": [],
|
|
15
|
+
"exports": []
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"kind": "javascript-module",
|
|
19
|
+
"path": "src/index.js",
|
|
20
|
+
"declarations": [
|
|
21
|
+
{
|
|
22
|
+
"kind": "class",
|
|
23
|
+
"description": "",
|
|
24
|
+
"name": "PieSkeleton",
|
|
25
|
+
"members": [],
|
|
26
|
+
"superclass": {
|
|
27
|
+
"name": "PieElement",
|
|
28
|
+
"package": "@justeattakeaway/pie-webc-core/src/internals/PieElement"
|
|
29
|
+
},
|
|
30
|
+
"tagName": "pie-skeleton",
|
|
31
|
+
"customElement": true
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"exports": [
|
|
35
|
+
{
|
|
36
|
+
"kind": "js",
|
|
37
|
+
"name": "*",
|
|
38
|
+
"declaration": {
|
|
39
|
+
"name": "*",
|
|
40
|
+
"module": "src/defs"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"kind": "js",
|
|
45
|
+
"name": "PieSkeleton",
|
|
46
|
+
"declaration": {
|
|
47
|
+
"name": "PieSkeleton",
|
|
48
|
+
"module": "src/index.js"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
3
|
+
import { TemplateResult } from 'lit-html';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @tagname pie-skeleton
|
|
7
|
+
*/
|
|
8
|
+
export declare class PieSkeleton extends PieElement implements SkeletonProps {
|
|
9
|
+
render(): TemplateResult<1>;
|
|
10
|
+
static styles: CSSResult;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare interface SkeletonProps {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
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 {
|
|
4
|
+
willUpdate() {
|
|
5
|
+
this.getAttribute("v") || this.setAttribute("v", e.v);
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
e.v = "0.0.1";
|
|
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;
|
|
15
|
+
};
|
|
16
|
+
let l = class extends r {
|
|
17
|
+
render() {
|
|
18
|
+
return v`<h1 data-test-id="pie-skeleton">Hello world!</h1>`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
l.styles = h(d);
|
|
22
|
+
l = b([
|
|
23
|
+
c("pie-skeleton")
|
|
24
|
+
], l);
|
|
25
|
+
export {
|
|
26
|
+
l as PieSkeleton
|
|
27
|
+
};
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
3
|
+
import * as React_2 from 'react';
|
|
4
|
+
import { TemplateResult } from 'lit-html';
|
|
5
|
+
|
|
6
|
+
export declare const PieSkeleton: React_2.ForwardRefExoticComponent<React_2.PropsWithChildren<Omit<React_2.PropsWithoutRef<SkeletonProps>, "children">> & React_2.RefAttributes<PieSkeleton_2> & ReactBaseType>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @tagname pie-skeleton
|
|
10
|
+
*/
|
|
11
|
+
declare class PieSkeleton_2 extends PieElement implements SkeletonProps {
|
|
12
|
+
render(): TemplateResult<1>;
|
|
13
|
+
static styles: CSSResult;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare type ReactBaseType = React_2.HTMLAttributes<HTMLElement>;
|
|
17
|
+
|
|
18
|
+
export declare interface SkeletonProps {
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { }
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { createComponent as t } from "@lit/react";
|
|
3
|
+
import { PieSkeleton as o } from "./index.js";
|
|
4
|
+
const n = t({
|
|
5
|
+
displayName: "PieSkeleton",
|
|
6
|
+
elementClass: o,
|
|
7
|
+
react: e,
|
|
8
|
+
tagName: "pie-skeleton",
|
|
9
|
+
events: {}
|
|
10
|
+
}), m = n;
|
|
11
|
+
export {
|
|
12
|
+
m as PieSkeleton
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-skeleton",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"description": "PIE Design System Skeleton built using Web Components",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"custom-elements.json",
|
|
11
|
+
"src",
|
|
12
|
+
"dist",
|
|
13
|
+
"**/*.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"pieMetadata": {
|
|
16
|
+
"componentStatus": "alpha",
|
|
17
|
+
"replaces": {
|
|
18
|
+
"snacks": []
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "run -T vite build",
|
|
23
|
+
"build:react-wrapper": "run -T build-react-wrapper",
|
|
24
|
+
"create:manifest": "run -T cem analyze --litelement",
|
|
25
|
+
"lint:scripts": "run -T eslint .",
|
|
26
|
+
"lint:scripts:fix": "yarn lint:scripts --fix",
|
|
27
|
+
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
|
|
28
|
+
"lint:style:fix": "yarn lint:style --fix",
|
|
29
|
+
"watch": "run -T vite build --watch",
|
|
30
|
+
"test:browsers": "run -T playwright test -c ./playwright-lit.config.ts",
|
|
31
|
+
"test:browsers:ci": "yarn test:browsers",
|
|
32
|
+
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_SKELETON} percy exec --allowed-hostname cloudfront.net -- run -T playwright test -c ./playwright-lit-visual.config.ts",
|
|
33
|
+
"test:visual:ci": "yarn test:visual"
|
|
34
|
+
},
|
|
35
|
+
"author": "Just Eat Takeaway.com - Design System Team",
|
|
36
|
+
"license": "Apache-2.0",
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@justeattakeaway/pie-components-config": "0.21.5",
|
|
39
|
+
"@justeattakeaway/pie-css": "1.9.1",
|
|
40
|
+
"@justeattakeaway/pie-monorepo-utils": "0.9.13"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@justeattakeaway/pie-webc-core": "22.0.1"
|
|
44
|
+
},
|
|
45
|
+
"customElements": "custom-elements.json",
|
|
46
|
+
"sideEffects": [
|
|
47
|
+
"dist/*.js"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* TODO: Verify if ReactBaseType can be set as a more specific React interface
|
|
4
|
+
* Use the React IntrinsicElements interface to find how to map standard HTML elements to existing React Interfaces
|
|
5
|
+
* Example: an HTML button maps to `React.ButtonHTMLAttributes<HTMLButtonElement>`
|
|
6
|
+
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0bb210867d16170c4a08d9ce5d132817651a0f80/types/react/index.d.ts#L2829
|
|
7
|
+
*/
|
|
8
|
+
export type ReactBaseType = React.HTMLAttributes<HTMLElement>
|
package/src/defs.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
import { html, unsafeCSS } from 'lit';
|
|
3
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
4
|
+
import {
|
|
5
|
+
safeCustomElement,
|
|
6
|
+
} from '@justeattakeaway/pie-webc-core';
|
|
7
|
+
import styles from './skeleton.scss?inline';
|
|
8
|
+
import { type SkeletonProps } from './defs';
|
|
9
|
+
|
|
10
|
+
// Valid values available to consumers
|
|
11
|
+
export * from './defs';
|
|
12
|
+
|
|
13
|
+
const componentSelector = 'pie-skeleton';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @tagname pie-skeleton
|
|
17
|
+
*/
|
|
18
|
+
@safeCustomElement('pie-skeleton')
|
|
19
|
+
export class PieSkeleton extends PieElement implements SkeletonProps {
|
|
20
|
+
render () {
|
|
21
|
+
return html`<h1 data-test-id="pie-skeleton">Hello world!</h1>`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Renders a `CSSResult` generated from SCSS by Vite
|
|
25
|
+
static styles = unsafeCSS(styles);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
[componentSelector]: PieSkeleton;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/react.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { PieSkeleton as PieSkeletonLit } from './index';
|
|
4
|
+
import { type SkeletonProps } from './defs';
|
|
5
|
+
|
|
6
|
+
export * from './defs';
|
|
7
|
+
|
|
8
|
+
const PieSkeletonReact = createComponent({
|
|
9
|
+
displayName: 'PieSkeleton',
|
|
10
|
+
elementClass: PieSkeletonLit,
|
|
11
|
+
react: React,
|
|
12
|
+
tagName: 'pie-skeleton',
|
|
13
|
+
events: {},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
type ReactBaseType = React.HTMLAttributes<HTMLElement>
|
|
17
|
+
|
|
18
|
+
export const PieSkeleton = PieSkeletonReact as React.ForwardRefExoticComponent<React.PropsWithChildren<Omit<React.PropsWithoutRef<SkeletonProps>, 'children'>>
|
|
19
|
+
& React.RefAttributes<PieSkeletonLit> & ReactBaseType>;
|