@uninspired/cookie-banner 0.0.8 → 0.0.9
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.
- package/dist/react/index.cjs +716 -1589
- package/dist/react/index.js +716 -1588
- package/dist/react/style.css +165 -18
- package/dist/script/index.cjs +1 -45
- package/dist/script/index.js +1561 -2091
- package/dist/script/style.css +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
-
const ReactDOM = require("react-dom");
|
|
5
4
|
function _interopNamespaceDefault(e) {
|
|
6
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
6
|
if (e) {
|
|
@@ -19,7 +18,6 @@ function _interopNamespaceDefault(e) {
|
|
|
19
18
|
return Object.freeze(n);
|
|
20
19
|
}
|
|
21
20
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
22
|
-
const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
|
|
23
21
|
var l;
|
|
24
22
|
l = { __e: function(n, l2, u2, t) {
|
|
25
23
|
for (var i, r, o; l2 = l2.__; ) if ((i = l2.__c) && !i.__) try {
|
|
@@ -44,27 +42,27 @@ function cls(...classes2) {
|
|
|
44
42
|
function clx(classes2) {
|
|
45
43
|
return Object.entries(classes2).filter(([, value]) => value).map(([key]) => key).join(" ");
|
|
46
44
|
}
|
|
47
|
-
const root$
|
|
45
|
+
const root$4 = "_root_hw69b_1";
|
|
48
46
|
const neutral = "_neutral_hw69b_17";
|
|
49
47
|
const brand = "_brand_hw69b_30";
|
|
50
48
|
const ghost = "_ghost_hw69b_43";
|
|
51
|
-
const classes$
|
|
52
|
-
root: root$
|
|
49
|
+
const classes$4 = {
|
|
50
|
+
root: root$4,
|
|
53
51
|
neutral,
|
|
54
52
|
brand,
|
|
55
53
|
ghost
|
|
56
54
|
};
|
|
57
55
|
const Button = ({ variant = "neutral", ...rest }) => {
|
|
58
|
-
return /* @__PURE__ */ u("button", { className: cls(classes$
|
|
56
|
+
return /* @__PURE__ */ u("button", { className: cls(classes$4.root, classes$4[variant]), ...rest });
|
|
59
57
|
};
|
|
60
|
-
const root$
|
|
58
|
+
const root$3 = "_root_14l5h_1";
|
|
61
59
|
const muted = "_muted_14l5h_4";
|
|
62
60
|
const body = "_body_14l5h_8";
|
|
63
61
|
const normal = "_normal_14l5h_14";
|
|
64
62
|
const bold = "_bold_14l5h_18";
|
|
65
63
|
const caption = "_caption_14l5h_23";
|
|
66
|
-
const classes$
|
|
67
|
-
root: root$
|
|
64
|
+
const classes$3 = {
|
|
65
|
+
root: root$3,
|
|
68
66
|
muted,
|
|
69
67
|
body,
|
|
70
68
|
normal,
|
|
@@ -85,37 +83,55 @@ const Text = ({
|
|
|
85
83
|
Component,
|
|
86
84
|
{
|
|
87
85
|
className: cls(
|
|
88
|
-
classes$
|
|
89
|
-
classes$
|
|
90
|
-
classes$
|
|
91
|
-
classes$
|
|
86
|
+
classes$3.root,
|
|
87
|
+
classes$3[size],
|
|
88
|
+
classes$3[weight],
|
|
89
|
+
classes$3[color]
|
|
92
90
|
),
|
|
93
91
|
...rest
|
|
94
92
|
}
|
|
95
93
|
)
|
|
96
94
|
);
|
|
97
95
|
};
|
|
98
|
-
const root = "
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
|
|
96
|
+
const root$2 = "_root_2wcp0_53";
|
|
97
|
+
const open$1 = "_open_2wcp0_66";
|
|
98
|
+
const noTarget = "_noTarget_2wcp0_72";
|
|
99
|
+
const collapsible = "_collapsible_2wcp0_81";
|
|
100
|
+
const header$1 = "_header_2wcp0_84";
|
|
101
|
+
const heading = "_heading_2wcp0_91";
|
|
102
|
+
const chevron$1 = "_chevron_2wcp0_97";
|
|
103
|
+
const settings = "_settings_2wcp0_108";
|
|
104
|
+
const footer = "_footer_2wcp0_122";
|
|
105
|
+
const legal = "_legal_2wcp0_129";
|
|
106
|
+
const actions$1 = "_actions_2wcp0_132";
|
|
107
|
+
const classes$2 = {
|
|
108
|
+
root: root$2,
|
|
109
|
+
open: open$1,
|
|
110
110
|
noTarget,
|
|
111
111
|
collapsible,
|
|
112
|
-
header,
|
|
112
|
+
header: header$1,
|
|
113
113
|
heading,
|
|
114
|
-
chevron,
|
|
115
|
-
|
|
114
|
+
chevron: chevron$1,
|
|
115
|
+
settings,
|
|
116
116
|
footer,
|
|
117
117
|
legal,
|
|
118
|
-
actions
|
|
118
|
+
actions: actions$1
|
|
119
|
+
};
|
|
120
|
+
const root$1 = "_root_mqtha_19";
|
|
121
|
+
const header = "_header_mqtha_24";
|
|
122
|
+
const label = "_label_mqtha_33";
|
|
123
|
+
const actions = "_actions_mqtha_39";
|
|
124
|
+
const chevron = "_chevron_mqtha_45";
|
|
125
|
+
const open = "_open_mqtha_51";
|
|
126
|
+
const description = "_description_mqtha_58";
|
|
127
|
+
const classes$1 = {
|
|
128
|
+
root: root$1,
|
|
129
|
+
header,
|
|
130
|
+
label,
|
|
131
|
+
actions,
|
|
132
|
+
chevron,
|
|
133
|
+
open,
|
|
134
|
+
description
|
|
119
135
|
};
|
|
120
136
|
function $constructor(name, initializer2, params) {
|
|
121
137
|
function init(inst, def) {
|
|
@@ -324,7 +340,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
324
340
|
}
|
|
325
341
|
return result.value;
|
|
326
342
|
};
|
|
327
|
-
const parse
|
|
343
|
+
const parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
328
344
|
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
329
345
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
330
346
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -962,7 +978,7 @@ const ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
|
962
978
|
$ZodType.init(inst, def);
|
|
963
979
|
inst.def = def;
|
|
964
980
|
inst.type = def.type;
|
|
965
|
-
inst.parse = (data, params) => parse
|
|
981
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
966
982
|
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
967
983
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
968
984
|
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
@@ -1984,22 +2000,6 @@ function requireJsxRuntime() {
|
|
|
1984
2000
|
return jsxRuntime.exports;
|
|
1985
2001
|
}
|
|
1986
2002
|
var jsxRuntimeExports = /* @__PURE__ */ requireJsxRuntime();
|
|
1987
|
-
function createContext2(rootComponentName, defaultContext) {
|
|
1988
|
-
const Context = React__namespace.createContext(defaultContext);
|
|
1989
|
-
const Provider = (props) => {
|
|
1990
|
-
const { children, ...context } = props;
|
|
1991
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
1992
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
1993
|
-
};
|
|
1994
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
1995
|
-
function useContext2(consumerName) {
|
|
1996
|
-
const context = React__namespace.useContext(Context);
|
|
1997
|
-
if (context) return context;
|
|
1998
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
1999
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
2000
|
-
}
|
|
2001
|
-
return [Provider, useContext2];
|
|
2002
|
-
}
|
|
2003
2003
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
2004
2004
|
let defaultContexts = [];
|
|
2005
2005
|
function createContext3(rootComponentName, defaultContext) {
|
|
@@ -2173,6 +2173,68 @@ function getElementRef$1(element) {
|
|
|
2173
2173
|
}
|
|
2174
2174
|
return element.props.ref || element.ref;
|
|
2175
2175
|
}
|
|
2176
|
+
function createCollection(name) {
|
|
2177
|
+
const PROVIDER_NAME = name + "CollectionProvider";
|
|
2178
|
+
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
2179
|
+
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
2180
|
+
PROVIDER_NAME,
|
|
2181
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
2182
|
+
);
|
|
2183
|
+
const CollectionProvider = (props) => {
|
|
2184
|
+
const { scope, children } = props;
|
|
2185
|
+
const ref = React.useRef(null);
|
|
2186
|
+
const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;
|
|
2187
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
2188
|
+
};
|
|
2189
|
+
CollectionProvider.displayName = PROVIDER_NAME;
|
|
2190
|
+
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
2191
|
+
const CollectionSlotImpl = /* @__PURE__ */ createSlot(COLLECTION_SLOT_NAME);
|
|
2192
|
+
const CollectionSlot = React.forwardRef(
|
|
2193
|
+
(props, forwardedRef) => {
|
|
2194
|
+
const { scope, children } = props;
|
|
2195
|
+
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
2196
|
+
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
2197
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionSlotImpl, { ref: composedRefs, children });
|
|
2198
|
+
}
|
|
2199
|
+
);
|
|
2200
|
+
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
2201
|
+
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
2202
|
+
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
2203
|
+
const CollectionItemSlotImpl = /* @__PURE__ */ createSlot(ITEM_SLOT_NAME);
|
|
2204
|
+
const CollectionItemSlot = React.forwardRef(
|
|
2205
|
+
(props, forwardedRef) => {
|
|
2206
|
+
const { scope, children, ...itemData } = props;
|
|
2207
|
+
const ref = React.useRef(null);
|
|
2208
|
+
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
2209
|
+
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
2210
|
+
React.useEffect(() => {
|
|
2211
|
+
context.itemMap.set(ref, { ref, ...itemData });
|
|
2212
|
+
return () => void context.itemMap.delete(ref);
|
|
2213
|
+
});
|
|
2214
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
2215
|
+
}
|
|
2216
|
+
);
|
|
2217
|
+
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
2218
|
+
function useCollection2(scope) {
|
|
2219
|
+
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
2220
|
+
const getItems = React.useCallback(() => {
|
|
2221
|
+
const collectionNode = context.collectionRef.current;
|
|
2222
|
+
if (!collectionNode) return [];
|
|
2223
|
+
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
2224
|
+
const items = Array.from(context.itemMap.values());
|
|
2225
|
+
const orderedItems = items.sort(
|
|
2226
|
+
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
2227
|
+
);
|
|
2228
|
+
return orderedItems;
|
|
2229
|
+
}, [context.collectionRef, context.itemMap]);
|
|
2230
|
+
return getItems;
|
|
2231
|
+
}
|
|
2232
|
+
return [
|
|
2233
|
+
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
2234
|
+
useCollection2,
|
|
2235
|
+
createCollectionScope2
|
|
2236
|
+
];
|
|
2237
|
+
}
|
|
2176
2238
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
2177
2239
|
return function handleEvent(event) {
|
|
2178
2240
|
originalEventHandler?.(event);
|
|
@@ -2267,21 +2329,18 @@ var NODES = [
|
|
|
2267
2329
|
"ul"
|
|
2268
2330
|
];
|
|
2269
2331
|
var Primitive = NODES.reduce((primitive, node) => {
|
|
2270
|
-
const
|
|
2271
|
-
const
|
|
2332
|
+
const Slot = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
2333
|
+
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
2272
2334
|
const { asChild, ...primitiveProps } = props;
|
|
2273
|
-
const Comp = asChild ?
|
|
2335
|
+
const Comp = asChild ? Slot : node;
|
|
2274
2336
|
if (typeof window !== "undefined") {
|
|
2275
2337
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
2276
2338
|
}
|
|
2277
2339
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
2278
2340
|
});
|
|
2279
|
-
|
|
2280
|
-
return { ...primitive, [node]:
|
|
2341
|
+
Node.displayName = `Primitive.${node}`;
|
|
2342
|
+
return { ...primitive, [node]: Node };
|
|
2281
2343
|
}, {});
|
|
2282
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
2283
|
-
if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
|
|
2284
|
-
}
|
|
2285
2344
|
function useStateMachine(initialState, machine) {
|
|
2286
2345
|
return React__namespace.useReducer((state, event) => {
|
|
2287
2346
|
const nextState = machine[state][event];
|
|
@@ -2405,16 +2464,16 @@ function getElementRef(element) {
|
|
|
2405
2464
|
return element.props.ref || element.ref;
|
|
2406
2465
|
}
|
|
2407
2466
|
var useReactId = React__namespace[" useId ".trim().toString()] || (() => void 0);
|
|
2408
|
-
var count
|
|
2467
|
+
var count = 0;
|
|
2409
2468
|
function useId(deterministicId) {
|
|
2410
2469
|
const [id, setId] = React__namespace.useState(useReactId());
|
|
2411
2470
|
useLayoutEffect2(() => {
|
|
2412
|
-
setId((reactId) => reactId ?? String(count
|
|
2471
|
+
setId((reactId) => reactId ?? String(count++));
|
|
2413
2472
|
}, [deterministicId]);
|
|
2414
2473
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
2415
2474
|
}
|
|
2416
2475
|
var COLLAPSIBLE_NAME = "Collapsible";
|
|
2417
|
-
var [createCollapsibleContext] = createContextScope(COLLAPSIBLE_NAME);
|
|
2476
|
+
var [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);
|
|
2418
2477
|
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
|
|
2419
2478
|
var Collapsible = React__namespace.forwardRef(
|
|
2420
2479
|
(props, forwardedRef) => {
|
|
@@ -2443,7 +2502,7 @@ var Collapsible = React__namespace.forwardRef(
|
|
|
2443
2502
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2444
2503
|
Primitive.div,
|
|
2445
2504
|
{
|
|
2446
|
-
"data-state": getState$
|
|
2505
|
+
"data-state": getState$2(open2),
|
|
2447
2506
|
"data-disabled": disabled ? "" : void 0,
|
|
2448
2507
|
...collapsibleProps,
|
|
2449
2508
|
ref: forwardedRef
|
|
@@ -2465,7 +2524,7 @@ var CollapsibleTrigger = React__namespace.forwardRef(
|
|
|
2465
2524
|
type: "button",
|
|
2466
2525
|
"aria-controls": context.contentId,
|
|
2467
2526
|
"aria-expanded": context.open || false,
|
|
2468
|
-
"data-state": getState$
|
|
2527
|
+
"data-state": getState$2(context.open),
|
|
2469
2528
|
"data-disabled": context.disabled ? "" : void 0,
|
|
2470
2529
|
disabled: context.disabled,
|
|
2471
2530
|
...triggerProps,
|
|
@@ -2524,7 +2583,7 @@ var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) =
|
|
|
2524
2583
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2525
2584
|
Primitive.div,
|
|
2526
2585
|
{
|
|
2527
|
-
"data-state": getState$
|
|
2586
|
+
"data-state": getState$2(context.open),
|
|
2528
2587
|
"data-disabled": context.disabled ? "" : void 0,
|
|
2529
2588
|
id: context.contentId,
|
|
2530
2589
|
hidden: !isOpen,
|
|
@@ -2539,11 +2598,307 @@ var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) =
|
|
|
2539
2598
|
}
|
|
2540
2599
|
);
|
|
2541
2600
|
});
|
|
2542
|
-
function getState$
|
|
2601
|
+
function getState$2(open2) {
|
|
2543
2602
|
return open2 ? "open" : "closed";
|
|
2544
2603
|
}
|
|
2545
2604
|
var Root$1 = Collapsible;
|
|
2546
2605
|
var Trigger = CollapsibleTrigger;
|
|
2606
|
+
var Content = CollapsibleContent;
|
|
2607
|
+
var DirectionContext = React__namespace.createContext(void 0);
|
|
2608
|
+
function useDirection(localDir) {
|
|
2609
|
+
const globalDir = React__namespace.useContext(DirectionContext);
|
|
2610
|
+
return localDir || globalDir || "ltr";
|
|
2611
|
+
}
|
|
2612
|
+
var ACCORDION_NAME = "Accordion";
|
|
2613
|
+
var ACCORDION_KEYS = ["Home", "End", "ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"];
|
|
2614
|
+
var [Collection, useCollection, createCollectionScope] = createCollection(ACCORDION_NAME);
|
|
2615
|
+
var [createAccordionContext] = createContextScope(ACCORDION_NAME, [
|
|
2616
|
+
createCollectionScope,
|
|
2617
|
+
createCollapsibleScope
|
|
2618
|
+
]);
|
|
2619
|
+
var useCollapsibleScope = createCollapsibleScope();
|
|
2620
|
+
var Accordion = React.forwardRef(
|
|
2621
|
+
(props, forwardedRef) => {
|
|
2622
|
+
const { type, ...accordionProps } = props;
|
|
2623
|
+
const singleProps = accordionProps;
|
|
2624
|
+
const multipleProps = accordionProps;
|
|
2625
|
+
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 }) });
|
|
2626
|
+
}
|
|
2627
|
+
);
|
|
2628
|
+
Accordion.displayName = ACCORDION_NAME;
|
|
2629
|
+
var [AccordionValueProvider, useAccordionValueContext] = createAccordionContext(ACCORDION_NAME);
|
|
2630
|
+
var [AccordionCollapsibleProvider, useAccordionCollapsibleContext] = createAccordionContext(
|
|
2631
|
+
ACCORDION_NAME,
|
|
2632
|
+
{ collapsible: false }
|
|
2633
|
+
);
|
|
2634
|
+
var AccordionImplSingle = React.forwardRef(
|
|
2635
|
+
(props, forwardedRef) => {
|
|
2636
|
+
const {
|
|
2637
|
+
value: valueProp,
|
|
2638
|
+
defaultValue,
|
|
2639
|
+
onValueChange = () => {
|
|
2640
|
+
},
|
|
2641
|
+
collapsible: collapsible2 = false,
|
|
2642
|
+
...accordionSingleProps
|
|
2643
|
+
} = props;
|
|
2644
|
+
const [value, setValue] = useControllableState({
|
|
2645
|
+
prop: valueProp,
|
|
2646
|
+
defaultProp: defaultValue ?? "",
|
|
2647
|
+
onChange: onValueChange,
|
|
2648
|
+
caller: ACCORDION_NAME
|
|
2649
|
+
});
|
|
2650
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2651
|
+
AccordionValueProvider,
|
|
2652
|
+
{
|
|
2653
|
+
scope: props.__scopeAccordion,
|
|
2654
|
+
value: React.useMemo(() => value ? [value] : [], [value]),
|
|
2655
|
+
onItemOpen: setValue,
|
|
2656
|
+
onItemClose: React.useCallback(() => collapsible2 && setValue(""), [collapsible2, setValue]),
|
|
2657
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: collapsible2, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionImpl, { ...accordionSingleProps, ref: forwardedRef }) })
|
|
2658
|
+
}
|
|
2659
|
+
);
|
|
2660
|
+
}
|
|
2661
|
+
);
|
|
2662
|
+
var AccordionImplMultiple = React.forwardRef((props, forwardedRef) => {
|
|
2663
|
+
const {
|
|
2664
|
+
value: valueProp,
|
|
2665
|
+
defaultValue,
|
|
2666
|
+
onValueChange = () => {
|
|
2667
|
+
},
|
|
2668
|
+
...accordionMultipleProps
|
|
2669
|
+
} = props;
|
|
2670
|
+
const [value, setValue] = useControllableState({
|
|
2671
|
+
prop: valueProp,
|
|
2672
|
+
defaultProp: defaultValue ?? [],
|
|
2673
|
+
onChange: onValueChange,
|
|
2674
|
+
caller: ACCORDION_NAME
|
|
2675
|
+
});
|
|
2676
|
+
const handleItemOpen = React.useCallback(
|
|
2677
|
+
(itemValue) => setValue((prevValue = []) => [...prevValue, itemValue]),
|
|
2678
|
+
[setValue]
|
|
2679
|
+
);
|
|
2680
|
+
const handleItemClose = React.useCallback(
|
|
2681
|
+
(itemValue) => setValue((prevValue = []) => prevValue.filter((value2) => value2 !== itemValue)),
|
|
2682
|
+
[setValue]
|
|
2683
|
+
);
|
|
2684
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2685
|
+
AccordionValueProvider,
|
|
2686
|
+
{
|
|
2687
|
+
scope: props.__scopeAccordion,
|
|
2688
|
+
value,
|
|
2689
|
+
onItemOpen: handleItemOpen,
|
|
2690
|
+
onItemClose: handleItemClose,
|
|
2691
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionCollapsibleProvider, { scope: props.__scopeAccordion, collapsible: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(AccordionImpl, { ...accordionMultipleProps, ref: forwardedRef }) })
|
|
2692
|
+
}
|
|
2693
|
+
);
|
|
2694
|
+
});
|
|
2695
|
+
var [AccordionImplProvider, useAccordionContext] = createAccordionContext(ACCORDION_NAME);
|
|
2696
|
+
var AccordionImpl = React.forwardRef(
|
|
2697
|
+
(props, forwardedRef) => {
|
|
2698
|
+
const { __scopeAccordion, disabled, dir, orientation = "vertical", ...accordionProps } = props;
|
|
2699
|
+
const accordionRef = React.useRef(null);
|
|
2700
|
+
const composedRefs = useComposedRefs(accordionRef, forwardedRef);
|
|
2701
|
+
const getItems = useCollection(__scopeAccordion);
|
|
2702
|
+
const direction = useDirection(dir);
|
|
2703
|
+
const isDirectionLTR = direction === "ltr";
|
|
2704
|
+
const handleKeyDown = composeEventHandlers(props.onKeyDown, (event) => {
|
|
2705
|
+
if (!ACCORDION_KEYS.includes(event.key)) return;
|
|
2706
|
+
const target = event.target;
|
|
2707
|
+
const triggerCollection = getItems().filter((item) => !item.ref.current?.disabled);
|
|
2708
|
+
const triggerIndex = triggerCollection.findIndex((item) => item.ref.current === target);
|
|
2709
|
+
const triggerCount = triggerCollection.length;
|
|
2710
|
+
if (triggerIndex === -1) return;
|
|
2711
|
+
event.preventDefault();
|
|
2712
|
+
let nextIndex = triggerIndex;
|
|
2713
|
+
const homeIndex = 0;
|
|
2714
|
+
const endIndex = triggerCount - 1;
|
|
2715
|
+
const moveNext = () => {
|
|
2716
|
+
nextIndex = triggerIndex + 1;
|
|
2717
|
+
if (nextIndex > endIndex) {
|
|
2718
|
+
nextIndex = homeIndex;
|
|
2719
|
+
}
|
|
2720
|
+
};
|
|
2721
|
+
const movePrev = () => {
|
|
2722
|
+
nextIndex = triggerIndex - 1;
|
|
2723
|
+
if (nextIndex < homeIndex) {
|
|
2724
|
+
nextIndex = endIndex;
|
|
2725
|
+
}
|
|
2726
|
+
};
|
|
2727
|
+
switch (event.key) {
|
|
2728
|
+
case "Home":
|
|
2729
|
+
nextIndex = homeIndex;
|
|
2730
|
+
break;
|
|
2731
|
+
case "End":
|
|
2732
|
+
nextIndex = endIndex;
|
|
2733
|
+
break;
|
|
2734
|
+
case "ArrowRight":
|
|
2735
|
+
if (orientation === "horizontal") {
|
|
2736
|
+
if (isDirectionLTR) {
|
|
2737
|
+
moveNext();
|
|
2738
|
+
} else {
|
|
2739
|
+
movePrev();
|
|
2740
|
+
}
|
|
2741
|
+
}
|
|
2742
|
+
break;
|
|
2743
|
+
case "ArrowDown":
|
|
2744
|
+
if (orientation === "vertical") {
|
|
2745
|
+
moveNext();
|
|
2746
|
+
}
|
|
2747
|
+
break;
|
|
2748
|
+
case "ArrowLeft":
|
|
2749
|
+
if (orientation === "horizontal") {
|
|
2750
|
+
if (isDirectionLTR) {
|
|
2751
|
+
movePrev();
|
|
2752
|
+
} else {
|
|
2753
|
+
moveNext();
|
|
2754
|
+
}
|
|
2755
|
+
}
|
|
2756
|
+
break;
|
|
2757
|
+
case "ArrowUp":
|
|
2758
|
+
if (orientation === "vertical") {
|
|
2759
|
+
movePrev();
|
|
2760
|
+
}
|
|
2761
|
+
break;
|
|
2762
|
+
}
|
|
2763
|
+
const clampedIndex = nextIndex % triggerCount;
|
|
2764
|
+
triggerCollection[clampedIndex].ref.current?.focus();
|
|
2765
|
+
});
|
|
2766
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2767
|
+
AccordionImplProvider,
|
|
2768
|
+
{
|
|
2769
|
+
scope: __scopeAccordion,
|
|
2770
|
+
disabled,
|
|
2771
|
+
direction: dir,
|
|
2772
|
+
orientation,
|
|
2773
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.Slot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2774
|
+
Primitive.div,
|
|
2775
|
+
{
|
|
2776
|
+
...accordionProps,
|
|
2777
|
+
"data-orientation": orientation,
|
|
2778
|
+
ref: composedRefs,
|
|
2779
|
+
onKeyDown: disabled ? void 0 : handleKeyDown
|
|
2780
|
+
}
|
|
2781
|
+
) })
|
|
2782
|
+
}
|
|
2783
|
+
);
|
|
2784
|
+
}
|
|
2785
|
+
);
|
|
2786
|
+
var ITEM_NAME = "AccordionItem";
|
|
2787
|
+
var [AccordionItemProvider, useAccordionItemContext] = createAccordionContext(ITEM_NAME);
|
|
2788
|
+
var AccordionItem = React.forwardRef(
|
|
2789
|
+
(props, forwardedRef) => {
|
|
2790
|
+
const { __scopeAccordion, value, ...accordionItemProps } = props;
|
|
2791
|
+
const accordionContext = useAccordionContext(ITEM_NAME, __scopeAccordion);
|
|
2792
|
+
const valueContext = useAccordionValueContext(ITEM_NAME, __scopeAccordion);
|
|
2793
|
+
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
|
|
2794
|
+
const triggerId = useId();
|
|
2795
|
+
const open2 = value && valueContext.value.includes(value) || false;
|
|
2796
|
+
const disabled = accordionContext.disabled || props.disabled;
|
|
2797
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2798
|
+
AccordionItemProvider,
|
|
2799
|
+
{
|
|
2800
|
+
scope: __scopeAccordion,
|
|
2801
|
+
open: open2,
|
|
2802
|
+
disabled,
|
|
2803
|
+
triggerId,
|
|
2804
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2805
|
+
Root$1,
|
|
2806
|
+
{
|
|
2807
|
+
"data-orientation": accordionContext.orientation,
|
|
2808
|
+
"data-state": getState$1(open2),
|
|
2809
|
+
...collapsibleScope,
|
|
2810
|
+
...accordionItemProps,
|
|
2811
|
+
ref: forwardedRef,
|
|
2812
|
+
disabled,
|
|
2813
|
+
open: open2,
|
|
2814
|
+
onOpenChange: (open22) => {
|
|
2815
|
+
if (open22) {
|
|
2816
|
+
valueContext.onItemOpen(value);
|
|
2817
|
+
} else {
|
|
2818
|
+
valueContext.onItemClose(value);
|
|
2819
|
+
}
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
)
|
|
2823
|
+
}
|
|
2824
|
+
);
|
|
2825
|
+
}
|
|
2826
|
+
);
|
|
2827
|
+
AccordionItem.displayName = ITEM_NAME;
|
|
2828
|
+
var HEADER_NAME = "AccordionHeader";
|
|
2829
|
+
var AccordionHeader = React.forwardRef(
|
|
2830
|
+
(props, forwardedRef) => {
|
|
2831
|
+
const { __scopeAccordion, ...headerProps } = props;
|
|
2832
|
+
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
|
|
2833
|
+
const itemContext = useAccordionItemContext(HEADER_NAME, __scopeAccordion);
|
|
2834
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2835
|
+
Primitive.h3,
|
|
2836
|
+
{
|
|
2837
|
+
"data-orientation": accordionContext.orientation,
|
|
2838
|
+
"data-state": getState$1(itemContext.open),
|
|
2839
|
+
"data-disabled": itemContext.disabled ? "" : void 0,
|
|
2840
|
+
...headerProps,
|
|
2841
|
+
ref: forwardedRef
|
|
2842
|
+
}
|
|
2843
|
+
);
|
|
2844
|
+
}
|
|
2845
|
+
);
|
|
2846
|
+
AccordionHeader.displayName = HEADER_NAME;
|
|
2847
|
+
var TRIGGER_NAME = "AccordionTrigger";
|
|
2848
|
+
var AccordionTrigger = React.forwardRef(
|
|
2849
|
+
(props, forwardedRef) => {
|
|
2850
|
+
const { __scopeAccordion, ...triggerProps } = props;
|
|
2851
|
+
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
|
|
2852
|
+
const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);
|
|
2853
|
+
const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);
|
|
2854
|
+
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
|
|
2855
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.ItemSlot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2856
|
+
Trigger,
|
|
2857
|
+
{
|
|
2858
|
+
"aria-disabled": itemContext.open && !collapsibleContext.collapsible || void 0,
|
|
2859
|
+
"data-orientation": accordionContext.orientation,
|
|
2860
|
+
id: itemContext.triggerId,
|
|
2861
|
+
...collapsibleScope,
|
|
2862
|
+
...triggerProps,
|
|
2863
|
+
ref: forwardedRef
|
|
2864
|
+
}
|
|
2865
|
+
) });
|
|
2866
|
+
}
|
|
2867
|
+
);
|
|
2868
|
+
AccordionTrigger.displayName = TRIGGER_NAME;
|
|
2869
|
+
var CONTENT_NAME = "AccordionContent";
|
|
2870
|
+
var AccordionContent = React.forwardRef(
|
|
2871
|
+
(props, forwardedRef) => {
|
|
2872
|
+
const { __scopeAccordion, ...contentProps } = props;
|
|
2873
|
+
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
|
|
2874
|
+
const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);
|
|
2875
|
+
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
|
|
2876
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2877
|
+
Content,
|
|
2878
|
+
{
|
|
2879
|
+
role: "region",
|
|
2880
|
+
"aria-labelledby": itemContext.triggerId,
|
|
2881
|
+
"data-orientation": accordionContext.orientation,
|
|
2882
|
+
...collapsibleScope,
|
|
2883
|
+
...contentProps,
|
|
2884
|
+
ref: forwardedRef,
|
|
2885
|
+
style: {
|
|
2886
|
+
["--radix-accordion-content-height"]: "var(--radix-collapsible-content-height)",
|
|
2887
|
+
["--radix-accordion-content-width"]: "var(--radix-collapsible-content-width)",
|
|
2888
|
+
...props.style
|
|
2889
|
+
}
|
|
2890
|
+
}
|
|
2891
|
+
);
|
|
2892
|
+
}
|
|
2893
|
+
);
|
|
2894
|
+
AccordionContent.displayName = CONTENT_NAME;
|
|
2895
|
+
function getState$1(open2) {
|
|
2896
|
+
return open2 ? "open" : "closed";
|
|
2897
|
+
}
|
|
2898
|
+
var Root2 = Accordion;
|
|
2899
|
+
var Item = AccordionItem;
|
|
2900
|
+
var Trigger2 = AccordionTrigger;
|
|
2901
|
+
var Content2 = AccordionContent;
|
|
2547
2902
|
const mergeClasses = (...classes2) => classes2.filter((className, index, array) => {
|
|
2548
2903
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
2549
2904
|
}).join(" ").trim();
|
|
@@ -2620,8 +2975,207 @@ const createLucideIcon = (iconName, iconNode) => {
|
|
|
2620
2975
|
Component.displayName = toPascalCase(iconName);
|
|
2621
2976
|
return Component;
|
|
2622
2977
|
};
|
|
2978
|
+
const __iconNode$1 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
2979
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$1);
|
|
2623
2980
|
const __iconNode = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
|
|
2624
2981
|
const ChevronUp = createLucideIcon("chevron-up", __iconNode);
|
|
2982
|
+
function usePrevious(value) {
|
|
2983
|
+
const ref = React__namespace.useRef({ value, previous: value });
|
|
2984
|
+
return React__namespace.useMemo(() => {
|
|
2985
|
+
if (ref.current.value !== value) {
|
|
2986
|
+
ref.current.previous = ref.current.value;
|
|
2987
|
+
ref.current.value = value;
|
|
2988
|
+
}
|
|
2989
|
+
return ref.current.previous;
|
|
2990
|
+
}, [value]);
|
|
2991
|
+
}
|
|
2992
|
+
function useSize(element) {
|
|
2993
|
+
const [size, setSize] = React__namespace.useState(void 0);
|
|
2994
|
+
useLayoutEffect2(() => {
|
|
2995
|
+
if (element) {
|
|
2996
|
+
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
2997
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
2998
|
+
if (!Array.isArray(entries)) {
|
|
2999
|
+
return;
|
|
3000
|
+
}
|
|
3001
|
+
if (!entries.length) {
|
|
3002
|
+
return;
|
|
3003
|
+
}
|
|
3004
|
+
const entry = entries[0];
|
|
3005
|
+
let width;
|
|
3006
|
+
let height;
|
|
3007
|
+
if ("borderBoxSize" in entry) {
|
|
3008
|
+
const borderSizeEntry = entry["borderBoxSize"];
|
|
3009
|
+
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
3010
|
+
width = borderSize["inlineSize"];
|
|
3011
|
+
height = borderSize["blockSize"];
|
|
3012
|
+
} else {
|
|
3013
|
+
width = element.offsetWidth;
|
|
3014
|
+
height = element.offsetHeight;
|
|
3015
|
+
}
|
|
3016
|
+
setSize({ width, height });
|
|
3017
|
+
});
|
|
3018
|
+
resizeObserver.observe(element, { box: "border-box" });
|
|
3019
|
+
return () => resizeObserver.unobserve(element);
|
|
3020
|
+
} else {
|
|
3021
|
+
setSize(void 0);
|
|
3022
|
+
}
|
|
3023
|
+
}, [element]);
|
|
3024
|
+
return size;
|
|
3025
|
+
}
|
|
3026
|
+
var SWITCH_NAME = "Switch";
|
|
3027
|
+
var [createSwitchContext] = createContextScope(SWITCH_NAME);
|
|
3028
|
+
var [SwitchProvider, useSwitchContext] = createSwitchContext(SWITCH_NAME);
|
|
3029
|
+
var Switch$1 = React__namespace.forwardRef(
|
|
3030
|
+
(props, forwardedRef) => {
|
|
3031
|
+
const {
|
|
3032
|
+
__scopeSwitch,
|
|
3033
|
+
name,
|
|
3034
|
+
checked: checkedProp,
|
|
3035
|
+
defaultChecked,
|
|
3036
|
+
required,
|
|
3037
|
+
disabled,
|
|
3038
|
+
value = "on",
|
|
3039
|
+
onCheckedChange,
|
|
3040
|
+
form,
|
|
3041
|
+
...switchProps
|
|
3042
|
+
} = props;
|
|
3043
|
+
const [button, setButton] = React__namespace.useState(null);
|
|
3044
|
+
const composedRefs = useComposedRefs(forwardedRef, (node) => setButton(node));
|
|
3045
|
+
const hasConsumerStoppedPropagationRef = React__namespace.useRef(false);
|
|
3046
|
+
const isFormControl = button ? form || !!button.closest("form") : true;
|
|
3047
|
+
const [checked, setChecked] = useControllableState({
|
|
3048
|
+
prop: checkedProp,
|
|
3049
|
+
defaultProp: defaultChecked ?? false,
|
|
3050
|
+
onChange: onCheckedChange,
|
|
3051
|
+
caller: SWITCH_NAME
|
|
3052
|
+
});
|
|
3053
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(SwitchProvider, { scope: __scopeSwitch, checked, disabled, children: [
|
|
3054
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3055
|
+
Primitive.button,
|
|
3056
|
+
{
|
|
3057
|
+
type: "button",
|
|
3058
|
+
role: "switch",
|
|
3059
|
+
"aria-checked": checked,
|
|
3060
|
+
"aria-required": required,
|
|
3061
|
+
"data-state": getState(checked),
|
|
3062
|
+
"data-disabled": disabled ? "" : void 0,
|
|
3063
|
+
disabled,
|
|
3064
|
+
value,
|
|
3065
|
+
...switchProps,
|
|
3066
|
+
ref: composedRefs,
|
|
3067
|
+
onClick: composeEventHandlers(props.onClick, (event) => {
|
|
3068
|
+
setChecked((prevChecked) => !prevChecked);
|
|
3069
|
+
if (isFormControl) {
|
|
3070
|
+
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
3071
|
+
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
3072
|
+
}
|
|
3073
|
+
})
|
|
3074
|
+
}
|
|
3075
|
+
),
|
|
3076
|
+
isFormControl && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3077
|
+
SwitchBubbleInput,
|
|
3078
|
+
{
|
|
3079
|
+
control: button,
|
|
3080
|
+
bubbles: !hasConsumerStoppedPropagationRef.current,
|
|
3081
|
+
name,
|
|
3082
|
+
value,
|
|
3083
|
+
checked,
|
|
3084
|
+
required,
|
|
3085
|
+
disabled,
|
|
3086
|
+
form,
|
|
3087
|
+
style: { transform: "translateX(-100%)" }
|
|
3088
|
+
}
|
|
3089
|
+
)
|
|
3090
|
+
] });
|
|
3091
|
+
}
|
|
3092
|
+
);
|
|
3093
|
+
Switch$1.displayName = SWITCH_NAME;
|
|
3094
|
+
var THUMB_NAME = "SwitchThumb";
|
|
3095
|
+
var SwitchThumb = React__namespace.forwardRef(
|
|
3096
|
+
(props, forwardedRef) => {
|
|
3097
|
+
const { __scopeSwitch, ...thumbProps } = props;
|
|
3098
|
+
const context = useSwitchContext(THUMB_NAME, __scopeSwitch);
|
|
3099
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3100
|
+
Primitive.span,
|
|
3101
|
+
{
|
|
3102
|
+
"data-state": getState(context.checked),
|
|
3103
|
+
"data-disabled": context.disabled ? "" : void 0,
|
|
3104
|
+
...thumbProps,
|
|
3105
|
+
ref: forwardedRef
|
|
3106
|
+
}
|
|
3107
|
+
);
|
|
3108
|
+
}
|
|
3109
|
+
);
|
|
3110
|
+
SwitchThumb.displayName = THUMB_NAME;
|
|
3111
|
+
var BUBBLE_INPUT_NAME = "SwitchBubbleInput";
|
|
3112
|
+
var SwitchBubbleInput = React__namespace.forwardRef(
|
|
3113
|
+
({
|
|
3114
|
+
__scopeSwitch,
|
|
3115
|
+
control,
|
|
3116
|
+
checked,
|
|
3117
|
+
bubbles = true,
|
|
3118
|
+
...props
|
|
3119
|
+
}, forwardedRef) => {
|
|
3120
|
+
const ref = React__namespace.useRef(null);
|
|
3121
|
+
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
3122
|
+
const prevChecked = usePrevious(checked);
|
|
3123
|
+
const controlSize = useSize(control);
|
|
3124
|
+
React__namespace.useEffect(() => {
|
|
3125
|
+
const input = ref.current;
|
|
3126
|
+
if (!input) return;
|
|
3127
|
+
const inputProto = window.HTMLInputElement.prototype;
|
|
3128
|
+
const descriptor = Object.getOwnPropertyDescriptor(
|
|
3129
|
+
inputProto,
|
|
3130
|
+
"checked"
|
|
3131
|
+
);
|
|
3132
|
+
const setChecked = descriptor.set;
|
|
3133
|
+
if (prevChecked !== checked && setChecked) {
|
|
3134
|
+
const event = new Event("click", { bubbles });
|
|
3135
|
+
setChecked.call(input, checked);
|
|
3136
|
+
input.dispatchEvent(event);
|
|
3137
|
+
}
|
|
3138
|
+
}, [prevChecked, checked, bubbles]);
|
|
3139
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3140
|
+
"input",
|
|
3141
|
+
{
|
|
3142
|
+
type: "checkbox",
|
|
3143
|
+
"aria-hidden": true,
|
|
3144
|
+
defaultChecked: checked,
|
|
3145
|
+
...props,
|
|
3146
|
+
tabIndex: -1,
|
|
3147
|
+
ref: composedRefs,
|
|
3148
|
+
style: {
|
|
3149
|
+
...props.style,
|
|
3150
|
+
...controlSize,
|
|
3151
|
+
position: "absolute",
|
|
3152
|
+
pointerEvents: "none",
|
|
3153
|
+
opacity: 0,
|
|
3154
|
+
margin: 0
|
|
3155
|
+
}
|
|
3156
|
+
}
|
|
3157
|
+
);
|
|
3158
|
+
}
|
|
3159
|
+
);
|
|
3160
|
+
SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
3161
|
+
function getState(checked) {
|
|
3162
|
+
return checked ? "checked" : "unchecked";
|
|
3163
|
+
}
|
|
3164
|
+
var Root = Switch$1;
|
|
3165
|
+
var Thumb = SwitchThumb;
|
|
3166
|
+
const root = "_root_dibqz_1";
|
|
3167
|
+
const thumb = "_thumb_dibqz_38";
|
|
3168
|
+
const classes = {
|
|
3169
|
+
root,
|
|
3170
|
+
"switch": "_switch_dibqz_8",
|
|
3171
|
+
thumb
|
|
3172
|
+
};
|
|
3173
|
+
const Switch = ({ label: label2, id, ...rest }) => {
|
|
3174
|
+
return /* @__PURE__ */ u("div", { className: classes.root, children: [
|
|
3175
|
+
label2 && /* @__PURE__ */ u(Text, { className: classes.label, as: "label", htmlFor: id, children: label2 }),
|
|
3176
|
+
/* @__PURE__ */ u(Root, { className: classes.switch, ...rest, children: /* @__PURE__ */ u(Thumb, { className: classes.thumb }) })
|
|
3177
|
+
] });
|
|
3178
|
+
};
|
|
2625
3179
|
const selectionSchema = /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ boolean());
|
|
2626
3180
|
const SelectionContext = React.createContext(null);
|
|
2627
3181
|
const SelectionProvider = ({
|
|
@@ -2742,1518 +3296,68 @@ function useSelection() {
|
|
|
2742
3296
|
}
|
|
2743
3297
|
return context;
|
|
2744
3298
|
}
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
const
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
onPointerDownOutside?.(event);
|
|
2801
|
-
onInteractOutside?.(event);
|
|
2802
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
2803
|
-
}, ownerDocument);
|
|
2804
|
-
const focusOutside = useFocusOutside((event) => {
|
|
2805
|
-
const target = event.target;
|
|
2806
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2807
|
-
if (isFocusInBranch) return;
|
|
2808
|
-
onFocusOutside?.(event);
|
|
2809
|
-
onInteractOutside?.(event);
|
|
2810
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
2811
|
-
}, ownerDocument);
|
|
2812
|
-
useEscapeKeydown((event) => {
|
|
2813
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
2814
|
-
if (!isHighestLayer) return;
|
|
2815
|
-
onEscapeKeyDown?.(event);
|
|
2816
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
2817
|
-
event.preventDefault();
|
|
2818
|
-
onDismiss();
|
|
2819
|
-
}
|
|
2820
|
-
}, ownerDocument);
|
|
2821
|
-
React__namespace.useEffect(() => {
|
|
2822
|
-
if (!node) return;
|
|
2823
|
-
if (disableOutsidePointerEvents) {
|
|
2824
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
2825
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
2826
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
2827
|
-
}
|
|
2828
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
2829
|
-
}
|
|
2830
|
-
context.layers.add(node);
|
|
2831
|
-
dispatchUpdate();
|
|
2832
|
-
return () => {
|
|
2833
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
2834
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
2835
|
-
}
|
|
2836
|
-
};
|
|
2837
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
2838
|
-
React__namespace.useEffect(() => {
|
|
2839
|
-
return () => {
|
|
2840
|
-
if (!node) return;
|
|
2841
|
-
context.layers.delete(node);
|
|
2842
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
2843
|
-
dispatchUpdate();
|
|
2844
|
-
};
|
|
2845
|
-
}, [node, context]);
|
|
2846
|
-
React__namespace.useEffect(() => {
|
|
2847
|
-
const handleUpdate = () => force({});
|
|
2848
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
2849
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
2850
|
-
}, []);
|
|
2851
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2852
|
-
Primitive.div,
|
|
3299
|
+
const BannerItem = ({
|
|
3300
|
+
value,
|
|
3301
|
+
label: label2,
|
|
3302
|
+
sublabel,
|
|
3303
|
+
required = false,
|
|
3304
|
+
description: description2,
|
|
3305
|
+
openItem
|
|
3306
|
+
}) => {
|
|
3307
|
+
const { toggleSelection, selection } = useSelection();
|
|
3308
|
+
const selected = React.useMemo(
|
|
3309
|
+
() => selection?.[value] ?? false,
|
|
3310
|
+
[selection, value]
|
|
3311
|
+
);
|
|
3312
|
+
React.useEffect(() => {
|
|
3313
|
+
toggleSelection(value, selected);
|
|
3314
|
+
}, [value, selected]);
|
|
3315
|
+
const checked = React.useMemo(
|
|
3316
|
+
() => required ? true : selected,
|
|
3317
|
+
[required, selected]
|
|
3318
|
+
);
|
|
3319
|
+
const onCheckedChange = React.useMemo(
|
|
3320
|
+
() => (checked2) => required ? () => {
|
|
3321
|
+
} : toggleSelection(value, checked2),
|
|
3322
|
+
[required, toggleSelection, value]
|
|
3323
|
+
);
|
|
3324
|
+
const disabled = React.useMemo(() => required, [required]);
|
|
3325
|
+
return /* @__PURE__ */ u(Item, { value, className: classes$1.root, children: [
|
|
3326
|
+
/* @__PURE__ */ u("div", { className: classes$1.header, children: [
|
|
3327
|
+
/* @__PURE__ */ u(Trigger2, { asChild: true, children: /* @__PURE__ */ u("div", { className: classes$1.label, children: [
|
|
3328
|
+
/* @__PURE__ */ u(Text, { weight: "bold", children: label2 }),
|
|
3329
|
+
sublabel && /* @__PURE__ */ u(Text, { size: "caption", color: "muted", children: sublabel })
|
|
3330
|
+
] }) }),
|
|
3331
|
+
/* @__PURE__ */ u("div", { className: classes$1.actions, children: [
|
|
3332
|
+
/* @__PURE__ */ u(
|
|
3333
|
+
Switch,
|
|
3334
|
+
{
|
|
3335
|
+
checked,
|
|
3336
|
+
onCheckedChange,
|
|
3337
|
+
disabled
|
|
3338
|
+
}
|
|
3339
|
+
),
|
|
3340
|
+
/* @__PURE__ */ u(Trigger2, { asChild: true, children: /* @__PURE__ */ u(
|
|
3341
|
+
ChevronDown,
|
|
3342
|
+
{
|
|
3343
|
+
size: 16,
|
|
3344
|
+
className: clx({
|
|
3345
|
+
[classes$1.chevron]: true,
|
|
3346
|
+
[classes$1.open]: openItem === value
|
|
3347
|
+
})
|
|
3348
|
+
}
|
|
3349
|
+
) })
|
|
3350
|
+
] })
|
|
3351
|
+
] }),
|
|
3352
|
+
description2 && /* @__PURE__ */ u(Content2, { className: classes$1.description, children: /* @__PURE__ */ u(
|
|
3353
|
+
Text,
|
|
2853
3354
|
{
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
style: {
|
|
2857
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
2858
|
-
...props.style
|
|
2859
|
-
},
|
|
2860
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
2861
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
2862
|
-
onPointerDownCapture: composeEventHandlers(
|
|
2863
|
-
props.onPointerDownCapture,
|
|
2864
|
-
pointerDownOutside.onPointerDownCapture
|
|
2865
|
-
)
|
|
2866
|
-
}
|
|
2867
|
-
);
|
|
2868
|
-
}
|
|
2869
|
-
);
|
|
2870
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
2871
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
2872
|
-
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
2873
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
2874
|
-
const ref = React__namespace.useRef(null);
|
|
2875
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
2876
|
-
React__namespace.useEffect(() => {
|
|
2877
|
-
const node = ref.current;
|
|
2878
|
-
if (node) {
|
|
2879
|
-
context.branches.add(node);
|
|
2880
|
-
return () => {
|
|
2881
|
-
context.branches.delete(node);
|
|
2882
|
-
};
|
|
2883
|
-
}
|
|
2884
|
-
}, [context.branches]);
|
|
2885
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
2886
|
-
});
|
|
2887
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
2888
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
2889
|
-
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
2890
|
-
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
2891
|
-
const handleClickRef = React__namespace.useRef(() => {
|
|
2892
|
-
});
|
|
2893
|
-
React__namespace.useEffect(() => {
|
|
2894
|
-
const handlePointerDown = (event) => {
|
|
2895
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
2896
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
2897
|
-
handleAndDispatchCustomEvent(
|
|
2898
|
-
POINTER_DOWN_OUTSIDE,
|
|
2899
|
-
handlePointerDownOutside,
|
|
2900
|
-
eventDetail,
|
|
2901
|
-
{ discrete: true }
|
|
2902
|
-
);
|
|
2903
|
-
};
|
|
2904
|
-
const eventDetail = { originalEvent: event };
|
|
2905
|
-
if (event.pointerType === "touch") {
|
|
2906
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2907
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
2908
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
2909
|
-
} else {
|
|
2910
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
2911
|
-
}
|
|
2912
|
-
} else {
|
|
2913
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2914
|
-
}
|
|
2915
|
-
isPointerInsideReactTreeRef.current = false;
|
|
2916
|
-
};
|
|
2917
|
-
const timerId = window.setTimeout(() => {
|
|
2918
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
2919
|
-
}, 0);
|
|
2920
|
-
return () => {
|
|
2921
|
-
window.clearTimeout(timerId);
|
|
2922
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
2923
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2924
|
-
};
|
|
2925
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
2926
|
-
return {
|
|
2927
|
-
// ensures we check React component tree (not just DOM tree)
|
|
2928
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
2929
|
-
};
|
|
2930
|
-
}
|
|
2931
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
2932
|
-
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
2933
|
-
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
2934
|
-
React__namespace.useEffect(() => {
|
|
2935
|
-
const handleFocus = (event) => {
|
|
2936
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
2937
|
-
const eventDetail = { originalEvent: event };
|
|
2938
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
2939
|
-
discrete: false
|
|
2940
|
-
});
|
|
3355
|
+
size: "caption",
|
|
3356
|
+
dangerouslySetInnerHTML: { __html: description2 }
|
|
2941
3357
|
}
|
|
2942
|
-
}
|
|
2943
|
-
|
|
2944
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
2945
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
2946
|
-
return {
|
|
2947
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
2948
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
2949
|
-
};
|
|
2950
|
-
}
|
|
2951
|
-
function dispatchUpdate() {
|
|
2952
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
2953
|
-
document.dispatchEvent(event);
|
|
2954
|
-
}
|
|
2955
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
2956
|
-
const target = detail.originalEvent.target;
|
|
2957
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
2958
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
2959
|
-
if (discrete) {
|
|
2960
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
2961
|
-
} else {
|
|
2962
|
-
target.dispatchEvent(event);
|
|
2963
|
-
}
|
|
2964
|
-
}
|
|
2965
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
2966
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
2967
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
2968
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
2969
|
-
var FocusScope = React__namespace.forwardRef((props, forwardedRef) => {
|
|
2970
|
-
const {
|
|
2971
|
-
loop = false,
|
|
2972
|
-
trapped = false,
|
|
2973
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
2974
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
2975
|
-
...scopeProps
|
|
2976
|
-
} = props;
|
|
2977
|
-
const [container, setContainer] = React__namespace.useState(null);
|
|
2978
|
-
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
2979
|
-
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
2980
|
-
const lastFocusedElementRef = React__namespace.useRef(null);
|
|
2981
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
2982
|
-
const focusScope = React__namespace.useRef({
|
|
2983
|
-
paused: false,
|
|
2984
|
-
pause() {
|
|
2985
|
-
this.paused = true;
|
|
2986
|
-
},
|
|
2987
|
-
resume() {
|
|
2988
|
-
this.paused = false;
|
|
2989
|
-
}
|
|
2990
|
-
}).current;
|
|
2991
|
-
React__namespace.useEffect(() => {
|
|
2992
|
-
if (trapped) {
|
|
2993
|
-
let handleFocusIn2 = function(event) {
|
|
2994
|
-
if (focusScope.paused || !container) return;
|
|
2995
|
-
const target = event.target;
|
|
2996
|
-
if (container.contains(target)) {
|
|
2997
|
-
lastFocusedElementRef.current = target;
|
|
2998
|
-
} else {
|
|
2999
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
3000
|
-
}
|
|
3001
|
-
}, handleFocusOut2 = function(event) {
|
|
3002
|
-
if (focusScope.paused || !container) return;
|
|
3003
|
-
const relatedTarget = event.relatedTarget;
|
|
3004
|
-
if (relatedTarget === null) return;
|
|
3005
|
-
if (!container.contains(relatedTarget)) {
|
|
3006
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
3007
|
-
}
|
|
3008
|
-
}, handleMutations2 = function(mutations) {
|
|
3009
|
-
const focusedElement = document.activeElement;
|
|
3010
|
-
if (focusedElement !== document.body) return;
|
|
3011
|
-
for (const mutation of mutations) {
|
|
3012
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
3013
|
-
}
|
|
3014
|
-
};
|
|
3015
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
3016
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
3017
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
3018
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
3019
|
-
return () => {
|
|
3020
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
3021
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
3022
|
-
mutationObserver.disconnect();
|
|
3023
|
-
};
|
|
3024
|
-
}
|
|
3025
|
-
}, [trapped, container, focusScope.paused]);
|
|
3026
|
-
React__namespace.useEffect(() => {
|
|
3027
|
-
if (container) {
|
|
3028
|
-
focusScopesStack.add(focusScope);
|
|
3029
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3030
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
3031
|
-
if (!hasFocusedCandidate) {
|
|
3032
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
3033
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
3034
|
-
container.dispatchEvent(mountEvent);
|
|
3035
|
-
if (!mountEvent.defaultPrevented) {
|
|
3036
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
3037
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
3038
|
-
focus(container);
|
|
3039
|
-
}
|
|
3040
|
-
}
|
|
3041
|
-
}
|
|
3042
|
-
return () => {
|
|
3043
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
3044
|
-
setTimeout(() => {
|
|
3045
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
3046
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
3047
|
-
container.dispatchEvent(unmountEvent);
|
|
3048
|
-
if (!unmountEvent.defaultPrevented) {
|
|
3049
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
3050
|
-
}
|
|
3051
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
3052
|
-
focusScopesStack.remove(focusScope);
|
|
3053
|
-
}, 0);
|
|
3054
|
-
};
|
|
3055
|
-
}
|
|
3056
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
3057
|
-
const handleKeyDown = React__namespace.useCallback(
|
|
3058
|
-
(event) => {
|
|
3059
|
-
if (!loop && !trapped) return;
|
|
3060
|
-
if (focusScope.paused) return;
|
|
3061
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
3062
|
-
const focusedElement = document.activeElement;
|
|
3063
|
-
if (isTabKey && focusedElement) {
|
|
3064
|
-
const container2 = event.currentTarget;
|
|
3065
|
-
const [first, last] = getTabbableEdges(container2);
|
|
3066
|
-
const hasTabbableElementsInside = first && last;
|
|
3067
|
-
if (!hasTabbableElementsInside) {
|
|
3068
|
-
if (focusedElement === container2) event.preventDefault();
|
|
3069
|
-
} else {
|
|
3070
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
3071
|
-
event.preventDefault();
|
|
3072
|
-
if (loop) focus(first, { select: true });
|
|
3073
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
3074
|
-
event.preventDefault();
|
|
3075
|
-
if (loop) focus(last, { select: true });
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
|
-
}
|
|
3079
|
-
},
|
|
3080
|
-
[loop, trapped, focusScope.paused]
|
|
3081
|
-
);
|
|
3082
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
3083
|
-
});
|
|
3084
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
3085
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
3086
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3087
|
-
for (const candidate of candidates) {
|
|
3088
|
-
focus(candidate, { select });
|
|
3089
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
|
-
function getTabbableEdges(container) {
|
|
3093
|
-
const candidates = getTabbableCandidates(container);
|
|
3094
|
-
const first = findVisible(candidates, container);
|
|
3095
|
-
const last = findVisible(candidates.reverse(), container);
|
|
3096
|
-
return [first, last];
|
|
3097
|
-
}
|
|
3098
|
-
function getTabbableCandidates(container) {
|
|
3099
|
-
const nodes = [];
|
|
3100
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
3101
|
-
acceptNode: (node) => {
|
|
3102
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
3103
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
3104
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
3105
|
-
}
|
|
3106
|
-
});
|
|
3107
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
3108
|
-
return nodes;
|
|
3109
|
-
}
|
|
3110
|
-
function findVisible(elements, container) {
|
|
3111
|
-
for (const element of elements) {
|
|
3112
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
3113
|
-
}
|
|
3114
|
-
}
|
|
3115
|
-
function isHidden(node, { upTo }) {
|
|
3116
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
3117
|
-
while (node) {
|
|
3118
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
3119
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
3120
|
-
node = node.parentElement;
|
|
3121
|
-
}
|
|
3122
|
-
return false;
|
|
3123
|
-
}
|
|
3124
|
-
function isSelectableInput(element) {
|
|
3125
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
3126
|
-
}
|
|
3127
|
-
function focus(element, { select = false } = {}) {
|
|
3128
|
-
if (element && element.focus) {
|
|
3129
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3130
|
-
element.focus({ preventScroll: true });
|
|
3131
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
3132
|
-
element.select();
|
|
3133
|
-
}
|
|
3134
|
-
}
|
|
3135
|
-
var focusScopesStack = createFocusScopesStack();
|
|
3136
|
-
function createFocusScopesStack() {
|
|
3137
|
-
let stack = [];
|
|
3138
|
-
return {
|
|
3139
|
-
add(focusScope) {
|
|
3140
|
-
const activeFocusScope = stack[0];
|
|
3141
|
-
if (focusScope !== activeFocusScope) {
|
|
3142
|
-
activeFocusScope?.pause();
|
|
3143
|
-
}
|
|
3144
|
-
stack = arrayRemove(stack, focusScope);
|
|
3145
|
-
stack.unshift(focusScope);
|
|
3146
|
-
},
|
|
3147
|
-
remove(focusScope) {
|
|
3148
|
-
stack = arrayRemove(stack, focusScope);
|
|
3149
|
-
stack[0]?.resume();
|
|
3150
|
-
}
|
|
3151
|
-
};
|
|
3152
|
-
}
|
|
3153
|
-
function arrayRemove(array, item) {
|
|
3154
|
-
const updatedArray = [...array];
|
|
3155
|
-
const index = updatedArray.indexOf(item);
|
|
3156
|
-
if (index !== -1) {
|
|
3157
|
-
updatedArray.splice(index, 1);
|
|
3158
|
-
}
|
|
3159
|
-
return updatedArray;
|
|
3160
|
-
}
|
|
3161
|
-
function removeLinks(items) {
|
|
3162
|
-
return items.filter((item) => item.tagName !== "A");
|
|
3163
|
-
}
|
|
3164
|
-
var count = 0;
|
|
3165
|
-
function useFocusGuards() {
|
|
3166
|
-
React__namespace.useEffect(() => {
|
|
3167
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
3168
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
3169
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
3170
|
-
count++;
|
|
3171
|
-
return () => {
|
|
3172
|
-
if (count === 1) {
|
|
3173
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
3174
|
-
}
|
|
3175
|
-
count--;
|
|
3176
|
-
};
|
|
3177
|
-
}, []);
|
|
3178
|
-
}
|
|
3179
|
-
function createFocusGuard() {
|
|
3180
|
-
const element = document.createElement("span");
|
|
3181
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
3182
|
-
element.tabIndex = 0;
|
|
3183
|
-
element.style.outline = "none";
|
|
3184
|
-
element.style.opacity = "0";
|
|
3185
|
-
element.style.position = "fixed";
|
|
3186
|
-
element.style.pointerEvents = "none";
|
|
3187
|
-
return element;
|
|
3188
|
-
}
|
|
3189
|
-
var __assign = function() {
|
|
3190
|
-
__assign = Object.assign || function __assign2(t) {
|
|
3191
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3192
|
-
s = arguments[i];
|
|
3193
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
3194
|
-
}
|
|
3195
|
-
return t;
|
|
3196
|
-
};
|
|
3197
|
-
return __assign.apply(this, arguments);
|
|
3198
|
-
};
|
|
3199
|
-
function __rest(s, e) {
|
|
3200
|
-
var t = {};
|
|
3201
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3202
|
-
t[p] = s[p];
|
|
3203
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3204
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3205
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3206
|
-
t[p[i]] = s[p[i]];
|
|
3207
|
-
}
|
|
3208
|
-
return t;
|
|
3209
|
-
}
|
|
3210
|
-
function __spreadArray(to, from, pack) {
|
|
3211
|
-
if (pack || arguments.length === 2) for (var i = 0, l2 = from.length, ar; i < l2; i++) {
|
|
3212
|
-
if (ar || !(i in from)) {
|
|
3213
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3214
|
-
ar[i] = from[i];
|
|
3215
|
-
}
|
|
3216
|
-
}
|
|
3217
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3218
|
-
}
|
|
3219
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
3220
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
3221
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
3222
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
3223
|
-
function assignRef(ref, value) {
|
|
3224
|
-
if (typeof ref === "function") {
|
|
3225
|
-
ref(value);
|
|
3226
|
-
} else if (ref) {
|
|
3227
|
-
ref.current = value;
|
|
3228
|
-
}
|
|
3229
|
-
return ref;
|
|
3230
|
-
}
|
|
3231
|
-
function useCallbackRef(initialValue, callback) {
|
|
3232
|
-
var ref = React.useState(function() {
|
|
3233
|
-
return {
|
|
3234
|
-
// value
|
|
3235
|
-
value: initialValue,
|
|
3236
|
-
// last callback
|
|
3237
|
-
callback,
|
|
3238
|
-
// "memoized" public interface
|
|
3239
|
-
facade: {
|
|
3240
|
-
get current() {
|
|
3241
|
-
return ref.value;
|
|
3242
|
-
},
|
|
3243
|
-
set current(value) {
|
|
3244
|
-
var last = ref.value;
|
|
3245
|
-
if (last !== value) {
|
|
3246
|
-
ref.value = value;
|
|
3247
|
-
ref.callback(value, last);
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
}
|
|
3251
|
-
};
|
|
3252
|
-
})[0];
|
|
3253
|
-
ref.callback = callback;
|
|
3254
|
-
return ref.facade;
|
|
3255
|
-
}
|
|
3256
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
3257
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
3258
|
-
function useMergeRefs(refs, defaultValue) {
|
|
3259
|
-
var callbackRef = useCallbackRef(null, function(newValue) {
|
|
3260
|
-
return refs.forEach(function(ref) {
|
|
3261
|
-
return assignRef(ref, newValue);
|
|
3262
|
-
});
|
|
3263
|
-
});
|
|
3264
|
-
useIsomorphicLayoutEffect(function() {
|
|
3265
|
-
var oldValue = currentValues.get(callbackRef);
|
|
3266
|
-
if (oldValue) {
|
|
3267
|
-
var prevRefs_1 = new Set(oldValue);
|
|
3268
|
-
var nextRefs_1 = new Set(refs);
|
|
3269
|
-
var current_1 = callbackRef.current;
|
|
3270
|
-
prevRefs_1.forEach(function(ref) {
|
|
3271
|
-
if (!nextRefs_1.has(ref)) {
|
|
3272
|
-
assignRef(ref, null);
|
|
3273
|
-
}
|
|
3274
|
-
});
|
|
3275
|
-
nextRefs_1.forEach(function(ref) {
|
|
3276
|
-
if (!prevRefs_1.has(ref)) {
|
|
3277
|
-
assignRef(ref, current_1);
|
|
3278
|
-
}
|
|
3279
|
-
});
|
|
3280
|
-
}
|
|
3281
|
-
currentValues.set(callbackRef, refs);
|
|
3282
|
-
}, [refs]);
|
|
3283
|
-
return callbackRef;
|
|
3284
|
-
}
|
|
3285
|
-
function ItoI(a) {
|
|
3286
|
-
return a;
|
|
3287
|
-
}
|
|
3288
|
-
function innerCreateMedium(defaults, middleware) {
|
|
3289
|
-
if (middleware === void 0) {
|
|
3290
|
-
middleware = ItoI;
|
|
3291
|
-
}
|
|
3292
|
-
var buffer = [];
|
|
3293
|
-
var assigned = false;
|
|
3294
|
-
var medium = {
|
|
3295
|
-
read: function() {
|
|
3296
|
-
if (assigned) {
|
|
3297
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
3298
|
-
}
|
|
3299
|
-
if (buffer.length) {
|
|
3300
|
-
return buffer[buffer.length - 1];
|
|
3301
|
-
}
|
|
3302
|
-
return defaults;
|
|
3303
|
-
},
|
|
3304
|
-
useMedium: function(data) {
|
|
3305
|
-
var item = middleware(data, assigned);
|
|
3306
|
-
buffer.push(item);
|
|
3307
|
-
return function() {
|
|
3308
|
-
buffer = buffer.filter(function(x) {
|
|
3309
|
-
return x !== item;
|
|
3310
|
-
});
|
|
3311
|
-
};
|
|
3312
|
-
},
|
|
3313
|
-
assignSyncMedium: function(cb) {
|
|
3314
|
-
assigned = true;
|
|
3315
|
-
while (buffer.length) {
|
|
3316
|
-
var cbs = buffer;
|
|
3317
|
-
buffer = [];
|
|
3318
|
-
cbs.forEach(cb);
|
|
3319
|
-
}
|
|
3320
|
-
buffer = {
|
|
3321
|
-
push: function(x) {
|
|
3322
|
-
return cb(x);
|
|
3323
|
-
},
|
|
3324
|
-
filter: function() {
|
|
3325
|
-
return buffer;
|
|
3326
|
-
}
|
|
3327
|
-
};
|
|
3328
|
-
},
|
|
3329
|
-
assignMedium: function(cb) {
|
|
3330
|
-
assigned = true;
|
|
3331
|
-
var pendingQueue = [];
|
|
3332
|
-
if (buffer.length) {
|
|
3333
|
-
var cbs = buffer;
|
|
3334
|
-
buffer = [];
|
|
3335
|
-
cbs.forEach(cb);
|
|
3336
|
-
pendingQueue = buffer;
|
|
3337
|
-
}
|
|
3338
|
-
var executeQueue = function() {
|
|
3339
|
-
var cbs2 = pendingQueue;
|
|
3340
|
-
pendingQueue = [];
|
|
3341
|
-
cbs2.forEach(cb);
|
|
3342
|
-
};
|
|
3343
|
-
var cycle = function() {
|
|
3344
|
-
return Promise.resolve().then(executeQueue);
|
|
3345
|
-
};
|
|
3346
|
-
cycle();
|
|
3347
|
-
buffer = {
|
|
3348
|
-
push: function(x) {
|
|
3349
|
-
pendingQueue.push(x);
|
|
3350
|
-
cycle();
|
|
3351
|
-
},
|
|
3352
|
-
filter: function(filter) {
|
|
3353
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
3354
|
-
return buffer;
|
|
3355
|
-
}
|
|
3356
|
-
};
|
|
3357
|
-
}
|
|
3358
|
-
};
|
|
3359
|
-
return medium;
|
|
3360
|
-
}
|
|
3361
|
-
function createSidecarMedium(options) {
|
|
3362
|
-
if (options === void 0) {
|
|
3363
|
-
options = {};
|
|
3364
|
-
}
|
|
3365
|
-
var medium = innerCreateMedium(null);
|
|
3366
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
3367
|
-
return medium;
|
|
3368
|
-
}
|
|
3369
|
-
var SideCar$1 = function(_a) {
|
|
3370
|
-
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
3371
|
-
if (!sideCar) {
|
|
3372
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
3373
|
-
}
|
|
3374
|
-
var Target = sideCar.read();
|
|
3375
|
-
if (!Target) {
|
|
3376
|
-
throw new Error("Sidecar medium not found");
|
|
3377
|
-
}
|
|
3378
|
-
return React__namespace.createElement(Target, __assign({}, rest));
|
|
3379
|
-
};
|
|
3380
|
-
SideCar$1.isSideCarExport = true;
|
|
3381
|
-
function exportSidecar(medium, exported) {
|
|
3382
|
-
medium.useMedium(exported);
|
|
3383
|
-
return SideCar$1;
|
|
3384
|
-
}
|
|
3385
|
-
var effectCar = createSidecarMedium();
|
|
3386
|
-
var nothing = function() {
|
|
3387
|
-
return;
|
|
3388
|
-
};
|
|
3389
|
-
var RemoveScroll = React__namespace.forwardRef(function(props, parentRef) {
|
|
3390
|
-
var ref = React__namespace.useRef(null);
|
|
3391
|
-
var _a = React__namespace.useState({
|
|
3392
|
-
onScrollCapture: nothing,
|
|
3393
|
-
onWheelCapture: nothing,
|
|
3394
|
-
onTouchMoveCapture: nothing
|
|
3395
|
-
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
3396
|
-
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? "div" : _b, gapMode = props.gapMode, rest = __rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
3397
|
-
var SideCar2 = sideCar;
|
|
3398
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
3399
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
3400
|
-
return React__namespace.createElement(
|
|
3401
|
-
React__namespace.Fragment,
|
|
3402
|
-
null,
|
|
3403
|
-
enabled && React__namespace.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
3404
|
-
forwardProps ? React__namespace.cloneElement(React__namespace.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React__namespace.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
3405
|
-
);
|
|
3406
|
-
});
|
|
3407
|
-
RemoveScroll.defaultProps = {
|
|
3408
|
-
enabled: true,
|
|
3409
|
-
removeScrollBar: true,
|
|
3410
|
-
inert: false
|
|
3411
|
-
};
|
|
3412
|
-
RemoveScroll.classNames = {
|
|
3413
|
-
fullWidth: fullWidthClassName,
|
|
3414
|
-
zeroRight: zeroRightClassName
|
|
3415
|
-
};
|
|
3416
|
-
var getNonce = function() {
|
|
3417
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
3418
|
-
return __webpack_nonce__;
|
|
3419
|
-
}
|
|
3420
|
-
return void 0;
|
|
3421
|
-
};
|
|
3422
|
-
function makeStyleTag() {
|
|
3423
|
-
if (!document)
|
|
3424
|
-
return null;
|
|
3425
|
-
var tag = document.createElement("style");
|
|
3426
|
-
tag.type = "text/css";
|
|
3427
|
-
var nonce = getNonce();
|
|
3428
|
-
if (nonce) {
|
|
3429
|
-
tag.setAttribute("nonce", nonce);
|
|
3430
|
-
}
|
|
3431
|
-
return tag;
|
|
3432
|
-
}
|
|
3433
|
-
function injectStyles(tag, css) {
|
|
3434
|
-
if (tag.styleSheet) {
|
|
3435
|
-
tag.styleSheet.cssText = css;
|
|
3436
|
-
} else {
|
|
3437
|
-
tag.appendChild(document.createTextNode(css));
|
|
3438
|
-
}
|
|
3439
|
-
}
|
|
3440
|
-
function insertStyleTag(tag) {
|
|
3441
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
3442
|
-
head.appendChild(tag);
|
|
3443
|
-
}
|
|
3444
|
-
var stylesheetSingleton = function() {
|
|
3445
|
-
var counter = 0;
|
|
3446
|
-
var stylesheet = null;
|
|
3447
|
-
return {
|
|
3448
|
-
add: function(style) {
|
|
3449
|
-
if (counter == 0) {
|
|
3450
|
-
if (stylesheet = makeStyleTag()) {
|
|
3451
|
-
injectStyles(stylesheet, style);
|
|
3452
|
-
insertStyleTag(stylesheet);
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
counter++;
|
|
3456
|
-
},
|
|
3457
|
-
remove: function() {
|
|
3458
|
-
counter--;
|
|
3459
|
-
if (!counter && stylesheet) {
|
|
3460
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
3461
|
-
stylesheet = null;
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
};
|
|
3465
|
-
};
|
|
3466
|
-
var styleHookSingleton = function() {
|
|
3467
|
-
var sheet = stylesheetSingleton();
|
|
3468
|
-
return function(styles, isDynamic) {
|
|
3469
|
-
React__namespace.useEffect(function() {
|
|
3470
|
-
sheet.add(styles);
|
|
3471
|
-
return function() {
|
|
3472
|
-
sheet.remove();
|
|
3473
|
-
};
|
|
3474
|
-
}, [styles && isDynamic]);
|
|
3475
|
-
};
|
|
3476
|
-
};
|
|
3477
|
-
var styleSingleton = function() {
|
|
3478
|
-
var useStyle = styleHookSingleton();
|
|
3479
|
-
var Sheet = function(_a) {
|
|
3480
|
-
var styles = _a.styles, dynamic = _a.dynamic;
|
|
3481
|
-
useStyle(styles, dynamic);
|
|
3482
|
-
return null;
|
|
3483
|
-
};
|
|
3484
|
-
return Sheet;
|
|
3485
|
-
};
|
|
3486
|
-
var zeroGap = {
|
|
3487
|
-
left: 0,
|
|
3488
|
-
top: 0,
|
|
3489
|
-
right: 0,
|
|
3490
|
-
gap: 0
|
|
3491
|
-
};
|
|
3492
|
-
var parse = function(x) {
|
|
3493
|
-
return parseInt(x || "", 10) || 0;
|
|
3494
|
-
};
|
|
3495
|
-
var getOffset = function(gapMode) {
|
|
3496
|
-
var cs = window.getComputedStyle(document.body);
|
|
3497
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
3498
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
3499
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
3500
|
-
return [parse(left), parse(top), parse(right)];
|
|
3501
|
-
};
|
|
3502
|
-
var getGapWidth = function(gapMode) {
|
|
3503
|
-
if (gapMode === void 0) {
|
|
3504
|
-
gapMode = "margin";
|
|
3505
|
-
}
|
|
3506
|
-
if (typeof window === "undefined") {
|
|
3507
|
-
return zeroGap;
|
|
3508
|
-
}
|
|
3509
|
-
var offsets = getOffset(gapMode);
|
|
3510
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
3511
|
-
var windowWidth = window.innerWidth;
|
|
3512
|
-
return {
|
|
3513
|
-
left: offsets[0],
|
|
3514
|
-
top: offsets[1],
|
|
3515
|
-
right: offsets[2],
|
|
3516
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
3517
|
-
};
|
|
3518
|
-
};
|
|
3519
|
-
var Style = styleSingleton();
|
|
3520
|
-
var lockAttribute = "data-scroll-locked";
|
|
3521
|
-
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
3522
|
-
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
3523
|
-
if (gapMode === void 0) {
|
|
3524
|
-
gapMode = "margin";
|
|
3525
|
-
}
|
|
3526
|
-
return "\n .".concat(noScrollbarsClassName, " {\n overflow: hidden ").concat(important, ";\n padding-right: ").concat(gap, "px ").concat(important, ";\n }\n body[").concat(lockAttribute, "] {\n overflow: hidden ").concat(important, ";\n overscroll-behavior: contain;\n ").concat([
|
|
3527
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
3528
|
-
gapMode === "margin" && "\n padding-left: ".concat(left, "px;\n padding-top: ").concat(top, "px;\n padding-right: ").concat(right, "px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(gap, "px ").concat(important, ";\n "),
|
|
3529
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
3530
|
-
].filter(Boolean).join(""), "\n }\n \n .").concat(zeroRightClassName, " {\n right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " {\n margin-right: ").concat(gap, "px ").concat(important, ";\n }\n \n .").concat(zeroRightClassName, " .").concat(zeroRightClassName, " {\n right: 0 ").concat(important, ";\n }\n \n .").concat(fullWidthClassName, " .").concat(fullWidthClassName, " {\n margin-right: 0 ").concat(important, ";\n }\n \n body[").concat(lockAttribute, "] {\n ").concat(removedBarSizeVariable, ": ").concat(gap, "px;\n }\n");
|
|
3531
|
-
};
|
|
3532
|
-
var getCurrentUseCounter = function() {
|
|
3533
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
3534
|
-
return isFinite(counter) ? counter : 0;
|
|
3535
|
-
};
|
|
3536
|
-
var useLockAttribute = function() {
|
|
3537
|
-
React__namespace.useEffect(function() {
|
|
3538
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
3539
|
-
return function() {
|
|
3540
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
3541
|
-
if (newCounter <= 0) {
|
|
3542
|
-
document.body.removeAttribute(lockAttribute);
|
|
3543
|
-
} else {
|
|
3544
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
3545
|
-
}
|
|
3546
|
-
};
|
|
3547
|
-
}, []);
|
|
3548
|
-
};
|
|
3549
|
-
var RemoveScrollBar = function(_a) {
|
|
3550
|
-
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
3551
|
-
useLockAttribute();
|
|
3552
|
-
var gap = React__namespace.useMemo(function() {
|
|
3553
|
-
return getGapWidth(gapMode);
|
|
3554
|
-
}, [gapMode]);
|
|
3555
|
-
return React__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
3556
|
-
};
|
|
3557
|
-
var passiveSupported = false;
|
|
3558
|
-
if (typeof window !== "undefined") {
|
|
3559
|
-
try {
|
|
3560
|
-
var options = Object.defineProperty({}, "passive", {
|
|
3561
|
-
get: function() {
|
|
3562
|
-
passiveSupported = true;
|
|
3563
|
-
return true;
|
|
3564
|
-
}
|
|
3565
|
-
});
|
|
3566
|
-
window.addEventListener("test", options, options);
|
|
3567
|
-
window.removeEventListener("test", options, options);
|
|
3568
|
-
} catch (err) {
|
|
3569
|
-
passiveSupported = false;
|
|
3570
|
-
}
|
|
3571
|
-
}
|
|
3572
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
3573
|
-
var alwaysContainsScroll = function(node) {
|
|
3574
|
-
return node.tagName === "TEXTAREA";
|
|
3575
|
-
};
|
|
3576
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
3577
|
-
if (!(node instanceof Element)) {
|
|
3578
|
-
return false;
|
|
3579
|
-
}
|
|
3580
|
-
var styles = window.getComputedStyle(node);
|
|
3581
|
-
return (
|
|
3582
|
-
// not-not-scrollable
|
|
3583
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
3584
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
3585
|
-
);
|
|
3586
|
-
};
|
|
3587
|
-
var elementCouldBeVScrolled = function(node) {
|
|
3588
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
3589
|
-
};
|
|
3590
|
-
var elementCouldBeHScrolled = function(node) {
|
|
3591
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
3592
|
-
};
|
|
3593
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
3594
|
-
var ownerDocument = node.ownerDocument;
|
|
3595
|
-
var current = node;
|
|
3596
|
-
do {
|
|
3597
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
3598
|
-
current = current.host;
|
|
3599
|
-
}
|
|
3600
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
3601
|
-
if (isScrollable) {
|
|
3602
|
-
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
3603
|
-
if (scrollHeight > clientHeight) {
|
|
3604
|
-
return true;
|
|
3605
|
-
}
|
|
3606
|
-
}
|
|
3607
|
-
current = current.parentNode;
|
|
3608
|
-
} while (current && current !== ownerDocument.body);
|
|
3609
|
-
return false;
|
|
3610
|
-
};
|
|
3611
|
-
var getVScrollVariables = function(_a) {
|
|
3612
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
3613
|
-
return [
|
|
3614
|
-
scrollTop,
|
|
3615
|
-
scrollHeight,
|
|
3616
|
-
clientHeight
|
|
3617
|
-
];
|
|
3618
|
-
};
|
|
3619
|
-
var getHScrollVariables = function(_a) {
|
|
3620
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
3621
|
-
return [
|
|
3622
|
-
scrollLeft,
|
|
3623
|
-
scrollWidth,
|
|
3624
|
-
clientWidth
|
|
3625
|
-
];
|
|
3626
|
-
};
|
|
3627
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
3628
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
3629
|
-
};
|
|
3630
|
-
var getScrollVariables = function(axis, node) {
|
|
3631
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
3358
|
+
) })
|
|
3359
|
+
] });
|
|
3632
3360
|
};
|
|
3633
|
-
var getDirectionFactor = function(axis, direction) {
|
|
3634
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
3635
|
-
};
|
|
3636
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
3637
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
3638
|
-
var delta = directionFactor * sourceDelta;
|
|
3639
|
-
var target = event.target;
|
|
3640
|
-
var targetInLock = endTarget.contains(target);
|
|
3641
|
-
var shouldCancelScroll = false;
|
|
3642
|
-
var isDeltaPositive = delta > 0;
|
|
3643
|
-
var availableScroll = 0;
|
|
3644
|
-
var availableScrollTop = 0;
|
|
3645
|
-
do {
|
|
3646
|
-
if (!target) {
|
|
3647
|
-
break;
|
|
3648
|
-
}
|
|
3649
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
3650
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
3651
|
-
if (position || elementScroll) {
|
|
3652
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
3653
|
-
availableScroll += elementScroll;
|
|
3654
|
-
availableScrollTop += position;
|
|
3655
|
-
}
|
|
3656
|
-
}
|
|
3657
|
-
var parent_1 = target.parentNode;
|
|
3658
|
-
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
3659
|
-
} while (
|
|
3660
|
-
// portaled content
|
|
3661
|
-
!targetInLock && target !== document.body || // self content
|
|
3662
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
3663
|
-
);
|
|
3664
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
3665
|
-
shouldCancelScroll = true;
|
|
3666
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
3667
|
-
shouldCancelScroll = true;
|
|
3668
|
-
}
|
|
3669
|
-
return shouldCancelScroll;
|
|
3670
|
-
};
|
|
3671
|
-
var getTouchXY = function(event) {
|
|
3672
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
3673
|
-
};
|
|
3674
|
-
var getDeltaXY = function(event) {
|
|
3675
|
-
return [event.deltaX, event.deltaY];
|
|
3676
|
-
};
|
|
3677
|
-
var extractRef = function(ref) {
|
|
3678
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
3679
|
-
};
|
|
3680
|
-
var deltaCompare = function(x, y) {
|
|
3681
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
3682
|
-
};
|
|
3683
|
-
var generateStyle = function(id) {
|
|
3684
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
3685
|
-
};
|
|
3686
|
-
var idCounter = 0;
|
|
3687
|
-
var lockStack = [];
|
|
3688
|
-
function RemoveScrollSideCar(props) {
|
|
3689
|
-
var shouldPreventQueue = React__namespace.useRef([]);
|
|
3690
|
-
var touchStartRef = React__namespace.useRef([0, 0]);
|
|
3691
|
-
var activeAxis = React__namespace.useRef();
|
|
3692
|
-
var id = React__namespace.useState(idCounter++)[0];
|
|
3693
|
-
var Style2 = React__namespace.useState(styleSingleton)[0];
|
|
3694
|
-
var lastProps = React__namespace.useRef(props);
|
|
3695
|
-
React__namespace.useEffect(function() {
|
|
3696
|
-
lastProps.current = props;
|
|
3697
|
-
}, [props]);
|
|
3698
|
-
React__namespace.useEffect(function() {
|
|
3699
|
-
if (props.inert) {
|
|
3700
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
3701
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
3702
|
-
allow_1.forEach(function(el) {
|
|
3703
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
3704
|
-
});
|
|
3705
|
-
return function() {
|
|
3706
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
3707
|
-
allow_1.forEach(function(el) {
|
|
3708
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
3709
|
-
});
|
|
3710
|
-
};
|
|
3711
|
-
}
|
|
3712
|
-
return;
|
|
3713
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
3714
|
-
var shouldCancelEvent = React__namespace.useCallback(function(event, parent) {
|
|
3715
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
3716
|
-
return !lastProps.current.allowPinchZoom;
|
|
3717
|
-
}
|
|
3718
|
-
var touch = getTouchXY(event);
|
|
3719
|
-
var touchStart = touchStartRef.current;
|
|
3720
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
3721
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
3722
|
-
var currentAxis;
|
|
3723
|
-
var target = event.target;
|
|
3724
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
3725
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
3726
|
-
return false;
|
|
3727
|
-
}
|
|
3728
|
-
var selection = window.getSelection();
|
|
3729
|
-
var anchorNode = selection && selection.anchorNode;
|
|
3730
|
-
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
3731
|
-
if (isTouchingSelection) {
|
|
3732
|
-
return false;
|
|
3733
|
-
}
|
|
3734
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3735
|
-
if (!canBeScrolledInMainDirection) {
|
|
3736
|
-
return true;
|
|
3737
|
-
}
|
|
3738
|
-
if (canBeScrolledInMainDirection) {
|
|
3739
|
-
currentAxis = moveDirection;
|
|
3740
|
-
} else {
|
|
3741
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
3742
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3743
|
-
}
|
|
3744
|
-
if (!canBeScrolledInMainDirection) {
|
|
3745
|
-
return false;
|
|
3746
|
-
}
|
|
3747
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
3748
|
-
activeAxis.current = currentAxis;
|
|
3749
|
-
}
|
|
3750
|
-
if (!currentAxis) {
|
|
3751
|
-
return true;
|
|
3752
|
-
}
|
|
3753
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
3754
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
3755
|
-
}, []);
|
|
3756
|
-
var shouldPrevent = React__namespace.useCallback(function(_event) {
|
|
3757
|
-
var event = _event;
|
|
3758
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
3759
|
-
return;
|
|
3760
|
-
}
|
|
3761
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
3762
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
3763
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
3764
|
-
})[0];
|
|
3765
|
-
if (sourceEvent && sourceEvent.should) {
|
|
3766
|
-
if (event.cancelable) {
|
|
3767
|
-
event.preventDefault();
|
|
3768
|
-
}
|
|
3769
|
-
return;
|
|
3770
|
-
}
|
|
3771
|
-
if (!sourceEvent) {
|
|
3772
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
3773
|
-
return node.contains(event.target);
|
|
3774
|
-
});
|
|
3775
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
3776
|
-
if (shouldStop) {
|
|
3777
|
-
if (event.cancelable) {
|
|
3778
|
-
event.preventDefault();
|
|
3779
|
-
}
|
|
3780
|
-
}
|
|
3781
|
-
}
|
|
3782
|
-
}, []);
|
|
3783
|
-
var shouldCancel = React__namespace.useCallback(function(name, delta, target, should) {
|
|
3784
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
3785
|
-
shouldPreventQueue.current.push(event);
|
|
3786
|
-
setTimeout(function() {
|
|
3787
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
3788
|
-
return e !== event;
|
|
3789
|
-
});
|
|
3790
|
-
}, 1);
|
|
3791
|
-
}, []);
|
|
3792
|
-
var scrollTouchStart = React__namespace.useCallback(function(event) {
|
|
3793
|
-
touchStartRef.current = getTouchXY(event);
|
|
3794
|
-
activeAxis.current = void 0;
|
|
3795
|
-
}, []);
|
|
3796
|
-
var scrollWheel = React__namespace.useCallback(function(event) {
|
|
3797
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3798
|
-
}, []);
|
|
3799
|
-
var scrollTouchMove = React__namespace.useCallback(function(event) {
|
|
3800
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3801
|
-
}, []);
|
|
3802
|
-
React__namespace.useEffect(function() {
|
|
3803
|
-
lockStack.push(Style2);
|
|
3804
|
-
props.setCallbacks({
|
|
3805
|
-
onScrollCapture: scrollWheel,
|
|
3806
|
-
onWheelCapture: scrollWheel,
|
|
3807
|
-
onTouchMoveCapture: scrollTouchMove
|
|
3808
|
-
});
|
|
3809
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
3810
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3811
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3812
|
-
return function() {
|
|
3813
|
-
lockStack = lockStack.filter(function(inst) {
|
|
3814
|
-
return inst !== Style2;
|
|
3815
|
-
});
|
|
3816
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
3817
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3818
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3819
|
-
};
|
|
3820
|
-
}, []);
|
|
3821
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
3822
|
-
return React__namespace.createElement(
|
|
3823
|
-
React__namespace.Fragment,
|
|
3824
|
-
null,
|
|
3825
|
-
inert ? React__namespace.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
3826
|
-
removeScrollBar ? React__namespace.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
3827
|
-
);
|
|
3828
|
-
}
|
|
3829
|
-
function getOutermostShadowParent(node) {
|
|
3830
|
-
var shadowParent = null;
|
|
3831
|
-
while (node !== null) {
|
|
3832
|
-
if (node instanceof ShadowRoot) {
|
|
3833
|
-
shadowParent = node.host;
|
|
3834
|
-
node = node.host;
|
|
3835
|
-
}
|
|
3836
|
-
node = node.parentNode;
|
|
3837
|
-
}
|
|
3838
|
-
return shadowParent;
|
|
3839
|
-
}
|
|
3840
|
-
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
3841
|
-
var ReactRemoveScroll = React__namespace.forwardRef(function(props, ref) {
|
|
3842
|
-
return React__namespace.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
|
|
3843
|
-
});
|
|
3844
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
3845
|
-
var getDefaultParent = function(originalTarget) {
|
|
3846
|
-
if (typeof document === "undefined") {
|
|
3847
|
-
return null;
|
|
3848
|
-
}
|
|
3849
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
3850
|
-
return sampleTarget.ownerDocument.body;
|
|
3851
|
-
};
|
|
3852
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
3853
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3854
|
-
var markerMap = {};
|
|
3855
|
-
var lockCount = 0;
|
|
3856
|
-
var unwrapHost = function(node) {
|
|
3857
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
3858
|
-
};
|
|
3859
|
-
var correctTargets = function(parent, targets) {
|
|
3860
|
-
return targets.map(function(target) {
|
|
3861
|
-
if (parent.contains(target)) {
|
|
3862
|
-
return target;
|
|
3863
|
-
}
|
|
3864
|
-
var correctedTarget = unwrapHost(target);
|
|
3865
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
3866
|
-
return correctedTarget;
|
|
3867
|
-
}
|
|
3868
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
3869
|
-
return null;
|
|
3870
|
-
}).filter(function(x) {
|
|
3871
|
-
return Boolean(x);
|
|
3872
|
-
});
|
|
3873
|
-
};
|
|
3874
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
3875
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3876
|
-
if (!markerMap[markerName]) {
|
|
3877
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
3878
|
-
}
|
|
3879
|
-
var markerCounter = markerMap[markerName];
|
|
3880
|
-
var hiddenNodes = [];
|
|
3881
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
3882
|
-
var elementsToStop = new Set(targets);
|
|
3883
|
-
var keep = function(el) {
|
|
3884
|
-
if (!el || elementsToKeep.has(el)) {
|
|
3885
|
-
return;
|
|
3886
|
-
}
|
|
3887
|
-
elementsToKeep.add(el);
|
|
3888
|
-
keep(el.parentNode);
|
|
3889
|
-
};
|
|
3890
|
-
targets.forEach(keep);
|
|
3891
|
-
var deep = function(parent) {
|
|
3892
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
3893
|
-
return;
|
|
3894
|
-
}
|
|
3895
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
3896
|
-
if (elementsToKeep.has(node)) {
|
|
3897
|
-
deep(node);
|
|
3898
|
-
} else {
|
|
3899
|
-
try {
|
|
3900
|
-
var attr = node.getAttribute(controlAttribute);
|
|
3901
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
3902
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
3903
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
3904
|
-
counterMap.set(node, counterValue);
|
|
3905
|
-
markerCounter.set(node, markerValue);
|
|
3906
|
-
hiddenNodes.push(node);
|
|
3907
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
3908
|
-
uncontrolledNodes.set(node, true);
|
|
3909
|
-
}
|
|
3910
|
-
if (markerValue === 1) {
|
|
3911
|
-
node.setAttribute(markerName, "true");
|
|
3912
|
-
}
|
|
3913
|
-
if (!alreadyHidden) {
|
|
3914
|
-
node.setAttribute(controlAttribute, "true");
|
|
3915
|
-
}
|
|
3916
|
-
} catch (e) {
|
|
3917
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
3918
|
-
}
|
|
3919
|
-
}
|
|
3920
|
-
});
|
|
3921
|
-
};
|
|
3922
|
-
deep(parentNode);
|
|
3923
|
-
elementsToKeep.clear();
|
|
3924
|
-
lockCount++;
|
|
3925
|
-
return function() {
|
|
3926
|
-
hiddenNodes.forEach(function(node) {
|
|
3927
|
-
var counterValue = counterMap.get(node) - 1;
|
|
3928
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
3929
|
-
counterMap.set(node, counterValue);
|
|
3930
|
-
markerCounter.set(node, markerValue);
|
|
3931
|
-
if (!counterValue) {
|
|
3932
|
-
if (!uncontrolledNodes.has(node)) {
|
|
3933
|
-
node.removeAttribute(controlAttribute);
|
|
3934
|
-
}
|
|
3935
|
-
uncontrolledNodes.delete(node);
|
|
3936
|
-
}
|
|
3937
|
-
if (!markerValue) {
|
|
3938
|
-
node.removeAttribute(markerName);
|
|
3939
|
-
}
|
|
3940
|
-
});
|
|
3941
|
-
lockCount--;
|
|
3942
|
-
if (!lockCount) {
|
|
3943
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3944
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3945
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3946
|
-
markerMap = {};
|
|
3947
|
-
}
|
|
3948
|
-
};
|
|
3949
|
-
};
|
|
3950
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
3951
|
-
if (markerName === void 0) {
|
|
3952
|
-
markerName = "data-aria-hidden";
|
|
3953
|
-
}
|
|
3954
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3955
|
-
var activeParentNode = getDefaultParent(originalTarget);
|
|
3956
|
-
if (!activeParentNode) {
|
|
3957
|
-
return function() {
|
|
3958
|
-
return null;
|
|
3959
|
-
};
|
|
3960
|
-
}
|
|
3961
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
3962
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
3963
|
-
};
|
|
3964
|
-
var DIALOG_NAME = "Dialog";
|
|
3965
|
-
var [createDialogContext] = createContextScope(DIALOG_NAME);
|
|
3966
|
-
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
3967
|
-
var Dialog = (props) => {
|
|
3968
|
-
const {
|
|
3969
|
-
__scopeDialog,
|
|
3970
|
-
children,
|
|
3971
|
-
open: openProp,
|
|
3972
|
-
defaultOpen,
|
|
3973
|
-
onOpenChange,
|
|
3974
|
-
modal = true
|
|
3975
|
-
} = props;
|
|
3976
|
-
const triggerRef = React__namespace.useRef(null);
|
|
3977
|
-
const contentRef = React__namespace.useRef(null);
|
|
3978
|
-
const [open2, setOpen] = useControllableState({
|
|
3979
|
-
prop: openProp,
|
|
3980
|
-
defaultProp: defaultOpen ?? false,
|
|
3981
|
-
onChange: onOpenChange,
|
|
3982
|
-
caller: DIALOG_NAME
|
|
3983
|
-
});
|
|
3984
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3985
|
-
DialogProvider,
|
|
3986
|
-
{
|
|
3987
|
-
scope: __scopeDialog,
|
|
3988
|
-
triggerRef,
|
|
3989
|
-
contentRef,
|
|
3990
|
-
contentId: useId(),
|
|
3991
|
-
titleId: useId(),
|
|
3992
|
-
descriptionId: useId(),
|
|
3993
|
-
open: open2,
|
|
3994
|
-
onOpenChange: setOpen,
|
|
3995
|
-
onOpenToggle: React__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
3996
|
-
modal,
|
|
3997
|
-
children
|
|
3998
|
-
}
|
|
3999
|
-
);
|
|
4000
|
-
};
|
|
4001
|
-
Dialog.displayName = DIALOG_NAME;
|
|
4002
|
-
var TRIGGER_NAME = "DialogTrigger";
|
|
4003
|
-
var DialogTrigger = React__namespace.forwardRef(
|
|
4004
|
-
(props, forwardedRef) => {
|
|
4005
|
-
const { __scopeDialog, ...triggerProps } = props;
|
|
4006
|
-
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
4007
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
4008
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4009
|
-
Primitive.button,
|
|
4010
|
-
{
|
|
4011
|
-
type: "button",
|
|
4012
|
-
"aria-haspopup": "dialog",
|
|
4013
|
-
"aria-expanded": context.open,
|
|
4014
|
-
"aria-controls": context.contentId,
|
|
4015
|
-
"data-state": getState(context.open),
|
|
4016
|
-
...triggerProps,
|
|
4017
|
-
ref: composedTriggerRef,
|
|
4018
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
4019
|
-
}
|
|
4020
|
-
);
|
|
4021
|
-
}
|
|
4022
|
-
);
|
|
4023
|
-
DialogTrigger.displayName = TRIGGER_NAME;
|
|
4024
|
-
var PORTAL_NAME = "DialogPortal";
|
|
4025
|
-
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
4026
|
-
forceMount: void 0
|
|
4027
|
-
});
|
|
4028
|
-
var OVERLAY_NAME = "DialogOverlay";
|
|
4029
|
-
var DialogOverlay = React__namespace.forwardRef(
|
|
4030
|
-
(props, forwardedRef) => {
|
|
4031
|
-
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
4032
|
-
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
4033
|
-
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
4034
|
-
return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
4035
|
-
}
|
|
4036
|
-
);
|
|
4037
|
-
DialogOverlay.displayName = OVERLAY_NAME;
|
|
4038
|
-
var Slot = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
|
|
4039
|
-
var DialogOverlayImpl = React__namespace.forwardRef(
|
|
4040
|
-
(props, forwardedRef) => {
|
|
4041
|
-
const { __scopeDialog, ...overlayProps } = props;
|
|
4042
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
4043
|
-
return (
|
|
4044
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
4045
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
4046
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4047
|
-
Primitive.div,
|
|
4048
|
-
{
|
|
4049
|
-
"data-state": getState(context.open),
|
|
4050
|
-
...overlayProps,
|
|
4051
|
-
ref: forwardedRef,
|
|
4052
|
-
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
4053
|
-
}
|
|
4054
|
-
) })
|
|
4055
|
-
);
|
|
4056
|
-
}
|
|
4057
|
-
);
|
|
4058
|
-
var CONTENT_NAME = "DialogContent";
|
|
4059
|
-
var DialogContent = React__namespace.forwardRef(
|
|
4060
|
-
(props, forwardedRef) => {
|
|
4061
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
4062
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
4063
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
4064
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
4065
|
-
}
|
|
4066
|
-
);
|
|
4067
|
-
DialogContent.displayName = CONTENT_NAME;
|
|
4068
|
-
var DialogContentModal = React__namespace.forwardRef(
|
|
4069
|
-
(props, forwardedRef) => {
|
|
4070
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
4071
|
-
const contentRef = React__namespace.useRef(null);
|
|
4072
|
-
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
4073
|
-
React__namespace.useEffect(() => {
|
|
4074
|
-
const content = contentRef.current;
|
|
4075
|
-
if (content) return hideOthers(content);
|
|
4076
|
-
}, []);
|
|
4077
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4078
|
-
DialogContentImpl,
|
|
4079
|
-
{
|
|
4080
|
-
...props,
|
|
4081
|
-
ref: composedRefs,
|
|
4082
|
-
trapFocus: context.open,
|
|
4083
|
-
disableOutsidePointerEvents: true,
|
|
4084
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
4085
|
-
event.preventDefault();
|
|
4086
|
-
context.triggerRef.current?.focus();
|
|
4087
|
-
}),
|
|
4088
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
4089
|
-
const originalEvent = event.detail.originalEvent;
|
|
4090
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
4091
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
4092
|
-
if (isRightClick) event.preventDefault();
|
|
4093
|
-
}),
|
|
4094
|
-
onFocusOutside: composeEventHandlers(
|
|
4095
|
-
props.onFocusOutside,
|
|
4096
|
-
(event) => event.preventDefault()
|
|
4097
|
-
)
|
|
4098
|
-
}
|
|
4099
|
-
);
|
|
4100
|
-
}
|
|
4101
|
-
);
|
|
4102
|
-
var DialogContentNonModal = React__namespace.forwardRef(
|
|
4103
|
-
(props, forwardedRef) => {
|
|
4104
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
4105
|
-
const hasInteractedOutsideRef = React__namespace.useRef(false);
|
|
4106
|
-
const hasPointerDownOutsideRef = React__namespace.useRef(false);
|
|
4107
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4108
|
-
DialogContentImpl,
|
|
4109
|
-
{
|
|
4110
|
-
...props,
|
|
4111
|
-
ref: forwardedRef,
|
|
4112
|
-
trapFocus: false,
|
|
4113
|
-
disableOutsidePointerEvents: false,
|
|
4114
|
-
onCloseAutoFocus: (event) => {
|
|
4115
|
-
props.onCloseAutoFocus?.(event);
|
|
4116
|
-
if (!event.defaultPrevented) {
|
|
4117
|
-
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
4118
|
-
event.preventDefault();
|
|
4119
|
-
}
|
|
4120
|
-
hasInteractedOutsideRef.current = false;
|
|
4121
|
-
hasPointerDownOutsideRef.current = false;
|
|
4122
|
-
},
|
|
4123
|
-
onInteractOutside: (event) => {
|
|
4124
|
-
props.onInteractOutside?.(event);
|
|
4125
|
-
if (!event.defaultPrevented) {
|
|
4126
|
-
hasInteractedOutsideRef.current = true;
|
|
4127
|
-
if (event.detail.originalEvent.type === "pointerdown") {
|
|
4128
|
-
hasPointerDownOutsideRef.current = true;
|
|
4129
|
-
}
|
|
4130
|
-
}
|
|
4131
|
-
const target = event.target;
|
|
4132
|
-
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
4133
|
-
if (targetIsTrigger) event.preventDefault();
|
|
4134
|
-
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
4135
|
-
event.preventDefault();
|
|
4136
|
-
}
|
|
4137
|
-
}
|
|
4138
|
-
}
|
|
4139
|
-
);
|
|
4140
|
-
}
|
|
4141
|
-
);
|
|
4142
|
-
var DialogContentImpl = React__namespace.forwardRef(
|
|
4143
|
-
(props, forwardedRef) => {
|
|
4144
|
-
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
4145
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
4146
|
-
const contentRef = React__namespace.useRef(null);
|
|
4147
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
4148
|
-
useFocusGuards();
|
|
4149
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4150
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4151
|
-
FocusScope,
|
|
4152
|
-
{
|
|
4153
|
-
asChild: true,
|
|
4154
|
-
loop: true,
|
|
4155
|
-
trapped: trapFocus,
|
|
4156
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
4157
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
4158
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4159
|
-
DismissableLayer,
|
|
4160
|
-
{
|
|
4161
|
-
role: "dialog",
|
|
4162
|
-
id: context.contentId,
|
|
4163
|
-
"aria-describedby": context.descriptionId,
|
|
4164
|
-
"aria-labelledby": context.titleId,
|
|
4165
|
-
"data-state": getState(context.open),
|
|
4166
|
-
...contentProps,
|
|
4167
|
-
ref: composedRefs,
|
|
4168
|
-
onDismiss: () => context.onOpenChange(false)
|
|
4169
|
-
}
|
|
4170
|
-
)
|
|
4171
|
-
}
|
|
4172
|
-
),
|
|
4173
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4174
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
|
|
4175
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
4176
|
-
] })
|
|
4177
|
-
] });
|
|
4178
|
-
}
|
|
4179
|
-
);
|
|
4180
|
-
var TITLE_NAME = "DialogTitle";
|
|
4181
|
-
var DialogTitle = React__namespace.forwardRef(
|
|
4182
|
-
(props, forwardedRef) => {
|
|
4183
|
-
const { __scopeDialog, ...titleProps } = props;
|
|
4184
|
-
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
4185
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
4186
|
-
}
|
|
4187
|
-
);
|
|
4188
|
-
DialogTitle.displayName = TITLE_NAME;
|
|
4189
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
4190
|
-
var DialogDescription = React__namespace.forwardRef(
|
|
4191
|
-
(props, forwardedRef) => {
|
|
4192
|
-
const { __scopeDialog, ...descriptionProps } = props;
|
|
4193
|
-
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
4194
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
4195
|
-
}
|
|
4196
|
-
);
|
|
4197
|
-
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
4198
|
-
var CLOSE_NAME = "DialogClose";
|
|
4199
|
-
var DialogClose = React__namespace.forwardRef(
|
|
4200
|
-
(props, forwardedRef) => {
|
|
4201
|
-
const { __scopeDialog, ...closeProps } = props;
|
|
4202
|
-
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
4203
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4204
|
-
Primitive.button,
|
|
4205
|
-
{
|
|
4206
|
-
type: "button",
|
|
4207
|
-
...closeProps,
|
|
4208
|
-
ref: forwardedRef,
|
|
4209
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
4210
|
-
}
|
|
4211
|
-
);
|
|
4212
|
-
}
|
|
4213
|
-
);
|
|
4214
|
-
DialogClose.displayName = CLOSE_NAME;
|
|
4215
|
-
function getState(open2) {
|
|
4216
|
-
return open2 ? "open" : "closed";
|
|
4217
|
-
}
|
|
4218
|
-
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
4219
|
-
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
4220
|
-
contentName: CONTENT_NAME,
|
|
4221
|
-
titleName: TITLE_NAME,
|
|
4222
|
-
docsSlug: "dialog"
|
|
4223
|
-
});
|
|
4224
|
-
var TitleWarning = ({ titleId }) => {
|
|
4225
|
-
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
4226
|
-
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
4227
|
-
|
|
4228
|
-
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4229
|
-
|
|
4230
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
4231
|
-
React__namespace.useEffect(() => {
|
|
4232
|
-
if (titleId) {
|
|
4233
|
-
const hasTitle = document.getElementById(titleId);
|
|
4234
|
-
if (!hasTitle) console.error(MESSAGE);
|
|
4235
|
-
}
|
|
4236
|
-
}, [MESSAGE, titleId]);
|
|
4237
|
-
return null;
|
|
4238
|
-
};
|
|
4239
|
-
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
4240
|
-
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
4241
|
-
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
4242
|
-
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
4243
|
-
React__namespace.useEffect(() => {
|
|
4244
|
-
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
4245
|
-
if (descriptionId && describedById) {
|
|
4246
|
-
const hasDescription = document.getElementById(descriptionId);
|
|
4247
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
4248
|
-
}
|
|
4249
|
-
}, [MESSAGE, contentRef, descriptionId]);
|
|
4250
|
-
return null;
|
|
4251
|
-
};
|
|
4252
|
-
var Root = Dialog;
|
|
4253
|
-
var Content = DialogContent;
|
|
4254
|
-
var Title = DialogTitle;
|
|
4255
|
-
var Description = DialogDescription;
|
|
4256
|
-
var Close = DialogClose;
|
|
4257
3361
|
const BannerContent = ({
|
|
4258
3362
|
noTarget: noTarget2 = true,
|
|
4259
3363
|
heading: heading2 = "We use cookies.",
|
|
@@ -4263,26 +3367,31 @@ const BannerContent = ({
|
|
|
4263
3367
|
saveLabel = "Save selection",
|
|
4264
3368
|
declineLabel = "Decline all",
|
|
4265
3369
|
defaultSettingsOpen = true,
|
|
4266
|
-
privacyPolicy
|
|
4267
|
-
|
|
3370
|
+
privacyPolicy,
|
|
3371
|
+
items
|
|
4268
3372
|
}) => {
|
|
4269
3373
|
const { onSave, onDeclineAll, selectionTaken } = useSelection();
|
|
3374
|
+
const [openItem, setOpenItem] = React.useState(void 0);
|
|
4270
3375
|
const [settingsOpen, setSettingsOpen] = React.useState(defaultSettingsOpen);
|
|
4271
|
-
return /* @__PURE__ */ u(
|
|
4272
|
-
|
|
3376
|
+
return /* @__PURE__ */ u(
|
|
3377
|
+
"div",
|
|
4273
3378
|
{
|
|
4274
|
-
className:
|
|
3379
|
+
className: clx({
|
|
3380
|
+
[classes$2.root]: true,
|
|
3381
|
+
[classes$2.noTarget]: noTarget2,
|
|
3382
|
+
[classes$2.open]: !selectionTaken
|
|
3383
|
+
}),
|
|
4275
3384
|
children: /* @__PURE__ */ u(
|
|
4276
3385
|
Root$1,
|
|
4277
3386
|
{
|
|
4278
3387
|
open: settingsOpen,
|
|
4279
3388
|
onOpenChange: setSettingsOpen,
|
|
4280
|
-
className: classes.collapsible,
|
|
3389
|
+
className: classes$2.collapsible,
|
|
4281
3390
|
children: [
|
|
4282
|
-
/* @__PURE__ */ u("div", { className: classes.header, children: [
|
|
4283
|
-
/* @__PURE__ */ u("div", { className: classes.heading, children: [
|
|
4284
|
-
/* @__PURE__ */ u(
|
|
4285
|
-
/* @__PURE__ */ u(
|
|
3391
|
+
/* @__PURE__ */ u("div", { className: classes$2.header, children: [
|
|
3392
|
+
/* @__PURE__ */ u("div", { className: classes$2.heading, children: [
|
|
3393
|
+
/* @__PURE__ */ u(Text, { weight: "bold", children: heading2 }),
|
|
3394
|
+
/* @__PURE__ */ u(Text, { size: "caption", color: "muted", children: subheading })
|
|
4286
3395
|
] }),
|
|
4287
3396
|
/* @__PURE__ */ u(Trigger, { asChild: true, children: /* @__PURE__ */ u(Button, { variant: "ghost", children: [
|
|
4288
3397
|
settingsOpen ? hideLabel : selectLabel,
|
|
@@ -4292,25 +3401,43 @@ const BannerContent = ({
|
|
|
4292
3401
|
{
|
|
4293
3402
|
size: 12,
|
|
4294
3403
|
className: clx({
|
|
4295
|
-
[classes.chevron]: true,
|
|
4296
|
-
[classes.open]: settingsOpen
|
|
3404
|
+
[classes$2.chevron]: true,
|
|
3405
|
+
[classes$2.open]: settingsOpen
|
|
4297
3406
|
})
|
|
4298
3407
|
}
|
|
4299
3408
|
)
|
|
4300
3409
|
] }) })
|
|
4301
3410
|
] }),
|
|
4302
|
-
/* @__PURE__ */ u(
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
3411
|
+
/* @__PURE__ */ u(
|
|
3412
|
+
Content,
|
|
3413
|
+
{
|
|
3414
|
+
className: clx({
|
|
3415
|
+
[classes$2.settings]: true
|
|
3416
|
+
}),
|
|
3417
|
+
children: /* @__PURE__ */ u(
|
|
3418
|
+
Root2,
|
|
3419
|
+
{
|
|
3420
|
+
type: "single",
|
|
3421
|
+
collapsible: true,
|
|
3422
|
+
value: openItem,
|
|
3423
|
+
onValueChange: setOpenItem,
|
|
3424
|
+
children: items.map((item) => /* @__PURE__ */ u(BannerItem, { ...item, openItem }, item.value))
|
|
3425
|
+
}
|
|
3426
|
+
)
|
|
3427
|
+
}
|
|
3428
|
+
),
|
|
3429
|
+
/* @__PURE__ */ u("div", { className: classes$2.footer, children: [
|
|
3430
|
+
/* @__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 }) }) }),
|
|
3431
|
+
/* @__PURE__ */ u("div", { className: classes$2.actions, children: [
|
|
3432
|
+
/* @__PURE__ */ u(Button, { variant: "neutral", onClick: () => onDeclineAll(), children: declineLabel }),
|
|
3433
|
+
/* @__PURE__ */ u(Button, { variant: "brand", onClick: () => onSave(), children: saveLabel })
|
|
4307
3434
|
] })
|
|
4308
3435
|
] })
|
|
4309
3436
|
]
|
|
4310
3437
|
}
|
|
4311
3438
|
)
|
|
4312
3439
|
}
|
|
4313
|
-
)
|
|
3440
|
+
);
|
|
4314
3441
|
};
|
|
4315
3442
|
const Banner = ({
|
|
4316
3443
|
localStorageKey = "cb-selection",
|