@justeattakeaway/pie-assistive-text 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 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-assistive-text">
7
+ <img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-assistive-text.svg">
8
+ </a>
9
+ </p>
10
+
11
+ # Table of Contents
12
+
13
+ 1. [Introduction](#pie-assistive-text)
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-assistive-text
21
+
22
+ `pie-assistive-text` 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-assistive-text` in your application, run the following on your command line:
30
+
31
+ ```bash
32
+ # npm
33
+ $ npm i @justeattakeaway/pie-assistive-text
34
+
35
+ # yarn
36
+ $ yarn add @justeattakeaway/pie-assistive-text
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 { PieAssistiveText } from '@justeattakeaway/pie-assistive-text';
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-assistive-text';
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 { PieAssistiveText } from '@justeattakeaway/pie-assistive-text/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-assistive-text`, 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-assistive-text` component:
80
+
81
+ ```html
82
+ <!-- Native HTML -->
83
+ <pie-assistive-text></pie-assistive-text>
84
+
85
+ <!-- JSX -->
86
+ <PieAssistiveText></PieAssistiveText>
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).
@@ -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": "PieAssistiveText",
25
+ "members": [],
26
+ "superclass": {
27
+ "name": "LitElement",
28
+ "package": "lit"
29
+ },
30
+ "tagName": "pie-assistive-text",
31
+ "customElement": true
32
+ }
33
+ ],
34
+ "exports": [
35
+ {
36
+ "kind": "js",
37
+ "name": "*",
38
+ "declaration": {
39
+ "name": "*",
40
+ "package": "./defs"
41
+ }
42
+ },
43
+ {
44
+ "kind": "js",
45
+ "name": "PieAssistiveText",
46
+ "declaration": {
47
+ "name": "PieAssistiveText",
48
+ "module": "src/index.js"
49
+ }
50
+ }
51
+ ]
52
+ }
53
+ ]
54
+ }
@@ -0,0 +1,9 @@
1
+ declare module '*.scss' {
2
+ const content: Record<string, string>;
3
+ export default content;
4
+ }
5
+
6
+ declare module '*.scss?inline' {
7
+ const content: Record<string, string>;
8
+ export default content;
9
+ }
@@ -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
+ export declare interface AssistiveTextProps {
6
+ }
7
+
8
+ /**
9
+ * @tagname pie-assistive-text
10
+ */
11
+ export declare class PieAssistiveText extends LitElement implements AssistiveTextProps {
12
+ render(): TemplateResult<1>;
13
+ static styles: CSSResult;
14
+ }
15
+
16
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import { unsafeCSS as t, LitElement as s, html as i } from "lit";
2
+ import { defineCustomElement as o } from "@justeattakeaway/pie-webc-core";
3
+ const n = "", r = "pie-assistive-text";
4
+ class e extends s {
5
+ render() {
6
+ return i`<h1 data-test-id="pie-assistive-text">Hello world!</h1>`;
7
+ }
8
+ }
9
+ e.styles = t(n);
10
+ o(r, e);
11
+ export {
12
+ e as PieAssistiveText
13
+ };
@@ -0,0 +1,21 @@
1
+ import type { CSSResult } from 'lit';
2
+ import type { LitElement } from 'lit';
3
+ import * as React_2 from 'react';
4
+ import type { TemplateResult } from 'lit-html';
5
+
6
+ export declare interface AssistiveTextProps {
7
+ }
8
+
9
+ export declare const PieAssistiveText: React_2.ForwardRefExoticComponent<AssistiveTextProps & React_2.RefAttributes<PieAssistiveText_2> & ReactBaseType>;
10
+
11
+ /**
12
+ * @tagname pie-assistive-text
13
+ */
14
+ declare class PieAssistiveText_2 extends LitElement implements AssistiveTextProps {
15
+ render(): TemplateResult<1>;
16
+ static styles: CSSResult;
17
+ }
18
+
19
+ declare type ReactBaseType = React_2.HTMLAttributes<HTMLElement>;
20
+
21
+ export { }
package/dist/react.js ADDED
@@ -0,0 +1,15 @@
1
+ import * as e from "react";
2
+ import { createComponent as t } from "@lit/react";
3
+ import { PieAssistiveText as s } from "./index.js";
4
+ import "lit";
5
+ import "@justeattakeaway/pie-webc-core";
6
+ const i = t({
7
+ displayName: "PieAssistiveText",
8
+ elementClass: s,
9
+ react: e,
10
+ tagName: "pie-assistive-text",
11
+ events: {}
12
+ }), p = i;
13
+ export {
14
+ p as PieAssistiveText
15
+ };
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@justeattakeaway/pie-assistive-text",
3
+ "description": "PIE Design System Assistive Text built using Web Components",
4
+ "version": "0.1.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
+ "scripts": {
16
+ "build": "npx build-react-wrapper && run -T vite build",
17
+ "create:manifest": "yarn cem analyze --litelement",
18
+ "lint:scripts": "run -T eslint .",
19
+ "lint:scripts:fix": "yarn lint:scripts --fix",
20
+ "lint:style": "run -T stylelint ./src/**/*.{css,scss}",
21
+ "lint:style:fix": "yarn lint:style --fix",
22
+ "watch": "run -T vite build --watch",
23
+ "test": "echo \"Error: no test specified\" && exit 0",
24
+ "test:ci": "yarn test",
25
+ "test:browsers": "npx playwright test -c ./playwright-lit.config.ts",
26
+ "test:browsers:ci": "yarn test:browsers",
27
+ "test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_ASSISTIVE_TEXT} percy exec --allowed-hostname cloudfront.net -- npx playwright test -c ./playwright-lit-visual.config.ts",
28
+ "test:visual:ci": "yarn test:visual"
29
+ },
30
+ "author": "Just Eat Takeaway.com - Design System Team",
31
+ "license": "Apache-2.0",
32
+ "devDependencies": {
33
+ "@custom-elements-manifest/analyzer": "0.9.0",
34
+ "@justeattakeaway/pie-components-config": "workspace:*",
35
+ "cem-plugin-module-file-extensions": "0.0.5"
36
+ },
37
+ "dependencies": {
38
+ "@justeattakeaway/pie-webc-core": "workspace:*"
39
+ },
40
+ "volta": {
41
+ "extends": "../../../package.json"
42
+ },
43
+ "customElements": "custom-elements.json",
44
+ "sideEffects": [
45
+ "dist/*.js"
46
+ ]
47
+ }
@@ -0,0 +1 @@
1
+ @use '@justeattakeaway/pie-css/scss' as p;
@@ -0,0 +1,8 @@
1
+ import 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 AssistiveTextProps {}
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 './assistive-text.scss?inline';
5
+ import { AssistiveTextProps } from './defs';
6
+
7
+ // Valid values available to consumers
8
+ export * from './defs';
9
+
10
+ const componentSelector = 'pie-assistive-text';
11
+
12
+ /**
13
+ * @tagname pie-assistive-text
14
+ */
15
+ export class PieAssistiveText extends LitElement implements AssistiveTextProps {
16
+ render () {
17
+ return html`<h1 data-test-id="pie-assistive-text">Hello world!</h1>`;
18
+ }
19
+
20
+ // Renders a `CSSResult` generated from SCSS by Vite
21
+ static styles = unsafeCSS(styles);
22
+ }
23
+
24
+ defineCustomElement(componentSelector, PieAssistiveText);
25
+
26
+ declare global {
27
+ interface HTMLElementTagNameMap {
28
+ [componentSelector]: PieAssistiveText;
29
+ }
30
+ }