@overmap-ai/forms 1.0.32-react-flow-david-fixes.39 → 1.0.32-react-flow-david-fixes.41
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/form/fields/BaseFormElement/typings.d.ts +2 -2
- package/dist/form/fields/hooks.d.ts +1 -371
- package/dist/forms.js +159 -2002
- package/dist/forms.umd.cjs +265 -2124
- package/package.json +1 -1
package/dist/forms.js
CHANGED
|
@@ -4,7 +4,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4
4
|
import { jsxs, jsx, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
5
5
|
import { Card, LuIcon, Text, Spinner, Overlay, ButtonGroup, Tooltip, IconButton, Separator, Input, Badge, Checkbox, CheckboxGroup, Popover, Button, DayPicker, Menu, OneTimePasswordField, RadioGroup, TextArea, stopPropagation, Heading, useToast, ToggleGroup } from "@overmap-ai/blocks";
|
|
6
6
|
import { cx } from "class-variance-authority";
|
|
7
|
-
import * as React from "react";
|
|
8
7
|
import { memo, forwardRef, createContext, useContext, useRef, useCallback, useState, useEffect, useMemo, Fragment, use, useLayoutEffect, useId } from "react";
|
|
9
8
|
import "@xyflow/react/dist/style.css";
|
|
10
9
|
import { getBezierPath, Position, BaseEdge, EdgeLabelRenderer, NodeToolbar, Handle, MarkerType, useNodesState, useEdgesState, ReactFlow, Panel } from "@xyflow/react";
|
|
@@ -15,7 +14,6 @@ import { v4 } from "uuid";
|
|
|
15
14
|
import { DragDropContext, Droppable, Draggable } from "@hello-pangea/dnd";
|
|
16
15
|
import { saveAs } from "file-saver";
|
|
17
16
|
import { DecodeHintType as DecodeHintType$2, useZxing } from "react-zxing";
|
|
18
|
-
import * as ReactDOM from "react-dom";
|
|
19
17
|
import get from "lodash.get";
|
|
20
18
|
import Dagre from "@dagrejs/dagre";
|
|
21
19
|
import set from "lodash.set";
|
|
@@ -328,12 +326,11 @@ const useFormikInput = (props) => {
|
|
|
328
326
|
];
|
|
329
327
|
};
|
|
330
328
|
const MultiStringInput = memo((props) => {
|
|
331
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
329
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
332
330
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
333
331
|
const computedLabel = showInputOnly ? "" : label;
|
|
334
332
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
335
333
|
const droppableId = `${inputId}-droppable`;
|
|
336
|
-
const { disabled } = rest;
|
|
337
334
|
const [intermediateValue, setIntermediateValue] = useState("");
|
|
338
335
|
const [internalError, setInternalError] = useState("");
|
|
339
336
|
const updatedHelpText = internalError || computedHelpText;
|
|
@@ -420,7 +417,7 @@ const MultiStringInput = memo((props) => {
|
|
|
420
417
|
placeholder: field.placeholder,
|
|
421
418
|
onBlur: handleInputBlur,
|
|
422
419
|
name,
|
|
423
|
-
|
|
420
|
+
disabled
|
|
424
421
|
}
|
|
425
422
|
) }),
|
|
426
423
|
/* @__PURE__ */ jsx(
|
|
@@ -632,7 +629,7 @@ class BaseOptionsField extends BaseField {
|
|
|
632
629
|
}
|
|
633
630
|
}
|
|
634
631
|
const BooleanInput = memo((props) => {
|
|
635
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
632
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
636
633
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
637
634
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
638
635
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -667,7 +664,7 @@ const BooleanInput = memo((props) => {
|
|
|
667
664
|
size: "sm",
|
|
668
665
|
accentColor: "primary",
|
|
669
666
|
variant: "surface",
|
|
670
|
-
|
|
667
|
+
disabled,
|
|
671
668
|
children: /* @__PURE__ */ jsx(Checkbox.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) })
|
|
672
669
|
}
|
|
673
670
|
)
|
|
@@ -728,7 +725,7 @@ let BooleanField = _BooleanField;
|
|
|
728
725
|
const NumberInput = memo((props) => {
|
|
729
726
|
const [
|
|
730
727
|
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
731
|
-
|
|
728
|
+
{ disabled }
|
|
732
729
|
] = useFormikInput(props);
|
|
733
730
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
734
731
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -774,7 +771,7 @@ const NumberInput = memo((props) => {
|
|
|
774
771
|
max: field.maximum,
|
|
775
772
|
step: field.integers ? 1 : 0.1,
|
|
776
773
|
placeholder: field.placeholder ?? "Enter a number",
|
|
777
|
-
|
|
774
|
+
disabled
|
|
778
775
|
}
|
|
779
776
|
) })
|
|
780
777
|
}
|
|
@@ -1031,7 +1028,7 @@ class BaseStringField extends BaseField {
|
|
|
1031
1028
|
}
|
|
1032
1029
|
}
|
|
1033
1030
|
const CheckboxListInput = memo((props) => {
|
|
1034
|
-
const [{ inputId, labelId, size, severity, field, showInputOnly, helpText, label, fieldProps },
|
|
1031
|
+
const [{ inputId, labelId, size, severity, field, showInputOnly, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1035
1032
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
1036
1033
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
1037
1034
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -1062,7 +1059,7 @@ const CheckboxListInput = memo((props) => {
|
|
|
1062
1059
|
size: "sm",
|
|
1063
1060
|
values: value,
|
|
1064
1061
|
onValuesChange: handleChange,
|
|
1065
|
-
|
|
1062
|
+
disabled,
|
|
1066
1063
|
children: field.options.map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
1067
1064
|
/* @__PURE__ */ jsx(CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: "check" }) }) }),
|
|
1068
1065
|
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
@@ -1120,7 +1117,7 @@ __publicField(_CheckboxListField, "fieldTypeName", "Checkbox list");
|
|
|
1120
1117
|
__publicField(_CheckboxListField, "fieldTypeDescription", "Allows the user to select a multiple options from a list.");
|
|
1121
1118
|
let CheckboxListField = _CheckboxListField;
|
|
1122
1119
|
const DateInput = memo((props) => {
|
|
1123
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
1120
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1124
1121
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
1125
1122
|
const [popoverOpen, setPopoverOpen] = useState(false);
|
|
1126
1123
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -1159,7 +1156,7 @@ const DateInput = memo((props) => {
|
|
|
1159
1156
|
accentColor: "base",
|
|
1160
1157
|
variant: "surface",
|
|
1161
1158
|
size: "sm",
|
|
1162
|
-
|
|
1159
|
+
disabled,
|
|
1163
1160
|
children: [
|
|
1164
1161
|
value ? value.toLocaleString(void 0, {
|
|
1165
1162
|
year: "numeric",
|
|
@@ -1237,7 +1234,7 @@ __publicField(_DateField, "fieldTypeName", "Date");
|
|
|
1237
1234
|
__publicField(_DateField, "fieldTypeDescription", "Allows specifying a date.");
|
|
1238
1235
|
let DateField = _DateField;
|
|
1239
1236
|
const MultiSelectInput = memo((props) => {
|
|
1240
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
1237
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1241
1238
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
1242
1239
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
1243
1240
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -1274,7 +1271,7 @@ const MultiSelectInput = memo((props) => {
|
|
|
1274
1271
|
type: "button",
|
|
1275
1272
|
size: "sm",
|
|
1276
1273
|
accentColor: "base",
|
|
1277
|
-
|
|
1274
|
+
disabled,
|
|
1278
1275
|
children: [
|
|
1279
1276
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: value && value.length > 0 ? value.join(", ") : field.placeholder ?? "Select one or more..." }),
|
|
1280
1277
|
/* @__PURE__ */ jsx(LuIcon, { icon: "chevron-down" })
|
|
@@ -1360,7 +1357,7 @@ __publicField(_MultiSelectField, "fieldTypeName", "Multi-select");
|
|
|
1360
1357
|
__publicField(_MultiSelectField, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options.");
|
|
1361
1358
|
let MultiSelectField = _MultiSelectField;
|
|
1362
1359
|
const SelectInput = memo((props) => {
|
|
1363
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
1360
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1364
1361
|
const { name, onChange, onBlur, value } = fieldProps;
|
|
1365
1362
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
1366
1363
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -1394,7 +1391,7 @@ const SelectInput = memo((props) => {
|
|
|
1394
1391
|
variant: "surface",
|
|
1395
1392
|
type: "button",
|
|
1396
1393
|
size: "sm",
|
|
1397
|
-
|
|
1394
|
+
disabled,
|
|
1398
1395
|
children: [
|
|
1399
1396
|
/* @__PURE__ */ jsx("span", { className: "truncate", children: currentOption ? currentOption.label : field.placeholder ?? "Select one..." }),
|
|
1400
1397
|
/* @__PURE__ */ jsx(LuIcon, { icon: "chevron-down" })
|
|
@@ -1469,7 +1466,7 @@ let SelectField = _SelectField;
|
|
|
1469
1466
|
const OTPInput = memo((props) => {
|
|
1470
1467
|
const [
|
|
1471
1468
|
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
1472
|
-
{ formId: formId2,
|
|
1469
|
+
{ formId: formId2, disabled }
|
|
1473
1470
|
] = useFormikInput(props);
|
|
1474
1471
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
1475
1472
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -1517,6 +1514,7 @@ const OTPInput = memo((props) => {
|
|
|
1517
1514
|
onValueChange: handleChange,
|
|
1518
1515
|
validationType: field.validationType,
|
|
1519
1516
|
form: formId2,
|
|
1517
|
+
disabled,
|
|
1520
1518
|
orientation: "horizontal",
|
|
1521
1519
|
dir: "ltr",
|
|
1522
1520
|
type: "text",
|
|
@@ -1527,7 +1525,6 @@ const OTPInput = memo((props) => {
|
|
|
1527
1525
|
accentColor: "base",
|
|
1528
1526
|
variant: "surface",
|
|
1529
1527
|
size: "sm",
|
|
1530
|
-
...rest,
|
|
1531
1528
|
children: [
|
|
1532
1529
|
inputUuids.map((inputUuid) => /* @__PURE__ */ jsx(OneTimePasswordField.Input, { id: inputUuid, onBlur: handleBlur }, inputUuid)),
|
|
1533
1530
|
/* @__PURE__ */ jsx(OneTimePasswordField.HiddenInput, {})
|
|
@@ -1657,7 +1654,7 @@ __publicField(_OTPField, "fieldTypeName", "OTP");
|
|
|
1657
1654
|
__publicField(_OTPField, "fieldTypeDescription", "Allows specifying a number within a given range.");
|
|
1658
1655
|
let OTPField = _OTPField;
|
|
1659
1656
|
const RadioInput = memo((props) => {
|
|
1660
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
1657
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1661
1658
|
const { name, onChange, onBlur, value } = fieldProps;
|
|
1662
1659
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
1663
1660
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -1692,10 +1689,10 @@ const RadioInput = memo((props) => {
|
|
|
1692
1689
|
size: "sm",
|
|
1693
1690
|
value: value ?? "",
|
|
1694
1691
|
onValueChange: handleChange,
|
|
1695
|
-
|
|
1692
|
+
disabled,
|
|
1696
1693
|
children: [
|
|
1697
1694
|
field.options.map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
1698
|
-
/* @__PURE__ */ jsx(RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: "
|
|
1695
|
+
/* @__PURE__ */ jsx(RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsx(RadioGroup.Indicator, { children: /* @__PURE__ */ jsx(LuIcon, { icon: "circle", className: "fill-current" }) }) }),
|
|
1699
1696
|
/* @__PURE__ */ jsx(Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
1700
1697
|
] }, `${inputId}-${option.value}-${index}`)),
|
|
1701
1698
|
!!value && /* @__PURE__ */ jsxs(
|
|
@@ -1769,1845 +1766,10 @@ const _RadioField = class _RadioField extends BaseOptionsField {
|
|
|
1769
1766
|
__publicField(_RadioField, "fieldTypeName", "Option list");
|
|
1770
1767
|
__publicField(_RadioField, "fieldTypeDescription", "Allows the user to select a single option from a list of options.");
|
|
1771
1768
|
let RadioField = _RadioField;
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
1775
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
1776
|
-
return ourEventHandler == null ? void 0 : ourEventHandler(event);
|
|
1777
|
-
}
|
|
1778
|
-
};
|
|
1779
|
-
}
|
|
1780
|
-
function setRef(ref, value) {
|
|
1781
|
-
if (typeof ref === "function") {
|
|
1782
|
-
return ref(value);
|
|
1783
|
-
} else if (ref !== null && ref !== void 0) {
|
|
1784
|
-
ref.current = value;
|
|
1785
|
-
}
|
|
1786
|
-
}
|
|
1787
|
-
function composeRefs(...refs) {
|
|
1788
|
-
return (node) => {
|
|
1789
|
-
let hasCleanup = false;
|
|
1790
|
-
const cleanups = refs.map((ref) => {
|
|
1791
|
-
const cleanup = setRef(ref, node);
|
|
1792
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
1793
|
-
hasCleanup = true;
|
|
1794
|
-
}
|
|
1795
|
-
return cleanup;
|
|
1796
|
-
});
|
|
1797
|
-
if (hasCleanup) {
|
|
1798
|
-
return () => {
|
|
1799
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
1800
|
-
const cleanup = cleanups[i];
|
|
1801
|
-
if (typeof cleanup == "function") {
|
|
1802
|
-
cleanup();
|
|
1803
|
-
} else {
|
|
1804
|
-
setRef(refs[i], null);
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
};
|
|
1808
|
-
}
|
|
1809
|
-
};
|
|
1810
|
-
}
|
|
1811
|
-
function useComposedRefs(...refs) {
|
|
1812
|
-
return React.useCallback(composeRefs(...refs), refs);
|
|
1813
|
-
}
|
|
1814
|
-
function createContext2(rootComponentName, defaultContext) {
|
|
1815
|
-
const Context = React.createContext(defaultContext);
|
|
1816
|
-
const Provider = (props) => {
|
|
1817
|
-
const { children, ...context } = props;
|
|
1818
|
-
const value = React.useMemo(() => context, Object.values(context));
|
|
1819
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
1820
|
-
};
|
|
1821
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
1822
|
-
function useContext2(consumerName) {
|
|
1823
|
-
const context = React.useContext(Context);
|
|
1824
|
-
if (context) return context;
|
|
1825
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
1826
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1827
|
-
}
|
|
1828
|
-
return [Provider, useContext2];
|
|
1829
|
-
}
|
|
1830
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1831
|
-
let defaultContexts = [];
|
|
1832
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
1833
|
-
const BaseContext = React.createContext(defaultContext);
|
|
1834
|
-
const index = defaultContexts.length;
|
|
1835
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
1836
|
-
const Provider = (props) => {
|
|
1837
|
-
var _a2;
|
|
1838
|
-
const { scope, children, ...context } = props;
|
|
1839
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index]) || BaseContext;
|
|
1840
|
-
const value = React.useMemo(() => context, Object.values(context));
|
|
1841
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
1842
|
-
};
|
|
1843
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
1844
|
-
function useContext2(consumerName, scope) {
|
|
1845
|
-
var _a2;
|
|
1846
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index]) || BaseContext;
|
|
1847
|
-
const context = React.useContext(Context);
|
|
1848
|
-
if (context) return context;
|
|
1849
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
1850
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1851
|
-
}
|
|
1852
|
-
return [Provider, useContext2];
|
|
1853
|
-
}
|
|
1854
|
-
const createScope = () => {
|
|
1855
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
1856
|
-
return React.createContext(defaultContext);
|
|
1857
|
-
});
|
|
1858
|
-
return function useScope(scope) {
|
|
1859
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
1860
|
-
return React.useMemo(
|
|
1861
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
1862
|
-
[scope, contexts]
|
|
1863
|
-
);
|
|
1864
|
-
};
|
|
1865
|
-
};
|
|
1866
|
-
createScope.scopeName = scopeName;
|
|
1867
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
1868
|
-
}
|
|
1869
|
-
function composeContextScopes(...scopes) {
|
|
1870
|
-
const baseScope = scopes[0];
|
|
1871
|
-
if (scopes.length === 1) return baseScope;
|
|
1872
|
-
const createScope = () => {
|
|
1873
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
1874
|
-
useScope: createScope2(),
|
|
1875
|
-
scopeName: createScope2.scopeName
|
|
1876
|
-
}));
|
|
1877
|
-
return function useComposedScopes(overrideScopes) {
|
|
1878
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
1879
|
-
const scopeProps = useScope(overrideScopes);
|
|
1880
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
1881
|
-
return { ...nextScopes2, ...currentScope };
|
|
1882
|
-
}, {});
|
|
1883
|
-
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
1884
|
-
};
|
|
1885
|
-
};
|
|
1886
|
-
createScope.scopeName = baseScope.scopeName;
|
|
1887
|
-
return createScope;
|
|
1888
|
-
}
|
|
1889
|
-
var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? React.useLayoutEffect : () => {
|
|
1890
|
-
};
|
|
1891
|
-
// @__NO_SIDE_EFFECTS__
|
|
1892
|
-
function createSlot(ownerName) {
|
|
1893
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
1894
|
-
const Slot2 = React.forwardRef((props, forwardedRef) => {
|
|
1895
|
-
const { children, ...slotProps } = props;
|
|
1896
|
-
const childrenArray = React.Children.toArray(children);
|
|
1897
|
-
const slottable = childrenArray.find(isSlottable);
|
|
1898
|
-
if (slottable) {
|
|
1899
|
-
const newElement = slottable.props.children;
|
|
1900
|
-
const newChildren = childrenArray.map((child) => {
|
|
1901
|
-
if (child === slottable) {
|
|
1902
|
-
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
1903
|
-
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
1904
|
-
} else {
|
|
1905
|
-
return child;
|
|
1906
|
-
}
|
|
1907
|
-
});
|
|
1908
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
1909
|
-
}
|
|
1910
|
-
return /* @__PURE__ */ jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
1911
|
-
});
|
|
1912
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
1913
|
-
return Slot2;
|
|
1914
|
-
}
|
|
1915
|
-
// @__NO_SIDE_EFFECTS__
|
|
1916
|
-
function createSlotClone(ownerName) {
|
|
1917
|
-
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
1918
|
-
const { children, ...slotProps } = props;
|
|
1919
|
-
if (React.isValidElement(children)) {
|
|
1920
|
-
const childrenRef = getElementRef$1(children);
|
|
1921
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
1922
|
-
if (children.type !== React.Fragment) {
|
|
1923
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
1924
|
-
}
|
|
1925
|
-
return React.cloneElement(children, props2);
|
|
1926
|
-
}
|
|
1927
|
-
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
1928
|
-
});
|
|
1929
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
1930
|
-
return SlotClone;
|
|
1931
|
-
}
|
|
1932
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
1933
|
-
function isSlottable(child) {
|
|
1934
|
-
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
1935
|
-
}
|
|
1936
|
-
function mergeProps(slotProps, childProps) {
|
|
1937
|
-
const overrideProps = { ...childProps };
|
|
1938
|
-
for (const propName in childProps) {
|
|
1939
|
-
const slotPropValue = slotProps[propName];
|
|
1940
|
-
const childPropValue = childProps[propName];
|
|
1941
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
1942
|
-
if (isHandler) {
|
|
1943
|
-
if (slotPropValue && childPropValue) {
|
|
1944
|
-
overrideProps[propName] = (...args) => {
|
|
1945
|
-
const result = childPropValue(...args);
|
|
1946
|
-
slotPropValue(...args);
|
|
1947
|
-
return result;
|
|
1948
|
-
};
|
|
1949
|
-
} else if (slotPropValue) {
|
|
1950
|
-
overrideProps[propName] = slotPropValue;
|
|
1951
|
-
}
|
|
1952
|
-
} else if (propName === "style") {
|
|
1953
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
1954
|
-
} else if (propName === "className") {
|
|
1955
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
1956
|
-
}
|
|
1957
|
-
}
|
|
1958
|
-
return { ...slotProps, ...overrideProps };
|
|
1959
|
-
}
|
|
1960
|
-
function getElementRef$1(element) {
|
|
1961
|
-
var _a2, _b;
|
|
1962
|
-
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
1963
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1964
|
-
if (mayWarn) {
|
|
1965
|
-
return element.ref;
|
|
1966
|
-
}
|
|
1967
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
1968
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1969
|
-
if (mayWarn) {
|
|
1970
|
-
return element.props.ref;
|
|
1971
|
-
}
|
|
1972
|
-
return element.props.ref || element.ref;
|
|
1973
|
-
}
|
|
1974
|
-
var NODES = [
|
|
1975
|
-
"a",
|
|
1976
|
-
"button",
|
|
1977
|
-
"div",
|
|
1978
|
-
"form",
|
|
1979
|
-
"h2",
|
|
1980
|
-
"h3",
|
|
1981
|
-
"img",
|
|
1982
|
-
"input",
|
|
1983
|
-
"label",
|
|
1984
|
-
"li",
|
|
1985
|
-
"nav",
|
|
1986
|
-
"ol",
|
|
1987
|
-
"p",
|
|
1988
|
-
"select",
|
|
1989
|
-
"span",
|
|
1990
|
-
"svg",
|
|
1991
|
-
"ul"
|
|
1992
|
-
];
|
|
1993
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
1994
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
1995
|
-
const Node = React.forwardRef((props, forwardedRef) => {
|
|
1996
|
-
const { asChild, ...primitiveProps } = props;
|
|
1997
|
-
const Comp = asChild ? Slot2 : node;
|
|
1998
|
-
if (typeof window !== "undefined") {
|
|
1999
|
-
window[Symbol.for("radix-ui")] = true;
|
|
2000
|
-
}
|
|
2001
|
-
return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
2002
|
-
});
|
|
2003
|
-
Node.displayName = `Primitive.${node}`;
|
|
2004
|
-
return { ...primitive, [node]: Node };
|
|
2005
|
-
}, {});
|
|
2006
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
2007
|
-
if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
|
|
2008
|
-
}
|
|
2009
|
-
function useCallbackRef$1(callback) {
|
|
2010
|
-
const callbackRef = React.useRef(callback);
|
|
2011
|
-
React.useEffect(() => {
|
|
2012
|
-
callbackRef.current = callback;
|
|
2013
|
-
});
|
|
2014
|
-
return React.useMemo(() => (...args) => {
|
|
2015
|
-
var _a2;
|
|
2016
|
-
return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
|
|
2017
|
-
}, []);
|
|
2018
|
-
}
|
|
2019
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
2020
|
-
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
2021
|
-
React.useEffect(() => {
|
|
2022
|
-
const handleKeyDown = (event) => {
|
|
2023
|
-
if (event.key === "Escape") {
|
|
2024
|
-
onEscapeKeyDown(event);
|
|
2025
|
-
}
|
|
2026
|
-
};
|
|
2027
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
2028
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
2029
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
2030
|
-
}
|
|
2031
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
2032
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
2033
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
2034
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
2035
|
-
var originalBodyPointerEvents;
|
|
2036
|
-
var DismissableLayerContext = React.createContext({
|
|
2037
|
-
layers: /* @__PURE__ */ new Set(),
|
|
2038
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
2039
|
-
branches: /* @__PURE__ */ new Set()
|
|
2040
|
-
});
|
|
2041
|
-
var DismissableLayer = React.forwardRef(
|
|
2042
|
-
(props, forwardedRef) => {
|
|
2043
|
-
const {
|
|
2044
|
-
disableOutsidePointerEvents = false,
|
|
2045
|
-
onEscapeKeyDown,
|
|
2046
|
-
onPointerDownOutside,
|
|
2047
|
-
onFocusOutside,
|
|
2048
|
-
onInteractOutside,
|
|
2049
|
-
onDismiss,
|
|
2050
|
-
...layerProps
|
|
2051
|
-
} = props;
|
|
2052
|
-
const context = React.useContext(DismissableLayerContext);
|
|
2053
|
-
const [node, setNode] = React.useState(null);
|
|
2054
|
-
const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
|
|
2055
|
-
const [, force] = React.useState({});
|
|
2056
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
2057
|
-
const layers = Array.from(context.layers);
|
|
2058
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
2059
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
2060
|
-
const index = node ? layers.indexOf(node) : -1;
|
|
2061
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
2062
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
2063
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
2064
|
-
const target = event.target;
|
|
2065
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2066
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
2067
|
-
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
2068
|
-
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
2069
|
-
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
2070
|
-
}, ownerDocument);
|
|
2071
|
-
const focusOutside = useFocusOutside((event) => {
|
|
2072
|
-
const target = event.target;
|
|
2073
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2074
|
-
if (isFocusInBranch) return;
|
|
2075
|
-
onFocusOutside == null ? void 0 : onFocusOutside(event);
|
|
2076
|
-
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
2077
|
-
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
2078
|
-
}, ownerDocument);
|
|
2079
|
-
useEscapeKeydown((event) => {
|
|
2080
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
2081
|
-
if (!isHighestLayer) return;
|
|
2082
|
-
onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
|
|
2083
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
2084
|
-
event.preventDefault();
|
|
2085
|
-
onDismiss();
|
|
2086
|
-
}
|
|
2087
|
-
}, ownerDocument);
|
|
2088
|
-
React.useEffect(() => {
|
|
2089
|
-
if (!node) return;
|
|
2090
|
-
if (disableOutsidePointerEvents) {
|
|
2091
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
2092
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
2093
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
2094
|
-
}
|
|
2095
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
2096
|
-
}
|
|
2097
|
-
context.layers.add(node);
|
|
2098
|
-
dispatchUpdate();
|
|
2099
|
-
return () => {
|
|
2100
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
2101
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
2102
|
-
}
|
|
2103
|
-
};
|
|
2104
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
2105
|
-
React.useEffect(() => {
|
|
2106
|
-
return () => {
|
|
2107
|
-
if (!node) return;
|
|
2108
|
-
context.layers.delete(node);
|
|
2109
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
2110
|
-
dispatchUpdate();
|
|
2111
|
-
};
|
|
2112
|
-
}, [node, context]);
|
|
2113
|
-
React.useEffect(() => {
|
|
2114
|
-
const handleUpdate = () => force({});
|
|
2115
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
2116
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
2117
|
-
}, []);
|
|
2118
|
-
return /* @__PURE__ */ jsx(
|
|
2119
|
-
Primitive.div,
|
|
2120
|
-
{
|
|
2121
|
-
...layerProps,
|
|
2122
|
-
ref: composedRefs,
|
|
2123
|
-
style: {
|
|
2124
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
2125
|
-
...props.style
|
|
2126
|
-
},
|
|
2127
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
2128
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
2129
|
-
onPointerDownCapture: composeEventHandlers(
|
|
2130
|
-
props.onPointerDownCapture,
|
|
2131
|
-
pointerDownOutside.onPointerDownCapture
|
|
2132
|
-
)
|
|
2133
|
-
}
|
|
2134
|
-
);
|
|
2135
|
-
}
|
|
2136
|
-
);
|
|
2137
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
2138
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
2139
|
-
var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
|
|
2140
|
-
const context = React.useContext(DismissableLayerContext);
|
|
2141
|
-
const ref = React.useRef(null);
|
|
2142
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
2143
|
-
React.useEffect(() => {
|
|
2144
|
-
const node = ref.current;
|
|
2145
|
-
if (node) {
|
|
2146
|
-
context.branches.add(node);
|
|
2147
|
-
return () => {
|
|
2148
|
-
context.branches.delete(node);
|
|
2149
|
-
};
|
|
2150
|
-
}
|
|
2151
|
-
}, [context.branches]);
|
|
2152
|
-
return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
2153
|
-
});
|
|
2154
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
2155
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
2156
|
-
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
2157
|
-
const isPointerInsideReactTreeRef = React.useRef(false);
|
|
2158
|
-
const handleClickRef = React.useRef(() => {
|
|
2159
|
-
});
|
|
2160
|
-
React.useEffect(() => {
|
|
2161
|
-
const handlePointerDown = (event) => {
|
|
2162
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
2163
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
2164
|
-
handleAndDispatchCustomEvent(
|
|
2165
|
-
POINTER_DOWN_OUTSIDE,
|
|
2166
|
-
handlePointerDownOutside,
|
|
2167
|
-
eventDetail,
|
|
2168
|
-
{ discrete: true }
|
|
2169
|
-
);
|
|
2170
|
-
};
|
|
2171
|
-
const eventDetail = { originalEvent: event };
|
|
2172
|
-
if (event.pointerType === "touch") {
|
|
2173
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2174
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
2175
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
2176
|
-
} else {
|
|
2177
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
2178
|
-
}
|
|
2179
|
-
} else {
|
|
2180
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2181
|
-
}
|
|
2182
|
-
isPointerInsideReactTreeRef.current = false;
|
|
2183
|
-
};
|
|
2184
|
-
const timerId = window.setTimeout(() => {
|
|
2185
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
2186
|
-
}, 0);
|
|
2187
|
-
return () => {
|
|
2188
|
-
window.clearTimeout(timerId);
|
|
2189
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
2190
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2191
|
-
};
|
|
2192
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
2193
|
-
return {
|
|
2194
|
-
// ensures we check React component tree (not just DOM tree)
|
|
2195
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
2196
|
-
};
|
|
2197
|
-
}
|
|
2198
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
2199
|
-
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
2200
|
-
const isFocusInsideReactTreeRef = React.useRef(false);
|
|
2201
|
-
React.useEffect(() => {
|
|
2202
|
-
const handleFocus = (event) => {
|
|
2203
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
2204
|
-
const eventDetail = { originalEvent: event };
|
|
2205
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
2206
|
-
discrete: false
|
|
2207
|
-
});
|
|
2208
|
-
}
|
|
2209
|
-
};
|
|
2210
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
2211
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
2212
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
2213
|
-
return {
|
|
2214
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
2215
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
2216
|
-
};
|
|
2217
|
-
}
|
|
2218
|
-
function dispatchUpdate() {
|
|
2219
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
2220
|
-
document.dispatchEvent(event);
|
|
2221
|
-
}
|
|
2222
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
2223
|
-
const target = detail.originalEvent.target;
|
|
2224
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
2225
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
2226
|
-
if (discrete) {
|
|
2227
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
2228
|
-
} else {
|
|
2229
|
-
target.dispatchEvent(event);
|
|
2230
|
-
}
|
|
2231
|
-
}
|
|
2232
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
2233
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
2234
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
2235
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
2236
|
-
var FocusScope = React.forwardRef((props, forwardedRef) => {
|
|
2237
|
-
const {
|
|
2238
|
-
loop = false,
|
|
2239
|
-
trapped = false,
|
|
2240
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
2241
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
2242
|
-
...scopeProps
|
|
2243
|
-
} = props;
|
|
2244
|
-
const [container, setContainer] = React.useState(null);
|
|
2245
|
-
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
2246
|
-
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
2247
|
-
const lastFocusedElementRef = React.useRef(null);
|
|
2248
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
2249
|
-
const focusScope = React.useRef({
|
|
2250
|
-
paused: false,
|
|
2251
|
-
pause() {
|
|
2252
|
-
this.paused = true;
|
|
2253
|
-
},
|
|
2254
|
-
resume() {
|
|
2255
|
-
this.paused = false;
|
|
2256
|
-
}
|
|
2257
|
-
}).current;
|
|
2258
|
-
React.useEffect(() => {
|
|
2259
|
-
if (trapped) {
|
|
2260
|
-
let handleFocusIn2 = function(event) {
|
|
2261
|
-
if (focusScope.paused || !container) return;
|
|
2262
|
-
const target = event.target;
|
|
2263
|
-
if (container.contains(target)) {
|
|
2264
|
-
lastFocusedElementRef.current = target;
|
|
2265
|
-
} else {
|
|
2266
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
2267
|
-
}
|
|
2268
|
-
}, handleFocusOut2 = function(event) {
|
|
2269
|
-
if (focusScope.paused || !container) return;
|
|
2270
|
-
const relatedTarget = event.relatedTarget;
|
|
2271
|
-
if (relatedTarget === null) return;
|
|
2272
|
-
if (!container.contains(relatedTarget)) {
|
|
2273
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
2274
|
-
}
|
|
2275
|
-
}, handleMutations2 = function(mutations) {
|
|
2276
|
-
const focusedElement = document.activeElement;
|
|
2277
|
-
if (focusedElement !== document.body) return;
|
|
2278
|
-
for (const mutation of mutations) {
|
|
2279
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
2280
|
-
}
|
|
2281
|
-
};
|
|
2282
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
2283
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
2284
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
2285
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
2286
|
-
return () => {
|
|
2287
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
2288
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
2289
|
-
mutationObserver.disconnect();
|
|
2290
|
-
};
|
|
2291
|
-
}
|
|
2292
|
-
}, [trapped, container, focusScope.paused]);
|
|
2293
|
-
React.useEffect(() => {
|
|
2294
|
-
if (container) {
|
|
2295
|
-
focusScopesStack.add(focusScope);
|
|
2296
|
-
const previouslyFocusedElement = document.activeElement;
|
|
2297
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
2298
|
-
if (!hasFocusedCandidate) {
|
|
2299
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
2300
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
2301
|
-
container.dispatchEvent(mountEvent);
|
|
2302
|
-
if (!mountEvent.defaultPrevented) {
|
|
2303
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
2304
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
2305
|
-
focus(container);
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
return () => {
|
|
2310
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
2311
|
-
setTimeout(() => {
|
|
2312
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
2313
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
2314
|
-
container.dispatchEvent(unmountEvent);
|
|
2315
|
-
if (!unmountEvent.defaultPrevented) {
|
|
2316
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
2317
|
-
}
|
|
2318
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
2319
|
-
focusScopesStack.remove(focusScope);
|
|
2320
|
-
}, 0);
|
|
2321
|
-
};
|
|
2322
|
-
}
|
|
2323
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
2324
|
-
const handleKeyDown = React.useCallback(
|
|
2325
|
-
(event) => {
|
|
2326
|
-
if (!loop && !trapped) return;
|
|
2327
|
-
if (focusScope.paused) return;
|
|
2328
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
2329
|
-
const focusedElement = document.activeElement;
|
|
2330
|
-
if (isTabKey && focusedElement) {
|
|
2331
|
-
const container2 = event.currentTarget;
|
|
2332
|
-
const [first, last] = getTabbableEdges(container2);
|
|
2333
|
-
const hasTabbableElementsInside = first && last;
|
|
2334
|
-
if (!hasTabbableElementsInside) {
|
|
2335
|
-
if (focusedElement === container2) event.preventDefault();
|
|
2336
|
-
} else {
|
|
2337
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
2338
|
-
event.preventDefault();
|
|
2339
|
-
if (loop) focus(first, { select: true });
|
|
2340
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
2341
|
-
event.preventDefault();
|
|
2342
|
-
if (loop) focus(last, { select: true });
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
},
|
|
2347
|
-
[loop, trapped, focusScope.paused]
|
|
2348
|
-
);
|
|
2349
|
-
return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
2350
|
-
});
|
|
2351
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
2352
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
2353
|
-
const previouslyFocusedElement = document.activeElement;
|
|
2354
|
-
for (const candidate of candidates) {
|
|
2355
|
-
focus(candidate, { select });
|
|
2356
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
function getTabbableEdges(container) {
|
|
2360
|
-
const candidates = getTabbableCandidates(container);
|
|
2361
|
-
const first = findVisible(candidates, container);
|
|
2362
|
-
const last = findVisible(candidates.reverse(), container);
|
|
2363
|
-
return [first, last];
|
|
2364
|
-
}
|
|
2365
|
-
function getTabbableCandidates(container) {
|
|
2366
|
-
const nodes = [];
|
|
2367
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
2368
|
-
acceptNode: (node) => {
|
|
2369
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
2370
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
2371
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
2372
|
-
}
|
|
2373
|
-
});
|
|
2374
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
2375
|
-
return nodes;
|
|
2376
|
-
}
|
|
2377
|
-
function findVisible(elements, container) {
|
|
2378
|
-
for (const element of elements) {
|
|
2379
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
function isHidden(node, { upTo }) {
|
|
2383
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
2384
|
-
while (node) {
|
|
2385
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
2386
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
2387
|
-
node = node.parentElement;
|
|
2388
|
-
}
|
|
2389
|
-
return false;
|
|
2390
|
-
}
|
|
2391
|
-
function isSelectableInput(element) {
|
|
2392
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
2393
|
-
}
|
|
2394
|
-
function focus(element, { select = false } = {}) {
|
|
2395
|
-
if (element && element.focus) {
|
|
2396
|
-
const previouslyFocusedElement = document.activeElement;
|
|
2397
|
-
element.focus({ preventScroll: true });
|
|
2398
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
2399
|
-
element.select();
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
var focusScopesStack = createFocusScopesStack();
|
|
2403
|
-
function createFocusScopesStack() {
|
|
2404
|
-
let stack = [];
|
|
2405
|
-
return {
|
|
2406
|
-
add(focusScope) {
|
|
2407
|
-
const activeFocusScope = stack[0];
|
|
2408
|
-
if (focusScope !== activeFocusScope) {
|
|
2409
|
-
activeFocusScope == null ? void 0 : activeFocusScope.pause();
|
|
2410
|
-
}
|
|
2411
|
-
stack = arrayRemove(stack, focusScope);
|
|
2412
|
-
stack.unshift(focusScope);
|
|
2413
|
-
},
|
|
2414
|
-
remove(focusScope) {
|
|
2415
|
-
var _a2;
|
|
2416
|
-
stack = arrayRemove(stack, focusScope);
|
|
2417
|
-
(_a2 = stack[0]) == null ? void 0 : _a2.resume();
|
|
2418
|
-
}
|
|
2419
|
-
};
|
|
2420
|
-
}
|
|
2421
|
-
function arrayRemove(array, item) {
|
|
2422
|
-
const updatedArray = [...array];
|
|
2423
|
-
const index = updatedArray.indexOf(item);
|
|
2424
|
-
if (index !== -1) {
|
|
2425
|
-
updatedArray.splice(index, 1);
|
|
2426
|
-
}
|
|
2427
|
-
return updatedArray;
|
|
2428
|
-
}
|
|
2429
|
-
function removeLinks(items) {
|
|
2430
|
-
return items.filter((item) => item.tagName !== "A");
|
|
2431
|
-
}
|
|
2432
|
-
function useStateMachine(initialState, machine) {
|
|
2433
|
-
return React.useReducer((state, event) => {
|
|
2434
|
-
const nextState = machine[state][event];
|
|
2435
|
-
return nextState ?? state;
|
|
2436
|
-
}, initialState);
|
|
2437
|
-
}
|
|
2438
|
-
var Presence = (props) => {
|
|
2439
|
-
const { present, children } = props;
|
|
2440
|
-
const presence = usePresence(present);
|
|
2441
|
-
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React.Children.only(children);
|
|
2442
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
2443
|
-
const forceMount = typeof children === "function";
|
|
2444
|
-
return forceMount || presence.isPresent ? React.cloneElement(child, { ref }) : null;
|
|
2445
|
-
};
|
|
2446
|
-
Presence.displayName = "Presence";
|
|
2447
|
-
function usePresence(present) {
|
|
2448
|
-
const [node, setNode] = React.useState();
|
|
2449
|
-
const stylesRef = React.useRef(null);
|
|
2450
|
-
const prevPresentRef = React.useRef(present);
|
|
2451
|
-
const prevAnimationNameRef = React.useRef("none");
|
|
2452
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
2453
|
-
const [state, send] = useStateMachine(initialState, {
|
|
2454
|
-
mounted: {
|
|
2455
|
-
UNMOUNT: "unmounted",
|
|
2456
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
2457
|
-
},
|
|
2458
|
-
unmountSuspended: {
|
|
2459
|
-
MOUNT: "mounted",
|
|
2460
|
-
ANIMATION_END: "unmounted"
|
|
2461
|
-
},
|
|
2462
|
-
unmounted: {
|
|
2463
|
-
MOUNT: "mounted"
|
|
2464
|
-
}
|
|
2465
|
-
});
|
|
2466
|
-
React.useEffect(() => {
|
|
2467
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
2468
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
2469
|
-
}, [state]);
|
|
2470
|
-
useLayoutEffect2(() => {
|
|
2471
|
-
const styles = stylesRef.current;
|
|
2472
|
-
const wasPresent = prevPresentRef.current;
|
|
2473
|
-
const hasPresentChanged = wasPresent !== present;
|
|
2474
|
-
if (hasPresentChanged) {
|
|
2475
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
2476
|
-
const currentAnimationName = getAnimationName(styles);
|
|
2477
|
-
if (present) {
|
|
2478
|
-
send("MOUNT");
|
|
2479
|
-
} else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
|
|
2480
|
-
send("UNMOUNT");
|
|
2481
|
-
} else {
|
|
2482
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
2483
|
-
if (wasPresent && isAnimating) {
|
|
2484
|
-
send("ANIMATION_OUT");
|
|
2485
|
-
} else {
|
|
2486
|
-
send("UNMOUNT");
|
|
2487
|
-
}
|
|
2488
|
-
}
|
|
2489
|
-
prevPresentRef.current = present;
|
|
2490
|
-
}
|
|
2491
|
-
}, [present, send]);
|
|
2492
|
-
useLayoutEffect2(() => {
|
|
2493
|
-
if (node) {
|
|
2494
|
-
let timeoutId;
|
|
2495
|
-
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
2496
|
-
const handleAnimationEnd = (event) => {
|
|
2497
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
2498
|
-
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
2499
|
-
if (event.target === node && isCurrentAnimation) {
|
|
2500
|
-
send("ANIMATION_END");
|
|
2501
|
-
if (!prevPresentRef.current) {
|
|
2502
|
-
const currentFillMode = node.style.animationFillMode;
|
|
2503
|
-
node.style.animationFillMode = "forwards";
|
|
2504
|
-
timeoutId = ownerWindow.setTimeout(() => {
|
|
2505
|
-
if (node.style.animationFillMode === "forwards") {
|
|
2506
|
-
node.style.animationFillMode = currentFillMode;
|
|
2507
|
-
}
|
|
2508
|
-
});
|
|
2509
|
-
}
|
|
2510
|
-
}
|
|
2511
|
-
};
|
|
2512
|
-
const handleAnimationStart = (event) => {
|
|
2513
|
-
if (event.target === node) {
|
|
2514
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
2515
|
-
}
|
|
2516
|
-
};
|
|
2517
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
2518
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
2519
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
2520
|
-
return () => {
|
|
2521
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
2522
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
2523
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
2524
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
2525
|
-
};
|
|
2526
|
-
} else {
|
|
2527
|
-
send("ANIMATION_END");
|
|
2528
|
-
}
|
|
2529
|
-
}, [node, send]);
|
|
2530
|
-
return {
|
|
2531
|
-
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
2532
|
-
ref: React.useCallback((node2) => {
|
|
2533
|
-
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
2534
|
-
setNode(node2);
|
|
2535
|
-
}, [])
|
|
2536
|
-
};
|
|
2537
|
-
}
|
|
2538
|
-
function getAnimationName(styles) {
|
|
2539
|
-
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
2540
|
-
}
|
|
2541
|
-
function getElementRef(element) {
|
|
2542
|
-
var _a2, _b;
|
|
2543
|
-
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
2544
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2545
|
-
if (mayWarn) {
|
|
2546
|
-
return element.ref;
|
|
2547
|
-
}
|
|
2548
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
2549
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2550
|
-
if (mayWarn) {
|
|
2551
|
-
return element.props.ref;
|
|
2552
|
-
}
|
|
2553
|
-
return element.props.ref || element.ref;
|
|
2554
|
-
}
|
|
2555
|
-
var count = 0;
|
|
2556
|
-
function useFocusGuards() {
|
|
2557
|
-
React.useEffect(() => {
|
|
2558
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
2559
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
2560
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
2561
|
-
count++;
|
|
2562
|
-
return () => {
|
|
2563
|
-
if (count === 1) {
|
|
2564
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
2565
|
-
}
|
|
2566
|
-
count--;
|
|
2567
|
-
};
|
|
2568
|
-
}, []);
|
|
2569
|
-
}
|
|
2570
|
-
function createFocusGuard() {
|
|
2571
|
-
const element = document.createElement("span");
|
|
2572
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
2573
|
-
element.tabIndex = 0;
|
|
2574
|
-
element.style.outline = "none";
|
|
2575
|
-
element.style.opacity = "0";
|
|
2576
|
-
element.style.position = "fixed";
|
|
2577
|
-
element.style.pointerEvents = "none";
|
|
2578
|
-
return element;
|
|
2579
|
-
}
|
|
2580
|
-
var __assign = function() {
|
|
2581
|
-
__assign = Object.assign || function __assign2(t) {
|
|
2582
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2583
|
-
s = arguments[i];
|
|
2584
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2585
|
-
}
|
|
2586
|
-
return t;
|
|
2587
|
-
};
|
|
2588
|
-
return __assign.apply(this, arguments);
|
|
2589
|
-
};
|
|
2590
|
-
function __rest(s, e) {
|
|
2591
|
-
var t = {};
|
|
2592
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2593
|
-
t[p] = s[p];
|
|
2594
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2595
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2596
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2597
|
-
t[p[i]] = s[p[i]];
|
|
2598
|
-
}
|
|
2599
|
-
return t;
|
|
2600
|
-
}
|
|
2601
|
-
function __spreadArray(to, from, pack) {
|
|
2602
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2603
|
-
if (ar || !(i in from)) {
|
|
2604
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2605
|
-
ar[i] = from[i];
|
|
2606
|
-
}
|
|
2607
|
-
}
|
|
2608
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2609
|
-
}
|
|
2610
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
2611
|
-
var e = new Error(message);
|
|
2612
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2613
|
-
};
|
|
2614
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
2615
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
2616
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
2617
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
2618
|
-
function assignRef(ref, value) {
|
|
2619
|
-
if (typeof ref === "function") {
|
|
2620
|
-
ref(value);
|
|
2621
|
-
} else if (ref) {
|
|
2622
|
-
ref.current = value;
|
|
2623
|
-
}
|
|
2624
|
-
return ref;
|
|
2625
|
-
}
|
|
2626
|
-
function useCallbackRef(initialValue, callback) {
|
|
2627
|
-
var ref = useState(function() {
|
|
2628
|
-
return {
|
|
2629
|
-
// value
|
|
2630
|
-
value: initialValue,
|
|
2631
|
-
// last callback
|
|
2632
|
-
callback,
|
|
2633
|
-
// "memoized" public interface
|
|
2634
|
-
facade: {
|
|
2635
|
-
get current() {
|
|
2636
|
-
return ref.value;
|
|
2637
|
-
},
|
|
2638
|
-
set current(value) {
|
|
2639
|
-
var last = ref.value;
|
|
2640
|
-
if (last !== value) {
|
|
2641
|
-
ref.value = value;
|
|
2642
|
-
ref.callback(value, last);
|
|
2643
|
-
}
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
};
|
|
2647
|
-
})[0];
|
|
2648
|
-
ref.callback = callback;
|
|
2649
|
-
return ref.facade;
|
|
2650
|
-
}
|
|
2651
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
2652
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
2653
|
-
function useMergeRefs(refs, defaultValue) {
|
|
2654
|
-
var callbackRef = useCallbackRef(null, function(newValue) {
|
|
2655
|
-
return refs.forEach(function(ref) {
|
|
2656
|
-
return assignRef(ref, newValue);
|
|
2657
|
-
});
|
|
2658
|
-
});
|
|
2659
|
-
useIsomorphicLayoutEffect(function() {
|
|
2660
|
-
var oldValue = currentValues.get(callbackRef);
|
|
2661
|
-
if (oldValue) {
|
|
2662
|
-
var prevRefs_1 = new Set(oldValue);
|
|
2663
|
-
var nextRefs_1 = new Set(refs);
|
|
2664
|
-
var current_1 = callbackRef.current;
|
|
2665
|
-
prevRefs_1.forEach(function(ref) {
|
|
2666
|
-
if (!nextRefs_1.has(ref)) {
|
|
2667
|
-
assignRef(ref, null);
|
|
2668
|
-
}
|
|
2669
|
-
});
|
|
2670
|
-
nextRefs_1.forEach(function(ref) {
|
|
2671
|
-
if (!prevRefs_1.has(ref)) {
|
|
2672
|
-
assignRef(ref, current_1);
|
|
2673
|
-
}
|
|
2674
|
-
});
|
|
2675
|
-
}
|
|
2676
|
-
currentValues.set(callbackRef, refs);
|
|
2677
|
-
}, [refs]);
|
|
2678
|
-
return callbackRef;
|
|
2679
|
-
}
|
|
2680
|
-
function ItoI(a) {
|
|
2681
|
-
return a;
|
|
2682
|
-
}
|
|
2683
|
-
function innerCreateMedium(defaults, middleware) {
|
|
2684
|
-
if (middleware === void 0) {
|
|
2685
|
-
middleware = ItoI;
|
|
2686
|
-
}
|
|
2687
|
-
var buffer = [];
|
|
2688
|
-
var assigned = false;
|
|
2689
|
-
var medium = {
|
|
2690
|
-
read: function() {
|
|
2691
|
-
if (assigned) {
|
|
2692
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
2693
|
-
}
|
|
2694
|
-
if (buffer.length) {
|
|
2695
|
-
return buffer[buffer.length - 1];
|
|
2696
|
-
}
|
|
2697
|
-
return defaults;
|
|
2698
|
-
},
|
|
2699
|
-
useMedium: function(data) {
|
|
2700
|
-
var item = middleware(data, assigned);
|
|
2701
|
-
buffer.push(item);
|
|
2702
|
-
return function() {
|
|
2703
|
-
buffer = buffer.filter(function(x) {
|
|
2704
|
-
return x !== item;
|
|
2705
|
-
});
|
|
2706
|
-
};
|
|
2707
|
-
},
|
|
2708
|
-
assignSyncMedium: function(cb) {
|
|
2709
|
-
assigned = true;
|
|
2710
|
-
while (buffer.length) {
|
|
2711
|
-
var cbs = buffer;
|
|
2712
|
-
buffer = [];
|
|
2713
|
-
cbs.forEach(cb);
|
|
2714
|
-
}
|
|
2715
|
-
buffer = {
|
|
2716
|
-
push: function(x) {
|
|
2717
|
-
return cb(x);
|
|
2718
|
-
},
|
|
2719
|
-
filter: function() {
|
|
2720
|
-
return buffer;
|
|
2721
|
-
}
|
|
2722
|
-
};
|
|
2723
|
-
},
|
|
2724
|
-
assignMedium: function(cb) {
|
|
2725
|
-
assigned = true;
|
|
2726
|
-
var pendingQueue = [];
|
|
2727
|
-
if (buffer.length) {
|
|
2728
|
-
var cbs = buffer;
|
|
2729
|
-
buffer = [];
|
|
2730
|
-
cbs.forEach(cb);
|
|
2731
|
-
pendingQueue = buffer;
|
|
2732
|
-
}
|
|
2733
|
-
var executeQueue = function() {
|
|
2734
|
-
var cbs2 = pendingQueue;
|
|
2735
|
-
pendingQueue = [];
|
|
2736
|
-
cbs2.forEach(cb);
|
|
2737
|
-
};
|
|
2738
|
-
var cycle = function() {
|
|
2739
|
-
return Promise.resolve().then(executeQueue);
|
|
2740
|
-
};
|
|
2741
|
-
cycle();
|
|
2742
|
-
buffer = {
|
|
2743
|
-
push: function(x) {
|
|
2744
|
-
pendingQueue.push(x);
|
|
2745
|
-
cycle();
|
|
2746
|
-
},
|
|
2747
|
-
filter: function(filter) {
|
|
2748
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
2749
|
-
return buffer;
|
|
2750
|
-
}
|
|
2751
|
-
};
|
|
2752
|
-
}
|
|
2753
|
-
};
|
|
2754
|
-
return medium;
|
|
2755
|
-
}
|
|
2756
|
-
function createSidecarMedium(options) {
|
|
2757
|
-
if (options === void 0) {
|
|
2758
|
-
options = {};
|
|
2759
|
-
}
|
|
2760
|
-
var medium = innerCreateMedium(null);
|
|
2761
|
-
medium.options = __assign({ async: true, ssr: false }, options);
|
|
2762
|
-
return medium;
|
|
2763
|
-
}
|
|
2764
|
-
var SideCar$1 = function(_a2) {
|
|
2765
|
-
var sideCar = _a2.sideCar, rest = __rest(_a2, ["sideCar"]);
|
|
2766
|
-
if (!sideCar) {
|
|
2767
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
2768
|
-
}
|
|
2769
|
-
var Target = sideCar.read();
|
|
2770
|
-
if (!Target) {
|
|
2771
|
-
throw new Error("Sidecar medium not found");
|
|
2772
|
-
}
|
|
2773
|
-
return React.createElement(Target, __assign({}, rest));
|
|
2774
|
-
};
|
|
2775
|
-
SideCar$1.isSideCarExport = true;
|
|
2776
|
-
function exportSidecar(medium, exported) {
|
|
2777
|
-
medium.useMedium(exported);
|
|
2778
|
-
return SideCar$1;
|
|
2779
|
-
}
|
|
2780
|
-
var effectCar = createSidecarMedium();
|
|
2781
|
-
var nothing = function() {
|
|
2782
|
-
return;
|
|
2783
|
-
};
|
|
2784
|
-
var RemoveScroll = React.forwardRef(function(props, parentRef) {
|
|
2785
|
-
var ref = React.useRef(null);
|
|
2786
|
-
var _a2 = React.useState({
|
|
2787
|
-
onScrollCapture: nothing,
|
|
2788
|
-
onWheelCapture: nothing,
|
|
2789
|
-
onTouchMoveCapture: nothing
|
|
2790
|
-
}), callbacks = _a2[0], setCallbacks = _a2[1];
|
|
2791
|
-
var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, 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", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
|
|
2792
|
-
var SideCar2 = sideCar;
|
|
2793
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
2794
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
2795
|
-
return React.createElement(
|
|
2796
|
-
React.Fragment,
|
|
2797
|
-
null,
|
|
2798
|
-
enabled && React.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
2799
|
-
forwardProps ? React.cloneElement(React.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
2800
|
-
);
|
|
2801
|
-
});
|
|
2802
|
-
RemoveScroll.defaultProps = {
|
|
2803
|
-
enabled: true,
|
|
2804
|
-
removeScrollBar: true,
|
|
2805
|
-
inert: false
|
|
2806
|
-
};
|
|
2807
|
-
RemoveScroll.classNames = {
|
|
2808
|
-
fullWidth: fullWidthClassName,
|
|
2809
|
-
zeroRight: zeroRightClassName
|
|
2810
|
-
};
|
|
2811
|
-
var getNonce = function() {
|
|
2812
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
2813
|
-
return __webpack_nonce__;
|
|
2814
|
-
}
|
|
2815
|
-
return void 0;
|
|
2816
|
-
};
|
|
2817
|
-
function makeStyleTag() {
|
|
2818
|
-
if (!document)
|
|
2819
|
-
return null;
|
|
2820
|
-
var tag = document.createElement("style");
|
|
2821
|
-
tag.type = "text/css";
|
|
2822
|
-
var nonce = getNonce();
|
|
2823
|
-
if (nonce) {
|
|
2824
|
-
tag.setAttribute("nonce", nonce);
|
|
2825
|
-
}
|
|
2826
|
-
return tag;
|
|
2827
|
-
}
|
|
2828
|
-
function injectStyles(tag, css) {
|
|
2829
|
-
if (tag.styleSheet) {
|
|
2830
|
-
tag.styleSheet.cssText = css;
|
|
2831
|
-
} else {
|
|
2832
|
-
tag.appendChild(document.createTextNode(css));
|
|
2833
|
-
}
|
|
2834
|
-
}
|
|
2835
|
-
function insertStyleTag(tag) {
|
|
2836
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
2837
|
-
head.appendChild(tag);
|
|
2838
|
-
}
|
|
2839
|
-
var stylesheetSingleton = function() {
|
|
2840
|
-
var counter = 0;
|
|
2841
|
-
var stylesheet = null;
|
|
2842
|
-
return {
|
|
2843
|
-
add: function(style) {
|
|
2844
|
-
if (counter == 0) {
|
|
2845
|
-
if (stylesheet = makeStyleTag()) {
|
|
2846
|
-
injectStyles(stylesheet, style);
|
|
2847
|
-
insertStyleTag(stylesheet);
|
|
2848
|
-
}
|
|
2849
|
-
}
|
|
2850
|
-
counter++;
|
|
2851
|
-
},
|
|
2852
|
-
remove: function() {
|
|
2853
|
-
counter--;
|
|
2854
|
-
if (!counter && stylesheet) {
|
|
2855
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
2856
|
-
stylesheet = null;
|
|
2857
|
-
}
|
|
2858
|
-
}
|
|
2859
|
-
};
|
|
2860
|
-
};
|
|
2861
|
-
var styleHookSingleton = function() {
|
|
2862
|
-
var sheet = stylesheetSingleton();
|
|
2863
|
-
return function(styles, isDynamic) {
|
|
2864
|
-
React.useEffect(function() {
|
|
2865
|
-
sheet.add(styles);
|
|
2866
|
-
return function() {
|
|
2867
|
-
sheet.remove();
|
|
2868
|
-
};
|
|
2869
|
-
}, [styles && isDynamic]);
|
|
2870
|
-
};
|
|
2871
|
-
};
|
|
2872
|
-
var styleSingleton = function() {
|
|
2873
|
-
var useStyle = styleHookSingleton();
|
|
2874
|
-
var Sheet = function(_a2) {
|
|
2875
|
-
var styles = _a2.styles, dynamic = _a2.dynamic;
|
|
2876
|
-
useStyle(styles, dynamic);
|
|
2877
|
-
return null;
|
|
2878
|
-
};
|
|
2879
|
-
return Sheet;
|
|
2880
|
-
};
|
|
2881
|
-
var zeroGap = {
|
|
2882
|
-
left: 0,
|
|
2883
|
-
top: 0,
|
|
2884
|
-
right: 0,
|
|
2885
|
-
gap: 0
|
|
2886
|
-
};
|
|
2887
|
-
var parse = function(x) {
|
|
2888
|
-
return parseInt(x || "", 10) || 0;
|
|
2889
|
-
};
|
|
2890
|
-
var getOffset = function(gapMode) {
|
|
2891
|
-
var cs = window.getComputedStyle(document.body);
|
|
2892
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
2893
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
2894
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
2895
|
-
return [parse(left), parse(top), parse(right)];
|
|
2896
|
-
};
|
|
2897
|
-
var getGapWidth = function(gapMode) {
|
|
2898
|
-
if (gapMode === void 0) {
|
|
2899
|
-
gapMode = "margin";
|
|
2900
|
-
}
|
|
2901
|
-
if (typeof window === "undefined") {
|
|
2902
|
-
return zeroGap;
|
|
2903
|
-
}
|
|
2904
|
-
var offsets = getOffset(gapMode);
|
|
2905
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
2906
|
-
var windowWidth = window.innerWidth;
|
|
2907
|
-
return {
|
|
2908
|
-
left: offsets[0],
|
|
2909
|
-
top: offsets[1],
|
|
2910
|
-
right: offsets[2],
|
|
2911
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
2912
|
-
};
|
|
2913
|
-
};
|
|
2914
|
-
var Style = styleSingleton();
|
|
2915
|
-
var lockAttribute = "data-scroll-locked";
|
|
2916
|
-
var getStyles = function(_a2, allowRelative, gapMode, important) {
|
|
2917
|
-
var left = _a2.left, top = _a2.top, right = _a2.right, gap = _a2.gap;
|
|
2918
|
-
if (gapMode === void 0) {
|
|
2919
|
-
gapMode = "margin";
|
|
2920
|
-
}
|
|
2921
|
-
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([
|
|
2922
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
2923
|
-
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 "),
|
|
2924
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
2925
|
-
].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");
|
|
2926
|
-
};
|
|
2927
|
-
var getCurrentUseCounter = function() {
|
|
2928
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
2929
|
-
return isFinite(counter) ? counter : 0;
|
|
2930
|
-
};
|
|
2931
|
-
var useLockAttribute = function() {
|
|
2932
|
-
React.useEffect(function() {
|
|
2933
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
2934
|
-
return function() {
|
|
2935
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
2936
|
-
if (newCounter <= 0) {
|
|
2937
|
-
document.body.removeAttribute(lockAttribute);
|
|
2938
|
-
} else {
|
|
2939
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
2940
|
-
}
|
|
2941
|
-
};
|
|
2942
|
-
}, []);
|
|
2943
|
-
};
|
|
2944
|
-
var RemoveScrollBar = function(_a2) {
|
|
2945
|
-
var noRelative = _a2.noRelative, noImportant = _a2.noImportant, _b = _a2.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
2946
|
-
useLockAttribute();
|
|
2947
|
-
var gap = React.useMemo(function() {
|
|
2948
|
-
return getGapWidth(gapMode);
|
|
2949
|
-
}, [gapMode]);
|
|
2950
|
-
return React.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
2951
|
-
};
|
|
2952
|
-
var passiveSupported = false;
|
|
2953
|
-
if (typeof window !== "undefined") {
|
|
2954
|
-
try {
|
|
2955
|
-
var options = Object.defineProperty({}, "passive", {
|
|
2956
|
-
get: function() {
|
|
2957
|
-
passiveSupported = true;
|
|
2958
|
-
return true;
|
|
2959
|
-
}
|
|
2960
|
-
});
|
|
2961
|
-
window.addEventListener("test", options, options);
|
|
2962
|
-
window.removeEventListener("test", options, options);
|
|
2963
|
-
} catch (err) {
|
|
2964
|
-
passiveSupported = false;
|
|
2965
|
-
}
|
|
2966
|
-
}
|
|
2967
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
2968
|
-
var alwaysContainsScroll = function(node) {
|
|
2969
|
-
return node.tagName === "TEXTAREA";
|
|
2970
|
-
};
|
|
2971
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
2972
|
-
if (!(node instanceof Element)) {
|
|
2973
|
-
return false;
|
|
2974
|
-
}
|
|
2975
|
-
var styles = window.getComputedStyle(node);
|
|
2976
|
-
return (
|
|
2977
|
-
// not-not-scrollable
|
|
2978
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
2979
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
2980
|
-
);
|
|
2981
|
-
};
|
|
2982
|
-
var elementCouldBeVScrolled = function(node) {
|
|
2983
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
2984
|
-
};
|
|
2985
|
-
var elementCouldBeHScrolled = function(node) {
|
|
2986
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
2987
|
-
};
|
|
2988
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
2989
|
-
var ownerDocument = node.ownerDocument;
|
|
2990
|
-
var current = node;
|
|
2991
|
-
do {
|
|
2992
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
2993
|
-
current = current.host;
|
|
2994
|
-
}
|
|
2995
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
2996
|
-
if (isScrollable) {
|
|
2997
|
-
var _a2 = getScrollVariables(axis, current), scrollHeight = _a2[1], clientHeight = _a2[2];
|
|
2998
|
-
if (scrollHeight > clientHeight) {
|
|
2999
|
-
return true;
|
|
3000
|
-
}
|
|
3001
|
-
}
|
|
3002
|
-
current = current.parentNode;
|
|
3003
|
-
} while (current && current !== ownerDocument.body);
|
|
3004
|
-
return false;
|
|
3005
|
-
};
|
|
3006
|
-
var getVScrollVariables = function(_a2) {
|
|
3007
|
-
var scrollTop = _a2.scrollTop, scrollHeight = _a2.scrollHeight, clientHeight = _a2.clientHeight;
|
|
3008
|
-
return [
|
|
3009
|
-
scrollTop,
|
|
3010
|
-
scrollHeight,
|
|
3011
|
-
clientHeight
|
|
3012
|
-
];
|
|
3013
|
-
};
|
|
3014
|
-
var getHScrollVariables = function(_a2) {
|
|
3015
|
-
var scrollLeft = _a2.scrollLeft, scrollWidth = _a2.scrollWidth, clientWidth = _a2.clientWidth;
|
|
3016
|
-
return [
|
|
3017
|
-
scrollLeft,
|
|
3018
|
-
scrollWidth,
|
|
3019
|
-
clientWidth
|
|
3020
|
-
];
|
|
3021
|
-
};
|
|
3022
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
3023
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
3024
|
-
};
|
|
3025
|
-
var getScrollVariables = function(axis, node) {
|
|
3026
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
3027
|
-
};
|
|
3028
|
-
var getDirectionFactor = function(axis, direction) {
|
|
3029
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
3030
|
-
};
|
|
3031
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
3032
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
3033
|
-
var delta = directionFactor * sourceDelta;
|
|
3034
|
-
var target = event.target;
|
|
3035
|
-
var targetInLock = endTarget.contains(target);
|
|
3036
|
-
var shouldCancelScroll = false;
|
|
3037
|
-
var isDeltaPositive = delta > 0;
|
|
3038
|
-
var availableScroll = 0;
|
|
3039
|
-
var availableScrollTop = 0;
|
|
3040
|
-
do {
|
|
3041
|
-
var _a2 = getScrollVariables(axis, target), position = _a2[0], scroll_1 = _a2[1], capacity = _a2[2];
|
|
3042
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
3043
|
-
if (position || elementScroll) {
|
|
3044
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
3045
|
-
availableScroll += elementScroll;
|
|
3046
|
-
availableScrollTop += position;
|
|
3047
|
-
}
|
|
3048
|
-
}
|
|
3049
|
-
if (target instanceof ShadowRoot) {
|
|
3050
|
-
target = target.host;
|
|
3051
|
-
} else {
|
|
3052
|
-
target = target.parentNode;
|
|
3053
|
-
}
|
|
3054
|
-
} while (
|
|
3055
|
-
// portaled content
|
|
3056
|
-
!targetInLock && target !== document.body || // self content
|
|
3057
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
3058
|
-
);
|
|
3059
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
3060
|
-
shouldCancelScroll = true;
|
|
3061
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
3062
|
-
shouldCancelScroll = true;
|
|
3063
|
-
}
|
|
3064
|
-
return shouldCancelScroll;
|
|
3065
|
-
};
|
|
3066
|
-
var getTouchXY = function(event) {
|
|
3067
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
3068
|
-
};
|
|
3069
|
-
var getDeltaXY = function(event) {
|
|
3070
|
-
return [event.deltaX, event.deltaY];
|
|
3071
|
-
};
|
|
3072
|
-
var extractRef = function(ref) {
|
|
3073
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
3074
|
-
};
|
|
3075
|
-
var deltaCompare = function(x, y) {
|
|
3076
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
3077
|
-
};
|
|
3078
|
-
var generateStyle = function(id) {
|
|
3079
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
3080
|
-
};
|
|
3081
|
-
var idCounter = 0;
|
|
3082
|
-
var lockStack = [];
|
|
3083
|
-
function RemoveScrollSideCar(props) {
|
|
3084
|
-
var shouldPreventQueue = React.useRef([]);
|
|
3085
|
-
var touchStartRef = React.useRef([0, 0]);
|
|
3086
|
-
var activeAxis = React.useRef();
|
|
3087
|
-
var id = React.useState(idCounter++)[0];
|
|
3088
|
-
var Style2 = React.useState(styleSingleton)[0];
|
|
3089
|
-
var lastProps = React.useRef(props);
|
|
3090
|
-
React.useEffect(function() {
|
|
3091
|
-
lastProps.current = props;
|
|
3092
|
-
}, [props]);
|
|
3093
|
-
React.useEffect(function() {
|
|
3094
|
-
if (props.inert) {
|
|
3095
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
3096
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
3097
|
-
allow_1.forEach(function(el) {
|
|
3098
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
3099
|
-
});
|
|
3100
|
-
return function() {
|
|
3101
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
3102
|
-
allow_1.forEach(function(el) {
|
|
3103
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
3104
|
-
});
|
|
3105
|
-
};
|
|
3106
|
-
}
|
|
3107
|
-
return;
|
|
3108
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
3109
|
-
var shouldCancelEvent = React.useCallback(function(event, parent) {
|
|
3110
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
3111
|
-
return !lastProps.current.allowPinchZoom;
|
|
3112
|
-
}
|
|
3113
|
-
var touch = getTouchXY(event);
|
|
3114
|
-
var touchStart = touchStartRef.current;
|
|
3115
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
3116
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
3117
|
-
var currentAxis;
|
|
3118
|
-
var target = event.target;
|
|
3119
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
3120
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
3121
|
-
return false;
|
|
3122
|
-
}
|
|
3123
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3124
|
-
if (!canBeScrolledInMainDirection) {
|
|
3125
|
-
return true;
|
|
3126
|
-
}
|
|
3127
|
-
if (canBeScrolledInMainDirection) {
|
|
3128
|
-
currentAxis = moveDirection;
|
|
3129
|
-
} else {
|
|
3130
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
3131
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3132
|
-
}
|
|
3133
|
-
if (!canBeScrolledInMainDirection) {
|
|
3134
|
-
return false;
|
|
3135
|
-
}
|
|
3136
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
3137
|
-
activeAxis.current = currentAxis;
|
|
3138
|
-
}
|
|
3139
|
-
if (!currentAxis) {
|
|
3140
|
-
return true;
|
|
3141
|
-
}
|
|
3142
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
3143
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
3144
|
-
}, []);
|
|
3145
|
-
var shouldPrevent = React.useCallback(function(_event) {
|
|
3146
|
-
var event = _event;
|
|
3147
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
3148
|
-
return;
|
|
3149
|
-
}
|
|
3150
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
3151
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
3152
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
3153
|
-
})[0];
|
|
3154
|
-
if (sourceEvent && sourceEvent.should) {
|
|
3155
|
-
if (event.cancelable) {
|
|
3156
|
-
event.preventDefault();
|
|
3157
|
-
}
|
|
3158
|
-
return;
|
|
3159
|
-
}
|
|
3160
|
-
if (!sourceEvent) {
|
|
3161
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
3162
|
-
return node.contains(event.target);
|
|
3163
|
-
});
|
|
3164
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
3165
|
-
if (shouldStop) {
|
|
3166
|
-
if (event.cancelable) {
|
|
3167
|
-
event.preventDefault();
|
|
3168
|
-
}
|
|
3169
|
-
}
|
|
3170
|
-
}
|
|
3171
|
-
}, []);
|
|
3172
|
-
var shouldCancel = React.useCallback(function(name, delta, target, should) {
|
|
3173
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
3174
|
-
shouldPreventQueue.current.push(event);
|
|
3175
|
-
setTimeout(function() {
|
|
3176
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
3177
|
-
return e !== event;
|
|
3178
|
-
});
|
|
3179
|
-
}, 1);
|
|
3180
|
-
}, []);
|
|
3181
|
-
var scrollTouchStart = React.useCallback(function(event) {
|
|
3182
|
-
touchStartRef.current = getTouchXY(event);
|
|
3183
|
-
activeAxis.current = void 0;
|
|
3184
|
-
}, []);
|
|
3185
|
-
var scrollWheel = React.useCallback(function(event) {
|
|
3186
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3187
|
-
}, []);
|
|
3188
|
-
var scrollTouchMove = React.useCallback(function(event) {
|
|
3189
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3190
|
-
}, []);
|
|
3191
|
-
React.useEffect(function() {
|
|
3192
|
-
lockStack.push(Style2);
|
|
3193
|
-
props.setCallbacks({
|
|
3194
|
-
onScrollCapture: scrollWheel,
|
|
3195
|
-
onWheelCapture: scrollWheel,
|
|
3196
|
-
onTouchMoveCapture: scrollTouchMove
|
|
3197
|
-
});
|
|
3198
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
3199
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3200
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3201
|
-
return function() {
|
|
3202
|
-
lockStack = lockStack.filter(function(inst) {
|
|
3203
|
-
return inst !== Style2;
|
|
3204
|
-
});
|
|
3205
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
3206
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3207
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3208
|
-
};
|
|
3209
|
-
}, []);
|
|
3210
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
3211
|
-
return React.createElement(
|
|
3212
|
-
React.Fragment,
|
|
3213
|
-
null,
|
|
3214
|
-
inert ? React.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
3215
|
-
removeScrollBar ? React.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null
|
|
3216
|
-
);
|
|
3217
|
-
}
|
|
3218
|
-
function getOutermostShadowParent(node) {
|
|
3219
|
-
var shadowParent = null;
|
|
3220
|
-
while (node !== null) {
|
|
3221
|
-
if (node instanceof ShadowRoot) {
|
|
3222
|
-
shadowParent = node.host;
|
|
3223
|
-
node = node.host;
|
|
3224
|
-
}
|
|
3225
|
-
node = node.parentNode;
|
|
3226
|
-
}
|
|
3227
|
-
return shadowParent;
|
|
3228
|
-
}
|
|
3229
|
-
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
3230
|
-
var ReactRemoveScroll = React.forwardRef(function(props, ref) {
|
|
3231
|
-
return React.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
|
|
3232
|
-
});
|
|
3233
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
3234
|
-
var getDefaultParent = function(originalTarget) {
|
|
3235
|
-
if (typeof document === "undefined") {
|
|
3236
|
-
return null;
|
|
3237
|
-
}
|
|
3238
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
3239
|
-
return sampleTarget.ownerDocument.body;
|
|
3240
|
-
};
|
|
3241
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
3242
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3243
|
-
var markerMap = {};
|
|
3244
|
-
var lockCount = 0;
|
|
3245
|
-
var unwrapHost = function(node) {
|
|
3246
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
3247
|
-
};
|
|
3248
|
-
var correctTargets = function(parent, targets) {
|
|
3249
|
-
return targets.map(function(target) {
|
|
3250
|
-
if (parent.contains(target)) {
|
|
3251
|
-
return target;
|
|
3252
|
-
}
|
|
3253
|
-
var correctedTarget = unwrapHost(target);
|
|
3254
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
3255
|
-
return correctedTarget;
|
|
3256
|
-
}
|
|
3257
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
3258
|
-
return null;
|
|
3259
|
-
}).filter(function(x) {
|
|
3260
|
-
return Boolean(x);
|
|
3261
|
-
});
|
|
3262
|
-
};
|
|
3263
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
3264
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3265
|
-
if (!markerMap[markerName]) {
|
|
3266
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
3267
|
-
}
|
|
3268
|
-
var markerCounter = markerMap[markerName];
|
|
3269
|
-
var hiddenNodes = [];
|
|
3270
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
3271
|
-
var elementsToStop = new Set(targets);
|
|
3272
|
-
var keep = function(el) {
|
|
3273
|
-
if (!el || elementsToKeep.has(el)) {
|
|
3274
|
-
return;
|
|
3275
|
-
}
|
|
3276
|
-
elementsToKeep.add(el);
|
|
3277
|
-
keep(el.parentNode);
|
|
3278
|
-
};
|
|
3279
|
-
targets.forEach(keep);
|
|
3280
|
-
var deep = function(parent) {
|
|
3281
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
3282
|
-
return;
|
|
3283
|
-
}
|
|
3284
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
3285
|
-
if (elementsToKeep.has(node)) {
|
|
3286
|
-
deep(node);
|
|
3287
|
-
} else {
|
|
3288
|
-
try {
|
|
3289
|
-
var attr = node.getAttribute(controlAttribute);
|
|
3290
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
3291
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
3292
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
3293
|
-
counterMap.set(node, counterValue);
|
|
3294
|
-
markerCounter.set(node, markerValue);
|
|
3295
|
-
hiddenNodes.push(node);
|
|
3296
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
3297
|
-
uncontrolledNodes.set(node, true);
|
|
3298
|
-
}
|
|
3299
|
-
if (markerValue === 1) {
|
|
3300
|
-
node.setAttribute(markerName, "true");
|
|
3301
|
-
}
|
|
3302
|
-
if (!alreadyHidden) {
|
|
3303
|
-
node.setAttribute(controlAttribute, "true");
|
|
3304
|
-
}
|
|
3305
|
-
} catch (e) {
|
|
3306
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
3307
|
-
}
|
|
3308
|
-
}
|
|
3309
|
-
});
|
|
3310
|
-
};
|
|
3311
|
-
deep(parentNode);
|
|
3312
|
-
elementsToKeep.clear();
|
|
3313
|
-
lockCount++;
|
|
3314
|
-
return function() {
|
|
3315
|
-
hiddenNodes.forEach(function(node) {
|
|
3316
|
-
var counterValue = counterMap.get(node) - 1;
|
|
3317
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
3318
|
-
counterMap.set(node, counterValue);
|
|
3319
|
-
markerCounter.set(node, markerValue);
|
|
3320
|
-
if (!counterValue) {
|
|
3321
|
-
if (!uncontrolledNodes.has(node)) {
|
|
3322
|
-
node.removeAttribute(controlAttribute);
|
|
3323
|
-
}
|
|
3324
|
-
uncontrolledNodes.delete(node);
|
|
3325
|
-
}
|
|
3326
|
-
if (!markerValue) {
|
|
3327
|
-
node.removeAttribute(markerName);
|
|
3328
|
-
}
|
|
3329
|
-
});
|
|
3330
|
-
lockCount--;
|
|
3331
|
-
if (!lockCount) {
|
|
3332
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3333
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3334
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3335
|
-
markerMap = {};
|
|
3336
|
-
}
|
|
3337
|
-
};
|
|
3338
|
-
};
|
|
3339
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
3340
|
-
if (markerName === void 0) {
|
|
3341
|
-
markerName = "data-aria-hidden";
|
|
3342
|
-
}
|
|
3343
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3344
|
-
var activeParentNode = getDefaultParent(originalTarget);
|
|
3345
|
-
if (!activeParentNode) {
|
|
3346
|
-
return function() {
|
|
3347
|
-
return null;
|
|
3348
|
-
};
|
|
3349
|
-
}
|
|
3350
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
|
|
3351
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
3352
|
-
};
|
|
3353
|
-
var DIALOG_NAME = "Dialog";
|
|
3354
|
-
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
3355
|
-
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
3356
|
-
var TRIGGER_NAME = "DialogTrigger";
|
|
3357
|
-
var DialogTrigger = React.forwardRef(
|
|
3358
|
-
(props, forwardedRef) => {
|
|
3359
|
-
const { __scopeDialog, ...triggerProps } = props;
|
|
3360
|
-
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
3361
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
3362
|
-
return /* @__PURE__ */ jsx(
|
|
3363
|
-
Primitive.button,
|
|
3364
|
-
{
|
|
3365
|
-
type: "button",
|
|
3366
|
-
"aria-haspopup": "dialog",
|
|
3367
|
-
"aria-expanded": context.open,
|
|
3368
|
-
"aria-controls": context.contentId,
|
|
3369
|
-
"data-state": getState(context.open),
|
|
3370
|
-
...triggerProps,
|
|
3371
|
-
ref: composedTriggerRef,
|
|
3372
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
3373
|
-
}
|
|
3374
|
-
);
|
|
3375
|
-
}
|
|
3376
|
-
);
|
|
3377
|
-
DialogTrigger.displayName = TRIGGER_NAME;
|
|
3378
|
-
var PORTAL_NAME = "DialogPortal";
|
|
3379
|
-
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
3380
|
-
forceMount: void 0
|
|
3381
|
-
});
|
|
3382
|
-
var OVERLAY_NAME = "DialogOverlay";
|
|
3383
|
-
var DialogOverlay = React.forwardRef(
|
|
3384
|
-
(props, forwardedRef) => {
|
|
3385
|
-
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
3386
|
-
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
3387
|
-
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
3388
|
-
return context.modal ? /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
3389
|
-
}
|
|
3390
|
-
);
|
|
3391
|
-
DialogOverlay.displayName = OVERLAY_NAME;
|
|
3392
|
-
var Slot = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
|
|
3393
|
-
var DialogOverlayImpl = React.forwardRef(
|
|
3394
|
-
(props, forwardedRef) => {
|
|
3395
|
-
const { __scopeDialog, ...overlayProps } = props;
|
|
3396
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
3397
|
-
return (
|
|
3398
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
3399
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
3400
|
-
/* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsx(
|
|
3401
|
-
Primitive.div,
|
|
3402
|
-
{
|
|
3403
|
-
"data-state": getState(context.open),
|
|
3404
|
-
...overlayProps,
|
|
3405
|
-
ref: forwardedRef,
|
|
3406
|
-
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
3407
|
-
}
|
|
3408
|
-
) })
|
|
3409
|
-
);
|
|
3410
|
-
}
|
|
3411
|
-
);
|
|
3412
|
-
var CONTENT_NAME = "DialogContent";
|
|
3413
|
-
var DialogContent = React.forwardRef(
|
|
3414
|
-
(props, forwardedRef) => {
|
|
3415
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
3416
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
3417
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
3418
|
-
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
3419
|
-
}
|
|
3420
|
-
);
|
|
3421
|
-
DialogContent.displayName = CONTENT_NAME;
|
|
3422
|
-
var DialogContentModal = React.forwardRef(
|
|
3423
|
-
(props, forwardedRef) => {
|
|
3424
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
3425
|
-
const contentRef = React.useRef(null);
|
|
3426
|
-
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
3427
|
-
React.useEffect(() => {
|
|
3428
|
-
const content = contentRef.current;
|
|
3429
|
-
if (content) return hideOthers(content);
|
|
3430
|
-
}, []);
|
|
3431
|
-
return /* @__PURE__ */ jsx(
|
|
3432
|
-
DialogContentImpl,
|
|
3433
|
-
{
|
|
3434
|
-
...props,
|
|
3435
|
-
ref: composedRefs,
|
|
3436
|
-
trapFocus: context.open,
|
|
3437
|
-
disableOutsidePointerEvents: true,
|
|
3438
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
3439
|
-
var _a2;
|
|
3440
|
-
event.preventDefault();
|
|
3441
|
-
(_a2 = context.triggerRef.current) == null ? void 0 : _a2.focus();
|
|
3442
|
-
}),
|
|
3443
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
3444
|
-
const originalEvent = event.detail.originalEvent;
|
|
3445
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
3446
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
3447
|
-
if (isRightClick) event.preventDefault();
|
|
3448
|
-
}),
|
|
3449
|
-
onFocusOutside: composeEventHandlers(
|
|
3450
|
-
props.onFocusOutside,
|
|
3451
|
-
(event) => event.preventDefault()
|
|
3452
|
-
)
|
|
3453
|
-
}
|
|
3454
|
-
);
|
|
3455
|
-
}
|
|
3456
|
-
);
|
|
3457
|
-
var DialogContentNonModal = React.forwardRef(
|
|
3458
|
-
(props, forwardedRef) => {
|
|
3459
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
3460
|
-
const hasInteractedOutsideRef = React.useRef(false);
|
|
3461
|
-
const hasPointerDownOutsideRef = React.useRef(false);
|
|
3462
|
-
return /* @__PURE__ */ jsx(
|
|
3463
|
-
DialogContentImpl,
|
|
3464
|
-
{
|
|
3465
|
-
...props,
|
|
3466
|
-
ref: forwardedRef,
|
|
3467
|
-
trapFocus: false,
|
|
3468
|
-
disableOutsidePointerEvents: false,
|
|
3469
|
-
onCloseAutoFocus: (event) => {
|
|
3470
|
-
var _a2, _b;
|
|
3471
|
-
(_a2 = props.onCloseAutoFocus) == null ? void 0 : _a2.call(props, event);
|
|
3472
|
-
if (!event.defaultPrevented) {
|
|
3473
|
-
if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
|
|
3474
|
-
event.preventDefault();
|
|
3475
|
-
}
|
|
3476
|
-
hasInteractedOutsideRef.current = false;
|
|
3477
|
-
hasPointerDownOutsideRef.current = false;
|
|
3478
|
-
},
|
|
3479
|
-
onInteractOutside: (event) => {
|
|
3480
|
-
var _a2, _b;
|
|
3481
|
-
(_a2 = props.onInteractOutside) == null ? void 0 : _a2.call(props, event);
|
|
3482
|
-
if (!event.defaultPrevented) {
|
|
3483
|
-
hasInteractedOutsideRef.current = true;
|
|
3484
|
-
if (event.detail.originalEvent.type === "pointerdown") {
|
|
3485
|
-
hasPointerDownOutsideRef.current = true;
|
|
3486
|
-
}
|
|
3487
|
-
}
|
|
3488
|
-
const target = event.target;
|
|
3489
|
-
const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
|
|
3490
|
-
if (targetIsTrigger) event.preventDefault();
|
|
3491
|
-
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
3492
|
-
event.preventDefault();
|
|
3493
|
-
}
|
|
3494
|
-
}
|
|
3495
|
-
}
|
|
3496
|
-
);
|
|
3497
|
-
}
|
|
3498
|
-
);
|
|
3499
|
-
var DialogContentImpl = React.forwardRef(
|
|
3500
|
-
(props, forwardedRef) => {
|
|
3501
|
-
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
3502
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
3503
|
-
const contentRef = React.useRef(null);
|
|
3504
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
3505
|
-
useFocusGuards();
|
|
3506
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3507
|
-
/* @__PURE__ */ jsx(
|
|
3508
|
-
FocusScope,
|
|
3509
|
-
{
|
|
3510
|
-
asChild: true,
|
|
3511
|
-
loop: true,
|
|
3512
|
-
trapped: trapFocus,
|
|
3513
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
3514
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
3515
|
-
children: /* @__PURE__ */ jsx(
|
|
3516
|
-
DismissableLayer,
|
|
3517
|
-
{
|
|
3518
|
-
role: "dialog",
|
|
3519
|
-
id: context.contentId,
|
|
3520
|
-
"aria-describedby": context.descriptionId,
|
|
3521
|
-
"aria-labelledby": context.titleId,
|
|
3522
|
-
"data-state": getState(context.open),
|
|
3523
|
-
...contentProps,
|
|
3524
|
-
ref: composedRefs,
|
|
3525
|
-
onDismiss: () => context.onOpenChange(false)
|
|
3526
|
-
}
|
|
3527
|
-
)
|
|
3528
|
-
}
|
|
3529
|
-
),
|
|
3530
|
-
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3531
|
-
/* @__PURE__ */ jsx(TitleWarning, { titleId: context.titleId }),
|
|
3532
|
-
/* @__PURE__ */ jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
3533
|
-
] })
|
|
3534
|
-
] });
|
|
3535
|
-
}
|
|
3536
|
-
);
|
|
3537
|
-
var TITLE_NAME = "DialogTitle";
|
|
3538
|
-
var DialogTitle = React.forwardRef(
|
|
3539
|
-
(props, forwardedRef) => {
|
|
3540
|
-
const { __scopeDialog, ...titleProps } = props;
|
|
3541
|
-
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
3542
|
-
return /* @__PURE__ */ jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
3543
|
-
}
|
|
3544
|
-
);
|
|
3545
|
-
DialogTitle.displayName = TITLE_NAME;
|
|
3546
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
3547
|
-
var DialogDescription = React.forwardRef(
|
|
3548
|
-
(props, forwardedRef) => {
|
|
3549
|
-
const { __scopeDialog, ...descriptionProps } = props;
|
|
3550
|
-
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
3551
|
-
return /* @__PURE__ */ jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
3552
|
-
}
|
|
3553
|
-
);
|
|
3554
|
-
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
3555
|
-
var CLOSE_NAME = "DialogClose";
|
|
3556
|
-
var DialogClose = React.forwardRef(
|
|
3557
|
-
(props, forwardedRef) => {
|
|
3558
|
-
const { __scopeDialog, ...closeProps } = props;
|
|
3559
|
-
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
3560
|
-
return /* @__PURE__ */ jsx(
|
|
3561
|
-
Primitive.button,
|
|
3562
|
-
{
|
|
3563
|
-
type: "button",
|
|
3564
|
-
...closeProps,
|
|
3565
|
-
ref: forwardedRef,
|
|
3566
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
3567
|
-
}
|
|
3568
|
-
);
|
|
3569
|
-
}
|
|
3570
|
-
);
|
|
3571
|
-
DialogClose.displayName = CLOSE_NAME;
|
|
3572
|
-
function getState(open) {
|
|
3573
|
-
return open ? "open" : "closed";
|
|
3574
|
-
}
|
|
3575
|
-
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
3576
|
-
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
3577
|
-
contentName: CONTENT_NAME,
|
|
3578
|
-
titleName: TITLE_NAME,
|
|
3579
|
-
docsSlug: "dialog"
|
|
1769
|
+
const ScannerContext = createContext(() => {
|
|
1770
|
+
throw new Error("No ScannerProvider found");
|
|
3580
1771
|
});
|
|
3581
|
-
|
|
3582
|
-
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
3583
|
-
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
3584
|
-
|
|
3585
|
-
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
3586
|
-
|
|
3587
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
3588
|
-
React.useEffect(() => {
|
|
3589
|
-
if (titleId) {
|
|
3590
|
-
const hasTitle = document.getElementById(titleId);
|
|
3591
|
-
if (!hasTitle) console.error(MESSAGE);
|
|
3592
|
-
}
|
|
3593
|
-
}, [MESSAGE, titleId]);
|
|
3594
|
-
return null;
|
|
3595
|
-
};
|
|
3596
|
-
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
3597
|
-
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
3598
|
-
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
3599
|
-
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
3600
|
-
React.useEffect(() => {
|
|
3601
|
-
var _a2;
|
|
3602
|
-
const describedById = (_a2 = contentRef.current) == null ? void 0 : _a2.getAttribute("aria-describedby");
|
|
3603
|
-
if (descriptionId && describedById) {
|
|
3604
|
-
const hasDescription = document.getElementById(descriptionId);
|
|
3605
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
3606
|
-
}
|
|
3607
|
-
}, [MESSAGE, contentRef, descriptionId]);
|
|
3608
|
-
return null;
|
|
3609
|
-
};
|
|
3610
|
-
var Close = DialogClose;
|
|
1772
|
+
const useScanner = () => use(ScannerContext);
|
|
3611
1773
|
function fixProto(target, prototype) {
|
|
3612
1774
|
var setPrototypeOf = Object.setPrototypeOf;
|
|
3613
1775
|
setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
|
|
@@ -7880,12 +6042,12 @@ var MathUtils = (
|
|
|
7880
6042
|
);
|
|
7881
6043
|
};
|
|
7882
6044
|
MathUtils2.sum = function(array) {
|
|
7883
|
-
var
|
|
6045
|
+
var count = 0;
|
|
7884
6046
|
for (var i = 0, length_1 = array.length; i !== length_1; i++) {
|
|
7885
6047
|
var a = array[i];
|
|
7886
|
-
|
|
6048
|
+
count += a;
|
|
7887
6049
|
}
|
|
7888
|
-
return
|
|
6050
|
+
return count;
|
|
7889
6051
|
};
|
|
7890
6052
|
return MathUtils2;
|
|
7891
6053
|
}()
|
|
@@ -13773,25 +11935,25 @@ var RSSExpandedReader = (
|
|
|
13773
11935
|
var evenRoundingErrors = this.getEvenRoundingErrors();
|
|
13774
11936
|
for (var i = 0; i < counters.length; i++) {
|
|
13775
11937
|
var value_1 = 1 * counters[i] / elementWidth;
|
|
13776
|
-
var
|
|
13777
|
-
if (
|
|
11938
|
+
var count = value_1 + 0.5;
|
|
11939
|
+
if (count < 1) {
|
|
13778
11940
|
if (value_1 < 0.3) {
|
|
13779
11941
|
throw new NotFoundException();
|
|
13780
11942
|
}
|
|
13781
|
-
|
|
13782
|
-
} else if (
|
|
11943
|
+
count = 1;
|
|
11944
|
+
} else if (count > 8) {
|
|
13783
11945
|
if (value_1 > 8.7) {
|
|
13784
11946
|
throw new NotFoundException();
|
|
13785
11947
|
}
|
|
13786
|
-
|
|
11948
|
+
count = 8;
|
|
13787
11949
|
}
|
|
13788
11950
|
var offset = i / 2;
|
|
13789
11951
|
if ((i & 1) === 0) {
|
|
13790
|
-
oddCounts[offset] =
|
|
13791
|
-
oddRoundingErrors[offset] = value_1 -
|
|
11952
|
+
oddCounts[offset] = count;
|
|
11953
|
+
oddRoundingErrors[offset] = value_1 - count;
|
|
13792
11954
|
} else {
|
|
13793
|
-
evenCounts[offset] =
|
|
13794
|
-
evenRoundingErrors[offset] = value_1 -
|
|
11955
|
+
evenCounts[offset] = count;
|
|
11956
|
+
evenRoundingErrors[offset] = value_1 - count;
|
|
13795
11957
|
}
|
|
13796
11958
|
}
|
|
13797
11959
|
this.adjustOddEvenCounts(numModules);
|
|
@@ -14267,19 +12429,19 @@ var RSS14Reader = (
|
|
|
14267
12429
|
var evenRoundingErrors = this.getEvenRoundingErrors();
|
|
14268
12430
|
for (var i = 0; i < counters.length; i++) {
|
|
14269
12431
|
var value = counters[i] / elementWidth;
|
|
14270
|
-
var
|
|
14271
|
-
if (
|
|
14272
|
-
|
|
14273
|
-
} else if (
|
|
14274
|
-
|
|
12432
|
+
var count = Math.floor(value + 0.5);
|
|
12433
|
+
if (count < 1) {
|
|
12434
|
+
count = 1;
|
|
12435
|
+
} else if (count > 8) {
|
|
12436
|
+
count = 8;
|
|
14275
12437
|
}
|
|
14276
12438
|
var offset = Math.floor(i / 2);
|
|
14277
12439
|
if ((i & 1) === 0) {
|
|
14278
|
-
oddCounts[offset] =
|
|
14279
|
-
oddRoundingErrors[offset] = value -
|
|
12440
|
+
oddCounts[offset] = count;
|
|
12441
|
+
oddRoundingErrors[offset] = value - count;
|
|
14280
12442
|
} else {
|
|
14281
|
-
evenCounts[offset] =
|
|
14282
|
-
evenRoundingErrors[offset] = value -
|
|
12443
|
+
evenCounts[offset] = count;
|
|
12444
|
+
evenRoundingErrors[offset] = value - count;
|
|
14283
12445
|
}
|
|
14284
12446
|
}
|
|
14285
12447
|
this.adjustOddEvenCounts(outsideChar, numModules);
|
|
@@ -14641,8 +12803,8 @@ var ECBlocks$1 = (
|
|
|
14641
12803
|
var ECB$1 = (
|
|
14642
12804
|
/** @class */
|
|
14643
12805
|
function() {
|
|
14644
|
-
function ECB2(
|
|
14645
|
-
this.count =
|
|
12806
|
+
function ECB2(count, dataCodewords) {
|
|
12807
|
+
this.count = count;
|
|
14646
12808
|
this.dataCodewords = dataCodewords;
|
|
14647
12809
|
}
|
|
14648
12810
|
ECB2.prototype.getCount = function() {
|
|
@@ -15567,19 +13729,19 @@ var DecodedBitStreamParser$2 = (
|
|
|
15567
13729
|
DecodedBitStreamParser2.decodeBase256Segment = function(bits, result, byteSegments) {
|
|
15568
13730
|
var codewordPosition = 1 + bits.getByteOffset();
|
|
15569
13731
|
var d1 = this.unrandomize255State(bits.readBits(8), codewordPosition++);
|
|
15570
|
-
var
|
|
13732
|
+
var count;
|
|
15571
13733
|
if (d1 === 0) {
|
|
15572
|
-
|
|
13734
|
+
count = bits.available() / 8 | 0;
|
|
15573
13735
|
} else if (d1 < 250) {
|
|
15574
|
-
|
|
13736
|
+
count = d1;
|
|
15575
13737
|
} else {
|
|
15576
|
-
|
|
13738
|
+
count = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);
|
|
15577
13739
|
}
|
|
15578
|
-
if (
|
|
13740
|
+
if (count < 0) {
|
|
15579
13741
|
throw new FormatException();
|
|
15580
13742
|
}
|
|
15581
|
-
var bytes = new Uint8Array(
|
|
15582
|
-
for (var i = 0; i <
|
|
13743
|
+
var bytes = new Uint8Array(count);
|
|
13744
|
+
for (var i = 0; i < count; i++) {
|
|
15583
13745
|
if (bits.available() < 8) {
|
|
15584
13746
|
throw new FormatException();
|
|
15585
13747
|
}
|
|
@@ -16388,8 +14550,8 @@ var ECBlocks = (
|
|
|
16388
14550
|
var ECB = (
|
|
16389
14551
|
/** @class */
|
|
16390
14552
|
function() {
|
|
16391
|
-
function ECB2(
|
|
16392
|
-
this.count =
|
|
14553
|
+
function ECB2(count, dataCodewords) {
|
|
14554
|
+
this.count = count;
|
|
16393
14555
|
this.dataCodewords = dataCodewords;
|
|
16394
14556
|
}
|
|
16395
14557
|
ECB2.prototype.getCount = function() {
|
|
@@ -16777,8 +14939,8 @@ var BitMatrixParser = (
|
|
|
16777
14939
|
if (j === 6) {
|
|
16778
14940
|
j--;
|
|
16779
14941
|
}
|
|
16780
|
-
for (var
|
|
16781
|
-
var i = readingUp ? dimension - 1 -
|
|
14942
|
+
for (var count = 0; count < dimension; count++) {
|
|
14943
|
+
var i = readingUp ? dimension - 1 - count : count;
|
|
16782
14944
|
for (var col = 0; col < 2; col++) {
|
|
16783
14945
|
if (!functionPattern.get(j - col, i)) {
|
|
16784
14946
|
bitsRead++;
|
|
@@ -17052,19 +15214,19 @@ var DecodedBitStreamParser$1 = (
|
|
|
17052
15214
|
}
|
|
17053
15215
|
break;
|
|
17054
15216
|
default:
|
|
17055
|
-
var
|
|
15217
|
+
var count = bits.readBits(mode.getCharacterCountBits(version));
|
|
17056
15218
|
switch (mode) {
|
|
17057
15219
|
case Mode$2.NUMERIC:
|
|
17058
|
-
DecodedBitStreamParser2.decodeNumericSegment(bits, result,
|
|
15220
|
+
DecodedBitStreamParser2.decodeNumericSegment(bits, result, count);
|
|
17059
15221
|
break;
|
|
17060
15222
|
case Mode$2.ALPHANUMERIC:
|
|
17061
|
-
DecodedBitStreamParser2.decodeAlphanumericSegment(bits, result,
|
|
15223
|
+
DecodedBitStreamParser2.decodeAlphanumericSegment(bits, result, count, fc1InEffect);
|
|
17062
15224
|
break;
|
|
17063
15225
|
case Mode$2.BYTE:
|
|
17064
|
-
DecodedBitStreamParser2.decodeByteSegment(bits, result,
|
|
15226
|
+
DecodedBitStreamParser2.decodeByteSegment(bits, result, count, currentCharacterSetECI, byteSegments, hints);
|
|
17065
15227
|
break;
|
|
17066
15228
|
case Mode$2.KANJI:
|
|
17067
|
-
DecodedBitStreamParser2.decodeKanjiSegment(bits, result,
|
|
15229
|
+
DecodedBitStreamParser2.decodeKanjiSegment(bits, result, count);
|
|
17068
15230
|
break;
|
|
17069
15231
|
default:
|
|
17070
15232
|
throw new FormatException();
|
|
@@ -17077,13 +15239,13 @@ var DecodedBitStreamParser$1 = (
|
|
|
17077
15239
|
}
|
|
17078
15240
|
return new DecoderResult(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, ecLevel === null ? null : ecLevel.toString(), symbolSequence, parityData);
|
|
17079
15241
|
};
|
|
17080
|
-
DecodedBitStreamParser2.decodeHanziSegment = function(bits, result,
|
|
17081
|
-
if (
|
|
15242
|
+
DecodedBitStreamParser2.decodeHanziSegment = function(bits, result, count) {
|
|
15243
|
+
if (count * 13 > bits.available()) {
|
|
17082
15244
|
throw new FormatException();
|
|
17083
15245
|
}
|
|
17084
|
-
var buffer = new Uint8Array(2 *
|
|
15246
|
+
var buffer = new Uint8Array(2 * count);
|
|
17085
15247
|
var offset = 0;
|
|
17086
|
-
while (
|
|
15248
|
+
while (count > 0) {
|
|
17087
15249
|
var twoBytes = bits.readBits(13);
|
|
17088
15250
|
var assembledTwoBytes = twoBytes / 96 << 8 & 4294967295 | twoBytes % 96;
|
|
17089
15251
|
if (assembledTwoBytes < 959) {
|
|
@@ -17096,7 +15258,7 @@ var DecodedBitStreamParser$1 = (
|
|
|
17096
15258
|
buffer[offset + 1] = /*(byte) */
|
|
17097
15259
|
assembledTwoBytes & 255;
|
|
17098
15260
|
offset += 2;
|
|
17099
|
-
|
|
15261
|
+
count--;
|
|
17100
15262
|
}
|
|
17101
15263
|
try {
|
|
17102
15264
|
result.append(StringEncoding.decode(buffer, StringUtils.GB2312));
|
|
@@ -17104,13 +15266,13 @@ var DecodedBitStreamParser$1 = (
|
|
|
17104
15266
|
throw new FormatException(ignored);
|
|
17105
15267
|
}
|
|
17106
15268
|
};
|
|
17107
|
-
DecodedBitStreamParser2.decodeKanjiSegment = function(bits, result,
|
|
17108
|
-
if (
|
|
15269
|
+
DecodedBitStreamParser2.decodeKanjiSegment = function(bits, result, count) {
|
|
15270
|
+
if (count * 13 > bits.available()) {
|
|
17109
15271
|
throw new FormatException();
|
|
17110
15272
|
}
|
|
17111
|
-
var buffer = new Uint8Array(2 *
|
|
15273
|
+
var buffer = new Uint8Array(2 * count);
|
|
17112
15274
|
var offset = 0;
|
|
17113
|
-
while (
|
|
15275
|
+
while (count > 0) {
|
|
17114
15276
|
var twoBytes = bits.readBits(13);
|
|
17115
15277
|
var assembledTwoBytes = twoBytes / 192 << 8 & 4294967295 | twoBytes % 192;
|
|
17116
15278
|
if (assembledTwoBytes < 7936) {
|
|
@@ -17123,7 +15285,7 @@ var DecodedBitStreamParser$1 = (
|
|
|
17123
15285
|
buffer[offset + 1] = /*(byte) */
|
|
17124
15286
|
assembledTwoBytes;
|
|
17125
15287
|
offset += 2;
|
|
17126
|
-
|
|
15288
|
+
count--;
|
|
17127
15289
|
}
|
|
17128
15290
|
try {
|
|
17129
15291
|
result.append(StringEncoding.decode(buffer, StringUtils.SHIFT_JIS));
|
|
@@ -17131,12 +15293,12 @@ var DecodedBitStreamParser$1 = (
|
|
|
17131
15293
|
throw new FormatException(ignored);
|
|
17132
15294
|
}
|
|
17133
15295
|
};
|
|
17134
|
-
DecodedBitStreamParser2.decodeByteSegment = function(bits, result,
|
|
17135
|
-
if (8 *
|
|
15296
|
+
DecodedBitStreamParser2.decodeByteSegment = function(bits, result, count, currentCharacterSetECI, byteSegments, hints) {
|
|
15297
|
+
if (8 * count > bits.available()) {
|
|
17136
15298
|
throw new FormatException();
|
|
17137
15299
|
}
|
|
17138
|
-
var readBytes = new Uint8Array(
|
|
17139
|
-
for (var i = 0; i <
|
|
15300
|
+
var readBytes = new Uint8Array(count);
|
|
15301
|
+
for (var i = 0; i < count; i++) {
|
|
17140
15302
|
readBytes[i] = /*(byte) */
|
|
17141
15303
|
bits.readBits(8);
|
|
17142
15304
|
}
|
|
@@ -17159,18 +15321,18 @@ var DecodedBitStreamParser$1 = (
|
|
|
17159
15321
|
}
|
|
17160
15322
|
return DecodedBitStreamParser2.ALPHANUMERIC_CHARS[value];
|
|
17161
15323
|
};
|
|
17162
|
-
DecodedBitStreamParser2.decodeAlphanumericSegment = function(bits, result,
|
|
15324
|
+
DecodedBitStreamParser2.decodeAlphanumericSegment = function(bits, result, count, fc1InEffect) {
|
|
17163
15325
|
var start = result.length();
|
|
17164
|
-
while (
|
|
15326
|
+
while (count > 1) {
|
|
17165
15327
|
if (bits.available() < 11) {
|
|
17166
15328
|
throw new FormatException();
|
|
17167
15329
|
}
|
|
17168
15330
|
var nextTwoCharsBits = bits.readBits(11);
|
|
17169
15331
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(nextTwoCharsBits / 45)));
|
|
17170
15332
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(nextTwoCharsBits % 45));
|
|
17171
|
-
|
|
15333
|
+
count -= 2;
|
|
17172
15334
|
}
|
|
17173
|
-
if (
|
|
15335
|
+
if (count === 1) {
|
|
17174
15336
|
if (bits.available() < 6) {
|
|
17175
15337
|
throw new FormatException();
|
|
17176
15338
|
}
|
|
@@ -17188,8 +15350,8 @@ var DecodedBitStreamParser$1 = (
|
|
|
17188
15350
|
}
|
|
17189
15351
|
}
|
|
17190
15352
|
};
|
|
17191
|
-
DecodedBitStreamParser2.decodeNumericSegment = function(bits, result,
|
|
17192
|
-
while (
|
|
15353
|
+
DecodedBitStreamParser2.decodeNumericSegment = function(bits, result, count) {
|
|
15354
|
+
while (count >= 3) {
|
|
17193
15355
|
if (bits.available() < 10) {
|
|
17194
15356
|
throw new FormatException();
|
|
17195
15357
|
}
|
|
@@ -17200,9 +15362,9 @@ var DecodedBitStreamParser$1 = (
|
|
|
17200
15362
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(threeDigitsBits / 100)));
|
|
17201
15363
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(threeDigitsBits / 10) % 10));
|
|
17202
15364
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(threeDigitsBits % 10));
|
|
17203
|
-
|
|
15365
|
+
count -= 3;
|
|
17204
15366
|
}
|
|
17205
|
-
if (
|
|
15367
|
+
if (count === 2) {
|
|
17206
15368
|
if (bits.available() < 7) {
|
|
17207
15369
|
throw new FormatException();
|
|
17208
15370
|
}
|
|
@@ -17212,7 +15374,7 @@ var DecodedBitStreamParser$1 = (
|
|
|
17212
15374
|
}
|
|
17213
15375
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(twoDigitsBits / 10)));
|
|
17214
15376
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(twoDigitsBits % 10));
|
|
17215
|
-
} else if (
|
|
15377
|
+
} else if (count === 1) {
|
|
17216
15378
|
if (bits.available() < 4) {
|
|
17217
15379
|
throw new FormatException();
|
|
17218
15380
|
}
|
|
@@ -17608,11 +15770,11 @@ var FinderPattern = (
|
|
|
17608
15770
|
/** @class */
|
|
17609
15771
|
function(_super) {
|
|
17610
15772
|
__extends$j(FinderPattern2, _super);
|
|
17611
|
-
function FinderPattern2(posX, posY, estimatedModuleSize,
|
|
15773
|
+
function FinderPattern2(posX, posY, estimatedModuleSize, count) {
|
|
17612
15774
|
var _this = _super.call(this, posX, posY) || this;
|
|
17613
15775
|
_this.estimatedModuleSize = estimatedModuleSize;
|
|
17614
|
-
_this.count =
|
|
17615
|
-
if (void 0 ===
|
|
15776
|
+
_this.count = count;
|
|
15777
|
+
if (void 0 === count) {
|
|
17616
15778
|
_this.count = 1;
|
|
17617
15779
|
}
|
|
17618
15780
|
return _this;
|
|
@@ -17779,11 +15941,11 @@ var FinderPatternFinder = (
|
|
|
17779
15941
|
FinderPatternFinder2.foundPatternCross = function(stateCount) {
|
|
17780
15942
|
var totalModuleSize = 0;
|
|
17781
15943
|
for (var i = 0; i < 5; i++) {
|
|
17782
|
-
var
|
|
17783
|
-
if (
|
|
15944
|
+
var count = stateCount[i];
|
|
15945
|
+
if (count === 0) {
|
|
17784
15946
|
return false;
|
|
17785
15947
|
}
|
|
17786
|
-
totalModuleSize +=
|
|
15948
|
+
totalModuleSize += count;
|
|
17787
15949
|
}
|
|
17788
15950
|
if (totalModuleSize < 7) {
|
|
17789
15951
|
return false;
|
|
@@ -26603,7 +24765,7 @@ var DecodedBitStreamParser = (
|
|
|
26603
24765
|
};
|
|
26604
24766
|
DecodedBitStreamParser2.byteCompaction = function(mode, codewords, encoding, codeIndex, result) {
|
|
26605
24767
|
var decodedBytes = new ByteArrayOutputStream();
|
|
26606
|
-
var
|
|
24768
|
+
var count = 0;
|
|
26607
24769
|
var value = (
|
|
26608
24770
|
/*long*/
|
|
26609
24771
|
0
|
|
@@ -26614,7 +24776,7 @@ var DecodedBitStreamParser = (
|
|
|
26614
24776
|
var byteCompactedCodewords = new Int32Array(6);
|
|
26615
24777
|
var nextCode = codewords[codeIndex++];
|
|
26616
24778
|
while (codeIndex < codewords[0] && !end) {
|
|
26617
|
-
byteCompactedCodewords[
|
|
24779
|
+
byteCompactedCodewords[count++] = nextCode;
|
|
26618
24780
|
value = 900 * value + nextCode;
|
|
26619
24781
|
nextCode = codewords[codeIndex++];
|
|
26620
24782
|
switch (nextCode) {
|
|
@@ -26629,7 +24791,7 @@ var DecodedBitStreamParser = (
|
|
|
26629
24791
|
end = true;
|
|
26630
24792
|
break;
|
|
26631
24793
|
default:
|
|
26632
|
-
if (
|
|
24794
|
+
if (count % 5 === 0 && count > 0) {
|
|
26633
24795
|
for (var j = 0; j < 6; ++j) {
|
|
26634
24796
|
decodedBytes.write(
|
|
26635
24797
|
/*(byte)*/
|
|
@@ -26637,15 +24799,15 @@ var DecodedBitStreamParser = (
|
|
|
26637
24799
|
);
|
|
26638
24800
|
}
|
|
26639
24801
|
value = 0;
|
|
26640
|
-
|
|
24802
|
+
count = 0;
|
|
26641
24803
|
}
|
|
26642
24804
|
break;
|
|
26643
24805
|
}
|
|
26644
24806
|
}
|
|
26645
24807
|
if (codeIndex === codewords[0] && nextCode < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
|
|
26646
|
-
byteCompactedCodewords[
|
|
24808
|
+
byteCompactedCodewords[count++] = nextCode;
|
|
26647
24809
|
}
|
|
26648
|
-
for (var i = 0; i <
|
|
24810
|
+
for (var i = 0; i < count; i++) {
|
|
26649
24811
|
decodedBytes.write(
|
|
26650
24812
|
/*(byte)*/
|
|
26651
24813
|
byteCompactedCodewords[i]
|
|
@@ -26656,7 +24818,7 @@ var DecodedBitStreamParser = (
|
|
|
26656
24818
|
while (codeIndex < codewords[0] && !end) {
|
|
26657
24819
|
var code = codewords[codeIndex++];
|
|
26658
24820
|
if (code < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
|
|
26659
|
-
|
|
24821
|
+
count++;
|
|
26660
24822
|
value = 900 * value + code;
|
|
26661
24823
|
} else {
|
|
26662
24824
|
switch (code) {
|
|
@@ -26672,7 +24834,7 @@ var DecodedBitStreamParser = (
|
|
|
26672
24834
|
break;
|
|
26673
24835
|
}
|
|
26674
24836
|
}
|
|
26675
|
-
if (
|
|
24837
|
+
if (count % 5 === 0 && count > 0) {
|
|
26676
24838
|
for (var j = 0; j < 6; ++j) {
|
|
26677
24839
|
decodedBytes.write(
|
|
26678
24840
|
/*(byte)*/
|
|
@@ -26680,7 +24842,7 @@ var DecodedBitStreamParser = (
|
|
|
26680
24842
|
);
|
|
26681
24843
|
}
|
|
26682
24844
|
value = 0;
|
|
26683
|
-
|
|
24845
|
+
count = 0;
|
|
26684
24846
|
}
|
|
26685
24847
|
}
|
|
26686
24848
|
break;
|
|
@@ -26689,7 +24851,7 @@ var DecodedBitStreamParser = (
|
|
|
26689
24851
|
return codeIndex;
|
|
26690
24852
|
};
|
|
26691
24853
|
DecodedBitStreamParser2.numericCompaction = function(codewords, codeIndex, result) {
|
|
26692
|
-
var
|
|
24854
|
+
var count = 0;
|
|
26693
24855
|
var end = false;
|
|
26694
24856
|
var numericCodewords = new Int32Array(DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS);
|
|
26695
24857
|
while (codeIndex < codewords[0] && !end) {
|
|
@@ -26698,8 +24860,8 @@ var DecodedBitStreamParser = (
|
|
|
26698
24860
|
end = true;
|
|
26699
24861
|
}
|
|
26700
24862
|
if (code < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
|
|
26701
|
-
numericCodewords[
|
|
26702
|
-
|
|
24863
|
+
numericCodewords[count] = code;
|
|
24864
|
+
count++;
|
|
26703
24865
|
} else {
|
|
26704
24866
|
switch (code) {
|
|
26705
24867
|
case DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH:
|
|
@@ -26713,17 +24875,17 @@ var DecodedBitStreamParser = (
|
|
|
26713
24875
|
break;
|
|
26714
24876
|
}
|
|
26715
24877
|
}
|
|
26716
|
-
if ((
|
|
26717
|
-
result.append(DecodedBitStreamParser2.decodeBase900toBase10(numericCodewords,
|
|
26718
|
-
|
|
24878
|
+
if ((count % DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser2.NUMERIC_COMPACTION_MODE_LATCH || end) && count > 0) {
|
|
24879
|
+
result.append(DecodedBitStreamParser2.decodeBase900toBase10(numericCodewords, count));
|
|
24880
|
+
count = 0;
|
|
26719
24881
|
}
|
|
26720
24882
|
}
|
|
26721
24883
|
return codeIndex;
|
|
26722
24884
|
};
|
|
26723
|
-
DecodedBitStreamParser2.decodeBase900toBase10 = function(codewords,
|
|
24885
|
+
DecodedBitStreamParser2.decodeBase900toBase10 = function(codewords, count) {
|
|
26724
24886
|
var result = createBigInt(0);
|
|
26725
|
-
for (var i = 0; i <
|
|
26726
|
-
result += DecodedBitStreamParser2.EXP900[
|
|
24887
|
+
for (var i = 0; i < count; i++) {
|
|
24888
|
+
result += DecodedBitStreamParser2.EXP900[count - i - 1] * createBigInt(codewords[i]);
|
|
26727
24889
|
}
|
|
26728
24890
|
var resultString = result.toString();
|
|
26729
24891
|
if (resultString.charAt(0) !== "1") {
|
|
@@ -29307,8 +27469,8 @@ var C40Encoder = (
|
|
|
29307
27469
|
}
|
|
29308
27470
|
break;
|
|
29309
27471
|
}
|
|
29310
|
-
var
|
|
29311
|
-
if (
|
|
27472
|
+
var count = buffer.length();
|
|
27473
|
+
if (count % 3 === 0) {
|
|
29312
27474
|
var newMode = HighLevelEncoder$1.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
|
|
29313
27475
|
if (newMode !== this.getEncodingMode()) {
|
|
29314
27476
|
context.signalEncoderChange(ASCII_ENCODATION);
|
|
@@ -29319,8 +27481,8 @@ var C40Encoder = (
|
|
|
29319
27481
|
this.handleEOD(context, buffer);
|
|
29320
27482
|
};
|
|
29321
27483
|
C40Encoder2.prototype.backtrackOneCharacter = function(context, buffer, removed, lastCharSize) {
|
|
29322
|
-
var
|
|
29323
|
-
var test = buffer.toString().substring(0,
|
|
27484
|
+
var count = buffer.length();
|
|
27485
|
+
var test = buffer.toString().substring(0, count - lastCharSize);
|
|
29324
27486
|
buffer.setLengthToZero();
|
|
29325
27487
|
buffer.append(test);
|
|
29326
27488
|
context.pos--;
|
|
@@ -29438,8 +27600,8 @@ var EdifactEncoder = (
|
|
|
29438
27600
|
var c = context.getCurrentChar();
|
|
29439
27601
|
this.encodeChar(c, buffer);
|
|
29440
27602
|
context.pos++;
|
|
29441
|
-
var
|
|
29442
|
-
if (
|
|
27603
|
+
var count = buffer.length();
|
|
27604
|
+
if (count >= 4) {
|
|
29443
27605
|
context.writeCodewords(this.encodeToCodewords(buffer.toString()));
|
|
29444
27606
|
var test_1 = buffer.toString().substring(4);
|
|
29445
27607
|
buffer.setLengthToZero();
|
|
@@ -29456,11 +27618,11 @@ var EdifactEncoder = (
|
|
|
29456
27618
|
};
|
|
29457
27619
|
EdifactEncoder2.prototype.handleEOD = function(context, buffer) {
|
|
29458
27620
|
try {
|
|
29459
|
-
var
|
|
29460
|
-
if (
|
|
27621
|
+
var count = buffer.length();
|
|
27622
|
+
if (count === 0) {
|
|
29461
27623
|
return;
|
|
29462
27624
|
}
|
|
29463
|
-
if (
|
|
27625
|
+
if (count === 1) {
|
|
29464
27626
|
context.updateSymbolInfo();
|
|
29465
27627
|
var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
|
|
29466
27628
|
var remaining = context.getRemainingCharacters();
|
|
@@ -29472,10 +27634,10 @@ var EdifactEncoder = (
|
|
|
29472
27634
|
return;
|
|
29473
27635
|
}
|
|
29474
27636
|
}
|
|
29475
|
-
if (
|
|
27637
|
+
if (count > 4) {
|
|
29476
27638
|
throw new Error("Count must not exceed 4");
|
|
29477
27639
|
}
|
|
29478
|
-
var restChars =
|
|
27640
|
+
var restChars = count - 1;
|
|
29479
27641
|
var encoded = this.encodeToCodewords(buffer.toString());
|
|
29480
27642
|
var endOfSymbolReached = !context.hasMoreCharacters();
|
|
29481
27643
|
var restInAscii = endOfSymbolReached && restChars <= 2;
|
|
@@ -29778,8 +27940,8 @@ var EncoderContext = (
|
|
|
29778
27940
|
EncoderContext2.prototype.getMessage = function() {
|
|
29779
27941
|
return this.msg;
|
|
29780
27942
|
};
|
|
29781
|
-
EncoderContext2.prototype.setSkipAtEnd = function(
|
|
29782
|
-
this.skipAtEnd =
|
|
27943
|
+
EncoderContext2.prototype.setSkipAtEnd = function(count) {
|
|
27944
|
+
this.skipAtEnd = count;
|
|
29783
27945
|
};
|
|
29784
27946
|
EncoderContext2.prototype.getCurrentChar = function() {
|
|
29785
27947
|
return this.msg.charCodeAt(this.pos);
|
|
@@ -29867,8 +28029,8 @@ var X12Encoder = (
|
|
|
29867
28029
|
var c = context.getCurrentChar();
|
|
29868
28030
|
context.pos++;
|
|
29869
28031
|
this.encodeChar(c, buffer);
|
|
29870
|
-
var
|
|
29871
|
-
if (
|
|
28032
|
+
var count = buffer.length();
|
|
28033
|
+
if (count % 3 === 0) {
|
|
29872
28034
|
this.writeNextTriplet(context, buffer);
|
|
29873
28035
|
var newMode = HighLevelEncoder$1.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
|
|
29874
28036
|
if (newMode !== this.getEncodingMode()) {
|
|
@@ -29908,8 +28070,8 @@ var X12Encoder = (
|
|
|
29908
28070
|
X12Encoder2.prototype.handleEOD = function(context, buffer) {
|
|
29909
28071
|
context.updateSymbolInfo();
|
|
29910
28072
|
var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
|
|
29911
|
-
var
|
|
29912
|
-
context.pos -=
|
|
28073
|
+
var count = buffer.length();
|
|
28074
|
+
context.pos -= count;
|
|
29913
28075
|
if (context.getRemainingCharacters() > 1 || available > 1 || context.getRemainingCharacters() !== available) {
|
|
29914
28076
|
context.writeCodeword(X12_UNLATCH);
|
|
29915
28077
|
}
|
|
@@ -31742,15 +29904,38 @@ const ScannerInternal = memo((props) => {
|
|
|
31742
29904
|
hints: SCANNER_HINTS
|
|
31743
29905
|
});
|
|
31744
29906
|
return /* @__PURE__ */ jsxs("div", { className: "flex size-full flex-col justify-center overflow-hidden bg-(--color-background)", children: [
|
|
31745
|
-
/* @__PURE__ */ jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsx(Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsx(LuIcon, { icon: "x" }) }) }) }),
|
|
29907
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsx(Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsx(LuIcon, { icon: "x" }) }) }) }),
|
|
31746
29908
|
/* @__PURE__ */ jsx("div", { className: "grow w-full max-h-full overflow-hidden p-4", children: /* @__PURE__ */ jsx("video", { className: "size-full", ref }) })
|
|
31747
29909
|
] });
|
|
31748
29910
|
});
|
|
31749
29911
|
ScannerInternal.displayName = "ScannerInternal";
|
|
29912
|
+
const ScannerProvider = memo((props) => {
|
|
29913
|
+
const { children } = props;
|
|
29914
|
+
const [config, setConfig] = useState(null);
|
|
29915
|
+
const closeFileViewer = useCallback(() => {
|
|
29916
|
+
setConfig(null);
|
|
29917
|
+
}, []);
|
|
29918
|
+
const openFileViewer = useCallback(
|
|
29919
|
+
(func) => {
|
|
29920
|
+
setConfig(func(closeFileViewer));
|
|
29921
|
+
},
|
|
29922
|
+
[closeFileViewer]
|
|
29923
|
+
);
|
|
29924
|
+
const handleClose = useCallback(() => {
|
|
29925
|
+
if (!config) return;
|
|
29926
|
+
if (config.onClose) config.onClose();
|
|
29927
|
+
closeFileViewer();
|
|
29928
|
+
}, [closeFileViewer, config]);
|
|
29929
|
+
return /* @__PURE__ */ jsxs(ScannerContext.Provider, { value: openFileViewer, children: [
|
|
29930
|
+
children,
|
|
29931
|
+
config && /* @__PURE__ */ jsx(Scanner, { open: true, onOpenChange: handleClose, ...config })
|
|
29932
|
+
] });
|
|
29933
|
+
});
|
|
29934
|
+
ScannerProvider.displayName = "FileViewerProvider";
|
|
31750
29935
|
const ScanInput = memo((props) => {
|
|
31751
29936
|
const [
|
|
31752
29937
|
{ inputId, labelId, label, helpText, size, severity, showInputOnly, field, fieldProps, helpers, touched },
|
|
31753
|
-
|
|
29938
|
+
{ disabled }
|
|
31754
29939
|
] = useFormikInput(props);
|
|
31755
29940
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
31756
29941
|
const [showScanner, setShowScanner] = useState(false);
|
|
@@ -31812,7 +29997,7 @@ const ScanInput = memo((props) => {
|
|
|
31812
29997
|
placeholder: "Enter a qr or barcode",
|
|
31813
29998
|
onChange: handleChange,
|
|
31814
29999
|
onBlur: handleBlur,
|
|
31815
|
-
|
|
30000
|
+
disabled
|
|
31816
30001
|
}
|
|
31817
30002
|
),
|
|
31818
30003
|
/* @__PURE__ */ jsxs(
|
|
@@ -31824,6 +30009,7 @@ const ScanInput = memo((props) => {
|
|
|
31824
30009
|
variant: "soft",
|
|
31825
30010
|
size: "sm",
|
|
31826
30011
|
accentColor: "base",
|
|
30012
|
+
disabled,
|
|
31827
30013
|
children: [
|
|
31828
30014
|
/* @__PURE__ */ jsx(LuIcon, { icon: "maximize" }),
|
|
31829
30015
|
"Scan"
|
|
@@ -31889,7 +30075,7 @@ const SHORT_TEXT_FIELD_MAX_LENGTH = 500;
|
|
|
31889
30075
|
const StringInput = memo((props) => {
|
|
31890
30076
|
const [
|
|
31891
30077
|
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
31892
|
-
|
|
30078
|
+
{ disabled }
|
|
31893
30079
|
] = useFormikInput(props);
|
|
31894
30080
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
31895
30081
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -31932,7 +30118,7 @@ const StringInput = memo((props) => {
|
|
|
31932
30118
|
placeholder: field.placeholder,
|
|
31933
30119
|
onChange: handleChange,
|
|
31934
30120
|
onBlur: handleBlur,
|
|
31935
|
-
|
|
30121
|
+
disabled
|
|
31936
30122
|
}
|
|
31937
30123
|
) })
|
|
31938
30124
|
}
|
|
@@ -31982,7 +30168,7 @@ let StringField = _StringField;
|
|
|
31982
30168
|
const TextInput = memo((props) => {
|
|
31983
30169
|
const [
|
|
31984
30170
|
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
31985
|
-
|
|
30171
|
+
{ disabled }
|
|
31986
30172
|
] = useFormikInput(props);
|
|
31987
30173
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
31988
30174
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -32028,7 +30214,7 @@ const TextInput = memo((props) => {
|
|
|
32028
30214
|
accentColor: "base",
|
|
32029
30215
|
variant: "surface",
|
|
32030
30216
|
size: "sm",
|
|
32031
|
-
|
|
30217
|
+
disabled
|
|
32032
30218
|
}
|
|
32033
30219
|
)
|
|
32034
30220
|
}
|
|
@@ -32176,7 +30362,7 @@ function separateFilesFromPromises(filesOrPromises) {
|
|
|
32176
30362
|
}
|
|
32177
30363
|
const UploadInput = memo((props) => {
|
|
32178
30364
|
var _a2;
|
|
32179
|
-
const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps },
|
|
30365
|
+
const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps }, { disabled }] = useFormikInput(props);
|
|
32180
30366
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
32181
30367
|
const input = useRef(null);
|
|
32182
30368
|
const updatedHelpText = useMemo(() => {
|
|
@@ -32250,9 +30436,8 @@ const UploadInput = memo((props) => {
|
|
|
32250
30436
|
variant: "soft",
|
|
32251
30437
|
accentColor: "base",
|
|
32252
30438
|
onClick: handleClick,
|
|
32253
|
-
id: "upload-input-upload-button",
|
|
32254
30439
|
type: "button",
|
|
32255
|
-
|
|
30440
|
+
disabled,
|
|
32256
30441
|
children: [
|
|
32257
30442
|
/* @__PURE__ */ jsx(LuIcon, { icon: "upload" }),
|
|
32258
30443
|
buttonText
|
|
@@ -32284,7 +30469,7 @@ const UploadInput = memo((props) => {
|
|
|
32284
30469
|
onRemove: () => {
|
|
32285
30470
|
handleRemove(index);
|
|
32286
30471
|
},
|
|
32287
|
-
disabled
|
|
30472
|
+
disabled
|
|
32288
30473
|
},
|
|
32289
30474
|
index
|
|
32290
30475
|
)) })
|
|
@@ -32315,7 +30500,6 @@ const DisplayFile = memo((props) => {
|
|
|
32315
30500
|
useEffect(() => {
|
|
32316
30501
|
if (file instanceof UUIDPromise) {
|
|
32317
30502
|
file.then((file2) => {
|
|
32318
|
-
console.debug("file", file2);
|
|
32319
30503
|
setResolvedFile(file2);
|
|
32320
30504
|
}).catch(console.error);
|
|
32321
30505
|
} else {
|
|
@@ -36362,33 +34546,6 @@ const FormBuilder = {
|
|
|
36362
34546
|
ListBuilder: FormBuilderListBuilder,
|
|
36363
34547
|
Preview: FormBuilderPreview
|
|
36364
34548
|
};
|
|
36365
|
-
const ScannerContext = createContext(() => {
|
|
36366
|
-
throw new Error("No ScannerProvider found");
|
|
36367
|
-
});
|
|
36368
|
-
const useScanner = () => use(ScannerContext);
|
|
36369
|
-
const ScannerProvider = memo((props) => {
|
|
36370
|
-
const { children } = props;
|
|
36371
|
-
const [config, setConfig] = useState(null);
|
|
36372
|
-
const closeFileViewer = useCallback(() => {
|
|
36373
|
-
setConfig(null);
|
|
36374
|
-
}, []);
|
|
36375
|
-
const openFileViewer = useCallback(
|
|
36376
|
-
(func) => {
|
|
36377
|
-
setConfig(func(closeFileViewer));
|
|
36378
|
-
},
|
|
36379
|
-
[closeFileViewer]
|
|
36380
|
-
);
|
|
36381
|
-
const handleClose = useCallback(() => {
|
|
36382
|
-
if (!config) return;
|
|
36383
|
-
if (config.onClose) config.onClose();
|
|
36384
|
-
closeFileViewer();
|
|
36385
|
-
}, [closeFileViewer, config]);
|
|
36386
|
-
return /* @__PURE__ */ jsxs(ScannerContext.Provider, { value: openFileViewer, children: [
|
|
36387
|
-
children,
|
|
36388
|
-
config && /* @__PURE__ */ jsx(Scanner, { open: true, onOpenChange: handleClose, ...config })
|
|
36389
|
-
] });
|
|
36390
|
-
});
|
|
36391
|
-
ScannerProvider.displayName = "FileViewerProvider";
|
|
36392
34549
|
export {
|
|
36393
34550
|
BaseCondition,
|
|
36394
34551
|
BaseField,
|