@uninspired/cookie-banner 0.0.6 → 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.
@@ -25,27 +25,27 @@ function cls(...classes2) {
25
25
  function clx(classes2) {
26
26
  return Object.entries(classes2).filter(([, value]) => value).map(([key]) => key).join(" ");
27
27
  }
28
- const root$4 = "_root_hw69b_1";
28
+ const root$2 = "_root_hw69b_1";
29
29
  const neutral = "_neutral_hw69b_17";
30
30
  const brand = "_brand_hw69b_30";
31
31
  const ghost = "_ghost_hw69b_43";
32
- const classes$4 = {
33
- root: root$4,
32
+ const classes$2 = {
33
+ root: root$2,
34
34
  neutral,
35
35
  brand,
36
36
  ghost
37
37
  };
38
38
  const Button = ({ variant = "neutral", ...rest }) => {
39
- return /* @__PURE__ */ u("button", { className: cls(classes$4.root, classes$4[variant]), ...rest });
39
+ return /* @__PURE__ */ u("button", { className: cls(classes$2.root, classes$2[variant]), ...rest });
40
40
  };
41
- const root$3 = "_root_14l5h_1";
41
+ const root$1 = "_root_14l5h_1";
42
42
  const muted = "_muted_14l5h_4";
43
43
  const body = "_body_14l5h_8";
44
44
  const normal = "_normal_14l5h_14";
45
45
  const bold = "_bold_14l5h_18";
46
46
  const caption = "_caption_14l5h_23";
47
- const classes$3 = {
48
- root: root$3,
47
+ const classes$1 = {
48
+ root: root$1,
49
49
  muted,
50
50
  body,
51
51
  normal,
@@ -66,55 +66,37 @@ const Text = ({
66
66
  Component,
67
67
  {
68
68
  className: cls(
69
- classes$3.root,
70
- classes$3[size],
71
- classes$3[weight],
72
- classes$3[color]
69
+ classes$1.root,
70
+ classes$1[size],
71
+ classes$1[weight],
72
+ classes$1[color]
73
73
  ),
74
74
  ...rest
75
75
  }
76
76
  )
77
77
  );
78
78
  };
79
- const root$2 = "_root_1wsw7_42";
79
+ const root = "_root_1wsw7_42";
80
80
  const noTarget = "_noTarget_1wsw7_53";
81
81
  const collapsible = "_collapsible_1wsw7_62";
82
- const header$1 = "_header_1wsw7_65";
82
+ const header = "_header_1wsw7_65";
83
83
  const heading = "_heading_1wsw7_72";
84
- const chevron$1 = "_chevron_1wsw7_78";
85
- const open$1 = "_open_1wsw7_83";
86
- const settings = "_settings_1wsw7_89";
84
+ const chevron = "_chevron_1wsw7_78";
85
+ const open = "_open_1wsw7_83";
87
86
  const footer = "_footer_1wsw7_103";
88
87
  const legal = "_legal_1wsw7_110";
89
- const actions$1 = "_actions_1wsw7_113";
90
- const classes$2 = {
91
- root: root$2,
88
+ const actions = "_actions_1wsw7_113";
89
+ const classes = {
90
+ root,
92
91
  noTarget,
93
92
  collapsible,
94
- header: header$1,
95
- heading,
96
- chevron: chevron$1,
97
- open: open$1,
98
- settings,
99
- footer,
100
- legal,
101
- actions: actions$1
102
- };
103
- const root$1 = "_root_mqtha_19";
104
- const header = "_header_mqtha_24";
105
- const label = "_label_mqtha_33";
106
- const actions = "_actions_mqtha_39";
107
- const chevron = "_chevron_mqtha_45";
108
- const open = "_open_mqtha_51";
109
- const description = "_description_mqtha_58";
110
- const classes$1 = {
111
- root: root$1,
112
93
  header,
113
- label,
114
- actions,
94
+ heading,
115
95
  chevron,
116
96
  open,
117
- description
97
+ footer,
98
+ legal,
99
+ actions
118
100
  };
119
101
  function $constructor(name, initializer2, params) {
120
102
  function init(inst, def) {
@@ -2172,68 +2154,6 @@ function getElementRef$1(element) {
2172
2154
  }
2173
2155
  return element.props.ref || element.ref;
2174
2156
  }
2175
- function createCollection(name) {
2176
- const PROVIDER_NAME = name + "CollectionProvider";
2177
- const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
2178
- const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
2179
- PROVIDER_NAME,
2180
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
2181
- );
2182
- const CollectionProvider = (props) => {
2183
- const { scope, children } = props;
2184
- const ref = React__default.useRef(null);
2185
- const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
2186
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
2187
- };
2188
- CollectionProvider.displayName = PROVIDER_NAME;
2189
- const COLLECTION_SLOT_NAME = name + "CollectionSlot";
2190
- const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
2191
- const CollectionSlot = React__default.forwardRef(
2192
- (props, forwardedRef) => {
2193
- const { scope, children } = props;
2194
- const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
2195
- const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
2196
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionSlotImpl, { ref: composedRefs, children });
2197
- }
2198
- );
2199
- CollectionSlot.displayName = COLLECTION_SLOT_NAME;
2200
- const ITEM_SLOT_NAME = name + "CollectionItemSlot";
2201
- const ITEM_DATA_ATTR = "data-radix-collection-item";
2202
- const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
2203
- const CollectionItemSlot = React__default.forwardRef(
2204
- (props, forwardedRef) => {
2205
- const { scope, children, ...itemData } = props;
2206
- const ref = React__default.useRef(null);
2207
- const composedRefs = useComposedRefs(forwardedRef, ref);
2208
- const context = useCollectionContext(ITEM_SLOT_NAME, scope);
2209
- React__default.useEffect(() => {
2210
- context.itemMap.set(ref, { ref, ...itemData });
2211
- return () => void context.itemMap.delete(ref);
2212
- });
2213
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
2214
- }
2215
- );
2216
- CollectionItemSlot.displayName = ITEM_SLOT_NAME;
2217
- function useCollection2(scope) {
2218
- const context = useCollectionContext(name + "CollectionConsumer", scope);
2219
- const getItems = React__default.useCallback(() => {
2220
- const collectionNode = context.collectionRef.current;
2221
- if (!collectionNode) return [];
2222
- const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
2223
- const items = Array.from(context.itemMap.values());
2224
- const orderedItems = items.sort(
2225
- (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
2226
- );
2227
- return orderedItems;
2228
- }, [context.collectionRef, context.itemMap]);
2229
- return getItems;
2230
- }
2231
- return [
2232
- { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
2233
- useCollection2,
2234
- createCollectionScope2
2235
- ];
2236
- }
2237
2157
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
2238
2158
  return function handleEvent(event) {
2239
2159
  originalEventHandler?.(event);
@@ -2475,7 +2395,7 @@ function useId(deterministicId) {
2475
2395
  return deterministicId || (id ? `radix-${id}` : "");
2476
2396
  }
2477
2397
  var COLLAPSIBLE_NAME = "Collapsible";
2478
- var [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);
2398
+ var [createCollapsibleContext] = createContextScope(COLLAPSIBLE_NAME);
2479
2399
  var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
2480
2400
  var Collapsible = React.forwardRef(
2481
2401
  (props, forwardedRef) => {
@@ -2504,7 +2424,7 @@ var Collapsible = React.forwardRef(
2504
2424
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2505
2425
  Primitive.div,
2506
2426
  {
2507
- "data-state": getState$3(open2),
2427
+ "data-state": getState$1(open2),
2508
2428
  "data-disabled": disabled ? "" : void 0,
2509
2429
  ...collapsibleProps,
2510
2430
  ref: forwardedRef
@@ -2515,18 +2435,18 @@ var Collapsible = React.forwardRef(
2515
2435
  }
2516
2436
  );
2517
2437
  Collapsible.displayName = COLLAPSIBLE_NAME;
2518
- var TRIGGER_NAME$2 = "CollapsibleTrigger";
2438
+ var TRIGGER_NAME$1 = "CollapsibleTrigger";
2519
2439
  var CollapsibleTrigger = React.forwardRef(
2520
2440
  (props, forwardedRef) => {
2521
2441
  const { __scopeCollapsible, ...triggerProps } = props;
2522
- const context = useCollapsibleContext(TRIGGER_NAME$2, __scopeCollapsible);
2442
+ const context = useCollapsibleContext(TRIGGER_NAME$1, __scopeCollapsible);
2523
2443
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2524
2444
  Primitive.button,
2525
2445
  {
2526
2446
  type: "button",
2527
2447
  "aria-controls": context.contentId,
2528
2448
  "aria-expanded": context.open || false,
2529
- "data-state": getState$3(context.open),
2449
+ "data-state": getState$1(context.open),
2530
2450
  "data-disabled": context.disabled ? "" : void 0,
2531
2451
  disabled: context.disabled,
2532
2452
  ...triggerProps,
@@ -2536,19 +2456,19 @@ var CollapsibleTrigger = React.forwardRef(
2536
2456
  );
2537
2457
  }
2538
2458
  );
2539
- CollapsibleTrigger.displayName = TRIGGER_NAME$2;
2540
- var CONTENT_NAME$2 = "CollapsibleContent";
2459
+ CollapsibleTrigger.displayName = TRIGGER_NAME$1;
2460
+ var CONTENT_NAME$1 = "CollapsibleContent";
2541
2461
  var CollapsibleContent = React.forwardRef(
2542
2462
  (props, forwardedRef) => {
2543
2463
  const { forceMount, ...contentProps } = props;
2544
- const context = useCollapsibleContext(CONTENT_NAME$2, props.__scopeCollapsible);
2464
+ const context = useCollapsibleContext(CONTENT_NAME$1, props.__scopeCollapsible);
2545
2465
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
2546
2466
  }
2547
2467
  );
2548
- CollapsibleContent.displayName = CONTENT_NAME$2;
2468
+ CollapsibleContent.displayName = CONTENT_NAME$1;
2549
2469
  var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
2550
2470
  const { __scopeCollapsible, present, children, ...contentProps } = props;
2551
- const context = useCollapsibleContext(CONTENT_NAME$2, __scopeCollapsible);
2471
+ const context = useCollapsibleContext(CONTENT_NAME$1, __scopeCollapsible);
2552
2472
  const [isPresent, setIsPresent] = React.useState(present);
2553
2473
  const ref = React.useRef(null);
2554
2474
  const composedRefs = useComposedRefs(forwardedRef, ref);
@@ -2585,7 +2505,7 @@ var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
2585
2505
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2586
2506
  Primitive.div,
2587
2507
  {
2588
- "data-state": getState$3(context.open),
2508
+ "data-state": getState$1(context.open),
2589
2509
  "data-disabled": context.disabled ? "" : void 0,
2590
2510
  id: context.contentId,
2591
2511
  hidden: !isOpen,
@@ -2600,307 +2520,11 @@ var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
2600
2520
  }
2601
2521
  );
2602
2522
  });
2603
- function getState$3(open2) {
2523
+ function getState$1(open2) {
2604
2524
  return open2 ? "open" : "closed";
2605
2525
  }
2606
- var Root$2 = Collapsible;
2526
+ var Root$1 = Collapsible;
2607
2527
  var Trigger = CollapsibleTrigger;
2608
- var Content$1 = CollapsibleContent;
2609
- var DirectionContext = React.createContext(void 0);
2610
- function useDirection(localDir) {
2611
- const globalDir = React.useContext(DirectionContext);
2612
- return localDir || globalDir || "ltr";
2613
- }
2614
- var ACCORDION_NAME = "Accordion";
2615
- var ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
2616
- var [Collection, useCollection, createCollectionScope] = createCollection(ACCORDION_NAME);
2617
- var [createAccordionContext] = createContextScope(ACCORDION_NAME, [
2618
- createCollectionScope,
2619
- createCollapsibleScope
2620
- ]);
2621
- var useCollapsibleScope = createCollapsibleScope();
2622
- var Accordion = React__default.forwardRef(
2623
- (props, forwardedRef) => {
2624
- const { type, ...accordionProps } = props;
2625
- const singleProps = accordionProps;
2626
- const multipleProps = accordionProps;
2627
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.Provider, { scope: props.__scopeAccordion, children: type === "multiple" ? /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionImplMultiple, { ...multipleProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionImplSingle, { ...singleProps, ref: forwardedRef }) });
2628
- }
2629
- );
2630
- Accordion.displayName = ACCORDION_NAME;
2631
- var [AccordionValueProvider, useAccordionValueContext] = createAccordionContext(ACCORDION_NAME);
2632
- var [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(
2633
- ACCORDION_NAME,
2634
- { collapsible: false }
2635
- );
2636
- var AccordionImplSingle = React__default.forwardRef(
2637
- (props, forwardedRef) => {
2638
- const {
2639
- value: valueProp,
2640
- defaultValue,
2641
- onValueChange = () => {
2642
- },
2643
- collapsible: collapsible2 = false,
2644
- ...accordionSingleProps
2645
- } = props;
2646
- const [value, setValue] = useControllableState({
2647
- prop: valueProp,
2648
- defaultProp: defaultValue ?? "",
2649
- onChange: onValueChange,
2650
- caller: ACCORDION_NAME
2651
- });
2652
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2653
- AccordionValueProvider,
2654
- {
2655
- scope: props.__scopeAccordion,
2656
- value: React__default.useMemo(() => value ? [value] : [], [value]),
2657
- onItemOpen: setValue,
2658
- onItemClose: React__default.useCallback(() => collapsible2 && setValue(""), [collapsible2, setValue]),
2659
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: collapsible2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionImpl, { ...accordionSingleProps, ref: forwardedRef }) })
2660
- }
2661
- );
2662
- }
2663
- );
2664
- var AccordionImplMultiple = React__default.forwardRef((props, forwardedRef) => {
2665
- const {
2666
- value: valueProp,
2667
- defaultValue,
2668
- onValueChange = () => {
2669
- },
2670
- ...accordionMultipleProps
2671
- } = props;
2672
- const [value, setValue] = useControllableState({
2673
- prop: valueProp,
2674
- defaultProp: defaultValue ?? [],
2675
- onChange: onValueChange,
2676
- caller: ACCORDION_NAME
2677
- });
2678
- const handleItemOpen = React__default.useCallback(
2679
- (itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
2680
- [setValue]
2681
- );
2682
- const handleItemClose = React__default.useCallback(
2683
- (itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
2684
- [setValue]
2685
- );
2686
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2687
- AccordionValueProvider,
2688
- {
2689
- scope: props.__scopeAccordion,
2690
- value,
2691
- onItemOpen: handleItemOpen,
2692
- onItemClose: handleItemClose,
2693
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionImpl, { ...accordionMultipleProps, ref: forwardedRef }) })
2694
- }
2695
- );
2696
- });
2697
- var [AccordionImplProvider, useAccordionContext] = createAccordionContext(ACCORDION_NAME);
2698
- var AccordionImpl = React__default.forwardRef(
2699
- (props, forwardedRef) => {
2700
- const { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props;
2701
- const accordionRef = React__default.useRef(null);
2702
- const composedRefs = useComposedRefs(accordionRef, forwardedRef);
2703
- const getItems = useCollection(__scopeAccordion);
2704
- const direction = useDirection(dir);
2705
- const isDirectionLTR = direction === "ltr";
2706
- const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {
2707
- if (!ACCORDION_KEYS.includes(event.key)) return;
2708
- const target = event.target;
2709
- const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);
2710
- const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);
2711
- const triggerCount = triggerCollection.length;
2712
- if (triggerIndex === -1) return;
2713
- event.preventDefault();
2714
- let nextIndex = triggerIndex;
2715
- const homeIndex = 0;
2716
- const endIndex = triggerCount - 1;
2717
- const moveNext = () => {
2718
- nextIndex = triggerIndex + 1;
2719
- if (nextIndex > endIndex) {
2720
- nextIndex = homeIndex;
2721
- }
2722
- };
2723
- const movePrev = () => {
2724
- nextIndex = triggerIndex - 1;
2725
- if (nextIndex < homeIndex) {
2726
- nextIndex = endIndex;
2727
- }
2728
- };
2729
- switch (event.key) {
2730
- case "Home":
2731
- nextIndex = homeIndex;
2732
- break;
2733
- case "End":
2734
- nextIndex = endIndex;
2735
- break;
2736
- case "ArrowRight":
2737
- if (orientation === "horizontal") {
2738
- if (isDirectionLTR) {
2739
- moveNext();
2740
- } else {
2741
- movePrev();
2742
- }
2743
- }
2744
- break;
2745
- case "ArrowDown":
2746
- if (orientation === "vertical") {
2747
- moveNext();
2748
- }
2749
- break;
2750
- case "ArrowLeft":
2751
- if (orientation === "horizontal") {
2752
- if (isDirectionLTR) {
2753
- movePrev();
2754
- } else {
2755
- moveNext();
2756
- }
2757
- }
2758
- break;
2759
- case "ArrowUp":
2760
- if (orientation === "vertical") {
2761
- movePrev();
2762
- }
2763
- break;
2764
- }
2765
- const clampedIndex = nextIndex % triggerCount;
2766
- triggerCollection[clampedIndex].ref.current?.focus();
2767
- });
2768
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2769
- AccordionImplProvider,
2770
- {
2771
- scope: __scopeAccordion,
2772
- disabled,
2773
- direction: dir,
2774
- orientation,
2775
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.Slot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2776
- Primitive.div,
2777
- {
2778
- ...accordionProps,
2779
- "data-orientation": orientation,
2780
- ref: composedRefs,
2781
- onKeyDown: disabled ? void 0 : handleKeyDown
2782
- }
2783
- ) })
2784
- }
2785
- );
2786
- }
2787
- );
2788
- var ITEM_NAME = "AccordionItem";
2789
- var [AccordionItemProvider, useAccordionItemContext] = createAccordionContext(ITEM_NAME);
2790
- var AccordionItem = React__default.forwardRef(
2791
- (props, forwardedRef) => {
2792
- const { __scopeAccordion, value, ...accordionItemProps } = props;
2793
- const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);
2794
- const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);
2795
- const collapsibleScope = useCollapsibleScope(__scopeAccordion);
2796
- const triggerId = useId();
2797
- const open2 = value && valueContext.value.includes(value) || false;
2798
- const disabled = accordionContext.disabled || props.disabled;
2799
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2800
- AccordionItemProvider,
2801
- {
2802
- scope: __scopeAccordion,
2803
- open: open2,
2804
- disabled,
2805
- triggerId,
2806
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2807
- Root$2,
2808
- {
2809
- "data-orientation": accordionContext.orientation,
2810
- "data-state": getState$2(open2),
2811
- ...collapsibleScope,
2812
- ...accordionItemProps,
2813
- ref: forwardedRef,
2814
- disabled,
2815
- open: open2,
2816
- onOpenChange: (open22) => {
2817
- if (open22) {
2818
- valueContext.onItemOpen(value);
2819
- } else {
2820
- valueContext.onItemClose(value);
2821
- }
2822
- }
2823
- }
2824
- )
2825
- }
2826
- );
2827
- }
2828
- );
2829
- AccordionItem.displayName = ITEM_NAME;
2830
- var HEADER_NAME = "AccordionHeader";
2831
- var AccordionHeader = React__default.forwardRef(
2832
- (props, forwardedRef) => {
2833
- const { __scopeAccordion, ...headerProps } = props;
2834
- const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
2835
- const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);
2836
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2837
- Primitive.h3,
2838
- {
2839
- "data-orientation": accordionContext.orientation,
2840
- "data-state": getState$2(itemContext.open),
2841
- "data-disabled": itemContext.disabled ? "" : void 0,
2842
- ...headerProps,
2843
- ref: forwardedRef
2844
- }
2845
- );
2846
- }
2847
- );
2848
- AccordionHeader.displayName = HEADER_NAME;
2849
- var TRIGGER_NAME$1 = "AccordionTrigger";
2850
- var AccordionTrigger = React__default.forwardRef(
2851
- (props, forwardedRef) => {
2852
- const { __scopeAccordion, ...triggerProps } = props;
2853
- const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
2854
- const itemContext = useAccordionItemContext(TRIGGER_NAME$1, __scopeAccordion);
2855
- const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME$1, __scopeAccordion);
2856
- const collapsibleScope = useCollapsibleScope(__scopeAccordion);
2857
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.ItemSlot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2858
- Trigger,
2859
- {
2860
- "aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
2861
- "data-orientation": accordionContext.orientation,
2862
- id: itemContext.triggerId,
2863
- ...collapsibleScope,
2864
- ...triggerProps,
2865
- ref: forwardedRef
2866
- }
2867
- ) });
2868
- }
2869
- );
2870
- AccordionTrigger.displayName = TRIGGER_NAME$1;
2871
- var CONTENT_NAME$1 = "AccordionContent";
2872
- var AccordionContent = React__default.forwardRef(
2873
- (props, forwardedRef) => {
2874
- const { __scopeAccordion, ...contentProps } = props;
2875
- const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
2876
- const itemContext = useAccordionItemContext(CONTENT_NAME$1, __scopeAccordion);
2877
- const collapsibleScope = useCollapsibleScope(__scopeAccordion);
2878
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2879
- Content$1,
2880
- {
2881
- role: "region",
2882
- "aria-labelledby": itemContext.triggerId,
2883
- "data-orientation": accordionContext.orientation,
2884
- ...collapsibleScope,
2885
- ...contentProps,
2886
- ref: forwardedRef,
2887
- style: {
2888
- ["--radix-accordion-content-height"]: "var(--radix-collapsible-content-height)",
2889
- ["--radix-accordion-content-width"]: "var(--radix-collapsible-content-width)",
2890
- ...props.style
2891
- }
2892
- }
2893
- );
2894
- }
2895
- );
2896
- AccordionContent.displayName = CONTENT_NAME$1;
2897
- function getState$2(open2) {
2898
- return open2 ? "open" : "closed";
2899
- }
2900
- var Root2 = Accordion;
2901
- var Item = AccordionItem;
2902
- var Trigger2 = AccordionTrigger;
2903
- var Content2 = AccordionContent;
2904
2528
  const mergeClasses = (...classes2) => classes2.filter((className, index, array) => {
2905
2529
  return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
2906
2530
  }).join(" ").trim();
@@ -2977,207 +2601,8 @@ const createLucideIcon = (iconName, iconNode) => {
2977
2601
  Component.displayName = toPascalCase(iconName);
2978
2602
  return Component;
2979
2603
  };
2980
- const __iconNode$1 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
2981
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$1);
2982
2604
  const __iconNode = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
2983
2605
  const ChevronUp = createLucideIcon("chevron-up", __iconNode);
2984
- function usePrevious(value) {
2985
- const ref = React.useRef({ value, previous: value });
2986
- return React.useMemo(() => {
2987
- if (ref.current.value !== value) {
2988
- ref.current.previous = ref.current.value;
2989
- ref.current.value = value;
2990
- }
2991
- return ref.current.previous;
2992
- }, [value]);
2993
- }
2994
- function useSize(element) {
2995
- const [size, setSize] = React.useState(void 0);
2996
- useLayoutEffect2(() => {
2997
- if (element) {
2998
- setSize({ width: element.offsetWidth, height: element.offsetHeight });
2999
- const resizeObserver = new ResizeObserver((entries) => {
3000
- if (!Array.isArray(entries)) {
3001
- return;
3002
- }
3003
- if (!entries.length) {
3004
- return;
3005
- }
3006
- const entry = entries[0];
3007
- let width;
3008
- let height;
3009
- if ("borderBoxSize" in entry) {
3010
- const borderSizeEntry = entry["borderBoxSize"];
3011
- const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
3012
- width = borderSize["inlineSize"];
3013
- height = borderSize["blockSize"];
3014
- } else {
3015
- width = element.offsetWidth;
3016
- height = element.offsetHeight;
3017
- }
3018
- setSize({ width, height });
3019
- });
3020
- resizeObserver.observe(element, { box: "border-box" });
3021
- return () => resizeObserver.unobserve(element);
3022
- } else {
3023
- setSize(void 0);
3024
- }
3025
- }, [element]);
3026
- return size;
3027
- }
3028
- var SWITCH_NAME = "Switch";
3029
- var [createSwitchContext] = createContextScope(SWITCH_NAME);
3030
- var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
3031
- var Switch$1 = React.forwardRef(
3032
- (props, forwardedRef) => {
3033
- const {
3034
- __scopeSwitch,
3035
- name,
3036
- checked: checkedProp,
3037
- defaultChecked,
3038
- required,
3039
- disabled,
3040
- value = "on",
3041
- onCheckedChange,
3042
- form,
3043
- ...switchProps
3044
- } = props;
3045
- const [button, setButton] = React.useState(null);
3046
- const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
3047
- const hasConsumerStoppedPropagationRef = React.useRef(false);
3048
- const isFormControl = button ? form || !!button.closest("form") : true;
3049
- const [checked, setChecked] = useControllableState({
3050
- prop: checkedProp,
3051
- defaultProp: defaultChecked ?? false,
3052
- onChange: onCheckedChange,
3053
- caller: SWITCH_NAME
3054
- });
3055
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
3056
- /* @__PURE__ */ jsxRuntimeExports.jsx(
3057
- Primitive.button,
3058
- {
3059
- type: "button",
3060
- role: "switch",
3061
- "aria-checked": checked,
3062
- "aria-required": required,
3063
- "data-state": getState$1(checked),
3064
- "data-disabled": disabled ? "" : void 0,
3065
- disabled,
3066
- value,
3067
- ...switchProps,
3068
- ref: composedRefs,
3069
- onClick: composeEventHandlers(props.onClick, (event) => {
3070
- setChecked((prevChecked) => !prevChecked);
3071
- if (isFormControl) {
3072
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
3073
- if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
3074
- }
3075
- })
3076
- }
3077
- ),
3078
- isFormControl && /* @__PURE__ */ jsxRuntimeExports.jsx(
3079
- SwitchBubbleInput,
3080
- {
3081
- control: button,
3082
- bubbles: !hasConsumerStoppedPropagationRef.current,
3083
- name,
3084
- value,
3085
- checked,
3086
- required,
3087
- disabled,
3088
- form,
3089
- style: { transform: "translateX(-100%)" }
3090
- }
3091
- )
3092
- ] });
3093
- }
3094
- );
3095
- Switch$1.displayName = SWITCH_NAME;
3096
- var THUMB_NAME = "SwitchThumb";
3097
- var SwitchThumb = React.forwardRef(
3098
- (props, forwardedRef) => {
3099
- const { __scopeSwitch, ...thumbProps } = props;
3100
- const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
3101
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3102
- Primitive.span,
3103
- {
3104
- "data-state": getState$1(context.checked),
3105
- "data-disabled": context.disabled ? "" : void 0,
3106
- ...thumbProps,
3107
- ref: forwardedRef
3108
- }
3109
- );
3110
- }
3111
- );
3112
- SwitchThumb.displayName = THUMB_NAME;
3113
- var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
3114
- var SwitchBubbleInput = React.forwardRef(
3115
- ({
3116
- __scopeSwitch,
3117
- control,
3118
- checked,
3119
- bubbles = true,
3120
- ...props
3121
- }, forwardedRef) => {
3122
- const ref = React.useRef(null);
3123
- const composedRefs = useComposedRefs(ref, forwardedRef);
3124
- const prevChecked = usePrevious(checked);
3125
- const controlSize = useSize(control);
3126
- React.useEffect(() => {
3127
- const input = ref.current;
3128
- if (!input) return;
3129
- const inputProto = window.HTMLInputElement.prototype;
3130
- const descriptor = Object.getOwnPropertyDescriptor(
3131
- inputProto,
3132
- "checked"
3133
- );
3134
- const setChecked = descriptor.set;
3135
- if (prevChecked !== checked && setChecked) {
3136
- const event = new Event("click", { bubbles });
3137
- setChecked.call(input, checked);
3138
- input.dispatchEvent(event);
3139
- }
3140
- }, [prevChecked, checked, bubbles]);
3141
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3142
- "input",
3143
- {
3144
- type: "checkbox",
3145
- "aria-hidden": true,
3146
- defaultChecked: checked,
3147
- ...props,
3148
- tabIndex: -1,
3149
- ref: composedRefs,
3150
- style: {
3151
- ...props.style,
3152
- ...controlSize,
3153
- position: "absolute",
3154
- pointerEvents: "none",
3155
- opacity: 0,
3156
- margin: 0
3157
- }
3158
- }
3159
- );
3160
- }
3161
- );
3162
- SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
3163
- function getState$1(checked) {
3164
- return checked ? "checked" : "unchecked";
3165
- }
3166
- var Root$1 = Switch$1;
3167
- var Thumb = SwitchThumb;
3168
- const root = "_root_dibqz_1";
3169
- const thumb = "_thumb_dibqz_38";
3170
- const classes = {
3171
- root,
3172
- "switch": "_switch_dibqz_8",
3173
- thumb
3174
- };
3175
- const Switch = ({ label: label2, id, ...rest }) => {
3176
- return /* @__PURE__ */ u("div", { className: classes.root, children: [
3177
- label2 && /* @__PURE__ */ u(Text, { className: classes.label, as: "label", htmlFor: id, children: label2 }),
3178
- /* @__PURE__ */ u(Root$1, { className: classes.switch, ...rest, children: /* @__PURE__ */ u(Thumb, { className: classes.thumb }) })
3179
- ] });
3180
- };
3181
2606
  const selectionSchema = /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ boolean());
3182
2607
  const SelectionContext = createContext(null);
3183
2608
  const SelectionProvider = ({
@@ -3298,68 +2723,6 @@ function useSelection() {
3298
2723
  }
3299
2724
  return context;
3300
2725
  }
3301
- const BannerItem = ({
3302
- value,
3303
- label: label2,
3304
- sublabel,
3305
- required = false,
3306
- description: description2,
3307
- openItem
3308
- }) => {
3309
- const { toggleSelection, selection } = useSelection();
3310
- const selected = useMemo(
3311
- () => selection?.[value] ?? false,
3312
- [selection, value]
3313
- );
3314
- useEffect(() => {
3315
- toggleSelection(value, selected);
3316
- }, [value, selected]);
3317
- const checked = useMemo(
3318
- () => required ? true : selected,
3319
- [required, selected]
3320
- );
3321
- const onCheckedChange = useMemo(
3322
- () => (checked2) => required ? () => {
3323
- } : toggleSelection(value, checked2),
3324
- [required, toggleSelection, value]
3325
- );
3326
- const disabled = useMemo(() => required, [required]);
3327
- return /* @__PURE__ */ u(Item, { value, className: classes$1.root, children: [
3328
- /* @__PURE__ */ u("div", { className: classes$1.header, children: [
3329
- /* @__PURE__ */ u(Trigger2, { asChild: true, children: /* @__PURE__ */ u("div", { className: classes$1.label, children: [
3330
- /* @__PURE__ */ u(Text, { weight: "bold", children: label2 }),
3331
- sublabel && /* @__PURE__ */ u(Text, { size: "caption", color: "muted", children: sublabel })
3332
- ] }) }),
3333
- /* @__PURE__ */ u("div", { className: classes$1.actions, children: [
3334
- /* @__PURE__ */ u(
3335
- Switch,
3336
- {
3337
- checked,
3338
- onCheckedChange,
3339
- disabled
3340
- }
3341
- ),
3342
- /* @__PURE__ */ u(Trigger2, { asChild: true, children: /* @__PURE__ */ u(
3343
- ChevronDown,
3344
- {
3345
- size: 16,
3346
- className: clx({
3347
- [classes$1.chevron]: true,
3348
- [classes$1.open]: openItem === value
3349
- })
3350
- }
3351
- ) })
3352
- ] })
3353
- ] }),
3354
- description2 && /* @__PURE__ */ u(Content2, { className: classes$1.description, children: /* @__PURE__ */ u(
3355
- Text,
3356
- {
3357
- size: "caption",
3358
- dangerouslySetInnerHTML: { __html: description2 }
3359
- }
3360
- ) })
3361
- ] });
3362
- };
3363
2726
  function useCallbackRef$1(callback) {
3364
2727
  const callbackRef = React.useRef(callback);
3365
2728
  React.useEffect(() => {
@@ -4881,25 +4244,24 @@ const BannerContent = ({
4881
4244
  saveLabel = "Save selection",
4882
4245
  declineLabel = "Decline all",
4883
4246
  defaultSettingsOpen = true,
4884
- privacyPolicy,
4885
- items
4247
+ privacyPolicy
4248
+ // items,
4886
4249
  }) => {
4887
4250
  const { onSave, onDeclineAll, selectionTaken } = useSelection();
4888
- const [openItem, setOpenItem] = useState(void 0);
4889
4251
  const [settingsOpen, setSettingsOpen] = useState(defaultSettingsOpen);
4890
4252
  return /* @__PURE__ */ u(Root, { open: !selectionTaken, children: /* @__PURE__ */ u(
4891
4253
  Content,
4892
4254
  {
4893
- className: cls(classes$2.root, noTarget2 ? classes$2.noTarget : ""),
4255
+ className: cls(classes.root, noTarget2 ? classes.noTarget : ""),
4894
4256
  children: /* @__PURE__ */ u(
4895
- Root$2,
4257
+ Root$1,
4896
4258
  {
4897
4259
  open: settingsOpen,
4898
4260
  onOpenChange: setSettingsOpen,
4899
- className: classes$2.collapsible,
4261
+ className: classes.collapsible,
4900
4262
  children: [
4901
- /* @__PURE__ */ u("div", { className: classes$2.header, children: [
4902
- /* @__PURE__ */ u("div", { className: classes$2.heading, children: [
4263
+ /* @__PURE__ */ u("div", { className: classes.header, children: [
4264
+ /* @__PURE__ */ u("div", { className: classes.heading, children: [
4903
4265
  /* @__PURE__ */ u(Title, { asChild: true, children: /* @__PURE__ */ u(Text, { weight: "bold", children: heading2 }) }),
4904
4266
  /* @__PURE__ */ u(Description, { asChild: true, children: /* @__PURE__ */ u(Text, { size: "caption", color: "muted", children: subheading }) })
4905
4267
  ] }),
@@ -4911,34 +4273,16 @@ const BannerContent = ({
4911
4273
  {
4912
4274
  size: 12,
4913
4275
  className: clx({
4914
- [classes$2.chevron]: true,
4915
- [classes$2.open]: settingsOpen
4276
+ [classes.chevron]: true,
4277
+ [classes.open]: settingsOpen
4916
4278
  })
4917
4279
  }
4918
4280
  )
4919
4281
  ] }) })
4920
4282
  ] }),
4921
- /* @__PURE__ */ u(
4922
- Content$1,
4923
- {
4924
- className: clx({
4925
- [classes$2.settings]: true
4926
- }),
4927
- children: /* @__PURE__ */ u(
4928
- Root2,
4929
- {
4930
- type: "single",
4931
- collapsible: true,
4932
- value: openItem,
4933
- onValueChange: setOpenItem,
4934
- children: items.map((item) => /* @__PURE__ */ u(BannerItem, { ...item, openItem }, item.value))
4935
- }
4936
- )
4937
- }
4938
- ),
4939
- /* @__PURE__ */ u("div", { className: classes$2.footer, children: [
4940
- /* @__PURE__ */ u("div", { className: classes$2.legal, children: privacyPolicy && /* @__PURE__ */ u(Text, { size: "caption", children: /* @__PURE__ */ u("a", { href: privacyPolicy.url, target: "_blank", children: privacyPolicy.label }) }) }),
4941
- /* @__PURE__ */ u("div", { className: classes$2.actions, children: [
4283
+ /* @__PURE__ */ u("div", { className: classes.footer, children: [
4284
+ /* @__PURE__ */ u("div", { className: classes.legal, children: privacyPolicy && /* @__PURE__ */ u(Text, { size: "caption", children: /* @__PURE__ */ u("a", { href: privacyPolicy.url, target: "_blank", children: privacyPolicy.label }) }) }),
4285
+ /* @__PURE__ */ u("div", { className: classes.actions, children: [
4942
4286
  /* @__PURE__ */ u(Close, { asChild: true, children: /* @__PURE__ */ u(Button, { variant: "neutral", onClick: () => onDeclineAll(), children: declineLabel }) }),
4943
4287
  /* @__PURE__ */ u(Close, { asChild: true, children: /* @__PURE__ */ u(Button, { variant: "brand", onClick: () => onSave(), children: saveLabel }) })
4944
4288
  ] })