@justeattakeaway/pie-tag 0.0.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 +91 -0
- package/declaration.d.ts +9 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +13 -0
- package/dist/react.d.ts +19 -0
- package/dist/react.js +15 -0
- package/package.json +42 -0
- package/src/defs.ts +3 -0
- package/src/index.ts +30 -0
- package/src/tag.scss +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img align="center" src="../../../readme_image.png" height="200" alt="">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://www.npmjs.com/@justeattakeaway/pie-tag">
|
|
7
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-tag.svg">
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
# Table of Contents
|
|
12
|
+
|
|
13
|
+
1. [Introduction](#pie-tag)
|
|
14
|
+
2. [Installation](#installation)
|
|
15
|
+
3. [Importing the component](#importing-the-component)
|
|
16
|
+
4. [Peer Dependencies](#peer-dependencies)
|
|
17
|
+
5. [Props](#props)
|
|
18
|
+
6. [Contributing](#contributing)
|
|
19
|
+
|
|
20
|
+
## pie-tag
|
|
21
|
+
|
|
22
|
+
`pie-tag` is a Web Component built using the Lit library.
|
|
23
|
+
|
|
24
|
+
This component can be easily integrated into various frontend frameworks and customized through a set of properties.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
To install `pie-tag` in your application, run the following on your command line:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# npm
|
|
33
|
+
$ npm i @justeattakeaway/pie-tag
|
|
34
|
+
|
|
35
|
+
# yarn
|
|
36
|
+
$ yarn add @justeattakeaway/pie-tag
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For full information on using PIE components as part of an application, check out the [Getting Started Guide](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components).
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Importing the component
|
|
43
|
+
|
|
44
|
+
#### JavaScript
|
|
45
|
+
```js
|
|
46
|
+
// Default – for Native JS Applications, Vue, Angular, Svelte, etc.
|
|
47
|
+
import { PieTag } from '@justeattakeaway/pie-tag';
|
|
48
|
+
|
|
49
|
+
// If you don't need to reference the imported object, you can simply
|
|
50
|
+
// import the module which registers the component as a custom element.
|
|
51
|
+
import '@justeattakeaway/pie-tag';
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### React
|
|
55
|
+
```js
|
|
56
|
+
// React
|
|
57
|
+
// For React, you will need to import our React-specific component build
|
|
58
|
+
// which wraps the web component using @lit/react
|
|
59
|
+
import { PieTag } from '@justeattakeaway/pie-tag/dist/react';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> [!NOTE]
|
|
63
|
+
> When using the React version of the component, please make sure to also
|
|
64
|
+
> include React as a [peer dependency](#peer-dependencies) in your project.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
## Peer Dependencies
|
|
68
|
+
|
|
69
|
+
> [!IMPORTANT]
|
|
70
|
+
> When using `pie-tag`, you will also need to include a couple of dependencies to ensure the component renders as expected. See [the PIE Wiki](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components#expected-dependencies) for more information and how to include these in your application.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Props
|
|
74
|
+
|
|
75
|
+
| Property | Type | Default | Description |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| - | - | - | - |
|
|
78
|
+
|
|
79
|
+
In your markup or JSX, you can then use these to set the properties for the `pie-tag` component:
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<!-- Native HTML -->
|
|
83
|
+
<pie-tag></pie-tag>
|
|
84
|
+
|
|
85
|
+
<!-- JSX -->
|
|
86
|
+
<PieTag></PieTag>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Contributing
|
|
90
|
+
|
|
91
|
+
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).
|
package/declaration.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CSSResult } from 'lit';
|
|
2
|
+
import type { LitElement } from 'lit';
|
|
3
|
+
import type { TemplateResult } from 'lit-html';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @tagname pie-tag
|
|
7
|
+
*/
|
|
8
|
+
export declare class PieTag extends LitElement implements TagProps {
|
|
9
|
+
render(): TemplateResult<1>;
|
|
10
|
+
static styles: CSSResult;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare interface TagProps {
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { unsafeCSS as t, LitElement as o, html as s } from "lit";
|
|
2
|
+
import { defineCustomElement as n } from "@justeattakeaway/pie-webc-core";
|
|
3
|
+
const r = "", l = "pie-tag";
|
|
4
|
+
class e extends o {
|
|
5
|
+
render() {
|
|
6
|
+
return s`<h1 data-test-id="pie-tag">Hello world!</h1>`;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
e.styles = t(r);
|
|
10
|
+
n(l, e);
|
|
11
|
+
export {
|
|
12
|
+
e as PieTag
|
|
13
|
+
};
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CSSResult } from 'lit';
|
|
2
|
+
import type { LitElement } from 'lit';
|
|
3
|
+
import type { ReactWebComponent } from '@lit/react';
|
|
4
|
+
import type { TemplateResult } from 'lit-html';
|
|
5
|
+
|
|
6
|
+
export declare const PieTag: ReactWebComponent<PieTag_2, {}>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @tagname pie-tag
|
|
10
|
+
*/
|
|
11
|
+
declare class PieTag_2 extends LitElement implements TagProps {
|
|
12
|
+
render(): TemplateResult<1>;
|
|
13
|
+
static styles: CSSResult;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare interface TagProps {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { }
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { createComponent as a } from "@lit/react";
|
|
3
|
+
import { PieTag as t } from "./index.js";
|
|
4
|
+
import "lit";
|
|
5
|
+
import "@justeattakeaway/pie-webc-core";
|
|
6
|
+
const p = a({
|
|
7
|
+
displayName: "PieTag",
|
|
8
|
+
elementClass: t,
|
|
9
|
+
react: e,
|
|
10
|
+
tagName: "pie-tag",
|
|
11
|
+
events: {}
|
|
12
|
+
});
|
|
13
|
+
export {
|
|
14
|
+
p as PieTag
|
|
15
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@justeattakeaway/pie-tag",
|
|
3
|
+
"description": "PIE Design System Tag built using Web Components",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"src",
|
|
11
|
+
"dist",
|
|
12
|
+
"**/*.d.ts"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "yarn build:wrapper pie-tag && run -T vite build",
|
|
16
|
+
"lint:scripts": "run -T eslint .",
|
|
17
|
+
"lint:scripts:fix": "yarn lint:scripts --fix",
|
|
18
|
+
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
|
|
19
|
+
"lint:style:fix": "yarn lint:style --fix",
|
|
20
|
+
"watch": "run -T vite build --watch",
|
|
21
|
+
"test": "echo \"Error: no test specified\" && exit 0",
|
|
22
|
+
"test:ci": "yarn test",
|
|
23
|
+
"test:browsers": "npx playwright test -c ./playwright-lit.config.ts",
|
|
24
|
+
"test:browsers:ci": "yarn test:browsers",
|
|
25
|
+
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_TAG} percy exec --allowed-hostname cloudfront.net -- npx playwright test -c ./playwright-lit-visual.config.ts",
|
|
26
|
+
"test:visual:ci": "yarn test:visual"
|
|
27
|
+
},
|
|
28
|
+
"author": "Just Eat Takeaway.com - Design System Team",
|
|
29
|
+
"license": "Apache-2.0",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@justeattakeaway/pie-components-config": "0.6.1"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@justeattakeaway/pie-webc-core": "0.13.0"
|
|
35
|
+
},
|
|
36
|
+
"volta": {
|
|
37
|
+
"extends": "../../../package.json"
|
|
38
|
+
},
|
|
39
|
+
"sideEffects": [
|
|
40
|
+
"dist/*.js"
|
|
41
|
+
]
|
|
42
|
+
}
|
package/src/defs.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LitElement, html, unsafeCSS } from 'lit';
|
|
2
|
+
|
|
3
|
+
import { defineCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
4
|
+
import styles from './tag.scss?inline';
|
|
5
|
+
import { TagProps } from './defs';
|
|
6
|
+
|
|
7
|
+
// Valid values available to consumers
|
|
8
|
+
export * from './defs';
|
|
9
|
+
|
|
10
|
+
const componentSelector = 'pie-tag';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @tagname pie-tag
|
|
14
|
+
*/
|
|
15
|
+
export class PieTag extends LitElement implements TagProps {
|
|
16
|
+
render () {
|
|
17
|
+
return html`<h1 data-test-id="pie-tag">Hello world!</h1>`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Renders a `CSSResult` generated from SCSS by Vite
|
|
21
|
+
static styles = unsafeCSS(styles);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
defineCustomElement(componentSelector, PieTag);
|
|
25
|
+
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
[componentSelector]: PieTag;
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/tag.scss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use '@justeattakeaway/pie-css/scss' as p;
|