@peax/consent-banner-react 0.9.4 → 0.10.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/README.md +2 -1
- package/dist/index.js +45 -44
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -96,6 +96,7 @@ All `BannerProps` fields are optional, but `floatingButtonPosition` requires `sh
|
|
|
96
96
|
| `hasAcceptRejectEqualWeight` | `false` | Give Accept and Reject the same secondary button appearance |
|
|
97
97
|
| `position` | `'right'` | `'left'`, `'center'`, or `'right'` |
|
|
98
98
|
| `slideFrom` | `'bottom'` | Bottom, or the matching side for left/right positioning |
|
|
99
|
+
| `isEdgeToEdgeOnMobile` | `false` | Below 768px, remove the page gutters so the banner meets the screen's sides and bottom, with square bottom corners; top corners keep `--pxc-radius-xl` |
|
|
99
100
|
| `appearanceDelay` | `0` | Delay the first appearance, in milliseconds |
|
|
100
101
|
|
|
101
102
|
### Content and preferences
|
|
@@ -211,7 +212,7 @@ Keyboard order follows visual order where `reading-flow` is supported; otherwise
|
|
|
211
212
|
|
|
212
213
|
## Development
|
|
213
214
|
|
|
214
|
-
Run `yarn workspace @peax/consent-banner-react dev` from the repository. The demo supports `?variant=stacked`, `?locale=de`,
|
|
215
|
+
Run `yarn workspace @peax/consent-banner-react dev` from the repository. The demo supports `?variant=stacked`, `?locale=de`, `?showCustomizePreferences=false`, and `?edgeToEdge=1` (open it at a width below 768px). Theme edits update live from source.
|
|
215
216
|
|
|
216
217
|
See [Banner verification](https://github.com/peaxco/consent/blob/main/docs/engineering/banner-verification.md) for browser setup and snapshot checks, and [Contributing](https://github.com/peaxco/consent/blob/main/CONTRIBUTING.md) for repository commands.
|
|
217
218
|
|
package/dist/index.js
CHANGED
|
@@ -360,79 +360,80 @@ var K = ({ message: e, links: t }) => b(() => o(e, Object.keys(t)), [e, t]).map(
|
|
|
360
360
|
onClick: () => a({ type: "on_open_preferences" }),
|
|
361
361
|
children: e === "compact" ? /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ j(B, {}), /* @__PURE__ */ j("span", { children: t.customizePreferencesLabel })] }) : t.customizePreferencesLabel
|
|
362
362
|
})
|
|
363
|
-
})] }), Z = g(function({ bannerContent: n, cookiePolicyUrl: r, isOpen: a = !1, appearanceDelay: o = 0, preferencesSections: s = t, preferencesContent: d, hasAcceptRejectEqualWeight: f = !1, showCustomizePreferences: p = !0,
|
|
364
|
-
let
|
|
365
|
-
v,
|
|
363
|
+
})] }), Z = g(function({ bannerContent: n, cookiePolicyUrl: r, isOpen: a = !1, appearanceDelay: o = 0, preferencesSections: s = t, preferencesContent: d, hasAcceptRejectEqualWeight: f = !1, showCustomizePreferences: p = !0, isEdgeToEdgeOnMobile: m = !1, showFloatingButton: h = !0, floatingButtonPosition: g, variant: _ = "compact", theme: v = "auto", locale: y = "en", locales: x, onMsg: S, className: C, style: w, ...T }) {
|
|
364
|
+
let E = b(() => l(y, x, n !== void 0 || d !== void 0), [
|
|
366
365
|
y,
|
|
366
|
+
x,
|
|
367
367
|
n,
|
|
368
368
|
d
|
|
369
|
-
]),
|
|
369
|
+
]), D = i(E.banner, n), O = b(() => ({ cookiePolicy: r }), [r]), k = b(() => u(s, d, E.preferences), [
|
|
370
370
|
s,
|
|
371
371
|
d,
|
|
372
|
-
|
|
373
|
-
]),
|
|
372
|
+
E.preferences
|
|
373
|
+
]), N = c(T.position, g), P = I({
|
|
374
374
|
isOpen: a,
|
|
375
|
-
showFloatingButton:
|
|
375
|
+
showFloatingButton: h,
|
|
376
376
|
showCustomizePreferences: p,
|
|
377
|
-
floatingPosition:
|
|
378
|
-
onMsg:
|
|
379
|
-
}),
|
|
380
|
-
...
|
|
381
|
-
position:
|
|
377
|
+
floatingPosition: N,
|
|
378
|
+
onMsg: S
|
|
379
|
+
}), F = P.view !== null, L = P.view?.source === "floating-button" ? {
|
|
380
|
+
...T,
|
|
381
|
+
position: P.view.position,
|
|
382
382
|
slideFrom: "bottom"
|
|
383
|
-
} :
|
|
384
|
-
if (e.type === "on_open_preferences") return
|
|
385
|
-
if (e.type === "on_close_preferences") return
|
|
386
|
-
|
|
383
|
+
} : T, z = (e) => {
|
|
384
|
+
if (e.type === "on_open_preferences") return P.openPreferences("banner");
|
|
385
|
+
if (e.type === "on_close_preferences") return P.closePreferences();
|
|
386
|
+
S?.(e);
|
|
387
387
|
};
|
|
388
388
|
return /* @__PURE__ */ M("div", {
|
|
389
|
-
"data-theme":
|
|
390
|
-
"data-banner-variant":
|
|
391
|
-
|
|
389
|
+
"data-theme": v,
|
|
390
|
+
"data-banner-variant": _,
|
|
391
|
+
"data-mobile-edge-to-edge": m || void 0,
|
|
392
|
+
className: e("pxc", C),
|
|
392
393
|
style: {
|
|
393
394
|
fontFamily: "var(--pxc-font-family)",
|
|
394
|
-
...
|
|
395
|
+
...w
|
|
395
396
|
},
|
|
396
|
-
lang:
|
|
397
|
+
lang: E.locale,
|
|
397
398
|
children: [/* @__PURE__ */ j(R, {
|
|
398
|
-
...
|
|
399
|
+
...L,
|
|
399
400
|
isOpen: a,
|
|
400
|
-
onExitFocus:
|
|
401
|
-
onPresenceChange:
|
|
401
|
+
onExitFocus: P.onExitFocus,
|
|
402
|
+
onPresenceChange: P.setHasPanel,
|
|
402
403
|
appearanceDelay: o,
|
|
403
|
-
className:
|
|
404
|
-
actions:
|
|
405
|
-
variant:
|
|
406
|
-
content:
|
|
404
|
+
className: F ? "pxc-container--preferences" : void 0,
|
|
405
|
+
actions: F ? null : /* @__PURE__ */ j(X, {
|
|
406
|
+
variant: _,
|
|
407
|
+
content: D,
|
|
407
408
|
equalWeight: f,
|
|
408
409
|
showCustomizePreferences: p,
|
|
409
|
-
preferencesRef:
|
|
410
|
-
onMsg:
|
|
410
|
+
preferencesRef: P.triggerRef,
|
|
411
|
+
onMsg: z
|
|
411
412
|
}),
|
|
412
|
-
children:
|
|
413
|
-
links:
|
|
414
|
-
content:
|
|
415
|
-
sections:
|
|
416
|
-
onMsg:
|
|
417
|
-
}) : /* @__PURE__ */ M(A, { children: [
|
|
413
|
+
children: F ? /* @__PURE__ */ j(J, {
|
|
414
|
+
links: O,
|
|
415
|
+
content: D,
|
|
416
|
+
sections: k,
|
|
417
|
+
onMsg: z
|
|
418
|
+
}) : /* @__PURE__ */ M(A, { children: [_ === "stacked" ? /* @__PURE__ */ M("div", {
|
|
418
419
|
className: "pxc-banner__heading",
|
|
419
420
|
children: [/* @__PURE__ */ j(U, {}), /* @__PURE__ */ j(Y, {
|
|
420
421
|
variant: "heading",
|
|
421
422
|
tag: "h3",
|
|
422
|
-
children:
|
|
423
|
+
children: D.title
|
|
423
424
|
})]
|
|
424
425
|
}) : /* @__PURE__ */ j(U, {}), /* @__PURE__ */ j(Y, {
|
|
425
426
|
variant: "paragraph",
|
|
426
427
|
children: /* @__PURE__ */ j(K, {
|
|
427
|
-
message:
|
|
428
|
-
links:
|
|
428
|
+
message: D.collapsedText,
|
|
429
|
+
links: O
|
|
429
430
|
})
|
|
430
431
|
})] })
|
|
431
|
-
}),
|
|
432
|
-
ref:
|
|
433
|
-
position:
|
|
434
|
-
label:
|
|
435
|
-
onMsg: () =>
|
|
432
|
+
}), h && !a && !P.hasPanel && /* @__PURE__ */ j(H, {
|
|
433
|
+
ref: P.triggerRef,
|
|
434
|
+
position: N,
|
|
435
|
+
label: D.customizePreferencesLabel.trim() || E.banner.customizePreferencesLabel,
|
|
436
|
+
onMsg: () => P.openPreferences("floating-button")
|
|
436
437
|
})]
|
|
437
438
|
});
|
|
438
439
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peax/consent-banner-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Accessible React bindings and components for Peax Consent.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"consent-management",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"typecheck": "tsc --noEmit"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@peax/consent-banner-locales": "^0.
|
|
53
|
+
"@peax/consent-banner-locales": "^0.10.0",
|
|
54
54
|
"react": "^18.2.0 || ^19.0.0",
|
|
55
55
|
"react-dom": "^18.2.0 || ^19.0.0"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@base-ui/react": "^1.8.0",
|
|
59
|
-
"@peax/consent-banner-shared": "^0.
|
|
60
|
-
"@peax/consent-banner-theme": "^0.
|
|
59
|
+
"@peax/consent-banner-shared": "^0.10.0",
|
|
60
|
+
"@peax/consent-banner-theme": "^0.10.0",
|
|
61
61
|
"clsx": "^2.1.1",
|
|
62
62
|
"framer-motion": "^14.0.0"
|
|
63
63
|
},
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@axe-core/playwright": "^4.13.0",
|
|
66
66
|
"@fontsource/figtree": "^5.3.0",
|
|
67
67
|
"@fontsource/poppins": "^5.3.0",
|
|
68
|
-
"@peax/consent-banner-locales": "^0.
|
|
68
|
+
"@peax/consent-banner-locales": "^0.10.0",
|
|
69
69
|
"@testing-library/dom": "^10.4.2",
|
|
70
70
|
"@testing-library/jest-dom": "^7.0.1",
|
|
71
71
|
"@testing-library/react": "^16.3.3",
|