@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.
@@ -44,27 +44,27 @@ function cls(...classes2) {
44
44
  function clx(classes2) {
45
45
  return Object.entries(classes2).filter(([, value]) => value).map(([key]) => key).join(" ");
46
46
  }
47
- const root$4 = "_root_hw69b_1";
47
+ const root$2 = "_root_hw69b_1";
48
48
  const neutral = "_neutral_hw69b_17";
49
49
  const brand = "_brand_hw69b_30";
50
50
  const ghost = "_ghost_hw69b_43";
51
- const classes$4 = {
52
- root: root$4,
51
+ const classes$2 = {
52
+ root: root$2,
53
53
  neutral,
54
54
  brand,
55
55
  ghost
56
56
  };
57
57
  const Button = ({ variant = "neutral", ...rest }) => {
58
- return /* @__PURE__ */ u("button", { className: cls(classes$4.root, classes$4[variant]), ...rest });
58
+ return /* @__PURE__ */ u("button", { className: cls(classes$2.root, classes$2[variant]), ...rest });
59
59
  };
60
- const root$3 = "_root_14l5h_1";
60
+ const root$1 = "_root_14l5h_1";
61
61
  const muted = "_muted_14l5h_4";
62
62
  const body = "_body_14l5h_8";
63
63
  const normal = "_normal_14l5h_14";
64
64
  const bold = "_bold_14l5h_18";
65
65
  const caption = "_caption_14l5h_23";
66
- const classes$3 = {
67
- root: root$3,
66
+ const classes$1 = {
67
+ root: root$1,
68
68
  muted,
69
69
  body,
70
70
  normal,
@@ -85,55 +85,37 @@ const Text = ({
85
85
  Component,
86
86
  {
87
87
  className: cls(
88
- classes$3.root,
89
- classes$3[size],
90
- classes$3[weight],
91
- classes$3[color]
88
+ classes$1.root,
89
+ classes$1[size],
90
+ classes$1[weight],
91
+ classes$1[color]
92
92
  ),
93
93
  ...rest
94
94
  }
95
95
  )
96
96
  );
97
97
  };
98
- const root$2 = "_root_1wsw7_42";
98
+ const root = "_root_1wsw7_42";
99
99
  const noTarget = "_noTarget_1wsw7_53";
100
100
  const collapsible = "_collapsible_1wsw7_62";
101
- const header$1 = "_header_1wsw7_65";
101
+ const header = "_header_1wsw7_65";
102
102
  const heading = "_heading_1wsw7_72";
103
- const chevron$1 = "_chevron_1wsw7_78";
104
- const open$1 = "_open_1wsw7_83";
105
- const settings = "_settings_1wsw7_89";
103
+ const chevron = "_chevron_1wsw7_78";
104
+ const open = "_open_1wsw7_83";
106
105
  const footer = "_footer_1wsw7_103";
107
106
  const legal = "_legal_1wsw7_110";
108
- const actions$1 = "_actions_1wsw7_113";
109
- const classes$2 = {
110
- root: root$2,
107
+ const actions = "_actions_1wsw7_113";
108
+ const classes = {
109
+ root,
111
110
  noTarget,
112
111
  collapsible,
113
- header: header$1,
114
- heading,
115
- chevron: chevron$1,
116
- open: open$1,
117
- settings,
118
- footer,
119
- legal,
120
- actions: actions$1
121
- };
122
- const root$1 = "_root_mqtha_19";
123
- const header = "_header_mqtha_24";
124
- const label = "_label_mqtha_33";
125
- const actions = "_actions_mqtha_39";
126
- const chevron = "_chevron_mqtha_45";
127
- const open = "_open_mqtha_51";
128
- const description = "_description_mqtha_58";
129
- const classes$1 = {
130
- root: root$1,
131
112
  header,
132
- label,
133
- actions,
113
+ heading,
134
114
  chevron,
135
115
  open,
136
- description
116
+ footer,
117
+ legal,
118
+ actions
137
119
  };
138
120
  function $constructor(name, initializer2, params) {
139
121
  function init(inst, def) {
@@ -2191,68 +2173,6 @@ function getElementRef$1(element) {
2191
2173
  }
2192
2174
  return element.props.ref || element.ref;
2193
2175
  }
2194
- function createCollection(name) {
2195
- const PROVIDER_NAME = name + "CollectionProvider";
2196
- const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
2197
- const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
2198
- PROVIDER_NAME,
2199
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
2200
- );
2201
- const CollectionProvider = (props) => {
2202
- const { scope, children } = props;
2203
- const ref = React.useRef(null);
2204
- const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
2205
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
2206
- };
2207
- CollectionProvider.displayName = PROVIDER_NAME;
2208
- const COLLECTION_SLOT_NAME = name + "CollectionSlot";
2209
- const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
2210
- const CollectionSlot = React.forwardRef(
2211
- (props, forwardedRef) => {
2212
- const { scope, children } = props;
2213
- const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
2214
- const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
2215
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionSlotImpl, { ref: composedRefs, children });
2216
- }
2217
- );
2218
- CollectionSlot.displayName = COLLECTION_SLOT_NAME;
2219
- const ITEM_SLOT_NAME = name + "CollectionItemSlot";
2220
- const ITEM_DATA_ATTR = "data-radix-collection-item";
2221
- const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
2222
- const CollectionItemSlot = React.forwardRef(
2223
- (props, forwardedRef) => {
2224
- const { scope, children, ...itemData } = props;
2225
- const ref = React.useRef(null);
2226
- const composedRefs = useComposedRefs(forwardedRef, ref);
2227
- const context = useCollectionContext(ITEM_SLOT_NAME, scope);
2228
- React.useEffect(() => {
2229
- context.itemMap.set(ref, { ref, ...itemData });
2230
- return () => void context.itemMap.delete(ref);
2231
- });
2232
- return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
2233
- }
2234
- );
2235
- CollectionItemSlot.displayName = ITEM_SLOT_NAME;
2236
- function useCollection2(scope) {
2237
- const context = useCollectionContext(name + "CollectionConsumer", scope);
2238
- const getItems = React.useCallback(() => {
2239
- const collectionNode = context.collectionRef.current;
2240
- if (!collectionNode) return [];
2241
- const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
2242
- const items = Array.from(context.itemMap.values());
2243
- const orderedItems = items.sort(
2244
- (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
2245
- );
2246
- return orderedItems;
2247
- }, [context.collectionRef, context.itemMap]);
2248
- return getItems;
2249
- }
2250
- return [
2251
- { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
2252
- useCollection2,
2253
- createCollectionScope2
2254
- ];
2255
- }
2256
2176
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
2257
2177
  return function handleEvent(event) {
2258
2178
  originalEventHandler?.(event);
@@ -2494,7 +2414,7 @@ function useId(deterministicId) {
2494
2414
  return deterministicId || (id ? `radix-${id}` : "");
2495
2415
  }
2496
2416
  var COLLAPSIBLE_NAME = "Collapsible";
2497
- var [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);
2417
+ var [createCollapsibleContext] = createContextScope(COLLAPSIBLE_NAME);
2498
2418
  var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
2499
2419
  var Collapsible = React__namespace.forwardRef(
2500
2420
  (props, forwardedRef) => {
@@ -2523,7 +2443,7 @@ var Collapsible = React__namespace.forwardRef(
2523
2443
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2524
2444
  Primitive.div,
2525
2445
  {
2526
- "data-state": getState$3(open2),
2446
+ "data-state": getState$1(open2),
2527
2447
  "data-disabled": disabled ? "" : void 0,
2528
2448
  ...collapsibleProps,
2529
2449
  ref: forwardedRef
@@ -2534,18 +2454,18 @@ var Collapsible = React__namespace.forwardRef(
2534
2454
  }
2535
2455
  );
2536
2456
  Collapsible.displayName = COLLAPSIBLE_NAME;
2537
- var TRIGGER_NAME$2 = "CollapsibleTrigger";
2457
+ var TRIGGER_NAME$1 = "CollapsibleTrigger";
2538
2458
  var CollapsibleTrigger = React__namespace.forwardRef(
2539
2459
  (props, forwardedRef) => {
2540
2460
  const { __scopeCollapsible, ...triggerProps } = props;
2541
- const context = useCollapsibleContext(TRIGGER_NAME$2, __scopeCollapsible);
2461
+ const context = useCollapsibleContext(TRIGGER_NAME$1, __scopeCollapsible);
2542
2462
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2543
2463
  Primitive.button,
2544
2464
  {
2545
2465
  type: "button",
2546
2466
  "aria-controls": context.contentId,
2547
2467
  "aria-expanded": context.open || false,
2548
- "data-state": getState$3(context.open),
2468
+ "data-state": getState$1(context.open),
2549
2469
  "data-disabled": context.disabled ? "" : void 0,
2550
2470
  disabled: context.disabled,
2551
2471
  ...triggerProps,
@@ -2555,19 +2475,19 @@ var CollapsibleTrigger = React__namespace.forwardRef(
2555
2475
  );
2556
2476
  }
2557
2477
  );
2558
- CollapsibleTrigger.displayName = TRIGGER_NAME$2;
2559
- var CONTENT_NAME$2 = "CollapsibleContent";
2478
+ CollapsibleTrigger.displayName = TRIGGER_NAME$1;
2479
+ var CONTENT_NAME$1 = "CollapsibleContent";
2560
2480
  var CollapsibleContent = React__namespace.forwardRef(
2561
2481
  (props, forwardedRef) => {
2562
2482
  const { forceMount, ...contentProps } = props;
2563
- const context = useCollapsibleContext(CONTENT_NAME$2, props.__scopeCollapsible);
2483
+ const context = useCollapsibleContext(CONTENT_NAME$1, props.__scopeCollapsible);
2564
2484
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
2565
2485
  }
2566
2486
  );
2567
- CollapsibleContent.displayName = CONTENT_NAME$2;
2487
+ CollapsibleContent.displayName = CONTENT_NAME$1;
2568
2488
  var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) => {
2569
2489
  const { __scopeCollapsible, present, children, ...contentProps } = props;
2570
- const context = useCollapsibleContext(CONTENT_NAME$2, __scopeCollapsible);
2490
+ const context = useCollapsibleContext(CONTENT_NAME$1, __scopeCollapsible);
2571
2491
  const [isPresent, setIsPresent] = React__namespace.useState(present);
2572
2492
  const ref = React__namespace.useRef(null);
2573
2493
  const composedRefs = useComposedRefs(forwardedRef, ref);
@@ -2604,7 +2524,7 @@ var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) =
2604
2524
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
2605
2525
  Primitive.div,
2606
2526
  {
2607
- "data-state": getState$3(context.open),
2527
+ "data-state": getState$1(context.open),
2608
2528
  "data-disabled": context.disabled ? "" : void 0,
2609
2529
  id: context.contentId,
2610
2530
  hidden: !isOpen,
@@ -2619,307 +2539,11 @@ var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) =
2619
2539
  }
2620
2540
  );
2621
2541
  });
2622
- function getState$3(open2) {
2542
+ function getState$1(open2) {
2623
2543
  return open2 ? "open" : "closed";
2624
2544
  }
2625
- var Root$2 = Collapsible;
2545
+ var Root$1 = Collapsible;
2626
2546
  var Trigger = CollapsibleTrigger;
2627
- var Content$1 = CollapsibleContent;
2628
- var DirectionContext = React__namespace.createContext(void 0);
2629
- function useDirection(localDir) {
2630
- const globalDir = React__namespace.useContext(DirectionContext);
2631
- return localDir || globalDir || "ltr";
2632
- }
2633
- var ACCORDION_NAME = "Accordion";
2634
- var ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
2635
- var [Collection, useCollection, createCollectionScope] = createCollection(ACCORDION_NAME);
2636
- var [createAccordionContext] = createContextScope(ACCORDION_NAME, [
2637
- createCollectionScope,
2638
- createCollapsibleScope
2639
- ]);
2640
- var useCollapsibleScope = createCollapsibleScope();
2641
- var Accordion = React.forwardRef(
2642
- (props, forwardedRef) => {
2643
- const { type, ...accordionProps } = props;
2644
- const singleProps = accordionProps;
2645
- const multipleProps = accordionProps;
2646
- 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 }) });
2647
- }
2648
- );
2649
- Accordion.displayName = ACCORDION_NAME;
2650
- var [AccordionValueProvider, useAccordionValueContext] = createAccordionContext(ACCORDION_NAME);
2651
- var [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(
2652
- ACCORDION_NAME,
2653
- { collapsible: false }
2654
- );
2655
- var AccordionImplSingle = React.forwardRef(
2656
- (props, forwardedRef) => {
2657
- const {
2658
- value: valueProp,
2659
- defaultValue,
2660
- onValueChange = () => {
2661
- },
2662
- collapsible: collapsible2 = false,
2663
- ...accordionSingleProps
2664
- } = props;
2665
- const [value, setValue] = useControllableState({
2666
- prop: valueProp,
2667
- defaultProp: defaultValue ?? "",
2668
- onChange: onValueChange,
2669
- caller: ACCORDION_NAME
2670
- });
2671
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2672
- AccordionValueProvider,
2673
- {
2674
- scope: props.__scopeAccordion,
2675
- value: React.useMemo(() => value ? [value] : [], [value]),
2676
- onItemOpen: setValue,
2677
- onItemClose: React.useCallback(() => collapsible2 && setValue(""), [collapsible2, setValue]),
2678
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: collapsible2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionImpl, { ...accordionSingleProps, ref: forwardedRef }) })
2679
- }
2680
- );
2681
- }
2682
- );
2683
- var AccordionImplMultiple = React.forwardRef((props, forwardedRef) => {
2684
- const {
2685
- value: valueProp,
2686
- defaultValue,
2687
- onValueChange = () => {
2688
- },
2689
- ...accordionMultipleProps
2690
- } = props;
2691
- const [value, setValue] = useControllableState({
2692
- prop: valueProp,
2693
- defaultProp: defaultValue ?? [],
2694
- onChange: onValueChange,
2695
- caller: ACCORDION_NAME
2696
- });
2697
- const handleItemOpen = React.useCallback(
2698
- (itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
2699
- [setValue]
2700
- );
2701
- const handleItemClose = React.useCallback(
2702
- (itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
2703
- [setValue]
2704
- );
2705
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2706
- AccordionValueProvider,
2707
- {
2708
- scope: props.__scopeAccordion,
2709
- value,
2710
- onItemOpen: handleItemOpen,
2711
- onItemClose: handleItemClose,
2712
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionImpl, { ...accordionMultipleProps, ref: forwardedRef }) })
2713
- }
2714
- );
2715
- });
2716
- var [AccordionImplProvider, useAccordionContext] = createAccordionContext(ACCORDION_NAME);
2717
- var AccordionImpl = React.forwardRef(
2718
- (props, forwardedRef) => {
2719
- const { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props;
2720
- const accordionRef = React.useRef(null);
2721
- const composedRefs = useComposedRefs(accordionRef, forwardedRef);
2722
- const getItems = useCollection(__scopeAccordion);
2723
- const direction = useDirection(dir);
2724
- const isDirectionLTR = direction === "ltr";
2725
- const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {
2726
- if (!ACCORDION_KEYS.includes(event.key)) return;
2727
- const target = event.target;
2728
- const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);
2729
- const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);
2730
- const triggerCount = triggerCollection.length;
2731
- if (triggerIndex === -1) return;
2732
- event.preventDefault();
2733
- let nextIndex = triggerIndex;
2734
- const homeIndex = 0;
2735
- const endIndex = triggerCount - 1;
2736
- const moveNext = () => {
2737
- nextIndex = triggerIndex + 1;
2738
- if (nextIndex > endIndex) {
2739
- nextIndex = homeIndex;
2740
- }
2741
- };
2742
- const movePrev = () => {
2743
- nextIndex = triggerIndex - 1;
2744
- if (nextIndex < homeIndex) {
2745
- nextIndex = endIndex;
2746
- }
2747
- };
2748
- switch (event.key) {
2749
- case "Home":
2750
- nextIndex = homeIndex;
2751
- break;
2752
- case "End":
2753
- nextIndex = endIndex;
2754
- break;
2755
- case "ArrowRight":
2756
- if (orientation === "horizontal") {
2757
- if (isDirectionLTR) {
2758
- moveNext();
2759
- } else {
2760
- movePrev();
2761
- }
2762
- }
2763
- break;
2764
- case "ArrowDown":
2765
- if (orientation === "vertical") {
2766
- moveNext();
2767
- }
2768
- break;
2769
- case "ArrowLeft":
2770
- if (orientation === "horizontal") {
2771
- if (isDirectionLTR) {
2772
- movePrev();
2773
- } else {
2774
- moveNext();
2775
- }
2776
- }
2777
- break;
2778
- case "ArrowUp":
2779
- if (orientation === "vertical") {
2780
- movePrev();
2781
- }
2782
- break;
2783
- }
2784
- const clampedIndex = nextIndex % triggerCount;
2785
- triggerCollection[clampedIndex].ref.current?.focus();
2786
- });
2787
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2788
- AccordionImplProvider,
2789
- {
2790
- scope: __scopeAccordion,
2791
- disabled,
2792
- direction: dir,
2793
- orientation,
2794
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.Slot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2795
- Primitive.div,
2796
- {
2797
- ...accordionProps,
2798
- "data-orientation": orientation,
2799
- ref: composedRefs,
2800
- onKeyDown: disabled ? void 0 : handleKeyDown
2801
- }
2802
- ) })
2803
- }
2804
- );
2805
- }
2806
- );
2807
- var ITEM_NAME = "AccordionItem";
2808
- var [AccordionItemProvider, useAccordionItemContext] = createAccordionContext(ITEM_NAME);
2809
- var AccordionItem = React.forwardRef(
2810
- (props, forwardedRef) => {
2811
- const { __scopeAccordion, value, ...accordionItemProps } = props;
2812
- const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);
2813
- const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);
2814
- const collapsibleScope = useCollapsibleScope(__scopeAccordion);
2815
- const triggerId = useId();
2816
- const open2 = value && valueContext.value.includes(value) || false;
2817
- const disabled = accordionContext.disabled || props.disabled;
2818
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2819
- AccordionItemProvider,
2820
- {
2821
- scope: __scopeAccordion,
2822
- open: open2,
2823
- disabled,
2824
- triggerId,
2825
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2826
- Root$2,
2827
- {
2828
- "data-orientation": accordionContext.orientation,
2829
- "data-state": getState$2(open2),
2830
- ...collapsibleScope,
2831
- ...accordionItemProps,
2832
- ref: forwardedRef,
2833
- disabled,
2834
- open: open2,
2835
- onOpenChange: (open22) => {
2836
- if (open22) {
2837
- valueContext.onItemOpen(value);
2838
- } else {
2839
- valueContext.onItemClose(value);
2840
- }
2841
- }
2842
- }
2843
- )
2844
- }
2845
- );
2846
- }
2847
- );
2848
- AccordionItem.displayName = ITEM_NAME;
2849
- var HEADER_NAME = "AccordionHeader";
2850
- var AccordionHeader = React.forwardRef(
2851
- (props, forwardedRef) => {
2852
- const { __scopeAccordion, ...headerProps } = props;
2853
- const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
2854
- const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);
2855
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2856
- Primitive.h3,
2857
- {
2858
- "data-orientation": accordionContext.orientation,
2859
- "data-state": getState$2(itemContext.open),
2860
- "data-disabled": itemContext.disabled ? "" : void 0,
2861
- ...headerProps,
2862
- ref: forwardedRef
2863
- }
2864
- );
2865
- }
2866
- );
2867
- AccordionHeader.displayName = HEADER_NAME;
2868
- var TRIGGER_NAME$1 = "AccordionTrigger";
2869
- var AccordionTrigger = React.forwardRef(
2870
- (props, forwardedRef) => {
2871
- const { __scopeAccordion, ...triggerProps } = props;
2872
- const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
2873
- const itemContext = useAccordionItemContext(TRIGGER_NAME$1, __scopeAccordion);
2874
- const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME$1, __scopeAccordion);
2875
- const collapsibleScope = useCollapsibleScope(__scopeAccordion);
2876
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.ItemSlot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2877
- Trigger,
2878
- {
2879
- "aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
2880
- "data-orientation": accordionContext.orientation,
2881
- id: itemContext.triggerId,
2882
- ...collapsibleScope,
2883
- ...triggerProps,
2884
- ref: forwardedRef
2885
- }
2886
- ) });
2887
- }
2888
- );
2889
- AccordionTrigger.displayName = TRIGGER_NAME$1;
2890
- var CONTENT_NAME$1 = "AccordionContent";
2891
- var AccordionContent = React.forwardRef(
2892
- (props, forwardedRef) => {
2893
- const { __scopeAccordion, ...contentProps } = props;
2894
- const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
2895
- const itemContext = useAccordionItemContext(CONTENT_NAME$1, __scopeAccordion);
2896
- const collapsibleScope = useCollapsibleScope(__scopeAccordion);
2897
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
2898
- Content$1,
2899
- {
2900
- role: "region",
2901
- "aria-labelledby": itemContext.triggerId,
2902
- "data-orientation": accordionContext.orientation,
2903
- ...collapsibleScope,
2904
- ...contentProps,
2905
- ref: forwardedRef,
2906
- style: {
2907
- ["--radix-accordion-content-height"]: "var(--radix-collapsible-content-height)",
2908
- ["--radix-accordion-content-width"]: "var(--radix-collapsible-content-width)",
2909
- ...props.style
2910
- }
2911
- }
2912
- );
2913
- }
2914
- );
2915
- AccordionContent.displayName = CONTENT_NAME$1;
2916
- function getState$2(open2) {
2917
- return open2 ? "open" : "closed";
2918
- }
2919
- var Root2 = Accordion;
2920
- var Item = AccordionItem;
2921
- var Trigger2 = AccordionTrigger;
2922
- var Content2 = AccordionContent;
2923
2547
  const mergeClasses = (...classes2) => classes2.filter((className, index, array) => {
2924
2548
  return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
2925
2549
  }).join(" ").trim();
@@ -2996,207 +2620,8 @@ const createLucideIcon = (iconName, iconNode) => {
2996
2620
  Component.displayName = toPascalCase(iconName);
2997
2621
  return Component;
2998
2622
  };
2999
- const __iconNode$1 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
3000
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$1);
3001
2623
  const __iconNode = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
3002
2624
  const ChevronUp = createLucideIcon("chevron-up", __iconNode);
3003
- function usePrevious(value) {
3004
- const ref = React__namespace.useRef({ value, previous: value });
3005
- return React__namespace.useMemo(() => {
3006
- if (ref.current.value !== value) {
3007
- ref.current.previous = ref.current.value;
3008
- ref.current.value = value;
3009
- }
3010
- return ref.current.previous;
3011
- }, [value]);
3012
- }
3013
- function useSize(element) {
3014
- const [size, setSize] = React__namespace.useState(void 0);
3015
- useLayoutEffect2(() => {
3016
- if (element) {
3017
- setSize({ width: element.offsetWidth, height: element.offsetHeight });
3018
- const resizeObserver = new ResizeObserver((entries) => {
3019
- if (!Array.isArray(entries)) {
3020
- return;
3021
- }
3022
- if (!entries.length) {
3023
- return;
3024
- }
3025
- const entry = entries[0];
3026
- let width;
3027
- let height;
3028
- if ("borderBoxSize" in entry) {
3029
- const borderSizeEntry = entry["borderBoxSize"];
3030
- const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
3031
- width = borderSize["inlineSize"];
3032
- height = borderSize["blockSize"];
3033
- } else {
3034
- width = element.offsetWidth;
3035
- height = element.offsetHeight;
3036
- }
3037
- setSize({ width, height });
3038
- });
3039
- resizeObserver.observe(element, { box: "border-box" });
3040
- return () => resizeObserver.unobserve(element);
3041
- } else {
3042
- setSize(void 0);
3043
- }
3044
- }, [element]);
3045
- return size;
3046
- }
3047
- var SWITCH_NAME = "Switch";
3048
- var [createSwitchContext] = createContextScope(SWITCH_NAME);
3049
- var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
3050
- var Switch$1 = React__namespace.forwardRef(
3051
- (props, forwardedRef) => {
3052
- const {
3053
- __scopeSwitch,
3054
- name,
3055
- checked: checkedProp,
3056
- defaultChecked,
3057
- required,
3058
- disabled,
3059
- value = "on",
3060
- onCheckedChange,
3061
- form,
3062
- ...switchProps
3063
- } = props;
3064
- const [button, setButton] = React__namespace.useState(null);
3065
- const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
3066
- const hasConsumerStoppedPropagationRef = React__namespace.useRef(false);
3067
- const isFormControl = button ? form || !!button.closest("form") : true;
3068
- const [checked, setChecked] = useControllableState({
3069
- prop: checkedProp,
3070
- defaultProp: defaultChecked ?? false,
3071
- onChange: onCheckedChange,
3072
- caller: SWITCH_NAME
3073
- });
3074
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
3075
- /* @__PURE__ */ jsxRuntimeExports.jsx(
3076
- Primitive.button,
3077
- {
3078
- type: "button",
3079
- role: "switch",
3080
- "aria-checked": checked,
3081
- "aria-required": required,
3082
- "data-state": getState$1(checked),
3083
- "data-disabled": disabled ? "" : void 0,
3084
- disabled,
3085
- value,
3086
- ...switchProps,
3087
- ref: composedRefs,
3088
- onClick: composeEventHandlers(props.onClick, (event) => {
3089
- setChecked((prevChecked) => !prevChecked);
3090
- if (isFormControl) {
3091
- hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
3092
- if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
3093
- }
3094
- })
3095
- }
3096
- ),
3097
- isFormControl && /* @__PURE__ */ jsxRuntimeExports.jsx(
3098
- SwitchBubbleInput,
3099
- {
3100
- control: button,
3101
- bubbles: !hasConsumerStoppedPropagationRef.current,
3102
- name,
3103
- value,
3104
- checked,
3105
- required,
3106
- disabled,
3107
- form,
3108
- style: { transform: "translateX(-100%)" }
3109
- }
3110
- )
3111
- ] });
3112
- }
3113
- );
3114
- Switch$1.displayName = SWITCH_NAME;
3115
- var THUMB_NAME = "SwitchThumb";
3116
- var SwitchThumb = React__namespace.forwardRef(
3117
- (props, forwardedRef) => {
3118
- const { __scopeSwitch, ...thumbProps } = props;
3119
- const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
3120
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3121
- Primitive.span,
3122
- {
3123
- "data-state": getState$1(context.checked),
3124
- "data-disabled": context.disabled ? "" : void 0,
3125
- ...thumbProps,
3126
- ref: forwardedRef
3127
- }
3128
- );
3129
- }
3130
- );
3131
- SwitchThumb.displayName = THUMB_NAME;
3132
- var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
3133
- var SwitchBubbleInput = React__namespace.forwardRef(
3134
- ({
3135
- __scopeSwitch,
3136
- control,
3137
- checked,
3138
- bubbles = true,
3139
- ...props
3140
- }, forwardedRef) => {
3141
- const ref = React__namespace.useRef(null);
3142
- const composedRefs = useComposedRefs(ref, forwardedRef);
3143
- const prevChecked = usePrevious(checked);
3144
- const controlSize = useSize(control);
3145
- React__namespace.useEffect(() => {
3146
- const input = ref.current;
3147
- if (!input) return;
3148
- const inputProto = window.HTMLInputElement.prototype;
3149
- const descriptor = Object.getOwnPropertyDescriptor(
3150
- inputProto,
3151
- "checked"
3152
- );
3153
- const setChecked = descriptor.set;
3154
- if (prevChecked !== checked && setChecked) {
3155
- const event = new Event("click", { bubbles });
3156
- setChecked.call(input, checked);
3157
- input.dispatchEvent(event);
3158
- }
3159
- }, [prevChecked, checked, bubbles]);
3160
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
3161
- "input",
3162
- {
3163
- type: "checkbox",
3164
- "aria-hidden": true,
3165
- defaultChecked: checked,
3166
- ...props,
3167
- tabIndex: -1,
3168
- ref: composedRefs,
3169
- style: {
3170
- ...props.style,
3171
- ...controlSize,
3172
- position: "absolute",
3173
- pointerEvents: "none",
3174
- opacity: 0,
3175
- margin: 0
3176
- }
3177
- }
3178
- );
3179
- }
3180
- );
3181
- SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
3182
- function getState$1(checked) {
3183
- return checked ? "checked" : "unchecked";
3184
- }
3185
- var Root$1 = Switch$1;
3186
- var Thumb = SwitchThumb;
3187
- const root = "_root_dibqz_1";
3188
- const thumb = "_thumb_dibqz_38";
3189
- const classes = {
3190
- root,
3191
- "switch": "_switch_dibqz_8",
3192
- thumb
3193
- };
3194
- const Switch = ({ label: label2, id, ...rest }) => {
3195
- return /* @__PURE__ */ u("div", { className: classes.root, children: [
3196
- label2 && /* @__PURE__ */ u(Text, { className: classes.label, as: "label", htmlFor: id, children: label2 }),
3197
- /* @__PURE__ */ u(Root$1, { className: classes.switch, ...rest, children: /* @__PURE__ */ u(Thumb, { className: classes.thumb }) })
3198
- ] });
3199
- };
3200
2625
  const selectionSchema = /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ boolean());
3201
2626
  const SelectionContext = React.createContext(null);
3202
2627
  const SelectionProvider = ({
@@ -3317,68 +2742,6 @@ function useSelection() {
3317
2742
  }
3318
2743
  return context;
3319
2744
  }
3320
- const BannerItem = ({
3321
- value,
3322
- label: label2,
3323
- sublabel,
3324
- required = false,
3325
- description: description2,
3326
- openItem
3327
- }) => {
3328
- const { toggleSelection, selection } = useSelection();
3329
- const selected = React.useMemo(
3330
- () => selection?.[value] ?? false,
3331
- [selection, value]
3332
- );
3333
- React.useEffect(() => {
3334
- toggleSelection(value, selected);
3335
- }, [value, selected]);
3336
- const checked = React.useMemo(
3337
- () => required ? true : selected,
3338
- [required, selected]
3339
- );
3340
- const onCheckedChange = React.useMemo(
3341
- () => (checked2) => required ? () => {
3342
- } : toggleSelection(value, checked2),
3343
- [required, toggleSelection, value]
3344
- );
3345
- const disabled = React.useMemo(() => required, [required]);
3346
- return /* @__PURE__ */ u(Item, { value, className: classes$1.root, children: [
3347
- /* @__PURE__ */ u("div", { className: classes$1.header, children: [
3348
- /* @__PURE__ */ u(Trigger2, { asChild: true, children: /* @__PURE__ */ u("div", { className: classes$1.label, children: [
3349
- /* @__PURE__ */ u(Text, { weight: "bold", children: label2 }),
3350
- sublabel && /* @__PURE__ */ u(Text, { size: "caption", color: "muted", children: sublabel })
3351
- ] }) }),
3352
- /* @__PURE__ */ u("div", { className: classes$1.actions, children: [
3353
- /* @__PURE__ */ u(
3354
- Switch,
3355
- {
3356
- checked,
3357
- onCheckedChange,
3358
- disabled
3359
- }
3360
- ),
3361
- /* @__PURE__ */ u(Trigger2, { asChild: true, children: /* @__PURE__ */ u(
3362
- ChevronDown,
3363
- {
3364
- size: 16,
3365
- className: clx({
3366
- [classes$1.chevron]: true,
3367
- [classes$1.open]: openItem === value
3368
- })
3369
- }
3370
- ) })
3371
- ] })
3372
- ] }),
3373
- description2 && /* @__PURE__ */ u(Content2, { className: classes$1.description, children: /* @__PURE__ */ u(
3374
- Text,
3375
- {
3376
- size: "caption",
3377
- dangerouslySetInnerHTML: { __html: description2 }
3378
- }
3379
- ) })
3380
- ] });
3381
- };
3382
2745
  function useCallbackRef$1(callback) {
3383
2746
  const callbackRef = React__namespace.useRef(callback);
3384
2747
  React__namespace.useEffect(() => {
@@ -4900,25 +4263,24 @@ const BannerContent = ({
4900
4263
  saveLabel = "Save selection",
4901
4264
  declineLabel = "Decline all",
4902
4265
  defaultSettingsOpen = true,
4903
- privacyPolicy,
4904
- items
4266
+ privacyPolicy
4267
+ // items,
4905
4268
  }) => {
4906
4269
  const { onSave, onDeclineAll, selectionTaken } = useSelection();
4907
- const [openItem, setOpenItem] = React.useState(void 0);
4908
4270
  const [settingsOpen, setSettingsOpen] = React.useState(defaultSettingsOpen);
4909
4271
  return /* @__PURE__ */ u(Root, { open: !selectionTaken, children: /* @__PURE__ */ u(
4910
4272
  Content,
4911
4273
  {
4912
- className: cls(classes$2.root, noTarget2 ? classes$2.noTarget : ""),
4274
+ className: cls(classes.root, noTarget2 ? classes.noTarget : ""),
4913
4275
  children: /* @__PURE__ */ u(
4914
- Root$2,
4276
+ Root$1,
4915
4277
  {
4916
4278
  open: settingsOpen,
4917
4279
  onOpenChange: setSettingsOpen,
4918
- className: classes$2.collapsible,
4280
+ className: classes.collapsible,
4919
4281
  children: [
4920
- /* @__PURE__ */ u("div", { className: classes$2.header, children: [
4921
- /* @__PURE__ */ u("div", { className: classes$2.heading, children: [
4282
+ /* @__PURE__ */ u("div", { className: classes.header, children: [
4283
+ /* @__PURE__ */ u("div", { className: classes.heading, children: [
4922
4284
  /* @__PURE__ */ u(Title, { asChild: true, children: /* @__PURE__ */ u(Text, { weight: "bold", children: heading2 }) }),
4923
4285
  /* @__PURE__ */ u(Description, { asChild: true, children: /* @__PURE__ */ u(Text, { size: "caption", color: "muted", children: subheading }) })
4924
4286
  ] }),
@@ -4930,34 +4292,16 @@ const BannerContent = ({
4930
4292
  {
4931
4293
  size: 12,
4932
4294
  className: clx({
4933
- [classes$2.chevron]: true,
4934
- [classes$2.open]: settingsOpen
4295
+ [classes.chevron]: true,
4296
+ [classes.open]: settingsOpen
4935
4297
  })
4936
4298
  }
4937
4299
  )
4938
4300
  ] }) })
4939
4301
  ] }),
4940
- /* @__PURE__ */ u(
4941
- Content$1,
4942
- {
4943
- className: clx({
4944
- [classes$2.settings]: true
4945
- }),
4946
- children: /* @__PURE__ */ u(
4947
- Root2,
4948
- {
4949
- type: "single",
4950
- collapsible: true,
4951
- value: openItem,
4952
- onValueChange: setOpenItem,
4953
- children: items.map((item) => /* @__PURE__ */ u(BannerItem, { ...item, openItem }, item.value))
4954
- }
4955
- )
4956
- }
4957
- ),
4958
- /* @__PURE__ */ u("div", { className: classes$2.footer, children: [
4959
- /* @__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 }) }) }),
4960
- /* @__PURE__ */ u("div", { className: classes$2.actions, children: [
4302
+ /* @__PURE__ */ u("div", { className: classes.footer, children: [
4303
+ /* @__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 }) }) }),
4304
+ /* @__PURE__ */ u("div", { className: classes.actions, children: [
4961
4305
  /* @__PURE__ */ u(Close, { asChild: true, children: /* @__PURE__ */ u(Button, { variant: "neutral", onClick: () => onDeclineAll(), children: declineLabel }) }),
4962
4306
  /* @__PURE__ */ u(Close, { asChild: true, children: /* @__PURE__ */ u(Button, { variant: "brand", onClick: () => onSave(), children: saveLabel }) })
4963
4307
  ] })