@justeattakeaway/pie-form-label 0.7.0 → 0.8.1

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.
Files changed (3) hide show
  1. package/README.md +19 -6
  2. package/dist/react.js +35 -34
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -13,10 +13,9 @@
13
13
  1. [Introduction](#pie-form-label)
14
14
  2. [Installation](#installation)
15
15
  3. [Importing the component](#importing-the-component)
16
- 4. [Local Development](#local-development)
17
- 5. [Peer Dependencies](#peer-dependencies)
18
- 6. [Props](#props)
19
- 7. [Contributing](#contributing)
16
+ 4. [Peer Dependencies](#peer-dependencies)
17
+ 5. [Props](#props)
18
+ 6. [Contributing](#contributing)
20
19
 
21
20
  ## pie-form-label
22
21
 
@@ -42,14 +41,28 @@ For full information on using PIE components as part of an application, check ou
42
41
 
43
42
  ### Importing the component
44
43
 
44
+ #### JavaScript
45
45
  ```js
46
- // default
46
+ // Default – for Native JS Applications, Vue, Angular, Svelte, etc.
47
47
  import { PieFormLabel } from '@justeattakeaway/pie-form-label';
48
48
 
49
- // react
49
+ // If you don't need to reference the imported object, you can simply
50
+ // import the module which registers the component as a custom element.
51
+ import '@justeattakeaway/pie-form-label';
52
+ ```
53
+
54
+ #### React
55
+ ```js
56
+ // React
57
+ // For React, you will need to import our React-specific component build
58
+ // which wraps the web component using @lit-labs/react
50
59
  import { PieFormLabel } from '@justeattakeaway/pie-form-label/dist/react';
51
60
  ```
52
61
 
62
+ > [!NOTE]
63
+ > When using the React version of the component, please make sure to also
64
+ > include React as a [peer dependency](#peer-dependencies) in your project.
65
+
53
66
 
54
67
  ## Peer Dependencies
55
68
 
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
- import * as L from "react";
2
- import { PieFormLabel as E } from "./index.js";
1
+ import * as w from "react";
2
+ import { PieFormLabel as L } from "./index.js";
3
3
  import "lit";
4
4
  import "lit/decorators.js";
5
5
  /**
@@ -7,59 +7,60 @@ import "lit/decorators.js";
7
7
  * Copyright 2018 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
9
  */
10
- const g = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), w = /* @__PURE__ */ new WeakMap(), F = (m, a, d, p, h) => {
11
- const o = h == null ? void 0 : h[a];
12
- o === void 0 || d === p ? d == null && a in HTMLElement.prototype ? m.removeAttribute(a) : m[a] = d : ((s, t, u) => {
13
- let n = w.get(s);
14
- n === void 0 && w.set(s, n = /* @__PURE__ */ new Map());
15
- let l = n.get(t);
16
- u !== void 0 ? l === void 0 ? (n.set(t, l = { handleEvent: u }), s.addEventListener(t, l)) : l.handleEvent = u : l !== void 0 && (n.delete(t), s.removeEventListener(t, l));
17
- })(m, o, d);
10
+ const g = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), b = /* @__PURE__ */ new WeakMap(), E = (t, o, c, d, p) => {
11
+ const n = p == null ? void 0 : p[o];
12
+ n === void 0 || c === d ? c == null && o in HTMLElement.prototype ? t.removeAttribute(o) : t[o] = c : ((r, i, h) => {
13
+ let a = b.get(r);
14
+ a === void 0 && b.set(r, a = /* @__PURE__ */ new Map());
15
+ let l = a.get(i);
16
+ h !== void 0 ? l === void 0 ? (a.set(i, l = { handleEvent: h }), r.addEventListener(i, l)) : l.handleEvent = h : l !== void 0 && (a.delete(i), r.removeEventListener(i, l));
17
+ })(t, n, c);
18
+ }, F = (t, o) => {
19
+ typeof t == "function" ? t(o) : t.current = o;
18
20
  };
19
- function M(m = window.React, a, d, p, h) {
20
- let o, s, t;
21
- if (a === void 0) {
22
- const r = m;
23
- ({ tagName: s, elementClass: t, events: p, displayName: h } = r), o = r.react;
21
+ function M(t = window.React, o, c, d, p) {
22
+ let n, r, i;
23
+ if (o === void 0) {
24
+ const m = t;
25
+ ({ tagName: r, elementClass: i, events: d, displayName: p } = m), n = m.react;
24
26
  } else
25
- o = m, t = d, s = a;
26
- const u = o.Component, n = o.createElement, l = new Set(Object.keys(p ?? {}));
27
- class f extends u {
27
+ n = t, i = c, r = o;
28
+ const h = n.Component, a = n.createElement, l = new Set(Object.keys(d ?? {}));
29
+ class f extends h {
28
30
  constructor() {
29
31
  super(...arguments), this.o = null;
30
32
  }
31
33
  t(e) {
32
34
  if (this.o !== null)
33
- for (const v in this.i)
34
- F(this.o, v, this.props[v], e ? e[v] : void 0, p);
35
+ for (const u in this.i)
36
+ E(this.o, u, this.props[u], e ? e[u] : void 0, d);
35
37
  }
36
38
  componentDidMount() {
37
- this.t();
39
+ var e;
40
+ this.t(), (e = this.o) === null || e === void 0 || e.removeAttribute("defer-hydration");
38
41
  }
39
42
  componentDidUpdate(e) {
40
43
  this.t(e);
41
44
  }
42
45
  render() {
43
- const { _$Gl: e, ...v } = this.props;
44
- this.h !== e && (this.u = (i) => {
45
- e !== null && ((c, b) => {
46
- typeof c == "function" ? c(b) : c.current = b;
47
- })(e, i), this.o = i, this.h = e;
46
+ const { _$Gl: e, ...u } = this.props;
47
+ this.h !== e && (this.u = (s) => {
48
+ e !== null && F(e, s), this.o = s, this.h = e;
48
49
  }), this.i = {};
49
- const y = { ref: this.u };
50
- for (const [i, c] of Object.entries(v))
51
- g.has(i) ? y[i === "className" ? "class" : i] = c : l.has(i) || i in t.prototype ? this.i[i] = c : y[i] = c;
52
- return n(s, y);
50
+ const v = { ref: this.u };
51
+ for (const [s, y] of Object.entries(u))
52
+ g.has(s) ? v[s === "className" ? "class" : s] = y : l.has(s) || s in i.prototype ? this.i[s] = y : v[s] = y;
53
+ return v.suppressHydrationWarning = !0, a(r, v);
53
54
  }
54
55
  }
55
- f.displayName = h ?? t.name;
56
- const N = o.forwardRef((r, e) => n(f, { ...r, _$Gl: e }, r == null ? void 0 : r.children));
56
+ f.displayName = p ?? i.name;
57
+ const N = n.forwardRef((m, e) => a(f, { ...m, _$Gl: e }, m == null ? void 0 : m.children));
57
58
  return N.displayName = f.displayName, N;
58
59
  }
59
60
  const $ = M({
60
61
  displayName: "PieFormLabel",
61
- elementClass: E,
62
- react: L,
62
+ elementClass: L,
63
+ react: w,
63
64
  tagName: "pie-form-label",
64
65
  events: {}
65
66
  });
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.7.0",
4
+ "version": "0.8.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",