@justeattakeaway/pie-form-label 0.8.2 → 0.8.4

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.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { CSSResult } from 'lit';
2
+ import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
2
3
  import type { LitElement } from 'lit';
3
4
  import type { TemplateResult } from 'lit';
4
5
 
@@ -29,8 +30,8 @@ export declare class PieFormLabel extends PieFormLabel_base implements FormLabel
29
30
  static styles: CSSResult;
30
31
  }
31
32
 
32
- declare const PieFormLabel_base: (new (...args: any[]) => {
33
+ declare const PieFormLabel_base: GenericConstructor<{
33
34
  isRTL: boolean;
34
- }) & typeof LitElement;
35
+ }> & typeof LitElement;
35
36
 
36
37
  export { }
package/dist/index.js CHANGED
@@ -1,42 +1,23 @@
1
- import { isServer as d, unsafeCSS as m, html as f, nothing as i, LitElement as b } from "lit";
2
- import { property as c } from "lit/decorators.js";
3
- const g = (t) => {
4
- class e extends t {
5
- /**
6
- * A getter to determine whether the text direction is right-to-left (RTL).
7
- * If the `dir` property is present on the component, it will be used to determine the text direction.
8
- * If running on the client-side (not SSR) and the `dir` property is not present, the text direction will be inferred
9
- * from the document's root element. This inference is not available during SSR.
10
- * In all other cases, it will return `false`, indicating a left-to-right (LTR) text direction.
11
- *
12
- * @returns {boolean} - Returns `true` if the text direction is RTL, otherwise `false`.
13
- */
14
- get isRTL() {
15
- return this.dir ? this.dir === "rtl" : !d && !this.dir ? document.documentElement.getAttribute("dir") === "rtl" : !1;
16
- }
17
- }
18
- return e;
19
- };
20
- function h(t, e) {
21
- customElements.get(t) ? console.warn(`PIE Web Component: "${t}" has already been defined. Please ensure the component is only being defined once in your application.`) : customElements.define(t, e);
22
- }
23
- const u = `.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)}
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";
3
+ 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)}
24
5
  `;
25
- var v = Object.defineProperty, L = Object.getOwnPropertyDescriptor, p = (t, e, n, o) => {
26
- for (var r = o > 1 ? void 0 : o ? L(e, n) : e, a = t.length - 1, s; a >= 0; a--)
27
- (s = t[a]) && (r = (o ? s(e, n, r) : s(r)) || r);
28
- return o && r && v(e, n, r), r;
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--)
8
+ (s = n[i]) && (t = (o ? s(e, r, t) : s(t)) || t);
9
+ return o && t && v(e, r, t), t;
29
10
  };
30
- const y = "pie-form-label";
31
- class l extends g(b) {
11
+ const u = "pie-form-label";
12
+ class l extends d(m) {
32
13
  _renderOptionalLabel() {
33
14
  const { optional: e } = this;
34
- return e ? f`<span class="c-formLabel-optional">${e}</span>` : i;
15
+ return e ? f`<span class="c-formLabel-optional">${e}</span>` : a;
35
16
  }
36
17
  render() {
37
18
  const {
38
19
  trailing: e,
39
- isRTL: n
20
+ isRTL: r
40
21
  } = this;
41
22
  return f`
42
23
  <label
@@ -44,25 +25,25 @@ class l extends g(b) {
44
25
  class="c-formLabel"
45
26
  for=${this.for}>
46
27
  <div>
47
- ${n ? this._renderOptionalLabel() : i}
28
+ ${r ? this._renderOptionalLabel() : a}
48
29
  <span class="c-formLabel-leading"><slot></slot></span>
49
- ${n ? i : this._renderOptionalLabel()}
30
+ ${r ? a : this._renderOptionalLabel()}
50
31
  </div>
51
- ${e ? f`<span class="c-formLabel-trailing">${e}</span>` : i}
32
+ ${e ? f`<span class="c-formLabel-trailing">${e}</span>` : a}
52
33
  </label>`;
53
34
  }
54
35
  }
55
- l.styles = m(u);
56
- p([
57
- c({ type: String, reflect: !0 })
36
+ l.styles = b(h);
37
+ c([
38
+ p({ type: String, reflect: !0 })
58
39
  ], l.prototype, "for", 2);
59
- p([
60
- c({ type: String })
40
+ c([
41
+ p({ type: String })
61
42
  ], l.prototype, "optional", 2);
62
- p([
63
- c({ type: String })
43
+ c([
44
+ p({ type: String })
64
45
  ], l.prototype, "trailing", 2);
65
- h(y, l);
46
+ g(u, l);
66
47
  export {
67
48
  l as PieFormLabel
68
49
  };
package/dist/react.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { CSSResult } from 'lit';
2
+ import type { GenericConstructor } from '@justeattakeaway/pie-webc-core';
2
3
  import type { LitElement } from 'lit';
3
4
  import type { ReactWebComponent } from '@lit/react';
4
5
  import type { TemplateResult } from 'lit';
@@ -32,8 +33,8 @@ declare class PieFormLabel_2 extends PieFormLabel_base implements FormLabelProps
32
33
  static styles: CSSResult;
33
34
  }
34
35
 
35
- declare const PieFormLabel_base: (new (...args: any[]) => {
36
+ declare const PieFormLabel_base: GenericConstructor<{
36
37
  isRTL: boolean;
37
- }) & typeof LitElement;
38
+ }> & typeof LitElement;
38
39
 
39
40
  export { }
package/dist/react.js CHANGED
@@ -2,6 +2,7 @@ import * as e from "react";
2
2
  import { createComponent as m } from "@lit/react";
3
3
  import { PieFormLabel as o } from "./index.js";
4
4
  import "lit";
5
+ import "@justeattakeaway/pie-webc-core";
5
6
  import "lit/decorators.js";
6
7
  const l = m({
7
8
  displayName: "PieFormLabel",
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.8.2",
4
+ "version": "0.8.4",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -28,10 +28,10 @@
28
28
  "author": "Just Eat Takeaway.com - Design System Team",
29
29
  "license": "Apache-2.0",
30
30
  "devDependencies": {
31
- "@justeattakeaway/pie-components-config": "0.6.0"
31
+ "@justeattakeaway/pie-components-config": "0.7.0"
32
32
  },
33
33
  "dependencies": {
34
- "@justeattakeaway/pie-webc-core": "0.12.0"
34
+ "@justeattakeaway/pie-webc-core": "0.14.0"
35
35
  },
36
36
  "volta": {
37
37
  "extends": "../../../package.json"