@justeattakeaway/pie-pagination 0.0.0-stage → 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 CHANGED
@@ -1,3 +1,88 @@
1
- # Temporary Holding Version
1
+ # @justeattakeaway/pie-pagination
2
+ [Source Code](https://github.com/justeattakeaway/pie/tree/main/packages/components/pie-pagination) | [Design Documentation](https://pie.design/components/pagination) | [NPM](https://www.npmjs.com/package/@justeattakeaway/pie-pagination)
2
3
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
4
+ <p>
5
+ <a href="https://www.npmjs.com/@justeattakeaway/pie-pagination">
6
+ <img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-pagination.svg">
7
+ </a>
8
+ </p>
9
+
10
+ `@justeattakeaway/pie-pagination` is a Web Component built using the Lit library. It offers a simple and accessible `pagination` 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/pagination.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/pagination.js'
72
+
73
+ ```
74
+
75
+ **For React Applications:**
76
+
77
+ ```jsx
78
+ import { PiePagination } from '@justeattakeaway/pie-webc/react/pagination.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": "PiePagination",
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-pagination",
37
+ "customElement": true
38
+ }
39
+ ],
40
+ "exports": [
41
+ {
42
+ "kind": "js",
43
+ "name": "*",
44
+ "declaration": {
45
+ "name": "*",
46
+ "module": "src/defs"
47
+ }
48
+ },
49
+ {
50
+ "kind": "js",
51
+ "name": "PiePagination",
52
+ "declaration": {
53
+ "name": "PiePagination",
54
+ "module": "src/index.js"
55
+ }
56
+ }
57
+ ]
58
+ }
59
+ ]
60
+ }
@@ -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 PaginationProps {
8
+ }
9
+
10
+ /**
11
+ * @tagname pie-pagination
12
+ */
13
+ export declare class PiePagination extends PiePagination_base implements PaginationProps {
14
+ render(): TemplateResult<1>;
15
+ static styles: CSSResult;
16
+ }
17
+
18
+ declare const PiePagination_base: GenericConstructor<RTLInterface> & typeof PieElement;
19
+
20
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import { LitElement as f, html as h, unsafeCSS as v } from "lit";
2
+ import { RtlMixin as c, safeCustomElement as d } 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.0";
9
+ let i = e;
10
+ const g = "*,*:after,*:before{box-sizing:inherit}:host{display:block}";
11
+ var u = Object.getOwnPropertyDescriptor, b = (a, n, p, o) => {
12
+ for (var t = o > 1 ? void 0 : o ? u(n, p) : n, s = a.length - 1, l; s >= 0; s--)
13
+ (l = a[s]) && (t = l(t) || t);
14
+ return t;
15
+ };
16
+ let r = class extends c(i) {
17
+ render() {
18
+ return h`<h1 data-test-id="pie-pagination">Hello world!</h1>`;
19
+ }
20
+ };
21
+ r.styles = v(g);
22
+ r = b([
23
+ d("pie-pagination")
24
+ ], r);
25
+ export {
26
+ r as PiePagination
27
+ };
@@ -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 PaginationProps {
9
+ }
10
+
11
+ export declare const PiePagination: React_2.ForwardRefExoticComponent<React_2.PropsWithChildren<Omit<React_2.PropsWithoutRef<PaginationProps>, "children">> & React_2.RefAttributes<PiePagination_2> & ReactBaseType>;
12
+
13
+ /**
14
+ * @tagname pie-pagination
15
+ */
16
+ declare class PiePagination_2 extends PiePagination_base implements PaginationProps {
17
+ render(): TemplateResult<1>;
18
+ static styles: CSSResult;
19
+ }
20
+
21
+ declare const PiePagination_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 i } from "@lit/react";
3
+ import { PiePagination as e } from "./index.js";
4
+ const t = i({
5
+ displayName: "PiePagination",
6
+ elementClass: e,
7
+ react: a,
8
+ tagName: "pie-pagination",
9
+ events: {}
10
+ }), m = t;
11
+ export {
12
+ m as PiePagination
13
+ };
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-pagination",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "description": "PIE Design System Pagination 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
+ "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_PAGINATION} 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.12"
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
@@ -0,0 +1,3 @@
1
+ // TODO - please remove the eslint disable comment below when you add props to this interface
2
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
3
+ export interface PaginationProps {}
package/src/index.ts ADDED
@@ -0,0 +1,33 @@
1
+
2
+ import { html, unsafeCSS } from 'lit';
3
+ import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
4
+ import {
5
+ RtlMixin,
6
+ safeCustomElement,
7
+ } from '@justeattakeaway/pie-webc-core';
8
+ import styles from './pagination.scss?inline';
9
+ import { type PaginationProps } from './defs';
10
+
11
+ // Valid values available to consumers
12
+ export * from './defs';
13
+
14
+ const componentSelector = 'pie-pagination';
15
+
16
+ /**
17
+ * @tagname pie-pagination
18
+ */
19
+ @safeCustomElement('pie-pagination')
20
+ export class PiePagination extends RtlMixin(PieElement) implements PaginationProps {
21
+ render () {
22
+ return html`<h1 data-test-id="pie-pagination">Hello world!</h1>`;
23
+ }
24
+
25
+ // Renders a `CSSResult` generated from SCSS by Vite
26
+ static styles = unsafeCSS(styles);
27
+ }
28
+
29
+ declare global {
30
+ interface HTMLElementTagNameMap {
31
+ [componentSelector]: PiePagination;
32
+ }
33
+ }
@@ -0,0 +1,7 @@
1
+ @use '@justeattakeaway/pie-css/scss' as p;
2
+
3
+ :host {
4
+ // Note: For consistency sake, the recommended display should be either
5
+ // "block" or "inline-block", otherwise it can be ommited for floating elements
6
+ display: block;
7
+ }
package/src/react.ts ADDED
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import { PiePagination as PiePaginationLit } from './index';
4
+ import { type PaginationProps } from './defs';
5
+
6
+ export * from './defs';
7
+
8
+ const PiePaginationReact = createComponent({
9
+ displayName: 'PiePagination',
10
+ elementClass: PiePaginationLit,
11
+ react: React,
12
+ tagName: 'pie-pagination',
13
+ events: {},
14
+ });
15
+
16
+ type ReactBaseType = React.HTMLAttributes<HTMLElement>
17
+
18
+ export const PiePagination = PiePaginationReact as React.ForwardRefExoticComponent<React.PropsWithChildren<Omit<React.PropsWithoutRef<PaginationProps>, 'children'>>
19
+ & React.RefAttributes<PiePaginationLit> & ReactBaseType>;