@justeattakeaway/pie-data-table 0.0.0-snapshot-release-20250729082959
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 +88 -0
- package/custom-elements.json +60 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +27 -0
- package/dist/react.d.ts +25 -0
- package/dist/react.js +13 -0
- package/package.json +51 -0
- package/src/data-table.scss +7 -0
- package/src/defs-react.ts +8 -0
- package/src/defs.ts +3 -0
- package/src/index.ts +30 -0
- package/src/react.ts +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @justeattakeaway/pie-data-table
|
|
2
|
+
[Source Code](https://github.com/justeattakeaway/pie/tree/main/packages/components/pie-data-table) | [Design Documentation](https://pie.design/components/data-table) | [NPM](https://www.npmjs.com/package/@justeattakeaway/pie-data-table)
|
|
3
|
+
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://www.npmjs.com/@justeattakeaway/pie-data-table">
|
|
6
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-data-table.svg">
|
|
7
|
+
</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
`@justeattakeaway/pie-data-table` is a Web Component built using the Lit library. It offers a simple and accessible button 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
|
+
| Slot | Description |
|
|
39
|
+
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
40
|
+
| | |
|
|
41
|
+
|
|
42
|
+
### CSS Variables
|
|
43
|
+
| Variable | Description | Default |
|
|
44
|
+
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
|
|
45
|
+
| | | |
|
|
46
|
+
|
|
47
|
+
### Events
|
|
48
|
+
| Event | Type | Description |
|
|
49
|
+
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
|
|
50
|
+
| | | |
|
|
51
|
+
|
|
52
|
+
## Usage Examples
|
|
53
|
+
|
|
54
|
+
**For HTML:**
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
// import as module into a js file e.g. main.js
|
|
58
|
+
import '@justeattakeaway/pie-webc/components/data-table.js'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```html
|
|
62
|
+
<!-- pass js file into <script> tag -->
|
|
63
|
+
|
|
64
|
+
<script type="module" src="/main.js"></script>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**For Native JS Applications, Vue, Angular, Svelte etc.:**
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
// Vue templates (using Nuxt 3)
|
|
71
|
+
import '@justeattakeaway/pie-webc/components/data-table.js'
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**For React Applications:**
|
|
76
|
+
|
|
77
|
+
```jsx
|
|
78
|
+
import { PieDataTable } from '@justeattakeaway/pie-webc/react/data-table.js';
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Questions and Support
|
|
83
|
+
|
|
84
|
+
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).
|
|
85
|
+
|
|
86
|
+
## Contributing
|
|
87
|
+
|
|
88
|
+
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,60 @@
|
|
|
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": "PieDataTable",
|
|
25
|
+
"members": [],
|
|
26
|
+
"mixins": [
|
|
27
|
+
{
|
|
28
|
+
"name": "RtlMixin",
|
|
29
|
+
"package": "@justeattakeaway/pie-webc-core"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"superclass": {
|
|
33
|
+
"name": "PieElement",
|
|
34
|
+
"package": "@justeattakeaway/pie-webc-core/src/internals/PieElement"
|
|
35
|
+
},
|
|
36
|
+
"tagName": "pie-data-table",
|
|
37
|
+
"customElement": true
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"exports": [
|
|
41
|
+
{
|
|
42
|
+
"kind": "js",
|
|
43
|
+
"name": "*",
|
|
44
|
+
"declaration": {
|
|
45
|
+
"name": "*",
|
|
46
|
+
"package": "./defs"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"kind": "js",
|
|
51
|
+
"name": "PieDataTable",
|
|
52
|
+
"declaration": {
|
|
53
|
+
"name": "PieDataTable",
|
|
54
|
+
"module": "src/index.js"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
3
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
4
|
+
import { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
5
|
+
import { TemplateResult } from 'lit-html';
|
|
6
|
+
|
|
7
|
+
export declare interface DataTableProps {
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @tagname pie-data-table
|
|
12
|
+
*/
|
|
13
|
+
export declare class PieDataTable extends PieDataTable_base implements DataTableProps {
|
|
14
|
+
render(): TemplateResult<1>;
|
|
15
|
+
static styles: CSSResult;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare const PieDataTable_base: GenericConstructor<RTLInterface> & typeof PieElement;
|
|
19
|
+
|
|
20
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LitElement as b, html as d, unsafeCSS as f } from "lit";
|
|
2
|
+
import { RtlMixin as h, safeCustomElement as v } from "@justeattakeaway/pie-webc-core";
|
|
3
|
+
const e = class e extends b {
|
|
4
|
+
willUpdate() {
|
|
5
|
+
this.getAttribute("v") || this.setAttribute("v", e.v);
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
e.v = "0.0.0";
|
|
9
|
+
let r = e;
|
|
10
|
+
const c = "*,*:after,*:before{box-sizing:inherit}:host{display:block}";
|
|
11
|
+
var u = Object.getOwnPropertyDescriptor, m = (i, l, p, o) => {
|
|
12
|
+
for (var t = o > 1 ? void 0 : o ? u(l, p) : l, s = i.length - 1, n; s >= 0; s--)
|
|
13
|
+
(n = i[s]) && (t = n(t) || t);
|
|
14
|
+
return t;
|
|
15
|
+
};
|
|
16
|
+
let a = class extends h(r) {
|
|
17
|
+
render() {
|
|
18
|
+
return d`<h1 data-test-id="pie-data-table">Hello world!</h1>`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
a.styles = f(c);
|
|
22
|
+
a = m([
|
|
23
|
+
v("pie-data-table")
|
|
24
|
+
], a);
|
|
25
|
+
export {
|
|
26
|
+
a as PieDataTable
|
|
27
|
+
};
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CSSResult } from 'lit';
|
|
2
|
+
import { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
3
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
4
|
+
import * as React_2 from 'react';
|
|
5
|
+
import { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
6
|
+
import { TemplateResult } from 'lit-html';
|
|
7
|
+
|
|
8
|
+
export declare interface DataTableProps {
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export declare const PieDataTable: React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<DataTableProps> & React_2.RefAttributes<PieDataTable_2> & ReactBaseType>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @tagname pie-data-table
|
|
15
|
+
*/
|
|
16
|
+
declare class PieDataTable_2 extends PieDataTable_base implements DataTableProps {
|
|
17
|
+
render(): TemplateResult<1>;
|
|
18
|
+
static styles: CSSResult;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare const PieDataTable_base: GenericConstructor<RTLInterface> & typeof PieElement;
|
|
22
|
+
|
|
23
|
+
declare type ReactBaseType = React_2.HTMLAttributes<HTMLElement>;
|
|
24
|
+
|
|
25
|
+
export { }
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as a from "react";
|
|
2
|
+
import { createComponent as e } from "@lit/react";
|
|
3
|
+
import { PieDataTable as t } from "./index.js";
|
|
4
|
+
const o = e({
|
|
5
|
+
displayName: "PieDataTable",
|
|
6
|
+
elementClass: t,
|
|
7
|
+
react: a,
|
|
8
|
+
tagName: "pie-data-table",
|
|
9
|
+
events: {}
|
|
10
|
+
}), l = o;
|
|
11
|
+
export {
|
|
12
|
+
l as PieDataTable
|
|
13
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@justeattakeaway/pie-data-table",
|
|
3
|
+
"description": "PIE Design System Data Table built using Web Components",
|
|
4
|
+
"version": "0.0.0-snapshot-release-20250729082959",
|
|
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
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "run -T vite build",
|
|
20
|
+
"build:react-wrapper": "npx build-react-wrapper",
|
|
21
|
+
"create:manifest": "yarn cem analyze --litelement",
|
|
22
|
+
"lint:scripts": "run -T eslint .",
|
|
23
|
+
"lint:scripts:fix": "yarn lint:scripts --fix",
|
|
24
|
+
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
|
|
25
|
+
"lint:style:fix": "yarn lint:style --fix",
|
|
26
|
+
"watch": "run -T vite build --watch",
|
|
27
|
+
"test:browsers": "npx playwright test -c ./playwright-lit.config.ts",
|
|
28
|
+
"test:browsers:ci": "yarn test:browsers",
|
|
29
|
+
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_DATA_TABLE} percy exec --allowed-hostname cloudfront.net -- npx playwright test -c ./playwright-lit-visual.config.ts",
|
|
30
|
+
"test:visual:ci": "yarn test:visual"
|
|
31
|
+
},
|
|
32
|
+
"author": "Just Eat Takeaway.com - Design System Team",
|
|
33
|
+
"license": "Apache-2.0",
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
36
|
+
"@justeattakeaway/pie-components-config": "0.20.1",
|
|
37
|
+
"@justeattakeaway/pie-css": "0.18.0",
|
|
38
|
+
"@justeattakeaway/pie-monorepo-utils": "0.6.0",
|
|
39
|
+
"cem-plugin-module-file-extensions": "0.0.5"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@justeattakeaway/pie-webc-core": "1.0.0"
|
|
43
|
+
},
|
|
44
|
+
"volta": {
|
|
45
|
+
"extends": "../../../package.json"
|
|
46
|
+
},
|
|
47
|
+
"customElements": "custom-elements.json",
|
|
48
|
+
"sideEffects": [
|
|
49
|
+
"dist/*.js"
|
|
50
|
+
]
|
|
51
|
+
}
|
|
@@ -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,30 @@
|
|
|
1
|
+
import { html, unsafeCSS } from 'lit';
|
|
2
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
3
|
+
import { RtlMixin, safeCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
4
|
+
|
|
5
|
+
import styles from './data-table.scss?inline';
|
|
6
|
+
import { type DataTableProps } from './defs';
|
|
7
|
+
|
|
8
|
+
// Valid values available to consumers
|
|
9
|
+
export * from './defs';
|
|
10
|
+
|
|
11
|
+
const componentSelector = 'pie-data-table';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @tagname pie-data-table
|
|
15
|
+
*/
|
|
16
|
+
@safeCustomElement('pie-data-table')
|
|
17
|
+
export class PieDataTable extends RtlMixin(PieElement) implements DataTableProps {
|
|
18
|
+
render () {
|
|
19
|
+
return html`<h1 data-test-id="pie-data-table">Hello world!</h1>`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Renders a `CSSResult` generated from SCSS by Vite
|
|
23
|
+
static styles = unsafeCSS(styles);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare global {
|
|
27
|
+
interface HTMLElementTagNameMap {
|
|
28
|
+
[componentSelector]: PieDataTable;
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/react.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { PieDataTable as PieDataTableLit } from './index';
|
|
4
|
+
import { type DataTableProps } from './defs';
|
|
5
|
+
|
|
6
|
+
export * from './defs';
|
|
7
|
+
|
|
8
|
+
const PieDataTableReact = createComponent({
|
|
9
|
+
displayName: 'PieDataTable',
|
|
10
|
+
elementClass: PieDataTableLit,
|
|
11
|
+
react: React,
|
|
12
|
+
tagName: 'pie-data-table',
|
|
13
|
+
events: {},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
type ReactBaseType = React.HTMLAttributes<HTMLElement>
|
|
17
|
+
|
|
18
|
+
export const PieDataTable = PieDataTableReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<DataTableProps>
|
|
19
|
+
& React.RefAttributes<PieDataTableLit> & ReactBaseType>;
|