@webority/ui-react 0.11.7 → 0.12.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.
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import "@webority/ui-elements";
|
|
2
|
+
/**
|
|
3
|
+
* The cookie consent banner: accept all, reject all, or choose per category (analytics,
|
|
4
|
+
* functional, marketing; essential is always on).
|
|
5
|
+
*
|
|
6
|
+
* Wraps the shared `<wui-consent-banner>` element, which owns the buttons, the switches and the
|
|
7
|
+
* settings mode. This wrapper owns the wiring to `@webority/analytics`: it shows the banner when
|
|
8
|
+
* the visitor has not decided yet, and stores their choice with `saveConsent`, which also tells
|
|
9
|
+
* Google Consent Mode, PostHog and the marketing tags. Call `initConsent` from
|
|
10
|
+
* `@webority/analytics` before this renders; it throws otherwise, because a banner with no
|
|
11
|
+
* consent record behind it would ask a question nothing remembers.
|
|
12
|
+
*
|
|
13
|
+
* Any element carrying `data-consent-settings` reopens the banner with the switches showing, so
|
|
14
|
+
* a footer "Cookie settings" link needs no code: withdrawing consent must be as easy as giving it.
|
|
15
|
+
*
|
|
16
|
+
* ```jsx
|
|
17
|
+
* initConsent({ requiresOptIn, cookieDomain: ".example.com" }); // app bootstrap, once
|
|
18
|
+
*
|
|
19
|
+
* <AppConsentBanner policyHref="/cookie-policy" />
|
|
20
|
+
* <a href="#" data-consent-settings>Cookie settings</a>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @param {object} props
|
|
24
|
+
* @param {string} [props.heading='Cookies on this site'] Heading, and the dialog's accessible name.
|
|
25
|
+
* @param {string} [props.description] The explanation above the buttons.
|
|
26
|
+
* @param {string} [props.policyHref] Link to the cookie policy; no link when omitted.
|
|
27
|
+
* @param {string} [props.policyLabel='Cookie policy'] The policy link's text.
|
|
28
|
+
* @param {string} [props.analyticsDescription] What the analytics category covers.
|
|
29
|
+
* @param {string} [props.functionalDescription] What the functional category covers.
|
|
30
|
+
* @param {string} [props.marketingDescription] What the marketing category covers.
|
|
31
|
+
* @param {"bottom-left"|"bottom-right"} [props.position='bottom-left'] Which corner it pins to.
|
|
32
|
+
* @param {string} [props.className] Extra classes on the element.
|
|
33
|
+
* @param {import('react').CSSProperties} [props.style] Inline style; lands on the element with `className`.
|
|
34
|
+
*/
|
|
35
|
+
export default function AppConsentBanner({ heading, description, policyHref, policyLabel, analyticsDescription, functionalDescription, marketingDescription, position, className, style, ...rest }: {
|
|
36
|
+
heading?: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
policyHref?: string;
|
|
39
|
+
policyLabel?: string;
|
|
40
|
+
analyticsDescription?: string;
|
|
41
|
+
functionalDescription?: string;
|
|
42
|
+
marketingDescription?: string;
|
|
43
|
+
position?: "bottom-left" | "bottom-right";
|
|
44
|
+
className?: string;
|
|
45
|
+
style?: import('react').CSSProperties;
|
|
46
|
+
}): import("react").JSX.Element;
|
|
@@ -5,8 +5,9 @@ import "@webority/ui-elements";
|
|
|
5
5
|
* footer. Give it `steps` metadata and one panel per step as children (in order).
|
|
6
6
|
*
|
|
7
7
|
* Uncontrolled by default (it owns the current step); pass `active` + `onStepChange`
|
|
8
|
-
* to drive it. `beforeNext` gates advancing
|
|
9
|
-
* to block Next, e.g. until a form validates. An
|
|
8
|
+
* to drive it. `beforeNext` gates advancing and finishing: return `false` (or a rejecting
|
|
9
|
+
* promise) to block Next, or Finish on the last step, e.g. until a form validates. An
|
|
10
|
+
* `optional` step shows the Skip button.
|
|
10
11
|
*
|
|
11
12
|
* @param {object} props
|
|
12
13
|
* @param {{ key?: string, label: string, description?: string, optional?: boolean, icon?: string, status?: 'done'|'active'|'pending'|'error' }[]} props.steps
|
|
@@ -16,7 +17,7 @@ import "@webority/ui-elements";
|
|
|
16
17
|
* @param {(index: number, detail: { previous: number, reason: 'next'|'back'|'skip'|'step'|'set' }) => void} [props.onStepChange]
|
|
17
18
|
* @param {(detail: { index: number }) => void} [props.onFinish] Fired when Finish is pressed on the last step.
|
|
18
19
|
* @param {(index: number) => void} [props.onSkip] Fired when an optional step is skipped.
|
|
19
|
-
* @param {(index: number) => boolean | Promise<boolean>} [props.beforeNext] Validation gate run before advancing on Next
|
|
20
|
+
* @param {(index: number) => boolean | Promise<boolean>} [props.beforeNext] Validation gate run before advancing on Next and before Finish on the last step. Return false (or a rejecting promise) to block; the blocked step turns red.
|
|
20
21
|
* @param {(index: number) => void} [props.onInvalid] Fired when advancing is blocked by beforeNext (the step is marked invalid).
|
|
21
22
|
* @param {'steps'|'journey'|'icons'} [props.variant='steps'] Stepper header style — compact circles, the wide journey bar, or large connected icon badges with a "STEP n" eyebrow.
|
|
22
23
|
* @param {'primary'|'success'|'warning'|'danger'|'info'} [props.tone] Recolour the whole stepper accent (active fill, done rail, ring, done tint) to a semantic ramp. Unset keeps the variant's default (primary for steps/journey, success/green for icons). For any other colour, override the `--wui-step-accent` / `--wui-step-soft` CSS variables via `style` or a `className` instead.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export { default as AppChoiceChip } from "./components/AppChoiceChip.jsx";
|
|
|
18
18
|
export { default as AppColorField } from "./components/AppColorField.jsx";
|
|
19
19
|
export { default as AppCompareTable } from "./components/AppCompareTable.jsx";
|
|
20
20
|
export { default as AppConfirmDialog } from "./components/AppConfirmDialog.jsx";
|
|
21
|
+
export { default as AppConsentBanner } from "./components/AppConsentBanner.jsx";
|
|
21
22
|
export { default as AppCopyButton } from "./components/AppCopyButton.jsx";
|
|
22
23
|
export { default as AppDataTable } from "./components/AppDataTable.jsx";
|
|
23
24
|
export { default as AppDatePicker } from "./components/AppDatePicker.jsx";
|