@justeattakeaway/pie-form-label 0.10.0 → 0.11.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 CHANGED
@@ -1,15 +1,16 @@
1
1
  import { LitElement as m, html as f, nothing as a, unsafeCSS as b } from "lit";
2
- import { RtlMixin as d, defineCustomElement as g } from "@justeattakeaway/pie-webc-core";
2
+ import { ifDefined as d } from "lit/directives/if-defined.js";
3
+ import { RtlMixin as g, defineCustomElement as h } from "@justeattakeaway/pie-webc-core";
3
4
  import { property as p } from "lit/decorators.js";
4
- const h = `.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)}
5
+ const v = `.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)}
5
6
  `;
6
- var v = Object.defineProperty, L = Object.getOwnPropertyDescriptor, c = (n, e, r, o) => {
7
- for (var t = o > 1 ? void 0 : o ? L(e, r) : e, i = n.length - 1, s; i >= 0; i--)
7
+ var L = Object.defineProperty, u = Object.getOwnPropertyDescriptor, c = (n, e, r, o) => {
8
+ for (var t = o > 1 ? void 0 : o ? u(e, r) : e, i = n.length - 1, s; i >= 0; i--)
8
9
  (s = n[i]) && (t = (o ? s(e, r, t) : s(t)) || t);
9
- return o && t && v(e, r, t), t;
10
+ return o && t && L(e, r, t), t;
10
11
  };
11
- const u = "pie-form-label";
12
- class l extends d(m) {
12
+ const y = "pie-form-label";
13
+ class l extends g(m) {
13
14
  _renderOptionalLabel() {
14
15
  const { optional: e } = this;
15
16
  return e ? f`<span class="c-formLabel-optional">${e}</span>` : a;
@@ -23,7 +24,7 @@ class l extends d(m) {
23
24
  <label
24
25
  data-test-id="pie-form-label"
25
26
  class="c-formLabel"
26
- for=${this.for}>
27
+ for=${d(this.for)}>
27
28
  <div>
28
29
  ${r ? this._renderOptionalLabel() : a}
29
30
  <span class="c-formLabel-leading"><slot></slot></span>
@@ -33,7 +34,7 @@ class l extends d(m) {
33
34
  </label>`;
34
35
  }
35
36
  }
36
- l.styles = b(h);
37
+ l.styles = b(v);
37
38
  c([
38
39
  p({ type: String, reflect: !0 })
39
40
  ], l.prototype, "for", 2);
@@ -43,7 +44,7 @@ c([
43
44
  c([
44
45
  p({ type: String })
45
46
  ], l.prototype, "trailing", 2);
46
- g(u, l);
47
+ h(y, l);
47
48
  export {
48
49
  l as PieFormLabel
49
50
  };
package/dist/react.js CHANGED
@@ -2,6 +2,7 @@ import * as e from "react";
2
2
  import { createComponent as o } from "@lit/react";
3
3
  import { PieFormLabel as m } from "./index.js";
4
4
  import "lit";
5
+ import "lit/directives/if-defined.js";
5
6
  import "@justeattakeaway/pie-webc-core";
6
7
  import "lit/decorators.js";
7
8
  const r = o({
@@ -10,7 +11,7 @@ const r = o({
10
11
  react: e,
11
12
  tagName: "pie-form-label",
12
13
  events: {}
13
- }), s = r;
14
+ }), b = r;
14
15
  export {
15
- s as PieFormLabel
16
+ b as PieFormLabel
16
17
  };
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.10.0",
4
+ "version": "0.11.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -33,11 +33,11 @@
33
33
  "devDependencies": {
34
34
  "@custom-elements-manifest/analyzer": "0.9.0",
35
35
  "@justeattakeaway/pie-components-config": "0.9.0",
36
- "@justeattakeaway/pie-wrapper-react": "0.13.0",
36
+ "@justeattakeaway/pie-wrapper-react": "0.14.0",
37
37
  "cem-plugin-module-file-extensions": "0.0.5"
38
38
  },
39
39
  "dependencies": {
40
- "@justeattakeaway/pie-webc-core": "0.17.0"
40
+ "@justeattakeaway/pie-webc-core": "0.17.1"
41
41
  },
42
42
  "volta": {
43
43
  "extends": "../../../package.json"
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  LitElement, TemplateResult, html, nothing, unsafeCSS,
3
3
  } from 'lit';
4
+ import { ifDefined } from 'lit/directives/if-defined.js';
4
5
  import { RtlMixin, defineCustomElement } from '@justeattakeaway/pie-webc-core';
5
6
  import { property } from 'lit/decorators.js';
6
7
  import styles from './form-label.scss?inline';
@@ -40,7 +41,7 @@ export class PieFormLabel extends RtlMixin(LitElement) implements FormLabelProps
40
41
  <label
41
42
  data-test-id="pie-form-label"
42
43
  class="c-formLabel"
43
- for=${this.for}>
44
+ for=${ifDefined(this.for)}>
44
45
  <div>
45
46
  ${isRTL ? this._renderOptionalLabel() : nothing}
46
47
  <span class="c-formLabel-leading"><slot></slot></span>
package/src/react.ts CHANGED
@@ -15,6 +15,5 @@ const PieFormLabelReact = createComponent({
15
15
 
16
16
  type ReactBaseType = React.LabelHTMLAttributes<HTMLLabelElement>
17
17
 
18
-
19
-
20
- export const PieFormLabel = PieFormLabelReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<FormLabelProps> & React.RefAttributes<PieFormLabelLit> & ReactBaseType>;
18
+ export const PieFormLabel = PieFormLabelReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<FormLabelProps>
19
+ & React.RefAttributes<PieFormLabelLit> & ReactBaseType>;