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