@justeattakeaway/pie-chip 0.0.0-snapshot-release-20240209112948
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 +116 -0
- package/custom-elements.json +197 -0
- package/declaration.d.ts +9 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +91 -0
- package/dist/react.d.ts +63 -0
- package/dist/react.js +19 -0
- package/package.json +49 -0
- package/src/chip.scss +142 -0
- package/src/defs-react.ts +8 -0
- package/src/defs.ts +26 -0
- package/src/index.ts +106 -0
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
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-chip">
|
|
7
|
+
<img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-chip.svg">
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
# Table of Contents
|
|
12
|
+
|
|
13
|
+
1. [Introduction](#pie-chip)
|
|
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-chip
|
|
21
|
+
|
|
22
|
+
`pie-chip` 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-chip` in your application, run the following on your command line:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# npm
|
|
33
|
+
$ npm i @justeattakeaway/pie-chip
|
|
34
|
+
|
|
35
|
+
# yarn
|
|
36
|
+
$ yarn add @justeattakeaway/pie-chip
|
|
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 { PieChip } from '@justeattakeaway/pie-chip';
|
|
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-chip';
|
|
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 { PieChip } from '@justeattakeaway/pie-chip/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-chip`, 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
|
+
| variant | `String` | `default` | Variant of the chip, one of `variants` - `default`, `outline`, `ghost` |
|
|
78
|
+
| isSelected | `Boolean` | `false` | If `true`, applies the selected styles |
|
|
79
|
+
| isLoading | `Boolean` | `false` | If `true`, displays a loading indicator inside the chip |
|
|
80
|
+
| isDismissible | `Boolean` | `false` | If `true`, displays a close icon to dismiss the chip component. Can be only used if `isSelected` is set to true |
|
|
81
|
+
| disabled | `Boolean` | `false` | If `true`, disables the chip component |
|
|
82
|
+
|
|
83
|
+
In your markup or JSX, you can then use these to set the properties for the `pie-chip` component:
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<!-- Native HTML -->
|
|
87
|
+
<pie-chip>Label</pie-chip>
|
|
88
|
+
|
|
89
|
+
<!-- JSX -->
|
|
90
|
+
<PieChip>Label</PieChip>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Slots
|
|
94
|
+
|
|
95
|
+
| Slot | Description |
|
|
96
|
+
| Default slot | Used to pass text into the chip component. |
|
|
97
|
+
| icon | Used to pass in an icon to the chip component. We recommend using `pie-icons-webc` for defining this icon, but this can also accept an SVG icon. |
|
|
98
|
+
|
|
99
|
+
### Using `pie-icons-webc` with `pie-chip` icon slot
|
|
100
|
+
|
|
101
|
+
We recommend using `pie-icons-webc` when using the `icon` slot. Here is an example of how you would do this:
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<!--
|
|
105
|
+
Note that pie-chip and the icon that you want to use will need to be imported as components into your application.
|
|
106
|
+
See the `pie-icons-webc` README for more info on importing these icons.
|
|
107
|
+
-->
|
|
108
|
+
<pie-chip>
|
|
109
|
+
<icon-vegan slot="icon"></icon-vegan>
|
|
110
|
+
Label
|
|
111
|
+
</pie-chip>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Contributing
|
|
115
|
+
|
|
116
|
+
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,197 @@
|
|
|
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
|
+
{
|
|
16
|
+
"kind": "variable",
|
|
17
|
+
"name": "variants",
|
|
18
|
+
"type": {
|
|
19
|
+
"text": "['default', 'outline', 'ghost']"
|
|
20
|
+
},
|
|
21
|
+
"default": "['default', 'outline', 'ghost']"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"exports": [
|
|
25
|
+
{
|
|
26
|
+
"kind": "js",
|
|
27
|
+
"name": "variants",
|
|
28
|
+
"declaration": {
|
|
29
|
+
"name": "variants",
|
|
30
|
+
"module": "src/defs.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"kind": "javascript-module",
|
|
37
|
+
"path": "src/index.js",
|
|
38
|
+
"declarations": [
|
|
39
|
+
{
|
|
40
|
+
"kind": "class",
|
|
41
|
+
"description": "",
|
|
42
|
+
"name": "PieChip",
|
|
43
|
+
"slots": [
|
|
44
|
+
{
|
|
45
|
+
"description": "The icon slot",
|
|
46
|
+
"name": "icon"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"description": "Default slot",
|
|
50
|
+
"name": ""
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"members": [
|
|
54
|
+
{
|
|
55
|
+
"kind": "field",
|
|
56
|
+
"name": "variant",
|
|
57
|
+
"type": {
|
|
58
|
+
"text": "ChipProps['variant']"
|
|
59
|
+
},
|
|
60
|
+
"privacy": "public",
|
|
61
|
+
"default": "'default'",
|
|
62
|
+
"attribute": "variant"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"kind": "field",
|
|
66
|
+
"name": "disabled",
|
|
67
|
+
"type": {
|
|
68
|
+
"text": "boolean"
|
|
69
|
+
},
|
|
70
|
+
"privacy": "public",
|
|
71
|
+
"default": "false",
|
|
72
|
+
"attribute": "disabled"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"kind": "field",
|
|
76
|
+
"name": "isSelected",
|
|
77
|
+
"type": {
|
|
78
|
+
"text": "boolean"
|
|
79
|
+
},
|
|
80
|
+
"privacy": "public",
|
|
81
|
+
"default": "false",
|
|
82
|
+
"attribute": "isSelected"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"kind": "field",
|
|
86
|
+
"name": "isLoading",
|
|
87
|
+
"type": {
|
|
88
|
+
"text": "boolean"
|
|
89
|
+
},
|
|
90
|
+
"privacy": "public",
|
|
91
|
+
"default": "false",
|
|
92
|
+
"attribute": "isLoading"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"kind": "field",
|
|
96
|
+
"name": "isDismissible",
|
|
97
|
+
"type": {
|
|
98
|
+
"text": "boolean"
|
|
99
|
+
},
|
|
100
|
+
"privacy": "public",
|
|
101
|
+
"default": "false",
|
|
102
|
+
"attribute": "isDismissible"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"kind": "method",
|
|
106
|
+
"name": "renderSpinner",
|
|
107
|
+
"privacy": "private",
|
|
108
|
+
"return": {
|
|
109
|
+
"type": {
|
|
110
|
+
"text": "TemplateResult"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"description": "Template for the loading state"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"kind": "method",
|
|
117
|
+
"name": "renderCloseButton",
|
|
118
|
+
"privacy": "private",
|
|
119
|
+
"return": {
|
|
120
|
+
"type": {
|
|
121
|
+
"text": "TemplateResult"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"description": "Template for the dismissible state"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"attributes": [
|
|
128
|
+
{
|
|
129
|
+
"name": "variant",
|
|
130
|
+
"type": {
|
|
131
|
+
"text": "ChipProps['variant']"
|
|
132
|
+
},
|
|
133
|
+
"default": "'default'",
|
|
134
|
+
"fieldName": "variant"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "disabled",
|
|
138
|
+
"type": {
|
|
139
|
+
"text": "boolean"
|
|
140
|
+
},
|
|
141
|
+
"default": "false",
|
|
142
|
+
"fieldName": "disabled"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "isSelected",
|
|
146
|
+
"type": {
|
|
147
|
+
"text": "boolean"
|
|
148
|
+
},
|
|
149
|
+
"default": "false",
|
|
150
|
+
"fieldName": "isSelected"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"name": "isLoading",
|
|
154
|
+
"type": {
|
|
155
|
+
"text": "boolean"
|
|
156
|
+
},
|
|
157
|
+
"default": "false",
|
|
158
|
+
"fieldName": "isLoading"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"name": "isDismissible",
|
|
162
|
+
"type": {
|
|
163
|
+
"text": "boolean"
|
|
164
|
+
},
|
|
165
|
+
"default": "false",
|
|
166
|
+
"fieldName": "isDismissible"
|
|
167
|
+
}
|
|
168
|
+
],
|
|
169
|
+
"superclass": {
|
|
170
|
+
"name": "LitElement",
|
|
171
|
+
"package": "lit"
|
|
172
|
+
},
|
|
173
|
+
"tagName": "pie-chip",
|
|
174
|
+
"customElement": true
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"exports": [
|
|
178
|
+
{
|
|
179
|
+
"kind": "js",
|
|
180
|
+
"name": "*",
|
|
181
|
+
"declaration": {
|
|
182
|
+
"name": "*",
|
|
183
|
+
"package": "./defs"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"kind": "js",
|
|
188
|
+
"name": "PieChip",
|
|
189
|
+
"declaration": {
|
|
190
|
+
"name": "PieChip",
|
|
191
|
+
"module": "src/index.js"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
}
|
package/declaration.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CSSResult } from 'lit';
|
|
2
|
+
import type { LitElement } from 'lit';
|
|
3
|
+
import type { TemplateResult } from 'lit';
|
|
4
|
+
|
|
5
|
+
export declare interface ChipProps {
|
|
6
|
+
/**
|
|
7
|
+
* What style variant the chip should be such as default, outline or ghost.
|
|
8
|
+
*/
|
|
9
|
+
variant?: typeof variants[number];
|
|
10
|
+
/**
|
|
11
|
+
* When true, the chip element is disabled.
|
|
12
|
+
*/
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* When true, the chip element will apply the selected styles.
|
|
16
|
+
*/
|
|
17
|
+
isSelected?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* When true, displays a loading indicator inside the chip.
|
|
20
|
+
*/
|
|
21
|
+
isLoading?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* When true, displays a close icon to dismiss the chip component.
|
|
24
|
+
* Can be only used if `isSelected` is set to true
|
|
25
|
+
*/
|
|
26
|
+
isDismissible?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @tagname pie-chip
|
|
31
|
+
* @slot icon - The icon slot
|
|
32
|
+
* @slot - Default slot
|
|
33
|
+
*/
|
|
34
|
+
export declare class PieChip extends LitElement implements ChipProps {
|
|
35
|
+
variant: ChipProps['variant'];
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
isSelected: boolean;
|
|
38
|
+
isLoading: boolean;
|
|
39
|
+
isDismissible: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Template for the loading state
|
|
42
|
+
*
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
private renderSpinner;
|
|
46
|
+
/**
|
|
47
|
+
* Template for the dismissible state
|
|
48
|
+
*
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
private renderCloseButton;
|
|
52
|
+
render(): TemplateResult<1>;
|
|
53
|
+
static styles: CSSResult;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export declare const variants: readonly ["default", "outline", "ghost"];
|
|
57
|
+
|
|
58
|
+
export { }
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { unsafeCSS as h, LitElement as b, html as l, nothing as p } from "lit";
|
|
2
|
+
import { property as a } from "lit/decorators.js";
|
|
3
|
+
import { validPropertyValues as g, defineCustomElement as m } from "@justeattakeaway/pie-webc-core";
|
|
4
|
+
import "@justeattakeaway/pie-icons-webc/IconCloseCircleFilled";
|
|
5
|
+
const f = `.c-chip{--chip-bg-color: var(--dt-color-interactive-secondary);--chip-color: var(--dt-color-content-interactive-secondary);--chip-border-width: 1px;--chip-border-color: transparent;--chip-padding-block: calc(6px - var(--chip-border-width));--chip-padding-inline: calc(var(--dt-spacing-c) - var(--chip-border-width));--chip-padding-dismissible: calc(var(--dt-spacing-a) - var(--chip-border-width));--chip-min-width: calc(var(--dt-spacing-g) + var(--dt-spacing-b));--chip-gap: var(--dt-spacing-b);--chip-dismissible-offset: calc(var(--chip-gap) / -2);--icon-display-override: block;position:relative;display:flex;align-items:center;justify-content:center;gap:var(--chip-gap);padding-block-start:var(--chip-padding-block);padding-block-end:var(--chip-padding-block);padding-inline-start:var(--chip-padding-inline);padding-inline-end:var(--chip-padding-inline);background-color:var(--chip-bg-color);color:var(--chip-color);border-radius:var(--dt-radius-rounded-e);border:1px solid;border-color:var(--chip-border-color);cursor:pointer;min-width:var(--chip-min-width);font-size:calc(var(--dt-font-interactive-xs-size) * 1px);line-height:calc(var(--dt-font-interactive-xs-line-height) * 1px);font-weight:var(--dt-font-weight-bold)}.c-chip:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--chip-bg-color: hsl(var(--dt-color-interactive-secondary-h), var(--dt-color-interactive-secondary-s), calc(var(--dt-color-interactive-secondary-l) + var(--hover-modifier)))}.c-chip:active:not(:disabled),.c-chip[isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--chip-bg-color: hsl(var(--dt-color-interactive-secondary-h), var(--dt-color-interactive-secondary-s), calc(var(--dt-color-interactive-secondary-l) + var(--active-modifier)))}.c-chip[variant=outline]:not([disabled],[isSelected],[isLoading]){--chip-border-color: var(--dt-color-border-strong)}.c-chip[variant=outline],.c-chip[variant=ghost]{--chip-bg-color: transparent}.c-chip[variant=outline]:hover:not(:disabled),.c-chip[variant=ghost]:hover:not(:disabled){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--hover-modifier: var(--dt-color-hover-01);--chip-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--hover-modifier))}.c-chip[variant=outline]:active:not(:disabled),.c-chip[variant=outline][isLoading]:not(:disabled),.c-chip[variant=ghost]:active:not(:disabled),.c-chip[variant=ghost][isLoading]:not(:disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--active-modifier: var(--dt-color-active-01);--chip-bg-color: hsl(var(--dt-color-black-h), var(--dt-color-black-s), var(--dt-color-black-l), var(--active-modifier))}.c-chip[isSelected]{--chip-bg-color: var(--dt-color-interactive-primary);--chip-color: var(--dt-color-content-interactive-primary)}.c-chip[isSelected]:hover:not(:disabled){--hover-modifier: var(--dt-color-hover-02);--chip-bg-color: hsl(var(--dt-color-interactive-primary-h), var(--dt-color-interactive-primary-s), calc(var(--dt-color-interactive-primary-l) + var(--hover-modifier)))}.c-chip[isSelected]:active:not(:disabled),.c-chip[isSelected][isLoading]:not(:disabled){--active-modifier: var(--dt-color-active-02);--chip-bg-color: hsl(var(--dt-color-interactive-primary-h), var(--dt-color-interactive-primary-s), calc(var(--dt-color-interactive-primary-l) + var(--active-modifier)))}.c-chip[isDismissible][isSelected]{padding-inline-end:var(--chip-padding-dismissible);padding-block-start:var(--chip-padding-dismissible);padding-block-end:var(--chip-padding-dismissible)}.c-chip[isDismissible][isSelected] .c-chip-closeBtn{display:inline-flex;-webkit-user-select:none;user-select:none;outline:none;border:none;color:inherit;background-color:inherit;border-radius:inherit;cursor:pointer;padding:0;margin-inline-start:var(--chip-dismissible-offset)}.c-chip[isLoading]>*:not(.c-chip-spinner){visibility:hidden}.c-chip[isLoading] .c-chip-spinner{position:absolute}.c-chip[disabled]{--chip-bg-color: var(--dt-color-disabled-01);--chip-color: var(--dt-color-content-disabled);cursor:not-allowed}.c-chip:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}::slotted(svg){display:block;height:var(--icon-size-override);width:var(--icon-size-override)}
|
|
6
|
+
`, u = ["default", "outline", "ghost"];
|
|
7
|
+
var y = Object.defineProperty, S = Object.getOwnPropertyDescriptor, n = (d, e, c, r) => {
|
|
8
|
+
for (var i = r > 1 ? void 0 : r ? S(e, c) : e, t = d.length - 1, s; t >= 0; t--)
|
|
9
|
+
(s = d[t]) && (i = (r ? s(e, c, i) : s(i)) || i);
|
|
10
|
+
return r && i && y(e, c, i), i;
|
|
11
|
+
};
|
|
12
|
+
const v = "pie-chip";
|
|
13
|
+
class o extends b {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.variant = "default", this.disabled = !1, this.isSelected = !1, this.isLoading = !1, this.isDismissible = !1;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Template for the loading state
|
|
19
|
+
*
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
renderSpinner() {
|
|
23
|
+
const { isSelected: e } = this;
|
|
24
|
+
return l`
|
|
25
|
+
<pie-spinner
|
|
26
|
+
class="c-chip-spinner"
|
|
27
|
+
size="small"
|
|
28
|
+
variant="${e ? "inverse" : "secondary"}">
|
|
29
|
+
</pie-spinner>`;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Template for the dismissible state
|
|
33
|
+
*
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
renderCloseButton() {
|
|
37
|
+
return l`
|
|
38
|
+
<button
|
|
39
|
+
class="c-chip-closeBtn"
|
|
40
|
+
data-test-id="chip-close-button">
|
|
41
|
+
<icon-close-circle-filled size="m"></icon-close-circle-filled>
|
|
42
|
+
</button>`;
|
|
43
|
+
}
|
|
44
|
+
render() {
|
|
45
|
+
const {
|
|
46
|
+
variant: e,
|
|
47
|
+
disabled: c,
|
|
48
|
+
isSelected: r,
|
|
49
|
+
isLoading: i,
|
|
50
|
+
isDismissible: t
|
|
51
|
+
} = this;
|
|
52
|
+
return l`
|
|
53
|
+
<div
|
|
54
|
+
class="c-chip"
|
|
55
|
+
role="button"
|
|
56
|
+
tabindex="0"
|
|
57
|
+
data-test-id="pie-chip"
|
|
58
|
+
variant="${e}"
|
|
59
|
+
?disabled="${c}"
|
|
60
|
+
?isSelected="${r}"
|
|
61
|
+
?isLoading="${i}"
|
|
62
|
+
?isDismissible="${t}">
|
|
63
|
+
<slot name="icon"></slot>
|
|
64
|
+
${i ? this.renderSpinner() : p}
|
|
65
|
+
<slot></slot>
|
|
66
|
+
${t && r ? this.renderCloseButton() : p}
|
|
67
|
+
</div>`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
o.styles = h(f);
|
|
71
|
+
n([
|
|
72
|
+
a(),
|
|
73
|
+
g(v, u, "primary")
|
|
74
|
+
], o.prototype, "variant", 2);
|
|
75
|
+
n([
|
|
76
|
+
a({ type: Boolean })
|
|
77
|
+
], o.prototype, "disabled", 2);
|
|
78
|
+
n([
|
|
79
|
+
a({ type: Boolean })
|
|
80
|
+
], o.prototype, "isSelected", 2);
|
|
81
|
+
n([
|
|
82
|
+
a({ type: Boolean })
|
|
83
|
+
], o.prototype, "isLoading", 2);
|
|
84
|
+
n([
|
|
85
|
+
a({ type: Boolean })
|
|
86
|
+
], o.prototype, "isDismissible", 2);
|
|
87
|
+
m(v, o);
|
|
88
|
+
export {
|
|
89
|
+
o as PieChip,
|
|
90
|
+
u as variants
|
|
91
|
+
};
|
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
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';
|
|
5
|
+
|
|
6
|
+
export declare interface ChipProps {
|
|
7
|
+
/**
|
|
8
|
+
* What style variant the chip should be such as default, outline or ghost.
|
|
9
|
+
*/
|
|
10
|
+
variant?: typeof variants[number];
|
|
11
|
+
/**
|
|
12
|
+
* When true, the chip element is disabled.
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* When true, the chip element will apply the selected styles.
|
|
17
|
+
*/
|
|
18
|
+
isSelected?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* When true, displays a loading indicator inside the chip.
|
|
21
|
+
*/
|
|
22
|
+
isLoading?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* When true, displays a close icon to dismiss the chip component.
|
|
25
|
+
* Can be only used if `isSelected` is set to true
|
|
26
|
+
*/
|
|
27
|
+
isDismissible?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare const PieChip: React_2.ForwardRefExoticComponent<ChipProps & React_2.RefAttributes<PieChip_2> & ReactBaseType>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @tagname pie-chip
|
|
34
|
+
* @slot icon - The icon slot
|
|
35
|
+
* @slot - Default slot
|
|
36
|
+
*/
|
|
37
|
+
declare class PieChip_2 extends LitElement implements ChipProps {
|
|
38
|
+
variant: ChipProps['variant'];
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
isSelected: boolean;
|
|
41
|
+
isLoading: boolean;
|
|
42
|
+
isDismissible: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Template for the loading state
|
|
45
|
+
*
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
private renderSpinner;
|
|
49
|
+
/**
|
|
50
|
+
* Template for the dismissible state
|
|
51
|
+
*
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
private renderCloseButton;
|
|
55
|
+
render(): TemplateResult<1>;
|
|
56
|
+
static styles: CSSResult;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
declare type ReactBaseType = React_2.HTMLAttributes<HTMLElement>;
|
|
60
|
+
|
|
61
|
+
export declare const variants: readonly ["default", "outline", "ghost"];
|
|
62
|
+
|
|
63
|
+
export { }
|
package/dist/react.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { createComponent as i } from "@lit/react";
|
|
3
|
+
import { PieChip as t } from "./index.js";
|
|
4
|
+
import { variants as P } from "./index.js";
|
|
5
|
+
import "lit";
|
|
6
|
+
import "lit/decorators.js";
|
|
7
|
+
import "@justeattakeaway/pie-webc-core";
|
|
8
|
+
import "@justeattakeaway/pie-icons-webc/IconCloseCircleFilled";
|
|
9
|
+
const p = i({
|
|
10
|
+
displayName: "PieChip",
|
|
11
|
+
elementClass: t,
|
|
12
|
+
react: e,
|
|
13
|
+
tagName: "pie-chip",
|
|
14
|
+
events: {}
|
|
15
|
+
}), n = p;
|
|
16
|
+
export {
|
|
17
|
+
n as PieChip,
|
|
18
|
+
P as variants
|
|
19
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@justeattakeaway/pie-chip",
|
|
3
|
+
"description": "PIE Design System Chip built using Web Components",
|
|
4
|
+
"version": "0.0.0-snapshot-release-20240209112948",
|
|
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_CHIP} 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": "0.10.0",
|
|
35
|
+
"cem-plugin-module-file-extensions": "0.0.5"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@justeattakeaway/pie-icons-webc": "0.0.0-snapshot-release-20240209112948",
|
|
39
|
+
"@justeattakeaway/pie-spinner": "0.0.0-snapshot-release-20240209112948",
|
|
40
|
+
"@justeattakeaway/pie-webc-core": "0.0.0-snapshot-release-20240209112948"
|
|
41
|
+
},
|
|
42
|
+
"volta": {
|
|
43
|
+
"extends": "../../../package.json"
|
|
44
|
+
},
|
|
45
|
+
"customElements": "custom-elements.json",
|
|
46
|
+
"sideEffects": [
|
|
47
|
+
"dist/*.js"
|
|
48
|
+
]
|
|
49
|
+
}
|
package/src/chip.scss
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
@use '@justeattakeaway/pie-css/scss' as p;
|
|
2
|
+
|
|
3
|
+
@mixin chip-interactive-states($bg-color, $mode: 'default') {
|
|
4
|
+
&:hover:not(:disabled) {
|
|
5
|
+
@if $mode == 'inverse' {
|
|
6
|
+
--hover-modifier: var(--dt-color-hover-02);
|
|
7
|
+
} @else {
|
|
8
|
+
--hover-modifier: calc(-1 * var(--dt-color-hover-01));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@if $mode == 'transparent' {
|
|
12
|
+
--hover-modifier: var(--dt-color-hover-01);
|
|
13
|
+
--chip-bg-color: hsl(var(#{$bg-color}-h), var(#{$bg-color}-s), var(#{$bg-color}-l), var(--hover-modifier));
|
|
14
|
+
} @else {
|
|
15
|
+
--chip-bg-color: hsl(var(#{$bg-color}-h), var(#{$bg-color}-s), calc(var(#{$bg-color}-l) + var(--hover-modifier)));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&:active:not(:disabled),
|
|
20
|
+
&[isLoading]:not(:disabled) {
|
|
21
|
+
@if $mode == 'inverse' {
|
|
22
|
+
--active-modifier: var(--dt-color-active-02);
|
|
23
|
+
} @else {
|
|
24
|
+
--active-modifier: calc(-1 * var(--dt-color-active-01));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@if $mode == 'transparent' {
|
|
28
|
+
--active-modifier: var(--dt-color-active-01);
|
|
29
|
+
--chip-bg-color: hsl(var(#{$bg-color}-h), var(#{$bg-color}-s), var(#{$bg-color}-l), var(--active-modifier));
|
|
30
|
+
} @else {
|
|
31
|
+
--chip-bg-color: hsl(var(#{$bg-color}-h), var(#{$bg-color}-s), calc(var(#{$bg-color}-l) + var(--active-modifier)));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
.c-chip {
|
|
38
|
+
--chip-bg-color: var(--dt-color-interactive-secondary);
|
|
39
|
+
--chip-color: var(--dt-color-content-interactive-secondary);
|
|
40
|
+
--chip-border-width: 1px;
|
|
41
|
+
--chip-border-color: transparent;
|
|
42
|
+
--chip-padding-block: calc(6px - var(--chip-border-width));
|
|
43
|
+
--chip-padding-inline: calc(var(--dt-spacing-c) - var(--chip-border-width));
|
|
44
|
+
--chip-padding-dismissible: calc(var(--dt-spacing-a) - var(--chip-border-width));
|
|
45
|
+
--chip-min-width: calc(var(--dt-spacing-g) + var(--dt-spacing-b));
|
|
46
|
+
--chip-gap: var(--dt-spacing-b);
|
|
47
|
+
--chip-dismissible-offset: calc(var(--chip-gap) / -2); // ensures the spacing between the text and close icon is 4px
|
|
48
|
+
|
|
49
|
+
// Pie Webc Icon var that is used to ensure the correctly sized icon passed in a slot
|
|
50
|
+
--icon-display-override: block;
|
|
51
|
+
|
|
52
|
+
position: relative;
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
justify-content: center;
|
|
56
|
+
gap: var(--chip-gap);
|
|
57
|
+
padding-block-start: var(--chip-padding-block);
|
|
58
|
+
padding-block-end: var(--chip-padding-block);
|
|
59
|
+
padding-inline-start: var(--chip-padding-inline);
|
|
60
|
+
padding-inline-end: var(--chip-padding-inline);
|
|
61
|
+
background-color: var(--chip-bg-color);
|
|
62
|
+
color: var(--chip-color);
|
|
63
|
+
border-radius: var(--dt-radius-rounded-e);
|
|
64
|
+
border: 1px solid;
|
|
65
|
+
border-color: var(--chip-border-color);
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
min-width: var(--chip-min-width);
|
|
68
|
+
|
|
69
|
+
@include p.font-size(--dt-font-interactive-xs-size);
|
|
70
|
+
@include p.line-height(--dt-font-interactive-xs-line-height);
|
|
71
|
+
font-weight: var(--dt-font-weight-bold);
|
|
72
|
+
|
|
73
|
+
@include chip-interactive-states('--dt-color-interactive-secondary');
|
|
74
|
+
|
|
75
|
+
&[variant='default'] {
|
|
76
|
+
// same as default styles
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&[variant='outline']:not([disabled], [isSelected], [isLoading]) {
|
|
80
|
+
--chip-border-color: var(--dt-color-border-strong);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&[variant='outline'],
|
|
84
|
+
&[variant='ghost'] {
|
|
85
|
+
--chip-bg-color: transparent;
|
|
86
|
+
|
|
87
|
+
@include chip-interactive-states('--dt-color-black', 'transparent');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&[isSelected] {
|
|
91
|
+
--chip-bg-color: var(--dt-color-interactive-primary);
|
|
92
|
+
--chip-color: var(--dt-color-content-interactive-primary);
|
|
93
|
+
|
|
94
|
+
@include chip-interactive-states('--dt-color-interactive-primary', 'inverse');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&[isDismissible][isSelected] {
|
|
98
|
+
padding-inline-end: var(--chip-padding-dismissible);
|
|
99
|
+
padding-block-start: var(--chip-padding-dismissible);
|
|
100
|
+
padding-block-end: var(--chip-padding-dismissible);
|
|
101
|
+
|
|
102
|
+
.c-chip-closeBtn {
|
|
103
|
+
display: inline-flex;
|
|
104
|
+
user-select: none;
|
|
105
|
+
outline: none;
|
|
106
|
+
border: none;
|
|
107
|
+
color: inherit;
|
|
108
|
+
background-color: inherit;
|
|
109
|
+
border-radius: inherit;
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
padding: 0;
|
|
112
|
+
margin-inline-start: var(--chip-dismissible-offset);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&[isLoading] {
|
|
117
|
+
& > *:not(.c-chip-spinner) {
|
|
118
|
+
visibility: hidden;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.c-chip-spinner {
|
|
122
|
+
position: absolute;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&[disabled] {
|
|
127
|
+
--chip-bg-color: var(--dt-color-disabled-01);
|
|
128
|
+
--chip-color: var(--dt-color-content-disabled);
|
|
129
|
+
|
|
130
|
+
cursor: not-allowed;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
&:focus-visible {
|
|
134
|
+
@include p.focus;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
::slotted(svg) {
|
|
139
|
+
display: block;
|
|
140
|
+
height: var(--icon-size-override);
|
|
141
|
+
width: var(--icon-size-override);
|
|
142
|
+
}
|
|
@@ -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,26 @@
|
|
|
1
|
+
export const variants = ['default', 'outline', 'ghost'] as const;
|
|
2
|
+
|
|
3
|
+
export interface ChipProps {
|
|
4
|
+
/**
|
|
5
|
+
* What style variant the chip should be such as default, outline or ghost.
|
|
6
|
+
*/
|
|
7
|
+
variant?: typeof variants[number];
|
|
8
|
+
/**
|
|
9
|
+
* When true, the chip element is disabled.
|
|
10
|
+
*/
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* When true, the chip element will apply the selected styles.
|
|
14
|
+
*/
|
|
15
|
+
isSelected?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* When true, displays a loading indicator inside the chip.
|
|
18
|
+
*/
|
|
19
|
+
isLoading?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* When true, displays a close icon to dismiss the chip component.
|
|
22
|
+
* Can be only used if `isSelected` is set to true
|
|
23
|
+
*/
|
|
24
|
+
isDismissible?: boolean;
|
|
25
|
+
|
|
26
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LitElement, html, unsafeCSS, TemplateResult, nothing,
|
|
3
|
+
} from 'lit';
|
|
4
|
+
import { property } from 'lit/decorators.js';
|
|
5
|
+
|
|
6
|
+
import { validPropertyValues, defineCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
7
|
+
import styles from './chip.scss?inline';
|
|
8
|
+
import { ChipProps, variants } from './defs';
|
|
9
|
+
import '@justeattakeaway/pie-icons-webc/IconCloseCircleFilled';
|
|
10
|
+
|
|
11
|
+
// Valid values available to consumers
|
|
12
|
+
export * from './defs';
|
|
13
|
+
|
|
14
|
+
const componentSelector = 'pie-chip';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @tagname pie-chip
|
|
18
|
+
* @slot icon - The icon slot
|
|
19
|
+
* @slot - Default slot
|
|
20
|
+
*/
|
|
21
|
+
export class PieChip extends LitElement implements ChipProps {
|
|
22
|
+
@property()
|
|
23
|
+
@validPropertyValues(componentSelector, variants, 'primary')
|
|
24
|
+
public variant: ChipProps['variant'] = 'default';
|
|
25
|
+
|
|
26
|
+
@property({ type: Boolean })
|
|
27
|
+
public disabled = false;
|
|
28
|
+
|
|
29
|
+
@property({ type: Boolean })
|
|
30
|
+
public isSelected = false;
|
|
31
|
+
|
|
32
|
+
@property({ type: Boolean })
|
|
33
|
+
public isLoading = false;
|
|
34
|
+
|
|
35
|
+
@property({ type: Boolean })
|
|
36
|
+
public isDismissible = false;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Template for the loading state
|
|
40
|
+
*
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
private renderSpinner (): TemplateResult {
|
|
44
|
+
const { isSelected } = this;
|
|
45
|
+
const spinnerVariant = isSelected ? 'inverse' : 'secondary';
|
|
46
|
+
|
|
47
|
+
return html`
|
|
48
|
+
<pie-spinner
|
|
49
|
+
class="c-chip-spinner"
|
|
50
|
+
size="small"
|
|
51
|
+
variant="${spinnerVariant}">
|
|
52
|
+
</pie-spinner>`;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Template for the dismissible state
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
private renderCloseButton (): TemplateResult {
|
|
61
|
+
return html`
|
|
62
|
+
<button
|
|
63
|
+
class="c-chip-closeBtn"
|
|
64
|
+
data-test-id="chip-close-button">
|
|
65
|
+
<icon-close-circle-filled size="m"></icon-close-circle-filled>
|
|
66
|
+
</button>`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
render () {
|
|
70
|
+
const {
|
|
71
|
+
variant,
|
|
72
|
+
disabled,
|
|
73
|
+
isSelected,
|
|
74
|
+
isLoading,
|
|
75
|
+
isDismissible,
|
|
76
|
+
} = this;
|
|
77
|
+
|
|
78
|
+
return html`
|
|
79
|
+
<div
|
|
80
|
+
class="c-chip"
|
|
81
|
+
role="button"
|
|
82
|
+
tabindex="0"
|
|
83
|
+
data-test-id="pie-chip"
|
|
84
|
+
variant="${variant}"
|
|
85
|
+
?disabled="${disabled}"
|
|
86
|
+
?isSelected="${isSelected}"
|
|
87
|
+
?isLoading="${isLoading}"
|
|
88
|
+
?isDismissible="${isDismissible}">
|
|
89
|
+
<slot name="icon"></slot>
|
|
90
|
+
${isLoading ? this.renderSpinner() : nothing}
|
|
91
|
+
<slot></slot>
|
|
92
|
+
${isDismissible && isSelected ? this.renderCloseButton() : nothing}
|
|
93
|
+
</div>`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Renders a `CSSResult` generated from SCSS by Vite
|
|
97
|
+
static styles = unsafeCSS(styles);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
defineCustomElement(componentSelector, PieChip);
|
|
101
|
+
|
|
102
|
+
declare global {
|
|
103
|
+
interface HTMLElementTagNameMap {
|
|
104
|
+
[componentSelector]: PieChip;
|
|
105
|
+
}
|
|
106
|
+
}
|