@justeattakeaway/pie-form-label 0.8.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.
- package/README.md +16 -2
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/react.d.ts +0 -0
- package/dist/react.js +35 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,14 +41,28 @@ For full information on using PIE components as part of an application, check ou
|
|
|
41
41
|
|
|
42
42
|
### Importing the component
|
|
43
43
|
|
|
44
|
+
#### JavaScript
|
|
44
45
|
```js
|
|
45
|
-
//
|
|
46
|
+
// Default – for Native JS Applications, Vue, Angular, Svelte, etc.
|
|
46
47
|
import { PieFormLabel } from '@justeattakeaway/pie-form-label';
|
|
47
48
|
|
|
48
|
-
//
|
|
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
|
|
49
59
|
import { PieFormLabel } from '@justeattakeaway/pie-form-label/dist/react';
|
|
50
60
|
```
|
|
51
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
|
+
|
|
52
66
|
|
|
53
67
|
## Peer Dependencies
|
|
54
68
|
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
package/dist/react.d.ts
CHANGED
|
File without changes
|
package/dist/react.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { PieFormLabel as
|
|
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"]),
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
let l =
|
|
16
|
-
|
|
17
|
-
})(
|
|
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(
|
|
20
|
-
let
|
|
21
|
-
if (
|
|
22
|
-
const
|
|
23
|
-
({ tagName:
|
|
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
|
-
|
|
26
|
-
const
|
|
27
|
-
class f extends
|
|
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
|
|
34
|
-
|
|
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
|
-
|
|
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, ...
|
|
44
|
-
this.h !== e && (this.u = (
|
|
45
|
-
e !== null && (
|
|
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
|
|
50
|
-
for (const [
|
|
51
|
-
g.has(
|
|
52
|
-
return
|
|
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 =
|
|
56
|
-
const N =
|
|
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:
|
|
62
|
-
react:
|
|
62
|
+
elementClass: L,
|
|
63
|
+
react: w,
|
|
63
64
|
tagName: "pie-form-label",
|
|
64
65
|
events: {}
|
|
65
66
|
});
|
package/package.json
CHANGED