@charcoal-ui/react 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.story.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +5 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +12 -0
- package/dist/core/CharcoalProvider.d.ts.map +1 -0
- package/dist/core/ComponentAbstraction.d.ts +1 -1
- package/dist/core/ComponentAbstraction.d.ts.map +1 -1
- package/dist/index.cjs +298 -2609
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +127 -2440
- package/dist/index.js.map +1 -1
- package/dist/styled.d.ts +3 -3
- package/package.json +8 -6
- package/src/components/Checkbox/index.story.tsx +29 -11
- package/src/components/Checkbox/index.tsx +16 -6
- package/src/components/Modal/index.tsx +6 -6
- package/src/components/Switch/index.tsx +7 -3
- package/src/core/CharcoalProvider.tsx +35 -0
- package/src/core/ComponentAbstraction.tsx +1 -1
- package/src/index.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -28,8 +28,22 @@ import { SSRProvider } from "@react-aria/ssr";
|
|
|
28
28
|
// src/core/OverlayProvider.tsx
|
|
29
29
|
import { OverlayProvider } from "@react-aria/overlays";
|
|
30
30
|
|
|
31
|
+
// src/core/CharcoalProvider.tsx
|
|
32
|
+
import React2 from "react";
|
|
33
|
+
import { ThemeProvider } from "styled-components";
|
|
34
|
+
import { TokenInjector } from "@charcoal-ui/styled";
|
|
35
|
+
function CharcoalProvider({
|
|
36
|
+
themeMap,
|
|
37
|
+
defaultTheme = themeMap[":root"],
|
|
38
|
+
components = {},
|
|
39
|
+
injectTokens = true,
|
|
40
|
+
children
|
|
41
|
+
}) {
|
|
42
|
+
return /* @__PURE__ */ React2.createElement(SSRProvider, null, /* @__PURE__ */ React2.createElement(ThemeProvider, { theme: defaultTheme }, injectTokens && /* @__PURE__ */ React2.createElement(TokenInjector, { theme: themeMap }), /* @__PURE__ */ React2.createElement(ComponentAbstraction, { components }, /* @__PURE__ */ React2.createElement(OverlayProvider, null, children))));
|
|
43
|
+
}
|
|
44
|
+
|
|
31
45
|
// src/components/Button/index.tsx
|
|
32
|
-
import
|
|
46
|
+
import React4 from "react";
|
|
33
47
|
import styled3 from "styled-components";
|
|
34
48
|
|
|
35
49
|
// src/_lib/index.ts
|
|
@@ -45,15 +59,15 @@ import { createTheme } from "@charcoal-ui/styled";
|
|
|
45
59
|
var theme = createTheme(styled);
|
|
46
60
|
|
|
47
61
|
// src/components/Clickable/index.tsx
|
|
48
|
-
import
|
|
62
|
+
import React3 from "react";
|
|
49
63
|
import styled2, { css } from "styled-components";
|
|
50
64
|
import { disabledSelector } from "@charcoal-ui/utils";
|
|
51
|
-
var Clickable =
|
|
65
|
+
var Clickable = React3.forwardRef(
|
|
52
66
|
function Clickable2(props, ref) {
|
|
53
67
|
const { Link } = useComponentAbstraction();
|
|
54
68
|
if ("to" in props) {
|
|
55
69
|
const { onClick, disabled = false, ...rest } = props;
|
|
56
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ React3.createElement(
|
|
57
71
|
A,
|
|
58
72
|
{
|
|
59
73
|
...rest,
|
|
@@ -64,7 +78,7 @@ var Clickable = React2.forwardRef(
|
|
|
64
78
|
}
|
|
65
79
|
);
|
|
66
80
|
} else {
|
|
67
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ React3.createElement(Button, { ...props, ref });
|
|
68
82
|
}
|
|
69
83
|
}
|
|
70
84
|
);
|
|
@@ -129,7 +143,7 @@ var A = styled2.span`
|
|
|
129
143
|
`;
|
|
130
144
|
|
|
131
145
|
// src/components/Button/index.tsx
|
|
132
|
-
var Button2 =
|
|
146
|
+
var Button2 = React4.forwardRef(function Button3({
|
|
133
147
|
children,
|
|
134
148
|
variant = "Default",
|
|
135
149
|
size = "M",
|
|
@@ -137,7 +151,7 @@ var Button2 = React3.forwardRef(function Button3({
|
|
|
137
151
|
disabled = false,
|
|
138
152
|
...rest
|
|
139
153
|
}, ref) {
|
|
140
|
-
return /* @__PURE__ */
|
|
154
|
+
return /* @__PURE__ */ React4.createElement(
|
|
141
155
|
StyledButton,
|
|
142
156
|
{
|
|
143
157
|
...rest,
|
|
@@ -216,12 +230,12 @@ function sizeToProps(size) {
|
|
|
216
230
|
}
|
|
217
231
|
|
|
218
232
|
// src/components/IconButton/index.tsx
|
|
219
|
-
import
|
|
233
|
+
import React5 from "react";
|
|
220
234
|
import styled4 from "styled-components";
|
|
221
|
-
var IconButton =
|
|
235
|
+
var IconButton = React5.forwardRef(
|
|
222
236
|
function IconButtonInner({ variant = "Default", size = "M", icon, ...rest }, ref) {
|
|
223
237
|
validateIconSize(size, icon);
|
|
224
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ React5.createElement(StyledIconButton, { ...rest, ref, variant, size }, /* @__PURE__ */ React5.createElement("pixiv-icon", { name: icon }));
|
|
225
239
|
}
|
|
226
240
|
);
|
|
227
241
|
var IconButton_default = IconButton;
|
|
@@ -300,7 +314,7 @@ function validateIconSize(size, icon) {
|
|
|
300
314
|
}
|
|
301
315
|
|
|
302
316
|
// src/components/Radio/index.tsx
|
|
303
|
-
import
|
|
317
|
+
import React6, { useCallback, useContext as useContext2 } from "react";
|
|
304
318
|
import styled5 from "styled-components";
|
|
305
319
|
import warning from "warning";
|
|
306
320
|
import { px } from "@charcoal-ui/utils";
|
|
@@ -331,7 +345,7 @@ function Radio({
|
|
|
331
345
|
},
|
|
332
346
|
[onChange]
|
|
333
347
|
);
|
|
334
|
-
return /* @__PURE__ */
|
|
348
|
+
return /* @__PURE__ */ React6.createElement(RadioRoot, { "aria-disabled": isDisabled || isReadonly }, /* @__PURE__ */ React6.createElement(
|
|
335
349
|
RadioInput,
|
|
336
350
|
{
|
|
337
351
|
name,
|
|
@@ -341,7 +355,7 @@ function Radio({
|
|
|
341
355
|
onChange: handleChange,
|
|
342
356
|
disabled: isDisabled || isReadonly
|
|
343
357
|
}
|
|
344
|
-
), children != null && /* @__PURE__ */
|
|
358
|
+
), children != null && /* @__PURE__ */ React6.createElement(RadioLabel, null, children));
|
|
345
359
|
}
|
|
346
360
|
var RadioRoot = styled5.label`
|
|
347
361
|
display: grid;
|
|
@@ -402,7 +416,7 @@ var StyledRadioGroup = styled5.div`
|
|
|
402
416
|
grid-template-columns: 1fr;
|
|
403
417
|
grid-gap: ${({ theme: theme4 }) => px(theme4.spacing[8])};
|
|
404
418
|
`;
|
|
405
|
-
var RadioGroupContext =
|
|
419
|
+
var RadioGroupContext = React6.createContext({
|
|
406
420
|
name: void 0,
|
|
407
421
|
selected: void 0,
|
|
408
422
|
disabled: false,
|
|
@@ -431,7 +445,7 @@ function RadioGroup({
|
|
|
431
445
|
},
|
|
432
446
|
[onChange]
|
|
433
447
|
);
|
|
434
|
-
return /* @__PURE__ */
|
|
448
|
+
return /* @__PURE__ */ React6.createElement(
|
|
435
449
|
RadioGroupContext.Provider,
|
|
436
450
|
{
|
|
437
451
|
value: {
|
|
@@ -443,7 +457,7 @@ function RadioGroup({
|
|
|
443
457
|
onChange: handleChange
|
|
444
458
|
}
|
|
445
459
|
},
|
|
446
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ React6.createElement(
|
|
447
461
|
StyledRadioGroup,
|
|
448
462
|
{
|
|
449
463
|
role: "radiogroup",
|
|
@@ -458,7 +472,7 @@ function RadioGroup({
|
|
|
458
472
|
}
|
|
459
473
|
|
|
460
474
|
// src/components/MultiSelect/index.tsx
|
|
461
|
-
import
|
|
475
|
+
import React7, { useCallback as useCallback2, useContext as useContext3 } from "react";
|
|
462
476
|
import styled6, { css as css2 } from "styled-components";
|
|
463
477
|
import warning2 from "warning";
|
|
464
478
|
import { disabledSelector as disabledSelector2, px as px2 } from "@charcoal-ui/utils";
|
|
@@ -512,7 +526,7 @@ function MultiSelect({
|
|
|
512
526
|
},
|
|
513
527
|
[onChange, parentOnChange, value]
|
|
514
528
|
);
|
|
515
|
-
return /* @__PURE__ */
|
|
529
|
+
return /* @__PURE__ */ React7.createElement(MultiSelectRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React7.createElement(
|
|
516
530
|
MultiSelectInput,
|
|
517
531
|
{
|
|
518
532
|
...{
|
|
@@ -526,15 +540,15 @@ function MultiSelect({
|
|
|
526
540
|
overlay: variant === "overlay",
|
|
527
541
|
"aria-invalid": hasError
|
|
528
542
|
}
|
|
529
|
-
), /* @__PURE__ */
|
|
543
|
+
), /* @__PURE__ */ React7.createElement(
|
|
530
544
|
MultiSelectInputOverlay,
|
|
531
545
|
{
|
|
532
546
|
overlay: variant === "overlay",
|
|
533
547
|
hasError,
|
|
534
548
|
"aria-hidden": true
|
|
535
549
|
},
|
|
536
|
-
/* @__PURE__ */
|
|
537
|
-
), Boolean(children) && /* @__PURE__ */
|
|
550
|
+
/* @__PURE__ */ React7.createElement("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 })
|
|
551
|
+
), Boolean(children) && /* @__PURE__ */ React7.createElement(MultiSelectLabel, null, children));
|
|
538
552
|
}
|
|
539
553
|
var MultiSelectRoot = styled6.label`
|
|
540
554
|
display: grid;
|
|
@@ -622,7 +636,7 @@ function MultiSelectGroup({
|
|
|
622
636
|
},
|
|
623
637
|
[onChange, selected]
|
|
624
638
|
);
|
|
625
|
-
return /* @__PURE__ */
|
|
639
|
+
return /* @__PURE__ */ React7.createElement(
|
|
626
640
|
MultiSelectGroupContext.Provider,
|
|
627
641
|
{
|
|
628
642
|
value: {
|
|
@@ -634,7 +648,7 @@ function MultiSelectGroup({
|
|
|
634
648
|
onChange: handleChange
|
|
635
649
|
}
|
|
636
650
|
},
|
|
637
|
-
/* @__PURE__ */
|
|
651
|
+
/* @__PURE__ */ React7.createElement(
|
|
638
652
|
"div",
|
|
639
653
|
{
|
|
640
654
|
className,
|
|
@@ -648,10 +662,10 @@ function MultiSelectGroup({
|
|
|
648
662
|
|
|
649
663
|
// src/components/Switch/index.tsx
|
|
650
664
|
import { useSwitch } from "@react-aria/switch";
|
|
651
|
-
import
|
|
665
|
+
import React8, { useRef, useMemo } from "react";
|
|
652
666
|
import { useToggleState } from "react-stately";
|
|
653
667
|
import styled7 from "styled-components";
|
|
654
|
-
import { disabledSelector as disabledSelector3
|
|
668
|
+
import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
|
|
655
669
|
function SwitchCheckbox(props) {
|
|
656
670
|
const { disabled, className } = props;
|
|
657
671
|
const ariaSwitchProps = useMemo(
|
|
@@ -668,13 +682,12 @@ function SwitchCheckbox(props) {
|
|
|
668
682
|
const {
|
|
669
683
|
inputProps: { className: _className, type: _type, ...rest }
|
|
670
684
|
} = useSwitch(ariaSwitchProps, state, ref);
|
|
671
|
-
return /* @__PURE__ */
|
|
685
|
+
return /* @__PURE__ */ React8.createElement(Label, { className, "aria-disabled": disabled }, /* @__PURE__ */ React8.createElement(SwitchInput, { ...rest, ref }), "children" in props ? /* @__PURE__ */ React8.createElement(LabelInner, null, props.children) : void 0);
|
|
672
686
|
}
|
|
673
687
|
var Label = styled7.label`
|
|
674
688
|
display: inline-grid;
|
|
675
689
|
grid-template-columns: auto 1fr;
|
|
676
690
|
align-items: center;
|
|
677
|
-
gap: ${({ theme: theme4 }) => px3(theme4.spacing[4])};
|
|
678
691
|
cursor: pointer;
|
|
679
692
|
outline: 0;
|
|
680
693
|
|
|
@@ -685,7 +698,11 @@ var Label = styled7.label`
|
|
|
685
698
|
}
|
|
686
699
|
`;
|
|
687
700
|
var LabelInner = styled7.div`
|
|
688
|
-
${theme((o) => [
|
|
701
|
+
${theme((o) => [
|
|
702
|
+
o.typography(14).preserveHalfLeading,
|
|
703
|
+
o.font.text2,
|
|
704
|
+
o.margin.left(4)
|
|
705
|
+
])}
|
|
689
706
|
`;
|
|
690
707
|
var SwitchInput = styled7.input.attrs({
|
|
691
708
|
type: "checkbox"
|
|
@@ -703,7 +720,8 @@ var SwitchInput = styled7.input.attrs({
|
|
|
703
720
|
o.borderRadius(16),
|
|
704
721
|
o.height.px(16),
|
|
705
722
|
o.bg.text4.hover.press,
|
|
706
|
-
o.outline.default.focus
|
|
723
|
+
o.outline.default.focus,
|
|
724
|
+
o.margin.all(0)
|
|
707
725
|
])}
|
|
708
726
|
|
|
709
727
|
&::after {
|
|
@@ -732,7 +750,7 @@ var SwitchInput = styled7.input.attrs({
|
|
|
732
750
|
// src/components/TextField/index.tsx
|
|
733
751
|
import { useTextField } from "@react-aria/textfield";
|
|
734
752
|
import { useVisuallyHidden } from "@react-aria/visually-hidden";
|
|
735
|
-
import
|
|
753
|
+
import React10, {
|
|
736
754
|
useCallback as useCallback3,
|
|
737
755
|
useEffect,
|
|
738
756
|
useRef as useRef2,
|
|
@@ -741,10 +759,10 @@ import React9, {
|
|
|
741
759
|
import styled9, { css as css3 } from "styled-components";
|
|
742
760
|
|
|
743
761
|
// src/components/FieldLabel/index.tsx
|
|
744
|
-
import
|
|
762
|
+
import React9 from "react";
|
|
745
763
|
import styled8 from "styled-components";
|
|
746
764
|
import { createTheme as createTheme2 } from "@charcoal-ui/styled";
|
|
747
|
-
var FieldLabel =
|
|
765
|
+
var FieldLabel = React9.forwardRef(
|
|
748
766
|
function FieldLabel2({
|
|
749
767
|
style,
|
|
750
768
|
className,
|
|
@@ -754,7 +772,7 @@ var FieldLabel = React8.forwardRef(
|
|
|
754
772
|
subLabel,
|
|
755
773
|
...labelProps
|
|
756
774
|
}, ref) {
|
|
757
|
-
return /* @__PURE__ */
|
|
775
|
+
return /* @__PURE__ */ React9.createElement(FieldLabelWrapper, { style, className }, /* @__PURE__ */ React9.createElement(Label2, { ref, ...labelProps }, label), required && /* @__PURE__ */ React9.createElement(RequiredText, null, requiredText), /* @__PURE__ */ React9.createElement(SubLabelClickable, null, /* @__PURE__ */ React9.createElement("span", null, subLabel)));
|
|
758
776
|
}
|
|
759
777
|
);
|
|
760
778
|
var FieldLabel_default = FieldLabel;
|
|
@@ -803,13 +821,13 @@ function mergeRefs(...refs) {
|
|
|
803
821
|
function countCodePointsInString(string) {
|
|
804
822
|
return Array.from(string).length;
|
|
805
823
|
}
|
|
806
|
-
var TextField =
|
|
824
|
+
var TextField = React10.forwardRef(
|
|
807
825
|
function TextField2(props, ref) {
|
|
808
|
-
return props.multiline !== void 0 && props.multiline ? /* @__PURE__ */
|
|
826
|
+
return props.multiline !== void 0 && props.multiline ? /* @__PURE__ */ React10.createElement(MultiLineTextField, { ref, ...props }) : /* @__PURE__ */ React10.createElement(SingleLineTextField, { ref, ...props });
|
|
809
827
|
}
|
|
810
828
|
);
|
|
811
829
|
var TextField_default = TextField;
|
|
812
|
-
var SingleLineTextField =
|
|
830
|
+
var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef4) {
|
|
813
831
|
const {
|
|
814
832
|
className,
|
|
815
833
|
showLabel = false,
|
|
@@ -880,7 +898,7 @@ var SingleLineTextField = React9.forwardRef(function SingleLineTextFieldInner({
|
|
|
880
898
|
prefixObserver.disconnect();
|
|
881
899
|
};
|
|
882
900
|
}, []);
|
|
883
|
-
return /* @__PURE__ */
|
|
901
|
+
return /* @__PURE__ */ React10.createElement(TextFieldRoot, { className, isDisabled: disabled }, /* @__PURE__ */ React10.createElement(
|
|
884
902
|
TextFieldLabel,
|
|
885
903
|
{
|
|
886
904
|
label,
|
|
@@ -890,7 +908,7 @@ var SingleLineTextField = React9.forwardRef(function SingleLineTextFieldInner({
|
|
|
890
908
|
...labelProps,
|
|
891
909
|
...!showLabel ? visuallyHiddenProps : {}
|
|
892
910
|
}
|
|
893
|
-
), /* @__PURE__ */
|
|
911
|
+
), /* @__PURE__ */ React10.createElement(StyledInputContainer, null, /* @__PURE__ */ React10.createElement(PrefixContainer, { ref: prefixRef }, /* @__PURE__ */ React10.createElement(Affix, null, prefix)), /* @__PURE__ */ React10.createElement(
|
|
894
912
|
StyledInput,
|
|
895
913
|
{
|
|
896
914
|
ref: mergeRefs(forwardRef4, ariaRef),
|
|
@@ -899,7 +917,7 @@ var SingleLineTextField = React9.forwardRef(function SingleLineTextFieldInner({
|
|
|
899
917
|
extraRightPadding: suffixWidth,
|
|
900
918
|
...inputProps
|
|
901
919
|
}
|
|
902
|
-
), /* @__PURE__ */
|
|
920
|
+
), /* @__PURE__ */ React10.createElement(SuffixContainer, { ref: suffixRef }, /* @__PURE__ */ React10.createElement(Affix, null, suffix), showCount && /* @__PURE__ */ React10.createElement(SingleLineCounter, null, maxLength !== void 0 ? `${count}/${maxLength}` : count))), assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ React10.createElement(
|
|
903
921
|
AssistiveText,
|
|
904
922
|
{
|
|
905
923
|
invalid,
|
|
@@ -908,7 +926,7 @@ var SingleLineTextField = React9.forwardRef(function SingleLineTextFieldInner({
|
|
|
908
926
|
assistiveText
|
|
909
927
|
));
|
|
910
928
|
});
|
|
911
|
-
var MultiLineTextField =
|
|
929
|
+
var MultiLineTextField = React10.forwardRef(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef4) {
|
|
912
930
|
const {
|
|
913
931
|
className,
|
|
914
932
|
showCount = false,
|
|
@@ -975,7 +993,7 @@ var MultiLineTextField = React9.forwardRef(function MultiLineTextFieldInner({ on
|
|
|
975
993
|
syncHeight(textareaRef.current);
|
|
976
994
|
}
|
|
977
995
|
}, [autoHeight, syncHeight]);
|
|
978
|
-
return /* @__PURE__ */
|
|
996
|
+
return /* @__PURE__ */ React10.createElement(TextFieldRoot, { className, isDisabled: disabled }, /* @__PURE__ */ React10.createElement(
|
|
979
997
|
TextFieldLabel,
|
|
980
998
|
{
|
|
981
999
|
label,
|
|
@@ -985,13 +1003,13 @@ var MultiLineTextField = React9.forwardRef(function MultiLineTextFieldInner({ on
|
|
|
985
1003
|
...labelProps,
|
|
986
1004
|
...!showLabel ? visuallyHiddenProps : {}
|
|
987
1005
|
}
|
|
988
|
-
), /* @__PURE__ */
|
|
1006
|
+
), /* @__PURE__ */ React10.createElement(
|
|
989
1007
|
StyledTextareaContainer,
|
|
990
1008
|
{
|
|
991
1009
|
invalid,
|
|
992
1010
|
rows: showCount ? rows + 1 : rows
|
|
993
1011
|
},
|
|
994
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ React10.createElement(
|
|
995
1013
|
StyledTextarea,
|
|
996
1014
|
{
|
|
997
1015
|
ref: mergeRefs(textareaRef, forwardRef4, ariaRef),
|
|
@@ -1000,8 +1018,8 @@ var MultiLineTextField = React9.forwardRef(function MultiLineTextFieldInner({ on
|
|
|
1000
1018
|
...inputProps
|
|
1001
1019
|
}
|
|
1002
1020
|
),
|
|
1003
|
-
showCount && /* @__PURE__ */
|
|
1004
|
-
), assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */
|
|
1021
|
+
showCount && /* @__PURE__ */ React10.createElement(MultiLineCounter, null, maxLength !== void 0 ? `${count}/${maxLength}` : count)
|
|
1022
|
+
), assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ React10.createElement(
|
|
1005
1023
|
AssistiveText,
|
|
1006
1024
|
{
|
|
1007
1025
|
invalid,
|
|
@@ -1151,10 +1169,10 @@ var AssistiveText = styled9.p`
|
|
|
1151
1169
|
`;
|
|
1152
1170
|
|
|
1153
1171
|
// src/components/Icon/index.tsx
|
|
1154
|
-
import
|
|
1172
|
+
import React11 from "react";
|
|
1155
1173
|
import "@charcoal-ui/icons";
|
|
1156
|
-
var Icon =
|
|
1157
|
-
return /* @__PURE__ */
|
|
1174
|
+
var Icon = React11.forwardRef(function IconInner({ name, scale, unsafeNonGuidelineScale, className, ...rest }, ref) {
|
|
1175
|
+
return /* @__PURE__ */ React11.createElement(
|
|
1158
1176
|
"pixiv-icon",
|
|
1159
1177
|
{
|
|
1160
1178
|
ref,
|
|
@@ -1169,12 +1187,11 @@ var Icon = React10.forwardRef(function IconInner({ name, scale, unsafeNonGuideli
|
|
|
1169
1187
|
var Icon_default = Icon;
|
|
1170
1188
|
|
|
1171
1189
|
// src/components/Modal/index.tsx
|
|
1172
|
-
import
|
|
1190
|
+
import React12, { useContext as useContext4, useRef as useRef3 } from "react";
|
|
1173
1191
|
import {
|
|
1174
1192
|
Overlay,
|
|
1175
1193
|
useModalOverlay,
|
|
1176
|
-
useOverlay
|
|
1177
|
-
usePreventScroll
|
|
1194
|
+
useOverlay
|
|
1178
1195
|
} from "@react-aria/overlays";
|
|
1179
1196
|
import styled10, { css as css4, useTheme } from "styled-components";
|
|
1180
1197
|
import { FocusScope } from "@react-aria/focus";
|
|
@@ -1208,7 +1225,6 @@ function Modal({
|
|
|
1208
1225
|
} = props;
|
|
1209
1226
|
const ref = useRef3(null);
|
|
1210
1227
|
const { overlayProps, underlayProps } = useOverlay(props, ref);
|
|
1211
|
-
usePreventScroll();
|
|
1212
1228
|
const { modalProps } = useModalOverlay(
|
|
1213
1229
|
props,
|
|
1214
1230
|
{
|
|
@@ -1244,14 +1260,14 @@ function Modal({
|
|
|
1244
1260
|
});
|
|
1245
1261
|
const showDismiss = !isMobile || bottomSheet !== true;
|
|
1246
1262
|
return transition(
|
|
1247
|
-
({ backgroundColor, transform }, item) => item && /* @__PURE__ */
|
|
1263
|
+
({ backgroundColor, transform }, item) => item && /* @__PURE__ */ React12.createElement(Overlay, { portalContainer }, /* @__PURE__ */ React12.createElement(
|
|
1248
1264
|
ModalBackground,
|
|
1249
1265
|
{
|
|
1250
1266
|
zIndex,
|
|
1251
1267
|
...underlayProps,
|
|
1252
1268
|
style: transitionEnabled ? { backgroundColor } : {}
|
|
1253
1269
|
},
|
|
1254
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ React12.createElement(FocusScope, { contain: true, restoreFocus: true, autoFocus: true }, /* @__PURE__ */ React12.createElement(
|
|
1255
1271
|
ModalDialog,
|
|
1256
1272
|
{
|
|
1257
1273
|
ref,
|
|
@@ -1262,13 +1278,13 @@ function Modal({
|
|
|
1262
1278
|
size,
|
|
1263
1279
|
bottomSheet
|
|
1264
1280
|
},
|
|
1265
|
-
/* @__PURE__ */
|
|
1281
|
+
/* @__PURE__ */ React12.createElement(
|
|
1266
1282
|
ModalContext.Provider,
|
|
1267
1283
|
{
|
|
1268
1284
|
value: { titleProps, title, close: onClose, showDismiss }
|
|
1269
1285
|
},
|
|
1270
1286
|
children,
|
|
1271
|
-
isDismissable === true && /* @__PURE__ */
|
|
1287
|
+
isDismissable === true && /* @__PURE__ */ React12.createElement(
|
|
1272
1288
|
ModalCrossButton,
|
|
1273
1289
|
{
|
|
1274
1290
|
size: "S",
|
|
@@ -1281,7 +1297,7 @@ function Modal({
|
|
|
1281
1297
|
))
|
|
1282
1298
|
);
|
|
1283
1299
|
}
|
|
1284
|
-
var ModalContext =
|
|
1300
|
+
var ModalContext = React12.createContext({
|
|
1285
1301
|
titleProps: {},
|
|
1286
1302
|
title: "",
|
|
1287
1303
|
close: void 0,
|
|
@@ -1336,7 +1352,7 @@ var ModalCrossButton = styled10(IconButton_default)`
|
|
|
1336
1352
|
`;
|
|
1337
1353
|
function ModalTitle(props) {
|
|
1338
1354
|
const { titleProps, title } = useContext4(ModalContext);
|
|
1339
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ React12.createElement(ModalHeading, { ...titleProps, ...props }, title);
|
|
1340
1356
|
}
|
|
1341
1357
|
var ModalHeading = styled10.h3`
|
|
1342
1358
|
margin: 0;
|
|
@@ -1345,11 +1361,11 @@ var ModalHeading = styled10.h3`
|
|
|
1345
1361
|
`;
|
|
1346
1362
|
|
|
1347
1363
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1348
|
-
import
|
|
1364
|
+
import React13 from "react";
|
|
1349
1365
|
import styled11 from "styled-components";
|
|
1350
1366
|
import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
|
|
1351
1367
|
function ModalHeader() {
|
|
1352
|
-
return /* @__PURE__ */
|
|
1368
|
+
return /* @__PURE__ */ React13.createElement(ModalHeaderRoot, null, /* @__PURE__ */ React13.createElement(StyledModalTitle, null));
|
|
1353
1369
|
}
|
|
1354
1370
|
var ModalHeaderRoot = styled11.div`
|
|
1355
1371
|
height: 64px;
|
|
@@ -1382,14 +1398,14 @@ var ModalButtons = styled11.div`
|
|
|
1382
1398
|
`;
|
|
1383
1399
|
|
|
1384
1400
|
// src/components/LoadingSpinner/index.tsx
|
|
1385
|
-
import
|
|
1401
|
+
import React14, { useImperativeHandle, useRef as useRef4 } from "react";
|
|
1386
1402
|
import styled12, { keyframes } from "styled-components";
|
|
1387
1403
|
function LoadingSpinner({
|
|
1388
1404
|
size = 48,
|
|
1389
1405
|
padding = 16,
|
|
1390
1406
|
transparent = false
|
|
1391
1407
|
}) {
|
|
1392
|
-
return /* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ React14.createElement(LoadingSpinnerRoot, { size, padding, transparent }, /* @__PURE__ */ React14.createElement(LoadingSpinnerIcon, null));
|
|
1393
1409
|
}
|
|
1394
1410
|
var LoadingSpinnerRoot = styled12.div.attrs({ role: "progressbar" })`
|
|
1395
1411
|
margin: auto;
|
|
@@ -1427,7 +1443,7 @@ var Icon2 = styled12.div.attrs({ role: "presentation" })`
|
|
|
1427
1443
|
animation: none;
|
|
1428
1444
|
}
|
|
1429
1445
|
`;
|
|
1430
|
-
var LoadingSpinnerIcon =
|
|
1446
|
+
var LoadingSpinnerIcon = React14.forwardRef(function LoadingSpinnerIcon2({ once = false }, ref) {
|
|
1431
1447
|
const iconRef = useRef4(null);
|
|
1432
1448
|
useImperativeHandle(ref, () => ({
|
|
1433
1449
|
restart: () => {
|
|
@@ -1439,11 +1455,11 @@ var LoadingSpinnerIcon = React13.forwardRef(function LoadingSpinnerIcon2({ once
|
|
|
1439
1455
|
delete iconRef.current.dataset.resetAnimation;
|
|
1440
1456
|
}
|
|
1441
1457
|
}));
|
|
1442
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ React14.createElement(Icon2, { ref: iconRef, once });
|
|
1443
1459
|
});
|
|
1444
1460
|
|
|
1445
1461
|
// src/components/DropdownSelector/index.tsx
|
|
1446
|
-
import
|
|
1462
|
+
import React17, { useMemo as useMemo4, useRef as useRef7 } from "react";
|
|
1447
1463
|
import styled14 from "styled-components";
|
|
1448
1464
|
import { Item, useSelectState } from "react-stately";
|
|
1449
1465
|
import { disabledSelector as disabledSelector4 } from "@charcoal-ui/utils";
|
|
@@ -1452,2359 +1468,19 @@ import { useSelect, HiddenSelect } from "@react-aria/select";
|
|
|
1452
1468
|
import { useButton } from "@react-aria/button";
|
|
1453
1469
|
|
|
1454
1470
|
// src/components/DropdownSelector/Listbox.tsx
|
|
1455
|
-
import
|
|
1471
|
+
import React15, { memo, useRef as useRef5, Fragment, useMemo as useMemo2 } from "react";
|
|
1456
1472
|
import styled13, { css as css5 } from "styled-components";
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
import $12uGp$react, { useState as $12uGp$useState, useRef as $12uGp$useRef, useCallback as $12uGp$useCallback, useEffect as $12uGp$useEffect } from "react";
|
|
1460
|
-
import { useSSRSafeId as $12uGp$useSSRSafeId } from "@react-aria/ssr";
|
|
1461
|
-
|
|
1462
|
-
// ../../node_modules/clsx/dist/clsx.m.js
|
|
1463
|
-
function toVal(mix) {
|
|
1464
|
-
var k, y, str = "";
|
|
1465
|
-
if (typeof mix === "string" || typeof mix === "number") {
|
|
1466
|
-
str += mix;
|
|
1467
|
-
} else if (typeof mix === "object") {
|
|
1468
|
-
if (Array.isArray(mix)) {
|
|
1469
|
-
for (k = 0; k < mix.length; k++) {
|
|
1470
|
-
if (mix[k]) {
|
|
1471
|
-
if (y = toVal(mix[k])) {
|
|
1472
|
-
str && (str += " ");
|
|
1473
|
-
str += y;
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
} else {
|
|
1478
|
-
for (k in mix) {
|
|
1479
|
-
if (mix[k]) {
|
|
1480
|
-
str && (str += " ");
|
|
1481
|
-
str += k;
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
return str;
|
|
1487
|
-
}
|
|
1488
|
-
function clsx_m_default() {
|
|
1489
|
-
var i = 0, tmp, x, str = "";
|
|
1490
|
-
while (i < arguments.length) {
|
|
1491
|
-
if (tmp = arguments[i++]) {
|
|
1492
|
-
if (x = toVal(tmp)) {
|
|
1493
|
-
str && (str += " ");
|
|
1494
|
-
str += x;
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
return str;
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
// ../../node_modules/@react-aria/utils/dist/module.js
|
|
1502
|
-
var $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof window !== "undefined" ? $12uGp$react.useLayoutEffect : () => {
|
|
1503
|
-
};
|
|
1504
|
-
var $bdb11010cef70236$var$idsUpdaterMap = /* @__PURE__ */ new Map();
|
|
1505
|
-
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
|
|
1506
|
-
let [value, setValue] = $12uGp$useState(defaultId);
|
|
1507
|
-
let nextId = $12uGp$useRef(null);
|
|
1508
|
-
let res = $12uGp$useSSRSafeId(value);
|
|
1509
|
-
let updateValue = $12uGp$useCallback((val) => {
|
|
1510
|
-
nextId.current = val;
|
|
1511
|
-
}, []);
|
|
1512
|
-
$bdb11010cef70236$var$idsUpdaterMap.set(res, updateValue);
|
|
1513
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1514
|
-
let r = res;
|
|
1515
|
-
return () => {
|
|
1516
|
-
$bdb11010cef70236$var$idsUpdaterMap.delete(r);
|
|
1517
|
-
};
|
|
1518
|
-
}, [
|
|
1519
|
-
res
|
|
1520
|
-
]);
|
|
1521
|
-
$12uGp$useEffect(() => {
|
|
1522
|
-
let newId = nextId.current;
|
|
1523
|
-
if (newId) {
|
|
1524
|
-
nextId.current = null;
|
|
1525
|
-
setValue(newId);
|
|
1526
|
-
}
|
|
1527
|
-
});
|
|
1528
|
-
return res;
|
|
1529
|
-
}
|
|
1530
|
-
function $bdb11010cef70236$export$cd8c9cb68f842629(idA, idB) {
|
|
1531
|
-
if (idA === idB)
|
|
1532
|
-
return idA;
|
|
1533
|
-
let setIdA = $bdb11010cef70236$var$idsUpdaterMap.get(idA);
|
|
1534
|
-
if (setIdA) {
|
|
1535
|
-
setIdA(idB);
|
|
1536
|
-
return idB;
|
|
1537
|
-
}
|
|
1538
|
-
let setIdB = $bdb11010cef70236$var$idsUpdaterMap.get(idB);
|
|
1539
|
-
if (setIdB) {
|
|
1540
|
-
setIdB(idA);
|
|
1541
|
-
return idA;
|
|
1542
|
-
}
|
|
1543
|
-
return idB;
|
|
1544
|
-
}
|
|
1545
|
-
function $bdb11010cef70236$export$b4cc09c592e8fdb8(depArray = []) {
|
|
1546
|
-
let id = $bdb11010cef70236$export$f680877a34711e37();
|
|
1547
|
-
let [resolvedId, setResolvedId] = $1dbecbe27a04f9af$export$14d238f342723f25(id);
|
|
1548
|
-
let updateId = $12uGp$useCallback(() => {
|
|
1549
|
-
setResolvedId(function* () {
|
|
1550
|
-
yield id;
|
|
1551
|
-
yield document.getElementById(id) ? id : void 0;
|
|
1552
|
-
});
|
|
1553
|
-
}, [
|
|
1554
|
-
id,
|
|
1555
|
-
setResolvedId
|
|
1556
|
-
]);
|
|
1557
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(updateId, [
|
|
1558
|
-
id,
|
|
1559
|
-
updateId,
|
|
1560
|
-
...depArray
|
|
1561
|
-
]);
|
|
1562
|
-
return resolvedId;
|
|
1563
|
-
}
|
|
1564
|
-
function $ff5963eb1fccf552$export$e08e3b67e392101e(...callbacks) {
|
|
1565
|
-
return (...args) => {
|
|
1566
|
-
for (let callback of callbacks)
|
|
1567
|
-
if (typeof callback === "function")
|
|
1568
|
-
callback(...args);
|
|
1569
|
-
};
|
|
1570
|
-
}
|
|
1571
|
-
function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
|
|
1572
|
-
let result = {
|
|
1573
|
-
...args[0]
|
|
1574
|
-
};
|
|
1575
|
-
for (let i = 1; i < args.length; i++) {
|
|
1576
|
-
let props = args[i];
|
|
1577
|
-
for (let key in props) {
|
|
1578
|
-
let a = result[key];
|
|
1579
|
-
let b = props[key];
|
|
1580
|
-
if (typeof a === "function" && typeof b === "function" && key[0] === "o" && key[1] === "n" && key.charCodeAt(2) >= 65 && key.charCodeAt(2) <= 90)
|
|
1581
|
-
result[key] = $ff5963eb1fccf552$export$e08e3b67e392101e(a, b);
|
|
1582
|
-
else if ((key === "className" || key === "UNSAFE_className") && typeof a === "string" && typeof b === "string")
|
|
1583
|
-
result[key] = clsx_m_default(a, b);
|
|
1584
|
-
else if (key === "id" && a && b)
|
|
1585
|
-
result.id = $bdb11010cef70236$export$cd8c9cb68f842629(a, b);
|
|
1586
|
-
else
|
|
1587
|
-
result[key] = b !== void 0 ? b : a;
|
|
1588
|
-
}
|
|
1589
|
-
}
|
|
1590
|
-
return result;
|
|
1591
|
-
}
|
|
1592
|
-
var $65484d02dcb7eb3e$var$DOMPropNames = /* @__PURE__ */ new Set([
|
|
1593
|
-
"id"
|
|
1594
|
-
]);
|
|
1595
|
-
var $65484d02dcb7eb3e$var$labelablePropNames = /* @__PURE__ */ new Set([
|
|
1596
|
-
"aria-label",
|
|
1597
|
-
"aria-labelledby",
|
|
1598
|
-
"aria-describedby",
|
|
1599
|
-
"aria-details"
|
|
1600
|
-
]);
|
|
1601
|
-
var $65484d02dcb7eb3e$var$propRe = /^(data-.*)$/;
|
|
1602
|
-
function $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, opts = {}) {
|
|
1603
|
-
let { labelable, propNames } = opts;
|
|
1604
|
-
let filteredProps = {};
|
|
1605
|
-
for (const prop in props)
|
|
1606
|
-
if (Object.prototype.hasOwnProperty.call(props, prop) && ($65484d02dcb7eb3e$var$DOMPropNames.has(prop) || labelable && $65484d02dcb7eb3e$var$labelablePropNames.has(prop) || (propNames === null || propNames === void 0 ? void 0 : propNames.has(prop)) || $65484d02dcb7eb3e$var$propRe.test(prop)))
|
|
1607
|
-
filteredProps[prop] = props[prop];
|
|
1608
|
-
return filteredProps;
|
|
1609
|
-
}
|
|
1610
|
-
function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
|
|
1611
|
-
if ($7215afc6de606d6b$var$supportsPreventScroll())
|
|
1612
|
-
element.focus({
|
|
1613
|
-
preventScroll: true
|
|
1614
|
-
});
|
|
1615
|
-
else {
|
|
1616
|
-
let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element);
|
|
1617
|
-
element.focus();
|
|
1618
|
-
$7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
var $7215afc6de606d6b$var$supportsPreventScrollCached = null;
|
|
1622
|
-
function $7215afc6de606d6b$var$supportsPreventScroll() {
|
|
1623
|
-
if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
|
|
1624
|
-
$7215afc6de606d6b$var$supportsPreventScrollCached = false;
|
|
1625
|
-
try {
|
|
1626
|
-
var focusElem = document.createElement("div");
|
|
1627
|
-
focusElem.focus({
|
|
1628
|
-
get preventScroll() {
|
|
1629
|
-
$7215afc6de606d6b$var$supportsPreventScrollCached = true;
|
|
1630
|
-
return true;
|
|
1631
|
-
}
|
|
1632
|
-
});
|
|
1633
|
-
} catch (e) {
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
return $7215afc6de606d6b$var$supportsPreventScrollCached;
|
|
1637
|
-
}
|
|
1638
|
-
function $7215afc6de606d6b$var$getScrollableElements(element) {
|
|
1639
|
-
var parent = element.parentNode;
|
|
1640
|
-
var scrollableElements = [];
|
|
1641
|
-
var rootScrollingElement = document.scrollingElement || document.documentElement;
|
|
1642
|
-
while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
|
|
1643
|
-
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth)
|
|
1644
|
-
scrollableElements.push({
|
|
1645
|
-
element: parent,
|
|
1646
|
-
scrollTop: parent.scrollTop,
|
|
1647
|
-
scrollLeft: parent.scrollLeft
|
|
1648
|
-
});
|
|
1649
|
-
parent = parent.parentNode;
|
|
1650
|
-
}
|
|
1651
|
-
if (rootScrollingElement instanceof HTMLElement)
|
|
1652
|
-
scrollableElements.push({
|
|
1653
|
-
element: rootScrollingElement,
|
|
1654
|
-
scrollTop: rootScrollingElement.scrollTop,
|
|
1655
|
-
scrollLeft: rootScrollingElement.scrollLeft
|
|
1656
|
-
});
|
|
1657
|
-
return scrollableElements;
|
|
1658
|
-
}
|
|
1659
|
-
function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
|
|
1660
|
-
for (let { element, scrollTop, scrollLeft } of scrollableElements) {
|
|
1661
|
-
element.scrollTop = scrollTop;
|
|
1662
|
-
element.scrollLeft = scrollLeft;
|
|
1663
|
-
}
|
|
1664
|
-
}
|
|
1665
|
-
var $bbed8b41f857bcc0$var$transitionsByElement = /* @__PURE__ */ new Map();
|
|
1666
|
-
var $bbed8b41f857bcc0$var$transitionCallbacks = /* @__PURE__ */ new Set();
|
|
1667
|
-
function $bbed8b41f857bcc0$var$setupGlobalEvents() {
|
|
1668
|
-
if (typeof window === "undefined")
|
|
1669
|
-
return;
|
|
1670
|
-
let onTransitionStart = (e) => {
|
|
1671
|
-
let transitions = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
1672
|
-
if (!transitions) {
|
|
1673
|
-
transitions = /* @__PURE__ */ new Set();
|
|
1674
|
-
$bbed8b41f857bcc0$var$transitionsByElement.set(e.target, transitions);
|
|
1675
|
-
e.target.addEventListener("transitioncancel", onTransitionEnd);
|
|
1676
|
-
}
|
|
1677
|
-
transitions.add(e.propertyName);
|
|
1678
|
-
};
|
|
1679
|
-
let onTransitionEnd = (e) => {
|
|
1680
|
-
let properties = $bbed8b41f857bcc0$var$transitionsByElement.get(e.target);
|
|
1681
|
-
if (!properties)
|
|
1682
|
-
return;
|
|
1683
|
-
properties.delete(e.propertyName);
|
|
1684
|
-
if (properties.size === 0) {
|
|
1685
|
-
e.target.removeEventListener("transitioncancel", onTransitionEnd);
|
|
1686
|
-
$bbed8b41f857bcc0$var$transitionsByElement.delete(e.target);
|
|
1687
|
-
}
|
|
1688
|
-
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0) {
|
|
1689
|
-
for (let cb of $bbed8b41f857bcc0$var$transitionCallbacks)
|
|
1690
|
-
cb();
|
|
1691
|
-
$bbed8b41f857bcc0$var$transitionCallbacks.clear();
|
|
1692
|
-
}
|
|
1693
|
-
};
|
|
1694
|
-
document.body.addEventListener("transitionrun", onTransitionStart);
|
|
1695
|
-
document.body.addEventListener("transitionend", onTransitionEnd);
|
|
1696
|
-
}
|
|
1697
|
-
if (typeof document !== "undefined") {
|
|
1698
|
-
if (document.readyState !== "loading")
|
|
1699
|
-
$bbed8b41f857bcc0$var$setupGlobalEvents();
|
|
1700
|
-
else
|
|
1701
|
-
document.addEventListener("DOMContentLoaded", $bbed8b41f857bcc0$var$setupGlobalEvents);
|
|
1702
|
-
}
|
|
1703
|
-
function $bbed8b41f857bcc0$export$24490316f764c430(fn) {
|
|
1704
|
-
requestAnimationFrame(() => {
|
|
1705
|
-
if ($bbed8b41f857bcc0$var$transitionsByElement.size === 0)
|
|
1706
|
-
fn();
|
|
1707
|
-
else
|
|
1708
|
-
$bbed8b41f857bcc0$var$transitionCallbacks.add(fn);
|
|
1709
|
-
});
|
|
1710
|
-
}
|
|
1711
|
-
function $03deb23ff14920c4$export$4eaf04e54aa8eed6() {
|
|
1712
|
-
let globalListeners = $12uGp$useRef(/* @__PURE__ */ new Map());
|
|
1713
|
-
let addGlobalListener = $12uGp$useCallback((eventTarget, type, listener, options) => {
|
|
1714
|
-
let fn = (options === null || options === void 0 ? void 0 : options.once) ? (...args) => {
|
|
1715
|
-
globalListeners.current.delete(listener);
|
|
1716
|
-
listener(...args);
|
|
1717
|
-
} : listener;
|
|
1718
|
-
globalListeners.current.set(listener, {
|
|
1719
|
-
type,
|
|
1720
|
-
eventTarget,
|
|
1721
|
-
fn,
|
|
1722
|
-
options
|
|
1723
|
-
});
|
|
1724
|
-
eventTarget.addEventListener(type, listener, options);
|
|
1725
|
-
}, []);
|
|
1726
|
-
let removeGlobalListener = $12uGp$useCallback((eventTarget, type, listener, options) => {
|
|
1727
|
-
var ref;
|
|
1728
|
-
let fn = ((ref = globalListeners.current.get(listener)) === null || ref === void 0 ? void 0 : ref.fn) || listener;
|
|
1729
|
-
eventTarget.removeEventListener(type, fn, options);
|
|
1730
|
-
globalListeners.current.delete(listener);
|
|
1731
|
-
}, []);
|
|
1732
|
-
let removeAllGlobalListeners = $12uGp$useCallback(() => {
|
|
1733
|
-
globalListeners.current.forEach((value, key) => {
|
|
1734
|
-
removeGlobalListener(value.eventTarget, value.type, key, value.options);
|
|
1735
|
-
});
|
|
1736
|
-
}, [
|
|
1737
|
-
removeGlobalListener
|
|
1738
|
-
]);
|
|
1739
|
-
$12uGp$useEffect(() => {
|
|
1740
|
-
return removeAllGlobalListeners;
|
|
1741
|
-
}, [
|
|
1742
|
-
removeAllGlobalListeners
|
|
1743
|
-
]);
|
|
1744
|
-
return {
|
|
1745
|
-
addGlobalListener,
|
|
1746
|
-
removeGlobalListener,
|
|
1747
|
-
removeAllGlobalListeners
|
|
1748
|
-
};
|
|
1749
|
-
}
|
|
1750
|
-
function $313b98861ee5dd6c$export$d6875122194c7b44(props, defaultLabel) {
|
|
1751
|
-
let { id, "aria-label": label, "aria-labelledby": labelledBy } = props;
|
|
1752
|
-
id = $bdb11010cef70236$export$f680877a34711e37(id);
|
|
1753
|
-
if (labelledBy && label) {
|
|
1754
|
-
let ids = /* @__PURE__ */ new Set([
|
|
1755
|
-
...labelledBy.trim().split(/\s+/),
|
|
1756
|
-
id
|
|
1757
|
-
]);
|
|
1758
|
-
labelledBy = [
|
|
1759
|
-
...ids
|
|
1760
|
-
].join(" ");
|
|
1761
|
-
} else if (labelledBy)
|
|
1762
|
-
labelledBy = labelledBy.trim().split(/\s+/).join(" ");
|
|
1763
|
-
if (!label && !labelledBy && defaultLabel)
|
|
1764
|
-
label = defaultLabel;
|
|
1765
|
-
return {
|
|
1766
|
-
id,
|
|
1767
|
-
"aria-label": label,
|
|
1768
|
-
"aria-labelledby": labelledBy
|
|
1769
|
-
};
|
|
1770
|
-
}
|
|
1771
|
-
function $df56164dff5785e2$export$4338b53315abf666(forwardedRef) {
|
|
1772
|
-
const objRef = $12uGp$useRef();
|
|
1773
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1774
|
-
if (!forwardedRef)
|
|
1775
|
-
return;
|
|
1776
|
-
if (typeof forwardedRef === "function")
|
|
1777
|
-
forwardedRef(objRef.current);
|
|
1778
|
-
else
|
|
1779
|
-
forwardedRef.current = objRef.current;
|
|
1780
|
-
}, [
|
|
1781
|
-
forwardedRef
|
|
1782
|
-
]);
|
|
1783
|
-
return objRef;
|
|
1784
|
-
}
|
|
1785
|
-
function $e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, ref) {
|
|
1786
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1787
|
-
if (context && context.ref && ref) {
|
|
1788
|
-
context.ref.current = ref.current;
|
|
1789
|
-
return () => {
|
|
1790
|
-
context.ref.current = null;
|
|
1791
|
-
};
|
|
1792
|
-
}
|
|
1793
|
-
}, [
|
|
1794
|
-
context,
|
|
1795
|
-
ref
|
|
1796
|
-
]);
|
|
1797
|
-
}
|
|
1798
|
-
var $5df64b3807dc15ee$var$visualViewport = typeof window !== "undefined" && window.visualViewport;
|
|
1799
|
-
var $ef06256079686ba0$var$descriptionId = 0;
|
|
1800
|
-
var $ef06256079686ba0$var$descriptionNodes = /* @__PURE__ */ new Map();
|
|
1801
|
-
function $ef06256079686ba0$export$f8aeda7b10753fa1(description) {
|
|
1802
|
-
let [id1, setId] = $12uGp$useState(void 0);
|
|
1803
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1804
|
-
if (!description)
|
|
1805
|
-
return;
|
|
1806
|
-
let desc = $ef06256079686ba0$var$descriptionNodes.get(description);
|
|
1807
|
-
if (!desc) {
|
|
1808
|
-
let id = `react-aria-description-${$ef06256079686ba0$var$descriptionId++}`;
|
|
1809
|
-
setId(id);
|
|
1810
|
-
let node = document.createElement("div");
|
|
1811
|
-
node.id = id;
|
|
1812
|
-
node.style.display = "none";
|
|
1813
|
-
node.textContent = description;
|
|
1814
|
-
document.body.appendChild(node);
|
|
1815
|
-
desc = {
|
|
1816
|
-
refCount: 0,
|
|
1817
|
-
element: node
|
|
1818
|
-
};
|
|
1819
|
-
$ef06256079686ba0$var$descriptionNodes.set(description, desc);
|
|
1820
|
-
} else
|
|
1821
|
-
setId(desc.element.id);
|
|
1822
|
-
desc.refCount++;
|
|
1823
|
-
return () => {
|
|
1824
|
-
if (--desc.refCount === 0) {
|
|
1825
|
-
desc.element.remove();
|
|
1826
|
-
$ef06256079686ba0$var$descriptionNodes.delete(description);
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1829
|
-
}, [
|
|
1830
|
-
description
|
|
1831
|
-
]);
|
|
1832
|
-
return {
|
|
1833
|
-
"aria-describedby": description ? id1 : void 0
|
|
1834
|
-
};
|
|
1835
|
-
}
|
|
1836
|
-
function $c87311424ea30a05$var$testUserAgent(re) {
|
|
1837
|
-
var ref;
|
|
1838
|
-
if (typeof window === "undefined" || window.navigator == null)
|
|
1839
|
-
return false;
|
|
1840
|
-
return ((ref = window.navigator["userAgentData"]) === null || ref === void 0 ? void 0 : ref.brands.some(
|
|
1841
|
-
(brand) => re.test(brand.brand)
|
|
1842
|
-
)) || re.test(window.navigator.userAgent);
|
|
1843
|
-
}
|
|
1844
|
-
function $c87311424ea30a05$var$testPlatform(re) {
|
|
1845
|
-
var ref;
|
|
1846
|
-
return typeof window !== "undefined" && window.navigator != null ? re.test(((ref = window.navigator["userAgentData"]) === null || ref === void 0 ? void 0 : ref.platform) || window.navigator.platform) : false;
|
|
1847
|
-
}
|
|
1848
|
-
function $c87311424ea30a05$export$9ac100e40613ea10() {
|
|
1849
|
-
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
1850
|
-
}
|
|
1851
|
-
function $c87311424ea30a05$export$186c6964ca17d99() {
|
|
1852
|
-
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
1853
|
-
}
|
|
1854
|
-
function $c87311424ea30a05$export$7bef049ce92e4224() {
|
|
1855
|
-
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || $c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
1856
|
-
}
|
|
1857
|
-
function $c87311424ea30a05$export$fedb369cb70207f1() {
|
|
1858
|
-
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
1859
|
-
}
|
|
1860
|
-
function $c87311424ea30a05$export$e1865c3bedcd822b() {
|
|
1861
|
-
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
1862
|
-
}
|
|
1863
|
-
function $c87311424ea30a05$export$78551043582a6a98() {
|
|
1864
|
-
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
1865
|
-
}
|
|
1866
|
-
function $c87311424ea30a05$export$6446a186d09e379e() {
|
|
1867
|
-
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
1868
|
-
}
|
|
1869
|
-
function $c87311424ea30a05$export$a11b0059900ceec8() {
|
|
1870
|
-
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
1871
|
-
}
|
|
1872
|
-
function $e9faafb641e167db$export$90fc3a17d93f704c(ref, event, handler1, options) {
|
|
1873
|
-
let handlerRef = $12uGp$useRef(handler1);
|
|
1874
|
-
handlerRef.current = handler1;
|
|
1875
|
-
let isDisabled = handler1 == null;
|
|
1876
|
-
$12uGp$useEffect(() => {
|
|
1877
|
-
if (isDisabled)
|
|
1878
|
-
return;
|
|
1879
|
-
let element = ref.current;
|
|
1880
|
-
let handler = (e) => handlerRef.current.call(this, e);
|
|
1881
|
-
element.addEventListener(event, handler, options);
|
|
1882
|
-
return () => {
|
|
1883
|
-
element.removeEventListener(event, handler, options);
|
|
1884
|
-
};
|
|
1885
|
-
}, [
|
|
1886
|
-
ref,
|
|
1887
|
-
event,
|
|
1888
|
-
options,
|
|
1889
|
-
isDisabled
|
|
1890
|
-
]);
|
|
1891
|
-
}
|
|
1892
|
-
function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
|
|
1893
|
-
let [value, setValue] = $12uGp$useState(defaultValue);
|
|
1894
|
-
let valueRef = $12uGp$useRef(value);
|
|
1895
|
-
let effect = $12uGp$useRef(null);
|
|
1896
|
-
valueRef.current = value;
|
|
1897
|
-
let nextRef = $12uGp$useRef(null);
|
|
1898
|
-
nextRef.current = () => {
|
|
1899
|
-
let newValue = effect.current.next();
|
|
1900
|
-
if (newValue.done) {
|
|
1901
|
-
effect.current = null;
|
|
1902
|
-
return;
|
|
1903
|
-
}
|
|
1904
|
-
if (value === newValue.value)
|
|
1905
|
-
nextRef.current();
|
|
1906
|
-
else
|
|
1907
|
-
setValue(newValue.value);
|
|
1908
|
-
};
|
|
1909
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
1910
|
-
if (effect.current)
|
|
1911
|
-
nextRef.current();
|
|
1912
|
-
});
|
|
1913
|
-
let queue = $12uGp$useCallback((fn) => {
|
|
1914
|
-
effect.current = fn(valueRef.current);
|
|
1915
|
-
nextRef.current();
|
|
1916
|
-
}, [
|
|
1917
|
-
effect,
|
|
1918
|
-
nextRef
|
|
1919
|
-
]);
|
|
1920
|
-
return [
|
|
1921
|
-
value,
|
|
1922
|
-
queue
|
|
1923
|
-
];
|
|
1924
|
-
}
|
|
1925
|
-
function $2f04cbc44ee30ce0$export$53a0910f038337bd(scrollView, element) {
|
|
1926
|
-
let offsetX = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "left");
|
|
1927
|
-
let offsetY = $2f04cbc44ee30ce0$var$relativeOffset(scrollView, element, "top");
|
|
1928
|
-
let width = element.offsetWidth;
|
|
1929
|
-
let height = element.offsetHeight;
|
|
1930
|
-
let x = scrollView.scrollLeft;
|
|
1931
|
-
let y = scrollView.scrollTop;
|
|
1932
|
-
let maxX = x + scrollView.offsetWidth;
|
|
1933
|
-
let maxY = y + scrollView.offsetHeight;
|
|
1934
|
-
if (offsetX <= x)
|
|
1935
|
-
x = offsetX;
|
|
1936
|
-
else if (offsetX + width > maxX)
|
|
1937
|
-
x += offsetX + width - maxX;
|
|
1938
|
-
if (offsetY <= y)
|
|
1939
|
-
y = offsetY;
|
|
1940
|
-
else if (offsetY + height > maxY)
|
|
1941
|
-
y += offsetY + height - maxY;
|
|
1942
|
-
scrollView.scrollLeft = x;
|
|
1943
|
-
scrollView.scrollTop = y;
|
|
1944
|
-
}
|
|
1945
|
-
function $2f04cbc44ee30ce0$var$relativeOffset(ancestor, child, axis) {
|
|
1946
|
-
const prop = axis === "left" ? "offsetLeft" : "offsetTop";
|
|
1947
|
-
let sum = 0;
|
|
1948
|
-
while (child.offsetParent) {
|
|
1949
|
-
sum += child[prop];
|
|
1950
|
-
if (child.offsetParent === ancestor)
|
|
1951
|
-
break;
|
|
1952
|
-
else if (child.offsetParent.contains(ancestor)) {
|
|
1953
|
-
sum -= ancestor[prop];
|
|
1954
|
-
break;
|
|
1955
|
-
}
|
|
1956
|
-
child = child.offsetParent;
|
|
1957
|
-
}
|
|
1958
|
-
return sum;
|
|
1959
|
-
}
|
|
1960
|
-
function $6a7db85432448f7f$export$60278871457622de(event) {
|
|
1961
|
-
if (event.mozInputSource === 0 && event.isTrusted)
|
|
1962
|
-
return true;
|
|
1963
|
-
if ($c87311424ea30a05$export$a11b0059900ceec8() && event.pointerType)
|
|
1964
|
-
return event.type === "click" && event.buttons === 1;
|
|
1965
|
-
return event.detail === 0 && !event.pointerType;
|
|
1966
|
-
}
|
|
1967
|
-
function $6a7db85432448f7f$export$29bf1b5f2c56cf63(event) {
|
|
1968
|
-
return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
// ../../node_modules/@react-aria/interactions/dist/module.js
|
|
1972
|
-
import $bx7SL$react, { useRef as $bx7SL$useRef, useContext as $bx7SL$useContext, useState as $bx7SL$useState, useMemo as $bx7SL$useMemo, useEffect as $bx7SL$useEffect, useCallback as $bx7SL$useCallback } from "react";
|
|
1973
|
-
var $14c0b72509d70225$var$state = "default";
|
|
1974
|
-
var $14c0b72509d70225$var$savedUserSelect = "";
|
|
1975
|
-
var $14c0b72509d70225$var$modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
1976
|
-
function $14c0b72509d70225$export$16a4697467175487(target) {
|
|
1977
|
-
if ($c87311424ea30a05$export$fedb369cb70207f1()) {
|
|
1978
|
-
if ($14c0b72509d70225$var$state === "default") {
|
|
1979
|
-
$14c0b72509d70225$var$savedUserSelect = document.documentElement.style.webkitUserSelect;
|
|
1980
|
-
document.documentElement.style.webkitUserSelect = "none";
|
|
1981
|
-
}
|
|
1982
|
-
$14c0b72509d70225$var$state = "disabled";
|
|
1983
|
-
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
1984
|
-
$14c0b72509d70225$var$modifiedElementMap.set(target, target.style.userSelect);
|
|
1985
|
-
target.style.userSelect = "none";
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
function $14c0b72509d70225$export$b0d6fa1ab32e3295(target) {
|
|
1989
|
-
if ($c87311424ea30a05$export$fedb369cb70207f1()) {
|
|
1990
|
-
if ($14c0b72509d70225$var$state !== "disabled")
|
|
1991
|
-
return;
|
|
1992
|
-
$14c0b72509d70225$var$state = "restoring";
|
|
1993
|
-
setTimeout(() => {
|
|
1994
|
-
$bbed8b41f857bcc0$export$24490316f764c430(() => {
|
|
1995
|
-
if ($14c0b72509d70225$var$state === "restoring") {
|
|
1996
|
-
if (document.documentElement.style.webkitUserSelect === "none")
|
|
1997
|
-
document.documentElement.style.webkitUserSelect = $14c0b72509d70225$var$savedUserSelect || "";
|
|
1998
|
-
$14c0b72509d70225$var$savedUserSelect = "";
|
|
1999
|
-
$14c0b72509d70225$var$state = "default";
|
|
2000
|
-
}
|
|
2001
|
-
});
|
|
2002
|
-
}, 300);
|
|
2003
|
-
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
2004
|
-
if (target && $14c0b72509d70225$var$modifiedElementMap.has(target)) {
|
|
2005
|
-
let targetOldUserSelect = $14c0b72509d70225$var$modifiedElementMap.get(target);
|
|
2006
|
-
if (target.style.userSelect === "none")
|
|
2007
|
-
target.style.userSelect = targetOldUserSelect;
|
|
2008
|
-
if (target.getAttribute("style") === "")
|
|
2009
|
-
target.removeAttribute("style");
|
|
2010
|
-
$14c0b72509d70225$var$modifiedElementMap.delete(target);
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
var $ae1eeba8b9eafd08$export$5165eccb35aaadb5 = $bx7SL$react.createContext(null);
|
|
2015
|
-
$ae1eeba8b9eafd08$export$5165eccb35aaadb5.displayName = "PressResponderContext";
|
|
2016
|
-
function $f6c31cce2adf654f$var$usePressResponderContext(props) {
|
|
2017
|
-
let context = $bx7SL$useContext($ae1eeba8b9eafd08$export$5165eccb35aaadb5);
|
|
2018
|
-
if (context) {
|
|
2019
|
-
let { register, ...contextProps } = context;
|
|
2020
|
-
props = $3ef42575df84b30b$export$9d1611c77c2fe928(contextProps, props);
|
|
2021
|
-
register();
|
|
2022
|
-
}
|
|
2023
|
-
$e7801be82b4b2a53$export$4debdb1a3f0fa79e(context, props.ref);
|
|
2024
|
-
return props;
|
|
2025
|
-
}
|
|
2026
|
-
function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
2027
|
-
let {
|
|
2028
|
-
onPress: onPress1,
|
|
2029
|
-
onPressChange: onPressChange1,
|
|
2030
|
-
onPressStart: onPressStart1,
|
|
2031
|
-
onPressEnd: onPressEnd1,
|
|
2032
|
-
onPressUp: onPressUp1,
|
|
2033
|
-
isDisabled: isDisabled1,
|
|
2034
|
-
isPressed: isPressedProp,
|
|
2035
|
-
preventFocusOnPress,
|
|
2036
|
-
shouldCancelOnPointerExit,
|
|
2037
|
-
allowTextSelectionOnPress,
|
|
2038
|
-
ref: _,
|
|
2039
|
-
...domProps
|
|
2040
|
-
} = $f6c31cce2adf654f$var$usePressResponderContext(props);
|
|
2041
|
-
let propsRef = $bx7SL$useRef(null);
|
|
2042
|
-
propsRef.current = {
|
|
2043
|
-
onPress: onPress1,
|
|
2044
|
-
onPressChange: onPressChange1,
|
|
2045
|
-
onPressStart: onPressStart1,
|
|
2046
|
-
onPressEnd: onPressEnd1,
|
|
2047
|
-
onPressUp: onPressUp1,
|
|
2048
|
-
isDisabled: isDisabled1,
|
|
2049
|
-
shouldCancelOnPointerExit
|
|
2050
|
-
};
|
|
2051
|
-
let [isPressed, setPressed] = $bx7SL$useState(false);
|
|
2052
|
-
let ref = $bx7SL$useRef({
|
|
2053
|
-
isPressed: false,
|
|
2054
|
-
ignoreEmulatedMouseEvents: false,
|
|
2055
|
-
ignoreClickAfterPress: false,
|
|
2056
|
-
didFirePressStart: false,
|
|
2057
|
-
activePointerId: null,
|
|
2058
|
-
target: null,
|
|
2059
|
-
isOverTarget: false,
|
|
2060
|
-
pointerType: null
|
|
2061
|
-
});
|
|
2062
|
-
let { addGlobalListener, removeAllGlobalListeners } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
|
|
2063
|
-
let pressProps1 = $bx7SL$useMemo(() => {
|
|
2064
|
-
let state = ref.current;
|
|
2065
|
-
let triggerPressStart = (originalEvent, pointerType) => {
|
|
2066
|
-
let { onPressStart, onPressChange, isDisabled } = propsRef.current;
|
|
2067
|
-
if (isDisabled || state.didFirePressStart)
|
|
2068
|
-
return;
|
|
2069
|
-
if (onPressStart)
|
|
2070
|
-
onPressStart({
|
|
2071
|
-
type: "pressstart",
|
|
2072
|
-
pointerType,
|
|
2073
|
-
target: originalEvent.currentTarget,
|
|
2074
|
-
shiftKey: originalEvent.shiftKey,
|
|
2075
|
-
metaKey: originalEvent.metaKey,
|
|
2076
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
2077
|
-
altKey: originalEvent.altKey
|
|
2078
|
-
});
|
|
2079
|
-
if (onPressChange)
|
|
2080
|
-
onPressChange(true);
|
|
2081
|
-
state.didFirePressStart = true;
|
|
2082
|
-
setPressed(true);
|
|
2083
|
-
};
|
|
2084
|
-
let triggerPressEnd = (originalEvent, pointerType, wasPressed = true) => {
|
|
2085
|
-
let { onPressEnd, onPressChange, onPress, isDisabled } = propsRef.current;
|
|
2086
|
-
if (!state.didFirePressStart)
|
|
2087
|
-
return;
|
|
2088
|
-
state.ignoreClickAfterPress = true;
|
|
2089
|
-
state.didFirePressStart = false;
|
|
2090
|
-
if (onPressEnd)
|
|
2091
|
-
onPressEnd({
|
|
2092
|
-
type: "pressend",
|
|
2093
|
-
pointerType,
|
|
2094
|
-
target: originalEvent.currentTarget,
|
|
2095
|
-
shiftKey: originalEvent.shiftKey,
|
|
2096
|
-
metaKey: originalEvent.metaKey,
|
|
2097
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
2098
|
-
altKey: originalEvent.altKey
|
|
2099
|
-
});
|
|
2100
|
-
if (onPressChange)
|
|
2101
|
-
onPressChange(false);
|
|
2102
|
-
setPressed(false);
|
|
2103
|
-
if (onPress && wasPressed && !isDisabled)
|
|
2104
|
-
onPress({
|
|
2105
|
-
type: "press",
|
|
2106
|
-
pointerType,
|
|
2107
|
-
target: originalEvent.currentTarget,
|
|
2108
|
-
shiftKey: originalEvent.shiftKey,
|
|
2109
|
-
metaKey: originalEvent.metaKey,
|
|
2110
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
2111
|
-
altKey: originalEvent.altKey
|
|
2112
|
-
});
|
|
2113
|
-
};
|
|
2114
|
-
let triggerPressUp = (originalEvent, pointerType) => {
|
|
2115
|
-
let { onPressUp, isDisabled } = propsRef.current;
|
|
2116
|
-
if (isDisabled)
|
|
2117
|
-
return;
|
|
2118
|
-
if (onPressUp)
|
|
2119
|
-
onPressUp({
|
|
2120
|
-
type: "pressup",
|
|
2121
|
-
pointerType,
|
|
2122
|
-
target: originalEvent.currentTarget,
|
|
2123
|
-
shiftKey: originalEvent.shiftKey,
|
|
2124
|
-
metaKey: originalEvent.metaKey,
|
|
2125
|
-
ctrlKey: originalEvent.ctrlKey,
|
|
2126
|
-
altKey: originalEvent.altKey
|
|
2127
|
-
});
|
|
2128
|
-
};
|
|
2129
|
-
let cancel = (e) => {
|
|
2130
|
-
if (state.isPressed) {
|
|
2131
|
-
if (state.isOverTarget)
|
|
2132
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
2133
|
-
state.isPressed = false;
|
|
2134
|
-
state.isOverTarget = false;
|
|
2135
|
-
state.activePointerId = null;
|
|
2136
|
-
state.pointerType = null;
|
|
2137
|
-
removeAllGlobalListeners();
|
|
2138
|
-
if (!allowTextSelectionOnPress)
|
|
2139
|
-
$14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
|
|
2140
|
-
}
|
|
2141
|
-
};
|
|
2142
|
-
let pressProps = {
|
|
2143
|
-
onKeyDown(e) {
|
|
2144
|
-
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && e.currentTarget.contains(e.target)) {
|
|
2145
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key))
|
|
2146
|
-
e.preventDefault();
|
|
2147
|
-
e.stopPropagation();
|
|
2148
|
-
if (!state.isPressed && !e.repeat) {
|
|
2149
|
-
state.target = e.currentTarget;
|
|
2150
|
-
state.isPressed = true;
|
|
2151
|
-
triggerPressStart(e, "keyboard");
|
|
2152
|
-
addGlobalListener(document, "keyup", onKeyUp, false);
|
|
2153
|
-
}
|
|
2154
|
-
} else if (e.key === "Enter" && $f6c31cce2adf654f$var$isHTMLAnchorLink(e.currentTarget))
|
|
2155
|
-
e.stopPropagation();
|
|
2156
|
-
},
|
|
2157
|
-
onKeyUp(e) {
|
|
2158
|
-
if ($f6c31cce2adf654f$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && !e.repeat && e.currentTarget.contains(e.target))
|
|
2159
|
-
triggerPressUp($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard");
|
|
2160
|
-
},
|
|
2161
|
-
onClick(e) {
|
|
2162
|
-
if (e && !e.currentTarget.contains(e.target))
|
|
2163
|
-
return;
|
|
2164
|
-
if (e && e.button === 0) {
|
|
2165
|
-
e.stopPropagation();
|
|
2166
|
-
if (isDisabled1)
|
|
2167
|
-
e.preventDefault();
|
|
2168
|
-
if (!state.ignoreClickAfterPress && !state.ignoreEmulatedMouseEvents && (state.pointerType === "virtual" || $6a7db85432448f7f$export$60278871457622de(e.nativeEvent))) {
|
|
2169
|
-
if (!isDisabled1 && !preventFocusOnPress)
|
|
2170
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
2171
|
-
triggerPressStart(e, "virtual");
|
|
2172
|
-
triggerPressUp(e, "virtual");
|
|
2173
|
-
triggerPressEnd(e, "virtual");
|
|
2174
|
-
}
|
|
2175
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
2176
|
-
state.ignoreClickAfterPress = false;
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2179
|
-
};
|
|
2180
|
-
let onKeyUp = (e) => {
|
|
2181
|
-
if (state.isPressed && $f6c31cce2adf654f$var$isValidKeyboardEvent(e, state.target)) {
|
|
2182
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(e.target, e.key))
|
|
2183
|
-
e.preventDefault();
|
|
2184
|
-
e.stopPropagation();
|
|
2185
|
-
state.isPressed = false;
|
|
2186
|
-
let target = e.target;
|
|
2187
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), "keyboard", state.target.contains(target));
|
|
2188
|
-
removeAllGlobalListeners();
|
|
2189
|
-
if (state.target instanceof HTMLElement && state.target.contains(target) && ($f6c31cce2adf654f$var$isHTMLAnchorLink(state.target) || state.target.getAttribute("role") === "link"))
|
|
2190
|
-
state.target.click();
|
|
2191
|
-
}
|
|
2192
|
-
};
|
|
2193
|
-
if (typeof PointerEvent !== "undefined") {
|
|
2194
|
-
pressProps.onPointerDown = (e) => {
|
|
2195
|
-
if (e.button !== 0 || !e.currentTarget.contains(e.target))
|
|
2196
|
-
return;
|
|
2197
|
-
if ($6a7db85432448f7f$export$29bf1b5f2c56cf63(e.nativeEvent)) {
|
|
2198
|
-
state.pointerType = "virtual";
|
|
2199
|
-
return;
|
|
2200
|
-
}
|
|
2201
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget))
|
|
2202
|
-
e.preventDefault();
|
|
2203
|
-
state.pointerType = e.pointerType;
|
|
2204
|
-
e.stopPropagation();
|
|
2205
|
-
if (!state.isPressed) {
|
|
2206
|
-
state.isPressed = true;
|
|
2207
|
-
state.isOverTarget = true;
|
|
2208
|
-
state.activePointerId = e.pointerId;
|
|
2209
|
-
state.target = e.currentTarget;
|
|
2210
|
-
if (!isDisabled1 && !preventFocusOnPress)
|
|
2211
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
2212
|
-
if (!allowTextSelectionOnPress)
|
|
2213
|
-
$14c0b72509d70225$export$16a4697467175487(state.target);
|
|
2214
|
-
triggerPressStart(e, state.pointerType);
|
|
2215
|
-
addGlobalListener(document, "pointermove", onPointerMove, false);
|
|
2216
|
-
addGlobalListener(document, "pointerup", onPointerUp, false);
|
|
2217
|
-
addGlobalListener(document, "pointercancel", onPointerCancel, false);
|
|
2218
|
-
}
|
|
2219
|
-
};
|
|
2220
|
-
pressProps.onMouseDown = (e) => {
|
|
2221
|
-
if (!e.currentTarget.contains(e.target))
|
|
2222
|
-
return;
|
|
2223
|
-
if (e.button === 0) {
|
|
2224
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget))
|
|
2225
|
-
e.preventDefault();
|
|
2226
|
-
e.stopPropagation();
|
|
2227
|
-
}
|
|
2228
|
-
};
|
|
2229
|
-
pressProps.onPointerUp = (e) => {
|
|
2230
|
-
if (!e.currentTarget.contains(e.target) || state.pointerType === "virtual")
|
|
2231
|
-
return;
|
|
2232
|
-
if (e.button === 0 && $f6c31cce2adf654f$var$isOverTarget(e, e.currentTarget))
|
|
2233
|
-
triggerPressUp(e, state.pointerType || e.pointerType);
|
|
2234
|
-
};
|
|
2235
|
-
let onPointerMove = (e) => {
|
|
2236
|
-
if (e.pointerId !== state.activePointerId)
|
|
2237
|
-
return;
|
|
2238
|
-
if ($f6c31cce2adf654f$var$isOverTarget(e, state.target)) {
|
|
2239
|
-
if (!state.isOverTarget) {
|
|
2240
|
-
state.isOverTarget = true;
|
|
2241
|
-
triggerPressStart($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
|
2242
|
-
}
|
|
2243
|
-
} else if (state.isOverTarget) {
|
|
2244
|
-
state.isOverTarget = false;
|
|
2245
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
2246
|
-
if (propsRef.current.shouldCancelOnPointerExit)
|
|
2247
|
-
cancel(e);
|
|
2248
|
-
}
|
|
2249
|
-
};
|
|
2250
|
-
let onPointerUp = (e) => {
|
|
2251
|
-
if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0) {
|
|
2252
|
-
if ($f6c31cce2adf654f$var$isOverTarget(e, state.target))
|
|
2253
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
|
2254
|
-
else if (state.isOverTarget)
|
|
2255
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
2256
|
-
state.isPressed = false;
|
|
2257
|
-
state.isOverTarget = false;
|
|
2258
|
-
state.activePointerId = null;
|
|
2259
|
-
state.pointerType = null;
|
|
2260
|
-
removeAllGlobalListeners();
|
|
2261
|
-
if (!allowTextSelectionOnPress)
|
|
2262
|
-
$14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
|
|
2263
|
-
}
|
|
2264
|
-
};
|
|
2265
|
-
let onPointerCancel = (e) => {
|
|
2266
|
-
cancel(e);
|
|
2267
|
-
};
|
|
2268
|
-
pressProps.onDragStart = (e) => {
|
|
2269
|
-
if (!e.currentTarget.contains(e.target))
|
|
2270
|
-
return;
|
|
2271
|
-
cancel(e);
|
|
2272
|
-
};
|
|
2273
|
-
} else {
|
|
2274
|
-
pressProps.onMouseDown = (e) => {
|
|
2275
|
-
if (e.button !== 0 || !e.currentTarget.contains(e.target))
|
|
2276
|
-
return;
|
|
2277
|
-
if ($f6c31cce2adf654f$var$shouldPreventDefault(e.currentTarget))
|
|
2278
|
-
e.preventDefault();
|
|
2279
|
-
e.stopPropagation();
|
|
2280
|
-
if (state.ignoreEmulatedMouseEvents)
|
|
2281
|
-
return;
|
|
2282
|
-
state.isPressed = true;
|
|
2283
|
-
state.isOverTarget = true;
|
|
2284
|
-
state.target = e.currentTarget;
|
|
2285
|
-
state.pointerType = $6a7db85432448f7f$export$60278871457622de(e.nativeEvent) ? "virtual" : "mouse";
|
|
2286
|
-
if (!isDisabled1 && !preventFocusOnPress)
|
|
2287
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
2288
|
-
triggerPressStart(e, state.pointerType);
|
|
2289
|
-
addGlobalListener(document, "mouseup", onMouseUp, false);
|
|
2290
|
-
};
|
|
2291
|
-
pressProps.onMouseEnter = (e) => {
|
|
2292
|
-
if (!e.currentTarget.contains(e.target))
|
|
2293
|
-
return;
|
|
2294
|
-
e.stopPropagation();
|
|
2295
|
-
if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
|
|
2296
|
-
state.isOverTarget = true;
|
|
2297
|
-
triggerPressStart(e, state.pointerType);
|
|
2298
|
-
}
|
|
2299
|
-
};
|
|
2300
|
-
pressProps.onMouseLeave = (e) => {
|
|
2301
|
-
if (!e.currentTarget.contains(e.target))
|
|
2302
|
-
return;
|
|
2303
|
-
e.stopPropagation();
|
|
2304
|
-
if (state.isPressed && !state.ignoreEmulatedMouseEvents) {
|
|
2305
|
-
state.isOverTarget = false;
|
|
2306
|
-
triggerPressEnd(e, state.pointerType, false);
|
|
2307
|
-
if (propsRef.current.shouldCancelOnPointerExit)
|
|
2308
|
-
cancel(e);
|
|
2309
|
-
}
|
|
2310
|
-
};
|
|
2311
|
-
pressProps.onMouseUp = (e) => {
|
|
2312
|
-
if (!e.currentTarget.contains(e.target))
|
|
2313
|
-
return;
|
|
2314
|
-
if (!state.ignoreEmulatedMouseEvents && e.button === 0)
|
|
2315
|
-
triggerPressUp(e, state.pointerType);
|
|
2316
|
-
};
|
|
2317
|
-
let onMouseUp = (e) => {
|
|
2318
|
-
if (e.button !== 0)
|
|
2319
|
-
return;
|
|
2320
|
-
state.isPressed = false;
|
|
2321
|
-
removeAllGlobalListeners();
|
|
2322
|
-
if (state.ignoreEmulatedMouseEvents) {
|
|
2323
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
2324
|
-
return;
|
|
2325
|
-
}
|
|
2326
|
-
if ($f6c31cce2adf654f$var$isOverTarget(e, state.target))
|
|
2327
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType);
|
|
2328
|
-
else if (state.isOverTarget)
|
|
2329
|
-
triggerPressEnd($f6c31cce2adf654f$var$createEvent(state.target, e), state.pointerType, false);
|
|
2330
|
-
state.isOverTarget = false;
|
|
2331
|
-
};
|
|
2332
|
-
pressProps.onTouchStart = (e) => {
|
|
2333
|
-
if (!e.currentTarget.contains(e.target))
|
|
2334
|
-
return;
|
|
2335
|
-
e.stopPropagation();
|
|
2336
|
-
let touch = $f6c31cce2adf654f$var$getTouchFromEvent(e.nativeEvent);
|
|
2337
|
-
if (!touch)
|
|
2338
|
-
return;
|
|
2339
|
-
state.activePointerId = touch.identifier;
|
|
2340
|
-
state.ignoreEmulatedMouseEvents = true;
|
|
2341
|
-
state.isOverTarget = true;
|
|
2342
|
-
state.isPressed = true;
|
|
2343
|
-
state.target = e.currentTarget;
|
|
2344
|
-
state.pointerType = "touch";
|
|
2345
|
-
if (!isDisabled1 && !preventFocusOnPress)
|
|
2346
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
2347
|
-
if (!allowTextSelectionOnPress)
|
|
2348
|
-
$14c0b72509d70225$export$16a4697467175487(state.target);
|
|
2349
|
-
triggerPressStart(e, state.pointerType);
|
|
2350
|
-
addGlobalListener(window, "scroll", onScroll, true);
|
|
2351
|
-
};
|
|
2352
|
-
pressProps.onTouchMove = (e) => {
|
|
2353
|
-
if (!e.currentTarget.contains(e.target))
|
|
2354
|
-
return;
|
|
2355
|
-
e.stopPropagation();
|
|
2356
|
-
if (!state.isPressed)
|
|
2357
|
-
return;
|
|
2358
|
-
let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
2359
|
-
if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
|
|
2360
|
-
if (!state.isOverTarget) {
|
|
2361
|
-
state.isOverTarget = true;
|
|
2362
|
-
triggerPressStart(e, state.pointerType);
|
|
2363
|
-
}
|
|
2364
|
-
} else if (state.isOverTarget) {
|
|
2365
|
-
state.isOverTarget = false;
|
|
2366
|
-
triggerPressEnd(e, state.pointerType, false);
|
|
2367
|
-
if (propsRef.current.shouldCancelOnPointerExit)
|
|
2368
|
-
cancel(e);
|
|
2369
|
-
}
|
|
2370
|
-
};
|
|
2371
|
-
pressProps.onTouchEnd = (e) => {
|
|
2372
|
-
if (!e.currentTarget.contains(e.target))
|
|
2373
|
-
return;
|
|
2374
|
-
e.stopPropagation();
|
|
2375
|
-
if (!state.isPressed)
|
|
2376
|
-
return;
|
|
2377
|
-
let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
2378
|
-
if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
|
|
2379
|
-
triggerPressUp(e, state.pointerType);
|
|
2380
|
-
triggerPressEnd(e, state.pointerType);
|
|
2381
|
-
} else if (state.isOverTarget)
|
|
2382
|
-
triggerPressEnd(e, state.pointerType, false);
|
|
2383
|
-
state.isPressed = false;
|
|
2384
|
-
state.activePointerId = null;
|
|
2385
|
-
state.isOverTarget = false;
|
|
2386
|
-
state.ignoreEmulatedMouseEvents = true;
|
|
2387
|
-
if (!allowTextSelectionOnPress)
|
|
2388
|
-
$14c0b72509d70225$export$b0d6fa1ab32e3295(state.target);
|
|
2389
|
-
removeAllGlobalListeners();
|
|
2390
|
-
};
|
|
2391
|
-
pressProps.onTouchCancel = (e) => {
|
|
2392
|
-
if (!e.currentTarget.contains(e.target))
|
|
2393
|
-
return;
|
|
2394
|
-
e.stopPropagation();
|
|
2395
|
-
if (state.isPressed)
|
|
2396
|
-
cancel(e);
|
|
2397
|
-
};
|
|
2398
|
-
let onScroll = (e) => {
|
|
2399
|
-
if (state.isPressed && e.target.contains(state.target))
|
|
2400
|
-
cancel({
|
|
2401
|
-
currentTarget: state.target,
|
|
2402
|
-
shiftKey: false,
|
|
2403
|
-
ctrlKey: false,
|
|
2404
|
-
metaKey: false,
|
|
2405
|
-
altKey: false
|
|
2406
|
-
});
|
|
2407
|
-
};
|
|
2408
|
-
pressProps.onDragStart = (e) => {
|
|
2409
|
-
if (!e.currentTarget.contains(e.target))
|
|
2410
|
-
return;
|
|
2411
|
-
cancel(e);
|
|
2412
|
-
};
|
|
2413
|
-
}
|
|
2414
|
-
return pressProps;
|
|
2415
|
-
}, [
|
|
2416
|
-
addGlobalListener,
|
|
2417
|
-
isDisabled1,
|
|
2418
|
-
preventFocusOnPress,
|
|
2419
|
-
removeAllGlobalListeners,
|
|
2420
|
-
allowTextSelectionOnPress
|
|
2421
|
-
]);
|
|
2422
|
-
$bx7SL$useEffect(() => {
|
|
2423
|
-
return () => {
|
|
2424
|
-
if (!allowTextSelectionOnPress)
|
|
2425
|
-
$14c0b72509d70225$export$b0d6fa1ab32e3295(ref.current.target);
|
|
2426
|
-
};
|
|
2427
|
-
}, [
|
|
2428
|
-
allowTextSelectionOnPress
|
|
2429
|
-
]);
|
|
2430
|
-
return {
|
|
2431
|
-
isPressed: isPressedProp || isPressed,
|
|
2432
|
-
pressProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, pressProps1)
|
|
2433
|
-
};
|
|
2434
|
-
}
|
|
2435
|
-
function $f6c31cce2adf654f$var$isHTMLAnchorLink(target) {
|
|
2436
|
-
return target.tagName === "A" && target.hasAttribute("href");
|
|
2437
|
-
}
|
|
2438
|
-
function $f6c31cce2adf654f$var$isValidKeyboardEvent(event, currentTarget) {
|
|
2439
|
-
const { key, code } = event;
|
|
2440
|
-
const element = currentTarget;
|
|
2441
|
-
const role = element.getAttribute("role");
|
|
2442
|
-
return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof HTMLInputElement && !$f6c31cce2adf654f$var$isValidInputKey(element, key) || element instanceof HTMLTextAreaElement || element.isContentEditable) && (!$f6c31cce2adf654f$var$isHTMLAnchorLink(element) || role === "button" && key !== "Enter") && !(role === "link" && key !== "Enter");
|
|
2443
|
-
}
|
|
2444
|
-
function $f6c31cce2adf654f$var$getTouchFromEvent(event) {
|
|
2445
|
-
const { targetTouches } = event;
|
|
2446
|
-
if (targetTouches.length > 0)
|
|
2447
|
-
return targetTouches[0];
|
|
2448
|
-
return null;
|
|
2449
|
-
}
|
|
2450
|
-
function $f6c31cce2adf654f$var$getTouchById(event, pointerId) {
|
|
2451
|
-
const changedTouches = event.changedTouches;
|
|
2452
|
-
for (let i = 0; i < changedTouches.length; i++) {
|
|
2453
|
-
const touch = changedTouches[i];
|
|
2454
|
-
if (touch.identifier === pointerId)
|
|
2455
|
-
return touch;
|
|
2456
|
-
}
|
|
2457
|
-
return null;
|
|
2458
|
-
}
|
|
2459
|
-
function $f6c31cce2adf654f$var$createEvent(target, e) {
|
|
2460
|
-
return {
|
|
2461
|
-
currentTarget: target,
|
|
2462
|
-
shiftKey: e.shiftKey,
|
|
2463
|
-
ctrlKey: e.ctrlKey,
|
|
2464
|
-
metaKey: e.metaKey,
|
|
2465
|
-
altKey: e.altKey
|
|
2466
|
-
};
|
|
2467
|
-
}
|
|
2468
|
-
function $f6c31cce2adf654f$var$getPointClientRect(point) {
|
|
2469
|
-
let offsetX = point.width / 2 || point.radiusX || 0;
|
|
2470
|
-
let offsetY = point.height / 2 || point.radiusY || 0;
|
|
2471
|
-
return {
|
|
2472
|
-
top: point.clientY - offsetY,
|
|
2473
|
-
right: point.clientX + offsetX,
|
|
2474
|
-
bottom: point.clientY + offsetY,
|
|
2475
|
-
left: point.clientX - offsetX
|
|
2476
|
-
};
|
|
2477
|
-
}
|
|
2478
|
-
function $f6c31cce2adf654f$var$areRectanglesOverlapping(a, b) {
|
|
2479
|
-
if (a.left > b.right || b.left > a.right)
|
|
2480
|
-
return false;
|
|
2481
|
-
if (a.top > b.bottom || b.top > a.bottom)
|
|
2482
|
-
return false;
|
|
2483
|
-
return true;
|
|
2484
|
-
}
|
|
2485
|
-
function $f6c31cce2adf654f$var$isOverTarget(point, target) {
|
|
2486
|
-
let rect = target.getBoundingClientRect();
|
|
2487
|
-
let pointRect = $f6c31cce2adf654f$var$getPointClientRect(point);
|
|
2488
|
-
return $f6c31cce2adf654f$var$areRectanglesOverlapping(rect, pointRect);
|
|
2489
|
-
}
|
|
2490
|
-
function $f6c31cce2adf654f$var$shouldPreventDefault(target) {
|
|
2491
|
-
return !(target instanceof HTMLElement) || !target.draggable;
|
|
2492
|
-
}
|
|
2493
|
-
function $f6c31cce2adf654f$var$shouldPreventDefaultKeyboard(target, key) {
|
|
2494
|
-
if (target instanceof HTMLInputElement)
|
|
2495
|
-
return !$f6c31cce2adf654f$var$isValidInputKey(target, key);
|
|
2496
|
-
if (target instanceof HTMLButtonElement)
|
|
2497
|
-
return target.type !== "submit";
|
|
2498
|
-
return true;
|
|
2499
|
-
}
|
|
2500
|
-
var $f6c31cce2adf654f$var$nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
2501
|
-
"checkbox",
|
|
2502
|
-
"radio",
|
|
2503
|
-
"range",
|
|
2504
|
-
"color",
|
|
2505
|
-
"file",
|
|
2506
|
-
"image",
|
|
2507
|
-
"button",
|
|
2508
|
-
"submit",
|
|
2509
|
-
"reset"
|
|
2510
|
-
]);
|
|
2511
|
-
function $f6c31cce2adf654f$var$isValidInputKey(target, key) {
|
|
2512
|
-
return target.type === "checkbox" || target.type === "radio" ? key === " " : $f6c31cce2adf654f$var$nonTextInputTypes.has(target.type);
|
|
2513
|
-
}
|
|
2514
|
-
var $8a9cb279dc87e130$export$905e7fc544a71f36 = class {
|
|
2515
|
-
isDefaultPrevented() {
|
|
2516
|
-
return this.nativeEvent.defaultPrevented;
|
|
2517
|
-
}
|
|
2518
|
-
preventDefault() {
|
|
2519
|
-
this.defaultPrevented = true;
|
|
2520
|
-
this.nativeEvent.preventDefault();
|
|
2521
|
-
}
|
|
2522
|
-
stopPropagation() {
|
|
2523
|
-
this.nativeEvent.stopPropagation();
|
|
2524
|
-
this.isPropagationStopped = () => true;
|
|
2525
|
-
}
|
|
2526
|
-
isPropagationStopped() {
|
|
2527
|
-
return false;
|
|
2528
|
-
}
|
|
2529
|
-
persist() {
|
|
2530
|
-
}
|
|
2531
|
-
constructor(type, nativeEvent) {
|
|
2532
|
-
this.nativeEvent = nativeEvent;
|
|
2533
|
-
this.target = nativeEvent.target;
|
|
2534
|
-
this.currentTarget = nativeEvent.currentTarget;
|
|
2535
|
-
this.relatedTarget = nativeEvent.relatedTarget;
|
|
2536
|
-
this.bubbles = nativeEvent.bubbles;
|
|
2537
|
-
this.cancelable = nativeEvent.cancelable;
|
|
2538
|
-
this.defaultPrevented = nativeEvent.defaultPrevented;
|
|
2539
|
-
this.eventPhase = nativeEvent.eventPhase;
|
|
2540
|
-
this.isTrusted = nativeEvent.isTrusted;
|
|
2541
|
-
this.timeStamp = nativeEvent.timeStamp;
|
|
2542
|
-
this.type = type;
|
|
2543
|
-
}
|
|
2544
|
-
};
|
|
2545
|
-
function $8a9cb279dc87e130$export$715c682d09d639cc(onBlur) {
|
|
2546
|
-
let stateRef = $bx7SL$useRef({
|
|
2547
|
-
isFocused: false,
|
|
2548
|
-
onBlur,
|
|
2549
|
-
observer: null
|
|
2550
|
-
});
|
|
2551
|
-
stateRef.current.onBlur = onBlur;
|
|
2552
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
2553
|
-
const state = stateRef.current;
|
|
2554
|
-
return () => {
|
|
2555
|
-
if (state.observer) {
|
|
2556
|
-
state.observer.disconnect();
|
|
2557
|
-
state.observer = null;
|
|
2558
|
-
}
|
|
2559
|
-
};
|
|
2560
|
-
}, []);
|
|
2561
|
-
return $bx7SL$useCallback((e1) => {
|
|
2562
|
-
if (e1.target instanceof HTMLButtonElement || e1.target instanceof HTMLInputElement || e1.target instanceof HTMLTextAreaElement || e1.target instanceof HTMLSelectElement) {
|
|
2563
|
-
stateRef.current.isFocused = true;
|
|
2564
|
-
let target = e1.target;
|
|
2565
|
-
let onBlurHandler = (e) => {
|
|
2566
|
-
var _current, ref;
|
|
2567
|
-
stateRef.current.isFocused = false;
|
|
2568
|
-
if (target.disabled)
|
|
2569
|
-
(ref = (_current = stateRef.current).onBlur) === null || ref === void 0 ? void 0 : ref.call(_current, new $8a9cb279dc87e130$export$905e7fc544a71f36("blur", e));
|
|
2570
|
-
if (stateRef.current.observer) {
|
|
2571
|
-
stateRef.current.observer.disconnect();
|
|
2572
|
-
stateRef.current.observer = null;
|
|
2573
|
-
}
|
|
2574
|
-
};
|
|
2575
|
-
target.addEventListener("focusout", onBlurHandler, {
|
|
2576
|
-
once: true
|
|
2577
|
-
});
|
|
2578
|
-
stateRef.current.observer = new MutationObserver(() => {
|
|
2579
|
-
if (stateRef.current.isFocused && target.disabled) {
|
|
2580
|
-
stateRef.current.observer.disconnect();
|
|
2581
|
-
target.dispatchEvent(new FocusEvent("blur"));
|
|
2582
|
-
target.dispatchEvent(new FocusEvent("focusout", {
|
|
2583
|
-
bubbles: true
|
|
2584
|
-
}));
|
|
2585
|
-
}
|
|
2586
|
-
});
|
|
2587
|
-
stateRef.current.observer.observe(target, {
|
|
2588
|
-
attributes: true,
|
|
2589
|
-
attributeFilter: [
|
|
2590
|
-
"disabled"
|
|
2591
|
-
]
|
|
2592
|
-
});
|
|
2593
|
-
}
|
|
2594
|
-
}, []);
|
|
2595
|
-
}
|
|
2596
|
-
var $507fabe10e71c6fb$var$currentModality = null;
|
|
2597
|
-
var $507fabe10e71c6fb$var$changeHandlers = /* @__PURE__ */ new Set();
|
|
2598
|
-
var $507fabe10e71c6fb$var$hasSetupGlobalListeners = false;
|
|
2599
|
-
var $507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
2600
|
-
var $507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
|
2601
|
-
function $507fabe10e71c6fb$var$triggerChangeHandlers(modality, e) {
|
|
2602
|
-
for (let handler of $507fabe10e71c6fb$var$changeHandlers)
|
|
2603
|
-
handler(modality, e);
|
|
2604
|
-
}
|
|
2605
|
-
function $507fabe10e71c6fb$var$isValidKey(e) {
|
|
2606
|
-
return !(e.metaKey || !$c87311424ea30a05$export$9ac100e40613ea10() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
2607
|
-
}
|
|
2608
|
-
function $507fabe10e71c6fb$var$handleKeyboardEvent(e) {
|
|
2609
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
2610
|
-
if ($507fabe10e71c6fb$var$isValidKey(e)) {
|
|
2611
|
-
$507fabe10e71c6fb$var$currentModality = "keyboard";
|
|
2612
|
-
$507fabe10e71c6fb$var$triggerChangeHandlers("keyboard", e);
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
function $507fabe10e71c6fb$var$handlePointerEvent(e) {
|
|
2616
|
-
$507fabe10e71c6fb$var$currentModality = "pointer";
|
|
2617
|
-
if (e.type === "mousedown" || e.type === "pointerdown") {
|
|
2618
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
2619
|
-
$507fabe10e71c6fb$var$triggerChangeHandlers("pointer", e);
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
function $507fabe10e71c6fb$var$handleClickEvent(e) {
|
|
2623
|
-
if ($6a7db85432448f7f$export$60278871457622de(e)) {
|
|
2624
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
2625
|
-
$507fabe10e71c6fb$var$currentModality = "virtual";
|
|
2626
|
-
}
|
|
2627
|
-
}
|
|
2628
|
-
function $507fabe10e71c6fb$var$handleFocusEvent(e) {
|
|
2629
|
-
if (e.target === window || e.target === document)
|
|
2630
|
-
return;
|
|
2631
|
-
if (!$507fabe10e71c6fb$var$hasEventBeforeFocus && !$507fabe10e71c6fb$var$hasBlurredWindowRecently) {
|
|
2632
|
-
$507fabe10e71c6fb$var$currentModality = "virtual";
|
|
2633
|
-
$507fabe10e71c6fb$var$triggerChangeHandlers("virtual", e);
|
|
2634
|
-
}
|
|
2635
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
2636
|
-
$507fabe10e71c6fb$var$hasBlurredWindowRecently = false;
|
|
2637
|
-
}
|
|
2638
|
-
function $507fabe10e71c6fb$var$handleWindowBlur() {
|
|
2639
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = false;
|
|
2640
|
-
$507fabe10e71c6fb$var$hasBlurredWindowRecently = true;
|
|
2641
|
-
}
|
|
2642
|
-
function $507fabe10e71c6fb$var$setupGlobalFocusEvents() {
|
|
2643
|
-
if (typeof window === "undefined" || $507fabe10e71c6fb$var$hasSetupGlobalListeners)
|
|
2644
|
-
return;
|
|
2645
|
-
let focus = HTMLElement.prototype.focus;
|
|
2646
|
-
HTMLElement.prototype.focus = function() {
|
|
2647
|
-
$507fabe10e71c6fb$var$hasEventBeforeFocus = true;
|
|
2648
|
-
focus.apply(this, arguments);
|
|
2649
|
-
};
|
|
2650
|
-
document.addEventListener("keydown", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
2651
|
-
document.addEventListener("keyup", $507fabe10e71c6fb$var$handleKeyboardEvent, true);
|
|
2652
|
-
document.addEventListener("click", $507fabe10e71c6fb$var$handleClickEvent, true);
|
|
2653
|
-
window.addEventListener("focus", $507fabe10e71c6fb$var$handleFocusEvent, true);
|
|
2654
|
-
window.addEventListener("blur", $507fabe10e71c6fb$var$handleWindowBlur, false);
|
|
2655
|
-
if (typeof PointerEvent !== "undefined") {
|
|
2656
|
-
document.addEventListener("pointerdown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2657
|
-
document.addEventListener("pointermove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2658
|
-
document.addEventListener("pointerup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2659
|
-
} else {
|
|
2660
|
-
document.addEventListener("mousedown", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2661
|
-
document.addEventListener("mousemove", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2662
|
-
document.addEventListener("mouseup", $507fabe10e71c6fb$var$handlePointerEvent, true);
|
|
2663
|
-
}
|
|
2664
|
-
$507fabe10e71c6fb$var$hasSetupGlobalListeners = true;
|
|
2665
|
-
}
|
|
2666
|
-
if (typeof document !== "undefined") {
|
|
2667
|
-
if (document.readyState !== "loading")
|
|
2668
|
-
$507fabe10e71c6fb$var$setupGlobalFocusEvents();
|
|
2669
|
-
else
|
|
2670
|
-
document.addEventListener("DOMContentLoaded", $507fabe10e71c6fb$var$setupGlobalFocusEvents);
|
|
2671
|
-
}
|
|
2672
|
-
function $507fabe10e71c6fb$export$b9b3dfddab17db27() {
|
|
2673
|
-
return $507fabe10e71c6fb$var$currentModality !== "pointer";
|
|
2674
|
-
}
|
|
2675
|
-
function $9ab94262bd0047c7$export$420e68273165f4ec(props) {
|
|
2676
|
-
let { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
|
|
2677
|
-
let state = $bx7SL$useRef({
|
|
2678
|
-
isFocusWithin: false
|
|
2679
|
-
});
|
|
2680
|
-
let onBlur = $bx7SL$useCallback((e) => {
|
|
2681
|
-
if (state.current.isFocusWithin && !e.currentTarget.contains(e.relatedTarget)) {
|
|
2682
|
-
state.current.isFocusWithin = false;
|
|
2683
|
-
if (onBlurWithin)
|
|
2684
|
-
onBlurWithin(e);
|
|
2685
|
-
if (onFocusWithinChange)
|
|
2686
|
-
onFocusWithinChange(false);
|
|
2687
|
-
}
|
|
2688
|
-
}, [
|
|
2689
|
-
onBlurWithin,
|
|
2690
|
-
onFocusWithinChange,
|
|
2691
|
-
state
|
|
2692
|
-
]);
|
|
2693
|
-
let onSyntheticFocus = $8a9cb279dc87e130$export$715c682d09d639cc(onBlur);
|
|
2694
|
-
let onFocus = $bx7SL$useCallback((e) => {
|
|
2695
|
-
if (!state.current.isFocusWithin) {
|
|
2696
|
-
if (onFocusWithin)
|
|
2697
|
-
onFocusWithin(e);
|
|
2698
|
-
if (onFocusWithinChange)
|
|
2699
|
-
onFocusWithinChange(true);
|
|
2700
|
-
state.current.isFocusWithin = true;
|
|
2701
|
-
onSyntheticFocus(e);
|
|
2702
|
-
}
|
|
2703
|
-
}, [
|
|
2704
|
-
onFocusWithin,
|
|
2705
|
-
onFocusWithinChange,
|
|
2706
|
-
onSyntheticFocus
|
|
2707
|
-
]);
|
|
2708
|
-
if (isDisabled)
|
|
2709
|
-
return {
|
|
2710
|
-
focusWithinProps: {
|
|
2711
|
-
onFocus: null,
|
|
2712
|
-
onBlur: null
|
|
2713
|
-
}
|
|
2714
|
-
};
|
|
2715
|
-
return {
|
|
2716
|
-
focusWithinProps: {
|
|
2717
|
-
onFocus,
|
|
2718
|
-
onBlur
|
|
2719
|
-
}
|
|
2720
|
-
};
|
|
2721
|
-
}
|
|
2722
|
-
var $6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
|
|
2723
|
-
var $6179b936705e76d3$var$hoverCount = 0;
|
|
2724
|
-
function $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents() {
|
|
2725
|
-
$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = true;
|
|
2726
|
-
setTimeout(() => {
|
|
2727
|
-
$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents = false;
|
|
2728
|
-
}, 50);
|
|
2729
|
-
}
|
|
2730
|
-
function $6179b936705e76d3$var$handleGlobalPointerEvent(e) {
|
|
2731
|
-
if (e.pointerType === "touch")
|
|
2732
|
-
$6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents();
|
|
2733
|
-
}
|
|
2734
|
-
function $6179b936705e76d3$var$setupGlobalTouchEvents() {
|
|
2735
|
-
if (typeof document === "undefined")
|
|
2736
|
-
return;
|
|
2737
|
-
if (typeof PointerEvent !== "undefined")
|
|
2738
|
-
document.addEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
|
|
2739
|
-
else
|
|
2740
|
-
document.addEventListener("touchend", $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
|
|
2741
|
-
$6179b936705e76d3$var$hoverCount++;
|
|
2742
|
-
return () => {
|
|
2743
|
-
$6179b936705e76d3$var$hoverCount--;
|
|
2744
|
-
if ($6179b936705e76d3$var$hoverCount > 0)
|
|
2745
|
-
return;
|
|
2746
|
-
if (typeof PointerEvent !== "undefined")
|
|
2747
|
-
document.removeEventListener("pointerup", $6179b936705e76d3$var$handleGlobalPointerEvent);
|
|
2748
|
-
else
|
|
2749
|
-
document.removeEventListener("touchend", $6179b936705e76d3$var$setGlobalIgnoreEmulatedMouseEvents);
|
|
2750
|
-
};
|
|
2751
|
-
}
|
|
2752
|
-
function $6179b936705e76d3$export$ae780daf29e6d456(props) {
|
|
2753
|
-
let { onHoverStart, onHoverChange, onHoverEnd, isDisabled } = props;
|
|
2754
|
-
let [isHovered, setHovered] = $bx7SL$useState(false);
|
|
2755
|
-
let state = $bx7SL$useRef({
|
|
2756
|
-
isHovered: false,
|
|
2757
|
-
ignoreEmulatedMouseEvents: false,
|
|
2758
|
-
pointerType: "",
|
|
2759
|
-
target: null
|
|
2760
|
-
}).current;
|
|
2761
|
-
$bx7SL$useEffect($6179b936705e76d3$var$setupGlobalTouchEvents, []);
|
|
2762
|
-
let { hoverProps: hoverProps1, triggerHoverEnd: triggerHoverEnd1 } = $bx7SL$useMemo(() => {
|
|
2763
|
-
let triggerHoverStart = (event, pointerType) => {
|
|
2764
|
-
state.pointerType = pointerType;
|
|
2765
|
-
if (isDisabled || pointerType === "touch" || state.isHovered || !event.currentTarget.contains(event.target))
|
|
2766
|
-
return;
|
|
2767
|
-
state.isHovered = true;
|
|
2768
|
-
let target = event.currentTarget;
|
|
2769
|
-
state.target = target;
|
|
2770
|
-
if (onHoverStart)
|
|
2771
|
-
onHoverStart({
|
|
2772
|
-
type: "hoverstart",
|
|
2773
|
-
target,
|
|
2774
|
-
pointerType
|
|
2775
|
-
});
|
|
2776
|
-
if (onHoverChange)
|
|
2777
|
-
onHoverChange(true);
|
|
2778
|
-
setHovered(true);
|
|
2779
|
-
};
|
|
2780
|
-
let triggerHoverEnd = (event, pointerType) => {
|
|
2781
|
-
state.pointerType = "";
|
|
2782
|
-
state.target = null;
|
|
2783
|
-
if (pointerType === "touch" || !state.isHovered)
|
|
2784
|
-
return;
|
|
2785
|
-
state.isHovered = false;
|
|
2786
|
-
let target = event.currentTarget;
|
|
2787
|
-
if (onHoverEnd)
|
|
2788
|
-
onHoverEnd({
|
|
2789
|
-
type: "hoverend",
|
|
2790
|
-
target,
|
|
2791
|
-
pointerType
|
|
2792
|
-
});
|
|
2793
|
-
if (onHoverChange)
|
|
2794
|
-
onHoverChange(false);
|
|
2795
|
-
setHovered(false);
|
|
2796
|
-
};
|
|
2797
|
-
let hoverProps = {};
|
|
2798
|
-
if (typeof PointerEvent !== "undefined") {
|
|
2799
|
-
hoverProps.onPointerEnter = (e) => {
|
|
2800
|
-
if ($6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents && e.pointerType === "mouse")
|
|
2801
|
-
return;
|
|
2802
|
-
triggerHoverStart(e, e.pointerType);
|
|
2803
|
-
};
|
|
2804
|
-
hoverProps.onPointerLeave = (e) => {
|
|
2805
|
-
if (!isDisabled && e.currentTarget.contains(e.target))
|
|
2806
|
-
triggerHoverEnd(e, e.pointerType);
|
|
2807
|
-
};
|
|
2808
|
-
} else {
|
|
2809
|
-
hoverProps.onTouchStart = () => {
|
|
2810
|
-
state.ignoreEmulatedMouseEvents = true;
|
|
2811
|
-
};
|
|
2812
|
-
hoverProps.onMouseEnter = (e) => {
|
|
2813
|
-
if (!state.ignoreEmulatedMouseEvents && !$6179b936705e76d3$var$globalIgnoreEmulatedMouseEvents)
|
|
2814
|
-
triggerHoverStart(e, "mouse");
|
|
2815
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
2816
|
-
};
|
|
2817
|
-
hoverProps.onMouseLeave = (e) => {
|
|
2818
|
-
if (!isDisabled && e.currentTarget.contains(e.target))
|
|
2819
|
-
triggerHoverEnd(e, "mouse");
|
|
2820
|
-
};
|
|
2821
|
-
}
|
|
2822
|
-
return {
|
|
2823
|
-
hoverProps,
|
|
2824
|
-
triggerHoverEnd
|
|
2825
|
-
};
|
|
2826
|
-
}, [
|
|
2827
|
-
onHoverStart,
|
|
2828
|
-
onHoverChange,
|
|
2829
|
-
onHoverEnd,
|
|
2830
|
-
isDisabled,
|
|
2831
|
-
state
|
|
2832
|
-
]);
|
|
2833
|
-
$bx7SL$useEffect(() => {
|
|
2834
|
-
if (isDisabled)
|
|
2835
|
-
triggerHoverEnd1({
|
|
2836
|
-
currentTarget: state.target
|
|
2837
|
-
}, state.pointerType);
|
|
2838
|
-
}, [
|
|
2839
|
-
isDisabled
|
|
2840
|
-
]);
|
|
2841
|
-
return {
|
|
2842
|
-
hoverProps: hoverProps1,
|
|
2843
|
-
isHovered
|
|
2844
|
-
};
|
|
2845
|
-
}
|
|
2846
|
-
var $8a26561d2877236e$var$DEFAULT_THRESHOLD = 500;
|
|
2847
|
-
function $8a26561d2877236e$export$c24ed0104d07eab9(props) {
|
|
2848
|
-
let { isDisabled, onLongPressStart, onLongPressEnd, onLongPress, threshold = $8a26561d2877236e$var$DEFAULT_THRESHOLD, accessibilityDescription } = props;
|
|
2849
|
-
const timeRef = $bx7SL$useRef(null);
|
|
2850
|
-
let { addGlobalListener, removeGlobalListener } = $03deb23ff14920c4$export$4eaf04e54aa8eed6();
|
|
2851
|
-
let { pressProps } = $f6c31cce2adf654f$export$45712eceda6fad21({
|
|
2852
|
-
isDisabled,
|
|
2853
|
-
onPressStart(e1) {
|
|
2854
|
-
if (e1.pointerType === "mouse" || e1.pointerType === "touch") {
|
|
2855
|
-
if (onLongPressStart)
|
|
2856
|
-
onLongPressStart({
|
|
2857
|
-
...e1,
|
|
2858
|
-
type: "longpressstart"
|
|
2859
|
-
});
|
|
2860
|
-
timeRef.current = setTimeout(() => {
|
|
2861
|
-
e1.target.dispatchEvent(new PointerEvent("pointercancel", {
|
|
2862
|
-
bubbles: true
|
|
2863
|
-
}));
|
|
2864
|
-
if (onLongPress)
|
|
2865
|
-
onLongPress({
|
|
2866
|
-
...e1,
|
|
2867
|
-
type: "longpress"
|
|
2868
|
-
});
|
|
2869
|
-
timeRef.current = null;
|
|
2870
|
-
}, threshold);
|
|
2871
|
-
if (e1.pointerType === "touch") {
|
|
2872
|
-
let onContextMenu = (e) => {
|
|
2873
|
-
e.preventDefault();
|
|
2874
|
-
};
|
|
2875
|
-
addGlobalListener(e1.target, "contextmenu", onContextMenu, {
|
|
2876
|
-
once: true
|
|
2877
|
-
});
|
|
2878
|
-
addGlobalListener(window, "pointerup", () => {
|
|
2879
|
-
setTimeout(() => {
|
|
2880
|
-
removeGlobalListener(e1.target, "contextmenu", onContextMenu);
|
|
2881
|
-
}, 30);
|
|
2882
|
-
}, {
|
|
2883
|
-
once: true
|
|
2884
|
-
});
|
|
2885
|
-
}
|
|
2886
|
-
}
|
|
2887
|
-
},
|
|
2888
|
-
onPressEnd(e) {
|
|
2889
|
-
if (timeRef.current)
|
|
2890
|
-
clearTimeout(timeRef.current);
|
|
2891
|
-
if (onLongPressEnd && (e.pointerType === "mouse" || e.pointerType === "touch"))
|
|
2892
|
-
onLongPressEnd({
|
|
2893
|
-
...e,
|
|
2894
|
-
type: "longpressend"
|
|
2895
|
-
});
|
|
2896
|
-
}
|
|
2897
|
-
});
|
|
2898
|
-
let descriptionProps = $ef06256079686ba0$export$f8aeda7b10753fa1(onLongPress && !isDisabled ? accessibilityDescription : null);
|
|
2899
|
-
return {
|
|
2900
|
-
longPressProps: $3ef42575df84b30b$export$9d1611c77c2fe928(pressProps, descriptionProps)
|
|
2901
|
-
};
|
|
2902
|
-
}
|
|
2903
|
-
|
|
2904
|
-
// ../../node_modules/@react-aria/label/dist/module.js
|
|
2905
|
-
function $d191a55c9702f145$export$8467354a121f1b9f(props) {
|
|
2906
|
-
let { id, label, "aria-labelledby": ariaLabelledby, "aria-label": ariaLabel, labelElementType = "label" } = props;
|
|
2907
|
-
id = $bdb11010cef70236$export$f680877a34711e37(id);
|
|
2908
|
-
let labelId = $bdb11010cef70236$export$f680877a34711e37();
|
|
2909
|
-
let labelProps = {};
|
|
2910
|
-
if (label) {
|
|
2911
|
-
ariaLabelledby = ariaLabelledby ? `${ariaLabelledby} ${labelId}` : labelId;
|
|
2912
|
-
labelProps = {
|
|
2913
|
-
id: labelId,
|
|
2914
|
-
htmlFor: labelElementType === "label" ? id : void 0
|
|
2915
|
-
};
|
|
2916
|
-
} else if (!ariaLabelledby && !ariaLabel)
|
|
2917
|
-
console.warn("If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility");
|
|
2918
|
-
let fieldProps = $313b98861ee5dd6c$export$d6875122194c7b44({
|
|
2919
|
-
id,
|
|
2920
|
-
"aria-label": ariaLabel,
|
|
2921
|
-
"aria-labelledby": ariaLabelledby
|
|
2922
|
-
});
|
|
2923
|
-
return {
|
|
2924
|
-
labelProps,
|
|
2925
|
-
fieldProps
|
|
2926
|
-
};
|
|
2927
|
-
}
|
|
2928
|
-
|
|
2929
|
-
// ../../node_modules/@react-aria/selection/dist/module.js
|
|
2930
|
-
import { useRef as $eCAIO$useRef, useEffect as $eCAIO$useEffect, useMemo as $eCAIO$useMemo } from "react";
|
|
2931
|
-
import { getFocusableTreeWalker as $eCAIO$getFocusableTreeWalker, focusSafely as $eCAIO$focusSafely } from "@react-aria/focus";
|
|
2932
|
-
|
|
2933
|
-
// ../../node_modules/@react-aria/i18n/dist/real-module.js
|
|
2934
|
-
import $iFADg$react, { useContext as $iFADg$useContext, useState as $iFADg$useState, useEffect as $iFADg$useEffect, useMemo as $iFADg$useMemo, useRef as $iFADg$useRef } from "react";
|
|
2935
|
-
import { useIsSSR as $iFADg$useIsSSR } from "@react-aria/ssr";
|
|
2936
|
-
var $148a7a147e38ea7f$var$RTL_SCRIPTS = /* @__PURE__ */ new Set([
|
|
2937
|
-
"Arab",
|
|
2938
|
-
"Syrc",
|
|
2939
|
-
"Samr",
|
|
2940
|
-
"Mand",
|
|
2941
|
-
"Thaa",
|
|
2942
|
-
"Mend",
|
|
2943
|
-
"Nkoo",
|
|
2944
|
-
"Adlm",
|
|
2945
|
-
"Rohg",
|
|
2946
|
-
"Hebr"
|
|
2947
|
-
]);
|
|
2948
|
-
var $148a7a147e38ea7f$var$RTL_LANGS = /* @__PURE__ */ new Set([
|
|
2949
|
-
"ae",
|
|
2950
|
-
"ar",
|
|
2951
|
-
"arc",
|
|
2952
|
-
"bcc",
|
|
2953
|
-
"bqi",
|
|
2954
|
-
"ckb",
|
|
2955
|
-
"dv",
|
|
2956
|
-
"fa",
|
|
2957
|
-
"glk",
|
|
2958
|
-
"he",
|
|
2959
|
-
"ku",
|
|
2960
|
-
"mzn",
|
|
2961
|
-
"nqo",
|
|
2962
|
-
"pnb",
|
|
2963
|
-
"ps",
|
|
2964
|
-
"sd",
|
|
2965
|
-
"ug",
|
|
2966
|
-
"ur",
|
|
2967
|
-
"yi"
|
|
2968
|
-
]);
|
|
2969
|
-
function $148a7a147e38ea7f$export$702d680b21cbd764(locale) {
|
|
2970
|
-
if (Intl.Locale) {
|
|
2971
|
-
let script = new Intl.Locale(locale).maximize().script;
|
|
2972
|
-
return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(script);
|
|
2973
|
-
}
|
|
2974
|
-
let lang = locale.split("-")[0];
|
|
2975
|
-
return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);
|
|
2976
|
-
}
|
|
2977
|
-
function $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {
|
|
2978
|
-
let locale = typeof navigator !== "undefined" && (navigator.language || navigator.userLanguage) || "en-US";
|
|
2979
|
-
try {
|
|
2980
|
-
Intl.DateTimeFormat.supportedLocalesOf([
|
|
2981
|
-
locale
|
|
2982
|
-
]);
|
|
2983
|
-
} catch (_err) {
|
|
2984
|
-
locale = "en-US";
|
|
2985
|
-
}
|
|
2986
|
-
return {
|
|
2987
|
-
locale,
|
|
2988
|
-
direction: $148a7a147e38ea7f$export$702d680b21cbd764(locale) ? "rtl" : "ltr"
|
|
2989
|
-
};
|
|
2990
|
-
}
|
|
2991
|
-
var $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
|
|
2992
|
-
var $1e5a04cdaf7d1af8$var$listeners = /* @__PURE__ */ new Set();
|
|
2993
|
-
function $1e5a04cdaf7d1af8$var$updateLocale() {
|
|
2994
|
-
$1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();
|
|
2995
|
-
for (let listener of $1e5a04cdaf7d1af8$var$listeners)
|
|
2996
|
-
listener($1e5a04cdaf7d1af8$var$currentLocale);
|
|
2997
|
-
}
|
|
2998
|
-
function $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {
|
|
2999
|
-
let isSSR = $iFADg$useIsSSR();
|
|
3000
|
-
let [defaultLocale, setDefaultLocale] = $iFADg$useState($1e5a04cdaf7d1af8$var$currentLocale);
|
|
3001
|
-
$iFADg$useEffect(() => {
|
|
3002
|
-
if ($1e5a04cdaf7d1af8$var$listeners.size === 0)
|
|
3003
|
-
window.addEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
|
|
3004
|
-
$1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);
|
|
3005
|
-
return () => {
|
|
3006
|
-
$1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);
|
|
3007
|
-
if ($1e5a04cdaf7d1af8$var$listeners.size === 0)
|
|
3008
|
-
window.removeEventListener("languagechange", $1e5a04cdaf7d1af8$var$updateLocale);
|
|
3009
|
-
};
|
|
3010
|
-
}, []);
|
|
3011
|
-
if (isSSR)
|
|
3012
|
-
return {
|
|
3013
|
-
locale: "en-US",
|
|
3014
|
-
direction: "ltr"
|
|
3015
|
-
};
|
|
3016
|
-
return defaultLocale;
|
|
3017
|
-
}
|
|
3018
|
-
var $18f2051aff69b9bf$var$I18nContext = /* @__PURE__ */ $iFADg$react.createContext(null);
|
|
3019
|
-
function $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {
|
|
3020
|
-
let defaultLocale = $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a();
|
|
3021
|
-
let context = $iFADg$useContext($18f2051aff69b9bf$var$I18nContext);
|
|
3022
|
-
return context || defaultLocale;
|
|
3023
|
-
}
|
|
3024
|
-
var $325a3faab7a68acd$var$cache = /* @__PURE__ */ new Map();
|
|
3025
|
-
function $325a3faab7a68acd$export$a16aca283550c30d(options) {
|
|
3026
|
-
let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
3027
|
-
let cacheKey = locale + (options ? Object.entries(options).sort(
|
|
3028
|
-
(a, b) => a[0] < b[0] ? -1 : 1
|
|
3029
|
-
).join() : "");
|
|
3030
|
-
if ($325a3faab7a68acd$var$cache.has(cacheKey))
|
|
3031
|
-
return $325a3faab7a68acd$var$cache.get(cacheKey);
|
|
3032
|
-
let formatter = new Intl.Collator(locale, options);
|
|
3033
|
-
$325a3faab7a68acd$var$cache.set(cacheKey, formatter);
|
|
3034
|
-
return formatter;
|
|
3035
|
-
}
|
|
3036
|
-
|
|
3037
|
-
// ../../node_modules/@react-aria/selection/dist/module.js
|
|
3038
|
-
function $feb5ffebff200149$export$d3e3bd3e26688c04(e) {
|
|
3039
|
-
return $c87311424ea30a05$export$e1865c3bedcd822b() ? e.altKey : e.ctrlKey;
|
|
3040
|
-
}
|
|
3041
|
-
function $feb5ffebff200149$export$16792effe837dba3(e) {
|
|
3042
|
-
if ($c87311424ea30a05$export$9ac100e40613ea10())
|
|
3043
|
-
return e.metaKey;
|
|
3044
|
-
return e.ctrlKey;
|
|
3045
|
-
}
|
|
3046
|
-
var $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS = 1e3;
|
|
3047
|
-
function $fb3050f43d946246$export$e32c88dfddc6e1d8(options) {
|
|
3048
|
-
let { keyboardDelegate, selectionManager, onTypeSelect } = options;
|
|
3049
|
-
let state = $eCAIO$useRef({
|
|
3050
|
-
search: "",
|
|
3051
|
-
timeout: null
|
|
3052
|
-
}).current;
|
|
3053
|
-
let onKeyDown = (e) => {
|
|
3054
|
-
let character = $fb3050f43d946246$var$getStringForKey(e.key);
|
|
3055
|
-
if (!character || e.ctrlKey || e.metaKey)
|
|
3056
|
-
return;
|
|
3057
|
-
if (character === " " && state.search.trim().length > 0) {
|
|
3058
|
-
e.preventDefault();
|
|
3059
|
-
if (!("continuePropagation" in e))
|
|
3060
|
-
e.stopPropagation();
|
|
3061
|
-
}
|
|
3062
|
-
state.search += character;
|
|
3063
|
-
let key = keyboardDelegate.getKeyForSearch(state.search, selectionManager.focusedKey);
|
|
3064
|
-
if (key == null)
|
|
3065
|
-
key = keyboardDelegate.getKeyForSearch(state.search);
|
|
3066
|
-
if (key != null) {
|
|
3067
|
-
selectionManager.setFocusedKey(key);
|
|
3068
|
-
if (onTypeSelect)
|
|
3069
|
-
onTypeSelect(key);
|
|
3070
|
-
}
|
|
3071
|
-
clearTimeout(state.timeout);
|
|
3072
|
-
state.timeout = setTimeout(() => {
|
|
3073
|
-
state.search = "";
|
|
3074
|
-
}, $fb3050f43d946246$var$TYPEAHEAD_DEBOUNCE_WAIT_MS);
|
|
3075
|
-
};
|
|
3076
|
-
return {
|
|
3077
|
-
typeSelectProps: {
|
|
3078
|
-
onKeyDownCapture: keyboardDelegate.getKeyForSearch ? onKeyDown : null
|
|
3079
|
-
}
|
|
3080
|
-
};
|
|
3081
|
-
}
|
|
3082
|
-
function $fb3050f43d946246$var$getStringForKey(key) {
|
|
3083
|
-
if (key.length === 1 || !/^[A-Z]/i.test(key))
|
|
3084
|
-
return key;
|
|
3085
|
-
return "";
|
|
3086
|
-
}
|
|
3087
|
-
function $ae20dd8cbca75726$export$d6daf82dcd84e87c(options) {
|
|
3088
|
-
let { selectionManager: manager, keyboardDelegate: delegate, ref, autoFocus = false, shouldFocusWrap = false, disallowEmptySelection = false, disallowSelectAll = false, selectOnFocus = manager.selectionBehavior === "replace", disallowTypeAhead = false, shouldUseVirtualFocus, allowsTabNavigation = false, isVirtualized, scrollRef = ref } = options;
|
|
3089
|
-
let { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
3090
|
-
let onKeyDown = (e) => {
|
|
3091
|
-
if (e.altKey && e.key === "Tab")
|
|
3092
|
-
e.preventDefault();
|
|
3093
|
-
if (!ref.current.contains(e.target))
|
|
3094
|
-
return;
|
|
3095
|
-
const navigateToKey = (key, childFocus) => {
|
|
3096
|
-
if (key != null) {
|
|
3097
|
-
manager.setFocusedKey(key, childFocus);
|
|
3098
|
-
if (e.shiftKey && manager.selectionMode === "multiple")
|
|
3099
|
-
manager.extendSelection(key);
|
|
3100
|
-
else if (selectOnFocus && !$feb5ffebff200149$export$d3e3bd3e26688c04(e))
|
|
3101
|
-
manager.replaceSelection(key);
|
|
3102
|
-
}
|
|
3103
|
-
};
|
|
3104
|
-
switch (e.key) {
|
|
3105
|
-
case "ArrowDown":
|
|
3106
|
-
if (delegate.getKeyBelow) {
|
|
3107
|
-
var ref4, ref1;
|
|
3108
|
-
e.preventDefault();
|
|
3109
|
-
let nextKey = manager.focusedKey != null ? delegate.getKeyBelow(manager.focusedKey) : (ref4 = delegate.getFirstKey) === null || ref4 === void 0 ? void 0 : ref4.call(delegate);
|
|
3110
|
-
if (nextKey == null && shouldFocusWrap)
|
|
3111
|
-
nextKey = (ref1 = delegate.getFirstKey) === null || ref1 === void 0 ? void 0 : ref1.call(delegate, manager.focusedKey);
|
|
3112
|
-
navigateToKey(nextKey);
|
|
3113
|
-
}
|
|
3114
|
-
break;
|
|
3115
|
-
case "ArrowUp":
|
|
3116
|
-
if (delegate.getKeyAbove) {
|
|
3117
|
-
var ref2, ref3;
|
|
3118
|
-
e.preventDefault();
|
|
3119
|
-
let nextKey = manager.focusedKey != null ? delegate.getKeyAbove(manager.focusedKey) : (ref2 = delegate.getLastKey) === null || ref2 === void 0 ? void 0 : ref2.call(delegate);
|
|
3120
|
-
if (nextKey == null && shouldFocusWrap)
|
|
3121
|
-
nextKey = (ref3 = delegate.getLastKey) === null || ref3 === void 0 ? void 0 : ref3.call(delegate, manager.focusedKey);
|
|
3122
|
-
navigateToKey(nextKey);
|
|
3123
|
-
}
|
|
3124
|
-
break;
|
|
3125
|
-
case "ArrowLeft":
|
|
3126
|
-
if (delegate.getKeyLeftOf) {
|
|
3127
|
-
e.preventDefault();
|
|
3128
|
-
let nextKey = delegate.getKeyLeftOf(manager.focusedKey);
|
|
3129
|
-
navigateToKey(nextKey, direction === "rtl" ? "first" : "last");
|
|
3130
|
-
}
|
|
3131
|
-
break;
|
|
3132
|
-
case "ArrowRight":
|
|
3133
|
-
if (delegate.getKeyRightOf) {
|
|
3134
|
-
e.preventDefault();
|
|
3135
|
-
let nextKey = delegate.getKeyRightOf(manager.focusedKey);
|
|
3136
|
-
navigateToKey(nextKey, direction === "rtl" ? "last" : "first");
|
|
3137
|
-
}
|
|
3138
|
-
break;
|
|
3139
|
-
case "Home":
|
|
3140
|
-
if (delegate.getFirstKey) {
|
|
3141
|
-
e.preventDefault();
|
|
3142
|
-
let firstKey = delegate.getFirstKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
|
|
3143
|
-
manager.setFocusedKey(firstKey);
|
|
3144
|
-
if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
|
|
3145
|
-
manager.extendSelection(firstKey);
|
|
3146
|
-
else if (selectOnFocus)
|
|
3147
|
-
manager.replaceSelection(firstKey);
|
|
3148
|
-
}
|
|
3149
|
-
break;
|
|
3150
|
-
case "End":
|
|
3151
|
-
if (delegate.getLastKey) {
|
|
3152
|
-
e.preventDefault();
|
|
3153
|
-
let lastKey = delegate.getLastKey(manager.focusedKey, $feb5ffebff200149$export$16792effe837dba3(e));
|
|
3154
|
-
manager.setFocusedKey(lastKey);
|
|
3155
|
-
if ($feb5ffebff200149$export$16792effe837dba3(e) && e.shiftKey && manager.selectionMode === "multiple")
|
|
3156
|
-
manager.extendSelection(lastKey);
|
|
3157
|
-
else if (selectOnFocus)
|
|
3158
|
-
manager.replaceSelection(lastKey);
|
|
3159
|
-
}
|
|
3160
|
-
break;
|
|
3161
|
-
case "PageDown":
|
|
3162
|
-
if (delegate.getKeyPageBelow) {
|
|
3163
|
-
e.preventDefault();
|
|
3164
|
-
let nextKey = delegate.getKeyPageBelow(manager.focusedKey);
|
|
3165
|
-
navigateToKey(nextKey);
|
|
3166
|
-
}
|
|
3167
|
-
break;
|
|
3168
|
-
case "PageUp":
|
|
3169
|
-
if (delegate.getKeyPageAbove) {
|
|
3170
|
-
e.preventDefault();
|
|
3171
|
-
let nextKey = delegate.getKeyPageAbove(manager.focusedKey);
|
|
3172
|
-
navigateToKey(nextKey);
|
|
3173
|
-
}
|
|
3174
|
-
break;
|
|
3175
|
-
case "a":
|
|
3176
|
-
if ($feb5ffebff200149$export$16792effe837dba3(e) && manager.selectionMode === "multiple" && disallowSelectAll !== true) {
|
|
3177
|
-
e.preventDefault();
|
|
3178
|
-
manager.selectAll();
|
|
3179
|
-
}
|
|
3180
|
-
break;
|
|
3181
|
-
case "Escape":
|
|
3182
|
-
e.preventDefault();
|
|
3183
|
-
if (!disallowEmptySelection)
|
|
3184
|
-
manager.clearSelection();
|
|
3185
|
-
break;
|
|
3186
|
-
case "Tab":
|
|
3187
|
-
if (!allowsTabNavigation) {
|
|
3188
|
-
if (e.shiftKey)
|
|
3189
|
-
ref.current.focus();
|
|
3190
|
-
else {
|
|
3191
|
-
let walker = $eCAIO$getFocusableTreeWalker(ref.current, {
|
|
3192
|
-
tabbable: true
|
|
3193
|
-
});
|
|
3194
|
-
let next;
|
|
3195
|
-
let last;
|
|
3196
|
-
do {
|
|
3197
|
-
last = walker.lastChild();
|
|
3198
|
-
if (last)
|
|
3199
|
-
next = last;
|
|
3200
|
-
} while (last);
|
|
3201
|
-
if (next && !next.contains(document.activeElement))
|
|
3202
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(next);
|
|
3203
|
-
}
|
|
3204
|
-
break;
|
|
3205
|
-
}
|
|
3206
|
-
}
|
|
3207
|
-
};
|
|
3208
|
-
let scrollPos = $eCAIO$useRef({
|
|
3209
|
-
top: 0,
|
|
3210
|
-
left: 0
|
|
3211
|
-
});
|
|
3212
|
-
$e9faafb641e167db$export$90fc3a17d93f704c(scrollRef, "scroll", isVirtualized ? null : () => {
|
|
3213
|
-
scrollPos.current = {
|
|
3214
|
-
top: scrollRef.current.scrollTop,
|
|
3215
|
-
left: scrollRef.current.scrollLeft
|
|
3216
|
-
};
|
|
3217
|
-
});
|
|
3218
|
-
let onFocus = (e) => {
|
|
3219
|
-
if (manager.isFocused) {
|
|
3220
|
-
if (!e.currentTarget.contains(e.target))
|
|
3221
|
-
manager.setFocused(false);
|
|
3222
|
-
return;
|
|
3223
|
-
}
|
|
3224
|
-
if (!e.currentTarget.contains(e.target))
|
|
3225
|
-
return;
|
|
3226
|
-
manager.setFocused(true);
|
|
3227
|
-
if (manager.focusedKey == null) {
|
|
3228
|
-
let navigateToFirstKey = (key) => {
|
|
3229
|
-
if (key != null) {
|
|
3230
|
-
manager.setFocusedKey(key);
|
|
3231
|
-
if (selectOnFocus)
|
|
3232
|
-
manager.replaceSelection(key);
|
|
3233
|
-
}
|
|
3234
|
-
};
|
|
3235
|
-
let relatedTarget = e.relatedTarget;
|
|
3236
|
-
var _lastSelectedKey, _firstSelectedKey;
|
|
3237
|
-
if (relatedTarget && e.currentTarget.compareDocumentPosition(relatedTarget) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
3238
|
-
navigateToFirstKey((_lastSelectedKey = manager.lastSelectedKey) !== null && _lastSelectedKey !== void 0 ? _lastSelectedKey : delegate.getLastKey());
|
|
3239
|
-
else
|
|
3240
|
-
navigateToFirstKey((_firstSelectedKey = manager.firstSelectedKey) !== null && _firstSelectedKey !== void 0 ? _firstSelectedKey : delegate.getFirstKey());
|
|
3241
|
-
} else if (!isVirtualized) {
|
|
3242
|
-
scrollRef.current.scrollTop = scrollPos.current.top;
|
|
3243
|
-
scrollRef.current.scrollLeft = scrollPos.current.left;
|
|
3244
|
-
let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
|
|
3245
|
-
if (element) {
|
|
3246
|
-
$7215afc6de606d6b$export$de79e2c695e052f3(element);
|
|
3247
|
-
$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
};
|
|
3251
|
-
let onBlur = (e) => {
|
|
3252
|
-
if (!e.currentTarget.contains(e.relatedTarget))
|
|
3253
|
-
manager.setFocused(false);
|
|
3254
|
-
};
|
|
3255
|
-
const autoFocusRef = $eCAIO$useRef(autoFocus);
|
|
3256
|
-
$eCAIO$useEffect(() => {
|
|
3257
|
-
if (autoFocusRef.current) {
|
|
3258
|
-
let focusedKey = null;
|
|
3259
|
-
if (autoFocus === "first")
|
|
3260
|
-
focusedKey = delegate.getFirstKey();
|
|
3261
|
-
if (autoFocus === "last")
|
|
3262
|
-
focusedKey = delegate.getLastKey();
|
|
3263
|
-
let selectedKeys = manager.selectedKeys;
|
|
3264
|
-
if (selectedKeys.size)
|
|
3265
|
-
focusedKey = selectedKeys.values().next().value;
|
|
3266
|
-
manager.setFocused(true);
|
|
3267
|
-
manager.setFocusedKey(focusedKey);
|
|
3268
|
-
if (focusedKey == null && !shouldUseVirtualFocus)
|
|
3269
|
-
$eCAIO$focusSafely(ref.current);
|
|
3270
|
-
}
|
|
3271
|
-
autoFocusRef.current = false;
|
|
3272
|
-
}, []);
|
|
3273
|
-
$eCAIO$useEffect(() => {
|
|
3274
|
-
if (!isVirtualized && manager.focusedKey && (scrollRef === null || scrollRef === void 0 ? void 0 : scrollRef.current)) {
|
|
3275
|
-
let element = scrollRef.current.querySelector(`[data-key="${manager.focusedKey}"]`);
|
|
3276
|
-
if (element)
|
|
3277
|
-
$2f04cbc44ee30ce0$export$53a0910f038337bd(scrollRef.current, element);
|
|
3278
|
-
}
|
|
3279
|
-
}, [
|
|
3280
|
-
isVirtualized,
|
|
3281
|
-
scrollRef,
|
|
3282
|
-
manager.focusedKey
|
|
3283
|
-
]);
|
|
3284
|
-
let handlers = {
|
|
3285
|
-
onKeyDown,
|
|
3286
|
-
onFocus,
|
|
3287
|
-
onBlur,
|
|
3288
|
-
onMouseDown(e) {
|
|
3289
|
-
if (scrollRef.current === e.target)
|
|
3290
|
-
e.preventDefault();
|
|
3291
|
-
}
|
|
3292
|
-
};
|
|
3293
|
-
let { typeSelectProps } = $fb3050f43d946246$export$e32c88dfddc6e1d8({
|
|
3294
|
-
keyboardDelegate: delegate,
|
|
3295
|
-
selectionManager: manager
|
|
3296
|
-
});
|
|
3297
|
-
if (!disallowTypeAhead)
|
|
3298
|
-
handlers = $3ef42575df84b30b$export$9d1611c77c2fe928(typeSelectProps, handlers);
|
|
3299
|
-
let tabIndex;
|
|
3300
|
-
if (!shouldUseVirtualFocus)
|
|
3301
|
-
tabIndex = manager.focusedKey == null ? 0 : -1;
|
|
3302
|
-
return {
|
|
3303
|
-
collectionProps: {
|
|
3304
|
-
...handlers,
|
|
3305
|
-
tabIndex
|
|
3306
|
-
}
|
|
3307
|
-
};
|
|
3308
|
-
}
|
|
3309
|
-
function $880e95eb8b93ba9a$export$ecf600387e221c37(options) {
|
|
3310
|
-
let { selectionManager: manager, key, ref, shouldSelectOnPressUp, isVirtualized, shouldUseVirtualFocus, focus, isDisabled, onAction, allowsDifferentPressOrigin } = options;
|
|
3311
|
-
let onSelect = (e) => {
|
|
3312
|
-
if (e.pointerType === "keyboard" && $feb5ffebff200149$export$d3e3bd3e26688c04(e))
|
|
3313
|
-
manager.toggleSelection(key);
|
|
3314
|
-
else {
|
|
3315
|
-
if (manager.selectionMode === "none")
|
|
3316
|
-
return;
|
|
3317
|
-
if (manager.selectionMode === "single") {
|
|
3318
|
-
if (manager.isSelected(key) && !manager.disallowEmptySelection)
|
|
3319
|
-
manager.toggleSelection(key);
|
|
3320
|
-
else
|
|
3321
|
-
manager.replaceSelection(key);
|
|
3322
|
-
} else if (e && e.shiftKey)
|
|
3323
|
-
manager.extendSelection(key);
|
|
3324
|
-
else if (manager.selectionBehavior === "toggle" || e && ($feb5ffebff200149$export$16792effe837dba3(e) || e.pointerType === "touch" || e.pointerType === "virtual"))
|
|
3325
|
-
manager.toggleSelection(key);
|
|
3326
|
-
else
|
|
3327
|
-
manager.replaceSelection(key);
|
|
3328
|
-
}
|
|
3329
|
-
};
|
|
3330
|
-
$eCAIO$useEffect(() => {
|
|
3331
|
-
let isFocused = key === manager.focusedKey;
|
|
3332
|
-
if (isFocused && manager.isFocused && !shouldUseVirtualFocus && document.activeElement !== ref.current) {
|
|
3333
|
-
if (focus)
|
|
3334
|
-
focus();
|
|
3335
|
-
else
|
|
3336
|
-
$eCAIO$focusSafely(ref.current);
|
|
3337
|
-
}
|
|
3338
|
-
}, [
|
|
3339
|
-
ref,
|
|
3340
|
-
key,
|
|
3341
|
-
manager.focusedKey,
|
|
3342
|
-
manager.childFocusStrategy,
|
|
3343
|
-
manager.isFocused,
|
|
3344
|
-
shouldUseVirtualFocus
|
|
3345
|
-
]);
|
|
3346
|
-
isDisabled = isDisabled || manager.isDisabled(key);
|
|
3347
|
-
let itemProps = {};
|
|
3348
|
-
if (!shouldUseVirtualFocus && !isDisabled)
|
|
3349
|
-
itemProps = {
|
|
3350
|
-
tabIndex: key === manager.focusedKey ? 0 : -1,
|
|
3351
|
-
onFocus(e) {
|
|
3352
|
-
if (e.target === ref.current)
|
|
3353
|
-
manager.setFocusedKey(key);
|
|
3354
|
-
}
|
|
3355
|
-
};
|
|
3356
|
-
else if (isDisabled)
|
|
3357
|
-
itemProps.onMouseDown = (e) => {
|
|
3358
|
-
e.preventDefault();
|
|
3359
|
-
};
|
|
3360
|
-
let allowsSelection = !isDisabled && manager.canSelectItem(key);
|
|
3361
|
-
let allowsActions = onAction && !isDisabled;
|
|
3362
|
-
let hasPrimaryAction = allowsActions && (manager.selectionBehavior === "replace" ? !allowsSelection : manager.isEmpty);
|
|
3363
|
-
let hasSecondaryAction = allowsActions && allowsSelection && manager.selectionBehavior === "replace";
|
|
3364
|
-
let hasAction = hasPrimaryAction || hasSecondaryAction;
|
|
3365
|
-
let modality = $eCAIO$useRef(null);
|
|
3366
|
-
let longPressEnabled = hasAction && allowsSelection;
|
|
3367
|
-
let longPressEnabledOnPressStart = $eCAIO$useRef(false);
|
|
3368
|
-
let hadPrimaryActionOnPressStart = $eCAIO$useRef(false);
|
|
3369
|
-
let itemPressProps = {};
|
|
3370
|
-
if (shouldSelectOnPressUp) {
|
|
3371
|
-
itemPressProps.onPressStart = (e) => {
|
|
3372
|
-
modality.current = e.pointerType;
|
|
3373
|
-
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
3374
|
-
if (e.pointerType === "keyboard" && (!hasAction || $880e95eb8b93ba9a$var$isSelectionKey()))
|
|
3375
|
-
onSelect(e);
|
|
3376
|
-
};
|
|
3377
|
-
if (!allowsDifferentPressOrigin)
|
|
3378
|
-
itemPressProps.onPress = (e) => {
|
|
3379
|
-
if (hasPrimaryAction || hasSecondaryAction && e.pointerType !== "mouse") {
|
|
3380
|
-
if (e.pointerType === "keyboard" && !$880e95eb8b93ba9a$var$isActionKey())
|
|
3381
|
-
return;
|
|
3382
|
-
onAction();
|
|
3383
|
-
} else if (e.pointerType !== "keyboard")
|
|
3384
|
-
onSelect(e);
|
|
3385
|
-
};
|
|
3386
|
-
else {
|
|
3387
|
-
itemPressProps.onPressUp = (e) => {
|
|
3388
|
-
if (e.pointerType !== "keyboard")
|
|
3389
|
-
onSelect(e);
|
|
3390
|
-
};
|
|
3391
|
-
itemPressProps.onPress = hasPrimaryAction ? () => onAction() : null;
|
|
3392
|
-
}
|
|
3393
|
-
} else {
|
|
3394
|
-
itemPressProps.onPressStart = (e) => {
|
|
3395
|
-
modality.current = e.pointerType;
|
|
3396
|
-
longPressEnabledOnPressStart.current = longPressEnabled;
|
|
3397
|
-
hadPrimaryActionOnPressStart.current = hasPrimaryAction;
|
|
3398
|
-
if (e.pointerType === "mouse" && !hasPrimaryAction || e.pointerType === "keyboard" && (!onAction || $880e95eb8b93ba9a$var$isSelectionKey()))
|
|
3399
|
-
onSelect(e);
|
|
3400
|
-
};
|
|
3401
|
-
itemPressProps.onPress = (e) => {
|
|
3402
|
-
if (e.pointerType === "touch" || e.pointerType === "pen" || e.pointerType === "virtual" || e.pointerType === "keyboard" && hasAction && $880e95eb8b93ba9a$var$isActionKey() || e.pointerType === "mouse" && hadPrimaryActionOnPressStart.current) {
|
|
3403
|
-
if (hasAction)
|
|
3404
|
-
onAction();
|
|
3405
|
-
else
|
|
3406
|
-
onSelect(e);
|
|
3407
|
-
}
|
|
3408
|
-
};
|
|
3409
|
-
}
|
|
3410
|
-
if (!isVirtualized)
|
|
3411
|
-
itemProps["data-key"] = key;
|
|
3412
|
-
itemPressProps.preventFocusOnPress = shouldUseVirtualFocus;
|
|
3413
|
-
let { pressProps, isPressed } = $f6c31cce2adf654f$export$45712eceda6fad21(itemPressProps);
|
|
3414
|
-
let onDoubleClick = hasSecondaryAction ? (e) => {
|
|
3415
|
-
if (modality.current === "mouse") {
|
|
3416
|
-
e.stopPropagation();
|
|
3417
|
-
e.preventDefault();
|
|
3418
|
-
onAction();
|
|
3419
|
-
}
|
|
3420
|
-
} : void 0;
|
|
3421
|
-
let { longPressProps } = $8a26561d2877236e$export$c24ed0104d07eab9({
|
|
3422
|
-
isDisabled: !longPressEnabled,
|
|
3423
|
-
onLongPress(e) {
|
|
3424
|
-
if (e.pointerType === "touch") {
|
|
3425
|
-
onSelect(e);
|
|
3426
|
-
manager.setSelectionBehavior("toggle");
|
|
3427
|
-
}
|
|
3428
|
-
}
|
|
3429
|
-
});
|
|
3430
|
-
let onDragStartCapture = (e) => {
|
|
3431
|
-
if (modality.current === "touch" && longPressEnabledOnPressStart.current)
|
|
3432
|
-
e.preventDefault();
|
|
3433
|
-
};
|
|
3434
|
-
return {
|
|
3435
|
-
itemProps: $3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, allowsSelection || hasPrimaryAction ? pressProps : {}, longPressEnabled ? longPressProps : {}, {
|
|
3436
|
-
onDoubleClick,
|
|
3437
|
-
onDragStartCapture
|
|
3438
|
-
}),
|
|
3439
|
-
isPressed,
|
|
3440
|
-
isSelected: manager.isSelected(key),
|
|
3441
|
-
isDisabled,
|
|
3442
|
-
allowsSelection,
|
|
3443
|
-
hasAction
|
|
3444
|
-
};
|
|
3445
|
-
}
|
|
3446
|
-
function $880e95eb8b93ba9a$var$isActionKey() {
|
|
3447
|
-
let event = window.event;
|
|
3448
|
-
return (event === null || event === void 0 ? void 0 : event.key) === "Enter";
|
|
3449
|
-
}
|
|
3450
|
-
function $880e95eb8b93ba9a$var$isSelectionKey() {
|
|
3451
|
-
let event = window.event;
|
|
3452
|
-
return (event === null || event === void 0 ? void 0 : event.key) === " " || (event === null || event === void 0 ? void 0 : event.code) === "Space";
|
|
3453
|
-
}
|
|
3454
|
-
var $2a25aae57d74318e$export$a05409b8bb224a5a = class {
|
|
3455
|
-
getKeyBelow(key) {
|
|
3456
|
-
key = this.collection.getKeyAfter(key);
|
|
3457
|
-
while (key != null) {
|
|
3458
|
-
let item = this.collection.getItem(key);
|
|
3459
|
-
if (item.type === "item" && !this.disabledKeys.has(key))
|
|
3460
|
-
return key;
|
|
3461
|
-
key = this.collection.getKeyAfter(key);
|
|
3462
|
-
}
|
|
3463
|
-
}
|
|
3464
|
-
getKeyAbove(key) {
|
|
3465
|
-
key = this.collection.getKeyBefore(key);
|
|
3466
|
-
while (key != null) {
|
|
3467
|
-
let item = this.collection.getItem(key);
|
|
3468
|
-
if (item.type === "item" && !this.disabledKeys.has(key))
|
|
3469
|
-
return key;
|
|
3470
|
-
key = this.collection.getKeyBefore(key);
|
|
3471
|
-
}
|
|
3472
|
-
}
|
|
3473
|
-
getFirstKey() {
|
|
3474
|
-
let key = this.collection.getFirstKey();
|
|
3475
|
-
while (key != null) {
|
|
3476
|
-
let item = this.collection.getItem(key);
|
|
3477
|
-
if (item.type === "item" && !this.disabledKeys.has(key))
|
|
3478
|
-
return key;
|
|
3479
|
-
key = this.collection.getKeyAfter(key);
|
|
3480
|
-
}
|
|
3481
|
-
}
|
|
3482
|
-
getLastKey() {
|
|
3483
|
-
let key = this.collection.getLastKey();
|
|
3484
|
-
while (key != null) {
|
|
3485
|
-
let item = this.collection.getItem(key);
|
|
3486
|
-
if (item.type === "item" && !this.disabledKeys.has(key))
|
|
3487
|
-
return key;
|
|
3488
|
-
key = this.collection.getKeyBefore(key);
|
|
3489
|
-
}
|
|
3490
|
-
}
|
|
3491
|
-
getItem(key) {
|
|
3492
|
-
return this.ref.current.querySelector(`[data-key="${key}"]`);
|
|
3493
|
-
}
|
|
3494
|
-
getKeyPageAbove(key) {
|
|
3495
|
-
let menu = this.ref.current;
|
|
3496
|
-
let item = this.getItem(key);
|
|
3497
|
-
if (!item)
|
|
3498
|
-
return null;
|
|
3499
|
-
let pageY = Math.max(0, item.offsetTop + item.offsetHeight - menu.offsetHeight);
|
|
3500
|
-
while (item && item.offsetTop > pageY) {
|
|
3501
|
-
key = this.getKeyAbove(key);
|
|
3502
|
-
item = this.getItem(key);
|
|
3503
|
-
}
|
|
3504
|
-
return key;
|
|
3505
|
-
}
|
|
3506
|
-
getKeyPageBelow(key) {
|
|
3507
|
-
let menu = this.ref.current;
|
|
3508
|
-
let item = this.getItem(key);
|
|
3509
|
-
if (!item)
|
|
3510
|
-
return null;
|
|
3511
|
-
let pageY = Math.min(menu.scrollHeight, item.offsetTop - item.offsetHeight + menu.offsetHeight);
|
|
3512
|
-
while (item && item.offsetTop < pageY) {
|
|
3513
|
-
key = this.getKeyBelow(key);
|
|
3514
|
-
item = this.getItem(key);
|
|
3515
|
-
}
|
|
3516
|
-
return key;
|
|
3517
|
-
}
|
|
3518
|
-
getKeyForSearch(search, fromKey) {
|
|
3519
|
-
if (!this.collator)
|
|
3520
|
-
return null;
|
|
3521
|
-
let collection = this.collection;
|
|
3522
|
-
let key = fromKey || this.getFirstKey();
|
|
3523
|
-
while (key != null) {
|
|
3524
|
-
let item = collection.getItem(key);
|
|
3525
|
-
let substring = item.textValue.slice(0, search.length);
|
|
3526
|
-
if (item.textValue && this.collator.compare(substring, search) === 0)
|
|
3527
|
-
return key;
|
|
3528
|
-
key = this.getKeyBelow(key);
|
|
3529
|
-
}
|
|
3530
|
-
return null;
|
|
3531
|
-
}
|
|
3532
|
-
constructor(collection, disabledKeys, ref, collator) {
|
|
3533
|
-
this.collection = collection;
|
|
3534
|
-
this.disabledKeys = disabledKeys;
|
|
3535
|
-
this.ref = ref;
|
|
3536
|
-
this.collator = collator;
|
|
3537
|
-
}
|
|
3538
|
-
};
|
|
3539
|
-
function $982254629710d113$export$b95089534ab7c1fd(props) {
|
|
3540
|
-
let { selectionManager, collection, disabledKeys, ref, keyboardDelegate, autoFocus, shouldFocusWrap, isVirtualized, disallowEmptySelection, selectOnFocus = selectionManager.selectionBehavior === "replace", disallowTypeAhead, shouldUseVirtualFocus, allowsTabNavigation } = props;
|
|
3541
|
-
let collator = $325a3faab7a68acd$export$a16aca283550c30d({
|
|
3542
|
-
usage: "search",
|
|
3543
|
-
sensitivity: "base"
|
|
3544
|
-
});
|
|
3545
|
-
let disabledBehavior = selectionManager.disabledBehavior;
|
|
3546
|
-
let delegate = $eCAIO$useMemo(
|
|
3547
|
-
() => keyboardDelegate || new $2a25aae57d74318e$export$a05409b8bb224a5a(collection, disabledBehavior === "selection" ? /* @__PURE__ */ new Set() : disabledKeys, ref, collator),
|
|
3548
|
-
[
|
|
3549
|
-
keyboardDelegate,
|
|
3550
|
-
collection,
|
|
3551
|
-
disabledKeys,
|
|
3552
|
-
ref,
|
|
3553
|
-
collator,
|
|
3554
|
-
disabledBehavior
|
|
3555
|
-
]
|
|
3556
|
-
);
|
|
3557
|
-
let { collectionProps } = $ae20dd8cbca75726$export$d6daf82dcd84e87c({
|
|
3558
|
-
ref,
|
|
3559
|
-
selectionManager,
|
|
3560
|
-
keyboardDelegate: delegate,
|
|
3561
|
-
autoFocus,
|
|
3562
|
-
shouldFocusWrap,
|
|
3563
|
-
disallowEmptySelection,
|
|
3564
|
-
selectOnFocus,
|
|
3565
|
-
disallowTypeAhead,
|
|
3566
|
-
shouldUseVirtualFocus,
|
|
3567
|
-
allowsTabNavigation,
|
|
3568
|
-
isVirtualized,
|
|
3569
|
-
scrollRef: ref
|
|
3570
|
-
});
|
|
3571
|
-
return {
|
|
3572
|
-
listProps: collectionProps
|
|
3573
|
-
};
|
|
3574
|
-
}
|
|
3575
|
-
|
|
3576
|
-
// ../../node_modules/@react-stately/collections/dist/module.js
|
|
3577
|
-
import $tyW6A$react, { useMemo as $tyW6A$useMemo, useRef as $tyW6A$useRef } from "react";
|
|
3578
|
-
function $c1d7fb2ec91bae71$var$Item(props) {
|
|
3579
|
-
return null;
|
|
3580
|
-
}
|
|
3581
|
-
$c1d7fb2ec91bae71$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
|
|
3582
|
-
let { childItems, title, children } = props;
|
|
3583
|
-
let rendered = props.title || props.children;
|
|
3584
|
-
let textValue = props.textValue || (typeof rendered === "string" ? rendered : "") || props["aria-label"] || "";
|
|
3585
|
-
if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning))
|
|
3586
|
-
console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.");
|
|
3587
|
-
yield {
|
|
3588
|
-
type: "item",
|
|
3589
|
-
props,
|
|
3590
|
-
rendered,
|
|
3591
|
-
textValue,
|
|
3592
|
-
"aria-label": props["aria-label"],
|
|
3593
|
-
hasChildNodes: $c1d7fb2ec91bae71$var$hasChildItems(props),
|
|
3594
|
-
*childNodes() {
|
|
3595
|
-
if (childItems)
|
|
3596
|
-
for (let child1 of childItems)
|
|
3597
|
-
yield {
|
|
3598
|
-
type: "item",
|
|
3599
|
-
value: child1
|
|
3600
|
-
};
|
|
3601
|
-
else if (title) {
|
|
3602
|
-
let items = [];
|
|
3603
|
-
$tyW6A$react.Children.forEach(children, (child) => {
|
|
3604
|
-
items.push({
|
|
3605
|
-
type: "item",
|
|
3606
|
-
element: child
|
|
3607
|
-
});
|
|
3608
|
-
});
|
|
3609
|
-
yield* items;
|
|
3610
|
-
}
|
|
3611
|
-
}
|
|
3612
|
-
};
|
|
3613
|
-
};
|
|
3614
|
-
function $c1d7fb2ec91bae71$var$hasChildItems(props) {
|
|
3615
|
-
if (props.hasChildItems != null)
|
|
3616
|
-
return props.hasChildItems;
|
|
3617
|
-
if (props.childItems)
|
|
3618
|
-
return true;
|
|
3619
|
-
if (props.title && $tyW6A$react.Children.count(props.children) > 0)
|
|
3620
|
-
return true;
|
|
3621
|
-
return false;
|
|
3622
|
-
}
|
|
3623
|
-
function $9fc4852771d079eb$var$Section(props) {
|
|
3624
|
-
return null;
|
|
3625
|
-
}
|
|
3626
|
-
$9fc4852771d079eb$var$Section.getCollectionNode = function* getCollectionNode2(props) {
|
|
3627
|
-
let { children, title, items: items1 } = props;
|
|
3628
|
-
yield {
|
|
3629
|
-
type: "section",
|
|
3630
|
-
props,
|
|
3631
|
-
hasChildNodes: true,
|
|
3632
|
-
rendered: title,
|
|
3633
|
-
"aria-label": props["aria-label"],
|
|
3634
|
-
*childNodes() {
|
|
3635
|
-
if (typeof children === "function") {
|
|
3636
|
-
if (!items1)
|
|
3637
|
-
throw new Error("props.children was a function but props.items is missing");
|
|
3638
|
-
for (let item of items1)
|
|
3639
|
-
yield {
|
|
3640
|
-
type: "item",
|
|
3641
|
-
value: item,
|
|
3642
|
-
renderer: children
|
|
3643
|
-
};
|
|
3644
|
-
} else {
|
|
3645
|
-
let items = [];
|
|
3646
|
-
$tyW6A$react.Children.forEach(children, (child) => {
|
|
3647
|
-
items.push({
|
|
3648
|
-
type: "item",
|
|
3649
|
-
element: child
|
|
3650
|
-
});
|
|
3651
|
-
});
|
|
3652
|
-
yield* items;
|
|
3653
|
-
}
|
|
3654
|
-
}
|
|
3655
|
-
};
|
|
3656
|
-
};
|
|
3657
|
-
var $453cc9f0df89c0a5$var$cache = /* @__PURE__ */ new WeakMap();
|
|
3658
|
-
function $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {
|
|
3659
|
-
let count = $453cc9f0df89c0a5$var$cache.get(collection);
|
|
3660
|
-
if (count != null)
|
|
3661
|
-
return count;
|
|
3662
|
-
count = 0;
|
|
3663
|
-
for (let item of collection)
|
|
3664
|
-
if (item.type === "section")
|
|
3665
|
-
count += $453cc9f0df89c0a5$export$77d5aafae4e095b2(item.childNodes);
|
|
3666
|
-
else
|
|
3667
|
-
count++;
|
|
3668
|
-
$453cc9f0df89c0a5$var$cache.set(collection, count);
|
|
3669
|
-
return count;
|
|
3670
|
-
}
|
|
3671
|
-
|
|
3672
|
-
// ../../node_modules/@react-aria/listbox/dist/module.js
|
|
3673
|
-
var $b1f0cad8af73213b$export$3585ede4d035bf14 = /* @__PURE__ */ new WeakMap();
|
|
3674
|
-
function $b1f0cad8af73213b$var$normalizeKey(key) {
|
|
3675
|
-
if (typeof key === "string")
|
|
3676
|
-
return key.replace(/\s*/g, "");
|
|
3677
|
-
return "" + key;
|
|
3678
|
-
}
|
|
3679
|
-
function $b1f0cad8af73213b$export$9145995848b05025(state, itemKey) {
|
|
3680
|
-
let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
|
|
3681
|
-
if (!data)
|
|
3682
|
-
throw new Error("Unknown list");
|
|
3683
|
-
return `${data.id}-option-${$b1f0cad8af73213b$var$normalizeKey(itemKey)}`;
|
|
3684
|
-
}
|
|
3685
|
-
function $c132121280ec012d$export$50eacbbf140a3141(props, state, ref) {
|
|
3686
|
-
let domProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
|
|
3687
|
-
labelable: true
|
|
3688
|
-
});
|
|
3689
|
-
let { listProps } = $982254629710d113$export$b95089534ab7c1fd({
|
|
3690
|
-
...props,
|
|
3691
|
-
ref,
|
|
3692
|
-
selectionManager: state.selectionManager,
|
|
3693
|
-
collection: state.collection,
|
|
3694
|
-
disabledKeys: state.disabledKeys
|
|
3695
|
-
});
|
|
3696
|
-
let { focusWithinProps } = $9ab94262bd0047c7$export$420e68273165f4ec({
|
|
3697
|
-
onFocusWithin: props.onFocus,
|
|
3698
|
-
onBlurWithin: props.onBlur,
|
|
3699
|
-
onFocusWithinChange: props.onFocusChange
|
|
3700
|
-
});
|
|
3701
|
-
let id = $bdb11010cef70236$export$f680877a34711e37(props.id);
|
|
3702
|
-
$b1f0cad8af73213b$export$3585ede4d035bf14.set(state, {
|
|
3703
|
-
id,
|
|
3704
|
-
shouldUseVirtualFocus: props.shouldUseVirtualFocus,
|
|
3705
|
-
shouldSelectOnPressUp: props.shouldSelectOnPressUp,
|
|
3706
|
-
shouldFocusOnHover: props.shouldFocusOnHover,
|
|
3707
|
-
isVirtualized: props.isVirtualized,
|
|
3708
|
-
onAction: props.onAction
|
|
3709
|
-
});
|
|
3710
|
-
let { labelProps, fieldProps } = $d191a55c9702f145$export$8467354a121f1b9f({
|
|
3711
|
-
...props,
|
|
3712
|
-
id,
|
|
3713
|
-
labelElementType: "span"
|
|
3714
|
-
});
|
|
3715
|
-
return {
|
|
3716
|
-
labelProps,
|
|
3717
|
-
listBoxProps: $3ef42575df84b30b$export$9d1611c77c2fe928(domProps, focusWithinProps, state.selectionManager.selectionMode === "multiple" ? {
|
|
3718
|
-
"aria-multiselectable": "true"
|
|
3719
|
-
} : {}, {
|
|
3720
|
-
role: "listbox",
|
|
3721
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(fieldProps, listProps)
|
|
3722
|
-
})
|
|
3723
|
-
};
|
|
3724
|
-
}
|
|
3725
|
-
function $293f70390ea03370$export$497855f14858aa34(props, state, ref) {
|
|
3726
|
-
let { key } = props;
|
|
3727
|
-
let data = $b1f0cad8af73213b$export$3585ede4d035bf14.get(state);
|
|
3728
|
-
var _isDisabled;
|
|
3729
|
-
let isDisabled = (_isDisabled = props.isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : state.disabledKeys.has(key);
|
|
3730
|
-
var _isSelected;
|
|
3731
|
-
let isSelected = (_isSelected = props.isSelected) !== null && _isSelected !== void 0 ? _isSelected : state.selectionManager.isSelected(key);
|
|
3732
|
-
let isFocused = state.selectionManager.focusedKey === key;
|
|
3733
|
-
var _shouldSelectOnPressUp;
|
|
3734
|
-
let shouldSelectOnPressUp = (_shouldSelectOnPressUp = props.shouldSelectOnPressUp) !== null && _shouldSelectOnPressUp !== void 0 ? _shouldSelectOnPressUp : data.shouldSelectOnPressUp;
|
|
3735
|
-
var _shouldFocusOnHover;
|
|
3736
|
-
let shouldFocusOnHover = (_shouldFocusOnHover = props.shouldFocusOnHover) !== null && _shouldFocusOnHover !== void 0 ? _shouldFocusOnHover : data.shouldFocusOnHover;
|
|
3737
|
-
var _shouldUseVirtualFocus;
|
|
3738
|
-
let shouldUseVirtualFocus = (_shouldUseVirtualFocus = props.shouldUseVirtualFocus) !== null && _shouldUseVirtualFocus !== void 0 ? _shouldUseVirtualFocus : data.shouldUseVirtualFocus;
|
|
3739
|
-
var _isVirtualized;
|
|
3740
|
-
let isVirtualized = (_isVirtualized = props.isVirtualized) !== null && _isVirtualized !== void 0 ? _isVirtualized : data.isVirtualized;
|
|
3741
|
-
let labelId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
|
|
3742
|
-
let descriptionId = $bdb11010cef70236$export$b4cc09c592e8fdb8();
|
|
3743
|
-
let optionProps = {
|
|
3744
|
-
role: "option",
|
|
3745
|
-
"aria-disabled": isDisabled,
|
|
3746
|
-
"aria-selected": state.selectionManager.selectionMode !== "none" ? isSelected : void 0
|
|
3747
|
-
};
|
|
3748
|
-
if (!($c87311424ea30a05$export$9ac100e40613ea10() && $c87311424ea30a05$export$78551043582a6a98())) {
|
|
3749
|
-
optionProps["aria-label"] = props["aria-label"];
|
|
3750
|
-
optionProps["aria-labelledby"] = labelId;
|
|
3751
|
-
optionProps["aria-describedby"] = descriptionId;
|
|
3752
|
-
}
|
|
3753
|
-
if (isVirtualized) {
|
|
3754
|
-
optionProps["aria-posinset"] = state.collection.getItem(key).index + 1;
|
|
3755
|
-
optionProps["aria-setsize"] = $453cc9f0df89c0a5$export$77d5aafae4e095b2(state.collection);
|
|
3756
|
-
}
|
|
3757
|
-
let { itemProps, isPressed, hasAction, allowsSelection } = $880e95eb8b93ba9a$export$ecf600387e221c37({
|
|
3758
|
-
selectionManager: state.selectionManager,
|
|
3759
|
-
key,
|
|
3760
|
-
ref,
|
|
3761
|
-
shouldSelectOnPressUp,
|
|
3762
|
-
allowsDifferentPressOrigin: shouldSelectOnPressUp && shouldFocusOnHover,
|
|
3763
|
-
isVirtualized,
|
|
3764
|
-
shouldUseVirtualFocus,
|
|
3765
|
-
isDisabled,
|
|
3766
|
-
onAction: data.onAction ? () => data.onAction(key) : void 0
|
|
3767
|
-
});
|
|
3768
|
-
let { hoverProps } = $6179b936705e76d3$export$ae780daf29e6d456({
|
|
3769
|
-
isDisabled: isDisabled || !shouldFocusOnHover,
|
|
3770
|
-
onHoverStart() {
|
|
3771
|
-
if (!$507fabe10e71c6fb$export$b9b3dfddab17db27()) {
|
|
3772
|
-
state.selectionManager.setFocused(true);
|
|
3773
|
-
state.selectionManager.setFocusedKey(key);
|
|
3774
|
-
}
|
|
3775
|
-
}
|
|
3776
|
-
});
|
|
3777
|
-
return {
|
|
3778
|
-
optionProps: {
|
|
3779
|
-
...optionProps,
|
|
3780
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(itemProps, hoverProps),
|
|
3781
|
-
id: $b1f0cad8af73213b$export$9145995848b05025(state, key)
|
|
3782
|
-
},
|
|
3783
|
-
labelProps: {
|
|
3784
|
-
id: labelId
|
|
3785
|
-
},
|
|
3786
|
-
descriptionProps: {
|
|
3787
|
-
id: descriptionId
|
|
3788
|
-
},
|
|
3789
|
-
isFocused,
|
|
3790
|
-
isSelected,
|
|
3791
|
-
isDisabled,
|
|
3792
|
-
isPressed,
|
|
3793
|
-
allowsSelection,
|
|
3794
|
-
hasAction
|
|
3795
|
-
};
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
// src/components/DropdownSelector/Listbox.tsx
|
|
1473
|
+
import { useListBox, useOption } from "@react-aria/listbox";
|
|
1474
|
+
import { mergeProps } from "@react-aria/utils";
|
|
3799
1475
|
import { useFocusRing } from "@react-aria/focus";
|
|
3800
|
-
import { px as
|
|
1476
|
+
import { px as px3 } from "@charcoal-ui/utils";
|
|
3801
1477
|
var Listbox = ({
|
|
3802
1478
|
state,
|
|
3803
1479
|
mode = "default",
|
|
3804
1480
|
...props
|
|
3805
1481
|
}) => {
|
|
3806
1482
|
const ref = useRef5(null);
|
|
3807
|
-
const { listBoxProps } =
|
|
1483
|
+
const { listBoxProps } = useListBox(props, state, ref);
|
|
3808
1484
|
const collection = useMemo2(
|
|
3809
1485
|
() => [...state.collection].map((node, index, self) => ({
|
|
3810
1486
|
node,
|
|
@@ -3813,7 +1489,7 @@ var Listbox = ({
|
|
|
3813
1489
|
})),
|
|
3814
1490
|
[state.collection]
|
|
3815
1491
|
);
|
|
3816
|
-
return /* @__PURE__ */
|
|
1492
|
+
return /* @__PURE__ */ React15.createElement(ListboxRoot, { ref, ...listBoxProps }, collection.map(({ node, last }) => /* @__PURE__ */ React15.createElement(Fragment, { key: node.key }, /* @__PURE__ */ React15.createElement(Option, { item: node, state, mode }), !last && mode === "separator" && /* @__PURE__ */ React15.createElement(Divider, null))));
|
|
3817
1493
|
};
|
|
3818
1494
|
var Listbox_default = memo(Listbox);
|
|
3819
1495
|
var ListboxRoot = styled13.ul`
|
|
@@ -3843,14 +1519,14 @@ var Divider = styled13.div.attrs({ role: "separator" })`
|
|
|
3843
1519
|
`;
|
|
3844
1520
|
var Option = ({ item, state, mode }) => {
|
|
3845
1521
|
const ref = useRef5(null);
|
|
3846
|
-
const { optionProps, isSelected } =
|
|
1522
|
+
const { optionProps, isSelected } = useOption(item, state, ref);
|
|
3847
1523
|
const { focusProps } = useFocusRing();
|
|
3848
|
-
return /* @__PURE__ */
|
|
1524
|
+
return /* @__PURE__ */ React15.createElement(OptionRoot, { ...mergeProps(optionProps, focusProps), ref, mode }, /* @__PURE__ */ React15.createElement(OptionCheckIcon, { name: "16/Check", isSelected }), /* @__PURE__ */ React15.createElement(OptionText, null, item.rendered));
|
|
3849
1525
|
};
|
|
3850
1526
|
var OptionRoot = styled13.li`
|
|
3851
1527
|
display: flex;
|
|
3852
1528
|
align-items: center;
|
|
3853
|
-
gap: ${({ theme: theme4 }) =>
|
|
1529
|
+
gap: ${({ theme: theme4 }) => px3(theme4.spacing[4])};
|
|
3854
1530
|
height: 40px;
|
|
3855
1531
|
cursor: pointer;
|
|
3856
1532
|
outline: none;
|
|
@@ -3880,11 +1556,12 @@ var OptionText = styled13.span`
|
|
|
3880
1556
|
// src/components/DropdownSelector/Popover.tsx
|
|
3881
1557
|
import { FocusScope as FocusScope2 } from "@react-aria/focus";
|
|
3882
1558
|
import { DismissButton, useOverlay as useOverlay2 } from "@react-aria/overlays";
|
|
3883
|
-
import
|
|
1559
|
+
import React16, {
|
|
3884
1560
|
useRef as useRef6,
|
|
3885
1561
|
useMemo as useMemo3,
|
|
3886
1562
|
memo as memo2
|
|
3887
1563
|
} from "react";
|
|
1564
|
+
import { mergeProps as mergeProps2 } from "@react-aria/utils";
|
|
3888
1565
|
var Popover = ({ open, onClose, children, ...props }) => {
|
|
3889
1566
|
const ref = useRef6(null);
|
|
3890
1567
|
const { overlayProps } = useOverlay2(
|
|
@@ -3899,7 +1576,7 @@ var Popover = ({ open, onClose, children, ...props }) => {
|
|
|
3899
1576
|
),
|
|
3900
1577
|
ref
|
|
3901
1578
|
);
|
|
3902
|
-
return /* @__PURE__ */
|
|
1579
|
+
return /* @__PURE__ */ React16.createElement(FocusScope2, { restoreFocus: true }, /* @__PURE__ */ React16.createElement("div", { ...mergeProps2(overlayProps, props), ref }, children, /* @__PURE__ */ React16.createElement(DismissButton, { onDismiss: onClose })));
|
|
3903
1580
|
};
|
|
3904
1581
|
var Popover_default = memo2(Popover);
|
|
3905
1582
|
|
|
@@ -3947,7 +1624,7 @@ var DropdownSelector = ({
|
|
|
3947
1624
|
} = useSelect(selectProps, state, triggerRef);
|
|
3948
1625
|
const { buttonProps } = useButton(triggerProps, triggerRef);
|
|
3949
1626
|
const hasAssertiveText = assertiveText !== void 0 && assertiveText.length > 0;
|
|
3950
|
-
return /* @__PURE__ */
|
|
1627
|
+
return /* @__PURE__ */ React17.createElement(DropdownSelectorRoot, { "aria-disabled": disabled, className }, /* @__PURE__ */ React17.createElement(
|
|
3951
1628
|
DropdownFieldLabel,
|
|
3952
1629
|
{
|
|
3953
1630
|
label,
|
|
@@ -3957,7 +1634,7 @@ var DropdownSelector = ({
|
|
|
3957
1634
|
...labelProps,
|
|
3958
1635
|
...!showLabel ? visuallyHiddenProps : {}
|
|
3959
1636
|
}
|
|
3960
|
-
), /* @__PURE__ */
|
|
1637
|
+
), /* @__PURE__ */ React17.createElement(
|
|
3961
1638
|
HiddenSelect,
|
|
3962
1639
|
{
|
|
3963
1640
|
state,
|
|
@@ -3967,7 +1644,7 @@ var DropdownSelector = ({
|
|
|
3967
1644
|
isDisabled: disabled,
|
|
3968
1645
|
autoComplete
|
|
3969
1646
|
}
|
|
3970
|
-
), /* @__PURE__ */
|
|
1647
|
+
), /* @__PURE__ */ React17.createElement(DropdownButtonWrapper, null, /* @__PURE__ */ React17.createElement(DropdownButton, { ...buttonProps, ref: triggerRef, invalid }, /* @__PURE__ */ React17.createElement(DropdownButtonText, { ...valueProps }, state.selectedItem ? state.selectedItem.rendered : props.placeholder), /* @__PURE__ */ React17.createElement(DropdownButtonIcon, { name: "16/Menu" })), state.isOpen && /* @__PURE__ */ React17.createElement(DropdownPopover, { open: state.isOpen, onClose: () => state.close() }, /* @__PURE__ */ React17.createElement(Listbox_default, { ...menuProps, state, mode }))), hasAssertiveText && /* @__PURE__ */ React17.createElement(
|
|
3971
1648
|
AssertiveText,
|
|
3972
1649
|
{
|
|
3973
1650
|
invalid,
|
|
@@ -4042,7 +1719,7 @@ var DropdownPopover = styled14(Popover_default)`
|
|
|
4042
1719
|
`;
|
|
4043
1720
|
|
|
4044
1721
|
// src/components/SegmentedControl/index.tsx
|
|
4045
|
-
import
|
|
1722
|
+
import React19, { forwardRef, memo as memo3, useMemo as useMemo5, useRef as useRef8 } from "react";
|
|
4046
1723
|
import { useRadioGroupState } from "react-stately";
|
|
4047
1724
|
import {
|
|
4048
1725
|
useRadio,
|
|
@@ -4052,13 +1729,13 @@ import styled15 from "styled-components";
|
|
|
4052
1729
|
import { disabledSelector as disabledSelector5 } from "@charcoal-ui/utils";
|
|
4053
1730
|
|
|
4054
1731
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
4055
|
-
import
|
|
1732
|
+
import React18, { createContext as createContext2, useContext as useContext5 } from "react";
|
|
4056
1733
|
var RadioContext = createContext2(null);
|
|
4057
1734
|
var RadioProvider = ({
|
|
4058
1735
|
value,
|
|
4059
1736
|
children
|
|
4060
1737
|
}) => {
|
|
4061
|
-
return /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ React18.createElement(RadioContext.Provider, { value }, children);
|
|
4062
1739
|
};
|
|
4063
1740
|
var useRadioContext = () => {
|
|
4064
1741
|
const state = useContext5(RadioContext);
|
|
@@ -4086,7 +1763,7 @@ var SegmentedControl = forwardRef(
|
|
|
4086
1763
|
(d) => typeof d === "string" ? { value: d, label: d } : d
|
|
4087
1764
|
);
|
|
4088
1765
|
}, [props.data]);
|
|
4089
|
-
return /* @__PURE__ */
|
|
1766
|
+
return /* @__PURE__ */ React19.createElement(SegmentedControlRoot, { ref, ...radioGroupProps }, /* @__PURE__ */ React19.createElement(RadioProvider, { value: state }, segmentedControlItems.map((item) => /* @__PURE__ */ React19.createElement(
|
|
4090
1767
|
Segmented,
|
|
4091
1768
|
{
|
|
4092
1769
|
key: item.value,
|
|
@@ -4110,14 +1787,14 @@ var Segmented = ({ children, ...props }) => {
|
|
|
4110
1787
|
state,
|
|
4111
1788
|
ref
|
|
4112
1789
|
);
|
|
4113
|
-
return /* @__PURE__ */
|
|
1790
|
+
return /* @__PURE__ */ React19.createElement(
|
|
4114
1791
|
SegmentedRoot,
|
|
4115
1792
|
{
|
|
4116
1793
|
"aria-disabled": isDisabled || state.isReadOnly,
|
|
4117
1794
|
checked: isSelected
|
|
4118
1795
|
},
|
|
4119
|
-
/* @__PURE__ */
|
|
4120
|
-
/* @__PURE__ */
|
|
1796
|
+
/* @__PURE__ */ React19.createElement(SegmentedInput, { ...inputProps, ref }),
|
|
1797
|
+
/* @__PURE__ */ React19.createElement(RadioLabel2, null, /* @__PURE__ */ React19.createElement(SegmentedLabelInner, null, children))
|
|
4121
1798
|
);
|
|
4122
1799
|
};
|
|
4123
1800
|
var SegmentedControlRoot = styled15.div`
|
|
@@ -4170,11 +1847,12 @@ var SegmentedLabelInner = styled15.div`
|
|
|
4170
1847
|
`;
|
|
4171
1848
|
|
|
4172
1849
|
// src/components/Checkbox/index.tsx
|
|
4173
|
-
import
|
|
1850
|
+
import React20, { forwardRef as forwardRef2, memo as memo4, useMemo as useMemo6 } from "react";
|
|
4174
1851
|
import styled16, { css as css6 } from "styled-components";
|
|
4175
1852
|
import { useCheckbox } from "@react-aria/checkbox";
|
|
1853
|
+
import { useObjectRef } from "@react-aria/utils";
|
|
4176
1854
|
import { useToggleState as useToggleState2 } from "react-stately";
|
|
4177
|
-
import { disabledSelector as disabledSelector6, px as
|
|
1855
|
+
import { disabledSelector as disabledSelector6, px as px4 } from "@charcoal-ui/utils";
|
|
4178
1856
|
var Checkbox = forwardRef2(
|
|
4179
1857
|
function CheckboxInner(props, ref) {
|
|
4180
1858
|
const ariaCheckboxProps = useMemo6(
|
|
@@ -4188,10 +1866,10 @@ var Checkbox = forwardRef2(
|
|
|
4188
1866
|
[props]
|
|
4189
1867
|
);
|
|
4190
1868
|
const state = useToggleState2(ariaCheckboxProps);
|
|
4191
|
-
const objectRef =
|
|
1869
|
+
const objectRef = useObjectRef(ref);
|
|
4192
1870
|
const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef);
|
|
4193
1871
|
const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
|
|
4194
|
-
return /* @__PURE__ */
|
|
1872
|
+
return /* @__PURE__ */ React20.createElement(InputRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React20.createElement(CheckboxRoot, null, /* @__PURE__ */ React20.createElement(CheckboxInput, { type: "checkbox", ...inputProps }), /* @__PURE__ */ React20.createElement(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked }, /* @__PURE__ */ React20.createElement(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }))), "children" in props && /* @__PURE__ */ React20.createElement(InputLabel, null, props.children));
|
|
4195
1873
|
}
|
|
4196
1874
|
);
|
|
4197
1875
|
var Checkbox_default = memo4(Checkbox);
|
|
@@ -4201,15 +1879,18 @@ var hiddenCss = css6`
|
|
|
4201
1879
|
var InputRoot = styled16.label`
|
|
4202
1880
|
position: relative;
|
|
4203
1881
|
display: flex;
|
|
4204
|
-
|
|
1882
|
+
|
|
4205
1883
|
cursor: pointer;
|
|
4206
1884
|
${disabledSelector6} {
|
|
4207
1885
|
cursor: default;
|
|
4208
1886
|
}
|
|
4209
1887
|
|
|
4210
|
-
gap: ${({ theme: theme4 }) =>
|
|
1888
|
+
gap: ${({ theme: theme4 }) => px4(theme4.spacing[4])};
|
|
4211
1889
|
${theme((o) => [o.disabled])}
|
|
4212
1890
|
`;
|
|
1891
|
+
var CheckboxRoot = styled16.div`
|
|
1892
|
+
position: relative;
|
|
1893
|
+
`;
|
|
4213
1894
|
var CheckboxInput = styled16.input`
|
|
4214
1895
|
&[type='checkbox'] {
|
|
4215
1896
|
appearance: none;
|
|
@@ -4244,17 +1925,22 @@ var CheckboxInputOverlay = styled16.div`
|
|
|
4244
1925
|
${({ checked }) => checked !== true && hiddenCss};
|
|
4245
1926
|
`;
|
|
4246
1927
|
var InputLabel = styled16.div`
|
|
4247
|
-
${theme((o) => [o.
|
|
1928
|
+
${theme((o) => [o.font.text2])}
|
|
1929
|
+
|
|
1930
|
+
font-size: 14px;
|
|
1931
|
+
/** checkbox の height が 20px なのでcheckbox と text が揃っているように見せるために行ボックスの高さを 20px にしている */
|
|
1932
|
+
line-height: 20px;
|
|
4248
1933
|
`;
|
|
4249
1934
|
|
|
4250
1935
|
// src/components/TagItem/index.tsx
|
|
4251
|
-
import
|
|
1936
|
+
import React21, {
|
|
4252
1937
|
forwardRef as forwardRef3,
|
|
4253
1938
|
memo as memo5,
|
|
4254
1939
|
useMemo as useMemo7
|
|
4255
1940
|
} from "react";
|
|
1941
|
+
import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
|
|
4256
1942
|
import styled17, { css as css7 } from "styled-components";
|
|
4257
|
-
import { disabledSelector as disabledSelector7, px as
|
|
1943
|
+
import { disabledSelector as disabledSelector7, px as px5 } from "@charcoal-ui/utils";
|
|
4258
1944
|
import { useButton as useButton2 } from "@react-aria/button";
|
|
4259
1945
|
var sizeMap = {
|
|
4260
1946
|
S: 32,
|
|
@@ -4271,7 +1957,7 @@ var TagItem = forwardRef3(
|
|
|
4271
1957
|
status = "default",
|
|
4272
1958
|
...props
|
|
4273
1959
|
}, _ref) {
|
|
4274
|
-
const ref =
|
|
1960
|
+
const ref = useObjectRef2(_ref);
|
|
4275
1961
|
const ariaButtonProps = useMemo7(
|
|
4276
1962
|
() => ({
|
|
4277
1963
|
elementType: "a",
|
|
@@ -4282,7 +1968,7 @@ var TagItem = forwardRef3(
|
|
|
4282
1968
|
);
|
|
4283
1969
|
const { buttonProps } = useButton2(ariaButtonProps, ref);
|
|
4284
1970
|
const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
|
|
4285
|
-
return /* @__PURE__ */
|
|
1971
|
+
return /* @__PURE__ */ React21.createElement(
|
|
4286
1972
|
TagItemRoot,
|
|
4287
1973
|
{
|
|
4288
1974
|
ref,
|
|
@@ -4290,8 +1976,8 @@ var TagItem = forwardRef3(
|
|
|
4290
1976
|
status,
|
|
4291
1977
|
...buttonProps
|
|
4292
1978
|
},
|
|
4293
|
-
/* @__PURE__ */
|
|
4294
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ React21.createElement(Background, { bgColor, bgImage }),
|
|
1980
|
+
/* @__PURE__ */ React21.createElement(Inner, null, /* @__PURE__ */ React21.createElement(LabelWrapper, { isTranslate: hasTranslatedLabel }, hasTranslatedLabel && /* @__PURE__ */ React21.createElement(TranslatedLabel, null, /* @__PURE__ */ React21.createElement(Label3, null, translatedLabel)), /* @__PURE__ */ React21.createElement(Label3, null, label)), status === "active" && /* @__PURE__ */ React21.createElement(Icon_default, { name: "16/Remove" }))
|
|
4295
1981
|
);
|
|
4296
1982
|
}
|
|
4297
1983
|
);
|
|
@@ -4350,7 +2036,7 @@ var Background = styled17.div`
|
|
|
4350
2036
|
`;
|
|
4351
2037
|
var Inner = styled17.div`
|
|
4352
2038
|
display: inline-flex;
|
|
4353
|
-
gap: ${({ theme: theme4 }) =>
|
|
2039
|
+
gap: ${({ theme: theme4 }) => px5(theme4.spacing[8])};
|
|
4354
2040
|
align-items: center;
|
|
4355
2041
|
z-index: 2;
|
|
4356
2042
|
`;
|
|
@@ -4380,6 +2066,7 @@ var TranslatedLabel = styled17.div`
|
|
|
4380
2066
|
`;
|
|
4381
2067
|
export {
|
|
4382
2068
|
Button_default as Button,
|
|
2069
|
+
CharcoalProvider,
|
|
4383
2070
|
Checkbox_default as Checkbox,
|
|
4384
2071
|
Clickable_default as Clickable,
|
|
4385
2072
|
ComponentAbstraction,
|