@justeattakeaway/pie-notification 0.1.1 → 0.1.2-next.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.d.ts CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { CSSResult } from 'lit';
2
2
  import type { LitElement } from 'lit';
3
- import type { ReactWebComponent } from '@lit-labs/react';
3
+ import type { ReactWebComponent } from '@lit/react';
4
4
  import type { TemplateResult } from 'lit-html';
5
5
 
6
6
  export declare interface NotificationProps {
package/dist/react.js CHANGED
@@ -1,68 +1,45 @@
1
- import * as g from "react";
2
- import { PieNotification as E } from "./index.js";
1
+ import * as y from "react";
2
+ import { PieNotification as N } from "./index.js";
3
3
  import "lit";
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2018 Google LLC
7
7
  * SPDX-License-Identifier: BSD-3-Clause
8
8
  */
9
- const b = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), w = /* @__PURE__ */ new WeakMap(), M = (t, i, d, m, p) => {
10
- const s = p == null ? void 0 : p[i];
11
- s === void 0 || d === m ? d == null && i in HTMLElement.prototype ? t.removeAttribute(i) : t[i] = d : ((a, o, h) => {
12
- let r = w.get(a);
13
- r === void 0 && w.set(a, r = /* @__PURE__ */ new Map());
14
- let l = r.get(o);
15
- h !== void 0 ? l === void 0 ? (r.set(o, l = { handleEvent: h }), a.addEventListener(o, l)) : l.handleEvent = h : l !== void 0 && (r.delete(o), a.removeEventListener(o, l));
16
- })(t, s, d);
17
- }, P = (t, i) => {
18
- typeof t == "function" ? t(i) : t.current = i;
19
- };
20
- function C(t = window.React, i, d, m, p) {
21
- let s, a, o;
22
- if (i === void 0) {
23
- const c = t;
24
- ({ tagName: a, elementClass: o, events: m, displayName: p } = c), s = c.react;
25
- } else
26
- s = t, o = d, a = i;
27
- const h = s.Component, r = s.createElement, l = new Set(Object.keys(m ?? {}));
28
- class v extends h {
29
- constructor() {
30
- super(...arguments), this.o = null;
31
- }
32
- t(e) {
33
- if (this.o !== null)
34
- for (const u in this.i)
35
- M(this.o, u, this.props[u], e ? e[u] : void 0, m);
36
- }
37
- componentDidMount() {
9
+ const E = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), v = /* @__PURE__ */ new WeakMap(), h = (t, c, i, u, l) => {
10
+ const f = l == null ? void 0 : l[c];
11
+ f === void 0 || i === u ? (t[c] = i, i == null && c in HTMLElement.prototype && t.removeAttribute(c)) : ((s, r, o) => {
12
+ let a = v.get(s);
13
+ a === void 0 && v.set(s, a = /* @__PURE__ */ new Map());
14
+ let n = a.get(r);
15
+ o !== void 0 ? n === void 0 ? (a.set(r, n = { handleEvent: o }), s.addEventListener(r, n)) : n.handleEvent = o : n !== void 0 && (a.delete(r), s.removeEventListener(r, n));
16
+ })(t, f, i);
17
+ }, b = ({ react: t, tagName: c, elementClass: i, events: u, displayName: l }) => {
18
+ const f = new Set(Object.keys(u ?? {})), s = t.forwardRef((r, o) => {
19
+ const a = t.useRef(null), n = t.useRef(null), m = {}, p = {};
20
+ for (const [e, d] of Object.entries(r))
21
+ E.has(e) ? m[e === "className" ? "class" : e] = d : f.has(e) || e in i.prototype ? p[e] = d : m[e] = d;
22
+ return t.useLayoutEffect(() => {
23
+ if (n.current !== null) {
24
+ for (const e in p)
25
+ h(n.current, e, r[e], a.current ? a.current[e] : void 0, u);
26
+ a.current = r;
27
+ }
28
+ }), t.useLayoutEffect(() => {
38
29
  var e;
39
- this.t(), (e = this.o) === null || e === void 0 || e.removeAttribute("defer-hydration");
40
- }
41
- componentDidUpdate(e) {
42
- this.t(e);
43
- }
44
- render() {
45
- const { _$Gl: e, ...u } = this.props;
46
- this.h !== e && (this.u = (n) => {
47
- e !== null && P(e, n), this.o = n, this.h = e;
48
- }), this.i = {};
49
- const f = { ref: this.u };
50
- for (const [n, N] of Object.entries(u))
51
- b.has(n) ? f[n === "className" ? "class" : n] = N : l.has(n) || n in o.prototype ? this.i[n] = N : f[n] = N;
52
- return f.suppressHydrationWarning = !0, r(a, f);
53
- }
54
- }
55
- v.displayName = p ?? o.name;
56
- const y = s.forwardRef((c, e) => r(v, { ...c, _$Gl: e }, c == null ? void 0 : c.children));
57
- return y.displayName = v.displayName, y;
58
- }
59
- const $ = C({
30
+ (e = n.current) == null || e.removeAttribute("defer-hydration");
31
+ }, []), m.suppressHydrationWarning = !0, t.createElement(c, { ...m, ref: t.useCallback((e) => {
32
+ n.current = e, typeof o == "function" ? o(e) : o !== null && (o.current = e);
33
+ }, [o]) });
34
+ });
35
+ return s.displayName = l ?? i.name, s;
36
+ }, L = b({
60
37
  displayName: "PieNotification",
61
- elementClass: E,
62
- react: g,
38
+ elementClass: N,
39
+ react: y,
63
40
  tagName: "pie-notification",
64
41
  events: {}
65
42
  });
66
43
  export {
67
- $ as PieNotification
44
+ L as PieNotification
68
45
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-notification",
3
3
  "description": "PIE Design System Notification built using Web Components",
4
- "version": "0.1.1",
4
+ "version": "0.1.2-next.0",
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.4.0"
31
+ "@justeattakeaway/pie-components-config": "0.6.0"
32
32
  },
33
33
  "dependencies": {
34
- "@justeattakeaway/pie-webc-core": "0.11.0"
34
+ "@justeattakeaway/pie-webc-core": "0.12.0-next.0"
35
35
  },
36
36
  "volta": {
37
37
  "extends": "../../../package.json"