@justeattakeaway/pie-cookie-banner 0.11.0 → 0.11.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/react.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { CSSResult } from 'lit';
2
- import type { EventName } from '@lit-labs/react';
2
+ import type { EventName } from '@lit/react';
3
3
  import type { LitElement } from 'lit';
4
4
  import { PieSwitch } from '@justeattakeaway/pie-switch';
5
- import type { ReactWebComponent } from '@lit-labs/react';
5
+ import type { ReactWebComponent } from '@lit/react';
6
6
  import { TemplateResult } from 'lit';
7
7
 
8
8
  export declare interface CookieBannerLocale {
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
- import * as _ from "react";
2
- import { PieCookieBanner as y } from "./index.js";
3
- import { ON_COOKIE_BANNER_ACCEPT_ALL as $, ON_COOKIE_BANNER_MANAGE_PREFS as j, ON_COOKIE_BANNER_NECESSARY_ONLY as F, ON_COOKIE_BANNER_PREFS_SAVED as H, preferences as T } from "./index.js";
1
+ import * as d from "react";
2
+ import { PieCookieBanner as C } from "./index.js";
3
+ import { ON_COOKIE_BANNER_ACCEPT_ALL as I, ON_COOKIE_BANNER_MANAGE_PREFS as K, ON_COOKIE_BANNER_NECESSARY_ONLY as j, ON_COOKIE_BANNER_PREFS_SAVED as x, preferences as F } from "./index.js";
4
4
  import "lit";
5
5
  import "lit/decorators.js";
6
6
  import "lit/directives/repeat.js";
@@ -15,60 +15,37 @@ import "@justeattakeaway/pie-switch";
15
15
  * Copyright 2018 Google LLC
16
16
  * SPDX-License-Identifier: BSD-3-Clause
17
17
  */
18
- const O = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), C = /* @__PURE__ */ new WeakMap(), k = (o, n, c, m, d) => {
19
- const r = d == null ? void 0 : d[n];
20
- r === void 0 || c === m ? c == null && n in HTMLElement.prototype ? o.removeAttribute(n) : o[n] = c : ((s, t, h) => {
21
- let a = C.get(s);
22
- a === void 0 && C.set(s, a = /* @__PURE__ */ new Map());
23
- let l = a.get(t);
24
- h !== void 0 ? l === void 0 ? (a.set(t, l = { handleEvent: h }), s.addEventListener(t, l)) : l.handleEvent = h : l !== void 0 && (a.delete(t), s.removeEventListener(t, l));
25
- })(o, r, c);
26
- }, A = (o, n) => {
27
- typeof o == "function" ? o(n) : o.current = n;
28
- };
29
- function P(o = window.React, n, c, m, d) {
30
- let r, s, t;
31
- if (n === void 0) {
32
- const p = o;
33
- ({ tagName: s, elementClass: t, events: m, displayName: d } = p), r = p.react;
34
- } else
35
- r = o, t = c, s = n;
36
- const h = r.Component, a = r.createElement, l = new Set(Object.keys(m ?? {}));
37
- class v extends h {
38
- constructor() {
39
- super(...arguments), this.o = null;
40
- }
41
- t(e) {
42
- if (this.o !== null)
43
- for (const N in this.i)
44
- k(this.o, N, this.props[N], e ? e[N] : void 0, m);
45
- }
46
- componentDidMount() {
18
+ const v = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]), E = /* @__PURE__ */ new WeakMap(), k = (n, c, i, p, l) => {
19
+ const m = l == null ? void 0 : l[c];
20
+ m === void 0 || i === p ? (n[c] = i, i == null && c in HTMLElement.prototype && n.removeAttribute(c)) : ((s, o, t) => {
21
+ let a = E.get(s);
22
+ a === void 0 && E.set(s, a = /* @__PURE__ */ new Map());
23
+ let r = a.get(o);
24
+ t !== void 0 ? r === void 0 ? (a.set(o, r = { handleEvent: t }), s.addEventListener(o, r)) : r.handleEvent = t : r !== void 0 && (a.delete(o), s.removeEventListener(o, r));
25
+ })(n, m, i);
26
+ }, y = ({ react: n, tagName: c, elementClass: i, events: p, displayName: l }) => {
27
+ const m = new Set(Object.keys(p ?? {})), s = n.forwardRef((o, t) => {
28
+ const a = n.useRef(null), r = n.useRef(null), u = {}, N = {};
29
+ for (const [e, f] of Object.entries(o))
30
+ v.has(e) ? u[e === "className" ? "class" : e] = f : m.has(e) || e in i.prototype ? N[e] = f : u[e] = f;
31
+ return n.useLayoutEffect(() => {
32
+ if (r.current !== null) {
33
+ for (const e in N)
34
+ k(r.current, e, o[e], a.current ? a.current[e] : void 0, p);
35
+ a.current = o;
36
+ }
37
+ }), n.useLayoutEffect(() => {
47
38
  var e;
48
- this.t(), (e = this.o) === null || e === void 0 || e.removeAttribute("defer-hydration");
49
- }
50
- componentDidUpdate(e) {
51
- this.t(e);
52
- }
53
- render() {
54
- const { _$Gl: e, ...N } = this.props;
55
- this.h !== e && (this.u = (i) => {
56
- e !== null && A(e, i), this.o = i, this.h = e;
57
- }), this.i = {};
58
- const u = { ref: this.u };
59
- for (const [i, f] of Object.entries(N))
60
- O.has(i) ? u[i === "className" ? "class" : i] = f : l.has(i) || i in t.prototype ? this.i[i] = f : u[i] = f;
61
- return u.suppressHydrationWarning = !0, a(s, u);
62
- }
63
- }
64
- v.displayName = d ?? t.name;
65
- const E = r.forwardRef((p, e) => a(v, { ...p, _$Gl: e }, p == null ? void 0 : p.children));
66
- return E.displayName = v.displayName, E;
67
- }
68
- const x = P({
39
+ (e = r.current) == null || e.removeAttribute("defer-hydration");
40
+ }, []), u.suppressHydrationWarning = !0, n.createElement(c, { ...u, ref: n.useCallback((e) => {
41
+ r.current = e, typeof t == "function" ? t(e) : t !== null && (t.current = e);
42
+ }, [t]) });
43
+ });
44
+ return s.displayName = l ?? i.name, s;
45
+ }, h = y({
69
46
  displayName: "PieCookieBanner",
70
- elementClass: y,
71
- react: _,
47
+ elementClass: C,
48
+ react: d,
72
49
  tagName: "pie-cookie-banner",
73
50
  events: {
74
51
  onPieCookieBannerAcceptAll: "pie-cookie-banner-accept-all",
@@ -82,10 +59,10 @@ const x = P({
82
59
  }
83
60
  });
84
61
  export {
85
- $ as ON_COOKIE_BANNER_ACCEPT_ALL,
86
- j as ON_COOKIE_BANNER_MANAGE_PREFS,
87
- F as ON_COOKIE_BANNER_NECESSARY_ONLY,
88
- H as ON_COOKIE_BANNER_PREFS_SAVED,
89
- x as PieCookieBanner,
90
- T as preferences
62
+ I as ON_COOKIE_BANNER_ACCEPT_ALL,
63
+ K as ON_COOKIE_BANNER_MANAGE_PREFS,
64
+ j as ON_COOKIE_BANNER_NECESSARY_ONLY,
65
+ x as ON_COOKIE_BANNER_PREFS_SAVED,
66
+ h as PieCookieBanner,
67
+ F as preferences
91
68
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-cookie-banner",
3
3
  "description": "PIE Design System Cookie Banner built using Web Components",
4
- "version": "0.11.0",
4
+ "version": "0.11.2-next.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -30,16 +30,16 @@
30
30
  "license": "Apache-2.0",
31
31
  "devDependencies": {
32
32
  "@justeat/pie-design-tokens": "5.9.0",
33
- "@justeattakeaway/pie-components-config": "0.5.0"
33
+ "@justeattakeaway/pie-components-config": "0.6.0"
34
34
  },
35
35
  "dependencies": {
36
- "@justeattakeaway/pie-button": "0.37.1",
37
- "@justeattakeaway/pie-divider": "0.9.1",
38
- "@justeattakeaway/pie-icon-button": "0.21.2",
39
- "@justeattakeaway/pie-link": "0.11.1",
40
- "@justeattakeaway/pie-modal": "0.32.1",
41
- "@justeattakeaway/pie-switch": "0.17.1",
42
- "@justeattakeaway/pie-webc-core": "0.11.0"
36
+ "@justeattakeaway/pie-button": "0.38.1-next.0",
37
+ "@justeattakeaway/pie-divider": "0.9.2-next.0",
38
+ "@justeattakeaway/pie-icon-button": "0.21.3-next.0",
39
+ "@justeattakeaway/pie-link": "0.11.2-next.0",
40
+ "@justeattakeaway/pie-modal": "0.32.3-next.0",
41
+ "@justeattakeaway/pie-switch": "0.17.2",
42
+ "@justeattakeaway/pie-webc-core": "0.12.0-next.0"
43
43
  },
44
44
  "volta": {
45
45
  "extends": "../../../package.json"