@justeattakeaway/pie-form-label 0.14.0 → 0.14.2
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 +26 -28
- package/dist/react.js +6 -10
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import { LitElement as d, html as
|
|
1
|
+
import { LitElement as d, html as l, nothing as i, unsafeCSS as g } from "lit";
|
|
2
2
|
import { ifDefined as m } from "lit/directives/if-defined.js";
|
|
3
3
|
import { RtlMixin as b, defineCustomElement as h } from "@justeattakeaway/pie-webc-core";
|
|
4
|
-
import { property as
|
|
5
|
-
const u =
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return l && r && v(e, t, r), r;
|
|
4
|
+
import { property as n } from "lit/decorators.js";
|
|
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
|
+
var v = Object.defineProperty, s = (f, e, t, L) => {
|
|
7
|
+
for (var r = void 0, a = f.length - 1, p; a >= 0; a--)
|
|
8
|
+
(p = f[a]) && (r = p(e, t, r) || r);
|
|
9
|
+
return r && v(e, t, r), r;
|
|
11
10
|
};
|
|
12
|
-
const y = "pie-form-label"
|
|
13
|
-
class o extends b(d) {
|
|
11
|
+
const y = "pie-form-label", c = class c extends b(d) {
|
|
14
12
|
_renderOptionalLabel() {
|
|
15
13
|
const { optional: e } = this;
|
|
16
|
-
return e ?
|
|
14
|
+
return e ? l`<span class="c-formLabel-optional">${e}</span>` : i;
|
|
17
15
|
}
|
|
18
16
|
handleClick() {
|
|
19
17
|
if (this.for) {
|
|
20
18
|
const e = document.querySelector(`#${this.for}`);
|
|
21
|
-
if (!(e && e.focusTarget && "focus" in e.focusTarget && "click" in e.focusTarget))
|
|
22
|
-
return;
|
|
19
|
+
if (!(e && e.focusTarget && "focus" in e.focusTarget && "click" in e.focusTarget)) return;
|
|
23
20
|
e.focusTarget.focus(), e.focusTarget.click();
|
|
24
21
|
}
|
|
25
22
|
}
|
|
@@ -28,31 +25,32 @@ class o extends b(d) {
|
|
|
28
25
|
trailing: e,
|
|
29
26
|
isRTL: t
|
|
30
27
|
} = this;
|
|
31
|
-
return
|
|
28
|
+
return l`
|
|
32
29
|
<label
|
|
33
30
|
@click=${this.handleClick}
|
|
34
31
|
data-test-id="pie-form-label"
|
|
35
32
|
class="c-formLabel"
|
|
36
33
|
for=${m(this.for)}>
|
|
37
34
|
<div>
|
|
38
|
-
${t ? this._renderOptionalLabel() :
|
|
35
|
+
${t ? this._renderOptionalLabel() : i}
|
|
39
36
|
<span class="c-formLabel-leading" data-test-id="pie-form-label-leading"><slot></slot></span>
|
|
40
|
-
${t ?
|
|
37
|
+
${t ? i : this._renderOptionalLabel()}
|
|
41
38
|
</div>
|
|
42
|
-
${e ?
|
|
39
|
+
${e ? l`<span class="c-formLabel-trailing" data-test-id="pie-form-label-trailing">${e}</span>` : i}
|
|
43
40
|
</label>`;
|
|
44
41
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
42
|
+
};
|
|
43
|
+
c.styles = g(u);
|
|
44
|
+
let o = c;
|
|
45
|
+
s([
|
|
46
|
+
n({ type: String, reflect: !0 })
|
|
47
|
+
], o.prototype, "for");
|
|
48
|
+
s([
|
|
49
|
+
n({ type: String })
|
|
50
|
+
], o.prototype, "optional");
|
|
51
|
+
s([
|
|
52
|
+
n({ type: String })
|
|
53
|
+
], o.prototype, "trailing");
|
|
56
54
|
h(y, o);
|
|
57
55
|
export {
|
|
58
56
|
o as PieFormLabel
|
package/dist/react.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import { createComponent as
|
|
3
|
-
import { PieFormLabel as
|
|
4
|
-
|
|
5
|
-
import "lit/directives/if-defined.js";
|
|
6
|
-
import "@justeattakeaway/pie-webc-core";
|
|
7
|
-
import "lit/decorators.js";
|
|
8
|
-
const r = o({
|
|
2
|
+
import { createComponent as a } from "@lit/react";
|
|
3
|
+
import { PieFormLabel as o } from "./index.js";
|
|
4
|
+
const m = a({
|
|
9
5
|
displayName: "PieFormLabel",
|
|
10
|
-
elementClass:
|
|
6
|
+
elementClass: o,
|
|
11
7
|
react: e,
|
|
12
8
|
tagName: "pie-form-label",
|
|
13
9
|
events: {}
|
|
14
|
-
}),
|
|
10
|
+
}), i = m;
|
|
15
11
|
export {
|
|
16
|
-
|
|
12
|
+
i as PieFormLabel
|
|
17
13
|
};
|
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.14.
|
|
4
|
+
"version": "0.14.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
40
|
-
"@justeattakeaway/pie-
|
|
41
|
-
"@justeattakeaway/pie-
|
|
39
|
+
"@justeattakeaway/pie-components-config": "0.18.0",
|
|
40
|
+
"@justeattakeaway/pie-css": "0.13.0",
|
|
41
|
+
"@justeattakeaway/pie-switch": "0.30.2",
|
|
42
|
+
"@justeattakeaway/pie-text-input": "0.24.1",
|
|
42
43
|
"@justeattakeaway/pie-wrapper-react": "0.14.1",
|
|
43
44
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@justeattakeaway/pie-webc-core": "0.24.
|
|
47
|
+
"@justeattakeaway/pie-webc-core": "0.24.1"
|
|
47
48
|
},
|
|
48
49
|
"volta": {
|
|
49
50
|
"extends": "../../../package.json"
|