@uninspired/cookie-banner 0.0.7 → 0.0.8

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.
@@ -1,26 +1,29 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
2
2
  import { useMemo, useState } from "react";
3
3
  import { cls, clx } from "../../utils/classes";
4
4
  import { Button } from "../Button";
5
5
  import { Text } from "../Text";
6
6
  import classes from "./Banner.module.css";
7
- import { BannerItem } from "../BannerItem";
8
- import { Root as AccordionRoot } from "@radix-ui/react-accordion";
7
+ import {} from "../BannerItem";
8
+ // import { BannerItem, type BannerItemOptions } from "../BannerItem";
9
+ // import { Root as AccordionRoot } from "@radix-ui/react-accordion";
9
10
  import { ChevronUp } from "lucide-react";
10
11
  import { SelectionProvider, useSelection, } from "../../contexts/SelectionContext";
11
12
  import { Root as DialogRoot, Content as DialogContent, Title as DialogTitle, Description as DialogDescription, Close as DialogClose, } from "@radix-ui/react-dialog";
12
- import { Root as CollapsibleRoot, Trigger as CollapsibleTrigger, Content as CollapsibleContent, } from "@radix-ui/react-collapsible";
13
+ import { Root as CollapsibleRoot, Trigger as CollapsibleTrigger,
14
+ // Content as CollapsibleContent,
15
+ } from "@radix-ui/react-collapsible";
13
16
  import "../../styles/variables.css";
14
- const BannerContent = ({ noTarget = true, heading = "We use cookies.", subheading = "Please define your selection below.", selectLabel = "Select", hideLabel = "Hide", saveLabel = "Save selection", declineLabel = "Decline all", defaultSettingsOpen = true, privacyPolicy, items, }) => {
17
+ const BannerContent = ({ noTarget = true, heading = "We use cookies.", subheading = "Please define your selection below.", selectLabel = "Select", hideLabel = "Hide", saveLabel = "Save selection", declineLabel = "Decline all", defaultSettingsOpen = true, privacyPolicy,
18
+ // items,
19
+ }) => {
15
20
  const { onSave, onDeclineAll, selectionTaken } = useSelection();
16
- const [openItem, setOpenItem] = useState(undefined);
21
+ // const [openItem, setOpenItem] = useState<string | undefined>(undefined);
17
22
  const [settingsOpen, setSettingsOpen] = useState(defaultSettingsOpen);
18
23
  return (_jsx(DialogRoot, { open: !selectionTaken, children: _jsx(DialogContent, { className: cls(classes.root, noTarget ? classes.noTarget : ""), children: _jsxs(CollapsibleRoot, { open: settingsOpen, onOpenChange: setSettingsOpen, className: classes.collapsible, children: [_jsxs("div", { className: classes.header, children: [_jsxs("div", { className: classes.heading, children: [_jsx(DialogTitle, { asChild: true, children: _jsx(Text, { weight: "bold", children: heading }) }), _jsx(DialogDescription, { asChild: true, children: _jsx(Text, { size: "caption", color: "muted", children: subheading }) })] }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", children: [settingsOpen ? hideLabel : selectLabel, "\u00A0", _jsx(ChevronUp, { size: 12, className: clx({
19
24
  [classes.chevron]: true,
20
25
  [classes.open]: settingsOpen,
21
- }) })] }) })] }), _jsx(CollapsibleContent, { className: clx({
22
- [classes.settings]: true,
23
- }), children: _jsx(AccordionRoot, { type: "single", collapsible: true, value: openItem, onValueChange: setOpenItem, children: _jsx(_Fragment, { children: items.map((item) => (_jsx(BannerItem, { ...item, openItem: openItem }, item.value))) }) }) }), _jsxs("div", { className: classes.footer, children: [_jsx("div", { className: classes.legal, children: privacyPolicy && (_jsx(Text, { size: "caption", children: _jsx("a", { href: privacyPolicy.url, target: "_blank", children: privacyPolicy.label }) })) }), _jsxs("div", { className: classes.actions, children: [_jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "neutral", onClick: () => onDeclineAll(), children: declineLabel }) }), _jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "brand", onClick: () => onSave(), children: saveLabel }) })] })] })] }) }) }));
26
+ }) })] }) })] }), _jsxs("div", { className: classes.footer, children: [_jsx("div", { className: classes.legal, children: privacyPolicy && (_jsx(Text, { size: "caption", children: _jsx("a", { href: privacyPolicy.url, target: "_blank", children: privacyPolicy.label }) })) }), _jsxs("div", { className: classes.actions, children: [_jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "neutral", onClick: () => onDeclineAll(), children: declineLabel }) }), _jsx(DialogClose, { asChild: true, children: _jsx(Button, { variant: "brand", onClick: () => onSave(), children: saveLabel }) })] })] })] }) }) }));
24
27
  };
25
28
  export const Banner = ({ localStorageKey = "cb-selection", items, ...rest }) => {
26
29
  const selectionItems = useMemo(() => items