@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.umd.cjs
CHANGED
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
(function(global2, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("class-variance-authority"), require("react"), require("@xyflow/react/dist/style.css"), require("@xyflow/react"), require("formik"), require("graphology"), require("graphology-dag"), require("uuid"), require("@hello-pangea/dnd"), require("file-saver"), require("react-zxing"), require("
|
|
3
|
-
})(this, function(exports2, jsxRuntime, blocks, classVarianceAuthority, React, style_css, react, formik, graphology, graphologyDag, uuid, dnd, fileSaver, reactZxing,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("@overmap-ai/blocks"), require("class-variance-authority"), require("react"), require("@xyflow/react/dist/style.css"), require("@xyflow/react"), require("formik"), require("graphology"), require("graphology-dag"), require("uuid"), require("@hello-pangea/dnd"), require("file-saver"), require("react-zxing"), require("lodash.get"), require("@dagrejs/dagre"), require("lodash.set")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "@overmap-ai/blocks", "class-variance-authority", "react", "@xyflow/react/dist/style.css", "@xyflow/react", "formik", "graphology", "graphology-dag", "uuid", "@hello-pangea/dnd", "file-saver", "react-zxing", "lodash.get", "@dagrejs/dagre", "lodash.set"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.forms = {}, global2.jsxRuntime, global2.blocks, global2.classVarianceAuthority, global2.React, null, global2.react, global2.formik, global2.graphology, global2.graphologyDag, global2.uuid, global2.dnd, global2.fileSaver, global2.reactZxing, global2.get, global2.Dagre, global2.set));
|
|
3
|
+
})(this, function(exports2, jsxRuntime, blocks, classVarianceAuthority, React, style_css, react, formik, graphology, graphologyDag, uuid, dnd, fileSaver, reactZxing, get, Dagre, set) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
7
|
|
|
8
|
-
function _interopNamespaceDefault(e) {
|
|
9
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
10
|
-
if (e) {
|
|
11
|
-
for (const k in e) {
|
|
12
|
-
if (k !== "default") {
|
|
13
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: () => e[k]
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
n.default = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
25
|
-
const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
|
|
26
8
|
const FileCard = React.memo(
|
|
27
9
|
React.forwardRef((props, ref) => {
|
|
28
10
|
const { file, className, error, rightSlot, ...rest } = props;
|
|
@@ -61,8 +43,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
61
43
|
}
|
|
62
44
|
}
|
|
63
45
|
class BaseFormElement extends Observable {
|
|
64
|
-
constructor(
|
|
65
|
-
const { identifier } =
|
|
46
|
+
constructor(options) {
|
|
47
|
+
const { identifier } = options;
|
|
66
48
|
super();
|
|
67
49
|
__publicField(this, "identifier");
|
|
68
50
|
this.identifier = identifier;
|
|
@@ -72,8 +54,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
72
54
|
identifier: this.identifier
|
|
73
55
|
};
|
|
74
56
|
}
|
|
75
|
-
setOptions(
|
|
76
|
-
this.identifier =
|
|
57
|
+
setOptions(options) {
|
|
58
|
+
this.identifier = options.identifier ?? this.identifier;
|
|
77
59
|
this.notify(this);
|
|
78
60
|
}
|
|
79
61
|
serialize() {
|
|
@@ -84,8 +66,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
84
66
|
}
|
|
85
67
|
}
|
|
86
68
|
class BaseField extends BaseFormElement {
|
|
87
|
-
constructor(
|
|
88
|
-
const { label, description = null, required, image, fieldValidators = [], ...base } =
|
|
69
|
+
constructor(options) {
|
|
70
|
+
const { label, description = null, required, image, fieldValidators = [], ...base } = options;
|
|
89
71
|
super(base);
|
|
90
72
|
__publicField(this, "label");
|
|
91
73
|
__publicField(this, "description");
|
|
@@ -133,8 +115,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
133
115
|
fieldValidators: this.fieldValidators
|
|
134
116
|
};
|
|
135
117
|
}
|
|
136
|
-
setOptions(
|
|
137
|
-
const { label, description = null, required, image, fieldValidators, ...base } =
|
|
118
|
+
setOptions(options) {
|
|
119
|
+
const { label, description = null, required, image, fieldValidators, ...base } = options;
|
|
138
120
|
this.label = label ?? this.label;
|
|
139
121
|
this.description = description ?? this.description;
|
|
140
122
|
this.required = required ?? this.required;
|
|
@@ -332,12 +314,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
332
314
|
];
|
|
333
315
|
};
|
|
334
316
|
const MultiStringInput = React.memo((props) => {
|
|
335
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
317
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
336
318
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
337
319
|
const computedLabel = showInputOnly ? "" : label;
|
|
338
320
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
339
321
|
const droppableId = `${inputId}-droppable`;
|
|
340
|
-
const { disabled } = rest;
|
|
341
322
|
const [intermediateValue, setIntermediateValue] = React.useState("");
|
|
342
323
|
const [internalError, setInternalError] = React.useState("");
|
|
343
324
|
const updatedHelpText = internalError || computedHelpText;
|
|
@@ -424,7 +405,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
424
405
|
placeholder: field.placeholder,
|
|
425
406
|
onBlur: handleInputBlur,
|
|
426
407
|
name,
|
|
427
|
-
|
|
408
|
+
disabled
|
|
428
409
|
}
|
|
429
410
|
) }),
|
|
430
411
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -501,8 +482,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
501
482
|
});
|
|
502
483
|
MultiStringInput.displayName = "MultiStringInput";
|
|
503
484
|
const _MultiStringField = class _MultiStringField extends BaseField {
|
|
504
|
-
constructor(
|
|
505
|
-
const { minimum_length, maximum_length, placeholder, ...rest } =
|
|
485
|
+
constructor(options) {
|
|
486
|
+
const { minimum_length, maximum_length, placeholder, ...rest } = options;
|
|
506
487
|
super(rest);
|
|
507
488
|
__publicField(this, "type", "multi-string");
|
|
508
489
|
__publicField(this, "minLength");
|
|
@@ -538,8 +519,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
538
519
|
identifier
|
|
539
520
|
});
|
|
540
521
|
}
|
|
541
|
-
setOptions(
|
|
542
|
-
const { minimum_length, maximum_length, placeholder, ...rest } =
|
|
522
|
+
setOptions(options) {
|
|
523
|
+
const { minimum_length, maximum_length, placeholder, ...rest } = options;
|
|
543
524
|
this.minLength = minimum_length ?? this.minLength;
|
|
544
525
|
this.maxLength = maximum_length ?? this.maxLength;
|
|
545
526
|
this.placeholder = placeholder ?? this.placeholder;
|
|
@@ -585,8 +566,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
585
566
|
__publicField(_MultiStringField, "fieldTypeDescription", "Allows the user to provide multiple unique strings.");
|
|
586
567
|
let MultiStringField = _MultiStringField;
|
|
587
568
|
class BaseOptionsField extends BaseField {
|
|
588
|
-
constructor(
|
|
589
|
-
const { options: _options, ...base } =
|
|
569
|
+
constructor(options) {
|
|
570
|
+
const { options: _options, ...base } = options;
|
|
590
571
|
super(base);
|
|
591
572
|
__publicField(this, "options");
|
|
592
573
|
__publicField(this, "onlyValidateAfterTouched", false);
|
|
@@ -609,8 +590,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
609
590
|
options: this.options
|
|
610
591
|
};
|
|
611
592
|
}
|
|
612
|
-
setOptions(
|
|
613
|
-
const { options: _options, ...base } =
|
|
593
|
+
setOptions(options) {
|
|
594
|
+
const { options: _options, ...base } = options;
|
|
614
595
|
this.options = (_options == null ? void 0 : _options.map((option) => {
|
|
615
596
|
if (typeof option === "string") {
|
|
616
597
|
option = { label: option, value: option };
|
|
@@ -636,7 +617,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
636
617
|
}
|
|
637
618
|
}
|
|
638
619
|
const BooleanInput = React.memo((props) => {
|
|
639
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
620
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
640
621
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
641
622
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
642
623
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -671,7 +652,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
671
652
|
size: "sm",
|
|
672
653
|
accentColor: "primary",
|
|
673
654
|
variant: "surface",
|
|
674
|
-
|
|
655
|
+
disabled,
|
|
675
656
|
children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Checkbox.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) })
|
|
676
657
|
}
|
|
677
658
|
)
|
|
@@ -680,8 +661,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
680
661
|
});
|
|
681
662
|
BooleanInput.displayName = "BooleanInput";
|
|
682
663
|
const _BooleanField = class _BooleanField extends BaseField {
|
|
683
|
-
constructor(
|
|
684
|
-
super(
|
|
664
|
+
constructor(options) {
|
|
665
|
+
super(options);
|
|
685
666
|
__publicField(this, "type", "boolean");
|
|
686
667
|
__publicField(this, "onlyValidateAfterTouched", false);
|
|
687
668
|
}
|
|
@@ -691,8 +672,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
691
672
|
getOptions() {
|
|
692
673
|
return super.getOptions();
|
|
693
674
|
}
|
|
694
|
-
setOptions(
|
|
695
|
-
super.setOptions(
|
|
675
|
+
setOptions(options) {
|
|
676
|
+
super.setOptions(options);
|
|
696
677
|
}
|
|
697
678
|
duplicate(identifier) {
|
|
698
679
|
return new _BooleanField({
|
|
@@ -732,7 +713,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
732
713
|
const NumberInput = React.memo((props) => {
|
|
733
714
|
const [
|
|
734
715
|
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
735
|
-
|
|
716
|
+
{ disabled }
|
|
736
717
|
] = useFormikInput(props);
|
|
737
718
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
738
719
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -778,7 +759,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
778
759
|
max: field.maximum,
|
|
779
760
|
step: field.integers ? 1 : 0.1,
|
|
780
761
|
placeholder: field.placeholder ?? "Enter a number",
|
|
781
|
-
|
|
762
|
+
disabled
|
|
782
763
|
}
|
|
783
764
|
) })
|
|
784
765
|
}
|
|
@@ -786,14 +767,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
786
767
|
});
|
|
787
768
|
NumberInput.displayName = "NumberInput";
|
|
788
769
|
const _NumberField = class _NumberField extends BaseField {
|
|
789
|
-
constructor(
|
|
770
|
+
constructor(options) {
|
|
790
771
|
const {
|
|
791
772
|
minimum = Number.MIN_SAFE_INTEGER,
|
|
792
773
|
maximum = Number.MAX_SAFE_INTEGER,
|
|
793
774
|
integers = false,
|
|
794
775
|
placeholder,
|
|
795
776
|
...rest
|
|
796
|
-
} =
|
|
777
|
+
} = options;
|
|
797
778
|
super(rest);
|
|
798
779
|
__publicField(this, "type", "number");
|
|
799
780
|
__publicField(this, "minimum");
|
|
@@ -892,8 +873,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
892
873
|
identifier
|
|
893
874
|
});
|
|
894
875
|
}
|
|
895
|
-
setOptions(
|
|
896
|
-
const { minimum, maximum, integers, placeholder, ...rest } =
|
|
876
|
+
setOptions(options) {
|
|
877
|
+
const { minimum, maximum, integers, placeholder, ...rest } = options;
|
|
897
878
|
this.minimum = minimum ?? this.minimum;
|
|
898
879
|
this.maximum = maximum ?? this.maximum;
|
|
899
880
|
this.integers = integers ?? this.integers;
|
|
@@ -930,8 +911,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
930
911
|
let NumberField = _NumberField;
|
|
931
912
|
const LONG_TEXT_FIELD_MAX_LENGTH = 1e4;
|
|
932
913
|
class BaseStringField extends BaseField {
|
|
933
|
-
constructor(
|
|
934
|
-
const { minLength, maxLength, placeholder = "", ...base } =
|
|
914
|
+
constructor(options) {
|
|
915
|
+
const { minLength, maxLength, placeholder = "", ...base } = options;
|
|
935
916
|
super(base);
|
|
936
917
|
__publicField(this, "minLength");
|
|
937
918
|
__publicField(this, "maxLength");
|
|
@@ -1008,8 +989,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1008
989
|
placeholder: this.placeholder
|
|
1009
990
|
};
|
|
1010
991
|
}
|
|
1011
|
-
setOptions(
|
|
1012
|
-
const { minLength, maxLength, placeholder, ...base } =
|
|
992
|
+
setOptions(options) {
|
|
993
|
+
const { minLength, maxLength, placeholder, ...base } = options;
|
|
1013
994
|
this.minLength = minLength;
|
|
1014
995
|
this.maxLength = maxLength ?? this.maxLength;
|
|
1015
996
|
this.placeholder = placeholder;
|
|
@@ -1035,7 +1016,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1035
1016
|
}
|
|
1036
1017
|
}
|
|
1037
1018
|
const CheckboxListInput = React.memo((props) => {
|
|
1038
|
-
const [{ inputId, labelId, size, severity, field, showInputOnly, helpText, label, fieldProps },
|
|
1019
|
+
const [{ inputId, labelId, size, severity, field, showInputOnly, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1039
1020
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
1040
1021
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
1041
1022
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -1066,7 +1047,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1066
1047
|
size: "sm",
|
|
1067
1048
|
values: value,
|
|
1068
1049
|
onValuesChange: handleChange,
|
|
1069
|
-
|
|
1050
|
+
disabled,
|
|
1070
1051
|
children: field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
1071
1052
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.CheckboxGroup.ItemIndicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "check" }) }) }),
|
|
1072
1053
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
@@ -1078,8 +1059,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1078
1059
|
});
|
|
1079
1060
|
CheckboxListInput.displayName = "CheckboxListInput";
|
|
1080
1061
|
const _CheckboxListField = class _CheckboxListField extends BaseOptionsField {
|
|
1081
|
-
constructor(
|
|
1082
|
-
super(
|
|
1062
|
+
constructor(options) {
|
|
1063
|
+
super(options);
|
|
1083
1064
|
__publicField(this, "type", "checkbox-list");
|
|
1084
1065
|
__publicField(this, "onlyValidateAfterTouched", false);
|
|
1085
1066
|
}
|
|
@@ -1124,7 +1105,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1124
1105
|
__publicField(_CheckboxListField, "fieldTypeDescription", "Allows the user to select a multiple options from a list.");
|
|
1125
1106
|
let CheckboxListField = _CheckboxListField;
|
|
1126
1107
|
const DateInput = React.memo((props) => {
|
|
1127
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
1108
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1128
1109
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
1129
1110
|
const [popoverOpen, setPopoverOpen] = React.useState(false);
|
|
1130
1111
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -1163,7 +1144,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1163
1144
|
accentColor: "base",
|
|
1164
1145
|
variant: "surface",
|
|
1165
1146
|
size: "sm",
|
|
1166
|
-
|
|
1147
|
+
disabled,
|
|
1167
1148
|
children: [
|
|
1168
1149
|
value ? value.toLocaleString(void 0, {
|
|
1169
1150
|
year: "numeric",
|
|
@@ -1190,8 +1171,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1190
1171
|
});
|
|
1191
1172
|
DateInput.displayName = "DateInput";
|
|
1192
1173
|
const _DateField = class _DateField extends BaseField {
|
|
1193
|
-
constructor(
|
|
1194
|
-
super(
|
|
1174
|
+
constructor(options) {
|
|
1175
|
+
super(options);
|
|
1195
1176
|
__publicField(this, "type", "date");
|
|
1196
1177
|
__publicField(this, "onlyValidateAfterTouched", false);
|
|
1197
1178
|
}
|
|
@@ -1210,8 +1191,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1210
1191
|
static deserialize(data) {
|
|
1211
1192
|
return new _DateField(data);
|
|
1212
1193
|
}
|
|
1213
|
-
setOptions(
|
|
1214
|
-
super.setOptions(
|
|
1194
|
+
setOptions(options) {
|
|
1195
|
+
super.setOptions(options);
|
|
1215
1196
|
}
|
|
1216
1197
|
serializeValue(value) {
|
|
1217
1198
|
return value ? value.toISOString() : null;
|
|
@@ -1241,7 +1222,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1241
1222
|
__publicField(_DateField, "fieldTypeDescription", "Allows specifying a date.");
|
|
1242
1223
|
let DateField = _DateField;
|
|
1243
1224
|
const MultiSelectInput = React.memo((props) => {
|
|
1244
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
1225
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1245
1226
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
1246
1227
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
1247
1228
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -1278,7 +1259,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1278
1259
|
type: "button",
|
|
1279
1260
|
size: "sm",
|
|
1280
1261
|
accentColor: "base",
|
|
1281
|
-
|
|
1262
|
+
disabled,
|
|
1282
1263
|
children: [
|
|
1283
1264
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: value && value.length > 0 ? value.join(", ") : field.placeholder ?? "Select one or more..." }),
|
|
1284
1265
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
|
|
@@ -1308,8 +1289,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1308
1289
|
});
|
|
1309
1290
|
MultiSelectInput.displayName = "MultiSelectInput";
|
|
1310
1291
|
const _MultiSelectField = class _MultiSelectField extends BaseOptionsField {
|
|
1311
|
-
constructor(
|
|
1312
|
-
const { placeholder, ...base } =
|
|
1292
|
+
constructor(options) {
|
|
1293
|
+
const { placeholder, ...base } = options;
|
|
1313
1294
|
super(base);
|
|
1314
1295
|
__publicField(this, "type", "multi-select");
|
|
1315
1296
|
__publicField(this, "placeholder");
|
|
@@ -1330,10 +1311,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1330
1311
|
identifier
|
|
1331
1312
|
});
|
|
1332
1313
|
}
|
|
1333
|
-
setOptions(
|
|
1334
|
-
const { placeholder } =
|
|
1314
|
+
setOptions(options) {
|
|
1315
|
+
const { placeholder } = options;
|
|
1335
1316
|
this.placeholder = placeholder;
|
|
1336
|
-
super.setOptions(
|
|
1317
|
+
super.setOptions(options);
|
|
1337
1318
|
}
|
|
1338
1319
|
static deserialize(data) {
|
|
1339
1320
|
return new _MultiSelectField(data);
|
|
@@ -1364,7 +1345,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1364
1345
|
__publicField(_MultiSelectField, "fieldTypeDescription", "Allows the user to select a multiple options from a list of options.");
|
|
1365
1346
|
let MultiSelectField = _MultiSelectField;
|
|
1366
1347
|
const SelectInput = React.memo((props) => {
|
|
1367
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
1348
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1368
1349
|
const { name, onChange, onBlur, value } = fieldProps;
|
|
1369
1350
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
1370
1351
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -1398,7 +1379,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1398
1379
|
variant: "surface",
|
|
1399
1380
|
type: "button",
|
|
1400
1381
|
size: "sm",
|
|
1401
|
-
|
|
1382
|
+
disabled,
|
|
1402
1383
|
children: [
|
|
1403
1384
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: currentOption ? currentOption.label : field.placeholder ?? "Select one..." }),
|
|
1404
1385
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "chevron-down" })
|
|
@@ -1415,8 +1396,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1415
1396
|
});
|
|
1416
1397
|
SelectInput.displayName = "SelectInput";
|
|
1417
1398
|
const _SelectField = class _SelectField extends BaseOptionsField {
|
|
1418
|
-
constructor(
|
|
1419
|
-
const { placeholder, ...base } =
|
|
1399
|
+
constructor(options) {
|
|
1400
|
+
const { placeholder, ...base } = options;
|
|
1420
1401
|
super(base);
|
|
1421
1402
|
__publicField(this, "type", "select");
|
|
1422
1403
|
__publicField(this, "placeholder");
|
|
@@ -1437,10 +1418,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1437
1418
|
identifier
|
|
1438
1419
|
});
|
|
1439
1420
|
}
|
|
1440
|
-
setOptions(
|
|
1441
|
-
const { placeholder } =
|
|
1421
|
+
setOptions(options) {
|
|
1422
|
+
const { placeholder } = options;
|
|
1442
1423
|
this.placeholder = placeholder;
|
|
1443
|
-
super.setOptions(
|
|
1424
|
+
super.setOptions(options);
|
|
1444
1425
|
}
|
|
1445
1426
|
static deserialize(data) {
|
|
1446
1427
|
return new _SelectField(data);
|
|
@@ -1473,7 +1454,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1473
1454
|
const OTPInput = React.memo((props) => {
|
|
1474
1455
|
const [
|
|
1475
1456
|
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
1476
|
-
{ formId: formId2,
|
|
1457
|
+
{ formId: formId2, disabled }
|
|
1477
1458
|
] = useFormikInput(props);
|
|
1478
1459
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
1479
1460
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -1521,6 +1502,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1521
1502
|
onValueChange: handleChange,
|
|
1522
1503
|
validationType: field.validationType,
|
|
1523
1504
|
form: formId2,
|
|
1505
|
+
disabled,
|
|
1524
1506
|
orientation: "horizontal",
|
|
1525
1507
|
dir: "ltr",
|
|
1526
1508
|
type: "text",
|
|
@@ -1531,7 +1513,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1531
1513
|
accentColor: "base",
|
|
1532
1514
|
variant: "surface",
|
|
1533
1515
|
size: "sm",
|
|
1534
|
-
...rest,
|
|
1535
1516
|
children: [
|
|
1536
1517
|
inputUuids.map((inputUuid) => /* @__PURE__ */ jsxRuntime.jsx(blocks.OneTimePasswordField.Input, { id: inputUuid, onBlur: handleBlur }, inputUuid)),
|
|
1537
1518
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.OneTimePasswordField.HiddenInput, {})
|
|
@@ -1543,8 +1524,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1543
1524
|
});
|
|
1544
1525
|
OTPInput.displayName = "NumberInput";
|
|
1545
1526
|
const _OTPField = class _OTPField extends BaseField {
|
|
1546
|
-
constructor(
|
|
1547
|
-
const { length, validationType, ...rest } =
|
|
1527
|
+
constructor(options) {
|
|
1528
|
+
const { length, validationType, ...rest } = options;
|
|
1548
1529
|
super(rest);
|
|
1549
1530
|
__publicField(this, "type", "otp");
|
|
1550
1531
|
__publicField(this, "length");
|
|
@@ -1626,8 +1607,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1626
1607
|
identifier
|
|
1627
1608
|
});
|
|
1628
1609
|
}
|
|
1629
|
-
setOptions(
|
|
1630
|
-
const { length, validationType, ...rest } =
|
|
1610
|
+
setOptions(options) {
|
|
1611
|
+
const { length, validationType, ...rest } = options;
|
|
1631
1612
|
this.length = length ?? this.length;
|
|
1632
1613
|
this.validationType = validationType ?? this.validationType;
|
|
1633
1614
|
super.setOptions(rest);
|
|
@@ -1661,7 +1642,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1661
1642
|
__publicField(_OTPField, "fieldTypeDescription", "Allows specifying a number within a given range.");
|
|
1662
1643
|
let OTPField = _OTPField;
|
|
1663
1644
|
const RadioInput = React.memo((props) => {
|
|
1664
|
-
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps },
|
|
1645
|
+
const [{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps }, { disabled }] = useFormikInput(props);
|
|
1665
1646
|
const { name, onChange, onBlur, value } = fieldProps;
|
|
1666
1647
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
1667
1648
|
const computedLabel = showInputOnly ? "" : label;
|
|
@@ -1696,10 +1677,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1696
1677
|
size: "sm",
|
|
1697
1678
|
value: value ?? "",
|
|
1698
1679
|
onValueChange: handleChange,
|
|
1699
|
-
|
|
1680
|
+
disabled,
|
|
1700
1681
|
children: [
|
|
1701
1682
|
field.options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex gap-2 items-center min-w-0", children: [
|
|
1702
|
-
/* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "
|
|
1683
|
+
/* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Item, { value: option.value, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.RadioGroup.Indicator, { children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "circle", className: "fill-current" }) }) }),
|
|
1703
1684
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.Text, { size: "sm", accentColor: "base", className: "truncate", children: option.label })
|
|
1704
1685
|
] }, `${inputId}-${option.value}-${index}`)),
|
|
1705
1686
|
!!value && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1725,8 +1706,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1725
1706
|
});
|
|
1726
1707
|
RadioInput.displayName = "SelectInput";
|
|
1727
1708
|
const _RadioField = class _RadioField extends BaseOptionsField {
|
|
1728
|
-
constructor(
|
|
1729
|
-
super(
|
|
1709
|
+
constructor(options) {
|
|
1710
|
+
super(options);
|
|
1730
1711
|
__publicField(this, "type", "radio");
|
|
1731
1712
|
__publicField(this, "onlyValidateAfterTouched", false);
|
|
1732
1713
|
}
|
|
@@ -1742,8 +1723,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1742
1723
|
identifier
|
|
1743
1724
|
});
|
|
1744
1725
|
}
|
|
1745
|
-
setOptions(
|
|
1746
|
-
super.setOptions(
|
|
1726
|
+
setOptions(options) {
|
|
1727
|
+
super.setOptions(options);
|
|
1747
1728
|
}
|
|
1748
1729
|
static deserialize(data) {
|
|
1749
1730
|
return new _RadioField(data);
|
|
@@ -1773,1845 +1754,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1773
1754
|
__publicField(_RadioField, "fieldTypeName", "Option list");
|
|
1774
1755
|
__publicField(_RadioField, "fieldTypeDescription", "Allows the user to select a single option from a list of options.");
|
|
1775
1756
|
let RadioField = _RadioField;
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
originalEventHandler == null ? void 0 : originalEventHandler(event);
|
|
1779
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) {
|
|
1780
|
-
return ourEventHandler == null ? void 0 : ourEventHandler(event);
|
|
1781
|
-
}
|
|
1782
|
-
};
|
|
1783
|
-
}
|
|
1784
|
-
function setRef(ref, value) {
|
|
1785
|
-
if (typeof ref === "function") {
|
|
1786
|
-
return ref(value);
|
|
1787
|
-
} else if (ref !== null && ref !== void 0) {
|
|
1788
|
-
ref.current = value;
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
function composeRefs(...refs) {
|
|
1792
|
-
return (node) => {
|
|
1793
|
-
let hasCleanup = false;
|
|
1794
|
-
const cleanups = refs.map((ref) => {
|
|
1795
|
-
const cleanup = setRef(ref, node);
|
|
1796
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
1797
|
-
hasCleanup = true;
|
|
1798
|
-
}
|
|
1799
|
-
return cleanup;
|
|
1800
|
-
});
|
|
1801
|
-
if (hasCleanup) {
|
|
1802
|
-
return () => {
|
|
1803
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
1804
|
-
const cleanup = cleanups[i];
|
|
1805
|
-
if (typeof cleanup == "function") {
|
|
1806
|
-
cleanup();
|
|
1807
|
-
} else {
|
|
1808
|
-
setRef(refs[i], null);
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
};
|
|
1812
|
-
}
|
|
1813
|
-
};
|
|
1814
|
-
}
|
|
1815
|
-
function useComposedRefs(...refs) {
|
|
1816
|
-
return React__namespace.useCallback(composeRefs(...refs), refs);
|
|
1817
|
-
}
|
|
1818
|
-
function createContext2(rootComponentName, defaultContext) {
|
|
1819
|
-
const Context = React__namespace.createContext(defaultContext);
|
|
1820
|
-
const Provider = (props) => {
|
|
1821
|
-
const { children, ...context } = props;
|
|
1822
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
1823
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
1824
|
-
};
|
|
1825
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
1826
|
-
function useContext2(consumerName) {
|
|
1827
|
-
const context = React__namespace.useContext(Context);
|
|
1828
|
-
if (context) return context;
|
|
1829
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
1830
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1831
|
-
}
|
|
1832
|
-
return [Provider, useContext2];
|
|
1833
|
-
}
|
|
1834
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
1835
|
-
let defaultContexts = [];
|
|
1836
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
1837
|
-
const BaseContext = React__namespace.createContext(defaultContext);
|
|
1838
|
-
const index = defaultContexts.length;
|
|
1839
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
1840
|
-
const Provider = (props) => {
|
|
1841
|
-
var _a2;
|
|
1842
|
-
const { scope, children, ...context } = props;
|
|
1843
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index]) || BaseContext;
|
|
1844
|
-
const value = React__namespace.useMemo(() => context, Object.values(context));
|
|
1845
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
|
|
1846
|
-
};
|
|
1847
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
1848
|
-
function useContext2(consumerName, scope) {
|
|
1849
|
-
var _a2;
|
|
1850
|
-
const Context = ((_a2 = scope == null ? void 0 : scope[scopeName]) == null ? void 0 : _a2[index]) || BaseContext;
|
|
1851
|
-
const context = React__namespace.useContext(Context);
|
|
1852
|
-
if (context) return context;
|
|
1853
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
1854
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1855
|
-
}
|
|
1856
|
-
return [Provider, useContext2];
|
|
1857
|
-
}
|
|
1858
|
-
const createScope = () => {
|
|
1859
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
1860
|
-
return React__namespace.createContext(defaultContext);
|
|
1861
|
-
});
|
|
1862
|
-
return function useScope(scope) {
|
|
1863
|
-
const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
|
|
1864
|
-
return React__namespace.useMemo(
|
|
1865
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
1866
|
-
[scope, contexts]
|
|
1867
|
-
);
|
|
1868
|
-
};
|
|
1869
|
-
};
|
|
1870
|
-
createScope.scopeName = scopeName;
|
|
1871
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
1872
|
-
}
|
|
1873
|
-
function composeContextScopes(...scopes) {
|
|
1874
|
-
const baseScope = scopes[0];
|
|
1875
|
-
if (scopes.length === 1) return baseScope;
|
|
1876
|
-
const createScope = () => {
|
|
1877
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
1878
|
-
useScope: createScope2(),
|
|
1879
|
-
scopeName: createScope2.scopeName
|
|
1880
|
-
}));
|
|
1881
|
-
return function useComposedScopes(overrideScopes) {
|
|
1882
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
1883
|
-
const scopeProps = useScope(overrideScopes);
|
|
1884
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
1885
|
-
return { ...nextScopes2, ...currentScope };
|
|
1886
|
-
}, {});
|
|
1887
|
-
return React__namespace.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
1888
|
-
};
|
|
1889
|
-
};
|
|
1890
|
-
createScope.scopeName = baseScope.scopeName;
|
|
1891
|
-
return createScope;
|
|
1892
|
-
}
|
|
1893
|
-
var useLayoutEffect2 = (globalThis == null ? void 0 : globalThis.document) ? React__namespace.useLayoutEffect : () => {
|
|
1894
|
-
};
|
|
1895
|
-
// @__NO_SIDE_EFFECTS__
|
|
1896
|
-
function createSlot(ownerName) {
|
|
1897
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
1898
|
-
const Slot2 = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1899
|
-
const { children, ...slotProps } = props;
|
|
1900
|
-
const childrenArray = React__namespace.Children.toArray(children);
|
|
1901
|
-
const slottable = childrenArray.find(isSlottable);
|
|
1902
|
-
if (slottable) {
|
|
1903
|
-
const newElement = slottable.props.children;
|
|
1904
|
-
const newChildren = childrenArray.map((child) => {
|
|
1905
|
-
if (child === slottable) {
|
|
1906
|
-
if (React__namespace.Children.count(newElement) > 1) return React__namespace.Children.only(null);
|
|
1907
|
-
return React__namespace.isValidElement(newElement) ? newElement.props.children : null;
|
|
1908
|
-
} else {
|
|
1909
|
-
return child;
|
|
1910
|
-
}
|
|
1911
|
-
});
|
|
1912
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React__namespace.isValidElement(newElement) ? React__namespace.cloneElement(newElement, void 0, newChildren) : null });
|
|
1913
|
-
}
|
|
1914
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
1915
|
-
});
|
|
1916
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
1917
|
-
return Slot2;
|
|
1918
|
-
}
|
|
1919
|
-
// @__NO_SIDE_EFFECTS__
|
|
1920
|
-
function createSlotClone(ownerName) {
|
|
1921
|
-
const SlotClone = React__namespace.forwardRef((props, forwardedRef) => {
|
|
1922
|
-
const { children, ...slotProps } = props;
|
|
1923
|
-
if (React__namespace.isValidElement(children)) {
|
|
1924
|
-
const childrenRef = getElementRef$1(children);
|
|
1925
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
1926
|
-
if (children.type !== React__namespace.Fragment) {
|
|
1927
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
1928
|
-
}
|
|
1929
|
-
return React__namespace.cloneElement(children, props2);
|
|
1930
|
-
}
|
|
1931
|
-
return React__namespace.Children.count(children) > 1 ? React__namespace.Children.only(null) : null;
|
|
1932
|
-
});
|
|
1933
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
1934
|
-
return SlotClone;
|
|
1935
|
-
}
|
|
1936
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
1937
|
-
function isSlottable(child) {
|
|
1938
|
-
return React__namespace.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
1939
|
-
}
|
|
1940
|
-
function mergeProps(slotProps, childProps) {
|
|
1941
|
-
const overrideProps = { ...childProps };
|
|
1942
|
-
for (const propName in childProps) {
|
|
1943
|
-
const slotPropValue = slotProps[propName];
|
|
1944
|
-
const childPropValue = childProps[propName];
|
|
1945
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
1946
|
-
if (isHandler) {
|
|
1947
|
-
if (slotPropValue && childPropValue) {
|
|
1948
|
-
overrideProps[propName] = (...args) => {
|
|
1949
|
-
const result = childPropValue(...args);
|
|
1950
|
-
slotPropValue(...args);
|
|
1951
|
-
return result;
|
|
1952
|
-
};
|
|
1953
|
-
} else if (slotPropValue) {
|
|
1954
|
-
overrideProps[propName] = slotPropValue;
|
|
1955
|
-
}
|
|
1956
|
-
} else if (propName === "style") {
|
|
1957
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
1958
|
-
} else if (propName === "className") {
|
|
1959
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
return { ...slotProps, ...overrideProps };
|
|
1963
|
-
}
|
|
1964
|
-
function getElementRef$1(element) {
|
|
1965
|
-
var _a2, _b;
|
|
1966
|
-
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
1967
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1968
|
-
if (mayWarn) {
|
|
1969
|
-
return element.ref;
|
|
1970
|
-
}
|
|
1971
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
1972
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
1973
|
-
if (mayWarn) {
|
|
1974
|
-
return element.props.ref;
|
|
1975
|
-
}
|
|
1976
|
-
return element.props.ref || element.ref;
|
|
1977
|
-
}
|
|
1978
|
-
var NODES = [
|
|
1979
|
-
"a",
|
|
1980
|
-
"button",
|
|
1981
|
-
"div",
|
|
1982
|
-
"form",
|
|
1983
|
-
"h2",
|
|
1984
|
-
"h3",
|
|
1985
|
-
"img",
|
|
1986
|
-
"input",
|
|
1987
|
-
"label",
|
|
1988
|
-
"li",
|
|
1989
|
-
"nav",
|
|
1990
|
-
"ol",
|
|
1991
|
-
"p",
|
|
1992
|
-
"select",
|
|
1993
|
-
"span",
|
|
1994
|
-
"svg",
|
|
1995
|
-
"ul"
|
|
1996
|
-
];
|
|
1997
|
-
var Primitive = NODES.reduce((primitive, node) => {
|
|
1998
|
-
const Slot2 = /* @__PURE__ */ createSlot(`Primitive.${node}`);
|
|
1999
|
-
const Node = React__namespace.forwardRef((props, forwardedRef) => {
|
|
2000
|
-
const { asChild, ...primitiveProps } = props;
|
|
2001
|
-
const Comp = asChild ? Slot2 : node;
|
|
2002
|
-
if (typeof window !== "undefined") {
|
|
2003
|
-
window[Symbol.for("radix-ui")] = true;
|
|
2004
|
-
}
|
|
2005
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
2006
|
-
});
|
|
2007
|
-
Node.displayName = `Primitive.${node}`;
|
|
2008
|
-
return { ...primitive, [node]: Node };
|
|
2009
|
-
}, {});
|
|
2010
|
-
function dispatchDiscreteCustomEvent(target, event) {
|
|
2011
|
-
if (target) ReactDOM__namespace.flushSync(() => target.dispatchEvent(event));
|
|
2012
|
-
}
|
|
2013
|
-
function useCallbackRef$1(callback) {
|
|
2014
|
-
const callbackRef = React__namespace.useRef(callback);
|
|
2015
|
-
React__namespace.useEffect(() => {
|
|
2016
|
-
callbackRef.current = callback;
|
|
2017
|
-
});
|
|
2018
|
-
return React__namespace.useMemo(() => (...args) => {
|
|
2019
|
-
var _a2;
|
|
2020
|
-
return (_a2 = callbackRef.current) == null ? void 0 : _a2.call(callbackRef, ...args);
|
|
2021
|
-
}, []);
|
|
2022
|
-
}
|
|
2023
|
-
function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
2024
|
-
const onEscapeKeyDown = useCallbackRef$1(onEscapeKeyDownProp);
|
|
2025
|
-
React__namespace.useEffect(() => {
|
|
2026
|
-
const handleKeyDown = (event) => {
|
|
2027
|
-
if (event.key === "Escape") {
|
|
2028
|
-
onEscapeKeyDown(event);
|
|
2029
|
-
}
|
|
2030
|
-
};
|
|
2031
|
-
ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
|
|
2032
|
-
return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
|
|
2033
|
-
}, [onEscapeKeyDown, ownerDocument]);
|
|
2034
|
-
}
|
|
2035
|
-
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
2036
|
-
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
2037
|
-
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
2038
|
-
var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
|
|
2039
|
-
var originalBodyPointerEvents;
|
|
2040
|
-
var DismissableLayerContext = React__namespace.createContext({
|
|
2041
|
-
layers: /* @__PURE__ */ new Set(),
|
|
2042
|
-
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
2043
|
-
branches: /* @__PURE__ */ new Set()
|
|
2044
|
-
});
|
|
2045
|
-
var DismissableLayer = React__namespace.forwardRef(
|
|
2046
|
-
(props, forwardedRef) => {
|
|
2047
|
-
const {
|
|
2048
|
-
disableOutsidePointerEvents = false,
|
|
2049
|
-
onEscapeKeyDown,
|
|
2050
|
-
onPointerDownOutside,
|
|
2051
|
-
onFocusOutside,
|
|
2052
|
-
onInteractOutside,
|
|
2053
|
-
onDismiss,
|
|
2054
|
-
...layerProps
|
|
2055
|
-
} = props;
|
|
2056
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
2057
|
-
const [node, setNode] = React__namespace.useState(null);
|
|
2058
|
-
const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
|
|
2059
|
-
const [, force] = React__namespace.useState({});
|
|
2060
|
-
const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
|
|
2061
|
-
const layers = Array.from(context.layers);
|
|
2062
|
-
const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
|
|
2063
|
-
const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
|
|
2064
|
-
const index = node ? layers.indexOf(node) : -1;
|
|
2065
|
-
const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
|
|
2066
|
-
const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
|
|
2067
|
-
const pointerDownOutside = usePointerDownOutside((event) => {
|
|
2068
|
-
const target = event.target;
|
|
2069
|
-
const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2070
|
-
if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
|
|
2071
|
-
onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
|
|
2072
|
-
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
2073
|
-
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
2074
|
-
}, ownerDocument);
|
|
2075
|
-
const focusOutside = useFocusOutside((event) => {
|
|
2076
|
-
const target = event.target;
|
|
2077
|
-
const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
|
|
2078
|
-
if (isFocusInBranch) return;
|
|
2079
|
-
onFocusOutside == null ? void 0 : onFocusOutside(event);
|
|
2080
|
-
onInteractOutside == null ? void 0 : onInteractOutside(event);
|
|
2081
|
-
if (!event.defaultPrevented) onDismiss == null ? void 0 : onDismiss();
|
|
2082
|
-
}, ownerDocument);
|
|
2083
|
-
useEscapeKeydown((event) => {
|
|
2084
|
-
const isHighestLayer = index === context.layers.size - 1;
|
|
2085
|
-
if (!isHighestLayer) return;
|
|
2086
|
-
onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
|
|
2087
|
-
if (!event.defaultPrevented && onDismiss) {
|
|
2088
|
-
event.preventDefault();
|
|
2089
|
-
onDismiss();
|
|
2090
|
-
}
|
|
2091
|
-
}, ownerDocument);
|
|
2092
|
-
React__namespace.useEffect(() => {
|
|
2093
|
-
if (!node) return;
|
|
2094
|
-
if (disableOutsidePointerEvents) {
|
|
2095
|
-
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
2096
|
-
originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
|
|
2097
|
-
ownerDocument.body.style.pointerEvents = "none";
|
|
2098
|
-
}
|
|
2099
|
-
context.layersWithOutsidePointerEventsDisabled.add(node);
|
|
2100
|
-
}
|
|
2101
|
-
context.layers.add(node);
|
|
2102
|
-
dispatchUpdate();
|
|
2103
|
-
return () => {
|
|
2104
|
-
if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
|
|
2105
|
-
ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
|
|
2106
|
-
}
|
|
2107
|
-
};
|
|
2108
|
-
}, [node, ownerDocument, disableOutsidePointerEvents, context]);
|
|
2109
|
-
React__namespace.useEffect(() => {
|
|
2110
|
-
return () => {
|
|
2111
|
-
if (!node) return;
|
|
2112
|
-
context.layers.delete(node);
|
|
2113
|
-
context.layersWithOutsidePointerEventsDisabled.delete(node);
|
|
2114
|
-
dispatchUpdate();
|
|
2115
|
-
};
|
|
2116
|
-
}, [node, context]);
|
|
2117
|
-
React__namespace.useEffect(() => {
|
|
2118
|
-
const handleUpdate = () => force({});
|
|
2119
|
-
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
2120
|
-
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
2121
|
-
}, []);
|
|
2122
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2123
|
-
Primitive.div,
|
|
2124
|
-
{
|
|
2125
|
-
...layerProps,
|
|
2126
|
-
ref: composedRefs,
|
|
2127
|
-
style: {
|
|
2128
|
-
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
|
|
2129
|
-
...props.style
|
|
2130
|
-
},
|
|
2131
|
-
onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
2132
|
-
onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
2133
|
-
onPointerDownCapture: composeEventHandlers(
|
|
2134
|
-
props.onPointerDownCapture,
|
|
2135
|
-
pointerDownOutside.onPointerDownCapture
|
|
2136
|
-
)
|
|
2137
|
-
}
|
|
2138
|
-
);
|
|
2139
|
-
}
|
|
2140
|
-
);
|
|
2141
|
-
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
2142
|
-
var BRANCH_NAME = "DismissableLayerBranch";
|
|
2143
|
-
var DismissableLayerBranch = React__namespace.forwardRef((props, forwardedRef) => {
|
|
2144
|
-
const context = React__namespace.useContext(DismissableLayerContext);
|
|
2145
|
-
const ref = React__namespace.useRef(null);
|
|
2146
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
2147
|
-
React__namespace.useEffect(() => {
|
|
2148
|
-
const node = ref.current;
|
|
2149
|
-
if (node) {
|
|
2150
|
-
context.branches.add(node);
|
|
2151
|
-
return () => {
|
|
2152
|
-
context.branches.delete(node);
|
|
2153
|
-
};
|
|
2154
|
-
}
|
|
2155
|
-
}, [context.branches]);
|
|
2156
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { ...props, ref: composedRefs });
|
|
2157
|
-
});
|
|
2158
|
-
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
2159
|
-
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
2160
|
-
const handlePointerDownOutside = useCallbackRef$1(onPointerDownOutside);
|
|
2161
|
-
const isPointerInsideReactTreeRef = React__namespace.useRef(false);
|
|
2162
|
-
const handleClickRef = React__namespace.useRef(() => {
|
|
2163
|
-
});
|
|
2164
|
-
React__namespace.useEffect(() => {
|
|
2165
|
-
const handlePointerDown = (event) => {
|
|
2166
|
-
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
2167
|
-
let handleAndDispatchPointerDownOutsideEvent2 = function() {
|
|
2168
|
-
handleAndDispatchCustomEvent(
|
|
2169
|
-
POINTER_DOWN_OUTSIDE,
|
|
2170
|
-
handlePointerDownOutside,
|
|
2171
|
-
eventDetail,
|
|
2172
|
-
{ discrete: true }
|
|
2173
|
-
);
|
|
2174
|
-
};
|
|
2175
|
-
const eventDetail = { originalEvent: event };
|
|
2176
|
-
if (event.pointerType === "touch") {
|
|
2177
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2178
|
-
handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
|
|
2179
|
-
ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
|
|
2180
|
-
} else {
|
|
2181
|
-
handleAndDispatchPointerDownOutsideEvent2();
|
|
2182
|
-
}
|
|
2183
|
-
} else {
|
|
2184
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2185
|
-
}
|
|
2186
|
-
isPointerInsideReactTreeRef.current = false;
|
|
2187
|
-
};
|
|
2188
|
-
const timerId = window.setTimeout(() => {
|
|
2189
|
-
ownerDocument.addEventListener("pointerdown", handlePointerDown);
|
|
2190
|
-
}, 0);
|
|
2191
|
-
return () => {
|
|
2192
|
-
window.clearTimeout(timerId);
|
|
2193
|
-
ownerDocument.removeEventListener("pointerdown", handlePointerDown);
|
|
2194
|
-
ownerDocument.removeEventListener("click", handleClickRef.current);
|
|
2195
|
-
};
|
|
2196
|
-
}, [ownerDocument, handlePointerDownOutside]);
|
|
2197
|
-
return {
|
|
2198
|
-
// ensures we check React component tree (not just DOM tree)
|
|
2199
|
-
onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
|
|
2200
|
-
};
|
|
2201
|
-
}
|
|
2202
|
-
function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
|
|
2203
|
-
const handleFocusOutside = useCallbackRef$1(onFocusOutside);
|
|
2204
|
-
const isFocusInsideReactTreeRef = React__namespace.useRef(false);
|
|
2205
|
-
React__namespace.useEffect(() => {
|
|
2206
|
-
const handleFocus = (event) => {
|
|
2207
|
-
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
2208
|
-
const eventDetail = { originalEvent: event };
|
|
2209
|
-
handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
|
|
2210
|
-
discrete: false
|
|
2211
|
-
});
|
|
2212
|
-
}
|
|
2213
|
-
};
|
|
2214
|
-
ownerDocument.addEventListener("focusin", handleFocus);
|
|
2215
|
-
return () => ownerDocument.removeEventListener("focusin", handleFocus);
|
|
2216
|
-
}, [ownerDocument, handleFocusOutside]);
|
|
2217
|
-
return {
|
|
2218
|
-
onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
|
|
2219
|
-
onBlurCapture: () => isFocusInsideReactTreeRef.current = false
|
|
2220
|
-
};
|
|
2221
|
-
}
|
|
2222
|
-
function dispatchUpdate() {
|
|
2223
|
-
const event = new CustomEvent(CONTEXT_UPDATE);
|
|
2224
|
-
document.dispatchEvent(event);
|
|
2225
|
-
}
|
|
2226
|
-
function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
|
|
2227
|
-
const target = detail.originalEvent.target;
|
|
2228
|
-
const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
|
|
2229
|
-
if (handler) target.addEventListener(name, handler, { once: true });
|
|
2230
|
-
if (discrete) {
|
|
2231
|
-
dispatchDiscreteCustomEvent(target, event);
|
|
2232
|
-
} else {
|
|
2233
|
-
target.dispatchEvent(event);
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
|
|
2237
|
-
var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
|
|
2238
|
-
var EVENT_OPTIONS = { bubbles: false, cancelable: true };
|
|
2239
|
-
var FOCUS_SCOPE_NAME = "FocusScope";
|
|
2240
|
-
var FocusScope = React__namespace.forwardRef((props, forwardedRef) => {
|
|
2241
|
-
const {
|
|
2242
|
-
loop = false,
|
|
2243
|
-
trapped = false,
|
|
2244
|
-
onMountAutoFocus: onMountAutoFocusProp,
|
|
2245
|
-
onUnmountAutoFocus: onUnmountAutoFocusProp,
|
|
2246
|
-
...scopeProps
|
|
2247
|
-
} = props;
|
|
2248
|
-
const [container, setContainer] = React__namespace.useState(null);
|
|
2249
|
-
const onMountAutoFocus = useCallbackRef$1(onMountAutoFocusProp);
|
|
2250
|
-
const onUnmountAutoFocus = useCallbackRef$1(onUnmountAutoFocusProp);
|
|
2251
|
-
const lastFocusedElementRef = React__namespace.useRef(null);
|
|
2252
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
|
|
2253
|
-
const focusScope = React__namespace.useRef({
|
|
2254
|
-
paused: false,
|
|
2255
|
-
pause() {
|
|
2256
|
-
this.paused = true;
|
|
2257
|
-
},
|
|
2258
|
-
resume() {
|
|
2259
|
-
this.paused = false;
|
|
2260
|
-
}
|
|
2261
|
-
}).current;
|
|
2262
|
-
React__namespace.useEffect(() => {
|
|
2263
|
-
if (trapped) {
|
|
2264
|
-
let handleFocusIn2 = function(event) {
|
|
2265
|
-
if (focusScope.paused || !container) return;
|
|
2266
|
-
const target = event.target;
|
|
2267
|
-
if (container.contains(target)) {
|
|
2268
|
-
lastFocusedElementRef.current = target;
|
|
2269
|
-
} else {
|
|
2270
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
2271
|
-
}
|
|
2272
|
-
}, handleFocusOut2 = function(event) {
|
|
2273
|
-
if (focusScope.paused || !container) return;
|
|
2274
|
-
const relatedTarget = event.relatedTarget;
|
|
2275
|
-
if (relatedTarget === null) return;
|
|
2276
|
-
if (!container.contains(relatedTarget)) {
|
|
2277
|
-
focus(lastFocusedElementRef.current, { select: true });
|
|
2278
|
-
}
|
|
2279
|
-
}, handleMutations2 = function(mutations) {
|
|
2280
|
-
const focusedElement = document.activeElement;
|
|
2281
|
-
if (focusedElement !== document.body) return;
|
|
2282
|
-
for (const mutation of mutations) {
|
|
2283
|
-
if (mutation.removedNodes.length > 0) focus(container);
|
|
2284
|
-
}
|
|
2285
|
-
};
|
|
2286
|
-
document.addEventListener("focusin", handleFocusIn2);
|
|
2287
|
-
document.addEventListener("focusout", handleFocusOut2);
|
|
2288
|
-
const mutationObserver = new MutationObserver(handleMutations2);
|
|
2289
|
-
if (container) mutationObserver.observe(container, { childList: true, subtree: true });
|
|
2290
|
-
return () => {
|
|
2291
|
-
document.removeEventListener("focusin", handleFocusIn2);
|
|
2292
|
-
document.removeEventListener("focusout", handleFocusOut2);
|
|
2293
|
-
mutationObserver.disconnect();
|
|
2294
|
-
};
|
|
2295
|
-
}
|
|
2296
|
-
}, [trapped, container, focusScope.paused]);
|
|
2297
|
-
React__namespace.useEffect(() => {
|
|
2298
|
-
if (container) {
|
|
2299
|
-
focusScopesStack.add(focusScope);
|
|
2300
|
-
const previouslyFocusedElement = document.activeElement;
|
|
2301
|
-
const hasFocusedCandidate = container.contains(previouslyFocusedElement);
|
|
2302
|
-
if (!hasFocusedCandidate) {
|
|
2303
|
-
const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
|
|
2304
|
-
container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
2305
|
-
container.dispatchEvent(mountEvent);
|
|
2306
|
-
if (!mountEvent.defaultPrevented) {
|
|
2307
|
-
focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
|
|
2308
|
-
if (document.activeElement === previouslyFocusedElement) {
|
|
2309
|
-
focus(container);
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
return () => {
|
|
2314
|
-
container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
|
|
2315
|
-
setTimeout(() => {
|
|
2316
|
-
const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
|
|
2317
|
-
container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
2318
|
-
container.dispatchEvent(unmountEvent);
|
|
2319
|
-
if (!unmountEvent.defaultPrevented) {
|
|
2320
|
-
focus(previouslyFocusedElement ?? document.body, { select: true });
|
|
2321
|
-
}
|
|
2322
|
-
container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
|
|
2323
|
-
focusScopesStack.remove(focusScope);
|
|
2324
|
-
}, 0);
|
|
2325
|
-
};
|
|
2326
|
-
}
|
|
2327
|
-
}, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
|
|
2328
|
-
const handleKeyDown = React__namespace.useCallback(
|
|
2329
|
-
(event) => {
|
|
2330
|
-
if (!loop && !trapped) return;
|
|
2331
|
-
if (focusScope.paused) return;
|
|
2332
|
-
const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
2333
|
-
const focusedElement = document.activeElement;
|
|
2334
|
-
if (isTabKey && focusedElement) {
|
|
2335
|
-
const container2 = event.currentTarget;
|
|
2336
|
-
const [first, last] = getTabbableEdges(container2);
|
|
2337
|
-
const hasTabbableElementsInside = first && last;
|
|
2338
|
-
if (!hasTabbableElementsInside) {
|
|
2339
|
-
if (focusedElement === container2) event.preventDefault();
|
|
2340
|
-
} else {
|
|
2341
|
-
if (!event.shiftKey && focusedElement === last) {
|
|
2342
|
-
event.preventDefault();
|
|
2343
|
-
if (loop) focus(first, { select: true });
|
|
2344
|
-
} else if (event.shiftKey && focusedElement === first) {
|
|
2345
|
-
event.preventDefault();
|
|
2346
|
-
if (loop) focus(last, { select: true });
|
|
2347
|
-
}
|
|
2348
|
-
}
|
|
2349
|
-
}
|
|
2350
|
-
},
|
|
2351
|
-
[loop, trapped, focusScope.paused]
|
|
2352
|
-
);
|
|
2353
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
|
|
2354
|
-
});
|
|
2355
|
-
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
2356
|
-
function focusFirst(candidates, { select = false } = {}) {
|
|
2357
|
-
const previouslyFocusedElement = document.activeElement;
|
|
2358
|
-
for (const candidate of candidates) {
|
|
2359
|
-
focus(candidate, { select });
|
|
2360
|
-
if (document.activeElement !== previouslyFocusedElement) return;
|
|
2361
|
-
}
|
|
2362
|
-
}
|
|
2363
|
-
function getTabbableEdges(container) {
|
|
2364
|
-
const candidates = getTabbableCandidates(container);
|
|
2365
|
-
const first = findVisible(candidates, container);
|
|
2366
|
-
const last = findVisible(candidates.reverse(), container);
|
|
2367
|
-
return [first, last];
|
|
2368
|
-
}
|
|
2369
|
-
function getTabbableCandidates(container) {
|
|
2370
|
-
const nodes = [];
|
|
2371
|
-
const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
|
|
2372
|
-
acceptNode: (node) => {
|
|
2373
|
-
const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
|
|
2374
|
-
if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
|
|
2375
|
-
return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
2376
|
-
}
|
|
2377
|
-
});
|
|
2378
|
-
while (walker.nextNode()) nodes.push(walker.currentNode);
|
|
2379
|
-
return nodes;
|
|
2380
|
-
}
|
|
2381
|
-
function findVisible(elements, container) {
|
|
2382
|
-
for (const element of elements) {
|
|
2383
|
-
if (!isHidden(element, { upTo: container })) return element;
|
|
2384
|
-
}
|
|
2385
|
-
}
|
|
2386
|
-
function isHidden(node, { upTo }) {
|
|
2387
|
-
if (getComputedStyle(node).visibility === "hidden") return true;
|
|
2388
|
-
while (node) {
|
|
2389
|
-
if (upTo !== void 0 && node === upTo) return false;
|
|
2390
|
-
if (getComputedStyle(node).display === "none") return true;
|
|
2391
|
-
node = node.parentElement;
|
|
2392
|
-
}
|
|
2393
|
-
return false;
|
|
2394
|
-
}
|
|
2395
|
-
function isSelectableInput(element) {
|
|
2396
|
-
return element instanceof HTMLInputElement && "select" in element;
|
|
2397
|
-
}
|
|
2398
|
-
function focus(element, { select = false } = {}) {
|
|
2399
|
-
if (element && element.focus) {
|
|
2400
|
-
const previouslyFocusedElement = document.activeElement;
|
|
2401
|
-
element.focus({ preventScroll: true });
|
|
2402
|
-
if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
|
|
2403
|
-
element.select();
|
|
2404
|
-
}
|
|
2405
|
-
}
|
|
2406
|
-
var focusScopesStack = createFocusScopesStack();
|
|
2407
|
-
function createFocusScopesStack() {
|
|
2408
|
-
let stack = [];
|
|
2409
|
-
return {
|
|
2410
|
-
add(focusScope) {
|
|
2411
|
-
const activeFocusScope = stack[0];
|
|
2412
|
-
if (focusScope !== activeFocusScope) {
|
|
2413
|
-
activeFocusScope == null ? void 0 : activeFocusScope.pause();
|
|
2414
|
-
}
|
|
2415
|
-
stack = arrayRemove(stack, focusScope);
|
|
2416
|
-
stack.unshift(focusScope);
|
|
2417
|
-
},
|
|
2418
|
-
remove(focusScope) {
|
|
2419
|
-
var _a2;
|
|
2420
|
-
stack = arrayRemove(stack, focusScope);
|
|
2421
|
-
(_a2 = stack[0]) == null ? void 0 : _a2.resume();
|
|
2422
|
-
}
|
|
2423
|
-
};
|
|
2424
|
-
}
|
|
2425
|
-
function arrayRemove(array, item) {
|
|
2426
|
-
const updatedArray = [...array];
|
|
2427
|
-
const index = updatedArray.indexOf(item);
|
|
2428
|
-
if (index !== -1) {
|
|
2429
|
-
updatedArray.splice(index, 1);
|
|
2430
|
-
}
|
|
2431
|
-
return updatedArray;
|
|
2432
|
-
}
|
|
2433
|
-
function removeLinks(items) {
|
|
2434
|
-
return items.filter((item) => item.tagName !== "A");
|
|
2435
|
-
}
|
|
2436
|
-
function useStateMachine(initialState, machine) {
|
|
2437
|
-
return React__namespace.useReducer((state, event) => {
|
|
2438
|
-
const nextState = machine[state][event];
|
|
2439
|
-
return nextState ?? state;
|
|
2440
|
-
}, initialState);
|
|
2441
|
-
}
|
|
2442
|
-
var Presence = (props) => {
|
|
2443
|
-
const { present, children } = props;
|
|
2444
|
-
const presence = usePresence(present);
|
|
2445
|
-
const child = typeof children === "function" ? children({ present: presence.isPresent }) : React__namespace.Children.only(children);
|
|
2446
|
-
const ref = useComposedRefs(presence.ref, getElementRef(child));
|
|
2447
|
-
const forceMount = typeof children === "function";
|
|
2448
|
-
return forceMount || presence.isPresent ? React__namespace.cloneElement(child, { ref }) : null;
|
|
2449
|
-
};
|
|
2450
|
-
Presence.displayName = "Presence";
|
|
2451
|
-
function usePresence(present) {
|
|
2452
|
-
const [node, setNode] = React__namespace.useState();
|
|
2453
|
-
const stylesRef = React__namespace.useRef(null);
|
|
2454
|
-
const prevPresentRef = React__namespace.useRef(present);
|
|
2455
|
-
const prevAnimationNameRef = React__namespace.useRef("none");
|
|
2456
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
2457
|
-
const [state, send] = useStateMachine(initialState, {
|
|
2458
|
-
mounted: {
|
|
2459
|
-
UNMOUNT: "unmounted",
|
|
2460
|
-
ANIMATION_OUT: "unmountSuspended"
|
|
2461
|
-
},
|
|
2462
|
-
unmountSuspended: {
|
|
2463
|
-
MOUNT: "mounted",
|
|
2464
|
-
ANIMATION_END: "unmounted"
|
|
2465
|
-
},
|
|
2466
|
-
unmounted: {
|
|
2467
|
-
MOUNT: "mounted"
|
|
2468
|
-
}
|
|
2469
|
-
});
|
|
2470
|
-
React__namespace.useEffect(() => {
|
|
2471
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
2472
|
-
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
2473
|
-
}, [state]);
|
|
2474
|
-
useLayoutEffect2(() => {
|
|
2475
|
-
const styles = stylesRef.current;
|
|
2476
|
-
const wasPresent = prevPresentRef.current;
|
|
2477
|
-
const hasPresentChanged = wasPresent !== present;
|
|
2478
|
-
if (hasPresentChanged) {
|
|
2479
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
2480
|
-
const currentAnimationName = getAnimationName(styles);
|
|
2481
|
-
if (present) {
|
|
2482
|
-
send("MOUNT");
|
|
2483
|
-
} else if (currentAnimationName === "none" || (styles == null ? void 0 : styles.display) === "none") {
|
|
2484
|
-
send("UNMOUNT");
|
|
2485
|
-
} else {
|
|
2486
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
2487
|
-
if (wasPresent && isAnimating) {
|
|
2488
|
-
send("ANIMATION_OUT");
|
|
2489
|
-
} else {
|
|
2490
|
-
send("UNMOUNT");
|
|
2491
|
-
}
|
|
2492
|
-
}
|
|
2493
|
-
prevPresentRef.current = present;
|
|
2494
|
-
}
|
|
2495
|
-
}, [present, send]);
|
|
2496
|
-
useLayoutEffect2(() => {
|
|
2497
|
-
if (node) {
|
|
2498
|
-
let timeoutId;
|
|
2499
|
-
const ownerWindow = node.ownerDocument.defaultView ?? window;
|
|
2500
|
-
const handleAnimationEnd = (event) => {
|
|
2501
|
-
const currentAnimationName = getAnimationName(stylesRef.current);
|
|
2502
|
-
const isCurrentAnimation = currentAnimationName.includes(event.animationName);
|
|
2503
|
-
if (event.target === node && isCurrentAnimation) {
|
|
2504
|
-
send("ANIMATION_END");
|
|
2505
|
-
if (!prevPresentRef.current) {
|
|
2506
|
-
const currentFillMode = node.style.animationFillMode;
|
|
2507
|
-
node.style.animationFillMode = "forwards";
|
|
2508
|
-
timeoutId = ownerWindow.setTimeout(() => {
|
|
2509
|
-
if (node.style.animationFillMode === "forwards") {
|
|
2510
|
-
node.style.animationFillMode = currentFillMode;
|
|
2511
|
-
}
|
|
2512
|
-
});
|
|
2513
|
-
}
|
|
2514
|
-
}
|
|
2515
|
-
};
|
|
2516
|
-
const handleAnimationStart = (event) => {
|
|
2517
|
-
if (event.target === node) {
|
|
2518
|
-
prevAnimationNameRef.current = getAnimationName(stylesRef.current);
|
|
2519
|
-
}
|
|
2520
|
-
};
|
|
2521
|
-
node.addEventListener("animationstart", handleAnimationStart);
|
|
2522
|
-
node.addEventListener("animationcancel", handleAnimationEnd);
|
|
2523
|
-
node.addEventListener("animationend", handleAnimationEnd);
|
|
2524
|
-
return () => {
|
|
2525
|
-
ownerWindow.clearTimeout(timeoutId);
|
|
2526
|
-
node.removeEventListener("animationstart", handleAnimationStart);
|
|
2527
|
-
node.removeEventListener("animationcancel", handleAnimationEnd);
|
|
2528
|
-
node.removeEventListener("animationend", handleAnimationEnd);
|
|
2529
|
-
};
|
|
2530
|
-
} else {
|
|
2531
|
-
send("ANIMATION_END");
|
|
2532
|
-
}
|
|
2533
|
-
}, [node, send]);
|
|
2534
|
-
return {
|
|
2535
|
-
isPresent: ["mounted", "unmountSuspended"].includes(state),
|
|
2536
|
-
ref: React__namespace.useCallback((node2) => {
|
|
2537
|
-
stylesRef.current = node2 ? getComputedStyle(node2) : null;
|
|
2538
|
-
setNode(node2);
|
|
2539
|
-
}, [])
|
|
2540
|
-
};
|
|
2541
|
-
}
|
|
2542
|
-
function getAnimationName(styles) {
|
|
2543
|
-
return (styles == null ? void 0 : styles.animationName) || "none";
|
|
2544
|
-
}
|
|
2545
|
-
function getElementRef(element) {
|
|
2546
|
-
var _a2, _b;
|
|
2547
|
-
let getter = (_a2 = Object.getOwnPropertyDescriptor(element.props, "ref")) == null ? void 0 : _a2.get;
|
|
2548
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2549
|
-
if (mayWarn) {
|
|
2550
|
-
return element.ref;
|
|
2551
|
-
}
|
|
2552
|
-
getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) == null ? void 0 : _b.get;
|
|
2553
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
2554
|
-
if (mayWarn) {
|
|
2555
|
-
return element.props.ref;
|
|
2556
|
-
}
|
|
2557
|
-
return element.props.ref || element.ref;
|
|
2558
|
-
}
|
|
2559
|
-
var count = 0;
|
|
2560
|
-
function useFocusGuards() {
|
|
2561
|
-
React__namespace.useEffect(() => {
|
|
2562
|
-
const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]");
|
|
2563
|
-
document.body.insertAdjacentElement("afterbegin", edgeGuards[0] ?? createFocusGuard());
|
|
2564
|
-
document.body.insertAdjacentElement("beforeend", edgeGuards[1] ?? createFocusGuard());
|
|
2565
|
-
count++;
|
|
2566
|
-
return () => {
|
|
2567
|
-
if (count === 1) {
|
|
2568
|
-
document.querySelectorAll("[data-radix-focus-guard]").forEach((node) => node.remove());
|
|
2569
|
-
}
|
|
2570
|
-
count--;
|
|
2571
|
-
};
|
|
2572
|
-
}, []);
|
|
2573
|
-
}
|
|
2574
|
-
function createFocusGuard() {
|
|
2575
|
-
const element = document.createElement("span");
|
|
2576
|
-
element.setAttribute("data-radix-focus-guard", "");
|
|
2577
|
-
element.tabIndex = 0;
|
|
2578
|
-
element.style.outline = "none";
|
|
2579
|
-
element.style.opacity = "0";
|
|
2580
|
-
element.style.position = "fixed";
|
|
2581
|
-
element.style.pointerEvents = "none";
|
|
2582
|
-
return element;
|
|
2583
|
-
}
|
|
2584
|
-
var __assign = function() {
|
|
2585
|
-
__assign = Object.assign || function __assign2(t) {
|
|
2586
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2587
|
-
s = arguments[i];
|
|
2588
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2589
|
-
}
|
|
2590
|
-
return t;
|
|
2591
|
-
};
|
|
2592
|
-
return __assign.apply(this, arguments);
|
|
2593
|
-
};
|
|
2594
|
-
function __rest(s, e) {
|
|
2595
|
-
var t = {};
|
|
2596
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2597
|
-
t[p] = s[p];
|
|
2598
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2599
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2600
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2601
|
-
t[p[i]] = s[p[i]];
|
|
2602
|
-
}
|
|
2603
|
-
return t;
|
|
2604
|
-
}
|
|
2605
|
-
function __spreadArray(to, from, pack) {
|
|
2606
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2607
|
-
if (ar || !(i in from)) {
|
|
2608
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2609
|
-
ar[i] = from[i];
|
|
2610
|
-
}
|
|
2611
|
-
}
|
|
2612
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2613
|
-
}
|
|
2614
|
-
typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
2615
|
-
var e = new Error(message);
|
|
2616
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
2617
|
-
};
|
|
2618
|
-
var zeroRightClassName = "right-scroll-bar-position";
|
|
2619
|
-
var fullWidthClassName = "width-before-scroll-bar";
|
|
2620
|
-
var noScrollbarsClassName = "with-scroll-bars-hidden";
|
|
2621
|
-
var removedBarSizeVariable = "--removed-body-scroll-bar-size";
|
|
2622
|
-
function assignRef(ref, value) {
|
|
2623
|
-
if (typeof ref === "function") {
|
|
2624
|
-
ref(value);
|
|
2625
|
-
} else if (ref) {
|
|
2626
|
-
ref.current = value;
|
|
2627
|
-
}
|
|
2628
|
-
return ref;
|
|
2629
|
-
}
|
|
2630
|
-
function useCallbackRef(initialValue, callback) {
|
|
2631
|
-
var ref = React.useState(function() {
|
|
2632
|
-
return {
|
|
2633
|
-
// value
|
|
2634
|
-
value: initialValue,
|
|
2635
|
-
// last callback
|
|
2636
|
-
callback,
|
|
2637
|
-
// "memoized" public interface
|
|
2638
|
-
facade: {
|
|
2639
|
-
get current() {
|
|
2640
|
-
return ref.value;
|
|
2641
|
-
},
|
|
2642
|
-
set current(value) {
|
|
2643
|
-
var last = ref.value;
|
|
2644
|
-
if (last !== value) {
|
|
2645
|
-
ref.value = value;
|
|
2646
|
-
ref.callback(value, last);
|
|
2647
|
-
}
|
|
2648
|
-
}
|
|
2649
|
-
}
|
|
2650
|
-
};
|
|
2651
|
-
})[0];
|
|
2652
|
-
ref.callback = callback;
|
|
2653
|
-
return ref.facade;
|
|
2654
|
-
}
|
|
2655
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
2656
|
-
var currentValues = /* @__PURE__ */ new WeakMap();
|
|
2657
|
-
function useMergeRefs(refs, defaultValue) {
|
|
2658
|
-
var callbackRef = useCallbackRef(null, function(newValue) {
|
|
2659
|
-
return refs.forEach(function(ref) {
|
|
2660
|
-
return assignRef(ref, newValue);
|
|
2661
|
-
});
|
|
2662
|
-
});
|
|
2663
|
-
useIsomorphicLayoutEffect(function() {
|
|
2664
|
-
var oldValue = currentValues.get(callbackRef);
|
|
2665
|
-
if (oldValue) {
|
|
2666
|
-
var prevRefs_1 = new Set(oldValue);
|
|
2667
|
-
var nextRefs_1 = new Set(refs);
|
|
2668
|
-
var current_1 = callbackRef.current;
|
|
2669
|
-
prevRefs_1.forEach(function(ref) {
|
|
2670
|
-
if (!nextRefs_1.has(ref)) {
|
|
2671
|
-
assignRef(ref, null);
|
|
2672
|
-
}
|
|
2673
|
-
});
|
|
2674
|
-
nextRefs_1.forEach(function(ref) {
|
|
2675
|
-
if (!prevRefs_1.has(ref)) {
|
|
2676
|
-
assignRef(ref, current_1);
|
|
2677
|
-
}
|
|
2678
|
-
});
|
|
2679
|
-
}
|
|
2680
|
-
currentValues.set(callbackRef, refs);
|
|
2681
|
-
}, [refs]);
|
|
2682
|
-
return callbackRef;
|
|
2683
|
-
}
|
|
2684
|
-
function ItoI(a) {
|
|
2685
|
-
return a;
|
|
2686
|
-
}
|
|
2687
|
-
function innerCreateMedium(defaults, middleware) {
|
|
2688
|
-
if (middleware === void 0) {
|
|
2689
|
-
middleware = ItoI;
|
|
2690
|
-
}
|
|
2691
|
-
var buffer = [];
|
|
2692
|
-
var assigned = false;
|
|
2693
|
-
var medium = {
|
|
2694
|
-
read: function() {
|
|
2695
|
-
if (assigned) {
|
|
2696
|
-
throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");
|
|
2697
|
-
}
|
|
2698
|
-
if (buffer.length) {
|
|
2699
|
-
return buffer[buffer.length - 1];
|
|
2700
|
-
}
|
|
2701
|
-
return defaults;
|
|
2702
|
-
},
|
|
2703
|
-
useMedium: function(data) {
|
|
2704
|
-
var item = middleware(data, assigned);
|
|
2705
|
-
buffer.push(item);
|
|
2706
|
-
return function() {
|
|
2707
|
-
buffer = buffer.filter(function(x) {
|
|
2708
|
-
return x !== item;
|
|
2709
|
-
});
|
|
2710
|
-
};
|
|
2711
|
-
},
|
|
2712
|
-
assignSyncMedium: function(cb) {
|
|
2713
|
-
assigned = true;
|
|
2714
|
-
while (buffer.length) {
|
|
2715
|
-
var cbs = buffer;
|
|
2716
|
-
buffer = [];
|
|
2717
|
-
cbs.forEach(cb);
|
|
2718
|
-
}
|
|
2719
|
-
buffer = {
|
|
2720
|
-
push: function(x) {
|
|
2721
|
-
return cb(x);
|
|
2722
|
-
},
|
|
2723
|
-
filter: function() {
|
|
2724
|
-
return buffer;
|
|
2725
|
-
}
|
|
2726
|
-
};
|
|
2727
|
-
},
|
|
2728
|
-
assignMedium: function(cb) {
|
|
2729
|
-
assigned = true;
|
|
2730
|
-
var pendingQueue = [];
|
|
2731
|
-
if (buffer.length) {
|
|
2732
|
-
var cbs = buffer;
|
|
2733
|
-
buffer = [];
|
|
2734
|
-
cbs.forEach(cb);
|
|
2735
|
-
pendingQueue = buffer;
|
|
2736
|
-
}
|
|
2737
|
-
var executeQueue = function() {
|
|
2738
|
-
var cbs2 = pendingQueue;
|
|
2739
|
-
pendingQueue = [];
|
|
2740
|
-
cbs2.forEach(cb);
|
|
2741
|
-
};
|
|
2742
|
-
var cycle = function() {
|
|
2743
|
-
return Promise.resolve().then(executeQueue);
|
|
2744
|
-
};
|
|
2745
|
-
cycle();
|
|
2746
|
-
buffer = {
|
|
2747
|
-
push: function(x) {
|
|
2748
|
-
pendingQueue.push(x);
|
|
2749
|
-
cycle();
|
|
2750
|
-
},
|
|
2751
|
-
filter: function(filter) {
|
|
2752
|
-
pendingQueue = pendingQueue.filter(filter);
|
|
2753
|
-
return buffer;
|
|
2754
|
-
}
|
|
2755
|
-
};
|
|
2756
|
-
}
|
|
2757
|
-
};
|
|
2758
|
-
return medium;
|
|
2759
|
-
}
|
|
2760
|
-
function createSidecarMedium(options2) {
|
|
2761
|
-
if (options2 === void 0) {
|
|
2762
|
-
options2 = {};
|
|
2763
|
-
}
|
|
2764
|
-
var medium = innerCreateMedium(null);
|
|
2765
|
-
medium.options = __assign({ async: true, ssr: false }, options2);
|
|
2766
|
-
return medium;
|
|
2767
|
-
}
|
|
2768
|
-
var SideCar$1 = function(_a2) {
|
|
2769
|
-
var sideCar = _a2.sideCar, rest = __rest(_a2, ["sideCar"]);
|
|
2770
|
-
if (!sideCar) {
|
|
2771
|
-
throw new Error("Sidecar: please provide `sideCar` property to import the right car");
|
|
2772
|
-
}
|
|
2773
|
-
var Target = sideCar.read();
|
|
2774
|
-
if (!Target) {
|
|
2775
|
-
throw new Error("Sidecar medium not found");
|
|
2776
|
-
}
|
|
2777
|
-
return React__namespace.createElement(Target, __assign({}, rest));
|
|
2778
|
-
};
|
|
2779
|
-
SideCar$1.isSideCarExport = true;
|
|
2780
|
-
function exportSidecar(medium, exported) {
|
|
2781
|
-
medium.useMedium(exported);
|
|
2782
|
-
return SideCar$1;
|
|
2783
|
-
}
|
|
2784
|
-
var effectCar = createSidecarMedium();
|
|
2785
|
-
var nothing = function() {
|
|
2786
|
-
return;
|
|
2787
|
-
};
|
|
2788
|
-
var RemoveScroll = React__namespace.forwardRef(function(props, parentRef) {
|
|
2789
|
-
var ref = React__namespace.useRef(null);
|
|
2790
|
-
var _a2 = React__namespace.useState({
|
|
2791
|
-
onScrollCapture: nothing,
|
|
2792
|
-
onWheelCapture: nothing,
|
|
2793
|
-
onTouchMoveCapture: nothing
|
|
2794
|
-
}), callbacks = _a2[0], setCallbacks = _a2[1];
|
|
2795
|
-
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"]);
|
|
2796
|
-
var SideCar2 = sideCar;
|
|
2797
|
-
var containerRef = useMergeRefs([ref, parentRef]);
|
|
2798
|
-
var containerProps = __assign(__assign({}, rest), callbacks);
|
|
2799
|
-
return React__namespace.createElement(
|
|
2800
|
-
React__namespace.Fragment,
|
|
2801
|
-
null,
|
|
2802
|
-
enabled && React__namespace.createElement(SideCar2, { sideCar: effectCar, removeScrollBar, shards, noIsolation, inert, setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode }),
|
|
2803
|
-
forwardProps ? React__namespace.cloneElement(React__namespace.Children.only(children), __assign(__assign({}, containerProps), { ref: containerRef })) : React__namespace.createElement(Container, __assign({}, containerProps, { className, ref: containerRef }), children)
|
|
2804
|
-
);
|
|
2805
|
-
});
|
|
2806
|
-
RemoveScroll.defaultProps = {
|
|
2807
|
-
enabled: true,
|
|
2808
|
-
removeScrollBar: true,
|
|
2809
|
-
inert: false
|
|
2810
|
-
};
|
|
2811
|
-
RemoveScroll.classNames = {
|
|
2812
|
-
fullWidth: fullWidthClassName,
|
|
2813
|
-
zeroRight: zeroRightClassName
|
|
2814
|
-
};
|
|
2815
|
-
var getNonce = function() {
|
|
2816
|
-
if (typeof __webpack_nonce__ !== "undefined") {
|
|
2817
|
-
return __webpack_nonce__;
|
|
2818
|
-
}
|
|
2819
|
-
return void 0;
|
|
2820
|
-
};
|
|
2821
|
-
function makeStyleTag() {
|
|
2822
|
-
if (!document)
|
|
2823
|
-
return null;
|
|
2824
|
-
var tag = document.createElement("style");
|
|
2825
|
-
tag.type = "text/css";
|
|
2826
|
-
var nonce = getNonce();
|
|
2827
|
-
if (nonce) {
|
|
2828
|
-
tag.setAttribute("nonce", nonce);
|
|
2829
|
-
}
|
|
2830
|
-
return tag;
|
|
2831
|
-
}
|
|
2832
|
-
function injectStyles(tag, css) {
|
|
2833
|
-
if (tag.styleSheet) {
|
|
2834
|
-
tag.styleSheet.cssText = css;
|
|
2835
|
-
} else {
|
|
2836
|
-
tag.appendChild(document.createTextNode(css));
|
|
2837
|
-
}
|
|
2838
|
-
}
|
|
2839
|
-
function insertStyleTag(tag) {
|
|
2840
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
2841
|
-
head.appendChild(tag);
|
|
2842
|
-
}
|
|
2843
|
-
var stylesheetSingleton = function() {
|
|
2844
|
-
var counter = 0;
|
|
2845
|
-
var stylesheet = null;
|
|
2846
|
-
return {
|
|
2847
|
-
add: function(style) {
|
|
2848
|
-
if (counter == 0) {
|
|
2849
|
-
if (stylesheet = makeStyleTag()) {
|
|
2850
|
-
injectStyles(stylesheet, style);
|
|
2851
|
-
insertStyleTag(stylesheet);
|
|
2852
|
-
}
|
|
2853
|
-
}
|
|
2854
|
-
counter++;
|
|
2855
|
-
},
|
|
2856
|
-
remove: function() {
|
|
2857
|
-
counter--;
|
|
2858
|
-
if (!counter && stylesheet) {
|
|
2859
|
-
stylesheet.parentNode && stylesheet.parentNode.removeChild(stylesheet);
|
|
2860
|
-
stylesheet = null;
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
};
|
|
2864
|
-
};
|
|
2865
|
-
var styleHookSingleton = function() {
|
|
2866
|
-
var sheet = stylesheetSingleton();
|
|
2867
|
-
return function(styles, isDynamic) {
|
|
2868
|
-
React__namespace.useEffect(function() {
|
|
2869
|
-
sheet.add(styles);
|
|
2870
|
-
return function() {
|
|
2871
|
-
sheet.remove();
|
|
2872
|
-
};
|
|
2873
|
-
}, [styles && isDynamic]);
|
|
2874
|
-
};
|
|
2875
|
-
};
|
|
2876
|
-
var styleSingleton = function() {
|
|
2877
|
-
var useStyle = styleHookSingleton();
|
|
2878
|
-
var Sheet = function(_a2) {
|
|
2879
|
-
var styles = _a2.styles, dynamic = _a2.dynamic;
|
|
2880
|
-
useStyle(styles, dynamic);
|
|
2881
|
-
return null;
|
|
2882
|
-
};
|
|
2883
|
-
return Sheet;
|
|
2884
|
-
};
|
|
2885
|
-
var zeroGap = {
|
|
2886
|
-
left: 0,
|
|
2887
|
-
top: 0,
|
|
2888
|
-
right: 0,
|
|
2889
|
-
gap: 0
|
|
2890
|
-
};
|
|
2891
|
-
var parse = function(x) {
|
|
2892
|
-
return parseInt(x || "", 10) || 0;
|
|
2893
|
-
};
|
|
2894
|
-
var getOffset = function(gapMode) {
|
|
2895
|
-
var cs = window.getComputedStyle(document.body);
|
|
2896
|
-
var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
|
|
2897
|
-
var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
|
|
2898
|
-
var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
|
|
2899
|
-
return [parse(left), parse(top), parse(right)];
|
|
2900
|
-
};
|
|
2901
|
-
var getGapWidth = function(gapMode) {
|
|
2902
|
-
if (gapMode === void 0) {
|
|
2903
|
-
gapMode = "margin";
|
|
2904
|
-
}
|
|
2905
|
-
if (typeof window === "undefined") {
|
|
2906
|
-
return zeroGap;
|
|
2907
|
-
}
|
|
2908
|
-
var offsets = getOffset(gapMode);
|
|
2909
|
-
var documentWidth = document.documentElement.clientWidth;
|
|
2910
|
-
var windowWidth = window.innerWidth;
|
|
2911
|
-
return {
|
|
2912
|
-
left: offsets[0],
|
|
2913
|
-
top: offsets[1],
|
|
2914
|
-
right: offsets[2],
|
|
2915
|
-
gap: Math.max(0, windowWidth - documentWidth + offsets[2] - offsets[0])
|
|
2916
|
-
};
|
|
2917
|
-
};
|
|
2918
|
-
var Style = styleSingleton();
|
|
2919
|
-
var lockAttribute = "data-scroll-locked";
|
|
2920
|
-
var getStyles = function(_a2, allowRelative, gapMode, important) {
|
|
2921
|
-
var left = _a2.left, top = _a2.top, right = _a2.right, gap = _a2.gap;
|
|
2922
|
-
if (gapMode === void 0) {
|
|
2923
|
-
gapMode = "margin";
|
|
2924
|
-
}
|
|
2925
|
-
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([
|
|
2926
|
-
allowRelative && "position: relative ".concat(important, ";"),
|
|
2927
|
-
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 "),
|
|
2928
|
-
gapMode === "padding" && "padding-right: ".concat(gap, "px ").concat(important, ";")
|
|
2929
|
-
].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");
|
|
2930
|
-
};
|
|
2931
|
-
var getCurrentUseCounter = function() {
|
|
2932
|
-
var counter = parseInt(document.body.getAttribute(lockAttribute) || "0", 10);
|
|
2933
|
-
return isFinite(counter) ? counter : 0;
|
|
2934
|
-
};
|
|
2935
|
-
var useLockAttribute = function() {
|
|
2936
|
-
React__namespace.useEffect(function() {
|
|
2937
|
-
document.body.setAttribute(lockAttribute, (getCurrentUseCounter() + 1).toString());
|
|
2938
|
-
return function() {
|
|
2939
|
-
var newCounter = getCurrentUseCounter() - 1;
|
|
2940
|
-
if (newCounter <= 0) {
|
|
2941
|
-
document.body.removeAttribute(lockAttribute);
|
|
2942
|
-
} else {
|
|
2943
|
-
document.body.setAttribute(lockAttribute, newCounter.toString());
|
|
2944
|
-
}
|
|
2945
|
-
};
|
|
2946
|
-
}, []);
|
|
2947
|
-
};
|
|
2948
|
-
var RemoveScrollBar = function(_a2) {
|
|
2949
|
-
var noRelative = _a2.noRelative, noImportant = _a2.noImportant, _b = _a2.gapMode, gapMode = _b === void 0 ? "margin" : _b;
|
|
2950
|
-
useLockAttribute();
|
|
2951
|
-
var gap = React__namespace.useMemo(function() {
|
|
2952
|
-
return getGapWidth(gapMode);
|
|
2953
|
-
}, [gapMode]);
|
|
2954
|
-
return React__namespace.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? "!important" : "") });
|
|
2955
|
-
};
|
|
2956
|
-
var passiveSupported = false;
|
|
2957
|
-
if (typeof window !== "undefined") {
|
|
2958
|
-
try {
|
|
2959
|
-
var options = Object.defineProperty({}, "passive", {
|
|
2960
|
-
get: function() {
|
|
2961
|
-
passiveSupported = true;
|
|
2962
|
-
return true;
|
|
2963
|
-
}
|
|
2964
|
-
});
|
|
2965
|
-
window.addEventListener("test", options, options);
|
|
2966
|
-
window.removeEventListener("test", options, options);
|
|
2967
|
-
} catch (err) {
|
|
2968
|
-
passiveSupported = false;
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
var nonPassive = passiveSupported ? { passive: false } : false;
|
|
2972
|
-
var alwaysContainsScroll = function(node) {
|
|
2973
|
-
return node.tagName === "TEXTAREA";
|
|
2974
|
-
};
|
|
2975
|
-
var elementCanBeScrolled = function(node, overflow) {
|
|
2976
|
-
if (!(node instanceof Element)) {
|
|
2977
|
-
return false;
|
|
2978
|
-
}
|
|
2979
|
-
var styles = window.getComputedStyle(node);
|
|
2980
|
-
return (
|
|
2981
|
-
// not-not-scrollable
|
|
2982
|
-
styles[overflow] !== "hidden" && // contains scroll inside self
|
|
2983
|
-
!(styles.overflowY === styles.overflowX && !alwaysContainsScroll(node) && styles[overflow] === "visible")
|
|
2984
|
-
);
|
|
2985
|
-
};
|
|
2986
|
-
var elementCouldBeVScrolled = function(node) {
|
|
2987
|
-
return elementCanBeScrolled(node, "overflowY");
|
|
2988
|
-
};
|
|
2989
|
-
var elementCouldBeHScrolled = function(node) {
|
|
2990
|
-
return elementCanBeScrolled(node, "overflowX");
|
|
2991
|
-
};
|
|
2992
|
-
var locationCouldBeScrolled = function(axis, node) {
|
|
2993
|
-
var ownerDocument = node.ownerDocument;
|
|
2994
|
-
var current = node;
|
|
2995
|
-
do {
|
|
2996
|
-
if (typeof ShadowRoot !== "undefined" && current instanceof ShadowRoot) {
|
|
2997
|
-
current = current.host;
|
|
2998
|
-
}
|
|
2999
|
-
var isScrollable = elementCouldBeScrolled(axis, current);
|
|
3000
|
-
if (isScrollable) {
|
|
3001
|
-
var _a2 = getScrollVariables(axis, current), scrollHeight = _a2[1], clientHeight = _a2[2];
|
|
3002
|
-
if (scrollHeight > clientHeight) {
|
|
3003
|
-
return true;
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
current = current.parentNode;
|
|
3007
|
-
} while (current && current !== ownerDocument.body);
|
|
3008
|
-
return false;
|
|
3009
|
-
};
|
|
3010
|
-
var getVScrollVariables = function(_a2) {
|
|
3011
|
-
var scrollTop = _a2.scrollTop, scrollHeight = _a2.scrollHeight, clientHeight = _a2.clientHeight;
|
|
3012
|
-
return [
|
|
3013
|
-
scrollTop,
|
|
3014
|
-
scrollHeight,
|
|
3015
|
-
clientHeight
|
|
3016
|
-
];
|
|
3017
|
-
};
|
|
3018
|
-
var getHScrollVariables = function(_a2) {
|
|
3019
|
-
var scrollLeft = _a2.scrollLeft, scrollWidth = _a2.scrollWidth, clientWidth = _a2.clientWidth;
|
|
3020
|
-
return [
|
|
3021
|
-
scrollLeft,
|
|
3022
|
-
scrollWidth,
|
|
3023
|
-
clientWidth
|
|
3024
|
-
];
|
|
3025
|
-
};
|
|
3026
|
-
var elementCouldBeScrolled = function(axis, node) {
|
|
3027
|
-
return axis === "v" ? elementCouldBeVScrolled(node) : elementCouldBeHScrolled(node);
|
|
3028
|
-
};
|
|
3029
|
-
var getScrollVariables = function(axis, node) {
|
|
3030
|
-
return axis === "v" ? getVScrollVariables(node) : getHScrollVariables(node);
|
|
3031
|
-
};
|
|
3032
|
-
var getDirectionFactor = function(axis, direction) {
|
|
3033
|
-
return axis === "h" && direction === "rtl" ? -1 : 1;
|
|
3034
|
-
};
|
|
3035
|
-
var handleScroll = function(axis, endTarget, event, sourceDelta, noOverscroll) {
|
|
3036
|
-
var directionFactor = getDirectionFactor(axis, window.getComputedStyle(endTarget).direction);
|
|
3037
|
-
var delta = directionFactor * sourceDelta;
|
|
3038
|
-
var target = event.target;
|
|
3039
|
-
var targetInLock = endTarget.contains(target);
|
|
3040
|
-
var shouldCancelScroll = false;
|
|
3041
|
-
var isDeltaPositive = delta > 0;
|
|
3042
|
-
var availableScroll = 0;
|
|
3043
|
-
var availableScrollTop = 0;
|
|
3044
|
-
do {
|
|
3045
|
-
var _a2 = getScrollVariables(axis, target), position = _a2[0], scroll_1 = _a2[1], capacity = _a2[2];
|
|
3046
|
-
var elementScroll = scroll_1 - capacity - directionFactor * position;
|
|
3047
|
-
if (position || elementScroll) {
|
|
3048
|
-
if (elementCouldBeScrolled(axis, target)) {
|
|
3049
|
-
availableScroll += elementScroll;
|
|
3050
|
-
availableScrollTop += position;
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3053
|
-
if (target instanceof ShadowRoot) {
|
|
3054
|
-
target = target.host;
|
|
3055
|
-
} else {
|
|
3056
|
-
target = target.parentNode;
|
|
3057
|
-
}
|
|
3058
|
-
} while (
|
|
3059
|
-
// portaled content
|
|
3060
|
-
!targetInLock && target !== document.body || // self content
|
|
3061
|
-
targetInLock && (endTarget.contains(target) || endTarget === target)
|
|
3062
|
-
);
|
|
3063
|
-
if (isDeltaPositive && (Math.abs(availableScroll) < 1 || false)) {
|
|
3064
|
-
shouldCancelScroll = true;
|
|
3065
|
-
} else if (!isDeltaPositive && (Math.abs(availableScrollTop) < 1 || false)) {
|
|
3066
|
-
shouldCancelScroll = true;
|
|
3067
|
-
}
|
|
3068
|
-
return shouldCancelScroll;
|
|
3069
|
-
};
|
|
3070
|
-
var getTouchXY = function(event) {
|
|
3071
|
-
return "changedTouches" in event ? [event.changedTouches[0].clientX, event.changedTouches[0].clientY] : [0, 0];
|
|
3072
|
-
};
|
|
3073
|
-
var getDeltaXY = function(event) {
|
|
3074
|
-
return [event.deltaX, event.deltaY];
|
|
3075
|
-
};
|
|
3076
|
-
var extractRef = function(ref) {
|
|
3077
|
-
return ref && "current" in ref ? ref.current : ref;
|
|
3078
|
-
};
|
|
3079
|
-
var deltaCompare = function(x, y) {
|
|
3080
|
-
return x[0] === y[0] && x[1] === y[1];
|
|
3081
|
-
};
|
|
3082
|
-
var generateStyle = function(id) {
|
|
3083
|
-
return "\n .block-interactivity-".concat(id, " {pointer-events: none;}\n .allow-interactivity-").concat(id, " {pointer-events: all;}\n");
|
|
3084
|
-
};
|
|
3085
|
-
var idCounter = 0;
|
|
3086
|
-
var lockStack = [];
|
|
3087
|
-
function RemoveScrollSideCar(props) {
|
|
3088
|
-
var shouldPreventQueue = React__namespace.useRef([]);
|
|
3089
|
-
var touchStartRef = React__namespace.useRef([0, 0]);
|
|
3090
|
-
var activeAxis = React__namespace.useRef();
|
|
3091
|
-
var id = React__namespace.useState(idCounter++)[0];
|
|
3092
|
-
var Style2 = React__namespace.useState(styleSingleton)[0];
|
|
3093
|
-
var lastProps = React__namespace.useRef(props);
|
|
3094
|
-
React__namespace.useEffect(function() {
|
|
3095
|
-
lastProps.current = props;
|
|
3096
|
-
}, [props]);
|
|
3097
|
-
React__namespace.useEffect(function() {
|
|
3098
|
-
if (props.inert) {
|
|
3099
|
-
document.body.classList.add("block-interactivity-".concat(id));
|
|
3100
|
-
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
3101
|
-
allow_1.forEach(function(el) {
|
|
3102
|
-
return el.classList.add("allow-interactivity-".concat(id));
|
|
3103
|
-
});
|
|
3104
|
-
return function() {
|
|
3105
|
-
document.body.classList.remove("block-interactivity-".concat(id));
|
|
3106
|
-
allow_1.forEach(function(el) {
|
|
3107
|
-
return el.classList.remove("allow-interactivity-".concat(id));
|
|
3108
|
-
});
|
|
3109
|
-
};
|
|
3110
|
-
}
|
|
3111
|
-
return;
|
|
3112
|
-
}, [props.inert, props.lockRef.current, props.shards]);
|
|
3113
|
-
var shouldCancelEvent = React__namespace.useCallback(function(event, parent) {
|
|
3114
|
-
if ("touches" in event && event.touches.length === 2 || event.type === "wheel" && event.ctrlKey) {
|
|
3115
|
-
return !lastProps.current.allowPinchZoom;
|
|
3116
|
-
}
|
|
3117
|
-
var touch = getTouchXY(event);
|
|
3118
|
-
var touchStart = touchStartRef.current;
|
|
3119
|
-
var deltaX = "deltaX" in event ? event.deltaX : touchStart[0] - touch[0];
|
|
3120
|
-
var deltaY = "deltaY" in event ? event.deltaY : touchStart[1] - touch[1];
|
|
3121
|
-
var currentAxis;
|
|
3122
|
-
var target = event.target;
|
|
3123
|
-
var moveDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "h" : "v";
|
|
3124
|
-
if ("touches" in event && moveDirection === "h" && target.type === "range") {
|
|
3125
|
-
return false;
|
|
3126
|
-
}
|
|
3127
|
-
var canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3128
|
-
if (!canBeScrolledInMainDirection) {
|
|
3129
|
-
return true;
|
|
3130
|
-
}
|
|
3131
|
-
if (canBeScrolledInMainDirection) {
|
|
3132
|
-
currentAxis = moveDirection;
|
|
3133
|
-
} else {
|
|
3134
|
-
currentAxis = moveDirection === "v" ? "h" : "v";
|
|
3135
|
-
canBeScrolledInMainDirection = locationCouldBeScrolled(moveDirection, target);
|
|
3136
|
-
}
|
|
3137
|
-
if (!canBeScrolledInMainDirection) {
|
|
3138
|
-
return false;
|
|
3139
|
-
}
|
|
3140
|
-
if (!activeAxis.current && "changedTouches" in event && (deltaX || deltaY)) {
|
|
3141
|
-
activeAxis.current = currentAxis;
|
|
3142
|
-
}
|
|
3143
|
-
if (!currentAxis) {
|
|
3144
|
-
return true;
|
|
3145
|
-
}
|
|
3146
|
-
var cancelingAxis = activeAxis.current || currentAxis;
|
|
3147
|
-
return handleScroll(cancelingAxis, parent, event, cancelingAxis === "h" ? deltaX : deltaY);
|
|
3148
|
-
}, []);
|
|
3149
|
-
var shouldPrevent = React__namespace.useCallback(function(_event) {
|
|
3150
|
-
var event = _event;
|
|
3151
|
-
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style2) {
|
|
3152
|
-
return;
|
|
3153
|
-
}
|
|
3154
|
-
var delta = "deltaY" in event ? getDeltaXY(event) : getTouchXY(event);
|
|
3155
|
-
var sourceEvent = shouldPreventQueue.current.filter(function(e) {
|
|
3156
|
-
return e.name === event.type && (e.target === event.target || event.target === e.shadowParent) && deltaCompare(e.delta, delta);
|
|
3157
|
-
})[0];
|
|
3158
|
-
if (sourceEvent && sourceEvent.should) {
|
|
3159
|
-
if (event.cancelable) {
|
|
3160
|
-
event.preventDefault();
|
|
3161
|
-
}
|
|
3162
|
-
return;
|
|
3163
|
-
}
|
|
3164
|
-
if (!sourceEvent) {
|
|
3165
|
-
var shardNodes = (lastProps.current.shards || []).map(extractRef).filter(Boolean).filter(function(node) {
|
|
3166
|
-
return node.contains(event.target);
|
|
3167
|
-
});
|
|
3168
|
-
var shouldStop = shardNodes.length > 0 ? shouldCancelEvent(event, shardNodes[0]) : !lastProps.current.noIsolation;
|
|
3169
|
-
if (shouldStop) {
|
|
3170
|
-
if (event.cancelable) {
|
|
3171
|
-
event.preventDefault();
|
|
3172
|
-
}
|
|
3173
|
-
}
|
|
3174
|
-
}
|
|
3175
|
-
}, []);
|
|
3176
|
-
var shouldCancel = React__namespace.useCallback(function(name, delta, target, should) {
|
|
3177
|
-
var event = { name, delta, target, should, shadowParent: getOutermostShadowParent(target) };
|
|
3178
|
-
shouldPreventQueue.current.push(event);
|
|
3179
|
-
setTimeout(function() {
|
|
3180
|
-
shouldPreventQueue.current = shouldPreventQueue.current.filter(function(e) {
|
|
3181
|
-
return e !== event;
|
|
3182
|
-
});
|
|
3183
|
-
}, 1);
|
|
3184
|
-
}, []);
|
|
3185
|
-
var scrollTouchStart = React__namespace.useCallback(function(event) {
|
|
3186
|
-
touchStartRef.current = getTouchXY(event);
|
|
3187
|
-
activeAxis.current = void 0;
|
|
3188
|
-
}, []);
|
|
3189
|
-
var scrollWheel = React__namespace.useCallback(function(event) {
|
|
3190
|
-
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3191
|
-
}, []);
|
|
3192
|
-
var scrollTouchMove = React__namespace.useCallback(function(event) {
|
|
3193
|
-
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
3194
|
-
}, []);
|
|
3195
|
-
React__namespace.useEffect(function() {
|
|
3196
|
-
lockStack.push(Style2);
|
|
3197
|
-
props.setCallbacks({
|
|
3198
|
-
onScrollCapture: scrollWheel,
|
|
3199
|
-
onWheelCapture: scrollWheel,
|
|
3200
|
-
onTouchMoveCapture: scrollTouchMove
|
|
3201
|
-
});
|
|
3202
|
-
document.addEventListener("wheel", shouldPrevent, nonPassive);
|
|
3203
|
-
document.addEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3204
|
-
document.addEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3205
|
-
return function() {
|
|
3206
|
-
lockStack = lockStack.filter(function(inst) {
|
|
3207
|
-
return inst !== Style2;
|
|
3208
|
-
});
|
|
3209
|
-
document.removeEventListener("wheel", shouldPrevent, nonPassive);
|
|
3210
|
-
document.removeEventListener("touchmove", shouldPrevent, nonPassive);
|
|
3211
|
-
document.removeEventListener("touchstart", scrollTouchStart, nonPassive);
|
|
3212
|
-
};
|
|
3213
|
-
}, []);
|
|
3214
|
-
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
3215
|
-
return React__namespace.createElement(
|
|
3216
|
-
React__namespace.Fragment,
|
|
3217
|
-
null,
|
|
3218
|
-
inert ? React__namespace.createElement(Style2, { styles: generateStyle(id) }) : null,
|
|
3219
|
-
removeScrollBar ? React__namespace.createElement(RemoveScrollBar, { gapMode: props.gapMode }) : null
|
|
3220
|
-
);
|
|
3221
|
-
}
|
|
3222
|
-
function getOutermostShadowParent(node) {
|
|
3223
|
-
var shadowParent = null;
|
|
3224
|
-
while (node !== null) {
|
|
3225
|
-
if (node instanceof ShadowRoot) {
|
|
3226
|
-
shadowParent = node.host;
|
|
3227
|
-
node = node.host;
|
|
3228
|
-
}
|
|
3229
|
-
node = node.parentNode;
|
|
3230
|
-
}
|
|
3231
|
-
return shadowParent;
|
|
3232
|
-
}
|
|
3233
|
-
const SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
3234
|
-
var ReactRemoveScroll = React__namespace.forwardRef(function(props, ref) {
|
|
3235
|
-
return React__namespace.createElement(RemoveScroll, __assign({}, props, { ref, sideCar: SideCar }));
|
|
3236
|
-
});
|
|
3237
|
-
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
3238
|
-
var getDefaultParent = function(originalTarget) {
|
|
3239
|
-
if (typeof document === "undefined") {
|
|
3240
|
-
return null;
|
|
3241
|
-
}
|
|
3242
|
-
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
3243
|
-
return sampleTarget.ownerDocument.body;
|
|
3244
|
-
};
|
|
3245
|
-
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
3246
|
-
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3247
|
-
var markerMap = {};
|
|
3248
|
-
var lockCount = 0;
|
|
3249
|
-
var unwrapHost = function(node) {
|
|
3250
|
-
return node && (node.host || unwrapHost(node.parentNode));
|
|
3251
|
-
};
|
|
3252
|
-
var correctTargets = function(parent, targets) {
|
|
3253
|
-
return targets.map(function(target) {
|
|
3254
|
-
if (parent.contains(target)) {
|
|
3255
|
-
return target;
|
|
3256
|
-
}
|
|
3257
|
-
var correctedTarget = unwrapHost(target);
|
|
3258
|
-
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
3259
|
-
return correctedTarget;
|
|
3260
|
-
}
|
|
3261
|
-
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
3262
|
-
return null;
|
|
3263
|
-
}).filter(function(x) {
|
|
3264
|
-
return Boolean(x);
|
|
3265
|
-
});
|
|
3266
|
-
};
|
|
3267
|
-
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
3268
|
-
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3269
|
-
if (!markerMap[markerName]) {
|
|
3270
|
-
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
3271
|
-
}
|
|
3272
|
-
var markerCounter = markerMap[markerName];
|
|
3273
|
-
var hiddenNodes = [];
|
|
3274
|
-
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
3275
|
-
var elementsToStop = new Set(targets);
|
|
3276
|
-
var keep = function(el) {
|
|
3277
|
-
if (!el || elementsToKeep.has(el)) {
|
|
3278
|
-
return;
|
|
3279
|
-
}
|
|
3280
|
-
elementsToKeep.add(el);
|
|
3281
|
-
keep(el.parentNode);
|
|
3282
|
-
};
|
|
3283
|
-
targets.forEach(keep);
|
|
3284
|
-
var deep = function(parent) {
|
|
3285
|
-
if (!parent || elementsToStop.has(parent)) {
|
|
3286
|
-
return;
|
|
3287
|
-
}
|
|
3288
|
-
Array.prototype.forEach.call(parent.children, function(node) {
|
|
3289
|
-
if (elementsToKeep.has(node)) {
|
|
3290
|
-
deep(node);
|
|
3291
|
-
} else {
|
|
3292
|
-
try {
|
|
3293
|
-
var attr = node.getAttribute(controlAttribute);
|
|
3294
|
-
var alreadyHidden = attr !== null && attr !== "false";
|
|
3295
|
-
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
3296
|
-
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
3297
|
-
counterMap.set(node, counterValue);
|
|
3298
|
-
markerCounter.set(node, markerValue);
|
|
3299
|
-
hiddenNodes.push(node);
|
|
3300
|
-
if (counterValue === 1 && alreadyHidden) {
|
|
3301
|
-
uncontrolledNodes.set(node, true);
|
|
3302
|
-
}
|
|
3303
|
-
if (markerValue === 1) {
|
|
3304
|
-
node.setAttribute(markerName, "true");
|
|
3305
|
-
}
|
|
3306
|
-
if (!alreadyHidden) {
|
|
3307
|
-
node.setAttribute(controlAttribute, "true");
|
|
3308
|
-
}
|
|
3309
|
-
} catch (e) {
|
|
3310
|
-
console.error("aria-hidden: cannot operate on ", node, e);
|
|
3311
|
-
}
|
|
3312
|
-
}
|
|
3313
|
-
});
|
|
3314
|
-
};
|
|
3315
|
-
deep(parentNode);
|
|
3316
|
-
elementsToKeep.clear();
|
|
3317
|
-
lockCount++;
|
|
3318
|
-
return function() {
|
|
3319
|
-
hiddenNodes.forEach(function(node) {
|
|
3320
|
-
var counterValue = counterMap.get(node) - 1;
|
|
3321
|
-
var markerValue = markerCounter.get(node) - 1;
|
|
3322
|
-
counterMap.set(node, counterValue);
|
|
3323
|
-
markerCounter.set(node, markerValue);
|
|
3324
|
-
if (!counterValue) {
|
|
3325
|
-
if (!uncontrolledNodes.has(node)) {
|
|
3326
|
-
node.removeAttribute(controlAttribute);
|
|
3327
|
-
}
|
|
3328
|
-
uncontrolledNodes.delete(node);
|
|
3329
|
-
}
|
|
3330
|
-
if (!markerValue) {
|
|
3331
|
-
node.removeAttribute(markerName);
|
|
3332
|
-
}
|
|
3333
|
-
});
|
|
3334
|
-
lockCount--;
|
|
3335
|
-
if (!lockCount) {
|
|
3336
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3337
|
-
counterMap = /* @__PURE__ */ new WeakMap();
|
|
3338
|
-
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
3339
|
-
markerMap = {};
|
|
3340
|
-
}
|
|
3341
|
-
};
|
|
3342
|
-
};
|
|
3343
|
-
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
3344
|
-
if (markerName === void 0) {
|
|
3345
|
-
markerName = "data-aria-hidden";
|
|
3346
|
-
}
|
|
3347
|
-
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
3348
|
-
var activeParentNode = getDefaultParent(originalTarget);
|
|
3349
|
-
if (!activeParentNode) {
|
|
3350
|
-
return function() {
|
|
3351
|
-
return null;
|
|
3352
|
-
};
|
|
3353
|
-
}
|
|
3354
|
-
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live]")));
|
|
3355
|
-
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
3356
|
-
};
|
|
3357
|
-
var DIALOG_NAME = "Dialog";
|
|
3358
|
-
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
3359
|
-
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
3360
|
-
var TRIGGER_NAME = "DialogTrigger";
|
|
3361
|
-
var DialogTrigger = React__namespace.forwardRef(
|
|
3362
|
-
(props, forwardedRef) => {
|
|
3363
|
-
const { __scopeDialog, ...triggerProps } = props;
|
|
3364
|
-
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
3365
|
-
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
3366
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3367
|
-
Primitive.button,
|
|
3368
|
-
{
|
|
3369
|
-
type: "button",
|
|
3370
|
-
"aria-haspopup": "dialog",
|
|
3371
|
-
"aria-expanded": context.open,
|
|
3372
|
-
"aria-controls": context.contentId,
|
|
3373
|
-
"data-state": getState(context.open),
|
|
3374
|
-
...triggerProps,
|
|
3375
|
-
ref: composedTriggerRef,
|
|
3376
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
3377
|
-
}
|
|
3378
|
-
);
|
|
3379
|
-
}
|
|
3380
|
-
);
|
|
3381
|
-
DialogTrigger.displayName = TRIGGER_NAME;
|
|
3382
|
-
var PORTAL_NAME = "DialogPortal";
|
|
3383
|
-
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, {
|
|
3384
|
-
forceMount: void 0
|
|
3385
|
-
});
|
|
3386
|
-
var OVERLAY_NAME = "DialogOverlay";
|
|
3387
|
-
var DialogOverlay = React__namespace.forwardRef(
|
|
3388
|
-
(props, forwardedRef) => {
|
|
3389
|
-
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
3390
|
-
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
3391
|
-
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
3392
|
-
return context.modal ? /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntime.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
|
|
3393
|
-
}
|
|
3394
|
-
);
|
|
3395
|
-
DialogOverlay.displayName = OVERLAY_NAME;
|
|
3396
|
-
var Slot = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll");
|
|
3397
|
-
var DialogOverlayImpl = React__namespace.forwardRef(
|
|
3398
|
-
(props, forwardedRef) => {
|
|
3399
|
-
const { __scopeDialog, ...overlayProps } = props;
|
|
3400
|
-
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
3401
|
-
return (
|
|
3402
|
-
// Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
|
|
3403
|
-
// ie. when `Overlay` and `Content` are siblings
|
|
3404
|
-
/* @__PURE__ */ jsxRuntime.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3405
|
-
Primitive.div,
|
|
3406
|
-
{
|
|
3407
|
-
"data-state": getState(context.open),
|
|
3408
|
-
...overlayProps,
|
|
3409
|
-
ref: forwardedRef,
|
|
3410
|
-
style: { pointerEvents: "auto", ...overlayProps.style }
|
|
3411
|
-
}
|
|
3412
|
-
) })
|
|
3413
|
-
);
|
|
3414
|
-
}
|
|
3415
|
-
);
|
|
3416
|
-
var CONTENT_NAME = "DialogContent";
|
|
3417
|
-
var DialogContent = React__namespace.forwardRef(
|
|
3418
|
-
(props, forwardedRef) => {
|
|
3419
|
-
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
3420
|
-
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
3421
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
3422
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntime.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntime.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
|
|
3423
|
-
}
|
|
3424
|
-
);
|
|
3425
|
-
DialogContent.displayName = CONTENT_NAME;
|
|
3426
|
-
var DialogContentModal = React__namespace.forwardRef(
|
|
3427
|
-
(props, forwardedRef) => {
|
|
3428
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
3429
|
-
const contentRef = React__namespace.useRef(null);
|
|
3430
|
-
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
3431
|
-
React__namespace.useEffect(() => {
|
|
3432
|
-
const content = contentRef.current;
|
|
3433
|
-
if (content) return hideOthers(content);
|
|
3434
|
-
}, []);
|
|
3435
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3436
|
-
DialogContentImpl,
|
|
3437
|
-
{
|
|
3438
|
-
...props,
|
|
3439
|
-
ref: composedRefs,
|
|
3440
|
-
trapFocus: context.open,
|
|
3441
|
-
disableOutsidePointerEvents: true,
|
|
3442
|
-
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
3443
|
-
var _a2;
|
|
3444
|
-
event.preventDefault();
|
|
3445
|
-
(_a2 = context.triggerRef.current) == null ? void 0 : _a2.focus();
|
|
3446
|
-
}),
|
|
3447
|
-
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
3448
|
-
const originalEvent = event.detail.originalEvent;
|
|
3449
|
-
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
3450
|
-
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
|
|
3451
|
-
if (isRightClick) event.preventDefault();
|
|
3452
|
-
}),
|
|
3453
|
-
onFocusOutside: composeEventHandlers(
|
|
3454
|
-
props.onFocusOutside,
|
|
3455
|
-
(event) => event.preventDefault()
|
|
3456
|
-
)
|
|
3457
|
-
}
|
|
3458
|
-
);
|
|
3459
|
-
}
|
|
3460
|
-
);
|
|
3461
|
-
var DialogContentNonModal = React__namespace.forwardRef(
|
|
3462
|
-
(props, forwardedRef) => {
|
|
3463
|
-
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
3464
|
-
const hasInteractedOutsideRef = React__namespace.useRef(false);
|
|
3465
|
-
const hasPointerDownOutsideRef = React__namespace.useRef(false);
|
|
3466
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3467
|
-
DialogContentImpl,
|
|
3468
|
-
{
|
|
3469
|
-
...props,
|
|
3470
|
-
ref: forwardedRef,
|
|
3471
|
-
trapFocus: false,
|
|
3472
|
-
disableOutsidePointerEvents: false,
|
|
3473
|
-
onCloseAutoFocus: (event) => {
|
|
3474
|
-
var _a2, _b;
|
|
3475
|
-
(_a2 = props.onCloseAutoFocus) == null ? void 0 : _a2.call(props, event);
|
|
3476
|
-
if (!event.defaultPrevented) {
|
|
3477
|
-
if (!hasInteractedOutsideRef.current) (_b = context.triggerRef.current) == null ? void 0 : _b.focus();
|
|
3478
|
-
event.preventDefault();
|
|
3479
|
-
}
|
|
3480
|
-
hasInteractedOutsideRef.current = false;
|
|
3481
|
-
hasPointerDownOutsideRef.current = false;
|
|
3482
|
-
},
|
|
3483
|
-
onInteractOutside: (event) => {
|
|
3484
|
-
var _a2, _b;
|
|
3485
|
-
(_a2 = props.onInteractOutside) == null ? void 0 : _a2.call(props, event);
|
|
3486
|
-
if (!event.defaultPrevented) {
|
|
3487
|
-
hasInteractedOutsideRef.current = true;
|
|
3488
|
-
if (event.detail.originalEvent.type === "pointerdown") {
|
|
3489
|
-
hasPointerDownOutsideRef.current = true;
|
|
3490
|
-
}
|
|
3491
|
-
}
|
|
3492
|
-
const target = event.target;
|
|
3493
|
-
const targetIsTrigger = (_b = context.triggerRef.current) == null ? void 0 : _b.contains(target);
|
|
3494
|
-
if (targetIsTrigger) event.preventDefault();
|
|
3495
|
-
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
|
|
3496
|
-
event.preventDefault();
|
|
3497
|
-
}
|
|
3498
|
-
}
|
|
3499
|
-
}
|
|
3500
|
-
);
|
|
3501
|
-
}
|
|
3502
|
-
);
|
|
3503
|
-
var DialogContentImpl = React__namespace.forwardRef(
|
|
3504
|
-
(props, forwardedRef) => {
|
|
3505
|
-
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
|
|
3506
|
-
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
3507
|
-
const contentRef = React__namespace.useRef(null);
|
|
3508
|
-
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
3509
|
-
useFocusGuards();
|
|
3510
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3511
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3512
|
-
FocusScope,
|
|
3513
|
-
{
|
|
3514
|
-
asChild: true,
|
|
3515
|
-
loop: true,
|
|
3516
|
-
trapped: trapFocus,
|
|
3517
|
-
onMountAutoFocus: onOpenAutoFocus,
|
|
3518
|
-
onUnmountAutoFocus: onCloseAutoFocus,
|
|
3519
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3520
|
-
DismissableLayer,
|
|
3521
|
-
{
|
|
3522
|
-
role: "dialog",
|
|
3523
|
-
id: context.contentId,
|
|
3524
|
-
"aria-describedby": context.descriptionId,
|
|
3525
|
-
"aria-labelledby": context.titleId,
|
|
3526
|
-
"data-state": getState(context.open),
|
|
3527
|
-
...contentProps,
|
|
3528
|
-
ref: composedRefs,
|
|
3529
|
-
onDismiss: () => context.onOpenChange(false)
|
|
3530
|
-
}
|
|
3531
|
-
)
|
|
3532
|
-
}
|
|
3533
|
-
),
|
|
3534
|
-
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3535
|
-
/* @__PURE__ */ jsxRuntime.jsx(TitleWarning, { titleId: context.titleId }),
|
|
3536
|
-
/* @__PURE__ */ jsxRuntime.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
|
|
3537
|
-
] })
|
|
3538
|
-
] });
|
|
3539
|
-
}
|
|
3540
|
-
);
|
|
3541
|
-
var TITLE_NAME = "DialogTitle";
|
|
3542
|
-
var DialogTitle = React__namespace.forwardRef(
|
|
3543
|
-
(props, forwardedRef) => {
|
|
3544
|
-
const { __scopeDialog, ...titleProps } = props;
|
|
3545
|
-
const context = useDialogContext(TITLE_NAME, __scopeDialog);
|
|
3546
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
|
|
3547
|
-
}
|
|
3548
|
-
);
|
|
3549
|
-
DialogTitle.displayName = TITLE_NAME;
|
|
3550
|
-
var DESCRIPTION_NAME = "DialogDescription";
|
|
3551
|
-
var DialogDescription = React__namespace.forwardRef(
|
|
3552
|
-
(props, forwardedRef) => {
|
|
3553
|
-
const { __scopeDialog, ...descriptionProps } = props;
|
|
3554
|
-
const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
|
|
3555
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
|
|
3556
|
-
}
|
|
3557
|
-
);
|
|
3558
|
-
DialogDescription.displayName = DESCRIPTION_NAME;
|
|
3559
|
-
var CLOSE_NAME = "DialogClose";
|
|
3560
|
-
var DialogClose = React__namespace.forwardRef(
|
|
3561
|
-
(props, forwardedRef) => {
|
|
3562
|
-
const { __scopeDialog, ...closeProps } = props;
|
|
3563
|
-
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
3564
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3565
|
-
Primitive.button,
|
|
3566
|
-
{
|
|
3567
|
-
type: "button",
|
|
3568
|
-
...closeProps,
|
|
3569
|
-
ref: forwardedRef,
|
|
3570
|
-
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
3571
|
-
}
|
|
3572
|
-
);
|
|
3573
|
-
}
|
|
3574
|
-
);
|
|
3575
|
-
DialogClose.displayName = CLOSE_NAME;
|
|
3576
|
-
function getState(open) {
|
|
3577
|
-
return open ? "open" : "closed";
|
|
3578
|
-
}
|
|
3579
|
-
var TITLE_WARNING_NAME = "DialogTitleWarning";
|
|
3580
|
-
var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
3581
|
-
contentName: CONTENT_NAME,
|
|
3582
|
-
titleName: TITLE_NAME,
|
|
3583
|
-
docsSlug: "dialog"
|
|
1757
|
+
const ScannerContext = React.createContext(() => {
|
|
1758
|
+
throw new Error("No ScannerProvider found");
|
|
3584
1759
|
});
|
|
3585
|
-
|
|
3586
|
-
const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
|
|
3587
|
-
const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
|
|
3588
|
-
|
|
3589
|
-
If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
3590
|
-
|
|
3591
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
|
|
3592
|
-
React__namespace.useEffect(() => {
|
|
3593
|
-
if (titleId) {
|
|
3594
|
-
const hasTitle = document.getElementById(titleId);
|
|
3595
|
-
if (!hasTitle) console.error(MESSAGE);
|
|
3596
|
-
}
|
|
3597
|
-
}, [MESSAGE, titleId]);
|
|
3598
|
-
return null;
|
|
3599
|
-
};
|
|
3600
|
-
var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
|
|
3601
|
-
var DescriptionWarning = ({ contentRef, descriptionId }) => {
|
|
3602
|
-
const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
|
|
3603
|
-
const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
|
|
3604
|
-
React__namespace.useEffect(() => {
|
|
3605
|
-
var _a2;
|
|
3606
|
-
const describedById = (_a2 = contentRef.current) == null ? void 0 : _a2.getAttribute("aria-describedby");
|
|
3607
|
-
if (descriptionId && describedById) {
|
|
3608
|
-
const hasDescription = document.getElementById(descriptionId);
|
|
3609
|
-
if (!hasDescription) console.warn(MESSAGE);
|
|
3610
|
-
}
|
|
3611
|
-
}, [MESSAGE, contentRef, descriptionId]);
|
|
3612
|
-
return null;
|
|
3613
|
-
};
|
|
3614
|
-
var Close = DialogClose;
|
|
1760
|
+
const useScanner = () => React.use(ScannerContext);
|
|
3615
1761
|
function fixProto(target, prototype) {
|
|
3616
1762
|
var setPrototypeOf = Object.setPrototypeOf;
|
|
3617
1763
|
setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
|
|
@@ -3647,9 +1793,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
3647
1793
|
}();
|
|
3648
1794
|
var CustomError = function(_super) {
|
|
3649
1795
|
__extends$19(CustomError2, _super);
|
|
3650
|
-
function CustomError2(message,
|
|
1796
|
+
function CustomError2(message, options) {
|
|
3651
1797
|
var _newTarget = this.constructor;
|
|
3652
|
-
var _this = _super.call(this, message,
|
|
1798
|
+
var _this = _super.call(this, message, options) || this;
|
|
3653
1799
|
Object.defineProperty(_this, "name", {
|
|
3654
1800
|
value: _newTarget.name,
|
|
3655
1801
|
enumerable: false,
|
|
@@ -7884,12 +6030,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
7884
6030
|
);
|
|
7885
6031
|
};
|
|
7886
6032
|
MathUtils2.sum = function(array) {
|
|
7887
|
-
var
|
|
6033
|
+
var count = 0;
|
|
7888
6034
|
for (var i = 0, length_1 = array.length; i !== length_1; i++) {
|
|
7889
6035
|
var a = array[i];
|
|
7890
|
-
|
|
6036
|
+
count += a;
|
|
7891
6037
|
}
|
|
7892
|
-
return
|
|
6038
|
+
return count;
|
|
7893
6039
|
};
|
|
7894
6040
|
return MathUtils2;
|
|
7895
6041
|
}()
|
|
@@ -13777,25 +11923,25 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
13777
11923
|
var evenRoundingErrors = this.getEvenRoundingErrors();
|
|
13778
11924
|
for (var i = 0; i < counters.length; i++) {
|
|
13779
11925
|
var value_1 = 1 * counters[i] / elementWidth;
|
|
13780
|
-
var
|
|
13781
|
-
if (
|
|
11926
|
+
var count = value_1 + 0.5;
|
|
11927
|
+
if (count < 1) {
|
|
13782
11928
|
if (value_1 < 0.3) {
|
|
13783
11929
|
throw new NotFoundException();
|
|
13784
11930
|
}
|
|
13785
|
-
|
|
13786
|
-
} else if (
|
|
11931
|
+
count = 1;
|
|
11932
|
+
} else if (count > 8) {
|
|
13787
11933
|
if (value_1 > 8.7) {
|
|
13788
11934
|
throw new NotFoundException();
|
|
13789
11935
|
}
|
|
13790
|
-
|
|
11936
|
+
count = 8;
|
|
13791
11937
|
}
|
|
13792
11938
|
var offset = i / 2;
|
|
13793
11939
|
if ((i & 1) === 0) {
|
|
13794
|
-
oddCounts[offset] =
|
|
13795
|
-
oddRoundingErrors[offset] = value_1 -
|
|
11940
|
+
oddCounts[offset] = count;
|
|
11941
|
+
oddRoundingErrors[offset] = value_1 - count;
|
|
13796
11942
|
} else {
|
|
13797
|
-
evenCounts[offset] =
|
|
13798
|
-
evenRoundingErrors[offset] = value_1 -
|
|
11943
|
+
evenCounts[offset] = count;
|
|
11944
|
+
evenRoundingErrors[offset] = value_1 - count;
|
|
13799
11945
|
}
|
|
13800
11946
|
}
|
|
13801
11947
|
this.adjustOddEvenCounts(numModules);
|
|
@@ -14271,19 +12417,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
14271
12417
|
var evenRoundingErrors = this.getEvenRoundingErrors();
|
|
14272
12418
|
for (var i = 0; i < counters.length; i++) {
|
|
14273
12419
|
var value = counters[i] / elementWidth;
|
|
14274
|
-
var
|
|
14275
|
-
if (
|
|
14276
|
-
|
|
14277
|
-
} else if (
|
|
14278
|
-
|
|
12420
|
+
var count = Math.floor(value + 0.5);
|
|
12421
|
+
if (count < 1) {
|
|
12422
|
+
count = 1;
|
|
12423
|
+
} else if (count > 8) {
|
|
12424
|
+
count = 8;
|
|
14279
12425
|
}
|
|
14280
12426
|
var offset = Math.floor(i / 2);
|
|
14281
12427
|
if ((i & 1) === 0) {
|
|
14282
|
-
oddCounts[offset] =
|
|
14283
|
-
oddRoundingErrors[offset] = value -
|
|
12428
|
+
oddCounts[offset] = count;
|
|
12429
|
+
oddRoundingErrors[offset] = value - count;
|
|
14284
12430
|
} else {
|
|
14285
|
-
evenCounts[offset] =
|
|
14286
|
-
evenRoundingErrors[offset] = value -
|
|
12431
|
+
evenCounts[offset] = count;
|
|
12432
|
+
evenRoundingErrors[offset] = value - count;
|
|
14287
12433
|
}
|
|
14288
12434
|
}
|
|
14289
12435
|
this.adjustOddEvenCounts(outsideChar, numModules);
|
|
@@ -14645,8 +12791,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
14645
12791
|
var ECB$1 = (
|
|
14646
12792
|
/** @class */
|
|
14647
12793
|
function() {
|
|
14648
|
-
function ECB2(
|
|
14649
|
-
this.count =
|
|
12794
|
+
function ECB2(count, dataCodewords) {
|
|
12795
|
+
this.count = count;
|
|
14650
12796
|
this.dataCodewords = dataCodewords;
|
|
14651
12797
|
}
|
|
14652
12798
|
ECB2.prototype.getCount = function() {
|
|
@@ -15571,19 +13717,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
15571
13717
|
DecodedBitStreamParser2.decodeBase256Segment = function(bits, result, byteSegments) {
|
|
15572
13718
|
var codewordPosition = 1 + bits.getByteOffset();
|
|
15573
13719
|
var d1 = this.unrandomize255State(bits.readBits(8), codewordPosition++);
|
|
15574
|
-
var
|
|
13720
|
+
var count;
|
|
15575
13721
|
if (d1 === 0) {
|
|
15576
|
-
|
|
13722
|
+
count = bits.available() / 8 | 0;
|
|
15577
13723
|
} else if (d1 < 250) {
|
|
15578
|
-
|
|
13724
|
+
count = d1;
|
|
15579
13725
|
} else {
|
|
15580
|
-
|
|
13726
|
+
count = 250 * (d1 - 249) + this.unrandomize255State(bits.readBits(8), codewordPosition++);
|
|
15581
13727
|
}
|
|
15582
|
-
if (
|
|
13728
|
+
if (count < 0) {
|
|
15583
13729
|
throw new FormatException();
|
|
15584
13730
|
}
|
|
15585
|
-
var bytes = new Uint8Array(
|
|
15586
|
-
for (var i = 0; i <
|
|
13731
|
+
var bytes = new Uint8Array(count);
|
|
13732
|
+
for (var i = 0; i < count; i++) {
|
|
15587
13733
|
if (bits.available() < 8) {
|
|
15588
13734
|
throw new FormatException();
|
|
15589
13735
|
}
|
|
@@ -16392,8 +14538,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
16392
14538
|
var ECB = (
|
|
16393
14539
|
/** @class */
|
|
16394
14540
|
function() {
|
|
16395
|
-
function ECB2(
|
|
16396
|
-
this.count =
|
|
14541
|
+
function ECB2(count, dataCodewords) {
|
|
14542
|
+
this.count = count;
|
|
16397
14543
|
this.dataCodewords = dataCodewords;
|
|
16398
14544
|
}
|
|
16399
14545
|
ECB2.prototype.getCount = function() {
|
|
@@ -16781,8 +14927,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
16781
14927
|
if (j === 6) {
|
|
16782
14928
|
j--;
|
|
16783
14929
|
}
|
|
16784
|
-
for (var
|
|
16785
|
-
var i = readingUp ? dimension - 1 -
|
|
14930
|
+
for (var count = 0; count < dimension; count++) {
|
|
14931
|
+
var i = readingUp ? dimension - 1 - count : count;
|
|
16786
14932
|
for (var col = 0; col < 2; col++) {
|
|
16787
14933
|
if (!functionPattern.get(j - col, i)) {
|
|
16788
14934
|
bitsRead++;
|
|
@@ -17056,19 +15202,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17056
15202
|
}
|
|
17057
15203
|
break;
|
|
17058
15204
|
default:
|
|
17059
|
-
var
|
|
15205
|
+
var count = bits.readBits(mode.getCharacterCountBits(version));
|
|
17060
15206
|
switch (mode) {
|
|
17061
15207
|
case Mode$2.NUMERIC:
|
|
17062
|
-
DecodedBitStreamParser2.decodeNumericSegment(bits, result,
|
|
15208
|
+
DecodedBitStreamParser2.decodeNumericSegment(bits, result, count);
|
|
17063
15209
|
break;
|
|
17064
15210
|
case Mode$2.ALPHANUMERIC:
|
|
17065
|
-
DecodedBitStreamParser2.decodeAlphanumericSegment(bits, result,
|
|
15211
|
+
DecodedBitStreamParser2.decodeAlphanumericSegment(bits, result, count, fc1InEffect);
|
|
17066
15212
|
break;
|
|
17067
15213
|
case Mode$2.BYTE:
|
|
17068
|
-
DecodedBitStreamParser2.decodeByteSegment(bits, result,
|
|
15214
|
+
DecodedBitStreamParser2.decodeByteSegment(bits, result, count, currentCharacterSetECI, byteSegments, hints);
|
|
17069
15215
|
break;
|
|
17070
15216
|
case Mode$2.KANJI:
|
|
17071
|
-
DecodedBitStreamParser2.decodeKanjiSegment(bits, result,
|
|
15217
|
+
DecodedBitStreamParser2.decodeKanjiSegment(bits, result, count);
|
|
17072
15218
|
break;
|
|
17073
15219
|
default:
|
|
17074
15220
|
throw new FormatException();
|
|
@@ -17081,13 +15227,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17081
15227
|
}
|
|
17082
15228
|
return new DecoderResult(bytes, result.toString(), byteSegments.length === 0 ? null : byteSegments, ecLevel === null ? null : ecLevel.toString(), symbolSequence, parityData);
|
|
17083
15229
|
};
|
|
17084
|
-
DecodedBitStreamParser2.decodeHanziSegment = function(bits, result,
|
|
17085
|
-
if (
|
|
15230
|
+
DecodedBitStreamParser2.decodeHanziSegment = function(bits, result, count) {
|
|
15231
|
+
if (count * 13 > bits.available()) {
|
|
17086
15232
|
throw new FormatException();
|
|
17087
15233
|
}
|
|
17088
|
-
var buffer = new Uint8Array(2 *
|
|
15234
|
+
var buffer = new Uint8Array(2 * count);
|
|
17089
15235
|
var offset = 0;
|
|
17090
|
-
while (
|
|
15236
|
+
while (count > 0) {
|
|
17091
15237
|
var twoBytes = bits.readBits(13);
|
|
17092
15238
|
var assembledTwoBytes = twoBytes / 96 << 8 & 4294967295 | twoBytes % 96;
|
|
17093
15239
|
if (assembledTwoBytes < 959) {
|
|
@@ -17100,7 +15246,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17100
15246
|
buffer[offset + 1] = /*(byte) */
|
|
17101
15247
|
assembledTwoBytes & 255;
|
|
17102
15248
|
offset += 2;
|
|
17103
|
-
|
|
15249
|
+
count--;
|
|
17104
15250
|
}
|
|
17105
15251
|
try {
|
|
17106
15252
|
result.append(StringEncoding.decode(buffer, StringUtils.GB2312));
|
|
@@ -17108,13 +15254,13 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17108
15254
|
throw new FormatException(ignored);
|
|
17109
15255
|
}
|
|
17110
15256
|
};
|
|
17111
|
-
DecodedBitStreamParser2.decodeKanjiSegment = function(bits, result,
|
|
17112
|
-
if (
|
|
15257
|
+
DecodedBitStreamParser2.decodeKanjiSegment = function(bits, result, count) {
|
|
15258
|
+
if (count * 13 > bits.available()) {
|
|
17113
15259
|
throw new FormatException();
|
|
17114
15260
|
}
|
|
17115
|
-
var buffer = new Uint8Array(2 *
|
|
15261
|
+
var buffer = new Uint8Array(2 * count);
|
|
17116
15262
|
var offset = 0;
|
|
17117
|
-
while (
|
|
15263
|
+
while (count > 0) {
|
|
17118
15264
|
var twoBytes = bits.readBits(13);
|
|
17119
15265
|
var assembledTwoBytes = twoBytes / 192 << 8 & 4294967295 | twoBytes % 192;
|
|
17120
15266
|
if (assembledTwoBytes < 7936) {
|
|
@@ -17127,7 +15273,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17127
15273
|
buffer[offset + 1] = /*(byte) */
|
|
17128
15274
|
assembledTwoBytes;
|
|
17129
15275
|
offset += 2;
|
|
17130
|
-
|
|
15276
|
+
count--;
|
|
17131
15277
|
}
|
|
17132
15278
|
try {
|
|
17133
15279
|
result.append(StringEncoding.decode(buffer, StringUtils.SHIFT_JIS));
|
|
@@ -17135,12 +15281,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17135
15281
|
throw new FormatException(ignored);
|
|
17136
15282
|
}
|
|
17137
15283
|
};
|
|
17138
|
-
DecodedBitStreamParser2.decodeByteSegment = function(bits, result,
|
|
17139
|
-
if (8 *
|
|
15284
|
+
DecodedBitStreamParser2.decodeByteSegment = function(bits, result, count, currentCharacterSetECI, byteSegments, hints) {
|
|
15285
|
+
if (8 * count > bits.available()) {
|
|
17140
15286
|
throw new FormatException();
|
|
17141
15287
|
}
|
|
17142
|
-
var readBytes = new Uint8Array(
|
|
17143
|
-
for (var i = 0; i <
|
|
15288
|
+
var readBytes = new Uint8Array(count);
|
|
15289
|
+
for (var i = 0; i < count; i++) {
|
|
17144
15290
|
readBytes[i] = /*(byte) */
|
|
17145
15291
|
bits.readBits(8);
|
|
17146
15292
|
}
|
|
@@ -17163,18 +15309,18 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17163
15309
|
}
|
|
17164
15310
|
return DecodedBitStreamParser2.ALPHANUMERIC_CHARS[value];
|
|
17165
15311
|
};
|
|
17166
|
-
DecodedBitStreamParser2.decodeAlphanumericSegment = function(bits, result,
|
|
15312
|
+
DecodedBitStreamParser2.decodeAlphanumericSegment = function(bits, result, count, fc1InEffect) {
|
|
17167
15313
|
var start = result.length();
|
|
17168
|
-
while (
|
|
15314
|
+
while (count > 1) {
|
|
17169
15315
|
if (bits.available() < 11) {
|
|
17170
15316
|
throw new FormatException();
|
|
17171
15317
|
}
|
|
17172
15318
|
var nextTwoCharsBits = bits.readBits(11);
|
|
17173
15319
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(nextTwoCharsBits / 45)));
|
|
17174
15320
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(nextTwoCharsBits % 45));
|
|
17175
|
-
|
|
15321
|
+
count -= 2;
|
|
17176
15322
|
}
|
|
17177
|
-
if (
|
|
15323
|
+
if (count === 1) {
|
|
17178
15324
|
if (bits.available() < 6) {
|
|
17179
15325
|
throw new FormatException();
|
|
17180
15326
|
}
|
|
@@ -17192,8 +15338,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17192
15338
|
}
|
|
17193
15339
|
}
|
|
17194
15340
|
};
|
|
17195
|
-
DecodedBitStreamParser2.decodeNumericSegment = function(bits, result,
|
|
17196
|
-
while (
|
|
15341
|
+
DecodedBitStreamParser2.decodeNumericSegment = function(bits, result, count) {
|
|
15342
|
+
while (count >= 3) {
|
|
17197
15343
|
if (bits.available() < 10) {
|
|
17198
15344
|
throw new FormatException();
|
|
17199
15345
|
}
|
|
@@ -17204,9 +15350,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17204
15350
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(threeDigitsBits / 100)));
|
|
17205
15351
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(threeDigitsBits / 10) % 10));
|
|
17206
15352
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(threeDigitsBits % 10));
|
|
17207
|
-
|
|
15353
|
+
count -= 3;
|
|
17208
15354
|
}
|
|
17209
|
-
if (
|
|
15355
|
+
if (count === 2) {
|
|
17210
15356
|
if (bits.available() < 7) {
|
|
17211
15357
|
throw new FormatException();
|
|
17212
15358
|
}
|
|
@@ -17216,7 +15362,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17216
15362
|
}
|
|
17217
15363
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(Math.floor(twoDigitsBits / 10)));
|
|
17218
15364
|
result.append(DecodedBitStreamParser2.toAlphaNumericChar(twoDigitsBits % 10));
|
|
17219
|
-
} else if (
|
|
15365
|
+
} else if (count === 1) {
|
|
17220
15366
|
if (bits.available() < 4) {
|
|
17221
15367
|
throw new FormatException();
|
|
17222
15368
|
}
|
|
@@ -17612,11 +15758,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17612
15758
|
/** @class */
|
|
17613
15759
|
function(_super) {
|
|
17614
15760
|
__extends$j(FinderPattern2, _super);
|
|
17615
|
-
function FinderPattern2(posX, posY, estimatedModuleSize,
|
|
15761
|
+
function FinderPattern2(posX, posY, estimatedModuleSize, count) {
|
|
17616
15762
|
var _this = _super.call(this, posX, posY) || this;
|
|
17617
15763
|
_this.estimatedModuleSize = estimatedModuleSize;
|
|
17618
|
-
_this.count =
|
|
17619
|
-
if (void 0 ===
|
|
15764
|
+
_this.count = count;
|
|
15765
|
+
if (void 0 === count) {
|
|
17620
15766
|
_this.count = 1;
|
|
17621
15767
|
}
|
|
17622
15768
|
return _this;
|
|
@@ -17783,11 +15929,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
17783
15929
|
FinderPatternFinder2.foundPatternCross = function(stateCount) {
|
|
17784
15930
|
var totalModuleSize = 0;
|
|
17785
15931
|
for (var i = 0; i < 5; i++) {
|
|
17786
|
-
var
|
|
17787
|
-
if (
|
|
15932
|
+
var count = stateCount[i];
|
|
15933
|
+
if (count === 0) {
|
|
17788
15934
|
return false;
|
|
17789
15935
|
}
|
|
17790
|
-
totalModuleSize +=
|
|
15936
|
+
totalModuleSize += count;
|
|
17791
15937
|
}
|
|
17792
15938
|
if (totalModuleSize < 7) {
|
|
17793
15939
|
return false;
|
|
@@ -26607,7 +24753,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26607
24753
|
};
|
|
26608
24754
|
DecodedBitStreamParser2.byteCompaction = function(mode, codewords, encoding, codeIndex, result) {
|
|
26609
24755
|
var decodedBytes = new ByteArrayOutputStream();
|
|
26610
|
-
var
|
|
24756
|
+
var count = 0;
|
|
26611
24757
|
var value = (
|
|
26612
24758
|
/*long*/
|
|
26613
24759
|
0
|
|
@@ -26618,7 +24764,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26618
24764
|
var byteCompactedCodewords = new Int32Array(6);
|
|
26619
24765
|
var nextCode = codewords[codeIndex++];
|
|
26620
24766
|
while (codeIndex < codewords[0] && !end) {
|
|
26621
|
-
byteCompactedCodewords[
|
|
24767
|
+
byteCompactedCodewords[count++] = nextCode;
|
|
26622
24768
|
value = 900 * value + nextCode;
|
|
26623
24769
|
nextCode = codewords[codeIndex++];
|
|
26624
24770
|
switch (nextCode) {
|
|
@@ -26633,7 +24779,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26633
24779
|
end = true;
|
|
26634
24780
|
break;
|
|
26635
24781
|
default:
|
|
26636
|
-
if (
|
|
24782
|
+
if (count % 5 === 0 && count > 0) {
|
|
26637
24783
|
for (var j = 0; j < 6; ++j) {
|
|
26638
24784
|
decodedBytes.write(
|
|
26639
24785
|
/*(byte)*/
|
|
@@ -26641,15 +24787,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26641
24787
|
);
|
|
26642
24788
|
}
|
|
26643
24789
|
value = 0;
|
|
26644
|
-
|
|
24790
|
+
count = 0;
|
|
26645
24791
|
}
|
|
26646
24792
|
break;
|
|
26647
24793
|
}
|
|
26648
24794
|
}
|
|
26649
24795
|
if (codeIndex === codewords[0] && nextCode < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
|
|
26650
|
-
byteCompactedCodewords[
|
|
24796
|
+
byteCompactedCodewords[count++] = nextCode;
|
|
26651
24797
|
}
|
|
26652
|
-
for (var i = 0; i <
|
|
24798
|
+
for (var i = 0; i < count; i++) {
|
|
26653
24799
|
decodedBytes.write(
|
|
26654
24800
|
/*(byte)*/
|
|
26655
24801
|
byteCompactedCodewords[i]
|
|
@@ -26660,7 +24806,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26660
24806
|
while (codeIndex < codewords[0] && !end) {
|
|
26661
24807
|
var code = codewords[codeIndex++];
|
|
26662
24808
|
if (code < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
|
|
26663
|
-
|
|
24809
|
+
count++;
|
|
26664
24810
|
value = 900 * value + code;
|
|
26665
24811
|
} else {
|
|
26666
24812
|
switch (code) {
|
|
@@ -26676,7 +24822,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26676
24822
|
break;
|
|
26677
24823
|
}
|
|
26678
24824
|
}
|
|
26679
|
-
if (
|
|
24825
|
+
if (count % 5 === 0 && count > 0) {
|
|
26680
24826
|
for (var j = 0; j < 6; ++j) {
|
|
26681
24827
|
decodedBytes.write(
|
|
26682
24828
|
/*(byte)*/
|
|
@@ -26684,7 +24830,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26684
24830
|
);
|
|
26685
24831
|
}
|
|
26686
24832
|
value = 0;
|
|
26687
|
-
|
|
24833
|
+
count = 0;
|
|
26688
24834
|
}
|
|
26689
24835
|
}
|
|
26690
24836
|
break;
|
|
@@ -26693,7 +24839,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26693
24839
|
return codeIndex;
|
|
26694
24840
|
};
|
|
26695
24841
|
DecodedBitStreamParser2.numericCompaction = function(codewords, codeIndex, result) {
|
|
26696
|
-
var
|
|
24842
|
+
var count = 0;
|
|
26697
24843
|
var end = false;
|
|
26698
24844
|
var numericCodewords = new Int32Array(DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS);
|
|
26699
24845
|
while (codeIndex < codewords[0] && !end) {
|
|
@@ -26702,8 +24848,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26702
24848
|
end = true;
|
|
26703
24849
|
}
|
|
26704
24850
|
if (code < DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH) {
|
|
26705
|
-
numericCodewords[
|
|
26706
|
-
|
|
24851
|
+
numericCodewords[count] = code;
|
|
24852
|
+
count++;
|
|
26707
24853
|
} else {
|
|
26708
24854
|
switch (code) {
|
|
26709
24855
|
case DecodedBitStreamParser2.TEXT_COMPACTION_MODE_LATCH:
|
|
@@ -26717,17 +24863,17 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
26717
24863
|
break;
|
|
26718
24864
|
}
|
|
26719
24865
|
}
|
|
26720
|
-
if ((
|
|
26721
|
-
result.append(DecodedBitStreamParser2.decodeBase900toBase10(numericCodewords,
|
|
26722
|
-
|
|
24866
|
+
if ((count % DecodedBitStreamParser2.MAX_NUMERIC_CODEWORDS === 0 || code === DecodedBitStreamParser2.NUMERIC_COMPACTION_MODE_LATCH || end) && count > 0) {
|
|
24867
|
+
result.append(DecodedBitStreamParser2.decodeBase900toBase10(numericCodewords, count));
|
|
24868
|
+
count = 0;
|
|
26723
24869
|
}
|
|
26724
24870
|
}
|
|
26725
24871
|
return codeIndex;
|
|
26726
24872
|
};
|
|
26727
|
-
DecodedBitStreamParser2.decodeBase900toBase10 = function(codewords,
|
|
24873
|
+
DecodedBitStreamParser2.decodeBase900toBase10 = function(codewords, count) {
|
|
26728
24874
|
var result = createBigInt(0);
|
|
26729
|
-
for (var i = 0; i <
|
|
26730
|
-
result += DecodedBitStreamParser2.EXP900[
|
|
24875
|
+
for (var i = 0; i < count; i++) {
|
|
24876
|
+
result += DecodedBitStreamParser2.EXP900[count - i - 1] * createBigInt(codewords[i]);
|
|
26731
24877
|
}
|
|
26732
24878
|
var resultString = result.toString();
|
|
26733
24879
|
if (resultString.charAt(0) !== "1") {
|
|
@@ -29311,8 +27457,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
29311
27457
|
}
|
|
29312
27458
|
break;
|
|
29313
27459
|
}
|
|
29314
|
-
var
|
|
29315
|
-
if (
|
|
27460
|
+
var count = buffer.length();
|
|
27461
|
+
if (count % 3 === 0) {
|
|
29316
27462
|
var newMode = HighLevelEncoder$1.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
|
|
29317
27463
|
if (newMode !== this.getEncodingMode()) {
|
|
29318
27464
|
context.signalEncoderChange(ASCII_ENCODATION);
|
|
@@ -29323,8 +27469,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
29323
27469
|
this.handleEOD(context, buffer);
|
|
29324
27470
|
};
|
|
29325
27471
|
C40Encoder2.prototype.backtrackOneCharacter = function(context, buffer, removed, lastCharSize) {
|
|
29326
|
-
var
|
|
29327
|
-
var test = buffer.toString().substring(0,
|
|
27472
|
+
var count = buffer.length();
|
|
27473
|
+
var test = buffer.toString().substring(0, count - lastCharSize);
|
|
29328
27474
|
buffer.setLengthToZero();
|
|
29329
27475
|
buffer.append(test);
|
|
29330
27476
|
context.pos--;
|
|
@@ -29442,8 +27588,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
29442
27588
|
var c = context.getCurrentChar();
|
|
29443
27589
|
this.encodeChar(c, buffer);
|
|
29444
27590
|
context.pos++;
|
|
29445
|
-
var
|
|
29446
|
-
if (
|
|
27591
|
+
var count = buffer.length();
|
|
27592
|
+
if (count >= 4) {
|
|
29447
27593
|
context.writeCodewords(this.encodeToCodewords(buffer.toString()));
|
|
29448
27594
|
var test_1 = buffer.toString().substring(4);
|
|
29449
27595
|
buffer.setLengthToZero();
|
|
@@ -29460,11 +27606,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
29460
27606
|
};
|
|
29461
27607
|
EdifactEncoder2.prototype.handleEOD = function(context, buffer) {
|
|
29462
27608
|
try {
|
|
29463
|
-
var
|
|
29464
|
-
if (
|
|
27609
|
+
var count = buffer.length();
|
|
27610
|
+
if (count === 0) {
|
|
29465
27611
|
return;
|
|
29466
27612
|
}
|
|
29467
|
-
if (
|
|
27613
|
+
if (count === 1) {
|
|
29468
27614
|
context.updateSymbolInfo();
|
|
29469
27615
|
var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
|
|
29470
27616
|
var remaining = context.getRemainingCharacters();
|
|
@@ -29476,10 +27622,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
29476
27622
|
return;
|
|
29477
27623
|
}
|
|
29478
27624
|
}
|
|
29479
|
-
if (
|
|
27625
|
+
if (count > 4) {
|
|
29480
27626
|
throw new Error("Count must not exceed 4");
|
|
29481
27627
|
}
|
|
29482
|
-
var restChars =
|
|
27628
|
+
var restChars = count - 1;
|
|
29483
27629
|
var encoded = this.encodeToCodewords(buffer.toString());
|
|
29484
27630
|
var endOfSymbolReached = !context.hasMoreCharacters();
|
|
29485
27631
|
var restInAscii = endOfSymbolReached && restChars <= 2;
|
|
@@ -29782,8 +27928,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
29782
27928
|
EncoderContext2.prototype.getMessage = function() {
|
|
29783
27929
|
return this.msg;
|
|
29784
27930
|
};
|
|
29785
|
-
EncoderContext2.prototype.setSkipAtEnd = function(
|
|
29786
|
-
this.skipAtEnd =
|
|
27931
|
+
EncoderContext2.prototype.setSkipAtEnd = function(count) {
|
|
27932
|
+
this.skipAtEnd = count;
|
|
29787
27933
|
};
|
|
29788
27934
|
EncoderContext2.prototype.getCurrentChar = function() {
|
|
29789
27935
|
return this.msg.charCodeAt(this.pos);
|
|
@@ -29871,8 +28017,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
29871
28017
|
var c = context.getCurrentChar();
|
|
29872
28018
|
context.pos++;
|
|
29873
28019
|
this.encodeChar(c, buffer);
|
|
29874
|
-
var
|
|
29875
|
-
if (
|
|
28020
|
+
var count = buffer.length();
|
|
28021
|
+
if (count % 3 === 0) {
|
|
29876
28022
|
this.writeNextTriplet(context, buffer);
|
|
29877
28023
|
var newMode = HighLevelEncoder$1.lookAheadTest(context.getMessage(), context.pos, this.getEncodingMode());
|
|
29878
28024
|
if (newMode !== this.getEncodingMode()) {
|
|
@@ -29912,8 +28058,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
29912
28058
|
X12Encoder2.prototype.handleEOD = function(context, buffer) {
|
|
29913
28059
|
context.updateSymbolInfo();
|
|
29914
28060
|
var available = context.getSymbolInfo().getDataCapacity() - context.getCodewordCount();
|
|
29915
|
-
var
|
|
29916
|
-
context.pos -=
|
|
28061
|
+
var count = buffer.length();
|
|
28062
|
+
context.pos -= count;
|
|
29917
28063
|
if (context.getRemainingCharacters() > 1 || available > 1 || context.getRemainingCharacters() !== available) {
|
|
29918
28064
|
context.writeCodeword(X12_UNLATCH);
|
|
29919
28065
|
}
|
|
@@ -31746,15 +29892,38 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31746
29892
|
hints: SCANNER_HINTS
|
|
31747
29893
|
});
|
|
31748
29894
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex size-full flex-col justify-center overflow-hidden bg-(--color-background)", children: [
|
|
31749
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsxRuntime.jsx(Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }) }) }) }),
|
|
29895
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-end p-4", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.Overlay.Close, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(blocks.IconButton, { "aria-label": "close", variant: "soft", accentColor: "base", children: /* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "x" }) }) }) }),
|
|
31750
29896
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grow w-full max-h-full overflow-hidden p-4", children: /* @__PURE__ */ jsxRuntime.jsx("video", { className: "size-full", ref }) })
|
|
31751
29897
|
] });
|
|
31752
29898
|
});
|
|
31753
29899
|
ScannerInternal.displayName = "ScannerInternal";
|
|
29900
|
+
const ScannerProvider = React.memo((props) => {
|
|
29901
|
+
const { children } = props;
|
|
29902
|
+
const [config, setConfig] = React.useState(null);
|
|
29903
|
+
const closeFileViewer = React.useCallback(() => {
|
|
29904
|
+
setConfig(null);
|
|
29905
|
+
}, []);
|
|
29906
|
+
const openFileViewer = React.useCallback(
|
|
29907
|
+
(func) => {
|
|
29908
|
+
setConfig(func(closeFileViewer));
|
|
29909
|
+
},
|
|
29910
|
+
[closeFileViewer]
|
|
29911
|
+
);
|
|
29912
|
+
const handleClose = React.useCallback(() => {
|
|
29913
|
+
if (!config) return;
|
|
29914
|
+
if (config.onClose) config.onClose();
|
|
29915
|
+
closeFileViewer();
|
|
29916
|
+
}, [closeFileViewer, config]);
|
|
29917
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(ScannerContext.Provider, { value: openFileViewer, children: [
|
|
29918
|
+
children,
|
|
29919
|
+
config && /* @__PURE__ */ jsxRuntime.jsx(Scanner, { open: true, onOpenChange: handleClose, ...config })
|
|
29920
|
+
] });
|
|
29921
|
+
});
|
|
29922
|
+
ScannerProvider.displayName = "FileViewerProvider";
|
|
31754
29923
|
const ScanInput = React.memo((props) => {
|
|
31755
29924
|
const [
|
|
31756
29925
|
{ inputId, labelId, label, helpText, size, severity, showInputOnly, field, fieldProps, helpers, touched },
|
|
31757
|
-
|
|
29926
|
+
{ disabled }
|
|
31758
29927
|
] = useFormikInput(props);
|
|
31759
29928
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
31760
29929
|
const [showScanner, setShowScanner] = React.useState(false);
|
|
@@ -31816,7 +29985,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31816
29985
|
placeholder: "Enter a qr or barcode",
|
|
31817
29986
|
onChange: handleChange,
|
|
31818
29987
|
onBlur: handleBlur,
|
|
31819
|
-
|
|
29988
|
+
disabled
|
|
31820
29989
|
}
|
|
31821
29990
|
),
|
|
31822
29991
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -31828,6 +29997,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31828
29997
|
variant: "soft",
|
|
31829
29998
|
size: "sm",
|
|
31830
29999
|
accentColor: "base",
|
|
30000
|
+
disabled,
|
|
31831
30001
|
children: [
|
|
31832
30002
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "maximize" }),
|
|
31833
30003
|
"Scan"
|
|
@@ -31841,8 +30011,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31841
30011
|
});
|
|
31842
30012
|
ScanInput.displayName = "QrInput";
|
|
31843
30013
|
const _ScanField = class _ScanField extends BaseField {
|
|
31844
|
-
constructor(
|
|
31845
|
-
super(
|
|
30014
|
+
constructor(options) {
|
|
30015
|
+
super(options);
|
|
31846
30016
|
__publicField(this, "type", "qr");
|
|
31847
30017
|
__publicField(this, "onlyValidateAfterTouched", false);
|
|
31848
30018
|
}
|
|
@@ -31858,8 +30028,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31858
30028
|
identifier
|
|
31859
30029
|
});
|
|
31860
30030
|
}
|
|
31861
|
-
setOptions(
|
|
31862
|
-
super.setOptions(
|
|
30031
|
+
setOptions(options) {
|
|
30032
|
+
super.setOptions(options);
|
|
31863
30033
|
}
|
|
31864
30034
|
static deserialize(data) {
|
|
31865
30035
|
return new _ScanField(data);
|
|
@@ -31893,7 +30063,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31893
30063
|
const StringInput = React.memo((props) => {
|
|
31894
30064
|
const [
|
|
31895
30065
|
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
31896
|
-
|
|
30066
|
+
{ disabled }
|
|
31897
30067
|
] = useFormikInput(props);
|
|
31898
30068
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
31899
30069
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -31936,7 +30106,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31936
30106
|
placeholder: field.placeholder,
|
|
31937
30107
|
onChange: handleChange,
|
|
31938
30108
|
onBlur: handleBlur,
|
|
31939
|
-
|
|
30109
|
+
disabled
|
|
31940
30110
|
}
|
|
31941
30111
|
) })
|
|
31942
30112
|
}
|
|
@@ -31944,10 +30114,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31944
30114
|
});
|
|
31945
30115
|
StringInput.displayName = "StringInput";
|
|
31946
30116
|
const _StringField = class _StringField extends BaseStringField {
|
|
31947
|
-
constructor(
|
|
31948
|
-
const { ...rest } =
|
|
31949
|
-
const maxLength =
|
|
31950
|
-
const minLength =
|
|
30117
|
+
constructor(options) {
|
|
30118
|
+
const { ...rest } = options;
|
|
30119
|
+
const maxLength = options.maxLength ? Math.min(SHORT_TEXT_FIELD_MAX_LENGTH, options.maxLength) : SHORT_TEXT_FIELD_MAX_LENGTH;
|
|
30120
|
+
const minLength = options.minLength ? Math.min(options.minLength, maxLength) : void 0;
|
|
31951
30121
|
super({ ...rest, maxLength, minLength });
|
|
31952
30122
|
__publicField(this, "type", "string");
|
|
31953
30123
|
}
|
|
@@ -31963,8 +30133,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31963
30133
|
identifier
|
|
31964
30134
|
});
|
|
31965
30135
|
}
|
|
31966
|
-
setOptions(
|
|
31967
|
-
super.setOptions(
|
|
30136
|
+
setOptions(options) {
|
|
30137
|
+
super.setOptions(options);
|
|
31968
30138
|
}
|
|
31969
30139
|
static deserialize(data) {
|
|
31970
30140
|
if (data.type !== "string") throw new Error("Type mismatch.");
|
|
@@ -31986,7 +30156,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
31986
30156
|
const TextInput = React.memo((props) => {
|
|
31987
30157
|
const [
|
|
31988
30158
|
{ inputId, labelId, size, severity, showInputOnly, field, helpText, label, fieldProps, touched, helpers },
|
|
31989
|
-
|
|
30159
|
+
{ disabled }
|
|
31990
30160
|
] = useFormikInput(props);
|
|
31991
30161
|
const { name, onBlur, onChange, value } = fieldProps;
|
|
31992
30162
|
const computedHelpText = showInputOnly ? null : helpText;
|
|
@@ -32032,7 +30202,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32032
30202
|
accentColor: "base",
|
|
32033
30203
|
variant: "surface",
|
|
32034
30204
|
size: "sm",
|
|
32035
|
-
|
|
30205
|
+
disabled
|
|
32036
30206
|
}
|
|
32037
30207
|
)
|
|
32038
30208
|
}
|
|
@@ -32040,10 +30210,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32040
30210
|
});
|
|
32041
30211
|
TextInput.displayName = "TextInput";
|
|
32042
30212
|
const _TextField = class _TextField extends BaseStringField {
|
|
32043
|
-
constructor(
|
|
32044
|
-
const maxLength =
|
|
32045
|
-
const minLength =
|
|
32046
|
-
super({ ...
|
|
30213
|
+
constructor(options) {
|
|
30214
|
+
const maxLength = options.maxLength ? Math.min(LONG_TEXT_FIELD_MAX_LENGTH, options.maxLength) : LONG_TEXT_FIELD_MAX_LENGTH;
|
|
30215
|
+
const minLength = options.minLength ? Math.min(options.minLength, maxLength) : void 0;
|
|
30216
|
+
super({ ...options, maxLength, minLength });
|
|
32047
30217
|
__publicField(this, "type", "text");
|
|
32048
30218
|
}
|
|
32049
30219
|
serialize() {
|
|
@@ -32058,8 +30228,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32058
30228
|
identifier
|
|
32059
30229
|
});
|
|
32060
30230
|
}
|
|
32061
|
-
setOptions(
|
|
32062
|
-
super.setOptions(
|
|
30231
|
+
setOptions(options) {
|
|
30232
|
+
super.setOptions(options);
|
|
32063
30233
|
}
|
|
32064
30234
|
static deserialize(data) {
|
|
32065
30235
|
const { maximum_length, minimum_length, ...rest } = data;
|
|
@@ -32180,7 +30350,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32180
30350
|
}
|
|
32181
30351
|
const UploadInput = React.memo((props) => {
|
|
32182
30352
|
var _a2;
|
|
32183
|
-
const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps },
|
|
30353
|
+
const [{ inputId, labelId, label, size, severity, helpText, showInputOnly, field, fieldProps }, { disabled }] = useFormikInput(props);
|
|
32184
30354
|
const { value, name, onChange, onBlur } = fieldProps;
|
|
32185
30355
|
const input = React.useRef(null);
|
|
32186
30356
|
const updatedHelpText = React.useMemo(() => {
|
|
@@ -32254,9 +30424,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32254
30424
|
variant: "soft",
|
|
32255
30425
|
accentColor: "base",
|
|
32256
30426
|
onClick: handleClick,
|
|
32257
|
-
id: "upload-input-upload-button",
|
|
32258
30427
|
type: "button",
|
|
32259
|
-
|
|
30428
|
+
disabled,
|
|
32260
30429
|
children: [
|
|
32261
30430
|
/* @__PURE__ */ jsxRuntime.jsx(blocks.LuIcon, { icon: "upload" }),
|
|
32262
30431
|
buttonText
|
|
@@ -32288,7 +30457,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32288
30457
|
onRemove: () => {
|
|
32289
30458
|
handleRemove(index);
|
|
32290
30459
|
},
|
|
32291
|
-
disabled
|
|
30460
|
+
disabled
|
|
32292
30461
|
},
|
|
32293
30462
|
index
|
|
32294
30463
|
)) })
|
|
@@ -32319,7 +30488,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32319
30488
|
React.useEffect(() => {
|
|
32320
30489
|
if (file instanceof UUIDPromise) {
|
|
32321
30490
|
file.then((file2) => {
|
|
32322
|
-
console.debug("file", file2);
|
|
32323
30491
|
setResolvedFile(file2);
|
|
32324
30492
|
}).catch(console.error);
|
|
32325
30493
|
} else {
|
|
@@ -32383,8 +30551,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32383
30551
|
});
|
|
32384
30552
|
DisplayFile.displayName = "DisplayFile";
|
|
32385
30553
|
const _UploadField = class _UploadField extends BaseField {
|
|
32386
|
-
constructor(
|
|
32387
|
-
const { extensions, maximum_files, maximum_size, ...base } =
|
|
30554
|
+
constructor(options) {
|
|
30555
|
+
const { extensions, maximum_files, maximum_size, ...base } = options;
|
|
32388
30556
|
super(base);
|
|
32389
30557
|
__publicField(this, "type", "upload");
|
|
32390
30558
|
__publicField(this, "extensions");
|
|
@@ -32494,8 +30662,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
32494
30662
|
identifier
|
|
32495
30663
|
});
|
|
32496
30664
|
}
|
|
32497
|
-
setOptions(
|
|
32498
|
-
const { extensions, maximum_files, maximum_size, ...rest } =
|
|
30665
|
+
setOptions(options) {
|
|
30666
|
+
const { extensions, maximum_files, maximum_size, ...rest } = options;
|
|
32499
30667
|
this.maxFileSize = typeof maximum_size === "number" ? maximum_size : this.maxFileSize;
|
|
32500
30668
|
this.maxFiles = typeof maximum_files === "number" ? maximum_files : this.maxFiles;
|
|
32501
30669
|
this.extensions = extensions;
|
|
@@ -33293,8 +31461,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
33293
31461
|
})
|
|
33294
31462
|
};
|
|
33295
31463
|
class BooleanFieldCondition extends BaseCondition {
|
|
33296
|
-
constructor(
|
|
33297
|
-
super(
|
|
31464
|
+
constructor(options) {
|
|
31465
|
+
super(options);
|
|
33298
31466
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
33299
31467
|
__publicField(this, "defaultConditionValue");
|
|
33300
31468
|
__publicField(this, "modifiers", modifiers$c);
|
|
@@ -33390,8 +31558,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
33390
31558
|
})
|
|
33391
31559
|
};
|
|
33392
31560
|
class CheckboxListFieldCondition extends BaseCondition {
|
|
33393
|
-
constructor(
|
|
33394
|
-
super(
|
|
31561
|
+
constructor(options) {
|
|
31562
|
+
super(options);
|
|
33395
31563
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
33396
31564
|
__publicField(this, "defaultConditionValue");
|
|
33397
31565
|
__publicField(this, "modifiers", modifiers$b);
|
|
@@ -33512,8 +31680,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
33512
31680
|
})
|
|
33513
31681
|
};
|
|
33514
31682
|
class DateFieldCondition extends BaseCondition {
|
|
33515
|
-
constructor(
|
|
33516
|
-
super(
|
|
31683
|
+
constructor(options) {
|
|
31684
|
+
super(options);
|
|
33517
31685
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
33518
31686
|
__publicField(this, "defaultConditionValue");
|
|
33519
31687
|
__publicField(this, "modifiers", modifiers$a);
|
|
@@ -33609,8 +31777,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
33609
31777
|
})
|
|
33610
31778
|
};
|
|
33611
31779
|
class MultiSelectFieldCondition extends BaseCondition {
|
|
33612
|
-
constructor(
|
|
33613
|
-
super(
|
|
31780
|
+
constructor(options) {
|
|
31781
|
+
super(options);
|
|
33614
31782
|
__publicField(this, "defaultConditionValue");
|
|
33615
31783
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
33616
31784
|
__publicField(this, "modifiers", modifiers$9);
|
|
@@ -33694,8 +31862,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
33694
31862
|
})
|
|
33695
31863
|
};
|
|
33696
31864
|
class MultiStringFieldCondition extends BaseCondition {
|
|
33697
|
-
constructor(
|
|
33698
|
-
super(
|
|
31865
|
+
constructor(options) {
|
|
31866
|
+
super(options);
|
|
33699
31867
|
__publicField(this, "defaultConditionValue");
|
|
33700
31868
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
33701
31869
|
__publicField(this, "modifiers", modifiers$8);
|
|
@@ -33832,8 +32000,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
33832
32000
|
})
|
|
33833
32001
|
};
|
|
33834
32002
|
class NumberFieldCondition extends BaseCondition {
|
|
33835
|
-
constructor(
|
|
33836
|
-
super(
|
|
32003
|
+
constructor(options) {
|
|
32004
|
+
super(options);
|
|
33837
32005
|
__publicField(this, "defaultConditionValue");
|
|
33838
32006
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
33839
32007
|
__publicField(this, "modifiers", modifiers$7);
|
|
@@ -33911,8 +32079,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
33911
32079
|
})
|
|
33912
32080
|
};
|
|
33913
32081
|
class OTPFieldCondition extends BaseCondition {
|
|
33914
|
-
constructor(
|
|
33915
|
-
super(
|
|
32082
|
+
constructor(options) {
|
|
32083
|
+
super(options);
|
|
33916
32084
|
__publicField(this, "defaultConditionValue");
|
|
33917
32085
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
33918
32086
|
__publicField(this, "modifiers", modifiers$6);
|
|
@@ -34031,8 +32199,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
34031
32199
|
})
|
|
34032
32200
|
};
|
|
34033
32201
|
class RadioFieldCondition extends BaseCondition {
|
|
34034
|
-
constructor(
|
|
34035
|
-
super(
|
|
32202
|
+
constructor(options) {
|
|
32203
|
+
super(options);
|
|
34036
32204
|
__publicField(this, "defaultConditionValue");
|
|
34037
32205
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
34038
32206
|
__publicField(this, "modifiers", modifiers$5);
|
|
@@ -34110,8 +32278,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
34110
32278
|
})
|
|
34111
32279
|
};
|
|
34112
32280
|
class ScanFieldCondition extends BaseCondition {
|
|
34113
|
-
constructor(
|
|
34114
|
-
super(
|
|
32281
|
+
constructor(options) {
|
|
32282
|
+
super(options);
|
|
34115
32283
|
__publicField(this, "defaultConditionValue");
|
|
34116
32284
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
34117
32285
|
__publicField(this, "modifiers", modifiers$4);
|
|
@@ -34230,8 +32398,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
34230
32398
|
})
|
|
34231
32399
|
};
|
|
34232
32400
|
class SelectFieldCondition extends BaseCondition {
|
|
34233
|
-
constructor(
|
|
34234
|
-
super(
|
|
32401
|
+
constructor(options) {
|
|
32402
|
+
super(options);
|
|
34235
32403
|
__publicField(this, "defaultConditionValue");
|
|
34236
32404
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
34237
32405
|
__publicField(this, "modifiers", modifiers$3);
|
|
@@ -34309,8 +32477,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
34309
32477
|
})
|
|
34310
32478
|
};
|
|
34311
32479
|
class StringFieldCondition extends BaseCondition {
|
|
34312
|
-
constructor(
|
|
34313
|
-
super(
|
|
32480
|
+
constructor(options) {
|
|
32481
|
+
super(options);
|
|
34314
32482
|
__publicField(this, "defaultConditionValue");
|
|
34315
32483
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
34316
32484
|
__publicField(this, "modifiers", modifiers$2);
|
|
@@ -34385,8 +32553,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
34385
32553
|
})
|
|
34386
32554
|
};
|
|
34387
32555
|
class TextFieldCondition extends BaseCondition {
|
|
34388
|
-
constructor(
|
|
34389
|
-
super(
|
|
32556
|
+
constructor(options) {
|
|
32557
|
+
super(options);
|
|
34390
32558
|
__publicField(this, "defaultConditionValue");
|
|
34391
32559
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
34392
32560
|
__publicField(this, "modifiers", modifiers$1);
|
|
@@ -34457,8 +32625,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
34457
32625
|
})
|
|
34458
32626
|
};
|
|
34459
32627
|
class UploadFieldCondition extends BaseCondition {
|
|
34460
|
-
constructor(
|
|
34461
|
-
super(
|
|
32628
|
+
constructor(options) {
|
|
32629
|
+
super(options);
|
|
34462
32630
|
__publicField(this, "defaultConditionValue");
|
|
34463
32631
|
__publicField(this, "defaultConditionModifier", "equals");
|
|
34464
32632
|
__publicField(this, "modifiers", modifiers);
|
|
@@ -34653,8 +32821,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
34653
32821
|
});
|
|
34654
32822
|
FieldSectionLayout.displayName = "FieldSectionLayout";
|
|
34655
32823
|
const _FieldSection = class _FieldSection extends BaseFormElement {
|
|
34656
|
-
constructor(
|
|
34657
|
-
const { label = null, description = null, fields, conditions = {}, ...base } =
|
|
32824
|
+
constructor(options) {
|
|
32825
|
+
const { label = null, description = null, fields, conditions = {}, ...base } = options;
|
|
34658
32826
|
super(base);
|
|
34659
32827
|
__publicField(this, "type", "section");
|
|
34660
32828
|
__publicField(this, "label");
|
|
@@ -34720,8 +32888,8 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
34720
32888
|
fields: this.fields.map((field) => field.duplicate(uuid.v4()))
|
|
34721
32889
|
});
|
|
34722
32890
|
}
|
|
34723
|
-
setOptions(
|
|
34724
|
-
const { label, description, fields, conditions, ...base } =
|
|
32891
|
+
setOptions(options) {
|
|
32892
|
+
const { label, description, fields, conditions, ...base } = options;
|
|
34725
32893
|
this.label = label ?? this.label;
|
|
34726
32894
|
this.description = description ?? this.description;
|
|
34727
32895
|
this.fields = fields || this.fields;
|
|
@@ -36366,33 +34534,6 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
36366
34534
|
ListBuilder: FormBuilderListBuilder,
|
|
36367
34535
|
Preview: FormBuilderPreview
|
|
36368
34536
|
};
|
|
36369
|
-
const ScannerContext = React.createContext(() => {
|
|
36370
|
-
throw new Error("No ScannerProvider found");
|
|
36371
|
-
});
|
|
36372
|
-
const useScanner = () => React.use(ScannerContext);
|
|
36373
|
-
const ScannerProvider = React.memo((props) => {
|
|
36374
|
-
const { children } = props;
|
|
36375
|
-
const [config, setConfig] = React.useState(null);
|
|
36376
|
-
const closeFileViewer = React.useCallback(() => {
|
|
36377
|
-
setConfig(null);
|
|
36378
|
-
}, []);
|
|
36379
|
-
const openFileViewer = React.useCallback(
|
|
36380
|
-
(func) => {
|
|
36381
|
-
setConfig(func(closeFileViewer));
|
|
36382
|
-
},
|
|
36383
|
-
[closeFileViewer]
|
|
36384
|
-
);
|
|
36385
|
-
const handleClose = React.useCallback(() => {
|
|
36386
|
-
if (!config) return;
|
|
36387
|
-
if (config.onClose) config.onClose();
|
|
36388
|
-
closeFileViewer();
|
|
36389
|
-
}, [closeFileViewer, config]);
|
|
36390
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ScannerContext.Provider, { value: openFileViewer, children: [
|
|
36391
|
-
children,
|
|
36392
|
-
config && /* @__PURE__ */ jsxRuntime.jsx(Scanner, { open: true, onOpenChange: handleClose, ...config })
|
|
36393
|
-
] });
|
|
36394
|
-
});
|
|
36395
|
-
ScannerProvider.displayName = "FileViewerProvider";
|
|
36396
34537
|
exports2.BaseCondition = BaseCondition;
|
|
36397
34538
|
exports2.BaseField = BaseField;
|
|
36398
34539
|
exports2.BaseFormElement = BaseFormElement;
|