@justeattakeaway/pie-form-label 0.13.5 → 0.14.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 +4 -6
- package/dist/index.js +14 -14
- package/package.json +5 -5
- package/src/index.ts +2 -2
package/README.md
CHANGED
|
@@ -29,11 +29,9 @@ This component can be easily integrated into various frontend frameworks and cus
|
|
|
29
29
|
To install `pie-form-label` in your application, run the following on your command line:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
|
|
33
|
-
$ npm i @justeattakeaway/pie-form-label
|
|
32
|
+
npm i @justeattakeaway/pie-form-label
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
$ yarn add @justeattakeaway/pie-form-label
|
|
34
|
+
yarn add @justeattakeaway/pie-form-label
|
|
37
35
|
```
|
|
38
36
|
|
|
39
37
|
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).
|
|
@@ -82,12 +80,12 @@ In your markup or JSX, you can then use these to set the properties for the `pie
|
|
|
82
80
|
```html
|
|
83
81
|
<!-- Native HTML -->
|
|
84
82
|
<pie-form-label for="username">Label</pie-form-label>
|
|
85
|
-
<pie-input id="username" name="username" type="text"></pie-input>
|
|
83
|
+
<pie-text-input id="username" name="username" type="text"></pie-text-input>
|
|
86
84
|
|
|
87
85
|
|
|
88
86
|
<!-- JSX -->
|
|
89
87
|
<PieFormLabel for="username">Label</PieFormLabel>
|
|
90
|
-
<
|
|
88
|
+
<PieTextInput id="username" name="username" type="text"></PieTextInput>
|
|
91
89
|
```
|
|
92
90
|
|
|
93
91
|
Note that the `for` prop should match the `id` of the input element you want to associate the label with.
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { ifDefined as
|
|
3
|
-
import { RtlMixin as
|
|
1
|
+
import { LitElement as d, html as c, nothing as a, unsafeCSS as g } from "lit";
|
|
2
|
+
import { ifDefined as m } from "lit/directives/if-defined.js";
|
|
3
|
+
import { RtlMixin as b, defineCustomElement as h } from "@justeattakeaway/pie-webc-core";
|
|
4
4
|
import { property as f } from "lit/decorators.js";
|
|
5
5
|
const u = `*,*:after,*:before{box-sizing:inherit}.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;align-items:flex-end;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-leading{margin-inline-end:var(--dt-spacing-b)}.c-formLabel-trailing{flex-shrink:0;white-space:var(--dt-spacing-d)}
|
|
6
6
|
`;
|
|
7
|
-
var v = Object.defineProperty, L = Object.getOwnPropertyDescriptor, p = (
|
|
8
|
-
for (var r = l > 1 ? void 0 : l ? L(e, t) : e, n =
|
|
9
|
-
(s =
|
|
7
|
+
var v = Object.defineProperty, L = Object.getOwnPropertyDescriptor, p = (i, e, t, l) => {
|
|
8
|
+
for (var r = l > 1 ? void 0 : l ? L(e, t) : e, n = i.length - 1, s; n >= 0; n--)
|
|
9
|
+
(s = i[n]) && (r = (l ? s(e, t, r) : s(r)) || r);
|
|
10
10
|
return l && r && v(e, t, r), r;
|
|
11
11
|
};
|
|
12
12
|
const y = "pie-form-label";
|
|
13
|
-
class o extends d
|
|
13
|
+
class o extends b(d) {
|
|
14
14
|
_renderOptionalLabel() {
|
|
15
15
|
const { optional: e } = this;
|
|
16
|
-
return e ? c`<span class="c-formLabel-optional">${e}</span>` :
|
|
16
|
+
return e ? c`<span class="c-formLabel-optional">${e}</span>` : a;
|
|
17
17
|
}
|
|
18
18
|
handleClick() {
|
|
19
19
|
if (this.for) {
|
|
@@ -33,17 +33,17 @@ class o extends d(g) {
|
|
|
33
33
|
@click=${this.handleClick}
|
|
34
34
|
data-test-id="pie-form-label"
|
|
35
35
|
class="c-formLabel"
|
|
36
|
-
for=${
|
|
36
|
+
for=${m(this.for)}>
|
|
37
37
|
<div>
|
|
38
|
-
${t ? this._renderOptionalLabel() :
|
|
39
|
-
<span class="c-formLabel-leading"><slot></slot></span>
|
|
40
|
-
${t ?
|
|
38
|
+
${t ? this._renderOptionalLabel() : a}
|
|
39
|
+
<span class="c-formLabel-leading" data-test-id="pie-form-label-leading"><slot></slot></span>
|
|
40
|
+
${t ? a : this._renderOptionalLabel()}
|
|
41
41
|
</div>
|
|
42
|
-
${e ? c`<span class="c-formLabel-trailing">${e}</span>` :
|
|
42
|
+
${e ? c`<span class="c-formLabel-trailing" data-test-id="pie-form-label-trailing">${e}</span>` : a}
|
|
43
43
|
</label>`;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
o.styles =
|
|
46
|
+
o.styles = g(u);
|
|
47
47
|
p([
|
|
48
48
|
f({ type: String, reflect: !0 })
|
|
49
49
|
], o.prototype, "for", 2);
|
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.14.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
39
|
"@justeattakeaway/pie-components-config": "0.16.0",
|
|
40
|
-
"@justeattakeaway/pie-
|
|
41
|
-
"@justeattakeaway/pie-
|
|
42
|
-
"@justeattakeaway/pie-wrapper-react": "0.14.
|
|
40
|
+
"@justeattakeaway/pie-switch": "0.29.11",
|
|
41
|
+
"@justeattakeaway/pie-text-input": "0.23.2",
|
|
42
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.1",
|
|
43
43
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
46
|
+
"@justeattakeaway/pie-webc-core": "0.24.0"
|
|
47
47
|
},
|
|
48
48
|
"volta": {
|
|
49
49
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -60,10 +60,10 @@ export class PieFormLabel extends RtlMixin(LitElement) implements FormLabelProps
|
|
|
60
60
|
for=${ifDefined(this.for)}>
|
|
61
61
|
<div>
|
|
62
62
|
${isRTL ? this._renderOptionalLabel() : nothing}
|
|
63
|
-
<span class="c-formLabel-leading"><slot></slot></span>
|
|
63
|
+
<span class="c-formLabel-leading" data-test-id="pie-form-label-leading"><slot></slot></span>
|
|
64
64
|
${!isRTL ? this._renderOptionalLabel() : nothing}
|
|
65
65
|
</div>
|
|
66
|
-
${trailing ? html`<span class="c-formLabel-trailing">${trailing}</span>` : nothing}
|
|
66
|
+
${trailing ? html`<span class="c-formLabel-trailing" data-test-id="pie-form-label-trailing">${trailing}</span>` : nothing}
|
|
67
67
|
</label>`;
|
|
68
68
|
}
|
|
69
69
|
|