@justeattakeaway/pie-form-label 0.15.0 → 0.16.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/dist/index.js +35 -40
- package/package.json +6 -6
- package/src/index.ts +2 -3
- package/declaration.d.ts +0 -9
package/dist/index.js
CHANGED
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import { property as s } from "lit/decorators.js";
|
|
1
|
+
import { LitElement as b, nothing as l, html as p, unsafeCSS as m } from "lit";
|
|
3
2
|
import { ifDefined as h } from "lit/directives/if-defined.js";
|
|
4
|
-
import { RtlMixin as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
class d extends m {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments), this.v = "0.15.0";
|
|
3
|
+
import { RtlMixin as v, safeCustomElement as u } from "@justeattakeaway/pie-webc-core";
|
|
4
|
+
import { property as g } from "lit/decorators.js";
|
|
5
|
+
const o = class o extends b {
|
|
6
|
+
willUpdate() {
|
|
7
|
+
this.getAttribute("v") || this.setAttribute("v", o.v);
|
|
13
8
|
}
|
|
14
|
-
}
|
|
15
|
-
L([
|
|
16
|
-
s({ type: String, reflect: !0 })
|
|
17
|
-
], d.prototype, "v");
|
|
18
|
-
const x = "*,*: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)}";
|
|
19
|
-
var _ = Object.defineProperty, c = (n, e, r, g) => {
|
|
20
|
-
for (var t = void 0, i = n.length - 1, a; i >= 0; i--)
|
|
21
|
-
(a = n[i]) && (t = a(e, r, t) || t);
|
|
22
|
-
return t && _(e, r, t), t;
|
|
23
9
|
};
|
|
24
|
-
|
|
10
|
+
o.v = "0.16.0";
|
|
11
|
+
let d = o;
|
|
12
|
+
const L = "*,*: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)}";
|
|
13
|
+
var y = Object.defineProperty, w = Object.getOwnPropertyDescriptor, n = (e, t, s, a) => {
|
|
14
|
+
for (var r = a > 1 ? void 0 : a ? w(t, s) : t, f = e.length - 1, c; f >= 0; f--)
|
|
15
|
+
(c = e[f]) && (r = (a ? c(t, s, r) : c(r)) || r);
|
|
16
|
+
return a && r && y(t, s, r), r;
|
|
17
|
+
};
|
|
18
|
+
let i = class extends v(d) {
|
|
25
19
|
_renderOptionalLabel() {
|
|
26
20
|
const { optional: e } = this;
|
|
27
|
-
return e ?
|
|
21
|
+
return e ? p`<span class="c-formLabel-optional">${e}</span>` : l;
|
|
28
22
|
}
|
|
29
23
|
handleClick() {
|
|
30
24
|
if (this.for) {
|
|
@@ -36,35 +30,36 @@ const $ = "pie-form-label", p = class p extends u(d) {
|
|
|
36
30
|
render() {
|
|
37
31
|
const {
|
|
38
32
|
trailing: e,
|
|
39
|
-
isRTL:
|
|
33
|
+
isRTL: t
|
|
40
34
|
} = this;
|
|
41
|
-
return
|
|
35
|
+
return p`
|
|
42
36
|
<label
|
|
43
37
|
@click=${this.handleClick}
|
|
44
38
|
data-test-id="pie-form-label"
|
|
45
39
|
class="c-formLabel"
|
|
46
40
|
for=${h(this.for)}>
|
|
47
41
|
<div>
|
|
48
|
-
${
|
|
42
|
+
${t ? this._renderOptionalLabel() : l}
|
|
49
43
|
<span class="c-formLabel-leading" data-test-id="pie-form-label-leading"><slot></slot></span>
|
|
50
|
-
${
|
|
44
|
+
${t ? l : this._renderOptionalLabel()}
|
|
51
45
|
</div>
|
|
52
|
-
${e ?
|
|
46
|
+
${e ? p`<span class="c-formLabel-trailing" data-test-id="pie-form-label-trailing">${e}</span>` : l}
|
|
53
47
|
</label>`;
|
|
54
48
|
}
|
|
55
49
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
i.styles = m(L);
|
|
51
|
+
n([
|
|
52
|
+
g({ type: String, reflect: !0 })
|
|
53
|
+
], i.prototype, "for", 2);
|
|
54
|
+
n([
|
|
55
|
+
g({ type: String })
|
|
56
|
+
], i.prototype, "optional", 2);
|
|
57
|
+
n([
|
|
58
|
+
g({ type: String })
|
|
59
|
+
], i.prototype, "trailing", 2);
|
|
60
|
+
i = n([
|
|
61
|
+
u("pie-form-label")
|
|
62
|
+
], i);
|
|
68
63
|
export {
|
|
69
|
-
|
|
64
|
+
i as PieFormLabel
|
|
70
65
|
};
|
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.16.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/justeattakeaway/pie",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
42
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
42
|
+
"@justeattakeaway/pie-components-config": "0.20.1",
|
|
43
43
|
"@justeattakeaway/pie-css": "0.16.0",
|
|
44
|
-
"@justeattakeaway/pie-monorepo-utils": "0.5.
|
|
45
|
-
"@justeattakeaway/pie-switch": "1.
|
|
46
|
-
"@justeattakeaway/pie-text-input": "0.
|
|
44
|
+
"@justeattakeaway/pie-monorepo-utils": "0.5.1",
|
|
45
|
+
"@justeattakeaway/pie-switch": "1.4.0",
|
|
46
|
+
"@justeattakeaway/pie-text-input": "0.28.0",
|
|
47
47
|
"@justeattakeaway/pie-wrapper-react": "0.14.3",
|
|
48
48
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
51
|
+
"@justeattakeaway/pie-webc-core": "0.26.0"
|
|
52
52
|
},
|
|
53
53
|
"volta": {
|
|
54
54
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from 'lit';
|
|
4
4
|
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
-
import { RtlMixin,
|
|
6
|
+
import { RtlMixin, safeCustomElement, type PIEInputElement } from '@justeattakeaway/pie-webc-core';
|
|
7
7
|
import { property } from 'lit/decorators.js';
|
|
8
8
|
import styles from './form-label.scss?inline';
|
|
9
9
|
import { type FormLabelProps } from './defs';
|
|
@@ -16,6 +16,7 @@ const componentSelector = 'pie-form-label';
|
|
|
16
16
|
/**
|
|
17
17
|
* @tagname pie-form-label
|
|
18
18
|
*/
|
|
19
|
+
@safeCustomElement('pie-form-label')
|
|
19
20
|
export class PieFormLabel extends RtlMixin(PieElement) implements FormLabelProps {
|
|
20
21
|
@property({ type: String, reflect: true })
|
|
21
22
|
public for: FormLabelProps['for'];
|
|
@@ -72,8 +73,6 @@ export class PieFormLabel extends RtlMixin(PieElement) implements FormLabelProps
|
|
|
72
73
|
static styles = unsafeCSS(styles);
|
|
73
74
|
}
|
|
74
75
|
|
|
75
|
-
defineCustomElement(componentSelector, PieFormLabel);
|
|
76
|
-
|
|
77
76
|
declare global {
|
|
78
77
|
interface HTMLElementTagNameMap {
|
|
79
78
|
[componentSelector]: PieFormLabel;
|