@szum-tech/design-system 3.7.1 → 3.8.1
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/chunk-2Q2BIWBE.js +46 -0
- package/dist/{chunk-AEMI4LPB.cjs → chunk-3Z3GVXXN.cjs} +83 -50
- package/dist/chunk-CXHDWIGF.cjs +89 -0
- package/dist/chunk-E5TYGWGE.js +176 -0
- package/dist/chunk-HNRVLRMN.js +82 -0
- package/dist/chunk-O3DHBQA5.cjs +50 -0
- package/dist/{chunk-6SNQ2B5C.js → chunk-SZ3LC2VO.js} +80 -47
- package/dist/chunk-XJZOANXX.cjs +183 -0
- package/dist/components/alert/index.cjs +19 -0
- package/dist/components/alert/index.d.cts +24 -0
- package/dist/components/alert/index.d.ts +24 -0
- package/dist/components/alert/index.js +2 -0
- package/dist/components/alert-dialog/index.cjs +0 -1
- package/dist/components/alert-dialog/index.js +0 -1
- package/dist/components/avatar/index.cjs +0 -1
- package/dist/components/avatar/index.js +0 -1
- package/dist/components/badge/index.cjs +0 -1
- package/dist/components/badge/index.js +0 -1
- package/dist/components/button/index.cjs +12 -11
- package/dist/components/button/index.js +11 -10
- package/dist/components/card/index.cjs +0 -1
- package/dist/components/card/index.js +0 -1
- package/dist/components/checkbox/index.cjs +0 -1
- package/dist/components/checkbox/index.js +0 -1
- package/dist/components/color-swatch/index.cjs +0 -1
- package/dist/components/color-swatch/index.js +0 -1
- package/dist/components/dialog/index.cjs +0 -1
- package/dist/components/dialog/index.js +0 -1
- package/dist/components/empty/index.cjs +31 -0
- package/dist/components/empty/index.d.cts +29 -0
- package/dist/components/empty/index.d.ts +29 -0
- package/dist/components/empty/index.js +2 -0
- package/dist/components/field/index.cjs +12 -13
- package/dist/components/field/index.js +2 -3
- package/dist/components/header/index.cjs +0 -1
- package/dist/components/header/index.js +0 -1
- package/dist/components/index.cjs +133 -96
- package/dist/components/index.d.cts +2 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +11 -10
- package/dist/components/input/index.cjs +0 -1
- package/dist/components/input/index.js +0 -1
- package/dist/components/item/index.cjs +0 -1
- package/dist/components/item/index.js +0 -1
- package/dist/components/label/index.cjs +0 -1
- package/dist/components/label/index.js +0 -1
- package/dist/components/progress/index.cjs +0 -1
- package/dist/components/progress/index.js +0 -1
- package/dist/components/radio-group/index.cjs +0 -1
- package/dist/components/radio-group/index.js +0 -1
- package/dist/components/scroll-area/index.cjs +0 -1
- package/dist/components/scroll-area/index.js +0 -1
- package/dist/components/select/index.cjs +7 -8
- package/dist/components/select/index.d.cts +1 -2
- package/dist/components/select/index.d.ts +1 -2
- package/dist/components/select/index.js +1 -2
- package/dist/components/separator/index.cjs +0 -1
- package/dist/components/separator/index.js +0 -1
- package/dist/components/sheet/index.cjs +0 -1
- package/dist/components/sheet/index.js +0 -1
- package/dist/components/spinner/index.cjs +0 -1
- package/dist/components/spinner/index.js +0 -1
- package/dist/components/stepper/index.cjs +30 -29
- package/dist/components/stepper/index.js +11 -10
- package/dist/components/textarea/index.cjs +0 -1
- package/dist/components/textarea/index.js +0 -1
- package/dist/components/toaster/index.cjs +13 -12
- package/dist/components/toaster/index.js +11 -10
- package/dist/components/tooltip/index.cjs +0 -1
- package/dist/components/tooltip/index.js +0 -1
- package/dist/contexts/index.cjs +0 -1
- package/dist/contexts/index.js +0 -1
- package/dist/hooks/index.cjs +0 -1
- package/dist/hooks/index.js +0 -1
- package/dist/icons/index.cjs +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/index.js +0 -1
- package/package.json +1 -1
- package/dist/chunk-3376ZTRC.cjs +0 -2
- package/dist/chunk-3ZRMIVJM.cjs +0 -4934
- package/dist/chunk-BYXBJQAS.js +0 -1
- package/dist/chunk-O7QFYWMK.js +0 -4907
- package/dist/{chunk-YTVV2IUF.cjs → chunk-Q5ONG5HB.cjs} +1 -1
- package/dist/{chunk-KYFNEU4K.js → chunk-SYKUS2RV.js} +1 -1
package/dist/chunk-3ZRMIVJM.cjs
DELETED
|
@@ -1,4934 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
4
|
-
var lucideReact = require('lucide-react');
|
|
5
|
-
var radixUi = require('radix-ui');
|
|
6
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var React30 = require('react');
|
|
8
|
-
var ReactDOM4 = require('react-dom');
|
|
9
|
-
var reactSlot = require('@radix-ui/react-slot');
|
|
10
|
-
|
|
11
|
-
function _interopNamespace(e) {
|
|
12
|
-
if (e && e.__esModule) return e;
|
|
13
|
-
var n = Object.create(null);
|
|
14
|
-
if (e) {
|
|
15
|
-
Object.keys(e).forEach(function (k) {
|
|
16
|
-
if (k !== 'default') {
|
|
17
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () { return e[k]; }
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
n.default = e;
|
|
26
|
-
return Object.freeze(n);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var React30__namespace = /*#__PURE__*/_interopNamespace(React30);
|
|
30
|
-
var ReactDOM4__namespace = /*#__PURE__*/_interopNamespace(ReactDOM4);
|
|
31
|
-
|
|
32
|
-
function Select({
|
|
33
|
-
children,
|
|
34
|
-
disabled,
|
|
35
|
-
defaultOpen,
|
|
36
|
-
defaultValue,
|
|
37
|
-
value,
|
|
38
|
-
dir,
|
|
39
|
-
open,
|
|
40
|
-
form,
|
|
41
|
-
name,
|
|
42
|
-
onOpenChange,
|
|
43
|
-
onValueChange,
|
|
44
|
-
required,
|
|
45
|
-
autoComplete,
|
|
46
|
-
// value props
|
|
47
|
-
placeholder,
|
|
48
|
-
// trigger props
|
|
49
|
-
className,
|
|
50
|
-
size: size4 = "default",
|
|
51
|
-
invalid = false,
|
|
52
|
-
...triggerProps
|
|
53
|
-
}) {
|
|
54
|
-
const rootProps = {
|
|
55
|
-
children,
|
|
56
|
-
disabled,
|
|
57
|
-
defaultOpen,
|
|
58
|
-
defaultValue,
|
|
59
|
-
value,
|
|
60
|
-
dir,
|
|
61
|
-
open,
|
|
62
|
-
form,
|
|
63
|
-
name,
|
|
64
|
-
onOpenChange,
|
|
65
|
-
onValueChange,
|
|
66
|
-
required,
|
|
67
|
-
autoComplete
|
|
68
|
-
};
|
|
69
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(radixUi.Select.Root, { "data-slot": "select", ...rootProps, children: [
|
|
70
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
71
|
-
radixUi.Select.Trigger,
|
|
72
|
-
{
|
|
73
|
-
"data-slot": "select-trigger",
|
|
74
|
-
"aria-invalid": triggerProps["aria-invalid"] || invalid ? true : void 0,
|
|
75
|
-
"data-size": size4,
|
|
76
|
-
className: chunkH2BWO3SI_cjs.cn(
|
|
77
|
-
"border-input dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none",
|
|
78
|
-
"*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2",
|
|
79
|
-
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
80
|
-
"aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error",
|
|
81
|
-
"data-[size=default]:h-9 data-[size=sm]:h-8",
|
|
82
|
-
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
83
|
-
"[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
84
|
-
"data-[placeholder]:text-muted-foreground",
|
|
85
|
-
className
|
|
86
|
-
),
|
|
87
|
-
...triggerProps,
|
|
88
|
-
children: [
|
|
89
|
-
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Value, { "data-slot": "select-value", placeholder }),
|
|
90
|
-
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Icon, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4 opacity-50" }) })
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
children
|
|
95
|
-
] });
|
|
96
|
-
}
|
|
97
|
-
function SelectContent({
|
|
98
|
-
className,
|
|
99
|
-
children,
|
|
100
|
-
position = "popper",
|
|
101
|
-
align = "center",
|
|
102
|
-
...props
|
|
103
|
-
}) {
|
|
104
|
-
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
105
|
-
radixUi.Select.Content,
|
|
106
|
-
{
|
|
107
|
-
"data-slot": "select-content",
|
|
108
|
-
className: chunkH2BWO3SI_cjs.cn(
|
|
109
|
-
"bg-popover text-popover-foreground border-border relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded border shadow-sm",
|
|
110
|
-
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
111
|
-
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
112
|
-
className
|
|
113
|
-
),
|
|
114
|
-
position,
|
|
115
|
-
align,
|
|
116
|
-
...props,
|
|
117
|
-
children: [
|
|
118
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectScrollUpButton, {}),
|
|
119
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
-
radixUi.Select.Viewport,
|
|
121
|
-
{
|
|
122
|
-
className: chunkH2BWO3SI_cjs.cn(
|
|
123
|
-
"p-1",
|
|
124
|
-
position === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
125
|
-
),
|
|
126
|
-
children
|
|
127
|
-
}
|
|
128
|
-
),
|
|
129
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectScrollDownButton, {})
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
) });
|
|
133
|
-
}
|
|
134
|
-
function SelectScrollUpButton({ className, ...props }) {
|
|
135
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
136
|
-
radixUi.Select.ScrollUpButton,
|
|
137
|
-
{
|
|
138
|
-
"data-slot": "select-scroll-up-button",
|
|
139
|
-
className: chunkH2BWO3SI_cjs.cn("flex cursor-default items-center justify-center py-1", className),
|
|
140
|
-
...props,
|
|
141
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUpIcon, { className: "size-4" })
|
|
142
|
-
}
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
function SelectScrollDownButton({
|
|
146
|
-
className,
|
|
147
|
-
...props
|
|
148
|
-
}) {
|
|
149
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
150
|
-
radixUi.Select.ScrollDownButton,
|
|
151
|
-
{
|
|
152
|
-
"data-slot": "select-scroll-down-button",
|
|
153
|
-
className: chunkH2BWO3SI_cjs.cn("flex cursor-default items-center justify-center py-1", className),
|
|
154
|
-
...props,
|
|
155
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "size-4" })
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// node_modules/@radix-ui/number/dist/index.mjs
|
|
161
|
-
function clamp(value, [min2, max2]) {
|
|
162
|
-
return Math.min(max2, Math.max(min2, value));
|
|
163
|
-
}
|
|
164
|
-
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
165
|
-
return function handleEvent(event) {
|
|
166
|
-
originalEventHandler?.(event);
|
|
167
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
168
|
-
return ourEventHandler?.(event);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
173
|
-
let defaultContexts = [];
|
|
174
|
-
function createContext32(rootComponentName, defaultContext) {
|
|
175
|
-
const BaseContext = React30__namespace.createContext(defaultContext);
|
|
176
|
-
const index2 = defaultContexts.length;
|
|
177
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
178
|
-
const Provider = (props) => {
|
|
179
|
-
const { scope, children, ...context } = props;
|
|
180
|
-
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
181
|
-
const value = React30__namespace.useMemo(() => context, Object.values(context));
|
|
182
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
183
|
-
};
|
|
184
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
185
|
-
function useContext22(consumerName, scope) {
|
|
186
|
-
const Context = scope?.[scopeName]?.[index2] || BaseContext;
|
|
187
|
-
const context = React30__namespace.useContext(Context);
|
|
188
|
-
if (context) return context;
|
|
189
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
190
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
191
|
-
}
|
|
192
|
-
return [Provider, useContext22];
|
|
193
|
-
}
|
|
194
|
-
const createScope = () => {
|
|
195
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
196
|
-
return React30__namespace.createContext(defaultContext);
|
|
197
|
-
});
|
|
198
|
-
return function useScope(scope) {
|
|
199
|
-
const contexts = scope?.[scopeName] || scopeContexts;
|
|
200
|
-
return React30__namespace.useMemo(
|
|
201
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
202
|
-
[scope, contexts]
|
|
203
|
-
);
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
createScope.scopeName = scopeName;
|
|
207
|
-
return [createContext32, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
208
|
-
}
|
|
209
|
-
function composeContextScopes(...scopes) {
|
|
210
|
-
const baseScope = scopes[0];
|
|
211
|
-
if (scopes.length === 1) return baseScope;
|
|
212
|
-
const createScope = () => {
|
|
213
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
214
|
-
useScope: createScope2(),
|
|
215
|
-
scopeName: createScope2.scopeName
|
|
216
|
-
}));
|
|
217
|
-
return function useComposedScopes(overrideScopes) {
|
|
218
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
219
|
-
const scopeProps = useScope(overrideScopes);
|
|
220
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
221
|
-
return { ...nextScopes2, ...currentScope };
|
|
222
|
-
}, {});
|
|
223
|
-
return React30__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
createScope.scopeName = baseScope.scopeName;
|
|
227
|
-
return createScope;
|
|
228
|
-
}
|
|
229
|
-
function setRef(ref, value) {
|
|
230
|
-
if (typeof ref === "function") {
|
|
231
|
-
return ref(value);
|
|
232
|
-
} else if (ref !== null && ref !== void 0) {
|
|
233
|
-
ref.current = value;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
function composeRefs(...refs) {
|
|
237
|
-
return (node) => {
|
|
238
|
-
let hasCleanup = false;
|
|
239
|
-
const cleanups = refs.map((ref) => {
|
|
240
|
-
const cleanup = setRef(ref, node);
|
|
241
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
242
|
-
hasCleanup = true;
|
|
243
|
-
}
|
|
244
|
-
return cleanup;
|
|
245
|
-
});
|
|
246
|
-
if (hasCleanup) {
|
|
247
|
-
return () => {
|
|
248
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
249
|
-
const cleanup = cleanups[i];
|
|
250
|
-
if (typeof cleanup == "function") {
|
|
251
|
-
cleanup();
|
|
252
|
-
} else {
|
|
253
|
-
setRef(refs[i], null);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
function useComposedRefs(...refs) {
|
|
261
|
-
return React30__namespace.useCallback(composeRefs(...refs), refs);
|
|
262
|
-
}
|
|
263
|
-
function createCollection(name) {
|
|
264
|
-
const PROVIDER_NAME = name + "CollectionProvider";
|
|
265
|
-
const [createCollectionContext, createCollectionScope2] = createContextScope(PROVIDER_NAME);
|
|
266
|
-
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
267
|
-
PROVIDER_NAME,
|
|
268
|
-
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
269
|
-
);
|
|
270
|
-
const CollectionProvider = (props) => {
|
|
271
|
-
const { scope, children } = props;
|
|
272
|
-
const ref = React30__namespace.default.useRef(null);
|
|
273
|
-
const itemMap = React30__namespace.default.useRef(/* @__PURE__ */ new Map()).current;
|
|
274
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
275
|
-
};
|
|
276
|
-
CollectionProvider.displayName = PROVIDER_NAME;
|
|
277
|
-
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
278
|
-
const CollectionSlotImpl = reactSlot.createSlot(COLLECTION_SLOT_NAME);
|
|
279
|
-
const CollectionSlot = React30__namespace.default.forwardRef(
|
|
280
|
-
(props, forwardedRef) => {
|
|
281
|
-
const { scope, children } = props;
|
|
282
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
283
|
-
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
284
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CollectionSlotImpl, { ref: composedRefs, children });
|
|
285
|
-
}
|
|
286
|
-
);
|
|
287
|
-
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
288
|
-
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
289
|
-
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
290
|
-
const CollectionItemSlotImpl = reactSlot.createSlot(ITEM_SLOT_NAME);
|
|
291
|
-
const CollectionItemSlot = React30__namespace.default.forwardRef(
|
|
292
|
-
(props, forwardedRef) => {
|
|
293
|
-
const { scope, children, ...itemData } = props;
|
|
294
|
-
const ref = React30__namespace.default.useRef(null);
|
|
295
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
296
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
297
|
-
React30__namespace.default.useEffect(() => {
|
|
298
|
-
context.itemMap.set(ref, { ref, ...itemData });
|
|
299
|
-
return () => void context.itemMap.delete(ref);
|
|
300
|
-
});
|
|
301
|
-
return /* @__PURE__ */ jsxRuntime.jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
302
|
-
}
|
|
303
|
-
);
|
|
304
|
-
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
305
|
-
function useCollection2(scope) {
|
|
306
|
-
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
307
|
-
const getItems = React30__namespace.default.useCallback(() => {
|
|
308
|
-
const collectionNode = context.collectionRef.current;
|
|
309
|
-
if (!collectionNode) return [];
|
|
310
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
311
|
-
const items = Array.from(context.itemMap.values());
|
|
312
|
-
const orderedItems = items.sort(
|
|
313
|
-
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
314
|
-
);
|
|
315
|
-
return orderedItems;
|
|
316
|
-
}, [context.collectionRef, context.itemMap]);
|
|
317
|
-
return getItems;
|
|
318
|
-
}
|
|
319
|
-
return [
|
|
320
|
-
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
321
|
-
useCollection2,
|
|
322
|
-
createCollectionScope2
|
|
323
|
-
];
|
|
324
|
-
}
|
|
325
|
-
React30__namespace.createContext(void 0);
|
|
326
|
-
var NODES = [
|
|
327
|
-
"a",
|
|
328
|
-
"button",
|
|
329
|
-
"div",
|
|
330
|
-
"form",
|
|
331
|
-
"h2",
|
|
332
|
-
"h3",
|
|
333
|
-
"img",
|
|
334
|
-
"input",
|
|
335
|
-
"label",
|
|
336
|
-
"li",
|
|
337
|
-
"nav",
|
|
338
|
-
"ol",
|
|
339
|
-
"p",
|
|
340
|
-
"select",
|
|
341
|
-
"span",
|
|
342
|
-
"svg",
|
|
343
|
-
"ul"
|
|
344
|
-
];
|
|
345
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
346
|
-
const Slot2 = reactSlot.createSlot(`Primitive.${node}`);
|
|
347
|
-
const Node2 = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
348
|
-
const { asChild, ...primitiveProps } = props;
|
|
349
|
-
const Comp = asChild ? Slot2 : node;
|
|
350
|
-
if (typeof window !== "undefined") {
|
|
351
|
-
window[Symbol.for("radix-ui")] = true;
|
|
352
|
-
}
|
|
353
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
354
|
-
});
|
|
355
|
-
Node2.displayName = `Primitive.${node}`;
|
|
356
|
-
return { ...primitive, [node]: Node2 };
|
|
357
|
-
}, {});
|
|
358
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
359
|
-
if (target) ReactDOM4__namespace.flushSync(() => target.dispatchEvent(event));
|
|
360
|
-
}
|
|
361
|
-
function useCallbackRef(callback) {
|
|
362
|
-
const callbackRef = React30__namespace.useRef(callback);
|
|
363
|
-
React30__namespace.useEffect(() => {
|
|
364
|
-
callbackRef.current = callback;
|
|
365
|
-
});
|
|
366
|
-
return React30__namespace.useMemo(() => (...args) => callbackRef.current?.(...args), []);
|
|
367
|
-
}
|
|
368
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
|
|
369
|
-
const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
|
|
370
|
-
React30__namespace.useEffect(() => {
|
|
371
|
-
const handleKeyDown = (event) => {
|
|
372
|
-
if (event.key === "Escape") {
|
|
373
|
-
onEscapeKeyDown(event);
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
377
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
378
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
379
|
-
}
|
|
380
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
381
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
382
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
383
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
384
|
-
var originalBodyPointerEvents;
|
|
385
|
-
var DismissableLayerContext = React30__namespace.createContext({
|
|
386
|
-
layers: /* @__PURE__ */ new Set(),
|
|
387
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
388
|
-
branches: /* @__PURE__ */ new Set()
|
|
389
|
-
});
|
|
390
|
-
var DismissableLayer = React30__namespace.forwardRef(
|
|
391
|
-
(props, forwardedRef) => {
|
|
392
|
-
const {
|
|
393
|
-
disableOutsidePointerEvents = false,
|
|
394
|
-
onEscapeKeyDown,
|
|
395
|
-
onPointerDownOutside,
|
|
396
|
-
onFocusOutside,
|
|
397
|
-
onInteractOutside,
|
|
398
|
-
onDismiss,
|
|
399
|
-
...layerProps
|
|
400
|
-
} = props;
|
|
401
|
-
const context = React30__namespace.useContext(DismissableLayerContext);
|
|
402
|
-
const [node, setNode] = React30__namespace.useState(null);
|
|
403
|
-
const ownerDocument = node?.ownerDocument ?? globalThis?.document;
|
|
404
|
-
const [, force] = React30__namespace.useState({});
|
|
405
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
406
|
-
const layers = Array.from(context.layers);
|
|
407
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
408
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
409
|
-
const index2 = node ? layers.indexOf(node) : -1;
|
|
410
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
411
|
-
const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
412
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
413
|
-
const target = event.target;
|
|
414
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
415
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
416
|
-
onPointerDownOutside?.(event);
|
|
417
|
-
onInteractOutside?.(event);
|
|
418
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
419
|
-
}, ownerDocument);
|
|
420
|
-
const focusOutside = useFocusOutside((event) => {
|
|
421
|
-
const target = event.target;
|
|
422
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
423
|
-
if (isFocusInBranch) return;
|
|
424
|
-
onFocusOutside?.(event);
|
|
425
|
-
onInteractOutside?.(event);
|
|
426
|
-
if (!event.defaultPrevented) onDismiss?.();
|
|
427
|
-
}, ownerDocument);
|
|
428
|
-
useEscapeKeydown((event) => {
|
|
429
|
-
const isHighestLayer = index2 === context.layers.size - 1;
|
|
430
|
-
if (!isHighestLayer) return;
|
|
431
|
-
onEscapeKeyDown?.(event);
|
|
432
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
433
|
-
event.preventDefault();
|
|
434
|
-
onDismiss();
|
|
435
|
-
}
|
|
436
|
-
}, ownerDocument);
|
|
437
|
-
React30__namespace.useEffect(() => {
|
|
438
|
-
if (!node) return;
|
|
439
|
-
if (disableOutsidePointerEvents) {
|
|
440
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
441
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
442
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
443
|
-
}
|
|
444
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
445
|
-
}
|
|
446
|
-
context.layers.add(node);
|
|
447
|
-
dispatchUpdate();
|
|
448
|
-
return () => {
|
|
449
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
450
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
454
|
-
React30__namespace.useEffect(() => {
|
|
455
|
-
return () => {
|
|
456
|
-
if (!node) return;
|
|
457
|
-
context.layers.delete(node);
|
|
458
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
459
|
-
dispatchUpdate();
|
|
460
|
-
};
|
|
461
|
-
}, [node, context]);
|
|
462
|
-
React30__namespace.useEffect(() => {
|
|
463
|
-
const handleUpdate = () => force({});
|
|
464
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
465
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
466
|
-
}, []);
|
|
467
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
468
|
-
Primitive.div,
|
|
469
|
-
{
|
|
470
|
-
...layerProps,
|
|
471
|
-
ref: composedRefs,
|
|
472
|
-
style: {
|
|
473
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
474
|
-
...props.style
|
|
475
|
-
},
|
|
476
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
477
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
478
|
-
onPointerDownCapture: composeEventHandlers(
|
|
479
|
-
props.onPointerDownCapture,
|
|
480
|
-
pointerDownOutside.onPointerDownCapture
|
|
481
|
-
)
|
|
482
|
-
}
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
|
-
);
|
|
486
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
487
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
488
|
-
var DismissableLayerBranch = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
489
|
-
const context = React30__namespace.useContext(DismissableLayerContext);
|
|
490
|
-
const ref = React30__namespace.useRef(null);
|
|
491
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
492
|
-
React30__namespace.useEffect(() => {
|
|
493
|
-
const node = ref.current;
|
|
494
|
-
if (node) {
|
|
495
|
-
context.branches.add(node);
|
|
496
|
-
return () => {
|
|
497
|
-
context.branches.delete(node);
|
|
498
|
-
};
|
|
499
|
-
}
|
|
500
|
-
}, [context.branches]);
|
|
501
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
502
|
-
});
|
|
503
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
504
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
505
|
-
const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
|
|
506
|
-
const isPointerInsideReactTreeRef = React30__namespace.useRef(false);
|
|
507
|
-
const handleClickRef = React30__namespace.useRef(() => {
|
|
508
|
-
});
|
|
509
|
-
React30__namespace.useEffect(() => {
|
|
510
|
-
const handlePointerDown = (event) => {
|
|
511
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
512
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
513
|
-
handleAndDispatchCustomEvent(
|
|
514
|
-
POINTER_DOWN_OUTSIDE,
|
|
515
|
-
handlePointerDownOutside,
|
|
516
|
-
eventDetail,
|
|
517
|
-
{ discrete: true }
|
|
518
|
-
);
|
|
519
|
-
};
|
|
520
|
-
const eventDetail = { originalEvent: event };
|
|
521
|
-
if (event.pointerType === "touch") {
|
|
522
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
523
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
524
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
525
|
-
} else {
|
|
526
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
527
|
-
}
|
|
528
|
-
} else {
|
|
529
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
530
|
-
}
|
|
531
|
-
isPointerInsideReactTreeRef.current = false;
|
|
532
|
-
};
|
|
533
|
-
const timerId = window.setTimeout(() => {
|
|
534
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
535
|
-
}, 0);
|
|
536
|
-
return () => {
|
|
537
|
-
window.clearTimeout(timerId);
|
|
538
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
539
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
540
|
-
};
|
|
541
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
542
|
-
return {
|
|
543
|
-
// ensures we check React component tree (not just DOM tree)
|
|
544
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
|
|
548
|
-
const handleFocusOutside = useCallbackRef(onFocusOutside);
|
|
549
|
-
const isFocusInsideReactTreeRef = React30__namespace.useRef(false);
|
|
550
|
-
React30__namespace.useEffect(() => {
|
|
551
|
-
const handleFocus = (event) => {
|
|
552
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
553
|
-
const eventDetail = { originalEvent: event };
|
|
554
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
555
|
-
discrete: false
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
560
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
561
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
562
|
-
return {
|
|
563
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
564
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
function dispatchUpdate() {
|
|
568
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
569
|
-
document.dispatchEvent(event);
|
|
570
|
-
}
|
|
571
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
572
|
-
const target = detail.originalEvent.target;
|
|
573
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
574
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
575
|
-
if (discrete) {
|
|
576
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
577
|
-
} else {
|
|
578
|
-
target.dispatchEvent(event);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
var count = 0;
|
|
582
|
-
function useFocusGuards() {
|
|
583
|
-
React30__namespace.useEffect(() => {
|
|
584
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
585
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
586
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
587
|
-
count++;
|
|
588
|
-
return () => {
|
|
589
|
-
if (count === 1) {
|
|
590
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
591
|
-
}
|
|
592
|
-
count--;
|
|
593
|
-
};
|
|
594
|
-
}, []);
|
|
595
|
-
}
|
|
596
|
-
function createFocusGuard() {
|
|
597
|
-
const element = document.createElement("span");
|
|
598
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
599
|
-
element.tabIndex = 0;
|
|
600
|
-
element.style.outline = "none";
|
|
601
|
-
element.style.opacity = "0";
|
|
602
|
-
element.style.position = "fixed";
|
|
603
|
-
element.style.pointerEvents = "none";
|
|
604
|
-
return element;
|
|
605
|
-
}
|
|
606
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
607
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
608
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
609
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
610
|
-
var FocusScope = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
611
|
-
const {
|
|
612
|
-
loop = false,
|
|
613
|
-
trapped = false,
|
|
614
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
615
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
616
|
-
...scopeProps
|
|
617
|
-
} = props;
|
|
618
|
-
const [container, setContainer] = React30__namespace.useState(null);
|
|
619
|
-
const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
|
|
620
|
-
const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
|
|
621
|
-
const lastFocusedElementRef = React30__namespace.useRef(null);
|
|
622
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
623
|
-
const focusScope = React30__namespace.useRef({
|
|
624
|
-
paused: false,
|
|
625
|
-
pause() {
|
|
626
|
-
this.paused = true;
|
|
627
|
-
},
|
|
628
|
-
resume() {
|
|
629
|
-
this.paused = false;
|
|
630
|
-
}
|
|
631
|
-
}).current;
|
|
632
|
-
React30__namespace.useEffect(() => {
|
|
633
|
-
if (trapped) {
|
|
634
|
-
let handleFocusIn2 = function(event) {
|
|
635
|
-
if (focusScope.paused || !container) return;
|
|
636
|
-
const target = event.target;
|
|
637
|
-
if (container.contains(target)) {
|
|
638
|
-
lastFocusedElementRef.current = target;
|
|
639
|
-
} else {
|
|
640
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
641
|
-
}
|
|
642
|
-
}, handleFocusOut2 = function(event) {
|
|
643
|
-
if (focusScope.paused || !container) return;
|
|
644
|
-
const relatedTarget = event.relatedTarget;
|
|
645
|
-
if (relatedTarget === null) return;
|
|
646
|
-
if (!container.contains(relatedTarget)) {
|
|
647
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
648
|
-
}
|
|
649
|
-
}, handleMutations2 = function(mutations) {
|
|
650
|
-
const focusedElement = document.activeElement;
|
|
651
|
-
if (focusedElement !== document.body) return;
|
|
652
|
-
for (const mutation of mutations) {
|
|
653
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
657
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
658
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
659
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
660
|
-
return () => {
|
|
661
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
662
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
663
|
-
mutationObserver.disconnect();
|
|
664
|
-
};
|
|
665
|
-
}
|
|
666
|
-
}, [trapped, container, focusScope.paused]);
|
|
667
|
-
React30__namespace.useEffect(() => {
|
|
668
|
-
if (container) {
|
|
669
|
-
focusScopesStack.add(focusScope);
|
|
670
|
-
const previouslyFocusedElement = document.activeElement;
|
|
671
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
672
|
-
if (!hasFocusedCandidate) {
|
|
673
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
674
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
675
|
-
container.dispatchEvent(mountEvent);
|
|
676
|
-
if (!mountEvent.defaultPrevented) {
|
|
677
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
678
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
679
|
-
focus(container);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
}
|
|
683
|
-
return () => {
|
|
684
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
685
|
-
setTimeout(() => {
|
|
686
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
687
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
688
|
-
container.dispatchEvent(unmountEvent);
|
|
689
|
-
if (!unmountEvent.defaultPrevented) {
|
|
690
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
691
|
-
}
|
|
692
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
693
|
-
focusScopesStack.remove(focusScope);
|
|
694
|
-
}, 0);
|
|
695
|
-
};
|
|
696
|
-
}
|
|
697
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
698
|
-
const handleKeyDown = React30__namespace.useCallback(
|
|
699
|
-
(event) => {
|
|
700
|
-
if (!loop && !trapped) return;
|
|
701
|
-
if (focusScope.paused) return;
|
|
702
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
703
|
-
const focusedElement = document.activeElement;
|
|
704
|
-
if (isTabKey && focusedElement) {
|
|
705
|
-
const container2 = event.currentTarget;
|
|
706
|
-
const [first, last] = getTabbableEdges(container2);
|
|
707
|
-
const hasTabbableElementsInside = first && last;
|
|
708
|
-
if (!hasTabbableElementsInside) {
|
|
709
|
-
if (focusedElement === container2) event.preventDefault();
|
|
710
|
-
} else {
|
|
711
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
712
|
-
event.preventDefault();
|
|
713
|
-
if (loop) focus(first, { select: true });
|
|
714
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
715
|
-
event.preventDefault();
|
|
716
|
-
if (loop) focus(last, { select: true });
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
},
|
|
721
|
-
[loop, trapped, focusScope.paused]
|
|
722
|
-
);
|
|
723
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
724
|
-
});
|
|
725
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
726
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
727
|
-
const previouslyFocusedElement = document.activeElement;
|
|
728
|
-
for (const candidate of candidates) {
|
|
729
|
-
focus(candidate, { select });
|
|
730
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
function getTabbableEdges(container) {
|
|
734
|
-
const candidates = getTabbableCandidates(container);
|
|
735
|
-
const first = findVisible(candidates, container);
|
|
736
|
-
const last = findVisible(candidates.reverse(), container);
|
|
737
|
-
return [first, last];
|
|
738
|
-
}
|
|
739
|
-
function getTabbableCandidates(container) {
|
|
740
|
-
const nodes = [];
|
|
741
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
742
|
-
acceptNode: (node) => {
|
|
743
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
744
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
745
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
749
|
-
return nodes;
|
|
750
|
-
}
|
|
751
|
-
function findVisible(elements, container) {
|
|
752
|
-
for (const element of elements) {
|
|
753
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
function isHidden(node, { upTo }) {
|
|
757
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
758
|
-
while (node) {
|
|
759
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
760
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
761
|
-
node = node.parentElement;
|
|
762
|
-
}
|
|
763
|
-
return false;
|
|
764
|
-
}
|
|
765
|
-
function isSelectableInput(element) {
|
|
766
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
767
|
-
}
|
|
768
|
-
function focus(element, { select = false } = {}) {
|
|
769
|
-
if (element && element.focus) {
|
|
770
|
-
const previouslyFocusedElement = document.activeElement;
|
|
771
|
-
element.focus({ preventScroll: true });
|
|
772
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
773
|
-
element.select();
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
var focusScopesStack = createFocusScopesStack();
|
|
777
|
-
function createFocusScopesStack() {
|
|
778
|
-
let stack = [];
|
|
779
|
-
return {
|
|
780
|
-
add(focusScope) {
|
|
781
|
-
const activeFocusScope = stack[0];
|
|
782
|
-
if (focusScope !== activeFocusScope) {
|
|
783
|
-
activeFocusScope?.pause();
|
|
784
|
-
}
|
|
785
|
-
stack = arrayRemove(stack, focusScope);
|
|
786
|
-
stack.unshift(focusScope);
|
|
787
|
-
},
|
|
788
|
-
remove(focusScope) {
|
|
789
|
-
stack = arrayRemove(stack, focusScope);
|
|
790
|
-
stack[0]?.resume();
|
|
791
|
-
}
|
|
792
|
-
};
|
|
793
|
-
}
|
|
794
|
-
function arrayRemove(array, item) {
|
|
795
|
-
const updatedArray = [...array];
|
|
796
|
-
const index2 = updatedArray.indexOf(item);
|
|
797
|
-
if (index2 !== -1) {
|
|
798
|
-
updatedArray.splice(index2, 1);
|
|
799
|
-
}
|
|
800
|
-
return updatedArray;
|
|
801
|
-
}
|
|
802
|
-
function removeLinks(items) {
|
|
803
|
-
return items.filter((item) => item.tagName !== "A");
|
|
804
|
-
}
|
|
805
|
-
var useLayoutEffect2 = globalThis?.document ? React30__namespace.useLayoutEffect : () => {
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
// node_modules/@radix-ui/react-id/dist/index.mjs
|
|
809
|
-
var useReactId = React30__namespace[" useId ".trim().toString()] || (() => void 0);
|
|
810
|
-
var count2 = 0;
|
|
811
|
-
function useId(deterministicId) {
|
|
812
|
-
const [id, setId] = React30__namespace.useState(useReactId());
|
|
813
|
-
useLayoutEffect2(() => {
|
|
814
|
-
setId((reactId) => reactId ?? String(count2++));
|
|
815
|
-
}, [deterministicId]);
|
|
816
|
-
return (id ? `radix-${id}` : "");
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
|
|
820
|
-
var sides = ["top", "right", "bottom", "left"];
|
|
821
|
-
var min = Math.min;
|
|
822
|
-
var max = Math.max;
|
|
823
|
-
var round = Math.round;
|
|
824
|
-
var floor = Math.floor;
|
|
825
|
-
var createCoords = (v) => ({
|
|
826
|
-
x: v,
|
|
827
|
-
y: v
|
|
828
|
-
});
|
|
829
|
-
var oppositeSideMap = {
|
|
830
|
-
left: "right",
|
|
831
|
-
right: "left",
|
|
832
|
-
bottom: "top",
|
|
833
|
-
top: "bottom"
|
|
834
|
-
};
|
|
835
|
-
var oppositeAlignmentMap = {
|
|
836
|
-
start: "end",
|
|
837
|
-
end: "start"
|
|
838
|
-
};
|
|
839
|
-
function clamp2(start, value, end) {
|
|
840
|
-
return max(start, min(value, end));
|
|
841
|
-
}
|
|
842
|
-
function evaluate(value, param) {
|
|
843
|
-
return typeof value === "function" ? value(param) : value;
|
|
844
|
-
}
|
|
845
|
-
function getSide(placement) {
|
|
846
|
-
return placement.split("-")[0];
|
|
847
|
-
}
|
|
848
|
-
function getAlignment(placement) {
|
|
849
|
-
return placement.split("-")[1];
|
|
850
|
-
}
|
|
851
|
-
function getOppositeAxis(axis) {
|
|
852
|
-
return axis === "x" ? "y" : "x";
|
|
853
|
-
}
|
|
854
|
-
function getAxisLength(axis) {
|
|
855
|
-
return axis === "y" ? "height" : "width";
|
|
856
|
-
}
|
|
857
|
-
var yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
|
|
858
|
-
function getSideAxis(placement) {
|
|
859
|
-
return yAxisSides.has(getSide(placement)) ? "y" : "x";
|
|
860
|
-
}
|
|
861
|
-
function getAlignmentAxis(placement) {
|
|
862
|
-
return getOppositeAxis(getSideAxis(placement));
|
|
863
|
-
}
|
|
864
|
-
function getAlignmentSides(placement, rects, rtl) {
|
|
865
|
-
if (rtl === void 0) {
|
|
866
|
-
rtl = false;
|
|
867
|
-
}
|
|
868
|
-
const alignment = getAlignment(placement);
|
|
869
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
870
|
-
const length = getAxisLength(alignmentAxis);
|
|
871
|
-
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
|
|
872
|
-
if (rects.reference[length] > rects.floating[length]) {
|
|
873
|
-
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
874
|
-
}
|
|
875
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
876
|
-
}
|
|
877
|
-
function getExpandedPlacements(placement) {
|
|
878
|
-
const oppositePlacement = getOppositePlacement(placement);
|
|
879
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
880
|
-
}
|
|
881
|
-
function getOppositeAlignmentPlacement(placement) {
|
|
882
|
-
return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
|
|
883
|
-
}
|
|
884
|
-
var lrPlacement = ["left", "right"];
|
|
885
|
-
var rlPlacement = ["right", "left"];
|
|
886
|
-
var tbPlacement = ["top", "bottom"];
|
|
887
|
-
var btPlacement = ["bottom", "top"];
|
|
888
|
-
function getSideList(side, isStart, rtl) {
|
|
889
|
-
switch (side) {
|
|
890
|
-
case "top":
|
|
891
|
-
case "bottom":
|
|
892
|
-
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
893
|
-
return isStart ? lrPlacement : rlPlacement;
|
|
894
|
-
case "left":
|
|
895
|
-
case "right":
|
|
896
|
-
return isStart ? tbPlacement : btPlacement;
|
|
897
|
-
default:
|
|
898
|
-
return [];
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
902
|
-
const alignment = getAlignment(placement);
|
|
903
|
-
let list = getSideList(getSide(placement), direction === "start", rtl);
|
|
904
|
-
if (alignment) {
|
|
905
|
-
list = list.map((side) => side + "-" + alignment);
|
|
906
|
-
if (flipAlignment) {
|
|
907
|
-
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
return list;
|
|
911
|
-
}
|
|
912
|
-
function getOppositePlacement(placement) {
|
|
913
|
-
return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
|
|
914
|
-
}
|
|
915
|
-
function expandPaddingObject(padding) {
|
|
916
|
-
return {
|
|
917
|
-
top: 0,
|
|
918
|
-
right: 0,
|
|
919
|
-
bottom: 0,
|
|
920
|
-
left: 0,
|
|
921
|
-
...padding
|
|
922
|
-
};
|
|
923
|
-
}
|
|
924
|
-
function getPaddingObject(padding) {
|
|
925
|
-
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
926
|
-
top: padding,
|
|
927
|
-
right: padding,
|
|
928
|
-
bottom: padding,
|
|
929
|
-
left: padding
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
function rectToClientRect(rect) {
|
|
933
|
-
const {
|
|
934
|
-
x,
|
|
935
|
-
y,
|
|
936
|
-
width,
|
|
937
|
-
height
|
|
938
|
-
} = rect;
|
|
939
|
-
return {
|
|
940
|
-
width,
|
|
941
|
-
height,
|
|
942
|
-
top: y,
|
|
943
|
-
left: x,
|
|
944
|
-
right: x + width,
|
|
945
|
-
bottom: y + height,
|
|
946
|
-
x,
|
|
947
|
-
y
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
// node_modules/@floating-ui/core/dist/floating-ui.core.mjs
|
|
952
|
-
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
953
|
-
let {
|
|
954
|
-
reference,
|
|
955
|
-
floating
|
|
956
|
-
} = _ref;
|
|
957
|
-
const sideAxis = getSideAxis(placement);
|
|
958
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
959
|
-
const alignLength = getAxisLength(alignmentAxis);
|
|
960
|
-
const side = getSide(placement);
|
|
961
|
-
const isVertical = sideAxis === "y";
|
|
962
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
963
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
964
|
-
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
965
|
-
let coords;
|
|
966
|
-
switch (side) {
|
|
967
|
-
case "top":
|
|
968
|
-
coords = {
|
|
969
|
-
x: commonX,
|
|
970
|
-
y: reference.y - floating.height
|
|
971
|
-
};
|
|
972
|
-
break;
|
|
973
|
-
case "bottom":
|
|
974
|
-
coords = {
|
|
975
|
-
x: commonX,
|
|
976
|
-
y: reference.y + reference.height
|
|
977
|
-
};
|
|
978
|
-
break;
|
|
979
|
-
case "right":
|
|
980
|
-
coords = {
|
|
981
|
-
x: reference.x + reference.width,
|
|
982
|
-
y: commonY
|
|
983
|
-
};
|
|
984
|
-
break;
|
|
985
|
-
case "left":
|
|
986
|
-
coords = {
|
|
987
|
-
x: reference.x - floating.width,
|
|
988
|
-
y: commonY
|
|
989
|
-
};
|
|
990
|
-
break;
|
|
991
|
-
default:
|
|
992
|
-
coords = {
|
|
993
|
-
x: reference.x,
|
|
994
|
-
y: reference.y
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
switch (getAlignment(placement)) {
|
|
998
|
-
case "start":
|
|
999
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1000
|
-
break;
|
|
1001
|
-
case "end":
|
|
1002
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
1003
|
-
break;
|
|
1004
|
-
}
|
|
1005
|
-
return coords;
|
|
1006
|
-
}
|
|
1007
|
-
var computePosition = async (reference, floating, config) => {
|
|
1008
|
-
const {
|
|
1009
|
-
placement = "bottom",
|
|
1010
|
-
strategy = "absolute",
|
|
1011
|
-
middleware = [],
|
|
1012
|
-
platform: platform2
|
|
1013
|
-
} = config;
|
|
1014
|
-
const validMiddleware = middleware.filter(Boolean);
|
|
1015
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
1016
|
-
let rects = await platform2.getElementRects({
|
|
1017
|
-
reference,
|
|
1018
|
-
floating,
|
|
1019
|
-
strategy
|
|
1020
|
-
});
|
|
1021
|
-
let {
|
|
1022
|
-
x,
|
|
1023
|
-
y
|
|
1024
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
1025
|
-
let statefulPlacement = placement;
|
|
1026
|
-
let middlewareData = {};
|
|
1027
|
-
let resetCount = 0;
|
|
1028
|
-
for (let i = 0; i < validMiddleware.length; i++) {
|
|
1029
|
-
const {
|
|
1030
|
-
name,
|
|
1031
|
-
fn
|
|
1032
|
-
} = validMiddleware[i];
|
|
1033
|
-
const {
|
|
1034
|
-
x: nextX,
|
|
1035
|
-
y: nextY,
|
|
1036
|
-
data,
|
|
1037
|
-
reset
|
|
1038
|
-
} = await fn({
|
|
1039
|
-
x,
|
|
1040
|
-
y,
|
|
1041
|
-
initialPlacement: placement,
|
|
1042
|
-
placement: statefulPlacement,
|
|
1043
|
-
strategy,
|
|
1044
|
-
middlewareData,
|
|
1045
|
-
rects,
|
|
1046
|
-
platform: platform2,
|
|
1047
|
-
elements: {
|
|
1048
|
-
reference,
|
|
1049
|
-
floating
|
|
1050
|
-
}
|
|
1051
|
-
});
|
|
1052
|
-
x = nextX != null ? nextX : x;
|
|
1053
|
-
y = nextY != null ? nextY : y;
|
|
1054
|
-
middlewareData = {
|
|
1055
|
-
...middlewareData,
|
|
1056
|
-
[name]: {
|
|
1057
|
-
...middlewareData[name],
|
|
1058
|
-
...data
|
|
1059
|
-
}
|
|
1060
|
-
};
|
|
1061
|
-
if (reset && resetCount <= 50) {
|
|
1062
|
-
resetCount++;
|
|
1063
|
-
if (typeof reset === "object") {
|
|
1064
|
-
if (reset.placement) {
|
|
1065
|
-
statefulPlacement = reset.placement;
|
|
1066
|
-
}
|
|
1067
|
-
if (reset.rects) {
|
|
1068
|
-
rects = reset.rects === true ? await platform2.getElementRects({
|
|
1069
|
-
reference,
|
|
1070
|
-
floating,
|
|
1071
|
-
strategy
|
|
1072
|
-
}) : reset.rects;
|
|
1073
|
-
}
|
|
1074
|
-
({
|
|
1075
|
-
x,
|
|
1076
|
-
y
|
|
1077
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
1078
|
-
}
|
|
1079
|
-
i = -1;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
return {
|
|
1083
|
-
x,
|
|
1084
|
-
y,
|
|
1085
|
-
placement: statefulPlacement,
|
|
1086
|
-
strategy,
|
|
1087
|
-
middlewareData
|
|
1088
|
-
};
|
|
1089
|
-
};
|
|
1090
|
-
async function detectOverflow(state, options) {
|
|
1091
|
-
var _await$platform$isEle;
|
|
1092
|
-
if (options === void 0) {
|
|
1093
|
-
options = {};
|
|
1094
|
-
}
|
|
1095
|
-
const {
|
|
1096
|
-
x,
|
|
1097
|
-
y,
|
|
1098
|
-
platform: platform2,
|
|
1099
|
-
rects,
|
|
1100
|
-
elements,
|
|
1101
|
-
strategy
|
|
1102
|
-
} = state;
|
|
1103
|
-
const {
|
|
1104
|
-
boundary = "clippingAncestors",
|
|
1105
|
-
rootBoundary = "viewport",
|
|
1106
|
-
elementContext = "floating",
|
|
1107
|
-
altBoundary = false,
|
|
1108
|
-
padding = 0
|
|
1109
|
-
} = evaluate(options, state);
|
|
1110
|
-
const paddingObject = getPaddingObject(padding);
|
|
1111
|
-
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
1112
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
1113
|
-
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
1114
|
-
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
1115
|
-
boundary,
|
|
1116
|
-
rootBoundary,
|
|
1117
|
-
strategy
|
|
1118
|
-
}));
|
|
1119
|
-
const rect = elementContext === "floating" ? {
|
|
1120
|
-
x,
|
|
1121
|
-
y,
|
|
1122
|
-
width: rects.floating.width,
|
|
1123
|
-
height: rects.floating.height
|
|
1124
|
-
} : rects.reference;
|
|
1125
|
-
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
1126
|
-
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
1127
|
-
x: 1,
|
|
1128
|
-
y: 1
|
|
1129
|
-
} : {
|
|
1130
|
-
x: 1,
|
|
1131
|
-
y: 1
|
|
1132
|
-
};
|
|
1133
|
-
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1134
|
-
elements,
|
|
1135
|
-
rect,
|
|
1136
|
-
offsetParent,
|
|
1137
|
-
strategy
|
|
1138
|
-
}) : rect);
|
|
1139
|
-
return {
|
|
1140
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
1141
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
1142
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
1143
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
1144
|
-
};
|
|
1145
|
-
}
|
|
1146
|
-
var arrow = (options) => ({
|
|
1147
|
-
name: "arrow",
|
|
1148
|
-
options,
|
|
1149
|
-
async fn(state) {
|
|
1150
|
-
const {
|
|
1151
|
-
x,
|
|
1152
|
-
y,
|
|
1153
|
-
placement,
|
|
1154
|
-
rects,
|
|
1155
|
-
platform: platform2,
|
|
1156
|
-
elements,
|
|
1157
|
-
middlewareData
|
|
1158
|
-
} = state;
|
|
1159
|
-
const {
|
|
1160
|
-
element,
|
|
1161
|
-
padding = 0
|
|
1162
|
-
} = evaluate(options, state) || {};
|
|
1163
|
-
if (element == null) {
|
|
1164
|
-
return {};
|
|
1165
|
-
}
|
|
1166
|
-
const paddingObject = getPaddingObject(padding);
|
|
1167
|
-
const coords = {
|
|
1168
|
-
x,
|
|
1169
|
-
y
|
|
1170
|
-
};
|
|
1171
|
-
const axis = getAlignmentAxis(placement);
|
|
1172
|
-
const length = getAxisLength(axis);
|
|
1173
|
-
const arrowDimensions = await platform2.getDimensions(element);
|
|
1174
|
-
const isYAxis = axis === "y";
|
|
1175
|
-
const minProp = isYAxis ? "top" : "left";
|
|
1176
|
-
const maxProp = isYAxis ? "bottom" : "right";
|
|
1177
|
-
const clientProp = isYAxis ? "clientHeight" : "clientWidth";
|
|
1178
|
-
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
|
|
1179
|
-
const startDiff = coords[axis] - rects.reference[axis];
|
|
1180
|
-
const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
|
|
1181
|
-
let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
|
|
1182
|
-
if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
|
|
1183
|
-
clientSize = elements.floating[clientProp] || rects.floating[length];
|
|
1184
|
-
}
|
|
1185
|
-
const centerToReference = endDiff / 2 - startDiff / 2;
|
|
1186
|
-
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
|
|
1187
|
-
const minPadding = min(paddingObject[minProp], largestPossiblePadding);
|
|
1188
|
-
const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
|
|
1189
|
-
const min$1 = minPadding;
|
|
1190
|
-
const max2 = clientSize - arrowDimensions[length] - maxPadding;
|
|
1191
|
-
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
|
|
1192
|
-
const offset4 = clamp2(min$1, center, max2);
|
|
1193
|
-
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
|
|
1194
|
-
const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
|
|
1195
|
-
return {
|
|
1196
|
-
[axis]: coords[axis] + alignmentOffset,
|
|
1197
|
-
data: {
|
|
1198
|
-
[axis]: offset4,
|
|
1199
|
-
centerOffset: center - offset4 - alignmentOffset,
|
|
1200
|
-
...shouldAddOffset && {
|
|
1201
|
-
alignmentOffset
|
|
1202
|
-
}
|
|
1203
|
-
},
|
|
1204
|
-
reset: shouldAddOffset
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
});
|
|
1208
|
-
var flip = function(options) {
|
|
1209
|
-
if (options === void 0) {
|
|
1210
|
-
options = {};
|
|
1211
|
-
}
|
|
1212
|
-
return {
|
|
1213
|
-
name: "flip",
|
|
1214
|
-
options,
|
|
1215
|
-
async fn(state) {
|
|
1216
|
-
var _middlewareData$arrow, _middlewareData$flip;
|
|
1217
|
-
const {
|
|
1218
|
-
placement,
|
|
1219
|
-
middlewareData,
|
|
1220
|
-
rects,
|
|
1221
|
-
initialPlacement,
|
|
1222
|
-
platform: platform2,
|
|
1223
|
-
elements
|
|
1224
|
-
} = state;
|
|
1225
|
-
const {
|
|
1226
|
-
mainAxis: checkMainAxis = true,
|
|
1227
|
-
crossAxis: checkCrossAxis = true,
|
|
1228
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
|
1229
|
-
fallbackStrategy = "bestFit",
|
|
1230
|
-
fallbackAxisSideDirection = "none",
|
|
1231
|
-
flipAlignment = true,
|
|
1232
|
-
...detectOverflowOptions
|
|
1233
|
-
} = evaluate(options, state);
|
|
1234
|
-
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
1235
|
-
return {};
|
|
1236
|
-
}
|
|
1237
|
-
const side = getSide(placement);
|
|
1238
|
-
const initialSideAxis = getSideAxis(initialPlacement);
|
|
1239
|
-
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
1240
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
1241
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
1242
|
-
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
|
|
1243
|
-
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
1244
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
1245
|
-
}
|
|
1246
|
-
const placements2 = [initialPlacement, ...fallbackPlacements];
|
|
1247
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1248
|
-
const overflows = [];
|
|
1249
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
1250
|
-
if (checkMainAxis) {
|
|
1251
|
-
overflows.push(overflow[side]);
|
|
1252
|
-
}
|
|
1253
|
-
if (checkCrossAxis) {
|
|
1254
|
-
const sides2 = getAlignmentSides(placement, rects, rtl);
|
|
1255
|
-
overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
|
|
1256
|
-
}
|
|
1257
|
-
overflowsData = [...overflowsData, {
|
|
1258
|
-
placement,
|
|
1259
|
-
overflows
|
|
1260
|
-
}];
|
|
1261
|
-
if (!overflows.every((side2) => side2 <= 0)) {
|
|
1262
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
|
1263
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
1264
|
-
const nextPlacement = placements2[nextIndex];
|
|
1265
|
-
if (nextPlacement) {
|
|
1266
|
-
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
1267
|
-
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
|
|
1268
|
-
// overflows the main axis.
|
|
1269
|
-
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
1270
|
-
return {
|
|
1271
|
-
data: {
|
|
1272
|
-
index: nextIndex,
|
|
1273
|
-
overflows: overflowsData
|
|
1274
|
-
},
|
|
1275
|
-
reset: {
|
|
1276
|
-
placement: nextPlacement
|
|
1277
|
-
}
|
|
1278
|
-
};
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
1282
|
-
if (!resetPlacement) {
|
|
1283
|
-
switch (fallbackStrategy) {
|
|
1284
|
-
case "bestFit": {
|
|
1285
|
-
var _overflowsData$filter2;
|
|
1286
|
-
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
|
|
1287
|
-
if (hasFallbackAxisSideDirection) {
|
|
1288
|
-
const currentSideAxis = getSideAxis(d.placement);
|
|
1289
|
-
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
|
|
1290
|
-
// reading directions favoring greater width.
|
|
1291
|
-
currentSideAxis === "y";
|
|
1292
|
-
}
|
|
1293
|
-
return true;
|
|
1294
|
-
}).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
1295
|
-
if (placement2) {
|
|
1296
|
-
resetPlacement = placement2;
|
|
1297
|
-
}
|
|
1298
|
-
break;
|
|
1299
|
-
}
|
|
1300
|
-
case "initialPlacement":
|
|
1301
|
-
resetPlacement = initialPlacement;
|
|
1302
|
-
break;
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
if (placement !== resetPlacement) {
|
|
1306
|
-
return {
|
|
1307
|
-
reset: {
|
|
1308
|
-
placement: resetPlacement
|
|
1309
|
-
}
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
return {};
|
|
1314
|
-
}
|
|
1315
|
-
};
|
|
1316
|
-
};
|
|
1317
|
-
function getSideOffsets(overflow, rect) {
|
|
1318
|
-
return {
|
|
1319
|
-
top: overflow.top - rect.height,
|
|
1320
|
-
right: overflow.right - rect.width,
|
|
1321
|
-
bottom: overflow.bottom - rect.height,
|
|
1322
|
-
left: overflow.left - rect.width
|
|
1323
|
-
};
|
|
1324
|
-
}
|
|
1325
|
-
function isAnySideFullyClipped(overflow) {
|
|
1326
|
-
return sides.some((side) => overflow[side] >= 0);
|
|
1327
|
-
}
|
|
1328
|
-
var hide = function(options) {
|
|
1329
|
-
if (options === void 0) {
|
|
1330
|
-
options = {};
|
|
1331
|
-
}
|
|
1332
|
-
return {
|
|
1333
|
-
name: "hide",
|
|
1334
|
-
options,
|
|
1335
|
-
async fn(state) {
|
|
1336
|
-
const {
|
|
1337
|
-
rects
|
|
1338
|
-
} = state;
|
|
1339
|
-
const {
|
|
1340
|
-
strategy = "referenceHidden",
|
|
1341
|
-
...detectOverflowOptions
|
|
1342
|
-
} = evaluate(options, state);
|
|
1343
|
-
switch (strategy) {
|
|
1344
|
-
case "referenceHidden": {
|
|
1345
|
-
const overflow = await detectOverflow(state, {
|
|
1346
|
-
...detectOverflowOptions,
|
|
1347
|
-
elementContext: "reference"
|
|
1348
|
-
});
|
|
1349
|
-
const offsets = getSideOffsets(overflow, rects.reference);
|
|
1350
|
-
return {
|
|
1351
|
-
data: {
|
|
1352
|
-
referenceHiddenOffsets: offsets,
|
|
1353
|
-
referenceHidden: isAnySideFullyClipped(offsets)
|
|
1354
|
-
}
|
|
1355
|
-
};
|
|
1356
|
-
}
|
|
1357
|
-
case "escaped": {
|
|
1358
|
-
const overflow = await detectOverflow(state, {
|
|
1359
|
-
...detectOverflowOptions,
|
|
1360
|
-
altBoundary: true
|
|
1361
|
-
});
|
|
1362
|
-
const offsets = getSideOffsets(overflow, rects.floating);
|
|
1363
|
-
return {
|
|
1364
|
-
data: {
|
|
1365
|
-
escapedOffsets: offsets,
|
|
1366
|
-
escaped: isAnySideFullyClipped(offsets)
|
|
1367
|
-
}
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
default: {
|
|
1371
|
-
return {};
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
};
|
|
1376
|
-
};
|
|
1377
|
-
var originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
1378
|
-
async function convertValueToCoords(state, options) {
|
|
1379
|
-
const {
|
|
1380
|
-
placement,
|
|
1381
|
-
platform: platform2,
|
|
1382
|
-
elements
|
|
1383
|
-
} = state;
|
|
1384
|
-
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
|
|
1385
|
-
const side = getSide(placement);
|
|
1386
|
-
const alignment = getAlignment(placement);
|
|
1387
|
-
const isVertical = getSideAxis(placement) === "y";
|
|
1388
|
-
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
1389
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
1390
|
-
const rawValue = evaluate(options, state);
|
|
1391
|
-
let {
|
|
1392
|
-
mainAxis,
|
|
1393
|
-
crossAxis,
|
|
1394
|
-
alignmentAxis
|
|
1395
|
-
} = typeof rawValue === "number" ? {
|
|
1396
|
-
mainAxis: rawValue,
|
|
1397
|
-
crossAxis: 0,
|
|
1398
|
-
alignmentAxis: null
|
|
1399
|
-
} : {
|
|
1400
|
-
mainAxis: rawValue.mainAxis || 0,
|
|
1401
|
-
crossAxis: rawValue.crossAxis || 0,
|
|
1402
|
-
alignmentAxis: rawValue.alignmentAxis
|
|
1403
|
-
};
|
|
1404
|
-
if (alignment && typeof alignmentAxis === "number") {
|
|
1405
|
-
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
|
|
1406
|
-
}
|
|
1407
|
-
return isVertical ? {
|
|
1408
|
-
x: crossAxis * crossAxisMulti,
|
|
1409
|
-
y: mainAxis * mainAxisMulti
|
|
1410
|
-
} : {
|
|
1411
|
-
x: mainAxis * mainAxisMulti,
|
|
1412
|
-
y: crossAxis * crossAxisMulti
|
|
1413
|
-
};
|
|
1414
|
-
}
|
|
1415
|
-
var offset = function(options) {
|
|
1416
|
-
if (options === void 0) {
|
|
1417
|
-
options = 0;
|
|
1418
|
-
}
|
|
1419
|
-
return {
|
|
1420
|
-
name: "offset",
|
|
1421
|
-
options,
|
|
1422
|
-
async fn(state) {
|
|
1423
|
-
var _middlewareData$offse, _middlewareData$arrow;
|
|
1424
|
-
const {
|
|
1425
|
-
x,
|
|
1426
|
-
y,
|
|
1427
|
-
placement,
|
|
1428
|
-
middlewareData
|
|
1429
|
-
} = state;
|
|
1430
|
-
const diffCoords = await convertValueToCoords(state, options);
|
|
1431
|
-
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
1432
|
-
return {};
|
|
1433
|
-
}
|
|
1434
|
-
return {
|
|
1435
|
-
x: x + diffCoords.x,
|
|
1436
|
-
y: y + diffCoords.y,
|
|
1437
|
-
data: {
|
|
1438
|
-
...diffCoords,
|
|
1439
|
-
placement
|
|
1440
|
-
}
|
|
1441
|
-
};
|
|
1442
|
-
}
|
|
1443
|
-
};
|
|
1444
|
-
};
|
|
1445
|
-
var shift = function(options) {
|
|
1446
|
-
if (options === void 0) {
|
|
1447
|
-
options = {};
|
|
1448
|
-
}
|
|
1449
|
-
return {
|
|
1450
|
-
name: "shift",
|
|
1451
|
-
options,
|
|
1452
|
-
async fn(state) {
|
|
1453
|
-
const {
|
|
1454
|
-
x,
|
|
1455
|
-
y,
|
|
1456
|
-
placement
|
|
1457
|
-
} = state;
|
|
1458
|
-
const {
|
|
1459
|
-
mainAxis: checkMainAxis = true,
|
|
1460
|
-
crossAxis: checkCrossAxis = false,
|
|
1461
|
-
limiter = {
|
|
1462
|
-
fn: (_ref) => {
|
|
1463
|
-
let {
|
|
1464
|
-
x: x2,
|
|
1465
|
-
y: y2
|
|
1466
|
-
} = _ref;
|
|
1467
|
-
return {
|
|
1468
|
-
x: x2,
|
|
1469
|
-
y: y2
|
|
1470
|
-
};
|
|
1471
|
-
}
|
|
1472
|
-
},
|
|
1473
|
-
...detectOverflowOptions
|
|
1474
|
-
} = evaluate(options, state);
|
|
1475
|
-
const coords = {
|
|
1476
|
-
x,
|
|
1477
|
-
y
|
|
1478
|
-
};
|
|
1479
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1480
|
-
const crossAxis = getSideAxis(getSide(placement));
|
|
1481
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
1482
|
-
let mainAxisCoord = coords[mainAxis];
|
|
1483
|
-
let crossAxisCoord = coords[crossAxis];
|
|
1484
|
-
if (checkMainAxis) {
|
|
1485
|
-
const minSide = mainAxis === "y" ? "top" : "left";
|
|
1486
|
-
const maxSide = mainAxis === "y" ? "bottom" : "right";
|
|
1487
|
-
const min2 = mainAxisCoord + overflow[minSide];
|
|
1488
|
-
const max2 = mainAxisCoord - overflow[maxSide];
|
|
1489
|
-
mainAxisCoord = clamp2(min2, mainAxisCoord, max2);
|
|
1490
|
-
}
|
|
1491
|
-
if (checkCrossAxis) {
|
|
1492
|
-
const minSide = crossAxis === "y" ? "top" : "left";
|
|
1493
|
-
const maxSide = crossAxis === "y" ? "bottom" : "right";
|
|
1494
|
-
const min2 = crossAxisCoord + overflow[minSide];
|
|
1495
|
-
const max2 = crossAxisCoord - overflow[maxSide];
|
|
1496
|
-
crossAxisCoord = clamp2(min2, crossAxisCoord, max2);
|
|
1497
|
-
}
|
|
1498
|
-
const limitedCoords = limiter.fn({
|
|
1499
|
-
...state,
|
|
1500
|
-
[mainAxis]: mainAxisCoord,
|
|
1501
|
-
[crossAxis]: crossAxisCoord
|
|
1502
|
-
});
|
|
1503
|
-
return {
|
|
1504
|
-
...limitedCoords,
|
|
1505
|
-
data: {
|
|
1506
|
-
x: limitedCoords.x - x,
|
|
1507
|
-
y: limitedCoords.y - y,
|
|
1508
|
-
enabled: {
|
|
1509
|
-
[mainAxis]: checkMainAxis,
|
|
1510
|
-
[crossAxis]: checkCrossAxis
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
};
|
|
1516
|
-
};
|
|
1517
|
-
var limitShift = function(options) {
|
|
1518
|
-
if (options === void 0) {
|
|
1519
|
-
options = {};
|
|
1520
|
-
}
|
|
1521
|
-
return {
|
|
1522
|
-
options,
|
|
1523
|
-
fn(state) {
|
|
1524
|
-
const {
|
|
1525
|
-
x,
|
|
1526
|
-
y,
|
|
1527
|
-
placement,
|
|
1528
|
-
rects,
|
|
1529
|
-
middlewareData
|
|
1530
|
-
} = state;
|
|
1531
|
-
const {
|
|
1532
|
-
offset: offset4 = 0,
|
|
1533
|
-
mainAxis: checkMainAxis = true,
|
|
1534
|
-
crossAxis: checkCrossAxis = true
|
|
1535
|
-
} = evaluate(options, state);
|
|
1536
|
-
const coords = {
|
|
1537
|
-
x,
|
|
1538
|
-
y
|
|
1539
|
-
};
|
|
1540
|
-
const crossAxis = getSideAxis(placement);
|
|
1541
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
1542
|
-
let mainAxisCoord = coords[mainAxis];
|
|
1543
|
-
let crossAxisCoord = coords[crossAxis];
|
|
1544
|
-
const rawOffset = evaluate(offset4, state);
|
|
1545
|
-
const computedOffset = typeof rawOffset === "number" ? {
|
|
1546
|
-
mainAxis: rawOffset,
|
|
1547
|
-
crossAxis: 0
|
|
1548
|
-
} : {
|
|
1549
|
-
mainAxis: 0,
|
|
1550
|
-
crossAxis: 0,
|
|
1551
|
-
...rawOffset
|
|
1552
|
-
};
|
|
1553
|
-
if (checkMainAxis) {
|
|
1554
|
-
const len = mainAxis === "y" ? "height" : "width";
|
|
1555
|
-
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
|
|
1556
|
-
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
|
|
1557
|
-
if (mainAxisCoord < limitMin) {
|
|
1558
|
-
mainAxisCoord = limitMin;
|
|
1559
|
-
} else if (mainAxisCoord > limitMax) {
|
|
1560
|
-
mainAxisCoord = limitMax;
|
|
1561
|
-
}
|
|
1562
|
-
}
|
|
1563
|
-
if (checkCrossAxis) {
|
|
1564
|
-
var _middlewareData$offse, _middlewareData$offse2;
|
|
1565
|
-
const len = mainAxis === "y" ? "width" : "height";
|
|
1566
|
-
const isOriginSide = originSides.has(getSide(placement));
|
|
1567
|
-
const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
|
|
1568
|
-
const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
|
|
1569
|
-
if (crossAxisCoord < limitMin) {
|
|
1570
|
-
crossAxisCoord = limitMin;
|
|
1571
|
-
} else if (crossAxisCoord > limitMax) {
|
|
1572
|
-
crossAxisCoord = limitMax;
|
|
1573
|
-
}
|
|
1574
|
-
}
|
|
1575
|
-
return {
|
|
1576
|
-
[mainAxis]: mainAxisCoord,
|
|
1577
|
-
[crossAxis]: crossAxisCoord
|
|
1578
|
-
};
|
|
1579
|
-
}
|
|
1580
|
-
};
|
|
1581
|
-
};
|
|
1582
|
-
var size = function(options) {
|
|
1583
|
-
if (options === void 0) {
|
|
1584
|
-
options = {};
|
|
1585
|
-
}
|
|
1586
|
-
return {
|
|
1587
|
-
name: "size",
|
|
1588
|
-
options,
|
|
1589
|
-
async fn(state) {
|
|
1590
|
-
var _state$middlewareData, _state$middlewareData2;
|
|
1591
|
-
const {
|
|
1592
|
-
placement,
|
|
1593
|
-
rects,
|
|
1594
|
-
platform: platform2,
|
|
1595
|
-
elements
|
|
1596
|
-
} = state;
|
|
1597
|
-
const {
|
|
1598
|
-
apply = () => {
|
|
1599
|
-
},
|
|
1600
|
-
...detectOverflowOptions
|
|
1601
|
-
} = evaluate(options, state);
|
|
1602
|
-
const overflow = await detectOverflow(state, detectOverflowOptions);
|
|
1603
|
-
const side = getSide(placement);
|
|
1604
|
-
const alignment = getAlignment(placement);
|
|
1605
|
-
const isYAxis = getSideAxis(placement) === "y";
|
|
1606
|
-
const {
|
|
1607
|
-
width,
|
|
1608
|
-
height
|
|
1609
|
-
} = rects.floating;
|
|
1610
|
-
let heightSide;
|
|
1611
|
-
let widthSide;
|
|
1612
|
-
if (side === "top" || side === "bottom") {
|
|
1613
|
-
heightSide = side;
|
|
1614
|
-
widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
|
|
1615
|
-
} else {
|
|
1616
|
-
widthSide = side;
|
|
1617
|
-
heightSide = alignment === "end" ? "top" : "bottom";
|
|
1618
|
-
}
|
|
1619
|
-
const maximumClippingHeight = height - overflow.top - overflow.bottom;
|
|
1620
|
-
const maximumClippingWidth = width - overflow.left - overflow.right;
|
|
1621
|
-
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
|
|
1622
|
-
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
|
|
1623
|
-
const noShift = !state.middlewareData.shift;
|
|
1624
|
-
let availableHeight = overflowAvailableHeight;
|
|
1625
|
-
let availableWidth = overflowAvailableWidth;
|
|
1626
|
-
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
|
|
1627
|
-
availableWidth = maximumClippingWidth;
|
|
1628
|
-
}
|
|
1629
|
-
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
|
|
1630
|
-
availableHeight = maximumClippingHeight;
|
|
1631
|
-
}
|
|
1632
|
-
if (noShift && !alignment) {
|
|
1633
|
-
const xMin = max(overflow.left, 0);
|
|
1634
|
-
const xMax = max(overflow.right, 0);
|
|
1635
|
-
const yMin = max(overflow.top, 0);
|
|
1636
|
-
const yMax = max(overflow.bottom, 0);
|
|
1637
|
-
if (isYAxis) {
|
|
1638
|
-
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
|
|
1639
|
-
} else {
|
|
1640
|
-
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
await apply({
|
|
1644
|
-
...state,
|
|
1645
|
-
availableWidth,
|
|
1646
|
-
availableHeight
|
|
1647
|
-
});
|
|
1648
|
-
const nextDimensions = await platform2.getDimensions(elements.floating);
|
|
1649
|
-
if (width !== nextDimensions.width || height !== nextDimensions.height) {
|
|
1650
|
-
return {
|
|
1651
|
-
reset: {
|
|
1652
|
-
rects: true
|
|
1653
|
-
}
|
|
1654
|
-
};
|
|
1655
|
-
}
|
|
1656
|
-
return {};
|
|
1657
|
-
}
|
|
1658
|
-
};
|
|
1659
|
-
};
|
|
1660
|
-
|
|
1661
|
-
// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
|
|
1662
|
-
function hasWindow() {
|
|
1663
|
-
return typeof window !== "undefined";
|
|
1664
|
-
}
|
|
1665
|
-
function getNodeName(node) {
|
|
1666
|
-
if (isNode(node)) {
|
|
1667
|
-
return (node.nodeName || "").toLowerCase();
|
|
1668
|
-
}
|
|
1669
|
-
return "#document";
|
|
1670
|
-
}
|
|
1671
|
-
function getWindow(node) {
|
|
1672
|
-
var _node$ownerDocument;
|
|
1673
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
1674
|
-
}
|
|
1675
|
-
function getDocumentElement(node) {
|
|
1676
|
-
var _ref;
|
|
1677
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
1678
|
-
}
|
|
1679
|
-
function isNode(value) {
|
|
1680
|
-
if (!hasWindow()) {
|
|
1681
|
-
return false;
|
|
1682
|
-
}
|
|
1683
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1684
|
-
}
|
|
1685
|
-
function isElement(value) {
|
|
1686
|
-
if (!hasWindow()) {
|
|
1687
|
-
return false;
|
|
1688
|
-
}
|
|
1689
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1690
|
-
}
|
|
1691
|
-
function isHTMLElement(value) {
|
|
1692
|
-
if (!hasWindow()) {
|
|
1693
|
-
return false;
|
|
1694
|
-
}
|
|
1695
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1696
|
-
}
|
|
1697
|
-
function isShadowRoot(value) {
|
|
1698
|
-
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
1699
|
-
return false;
|
|
1700
|
-
}
|
|
1701
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1702
|
-
}
|
|
1703
|
-
var invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
|
|
1704
|
-
function isOverflowElement(element) {
|
|
1705
|
-
const {
|
|
1706
|
-
overflow,
|
|
1707
|
-
overflowX,
|
|
1708
|
-
overflowY,
|
|
1709
|
-
display
|
|
1710
|
-
} = getComputedStyle2(element);
|
|
1711
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
|
|
1712
|
-
}
|
|
1713
|
-
var tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
|
|
1714
|
-
function isTableElement(element) {
|
|
1715
|
-
return tableElements.has(getNodeName(element));
|
|
1716
|
-
}
|
|
1717
|
-
var topLayerSelectors = [":popover-open", ":modal"];
|
|
1718
|
-
function isTopLayer(element) {
|
|
1719
|
-
return topLayerSelectors.some((selector) => {
|
|
1720
|
-
try {
|
|
1721
|
-
return element.matches(selector);
|
|
1722
|
-
} catch (_e) {
|
|
1723
|
-
return false;
|
|
1724
|
-
}
|
|
1725
|
-
});
|
|
1726
|
-
}
|
|
1727
|
-
var transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
|
|
1728
|
-
var willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
|
|
1729
|
-
var containValues = ["paint", "layout", "strict", "content"];
|
|
1730
|
-
function isContainingBlock(elementOrCss) {
|
|
1731
|
-
const webkit = isWebKit();
|
|
1732
|
-
const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss;
|
|
1733
|
-
return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value));
|
|
1734
|
-
}
|
|
1735
|
-
function getContainingBlock(element) {
|
|
1736
|
-
let currentNode = getParentNode(element);
|
|
1737
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
1738
|
-
if (isContainingBlock(currentNode)) {
|
|
1739
|
-
return currentNode;
|
|
1740
|
-
} else if (isTopLayer(currentNode)) {
|
|
1741
|
-
return null;
|
|
1742
|
-
}
|
|
1743
|
-
currentNode = getParentNode(currentNode);
|
|
1744
|
-
}
|
|
1745
|
-
return null;
|
|
1746
|
-
}
|
|
1747
|
-
function isWebKit() {
|
|
1748
|
-
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
1749
|
-
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
1750
|
-
}
|
|
1751
|
-
var lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
|
|
1752
|
-
function isLastTraversableNode(node) {
|
|
1753
|
-
return lastTraversableNodeNames.has(getNodeName(node));
|
|
1754
|
-
}
|
|
1755
|
-
function getComputedStyle2(element) {
|
|
1756
|
-
return getWindow(element).getComputedStyle(element);
|
|
1757
|
-
}
|
|
1758
|
-
function getNodeScroll(element) {
|
|
1759
|
-
if (isElement(element)) {
|
|
1760
|
-
return {
|
|
1761
|
-
scrollLeft: element.scrollLeft,
|
|
1762
|
-
scrollTop: element.scrollTop
|
|
1763
|
-
};
|
|
1764
|
-
}
|
|
1765
|
-
return {
|
|
1766
|
-
scrollLeft: element.scrollX,
|
|
1767
|
-
scrollTop: element.scrollY
|
|
1768
|
-
};
|
|
1769
|
-
}
|
|
1770
|
-
function getParentNode(node) {
|
|
1771
|
-
if (getNodeName(node) === "html") {
|
|
1772
|
-
return node;
|
|
1773
|
-
}
|
|
1774
|
-
const result = (
|
|
1775
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
1776
|
-
node.assignedSlot || // DOM Element detected.
|
|
1777
|
-
node.parentNode || // ShadowRoot detected.
|
|
1778
|
-
isShadowRoot(node) && node.host || // Fallback.
|
|
1779
|
-
getDocumentElement(node)
|
|
1780
|
-
);
|
|
1781
|
-
return isShadowRoot(result) ? result.host : result;
|
|
1782
|
-
}
|
|
1783
|
-
function getNearestOverflowAncestor(node) {
|
|
1784
|
-
const parentNode = getParentNode(node);
|
|
1785
|
-
if (isLastTraversableNode(parentNode)) {
|
|
1786
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
1787
|
-
}
|
|
1788
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
1789
|
-
return parentNode;
|
|
1790
|
-
}
|
|
1791
|
-
return getNearestOverflowAncestor(parentNode);
|
|
1792
|
-
}
|
|
1793
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
1794
|
-
var _node$ownerDocument2;
|
|
1795
|
-
if (list === void 0) {
|
|
1796
|
-
list = [];
|
|
1797
|
-
}
|
|
1798
|
-
if (traverseIframes === void 0) {
|
|
1799
|
-
traverseIframes = true;
|
|
1800
|
-
}
|
|
1801
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
1802
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
1803
|
-
const win = getWindow(scrollableAncestor);
|
|
1804
|
-
if (isBody) {
|
|
1805
|
-
const frameElement = getFrameElement(win);
|
|
1806
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
1807
|
-
}
|
|
1808
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
1809
|
-
}
|
|
1810
|
-
function getFrameElement(win) {
|
|
1811
|
-
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
|
|
1815
|
-
function getCssDimensions(element) {
|
|
1816
|
-
const css = getComputedStyle2(element);
|
|
1817
|
-
let width = parseFloat(css.width) || 0;
|
|
1818
|
-
let height = parseFloat(css.height) || 0;
|
|
1819
|
-
const hasOffset = isHTMLElement(element);
|
|
1820
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
1821
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
1822
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
1823
|
-
if (shouldFallback) {
|
|
1824
|
-
width = offsetWidth;
|
|
1825
|
-
height = offsetHeight;
|
|
1826
|
-
}
|
|
1827
|
-
return {
|
|
1828
|
-
width,
|
|
1829
|
-
height,
|
|
1830
|
-
$: shouldFallback
|
|
1831
|
-
};
|
|
1832
|
-
}
|
|
1833
|
-
function unwrapElement(element) {
|
|
1834
|
-
return !isElement(element) ? element.contextElement : element;
|
|
1835
|
-
}
|
|
1836
|
-
function getScale(element) {
|
|
1837
|
-
const domElement = unwrapElement(element);
|
|
1838
|
-
if (!isHTMLElement(domElement)) {
|
|
1839
|
-
return createCoords(1);
|
|
1840
|
-
}
|
|
1841
|
-
const rect = domElement.getBoundingClientRect();
|
|
1842
|
-
const {
|
|
1843
|
-
width,
|
|
1844
|
-
height,
|
|
1845
|
-
$
|
|
1846
|
-
} = getCssDimensions(domElement);
|
|
1847
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
1848
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
1849
|
-
if (!x || !Number.isFinite(x)) {
|
|
1850
|
-
x = 1;
|
|
1851
|
-
}
|
|
1852
|
-
if (!y || !Number.isFinite(y)) {
|
|
1853
|
-
y = 1;
|
|
1854
|
-
}
|
|
1855
|
-
return {
|
|
1856
|
-
x,
|
|
1857
|
-
y
|
|
1858
|
-
};
|
|
1859
|
-
}
|
|
1860
|
-
var noOffsets = /* @__PURE__ */ createCoords(0);
|
|
1861
|
-
function getVisualOffsets(element) {
|
|
1862
|
-
const win = getWindow(element);
|
|
1863
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
1864
|
-
return noOffsets;
|
|
1865
|
-
}
|
|
1866
|
-
return {
|
|
1867
|
-
x: win.visualViewport.offsetLeft,
|
|
1868
|
-
y: win.visualViewport.offsetTop
|
|
1869
|
-
};
|
|
1870
|
-
}
|
|
1871
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
1872
|
-
if (isFixed === void 0) {
|
|
1873
|
-
isFixed = false;
|
|
1874
|
-
}
|
|
1875
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
1876
|
-
return false;
|
|
1877
|
-
}
|
|
1878
|
-
return isFixed;
|
|
1879
|
-
}
|
|
1880
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
1881
|
-
if (includeScale === void 0) {
|
|
1882
|
-
includeScale = false;
|
|
1883
|
-
}
|
|
1884
|
-
if (isFixedStrategy === void 0) {
|
|
1885
|
-
isFixedStrategy = false;
|
|
1886
|
-
}
|
|
1887
|
-
const clientRect = element.getBoundingClientRect();
|
|
1888
|
-
const domElement = unwrapElement(element);
|
|
1889
|
-
let scale = createCoords(1);
|
|
1890
|
-
if (includeScale) {
|
|
1891
|
-
if (offsetParent) {
|
|
1892
|
-
if (isElement(offsetParent)) {
|
|
1893
|
-
scale = getScale(offsetParent);
|
|
1894
|
-
}
|
|
1895
|
-
} else {
|
|
1896
|
-
scale = getScale(element);
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
1900
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
1901
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
1902
|
-
let width = clientRect.width / scale.x;
|
|
1903
|
-
let height = clientRect.height / scale.y;
|
|
1904
|
-
if (domElement) {
|
|
1905
|
-
const win = getWindow(domElement);
|
|
1906
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
1907
|
-
let currentWin = win;
|
|
1908
|
-
let currentIFrame = getFrameElement(currentWin);
|
|
1909
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
1910
|
-
const iframeScale = getScale(currentIFrame);
|
|
1911
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
1912
|
-
const css = getComputedStyle2(currentIFrame);
|
|
1913
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
1914
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
1915
|
-
x *= iframeScale.x;
|
|
1916
|
-
y *= iframeScale.y;
|
|
1917
|
-
width *= iframeScale.x;
|
|
1918
|
-
height *= iframeScale.y;
|
|
1919
|
-
x += left;
|
|
1920
|
-
y += top;
|
|
1921
|
-
currentWin = getWindow(currentIFrame);
|
|
1922
|
-
currentIFrame = getFrameElement(currentWin);
|
|
1923
|
-
}
|
|
1924
|
-
}
|
|
1925
|
-
return rectToClientRect({
|
|
1926
|
-
width,
|
|
1927
|
-
height,
|
|
1928
|
-
x,
|
|
1929
|
-
y
|
|
1930
|
-
});
|
|
1931
|
-
}
|
|
1932
|
-
function getWindowScrollBarX(element, rect) {
|
|
1933
|
-
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
1934
|
-
if (!rect) {
|
|
1935
|
-
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
1936
|
-
}
|
|
1937
|
-
return rect.left + leftScroll;
|
|
1938
|
-
}
|
|
1939
|
-
function getHTMLOffset(documentElement, scroll) {
|
|
1940
|
-
const htmlRect = documentElement.getBoundingClientRect();
|
|
1941
|
-
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
1942
|
-
const y = htmlRect.top + scroll.scrollTop;
|
|
1943
|
-
return {
|
|
1944
|
-
x,
|
|
1945
|
-
y
|
|
1946
|
-
};
|
|
1947
|
-
}
|
|
1948
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
1949
|
-
let {
|
|
1950
|
-
elements,
|
|
1951
|
-
rect,
|
|
1952
|
-
offsetParent,
|
|
1953
|
-
strategy
|
|
1954
|
-
} = _ref;
|
|
1955
|
-
const isFixed = strategy === "fixed";
|
|
1956
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
1957
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
1958
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
1959
|
-
return rect;
|
|
1960
|
-
}
|
|
1961
|
-
let scroll = {
|
|
1962
|
-
scrollLeft: 0,
|
|
1963
|
-
scrollTop: 0
|
|
1964
|
-
};
|
|
1965
|
-
let scale = createCoords(1);
|
|
1966
|
-
const offsets = createCoords(0);
|
|
1967
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
1968
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
1969
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
1970
|
-
scroll = getNodeScroll(offsetParent);
|
|
1971
|
-
}
|
|
1972
|
-
if (isHTMLElement(offsetParent)) {
|
|
1973
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
1974
|
-
scale = getScale(offsetParent);
|
|
1975
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
1976
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
1980
|
-
return {
|
|
1981
|
-
width: rect.width * scale.x,
|
|
1982
|
-
height: rect.height * scale.y,
|
|
1983
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
1984
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
1985
|
-
};
|
|
1986
|
-
}
|
|
1987
|
-
function getClientRects(element) {
|
|
1988
|
-
return Array.from(element.getClientRects());
|
|
1989
|
-
}
|
|
1990
|
-
function getDocumentRect(element) {
|
|
1991
|
-
const html = getDocumentElement(element);
|
|
1992
|
-
const scroll = getNodeScroll(element);
|
|
1993
|
-
const body = element.ownerDocument.body;
|
|
1994
|
-
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
1995
|
-
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
1996
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
1997
|
-
const y = -scroll.scrollTop;
|
|
1998
|
-
if (getComputedStyle2(body).direction === "rtl") {
|
|
1999
|
-
x += max(html.clientWidth, body.clientWidth) - width;
|
|
2000
|
-
}
|
|
2001
|
-
return {
|
|
2002
|
-
width,
|
|
2003
|
-
height,
|
|
2004
|
-
x,
|
|
2005
|
-
y
|
|
2006
|
-
};
|
|
2007
|
-
}
|
|
2008
|
-
var SCROLLBAR_MAX = 25;
|
|
2009
|
-
function getViewportRect(element, strategy) {
|
|
2010
|
-
const win = getWindow(element);
|
|
2011
|
-
const html = getDocumentElement(element);
|
|
2012
|
-
const visualViewport = win.visualViewport;
|
|
2013
|
-
let width = html.clientWidth;
|
|
2014
|
-
let height = html.clientHeight;
|
|
2015
|
-
let x = 0;
|
|
2016
|
-
let y = 0;
|
|
2017
|
-
if (visualViewport) {
|
|
2018
|
-
width = visualViewport.width;
|
|
2019
|
-
height = visualViewport.height;
|
|
2020
|
-
const visualViewportBased = isWebKit();
|
|
2021
|
-
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
2022
|
-
x = visualViewport.offsetLeft;
|
|
2023
|
-
y = visualViewport.offsetTop;
|
|
2024
|
-
}
|
|
2025
|
-
}
|
|
2026
|
-
const windowScrollbarX = getWindowScrollBarX(html);
|
|
2027
|
-
if (windowScrollbarX <= 0) {
|
|
2028
|
-
const doc = html.ownerDocument;
|
|
2029
|
-
const body = doc.body;
|
|
2030
|
-
const bodyStyles = getComputedStyle(body);
|
|
2031
|
-
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
2032
|
-
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
2033
|
-
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
2034
|
-
width -= clippingStableScrollbarWidth;
|
|
2035
|
-
}
|
|
2036
|
-
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
2037
|
-
width += windowScrollbarX;
|
|
2038
|
-
}
|
|
2039
|
-
return {
|
|
2040
|
-
width,
|
|
2041
|
-
height,
|
|
2042
|
-
x,
|
|
2043
|
-
y
|
|
2044
|
-
};
|
|
2045
|
-
}
|
|
2046
|
-
var absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
|
|
2047
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
2048
|
-
const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
|
|
2049
|
-
const top = clientRect.top + element.clientTop;
|
|
2050
|
-
const left = clientRect.left + element.clientLeft;
|
|
2051
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
2052
|
-
const width = element.clientWidth * scale.x;
|
|
2053
|
-
const height = element.clientHeight * scale.y;
|
|
2054
|
-
const x = left * scale.x;
|
|
2055
|
-
const y = top * scale.y;
|
|
2056
|
-
return {
|
|
2057
|
-
width,
|
|
2058
|
-
height,
|
|
2059
|
-
x,
|
|
2060
|
-
y
|
|
2061
|
-
};
|
|
2062
|
-
}
|
|
2063
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
2064
|
-
let rect;
|
|
2065
|
-
if (clippingAncestor === "viewport") {
|
|
2066
|
-
rect = getViewportRect(element, strategy);
|
|
2067
|
-
} else if (clippingAncestor === "document") {
|
|
2068
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
2069
|
-
} else if (isElement(clippingAncestor)) {
|
|
2070
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
2071
|
-
} else {
|
|
2072
|
-
const visualOffsets = getVisualOffsets(element);
|
|
2073
|
-
rect = {
|
|
2074
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
2075
|
-
y: clippingAncestor.y - visualOffsets.y,
|
|
2076
|
-
width: clippingAncestor.width,
|
|
2077
|
-
height: clippingAncestor.height
|
|
2078
|
-
};
|
|
2079
|
-
}
|
|
2080
|
-
return rectToClientRect(rect);
|
|
2081
|
-
}
|
|
2082
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
2083
|
-
const parentNode = getParentNode(element);
|
|
2084
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
2085
|
-
return false;
|
|
2086
|
-
}
|
|
2087
|
-
return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
|
|
2088
|
-
}
|
|
2089
|
-
function getClippingElementAncestors(element, cache) {
|
|
2090
|
-
const cachedResult = cache.get(element);
|
|
2091
|
-
if (cachedResult) {
|
|
2092
|
-
return cachedResult;
|
|
2093
|
-
}
|
|
2094
|
-
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
|
|
2095
|
-
let currentContainingBlockComputedStyle = null;
|
|
2096
|
-
const elementIsFixed = getComputedStyle2(element).position === "fixed";
|
|
2097
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
2098
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
2099
|
-
const computedStyle = getComputedStyle2(currentNode);
|
|
2100
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
2101
|
-
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
2102
|
-
currentContainingBlockComputedStyle = null;
|
|
2103
|
-
}
|
|
2104
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
2105
|
-
if (shouldDropCurrentNode) {
|
|
2106
|
-
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
2107
|
-
} else {
|
|
2108
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
2109
|
-
}
|
|
2110
|
-
currentNode = getParentNode(currentNode);
|
|
2111
|
-
}
|
|
2112
|
-
cache.set(element, result);
|
|
2113
|
-
return result;
|
|
2114
|
-
}
|
|
2115
|
-
function getClippingRect(_ref) {
|
|
2116
|
-
let {
|
|
2117
|
-
element,
|
|
2118
|
-
boundary,
|
|
2119
|
-
rootBoundary,
|
|
2120
|
-
strategy
|
|
2121
|
-
} = _ref;
|
|
2122
|
-
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
2123
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
2124
|
-
const firstClippingAncestor = clippingAncestors[0];
|
|
2125
|
-
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
2126
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
2127
|
-
accRect.top = max(rect.top, accRect.top);
|
|
2128
|
-
accRect.right = min(rect.right, accRect.right);
|
|
2129
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
2130
|
-
accRect.left = max(rect.left, accRect.left);
|
|
2131
|
-
return accRect;
|
|
2132
|
-
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
2133
|
-
return {
|
|
2134
|
-
width: clippingRect.right - clippingRect.left,
|
|
2135
|
-
height: clippingRect.bottom - clippingRect.top,
|
|
2136
|
-
x: clippingRect.left,
|
|
2137
|
-
y: clippingRect.top
|
|
2138
|
-
};
|
|
2139
|
-
}
|
|
2140
|
-
function getDimensions(element) {
|
|
2141
|
-
const {
|
|
2142
|
-
width,
|
|
2143
|
-
height
|
|
2144
|
-
} = getCssDimensions(element);
|
|
2145
|
-
return {
|
|
2146
|
-
width,
|
|
2147
|
-
height
|
|
2148
|
-
};
|
|
2149
|
-
}
|
|
2150
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
2151
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
2152
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
2153
|
-
const isFixed = strategy === "fixed";
|
|
2154
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
2155
|
-
let scroll = {
|
|
2156
|
-
scrollLeft: 0,
|
|
2157
|
-
scrollTop: 0
|
|
2158
|
-
};
|
|
2159
|
-
const offsets = createCoords(0);
|
|
2160
|
-
function setLeftRTLScrollbarOffset() {
|
|
2161
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
2162
|
-
}
|
|
2163
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
2164
|
-
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
2165
|
-
scroll = getNodeScroll(offsetParent);
|
|
2166
|
-
}
|
|
2167
|
-
if (isOffsetParentAnElement) {
|
|
2168
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
2169
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
2170
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
2171
|
-
} else if (documentElement) {
|
|
2172
|
-
setLeftRTLScrollbarOffset();
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
2176
|
-
setLeftRTLScrollbarOffset();
|
|
2177
|
-
}
|
|
2178
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
2179
|
-
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
2180
|
-
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
2181
|
-
return {
|
|
2182
|
-
x,
|
|
2183
|
-
y,
|
|
2184
|
-
width: rect.width,
|
|
2185
|
-
height: rect.height
|
|
2186
|
-
};
|
|
2187
|
-
}
|
|
2188
|
-
function isStaticPositioned(element) {
|
|
2189
|
-
return getComputedStyle2(element).position === "static";
|
|
2190
|
-
}
|
|
2191
|
-
function getTrueOffsetParent(element, polyfill) {
|
|
2192
|
-
if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") {
|
|
2193
|
-
return null;
|
|
2194
|
-
}
|
|
2195
|
-
if (polyfill) {
|
|
2196
|
-
return polyfill(element);
|
|
2197
|
-
}
|
|
2198
|
-
let rawOffsetParent = element.offsetParent;
|
|
2199
|
-
if (getDocumentElement(element) === rawOffsetParent) {
|
|
2200
|
-
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
2201
|
-
}
|
|
2202
|
-
return rawOffsetParent;
|
|
2203
|
-
}
|
|
2204
|
-
function getOffsetParent(element, polyfill) {
|
|
2205
|
-
const win = getWindow(element);
|
|
2206
|
-
if (isTopLayer(element)) {
|
|
2207
|
-
return win;
|
|
2208
|
-
}
|
|
2209
|
-
if (!isHTMLElement(element)) {
|
|
2210
|
-
let svgOffsetParent = getParentNode(element);
|
|
2211
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
2212
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
2213
|
-
return svgOffsetParent;
|
|
2214
|
-
}
|
|
2215
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
2216
|
-
}
|
|
2217
|
-
return win;
|
|
2218
|
-
}
|
|
2219
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
2220
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
2221
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
2222
|
-
}
|
|
2223
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
2224
|
-
return win;
|
|
2225
|
-
}
|
|
2226
|
-
return offsetParent || getContainingBlock(element) || win;
|
|
2227
|
-
}
|
|
2228
|
-
var getElementRects = async function(data) {
|
|
2229
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
2230
|
-
const getDimensionsFn = this.getDimensions;
|
|
2231
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
2232
|
-
return {
|
|
2233
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
2234
|
-
floating: {
|
|
2235
|
-
x: 0,
|
|
2236
|
-
y: 0,
|
|
2237
|
-
width: floatingDimensions.width,
|
|
2238
|
-
height: floatingDimensions.height
|
|
2239
|
-
}
|
|
2240
|
-
};
|
|
2241
|
-
};
|
|
2242
|
-
function isRTL(element) {
|
|
2243
|
-
return getComputedStyle2(element).direction === "rtl";
|
|
2244
|
-
}
|
|
2245
|
-
var platform = {
|
|
2246
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
2247
|
-
getDocumentElement,
|
|
2248
|
-
getClippingRect,
|
|
2249
|
-
getOffsetParent,
|
|
2250
|
-
getElementRects,
|
|
2251
|
-
getClientRects,
|
|
2252
|
-
getDimensions,
|
|
2253
|
-
getScale,
|
|
2254
|
-
isElement,
|
|
2255
|
-
isRTL
|
|
2256
|
-
};
|
|
2257
|
-
function rectsAreEqual(a, b) {
|
|
2258
|
-
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
2259
|
-
}
|
|
2260
|
-
function observeMove(element, onMove) {
|
|
2261
|
-
let io = null;
|
|
2262
|
-
let timeoutId;
|
|
2263
|
-
const root = getDocumentElement(element);
|
|
2264
|
-
function cleanup() {
|
|
2265
|
-
var _io;
|
|
2266
|
-
clearTimeout(timeoutId);
|
|
2267
|
-
(_io = io) == null || _io.disconnect();
|
|
2268
|
-
io = null;
|
|
2269
|
-
}
|
|
2270
|
-
function refresh(skip, threshold) {
|
|
2271
|
-
if (skip === void 0) {
|
|
2272
|
-
skip = false;
|
|
2273
|
-
}
|
|
2274
|
-
if (threshold === void 0) {
|
|
2275
|
-
threshold = 1;
|
|
2276
|
-
}
|
|
2277
|
-
cleanup();
|
|
2278
|
-
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
2279
|
-
const {
|
|
2280
|
-
left,
|
|
2281
|
-
top,
|
|
2282
|
-
width,
|
|
2283
|
-
height
|
|
2284
|
-
} = elementRectForRootMargin;
|
|
2285
|
-
if (!skip) {
|
|
2286
|
-
onMove();
|
|
2287
|
-
}
|
|
2288
|
-
if (!width || !height) {
|
|
2289
|
-
return;
|
|
2290
|
-
}
|
|
2291
|
-
const insetTop = floor(top);
|
|
2292
|
-
const insetRight = floor(root.clientWidth - (left + width));
|
|
2293
|
-
const insetBottom = floor(root.clientHeight - (top + height));
|
|
2294
|
-
const insetLeft = floor(left);
|
|
2295
|
-
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
2296
|
-
const options = {
|
|
2297
|
-
rootMargin,
|
|
2298
|
-
threshold: max(0, min(1, threshold)) || 1
|
|
2299
|
-
};
|
|
2300
|
-
let isFirstUpdate = true;
|
|
2301
|
-
function handleObserve(entries) {
|
|
2302
|
-
const ratio = entries[0].intersectionRatio;
|
|
2303
|
-
if (ratio !== threshold) {
|
|
2304
|
-
if (!isFirstUpdate) {
|
|
2305
|
-
return refresh();
|
|
2306
|
-
}
|
|
2307
|
-
if (!ratio) {
|
|
2308
|
-
timeoutId = setTimeout(() => {
|
|
2309
|
-
refresh(false, 1e-7);
|
|
2310
|
-
}, 1e3);
|
|
2311
|
-
} else {
|
|
2312
|
-
refresh(false, ratio);
|
|
2313
|
-
}
|
|
2314
|
-
}
|
|
2315
|
-
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
2316
|
-
refresh();
|
|
2317
|
-
}
|
|
2318
|
-
isFirstUpdate = false;
|
|
2319
|
-
}
|
|
2320
|
-
try {
|
|
2321
|
-
io = new IntersectionObserver(handleObserve, {
|
|
2322
|
-
...options,
|
|
2323
|
-
// Handle <iframe>s
|
|
2324
|
-
root: root.ownerDocument
|
|
2325
|
-
});
|
|
2326
|
-
} catch (_e) {
|
|
2327
|
-
io = new IntersectionObserver(handleObserve, options);
|
|
2328
|
-
}
|
|
2329
|
-
io.observe(element);
|
|
2330
|
-
}
|
|
2331
|
-
refresh(true);
|
|
2332
|
-
return cleanup;
|
|
2333
|
-
}
|
|
2334
|
-
function autoUpdate(reference, floating, update, options) {
|
|
2335
|
-
if (options === void 0) {
|
|
2336
|
-
options = {};
|
|
2337
|
-
}
|
|
2338
|
-
const {
|
|
2339
|
-
ancestorScroll = true,
|
|
2340
|
-
ancestorResize = true,
|
|
2341
|
-
elementResize = typeof ResizeObserver === "function",
|
|
2342
|
-
layoutShift = typeof IntersectionObserver === "function",
|
|
2343
|
-
animationFrame = false
|
|
2344
|
-
} = options;
|
|
2345
|
-
const referenceEl = unwrapElement(reference);
|
|
2346
|
-
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
2347
|
-
ancestors.forEach((ancestor) => {
|
|
2348
|
-
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
2349
|
-
passive: true
|
|
2350
|
-
});
|
|
2351
|
-
ancestorResize && ancestor.addEventListener("resize", update);
|
|
2352
|
-
});
|
|
2353
|
-
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
2354
|
-
let reobserveFrame = -1;
|
|
2355
|
-
let resizeObserver = null;
|
|
2356
|
-
if (elementResize) {
|
|
2357
|
-
resizeObserver = new ResizeObserver((_ref) => {
|
|
2358
|
-
let [firstEntry] = _ref;
|
|
2359
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
2360
|
-
resizeObserver.unobserve(floating);
|
|
2361
|
-
cancelAnimationFrame(reobserveFrame);
|
|
2362
|
-
reobserveFrame = requestAnimationFrame(() => {
|
|
2363
|
-
var _resizeObserver;
|
|
2364
|
-
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
2365
|
-
});
|
|
2366
|
-
}
|
|
2367
|
-
update();
|
|
2368
|
-
});
|
|
2369
|
-
if (referenceEl && !animationFrame) {
|
|
2370
|
-
resizeObserver.observe(referenceEl);
|
|
2371
|
-
}
|
|
2372
|
-
resizeObserver.observe(floating);
|
|
2373
|
-
}
|
|
2374
|
-
let frameId;
|
|
2375
|
-
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
2376
|
-
if (animationFrame) {
|
|
2377
|
-
frameLoop();
|
|
2378
|
-
}
|
|
2379
|
-
function frameLoop() {
|
|
2380
|
-
const nextRefRect = getBoundingClientRect(reference);
|
|
2381
|
-
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
2382
|
-
update();
|
|
2383
|
-
}
|
|
2384
|
-
prevRefRect = nextRefRect;
|
|
2385
|
-
frameId = requestAnimationFrame(frameLoop);
|
|
2386
|
-
}
|
|
2387
|
-
update();
|
|
2388
|
-
return () => {
|
|
2389
|
-
var _resizeObserver2;
|
|
2390
|
-
ancestors.forEach((ancestor) => {
|
|
2391
|
-
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
2392
|
-
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
2393
|
-
});
|
|
2394
|
-
cleanupIo == null || cleanupIo();
|
|
2395
|
-
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
2396
|
-
resizeObserver = null;
|
|
2397
|
-
if (animationFrame) {
|
|
2398
|
-
cancelAnimationFrame(frameId);
|
|
2399
|
-
}
|
|
2400
|
-
};
|
|
2401
|
-
}
|
|
2402
|
-
var offset2 = offset;
|
|
2403
|
-
var shift2 = shift;
|
|
2404
|
-
var flip2 = flip;
|
|
2405
|
-
var size2 = size;
|
|
2406
|
-
var hide2 = hide;
|
|
2407
|
-
var arrow2 = arrow;
|
|
2408
|
-
var limitShift2 = limitShift;
|
|
2409
|
-
var computePosition2 = (reference, floating, options) => {
|
|
2410
|
-
const cache = /* @__PURE__ */ new Map();
|
|
2411
|
-
const mergedOptions = {
|
|
2412
|
-
platform,
|
|
2413
|
-
...options
|
|
2414
|
-
};
|
|
2415
|
-
const platformWithCache = {
|
|
2416
|
-
...mergedOptions.platform,
|
|
2417
|
-
_c: cache
|
|
2418
|
-
};
|
|
2419
|
-
return computePosition(reference, floating, {
|
|
2420
|
-
...mergedOptions,
|
|
2421
|
-
platform: platformWithCache
|
|
2422
|
-
});
|
|
2423
|
-
};
|
|
2424
|
-
var isClient = typeof document !== "undefined";
|
|
2425
|
-
var noop = function noop2() {
|
|
2426
|
-
};
|
|
2427
|
-
var index = isClient ? React30.useLayoutEffect : noop;
|
|
2428
|
-
function deepEqual(a, b) {
|
|
2429
|
-
if (a === b) {
|
|
2430
|
-
return true;
|
|
2431
|
-
}
|
|
2432
|
-
if (typeof a !== typeof b) {
|
|
2433
|
-
return false;
|
|
2434
|
-
}
|
|
2435
|
-
if (typeof a === "function" && a.toString() === b.toString()) {
|
|
2436
|
-
return true;
|
|
2437
|
-
}
|
|
2438
|
-
let length;
|
|
2439
|
-
let i;
|
|
2440
|
-
let keys;
|
|
2441
|
-
if (a && b && typeof a === "object") {
|
|
2442
|
-
if (Array.isArray(a)) {
|
|
2443
|
-
length = a.length;
|
|
2444
|
-
if (length !== b.length) return false;
|
|
2445
|
-
for (i = length; i-- !== 0; ) {
|
|
2446
|
-
if (!deepEqual(a[i], b[i])) {
|
|
2447
|
-
return false;
|
|
2448
|
-
}
|
|
2449
|
-
}
|
|
2450
|
-
return true;
|
|
2451
|
-
}
|
|
2452
|
-
keys = Object.keys(a);
|
|
2453
|
-
length = keys.length;
|
|
2454
|
-
if (length !== Object.keys(b).length) {
|
|
2455
|
-
return false;
|
|
2456
|
-
}
|
|
2457
|
-
for (i = length; i-- !== 0; ) {
|
|
2458
|
-
if (!{}.hasOwnProperty.call(b, keys[i])) {
|
|
2459
|
-
return false;
|
|
2460
|
-
}
|
|
2461
|
-
}
|
|
2462
|
-
for (i = length; i-- !== 0; ) {
|
|
2463
|
-
const key = keys[i];
|
|
2464
|
-
if (key === "_owner" && a.$$typeof) {
|
|
2465
|
-
continue;
|
|
2466
|
-
}
|
|
2467
|
-
if (!deepEqual(a[key], b[key])) {
|
|
2468
|
-
return false;
|
|
2469
|
-
}
|
|
2470
|
-
}
|
|
2471
|
-
return true;
|
|
2472
|
-
}
|
|
2473
|
-
return a !== a && b !== b;
|
|
2474
|
-
}
|
|
2475
|
-
function getDPR(element) {
|
|
2476
|
-
if (typeof window === "undefined") {
|
|
2477
|
-
return 1;
|
|
2478
|
-
}
|
|
2479
|
-
const win = element.ownerDocument.defaultView || window;
|
|
2480
|
-
return win.devicePixelRatio || 1;
|
|
2481
|
-
}
|
|
2482
|
-
function roundByDPR(element, value) {
|
|
2483
|
-
const dpr = getDPR(element);
|
|
2484
|
-
return Math.round(value * dpr) / dpr;
|
|
2485
|
-
}
|
|
2486
|
-
function useLatestRef(value) {
|
|
2487
|
-
const ref = React30__namespace.useRef(value);
|
|
2488
|
-
index(() => {
|
|
2489
|
-
ref.current = value;
|
|
2490
|
-
});
|
|
2491
|
-
return ref;
|
|
2492
|
-
}
|
|
2493
|
-
function useFloating(options) {
|
|
2494
|
-
if (options === void 0) {
|
|
2495
|
-
options = {};
|
|
2496
|
-
}
|
|
2497
|
-
const {
|
|
2498
|
-
placement = "bottom",
|
|
2499
|
-
strategy = "absolute",
|
|
2500
|
-
middleware = [],
|
|
2501
|
-
platform: platform2,
|
|
2502
|
-
elements: {
|
|
2503
|
-
reference: externalReference,
|
|
2504
|
-
floating: externalFloating
|
|
2505
|
-
} = {},
|
|
2506
|
-
transform = true,
|
|
2507
|
-
whileElementsMounted,
|
|
2508
|
-
open
|
|
2509
|
-
} = options;
|
|
2510
|
-
const [data, setData] = React30__namespace.useState({
|
|
2511
|
-
x: 0,
|
|
2512
|
-
y: 0,
|
|
2513
|
-
strategy,
|
|
2514
|
-
placement,
|
|
2515
|
-
middlewareData: {},
|
|
2516
|
-
isPositioned: false
|
|
2517
|
-
});
|
|
2518
|
-
const [latestMiddleware, setLatestMiddleware] = React30__namespace.useState(middleware);
|
|
2519
|
-
if (!deepEqual(latestMiddleware, middleware)) {
|
|
2520
|
-
setLatestMiddleware(middleware);
|
|
2521
|
-
}
|
|
2522
|
-
const [_reference, _setReference] = React30__namespace.useState(null);
|
|
2523
|
-
const [_floating, _setFloating] = React30__namespace.useState(null);
|
|
2524
|
-
const setReference = React30__namespace.useCallback((node) => {
|
|
2525
|
-
if (node !== referenceRef.current) {
|
|
2526
|
-
referenceRef.current = node;
|
|
2527
|
-
_setReference(node);
|
|
2528
|
-
}
|
|
2529
|
-
}, []);
|
|
2530
|
-
const setFloating = React30__namespace.useCallback((node) => {
|
|
2531
|
-
if (node !== floatingRef.current) {
|
|
2532
|
-
floatingRef.current = node;
|
|
2533
|
-
_setFloating(node);
|
|
2534
|
-
}
|
|
2535
|
-
}, []);
|
|
2536
|
-
const referenceEl = externalReference || _reference;
|
|
2537
|
-
const floatingEl = externalFloating || _floating;
|
|
2538
|
-
const referenceRef = React30__namespace.useRef(null);
|
|
2539
|
-
const floatingRef = React30__namespace.useRef(null);
|
|
2540
|
-
const dataRef = React30__namespace.useRef(data);
|
|
2541
|
-
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
2542
|
-
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
2543
|
-
const platformRef = useLatestRef(platform2);
|
|
2544
|
-
const openRef = useLatestRef(open);
|
|
2545
|
-
const update = React30__namespace.useCallback(() => {
|
|
2546
|
-
if (!referenceRef.current || !floatingRef.current) {
|
|
2547
|
-
return;
|
|
2548
|
-
}
|
|
2549
|
-
const config = {
|
|
2550
|
-
placement,
|
|
2551
|
-
strategy,
|
|
2552
|
-
middleware: latestMiddleware
|
|
2553
|
-
};
|
|
2554
|
-
if (platformRef.current) {
|
|
2555
|
-
config.platform = platformRef.current;
|
|
2556
|
-
}
|
|
2557
|
-
computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => {
|
|
2558
|
-
const fullData = {
|
|
2559
|
-
...data2,
|
|
2560
|
-
// The floating element's position may be recomputed while it's closed
|
|
2561
|
-
// but still mounted (such as when transitioning out). To ensure
|
|
2562
|
-
// `isPositioned` will be `false` initially on the next open, avoid
|
|
2563
|
-
// setting it to `true` when `open === false` (must be specified).
|
|
2564
|
-
isPositioned: openRef.current !== false
|
|
2565
|
-
};
|
|
2566
|
-
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
|
|
2567
|
-
dataRef.current = fullData;
|
|
2568
|
-
ReactDOM4__namespace.flushSync(() => {
|
|
2569
|
-
setData(fullData);
|
|
2570
|
-
});
|
|
2571
|
-
}
|
|
2572
|
-
});
|
|
2573
|
-
}, [latestMiddleware, placement, strategy, platformRef, openRef]);
|
|
2574
|
-
index(() => {
|
|
2575
|
-
if (open === false && dataRef.current.isPositioned) {
|
|
2576
|
-
dataRef.current.isPositioned = false;
|
|
2577
|
-
setData((data2) => ({
|
|
2578
|
-
...data2,
|
|
2579
|
-
isPositioned: false
|
|
2580
|
-
}));
|
|
2581
|
-
}
|
|
2582
|
-
}, [open]);
|
|
2583
|
-
const isMountedRef = React30__namespace.useRef(false);
|
|
2584
|
-
index(() => {
|
|
2585
|
-
isMountedRef.current = true;
|
|
2586
|
-
return () => {
|
|
2587
|
-
isMountedRef.current = false;
|
|
2588
|
-
};
|
|
2589
|
-
}, []);
|
|
2590
|
-
index(() => {
|
|
2591
|
-
if (referenceEl) referenceRef.current = referenceEl;
|
|
2592
|
-
if (floatingEl) floatingRef.current = floatingEl;
|
|
2593
|
-
if (referenceEl && floatingEl) {
|
|
2594
|
-
if (whileElementsMountedRef.current) {
|
|
2595
|
-
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
2596
|
-
}
|
|
2597
|
-
update();
|
|
2598
|
-
}
|
|
2599
|
-
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
2600
|
-
const refs = React30__namespace.useMemo(() => ({
|
|
2601
|
-
reference: referenceRef,
|
|
2602
|
-
floating: floatingRef,
|
|
2603
|
-
setReference,
|
|
2604
|
-
setFloating
|
|
2605
|
-
}), [setReference, setFloating]);
|
|
2606
|
-
const elements = React30__namespace.useMemo(() => ({
|
|
2607
|
-
reference: referenceEl,
|
|
2608
|
-
floating: floatingEl
|
|
2609
|
-
}), [referenceEl, floatingEl]);
|
|
2610
|
-
const floatingStyles = React30__namespace.useMemo(() => {
|
|
2611
|
-
const initialStyles = {
|
|
2612
|
-
position: strategy,
|
|
2613
|
-
left: 0,
|
|
2614
|
-
top: 0
|
|
2615
|
-
};
|
|
2616
|
-
if (!elements.floating) {
|
|
2617
|
-
return initialStyles;
|
|
2618
|
-
}
|
|
2619
|
-
const x = roundByDPR(elements.floating, data.x);
|
|
2620
|
-
const y = roundByDPR(elements.floating, data.y);
|
|
2621
|
-
if (transform) {
|
|
2622
|
-
return {
|
|
2623
|
-
...initialStyles,
|
|
2624
|
-
transform: "translate(" + x + "px, " + y + "px)",
|
|
2625
|
-
...getDPR(elements.floating) >= 1.5 && {
|
|
2626
|
-
willChange: "transform"
|
|
2627
|
-
}
|
|
2628
|
-
};
|
|
2629
|
-
}
|
|
2630
|
-
return {
|
|
2631
|
-
position: strategy,
|
|
2632
|
-
left: x,
|
|
2633
|
-
top: y
|
|
2634
|
-
};
|
|
2635
|
-
}, [strategy, transform, elements.floating, data.x, data.y]);
|
|
2636
|
-
return React30__namespace.useMemo(() => ({
|
|
2637
|
-
...data,
|
|
2638
|
-
update,
|
|
2639
|
-
refs,
|
|
2640
|
-
elements,
|
|
2641
|
-
floatingStyles
|
|
2642
|
-
}), [data, update, refs, elements, floatingStyles]);
|
|
2643
|
-
}
|
|
2644
|
-
var arrow$1 = (options) => {
|
|
2645
|
-
function isRef(value) {
|
|
2646
|
-
return {}.hasOwnProperty.call(value, "current");
|
|
2647
|
-
}
|
|
2648
|
-
return {
|
|
2649
|
-
name: "arrow",
|
|
2650
|
-
options,
|
|
2651
|
-
fn(state) {
|
|
2652
|
-
const {
|
|
2653
|
-
element,
|
|
2654
|
-
padding
|
|
2655
|
-
} = typeof options === "function" ? options(state) : options;
|
|
2656
|
-
if (element && isRef(element)) {
|
|
2657
|
-
if (element.current != null) {
|
|
2658
|
-
return arrow2({
|
|
2659
|
-
element: element.current,
|
|
2660
|
-
padding
|
|
2661
|
-
}).fn(state);
|
|
2662
|
-
}
|
|
2663
|
-
return {};
|
|
2664
|
-
}
|
|
2665
|
-
if (element) {
|
|
2666
|
-
return arrow2({
|
|
2667
|
-
element,
|
|
2668
|
-
padding
|
|
2669
|
-
}).fn(state);
|
|
2670
|
-
}
|
|
2671
|
-
return {};
|
|
2672
|
-
}
|
|
2673
|
-
};
|
|
2674
|
-
};
|
|
2675
|
-
var offset3 = (options, deps) => ({
|
|
2676
|
-
...offset2(options),
|
|
2677
|
-
options: [options, deps]
|
|
2678
|
-
});
|
|
2679
|
-
var shift3 = (options, deps) => ({
|
|
2680
|
-
...shift2(options),
|
|
2681
|
-
options: [options, deps]
|
|
2682
|
-
});
|
|
2683
|
-
var limitShift3 = (options, deps) => ({
|
|
2684
|
-
...limitShift2(options),
|
|
2685
|
-
options: [options, deps]
|
|
2686
|
-
});
|
|
2687
|
-
var flip3 = (options, deps) => ({
|
|
2688
|
-
...flip2(options),
|
|
2689
|
-
options: [options, deps]
|
|
2690
|
-
});
|
|
2691
|
-
var size3 = (options, deps) => ({
|
|
2692
|
-
...size2(options),
|
|
2693
|
-
options: [options, deps]
|
|
2694
|
-
});
|
|
2695
|
-
var hide3 = (options, deps) => ({
|
|
2696
|
-
...hide2(options),
|
|
2697
|
-
options: [options, deps]
|
|
2698
|
-
});
|
|
2699
|
-
var arrow3 = (options, deps) => ({
|
|
2700
|
-
...arrow$1(options),
|
|
2701
|
-
options: [options, deps]
|
|
2702
|
-
});
|
|
2703
|
-
var NAME = "Arrow";
|
|
2704
|
-
var Arrow = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
2705
|
-
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
2706
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2707
|
-
Primitive.svg,
|
|
2708
|
-
{
|
|
2709
|
-
...arrowProps,
|
|
2710
|
-
ref: forwardedRef,
|
|
2711
|
-
width,
|
|
2712
|
-
height,
|
|
2713
|
-
viewBox: "0 0 30 10",
|
|
2714
|
-
preserveAspectRatio: "none",
|
|
2715
|
-
children: props.asChild ? children : /* @__PURE__ */ jsxRuntime.jsx("polygon", { points: "0,0 30,0 15,10" })
|
|
2716
|
-
}
|
|
2717
|
-
);
|
|
2718
|
-
});
|
|
2719
|
-
Arrow.displayName = NAME;
|
|
2720
|
-
var Root = Arrow;
|
|
2721
|
-
function useSize(element) {
|
|
2722
|
-
const [size4, setSize] = React30__namespace.useState(void 0);
|
|
2723
|
-
useLayoutEffect2(() => {
|
|
2724
|
-
if (element) {
|
|
2725
|
-
setSize({ width: element.offsetWidth, height: element.offsetHeight });
|
|
2726
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
2727
|
-
if (!Array.isArray(entries)) {
|
|
2728
|
-
return;
|
|
2729
|
-
}
|
|
2730
|
-
if (!entries.length) {
|
|
2731
|
-
return;
|
|
2732
|
-
}
|
|
2733
|
-
const entry = entries[0];
|
|
2734
|
-
let width;
|
|
2735
|
-
let height;
|
|
2736
|
-
if ("borderBoxSize" in entry) {
|
|
2737
|
-
const borderSizeEntry = entry["borderBoxSize"];
|
|
2738
|
-
const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
|
|
2739
|
-
width = borderSize["inlineSize"];
|
|
2740
|
-
height = borderSize["blockSize"];
|
|
2741
|
-
} else {
|
|
2742
|
-
width = element.offsetWidth;
|
|
2743
|
-
height = element.offsetHeight;
|
|
2744
|
-
}
|
|
2745
|
-
setSize({ width, height });
|
|
2746
|
-
});
|
|
2747
|
-
resizeObserver.observe(element, { box: "border-box" });
|
|
2748
|
-
return () => resizeObserver.unobserve(element);
|
|
2749
|
-
} else {
|
|
2750
|
-
setSize(void 0);
|
|
2751
|
-
}
|
|
2752
|
-
}, [element]);
|
|
2753
|
-
return size4;
|
|
2754
|
-
}
|
|
2755
|
-
var POPPER_NAME = "Popper";
|
|
2756
|
-
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
2757
|
-
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
2758
|
-
var ANCHOR_NAME = "PopperAnchor";
|
|
2759
|
-
var PopperAnchor = React30__namespace.forwardRef(
|
|
2760
|
-
(props, forwardedRef) => {
|
|
2761
|
-
const { __scopePopper, virtualRef, ...anchorProps } = props;
|
|
2762
|
-
const context = usePopperContext(ANCHOR_NAME, __scopePopper);
|
|
2763
|
-
const ref = React30__namespace.useRef(null);
|
|
2764
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
2765
|
-
const anchorRef = React30__namespace.useRef(null);
|
|
2766
|
-
React30__namespace.useEffect(() => {
|
|
2767
|
-
const previousAnchor = anchorRef.current;
|
|
2768
|
-
anchorRef.current = virtualRef?.current || ref.current;
|
|
2769
|
-
if (previousAnchor !== anchorRef.current) {
|
|
2770
|
-
context.onAnchorChange(anchorRef.current);
|
|
2771
|
-
}
|
|
2772
|
-
});
|
|
2773
|
-
return virtualRef ? null : /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
2774
|
-
}
|
|
2775
|
-
);
|
|
2776
|
-
PopperAnchor.displayName = ANCHOR_NAME;
|
|
2777
|
-
var CONTENT_NAME = "PopperContent";
|
|
2778
|
-
var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME);
|
|
2779
|
-
var PopperContent = React30__namespace.forwardRef(
|
|
2780
|
-
(props, forwardedRef) => {
|
|
2781
|
-
const {
|
|
2782
|
-
__scopePopper,
|
|
2783
|
-
side = "bottom",
|
|
2784
|
-
sideOffset = 0,
|
|
2785
|
-
align = "center",
|
|
2786
|
-
alignOffset = 0,
|
|
2787
|
-
arrowPadding = 0,
|
|
2788
|
-
avoidCollisions = true,
|
|
2789
|
-
collisionBoundary = [],
|
|
2790
|
-
collisionPadding: collisionPaddingProp = 0,
|
|
2791
|
-
sticky = "partial",
|
|
2792
|
-
hideWhenDetached = false,
|
|
2793
|
-
updatePositionStrategy = "optimized",
|
|
2794
|
-
onPlaced,
|
|
2795
|
-
...contentProps
|
|
2796
|
-
} = props;
|
|
2797
|
-
const context = usePopperContext(CONTENT_NAME, __scopePopper);
|
|
2798
|
-
const [content, setContent] = React30__namespace.useState(null);
|
|
2799
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
2800
|
-
const [arrow4, setArrow] = React30__namespace.useState(null);
|
|
2801
|
-
const arrowSize = useSize(arrow4);
|
|
2802
|
-
const arrowWidth = arrowSize?.width ?? 0;
|
|
2803
|
-
const arrowHeight = arrowSize?.height ?? 0;
|
|
2804
|
-
const desiredPlacement = side + (align !== "center" ? "-" + align : "");
|
|
2805
|
-
const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
|
|
2806
|
-
const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
|
|
2807
|
-
const hasExplicitBoundaries = boundary.length > 0;
|
|
2808
|
-
const detectOverflowOptions = {
|
|
2809
|
-
padding: collisionPadding,
|
|
2810
|
-
boundary: boundary.filter(isNotNull),
|
|
2811
|
-
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
2812
|
-
altBoundary: hasExplicitBoundaries
|
|
2813
|
-
};
|
|
2814
|
-
const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
|
|
2815
|
-
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
2816
|
-
strategy: "fixed",
|
|
2817
|
-
placement: desiredPlacement,
|
|
2818
|
-
whileElementsMounted: (...args) => {
|
|
2819
|
-
const cleanup = autoUpdate(...args, {
|
|
2820
|
-
animationFrame: updatePositionStrategy === "always"
|
|
2821
|
-
});
|
|
2822
|
-
return cleanup;
|
|
2823
|
-
},
|
|
2824
|
-
elements: {
|
|
2825
|
-
reference: context.anchor
|
|
2826
|
-
},
|
|
2827
|
-
middleware: [
|
|
2828
|
-
offset3({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
|
|
2829
|
-
avoidCollisions && shift3({
|
|
2830
|
-
mainAxis: true,
|
|
2831
|
-
crossAxis: false,
|
|
2832
|
-
limiter: sticky === "partial" ? limitShift3() : void 0,
|
|
2833
|
-
...detectOverflowOptions
|
|
2834
|
-
}),
|
|
2835
|
-
avoidCollisions && flip3({ ...detectOverflowOptions }),
|
|
2836
|
-
size3({
|
|
2837
|
-
...detectOverflowOptions,
|
|
2838
|
-
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
2839
|
-
const { width: anchorWidth, height: anchorHeight } = rects.reference;
|
|
2840
|
-
const contentStyle = elements.floating.style;
|
|
2841
|
-
contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
|
|
2842
|
-
contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
|
|
2843
|
-
contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
|
|
2844
|
-
contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
|
|
2845
|
-
}
|
|
2846
|
-
}),
|
|
2847
|
-
arrow4 && arrow3({ element: arrow4, padding: arrowPadding }),
|
|
2848
|
-
transformOrigin({ arrowWidth, arrowHeight }),
|
|
2849
|
-
hideWhenDetached && hide3({ strategy: "referenceHidden", ...detectOverflowOptions })
|
|
2850
|
-
]
|
|
2851
|
-
});
|
|
2852
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
2853
|
-
const handlePlaced = useCallbackRef(onPlaced);
|
|
2854
|
-
useLayoutEffect2(() => {
|
|
2855
|
-
if (isPositioned) {
|
|
2856
|
-
handlePlaced?.();
|
|
2857
|
-
}
|
|
2858
|
-
}, [isPositioned, handlePlaced]);
|
|
2859
|
-
const arrowX = middlewareData.arrow?.x;
|
|
2860
|
-
const arrowY = middlewareData.arrow?.y;
|
|
2861
|
-
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
2862
|
-
const [contentZIndex, setContentZIndex] = React30__namespace.useState();
|
|
2863
|
-
useLayoutEffect2(() => {
|
|
2864
|
-
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
2865
|
-
}, [content]);
|
|
2866
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2867
|
-
"div",
|
|
2868
|
-
{
|
|
2869
|
-
ref: refs.setFloating,
|
|
2870
|
-
"data-radix-popper-content-wrapper": "",
|
|
2871
|
-
style: {
|
|
2872
|
-
...floatingStyles,
|
|
2873
|
-
transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
|
|
2874
|
-
// keep off the page when measuring
|
|
2875
|
-
minWidth: "max-content",
|
|
2876
|
-
zIndex: contentZIndex,
|
|
2877
|
-
["--radix-popper-transform-origin"]: [
|
|
2878
|
-
middlewareData.transformOrigin?.x,
|
|
2879
|
-
middlewareData.transformOrigin?.y
|
|
2880
|
-
].join(" "),
|
|
2881
|
-
// hide the content if using the hide middleware and should be hidden
|
|
2882
|
-
// set visibility to hidden and disable pointer events so the UI behaves
|
|
2883
|
-
// as if the PopperContent isn't there at all
|
|
2884
|
-
...middlewareData.hide?.referenceHidden && {
|
|
2885
|
-
visibility: "hidden",
|
|
2886
|
-
pointerEvents: "none"
|
|
2887
|
-
}
|
|
2888
|
-
},
|
|
2889
|
-
dir: props.dir,
|
|
2890
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2891
|
-
PopperContentProvider,
|
|
2892
|
-
{
|
|
2893
|
-
scope: __scopePopper,
|
|
2894
|
-
placedSide,
|
|
2895
|
-
onArrowChange: setArrow,
|
|
2896
|
-
arrowX,
|
|
2897
|
-
arrowY,
|
|
2898
|
-
shouldHideArrow: cannotCenterArrow,
|
|
2899
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2900
|
-
Primitive.div,
|
|
2901
|
-
{
|
|
2902
|
-
"data-side": placedSide,
|
|
2903
|
-
"data-align": placedAlign,
|
|
2904
|
-
...contentProps,
|
|
2905
|
-
ref: composedRefs,
|
|
2906
|
-
style: {
|
|
2907
|
-
...contentProps.style,
|
|
2908
|
-
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
2909
|
-
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
2910
|
-
animation: !isPositioned ? "none" : void 0
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
)
|
|
2914
|
-
}
|
|
2915
|
-
)
|
|
2916
|
-
}
|
|
2917
|
-
);
|
|
2918
|
-
}
|
|
2919
|
-
);
|
|
2920
|
-
PopperContent.displayName = CONTENT_NAME;
|
|
2921
|
-
var ARROW_NAME = "PopperArrow";
|
|
2922
|
-
var OPPOSITE_SIDE = {
|
|
2923
|
-
top: "bottom",
|
|
2924
|
-
right: "left",
|
|
2925
|
-
bottom: "top",
|
|
2926
|
-
left: "right"
|
|
2927
|
-
};
|
|
2928
|
-
var PopperArrow = React30__namespace.forwardRef(function PopperArrow2(props, forwardedRef) {
|
|
2929
|
-
const { __scopePopper, ...arrowProps } = props;
|
|
2930
|
-
const contentContext = useContentContext(ARROW_NAME, __scopePopper);
|
|
2931
|
-
const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
|
|
2932
|
-
return (
|
|
2933
|
-
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
2934
|
-
// doesn't report size as we'd expect on SVG elements.
|
|
2935
|
-
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
2936
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2937
|
-
"span",
|
|
2938
|
-
{
|
|
2939
|
-
ref: contentContext.onArrowChange,
|
|
2940
|
-
style: {
|
|
2941
|
-
position: "absolute",
|
|
2942
|
-
left: contentContext.arrowX,
|
|
2943
|
-
top: contentContext.arrowY,
|
|
2944
|
-
[baseSide]: 0,
|
|
2945
|
-
transformOrigin: {
|
|
2946
|
-
top: "",
|
|
2947
|
-
right: "0 0",
|
|
2948
|
-
bottom: "center 0",
|
|
2949
|
-
left: "100% 0"
|
|
2950
|
-
}[contentContext.placedSide],
|
|
2951
|
-
transform: {
|
|
2952
|
-
top: "translateY(100%)",
|
|
2953
|
-
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
2954
|
-
bottom: `rotate(180deg)`,
|
|
2955
|
-
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
2956
|
-
}[contentContext.placedSide],
|
|
2957
|
-
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
2958
|
-
},
|
|
2959
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2960
|
-
Root,
|
|
2961
|
-
{
|
|
2962
|
-
...arrowProps,
|
|
2963
|
-
ref: forwardedRef,
|
|
2964
|
-
style: {
|
|
2965
|
-
...arrowProps.style,
|
|
2966
|
-
// ensures the element can be measured correctly (mostly for if SVG)
|
|
2967
|
-
display: "block"
|
|
2968
|
-
}
|
|
2969
|
-
}
|
|
2970
|
-
)
|
|
2971
|
-
}
|
|
2972
|
-
)
|
|
2973
|
-
);
|
|
2974
|
-
});
|
|
2975
|
-
PopperArrow.displayName = ARROW_NAME;
|
|
2976
|
-
function isNotNull(value) {
|
|
2977
|
-
return value !== null;
|
|
2978
|
-
}
|
|
2979
|
-
var transformOrigin = (options) => ({
|
|
2980
|
-
name: "transformOrigin",
|
|
2981
|
-
options,
|
|
2982
|
-
fn(data) {
|
|
2983
|
-
const { placement, rects, middlewareData } = data;
|
|
2984
|
-
const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
|
|
2985
|
-
const isArrowHidden = cannotCenterArrow;
|
|
2986
|
-
const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
|
|
2987
|
-
const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
|
|
2988
|
-
const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
|
|
2989
|
-
const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
|
|
2990
|
-
const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
|
|
2991
|
-
const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
|
|
2992
|
-
let x = "";
|
|
2993
|
-
let y = "";
|
|
2994
|
-
if (placedSide === "bottom") {
|
|
2995
|
-
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
2996
|
-
y = `${-arrowHeight}px`;
|
|
2997
|
-
} else if (placedSide === "top") {
|
|
2998
|
-
x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
|
|
2999
|
-
y = `${rects.floating.height + arrowHeight}px`;
|
|
3000
|
-
} else if (placedSide === "right") {
|
|
3001
|
-
x = `${-arrowHeight}px`;
|
|
3002
|
-
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
3003
|
-
} else if (placedSide === "left") {
|
|
3004
|
-
x = `${rects.floating.width + arrowHeight}px`;
|
|
3005
|
-
y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
|
|
3006
|
-
}
|
|
3007
|
-
return { data: { x, y } };
|
|
3008
|
-
}
|
|
3009
|
-
});
|
|
3010
|
-
function getSideAndAlignFromPlacement(placement) {
|
|
3011
|
-
const [side, align = "center"] = placement.split("-");
|
|
3012
|
-
return [side, align];
|
|
3013
|
-
}
|
|
3014
|
-
var Anchor = PopperAnchor;
|
|
3015
|
-
var Content = PopperContent;
|
|
3016
|
-
var Arrow2 = PopperArrow;
|
|
3017
|
-
var PORTAL_NAME = "Portal";
|
|
3018
|
-
var Portal = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
3019
|
-
const { container: containerProp, ...portalProps } = props;
|
|
3020
|
-
const [mounted, setMounted] = React30__namespace.useState(false);
|
|
3021
|
-
useLayoutEffect2(() => setMounted(true), []);
|
|
3022
|
-
const container = containerProp || mounted && globalThis?.document?.body;
|
|
3023
|
-
return container ? ReactDOM4__namespace.default.createPortal(/* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
3024
|
-
});
|
|
3025
|
-
Portal.displayName = PORTAL_NAME;
|
|
3026
|
-
function usePrevious(value) {
|
|
3027
|
-
const ref = React30__namespace.useRef({ value, previous: value });
|
|
3028
|
-
return React30__namespace.useMemo(() => {
|
|
3029
|
-
if (ref.current.value !== value) {
|
|
3030
|
-
ref.current.previous = ref.current.value;
|
|
3031
|
-
ref.current.value = value;
|
|
3032
|
-
}
|
|
3033
|
-
return ref.current.previous;
|
|
3034
|
-
}, [value]);
|
|
3035
|
-
}
|
|
3036
|
-
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
3037
|
-
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
3038
|
-
position: "absolute",
|
|
3039
|
-
border: 0,
|
|
3040
|
-
width: 1,
|
|
3041
|
-
height: 1,
|
|
3042
|
-
padding: 0,
|
|
3043
|
-
margin: -1,
|
|
3044
|
-
overflow: "hidden",
|
|
3045
|
-
clip: "rect(0, 0, 0, 0)",
|
|
3046
|
-
whiteSpace: "nowrap",
|
|
3047
|
-
wordWrap: "normal"
|
|
3048
|
-
});
|
|
3049
|
-
var NAME2 = "VisuallyHidden";
|
|
3050
|
-
var VisuallyHidden = React30__namespace.forwardRef(
|
|
3051
|
-
(props, forwardedRef) => {
|
|
3052
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3053
|
-
Primitive.span,
|
|
3054
|
-
{
|
|
3055
|
-
...props,
|
|
3056
|
-
ref: forwardedRef,
|
|
3057
|
-
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style }
|
|
3058
|
-
}
|
|
3059
|
-
);
|
|
3060
|
-
}
|
|
3061
|
-
);
|
|
3062
|
-
VisuallyHidden.displayName = NAME2;
|
|
3063
|
-
|
|
3064
|
-
// node_modules/aria-hidden/dist/es2015/index.js
|
|
3065
|
-
var getDefaultParent = function(originalTarget) {
|
|
3066
|
-
if (typeof document === "undefined") {
|
|
3067
|
-
return null;
|
|
3068
|
-
}
|
|
3069
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
3070
|
-
return sampleTarget.ownerDocument.body;
|
|
3071
|
-
};
|
|
3072
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
3073
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3074
|
-
var markerMap = {};
|
|
3075
|
-
var lockCount = 0;
|
|
3076
|
-
var unwrapHost = function(node) {
|
|
3077
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
3078
|
-
};
|
|
3079
|
-
var correctTargets = function(parent, targets) {
|
|
3080
|
-
return targets.map(function(target) {
|
|
3081
|
-
if (parent.contains(target)) {
|
|
3082
|
-
return target;
|
|
3083
|
-
}
|
|
3084
|
-
var correctedTarget = unwrapHost(target);
|
|
3085
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
3086
|
-
return correctedTarget;
|
|
3087
|
-
}
|
|
3088
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
3089
|
-
return null;
|
|
3090
|
-
}).filter(function(x) {
|
|
3091
|
-
return Boolean(x);
|
|
3092
|
-
});
|
|
3093
|
-
};
|
|
3094
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
3095
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3096
|
-
if (!markerMap[markerName]) {
|
|
3097
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
3098
|
-
}
|
|
3099
|
-
var markerCounter = markerMap[markerName];
|
|
3100
|
-
var hiddenNodes = [];
|
|
3101
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
3102
|
-
var elementsToStop = new Set(targets);
|
|
3103
|
-
var keep = function(el) {
|
|
3104
|
-
if (!el || elementsToKeep.has(el)) {
|
|
3105
|
-
return;
|
|
3106
|
-
}
|
|
3107
|
-
elementsToKeep.add(el);
|
|
3108
|
-
keep(el.parentNode);
|
|
3109
|
-
};
|
|
3110
|
-
targets.forEach(keep);
|
|
3111
|
-
var deep = function(parent) {
|
|
3112
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
3113
|
-
return;
|
|
3114
|
-
}
|
|
3115
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
3116
|
-
if (elementsToKeep.has(node)) {
|
|
3117
|
-
deep(node);
|
|
3118
|
-
} else {
|
|
3119
|
-
try {
|
|
3120
|
-
var attr = node.getAttribute(controlAttribute);
|
|
3121
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
3122
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
3123
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
3124
|
-
counterMap.set(node, counterValue);
|
|
3125
|
-
markerCounter.set(node, markerValue);
|
|
3126
|
-
hiddenNodes.push(node);
|
|
3127
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
3128
|
-
uncontrolledNodes.set(node, true);
|
|
3129
|
-
}
|
|
3130
|
-
if (markerValue === 1) {
|
|
3131
|
-
node.setAttribute(markerName, "true");
|
|
3132
|
-
}
|
|
3133
|
-
if (!alreadyHidden) {
|
|
3134
|
-
node.setAttribute(controlAttribute, "true");
|
|
3135
|
-
}
|
|
3136
|
-
} catch (e) {
|
|
3137
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
});
|
|
3141
|
-
};
|
|
3142
|
-
deep(parentNode);
|
|
3143
|
-
elementsToKeep.clear();
|
|
3144
|
-
lockCount++;
|
|
3145
|
-
return function() {
|
|
3146
|
-
hiddenNodes.forEach(function(node) {
|
|
3147
|
-
var counterValue = counterMap.get(node) - 1;
|
|
3148
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
3149
|
-
counterMap.set(node, counterValue);
|
|
3150
|
-
markerCounter.set(node, markerValue);
|
|
3151
|
-
if (!counterValue) {
|
|
3152
|
-
if (!uncontrolledNodes.has(node)) {
|
|
3153
|
-
node.removeAttribute(controlAttribute);
|
|
3154
|
-
}
|
|
3155
|
-
uncontrolledNodes.delete(node);
|
|
3156
|
-
}
|
|
3157
|
-
if (!markerValue) {
|
|
3158
|
-
node.removeAttribute(markerName);
|
|
3159
|
-
}
|
|
3160
|
-
});
|
|
3161
|
-
lockCount--;
|
|
3162
|
-
if (!lockCount) {
|
|
3163
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3164
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3165
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3166
|
-
markerMap = {};
|
|
3167
|
-
}
|
|
3168
|
-
};
|
|
3169
|
-
};
|
|
3170
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
3171
|
-
if (markerName === void 0) {
|
|
3172
|
-
markerName = "data-aria-hidden";
|
|
3173
|
-
}
|
|
3174
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3175
|
-
var activeParentNode = getDefaultParent(originalTarget);
|
|
3176
|
-
if (!activeParentNode) {
|
|
3177
|
-
return function() {
|
|
3178
|
-
return null;
|
|
3179
|
-
};
|
|
3180
|
-
}
|
|
3181
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
3182
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
3183
|
-
};
|
|
3184
|
-
|
|
3185
|
-
// node_modules/tslib/tslib.es6.mjs
|
|
3186
|
-
var __assign = function() {
|
|
3187
|
-
__assign = Object.assign || function __assign2(t) {
|
|
3188
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
3189
|
-
s = arguments[i];
|
|
3190
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
3191
|
-
}
|
|
3192
|
-
return t;
|
|
3193
|
-
};
|
|
3194
|
-
return __assign.apply(this, arguments);
|
|
3195
|
-
};
|
|
3196
|
-
function __rest(s, e) {
|
|
3197
|
-
var t = {};
|
|
3198
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
3199
|
-
t[p] = s[p];
|
|
3200
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
3201
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
3202
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
3203
|
-
t[p[i]] = s[p[i]];
|
|
3204
|
-
}
|
|
3205
|
-
return t;
|
|
3206
|
-
}
|
|
3207
|
-
function __spreadArray(to, from, pack) {
|
|
3208
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
3209
|
-
if (ar || !(i in from)) {
|
|
3210
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
3211
|
-
ar[i] = from[i];
|
|
3212
|
-
}
|
|
3213
|
-
}
|
|
3214
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
3215
|
-
}
|
|
3216
|
-
|
|
3217
|
-
// node_modules/react-remove-scroll-bar/dist/es2015/constants.js
|
|
3218
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
3219
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
3220
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
3221
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
3222
|
-
|
|
3223
|
-
// node_modules/use-callback-ref/dist/es2015/assignRef.js
|
|
3224
|
-
function assignRef(ref, value) {
|
|
3225
|
-
if (typeof ref === "function") {
|
|
3226
|
-
ref(value);
|
|
3227
|
-
} else if (ref) {
|
|
3228
|
-
ref.current = value;
|
|
3229
|
-
}
|
|
3230
|
-
return ref;
|
|
3231
|
-
}
|
|
3232
|
-
function useCallbackRef2(initialValue, callback) {
|
|
3233
|
-
var ref = React30.useState(function() {
|
|
3234
|
-
return {
|
|
3235
|
-
// value
|
|
3236
|
-
value: initialValue,
|
|
3237
|
-
// last callback
|
|
3238
|
-
callback,
|
|
3239
|
-
// "memoized" public interface
|
|
3240
|
-
facade: {
|
|
3241
|
-
get current() {
|
|
3242
|
-
return ref.value;
|
|
3243
|
-
},
|
|
3244
|
-
set current(value) {
|
|
3245
|
-
var last = ref.value;
|
|
3246
|
-
if (last !== value) {
|
|
3247
|
-
ref.value = value;
|
|
3248
|
-
ref.callback(value, last);
|
|
3249
|
-
}
|
|
3250
|
-
}
|
|
3251
|
-
}
|
|
3252
|
-
};
|
|
3253
|
-
})[0];
|
|
3254
|
-
ref.callback = callback;
|
|
3255
|
-
return ref.facade;
|
|
3256
|
-
}
|
|
3257
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React30__namespace.useLayoutEffect : React30__namespace.useEffect;
|
|
3258
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
3259
|
-
function useMergeRefs(refs, defaultValue) {
|
|
3260
|
-
var callbackRef = useCallbackRef2(null, function(newValue) {
|
|
3261
|
-
return refs.forEach(function(ref) {
|
|
3262
|
-
return assignRef(ref, newValue);
|
|
3263
|
-
});
|
|
3264
|
-
});
|
|
3265
|
-
useIsomorphicLayoutEffect(function() {
|
|
3266
|
-
var oldValue = currentValues.get(callbackRef);
|
|
3267
|
-
if (oldValue) {
|
|
3268
|
-
var prevRefs_1 = new Set(oldValue);
|
|
3269
|
-
var nextRefs_1 = new Set(refs);
|
|
3270
|
-
var current_1 = callbackRef.current;
|
|
3271
|
-
prevRefs_1.forEach(function(ref) {
|
|
3272
|
-
if (!nextRefs_1.has(ref)) {
|
|
3273
|
-
assignRef(ref, null);
|
|
3274
|
-
}
|
|
3275
|
-
});
|
|
3276
|
-
nextRefs_1.forEach(function(ref) {
|
|
3277
|
-
if (!prevRefs_1.has(ref)) {
|
|
3278
|
-
assignRef(ref, current_1);
|
|
3279
|
-
}
|
|
3280
|
-
});
|
|
3281
|
-
}
|
|
3282
|
-
currentValues.set(callbackRef, refs);
|
|
3283
|
-
}, [refs]);
|
|
3284
|
-
return callbackRef;
|
|
3285
|
-
}
|
|
3286
|
-
|
|
3287
|
-
// node_modules/use-sidecar/dist/es2015/medium.js
|
|
3288
|
-
function ItoI(a) {
|
|
3289
|
-
return a;
|
|
3290
|
-
}
|
|
3291
|
-
function innerCreateMedium(defaults, middleware) {
|
|
3292
|
-
if (middleware === void 0) {
|
|
3293
|
-
middleware = ItoI;
|
|
3294
|
-
}
|
|
3295
|
-
var buffer = [];
|
|
3296
|
-
var assigned = false;
|
|
3297
|
-
var medium = {
|
|
3298
|
-
read: function() {
|
|
3299
|
-
if (assigned) {
|
|
3300
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
3301
|
-
}
|
|
3302
|
-
if (buffer.length) {
|
|
3303
|
-
return buffer[buffer.length - 1];
|
|
3304
|
-
}
|
|
3305
|
-
return defaults;
|
|
3306
|
-
},
|
|
3307
|
-
useMedium: function(data) {
|
|
3308
|
-
var item = middleware(data, assigned);
|
|
3309
|
-
buffer.push(item);
|
|
3310
|
-
return function() {
|
|
3311
|
-
buffer = buffer.filter(function(x) {
|
|
3312
|
-
return x !== item;
|
|
3313
|
-
});
|
|
3314
|
-
};
|
|
3315
|
-
},
|
|
3316
|
-
assignSyncMedium: function(cb) {
|
|
3317
|
-
assigned = true;
|
|
3318
|
-
while (buffer.length) {
|
|
3319
|
-
var cbs = buffer;
|
|
3320
|
-
buffer = [];
|
|
3321
|
-
cbs.forEach(cb);
|
|
3322
|
-
}
|
|
3323
|
-
buffer = {
|
|
3324
|
-
push: function(x) {
|
|
3325
|
-
return cb(x);
|
|
3326
|
-
},
|
|
3327
|
-
filter: function() {
|
|
3328
|
-
return buffer;
|
|
3329
|
-
}
|
|
3330
|
-
};
|
|
3331
|
-
},
|
|
3332
|
-
assignMedium: function(cb) {
|
|
3333
|
-
assigned = true;
|
|
3334
|
-
var pendingQueue = [];
|
|
3335
|
-
if (buffer.length) {
|
|
3336
|
-
var cbs = buffer;
|
|
3337
|
-
buffer = [];
|
|
3338
|
-
cbs.forEach(cb);
|
|
3339
|
-
pendingQueue = buffer;
|
|
3340
|
-
}
|
|
3341
|
-
var executeQueue = function() {
|
|
3342
|
-
var cbs2 = pendingQueue;
|
|
3343
|
-
pendingQueue = [];
|
|
3344
|
-
cbs2.forEach(cb);
|
|
3345
|
-
};
|
|
3346
|
-
var cycle = function() {
|
|
3347
|
-
return Promise.resolve().then(executeQueue);
|
|
3348
|
-
};
|
|
3349
|
-
cycle();
|
|
3350
|
-
buffer = {
|
|
3351
|
-
push: function(x) {
|
|
3352
|
-
pendingQueue.push(x);
|
|
3353
|
-
cycle();
|
|
3354
|
-
},
|
|
3355
|
-
filter: function(filter) {
|
|
3356
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
3357
|
-
return buffer;
|
|
3358
|
-
}
|
|
3359
|
-
};
|
|
3360
|
-
}
|
|
3361
|
-
};
|
|
3362
|
-
return medium;
|
|
3363
|
-
}
|
|
3364
|
-
function createSidecarMedium(options) {
|
|
3365
|
-
if (options === void 0) {
|
|
3366
|
-
options = {};
|
|
3367
|
-
}
|
|
3368
|
-
var medium = innerCreateMedium(null);
|
|
3369
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
3370
|
-
return medium;
|
|
3371
|
-
}
|
|
3372
|
-
var SideCar = function(_a) {
|
|
3373
|
-
var sideCar = _a.sideCar, rest = __rest(_a, ["sideCar"]);
|
|
3374
|
-
if (!sideCar) {
|
|
3375
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
3376
|
-
}
|
|
3377
|
-
var Target = sideCar.read();
|
|
3378
|
-
if (!Target) {
|
|
3379
|
-
throw new Error("Sidecar medium not found");
|
|
3380
|
-
}
|
|
3381
|
-
return React30__namespace.createElement(Target, __assign({}, rest));
|
|
3382
|
-
};
|
|
3383
|
-
SideCar.isSideCarExport = true;
|
|
3384
|
-
function exportSidecar(medium, exported) {
|
|
3385
|
-
medium.useMedium(exported);
|
|
3386
|
-
return SideCar;
|
|
3387
|
-
}
|
|
3388
|
-
|
|
3389
|
-
// node_modules/react-remove-scroll/dist/es2015/medium.js
|
|
3390
|
-
var effectCar = createSidecarMedium();
|
|
3391
|
-
|
|
3392
|
-
// node_modules/react-remove-scroll/dist/es2015/UI.js
|
|
3393
|
-
var nothing = function() {
|
|
3394
|
-
return;
|
|
3395
|
-
};
|
|
3396
|
-
var RemoveScroll = React30__namespace.forwardRef(function(props, parentRef) {
|
|
3397
|
-
var ref = React30__namespace.useRef(null);
|
|
3398
|
-
var _a = React30__namespace.useState({
|
|
3399
|
-
onScrollCapture: nothing,
|
|
3400
|
-
onWheelCapture: nothing,
|
|
3401
|
-
onTouchMoveCapture: nothing
|
|
3402
|
-
}), callbacks = _a[0], setCallbacks = _a[1];
|
|
3403
|
-
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"]);
|
|
3404
|
-
var SideCar2 = sideCar;
|
|
3405
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
3406
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
3407
|
-
return React30__namespace.createElement(
|
|
3408
|
-
React30__namespace.Fragment,
|
|
3409
|
-
null,
|
|
3410
|
-
enabled && React30__namespace.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noRelative, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
3411
|
-
forwardProps ? React30__namespace.cloneElement(React30__namespace.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React30__namespace.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
3412
|
-
);
|
|
3413
|
-
});
|
|
3414
|
-
RemoveScroll.defaultProps = {
|
|
3415
|
-
enabled: true,
|
|
3416
|
-
removeScrollBar: true,
|
|
3417
|
-
inert: false
|
|
3418
|
-
};
|
|
3419
|
-
RemoveScroll.classNames = {
|
|
3420
|
-
fullWidth: fullWidthClassName,
|
|
3421
|
-
zeroRight: zeroRightClassName
|
|
3422
|
-
};
|
|
3423
|
-
var getNonce = function() {
|
|
3424
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
3425
|
-
return __webpack_nonce__;
|
|
3426
|
-
}
|
|
3427
|
-
return void 0;
|
|
3428
|
-
};
|
|
3429
|
-
|
|
3430
|
-
// node_modules/react-style-singleton/dist/es2015/singleton.js
|
|
3431
|
-
function makeStyleTag() {
|
|
3432
|
-
if (!document)
|
|
3433
|
-
return null;
|
|
3434
|
-
var tag = document.createElement("style");
|
|
3435
|
-
tag.type = "text/css";
|
|
3436
|
-
var nonce = getNonce();
|
|
3437
|
-
if (nonce) {
|
|
3438
|
-
tag.setAttribute("nonce", nonce);
|
|
3439
|
-
}
|
|
3440
|
-
return tag;
|
|
3441
|
-
}
|
|
3442
|
-
function injectStyles(tag, css) {
|
|
3443
|
-
if (tag.styleSheet) {
|
|
3444
|
-
tag.styleSheet.cssText = css;
|
|
3445
|
-
} else {
|
|
3446
|
-
tag.appendChild(document.createTextNode(css));
|
|
3447
|
-
}
|
|
3448
|
-
}
|
|
3449
|
-
function insertStyleTag(tag) {
|
|
3450
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
3451
|
-
head.appendChild(tag);
|
|
3452
|
-
}
|
|
3453
|
-
var stylesheetSingleton = function() {
|
|
3454
|
-
var counter = 0;
|
|
3455
|
-
var stylesheet = null;
|
|
3456
|
-
return {
|
|
3457
|
-
add: function(style) {
|
|
3458
|
-
if (counter == 0) {
|
|
3459
|
-
if (stylesheet = makeStyleTag()) {
|
|
3460
|
-
injectStyles(stylesheet, style);
|
|
3461
|
-
insertStyleTag(stylesheet);
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
counter++;
|
|
3465
|
-
},
|
|
3466
|
-
remove: function() {
|
|
3467
|
-
counter--;
|
|
3468
|
-
if (!counter && stylesheet) {
|
|
3469
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
3470
|
-
stylesheet = null;
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
};
|
|
3474
|
-
};
|
|
3475
|
-
|
|
3476
|
-
// node_modules/react-style-singleton/dist/es2015/hook.js
|
|
3477
|
-
var styleHookSingleton = function() {
|
|
3478
|
-
var sheet = stylesheetSingleton();
|
|
3479
|
-
return function(styles, isDynamic) {
|
|
3480
|
-
React30__namespace.useEffect(function() {
|
|
3481
|
-
sheet.add(styles);
|
|
3482
|
-
return function() {
|
|
3483
|
-
sheet.remove();
|
|
3484
|
-
};
|
|
3485
|
-
}, [styles && isDynamic]);
|
|
3486
|
-
};
|
|
3487
|
-
};
|
|
3488
|
-
|
|
3489
|
-
// node_modules/react-style-singleton/dist/es2015/component.js
|
|
3490
|
-
var styleSingleton = function() {
|
|
3491
|
-
var useStyle = styleHookSingleton();
|
|
3492
|
-
var Sheet = function(_a) {
|
|
3493
|
-
var styles = _a.styles, dynamic = _a.dynamic;
|
|
3494
|
-
useStyle(styles, dynamic);
|
|
3495
|
-
return null;
|
|
3496
|
-
};
|
|
3497
|
-
return Sheet;
|
|
3498
|
-
};
|
|
3499
|
-
|
|
3500
|
-
// node_modules/react-remove-scroll-bar/dist/es2015/utils.js
|
|
3501
|
-
var zeroGap = {
|
|
3502
|
-
left: 0,
|
|
3503
|
-
top: 0,
|
|
3504
|
-
right: 0,
|
|
3505
|
-
gap: 0
|
|
3506
|
-
};
|
|
3507
|
-
var parse = function(x) {
|
|
3508
|
-
return parseInt(x || "", 10) || 0;
|
|
3509
|
-
};
|
|
3510
|
-
var getOffset = function(gapMode) {
|
|
3511
|
-
var cs = window.getComputedStyle(document.body);
|
|
3512
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
3513
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
3514
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
3515
|
-
return [parse(left), parse(top), parse(right)];
|
|
3516
|
-
};
|
|
3517
|
-
var getGapWidth = function(gapMode) {
|
|
3518
|
-
if (gapMode === void 0) {
|
|
3519
|
-
gapMode = "margin";
|
|
3520
|
-
}
|
|
3521
|
-
if (typeof window === "undefined") {
|
|
3522
|
-
return zeroGap;
|
|
3523
|
-
}
|
|
3524
|
-
var offsets = getOffset(gapMode);
|
|
3525
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
3526
|
-
var windowWidth = window.innerWidth;
|
|
3527
|
-
return {
|
|
3528
|
-
left: offsets[0],
|
|
3529
|
-
top: offsets[1],
|
|
3530
|
-
right: offsets[2],
|
|
3531
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
3532
|
-
};
|
|
3533
|
-
};
|
|
3534
|
-
|
|
3535
|
-
// node_modules/react-remove-scroll-bar/dist/es2015/component.js
|
|
3536
|
-
var Style = styleSingleton();
|
|
3537
|
-
var lockAttribute = "data-scroll-locked";
|
|
3538
|
-
var getStyles = function(_a, allowRelative, gapMode, important) {
|
|
3539
|
-
var left = _a.left, top = _a.top, right = _a.right, gap = _a.gap;
|
|
3540
|
-
if (gapMode === void 0) {
|
|
3541
|
-
gapMode = "margin";
|
|
3542
|
-
}
|
|
3543
|
-
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([
|
|
3544
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
3545
|
-
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 "),
|
|
3546
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
3547
|
-
].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");
|
|
3548
|
-
};
|
|
3549
|
-
var getCurrentUseCounter = function() {
|
|
3550
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
3551
|
-
return isFinite(counter) ? counter : 0;
|
|
3552
|
-
};
|
|
3553
|
-
var useLockAttribute = function() {
|
|
3554
|
-
React30__namespace.useEffect(function() {
|
|
3555
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
3556
|
-
return function() {
|
|
3557
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
3558
|
-
if (newCounter <= 0) {
|
|
3559
|
-
document.body.removeAttribute(lockAttribute);
|
|
3560
|
-
} else {
|
|
3561
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
3562
|
-
}
|
|
3563
|
-
};
|
|
3564
|
-
}, []);
|
|
3565
|
-
};
|
|
3566
|
-
var RemoveScrollBar = function(_a) {
|
|
3567
|
-
var noRelative = _a.noRelative, noImportant = _a.noImportant, _b = _a.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
3568
|
-
useLockAttribute();
|
|
3569
|
-
var gap = React30__namespace.useMemo(function() {
|
|
3570
|
-
return getGapWidth(gapMode);
|
|
3571
|
-
}, [gapMode]);
|
|
3572
|
-
return React30__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
3573
|
-
};
|
|
3574
|
-
|
|
3575
|
-
// node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js
|
|
3576
|
-
var passiveSupported = false;
|
|
3577
|
-
if (typeof window !== "undefined") {
|
|
3578
|
-
try {
|
|
3579
|
-
options = Object.defineProperty({}, "passive", {
|
|
3580
|
-
get: function() {
|
|
3581
|
-
passiveSupported = true;
|
|
3582
|
-
return true;
|
|
3583
|
-
}
|
|
3584
|
-
});
|
|
3585
|
-
window.addEventListener("test", options, options);
|
|
3586
|
-
window.removeEventListener("test", options, options);
|
|
3587
|
-
} catch (err) {
|
|
3588
|
-
passiveSupported = false;
|
|
3589
|
-
}
|
|
3590
|
-
}
|
|
3591
|
-
var options;
|
|
3592
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
3593
|
-
|
|
3594
|
-
// node_modules/react-remove-scroll/dist/es2015/handleScroll.js
|
|
3595
|
-
var alwaysContainsScroll = function(node) {
|
|
3596
|
-
return node.tagName === "TEXTAREA";
|
|
3597
|
-
};
|
|
3598
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
3599
|
-
if (!(node instanceof Element)) {
|
|
3600
|
-
return false;
|
|
3601
|
-
}
|
|
3602
|
-
var styles = window.getComputedStyle(node);
|
|
3603
|
-
return (
|
|
3604
|
-
// not-not-scrollable
|
|
3605
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
3606
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
3607
|
-
);
|
|
3608
|
-
};
|
|
3609
|
-
var elementCouldBeVScrolled = function(node) {
|
|
3610
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
3611
|
-
};
|
|
3612
|
-
var elementCouldBeHScrolled = function(node) {
|
|
3613
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
3614
|
-
};
|
|
3615
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
3616
|
-
var ownerDocument = node.ownerDocument;
|
|
3617
|
-
var current = node;
|
|
3618
|
-
do {
|
|
3619
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
3620
|
-
current = current.host;
|
|
3621
|
-
}
|
|
3622
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
3623
|
-
if (isScrollable) {
|
|
3624
|
-
var _a = getScrollVariables(axis, current), scrollHeight = _a[1], clientHeight = _a[2];
|
|
3625
|
-
if (scrollHeight > clientHeight) {
|
|
3626
|
-
return true;
|
|
3627
|
-
}
|
|
3628
|
-
}
|
|
3629
|
-
current = current.parentNode;
|
|
3630
|
-
} while (current && current !== ownerDocument.body);
|
|
3631
|
-
return false;
|
|
3632
|
-
};
|
|
3633
|
-
var getVScrollVariables = function(_a) {
|
|
3634
|
-
var scrollTop = _a.scrollTop, scrollHeight = _a.scrollHeight, clientHeight = _a.clientHeight;
|
|
3635
|
-
return [
|
|
3636
|
-
scrollTop,
|
|
3637
|
-
scrollHeight,
|
|
3638
|
-
clientHeight
|
|
3639
|
-
];
|
|
3640
|
-
};
|
|
3641
|
-
var getHScrollVariables = function(_a) {
|
|
3642
|
-
var scrollLeft = _a.scrollLeft, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth;
|
|
3643
|
-
return [
|
|
3644
|
-
scrollLeft,
|
|
3645
|
-
scrollWidth,
|
|
3646
|
-
clientWidth
|
|
3647
|
-
];
|
|
3648
|
-
};
|
|
3649
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
3650
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
3651
|
-
};
|
|
3652
|
-
var getScrollVariables = function(axis, node) {
|
|
3653
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
3654
|
-
};
|
|
3655
|
-
var getDirectionFactor = function(axis, direction) {
|
|
3656
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
3657
|
-
};
|
|
3658
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
3659
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
3660
|
-
var delta = directionFactor * sourceDelta;
|
|
3661
|
-
var target = event.target;
|
|
3662
|
-
var targetInLock = endTarget.contains(target);
|
|
3663
|
-
var shouldCancelScroll = false;
|
|
3664
|
-
var isDeltaPositive = delta > 0;
|
|
3665
|
-
var availableScroll = 0;
|
|
3666
|
-
var availableScrollTop = 0;
|
|
3667
|
-
do {
|
|
3668
|
-
if (!target) {
|
|
3669
|
-
break;
|
|
3670
|
-
}
|
|
3671
|
-
var _a = getScrollVariables(axis, target), position = _a[0], scroll_1 = _a[1], capacity = _a[2];
|
|
3672
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
3673
|
-
if (position || elementScroll) {
|
|
3674
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
3675
|
-
availableScroll += elementScroll;
|
|
3676
|
-
availableScrollTop += position;
|
|
3677
|
-
}
|
|
3678
|
-
}
|
|
3679
|
-
var parent_1 = target.parentNode;
|
|
3680
|
-
target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
|
|
3681
|
-
} while (
|
|
3682
|
-
// portaled content
|
|
3683
|
-
!targetInLock && target !== document.body || // self content
|
|
3684
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
3685
|
-
);
|
|
3686
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
3687
|
-
shouldCancelScroll = true;
|
|
3688
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
3689
|
-
shouldCancelScroll = true;
|
|
3690
|
-
}
|
|
3691
|
-
return shouldCancelScroll;
|
|
3692
|
-
};
|
|
3693
|
-
|
|
3694
|
-
// node_modules/react-remove-scroll/dist/es2015/SideEffect.js
|
|
3695
|
-
var getTouchXY = function(event) {
|
|
3696
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
3697
|
-
};
|
|
3698
|
-
var getDeltaXY = function(event) {
|
|
3699
|
-
return [event.deltaX, event.deltaY];
|
|
3700
|
-
};
|
|
3701
|
-
var extractRef = function(ref) {
|
|
3702
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
3703
|
-
};
|
|
3704
|
-
var deltaCompare = function(x, y) {
|
|
3705
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
3706
|
-
};
|
|
3707
|
-
var generateStyle = function(id) {
|
|
3708
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
3709
|
-
};
|
|
3710
|
-
var idCounter = 0;
|
|
3711
|
-
var lockStack = [];
|
|
3712
|
-
function RemoveScrollSideCar(props) {
|
|
3713
|
-
var shouldPreventQueue = React30__namespace.useRef([]);
|
|
3714
|
-
var touchStartRef = React30__namespace.useRef([0, 0]);
|
|
3715
|
-
var activeAxis = React30__namespace.useRef();
|
|
3716
|
-
var id = React30__namespace.useState(idCounter++)[0];
|
|
3717
|
-
var Style2 = React30__namespace.useState(styleSingleton)[0];
|
|
3718
|
-
var lastProps = React30__namespace.useRef(props);
|
|
3719
|
-
React30__namespace.useEffect(function() {
|
|
3720
|
-
lastProps.current = props;
|
|
3721
|
-
}, [props]);
|
|
3722
|
-
React30__namespace.useEffect(function() {
|
|
3723
|
-
if (props.inert) {
|
|
3724
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
3725
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef)).filter(Boolean);
|
|
3726
|
-
allow_1.forEach(function(el) {
|
|
3727
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
3728
|
-
});
|
|
3729
|
-
return function() {
|
|
3730
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
3731
|
-
allow_1.forEach(function(el) {
|
|
3732
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
3733
|
-
});
|
|
3734
|
-
};
|
|
3735
|
-
}
|
|
3736
|
-
return;
|
|
3737
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
3738
|
-
var shouldCancelEvent = React30__namespace.useCallback(function(event, parent) {
|
|
3739
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
3740
|
-
return !lastProps.current.allowPinchZoom;
|
|
3741
|
-
}
|
|
3742
|
-
var touch = getTouchXY(event);
|
|
3743
|
-
var touchStart = touchStartRef.current;
|
|
3744
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
3745
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
3746
|
-
var currentAxis;
|
|
3747
|
-
var target = event.target;
|
|
3748
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
3749
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
3750
|
-
return false;
|
|
3751
|
-
}
|
|
3752
|
-
var selection = window.getSelection();
|
|
3753
|
-
var anchorNode = selection && selection.anchorNode;
|
|
3754
|
-
var isTouchingSelection = anchorNode ? anchorNode === target || anchorNode.contains(target) : false;
|
|
3755
|
-
if (isTouchingSelection) {
|
|
3756
|
-
return false;
|
|
3757
|
-
}
|
|
3758
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3759
|
-
if (!canBeScrolledInMainDirection) {
|
|
3760
|
-
return true;
|
|
3761
|
-
}
|
|
3762
|
-
if (canBeScrolledInMainDirection) {
|
|
3763
|
-
currentAxis = moveDirection;
|
|
3764
|
-
} else {
|
|
3765
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
3766
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3767
|
-
}
|
|
3768
|
-
if (!canBeScrolledInMainDirection) {
|
|
3769
|
-
return false;
|
|
3770
|
-
}
|
|
3771
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
3772
|
-
activeAxis.current = currentAxis;
|
|
3773
|
-
}
|
|
3774
|
-
if (!currentAxis) {
|
|
3775
|
-
return true;
|
|
3776
|
-
}
|
|
3777
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
3778
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
3779
|
-
}, []);
|
|
3780
|
-
var shouldPrevent = React30__namespace.useCallback(function(_event) {
|
|
3781
|
-
var event = _event;
|
|
3782
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
3783
|
-
return;
|
|
3784
|
-
}
|
|
3785
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
3786
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
3787
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
3788
|
-
})[0];
|
|
3789
|
-
if (sourceEvent && sourceEvent.should) {
|
|
3790
|
-
if (event.cancelable) {
|
|
3791
|
-
event.preventDefault();
|
|
3792
|
-
}
|
|
3793
|
-
return;
|
|
3794
|
-
}
|
|
3795
|
-
if (!sourceEvent) {
|
|
3796
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
3797
|
-
return node.contains(event.target);
|
|
3798
|
-
});
|
|
3799
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
3800
|
-
if (shouldStop) {
|
|
3801
|
-
if (event.cancelable) {
|
|
3802
|
-
event.preventDefault();
|
|
3803
|
-
}
|
|
3804
|
-
}
|
|
3805
|
-
}
|
|
3806
|
-
}, []);
|
|
3807
|
-
var shouldCancel = React30__namespace.useCallback(function(name, delta, target, should) {
|
|
3808
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
3809
|
-
shouldPreventQueue.current.push(event);
|
|
3810
|
-
setTimeout(function() {
|
|
3811
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
3812
|
-
return e !== event;
|
|
3813
|
-
});
|
|
3814
|
-
}, 1);
|
|
3815
|
-
}, []);
|
|
3816
|
-
var scrollTouchStart = React30__namespace.useCallback(function(event) {
|
|
3817
|
-
touchStartRef.current = getTouchXY(event);
|
|
3818
|
-
activeAxis.current = void 0;
|
|
3819
|
-
}, []);
|
|
3820
|
-
var scrollWheel = React30__namespace.useCallback(function(event) {
|
|
3821
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3822
|
-
}, []);
|
|
3823
|
-
var scrollTouchMove = React30__namespace.useCallback(function(event) {
|
|
3824
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3825
|
-
}, []);
|
|
3826
|
-
React30__namespace.useEffect(function() {
|
|
3827
|
-
lockStack.push(Style2);
|
|
3828
|
-
props.setCallbacks({
|
|
3829
|
-
onScrollCapture: scrollWheel,
|
|
3830
|
-
onWheelCapture: scrollWheel,
|
|
3831
|
-
onTouchMoveCapture: scrollTouchMove
|
|
3832
|
-
});
|
|
3833
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
3834
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3835
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3836
|
-
return function() {
|
|
3837
|
-
lockStack = lockStack.filter(function(inst) {
|
|
3838
|
-
return inst !== Style2;
|
|
3839
|
-
});
|
|
3840
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
3841
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3842
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3843
|
-
};
|
|
3844
|
-
}, []);
|
|
3845
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
3846
|
-
return React30__namespace.createElement(
|
|
3847
|
-
React30__namespace.Fragment,
|
|
3848
|
-
null,
|
|
3849
|
-
inert ? React30__namespace.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
3850
|
-
removeScrollBar ? React30__namespace.createElement(RemoveScrollBar, { noRelative: props.noRelative, gapMode: props.gapMode }) : null
|
|
3851
|
-
);
|
|
3852
|
-
}
|
|
3853
|
-
function getOutermostShadowParent(node) {
|
|
3854
|
-
var shadowParent = null;
|
|
3855
|
-
while (node !== null) {
|
|
3856
|
-
if (node instanceof ShadowRoot) {
|
|
3857
|
-
shadowParent = node.host;
|
|
3858
|
-
node = node.host;
|
|
3859
|
-
}
|
|
3860
|
-
node = node.parentNode;
|
|
3861
|
-
}
|
|
3862
|
-
return shadowParent;
|
|
3863
|
-
}
|
|
3864
|
-
|
|
3865
|
-
// node_modules/react-remove-scroll/dist/es2015/sidecar.js
|
|
3866
|
-
var sidecar_default = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
3867
|
-
|
|
3868
|
-
// node_modules/react-remove-scroll/dist/es2015/Combination.js
|
|
3869
|
-
var ReactRemoveScroll = React30__namespace.forwardRef(function(props, ref) {
|
|
3870
|
-
return React30__namespace.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: sidecar_default }));
|
|
3871
|
-
});
|
|
3872
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
3873
|
-
var Combination_default = ReactRemoveScroll;
|
|
3874
|
-
var OPEN_KEYS = [" ", "Enter", "ArrowUp", "ArrowDown"];
|
|
3875
|
-
var SELECTION_KEYS = [" ", "Enter"];
|
|
3876
|
-
var SELECT_NAME = "Select";
|
|
3877
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(SELECT_NAME);
|
|
3878
|
-
var [createSelectContext] = createContextScope(SELECT_NAME, [
|
|
3879
|
-
createCollectionScope,
|
|
3880
|
-
createPopperScope
|
|
3881
|
-
]);
|
|
3882
|
-
var usePopperScope = createPopperScope();
|
|
3883
|
-
var [SelectProvider, useSelectContext] = createSelectContext(SELECT_NAME);
|
|
3884
|
-
var [SelectNativeOptionsProvider, useSelectNativeOptionsContext] = createSelectContext(SELECT_NAME);
|
|
3885
|
-
var TRIGGER_NAME = "SelectTrigger";
|
|
3886
|
-
var SelectTrigger = React30__namespace.forwardRef(
|
|
3887
|
-
(props, forwardedRef) => {
|
|
3888
|
-
const { __scopeSelect, disabled = false, ...triggerProps } = props;
|
|
3889
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
3890
|
-
const context = useSelectContext(TRIGGER_NAME, __scopeSelect);
|
|
3891
|
-
const isDisabled = context.disabled || disabled;
|
|
3892
|
-
const composedRefs = useComposedRefs(forwardedRef, context.onTriggerChange);
|
|
3893
|
-
const getItems = useCollection(__scopeSelect);
|
|
3894
|
-
const pointerTypeRef = React30__namespace.useRef("touch");
|
|
3895
|
-
const [searchRef, handleTypeaheadSearch, resetTypeahead] = useTypeaheadSearch((search) => {
|
|
3896
|
-
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
3897
|
-
const currentItem = enabledItems.find((item) => item.value === context.value);
|
|
3898
|
-
const nextItem = findNextItem(enabledItems, search, currentItem);
|
|
3899
|
-
if (nextItem !== void 0) {
|
|
3900
|
-
context.onValueChange(nextItem.value);
|
|
3901
|
-
}
|
|
3902
|
-
});
|
|
3903
|
-
const handleOpen = (pointerEvent) => {
|
|
3904
|
-
if (!isDisabled) {
|
|
3905
|
-
context.onOpenChange(true);
|
|
3906
|
-
resetTypeahead();
|
|
3907
|
-
}
|
|
3908
|
-
if (pointerEvent) {
|
|
3909
|
-
context.triggerPointerDownPosRef.current = {
|
|
3910
|
-
x: Math.round(pointerEvent.pageX),
|
|
3911
|
-
y: Math.round(pointerEvent.pageY)
|
|
3912
|
-
};
|
|
3913
|
-
}
|
|
3914
|
-
};
|
|
3915
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3916
|
-
Primitive.button,
|
|
3917
|
-
{
|
|
3918
|
-
type: "button",
|
|
3919
|
-
role: "combobox",
|
|
3920
|
-
"aria-controls": context.contentId,
|
|
3921
|
-
"aria-expanded": context.open,
|
|
3922
|
-
"aria-required": context.required,
|
|
3923
|
-
"aria-autocomplete": "none",
|
|
3924
|
-
dir: context.dir,
|
|
3925
|
-
"data-state": context.open ? "open" : "closed",
|
|
3926
|
-
disabled: isDisabled,
|
|
3927
|
-
"data-disabled": isDisabled ? "" : void 0,
|
|
3928
|
-
"data-placeholder": shouldShowPlaceholder(context.value) ? "" : void 0,
|
|
3929
|
-
...triggerProps,
|
|
3930
|
-
ref: composedRefs,
|
|
3931
|
-
onClick: composeEventHandlers(triggerProps.onClick, (event) => {
|
|
3932
|
-
event.currentTarget.focus();
|
|
3933
|
-
if (pointerTypeRef.current !== "mouse") {
|
|
3934
|
-
handleOpen(event);
|
|
3935
|
-
}
|
|
3936
|
-
}),
|
|
3937
|
-
onPointerDown: composeEventHandlers(triggerProps.onPointerDown, (event) => {
|
|
3938
|
-
pointerTypeRef.current = event.pointerType;
|
|
3939
|
-
const target = event.target;
|
|
3940
|
-
if (target.hasPointerCapture(event.pointerId)) {
|
|
3941
|
-
target.releasePointerCapture(event.pointerId);
|
|
3942
|
-
}
|
|
3943
|
-
if (event.button === 0 && event.ctrlKey === false && event.pointerType === "mouse") {
|
|
3944
|
-
handleOpen(event);
|
|
3945
|
-
event.preventDefault();
|
|
3946
|
-
}
|
|
3947
|
-
}),
|
|
3948
|
-
onKeyDown: composeEventHandlers(triggerProps.onKeyDown, (event) => {
|
|
3949
|
-
const isTypingAhead = searchRef.current !== "";
|
|
3950
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
3951
|
-
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
3952
|
-
if (isTypingAhead && event.key === " ") return;
|
|
3953
|
-
if (OPEN_KEYS.includes(event.key)) {
|
|
3954
|
-
handleOpen();
|
|
3955
|
-
event.preventDefault();
|
|
3956
|
-
}
|
|
3957
|
-
})
|
|
3958
|
-
}
|
|
3959
|
-
) });
|
|
3960
|
-
}
|
|
3961
|
-
);
|
|
3962
|
-
SelectTrigger.displayName = TRIGGER_NAME;
|
|
3963
|
-
var VALUE_NAME = "SelectValue";
|
|
3964
|
-
var SelectValue = React30__namespace.forwardRef(
|
|
3965
|
-
(props, forwardedRef) => {
|
|
3966
|
-
const { __scopeSelect, className, style, children, placeholder = "", ...valueProps } = props;
|
|
3967
|
-
const context = useSelectContext(VALUE_NAME, __scopeSelect);
|
|
3968
|
-
const { onValueNodeHasChildrenChange } = context;
|
|
3969
|
-
const hasChildren = children !== void 0;
|
|
3970
|
-
const composedRefs = useComposedRefs(forwardedRef, context.onValueNodeChange);
|
|
3971
|
-
useLayoutEffect2(() => {
|
|
3972
|
-
onValueNodeHasChildrenChange(hasChildren);
|
|
3973
|
-
}, [onValueNodeHasChildrenChange, hasChildren]);
|
|
3974
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3975
|
-
Primitive.span,
|
|
3976
|
-
{
|
|
3977
|
-
...valueProps,
|
|
3978
|
-
ref: composedRefs,
|
|
3979
|
-
style: { pointerEvents: "none" },
|
|
3980
|
-
children: shouldShowPlaceholder(context.value) ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: placeholder }) : children
|
|
3981
|
-
}
|
|
3982
|
-
);
|
|
3983
|
-
}
|
|
3984
|
-
);
|
|
3985
|
-
SelectValue.displayName = VALUE_NAME;
|
|
3986
|
-
var ICON_NAME = "SelectIcon";
|
|
3987
|
-
var SelectIcon = React30__namespace.forwardRef(
|
|
3988
|
-
(props, forwardedRef) => {
|
|
3989
|
-
const { __scopeSelect, children, ...iconProps } = props;
|
|
3990
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.span, { "aria-hidden": true, ...iconProps, ref: forwardedRef, children: children || "\u25BC" });
|
|
3991
|
-
}
|
|
3992
|
-
);
|
|
3993
|
-
SelectIcon.displayName = ICON_NAME;
|
|
3994
|
-
var CONTENT_NAME2 = "SelectContent";
|
|
3995
|
-
var SelectContent2 = React30__namespace.forwardRef(
|
|
3996
|
-
(props, forwardedRef) => {
|
|
3997
|
-
const context = useSelectContext(CONTENT_NAME2, props.__scopeSelect);
|
|
3998
|
-
const [fragment, setFragment] = React30__namespace.useState();
|
|
3999
|
-
useLayoutEffect2(() => {
|
|
4000
|
-
setFragment(new DocumentFragment());
|
|
4001
|
-
}, []);
|
|
4002
|
-
if (!context.open) {
|
|
4003
|
-
const frag = fragment;
|
|
4004
|
-
return frag ? ReactDOM4__namespace.createPortal(
|
|
4005
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectContentProvider, { scope: props.__scopeSelect, children: /* @__PURE__ */ jsxRuntime.jsx(Collection.Slot, { scope: props.__scopeSelect, children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: props.children }) }) }),
|
|
4006
|
-
frag
|
|
4007
|
-
) : null;
|
|
4008
|
-
}
|
|
4009
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectContentImpl, { ...props, ref: forwardedRef });
|
|
4010
|
-
}
|
|
4011
|
-
);
|
|
4012
|
-
SelectContent2.displayName = CONTENT_NAME2;
|
|
4013
|
-
var CONTENT_MARGIN = 10;
|
|
4014
|
-
var [SelectContentProvider, useSelectContentContext] = createSelectContext(CONTENT_NAME2);
|
|
4015
|
-
var CONTENT_IMPL_NAME = "SelectContentImpl";
|
|
4016
|
-
var Slot = reactSlot.createSlot("SelectContent.RemoveScroll");
|
|
4017
|
-
var SelectContentImpl = React30__namespace.forwardRef(
|
|
4018
|
-
(props, forwardedRef) => {
|
|
4019
|
-
const {
|
|
4020
|
-
__scopeSelect,
|
|
4021
|
-
position = "item-aligned",
|
|
4022
|
-
onCloseAutoFocus,
|
|
4023
|
-
onEscapeKeyDown,
|
|
4024
|
-
onPointerDownOutside,
|
|
4025
|
-
//
|
|
4026
|
-
// PopperContent props
|
|
4027
|
-
side,
|
|
4028
|
-
sideOffset,
|
|
4029
|
-
align,
|
|
4030
|
-
alignOffset,
|
|
4031
|
-
arrowPadding,
|
|
4032
|
-
collisionBoundary,
|
|
4033
|
-
collisionPadding,
|
|
4034
|
-
sticky,
|
|
4035
|
-
hideWhenDetached,
|
|
4036
|
-
avoidCollisions,
|
|
4037
|
-
//
|
|
4038
|
-
...contentProps
|
|
4039
|
-
} = props;
|
|
4040
|
-
const context = useSelectContext(CONTENT_NAME2, __scopeSelect);
|
|
4041
|
-
const [content, setContent] = React30__namespace.useState(null);
|
|
4042
|
-
const [viewport, setViewport] = React30__namespace.useState(null);
|
|
4043
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
4044
|
-
const [selectedItem, setSelectedItem] = React30__namespace.useState(null);
|
|
4045
|
-
const [selectedItemText, setSelectedItemText] = React30__namespace.useState(
|
|
4046
|
-
null
|
|
4047
|
-
);
|
|
4048
|
-
const getItems = useCollection(__scopeSelect);
|
|
4049
|
-
const [isPositioned, setIsPositioned] = React30__namespace.useState(false);
|
|
4050
|
-
const firstValidItemFoundRef = React30__namespace.useRef(false);
|
|
4051
|
-
React30__namespace.useEffect(() => {
|
|
4052
|
-
if (content) return hideOthers(content);
|
|
4053
|
-
}, [content]);
|
|
4054
|
-
useFocusGuards();
|
|
4055
|
-
const focusFirst2 = React30__namespace.useCallback(
|
|
4056
|
-
(candidates) => {
|
|
4057
|
-
const [firstItem, ...restItems] = getItems().map((item) => item.ref.current);
|
|
4058
|
-
const [lastItem] = restItems.slice(-1);
|
|
4059
|
-
const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
4060
|
-
for (const candidate of candidates) {
|
|
4061
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
4062
|
-
candidate?.scrollIntoView({ block: "nearest" });
|
|
4063
|
-
if (candidate === firstItem && viewport) viewport.scrollTop = 0;
|
|
4064
|
-
if (candidate === lastItem && viewport) viewport.scrollTop = viewport.scrollHeight;
|
|
4065
|
-
candidate?.focus();
|
|
4066
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
4067
|
-
}
|
|
4068
|
-
},
|
|
4069
|
-
[getItems, viewport]
|
|
4070
|
-
);
|
|
4071
|
-
const focusSelectedItem = React30__namespace.useCallback(
|
|
4072
|
-
() => focusFirst2([selectedItem, content]),
|
|
4073
|
-
[focusFirst2, selectedItem, content]
|
|
4074
|
-
);
|
|
4075
|
-
React30__namespace.useEffect(() => {
|
|
4076
|
-
if (isPositioned) {
|
|
4077
|
-
focusSelectedItem();
|
|
4078
|
-
}
|
|
4079
|
-
}, [isPositioned, focusSelectedItem]);
|
|
4080
|
-
const { onOpenChange, triggerPointerDownPosRef } = context;
|
|
4081
|
-
React30__namespace.useEffect(() => {
|
|
4082
|
-
if (content) {
|
|
4083
|
-
let pointerMoveDelta = { x: 0, y: 0 };
|
|
4084
|
-
const handlePointerMove = (event) => {
|
|
4085
|
-
pointerMoveDelta = {
|
|
4086
|
-
x: Math.abs(Math.round(event.pageX) - (triggerPointerDownPosRef.current?.x ?? 0)),
|
|
4087
|
-
y: Math.abs(Math.round(event.pageY) - (triggerPointerDownPosRef.current?.y ?? 0))
|
|
4088
|
-
};
|
|
4089
|
-
};
|
|
4090
|
-
const handlePointerUp = (event) => {
|
|
4091
|
-
if (pointerMoveDelta.x <= 10 && pointerMoveDelta.y <= 10) {
|
|
4092
|
-
event.preventDefault();
|
|
4093
|
-
} else {
|
|
4094
|
-
if (!content.contains(event.target)) {
|
|
4095
|
-
onOpenChange(false);
|
|
4096
|
-
}
|
|
4097
|
-
}
|
|
4098
|
-
document.removeEventListener("pointermove", handlePointerMove);
|
|
4099
|
-
triggerPointerDownPosRef.current = null;
|
|
4100
|
-
};
|
|
4101
|
-
if (triggerPointerDownPosRef.current !== null) {
|
|
4102
|
-
document.addEventListener("pointermove", handlePointerMove);
|
|
4103
|
-
document.addEventListener("pointerup", handlePointerUp, { capture: true, once: true });
|
|
4104
|
-
}
|
|
4105
|
-
return () => {
|
|
4106
|
-
document.removeEventListener("pointermove", handlePointerMove);
|
|
4107
|
-
document.removeEventListener("pointerup", handlePointerUp, { capture: true });
|
|
4108
|
-
};
|
|
4109
|
-
}
|
|
4110
|
-
}, [content, onOpenChange, triggerPointerDownPosRef]);
|
|
4111
|
-
React30__namespace.useEffect(() => {
|
|
4112
|
-
const close = () => onOpenChange(false);
|
|
4113
|
-
window.addEventListener("blur", close);
|
|
4114
|
-
window.addEventListener("resize", close);
|
|
4115
|
-
return () => {
|
|
4116
|
-
window.removeEventListener("blur", close);
|
|
4117
|
-
window.removeEventListener("resize", close);
|
|
4118
|
-
};
|
|
4119
|
-
}, [onOpenChange]);
|
|
4120
|
-
const [searchRef, handleTypeaheadSearch] = useTypeaheadSearch((search) => {
|
|
4121
|
-
const enabledItems = getItems().filter((item) => !item.disabled);
|
|
4122
|
-
const currentItem = enabledItems.find((item) => item.ref.current === document.activeElement);
|
|
4123
|
-
const nextItem = findNextItem(enabledItems, search, currentItem);
|
|
4124
|
-
if (nextItem) {
|
|
4125
|
-
setTimeout(() => nextItem.ref.current.focus());
|
|
4126
|
-
}
|
|
4127
|
-
});
|
|
4128
|
-
const itemRefCallback = React30__namespace.useCallback(
|
|
4129
|
-
(node, value, disabled) => {
|
|
4130
|
-
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
4131
|
-
const isSelectedItem = context.value !== void 0 && context.value === value;
|
|
4132
|
-
if (isSelectedItem || isFirstValidItem) {
|
|
4133
|
-
setSelectedItem(node);
|
|
4134
|
-
if (isFirstValidItem) firstValidItemFoundRef.current = true;
|
|
4135
|
-
}
|
|
4136
|
-
},
|
|
4137
|
-
[context.value]
|
|
4138
|
-
);
|
|
4139
|
-
const handleItemLeave = React30__namespace.useCallback(() => content?.focus(), [content]);
|
|
4140
|
-
const itemTextRefCallback = React30__namespace.useCallback(
|
|
4141
|
-
(node, value, disabled) => {
|
|
4142
|
-
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
4143
|
-
const isSelectedItem = context.value !== void 0 && context.value === value;
|
|
4144
|
-
if (isSelectedItem || isFirstValidItem) {
|
|
4145
|
-
setSelectedItemText(node);
|
|
4146
|
-
}
|
|
4147
|
-
},
|
|
4148
|
-
[context.value]
|
|
4149
|
-
);
|
|
4150
|
-
const SelectPosition = position === "popper" ? SelectPopperPosition : SelectItemAlignedPosition;
|
|
4151
|
-
const popperContentProps = SelectPosition === SelectPopperPosition ? {
|
|
4152
|
-
side,
|
|
4153
|
-
sideOffset,
|
|
4154
|
-
align,
|
|
4155
|
-
alignOffset,
|
|
4156
|
-
arrowPadding,
|
|
4157
|
-
collisionBoundary,
|
|
4158
|
-
collisionPadding,
|
|
4159
|
-
sticky,
|
|
4160
|
-
hideWhenDetached,
|
|
4161
|
-
avoidCollisions
|
|
4162
|
-
} : {};
|
|
4163
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4164
|
-
SelectContentProvider,
|
|
4165
|
-
{
|
|
4166
|
-
scope: __scopeSelect,
|
|
4167
|
-
content,
|
|
4168
|
-
viewport,
|
|
4169
|
-
onViewportChange: setViewport,
|
|
4170
|
-
itemRefCallback,
|
|
4171
|
-
selectedItem,
|
|
4172
|
-
onItemLeave: handleItemLeave,
|
|
4173
|
-
itemTextRefCallback,
|
|
4174
|
-
focusSelectedItem,
|
|
4175
|
-
selectedItemText,
|
|
4176
|
-
position,
|
|
4177
|
-
isPositioned,
|
|
4178
|
-
searchRef,
|
|
4179
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Combination_default, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4180
|
-
FocusScope,
|
|
4181
|
-
{
|
|
4182
|
-
asChild: true,
|
|
4183
|
-
trapped: context.open,
|
|
4184
|
-
onMountAutoFocus: (event) => {
|
|
4185
|
-
event.preventDefault();
|
|
4186
|
-
},
|
|
4187
|
-
onUnmountAutoFocus: composeEventHandlers(onCloseAutoFocus, (event) => {
|
|
4188
|
-
context.trigger?.focus({ preventScroll: true });
|
|
4189
|
-
event.preventDefault();
|
|
4190
|
-
}),
|
|
4191
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4192
|
-
DismissableLayer,
|
|
4193
|
-
{
|
|
4194
|
-
asChild: true,
|
|
4195
|
-
disableOutsidePointerEvents: true,
|
|
4196
|
-
onEscapeKeyDown,
|
|
4197
|
-
onPointerDownOutside,
|
|
4198
|
-
onFocusOutside: (event) => event.preventDefault(),
|
|
4199
|
-
onDismiss: () => context.onOpenChange(false),
|
|
4200
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4201
|
-
SelectPosition,
|
|
4202
|
-
{
|
|
4203
|
-
role: "listbox",
|
|
4204
|
-
id: context.contentId,
|
|
4205
|
-
"data-state": context.open ? "open" : "closed",
|
|
4206
|
-
dir: context.dir,
|
|
4207
|
-
onContextMenu: (event) => event.preventDefault(),
|
|
4208
|
-
...contentProps,
|
|
4209
|
-
...popperContentProps,
|
|
4210
|
-
onPlaced: () => setIsPositioned(true),
|
|
4211
|
-
ref: composedRefs,
|
|
4212
|
-
style: {
|
|
4213
|
-
// flex layout so we can place the scroll buttons properly
|
|
4214
|
-
display: "flex",
|
|
4215
|
-
flexDirection: "column",
|
|
4216
|
-
// reset the outline by default as the content MAY get focused
|
|
4217
|
-
outline: "none",
|
|
4218
|
-
...contentProps.style
|
|
4219
|
-
},
|
|
4220
|
-
onKeyDown: composeEventHandlers(contentProps.onKeyDown, (event) => {
|
|
4221
|
-
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
4222
|
-
if (event.key === "Tab") event.preventDefault();
|
|
4223
|
-
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
4224
|
-
if (["ArrowUp", "ArrowDown", "Home", "End"].includes(event.key)) {
|
|
4225
|
-
const items = getItems().filter((item) => !item.disabled);
|
|
4226
|
-
let candidateNodes = items.map((item) => item.ref.current);
|
|
4227
|
-
if (["ArrowUp", "End"].includes(event.key)) {
|
|
4228
|
-
candidateNodes = candidateNodes.slice().reverse();
|
|
4229
|
-
}
|
|
4230
|
-
if (["ArrowUp", "ArrowDown"].includes(event.key)) {
|
|
4231
|
-
const currentElement = event.target;
|
|
4232
|
-
const currentIndex = candidateNodes.indexOf(currentElement);
|
|
4233
|
-
candidateNodes = candidateNodes.slice(currentIndex + 1);
|
|
4234
|
-
}
|
|
4235
|
-
setTimeout(() => focusFirst2(candidateNodes));
|
|
4236
|
-
event.preventDefault();
|
|
4237
|
-
}
|
|
4238
|
-
})
|
|
4239
|
-
}
|
|
4240
|
-
)
|
|
4241
|
-
}
|
|
4242
|
-
)
|
|
4243
|
-
}
|
|
4244
|
-
) })
|
|
4245
|
-
}
|
|
4246
|
-
);
|
|
4247
|
-
}
|
|
4248
|
-
);
|
|
4249
|
-
SelectContentImpl.displayName = CONTENT_IMPL_NAME;
|
|
4250
|
-
var ITEM_ALIGNED_POSITION_NAME = "SelectItemAlignedPosition";
|
|
4251
|
-
var SelectItemAlignedPosition = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
4252
|
-
const { __scopeSelect, onPlaced, ...popperProps } = props;
|
|
4253
|
-
const context = useSelectContext(CONTENT_NAME2, __scopeSelect);
|
|
4254
|
-
const contentContext = useSelectContentContext(CONTENT_NAME2, __scopeSelect);
|
|
4255
|
-
const [contentWrapper, setContentWrapper] = React30__namespace.useState(null);
|
|
4256
|
-
const [content, setContent] = React30__namespace.useState(null);
|
|
4257
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
|
|
4258
|
-
const getItems = useCollection(__scopeSelect);
|
|
4259
|
-
const shouldExpandOnScrollRef = React30__namespace.useRef(false);
|
|
4260
|
-
const shouldRepositionRef = React30__namespace.useRef(true);
|
|
4261
|
-
const { viewport, selectedItem, selectedItemText, focusSelectedItem } = contentContext;
|
|
4262
|
-
const position = React30__namespace.useCallback(() => {
|
|
4263
|
-
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
4264
|
-
const triggerRect = context.trigger.getBoundingClientRect();
|
|
4265
|
-
const contentRect = content.getBoundingClientRect();
|
|
4266
|
-
const valueNodeRect = context.valueNode.getBoundingClientRect();
|
|
4267
|
-
const itemTextRect = selectedItemText.getBoundingClientRect();
|
|
4268
|
-
if (context.dir !== "rtl") {
|
|
4269
|
-
const itemTextOffset = itemTextRect.left - contentRect.left;
|
|
4270
|
-
const left = valueNodeRect.left - itemTextOffset;
|
|
4271
|
-
const leftDelta = triggerRect.left - left;
|
|
4272
|
-
const minContentWidth = triggerRect.width + leftDelta;
|
|
4273
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
4274
|
-
const rightEdge = window.innerWidth - CONTENT_MARGIN;
|
|
4275
|
-
const clampedLeft = clamp(left, [
|
|
4276
|
-
CONTENT_MARGIN,
|
|
4277
|
-
// Prevents the content from going off the starting edge of the
|
|
4278
|
-
// viewport. It may still go off the ending edge, but this can be
|
|
4279
|
-
// controlled by the user since they may want to manage overflow in a
|
|
4280
|
-
// specific way.
|
|
4281
|
-
// https://github.com/radix-ui/primitives/issues/2049
|
|
4282
|
-
Math.max(CONTENT_MARGIN, rightEdge - contentWidth)
|
|
4283
|
-
]);
|
|
4284
|
-
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
4285
|
-
contentWrapper.style.left = clampedLeft + "px";
|
|
4286
|
-
} else {
|
|
4287
|
-
const itemTextOffset = contentRect.right - itemTextRect.right;
|
|
4288
|
-
const right = window.innerWidth - valueNodeRect.right - itemTextOffset;
|
|
4289
|
-
const rightDelta = window.innerWidth - triggerRect.right - right;
|
|
4290
|
-
const minContentWidth = triggerRect.width + rightDelta;
|
|
4291
|
-
const contentWidth = Math.max(minContentWidth, contentRect.width);
|
|
4292
|
-
const leftEdge = window.innerWidth - CONTENT_MARGIN;
|
|
4293
|
-
const clampedRight = clamp(right, [
|
|
4294
|
-
CONTENT_MARGIN,
|
|
4295
|
-
Math.max(CONTENT_MARGIN, leftEdge - contentWidth)
|
|
4296
|
-
]);
|
|
4297
|
-
contentWrapper.style.minWidth = minContentWidth + "px";
|
|
4298
|
-
contentWrapper.style.right = clampedRight + "px";
|
|
4299
|
-
}
|
|
4300
|
-
const items = getItems();
|
|
4301
|
-
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
4302
|
-
const itemsHeight = viewport.scrollHeight;
|
|
4303
|
-
const contentStyles = window.getComputedStyle(content);
|
|
4304
|
-
const contentBorderTopWidth = parseInt(contentStyles.borderTopWidth, 10);
|
|
4305
|
-
const contentPaddingTop = parseInt(contentStyles.paddingTop, 10);
|
|
4306
|
-
const contentBorderBottomWidth = parseInt(contentStyles.borderBottomWidth, 10);
|
|
4307
|
-
const contentPaddingBottom = parseInt(contentStyles.paddingBottom, 10);
|
|
4308
|
-
const fullContentHeight = contentBorderTopWidth + contentPaddingTop + itemsHeight + contentPaddingBottom + contentBorderBottomWidth;
|
|
4309
|
-
const minContentHeight = Math.min(selectedItem.offsetHeight * 5, fullContentHeight);
|
|
4310
|
-
const viewportStyles = window.getComputedStyle(viewport);
|
|
4311
|
-
const viewportPaddingTop = parseInt(viewportStyles.paddingTop, 10);
|
|
4312
|
-
const viewportPaddingBottom = parseInt(viewportStyles.paddingBottom, 10);
|
|
4313
|
-
const topEdgeToTriggerMiddle = triggerRect.top + triggerRect.height / 2 - CONTENT_MARGIN;
|
|
4314
|
-
const triggerMiddleToBottomEdge = availableHeight - topEdgeToTriggerMiddle;
|
|
4315
|
-
const selectedItemHalfHeight = selectedItem.offsetHeight / 2;
|
|
4316
|
-
const itemOffsetMiddle = selectedItem.offsetTop + selectedItemHalfHeight;
|
|
4317
|
-
const contentTopToItemMiddle = contentBorderTopWidth + contentPaddingTop + itemOffsetMiddle;
|
|
4318
|
-
const itemMiddleToContentBottom = fullContentHeight - contentTopToItemMiddle;
|
|
4319
|
-
const willAlignWithoutTopOverflow = contentTopToItemMiddle <= topEdgeToTriggerMiddle;
|
|
4320
|
-
if (willAlignWithoutTopOverflow) {
|
|
4321
|
-
const isLastItem = items.length > 0 && selectedItem === items[items.length - 1].ref.current;
|
|
4322
|
-
contentWrapper.style.bottom = "0px";
|
|
4323
|
-
const viewportOffsetBottom = content.clientHeight - viewport.offsetTop - viewport.offsetHeight;
|
|
4324
|
-
const clampedTriggerMiddleToBottomEdge = Math.max(
|
|
4325
|
-
triggerMiddleToBottomEdge,
|
|
4326
|
-
selectedItemHalfHeight + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
4327
|
-
(isLastItem ? viewportPaddingBottom : 0) + viewportOffsetBottom + contentBorderBottomWidth
|
|
4328
|
-
);
|
|
4329
|
-
const height = contentTopToItemMiddle + clampedTriggerMiddleToBottomEdge;
|
|
4330
|
-
contentWrapper.style.height = height + "px";
|
|
4331
|
-
} else {
|
|
4332
|
-
const isFirstItem = items.length > 0 && selectedItem === items[0].ref.current;
|
|
4333
|
-
contentWrapper.style.top = "0px";
|
|
4334
|
-
const clampedTopEdgeToTriggerMiddle = Math.max(
|
|
4335
|
-
topEdgeToTriggerMiddle,
|
|
4336
|
-
contentBorderTopWidth + viewport.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
4337
|
-
(isFirstItem ? viewportPaddingTop : 0) + selectedItemHalfHeight
|
|
4338
|
-
);
|
|
4339
|
-
const height = clampedTopEdgeToTriggerMiddle + itemMiddleToContentBottom;
|
|
4340
|
-
contentWrapper.style.height = height + "px";
|
|
4341
|
-
viewport.scrollTop = contentTopToItemMiddle - topEdgeToTriggerMiddle + viewport.offsetTop;
|
|
4342
|
-
}
|
|
4343
|
-
contentWrapper.style.margin = `${CONTENT_MARGIN}px 0`;
|
|
4344
|
-
contentWrapper.style.minHeight = minContentHeight + "px";
|
|
4345
|
-
contentWrapper.style.maxHeight = availableHeight + "px";
|
|
4346
|
-
onPlaced?.();
|
|
4347
|
-
requestAnimationFrame(() => shouldExpandOnScrollRef.current = true);
|
|
4348
|
-
}
|
|
4349
|
-
}, [
|
|
4350
|
-
getItems,
|
|
4351
|
-
context.trigger,
|
|
4352
|
-
context.valueNode,
|
|
4353
|
-
contentWrapper,
|
|
4354
|
-
content,
|
|
4355
|
-
viewport,
|
|
4356
|
-
selectedItem,
|
|
4357
|
-
selectedItemText,
|
|
4358
|
-
context.dir,
|
|
4359
|
-
onPlaced
|
|
4360
|
-
]);
|
|
4361
|
-
useLayoutEffect2(() => position(), [position]);
|
|
4362
|
-
const [contentZIndex, setContentZIndex] = React30__namespace.useState();
|
|
4363
|
-
useLayoutEffect2(() => {
|
|
4364
|
-
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
4365
|
-
}, [content]);
|
|
4366
|
-
const handleScrollButtonChange = React30__namespace.useCallback(
|
|
4367
|
-
(node) => {
|
|
4368
|
-
if (node && shouldRepositionRef.current === true) {
|
|
4369
|
-
position();
|
|
4370
|
-
focusSelectedItem?.();
|
|
4371
|
-
shouldRepositionRef.current = false;
|
|
4372
|
-
}
|
|
4373
|
-
},
|
|
4374
|
-
[position, focusSelectedItem]
|
|
4375
|
-
);
|
|
4376
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4377
|
-
SelectViewportProvider,
|
|
4378
|
-
{
|
|
4379
|
-
scope: __scopeSelect,
|
|
4380
|
-
contentWrapper,
|
|
4381
|
-
shouldExpandOnScrollRef,
|
|
4382
|
-
onScrollButtonChange: handleScrollButtonChange,
|
|
4383
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4384
|
-
"div",
|
|
4385
|
-
{
|
|
4386
|
-
ref: setContentWrapper,
|
|
4387
|
-
style: {
|
|
4388
|
-
display: "flex",
|
|
4389
|
-
flexDirection: "column",
|
|
4390
|
-
position: "fixed",
|
|
4391
|
-
zIndex: contentZIndex
|
|
4392
|
-
},
|
|
4393
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4394
|
-
Primitive.div,
|
|
4395
|
-
{
|
|
4396
|
-
...popperProps,
|
|
4397
|
-
ref: composedRefs,
|
|
4398
|
-
style: {
|
|
4399
|
-
// When we get the height of the content, it includes borders. If we were to set
|
|
4400
|
-
// the height without having `boxSizing: 'border-box'` it would be too big.
|
|
4401
|
-
boxSizing: "border-box",
|
|
4402
|
-
// We need to ensure the content doesn't get taller than the wrapper
|
|
4403
|
-
maxHeight: "100%",
|
|
4404
|
-
...popperProps.style
|
|
4405
|
-
}
|
|
4406
|
-
}
|
|
4407
|
-
)
|
|
4408
|
-
}
|
|
4409
|
-
)
|
|
4410
|
-
}
|
|
4411
|
-
);
|
|
4412
|
-
});
|
|
4413
|
-
SelectItemAlignedPosition.displayName = ITEM_ALIGNED_POSITION_NAME;
|
|
4414
|
-
var POPPER_POSITION_NAME = "SelectPopperPosition";
|
|
4415
|
-
var SelectPopperPosition = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
4416
|
-
const {
|
|
4417
|
-
__scopeSelect,
|
|
4418
|
-
align = "start",
|
|
4419
|
-
collisionPadding = CONTENT_MARGIN,
|
|
4420
|
-
...popperProps
|
|
4421
|
-
} = props;
|
|
4422
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
4423
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4424
|
-
Content,
|
|
4425
|
-
{
|
|
4426
|
-
...popperScope,
|
|
4427
|
-
...popperProps,
|
|
4428
|
-
ref: forwardedRef,
|
|
4429
|
-
align,
|
|
4430
|
-
collisionPadding,
|
|
4431
|
-
style: {
|
|
4432
|
-
// Ensure border-box for floating-ui calculations
|
|
4433
|
-
boxSizing: "border-box",
|
|
4434
|
-
...popperProps.style,
|
|
4435
|
-
// re-namespace exposed content custom properties
|
|
4436
|
-
...{
|
|
4437
|
-
"--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
4438
|
-
"--radix-select-content-available-width": "var(--radix-popper-available-width)",
|
|
4439
|
-
"--radix-select-content-available-height": "var(--radix-popper-available-height)",
|
|
4440
|
-
"--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
|
|
4441
|
-
"--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
|
|
4442
|
-
}
|
|
4443
|
-
}
|
|
4444
|
-
}
|
|
4445
|
-
);
|
|
4446
|
-
});
|
|
4447
|
-
SelectPopperPosition.displayName = POPPER_POSITION_NAME;
|
|
4448
|
-
var [SelectViewportProvider, useSelectViewportContext] = createSelectContext(CONTENT_NAME2, {});
|
|
4449
|
-
var VIEWPORT_NAME = "SelectViewport";
|
|
4450
|
-
var SelectViewport = React30__namespace.forwardRef(
|
|
4451
|
-
(props, forwardedRef) => {
|
|
4452
|
-
const { __scopeSelect, nonce, ...viewportProps } = props;
|
|
4453
|
-
const contentContext = useSelectContentContext(VIEWPORT_NAME, __scopeSelect);
|
|
4454
|
-
const viewportContext = useSelectViewportContext(VIEWPORT_NAME, __scopeSelect);
|
|
4455
|
-
const composedRefs = useComposedRefs(forwardedRef, contentContext.onViewportChange);
|
|
4456
|
-
const prevScrollTopRef = React30__namespace.useRef(0);
|
|
4457
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4458
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4459
|
-
"style",
|
|
4460
|
-
{
|
|
4461
|
-
dangerouslySetInnerHTML: {
|
|
4462
|
-
__html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`
|
|
4463
|
-
},
|
|
4464
|
-
nonce
|
|
4465
|
-
}
|
|
4466
|
-
),
|
|
4467
|
-
/* @__PURE__ */ jsxRuntime.jsx(Collection.Slot, { scope: __scopeSelect, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4468
|
-
Primitive.div,
|
|
4469
|
-
{
|
|
4470
|
-
"data-radix-select-viewport": "",
|
|
4471
|
-
role: "presentation",
|
|
4472
|
-
...viewportProps,
|
|
4473
|
-
ref: composedRefs,
|
|
4474
|
-
style: {
|
|
4475
|
-
// we use position: 'relative' here on the `viewport` so that when we call
|
|
4476
|
-
// `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
|
|
4477
|
-
// (independent of the scrollUpButton).
|
|
4478
|
-
position: "relative",
|
|
4479
|
-
flex: 1,
|
|
4480
|
-
// Viewport should only be scrollable in the vertical direction.
|
|
4481
|
-
// This won't work in vertical writing modes, so we'll need to
|
|
4482
|
-
// revisit this if/when that is supported
|
|
4483
|
-
// https://developer.chrome.com/blog/vertical-form-controls
|
|
4484
|
-
overflow: "hidden auto",
|
|
4485
|
-
...viewportProps.style
|
|
4486
|
-
},
|
|
4487
|
-
onScroll: composeEventHandlers(viewportProps.onScroll, (event) => {
|
|
4488
|
-
const viewport = event.currentTarget;
|
|
4489
|
-
const { contentWrapper, shouldExpandOnScrollRef } = viewportContext;
|
|
4490
|
-
if (shouldExpandOnScrollRef?.current && contentWrapper) {
|
|
4491
|
-
const scrolledBy = Math.abs(prevScrollTopRef.current - viewport.scrollTop);
|
|
4492
|
-
if (scrolledBy > 0) {
|
|
4493
|
-
const availableHeight = window.innerHeight - CONTENT_MARGIN * 2;
|
|
4494
|
-
const cssMinHeight = parseFloat(contentWrapper.style.minHeight);
|
|
4495
|
-
const cssHeight = parseFloat(contentWrapper.style.height);
|
|
4496
|
-
const prevHeight = Math.max(cssMinHeight, cssHeight);
|
|
4497
|
-
if (prevHeight < availableHeight) {
|
|
4498
|
-
const nextHeight = prevHeight + scrolledBy;
|
|
4499
|
-
const clampedNextHeight = Math.min(availableHeight, nextHeight);
|
|
4500
|
-
const heightDiff = nextHeight - clampedNextHeight;
|
|
4501
|
-
contentWrapper.style.height = clampedNextHeight + "px";
|
|
4502
|
-
if (contentWrapper.style.bottom === "0px") {
|
|
4503
|
-
viewport.scrollTop = heightDiff > 0 ? heightDiff : 0;
|
|
4504
|
-
contentWrapper.style.justifyContent = "flex-end";
|
|
4505
|
-
}
|
|
4506
|
-
}
|
|
4507
|
-
}
|
|
4508
|
-
}
|
|
4509
|
-
prevScrollTopRef.current = viewport.scrollTop;
|
|
4510
|
-
})
|
|
4511
|
-
}
|
|
4512
|
-
) })
|
|
4513
|
-
] });
|
|
4514
|
-
}
|
|
4515
|
-
);
|
|
4516
|
-
SelectViewport.displayName = VIEWPORT_NAME;
|
|
4517
|
-
var GROUP_NAME = "SelectGroup";
|
|
4518
|
-
var [SelectGroupContextProvider, useSelectGroupContext] = createSelectContext(GROUP_NAME);
|
|
4519
|
-
var SelectGroup = React30__namespace.forwardRef(
|
|
4520
|
-
(props, forwardedRef) => {
|
|
4521
|
-
const { __scopeSelect, ...groupProps } = props;
|
|
4522
|
-
const groupId = useId();
|
|
4523
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SelectGroupContextProvider, { scope: __scopeSelect, id: groupId, children: /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { role: "group", "aria-labelledby": groupId, ...groupProps, ref: forwardedRef }) });
|
|
4524
|
-
}
|
|
4525
|
-
);
|
|
4526
|
-
SelectGroup.displayName = GROUP_NAME;
|
|
4527
|
-
var LABEL_NAME = "SelectLabel";
|
|
4528
|
-
var SelectLabel = React30__namespace.forwardRef(
|
|
4529
|
-
(props, forwardedRef) => {
|
|
4530
|
-
const { __scopeSelect, ...labelProps } = props;
|
|
4531
|
-
const groupContext = useSelectGroupContext(LABEL_NAME, __scopeSelect);
|
|
4532
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { id: groupContext.id, ...labelProps, ref: forwardedRef });
|
|
4533
|
-
}
|
|
4534
|
-
);
|
|
4535
|
-
SelectLabel.displayName = LABEL_NAME;
|
|
4536
|
-
var ITEM_NAME = "SelectItem";
|
|
4537
|
-
var [SelectItemContextProvider, useSelectItemContext] = createSelectContext(ITEM_NAME);
|
|
4538
|
-
var SelectItem = React30__namespace.forwardRef(
|
|
4539
|
-
(props, forwardedRef) => {
|
|
4540
|
-
const {
|
|
4541
|
-
__scopeSelect,
|
|
4542
|
-
value,
|
|
4543
|
-
disabled = false,
|
|
4544
|
-
textValue: textValueProp,
|
|
4545
|
-
...itemProps
|
|
4546
|
-
} = props;
|
|
4547
|
-
const context = useSelectContext(ITEM_NAME, __scopeSelect);
|
|
4548
|
-
const contentContext = useSelectContentContext(ITEM_NAME, __scopeSelect);
|
|
4549
|
-
const isSelected = context.value === value;
|
|
4550
|
-
const [textValue, setTextValue] = React30__namespace.useState(textValueProp ?? "");
|
|
4551
|
-
const [isFocused, setIsFocused] = React30__namespace.useState(false);
|
|
4552
|
-
const composedRefs = useComposedRefs(
|
|
4553
|
-
forwardedRef,
|
|
4554
|
-
(node) => contentContext.itemRefCallback?.(node, value, disabled)
|
|
4555
|
-
);
|
|
4556
|
-
const textId = useId();
|
|
4557
|
-
const pointerTypeRef = React30__namespace.useRef("touch");
|
|
4558
|
-
const handleSelect = () => {
|
|
4559
|
-
if (!disabled) {
|
|
4560
|
-
context.onValueChange(value);
|
|
4561
|
-
context.onOpenChange(false);
|
|
4562
|
-
}
|
|
4563
|
-
};
|
|
4564
|
-
if (value === "") {
|
|
4565
|
-
throw new Error(
|
|
4566
|
-
"A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
|
|
4567
|
-
);
|
|
4568
|
-
}
|
|
4569
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4570
|
-
SelectItemContextProvider,
|
|
4571
|
-
{
|
|
4572
|
-
scope: __scopeSelect,
|
|
4573
|
-
value,
|
|
4574
|
-
disabled,
|
|
4575
|
-
textId,
|
|
4576
|
-
isSelected,
|
|
4577
|
-
onItemTextChange: React30__namespace.useCallback((node) => {
|
|
4578
|
-
setTextValue((prevTextValue) => prevTextValue || (node?.textContent ?? "").trim());
|
|
4579
|
-
}, []),
|
|
4580
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4581
|
-
Collection.ItemSlot,
|
|
4582
|
-
{
|
|
4583
|
-
scope: __scopeSelect,
|
|
4584
|
-
value,
|
|
4585
|
-
disabled,
|
|
4586
|
-
textValue,
|
|
4587
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4588
|
-
Primitive.div,
|
|
4589
|
-
{
|
|
4590
|
-
role: "option",
|
|
4591
|
-
"aria-labelledby": textId,
|
|
4592
|
-
"data-highlighted": isFocused ? "" : void 0,
|
|
4593
|
-
"aria-selected": isSelected && isFocused,
|
|
4594
|
-
"data-state": isSelected ? "checked" : "unchecked",
|
|
4595
|
-
"aria-disabled": disabled || void 0,
|
|
4596
|
-
"data-disabled": disabled ? "" : void 0,
|
|
4597
|
-
tabIndex: disabled ? void 0 : -1,
|
|
4598
|
-
...itemProps,
|
|
4599
|
-
ref: composedRefs,
|
|
4600
|
-
onFocus: composeEventHandlers(itemProps.onFocus, () => setIsFocused(true)),
|
|
4601
|
-
onBlur: composeEventHandlers(itemProps.onBlur, () => setIsFocused(false)),
|
|
4602
|
-
onClick: composeEventHandlers(itemProps.onClick, () => {
|
|
4603
|
-
if (pointerTypeRef.current !== "mouse") handleSelect();
|
|
4604
|
-
}),
|
|
4605
|
-
onPointerUp: composeEventHandlers(itemProps.onPointerUp, () => {
|
|
4606
|
-
if (pointerTypeRef.current === "mouse") handleSelect();
|
|
4607
|
-
}),
|
|
4608
|
-
onPointerDown: composeEventHandlers(itemProps.onPointerDown, (event) => {
|
|
4609
|
-
pointerTypeRef.current = event.pointerType;
|
|
4610
|
-
}),
|
|
4611
|
-
onPointerMove: composeEventHandlers(itemProps.onPointerMove, (event) => {
|
|
4612
|
-
pointerTypeRef.current = event.pointerType;
|
|
4613
|
-
if (disabled) {
|
|
4614
|
-
contentContext.onItemLeave?.();
|
|
4615
|
-
} else if (pointerTypeRef.current === "mouse") {
|
|
4616
|
-
event.currentTarget.focus({ preventScroll: true });
|
|
4617
|
-
}
|
|
4618
|
-
}),
|
|
4619
|
-
onPointerLeave: composeEventHandlers(itemProps.onPointerLeave, (event) => {
|
|
4620
|
-
if (event.currentTarget === document.activeElement) {
|
|
4621
|
-
contentContext.onItemLeave?.();
|
|
4622
|
-
}
|
|
4623
|
-
}),
|
|
4624
|
-
onKeyDown: composeEventHandlers(itemProps.onKeyDown, (event) => {
|
|
4625
|
-
const isTypingAhead = contentContext.searchRef?.current !== "";
|
|
4626
|
-
if (isTypingAhead && event.key === " ") return;
|
|
4627
|
-
if (SELECTION_KEYS.includes(event.key)) handleSelect();
|
|
4628
|
-
if (event.key === " ") event.preventDefault();
|
|
4629
|
-
})
|
|
4630
|
-
}
|
|
4631
|
-
)
|
|
4632
|
-
}
|
|
4633
|
-
)
|
|
4634
|
-
}
|
|
4635
|
-
);
|
|
4636
|
-
}
|
|
4637
|
-
);
|
|
4638
|
-
SelectItem.displayName = ITEM_NAME;
|
|
4639
|
-
var ITEM_TEXT_NAME = "SelectItemText";
|
|
4640
|
-
var SelectItemText = React30__namespace.forwardRef(
|
|
4641
|
-
(props, forwardedRef) => {
|
|
4642
|
-
const { __scopeSelect, className, style, ...itemTextProps } = props;
|
|
4643
|
-
const context = useSelectContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
4644
|
-
const contentContext = useSelectContentContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
4645
|
-
const itemContext = useSelectItemContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
4646
|
-
const nativeOptionsContext = useSelectNativeOptionsContext(ITEM_TEXT_NAME, __scopeSelect);
|
|
4647
|
-
const [itemTextNode, setItemTextNode] = React30__namespace.useState(null);
|
|
4648
|
-
const composedRefs = useComposedRefs(
|
|
4649
|
-
forwardedRef,
|
|
4650
|
-
(node) => setItemTextNode(node),
|
|
4651
|
-
itemContext.onItemTextChange,
|
|
4652
|
-
(node) => contentContext.itemTextRefCallback?.(node, itemContext.value, itemContext.disabled)
|
|
4653
|
-
);
|
|
4654
|
-
const textContent = itemTextNode?.textContent;
|
|
4655
|
-
const nativeOption = React30__namespace.useMemo(
|
|
4656
|
-
() => /* @__PURE__ */ jsxRuntime.jsx("option", { value: itemContext.value, disabled: itemContext.disabled, children: textContent }, itemContext.value),
|
|
4657
|
-
[itemContext.disabled, itemContext.value, textContent]
|
|
4658
|
-
);
|
|
4659
|
-
const { onNativeOptionAdd, onNativeOptionRemove } = nativeOptionsContext;
|
|
4660
|
-
useLayoutEffect2(() => {
|
|
4661
|
-
onNativeOptionAdd(nativeOption);
|
|
4662
|
-
return () => onNativeOptionRemove(nativeOption);
|
|
4663
|
-
}, [onNativeOptionAdd, onNativeOptionRemove, nativeOption]);
|
|
4664
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4665
|
-
/* @__PURE__ */ jsxRuntime.jsx(Primitive.span, { id: itemContext.textId, ...itemTextProps, ref: composedRefs }),
|
|
4666
|
-
itemContext.isSelected && context.valueNode && !context.valueNodeHasChildren ? ReactDOM4__namespace.createPortal(itemTextProps.children, context.valueNode) : null
|
|
4667
|
-
] });
|
|
4668
|
-
}
|
|
4669
|
-
);
|
|
4670
|
-
SelectItemText.displayName = ITEM_TEXT_NAME;
|
|
4671
|
-
var ITEM_INDICATOR_NAME = "SelectItemIndicator";
|
|
4672
|
-
var SelectItemIndicator = React30__namespace.forwardRef(
|
|
4673
|
-
(props, forwardedRef) => {
|
|
4674
|
-
const { __scopeSelect, ...itemIndicatorProps } = props;
|
|
4675
|
-
const itemContext = useSelectItemContext(ITEM_INDICATOR_NAME, __scopeSelect);
|
|
4676
|
-
return itemContext.isSelected ? /* @__PURE__ */ jsxRuntime.jsx(Primitive.span, { "aria-hidden": true, ...itemIndicatorProps, ref: forwardedRef }) : null;
|
|
4677
|
-
}
|
|
4678
|
-
);
|
|
4679
|
-
SelectItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
4680
|
-
var SCROLL_UP_BUTTON_NAME = "SelectScrollUpButton";
|
|
4681
|
-
var SelectScrollUpButton2 = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
4682
|
-
const contentContext = useSelectContentContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
4683
|
-
const viewportContext = useSelectViewportContext(SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
4684
|
-
const [canScrollUp, setCanScrollUp] = React30__namespace.useState(false);
|
|
4685
|
-
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
4686
|
-
useLayoutEffect2(() => {
|
|
4687
|
-
if (contentContext.viewport && contentContext.isPositioned) {
|
|
4688
|
-
let handleScroll22 = function() {
|
|
4689
|
-
const canScrollUp2 = viewport.scrollTop > 0;
|
|
4690
|
-
setCanScrollUp(canScrollUp2);
|
|
4691
|
-
};
|
|
4692
|
-
const viewport = contentContext.viewport;
|
|
4693
|
-
handleScroll22();
|
|
4694
|
-
viewport.addEventListener("scroll", handleScroll22);
|
|
4695
|
-
return () => viewport.removeEventListener("scroll", handleScroll22);
|
|
4696
|
-
}
|
|
4697
|
-
}, [contentContext.viewport, contentContext.isPositioned]);
|
|
4698
|
-
return canScrollUp ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4699
|
-
SelectScrollButtonImpl,
|
|
4700
|
-
{
|
|
4701
|
-
...props,
|
|
4702
|
-
ref: composedRefs,
|
|
4703
|
-
onAutoScroll: () => {
|
|
4704
|
-
const { viewport, selectedItem } = contentContext;
|
|
4705
|
-
if (viewport && selectedItem) {
|
|
4706
|
-
viewport.scrollTop = viewport.scrollTop - selectedItem.offsetHeight;
|
|
4707
|
-
}
|
|
4708
|
-
}
|
|
4709
|
-
}
|
|
4710
|
-
) : null;
|
|
4711
|
-
});
|
|
4712
|
-
SelectScrollUpButton2.displayName = SCROLL_UP_BUTTON_NAME;
|
|
4713
|
-
var SCROLL_DOWN_BUTTON_NAME = "SelectScrollDownButton";
|
|
4714
|
-
var SelectScrollDownButton2 = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
4715
|
-
const contentContext = useSelectContentContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
4716
|
-
const viewportContext = useSelectViewportContext(SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
4717
|
-
const [canScrollDown, setCanScrollDown] = React30__namespace.useState(false);
|
|
4718
|
-
const composedRefs = useComposedRefs(forwardedRef, viewportContext.onScrollButtonChange);
|
|
4719
|
-
useLayoutEffect2(() => {
|
|
4720
|
-
if (contentContext.viewport && contentContext.isPositioned) {
|
|
4721
|
-
let handleScroll22 = function() {
|
|
4722
|
-
const maxScroll = viewport.scrollHeight - viewport.clientHeight;
|
|
4723
|
-
const canScrollDown2 = Math.ceil(viewport.scrollTop) < maxScroll;
|
|
4724
|
-
setCanScrollDown(canScrollDown2);
|
|
4725
|
-
};
|
|
4726
|
-
const viewport = contentContext.viewport;
|
|
4727
|
-
handleScroll22();
|
|
4728
|
-
viewport.addEventListener("scroll", handleScroll22);
|
|
4729
|
-
return () => viewport.removeEventListener("scroll", handleScroll22);
|
|
4730
|
-
}
|
|
4731
|
-
}, [contentContext.viewport, contentContext.isPositioned]);
|
|
4732
|
-
return canScrollDown ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4733
|
-
SelectScrollButtonImpl,
|
|
4734
|
-
{
|
|
4735
|
-
...props,
|
|
4736
|
-
ref: composedRefs,
|
|
4737
|
-
onAutoScroll: () => {
|
|
4738
|
-
const { viewport, selectedItem } = contentContext;
|
|
4739
|
-
if (viewport && selectedItem) {
|
|
4740
|
-
viewport.scrollTop = viewport.scrollTop + selectedItem.offsetHeight;
|
|
4741
|
-
}
|
|
4742
|
-
}
|
|
4743
|
-
}
|
|
4744
|
-
) : null;
|
|
4745
|
-
});
|
|
4746
|
-
SelectScrollDownButton2.displayName = SCROLL_DOWN_BUTTON_NAME;
|
|
4747
|
-
var SelectScrollButtonImpl = React30__namespace.forwardRef((props, forwardedRef) => {
|
|
4748
|
-
const { __scopeSelect, onAutoScroll, ...scrollIndicatorProps } = props;
|
|
4749
|
-
const contentContext = useSelectContentContext("SelectScrollButton", __scopeSelect);
|
|
4750
|
-
const autoScrollTimerRef = React30__namespace.useRef(null);
|
|
4751
|
-
const getItems = useCollection(__scopeSelect);
|
|
4752
|
-
const clearAutoScrollTimer = React30__namespace.useCallback(() => {
|
|
4753
|
-
if (autoScrollTimerRef.current !== null) {
|
|
4754
|
-
window.clearInterval(autoScrollTimerRef.current);
|
|
4755
|
-
autoScrollTimerRef.current = null;
|
|
4756
|
-
}
|
|
4757
|
-
}, []);
|
|
4758
|
-
React30__namespace.useEffect(() => {
|
|
4759
|
-
return () => clearAutoScrollTimer();
|
|
4760
|
-
}, [clearAutoScrollTimer]);
|
|
4761
|
-
useLayoutEffect2(() => {
|
|
4762
|
-
const activeItem = getItems().find((item) => item.ref.current === document.activeElement);
|
|
4763
|
-
activeItem?.ref.current?.scrollIntoView({ block: "nearest" });
|
|
4764
|
-
}, [getItems]);
|
|
4765
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4766
|
-
Primitive.div,
|
|
4767
|
-
{
|
|
4768
|
-
"aria-hidden": true,
|
|
4769
|
-
...scrollIndicatorProps,
|
|
4770
|
-
ref: forwardedRef,
|
|
4771
|
-
style: { flexShrink: 0, ...scrollIndicatorProps.style },
|
|
4772
|
-
onPointerDown: composeEventHandlers(scrollIndicatorProps.onPointerDown, () => {
|
|
4773
|
-
if (autoScrollTimerRef.current === null) {
|
|
4774
|
-
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
4775
|
-
}
|
|
4776
|
-
}),
|
|
4777
|
-
onPointerMove: composeEventHandlers(scrollIndicatorProps.onPointerMove, () => {
|
|
4778
|
-
contentContext.onItemLeave?.();
|
|
4779
|
-
if (autoScrollTimerRef.current === null) {
|
|
4780
|
-
autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
4781
|
-
}
|
|
4782
|
-
}),
|
|
4783
|
-
onPointerLeave: composeEventHandlers(scrollIndicatorProps.onPointerLeave, () => {
|
|
4784
|
-
clearAutoScrollTimer();
|
|
4785
|
-
})
|
|
4786
|
-
}
|
|
4787
|
-
);
|
|
4788
|
-
});
|
|
4789
|
-
var SEPARATOR_NAME = "SelectSeparator";
|
|
4790
|
-
var SelectSeparator = React30__namespace.forwardRef(
|
|
4791
|
-
(props, forwardedRef) => {
|
|
4792
|
-
const { __scopeSelect, ...separatorProps } = props;
|
|
4793
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { "aria-hidden": true, ...separatorProps, ref: forwardedRef });
|
|
4794
|
-
}
|
|
4795
|
-
);
|
|
4796
|
-
SelectSeparator.displayName = SEPARATOR_NAME;
|
|
4797
|
-
var ARROW_NAME2 = "SelectArrow";
|
|
4798
|
-
var SelectArrow = React30__namespace.forwardRef(
|
|
4799
|
-
(props, forwardedRef) => {
|
|
4800
|
-
const { __scopeSelect, ...arrowProps } = props;
|
|
4801
|
-
const popperScope = usePopperScope(__scopeSelect);
|
|
4802
|
-
const context = useSelectContext(ARROW_NAME2, __scopeSelect);
|
|
4803
|
-
const contentContext = useSelectContentContext(ARROW_NAME2, __scopeSelect);
|
|
4804
|
-
return context.open && contentContext.position === "popper" ? /* @__PURE__ */ jsxRuntime.jsx(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef }) : null;
|
|
4805
|
-
}
|
|
4806
|
-
);
|
|
4807
|
-
SelectArrow.displayName = ARROW_NAME2;
|
|
4808
|
-
var BUBBLE_INPUT_NAME = "SelectBubbleInput";
|
|
4809
|
-
var SelectBubbleInput = React30__namespace.forwardRef(
|
|
4810
|
-
({ __scopeSelect, value, ...props }, forwardedRef) => {
|
|
4811
|
-
const ref = React30__namespace.useRef(null);
|
|
4812
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
4813
|
-
const prevValue = usePrevious(value);
|
|
4814
|
-
React30__namespace.useEffect(() => {
|
|
4815
|
-
const select = ref.current;
|
|
4816
|
-
if (!select) return;
|
|
4817
|
-
const selectProto = window.HTMLSelectElement.prototype;
|
|
4818
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
4819
|
-
selectProto,
|
|
4820
|
-
"value"
|
|
4821
|
-
);
|
|
4822
|
-
const setValue = descriptor.set;
|
|
4823
|
-
if (prevValue !== value && setValue) {
|
|
4824
|
-
const event = new Event("change", { bubbles: true });
|
|
4825
|
-
setValue.call(select, value);
|
|
4826
|
-
select.dispatchEvent(event);
|
|
4827
|
-
}
|
|
4828
|
-
}, [prevValue, value]);
|
|
4829
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4830
|
-
Primitive.select,
|
|
4831
|
-
{
|
|
4832
|
-
...props,
|
|
4833
|
-
style: { ...VISUALLY_HIDDEN_STYLES, ...props.style },
|
|
4834
|
-
ref: composedRefs,
|
|
4835
|
-
defaultValue: value
|
|
4836
|
-
}
|
|
4837
|
-
);
|
|
4838
|
-
}
|
|
4839
|
-
);
|
|
4840
|
-
SelectBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
4841
|
-
function shouldShowPlaceholder(value) {
|
|
4842
|
-
return value === "" || value === void 0;
|
|
4843
|
-
}
|
|
4844
|
-
function useTypeaheadSearch(onSearchChange) {
|
|
4845
|
-
const handleSearchChange = useCallbackRef(onSearchChange);
|
|
4846
|
-
const searchRef = React30__namespace.useRef("");
|
|
4847
|
-
const timerRef = React30__namespace.useRef(0);
|
|
4848
|
-
const handleTypeaheadSearch = React30__namespace.useCallback(
|
|
4849
|
-
(key) => {
|
|
4850
|
-
const search = searchRef.current + key;
|
|
4851
|
-
handleSearchChange(search);
|
|
4852
|
-
(function updateSearch(value) {
|
|
4853
|
-
searchRef.current = value;
|
|
4854
|
-
window.clearTimeout(timerRef.current);
|
|
4855
|
-
if (value !== "") timerRef.current = window.setTimeout(() => updateSearch(""), 1e3);
|
|
4856
|
-
})(search);
|
|
4857
|
-
},
|
|
4858
|
-
[handleSearchChange]
|
|
4859
|
-
);
|
|
4860
|
-
const resetTypeahead = React30__namespace.useCallback(() => {
|
|
4861
|
-
searchRef.current = "";
|
|
4862
|
-
window.clearTimeout(timerRef.current);
|
|
4863
|
-
}, []);
|
|
4864
|
-
React30__namespace.useEffect(() => {
|
|
4865
|
-
return () => window.clearTimeout(timerRef.current);
|
|
4866
|
-
}, []);
|
|
4867
|
-
return [searchRef, handleTypeaheadSearch, resetTypeahead];
|
|
4868
|
-
}
|
|
4869
|
-
function findNextItem(items, search, currentItem) {
|
|
4870
|
-
const isRepeated = search.length > 1 && Array.from(search).every((char) => char === search[0]);
|
|
4871
|
-
const normalizedSearch = isRepeated ? search[0] : search;
|
|
4872
|
-
const currentItemIndex = currentItem ? items.indexOf(currentItem) : -1;
|
|
4873
|
-
let wrappedItems = wrapArray(items, Math.max(currentItemIndex, 0));
|
|
4874
|
-
const excludeCurrentItem = normalizedSearch.length === 1;
|
|
4875
|
-
if (excludeCurrentItem) wrappedItems = wrappedItems.filter((v) => v !== currentItem);
|
|
4876
|
-
const nextItem = wrappedItems.find(
|
|
4877
|
-
(item) => item.textValue.toLowerCase().startsWith(normalizedSearch.toLowerCase())
|
|
4878
|
-
);
|
|
4879
|
-
return nextItem !== currentItem ? nextItem : void 0;
|
|
4880
|
-
}
|
|
4881
|
-
function wrapArray(array, startIndex) {
|
|
4882
|
-
return array.map((_, index2) => array[(startIndex + index2) % array.length]);
|
|
4883
|
-
}
|
|
4884
|
-
var Group = SelectGroup;
|
|
4885
|
-
function SelectGroup2(props) {
|
|
4886
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Group, { "data-slot": "select-group", ...props });
|
|
4887
|
-
}
|
|
4888
|
-
function SelectItem2({ className, children, ...props }) {
|
|
4889
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4890
|
-
radixUi.Select.Item,
|
|
4891
|
-
{
|
|
4892
|
-
"data-slot": "select-item",
|
|
4893
|
-
className: chunkH2BWO3SI_cjs.cn(
|
|
4894
|
-
"focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
|
|
4895
|
-
"data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
4896
|
-
"[&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
4897
|
-
className
|
|
4898
|
-
),
|
|
4899
|
-
...props,
|
|
4900
|
-
children: [
|
|
4901
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-4" }) }) }),
|
|
4902
|
-
/* @__PURE__ */ jsxRuntime.jsx(radixUi.Select.ItemText, { children })
|
|
4903
|
-
]
|
|
4904
|
-
}
|
|
4905
|
-
);
|
|
4906
|
-
}
|
|
4907
|
-
function SelectLabel2({ className, ...props }) {
|
|
4908
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4909
|
-
radixUi.Select.Label,
|
|
4910
|
-
{
|
|
4911
|
-
"data-slot": "select-label",
|
|
4912
|
-
className: chunkH2BWO3SI_cjs.cn("text-muted-foreground px-2 py-1.5 text-xs", className),
|
|
4913
|
-
...props
|
|
4914
|
-
}
|
|
4915
|
-
);
|
|
4916
|
-
}
|
|
4917
|
-
function SelectSeparator2({ className, ...props }) {
|
|
4918
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4919
|
-
radixUi.Select.Separator,
|
|
4920
|
-
{
|
|
4921
|
-
"data-slot": "select-separator",
|
|
4922
|
-
className: chunkH2BWO3SI_cjs.cn("bg-border pointer-events-none -mx-1 my-1 h-px", className),
|
|
4923
|
-
...props
|
|
4924
|
-
}
|
|
4925
|
-
);
|
|
4926
|
-
}
|
|
4927
|
-
|
|
4928
|
-
exports.Select = Select;
|
|
4929
|
-
exports.SelectContent = SelectContent;
|
|
4930
|
-
exports.SelectGroup = SelectGroup2;
|
|
4931
|
-
exports.SelectItem = SelectItem2;
|
|
4932
|
-
exports.SelectLabel = SelectLabel2;
|
|
4933
|
-
exports.SelectSeparator = SelectSeparator2;
|
|
4934
|
-
exports.useComposedRefs = useComposedRefs;
|