@justeattakeaway/pie-form-label 0.14.4 → 0.15.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/custom-elements.json +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +39 -26
- package/dist/react.d.ts +2 -2
- package/package.json +14 -10
- package/src/index.ts +3 -2
package/custom-elements.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSResult } from 'lit';
|
|
2
2
|
import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
3
|
-
import
|
|
3
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
4
4
|
import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
5
5
|
import type { TemplateResult } from 'lit';
|
|
6
6
|
|
|
@@ -32,6 +32,6 @@ export declare class PieFormLabel extends PieFormLabel_base implements FormLabel
|
|
|
32
32
|
static styles: CSSResult;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
declare const PieFormLabel_base: GenericConstructor<RTLInterface> & typeof
|
|
35
|
+
declare const PieFormLabel_base: GenericConstructor<RTLInterface> & typeof PieElement;
|
|
36
36
|
|
|
37
37
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return r && v(e, t, r), r;
|
|
1
|
+
import { LitElement as m, html as f, nothing as l, unsafeCSS as b } from "lit";
|
|
2
|
+
import { property as s } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined as h } from "lit/directives/if-defined.js";
|
|
4
|
+
import { RtlMixin as u, defineCustomElement as v } from "@justeattakeaway/pie-webc-core";
|
|
5
|
+
var y = Object.defineProperty, L = (n, e, r, g) => {
|
|
6
|
+
for (var t = void 0, i = n.length - 1, a; i >= 0; i--)
|
|
7
|
+
(a = n[i]) && (t = a(e, r, t) || t);
|
|
8
|
+
return t && y(e, r, t), t;
|
|
10
9
|
};
|
|
11
|
-
|
|
10
|
+
class d extends m {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.v = "0.15.0";
|
|
13
|
+
}
|
|
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
|
+
};
|
|
24
|
+
const $ = "pie-form-label", p = class p extends u(d) {
|
|
12
25
|
_renderOptionalLabel() {
|
|
13
26
|
const { optional: e } = this;
|
|
14
|
-
return e ?
|
|
27
|
+
return e ? f`<span class="c-formLabel-optional">${e}</span>` : l;
|
|
15
28
|
}
|
|
16
29
|
handleClick() {
|
|
17
30
|
if (this.for) {
|
|
@@ -23,35 +36,35 @@ const y = "pie-form-label", c = class c extends b(d) {
|
|
|
23
36
|
render() {
|
|
24
37
|
const {
|
|
25
38
|
trailing: e,
|
|
26
|
-
isRTL:
|
|
39
|
+
isRTL: r
|
|
27
40
|
} = this;
|
|
28
|
-
return
|
|
41
|
+
return f`
|
|
29
42
|
<label
|
|
30
43
|
@click=${this.handleClick}
|
|
31
44
|
data-test-id="pie-form-label"
|
|
32
45
|
class="c-formLabel"
|
|
33
|
-
for=${
|
|
46
|
+
for=${h(this.for)}>
|
|
34
47
|
<div>
|
|
35
|
-
${
|
|
48
|
+
${r ? this._renderOptionalLabel() : l}
|
|
36
49
|
<span class="c-formLabel-leading" data-test-id="pie-form-label-leading"><slot></slot></span>
|
|
37
|
-
${
|
|
50
|
+
${r ? l : this._renderOptionalLabel()}
|
|
38
51
|
</div>
|
|
39
|
-
${e ?
|
|
52
|
+
${e ? f`<span class="c-formLabel-trailing" data-test-id="pie-form-label-trailing">${e}</span>` : l}
|
|
40
53
|
</label>`;
|
|
41
54
|
}
|
|
42
55
|
};
|
|
43
|
-
|
|
44
|
-
let o =
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
p.styles = b(x);
|
|
57
|
+
let o = p;
|
|
58
|
+
c([
|
|
59
|
+
s({ type: String, reflect: !0 })
|
|
47
60
|
], o.prototype, "for");
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
c([
|
|
62
|
+
s({ type: String })
|
|
50
63
|
], o.prototype, "optional");
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
c([
|
|
65
|
+
s({ type: String })
|
|
53
66
|
], o.prototype, "trailing");
|
|
54
|
-
|
|
67
|
+
v($, o);
|
|
55
68
|
export {
|
|
56
69
|
o as PieFormLabel
|
|
57
70
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CSSResult } from 'lit';
|
|
2
2
|
import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
|
|
3
|
-
import
|
|
3
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
4
4
|
import * as React_2 from 'react';
|
|
5
5
|
import type { RTLInterface } from '@justeattakeaway/pie-webc-core';
|
|
6
6
|
import type { TemplateResult } from 'lit';
|
|
@@ -35,7 +35,7 @@ declare class PieFormLabel_2 extends PieFormLabel_base implements FormLabelProps
|
|
|
35
35
|
static styles: CSSResult;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
declare const PieFormLabel_base: GenericConstructor<RTLInterface> & typeof
|
|
38
|
+
declare const PieFormLabel_base: GenericConstructor<RTLInterface> & typeof PieElement;
|
|
39
39
|
|
|
40
40
|
declare type ReactBaseType = React_2.LabelHTMLAttributes<HTMLLabelElement>;
|
|
41
41
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
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.15.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/justeattakeaway/pie",
|
|
8
|
+
"directory": "packages/components/pie-form-label"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/justeattakeaway/pie/tree/main/packages/components/pie-form-label",
|
|
5
11
|
"type": "module",
|
|
6
12
|
"main": "dist/index.js",
|
|
7
13
|
"module": "dist/index.js",
|
|
@@ -24,9 +30,6 @@
|
|
|
24
30
|
"lint:style": "run -T stylelint ./src/**/*.{css,scss}",
|
|
25
31
|
"lint:style:fix": "yarn lint:style --fix",
|
|
26
32
|
"watch": "run -T vite build --watch",
|
|
27
|
-
"test": "echo \"Error: no test specified\" && exit 0",
|
|
28
|
-
"test:ci": "yarn test",
|
|
29
|
-
"test:browsers-setup": "npx playwright-lit-setup",
|
|
30
33
|
"test:browsers": "npx playwright test -c ./playwright-lit.config.ts",
|
|
31
34
|
"test:browsers:ci": "yarn test:browsers",
|
|
32
35
|
"test:visual": "run -T cross-env-shell PERCY_TOKEN=${PERCY_TOKEN_PIE_FORM_LABEL} percy exec --allowed-hostname cloudfront.net -- npx playwright test -c ./playwright-lit-visual.config.ts",
|
|
@@ -36,15 +39,16 @@
|
|
|
36
39
|
"license": "Apache-2.0",
|
|
37
40
|
"devDependencies": {
|
|
38
41
|
"@custom-elements-manifest/analyzer": "0.9.0",
|
|
39
|
-
"@justeattakeaway/pie-components-config": "0.
|
|
40
|
-
"@justeattakeaway/pie-css": "0.
|
|
41
|
-
"@justeattakeaway/pie-
|
|
42
|
-
"@justeattakeaway/pie-
|
|
43
|
-
"@justeattakeaway/pie-
|
|
42
|
+
"@justeattakeaway/pie-components-config": "0.19.0",
|
|
43
|
+
"@justeattakeaway/pie-css": "0.16.0",
|
|
44
|
+
"@justeattakeaway/pie-monorepo-utils": "0.5.0",
|
|
45
|
+
"@justeattakeaway/pie-switch": "1.3.0",
|
|
46
|
+
"@justeattakeaway/pie-text-input": "0.27.0",
|
|
47
|
+
"@justeattakeaway/pie-wrapper-react": "0.14.3",
|
|
44
48
|
"cem-plugin-module-file-extensions": "0.0.5"
|
|
45
49
|
},
|
|
46
50
|
"dependencies": {
|
|
47
|
-
"@justeattakeaway/pie-webc-core": "0.
|
|
51
|
+
"@justeattakeaway/pie-webc-core": "0.25.0"
|
|
48
52
|
},
|
|
49
53
|
"volta": {
|
|
50
54
|
"extends": "../../../package.json"
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
type TemplateResult, html, nothing, unsafeCSS,
|
|
3
3
|
} from 'lit';
|
|
4
|
+
import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement';
|
|
4
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
6
|
import { RtlMixin, defineCustomElement, type PIEInputElement } from '@justeattakeaway/pie-webc-core';
|
|
6
7
|
import { property } from 'lit/decorators.js';
|
|
@@ -15,7 +16,7 @@ const componentSelector = 'pie-form-label';
|
|
|
15
16
|
/**
|
|
16
17
|
* @tagname pie-form-label
|
|
17
18
|
*/
|
|
18
|
-
export class PieFormLabel extends RtlMixin(
|
|
19
|
+
export class PieFormLabel extends RtlMixin(PieElement) implements FormLabelProps {
|
|
19
20
|
@property({ type: String, reflect: true })
|
|
20
21
|
public for: FormLabelProps['for'];
|
|
21
22
|
|