@justeattakeaway/pie-card 0.25.0 → 0.25.1
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 +86 -16
- package/custom-elements.json +2 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,37 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
</p>
|
|
1
|
+
# @justeattakeaway/pie-card
|
|
2
|
+
[Source Code](https://github.com/justeattakeaway/pie/tree/main/packages/components/pie-card) | [Design Documentation](https://pie.design/components/card) | [NPM](https://www.npmjs.com/package/@justeattakeaway/pie-card)
|
|
4
3
|
|
|
5
|
-
<p
|
|
4
|
+
<p>
|
|
6
5
|
<a href="https://www.npmjs.com/@justeattakeaway/pie-card">
|
|
7
6
|
<img alt="GitHub Workflow Status" src="https://img.shields.io/npm/v/@justeattakeaway/pie-card.svg">
|
|
8
7
|
</a>
|
|
9
8
|
</p>
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`pie-card` is a Web Component built using the Lit library.
|
|
10
|
+
`@justeattakeaway/pie-card` is a Web Component built using the Lit library. It offers a simple and accessible interactive card component for web applications.
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
## Table of Contents
|
|
16
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)
|
|
17
23
|
|
|
18
24
|
## Installation
|
|
19
25
|
|
|
20
|
-
To install
|
|
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
|
+
| `tag` | `"a"`, `"button"` | Which HTML tag to use for the card. | `"button"` |
|
|
36
|
+
| `variant` | `"default"`, `"outline"`, `"inverse"`, `"outline-inverse"` | Which variant of the card to use. | `"default"` |
|
|
37
|
+
| `href` | — | The `href` attribute to apply when `tag` is set to `"button"`. | `undefined` |
|
|
38
|
+
| `target` | — | The `target` attribute to apply when `tag` is set to `"button"`. | `undefined` |
|
|
39
|
+
| `rel` | — | The `rel` attribute to apply when `tag` is set to `"button"`. | `undefined` |
|
|
40
|
+
| `disabled` | `true`, `false` | Whether or not the card should be disabled. This applies disabled styles and turns off interactivity. <br /> If the card is used as a link, the `href` attribute will be removed so the link can no longer be navigated. | `false` |
|
|
41
|
+
| `aria` | `{ label?: string }` | Aria properties for the card to help with making it accessible. | `undefined` |
|
|
42
|
+
| `isDraggable`| `true`, `false` | Whether the card is draggable or not. Styling and pointer changes only. Implementation is left to the consuming application. | `false` |
|
|
43
|
+
| `padding` | `a-g` | Which spacing token(s) to use for the card's padding. Pass two (comma-separated) values for different vertical and horizontal padding, or one value to pad all sides evenly, e.g., `"a"` or `"a,b"`. | `undefined` |
|
|
44
|
+
|
|
45
|
+
### Slots
|
|
46
|
+
| Slot | Description |
|
|
47
|
+
|----------|-------------------------------------------------------------------|
|
|
48
|
+
| `default`| The default slot is used to pass content into the card component. |
|
|
49
|
+
|
|
50
|
+
### CSS Variables
|
|
51
|
+
This component does not expose any CSS variables for style overrides.
|
|
52
|
+
|
|
53
|
+
### Events
|
|
54
|
+
|
|
55
|
+
This component does not emit any custom events. In order to add event listening to this component, you can treat it like a native HTML element in your application.
|
|
21
56
|
|
|
22
|
-
|
|
23
|
-
npm i @justeattakeaway/pie-card
|
|
57
|
+
## Usage Examples
|
|
24
58
|
|
|
25
|
-
|
|
59
|
+
**For HTML:**
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
// import as module into a js file e.g. main.js
|
|
63
|
+
import '@justeattakeaway/pie-webc/components/card.js';
|
|
26
64
|
```
|
|
27
65
|
|
|
28
|
-
|
|
66
|
+
```html
|
|
67
|
+
<html>
|
|
68
|
+
<body>
|
|
69
|
+
<pie-card
|
|
70
|
+
tag="a"
|
|
71
|
+
href="https://www.example.com"
|
|
72
|
+
target="_blank"
|
|
73
|
+
padding="d">
|
|
74
|
+
Take me to example.com!
|
|
75
|
+
</pie-card>
|
|
76
|
+
<script type="module" src="/main.js"></script>
|
|
77
|
+
</body>
|
|
78
|
+
</html>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**For Native JS Applications, Vue, Angular, Svelte etc.:**
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
// Vue templates (using Nuxt 3)
|
|
85
|
+
import '@justeattakeaway/pie-webc/components/card.js';
|
|
29
86
|
|
|
30
|
-
|
|
87
|
+
<pie-card tag="a" href="https://www.example.com" target="_blank" padding="d">
|
|
88
|
+
Take me to example.com!
|
|
89
|
+
</pie-card>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**For React Applications:**
|
|
93
|
+
|
|
94
|
+
```jsx
|
|
95
|
+
import { PieCard } from '@justeattakeaway/pie-webc/react/card.js';
|
|
96
|
+
|
|
97
|
+
<PieCard tag="a" href="https://www.example.com" target="_blank" padding="d">
|
|
98
|
+
Take me to example.com!
|
|
99
|
+
</PieCard>
|
|
100
|
+
```
|
|
31
101
|
|
|
32
|
-
## Questions
|
|
102
|
+
## Questions and Support
|
|
33
103
|
|
|
34
|
-
|
|
104
|
+
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).
|
|
35
105
|
|
|
36
106
|
## Contributing
|
|
37
107
|
|
package/custom-elements.json
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"type": {
|
|
39
39
|
"text": "DefaultProps"
|
|
40
40
|
},
|
|
41
|
-
"default": "{\n disabled: false,\n variant: 'default',\n isDraggable: false,\n tag: 'button',\n}"
|
|
41
|
+
"default": "{\r\n disabled: false,\r\n variant: 'default',\r\n isDraggable: false,\r\n tag: 'button',\r\n}"
|
|
42
42
|
}
|
|
43
43
|
],
|
|
44
44
|
"exports": [
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
"text": "string"
|
|
207
207
|
}
|
|
208
208
|
},
|
|
209
|
-
"description": "Generates padding for the component based on `padding` values passed\nby the consumer.\n\n\nExample: 'a' or 'a, b'\nSingle values i.e `'a'` applies to all sides and `'a, b'` applies to: top & bottom, left & right"
|
|
209
|
+
"description": "Generates padding for the component based on `padding` values passed\r\nby the consumer.\r\n\r\n\r\nExample: 'a' or 'a, b'\r\nSingle values i.e `'a'` applies to all sides and `'a, b'` applies to: top & bottom, left & right"
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
212
|
"kind": "method",
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const b = class b extends y {
|
|
|
8
8
|
this.getAttribute("v") || this.setAttribute("v", b.v);
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
-
b.v = "0.25.
|
|
11
|
+
b.v = "0.25.1";
|
|
12
12
|
let g = b;
|
|
13
13
|
const k = ".c-card.c-card--draggable{cursor:grab}.c-card.c-card--draggable:active{cursor:grabbing}*,*:after,*:before{box-sizing:inherit}.c-card{--int-states-mixin-bg-color: var(--dt-color-container-default);--card-color: var(--dt-color-content-default);--card-radius: var(--dt-radius-rounded-c);--card-border-color: transparent;display:block;position:relative;color:var(--card-color);background-color:var(--int-states-mixin-bg-color);border:1px solid var(--card-border-color);border-radius:var(--card-radius);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none;text-decoration:none}.c-card.is-disabled{--int-states-mixin-bg-color: var(--dt-color-disabled-01);cursor:not-allowed}.c-card.is-disabled ::slotted(*){color:var(--dt-color-content-disabled)}.c-card.is-disabled img{opacity:.5}.c-card.c-card--default{box-shadow:var(--dt-elevation-card)}.c-card.c-card--default:hover:not(:disabled,.is-disabled,.is-dismissible){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--int-states-mixin-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + var(--hover-modifier)))}.c-card.c-card--default:active:not(:disabled,.is-disabled,.is-dismissible),.c-card.c-card--default.is-loading:not(:disabled,.is-disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--int-states-mixin-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + var(--active-modifier)))}@supports (background-color: color-mix(in srgb,black,white)){.c-card.c-card--default:hover:not(:disabled,.is-disabled,.is-dismissible){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-container-default))}.c-card.c-card--default:active:not(:disabled,.is-disabled,.is-dismissible),.c-card.c-card--default.is-loading:not(:disabled,.is-disabled){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), var(--dt-color-container-default))}}.c-card.c-card--outline{border-color:var(--dt-color-border-strong)}.c-card.c-card--outline:hover:not(:disabled,.is-disabled,.is-dismissible){--hover-modifier: calc(-1 * var(--dt-color-hover-01));--int-states-mixin-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + var(--hover-modifier)))}.c-card.c-card--outline:active:not(:disabled,.is-disabled,.is-dismissible),.c-card.c-card--outline.is-loading:not(:disabled,.is-disabled){--active-modifier: calc(-1 * var(--dt-color-active-01));--int-states-mixin-bg-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + var(--active-modifier)))}@supports (background-color: color-mix(in srgb,black,white)){.c-card.c-card--outline:hover:not(:disabled,.is-disabled,.is-dismissible){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-hover-01-bg) var(--dt-color-hover-01), var(--dt-color-container-default))}.c-card.c-card--outline:active:not(:disabled,.is-disabled,.is-dismissible),.c-card.c-card--outline.is-loading:not(:disabled,.is-disabled){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-active-01-bg) var(--dt-color-active-01), var(--dt-color-container-default))}}.c-card.c-card--inverse{--int-states-mixin-bg-color: var(--dt-color-container-inverse);--card-color: var(--dt-color-content-inverse);box-shadow:var(--dt-elevation-inverse-card)}.c-card.c-card--inverse:hover:not(:disabled,.is-disabled,.is-dismissible){--hover-modifier: var(--dt-color-hover-02);--int-states-mixin-bg-color: hsl(var(--dt-color-container-inverse-h), var(--dt-color-container-inverse-s), calc(var(--dt-color-container-inverse-l) + var(--hover-modifier)))}.c-card.c-card--inverse:active:not(:disabled,.is-disabled,.is-dismissible),.c-card.c-card--inverse.is-loading:not(:disabled,.is-disabled){--active-modifier: var(--dt-color-active-02);--int-states-mixin-bg-color: hsl(var(--dt-color-container-inverse-h), var(--dt-color-container-inverse-s), calc(var(--dt-color-container-inverse-l) + var(--active-modifier)))}@supports (background-color: color-mix(in srgb,black,white)){.c-card.c-card--inverse:hover:not(:disabled,.is-disabled,.is-dismissible){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-hover-02-bg) var(--dt-color-hover-02), var(--dt-color-container-inverse))}.c-card.c-card--inverse:active:not(:disabled,.is-disabled,.is-dismissible),.c-card.c-card--inverse.is-loading:not(:disabled,.is-disabled){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-active-02-bg) var(--dt-color-active-02), var(--dt-color-container-inverse))}}.c-card.c-card--outline-inverse{--int-states-mixin-bg-color: var(--dt-color-container-inverse);--card-color: var(--dt-color-content-inverse);border-color:var(--dt-color-border-inverse)}.c-card.c-card--outline-inverse:hover:not(:disabled,.is-disabled,.is-dismissible){--hover-modifier: var(--dt-color-hover-02);--int-states-mixin-bg-color: hsl(var(--dt-color-container-inverse-h), var(--dt-color-container-inverse-s), calc(var(--dt-color-container-inverse-l) + var(--hover-modifier)))}.c-card.c-card--outline-inverse:active:not(:disabled,.is-disabled,.is-dismissible),.c-card.c-card--outline-inverse.is-loading:not(:disabled,.is-disabled){--active-modifier: var(--dt-color-active-02);--int-states-mixin-bg-color: hsl(var(--dt-color-container-inverse-h), var(--dt-color-container-inverse-s), calc(var(--dt-color-container-inverse-l) + var(--active-modifier)))}@supports (background-color: color-mix(in srgb,black,white)){.c-card.c-card--outline-inverse:hover:not(:disabled,.is-disabled,.is-dismissible){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-hover-02-bg) var(--dt-color-hover-02), var(--dt-color-container-inverse))}.c-card.c-card--outline-inverse:active:not(:disabled,.is-disabled,.is-dismissible),.c-card.c-card--outline-inverse.is-loading:not(:disabled,.is-disabled){--int-states-mixin-bg-color: color-mix(in srgb, var(--dt-color-active-02-bg) var(--dt-color-active-02), var(--dt-color-container-inverse))}}.c-card.c-card--inverse.is-disabled,.c-card.c-card--outline-inverse.is-disabled{--int-states-mixin-bg-color: var(--dt-color-disabled-01-inverse)}.c-card:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}", w = ["default", "outline", "inverse", "outline-inverse"], O = ["a", "button"], x = ["a", "b", "c", "d", "e", "f", "g"], D = x.flatMap((r) => [r, ...x.map((e) => `${r},${e}`)]), n = {
|
|
14
14
|
disabled: !1,
|