@uninspired/cookie-banner 0.0.7 → 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/components/Banner/Banner.js +12 -9
- package/dist/react/index.cjs +87 -1619
- package/dist/react/index.js +82 -1613
- package/dist/react/style.css +37 -18
- package/dist/script/index.cjs +1 -45
- package/dist/script/index.js +1230 -2256
- package/dist/script/style.css +1 -1
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
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) {
|
|
8
|
-
for (const
|
|
9
|
-
if (
|
|
10
|
-
const d = Object.getOwnPropertyDescriptor(e,
|
|
11
|
-
Object.defineProperty(n,
|
|
7
|
+
for (const k in e) {
|
|
8
|
+
if (k !== "default") {
|
|
9
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
10
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
12
11
|
enumerable: true,
|
|
13
|
-
get: () => e[
|
|
12
|
+
get: () => e[k]
|
|
14
13
|
});
|
|
15
14
|
}
|
|
16
15
|
}
|
|
@@ -19,11 +18,7 @@ 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
|
-
function k(n) {
|
|
25
|
-
return n.children;
|
|
26
|
-
}
|
|
27
22
|
l = { __e: function(n, l2, u2, t) {
|
|
28
23
|
for (var i, r, o; l2 = l2.__; ) if ((i = l2.__c) && !i.__) try {
|
|
29
24
|
if ((r = i.constructor) && null != r.getDerivedStateFromError && (i.setState(r.getDerivedStateFromError(n)), o = i.__d), null != i.componentDidCatch && (i.componentDidCatch(n, t || {}), o = i.__d), o) return i.__E = i;
|
|
@@ -98,25 +93,25 @@ const Text = ({
|
|
|
98
93
|
)
|
|
99
94
|
);
|
|
100
95
|
};
|
|
101
|
-
const root$2 = "
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const settings = "
|
|
109
|
-
const footer = "
|
|
110
|
-
const legal = "
|
|
111
|
-
const actions$1 = "
|
|
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";
|
|
112
107
|
const classes$2 = {
|
|
113
108
|
root: root$2,
|
|
109
|
+
open: open$1,
|
|
114
110
|
noTarget,
|
|
115
111
|
collapsible,
|
|
116
112
|
header: header$1,
|
|
117
113
|
heading,
|
|
118
114
|
chevron: chevron$1,
|
|
119
|
-
open: open$1,
|
|
120
115
|
settings,
|
|
121
116
|
footer,
|
|
122
117
|
legal,
|
|
@@ -158,9 +153,9 @@ function $constructor(name, initializer2, params) {
|
|
|
158
153
|
const proto = _.prototype;
|
|
159
154
|
const keys = Object.keys(proto);
|
|
160
155
|
for (let i = 0; i < keys.length; i++) {
|
|
161
|
-
const
|
|
162
|
-
if (!(
|
|
163
|
-
inst[
|
|
156
|
+
const k = keys[i];
|
|
157
|
+
if (!(k in inst)) {
|
|
158
|
+
inst[k] = proto[k].bind(inst);
|
|
164
159
|
}
|
|
165
160
|
}
|
|
166
161
|
}
|
|
@@ -276,8 +271,8 @@ function normalizeParams(_params) {
|
|
|
276
271
|
return {};
|
|
277
272
|
}
|
|
278
273
|
function optionalKeys(shape) {
|
|
279
|
-
return Object.keys(shape).filter((
|
|
280
|
-
return shape[
|
|
274
|
+
return Object.keys(shape).filter((k) => {
|
|
275
|
+
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
281
276
|
});
|
|
282
277
|
}
|
|
283
278
|
function aborted(x, startIndex = 0) {
|
|
@@ -345,7 +340,7 @@ const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
345
340
|
}
|
|
346
341
|
return result.value;
|
|
347
342
|
};
|
|
348
|
-
const parse
|
|
343
|
+
const parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
349
344
|
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
350
345
|
const ctx = _ctx ? Object.assign(_ctx, { async: true }) : { async: true };
|
|
351
346
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -560,9 +555,9 @@ function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
|
560
555
|
}
|
|
561
556
|
function normalizeDef(def) {
|
|
562
557
|
const keys = Object.keys(def.shape);
|
|
563
|
-
for (const
|
|
564
|
-
if (!def.shape?.[
|
|
565
|
-
throw new Error(`Invalid element at key "${
|
|
558
|
+
for (const k of keys) {
|
|
559
|
+
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
560
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
566
561
|
}
|
|
567
562
|
}
|
|
568
563
|
const okeys = optionalKeys(def.shape);
|
|
@@ -747,11 +742,11 @@ const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUn
|
|
|
747
742
|
const pv = option._zod.propValues;
|
|
748
743
|
if (!pv || Object.keys(pv).length === 0)
|
|
749
744
|
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
750
|
-
for (const [
|
|
751
|
-
if (!propValues[
|
|
752
|
-
propValues[
|
|
745
|
+
for (const [k, v] of Object.entries(pv)) {
|
|
746
|
+
if (!propValues[k])
|
|
747
|
+
propValues[k] = /* @__PURE__ */ new Set();
|
|
753
748
|
for (const val of v) {
|
|
754
|
-
propValues[
|
|
749
|
+
propValues[k].add(val);
|
|
755
750
|
}
|
|
756
751
|
}
|
|
757
752
|
}
|
|
@@ -983,7 +978,7 @@ const ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
|
983
978
|
$ZodType.init(inst, def);
|
|
984
979
|
inst.def = def;
|
|
985
980
|
inst.type = def.type;
|
|
986
|
-
inst.parse = (data, params) => parse
|
|
981
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
987
982
|
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
988
983
|
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
989
984
|
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
@@ -1110,7 +1105,7 @@ var hasRequiredReactJsxRuntime_production_min;
|
|
|
1110
1105
|
function requireReactJsxRuntime_production_min() {
|
|
1111
1106
|
if (hasRequiredReactJsxRuntime_production_min) return reactJsxRuntime_production_min;
|
|
1112
1107
|
hasRequiredReactJsxRuntime_production_min = 1;
|
|
1113
|
-
var f2 = React,
|
|
1108
|
+
var f2 = React, k = /* @__PURE__ */ Symbol.for("react.element"), l2 = /* @__PURE__ */ Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, n = f2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
|
|
1114
1109
|
function q(c, a, g) {
|
|
1115
1110
|
var b, d = {}, e = null, h = null;
|
|
1116
1111
|
void 0 !== g && (e = "" + g);
|
|
@@ -1118,7 +1113,7 @@ function requireReactJsxRuntime_production_min() {
|
|
|
1118
1113
|
void 0 !== a.ref && (h = a.ref);
|
|
1119
1114
|
for (b in a) m.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
|
|
1120
1115
|
if (c && c.defaultProps) for (b in a = c.defaultProps, a) void 0 === d[b] && (d[b] = a[b]);
|
|
1121
|
-
return { $$typeof:
|
|
1116
|
+
return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
|
|
1122
1117
|
}
|
|
1123
1118
|
reactJsxRuntime_production_min.Fragment = l2;
|
|
1124
1119
|
reactJsxRuntime_production_min.jsx = q;
|
|
@@ -1955,8 +1950,8 @@ function requireReactJsxRuntime_development() {
|
|
|
1955
1950
|
{
|
|
1956
1951
|
if (hasOwnProperty.call(props, "key")) {
|
|
1957
1952
|
var componentName = getComponentNameFromType(type);
|
|
1958
|
-
var keys = Object.keys(props).filter(function(
|
|
1959
|
-
return
|
|
1953
|
+
var keys = Object.keys(props).filter(function(k) {
|
|
1954
|
+
return k !== "key";
|
|
1960
1955
|
});
|
|
1961
1956
|
var beforeExample = keys.length > 0 ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
1962
1957
|
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
@@ -2005,22 +2000,6 @@ function requireJsxRuntime() {
|
|
|
2005
2000
|
return jsxRuntime.exports;
|
|
2006
2001
|
}
|
|
2007
2002
|
var jsxRuntimeExports = /* @__PURE__ */ requireJsxRuntime();
|
|
2008
|
-
function createContext2(rootComponentName, defaultContext) {
|
|
2009
|
-
const Context = React__namespace.createContext(defaultContext);
|
|
2010
|
-
const Provider = (props) => {
|
|
2011
|
-
const { children, ...context } = props;
|
|
2012
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
2013
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
|
|
2014
|
-
};
|
|
2015
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
2016
|
-
function useContext2(consumerName) {
|
|
2017
|
-
const context = React__namespace.useContext(Context);
|
|
2018
|
-
if (context) return context;
|
|
2019
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
2020
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
2021
|
-
}
|
|
2022
|
-
return [Provider, useContext2];
|
|
2023
|
-
}
|
|
2024
2003
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
2025
2004
|
let defaultContexts = [];
|
|
2026
2005
|
function createContext3(rootComponentName, defaultContext) {
|
|
@@ -2350,21 +2329,18 @@ var NODES = [
|
|
|
2350
2329
|
"ul"
|
|
2351
2330
|
];
|
|
2352
2331
|
var Primitive = NODES.reduce((primitive, node) => {
|
|
2353
|
-
const
|
|
2354
|
-
const
|
|
2332
|
+
const Slot = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
2333
|
+
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
2355
2334
|
const { asChild, ...primitiveProps } = props;
|
|
2356
|
-
const Comp = asChild ?
|
|
2335
|
+
const Comp = asChild ? Slot : node;
|
|
2357
2336
|
if (typeof window !== "undefined") {
|
|
2358
2337
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
2359
2338
|
}
|
|
2360
2339
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
2361
2340
|
});
|
|
2362
|
-
|
|
2363
|
-
return { ...primitive, [node]:
|
|
2341
|
+
Node.displayName = `Primitive.${node}`;
|
|
2342
|
+
return { ...primitive, [node]: Node };
|
|
2364
2343
|
}, {});
|
|
2365
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
2366
|
-
if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
|
|
2367
|
-
}
|
|
2368
2344
|
function useStateMachine(initialState, machine) {
|
|
2369
2345
|
return React__namespace.useReducer((state, event) => {
|
|
2370
2346
|
const nextState = machine[state][event];
|
|
@@ -2488,11 +2464,11 @@ function getElementRef(element) {
|
|
|
2488
2464
|
return element.props.ref || element.ref;
|
|
2489
2465
|
}
|
|
2490
2466
|
var useReactId = React__namespace[" useId ".trim().toString()] || (() => void 0);
|
|
2491
|
-
var count
|
|
2467
|
+
var count = 0;
|
|
2492
2468
|
function useId(deterministicId) {
|
|
2493
2469
|
const [id, setId] = React__namespace.useState(useReactId());
|
|
2494
2470
|
useLayoutEffect2(() => {
|
|
2495
|
-
setId((reactId) => reactId ?? String(count
|
|
2471
|
+
setId((reactId) => reactId ?? String(count++));
|
|
2496
2472
|
}, [deterministicId]);
|
|
2497
2473
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
2498
2474
|
}
|
|
@@ -2526,7 +2502,7 @@ var Collapsible = React__namespace.forwardRef(
|
|
|
2526
2502
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2527
2503
|
Primitive.div,
|
|
2528
2504
|
{
|
|
2529
|
-
"data-state": getState$
|
|
2505
|
+
"data-state": getState$2(open2),
|
|
2530
2506
|
"data-disabled": disabled ? "" : void 0,
|
|
2531
2507
|
...collapsibleProps,
|
|
2532
2508
|
ref: forwardedRef
|
|
@@ -2537,18 +2513,18 @@ var Collapsible = React__namespace.forwardRef(
|
|
|
2537
2513
|
}
|
|
2538
2514
|
);
|
|
2539
2515
|
Collapsible.displayName = COLLAPSIBLE_NAME;
|
|
2540
|
-
var TRIGGER_NAME$
|
|
2516
|
+
var TRIGGER_NAME$1 = "CollapsibleTrigger";
|
|
2541
2517
|
var CollapsibleTrigger = React__namespace.forwardRef(
|
|
2542
2518
|
(props, forwardedRef) => {
|
|
2543
2519
|
const { __scopeCollapsible, ...triggerProps } = props;
|
|
2544
|
-
const context = useCollapsibleContext(TRIGGER_NAME$
|
|
2520
|
+
const context = useCollapsibleContext(TRIGGER_NAME$1, __scopeCollapsible);
|
|
2545
2521
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2546
2522
|
Primitive.button,
|
|
2547
2523
|
{
|
|
2548
2524
|
type: "button",
|
|
2549
2525
|
"aria-controls": context.contentId,
|
|
2550
2526
|
"aria-expanded": context.open || false,
|
|
2551
|
-
"data-state": getState$
|
|
2527
|
+
"data-state": getState$2(context.open),
|
|
2552
2528
|
"data-disabled": context.disabled ? "" : void 0,
|
|
2553
2529
|
disabled: context.disabled,
|
|
2554
2530
|
...triggerProps,
|
|
@@ -2558,19 +2534,19 @@ var CollapsibleTrigger = React__namespace.forwardRef(
|
|
|
2558
2534
|
);
|
|
2559
2535
|
}
|
|
2560
2536
|
);
|
|
2561
|
-
CollapsibleTrigger.displayName = TRIGGER_NAME$
|
|
2562
|
-
var CONTENT_NAME$
|
|
2537
|
+
CollapsibleTrigger.displayName = TRIGGER_NAME$1;
|
|
2538
|
+
var CONTENT_NAME$1 = "CollapsibleContent";
|
|
2563
2539
|
var CollapsibleContent = React__namespace.forwardRef(
|
|
2564
2540
|
(props, forwardedRef) => {
|
|
2565
2541
|
const { forceMount, ...contentProps } = props;
|
|
2566
|
-
const context = useCollapsibleContext(CONTENT_NAME$
|
|
2542
|
+
const context = useCollapsibleContext(CONTENT_NAME$1, props.__scopeCollapsible);
|
|
2567
2543
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsxRuntimeExports.jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
|
|
2568
2544
|
}
|
|
2569
2545
|
);
|
|
2570
|
-
CollapsibleContent.displayName = CONTENT_NAME$
|
|
2546
|
+
CollapsibleContent.displayName = CONTENT_NAME$1;
|
|
2571
2547
|
var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) => {
|
|
2572
2548
|
const { __scopeCollapsible, present, children, ...contentProps } = props;
|
|
2573
|
-
const context = useCollapsibleContext(CONTENT_NAME$
|
|
2549
|
+
const context = useCollapsibleContext(CONTENT_NAME$1, __scopeCollapsible);
|
|
2574
2550
|
const [isPresent, setIsPresent] = React__namespace.useState(present);
|
|
2575
2551
|
const ref = React__namespace.useRef(null);
|
|
2576
2552
|
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
@@ -2607,7 +2583,7 @@ var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) =
|
|
|
2607
2583
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2608
2584
|
Primitive.div,
|
|
2609
2585
|
{
|
|
2610
|
-
"data-state": getState$
|
|
2586
|
+
"data-state": getState$2(context.open),
|
|
2611
2587
|
"data-disabled": context.disabled ? "" : void 0,
|
|
2612
2588
|
id: context.contentId,
|
|
2613
2589
|
hidden: !isOpen,
|
|
@@ -2622,12 +2598,12 @@ var CollapsibleContentImpl = React__namespace.forwardRef((props, forwardedRef) =
|
|
|
2622
2598
|
}
|
|
2623
2599
|
);
|
|
2624
2600
|
});
|
|
2625
|
-
function getState$
|
|
2601
|
+
function getState$2(open2) {
|
|
2626
2602
|
return open2 ? "open" : "closed";
|
|
2627
2603
|
}
|
|
2628
|
-
var Root$
|
|
2604
|
+
var Root$1 = Collapsible;
|
|
2629
2605
|
var Trigger = CollapsibleTrigger;
|
|
2630
|
-
var Content
|
|
2606
|
+
var Content = CollapsibleContent;
|
|
2631
2607
|
var DirectionContext = React__namespace.createContext(void 0);
|
|
2632
2608
|
function useDirection(localDir) {
|
|
2633
2609
|
const globalDir = React__namespace.useContext(DirectionContext);
|
|
@@ -2826,10 +2802,10 @@ var AccordionItem = React.forwardRef(
|
|
|
2826
2802
|
disabled,
|
|
2827
2803
|
triggerId,
|
|
2828
2804
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2829
|
-
Root$
|
|
2805
|
+
Root$1,
|
|
2830
2806
|
{
|
|
2831
2807
|
"data-orientation": accordionContext.orientation,
|
|
2832
|
-
"data-state": getState$
|
|
2808
|
+
"data-state": getState$1(open2),
|
|
2833
2809
|
...collapsibleScope,
|
|
2834
2810
|
...accordionItemProps,
|
|
2835
2811
|
ref: forwardedRef,
|
|
@@ -2859,7 +2835,7 @@ var AccordionHeader = React.forwardRef(
|
|
|
2859
2835
|
Primitive.h3,
|
|
2860
2836
|
{
|
|
2861
2837
|
"data-orientation": accordionContext.orientation,
|
|
2862
|
-
"data-state": getState$
|
|
2838
|
+
"data-state": getState$1(itemContext.open),
|
|
2863
2839
|
"data-disabled": itemContext.disabled ? "" : void 0,
|
|
2864
2840
|
...headerProps,
|
|
2865
2841
|
ref: forwardedRef
|
|
@@ -2868,13 +2844,13 @@ var AccordionHeader = React.forwardRef(
|
|
|
2868
2844
|
}
|
|
2869
2845
|
);
|
|
2870
2846
|
AccordionHeader.displayName = HEADER_NAME;
|
|
2871
|
-
var TRIGGER_NAME
|
|
2847
|
+
var TRIGGER_NAME = "AccordionTrigger";
|
|
2872
2848
|
var AccordionTrigger = React.forwardRef(
|
|
2873
2849
|
(props, forwardedRef) => {
|
|
2874
2850
|
const { __scopeAccordion, ...triggerProps } = props;
|
|
2875
2851
|
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
|
|
2876
|
-
const itemContext = useAccordionItemContext(TRIGGER_NAME
|
|
2877
|
-
const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME
|
|
2852
|
+
const itemContext = useAccordionItemContext(TRIGGER_NAME, __scopeAccordion);
|
|
2853
|
+
const collapsibleContext = useAccordionCollapsibleContext(TRIGGER_NAME, __scopeAccordion);
|
|
2878
2854
|
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
|
|
2879
2855
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.ItemSlot, { scope: __scopeAccordion, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2880
2856
|
Trigger,
|
|
@@ -2889,16 +2865,16 @@ var AccordionTrigger = React.forwardRef(
|
|
|
2889
2865
|
) });
|
|
2890
2866
|
}
|
|
2891
2867
|
);
|
|
2892
|
-
AccordionTrigger.displayName = TRIGGER_NAME
|
|
2893
|
-
var CONTENT_NAME
|
|
2868
|
+
AccordionTrigger.displayName = TRIGGER_NAME;
|
|
2869
|
+
var CONTENT_NAME = "AccordionContent";
|
|
2894
2870
|
var AccordionContent = React.forwardRef(
|
|
2895
2871
|
(props, forwardedRef) => {
|
|
2896
2872
|
const { __scopeAccordion, ...contentProps } = props;
|
|
2897
2873
|
const accordionContext = useAccordionContext(ACCORDION_NAME, __scopeAccordion);
|
|
2898
|
-
const itemContext = useAccordionItemContext(CONTENT_NAME
|
|
2874
|
+
const itemContext = useAccordionItemContext(CONTENT_NAME, __scopeAccordion);
|
|
2899
2875
|
const collapsibleScope = useCollapsibleScope(__scopeAccordion);
|
|
2900
2876
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
2901
|
-
Content
|
|
2877
|
+
Content,
|
|
2902
2878
|
{
|
|
2903
2879
|
role: "region",
|
|
2904
2880
|
"aria-labelledby": itemContext.triggerId,
|
|
@@ -2915,8 +2891,8 @@ var AccordionContent = React.forwardRef(
|
|
|
2915
2891
|
);
|
|
2916
2892
|
}
|
|
2917
2893
|
);
|
|
2918
|
-
AccordionContent.displayName = CONTENT_NAME
|
|
2919
|
-
function getState$
|
|
2894
|
+
AccordionContent.displayName = CONTENT_NAME;
|
|
2895
|
+
function getState$1(open2) {
|
|
2920
2896
|
return open2 ? "open" : "closed";
|
|
2921
2897
|
}
|
|
2922
2898
|
var Root2 = Accordion;
|
|
@@ -3082,7 +3058,7 @@ var Switch$1 = React__namespace.forwardRef(
|
|
|
3082
3058
|
role: "switch",
|
|
3083
3059
|
"aria-checked": checked,
|
|
3084
3060
|
"aria-required": required,
|
|
3085
|
-
"data-state": getState
|
|
3061
|
+
"data-state": getState(checked),
|
|
3086
3062
|
"data-disabled": disabled ? "" : void 0,
|
|
3087
3063
|
disabled,
|
|
3088
3064
|
value,
|
|
@@ -3123,7 +3099,7 @@ var SwitchThumb = React__namespace.forwardRef(
|
|
|
3123
3099
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3124
3100
|
Primitive.span,
|
|
3125
3101
|
{
|
|
3126
|
-
"data-state": getState
|
|
3102
|
+
"data-state": getState(context.checked),
|
|
3127
3103
|
"data-disabled": context.disabled ? "" : void 0,
|
|
3128
3104
|
...thumbProps,
|
|
3129
3105
|
ref: forwardedRef
|
|
@@ -3182,10 +3158,10 @@ var SwitchBubbleInput = React__namespace.forwardRef(
|
|
|
3182
3158
|
}
|
|
3183
3159
|
);
|
|
3184
3160
|
SwitchBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
3185
|
-
function getState
|
|
3161
|
+
function getState(checked) {
|
|
3186
3162
|
return checked ? "checked" : "unchecked";
|
|
3187
3163
|
}
|
|
3188
|
-
var Root
|
|
3164
|
+
var Root = Switch$1;
|
|
3189
3165
|
var Thumb = SwitchThumb;
|
|
3190
3166
|
const root = "_root_dibqz_1";
|
|
3191
3167
|
const thumb = "_thumb_dibqz_38";
|
|
@@ -3197,7 +3173,7 @@ const classes = {
|
|
|
3197
3173
|
const Switch = ({ label: label2, id, ...rest }) => {
|
|
3198
3174
|
return /* @__PURE__ */ u("div", { className: classes.root, children: [
|
|
3199
3175
|
label2 && /* @__PURE__ */ u(Text, { className: classes.label, as: "label", htmlFor: id, children: label2 }),
|
|
3200
|
-
/* @__PURE__ */ u(Root
|
|
3176
|
+
/* @__PURE__ */ u(Root, { className: classes.switch, ...rest, children: /* @__PURE__ */ u(Thumb, { className: classes.thumb }) })
|
|
3201
3177
|
] });
|
|
3202
3178
|
};
|
|
3203
3179
|
const selectionSchema = /* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ boolean());
|
|
@@ -3382,1518 +3358,6 @@ const BannerItem = ({
|
|
|
3382
3358
|
) })
|
|
3383
3359
|
] });
|
|
3384
3360
|
};
|
|
3385
|
-
function useCallbackRef$1(callback) {
|
|
3386
|
-
const callbackRef = React__namespace.useRef(callback);
|
|
3387
|
-
React__namespace.useEffect(() => {
|
|
3388
|
-
callbackRef.current = callback;
|
|
3389
|
-
});
|
|
3390
|
-
return React__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
3391
|
-
}
|
|
3392
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
3393
|
-
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
3394
|
-
React__namespace.useEffect(() => {
|
|
3395
|
-
const handleKeyDown = (event) => {
|
|
3396
|
-
if (event.key === "Escape") {
|
|
3397
|
-
onEscapeKeyDown(event);
|
|
3398
|
-
}
|
|
3399
|
-
};
|
|
3400
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
3401
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
3402
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
3403
|
-
}
|
|
3404
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
3405
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
3406
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
3407
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
3408
|
-
var originalBodyPointerEvents;
|
|
3409
|
-
var DismissableLayerContext = React__namespace.createContext({
|
|
3410
|
-
layers: /* @__PURE__ */ new Set(),
|
|
3411
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
3412
|
-
branches: /* @__PURE__ */ new Set()
|
|
3413
|
-
});
|
|
3414
|
-
var DismissableLayer = React__namespace.forwardRef(
|
|
3415
|
-
(props, forwardedRef) => {
|
|
3416
|
-
const {
|
|
3417
|
-
disableOutsidePointerEvents = false,
|
|
3418
|
-
onEscapeKeyDown,
|
|
3419
|
-
onPointerDownOutside,
|
|
3420
|
-
onFocusOutside,
|
|
3421
|
-
onInteractOutside,
|
|
3422
|
-
onDismiss,
|
|
3423
|
-
...layerProps
|
|
3424
|
-
} = props;
|
|
3425
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
3426
|
-
const [node, setNode] = React__namespace.useState(null);
|
|
3427
|
-
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
3428
|
-
const [, force] = React__namespace.useState({});
|
|
3429
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
3430
|
-
const layers = Array.from(context.layers);
|
|
3431
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
3432
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
3433
|
-
const index = node ? layers.indexOf(node) : -1;
|
|
3434
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
3435
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
3436
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
3437
|
-
const target = event.target;
|
|
3438
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
3439
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
3440
|
-
onPointerDownOutside?.(event);
|
|
3441
|
-
onInteractOutside?.(event);
|
|
3442
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
3443
|
-
}, ownerDocument);
|
|
3444
|
-
const focusOutside = useFocusOutside((event) => {
|
|
3445
|
-
const target = event.target;
|
|
3446
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
3447
|
-
if (isFocusInBranch) return;
|
|
3448
|
-
onFocusOutside?.(event);
|
|
3449
|
-
onInteractOutside?.(event);
|
|
3450
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
3451
|
-
}, ownerDocument);
|
|
3452
|
-
useEscapeKeydown((event) => {
|
|
3453
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
3454
|
-
if (!isHighestLayer) return;
|
|
3455
|
-
onEscapeKeyDown?.(event);
|
|
3456
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
3457
|
-
event.preventDefault();
|
|
3458
|
-
onDismiss();
|
|
3459
|
-
}
|
|
3460
|
-
}, ownerDocument);
|
|
3461
|
-
React__namespace.useEffect(() => {
|
|
3462
|
-
if (!node) return;
|
|
3463
|
-
if (disableOutsidePointerEvents) {
|
|
3464
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
3465
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
3466
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
3467
|
-
}
|
|
3468
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
3469
|
-
}
|
|
3470
|
-
context.layers.add(node);
|
|
3471
|
-
dispatchUpdate();
|
|
3472
|
-
return () => {
|
|
3473
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
3474
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
3475
|
-
}
|
|
3476
|
-
};
|
|
3477
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
3478
|
-
React__namespace.useEffect(() => {
|
|
3479
|
-
return () => {
|
|
3480
|
-
if (!node) return;
|
|
3481
|
-
context.layers.delete(node);
|
|
3482
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
3483
|
-
dispatchUpdate();
|
|
3484
|
-
};
|
|
3485
|
-
}, [node, context]);
|
|
3486
|
-
React__namespace.useEffect(() => {
|
|
3487
|
-
const handleUpdate = () => force({});
|
|
3488
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
3489
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
3490
|
-
}, []);
|
|
3491
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3492
|
-
Primitive.div,
|
|
3493
|
-
{
|
|
3494
|
-
...layerProps,
|
|
3495
|
-
ref: composedRefs,
|
|
3496
|
-
style: {
|
|
3497
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
3498
|
-
...props.style
|
|
3499
|
-
},
|
|
3500
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
3501
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
3502
|
-
onPointerDownCapture: composeEventHandlers(
|
|
3503
|
-
props.onPointerDownCapture,
|
|
3504
|
-
pointerDownOutside.onPointerDownCapture
|
|
3505
|
-
)
|
|
3506
|
-
}
|
|
3507
|
-
);
|
|
3508
|
-
}
|
|
3509
|
-
);
|
|
3510
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
3511
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
3512
|
-
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
3513
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
3514
|
-
const ref = React__namespace.useRef(null);
|
|
3515
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
3516
|
-
React__namespace.useEffect(() => {
|
|
3517
|
-
const node = ref.current;
|
|
3518
|
-
if (node) {
|
|
3519
|
-
context.branches.add(node);
|
|
3520
|
-
return () => {
|
|
3521
|
-
context.branches.delete(node);
|
|
3522
|
-
};
|
|
3523
|
-
}
|
|
3524
|
-
}, [context.branches]);
|
|
3525
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
3526
|
-
});
|
|
3527
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
3528
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
3529
|
-
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
3530
|
-
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
3531
|
-
const handleClickRef = React__namespace.useRef(() => {
|
|
3532
|
-
});
|
|
3533
|
-
React__namespace.useEffect(() => {
|
|
3534
|
-
const handlePointerDown = (event) => {
|
|
3535
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
3536
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
3537
|
-
handleAndDispatchCustomEvent(
|
|
3538
|
-
POINTER_DOWN_OUTSIDE,
|
|
3539
|
-
handlePointerDownOutside,
|
|
3540
|
-
eventDetail,
|
|
3541
|
-
{ discrete: true }
|
|
3542
|
-
);
|
|
3543
|
-
};
|
|
3544
|
-
const eventDetail = { originalEvent: event };
|
|
3545
|
-
if (event.pointerType === "touch") {
|
|
3546
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
3547
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
3548
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
3549
|
-
} else {
|
|
3550
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
3551
|
-
}
|
|
3552
|
-
} else {
|
|
3553
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
3554
|
-
}
|
|
3555
|
-
isPointerInsideReactTreeRef.current = false;
|
|
3556
|
-
};
|
|
3557
|
-
const timerId = window.setTimeout(() => {
|
|
3558
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
3559
|
-
}, 0);
|
|
3560
|
-
return () => {
|
|
3561
|
-
window.clearTimeout(timerId);
|
|
3562
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
3563
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
3564
|
-
};
|
|
3565
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
3566
|
-
return {
|
|
3567
|
-
// ensures we check React component tree (not just DOM tree)
|
|
3568
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
3569
|
-
};
|
|
3570
|
-
}
|
|
3571
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
3572
|
-
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
3573
|
-
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
3574
|
-
React__namespace.useEffect(() => {
|
|
3575
|
-
const handleFocus = (event) => {
|
|
3576
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
3577
|
-
const eventDetail = { originalEvent: event };
|
|
3578
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
3579
|
-
discrete: false
|
|
3580
|
-
});
|
|
3581
|
-
}
|
|
3582
|
-
};
|
|
3583
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
3584
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
3585
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
3586
|
-
return {
|
|
3587
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
3588
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
3589
|
-
};
|
|
3590
|
-
}
|
|
3591
|
-
function dispatchUpdate() {
|
|
3592
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
3593
|
-
document.dispatchEvent(event);
|
|
3594
|
-
}
|
|
3595
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
3596
|
-
const target = detail.originalEvent.target;
|
|
3597
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
3598
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
3599
|
-
if (discrete) {
|
|
3600
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
3601
|
-
} else {
|
|
3602
|
-
target.dispatchEvent(event);
|
|
3603
|
-
}
|
|
3604
|
-
}
|
|
3605
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
3606
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
3607
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
3608
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
3609
|
-
var FocusScope = React__namespace.forwardRef((props, forwardedRef) => {
|
|
3610
|
-
const {
|
|
3611
|
-
loop = false,
|
|
3612
|
-
trapped = false,
|
|
3613
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
3614
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
3615
|
-
...scopeProps
|
|
3616
|
-
} = props;
|
|
3617
|
-
const [container, setContainer] = React__namespace.useState(null);
|
|
3618
|
-
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
3619
|
-
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
3620
|
-
const lastFocusedElementRef = React__namespace.useRef(null);
|
|
3621
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
3622
|
-
const focusScope = React__namespace.useRef({
|
|
3623
|
-
paused: false,
|
|
3624
|
-
pause() {
|
|
3625
|
-
this.paused = true;
|
|
3626
|
-
},
|
|
3627
|
-
resume() {
|
|
3628
|
-
this.paused = false;
|
|
3629
|
-
}
|
|
3630
|
-
}).current;
|
|
3631
|
-
React__namespace.useEffect(() => {
|
|
3632
|
-
if (trapped) {
|
|
3633
|
-
let handleFocusIn2 = function(event) {
|
|
3634
|
-
if (focusScope.paused || !container) return;
|
|
3635
|
-
const target = event.target;
|
|
3636
|
-
if (container.contains(target)) {
|
|
3637
|
-
lastFocusedElementRef.current = target;
|
|
3638
|
-
} else {
|
|
3639
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
3640
|
-
}
|
|
3641
|
-
}, handleFocusOut2 = function(event) {
|
|
3642
|
-
if (focusScope.paused || !container) return;
|
|
3643
|
-
const relatedTarget = event.relatedTarget;
|
|
3644
|
-
if (relatedTarget === null) return;
|
|
3645
|
-
if (!container.contains(relatedTarget)) {
|
|
3646
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
3647
|
-
}
|
|
3648
|
-
}, handleMutations2 = function(mutations) {
|
|
3649
|
-
const focusedElement = document.activeElement;
|
|
3650
|
-
if (focusedElement !== document.body) return;
|
|
3651
|
-
for (const mutation of mutations) {
|
|
3652
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
3653
|
-
}
|
|
3654
|
-
};
|
|
3655
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
3656
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
3657
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
3658
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
3659
|
-
return () => {
|
|
3660
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
3661
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
3662
|
-
mutationObserver.disconnect();
|
|
3663
|
-
};
|
|
3664
|
-
}
|
|
3665
|
-
}, [trapped, container, focusScope.paused]);
|
|
3666
|
-
React__namespace.useEffect(() => {
|
|
3667
|
-
if (container) {
|
|
3668
|
-
focusScopesStack.add(focusScope);
|
|
3669
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3670
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
3671
|
-
if (!hasFocusedCandidate) {
|
|
3672
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
3673
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
3674
|
-
container.dispatchEvent(mountEvent);
|
|
3675
|
-
if (!mountEvent.defaultPrevented) {
|
|
3676
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
3677
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
3678
|
-
focus(container);
|
|
3679
|
-
}
|
|
3680
|
-
}
|
|
3681
|
-
}
|
|
3682
|
-
return () => {
|
|
3683
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
3684
|
-
setTimeout(() => {
|
|
3685
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
3686
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
3687
|
-
container.dispatchEvent(unmountEvent);
|
|
3688
|
-
if (!unmountEvent.defaultPrevented) {
|
|
3689
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
3690
|
-
}
|
|
3691
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
3692
|
-
focusScopesStack.remove(focusScope);
|
|
3693
|
-
}, 0);
|
|
3694
|
-
};
|
|
3695
|
-
}
|
|
3696
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
3697
|
-
const handleKeyDown = React__namespace.useCallback(
|
|
3698
|
-
(event) => {
|
|
3699
|
-
if (!loop && !trapped) return;
|
|
3700
|
-
if (focusScope.paused) return;
|
|
3701
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
3702
|
-
const focusedElement = document.activeElement;
|
|
3703
|
-
if (isTabKey && focusedElement) {
|
|
3704
|
-
const container2 = event.currentTarget;
|
|
3705
|
-
const [first, last] = getTabbableEdges(container2);
|
|
3706
|
-
const hasTabbableElementsInside = first && last;
|
|
3707
|
-
if (!hasTabbableElementsInside) {
|
|
3708
|
-
if (focusedElement === container2) event.preventDefault();
|
|
3709
|
-
} else {
|
|
3710
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
3711
|
-
event.preventDefault();
|
|
3712
|
-
if (loop) focus(first, { select: true });
|
|
3713
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
3714
|
-
event.preventDefault();
|
|
3715
|
-
if (loop) focus(last, { select: true });
|
|
3716
|
-
}
|
|
3717
|
-
}
|
|
3718
|
-
}
|
|
3719
|
-
},
|
|
3720
|
-
[loop, trapped, focusScope.paused]
|
|
3721
|
-
);
|
|
3722
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
3723
|
-
});
|
|
3724
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
3725
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
3726
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3727
|
-
for (const candidate of candidates) {
|
|
3728
|
-
focus(candidate, { select });
|
|
3729
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
3730
|
-
}
|
|
3731
|
-
}
|
|
3732
|
-
function getTabbableEdges(container) {
|
|
3733
|
-
const candidates = getTabbableCandidates(container);
|
|
3734
|
-
const first = findVisible(candidates, container);
|
|
3735
|
-
const last = findVisible(candidates.reverse(), container);
|
|
3736
|
-
return [first, last];
|
|
3737
|
-
}
|
|
3738
|
-
function getTabbableCandidates(container) {
|
|
3739
|
-
const nodes = [];
|
|
3740
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
3741
|
-
acceptNode: (node) => {
|
|
3742
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
3743
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
3744
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
3745
|
-
}
|
|
3746
|
-
});
|
|
3747
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
3748
|
-
return nodes;
|
|
3749
|
-
}
|
|
3750
|
-
function findVisible(elements, container) {
|
|
3751
|
-
for (const element of elements) {
|
|
3752
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
3753
|
-
}
|
|
3754
|
-
}
|
|
3755
|
-
function isHidden(node, { upTo }) {
|
|
3756
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
3757
|
-
while (node) {
|
|
3758
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
3759
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
3760
|
-
node = node.parentElement;
|
|
3761
|
-
}
|
|
3762
|
-
return false;
|
|
3763
|
-
}
|
|
3764
|
-
function isSelectableInput(element) {
|
|
3765
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
3766
|
-
}
|
|
3767
|
-
function focus(element, { select = false } = {}) {
|
|
3768
|
-
if (element && element.focus) {
|
|
3769
|
-
const previouslyFocusedElement = document.activeElement;
|
|
3770
|
-
element.focus({ preventScroll: true });
|
|
3771
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
3772
|
-
element.select();
|
|
3773
|
-
}
|
|
3774
|
-
}
|
|
3775
|
-
var focusScopesStack = createFocusScopesStack();
|
|
3776
|
-
function createFocusScopesStack() {
|
|
3777
|
-
let stack = [];
|
|
3778
|
-
return {
|
|
3779
|
-
add(focusScope) {
|
|
3780
|
-
const activeFocusScope = stack[0];
|
|
3781
|
-
if (focusScope !== activeFocusScope) {
|
|
3782
|
-
activeFocusScope?.pause();
|
|
3783
|
-
}
|
|
3784
|
-
stack = arrayRemove(stack, focusScope);
|
|
3785
|
-
stack.unshift(focusScope);
|
|
3786
|
-
},
|
|
3787
|
-
remove(focusScope) {
|
|
3788
|
-
stack = arrayRemove(stack, focusScope);
|
|
3789
|
-
stack[0]?.resume();
|
|
3790
|
-
}
|
|
3791
|
-
};
|
|
3792
|
-
}
|
|
3793
|
-
function arrayRemove(array, item) {
|
|
3794
|
-
const updatedArray = [...array];
|
|
3795
|
-
const index = updatedArray.indexOf(item);
|
|
3796
|
-
if (index !== -1) {
|
|
3797
|
-
updatedArray.splice(index, 1);
|
|
3798
|
-
}
|
|
3799
|
-
return updatedArray;
|
|
3800
|
-
}
|
|
3801
|
-
function removeLinks(items) {
|
|
3802
|
-
return items.filter((item) => item.tagName !== "A");
|
|
3803
|
-
}
|
|
3804
|
-
var count = 0;
|
|
3805
|
-
function useFocusGuards() {
|
|
3806
|
-
React__namespace.useEffect(() => {
|
|
3807
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
3808
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
3809
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
3810
|
-
count++;
|
|
3811
|
-
return () => {
|
|
3812
|
-
if (count === 1) {
|
|
3813
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
3814
|
-
}
|
|
3815
|
-
count--;
|
|
3816
|
-
};
|
|
3817
|
-
}, []);
|
|
3818
|
-
}
|
|
3819
|
-
function createFocusGuard() {
|
|
3820
|
-
const element = document.createElement("span");
|
|
3821
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
3822
|
-
element.tabIndex = 0;
|
|
3823
|
-
element.style.outline = "none";
|
|
3824
|
-
element.style.opacity = "0";
|
|
3825
|
-
element.style.position = "fixed";
|
|
3826
|
-
element.style.pointerEvents = "none";
|
|
3827
|
-
return element;
|
|
3828
|
-
}
|
|
3829
|
-
var __assign = function() {
|
|
3830
|
-
__assign = Object.assign || function __assign2(t) {
|
|
3831
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3832
|
-
s = arguments[i];
|
|
3833
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
3834
|
-
}
|
|
3835
|
-
return t;
|
|
3836
|
-
};
|
|
3837
|
-
return __assign.apply(this, arguments);
|
|
3838
|
-
};
|
|
3839
|
-
function __rest(s, e) {
|
|
3840
|
-
var t = {};
|
|
3841
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3842
|
-
t[p] = s[p];
|
|
3843
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3844
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3845
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3846
|
-
t[p[i]] = s[p[i]];
|
|
3847
|
-
}
|
|
3848
|
-
return t;
|
|
3849
|
-
}
|
|
3850
|
-
function __spreadArray(to, from, pack) {
|
|
3851
|
-
if (pack || arguments.length === 2) for (var i = 0, l2 = from.length, ar; i < l2; i++) {
|
|
3852
|
-
if (ar || !(i in from)) {
|
|
3853
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3854
|
-
ar[i] = from[i];
|
|
3855
|
-
}
|
|
3856
|
-
}
|
|
3857
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3858
|
-
}
|
|
3859
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
3860
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
3861
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
3862
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
3863
|
-
function assignRef(ref, value) {
|
|
3864
|
-
if (typeof ref === "function") {
|
|
3865
|
-
ref(value);
|
|
3866
|
-
} else if (ref) {
|
|
3867
|
-
ref.current = value;
|
|
3868
|
-
}
|
|
3869
|
-
return ref;
|
|
3870
|
-
}
|
|
3871
|
-
function useCallbackRef(initialValue, callback) {
|
|
3872
|
-
var ref = React.useState(function() {
|
|
3873
|
-
return {
|
|
3874
|
-
// value
|
|
3875
|
-
value: initialValue,
|
|
3876
|
-
// last callback
|
|
3877
|
-
callback,
|
|
3878
|
-
// "memoized" public interface
|
|
3879
|
-
facade: {
|
|
3880
|
-
get current() {
|
|
3881
|
-
return ref.value;
|
|
3882
|
-
},
|
|
3883
|
-
set current(value) {
|
|
3884
|
-
var last = ref.value;
|
|
3885
|
-
if (last !== value) {
|
|
3886
|
-
ref.value = value;
|
|
3887
|
-
ref.callback(value, last);
|
|
3888
|
-
}
|
|
3889
|
-
}
|
|
3890
|
-
}
|
|
3891
|
-
};
|
|
3892
|
-
})[0];
|
|
3893
|
-
ref.callback = callback;
|
|
3894
|
-
return ref.facade;
|
|
3895
|
-
}
|
|
3896
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
3897
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
3898
|
-
function useMergeRefs(refs, defaultValue) {
|
|
3899
|
-
var callbackRef = useCallbackRef(null, function(newValue) {
|
|
3900
|
-
return refs.forEach(function(ref) {
|
|
3901
|
-
return assignRef(ref, newValue);
|
|
3902
|
-
});
|
|
3903
|
-
});
|
|
3904
|
-
useIsomorphicLayoutEffect(function() {
|
|
3905
|
-
var oldValue = currentValues.get(callbackRef);
|
|
3906
|
-
if (oldValue) {
|
|
3907
|
-
var prevRefs_1 = new Set(oldValue);
|
|
3908
|
-
var nextRefs_1 = new Set(refs);
|
|
3909
|
-
var current_1 = callbackRef.current;
|
|
3910
|
-
prevRefs_1.forEach(function(ref) {
|
|
3911
|
-
if (!nextRefs_1.has(ref)) {
|
|
3912
|
-
assignRef(ref, null);
|
|
3913
|
-
}
|
|
3914
|
-
});
|
|
3915
|
-
nextRefs_1.forEach(function(ref) {
|
|
3916
|
-
if (!prevRefs_1.has(ref)) {
|
|
3917
|
-
assignRef(ref, current_1);
|
|
3918
|
-
}
|
|
3919
|
-
});
|
|
3920
|
-
}
|
|
3921
|
-
currentValues.set(callbackRef, refs);
|
|
3922
|
-
}, [refs]);
|
|
3923
|
-
return callbackRef;
|
|
3924
|
-
}
|
|
3925
|
-
function ItoI(a) {
|
|
3926
|
-
return a;
|
|
3927
|
-
}
|
|
3928
|
-
function innerCreateMedium(defaults, middleware) {
|
|
3929
|
-
if (middleware === void 0) {
|
|
3930
|
-
middleware = ItoI;
|
|
3931
|
-
}
|
|
3932
|
-
var buffer = [];
|
|
3933
|
-
var assigned = false;
|
|
3934
|
-
var medium = {
|
|
3935
|
-
read: function() {
|
|
3936
|
-
if (assigned) {
|
|
3937
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
3938
|
-
}
|
|
3939
|
-
if (buffer.length) {
|
|
3940
|
-
return buffer[buffer.length - 1];
|
|
3941
|
-
}
|
|
3942
|
-
return defaults;
|
|
3943
|
-
},
|
|
3944
|
-
useMedium: function(data) {
|
|
3945
|
-
var item = middleware(data, assigned);
|
|
3946
|
-
buffer.push(item);
|
|
3947
|
-
return function() {
|
|
3948
|
-
buffer = buffer.filter(function(x) {
|
|
3949
|
-
return x !== item;
|
|
3950
|
-
});
|
|
3951
|
-
};
|
|
3952
|
-
},
|
|
3953
|
-
assignSyncMedium: function(cb) {
|
|
3954
|
-
assigned = true;
|
|
3955
|
-
while (buffer.length) {
|
|
3956
|
-
var cbs = buffer;
|
|
3957
|
-
buffer = [];
|
|
3958
|
-
cbs.forEach(cb);
|
|
3959
|
-
}
|
|
3960
|
-
buffer = {
|
|
3961
|
-
push: function(x) {
|
|
3962
|
-
return cb(x);
|
|
3963
|
-
},
|
|
3964
|
-
filter: function() {
|
|
3965
|
-
return buffer;
|
|
3966
|
-
}
|
|
3967
|
-
};
|
|
3968
|
-
},
|
|
3969
|
-
assignMedium: function(cb) {
|
|
3970
|
-
assigned = true;
|
|
3971
|
-
var pendingQueue = [];
|
|
3972
|
-
if (buffer.length) {
|
|
3973
|
-
var cbs = buffer;
|
|
3974
|
-
buffer = [];
|
|
3975
|
-
cbs.forEach(cb);
|
|
3976
|
-
pendingQueue = buffer;
|
|
3977
|
-
}
|
|
3978
|
-
var executeQueue = function() {
|
|
3979
|
-
var cbs2 = pendingQueue;
|
|
3980
|
-
pendingQueue = [];
|
|
3981
|
-
cbs2.forEach(cb);
|
|
3982
|
-
};
|
|
3983
|
-
var cycle = function() {
|
|
3984
|
-
return Promise.resolve().then(executeQueue);
|
|
3985
|
-
};
|
|
3986
|
-
cycle();
|
|
3987
|
-
buffer = {
|
|
3988
|
-
push: function(x) {
|
|
3989
|
-
pendingQueue.push(x);
|
|
3990
|
-
cycle();
|
|
3991
|
-
},
|
|
3992
|
-
filter: function(filter) {
|
|
3993
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
3994
|
-
return buffer;
|
|
3995
|
-
}
|
|
3996
|
-
};
|
|
3997
|
-
}
|
|
3998
|
-
};
|
|
3999
|
-
return medium;
|
|
4000
|
-
}
|
|
4001
|
-
function createSidecarMedium(options) {
|
|
4002
|
-
if (options === void 0) {
|
|
4003
|
-
options = {};
|
|
4004
|
-
}
|
|
4005
|
-
var medium = innerCreateMedium(null);
|
|
4006
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
4007
|
-
return medium;
|
|
4008
|
-
}
|
|
4009
|
-
var SideCar$1 = function(_a) {
|
|
4010
|
-
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
4011
|
-
if (!sideCar) {
|
|
4012
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
4013
|
-
}
|
|
4014
|
-
var Target = sideCar.read();
|
|
4015
|
-
if (!Target) {
|
|
4016
|
-
throw new Error("Sidecar medium not found");
|
|
4017
|
-
}
|
|
4018
|
-
return React__namespace.createElement(Target, __assign({}, rest));
|
|
4019
|
-
};
|
|
4020
|
-
SideCar$1.isSideCarExport = true;
|
|
4021
|
-
function exportSidecar(medium, exported) {
|
|
4022
|
-
medium.useMedium(exported);
|
|
4023
|
-
return SideCar$1;
|
|
4024
|
-
}
|
|
4025
|
-
var effectCar = createSidecarMedium();
|
|
4026
|
-
var nothing = function() {
|
|
4027
|
-
return;
|
|
4028
|
-
};
|
|
4029
|
-
var RemoveScroll = React__namespace.forwardRef(function(props, parentRef) {
|
|
4030
|
-
var ref = React__namespace.useRef(null);
|
|
4031
|
-
var _a = React__namespace.useState({
|
|
4032
|
-
onScrollCapture: nothing,
|
|
4033
|
-
onWheelCapture: nothing,
|
|
4034
|
-
onTouchMoveCapture: nothing
|
|
4035
|
-
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
4036
|
-
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"]);
|
|
4037
|
-
var SideCar2 = sideCar;
|
|
4038
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
4039
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
4040
|
-
return React__namespace.createElement(
|
|
4041
|
-
React__namespace.Fragment,
|
|
4042
|
-
null,
|
|
4043
|
-
enabled && React__namespace.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
4044
|
-
forwardProps ? React__namespace.cloneElement(React__namespace.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React__namespace.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
4045
|
-
);
|
|
4046
|
-
});
|
|
4047
|
-
RemoveScroll.defaultProps = {
|
|
4048
|
-
enabled: true,
|
|
4049
|
-
removeScrollBar: true,
|
|
4050
|
-
inert: false
|
|
4051
|
-
};
|
|
4052
|
-
RemoveScroll.classNames = {
|
|
4053
|
-
fullWidth: fullWidthClassName,
|
|
4054
|
-
zeroRight: zeroRightClassName
|
|
4055
|
-
};
|
|
4056
|
-
var getNonce = function() {
|
|
4057
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
4058
|
-
return __webpack_nonce__;
|
|
4059
|
-
}
|
|
4060
|
-
return void 0;
|
|
4061
|
-
};
|
|
4062
|
-
function makeStyleTag() {
|
|
4063
|
-
if (!document)
|
|
4064
|
-
return null;
|
|
4065
|
-
var tag = document.createElement("style");
|
|
4066
|
-
tag.type = "text/css";
|
|
4067
|
-
var nonce = getNonce();
|
|
4068
|
-
if (nonce) {
|
|
4069
|
-
tag.setAttribute("nonce", nonce);
|
|
4070
|
-
}
|
|
4071
|
-
return tag;
|
|
4072
|
-
}
|
|
4073
|
-
function injectStyles(tag, css) {
|
|
4074
|
-
if (tag.styleSheet) {
|
|
4075
|
-
tag.styleSheet.cssText = css;
|
|
4076
|
-
} else {
|
|
4077
|
-
tag.appendChild(document.createTextNode(css));
|
|
4078
|
-
}
|
|
4079
|
-
}
|
|
4080
|
-
function insertStyleTag(tag) {
|
|
4081
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
4082
|
-
head.appendChild(tag);
|
|
4083
|
-
}
|
|
4084
|
-
var stylesheetSingleton = function() {
|
|
4085
|
-
var counter = 0;
|
|
4086
|
-
var stylesheet = null;
|
|
4087
|
-
return {
|
|
4088
|
-
add: function(style) {
|
|
4089
|
-
if (counter == 0) {
|
|
4090
|
-
if (stylesheet = makeStyleTag()) {
|
|
4091
|
-
injectStyles(stylesheet, style);
|
|
4092
|
-
insertStyleTag(stylesheet);
|
|
4093
|
-
}
|
|
4094
|
-
}
|
|
4095
|
-
counter++;
|
|
4096
|
-
},
|
|
4097
|
-
remove: function() {
|
|
4098
|
-
counter--;
|
|
4099
|
-
if (!counter && stylesheet) {
|
|
4100
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
4101
|
-
stylesheet = null;
|
|
4102
|
-
}
|
|
4103
|
-
}
|
|
4104
|
-
};
|
|
4105
|
-
};
|
|
4106
|
-
var styleHookSingleton = function() {
|
|
4107
|
-
var sheet = stylesheetSingleton();
|
|
4108
|
-
return function(styles, isDynamic) {
|
|
4109
|
-
React__namespace.useEffect(function() {
|
|
4110
|
-
sheet.add(styles);
|
|
4111
|
-
return function() {
|
|
4112
|
-
sheet.remove();
|
|
4113
|
-
};
|
|
4114
|
-
}, [styles && isDynamic]);
|
|
4115
|
-
};
|
|
4116
|
-
};
|
|
4117
|
-
var styleSingleton = function() {
|
|
4118
|
-
var useStyle = styleHookSingleton();
|
|
4119
|
-
var Sheet = function(_a) {
|
|
4120
|
-
var styles = _a.styles, dynamic = _a.dynamic;
|
|
4121
|
-
useStyle(styles, dynamic);
|
|
4122
|
-
return null;
|
|
4123
|
-
};
|
|
4124
|
-
return Sheet;
|
|
4125
|
-
};
|
|
4126
|
-
var zeroGap = {
|
|
4127
|
-
left: 0,
|
|
4128
|
-
top: 0,
|
|
4129
|
-
right: 0,
|
|
4130
|
-
gap: 0
|
|
4131
|
-
};
|
|
4132
|
-
var parse = function(x) {
|
|
4133
|
-
return parseInt(x || "", 10) || 0;
|
|
4134
|
-
};
|
|
4135
|
-
var getOffset = function(gapMode) {
|
|
4136
|
-
var cs = window.getComputedStyle(document.body);
|
|
4137
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
4138
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
4139
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
4140
|
-
return [parse(left), parse(top), parse(right)];
|
|
4141
|
-
};
|
|
4142
|
-
var getGapWidth = function(gapMode) {
|
|
4143
|
-
if (gapMode === void 0) {
|
|
4144
|
-
gapMode = "margin";
|
|
4145
|
-
}
|
|
4146
|
-
if (typeof window === "undefined") {
|
|
4147
|
-
return zeroGap;
|
|
4148
|
-
}
|
|
4149
|
-
var offsets = getOffset(gapMode);
|
|
4150
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
4151
|
-
var windowWidth = window.innerWidth;
|
|
4152
|
-
return {
|
|
4153
|
-
left: offsets[0],
|
|
4154
|
-
top: offsets[1],
|
|
4155
|
-
right: offsets[2],
|
|
4156
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
4157
|
-
};
|
|
4158
|
-
};
|
|
4159
|
-
var Style = styleSingleton();
|
|
4160
|
-
var lockAttribute = "data-scroll-locked";
|
|
4161
|
-
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
4162
|
-
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
4163
|
-
if (gapMode === void 0) {
|
|
4164
|
-
gapMode = "margin";
|
|
4165
|
-
}
|
|
4166
|
-
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([
|
|
4167
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
4168
|
-
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 "),
|
|
4169
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
4170
|
-
].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");
|
|
4171
|
-
};
|
|
4172
|
-
var getCurrentUseCounter = function() {
|
|
4173
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
4174
|
-
return isFinite(counter) ? counter : 0;
|
|
4175
|
-
};
|
|
4176
|
-
var useLockAttribute = function() {
|
|
4177
|
-
React__namespace.useEffect(function() {
|
|
4178
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
4179
|
-
return function() {
|
|
4180
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
4181
|
-
if (newCounter <= 0) {
|
|
4182
|
-
document.body.removeAttribute(lockAttribute);
|
|
4183
|
-
} else {
|
|
4184
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
4185
|
-
}
|
|
4186
|
-
};
|
|
4187
|
-
}, []);
|
|
4188
|
-
};
|
|
4189
|
-
var RemoveScrollBar = function(_a) {
|
|
4190
|
-
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
4191
|
-
useLockAttribute();
|
|
4192
|
-
var gap = React__namespace.useMemo(function() {
|
|
4193
|
-
return getGapWidth(gapMode);
|
|
4194
|
-
}, [gapMode]);
|
|
4195
|
-
return React__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
4196
|
-
};
|
|
4197
|
-
var passiveSupported = false;
|
|
4198
|
-
if (typeof window !== "undefined") {
|
|
4199
|
-
try {
|
|
4200
|
-
var options = Object.defineProperty({}, "passive", {
|
|
4201
|
-
get: function() {
|
|
4202
|
-
passiveSupported = true;
|
|
4203
|
-
return true;
|
|
4204
|
-
}
|
|
4205
|
-
});
|
|
4206
|
-
window.addEventListener("test", options, options);
|
|
4207
|
-
window.removeEventListener("test", options, options);
|
|
4208
|
-
} catch (err) {
|
|
4209
|
-
passiveSupported = false;
|
|
4210
|
-
}
|
|
4211
|
-
}
|
|
4212
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
4213
|
-
var alwaysContainsScroll = function(node) {
|
|
4214
|
-
return node.tagName === "TEXTAREA";
|
|
4215
|
-
};
|
|
4216
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
4217
|
-
if (!(node instanceof Element)) {
|
|
4218
|
-
return false;
|
|
4219
|
-
}
|
|
4220
|
-
var styles = window.getComputedStyle(node);
|
|
4221
|
-
return (
|
|
4222
|
-
// not-not-scrollable
|
|
4223
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
4224
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
4225
|
-
);
|
|
4226
|
-
};
|
|
4227
|
-
var elementCouldBeVScrolled = function(node) {
|
|
4228
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
4229
|
-
};
|
|
4230
|
-
var elementCouldBeHScrolled = function(node) {
|
|
4231
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
4232
|
-
};
|
|
4233
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
4234
|
-
var ownerDocument = node.ownerDocument;
|
|
4235
|
-
var current = node;
|
|
4236
|
-
do {
|
|
4237
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
4238
|
-
current = current.host;
|
|
4239
|
-
}
|
|
4240
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
4241
|
-
if (isScrollable) {
|
|
4242
|
-
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
4243
|
-
if (scrollHeight > clientHeight) {
|
|
4244
|
-
return true;
|
|
4245
|
-
}
|
|
4246
|
-
}
|
|
4247
|
-
current = current.parentNode;
|
|
4248
|
-
} while (current && current !== ownerDocument.body);
|
|
4249
|
-
return false;
|
|
4250
|
-
};
|
|
4251
|
-
var getVScrollVariables = function(_a) {
|
|
4252
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
4253
|
-
return [
|
|
4254
|
-
scrollTop,
|
|
4255
|
-
scrollHeight,
|
|
4256
|
-
clientHeight
|
|
4257
|
-
];
|
|
4258
|
-
};
|
|
4259
|
-
var getHScrollVariables = function(_a) {
|
|
4260
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
4261
|
-
return [
|
|
4262
|
-
scrollLeft,
|
|
4263
|
-
scrollWidth,
|
|
4264
|
-
clientWidth
|
|
4265
|
-
];
|
|
4266
|
-
};
|
|
4267
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
4268
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
4269
|
-
};
|
|
4270
|
-
var getScrollVariables = function(axis, node) {
|
|
4271
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
4272
|
-
};
|
|
4273
|
-
var getDirectionFactor = function(axis, direction) {
|
|
4274
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
4275
|
-
};
|
|
4276
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
4277
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
4278
|
-
var delta = directionFactor * sourceDelta;
|
|
4279
|
-
var target = event.target;
|
|
4280
|
-
var targetInLock = endTarget.contains(target);
|
|
4281
|
-
var shouldCancelScroll = false;
|
|
4282
|
-
var isDeltaPositive = delta > 0;
|
|
4283
|
-
var availableScroll = 0;
|
|
4284
|
-
var availableScrollTop = 0;
|
|
4285
|
-
do {
|
|
4286
|
-
if (!target) {
|
|
4287
|
-
break;
|
|
4288
|
-
}
|
|
4289
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
4290
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
4291
|
-
if (position || elementScroll) {
|
|
4292
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
4293
|
-
availableScroll += elementScroll;
|
|
4294
|
-
availableScrollTop += position;
|
|
4295
|
-
}
|
|
4296
|
-
}
|
|
4297
|
-
var parent_1 = target.parentNode;
|
|
4298
|
-
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
4299
|
-
} while (
|
|
4300
|
-
// portaled content
|
|
4301
|
-
!targetInLock && target !== document.body || // self content
|
|
4302
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
4303
|
-
);
|
|
4304
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
4305
|
-
shouldCancelScroll = true;
|
|
4306
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
4307
|
-
shouldCancelScroll = true;
|
|
4308
|
-
}
|
|
4309
|
-
return shouldCancelScroll;
|
|
4310
|
-
};
|
|
4311
|
-
var getTouchXY = function(event) {
|
|
4312
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
4313
|
-
};
|
|
4314
|
-
var getDeltaXY = function(event) {
|
|
4315
|
-
return [event.deltaX, event.deltaY];
|
|
4316
|
-
};
|
|
4317
|
-
var extractRef = function(ref) {
|
|
4318
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
4319
|
-
};
|
|
4320
|
-
var deltaCompare = function(x, y) {
|
|
4321
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
4322
|
-
};
|
|
4323
|
-
var generateStyle = function(id) {
|
|
4324
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
4325
|
-
};
|
|
4326
|
-
var idCounter = 0;
|
|
4327
|
-
var lockStack = [];
|
|
4328
|
-
function RemoveScrollSideCar(props) {
|
|
4329
|
-
var shouldPreventQueue = React__namespace.useRef([]);
|
|
4330
|
-
var touchStartRef = React__namespace.useRef([0, 0]);
|
|
4331
|
-
var activeAxis = React__namespace.useRef();
|
|
4332
|
-
var id = React__namespace.useState(idCounter++)[0];
|
|
4333
|
-
var Style2 = React__namespace.useState(styleSingleton)[0];
|
|
4334
|
-
var lastProps = React__namespace.useRef(props);
|
|
4335
|
-
React__namespace.useEffect(function() {
|
|
4336
|
-
lastProps.current = props;
|
|
4337
|
-
}, [props]);
|
|
4338
|
-
React__namespace.useEffect(function() {
|
|
4339
|
-
if (props.inert) {
|
|
4340
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
4341
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
4342
|
-
allow_1.forEach(function(el) {
|
|
4343
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
4344
|
-
});
|
|
4345
|
-
return function() {
|
|
4346
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
4347
|
-
allow_1.forEach(function(el) {
|
|
4348
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
4349
|
-
});
|
|
4350
|
-
};
|
|
4351
|
-
}
|
|
4352
|
-
return;
|
|
4353
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
4354
|
-
var shouldCancelEvent = React__namespace.useCallback(function(event, parent) {
|
|
4355
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
4356
|
-
return !lastProps.current.allowPinchZoom;
|
|
4357
|
-
}
|
|
4358
|
-
var touch = getTouchXY(event);
|
|
4359
|
-
var touchStart = touchStartRef.current;
|
|
4360
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
4361
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
4362
|
-
var currentAxis;
|
|
4363
|
-
var target = event.target;
|
|
4364
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
4365
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
4366
|
-
return false;
|
|
4367
|
-
}
|
|
4368
|
-
var selection = window.getSelection();
|
|
4369
|
-
var anchorNode = selection && selection.anchorNode;
|
|
4370
|
-
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
4371
|
-
if (isTouchingSelection) {
|
|
4372
|
-
return false;
|
|
4373
|
-
}
|
|
4374
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
4375
|
-
if (!canBeScrolledInMainDirection) {
|
|
4376
|
-
return true;
|
|
4377
|
-
}
|
|
4378
|
-
if (canBeScrolledInMainDirection) {
|
|
4379
|
-
currentAxis = moveDirection;
|
|
4380
|
-
} else {
|
|
4381
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
4382
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
4383
|
-
}
|
|
4384
|
-
if (!canBeScrolledInMainDirection) {
|
|
4385
|
-
return false;
|
|
4386
|
-
}
|
|
4387
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
4388
|
-
activeAxis.current = currentAxis;
|
|
4389
|
-
}
|
|
4390
|
-
if (!currentAxis) {
|
|
4391
|
-
return true;
|
|
4392
|
-
}
|
|
4393
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
4394
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
4395
|
-
}, []);
|
|
4396
|
-
var shouldPrevent = React__namespace.useCallback(function(_event) {
|
|
4397
|
-
var event = _event;
|
|
4398
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
4399
|
-
return;
|
|
4400
|
-
}
|
|
4401
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
4402
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
4403
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
4404
|
-
})[0];
|
|
4405
|
-
if (sourceEvent && sourceEvent.should) {
|
|
4406
|
-
if (event.cancelable) {
|
|
4407
|
-
event.preventDefault();
|
|
4408
|
-
}
|
|
4409
|
-
return;
|
|
4410
|
-
}
|
|
4411
|
-
if (!sourceEvent) {
|
|
4412
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
4413
|
-
return node.contains(event.target);
|
|
4414
|
-
});
|
|
4415
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
4416
|
-
if (shouldStop) {
|
|
4417
|
-
if (event.cancelable) {
|
|
4418
|
-
event.preventDefault();
|
|
4419
|
-
}
|
|
4420
|
-
}
|
|
4421
|
-
}
|
|
4422
|
-
}, []);
|
|
4423
|
-
var shouldCancel = React__namespace.useCallback(function(name, delta, target, should) {
|
|
4424
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
4425
|
-
shouldPreventQueue.current.push(event);
|
|
4426
|
-
setTimeout(function() {
|
|
4427
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
4428
|
-
return e !== event;
|
|
4429
|
-
});
|
|
4430
|
-
}, 1);
|
|
4431
|
-
}, []);
|
|
4432
|
-
var scrollTouchStart = React__namespace.useCallback(function(event) {
|
|
4433
|
-
touchStartRef.current = getTouchXY(event);
|
|
4434
|
-
activeAxis.current = void 0;
|
|
4435
|
-
}, []);
|
|
4436
|
-
var scrollWheel = React__namespace.useCallback(function(event) {
|
|
4437
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
4438
|
-
}, []);
|
|
4439
|
-
var scrollTouchMove = React__namespace.useCallback(function(event) {
|
|
4440
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
4441
|
-
}, []);
|
|
4442
|
-
React__namespace.useEffect(function() {
|
|
4443
|
-
lockStack.push(Style2);
|
|
4444
|
-
props.setCallbacks({
|
|
4445
|
-
onScrollCapture: scrollWheel,
|
|
4446
|
-
onWheelCapture: scrollWheel,
|
|
4447
|
-
onTouchMoveCapture: scrollTouchMove
|
|
4448
|
-
});
|
|
4449
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
4450
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
4451
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
4452
|
-
return function() {
|
|
4453
|
-
lockStack = lockStack.filter(function(inst) {
|
|
4454
|
-
return inst !== Style2;
|
|
4455
|
-
});
|
|
4456
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
4457
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
4458
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
4459
|
-
};
|
|
4460
|
-
}, []);
|
|
4461
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
4462
|
-
return React__namespace.createElement(
|
|
4463
|
-
React__namespace.Fragment,
|
|
4464
|
-
null,
|
|
4465
|
-
inert ? React__namespace.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
4466
|
-
removeScrollBar ? React__namespace.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
4467
|
-
);
|
|
4468
|
-
}
|
|
4469
|
-
function getOutermostShadowParent(node) {
|
|
4470
|
-
var shadowParent = null;
|
|
4471
|
-
while (node !== null) {
|
|
4472
|
-
if (node instanceof ShadowRoot) {
|
|
4473
|
-
shadowParent = node.host;
|
|
4474
|
-
node = node.host;
|
|
4475
|
-
}
|
|
4476
|
-
node = node.parentNode;
|
|
4477
|
-
}
|
|
4478
|
-
return shadowParent;
|
|
4479
|
-
}
|
|
4480
|
-
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
4481
|
-
var ReactRemoveScroll = React__namespace.forwardRef(function(props, ref) {
|
|
4482
|
-
return React__namespace.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
|
|
4483
|
-
});
|
|
4484
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
4485
|
-
var getDefaultParent = function(originalTarget) {
|
|
4486
|
-
if (typeof document === "undefined") {
|
|
4487
|
-
return null;
|
|
4488
|
-
}
|
|
4489
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
4490
|
-
return sampleTarget.ownerDocument.body;
|
|
4491
|
-
};
|
|
4492
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
4493
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
4494
|
-
var markerMap = {};
|
|
4495
|
-
var lockCount = 0;
|
|
4496
|
-
var unwrapHost = function(node) {
|
|
4497
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
4498
|
-
};
|
|
4499
|
-
var correctTargets = function(parent, targets) {
|
|
4500
|
-
return targets.map(function(target) {
|
|
4501
|
-
if (parent.contains(target)) {
|
|
4502
|
-
return target;
|
|
4503
|
-
}
|
|
4504
|
-
var correctedTarget = unwrapHost(target);
|
|
4505
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
4506
|
-
return correctedTarget;
|
|
4507
|
-
}
|
|
4508
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
4509
|
-
return null;
|
|
4510
|
-
}).filter(function(x) {
|
|
4511
|
-
return Boolean(x);
|
|
4512
|
-
});
|
|
4513
|
-
};
|
|
4514
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
4515
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
4516
|
-
if (!markerMap[markerName]) {
|
|
4517
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
4518
|
-
}
|
|
4519
|
-
var markerCounter = markerMap[markerName];
|
|
4520
|
-
var hiddenNodes = [];
|
|
4521
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
4522
|
-
var elementsToStop = new Set(targets);
|
|
4523
|
-
var keep = function(el) {
|
|
4524
|
-
if (!el || elementsToKeep.has(el)) {
|
|
4525
|
-
return;
|
|
4526
|
-
}
|
|
4527
|
-
elementsToKeep.add(el);
|
|
4528
|
-
keep(el.parentNode);
|
|
4529
|
-
};
|
|
4530
|
-
targets.forEach(keep);
|
|
4531
|
-
var deep = function(parent) {
|
|
4532
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
4533
|
-
return;
|
|
4534
|
-
}
|
|
4535
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
4536
|
-
if (elementsToKeep.has(node)) {
|
|
4537
|
-
deep(node);
|
|
4538
|
-
} else {
|
|
4539
|
-
try {
|
|
4540
|
-
var attr = node.getAttribute(controlAttribute);
|
|
4541
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
4542
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
4543
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
4544
|
-
counterMap.set(node, counterValue);
|
|
4545
|
-
markerCounter.set(node, markerValue);
|
|
4546
|
-
hiddenNodes.push(node);
|
|
4547
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
4548
|
-
uncontrolledNodes.set(node, true);
|
|
4549
|
-
}
|
|
4550
|
-
if (markerValue === 1) {
|
|
4551
|
-
node.setAttribute(markerName, "true");
|
|
4552
|
-
}
|
|
4553
|
-
if (!alreadyHidden) {
|
|
4554
|
-
node.setAttribute(controlAttribute, "true");
|
|
4555
|
-
}
|
|
4556
|
-
} catch (e) {
|
|
4557
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
4558
|
-
}
|
|
4559
|
-
}
|
|
4560
|
-
});
|
|
4561
|
-
};
|
|
4562
|
-
deep(parentNode);
|
|
4563
|
-
elementsToKeep.clear();
|
|
4564
|
-
lockCount++;
|
|
4565
|
-
return function() {
|
|
4566
|
-
hiddenNodes.forEach(function(node) {
|
|
4567
|
-
var counterValue = counterMap.get(node) - 1;
|
|
4568
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
4569
|
-
counterMap.set(node, counterValue);
|
|
4570
|
-
markerCounter.set(node, markerValue);
|
|
4571
|
-
if (!counterValue) {
|
|
4572
|
-
if (!uncontrolledNodes.has(node)) {
|
|
4573
|
-
node.removeAttribute(controlAttribute);
|
|
4574
|
-
}
|
|
4575
|
-
uncontrolledNodes.delete(node);
|
|
4576
|
-
}
|
|
4577
|
-
if (!markerValue) {
|
|
4578
|
-
node.removeAttribute(markerName);
|
|
4579
|
-
}
|
|
4580
|
-
});
|
|
4581
|
-
lockCount--;
|
|
4582
|
-
if (!lockCount) {
|
|
4583
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
4584
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
4585
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
4586
|
-
markerMap = {};
|
|
4587
|
-
}
|
|
4588
|
-
};
|
|
4589
|
-
};
|
|
4590
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
4591
|
-
if (markerName === void 0) {
|
|
4592
|
-
markerName = "data-aria-hidden";
|
|
4593
|
-
}
|
|
4594
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
4595
|
-
var activeParentNode = getDefaultParent(originalTarget);
|
|
4596
|
-
if (!activeParentNode) {
|
|
4597
|
-
return function() {
|
|
4598
|
-
return null;
|
|
4599
|
-
};
|
|
4600
|
-
}
|
|
4601
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
4602
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
4603
|
-
};
|
|
4604
|
-
var DIALOG_NAME = "Dialog";
|
|
4605
|
-
var [createDialogContext] = createContextScope(DIALOG_NAME);
|
|
4606
|
-
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
4607
|
-
var Dialog = (props) => {
|
|
4608
|
-
const {
|
|
4609
|
-
__scopeDialog,
|
|
4610
|
-
children,
|
|
4611
|
-
open: openProp,
|
|
4612
|
-
defaultOpen,
|
|
4613
|
-
onOpenChange,
|
|
4614
|
-
modal = true
|
|
4615
|
-
} = props;
|
|
4616
|
-
const triggerRef = React__namespace.useRef(null);
|
|
4617
|
-
const contentRef = React__namespace.useRef(null);
|
|
4618
|
-
const [open2, setOpen] = useControllableState({
|
|
4619
|
-
prop: openProp,
|
|
4620
|
-
defaultProp: defaultOpen ?? false,
|
|
4621
|
-
onChange: onOpenChange,
|
|
4622
|
-
caller: DIALOG_NAME
|
|
4623
|
-
});
|
|
4624
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4625
|
-
DialogProvider,
|
|
4626
|
-
{
|
|
4627
|
-
scope: __scopeDialog,
|
|
4628
|
-
triggerRef,
|
|
4629
|
-
contentRef,
|
|
4630
|
-
contentId: useId(),
|
|
4631
|
-
titleId: useId(),
|
|
4632
|
-
descriptionId: useId(),
|
|
4633
|
-
open: open2,
|
|
4634
|
-
onOpenChange: setOpen,
|
|
4635
|
-
onOpenToggle: React__namespace.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
4636
|
-
modal,
|
|
4637
|
-
children
|
|
4638
|
-
}
|
|
4639
|
-
);
|
|
4640
|
-
};
|
|
4641
|
-
Dialog.displayName = DIALOG_NAME;
|
|
4642
|
-
var TRIGGER_NAME = "DialogTrigger";
|
|
4643
|
-
var DialogTrigger = React__namespace.forwardRef(
|
|
4644
|
-
(props, forwardedRef) => {
|
|
4645
|
-
const { __scopeDialog, ...triggerProps } = props;
|
|
4646
|
-
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
4647
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
4648
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4649
|
-
Primitive.button,
|
|
4650
|
-
{
|
|
4651
|
-
type: "button",
|
|
4652
|
-
"aria-haspopup": "dialog",
|
|
4653
|
-
"aria-expanded": context.open,
|
|
4654
|
-
"aria-controls": context.contentId,
|
|
4655
|
-
"data-state": getState(context.open),
|
|
4656
|
-
...triggerProps,
|
|
4657
|
-
ref: composedTriggerRef,
|
|
4658
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
4659
|
-
}
|
|
4660
|
-
);
|
|
4661
|
-
}
|
|
4662
|
-
);
|
|
4663
|
-
DialogTrigger.displayName = TRIGGER_NAME;
|
|
4664
|
-
var PORTAL_NAME = "DialogPortal";
|
|
4665
|
-
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
4666
|
-
forceMount: void 0
|
|
4667
|
-
});
|
|
4668
|
-
var OVERLAY_NAME = "DialogOverlay";
|
|
4669
|
-
var DialogOverlay = React__namespace.forwardRef(
|
|
4670
|
-
(props, forwardedRef) => {
|
|
4671
|
-
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
4672
|
-
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
4673
|
-
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
4674
|
-
return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
4675
|
-
}
|
|
4676
|
-
);
|
|
4677
|
-
DialogOverlay.displayName = OVERLAY_NAME;
|
|
4678
|
-
var Slot = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
|
|
4679
|
-
var DialogOverlayImpl = React__namespace.forwardRef(
|
|
4680
|
-
(props, forwardedRef) => {
|
|
4681
|
-
const { __scopeDialog, ...overlayProps } = props;
|
|
4682
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
4683
|
-
return (
|
|
4684
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
4685
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
4686
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4687
|
-
Primitive.div,
|
|
4688
|
-
{
|
|
4689
|
-
"data-state": getState(context.open),
|
|
4690
|
-
...overlayProps,
|
|
4691
|
-
ref: forwardedRef,
|
|
4692
|
-
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
4693
|
-
}
|
|
4694
|
-
) })
|
|
4695
|
-
);
|
|
4696
|
-
}
|
|
4697
|
-
);
|
|
4698
|
-
var CONTENT_NAME = "DialogContent";
|
|
4699
|
-
var DialogContent = React__namespace.forwardRef(
|
|
4700
|
-
(props, forwardedRef) => {
|
|
4701
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
4702
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
4703
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
4704
|
-
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 }) });
|
|
4705
|
-
}
|
|
4706
|
-
);
|
|
4707
|
-
DialogContent.displayName = CONTENT_NAME;
|
|
4708
|
-
var DialogContentModal = React__namespace.forwardRef(
|
|
4709
|
-
(props, forwardedRef) => {
|
|
4710
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
4711
|
-
const contentRef = React__namespace.useRef(null);
|
|
4712
|
-
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
4713
|
-
React__namespace.useEffect(() => {
|
|
4714
|
-
const content = contentRef.current;
|
|
4715
|
-
if (content) return hideOthers(content);
|
|
4716
|
-
}, []);
|
|
4717
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4718
|
-
DialogContentImpl,
|
|
4719
|
-
{
|
|
4720
|
-
...props,
|
|
4721
|
-
ref: composedRefs,
|
|
4722
|
-
trapFocus: context.open,
|
|
4723
|
-
disableOutsidePointerEvents: true,
|
|
4724
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
4725
|
-
event.preventDefault();
|
|
4726
|
-
context.triggerRef.current?.focus();
|
|
4727
|
-
}),
|
|
4728
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
4729
|
-
const originalEvent = event.detail.originalEvent;
|
|
4730
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
4731
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
4732
|
-
if (isRightClick) event.preventDefault();
|
|
4733
|
-
}),
|
|
4734
|
-
onFocusOutside: composeEventHandlers(
|
|
4735
|
-
props.onFocusOutside,
|
|
4736
|
-
(event) => event.preventDefault()
|
|
4737
|
-
)
|
|
4738
|
-
}
|
|
4739
|
-
);
|
|
4740
|
-
}
|
|
4741
|
-
);
|
|
4742
|
-
var DialogContentNonModal = React__namespace.forwardRef(
|
|
4743
|
-
(props, forwardedRef) => {
|
|
4744
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
4745
|
-
const hasInteractedOutsideRef = React__namespace.useRef(false);
|
|
4746
|
-
const hasPointerDownOutsideRef = React__namespace.useRef(false);
|
|
4747
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4748
|
-
DialogContentImpl,
|
|
4749
|
-
{
|
|
4750
|
-
...props,
|
|
4751
|
-
ref: forwardedRef,
|
|
4752
|
-
trapFocus: false,
|
|
4753
|
-
disableOutsidePointerEvents: false,
|
|
4754
|
-
onCloseAutoFocus: (event) => {
|
|
4755
|
-
props.onCloseAutoFocus?.(event);
|
|
4756
|
-
if (!event.defaultPrevented) {
|
|
4757
|
-
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
4758
|
-
event.preventDefault();
|
|
4759
|
-
}
|
|
4760
|
-
hasInteractedOutsideRef.current = false;
|
|
4761
|
-
hasPointerDownOutsideRef.current = false;
|
|
4762
|
-
},
|
|
4763
|
-
onInteractOutside: (event) => {
|
|
4764
|
-
props.onInteractOutside?.(event);
|
|
4765
|
-
if (!event.defaultPrevented) {
|
|
4766
|
-
hasInteractedOutsideRef.current = true;
|
|
4767
|
-
if (event.detail.originalEvent.type === "pointerdown") {
|
|
4768
|
-
hasPointerDownOutsideRef.current = true;
|
|
4769
|
-
}
|
|
4770
|
-
}
|
|
4771
|
-
const target = event.target;
|
|
4772
|
-
const targetIsTrigger = context.triggerRef.current?.contains(target);
|
|
4773
|
-
if (targetIsTrigger) event.preventDefault();
|
|
4774
|
-
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
4775
|
-
event.preventDefault();
|
|
4776
|
-
}
|
|
4777
|
-
}
|
|
4778
|
-
}
|
|
4779
|
-
);
|
|
4780
|
-
}
|
|
4781
|
-
);
|
|
4782
|
-
var DialogContentImpl = React__namespace.forwardRef(
|
|
4783
|
-
(props, forwardedRef) => {
|
|
4784
|
-
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
4785
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
4786
|
-
const contentRef = React__namespace.useRef(null);
|
|
4787
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
4788
|
-
useFocusGuards();
|
|
4789
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4790
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4791
|
-
FocusScope,
|
|
4792
|
-
{
|
|
4793
|
-
asChild: true,
|
|
4794
|
-
loop: true,
|
|
4795
|
-
trapped: trapFocus,
|
|
4796
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
4797
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
4798
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4799
|
-
DismissableLayer,
|
|
4800
|
-
{
|
|
4801
|
-
role: "dialog",
|
|
4802
|
-
id: context.contentId,
|
|
4803
|
-
"aria-describedby": context.descriptionId,
|
|
4804
|
-
"aria-labelledby": context.titleId,
|
|
4805
|
-
"data-state": getState(context.open),
|
|
4806
|
-
...contentProps,
|
|
4807
|
-
ref: composedRefs,
|
|
4808
|
-
onDismiss: () => context.onOpenChange(false)
|
|
4809
|
-
}
|
|
4810
|
-
)
|
|
4811
|
-
}
|
|
4812
|
-
),
|
|
4813
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
4814
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
|
|
4815
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
4816
|
-
] })
|
|
4817
|
-
] });
|
|
4818
|
-
}
|
|
4819
|
-
);
|
|
4820
|
-
var TITLE_NAME = "DialogTitle";
|
|
4821
|
-
var DialogTitle = React__namespace.forwardRef(
|
|
4822
|
-
(props, forwardedRef) => {
|
|
4823
|
-
const { __scopeDialog, ...titleProps } = props;
|
|
4824
|
-
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
4825
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
4826
|
-
}
|
|
4827
|
-
);
|
|
4828
|
-
DialogTitle.displayName = TITLE_NAME;
|
|
4829
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
4830
|
-
var DialogDescription = React__namespace.forwardRef(
|
|
4831
|
-
(props, forwardedRef) => {
|
|
4832
|
-
const { __scopeDialog, ...descriptionProps } = props;
|
|
4833
|
-
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
4834
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
4835
|
-
}
|
|
4836
|
-
);
|
|
4837
|
-
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
4838
|
-
var CLOSE_NAME = "DialogClose";
|
|
4839
|
-
var DialogClose = React__namespace.forwardRef(
|
|
4840
|
-
(props, forwardedRef) => {
|
|
4841
|
-
const { __scopeDialog, ...closeProps } = props;
|
|
4842
|
-
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
4843
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
4844
|
-
Primitive.button,
|
|
4845
|
-
{
|
|
4846
|
-
type: "button",
|
|
4847
|
-
...closeProps,
|
|
4848
|
-
ref: forwardedRef,
|
|
4849
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
4850
|
-
}
|
|
4851
|
-
);
|
|
4852
|
-
}
|
|
4853
|
-
);
|
|
4854
|
-
DialogClose.displayName = CLOSE_NAME;
|
|
4855
|
-
function getState(open2) {
|
|
4856
|
-
return open2 ? "open" : "closed";
|
|
4857
|
-
}
|
|
4858
|
-
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
4859
|
-
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
4860
|
-
contentName: CONTENT_NAME,
|
|
4861
|
-
titleName: TITLE_NAME,
|
|
4862
|
-
docsSlug: "dialog"
|
|
4863
|
-
});
|
|
4864
|
-
var TitleWarning = ({ titleId }) => {
|
|
4865
|
-
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
4866
|
-
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
4867
|
-
|
|
4868
|
-
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4869
|
-
|
|
4870
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
4871
|
-
React__namespace.useEffect(() => {
|
|
4872
|
-
if (titleId) {
|
|
4873
|
-
const hasTitle = document.getElementById(titleId);
|
|
4874
|
-
if (!hasTitle) console.error(MESSAGE);
|
|
4875
|
-
}
|
|
4876
|
-
}, [MESSAGE, titleId]);
|
|
4877
|
-
return null;
|
|
4878
|
-
};
|
|
4879
|
-
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
4880
|
-
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
4881
|
-
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
4882
|
-
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
4883
|
-
React__namespace.useEffect(() => {
|
|
4884
|
-
const describedById = contentRef.current?.getAttribute("aria-describedby");
|
|
4885
|
-
if (descriptionId && describedById) {
|
|
4886
|
-
const hasDescription = document.getElementById(descriptionId);
|
|
4887
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
4888
|
-
}
|
|
4889
|
-
}, [MESSAGE, contentRef, descriptionId]);
|
|
4890
|
-
return null;
|
|
4891
|
-
};
|
|
4892
|
-
var Root = Dialog;
|
|
4893
|
-
var Content = DialogContent;
|
|
4894
|
-
var Title = DialogTitle;
|
|
4895
|
-
var Description = DialogDescription;
|
|
4896
|
-
var Close = DialogClose;
|
|
4897
3361
|
const BannerContent = ({
|
|
4898
3362
|
noTarget: noTarget2 = true,
|
|
4899
3363
|
heading: heading2 = "We use cookies.",
|
|
@@ -4909,12 +3373,16 @@ const BannerContent = ({
|
|
|
4909
3373
|
const { onSave, onDeclineAll, selectionTaken } = useSelection();
|
|
4910
3374
|
const [openItem, setOpenItem] = React.useState(void 0);
|
|
4911
3375
|
const [settingsOpen, setSettingsOpen] = React.useState(defaultSettingsOpen);
|
|
4912
|
-
return /* @__PURE__ */ u(
|
|
4913
|
-
|
|
3376
|
+
return /* @__PURE__ */ u(
|
|
3377
|
+
"div",
|
|
4914
3378
|
{
|
|
4915
|
-
className:
|
|
3379
|
+
className: clx({
|
|
3380
|
+
[classes$2.root]: true,
|
|
3381
|
+
[classes$2.noTarget]: noTarget2,
|
|
3382
|
+
[classes$2.open]: !selectionTaken
|
|
3383
|
+
}),
|
|
4916
3384
|
children: /* @__PURE__ */ u(
|
|
4917
|
-
Root$
|
|
3385
|
+
Root$1,
|
|
4918
3386
|
{
|
|
4919
3387
|
open: settingsOpen,
|
|
4920
3388
|
onOpenChange: setSettingsOpen,
|
|
@@ -4922,8 +3390,8 @@ const BannerContent = ({
|
|
|
4922
3390
|
children: [
|
|
4923
3391
|
/* @__PURE__ */ u("div", { className: classes$2.header, children: [
|
|
4924
3392
|
/* @__PURE__ */ u("div", { className: classes$2.heading, children: [
|
|
4925
|
-
/* @__PURE__ */ u(
|
|
4926
|
-
/* @__PURE__ */ u(
|
|
3393
|
+
/* @__PURE__ */ u(Text, { weight: "bold", children: heading2 }),
|
|
3394
|
+
/* @__PURE__ */ u(Text, { size: "caption", color: "muted", children: subheading })
|
|
4927
3395
|
] }),
|
|
4928
3396
|
/* @__PURE__ */ u(Trigger, { asChild: true, children: /* @__PURE__ */ u(Button, { variant: "ghost", children: [
|
|
4929
3397
|
settingsOpen ? hideLabel : selectLabel,
|
|
@@ -4941,7 +3409,7 @@ const BannerContent = ({
|
|
|
4941
3409
|
] }) })
|
|
4942
3410
|
] }),
|
|
4943
3411
|
/* @__PURE__ */ u(
|
|
4944
|
-
Content
|
|
3412
|
+
Content,
|
|
4945
3413
|
{
|
|
4946
3414
|
className: clx({
|
|
4947
3415
|
[classes$2.settings]: true
|
|
@@ -4953,7 +3421,7 @@ const BannerContent = ({
|
|
|
4953
3421
|
collapsible: true,
|
|
4954
3422
|
value: openItem,
|
|
4955
3423
|
onValueChange: setOpenItem,
|
|
4956
|
-
children:
|
|
3424
|
+
children: items.map((item) => /* @__PURE__ */ u(BannerItem, { ...item, openItem }, item.value))
|
|
4957
3425
|
}
|
|
4958
3426
|
)
|
|
4959
3427
|
}
|
|
@@ -4961,15 +3429,15 @@ const BannerContent = ({
|
|
|
4961
3429
|
/* @__PURE__ */ u("div", { className: classes$2.footer, children: [
|
|
4962
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 }) }) }),
|
|
4963
3431
|
/* @__PURE__ */ u("div", { className: classes$2.actions, children: [
|
|
4964
|
-
/* @__PURE__ */ u(
|
|
4965
|
-
/* @__PURE__ */ u(
|
|
3432
|
+
/* @__PURE__ */ u(Button, { variant: "neutral", onClick: () => onDeclineAll(), children: declineLabel }),
|
|
3433
|
+
/* @__PURE__ */ u(Button, { variant: "brand", onClick: () => onSave(), children: saveLabel })
|
|
4966
3434
|
] })
|
|
4967
3435
|
] })
|
|
4968
3436
|
]
|
|
4969
3437
|
}
|
|
4970
3438
|
)
|
|
4971
3439
|
}
|
|
4972
|
-
)
|
|
3440
|
+
);
|
|
4973
3441
|
};
|
|
4974
3442
|
const Banner = ({
|
|
4975
3443
|
localStorageKey = "cb-selection",
|