@justeattakeaway/pie-form-label 0.3.0 → 0.5.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 +40 -14
- package/dist/index.d.ts +3 -0
- package/dist/index.js +11 -8
- package/dist/react.d.ts +3 -0
- package/package.json +2 -2
- package/src/index.ts +5 -1
- package/LICENSE +0 -17
package/README.md
CHANGED
|
@@ -11,17 +11,52 @@
|
|
|
11
11
|
# Table of Contents
|
|
12
12
|
|
|
13
13
|
1. [Introduction](#pie-form-label)
|
|
14
|
-
2. [
|
|
14
|
+
2. [Installation](#installation)
|
|
15
15
|
3. [Importing the component](#importing-the-component)
|
|
16
|
-
4. [
|
|
17
|
-
5. [
|
|
16
|
+
4. [Local Development](#local-development)
|
|
17
|
+
5. [Peer Dependencies](#peer-dependencies)
|
|
18
|
+
6. [Props](#props)
|
|
19
|
+
7. [Testing](#testing)
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
## pie-form-label
|
|
20
22
|
|
|
21
23
|
`pie-form-label` is a Web Component built using the Lit library.
|
|
22
24
|
|
|
23
25
|
This component can be easily integrated into various frontend frameworks and customized through a set of properties.
|
|
24
26
|
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
To install `pie-form-label` in your application, run the following on your command line:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# npm
|
|
34
|
+
$ npm i @justeattakeaway/pie-form-label
|
|
35
|
+
|
|
36
|
+
# yarn
|
|
37
|
+
$ yarn add @justeattakeaway/pie-form-label
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
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).
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Importing the component
|
|
44
|
+
|
|
45
|
+
```js
|
|
46
|
+
// default
|
|
47
|
+
import { PieFormLabel } from '@justeattakeaway/pie-form-label';
|
|
48
|
+
|
|
49
|
+
// react
|
|
50
|
+
import { PieFormLabel } from '@justeattakeaway/pie-form-label/dist/react';
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Peer Dependencies
|
|
55
|
+
|
|
56
|
+
> [!IMPORTANT]
|
|
57
|
+
> When using `pie-form-label`, 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.
|
|
58
|
+
|
|
59
|
+
|
|
25
60
|
## Local development
|
|
26
61
|
|
|
27
62
|
Install the dependencies. Note that this, and the following commands below, should be run from the **root of the monorepo**:
|
|
@@ -45,15 +80,6 @@ yarn watch --filter=pie-form-label
|
|
|
45
80
|
yarn dev --filter=pie-storybook
|
|
46
81
|
```
|
|
47
82
|
|
|
48
|
-
### Importing the component
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
// default
|
|
52
|
-
import { PieFormLabel } from '@justeattakeaway/pie-form-label';
|
|
53
|
-
|
|
54
|
-
// react
|
|
55
|
-
import { PieFormLabel } from '@justeattakeaway/pie-form-label/dist/react';
|
|
56
|
-
```
|
|
57
83
|
|
|
58
84
|
## Props
|
|
59
85
|
|
|
@@ -105,4 +131,4 @@ Under scripts `test:visual` replace the environment variable with the below:
|
|
|
105
131
|
|
|
106
132
|
```bash
|
|
107
133
|
PERCY_TOKEN_PIE_FORM_LABEL=abcde
|
|
108
|
-
```
|
|
134
|
+
```
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { unsafeCSS as m, LitElement as b, html as s, nothing as p } from "lit";
|
|
2
2
|
import { property as f } from "lit/decorators.js";
|
|
3
|
+
function d(t, e) {
|
|
4
|
+
customElements.get(t) ? console.warn(`PIE Web Component: "${t}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(t, e);
|
|
5
|
+
}
|
|
3
6
|
const g = `.c-formLabel{--form-label-font-size: calc(var(--dt-font-size-14) * 1px);--form-label-line-height: calc(var(--dt-font-size-14-line-height) * 1px);--form-label-font-weight: var(--dt-font-weight-bold);--form-label-color: var(--dt-color-content-default);display:flex;justify-content:space-between;gap:var(--dt-spacing-d);color:var(--form-label-color);font-size:var(--form-label-font-size);line-height:var(--form-label-line-height);font-weight:var(--form-label-font-weight);margin-block-end:var(--dt-spacing-a)}.c-formLabel-optional,.c-formLabel-trailing{color:var(--dt-color-content-subdued);font-weight:var(--dt-font-weight-regular)}.c-formLabel-optional{margin-inline-start:var(--dt-spacing-b)}.c-formLabel-trailing{flex-shrink:0;white-space:var(--dt-spacing-d)}
|
|
4
7
|
`;
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
(i = a
|
|
8
|
-
return l &&
|
|
8
|
+
var h = Object.defineProperty, v = Object.getOwnPropertyDescriptor, c = (t, e, n, l) => {
|
|
9
|
+
for (var o = l > 1 ? void 0 : l ? v(e, n) : e, a = t.length - 1, i; a >= 0; a--)
|
|
10
|
+
(i = t[a]) && (o = (l ? i(e, n, o) : i(o)) || o);
|
|
11
|
+
return l && o && h(e, n, o), o;
|
|
9
12
|
};
|
|
10
|
-
const
|
|
13
|
+
const u = "pie-form-label";
|
|
11
14
|
class r extends b {
|
|
12
15
|
render() {
|
|
13
16
|
const {
|
|
14
17
|
optional: e,
|
|
15
|
-
trailing:
|
|
18
|
+
trailing: n
|
|
16
19
|
} = this;
|
|
17
20
|
return s`
|
|
18
21
|
<label
|
|
@@ -23,7 +26,7 @@ class r extends b {
|
|
|
23
26
|
<slot></slot>
|
|
24
27
|
${e ? s`<span class="c-formLabel-optional">${e}</span>` : p}
|
|
25
28
|
</div>
|
|
26
|
-
${
|
|
29
|
+
${n ? s`<span class="c-formLabel-trailing">${n}</span>` : p}
|
|
27
30
|
</label>`;
|
|
28
31
|
}
|
|
29
32
|
}
|
|
@@ -37,7 +40,7 @@ c([
|
|
|
37
40
|
c([
|
|
38
41
|
f({ type: String })
|
|
39
42
|
], r.prototype, "trailing", 2);
|
|
40
|
-
|
|
43
|
+
d(u, r);
|
|
41
44
|
export {
|
|
42
45
|
r as PieFormLabel
|
|
43
46
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -20,6 +20,9 @@ export declare interface FormLabelProps {
|
|
|
20
20
|
|
|
21
21
|
export declare const PieFormLabel: ReactWebComponent<PieFormLabel_2, {}>;
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* @tagname pie-form-label
|
|
25
|
+
*/
|
|
23
26
|
declare class PieFormLabel_2 extends LitElement implements FormLabelProps {
|
|
24
27
|
for?: string;
|
|
25
28
|
optional?: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justeattakeaway/pie-form-label",
|
|
3
3
|
"description": "PIE Design System Form Label built using Web Components",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@justeattakeaway/pie-components-config": "0.4.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
34
|
+
"@justeattakeaway/pie-webc-core": "0.11.0"
|
|
35
35
|
},
|
|
36
36
|
"volta": {
|
|
37
37
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LitElement, html, nothing, unsafeCSS,
|
|
3
3
|
} from 'lit';
|
|
4
|
+
import { defineCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
4
5
|
import { property } from 'lit/decorators.js';
|
|
5
6
|
import styles from './form-label.scss?inline';
|
|
6
7
|
import { FormLabelProps } from './defs';
|
|
@@ -10,6 +11,9 @@ export * from './defs';
|
|
|
10
11
|
|
|
11
12
|
const componentSelector = 'pie-form-label';
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @tagname pie-form-label
|
|
16
|
+
*/
|
|
13
17
|
export class PieFormLabel extends LitElement implements FormLabelProps {
|
|
14
18
|
@property({ type: String, reflect: true })
|
|
15
19
|
public for?: string;
|
|
@@ -43,7 +47,7 @@ export class PieFormLabel extends LitElement implements FormLabelProps {
|
|
|
43
47
|
static styles = unsafeCSS(styles);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
defineCustomElement(componentSelector, PieFormLabel);
|
|
47
51
|
|
|
48
52
|
declare global {
|
|
49
53
|
interface HTMLElementTagNameMap {
|
package/LICENSE
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
Copyright (c) Just Eat Takeaway.com
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|