@storybook/addon-a11y 10.1.0-alpha.10 → 10.1.0-alpha.11
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/_browser-chunks/chunk-3FKQRDK3.js +13 -0
- package/dist/_browser-chunks/chunk-4BE7D4DS.js +9 -0
- package/dist/_browser-chunks/chunk-CQ2APV2R.js +163 -0
- package/dist/_browser-chunks/matchers-DMFSMG2O.js +1263 -0
- package/dist/index.js +4 -6
- package/dist/manager.js +452 -835
- package/dist/postinstall.js +1777 -3836
- package/dist/preview.js +3 -3
- package/package.json +4 -4
- package/dist/_browser-chunks/chunk-JFJ5UJ7Q.js +0 -11
- package/dist/_browser-chunks/chunk-JZJ5QO7P.js +0 -26
- package/dist/_browser-chunks/chunk-W2OC36OK.js +0 -217
- package/dist/_browser-chunks/matchers-ZRZBO4XZ.js +0 -1987
package/dist/manager.js
CHANGED
|
@@ -6,10 +6,8 @@ import {
|
|
|
6
6
|
PARAM_KEY,
|
|
7
7
|
STATUS_TYPE_ID_A11Y,
|
|
8
8
|
STATUS_TYPE_ID_COMPONENT_TEST
|
|
9
|
-
} from "./_browser-chunks/chunk-
|
|
10
|
-
import
|
|
11
|
-
__name
|
|
12
|
-
} from "./_browser-chunks/chunk-JFJ5UJ7Q.js";
|
|
9
|
+
} from "./_browser-chunks/chunk-3FKQRDK3.js";
|
|
10
|
+
import "./_browser-chunks/chunk-4BE7D4DS.js";
|
|
13
11
|
|
|
14
12
|
// src/manager.tsx
|
|
15
13
|
import React9 from "react";
|
|
@@ -342,8 +340,7 @@ var axeRuleMapping_wcag_2_0_a_aa = {
|
|
|
342
340
|
axeSummary: "Ensure <video> elements have captions",
|
|
343
341
|
friendlySummary: "Provide captions for all <video> content."
|
|
344
342
|
}
|
|
345
|
-
}
|
|
346
|
-
var axeRuleMapping_wcag_2_1_a_aa = {
|
|
343
|
+
}, axeRuleMapping_wcag_2_1_a_aa = {
|
|
347
344
|
"autocomplete-valid": {
|
|
348
345
|
title: "autocomplete attribute valid",
|
|
349
346
|
axeSummary: "Ensure the autocomplete attribute is correct and suitable for the form field",
|
|
@@ -354,15 +351,13 @@ var axeRuleMapping_wcag_2_1_a_aa = {
|
|
|
354
351
|
axeSummary: "Ensure that text spacing set via inline styles can be adjusted with custom CSS",
|
|
355
352
|
friendlySummary: "Don't lock in text spacing with forced (!important) inline styles\u2014allow user CSS to adjust text spacing."
|
|
356
353
|
}
|
|
357
|
-
}
|
|
358
|
-
var axeRuleMapping_wcag_2_2_a_aa = {
|
|
354
|
+
}, axeRuleMapping_wcag_2_2_a_aa = {
|
|
359
355
|
"target-size": {
|
|
360
356
|
title: "Touch target size",
|
|
361
357
|
axeSummary: "Ensure touch targets have sufficient size and space",
|
|
362
358
|
friendlySummary: "Make sure interactive elements are big enough and not too close together for touch."
|
|
363
359
|
}
|
|
364
|
-
}
|
|
365
|
-
var axeRuleMapping_best_practices = {
|
|
360
|
+
}, axeRuleMapping_best_practices = {
|
|
366
361
|
accesskeys: {
|
|
367
362
|
title: "Unique accesskey",
|
|
368
363
|
axeSummary: "Ensure every accesskey attribute value is unique",
|
|
@@ -503,8 +498,7 @@ var axeRuleMapping_best_practices = {
|
|
|
503
498
|
axeSummary: "Ensure the <caption> does not duplicate the summary attribute text",
|
|
504
499
|
friendlySummary: "Don't use the same text in both a table's <caption> and its summary attribute."
|
|
505
500
|
}
|
|
506
|
-
}
|
|
507
|
-
var axeRuleMapping_wcag_2_x_aaa = {
|
|
501
|
+
}, axeRuleMapping_wcag_2_x_aaa = {
|
|
508
502
|
"color-contrast-enhanced": {
|
|
509
503
|
title: "Enhanced color contrast",
|
|
510
504
|
axeSummary: "Ensure contrast between text and background meets WCAG 2 AAA enhanced contrast thresholds",
|
|
@@ -520,8 +514,7 @@ var axeRuleMapping_wcag_2_x_aaa = {
|
|
|
520
514
|
axeSummary: 'Ensure <meta http-equiv="refresh"> is not used for delayed refresh (no exceptions)',
|
|
521
515
|
friendlySummary: `Don't auto-refresh or redirect pages using <meta http-equiv="refresh"> even with a delay.`
|
|
522
516
|
}
|
|
523
|
-
}
|
|
524
|
-
var axeRuleMapping_experimental = {
|
|
517
|
+
}, axeRuleMapping_experimental = {
|
|
525
518
|
"css-orientation-lock": {
|
|
526
519
|
title: "CSS orientation lock",
|
|
527
520
|
axeSummary: "Ensure content is not locked to a specific display orientation (works in all orientations)",
|
|
@@ -557,15 +550,13 @@ var axeRuleMapping_experimental = {
|
|
|
557
550
|
axeSummary: "Ensure each non-empty data cell in large tables (3\xD73+) has one or more headers",
|
|
558
551
|
friendlySummary: "Every data cell in large tables should be associated with at least one header cell."
|
|
559
552
|
}
|
|
560
|
-
}
|
|
561
|
-
var axeRuleMapping_deprecated = {
|
|
553
|
+
}, axeRuleMapping_deprecated = {
|
|
562
554
|
"aria-roledescription": {
|
|
563
555
|
title: "aria-roledescription",
|
|
564
556
|
axeSummary: "Ensure aria-roledescription is only used on elements with an implicit or explicit role",
|
|
565
557
|
friendlySummary: "Only use aria-roledescription on elements that already have a defined role."
|
|
566
558
|
}
|
|
567
|
-
}
|
|
568
|
-
var combinedRulesMap = {
|
|
559
|
+
}, combinedRulesMap = {
|
|
569
560
|
...axeRuleMapping_wcag_2_0_a_aa,
|
|
570
561
|
...axeRuleMapping_wcag_2_1_a_aa,
|
|
571
562
|
...axeRuleMapping_wcag_2_2_a_aa,
|
|
@@ -576,202 +567,142 @@ var combinedRulesMap = {
|
|
|
576
567
|
};
|
|
577
568
|
|
|
578
569
|
// src/axeRuleMappingHelper.ts
|
|
579
|
-
var getTitleForAxeResult =
|
|
580
|
-
var getFriendlySummaryForAxeResult = /* @__PURE__ */ __name((axeResult) => combinedRulesMap[axeResult.id]?.friendlySummary || axeResult.description, "getFriendlySummaryForAxeResult");
|
|
570
|
+
var getTitleForAxeResult = (axeResult) => combinedRulesMap[axeResult.id]?.title || axeResult.id, getFriendlySummaryForAxeResult = (axeResult) => combinedRulesMap[axeResult.id]?.friendlySummary || axeResult.description;
|
|
581
571
|
|
|
582
572
|
// src/components/A11yContext.tsx
|
|
583
|
-
var unhighlightedSelectors = ["html", "body", "main"]
|
|
584
|
-
var theme = convert(themes.light);
|
|
585
|
-
var colorsByType = {
|
|
573
|
+
var unhighlightedSelectors = ["html", "body", "main"], theme = convert(themes.light), colorsByType = {
|
|
586
574
|
[RuleType.VIOLATION]: theme.color.negative,
|
|
587
575
|
[RuleType.PASS]: theme.color.positive,
|
|
588
576
|
[RuleType.INCOMPLETION]: theme.color.warning
|
|
589
|
-
}
|
|
590
|
-
var A11yContext = createContext({
|
|
577
|
+
}, A11yContext = createContext({
|
|
591
578
|
parameters: {},
|
|
592
579
|
results: void 0,
|
|
593
|
-
highlighted:
|
|
594
|
-
toggleHighlight:
|
|
595
|
-
},
|
|
580
|
+
highlighted: !1,
|
|
581
|
+
toggleHighlight: () => {
|
|
582
|
+
},
|
|
596
583
|
tab: RuleType.VIOLATION,
|
|
597
|
-
handleCopyLink:
|
|
598
|
-
},
|
|
599
|
-
setTab:
|
|
600
|
-
},
|
|
601
|
-
setStatus:
|
|
602
|
-
},
|
|
584
|
+
handleCopyLink: () => {
|
|
585
|
+
},
|
|
586
|
+
setTab: () => {
|
|
587
|
+
},
|
|
588
|
+
setStatus: () => {
|
|
589
|
+
},
|
|
603
590
|
status: "initial",
|
|
604
591
|
error: void 0,
|
|
605
|
-
handleManual:
|
|
606
|
-
},
|
|
592
|
+
handleManual: () => {
|
|
593
|
+
},
|
|
607
594
|
discrepancy: null,
|
|
608
595
|
selectedItems: /* @__PURE__ */ new Map(),
|
|
609
|
-
allExpanded:
|
|
610
|
-
toggleOpen:
|
|
611
|
-
},
|
|
612
|
-
handleCollapseAll:
|
|
613
|
-
},
|
|
614
|
-
handleExpandAll:
|
|
615
|
-
},
|
|
616
|
-
handleJumpToElement:
|
|
617
|
-
},
|
|
618
|
-
handleSelectionChange:
|
|
619
|
-
}
|
|
620
|
-
})
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
const getInitialStatus = useCallback((manual2 = false) => manual2 ? "manual" : "initial", []);
|
|
626
|
-
const manual = useMemo(() => globals?.a11y?.manual ?? false, [globals?.a11y?.manual]);
|
|
627
|
-
const a11ySelection = useMemo(() => {
|
|
628
|
-
const value = api.getQueryParam("a11ySelection");
|
|
629
|
-
if (value) {
|
|
630
|
-
api.setQueryParams({ a11ySelection: "" });
|
|
631
|
-
}
|
|
632
|
-
return value;
|
|
633
|
-
}, [api]);
|
|
634
|
-
const [state, setState] = useAddonState(ADDON_ID, {
|
|
596
|
+
allExpanded: !1,
|
|
597
|
+
toggleOpen: () => {
|
|
598
|
+
},
|
|
599
|
+
handleCollapseAll: () => {
|
|
600
|
+
},
|
|
601
|
+
handleExpandAll: () => {
|
|
602
|
+
},
|
|
603
|
+
handleJumpToElement: () => {
|
|
604
|
+
},
|
|
605
|
+
handleSelectionChange: () => {
|
|
606
|
+
}
|
|
607
|
+
}), A11yContextProvider = (props) => {
|
|
608
|
+
let parameters = useParameter("a11y", {}), [globals] = useGlobals() ?? [], api = useStorybookApi(), getInitialStatus = useCallback((manual2 = !1) => manual2 ? "manual" : "initial", []), manual = useMemo(() => globals?.a11y?.manual ?? !1, [globals?.a11y?.manual]), a11ySelection = useMemo(() => {
|
|
609
|
+
let value = api.getQueryParam("a11ySelection");
|
|
610
|
+
return value && api.setQueryParams({ a11ySelection: "" }), value;
|
|
611
|
+
}, [api]), [state, setState] = useAddonState(ADDON_ID, {
|
|
635
612
|
ui: {
|
|
636
|
-
highlighted:
|
|
613
|
+
highlighted: !1,
|
|
637
614
|
tab: RuleType.VIOLATION
|
|
638
615
|
},
|
|
639
616
|
results: void 0,
|
|
640
617
|
error: void 0,
|
|
641
618
|
status: getInitialStatus(manual)
|
|
642
|
-
})
|
|
643
|
-
const { ui, results, error, status } = state;
|
|
644
|
-
const { storyId } = useStorybookState();
|
|
645
|
-
const currentStoryA11yStatusValue = experimental_useStatusStore(
|
|
619
|
+
}), { ui, results, error, status } = state, { storyId } = useStorybookState(), currentStoryA11yStatusValue = experimental_useStatusStore(
|
|
646
620
|
(allStatuses) => allStatuses[storyId]?.[STATUS_TYPE_ID_A11Y]?.value
|
|
647
621
|
);
|
|
648
|
-
useEffect(() =>
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
);
|
|
658
|
-
return unsubscribe;
|
|
659
|
-
}, [setState, storyId]);
|
|
660
|
-
const handleToggleHighlight = useCallback(() => {
|
|
622
|
+
useEffect(() => experimental_getStatusStore("storybook/component-test").onAllStatusChange(
|
|
623
|
+
(statuses, previousStatuses) => {
|
|
624
|
+
let current = statuses[storyId]?.[STATUS_TYPE_ID_COMPONENT_TEST], previous = previousStatuses[storyId]?.[STATUS_TYPE_ID_COMPONENT_TEST];
|
|
625
|
+
current?.value === "status-value:error" && previous?.value !== "status-value:error" && setState((prev) => ({ ...prev, status: "component-test-error" }));
|
|
626
|
+
}
|
|
627
|
+
), [setState, storyId]);
|
|
628
|
+
let handleToggleHighlight = useCallback(() => {
|
|
661
629
|
setState((prev) => ({ ...prev, ui: { ...prev.ui, highlighted: !prev.ui.highlighted } }));
|
|
662
|
-
}, [setState])
|
|
663
|
-
|
|
664
|
-
const initialValue = /* @__PURE__ */ new Map();
|
|
630
|
+
}, [setState]), [selectedItems, setSelectedItems] = useState(() => {
|
|
631
|
+
let initialValue = /* @__PURE__ */ new Map();
|
|
665
632
|
if (a11ySelection && /^[a-z]+.[a-z-]+.[0-9]+$/.test(a11ySelection)) {
|
|
666
|
-
|
|
633
|
+
let [type, id] = a11ySelection.split(".");
|
|
667
634
|
initialValue.set(`${type}.${id}`, a11ySelection);
|
|
668
635
|
}
|
|
669
636
|
return initialValue;
|
|
670
|
-
})
|
|
671
|
-
const allExpanded = useMemo(() => {
|
|
672
|
-
const currentResults = results?.[ui.tab];
|
|
673
|
-
return currentResults?.every((result) => selectedItems.has(`${ui.tab}.${result.id}`)) ?? false;
|
|
674
|
-
}, [results, selectedItems, ui.tab]);
|
|
675
|
-
const toggleOpen = useCallback(
|
|
637
|
+
}), allExpanded = useMemo(() => results?.[ui.tab]?.every((result) => selectedItems.has(`${ui.tab}.${result.id}`)) ?? !1, [results, selectedItems, ui.tab]), toggleOpen = useCallback(
|
|
676
638
|
(event, type, item) => {
|
|
677
639
|
event.stopPropagation();
|
|
678
|
-
|
|
640
|
+
let key = `${type}.${item.id}`;
|
|
679
641
|
setSelectedItems((prev) => new Map(prev.delete(key) ? prev : prev.set(key, `${key}.1`)));
|
|
680
642
|
},
|
|
681
643
|
[]
|
|
682
|
-
)
|
|
683
|
-
const handleCollapseAll = useCallback(() => {
|
|
644
|
+
), handleCollapseAll = useCallback(() => {
|
|
684
645
|
setSelectedItems(/* @__PURE__ */ new Map());
|
|
685
|
-
}, [])
|
|
686
|
-
const handleExpandAll = useCallback(() => {
|
|
646
|
+
}, []), handleExpandAll = useCallback(() => {
|
|
687
647
|
setSelectedItems(
|
|
688
648
|
(prev) => new Map(
|
|
689
649
|
results?.[ui.tab]?.map((result) => {
|
|
690
|
-
|
|
650
|
+
let key = `${ui.tab}.${result.id}`;
|
|
691
651
|
return [key, prev.get(key) ?? `${key}.1`];
|
|
692
652
|
}) ?? []
|
|
693
653
|
)
|
|
694
654
|
);
|
|
695
|
-
}, [results, ui.tab])
|
|
696
|
-
|
|
697
|
-
const [type, id] = key.split(".");
|
|
655
|
+
}, [results, ui.tab]), handleSelectionChange = useCallback((key) => {
|
|
656
|
+
let [type, id] = key.split(".");
|
|
698
657
|
setSelectedItems((prev) => new Map(prev.set(`${type}.${id}`, key)));
|
|
699
|
-
}, [])
|
|
700
|
-
const handleError = useCallback(
|
|
658
|
+
}, []), handleError = useCallback(
|
|
701
659
|
(err) => {
|
|
702
660
|
setState((prev) => ({ ...prev, status: "error", error: err }));
|
|
703
661
|
},
|
|
704
662
|
[setState]
|
|
705
|
-
)
|
|
706
|
-
const handleResult = useCallback(
|
|
663
|
+
), handleResult = useCallback(
|
|
707
664
|
(axeResults, id) => {
|
|
708
|
-
|
|
709
|
-
setState((prev) =>
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
setSelectedItems((prev) => {
|
|
718
|
-
if (prev.size === 1) {
|
|
719
|
-
const [key] = prev.values();
|
|
720
|
-
document.getElementById(key)?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
721
|
-
}
|
|
722
|
-
return prev;
|
|
723
|
-
});
|
|
724
|
-
}, 900);
|
|
725
|
-
}
|
|
665
|
+
storyId === id && (setState((prev) => ({ ...prev, status: "ran", results: axeResults })), setTimeout(() => {
|
|
666
|
+
setState((prev) => prev.status === "ran" ? { ...prev, status: "ready" } : prev), setSelectedItems((prev) => {
|
|
667
|
+
if (prev.size === 1) {
|
|
668
|
+
let [key] = prev.values();
|
|
669
|
+
document.getElementById(key)?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
670
|
+
}
|
|
671
|
+
return prev;
|
|
672
|
+
});
|
|
673
|
+
}, 900));
|
|
726
674
|
},
|
|
727
675
|
[storyId, setState, setSelectedItems]
|
|
728
|
-
)
|
|
729
|
-
const handleSelect = useCallback(
|
|
676
|
+
), handleSelect = useCallback(
|
|
730
677
|
(itemId, details) => {
|
|
731
|
-
|
|
732
|
-
const { helpUrl, nodes } = results?.[type]?.find((r) => r.id === id) || {};
|
|
733
|
-
const openedWindow = helpUrl && window.open(helpUrl, "_blank", "noopener,noreferrer");
|
|
678
|
+
let [type, id] = itemId.split("."), { helpUrl, nodes } = results?.[type]?.find((r) => r.id === id) || {}, openedWindow = helpUrl && window.open(helpUrl, "_blank", "noopener,noreferrer");
|
|
734
679
|
if (nodes && !openedWindow) {
|
|
735
|
-
|
|
680
|
+
let index = nodes.findIndex((n) => details.selectors.some((s) => s === String(n.target))) ?? -1;
|
|
736
681
|
if (index !== -1) {
|
|
737
|
-
|
|
738
|
-
setSelectedItems(/* @__PURE__ */ new Map([[`${type}.${id}`, key]]))
|
|
739
|
-
setTimeout(() => {
|
|
682
|
+
let key = `${type}.${id}.${index + 1}`;
|
|
683
|
+
setSelectedItems(/* @__PURE__ */ new Map([[`${type}.${id}`, key]])), setTimeout(() => {
|
|
740
684
|
document.getElementById(key)?.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
741
685
|
}, 100);
|
|
742
686
|
}
|
|
743
687
|
}
|
|
744
688
|
},
|
|
745
689
|
[results]
|
|
746
|
-
)
|
|
747
|
-
const handleReport = useCallback(
|
|
690
|
+
), handleReport = useCallback(
|
|
748
691
|
({ reporters }) => {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
if ("error" in a11yReport.result) {
|
|
752
|
-
handleError(a11yReport.result.error);
|
|
753
|
-
} else {
|
|
754
|
-
handleResult(a11yReport.result, storyId);
|
|
755
|
-
}
|
|
756
|
-
}
|
|
692
|
+
let a11yReport = reporters.find((r) => r.type === "a11y");
|
|
693
|
+
a11yReport && ("error" in a11yReport.result ? handleError(a11yReport.result.error) : handleResult(a11yReport.result, storyId));
|
|
757
694
|
},
|
|
758
695
|
[handleError, handleResult, storyId]
|
|
759
|
-
)
|
|
760
|
-
const handleReset = useCallback(
|
|
696
|
+
), handleReset = useCallback(
|
|
761
697
|
({ newPhase }) => {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}));
|
|
768
|
-
} else if (newPhase === "afterEach" && !manual) {
|
|
769
|
-
setState((prev) => ({ ...prev, status: "running" }));
|
|
770
|
-
}
|
|
698
|
+
newPhase === "loading" ? setState((prev) => ({
|
|
699
|
+
...prev,
|
|
700
|
+
results: void 0,
|
|
701
|
+
status: manual ? "manual" : "initial"
|
|
702
|
+
})) : newPhase === "afterEach" && !manual && setState((prev) => ({ ...prev, status: "running" }));
|
|
771
703
|
},
|
|
772
704
|
[manual, setState]
|
|
773
|
-
)
|
|
774
|
-
const emit = useChannel(
|
|
705
|
+
), emit = useChannel(
|
|
775
706
|
{
|
|
776
707
|
[EVENTS.RESULT]: handleResult,
|
|
777
708
|
[EVENTS.ERROR]: handleError,
|
|
@@ -780,143 +711,117 @@ var A11yContextProvider = /* @__PURE__ */ __name((props) => {
|
|
|
780
711
|
[STORY_RENDER_PHASE_CHANGED]: handleReset,
|
|
781
712
|
[STORY_FINISHED]: handleReport,
|
|
782
713
|
[STORY_HOT_UPDATED]: () => {
|
|
783
|
-
setState((prev) => ({ ...prev, status: "running" }));
|
|
784
|
-
emit(EVENTS.MANUAL, storyId, parameters);
|
|
714
|
+
setState((prev) => ({ ...prev, status: "running" })), emit(EVENTS.MANUAL, storyId, parameters);
|
|
785
715
|
}
|
|
786
716
|
},
|
|
787
717
|
[handleReset, handleReport, handleSelect, handleError, handleResult, parameters, storyId]
|
|
788
|
-
)
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}, [emit, parameters, setState, storyId]);
|
|
793
|
-
const handleCopyLink = useCallback(async (linkPath) => {
|
|
794
|
-
const { createCopyToClipboardFunction } = await import("storybook/internal/components");
|
|
718
|
+
), handleManual = useCallback(() => {
|
|
719
|
+
setState((prev) => ({ ...prev, status: "running" })), emit(EVENTS.MANUAL, storyId, parameters);
|
|
720
|
+
}, [emit, parameters, setState, storyId]), handleCopyLink = useCallback(async (linkPath) => {
|
|
721
|
+
let { createCopyToClipboardFunction } = await import("storybook/internal/components");
|
|
795
722
|
await createCopyToClipboardFunction()(`${window.location.origin}${linkPath}`);
|
|
796
|
-
}, [])
|
|
797
|
-
const handleJumpToElement = useCallback(
|
|
723
|
+
}, []), handleJumpToElement = useCallback(
|
|
798
724
|
(target) => emit(SCROLL_INTO_VIEW, target),
|
|
799
725
|
[emit]
|
|
800
726
|
);
|
|
801
727
|
useEffect(() => {
|
|
802
728
|
setState((prev) => ({ ...prev, status: getInitialStatus(manual) }));
|
|
803
729
|
}, [getInitialStatus, manual, setState]);
|
|
804
|
-
|
|
730
|
+
let isInitial = status === "initial";
|
|
805
731
|
useEffect(() => {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
setState((prev) => {
|
|
810
|
-
const update = { ...prev.ui, highlighted: true };
|
|
811
|
-
const [type] = a11ySelection.split(".") ?? [];
|
|
812
|
-
if (type && Object.values(RuleType).includes(type)) {
|
|
813
|
-
update.tab = type;
|
|
814
|
-
}
|
|
815
|
-
return { ...prev, ui: update };
|
|
732
|
+
a11ySelection && setState((prev) => {
|
|
733
|
+
let update = { ...prev.ui, highlighted: !0 }, [type] = a11ySelection.split(".") ?? [];
|
|
734
|
+
return type && Object.values(RuleType).includes(type) && (update.tab = type), { ...prev, ui: update };
|
|
816
735
|
});
|
|
817
|
-
}, [a11ySelection])
|
|
818
|
-
|
|
819
|
-
emit(REMOVE_HIGHLIGHT, `${ADDON_ID}/selected`);
|
|
820
|
-
emit(REMOVE_HIGHLIGHT, `${ADDON_ID}/others`);
|
|
821
|
-
if (!ui.highlighted || isInitial) {
|
|
736
|
+
}, [a11ySelection]), useEffect(() => {
|
|
737
|
+
if (emit(REMOVE_HIGHLIGHT, `${ADDON_ID}/selected`), emit(REMOVE_HIGHLIGHT, `${ADDON_ID}/others`), !ui.highlighted || isInitial)
|
|
822
738
|
return;
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
if (type !== ui.tab) {
|
|
739
|
+
let selected = Array.from(selectedItems.values()).flatMap((key) => {
|
|
740
|
+
let [type, id, number] = key.split(".");
|
|
741
|
+
if (type !== ui.tab)
|
|
827
742
|
return [];
|
|
828
|
-
|
|
829
|
-
const result = results?.[type]?.find((r) => r.id === id);
|
|
830
|
-
const target = result?.nodes[Number(number) - 1]?.target;
|
|
743
|
+
let target = results?.[type]?.find((r) => r.id === id)?.nodes[Number(number) - 1]?.target;
|
|
831
744
|
return target ? [String(target)] : [];
|
|
832
745
|
});
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
{
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
{
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
];
|
|
902
|
-
})
|
|
903
|
-
});
|
|
904
|
-
}
|
|
746
|
+
selected.length && emit(HIGHLIGHT, {
|
|
747
|
+
id: `${ADDON_ID}/selected`,
|
|
748
|
+
priority: 1,
|
|
749
|
+
selectors: selected,
|
|
750
|
+
styles: {
|
|
751
|
+
outline: `1px solid color-mix(in srgb, ${colorsByType[ui.tab]}, transparent 30%)`,
|
|
752
|
+
backgroundColor: "transparent"
|
|
753
|
+
},
|
|
754
|
+
hoverStyles: {
|
|
755
|
+
outlineWidth: "2px"
|
|
756
|
+
},
|
|
757
|
+
focusStyles: {
|
|
758
|
+
backgroundColor: "transparent"
|
|
759
|
+
},
|
|
760
|
+
menu: results?.[ui.tab].map((result) => {
|
|
761
|
+
let selectors = result.nodes.flatMap((n) => n.target).map(String).filter((e) => selected.includes(e));
|
|
762
|
+
return [
|
|
763
|
+
{
|
|
764
|
+
id: `${ui.tab}.${result.id}:info`,
|
|
765
|
+
title: getTitleForAxeResult(result),
|
|
766
|
+
description: getFriendlySummaryForAxeResult(result),
|
|
767
|
+
selectors
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
id: `${ui.tab}.${result.id}`,
|
|
771
|
+
iconLeft: "info",
|
|
772
|
+
iconRight: "shareAlt",
|
|
773
|
+
title: "Learn how to resolve this violation",
|
|
774
|
+
clickEvent: EVENTS.SELECT,
|
|
775
|
+
selectors
|
|
776
|
+
}
|
|
777
|
+
];
|
|
778
|
+
})
|
|
779
|
+
});
|
|
780
|
+
let others = results?.[ui.tab].flatMap((r) => r.nodes.flatMap((n) => n.target).map(String)).filter((e) => ![...unhighlightedSelectors, ...selected].includes(e));
|
|
781
|
+
others?.length && emit(HIGHLIGHT, {
|
|
782
|
+
id: `${ADDON_ID}/others`,
|
|
783
|
+
selectors: others,
|
|
784
|
+
styles: {
|
|
785
|
+
outline: `1px solid color-mix(in srgb, ${colorsByType[ui.tab]}, transparent 30%)`,
|
|
786
|
+
backgroundColor: `color-mix(in srgb, ${colorsByType[ui.tab]}, transparent 60%)`
|
|
787
|
+
},
|
|
788
|
+
hoverStyles: {
|
|
789
|
+
outlineWidth: "2px"
|
|
790
|
+
},
|
|
791
|
+
focusStyles: {
|
|
792
|
+
backgroundColor: "transparent"
|
|
793
|
+
},
|
|
794
|
+
menu: results?.[ui.tab].map((result) => {
|
|
795
|
+
let selectors = result.nodes.flatMap((n) => n.target).map(String).filter((e) => !selected.includes(e));
|
|
796
|
+
return [
|
|
797
|
+
{
|
|
798
|
+
id: `${ui.tab}.${result.id}:info`,
|
|
799
|
+
title: getTitleForAxeResult(result),
|
|
800
|
+
description: getFriendlySummaryForAxeResult(result),
|
|
801
|
+
selectors
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
id: `${ui.tab}.${result.id}`,
|
|
805
|
+
iconLeft: "info",
|
|
806
|
+
iconRight: "shareAlt",
|
|
807
|
+
title: "Learn how to resolve this violation",
|
|
808
|
+
clickEvent: EVENTS.SELECT,
|
|
809
|
+
selectors
|
|
810
|
+
}
|
|
811
|
+
];
|
|
812
|
+
})
|
|
813
|
+
});
|
|
905
814
|
}, [isInitial, emit, ui.highlighted, results, ui.tab, selectedItems]);
|
|
906
|
-
|
|
907
|
-
if (!currentStoryA11yStatusValue)
|
|
815
|
+
let discrepancy = useMemo(() => {
|
|
816
|
+
if (!currentStoryA11yStatusValue)
|
|
908
817
|
return null;
|
|
909
|
-
|
|
910
|
-
if (currentStoryA11yStatusValue === "status-value:success" && results?.violations.length) {
|
|
818
|
+
if (currentStoryA11yStatusValue === "status-value:success" && results?.violations.length)
|
|
911
819
|
return "cliPassedBrowserFailed";
|
|
912
|
-
}
|
|
913
820
|
if (currentStoryA11yStatusValue === "status-value:error" && !results?.violations.length) {
|
|
914
|
-
if (status === "ready" || status === "ran")
|
|
821
|
+
if (status === "ready" || status === "ran")
|
|
915
822
|
return "browserPassedCliFailed";
|
|
916
|
-
|
|
917
|
-
if (status === "manual") {
|
|
823
|
+
if (status === "manual")
|
|
918
824
|
return "cliFailedButModeManual";
|
|
919
|
-
}
|
|
920
825
|
}
|
|
921
826
|
return null;
|
|
922
827
|
}, [results?.violations.length, status, currentStoryA11yStatusValue]);
|
|
@@ -953,8 +858,7 @@ var A11yContextProvider = /* @__PURE__ */ __name((props) => {
|
|
|
953
858
|
...props
|
|
954
859
|
}
|
|
955
860
|
);
|
|
956
|
-
},
|
|
957
|
-
var useA11yContext = /* @__PURE__ */ __name(() => useContext(A11yContext), "useA11yContext");
|
|
861
|
+
}, useA11yContext = () => useContext(A11yContext);
|
|
958
862
|
|
|
959
863
|
// src/components/Report/Report.tsx
|
|
960
864
|
import React3 from "react";
|
|
@@ -977,35 +881,29 @@ function _extends() {
|
|
|
977
881
|
return n;
|
|
978
882
|
}, _extends.apply(null, arguments);
|
|
979
883
|
}
|
|
980
|
-
__name(_extends, "_extends");
|
|
981
884
|
|
|
982
885
|
// ../../node_modules/@radix-ui/react-tabs/dist/index.mjs
|
|
983
886
|
import { forwardRef as $1IHzk$forwardRef, createElement as $1IHzk$createElement, useRef as $1IHzk$useRef, useEffect as $1IHzk$useEffect } from "react";
|
|
984
887
|
|
|
985
888
|
// ../../node_modules/@radix-ui/primitive/dist/index.mjs
|
|
986
|
-
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented =
|
|
987
|
-
return
|
|
988
|
-
originalEventHandler ===
|
|
989
|
-
|
|
990
|
-
}, "handleEvent");
|
|
889
|
+
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = !0 } = {}) {
|
|
890
|
+
return function(event) {
|
|
891
|
+
if (originalEventHandler?.(event), checkForDefaultPrevented === !1 || !event.defaultPrevented) return ourEventHandler?.(event);
|
|
892
|
+
};
|
|
991
893
|
}
|
|
992
|
-
__name($e42e1063c40fb3ef$export$b9ecd428b558ff10, "$e42e1063c40fb3ef$export$b9ecd428b558ff10");
|
|
993
894
|
|
|
994
895
|
// ../../node_modules/@radix-ui/react-context/dist/index.mjs
|
|
995
896
|
import { createContext as $3bkAK$createContext, useMemo as $3bkAK$useMemo, createElement as $3bkAK$createElement, useContext as $3bkAK$useContext } from "react";
|
|
996
897
|
function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
|
|
997
898
|
let defaultContexts = [];
|
|
998
899
|
function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
999
|
-
|
|
1000
|
-
const index = defaultContexts.length;
|
|
900
|
+
let BaseContext = $3bkAK$createContext(defaultContext), index = defaultContexts.length;
|
|
1001
901
|
defaultContexts = [
|
|
1002
902
|
...defaultContexts,
|
|
1003
903
|
defaultContext
|
|
1004
904
|
];
|
|
1005
905
|
function Provider(props) {
|
|
1006
|
-
|
|
1007
|
-
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
|
|
1008
|
-
const value = $3bkAK$useMemo(
|
|
906
|
+
let { scope, children, ...context } = props, Context = scope?.[scopeName][index] || BaseContext, value = $3bkAK$useMemo(
|
|
1009
907
|
() => context,
|
|
1010
908
|
Object.values(context)
|
|
1011
909
|
);
|
|
@@ -1013,28 +911,21 @@ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeD
|
|
|
1013
911
|
value
|
|
1014
912
|
}, children);
|
|
1015
913
|
}
|
|
1016
|
-
__name(Provider, "Provider");
|
|
1017
914
|
function useContext2(consumerName, scope) {
|
|
1018
|
-
|
|
1019
|
-
const context = $3bkAK$useContext(Context);
|
|
915
|
+
let Context = scope?.[scopeName][index] || BaseContext, context = $3bkAK$useContext(Context);
|
|
1020
916
|
if (context) return context;
|
|
1021
917
|
if (defaultContext !== void 0) return defaultContext;
|
|
1022
918
|
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
1023
919
|
}
|
|
1024
|
-
|
|
1025
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
1026
|
-
return [
|
|
920
|
+
return Provider.displayName = rootComponentName + "Provider", [
|
|
1027
921
|
Provider,
|
|
1028
922
|
useContext2
|
|
1029
923
|
];
|
|
1030
924
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
});
|
|
1036
|
-
return /* @__PURE__ */ __name(function useScope(scope) {
|
|
1037
|
-
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
925
|
+
let createScope = () => {
|
|
926
|
+
let scopeContexts = defaultContexts.map((defaultContext) => $3bkAK$createContext(defaultContext));
|
|
927
|
+
return function(scope) {
|
|
928
|
+
let contexts = scope?.[scopeName] || scopeContexts;
|
|
1038
929
|
return $3bkAK$useMemo(
|
|
1039
930
|
() => ({
|
|
1040
931
|
[`__scope${scopeName}`]: {
|
|
@@ -1047,29 +938,26 @@ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeD
|
|
|
1047
938
|
contexts
|
|
1048
939
|
]
|
|
1049
940
|
);
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
createScope.scopeName = scopeName
|
|
1053
|
-
return [
|
|
941
|
+
};
|
|
942
|
+
};
|
|
943
|
+
return createScope.scopeName = scopeName, [
|
|
1054
944
|
$c512c27ab02ef895$export$fd42f52fd3ae1109,
|
|
1055
945
|
$c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
|
|
1056
946
|
];
|
|
1057
947
|
}
|
|
1058
|
-
__name($c512c27ab02ef895$export$50c7b4e9d9f19c1, "$c512c27ab02ef895$export$50c7b4e9d9f19c1");
|
|
1059
948
|
function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
|
|
1060
|
-
|
|
949
|
+
let baseScope = scopes[0];
|
|
1061
950
|
if (scopes.length === 1) return baseScope;
|
|
1062
|
-
|
|
1063
|
-
|
|
951
|
+
let createScope1 = () => {
|
|
952
|
+
let scopeHooks = scopes.map(
|
|
1064
953
|
(createScope) => ({
|
|
1065
954
|
useScope: createScope(),
|
|
1066
955
|
scopeName: createScope.scopeName
|
|
1067
956
|
})
|
|
1068
957
|
);
|
|
1069
|
-
return
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
958
|
+
return function(overrideScopes) {
|
|
959
|
+
let nextScopes1 = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => {
|
|
960
|
+
let currentScope = useScope(overrideScopes)[`__scope${scopeName}`];
|
|
1073
961
|
return {
|
|
1074
962
|
...nextScopes,
|
|
1075
963
|
...currentScope
|
|
@@ -1083,12 +971,10 @@ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
|
|
|
1083
971
|
nextScopes1
|
|
1084
972
|
]
|
|
1085
973
|
);
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
createScope1.scopeName = baseScope.scopeName;
|
|
1089
|
-
return createScope1;
|
|
974
|
+
};
|
|
975
|
+
};
|
|
976
|
+
return createScope1.scopeName = baseScope.scopeName, createScope1;
|
|
1090
977
|
}
|
|
1091
|
-
__name($c512c27ab02ef895$var$composeContextScopes, "$c512c27ab02ef895$var$composeContextScopes");
|
|
1092
978
|
|
|
1093
979
|
// ../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
1094
980
|
import { forwardRef as $98Iye$forwardRef, createElement as $98Iye$createElement, useRef as $98Iye$useRef, useState as $98Iye$useState, useEffect as $98Iye$useEffect, useCallback as $98Iye$useCallback } from "react";
|
|
@@ -1099,35 +985,23 @@ import $6vYhU$react from "react";
|
|
|
1099
985
|
// ../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs
|
|
1100
986
|
import { useCallback as $3vqmr$useCallback } from "react";
|
|
1101
987
|
function $6ed0406888f73fc4$var$setRef(ref, value) {
|
|
1102
|
-
|
|
1103
|
-
else if (ref !== null && ref !== void 0) ref.current = value;
|
|
988
|
+
typeof ref == "function" ? ref(value) : ref != null && (ref.current = value);
|
|
1104
989
|
}
|
|
1105
|
-
__name($6ed0406888f73fc4$var$setRef, "$6ed0406888f73fc4$var$setRef");
|
|
1106
990
|
function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
|
|
1107
991
|
return (node) => refs.forEach(
|
|
1108
992
|
(ref) => $6ed0406888f73fc4$var$setRef(ref, node)
|
|
1109
993
|
);
|
|
1110
994
|
}
|
|
1111
|
-
__name($6ed0406888f73fc4$export$43e446d32b3d21af, "$6ed0406888f73fc4$export$43e446d32b3d21af");
|
|
1112
995
|
function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
|
|
1113
996
|
return $3vqmr$useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
|
|
1114
997
|
}
|
|
1115
|
-
__name($6ed0406888f73fc4$export$c7b2cbe3552a0d05, "$6ed0406888f73fc4$export$c7b2cbe3552a0d05");
|
|
1116
998
|
|
|
1117
999
|
// ../../node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
1118
1000
|
import { forwardRef as $9IrjX$forwardRef, Children as $9IrjX$Children, isValidElement as $9IrjX$isValidElement, createElement as $9IrjX$createElement, cloneElement as $9IrjX$cloneElement, Fragment as $9IrjX$Fragment } from "react";
|
|
1119
1001
|
var $5e63c961fc1ce211$export$8c6ed5c666ac1360 = $9IrjX$forwardRef((props, forwardedRef) => {
|
|
1120
|
-
|
|
1121
|
-
const childrenArray = $9IrjX$Children.toArray(children);
|
|
1122
|
-
const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
|
|
1002
|
+
let { children, ...slotProps } = props, childrenArray = $9IrjX$Children.toArray(children), slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
|
|
1123
1003
|
if (slottable) {
|
|
1124
|
-
|
|
1125
|
-
const newChildren = childrenArray.map((child) => {
|
|
1126
|
-
if (child === slottable) {
|
|
1127
|
-
if ($9IrjX$Children.count(newElement) > 1) return $9IrjX$Children.only(null);
|
|
1128
|
-
return $9IrjX$isValidElement(newElement) ? newElement.props.children : null;
|
|
1129
|
-
} else return child;
|
|
1130
|
-
});
|
|
1004
|
+
let newElement = slottable.props.children, newChildren = childrenArray.map((child) => child === slottable ? $9IrjX$Children.count(newElement) > 1 ? $9IrjX$Children.only(null) : $9IrjX$isValidElement(newElement) ? newElement.props.children : null : child);
|
|
1131
1005
|
return $9IrjX$createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
|
|
1132
1006
|
ref: forwardedRef
|
|
1133
1007
|
}), $9IrjX$isValidElement(newElement) ? $9IrjX$cloneElement(newElement, void 0, newChildren) : null);
|
|
@@ -1138,79 +1012,59 @@ var $5e63c961fc1ce211$export$8c6ed5c666ac1360 = $9IrjX$forwardRef((props, forwar
|
|
|
1138
1012
|
});
|
|
1139
1013
|
$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = "Slot";
|
|
1140
1014
|
var $5e63c961fc1ce211$var$SlotClone = $9IrjX$forwardRef((props, forwardedRef) => {
|
|
1141
|
-
|
|
1142
|
-
|
|
1015
|
+
let { children, ...slotProps } = props;
|
|
1016
|
+
return $9IrjX$isValidElement(children) ? $9IrjX$cloneElement(children, {
|
|
1143
1017
|
...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
|
|
1144
1018
|
ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref
|
|
1145
|
-
});
|
|
1146
|
-
return $9IrjX$Children.count(children) > 1 ? $9IrjX$Children.only(null) : null;
|
|
1019
|
+
}) : $9IrjX$Children.count(children) > 1 ? $9IrjX$Children.only(null) : null;
|
|
1147
1020
|
});
|
|
1148
1021
|
$5e63c961fc1ce211$var$SlotClone.displayName = "SlotClone";
|
|
1149
|
-
var $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 =
|
|
1150
|
-
return $9IrjX$createElement($9IrjX$Fragment, null, children);
|
|
1151
|
-
}, "$5e63c961fc1ce211$export$d9f1ccf0bdb05d45");
|
|
1022
|
+
var $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children }) => $9IrjX$createElement($9IrjX$Fragment, null, children);
|
|
1152
1023
|
function $5e63c961fc1ce211$var$isSlottable(child) {
|
|
1153
1024
|
return $9IrjX$isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
|
|
1154
1025
|
}
|
|
1155
|
-
__name($5e63c961fc1ce211$var$isSlottable, "$5e63c961fc1ce211$var$isSlottable");
|
|
1156
1026
|
function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
|
|
1157
|
-
|
|
1027
|
+
let overrideProps = {
|
|
1158
1028
|
...childProps
|
|
1159
1029
|
};
|
|
1160
|
-
for (
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
|
|
1166
|
-
childPropValue(...args);
|
|
1167
|
-
slotPropValue(...args);
|
|
1168
|
-
};
|
|
1169
|
-
else if (slotPropValue) overrideProps[propName] = slotPropValue;
|
|
1170
|
-
} else if (propName === "style") overrideProps[propName] = {
|
|
1030
|
+
for (let propName in childProps) {
|
|
1031
|
+
let slotPropValue = slotProps[propName], childPropValue = childProps[propName];
|
|
1032
|
+
/^on[A-Z]/.test(propName) ? slotPropValue && childPropValue ? overrideProps[propName] = (...args) => {
|
|
1033
|
+
childPropValue(...args), slotPropValue(...args);
|
|
1034
|
+
} : slotPropValue && (overrideProps[propName] = slotPropValue) : propName === "style" ? overrideProps[propName] = {
|
|
1171
1035
|
...slotPropValue,
|
|
1172
1036
|
...childPropValue
|
|
1173
|
-
}
|
|
1174
|
-
else if (propName === "className") overrideProps[propName] = [
|
|
1037
|
+
} : propName === "className" && (overrideProps[propName] = [
|
|
1175
1038
|
slotPropValue,
|
|
1176
1039
|
childPropValue
|
|
1177
|
-
].filter(Boolean).join(" ");
|
|
1040
|
+
].filter(Boolean).join(" "));
|
|
1178
1041
|
}
|
|
1179
1042
|
return {
|
|
1180
1043
|
...slotProps,
|
|
1181
1044
|
...overrideProps
|
|
1182
1045
|
};
|
|
1183
1046
|
}
|
|
1184
|
-
__name($5e63c961fc1ce211$var$mergeProps, "$5e63c961fc1ce211$var$mergeProps");
|
|
1185
1047
|
|
|
1186
1048
|
// ../../node_modules/@radix-ui/react-collection/dist/index.mjs
|
|
1187
1049
|
function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
1188
|
-
|
|
1189
|
-
const [createCollectionContext, createCollectionScope] = $c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
|
|
1190
|
-
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
1050
|
+
let PROVIDER_NAME = name + "CollectionProvider", [createCollectionContext, createCollectionScope] = $c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME), [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
1191
1051
|
collectionRef: {
|
|
1192
1052
|
current: null
|
|
1193
1053
|
},
|
|
1194
1054
|
itemMap: /* @__PURE__ */ new Map()
|
|
1195
|
-
})
|
|
1196
|
-
|
|
1197
|
-
const { scope, children } = props;
|
|
1198
|
-
const ref = $6vYhU$react.useRef(null);
|
|
1199
|
-
const itemMap = $6vYhU$react.useRef(/* @__PURE__ */ new Map()).current;
|
|
1055
|
+
}), CollectionProvider = (props) => {
|
|
1056
|
+
let { scope, children } = props, ref = $6vYhU$react.useRef(null), itemMap = $6vYhU$react.useRef(/* @__PURE__ */ new Map()).current;
|
|
1200
1057
|
return $6vYhU$react.createElement(CollectionProviderImpl, {
|
|
1201
1058
|
scope,
|
|
1202
1059
|
itemMap,
|
|
1203
1060
|
collectionRef: ref
|
|
1204
1061
|
}, children);
|
|
1205
|
-
}
|
|
1062
|
+
};
|
|
1206
1063
|
Object.assign(CollectionProvider, {
|
|
1207
1064
|
displayName: PROVIDER_NAME
|
|
1208
1065
|
});
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
const { scope, children } = props;
|
|
1212
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
1213
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.collectionRef);
|
|
1066
|
+
let COLLECTION_SLOT_NAME = name + "CollectionSlot", CollectionSlot = $6vYhU$react.forwardRef((props, forwardedRef) => {
|
|
1067
|
+
let { scope, children } = props, context = useCollectionContext(COLLECTION_SLOT_NAME, scope), composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.collectionRef);
|
|
1214
1068
|
return $6vYhU$react.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
1215
1069
|
ref: composedRefs
|
|
1216
1070
|
}, children);
|
|
@@ -1218,21 +1072,12 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
1218
1072
|
Object.assign(CollectionSlot, {
|
|
1219
1073
|
displayName: COLLECTION_SLOT_NAME
|
|
1220
1074
|
});
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
1228
|
-
$6vYhU$react.useEffect(() => {
|
|
1229
|
-
context.itemMap.set(ref, {
|
|
1230
|
-
ref,
|
|
1231
|
-
...itemData
|
|
1232
|
-
});
|
|
1233
|
-
return () => void context.itemMap.delete(ref);
|
|
1234
|
-
});
|
|
1235
|
-
return $6vYhU$react.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
1075
|
+
let ITEM_SLOT_NAME = name + "CollectionItemSlot", ITEM_DATA_ATTR = "data-radix-collection-item", CollectionItemSlot = $6vYhU$react.forwardRef((props, forwardedRef) => {
|
|
1076
|
+
let { scope, children, ...itemData } = props, ref = $6vYhU$react.useRef(null), composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref), context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
1077
|
+
return $6vYhU$react.useEffect(() => (context.itemMap.set(ref, {
|
|
1078
|
+
ref,
|
|
1079
|
+
...itemData
|
|
1080
|
+
}), () => void context.itemMap.delete(ref))), $6vYhU$react.createElement($5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
1236
1081
|
[ITEM_DATA_ATTR]: "",
|
|
1237
1082
|
ref: composedRefs
|
|
1238
1083
|
}, children);
|
|
@@ -1241,23 +1086,19 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
1241
1086
|
displayName: ITEM_SLOT_NAME
|
|
1242
1087
|
});
|
|
1243
1088
|
function useCollection(scope) {
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1089
|
+
let context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
1090
|
+
return $6vYhU$react.useCallback(() => {
|
|
1091
|
+
let collectionNode = context.collectionRef.current;
|
|
1247
1092
|
if (!collectionNode) return [];
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
const orderedItems = items.sort(
|
|
1093
|
+
let orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
1094
|
+
return Array.from(context.itemMap.values()).sort(
|
|
1251
1095
|
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
1252
1096
|
);
|
|
1253
|
-
return orderedItems;
|
|
1254
1097
|
}, [
|
|
1255
1098
|
context.collectionRef,
|
|
1256
1099
|
context.itemMap
|
|
1257
1100
|
]);
|
|
1258
|
-
return getItems;
|
|
1259
1101
|
}
|
|
1260
|
-
__name(useCollection, "useCollection");
|
|
1261
1102
|
return [
|
|
1262
1103
|
{
|
|
1263
1104
|
Provider: CollectionProvider,
|
|
@@ -1268,31 +1109,28 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
1268
1109
|
createCollectionScope
|
|
1269
1110
|
];
|
|
1270
1111
|
}
|
|
1271
|
-
__name($e02a7d9cb1dc128c$export$c74125a8e3af6bb2, "$e02a7d9cb1dc128c$export$c74125a8e3af6bb2");
|
|
1272
1112
|
|
|
1273
1113
|
// ../../node_modules/@radix-ui/react-id/dist/index.mjs
|
|
1274
1114
|
import * as $2AODx$react from "react";
|
|
1275
1115
|
|
|
1276
1116
|
// ../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs
|
|
1277
1117
|
import { useLayoutEffect as $dxlwH$useLayoutEffect } from "react";
|
|
1278
|
-
var $9f79659886946c16$export$e5c5a5f917a5871c =
|
|
1118
|
+
var $9f79659886946c16$export$e5c5a5f917a5871c = globalThis?.document ? $dxlwH$useLayoutEffect : () => {
|
|
1279
1119
|
};
|
|
1280
1120
|
|
|
1281
1121
|
// ../../node_modules/@radix-ui/react-id/dist/index.mjs
|
|
1282
|
-
var $1746a345f3d73bb7$var$useReactId = $2AODx$react
|
|
1283
|
-
|
|
1122
|
+
var $1746a345f3d73bb7$var$useReactId = $2AODx$react.useId || (() => {
|
|
1123
|
+
}), $1746a345f3d73bb7$var$count = 0;
|
|
1284
1124
|
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
1285
|
-
|
|
1286
|
-
$9f79659886946c16$export$e5c5a5f917a5871c(() => {
|
|
1287
|
-
|
|
1288
|
-
(reactId) => reactId
|
|
1125
|
+
let [id, setId] = $2AODx$react.useState($1746a345f3d73bb7$var$useReactId());
|
|
1126
|
+
return $9f79659886946c16$export$e5c5a5f917a5871c(() => {
|
|
1127
|
+
deterministicId || setId(
|
|
1128
|
+
(reactId) => reactId ?? String($1746a345f3d73bb7$var$count++)
|
|
1289
1129
|
);
|
|
1290
1130
|
}, [
|
|
1291
1131
|
deterministicId
|
|
1292
|
-
]);
|
|
1293
|
-
return deterministicId || (id ? `radix-${id}` : "");
|
|
1132
|
+
]), deterministicId || (id ? `radix-${id}` : "");
|
|
1294
1133
|
}
|
|
1295
|
-
__name($1746a345f3d73bb7$export$f680877a34711e37, "$1746a345f3d73bb7$export$f680877a34711e37");
|
|
1296
1134
|
|
|
1297
1135
|
// ../../node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
1298
1136
|
import { forwardRef as $4q5Fq$forwardRef, useEffect as $4q5Fq$useEffect, createElement as $4q5Fq$createElement } from "react";
|
|
@@ -1301,17 +1139,9 @@ import { flushSync as $4q5Fq$flushSync } from "react-dom";
|
|
|
1301
1139
|
// ../../node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
1302
1140
|
import { forwardRef as $9IrjX$forwardRef2, Children as $9IrjX$Children2, isValidElement as $9IrjX$isValidElement2, createElement as $9IrjX$createElement2, cloneElement as $9IrjX$cloneElement2, Fragment as $9IrjX$Fragment2 } from "react";
|
|
1303
1141
|
var $5e63c961fc1ce211$export$8c6ed5c666ac13602 = $9IrjX$forwardRef2((props, forwardedRef) => {
|
|
1304
|
-
|
|
1305
|
-
const childrenArray = $9IrjX$Children2.toArray(children);
|
|
1306
|
-
const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable2);
|
|
1142
|
+
let { children, ...slotProps } = props, childrenArray = $9IrjX$Children2.toArray(children), slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable2);
|
|
1307
1143
|
if (slottable) {
|
|
1308
|
-
|
|
1309
|
-
const newChildren = childrenArray.map((child) => {
|
|
1310
|
-
if (child === slottable) {
|
|
1311
|
-
if ($9IrjX$Children2.count(newElement) > 1) return $9IrjX$Children2.only(null);
|
|
1312
|
-
return $9IrjX$isValidElement2(newElement) ? newElement.props.children : null;
|
|
1313
|
-
} else return child;
|
|
1314
|
-
});
|
|
1144
|
+
let newElement = slottable.props.children, newChildren = childrenArray.map((child) => child === slottable ? $9IrjX$Children2.count(newElement) > 1 ? $9IrjX$Children2.only(null) : $9IrjX$isValidElement2(newElement) ? newElement.props.children : null : child);
|
|
1315
1145
|
return $9IrjX$createElement2($5e63c961fc1ce211$var$SlotClone2, _extends({}, slotProps, {
|
|
1316
1146
|
ref: forwardedRef
|
|
1317
1147
|
}), $9IrjX$isValidElement2(newElement) ? $9IrjX$cloneElement2(newElement, void 0, newChildren) : null);
|
|
@@ -1322,50 +1152,38 @@ var $5e63c961fc1ce211$export$8c6ed5c666ac13602 = $9IrjX$forwardRef2((props, forw
|
|
|
1322
1152
|
});
|
|
1323
1153
|
$5e63c961fc1ce211$export$8c6ed5c666ac13602.displayName = "Slot";
|
|
1324
1154
|
var $5e63c961fc1ce211$var$SlotClone2 = $9IrjX$forwardRef2((props, forwardedRef) => {
|
|
1325
|
-
|
|
1326
|
-
|
|
1155
|
+
let { children, ...slotProps } = props;
|
|
1156
|
+
return $9IrjX$isValidElement2(children) ? $9IrjX$cloneElement2(children, {
|
|
1327
1157
|
...$5e63c961fc1ce211$var$mergeProps2(slotProps, children.props),
|
|
1328
1158
|
ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref
|
|
1329
|
-
});
|
|
1330
|
-
return $9IrjX$Children2.count(children) > 1 ? $9IrjX$Children2.only(null) : null;
|
|
1159
|
+
}) : $9IrjX$Children2.count(children) > 1 ? $9IrjX$Children2.only(null) : null;
|
|
1331
1160
|
});
|
|
1332
1161
|
$5e63c961fc1ce211$var$SlotClone2.displayName = "SlotClone";
|
|
1333
|
-
var $5e63c961fc1ce211$export$d9f1ccf0bdb05d452 =
|
|
1334
|
-
return $9IrjX$createElement2($9IrjX$Fragment2, null, children);
|
|
1335
|
-
}, "$5e63c961fc1ce211$export$d9f1ccf0bdb05d45");
|
|
1162
|
+
var $5e63c961fc1ce211$export$d9f1ccf0bdb05d452 = ({ children }) => $9IrjX$createElement2($9IrjX$Fragment2, null, children);
|
|
1336
1163
|
function $5e63c961fc1ce211$var$isSlottable2(child) {
|
|
1337
1164
|
return $9IrjX$isValidElement2(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d452;
|
|
1338
1165
|
}
|
|
1339
|
-
__name($5e63c961fc1ce211$var$isSlottable2, "$5e63c961fc1ce211$var$isSlottable");
|
|
1340
1166
|
function $5e63c961fc1ce211$var$mergeProps2(slotProps, childProps) {
|
|
1341
|
-
|
|
1167
|
+
let overrideProps = {
|
|
1342
1168
|
...childProps
|
|
1343
1169
|
};
|
|
1344
|
-
for (
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
|
|
1350
|
-
childPropValue(...args);
|
|
1351
|
-
slotPropValue(...args);
|
|
1352
|
-
};
|
|
1353
|
-
else if (slotPropValue) overrideProps[propName] = slotPropValue;
|
|
1354
|
-
} else if (propName === "style") overrideProps[propName] = {
|
|
1170
|
+
for (let propName in childProps) {
|
|
1171
|
+
let slotPropValue = slotProps[propName], childPropValue = childProps[propName];
|
|
1172
|
+
/^on[A-Z]/.test(propName) ? slotPropValue && childPropValue ? overrideProps[propName] = (...args) => {
|
|
1173
|
+
childPropValue(...args), slotPropValue(...args);
|
|
1174
|
+
} : slotPropValue && (overrideProps[propName] = slotPropValue) : propName === "style" ? overrideProps[propName] = {
|
|
1355
1175
|
...slotPropValue,
|
|
1356
1176
|
...childPropValue
|
|
1357
|
-
}
|
|
1358
|
-
else if (propName === "className") overrideProps[propName] = [
|
|
1177
|
+
} : propName === "className" && (overrideProps[propName] = [
|
|
1359
1178
|
slotPropValue,
|
|
1360
1179
|
childPropValue
|
|
1361
|
-
].filter(Boolean).join(" ");
|
|
1180
|
+
].filter(Boolean).join(" "));
|
|
1362
1181
|
}
|
|
1363
1182
|
return {
|
|
1364
1183
|
...slotProps,
|
|
1365
1184
|
...overrideProps
|
|
1366
1185
|
};
|
|
1367
1186
|
}
|
|
1368
|
-
__name($5e63c961fc1ce211$var$mergeProps2, "$5e63c961fc1ce211$var$mergeProps");
|
|
1369
1187
|
|
|
1370
1188
|
// ../../node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
1371
1189
|
var $8927f6f2acc4f386$var$NODES = [
|
|
@@ -1385,20 +1203,16 @@ var $8927f6f2acc4f386$var$NODES = [
|
|
|
1385
1203
|
"span",
|
|
1386
1204
|
"svg",
|
|
1387
1205
|
"ul"
|
|
1388
|
-
]
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
$4q5Fq$
|
|
1394
|
-
window[Symbol.for("radix-ui")] = true;
|
|
1395
|
-
}, []);
|
|
1396
|
-
return $4q5Fq$createElement(Comp, _extends({}, primitiveProps, {
|
|
1206
|
+
], $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node) => {
|
|
1207
|
+
let Node = $4q5Fq$forwardRef((props, forwardedRef) => {
|
|
1208
|
+
let { asChild, ...primitiveProps } = props, Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac13602 : node;
|
|
1209
|
+
return $4q5Fq$useEffect(() => {
|
|
1210
|
+
window[Symbol.for("radix-ui")] = !0;
|
|
1211
|
+
}, []), $4q5Fq$createElement(Comp, _extends({}, primitiveProps, {
|
|
1397
1212
|
ref: forwardedRef
|
|
1398
1213
|
}));
|
|
1399
1214
|
});
|
|
1400
|
-
Node.displayName = `Primitive.${node}
|
|
1401
|
-
return {
|
|
1215
|
+
return Node.displayName = `Primitive.${node}`, {
|
|
1402
1216
|
...primitive,
|
|
1403
1217
|
[node]: Node
|
|
1404
1218
|
};
|
|
@@ -1407,11 +1221,10 @@ var $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.redu
|
|
|
1407
1221
|
// ../../node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs
|
|
1408
1222
|
import { useRef as $lwiWj$useRef, useEffect as $lwiWj$useEffect, useMemo as $lwiWj$useMemo } from "react";
|
|
1409
1223
|
function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
1410
|
-
|
|
1411
|
-
$lwiWj$useEffect(() => {
|
|
1224
|
+
let callbackRef = $lwiWj$useRef(callback);
|
|
1225
|
+
return $lwiWj$useEffect(() => {
|
|
1412
1226
|
callbackRef.current = callback;
|
|
1413
|
-
})
|
|
1414
|
-
return $lwiWj$useMemo(
|
|
1227
|
+
}), $lwiWj$useMemo(
|
|
1415
1228
|
() => (...args) => {
|
|
1416
1229
|
var _callbackRef$current;
|
|
1417
1230
|
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
@@ -1419,24 +1232,18 @@ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
|
1419
1232
|
[]
|
|
1420
1233
|
);
|
|
1421
1234
|
}
|
|
1422
|
-
__name($b1b2314f5f9a1d84$export$25bec8c6f54ee79a, "$b1b2314f5f9a1d84$export$25bec8c6f54ee79a");
|
|
1423
1235
|
|
|
1424
1236
|
// ../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs
|
|
1425
1237
|
import { useCallback as $bnPw9$useCallback, useState as $bnPw9$useState, useRef as $bnPw9$useRef, useEffect as $bnPw9$useEffect } from "react";
|
|
1426
|
-
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop, defaultProp, onChange =
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1238
|
+
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop, defaultProp, onChange = () => {
|
|
1239
|
+
} }) {
|
|
1240
|
+
let [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
|
|
1429
1241
|
defaultProp,
|
|
1430
1242
|
onChange
|
|
1431
|
-
})
|
|
1432
|
-
const isControlled = prop !== void 0;
|
|
1433
|
-
const value1 = isControlled ? prop : uncontrolledProp;
|
|
1434
|
-
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
1435
|
-
const setValue = $bnPw9$useCallback((nextValue) => {
|
|
1243
|
+
}), isControlled = prop !== void 0, value1 = isControlled ? prop : uncontrolledProp, handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange), setValue = $bnPw9$useCallback((nextValue) => {
|
|
1436
1244
|
if (isControlled) {
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
if (value !== prop) handleChange(value);
|
|
1245
|
+
let value = typeof nextValue == "function" ? nextValue(prop) : nextValue;
|
|
1246
|
+
value !== prop && handleChange(value);
|
|
1440
1247
|
} else setUncontrolledProp(nextValue);
|
|
1441
1248
|
}, [
|
|
1442
1249
|
isControlled,
|
|
@@ -1449,84 +1256,54 @@ function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop, defaultProp, onChange
|
|
|
1449
1256
|
setValue
|
|
1450
1257
|
];
|
|
1451
1258
|
}
|
|
1452
|
-
__name($71cd76cc60e0454e$export$6f32135080cb4c3, "$71cd76cc60e0454e$export$6f32135080cb4c3");
|
|
1453
1259
|
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp, onChange }) {
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
1458
|
-
$bnPw9$useEffect(() => {
|
|
1459
|
-
if (prevValueRef.current !== value) {
|
|
1460
|
-
handleChange(value);
|
|
1461
|
-
prevValueRef.current = value;
|
|
1462
|
-
}
|
|
1260
|
+
let uncontrolledState = $bnPw9$useState(defaultProp), [value] = uncontrolledState, prevValueRef = $bnPw9$useRef(value), handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
1261
|
+
return $bnPw9$useEffect(() => {
|
|
1262
|
+
prevValueRef.current !== value && (handleChange(value), prevValueRef.current = value);
|
|
1463
1263
|
}, [
|
|
1464
1264
|
value,
|
|
1465
1265
|
prevValueRef,
|
|
1466
1266
|
handleChange
|
|
1467
|
-
]);
|
|
1468
|
-
return uncontrolledState;
|
|
1267
|
+
]), uncontrolledState;
|
|
1469
1268
|
}
|
|
1470
|
-
__name($71cd76cc60e0454e$var$useUncontrolledState, "$71cd76cc60e0454e$var$useUncontrolledState");
|
|
1471
1269
|
|
|
1472
1270
|
// ../../node_modules/@radix-ui/react-direction/dist/index.mjs
|
|
1473
1271
|
import { createContext as $7Gjcd$createContext, createElement as $7Gjcd$createElement, useContext as $7Gjcd$useContext } from "react";
|
|
1474
1272
|
var $f631663db3294ace$var$DirectionContext = $7Gjcd$createContext(void 0);
|
|
1475
1273
|
function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
|
|
1476
|
-
|
|
1274
|
+
let globalDir = $7Gjcd$useContext($f631663db3294ace$var$DirectionContext);
|
|
1477
1275
|
return localDir || globalDir || "ltr";
|
|
1478
1276
|
}
|
|
1479
|
-
__name($f631663db3294ace$export$b39126d51d94e6f3, "$f631663db3294ace$export$b39126d51d94e6f3");
|
|
1480
1277
|
|
|
1481
1278
|
// ../../node_modules/@radix-ui/react-roving-focus/dist/index.mjs
|
|
1482
|
-
var $d7bdfb9eb0fdf311$var$ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus"
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
};
|
|
1487
|
-
var $d7bdfb9eb0fdf311$var$GROUP_NAME = "RovingFocusGroup";
|
|
1488
|
-
var [$d7bdfb9eb0fdf311$var$Collection, $d7bdfb9eb0fdf311$var$useCollection, $d7bdfb9eb0fdf311$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($d7bdfb9eb0fdf311$var$GROUP_NAME);
|
|
1489
|
-
var [$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext, $d7bdfb9eb0fdf311$export$c7109489551a4f4] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($d7bdfb9eb0fdf311$var$GROUP_NAME, [
|
|
1279
|
+
var $d7bdfb9eb0fdf311$var$ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus", $d7bdfb9eb0fdf311$var$EVENT_OPTIONS = {
|
|
1280
|
+
bubbles: !1,
|
|
1281
|
+
cancelable: !0
|
|
1282
|
+
}, $d7bdfb9eb0fdf311$var$GROUP_NAME = "RovingFocusGroup", [$d7bdfb9eb0fdf311$var$Collection, $d7bdfb9eb0fdf311$var$useCollection, $d7bdfb9eb0fdf311$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($d7bdfb9eb0fdf311$var$GROUP_NAME), [$d7bdfb9eb0fdf311$var$createRovingFocusGroupContext, $d7bdfb9eb0fdf311$export$c7109489551a4f4] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($d7bdfb9eb0fdf311$var$GROUP_NAME, [
|
|
1490
1283
|
$d7bdfb9eb0fdf311$var$createCollectionScope
|
|
1491
|
-
])
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
}, $98Iye$createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends({}, props, {
|
|
1499
|
-
ref: forwardedRef
|
|
1500
|
-
}))));
|
|
1501
|
-
});
|
|
1284
|
+
]), [$d7bdfb9eb0fdf311$var$RovingFocusProvider, $d7bdfb9eb0fdf311$var$useRovingFocusContext] = $d7bdfb9eb0fdf311$var$createRovingFocusGroupContext($d7bdfb9eb0fdf311$var$GROUP_NAME), $d7bdfb9eb0fdf311$export$8699f7c8af148338 = $98Iye$forwardRef((props, forwardedRef) => $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.Provider, {
|
|
1285
|
+
scope: props.__scopeRovingFocusGroup
|
|
1286
|
+
}, $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.Slot, {
|
|
1287
|
+
scope: props.__scopeRovingFocusGroup
|
|
1288
|
+
}, $98Iye$createElement($d7bdfb9eb0fdf311$var$RovingFocusGroupImpl, _extends({}, props, {
|
|
1289
|
+
ref: forwardedRef
|
|
1290
|
+
})))));
|
|
1502
1291
|
Object.assign($d7bdfb9eb0fdf311$export$8699f7c8af148338, {
|
|
1503
1292
|
displayName: $d7bdfb9eb0fdf311$var$GROUP_NAME
|
|
1504
1293
|
});
|
|
1505
1294
|
var $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = $98Iye$forwardRef((props, forwardedRef) => {
|
|
1506
|
-
|
|
1507
|
-
const ref = $98Iye$useRef(null);
|
|
1508
|
-
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
1509
|
-
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
1510
|
-
const [currentTabStopId = null, setCurrentTabStopId] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1295
|
+
let { __scopeRovingFocusGroup, orientation, loop = !1, dir, currentTabStopId: currentTabStopIdProp, defaultCurrentTabStopId, onCurrentTabStopIdChange, onEntryFocus, ...groupProps } = props, ref = $98Iye$useRef(null), composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref), direction = $f631663db3294ace$export$b39126d51d94e6f3(dir), [currentTabStopId = null, setCurrentTabStopId] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1511
1296
|
prop: currentTabStopIdProp,
|
|
1512
1297
|
defaultProp: defaultCurrentTabStopId,
|
|
1513
1298
|
onChange: onCurrentTabStopIdChange
|
|
1514
|
-
});
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
const [focusableItemsCount, setFocusableItemsCount] = $98Iye$useState(0);
|
|
1520
|
-
$98Iye$useEffect(() => {
|
|
1521
|
-
const node = ref.current;
|
|
1522
|
-
if (node) {
|
|
1523
|
-
node.addEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus);
|
|
1524
|
-
return () => node.removeEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus);
|
|
1525
|
-
}
|
|
1299
|
+
}), [isTabbingBackOut, setIsTabbingBackOut] = $98Iye$useState(!1), handleEntryFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEntryFocus), getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup), isClickFocusRef = $98Iye$useRef(!1), [focusableItemsCount, setFocusableItemsCount] = $98Iye$useState(0);
|
|
1300
|
+
return $98Iye$useEffect(() => {
|
|
1301
|
+
let node = ref.current;
|
|
1302
|
+
if (node)
|
|
1303
|
+
return node.addEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus), () => node.removeEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus);
|
|
1526
1304
|
}, [
|
|
1527
1305
|
handleEntryFocus
|
|
1528
|
-
])
|
|
1529
|
-
return $98Iye$createElement($d7bdfb9eb0fdf311$var$RovingFocusProvider, {
|
|
1306
|
+
]), $98Iye$createElement($d7bdfb9eb0fdf311$var$RovingFocusProvider, {
|
|
1530
1307
|
scope: __scopeRovingFocusGroup,
|
|
1531
1308
|
orientation,
|
|
1532
1309
|
dir: direction,
|
|
@@ -1539,7 +1316,7 @@ var $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = $98Iye$forwardRef((props, forwa
|
|
|
1539
1316
|
]
|
|
1540
1317
|
),
|
|
1541
1318
|
onItemShiftTab: $98Iye$useCallback(
|
|
1542
|
-
() => setIsTabbingBackOut(
|
|
1319
|
+
() => setIsTabbingBackOut(!0),
|
|
1543
1320
|
[]
|
|
1544
1321
|
),
|
|
1545
1322
|
onFocusableItemAdd: $98Iye$useCallback(
|
|
@@ -1564,62 +1341,46 @@ var $d7bdfb9eb0fdf311$var$RovingFocusGroupImpl = $98Iye$forwardRef((props, forwa
|
|
|
1564
1341
|
...props.style
|
|
1565
1342
|
},
|
|
1566
1343
|
onMouseDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, () => {
|
|
1567
|
-
isClickFocusRef.current =
|
|
1344
|
+
isClickFocusRef.current = !0;
|
|
1568
1345
|
}),
|
|
1569
1346
|
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, (event) => {
|
|
1570
|
-
|
|
1347
|
+
let isKeyboardFocus = !isClickFocusRef.current;
|
|
1571
1348
|
if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) {
|
|
1572
|
-
|
|
1573
|
-
event.currentTarget.dispatchEvent(entryFocusEvent)
|
|
1574
|
-
|
|
1575
|
-
const items = getItems().filter(
|
|
1349
|
+
let entryFocusEvent = new CustomEvent($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, $d7bdfb9eb0fdf311$var$EVENT_OPTIONS);
|
|
1350
|
+
if (event.currentTarget.dispatchEvent(entryFocusEvent), !entryFocusEvent.defaultPrevented) {
|
|
1351
|
+
let items = getItems().filter(
|
|
1576
1352
|
(item) => item.focusable
|
|
1577
|
-
)
|
|
1578
|
-
const activeItem = items.find(
|
|
1353
|
+
), activeItem = items.find(
|
|
1579
1354
|
(item) => item.active
|
|
1580
|
-
)
|
|
1581
|
-
const currentItem = items.find(
|
|
1355
|
+
), currentItem = items.find(
|
|
1582
1356
|
(item) => item.id === currentTabStopId
|
|
1583
|
-
)
|
|
1584
|
-
const candidateItems = [
|
|
1357
|
+
), candidateNodes = [
|
|
1585
1358
|
activeItem,
|
|
1586
1359
|
currentItem,
|
|
1587
1360
|
...items
|
|
1588
|
-
].filter(Boolean)
|
|
1589
|
-
const candidateNodes = candidateItems.map(
|
|
1361
|
+
].filter(Boolean).map(
|
|
1590
1362
|
(item) => item.ref.current
|
|
1591
1363
|
);
|
|
1592
1364
|
$d7bdfb9eb0fdf311$var$focusFirst(candidateNodes);
|
|
1593
1365
|
}
|
|
1594
1366
|
}
|
|
1595
|
-
isClickFocusRef.current =
|
|
1367
|
+
isClickFocusRef.current = !1;
|
|
1596
1368
|
}),
|
|
1597
1369
|
onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(
|
|
1598
1370
|
props.onBlur,
|
|
1599
|
-
() => setIsTabbingBackOut(
|
|
1371
|
+
() => setIsTabbingBackOut(!1)
|
|
1600
1372
|
)
|
|
1601
1373
|
})));
|
|
1602
|
-
})
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
const id = tabStopId || autoId;
|
|
1608
|
-
const context = $d7bdfb9eb0fdf311$var$useRovingFocusContext($d7bdfb9eb0fdf311$var$ITEM_NAME, __scopeRovingFocusGroup);
|
|
1609
|
-
const isCurrentTabStop = context.currentTabStopId === id;
|
|
1610
|
-
const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);
|
|
1611
|
-
const { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
1612
|
-
$98Iye$useEffect(() => {
|
|
1613
|
-
if (focusable) {
|
|
1614
|
-
onFocusableItemAdd();
|
|
1615
|
-
return () => onFocusableItemRemove();
|
|
1616
|
-
}
|
|
1374
|
+
}), $d7bdfb9eb0fdf311$var$ITEM_NAME = "RovingFocusGroupItem", $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = $98Iye$forwardRef((props, forwardedRef) => {
|
|
1375
|
+
let { __scopeRovingFocusGroup, focusable = !0, active = !1, tabStopId, ...itemProps } = props, autoId = $1746a345f3d73bb7$export$f680877a34711e37(), id = tabStopId || autoId, context = $d7bdfb9eb0fdf311$var$useRovingFocusContext($d7bdfb9eb0fdf311$var$ITEM_NAME, __scopeRovingFocusGroup), isCurrentTabStop = context.currentTabStopId === id, getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup), { onFocusableItemAdd, onFocusableItemRemove } = context;
|
|
1376
|
+
return $98Iye$useEffect(() => {
|
|
1377
|
+
if (focusable)
|
|
1378
|
+
return onFocusableItemAdd(), () => onFocusableItemRemove();
|
|
1617
1379
|
}, [
|
|
1618
1380
|
focusable,
|
|
1619
1381
|
onFocusableItemAdd,
|
|
1620
1382
|
onFocusableItemRemove
|
|
1621
|
-
])
|
|
1622
|
-
return $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.ItemSlot, {
|
|
1383
|
+
]), $98Iye$createElement($d7bdfb9eb0fdf311$var$Collection.ItemSlot, {
|
|
1623
1384
|
scope: __scopeRovingFocusGroup,
|
|
1624
1385
|
id,
|
|
1625
1386
|
focusable,
|
|
@@ -1630,8 +1391,7 @@ var $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = $98Iye$forwardRef((props, forward
|
|
|
1630
1391
|
}, itemProps, {
|
|
1631
1392
|
ref: forwardedRef,
|
|
1632
1393
|
onMouseDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, (event) => {
|
|
1633
|
-
|
|
1634
|
-
else context.onItemFocus(id);
|
|
1394
|
+
focusable ? context.onItemFocus(id) : event.preventDefault();
|
|
1635
1395
|
}),
|
|
1636
1396
|
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(
|
|
1637
1397
|
props.onFocus,
|
|
@@ -1643,19 +1403,18 @@ var $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = $98Iye$forwardRef((props, forward
|
|
|
1643
1403
|
return;
|
|
1644
1404
|
}
|
|
1645
1405
|
if (event.target !== event.currentTarget) return;
|
|
1646
|
-
|
|
1406
|
+
let focusIntent = $d7bdfb9eb0fdf311$var$getFocusIntent(event, context.orientation, context.dir);
|
|
1647
1407
|
if (focusIntent !== void 0) {
|
|
1648
1408
|
event.preventDefault();
|
|
1649
|
-
|
|
1409
|
+
let candidateNodes = getItems().filter(
|
|
1650
1410
|
(item) => item.focusable
|
|
1651
|
-
)
|
|
1652
|
-
let candidateNodes = items.map(
|
|
1411
|
+
).map(
|
|
1653
1412
|
(item) => item.ref.current
|
|
1654
1413
|
);
|
|
1655
1414
|
if (focusIntent === "last") candidateNodes.reverse();
|
|
1656
1415
|
else if (focusIntent === "prev" || focusIntent === "next") {
|
|
1657
|
-
|
|
1658
|
-
|
|
1416
|
+
focusIntent === "prev" && candidateNodes.reverse();
|
|
1417
|
+
let currentIndex = candidateNodes.indexOf(event.currentTarget);
|
|
1659
1418
|
candidateNodes = context.loop ? $d7bdfb9eb0fdf311$var$wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1);
|
|
1660
1419
|
}
|
|
1661
1420
|
setTimeout(
|
|
@@ -1679,71 +1438,51 @@ var $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT = {
|
|
|
1679
1438
|
End: "last"
|
|
1680
1439
|
};
|
|
1681
1440
|
function $d7bdfb9eb0fdf311$var$getDirectionAwareKey(key, dir) {
|
|
1682
|
-
|
|
1683
|
-
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
1441
|
+
return dir !== "rtl" ? key : key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
1684
1442
|
}
|
|
1685
|
-
__name($d7bdfb9eb0fdf311$var$getDirectionAwareKey, "$d7bdfb9eb0fdf311$var$getDirectionAwareKey");
|
|
1686
1443
|
function $d7bdfb9eb0fdf311$var$getFocusIntent(event, orientation, dir) {
|
|
1687
|
-
|
|
1688
|
-
if (orientation === "vertical" && [
|
|
1444
|
+
let key = $d7bdfb9eb0fdf311$var$getDirectionAwareKey(event.key, dir);
|
|
1445
|
+
if (!(orientation === "vertical" && [
|
|
1689
1446
|
"ArrowLeft",
|
|
1690
1447
|
"ArrowRight"
|
|
1691
|
-
].includes(key))
|
|
1692
|
-
if (orientation === "horizontal" && [
|
|
1448
|
+
].includes(key)) && !(orientation === "horizontal" && [
|
|
1693
1449
|
"ArrowUp",
|
|
1694
1450
|
"ArrowDown"
|
|
1695
|
-
].includes(key))
|
|
1696
|
-
|
|
1451
|
+
].includes(key)))
|
|
1452
|
+
return $d7bdfb9eb0fdf311$var$MAP_KEY_TO_FOCUS_INTENT[key];
|
|
1697
1453
|
}
|
|
1698
|
-
__name($d7bdfb9eb0fdf311$var$getFocusIntent, "$d7bdfb9eb0fdf311$var$getFocusIntent");
|
|
1699
1454
|
function $d7bdfb9eb0fdf311$var$focusFirst(candidates) {
|
|
1700
|
-
|
|
1701
|
-
for (
|
|
1702
|
-
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
1703
|
-
candidate.focus();
|
|
1704
|
-
if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return;
|
|
1705
|
-
}
|
|
1455
|
+
let PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement;
|
|
1456
|
+
for (let candidate of candidates)
|
|
1457
|
+
if (candidate === PREVIOUSLY_FOCUSED_ELEMENT || (candidate.focus(), document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT)) return;
|
|
1706
1458
|
}
|
|
1707
|
-
__name($d7bdfb9eb0fdf311$var$focusFirst, "$d7bdfb9eb0fdf311$var$focusFirst");
|
|
1708
1459
|
function $d7bdfb9eb0fdf311$var$wrapArray(array, startIndex) {
|
|
1709
1460
|
return array.map(
|
|
1710
1461
|
(_, index) => array[(startIndex + index) % array.length]
|
|
1711
1462
|
);
|
|
1712
1463
|
}
|
|
1713
|
-
|
|
1714
|
-
var $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9 = $d7bdfb9eb0fdf311$export$8699f7c8af148338;
|
|
1715
|
-
var $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2 = $d7bdfb9eb0fdf311$export$ab9df7c53fe8454;
|
|
1464
|
+
var $d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9 = $d7bdfb9eb0fdf311$export$8699f7c8af148338, $d7bdfb9eb0fdf311$export$6d08773d2e66f8f2 = $d7bdfb9eb0fdf311$export$ab9df7c53fe8454;
|
|
1716
1465
|
|
|
1717
1466
|
// ../../node_modules/@radix-ui/react-presence/dist/index.mjs
|
|
1718
1467
|
import { Children as $iqq3r$Children, cloneElement as $iqq3r$cloneElement, useState as $iqq3r$useState, useRef as $iqq3r$useRef, useEffect as $iqq3r$useEffect, useCallback as $iqq3r$useCallback, useReducer as $iqq3r$useReducer } from "react";
|
|
1719
1468
|
import { flushSync as $iqq3r$flushSync } from "react-dom";
|
|
1720
1469
|
function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
|
|
1721
1470
|
return $iqq3r$useReducer((state, event) => {
|
|
1722
|
-
|
|
1723
|
-
return nextState
|
|
1471
|
+
let nextState = machine[state][event];
|
|
1472
|
+
return nextState ?? state;
|
|
1724
1473
|
}, initialState);
|
|
1725
1474
|
}
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
const { present, children } = props;
|
|
1729
|
-
const presence = $921a889cee6df7e8$var$usePresence(present);
|
|
1730
|
-
const child = typeof children === "function" ? children({
|
|
1475
|
+
var $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props) => {
|
|
1476
|
+
let { present, children } = props, presence = $921a889cee6df7e8$var$usePresence(present), child = typeof children == "function" ? children({
|
|
1731
1477
|
present: presence.isPresent
|
|
1732
|
-
}) : $iqq3r$Children.only(children);
|
|
1733
|
-
|
|
1734
|
-
const forceMount = typeof children === "function";
|
|
1735
|
-
return forceMount || presence.isPresent ? $iqq3r$cloneElement(child, {
|
|
1478
|
+
}) : $iqq3r$Children.only(children), ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
|
|
1479
|
+
return typeof children == "function" || presence.isPresent ? $iqq3r$cloneElement(child, {
|
|
1736
1480
|
ref
|
|
1737
1481
|
}) : null;
|
|
1738
|
-
}
|
|
1482
|
+
};
|
|
1739
1483
|
$921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = "Presence";
|
|
1740
1484
|
function $921a889cee6df7e8$var$usePresence(present) {
|
|
1741
|
-
|
|
1742
|
-
const stylesRef = $iqq3r$useRef({});
|
|
1743
|
-
const prevPresentRef = $iqq3r$useRef(present);
|
|
1744
|
-
const prevAnimationNameRef = $iqq3r$useRef("none");
|
|
1745
|
-
const initialState = present ? "mounted" : "unmounted";
|
|
1746
|
-
const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
|
|
1485
|
+
let [node1, setNode] = $iqq3r$useState(), stylesRef = $iqq3r$useRef({}), prevPresentRef = $iqq3r$useRef(present), prevAnimationNameRef = $iqq3r$useRef("none"), initialState = present ? "mounted" : "unmounted", [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
|
|
1747
1486
|
mounted: {
|
|
1748
1487
|
UNMOUNT: "unmounted",
|
|
1749
1488
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -1756,89 +1495,57 @@ function $921a889cee6df7e8$var$usePresence(present) {
|
|
|
1756
1495
|
MOUNT: "mounted"
|
|
1757
1496
|
}
|
|
1758
1497
|
});
|
|
1759
|
-
$iqq3r$useEffect(() => {
|
|
1760
|
-
|
|
1498
|
+
return $iqq3r$useEffect(() => {
|
|
1499
|
+
let currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
|
|
1761
1500
|
prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
|
|
1762
1501
|
}, [
|
|
1763
1502
|
state
|
|
1764
|
-
])
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
if (hasPresentChanged) {
|
|
1770
|
-
const prevAnimationName = prevAnimationNameRef.current;
|
|
1771
|
-
const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
|
|
1772
|
-
if (present) send("MOUNT");
|
|
1773
|
-
else if (currentAnimationName === "none" || (styles === null || styles === void 0 ? void 0 : styles.display) === "none")
|
|
1774
|
-
send("UNMOUNT");
|
|
1775
|
-
else {
|
|
1776
|
-
const isAnimating = prevAnimationName !== currentAnimationName;
|
|
1777
|
-
if (wasPresent && isAnimating) send("ANIMATION_OUT");
|
|
1778
|
-
else send("UNMOUNT");
|
|
1779
|
-
}
|
|
1780
|
-
prevPresentRef.current = present;
|
|
1503
|
+
]), $9f79659886946c16$export$e5c5a5f917a5871c(() => {
|
|
1504
|
+
let styles = stylesRef.current, wasPresent = prevPresentRef.current;
|
|
1505
|
+
if (wasPresent !== present) {
|
|
1506
|
+
let prevAnimationName = prevAnimationNameRef.current, currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
|
|
1507
|
+
present ? send("MOUNT") : currentAnimationName === "none" || styles?.display === "none" ? send("UNMOUNT") : send(wasPresent && prevAnimationName !== currentAnimationName ? "ANIMATION_OUT" : "UNMOUNT"), prevPresentRef.current = present;
|
|
1781
1508
|
}
|
|
1782
1509
|
}, [
|
|
1783
1510
|
present,
|
|
1784
1511
|
send
|
|
1785
|
-
])
|
|
1786
|
-
$9f79659886946c16$export$e5c5a5f917a5871c(() => {
|
|
1512
|
+
]), $9f79659886946c16$export$e5c5a5f917a5871c(() => {
|
|
1787
1513
|
if (node1) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
|
|
1799
|
-
}, "handleAnimationStart");
|
|
1800
|
-
node1.addEventListener("animationstart", handleAnimationStart);
|
|
1801
|
-
node1.addEventListener("animationcancel", handleAnimationEnd);
|
|
1802
|
-
node1.addEventListener("animationend", handleAnimationEnd);
|
|
1803
|
-
return () => {
|
|
1804
|
-
node1.removeEventListener("animationstart", handleAnimationStart);
|
|
1805
|
-
node1.removeEventListener("animationcancel", handleAnimationEnd);
|
|
1806
|
-
node1.removeEventListener("animationend", handleAnimationEnd);
|
|
1514
|
+
let handleAnimationEnd = (event) => {
|
|
1515
|
+
let isCurrentAnimation = $921a889cee6df7e8$var$getAnimationName(stylesRef.current).includes(event.animationName);
|
|
1516
|
+
event.target === node1 && isCurrentAnimation && $iqq3r$flushSync(
|
|
1517
|
+
() => send("ANIMATION_END")
|
|
1518
|
+
);
|
|
1519
|
+
}, handleAnimationStart = (event) => {
|
|
1520
|
+
event.target === node1 && (prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current));
|
|
1521
|
+
};
|
|
1522
|
+
return node1.addEventListener("animationstart", handleAnimationStart), node1.addEventListener("animationcancel", handleAnimationEnd), node1.addEventListener("animationend", handleAnimationEnd), () => {
|
|
1523
|
+
node1.removeEventListener("animationstart", handleAnimationStart), node1.removeEventListener("animationcancel", handleAnimationEnd), node1.removeEventListener("animationend", handleAnimationEnd);
|
|
1807
1524
|
};
|
|
1808
1525
|
} else
|
|
1809
1526
|
send("ANIMATION_END");
|
|
1810
1527
|
}, [
|
|
1811
1528
|
node1,
|
|
1812
1529
|
send
|
|
1813
|
-
])
|
|
1814
|
-
return {
|
|
1530
|
+
]), {
|
|
1815
1531
|
isPresent: [
|
|
1816
1532
|
"mounted",
|
|
1817
1533
|
"unmountSuspended"
|
|
1818
1534
|
].includes(state),
|
|
1819
1535
|
ref: $iqq3r$useCallback((node) => {
|
|
1820
|
-
|
|
1821
|
-
setNode(node);
|
|
1536
|
+
node && (stylesRef.current = getComputedStyle(node)), setNode(node);
|
|
1822
1537
|
}, [])
|
|
1823
1538
|
};
|
|
1824
1539
|
}
|
|
1825
|
-
__name($921a889cee6df7e8$var$usePresence, "$921a889cee6df7e8$var$usePresence");
|
|
1826
1540
|
function $921a889cee6df7e8$var$getAnimationName(styles) {
|
|
1827
|
-
return
|
|
1541
|
+
return styles?.animationName || "none";
|
|
1828
1542
|
}
|
|
1829
|
-
__name($921a889cee6df7e8$var$getAnimationName, "$921a889cee6df7e8$var$getAnimationName");
|
|
1830
1543
|
|
|
1831
1544
|
// ../../node_modules/@radix-ui/react-tabs/dist/index.mjs
|
|
1832
|
-
var $69cb30bb0017df05$var$TABS_NAME = "Tabs"
|
|
1833
|
-
var [$69cb30bb0017df05$var$createTabsContext, $69cb30bb0017df05$export$355f5bd209d7b13a] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($69cb30bb0017df05$var$TABS_NAME, [
|
|
1545
|
+
var $69cb30bb0017df05$var$TABS_NAME = "Tabs", [$69cb30bb0017df05$var$createTabsContext, $69cb30bb0017df05$export$355f5bd209d7b13a] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($69cb30bb0017df05$var$TABS_NAME, [
|
|
1834
1546
|
$d7bdfb9eb0fdf311$export$c7109489551a4f4
|
|
1835
|
-
])
|
|
1836
|
-
|
|
1837
|
-
var [$69cb30bb0017df05$var$TabsProvider, $69cb30bb0017df05$var$useTabsContext] = $69cb30bb0017df05$var$createTabsContext($69cb30bb0017df05$var$TABS_NAME);
|
|
1838
|
-
var $69cb30bb0017df05$export$b2539bed5023c21c = $1IHzk$forwardRef((props, forwardedRef) => {
|
|
1839
|
-
const { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", ...tabsProps } = props;
|
|
1840
|
-
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
1841
|
-
const [value, setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1547
|
+
]), $69cb30bb0017df05$var$useRovingFocusGroupScope = $d7bdfb9eb0fdf311$export$c7109489551a4f4(), [$69cb30bb0017df05$var$TabsProvider, $69cb30bb0017df05$var$useTabsContext] = $69cb30bb0017df05$var$createTabsContext($69cb30bb0017df05$var$TABS_NAME), $69cb30bb0017df05$export$b2539bed5023c21c = $1IHzk$forwardRef((props, forwardedRef) => {
|
|
1548
|
+
let { __scopeTabs, value: valueProp, onValueChange, defaultValue, orientation = "horizontal", dir, activationMode = "automatic", ...tabsProps } = props, direction = $f631663db3294ace$export$b39126d51d94e6f3(dir), [value, setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1842
1549
|
prop: valueProp,
|
|
1843
1550
|
onChange: onValueChange,
|
|
1844
1551
|
defaultProp: defaultValue
|
|
@@ -1861,13 +1568,10 @@ var $69cb30bb0017df05$export$b2539bed5023c21c = $1IHzk$forwardRef((props, forwar
|
|
|
1861
1568
|
Object.assign($69cb30bb0017df05$export$b2539bed5023c21c, {
|
|
1862
1569
|
displayName: $69cb30bb0017df05$var$TABS_NAME
|
|
1863
1570
|
});
|
|
1864
|
-
var $69cb30bb0017df05$var$TAB_LIST_NAME = "TabsList"
|
|
1865
|
-
|
|
1866
|
-
const { __scopeTabs, loop = true, ...listProps } = props;
|
|
1867
|
-
const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs);
|
|
1868
|
-
const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
|
|
1571
|
+
var $69cb30bb0017df05$var$TAB_LIST_NAME = "TabsList", $69cb30bb0017df05$export$9712d22edc0d78c1 = $1IHzk$forwardRef((props, forwardedRef) => {
|
|
1572
|
+
let { __scopeTabs, loop = !0, ...listProps } = props, context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TAB_LIST_NAME, __scopeTabs), rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
|
|
1869
1573
|
return $1IHzk$createElement($d7bdfb9eb0fdf311$export$be92b6f5f03c0fe9, _extends({
|
|
1870
|
-
asChild:
|
|
1574
|
+
asChild: !0
|
|
1871
1575
|
}, rovingFocusGroupScope, {
|
|
1872
1576
|
orientation: context.orientation,
|
|
1873
1577
|
dir: context.dir,
|
|
@@ -1882,16 +1586,10 @@ var $69cb30bb0017df05$export$9712d22edc0d78c1 = $1IHzk$forwardRef((props, forwar
|
|
|
1882
1586
|
Object.assign($69cb30bb0017df05$export$9712d22edc0d78c1, {
|
|
1883
1587
|
displayName: $69cb30bb0017df05$var$TAB_LIST_NAME
|
|
1884
1588
|
});
|
|
1885
|
-
var $69cb30bb0017df05$var$TRIGGER_NAME = "TabsTrigger"
|
|
1886
|
-
var $69cb30bb0017df05$
|
|
1887
|
-
const { __scopeTabs, value, disabled = false, ...triggerProps } = props;
|
|
1888
|
-
const context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TRIGGER_NAME, __scopeTabs);
|
|
1889
|
-
const rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs);
|
|
1890
|
-
const triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value);
|
|
1891
|
-
const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
|
|
1892
|
-
const isSelected = value === context.value;
|
|
1589
|
+
var $69cb30bb0017df05$var$TRIGGER_NAME = "TabsTrigger", $69cb30bb0017df05$export$8114b9fdfdf9f3ba = $1IHzk$forwardRef((props, forwardedRef) => {
|
|
1590
|
+
let { __scopeTabs, value, disabled = !1, ...triggerProps } = props, context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$TRIGGER_NAME, __scopeTabs), rovingFocusGroupScope = $69cb30bb0017df05$var$useRovingFocusGroupScope(__scopeTabs), triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value), contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value), isSelected = value === context.value;
|
|
1893
1591
|
return $1IHzk$createElement($d7bdfb9eb0fdf311$export$6d08773d2e66f8f2, _extends({
|
|
1894
|
-
asChild:
|
|
1592
|
+
asChild: !0
|
|
1895
1593
|
}, rovingFocusGroupScope, {
|
|
1896
1594
|
focusable: !disabled,
|
|
1897
1595
|
active: isSelected
|
|
@@ -1907,40 +1605,31 @@ var $69cb30bb0017df05$export$8114b9fdfdf9f3ba = $1IHzk$forwardRef((props, forwar
|
|
|
1907
1605
|
}, triggerProps, {
|
|
1908
1606
|
ref: forwardedRef,
|
|
1909
1607
|
onMouseDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onMouseDown, (event) => {
|
|
1910
|
-
|
|
1911
|
-
else
|
|
1912
|
-
event.preventDefault();
|
|
1608
|
+
!disabled && event.button === 0 && event.ctrlKey === !1 ? context.onValueChange(value) : event.preventDefault();
|
|
1913
1609
|
}),
|
|
1914
1610
|
onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event) => {
|
|
1915
|
-
|
|
1611
|
+
[
|
|
1916
1612
|
" ",
|
|
1917
1613
|
"Enter"
|
|
1918
|
-
].includes(event.key)
|
|
1614
|
+
].includes(event.key) && context.onValueChange(value);
|
|
1919
1615
|
}),
|
|
1920
1616
|
onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, () => {
|
|
1921
|
-
|
|
1922
|
-
|
|
1617
|
+
let isAutomaticActivation = context.activationMode !== "manual";
|
|
1618
|
+
!isSelected && !disabled && isAutomaticActivation && context.onValueChange(value);
|
|
1923
1619
|
})
|
|
1924
1620
|
})));
|
|
1925
1621
|
});
|
|
1926
1622
|
Object.assign($69cb30bb0017df05$export$8114b9fdfdf9f3ba, {
|
|
1927
1623
|
displayName: $69cb30bb0017df05$var$TRIGGER_NAME
|
|
1928
1624
|
});
|
|
1929
|
-
var $69cb30bb0017df05$var$CONTENT_NAME = "TabsContent"
|
|
1930
|
-
var $69cb30bb0017df05$
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
|
|
1935
|
-
const isSelected = value === context.value;
|
|
1936
|
-
const isMountAnimationPreventedRef = $1IHzk$useRef(isSelected);
|
|
1937
|
-
$1IHzk$useEffect(() => {
|
|
1938
|
-
const rAF = requestAnimationFrame(
|
|
1939
|
-
() => isMountAnimationPreventedRef.current = false
|
|
1625
|
+
var $69cb30bb0017df05$var$CONTENT_NAME = "TabsContent", $69cb30bb0017df05$export$bd905d70e8fd2ebb = $1IHzk$forwardRef((props, forwardedRef) => {
|
|
1626
|
+
let { __scopeTabs, value, forceMount, children, ...contentProps } = props, context = $69cb30bb0017df05$var$useTabsContext($69cb30bb0017df05$var$CONTENT_NAME, __scopeTabs), triggerId = $69cb30bb0017df05$var$makeTriggerId(context.baseId, value), contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value), isSelected = value === context.value, isMountAnimationPreventedRef = $1IHzk$useRef(isSelected);
|
|
1627
|
+
return $1IHzk$useEffect(() => {
|
|
1628
|
+
let rAF = requestAnimationFrame(
|
|
1629
|
+
() => isMountAnimationPreventedRef.current = !1
|
|
1940
1630
|
);
|
|
1941
1631
|
return () => cancelAnimationFrame(rAF);
|
|
1942
|
-
}, [])
|
|
1943
|
-
return $1IHzk$createElement(
|
|
1632
|
+
}, []), $1IHzk$createElement(
|
|
1944
1633
|
$921a889cee6df7e8$export$99c2b779aa4e8b8b,
|
|
1945
1634
|
{
|
|
1946
1635
|
present: forceMount || isSelected
|
|
@@ -1968,15 +1657,10 @@ Object.assign($69cb30bb0017df05$export$bd905d70e8fd2ebb, {
|
|
|
1968
1657
|
function $69cb30bb0017df05$var$makeTriggerId(baseId, value) {
|
|
1969
1658
|
return `${baseId}-trigger-${value}`;
|
|
1970
1659
|
}
|
|
1971
|
-
__name($69cb30bb0017df05$var$makeTriggerId, "$69cb30bb0017df05$var$makeTriggerId");
|
|
1972
1660
|
function $69cb30bb0017df05$var$makeContentId(baseId, value) {
|
|
1973
1661
|
return `${baseId}-content-${value}`;
|
|
1974
1662
|
}
|
|
1975
|
-
|
|
1976
|
-
var $69cb30bb0017df05$export$be92b6f5f03c0fe9 = $69cb30bb0017df05$export$b2539bed5023c21c;
|
|
1977
|
-
var $69cb30bb0017df05$export$54c2e3dc7acea9f5 = $69cb30bb0017df05$export$9712d22edc0d78c1;
|
|
1978
|
-
var $69cb30bb0017df05$export$41fb9f06171c75f4 = $69cb30bb0017df05$export$8114b9fdfdf9f3ba;
|
|
1979
|
-
var $69cb30bb0017df05$export$7c6e2c02157bb7d2 = $69cb30bb0017df05$export$bd905d70e8fd2ebb;
|
|
1663
|
+
var $69cb30bb0017df05$export$be92b6f5f03c0fe9 = $69cb30bb0017df05$export$b2539bed5023c21c, $69cb30bb0017df05$export$54c2e3dc7acea9f5 = $69cb30bb0017df05$export$9712d22edc0d78c1, $69cb30bb0017df05$export$41fb9f06171c75f4 = $69cb30bb0017df05$export$8114b9fdfdf9f3ba, $69cb30bb0017df05$export$7c6e2c02157bb7d2 = $69cb30bb0017df05$export$bd905d70e8fd2ebb;
|
|
1980
1664
|
|
|
1981
1665
|
// src/components/Report/Details.tsx
|
|
1982
1666
|
import { styled } from "storybook/theming";
|
|
@@ -1994,12 +1678,10 @@ var StyledSyntaxHighlighter = styled(SyntaxHighlighter)(
|
|
|
1994
1678
|
}
|
|
1995
1679
|
}
|
|
1996
1680
|
)
|
|
1997
|
-
)
|
|
1998
|
-
var Info = styled.div({
|
|
1681
|
+
), Info = styled.div({
|
|
1999
1682
|
display: "flex",
|
|
2000
1683
|
flexDirection: "column"
|
|
2001
|
-
})
|
|
2002
|
-
var RuleId = styled.div(({ theme: theme2 }) => ({
|
|
1684
|
+
}), RuleId = styled.div(({ theme: theme2 }) => ({
|
|
2003
1685
|
display: "block",
|
|
2004
1686
|
color: theme2.textMutedColor,
|
|
2005
1687
|
fontFamily: theme2.typography.fonts.mono,
|
|
@@ -2009,24 +1691,20 @@ var RuleId = styled.div(({ theme: theme2 }) => ({
|
|
|
2009
1691
|
"@container (min-width: 800px)": {
|
|
2010
1692
|
display: "none"
|
|
2011
1693
|
}
|
|
2012
|
-
}))
|
|
2013
|
-
var Description = styled.p({
|
|
1694
|
+
})), Description = styled.p({
|
|
2014
1695
|
margin: 0
|
|
2015
|
-
})
|
|
2016
|
-
var Wrapper = styled.div({
|
|
1696
|
+
}), Wrapper = styled.div({
|
|
2017
1697
|
display: "flex",
|
|
2018
1698
|
flexDirection: "column",
|
|
2019
1699
|
padding: "0 15px 20px 15px",
|
|
2020
1700
|
gap: 20
|
|
2021
|
-
})
|
|
2022
|
-
var Columns = styled.div({
|
|
1701
|
+
}), Columns = styled.div({
|
|
2023
1702
|
gap: 15,
|
|
2024
1703
|
"@container (min-width: 800px)": {
|
|
2025
1704
|
display: "grid",
|
|
2026
1705
|
gridTemplateColumns: "50% 50%"
|
|
2027
1706
|
}
|
|
2028
|
-
})
|
|
2029
|
-
var Content = styled.div(({ theme: theme2, side }) => ({
|
|
1707
|
+
}), Content = styled.div(({ theme: theme2, side }) => ({
|
|
2030
1708
|
display: side === "left" ? "flex" : "none",
|
|
2031
1709
|
flexDirection: "column",
|
|
2032
1710
|
gap: 15,
|
|
@@ -2041,8 +1719,7 @@ var Content = styled.div(({ theme: theme2, side }) => ({
|
|
|
2041
1719
|
"@container (min-width: 800px)": {
|
|
2042
1720
|
display: side === "left" ? "none" : "flex"
|
|
2043
1721
|
}
|
|
2044
|
-
}))
|
|
2045
|
-
var Item = styled(Button)(({ theme: theme2 }) => ({
|
|
1722
|
+
})), Item = styled(Button)(({ theme: theme2 }) => ({
|
|
2046
1723
|
fontFamily: theme2.typography.fonts.mono,
|
|
2047
1724
|
fontWeight: theme2.typography.weight.regular,
|
|
2048
1725
|
color: theme2.textMutedColor,
|
|
@@ -2058,52 +1735,44 @@ var Item = styled(Button)(({ theme: theme2 }) => ({
|
|
|
2058
1735
|
color: theme2.color.secondary,
|
|
2059
1736
|
backgroundColor: theme2.background.hoverable
|
|
2060
1737
|
}
|
|
2061
|
-
}))
|
|
2062
|
-
var Messages = styled.div({
|
|
1738
|
+
})), Messages = styled.div({
|
|
2063
1739
|
display: "flex",
|
|
2064
1740
|
flexDirection: "column",
|
|
2065
1741
|
gap: 10
|
|
2066
|
-
})
|
|
2067
|
-
var Actions = styled.div({
|
|
1742
|
+
}), Actions = styled.div({
|
|
2068
1743
|
display: "flex",
|
|
2069
1744
|
gap: 10
|
|
2070
|
-
})
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
onClick();
|
|
2075
|
-
setCopied(true);
|
|
2076
|
-
const timeout = setTimeout(() => setCopied(false), 2e3);
|
|
1745
|
+
}), CopyButton = ({ onClick }) => {
|
|
1746
|
+
let [copied, setCopied] = useState3(!1), handleClick = useCallback2(() => {
|
|
1747
|
+
onClick(), setCopied(!0);
|
|
1748
|
+
let timeout = setTimeout(() => setCopied(!1), 2e3);
|
|
2077
1749
|
return () => clearTimeout(timeout);
|
|
2078
1750
|
}, [onClick]);
|
|
2079
|
-
return React2.createElement(Button, { ariaLabel:
|
|
2080
|
-
}, "
|
|
2081
|
-
var Details = /* @__PURE__ */ __name(({ id, item, type, selection, handleSelectionChange }) => React2.createElement(Wrapper, { id }, React2.createElement(Info, null, React2.createElement(RuleId, null, item.id), React2.createElement(Description, null, getFriendlySummaryForAxeResult(item), " ", React2.createElement(Link, { href: item.helpUrl, target: "_blank", rel: "noopener noreferrer", withArrow: true }, "Learn how to resolve this violation"))), React2.createElement(
|
|
1751
|
+
return React2.createElement(Button, { ariaLabel: !1, onClick: handleClick }, copied ? React2.createElement(CheckIcon, null) : React2.createElement(CopyIcon, null), " ", copied ? "Copied" : "Copy link");
|
|
1752
|
+
}, Details = ({ id, item, type, selection, handleSelectionChange }) => React2.createElement(Wrapper, { id }, React2.createElement(Info, null, React2.createElement(RuleId, null, item.id), React2.createElement(Description, null, getFriendlySummaryForAxeResult(item), " ", React2.createElement(Link, { href: item.helpUrl, target: "_blank", rel: "noopener noreferrer", withArrow: !0 }, "Learn how to resolve this violation"))), React2.createElement(
|
|
2082
1753
|
$69cb30bb0017df05$export$be92b6f5f03c0fe9,
|
|
2083
1754
|
{
|
|
2084
1755
|
defaultValue: selection,
|
|
2085
1756
|
orientation: "vertical",
|
|
2086
1757
|
value: selection,
|
|
2087
1758
|
onValueChange: handleSelectionChange,
|
|
2088
|
-
asChild:
|
|
1759
|
+
asChild: !0
|
|
2089
1760
|
},
|
|
2090
1761
|
React2.createElement(Columns, null, React2.createElement($69cb30bb0017df05$export$54c2e3dc7acea9f5, { "aria-label": type }, item.nodes.map((node, index) => {
|
|
2091
|
-
|
|
2092
|
-
return React2.createElement(Fragment, { key }, React2.createElement($69cb30bb0017df05$export$41fb9f06171c75f4, { value: key, asChild:
|
|
1762
|
+
let key = `${type}.${item.id}.${index + 1}`;
|
|
1763
|
+
return React2.createElement(Fragment, { key }, React2.createElement($69cb30bb0017df05$export$41fb9f06171c75f4, { value: key, asChild: !0 }, React2.createElement(Item, { ariaLabel: !1, variant: "ghost", size: "medium", id: key }, index + 1, ". ", node.html)), React2.createElement($69cb30bb0017df05$export$7c6e2c02157bb7d2, { value: key, asChild: !0 }, React2.createElement(Content, { side: "left" }, getContent(node))));
|
|
2093
1764
|
})), item.nodes.map((node, index) => {
|
|
2094
|
-
|
|
2095
|
-
return React2.createElement($69cb30bb0017df05$export$7c6e2c02157bb7d2, { key, value: key, asChild:
|
|
1765
|
+
let key = `${type}.${item.id}.${index + 1}`;
|
|
1766
|
+
return React2.createElement($69cb30bb0017df05$export$7c6e2c02157bb7d2, { key, value: key, asChild: !0 }, React2.createElement(Content, { side: "right" }, getContent(node)));
|
|
2096
1767
|
}))
|
|
2097
|
-
))
|
|
1768
|
+
));
|
|
2098
1769
|
function getContent(node) {
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
const rules = [...any, ...all, ...none];
|
|
2102
|
-
return React2.createElement(React2.Fragment, null, React2.createElement(Messages, null, rules.map((rule) => React2.createElement("div", { key: rule.id }, `${rule.message}${/(\.|: [^.]+\.*)$/.test(rule.message) ? "" : "."}`))), React2.createElement(Actions, null, React2.createElement(Button, { ariaLabel: false, onClick: () => handleJumpToElement(node.target.toString()) }, React2.createElement(LocationIcon, null), " Jump to element"), React2.createElement(CopyButton, { onClick: () => handleCopyLink(node.linkPath) })), React2.createElement(
|
|
1770
|
+
let { handleCopyLink, handleJumpToElement } = useA11yContext(), { any, all, none, html, target } = node, rules = [...any, ...all, ...none];
|
|
1771
|
+
return React2.createElement(React2.Fragment, null, React2.createElement(Messages, null, rules.map((rule) => React2.createElement("div", { key: rule.id }, `${rule.message}${/(\.|: [^.]+\.*)$/.test(rule.message) ? "" : "."}`))), React2.createElement(Actions, null, React2.createElement(Button, { ariaLabel: !1, onClick: () => handleJumpToElement(node.target.toString()) }, React2.createElement(LocationIcon, null), " Jump to element"), React2.createElement(CopyButton, { onClick: () => handleCopyLink(node.linkPath) })), React2.createElement(
|
|
2103
1772
|
StyledSyntaxHighlighter,
|
|
2104
1773
|
{
|
|
2105
1774
|
language: "jsx",
|
|
2106
|
-
wrapLongLines:
|
|
1775
|
+
wrapLongLines: !0
|
|
2107
1776
|
},
|
|
2108
1777
|
`/* element */
|
|
2109
1778
|
${html}`
|
|
@@ -2111,13 +1780,12 @@ ${html}`
|
|
|
2111
1780
|
StyledSyntaxHighlighter,
|
|
2112
1781
|
{
|
|
2113
1782
|
language: "css",
|
|
2114
|
-
wrapLongLines:
|
|
1783
|
+
wrapLongLines: !0
|
|
2115
1784
|
},
|
|
2116
1785
|
`/* selector */
|
|
2117
1786
|
${target} {}`
|
|
2118
1787
|
));
|
|
2119
1788
|
}
|
|
2120
|
-
__name(getContent, "getContent");
|
|
2121
1789
|
|
|
2122
1790
|
// src/components/Report/Report.tsx
|
|
2123
1791
|
var impactStatus = {
|
|
@@ -2125,25 +1793,21 @@ var impactStatus = {
|
|
|
2125
1793
|
moderate: "warning",
|
|
2126
1794
|
serious: "negative",
|
|
2127
1795
|
critical: "critical"
|
|
2128
|
-
}
|
|
2129
|
-
var impactLabels = {
|
|
1796
|
+
}, impactLabels = {
|
|
2130
1797
|
minor: "Minor",
|
|
2131
1798
|
moderate: "Moderate",
|
|
2132
1799
|
serious: "Serious",
|
|
2133
1800
|
critical: "Critical"
|
|
2134
|
-
}
|
|
2135
|
-
var Wrapper2 = styled2.div(({ theme: theme2 }) => ({
|
|
1801
|
+
}, Wrapper2 = styled2.div(({ theme: theme2 }) => ({
|
|
2136
1802
|
display: "flex",
|
|
2137
1803
|
flexDirection: "column",
|
|
2138
1804
|
width: "100%",
|
|
2139
1805
|
borderBottom: `1px solid ${theme2.appBorderColor}`,
|
|
2140
1806
|
containerType: "inline-size",
|
|
2141
1807
|
fontSize: theme2.typography.size.s2
|
|
2142
|
-
}))
|
|
2143
|
-
var Icon = styled2(ChevronSmallDownIcon)({
|
|
1808
|
+
})), Icon = styled2(ChevronSmallDownIcon)({
|
|
2144
1809
|
transition: "transform 0.1s ease-in-out"
|
|
2145
|
-
})
|
|
2146
|
-
var HeaderBar = styled2.div(({ theme: theme2 }) => ({
|
|
1810
|
+
}), HeaderBar = styled2.div(({ theme: theme2 }) => ({
|
|
2147
1811
|
display: "flex",
|
|
2148
1812
|
justifyContent: "space-between",
|
|
2149
1813
|
alignItems: "center",
|
|
@@ -2158,15 +1822,13 @@ var HeaderBar = styled2.div(({ theme: theme2 }) => ({
|
|
|
2158
1822
|
"&:hover": {
|
|
2159
1823
|
color: theme2.color.secondary
|
|
2160
1824
|
}
|
|
2161
|
-
}))
|
|
2162
|
-
var Title = styled2.div(({ theme: theme2 }) => ({
|
|
1825
|
+
})), Title = styled2.div(({ theme: theme2 }) => ({
|
|
2163
1826
|
display: "flex",
|
|
2164
1827
|
alignItems: "baseline",
|
|
2165
1828
|
flexGrow: 1,
|
|
2166
1829
|
fontSize: theme2.typography.size.s2,
|
|
2167
1830
|
gap: 8
|
|
2168
|
-
}))
|
|
2169
|
-
var RuleId2 = styled2.div(({ theme: theme2 }) => ({
|
|
1831
|
+
})), RuleId2 = styled2.div(({ theme: theme2 }) => ({
|
|
2170
1832
|
display: "none",
|
|
2171
1833
|
color: theme2.textMutedColor,
|
|
2172
1834
|
fontFamily: theme2.typography.fonts.mono,
|
|
@@ -2174,16 +1836,14 @@ var RuleId2 = styled2.div(({ theme: theme2 }) => ({
|
|
|
2174
1836
|
"@container (min-width: 800px)": {
|
|
2175
1837
|
display: "block"
|
|
2176
1838
|
}
|
|
2177
|
-
}))
|
|
2178
|
-
var Count = styled2.div(({ theme: theme2 }) => ({
|
|
1839
|
+
})), Count = styled2.div(({ theme: theme2 }) => ({
|
|
2179
1840
|
display: "flex",
|
|
2180
1841
|
alignItems: "center",
|
|
2181
1842
|
justifyContent: "center",
|
|
2182
1843
|
color: theme2.textMutedColor,
|
|
2183
1844
|
width: 28,
|
|
2184
1845
|
height: 28
|
|
2185
|
-
}))
|
|
2186
|
-
var Report = /* @__PURE__ */ __name(({
|
|
1846
|
+
})), Report = ({
|
|
2187
1847
|
items,
|
|
2188
1848
|
empty,
|
|
2189
1849
|
type,
|
|
@@ -2191,10 +1851,7 @@ var Report = /* @__PURE__ */ __name(({
|
|
|
2191
1851
|
selectedItems,
|
|
2192
1852
|
toggleOpen
|
|
2193
1853
|
}) => React3.createElement(React3.Fragment, null, items && items.length ? items.map((item) => {
|
|
2194
|
-
|
|
2195
|
-
const detailsId = `details:${id}`;
|
|
2196
|
-
const selection = selectedItems.get(id);
|
|
2197
|
-
const title = getTitleForAxeResult(item);
|
|
1854
|
+
let id = `${type}.${item.id}`, detailsId = `details:${id}`, selection = selectedItems.get(id), title = getTitleForAxeResult(item);
|
|
2198
1855
|
return React3.createElement(Wrapper2, { key: id }, React3.createElement(HeaderBar, { onClick: (event) => toggleOpen(event, type, item), "data-active": !!selection }, React3.createElement(Title, null, React3.createElement("strong", null, title), React3.createElement(RuleId2, null, item.id)), item.impact && React3.createElement(Badge, { status: type === RuleType.PASS ? "neutral" : impactStatus[item.impact] }, impactLabels[item.impact]), React3.createElement(Count, null, item.nodes.length), React3.createElement(
|
|
2199
1856
|
Button2,
|
|
2200
1857
|
{
|
|
@@ -2216,7 +1873,7 @@ var Report = /* @__PURE__ */ __name(({
|
|
|
2216
1873
|
handleSelectionChange
|
|
2217
1874
|
}
|
|
2218
1875
|
) : React3.createElement("div", { id: detailsId }));
|
|
2219
|
-
}) : React3.createElement(EmptyTabContent, { title: empty }))
|
|
1876
|
+
}) : React3.createElement(EmptyTabContent, { title: empty }));
|
|
2220
1877
|
|
|
2221
1878
|
// src/components/Tabs.tsx
|
|
2222
1879
|
import * as React4 from "react";
|
|
@@ -2230,14 +1887,12 @@ var Container = styled3.div({
|
|
|
2230
1887
|
overflow: "hidden",
|
|
2231
1888
|
display: "flex",
|
|
2232
1889
|
flexDirection: "column"
|
|
2233
|
-
})
|
|
2234
|
-
var ActionsWrapper = styled3.div({
|
|
1890
|
+
}), ActionsWrapper = styled3.div({
|
|
2235
1891
|
display: "flex",
|
|
2236
1892
|
justifyContent: "flex-end",
|
|
2237
1893
|
gap: 6
|
|
2238
|
-
})
|
|
2239
|
-
|
|
2240
|
-
const {
|
|
1894
|
+
}), Tabs = ({ tabs }) => {
|
|
1895
|
+
let {
|
|
2241
1896
|
tab,
|
|
2242
1897
|
setTab,
|
|
2243
1898
|
toggleHighlight,
|
|
@@ -2246,13 +1901,12 @@ var Tabs = /* @__PURE__ */ __name(({ tabs }) => {
|
|
|
2246
1901
|
allExpanded,
|
|
2247
1902
|
handleCollapseAll,
|
|
2248
1903
|
handleExpandAll
|
|
2249
|
-
} = useA11yContext();
|
|
2250
|
-
const theme2 = useTheme();
|
|
1904
|
+
} = useA11yContext(), theme2 = useTheme();
|
|
2251
1905
|
return React4.createElement(Container, null, React4.createElement(
|
|
2252
1906
|
TabsView,
|
|
2253
1907
|
{
|
|
2254
1908
|
backgroundColor: theme2.background.app,
|
|
2255
|
-
panelProps: { hasScrollbar:
|
|
1909
|
+
panelProps: { hasScrollbar: !0 },
|
|
2256
1910
|
tabs: tabs.map((tab2) => ({
|
|
2257
1911
|
id: tab2.type,
|
|
2258
1912
|
title: tab2.label,
|
|
@@ -2291,7 +1945,7 @@ var Tabs = /* @__PURE__ */ __name(({ tabs }) => {
|
|
|
2291
1945
|
))
|
|
2292
1946
|
}
|
|
2293
1947
|
));
|
|
2294
|
-
}
|
|
1948
|
+
};
|
|
2295
1949
|
|
|
2296
1950
|
// src/components/TestDiscrepancyMessage.tsx
|
|
2297
1951
|
import React5, { useMemo as useMemo2 } from "react";
|
|
@@ -2318,15 +1972,12 @@ var Wrapper3 = styled4.div(({ theme: { color, typography, background } }) => ({
|
|
|
2318
1972
|
borderRadius: "2px",
|
|
2319
1973
|
boxShadow: "0 0 0 1px rgba(0, 0, 0, 0.1)"
|
|
2320
1974
|
}
|
|
2321
|
-
}))
|
|
2322
|
-
|
|
2323
|
-
const api = useStorybookApi2();
|
|
2324
|
-
const docsUrl = api.getDocsUrl({
|
|
1975
|
+
})), TestDiscrepancyMessage = ({ discrepancy }) => {
|
|
1976
|
+
let docsUrl = useStorybookApi2().getDocsUrl({
|
|
2325
1977
|
subpath: DOCUMENTATION_DISCREPANCY_LINK,
|
|
2326
|
-
versioned:
|
|
2327
|
-
renderer:
|
|
2328
|
-
})
|
|
2329
|
-
const message = useMemo2(() => {
|
|
1978
|
+
versioned: !0,
|
|
1979
|
+
renderer: !0
|
|
1980
|
+
}), message = useMemo2(() => {
|
|
2330
1981
|
switch (discrepancy) {
|
|
2331
1982
|
case "browserPassedCliFailed":
|
|
2332
1983
|
return "Accessibility checks passed in this browser but failed in the CLI.";
|
|
@@ -2338,23 +1989,18 @@ var TestDiscrepancyMessage = /* @__PURE__ */ __name(({ discrepancy }) => {
|
|
|
2338
1989
|
return null;
|
|
2339
1990
|
}
|
|
2340
1991
|
}, [discrepancy]);
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
}
|
|
2344
|
-
return React5.createElement(Wrapper3, null, message, " ", React5.createElement(Link2, { href: docsUrl, target: "_blank", withArrow: true }, "Learn what could cause this"));
|
|
2345
|
-
}, "TestDiscrepancyMessage");
|
|
1992
|
+
return message ? React5.createElement(Wrapper3, null, message, " ", React5.createElement(Link2, { href: docsUrl, target: "_blank", withArrow: !0 }, "Learn what could cause this")) : null;
|
|
1993
|
+
};
|
|
2346
1994
|
|
|
2347
1995
|
// src/components/A11YPanel.tsx
|
|
2348
1996
|
var RotatingIcon = styled5(SyncIcon2)(({ theme: theme2 }) => ({
|
|
2349
1997
|
animation: `${theme2.animation.rotate360} 1s linear infinite;`,
|
|
2350
1998
|
margin: 4
|
|
2351
|
-
}))
|
|
2352
|
-
var Tab = styled5.div({
|
|
1999
|
+
})), Tab = styled5.div({
|
|
2353
2000
|
display: "flex",
|
|
2354
2001
|
alignItems: "center",
|
|
2355
2002
|
gap: 6
|
|
2356
|
-
})
|
|
2357
|
-
var Centered = styled5.span(({ theme: theme2 }) => ({
|
|
2003
|
+
}), Centered = styled5.span(({ theme: theme2 }) => ({
|
|
2358
2004
|
display: "flex",
|
|
2359
2005
|
flexDirection: "column",
|
|
2360
2006
|
alignItems: "center",
|
|
@@ -2381,9 +2027,8 @@ var Centered = styled5.span(({ theme: theme2 }) => ({
|
|
|
2381
2027
|
borderRadius: 4,
|
|
2382
2028
|
padding: "2px 3px"
|
|
2383
2029
|
}
|
|
2384
|
-
}))
|
|
2385
|
-
|
|
2386
|
-
const {
|
|
2030
|
+
})), A11YPanel = () => {
|
|
2031
|
+
let {
|
|
2387
2032
|
parameters,
|
|
2388
2033
|
tab,
|
|
2389
2034
|
results,
|
|
@@ -2394,16 +2039,15 @@ var A11YPanel = /* @__PURE__ */ __name(() => {
|
|
|
2394
2039
|
handleSelectionChange,
|
|
2395
2040
|
selectedItems,
|
|
2396
2041
|
toggleOpen
|
|
2397
|
-
} = useA11yContext()
|
|
2398
|
-
|
|
2399
|
-
const { passes, incomplete, violations } = results ?? {
|
|
2042
|
+
} = useA11yContext(), tabs = useMemo3(() => {
|
|
2043
|
+
let { passes, incomplete, violations } = results ?? {
|
|
2400
2044
|
passes: [],
|
|
2401
2045
|
incomplete: [],
|
|
2402
2046
|
violations: []
|
|
2403
2047
|
};
|
|
2404
2048
|
return [
|
|
2405
2049
|
{
|
|
2406
|
-
label: React6.createElement(Tab, null, "Violations", React6.createElement(Badge2, { compact:
|
|
2050
|
+
label: React6.createElement(Tab, null, "Violations", React6.createElement(Badge2, { compact: !0, status: tab === "violations" ? "active" : "neutral" }, violations.length)),
|
|
2407
2051
|
panel: React6.createElement(
|
|
2408
2052
|
Report,
|
|
2409
2053
|
{
|
|
@@ -2419,7 +2063,7 @@ var A11YPanel = /* @__PURE__ */ __name(() => {
|
|
|
2419
2063
|
type: RuleType.VIOLATION
|
|
2420
2064
|
},
|
|
2421
2065
|
{
|
|
2422
|
-
label: React6.createElement(Tab, null, "Passes", React6.createElement(Badge2, { compact:
|
|
2066
|
+
label: React6.createElement(Tab, null, "Passes", React6.createElement(Badge2, { compact: !0, status: tab === "passes" ? "active" : "neutral" }, passes.length)),
|
|
2423
2067
|
panel: React6.createElement(
|
|
2424
2068
|
Report,
|
|
2425
2069
|
{
|
|
@@ -2435,7 +2079,7 @@ var A11YPanel = /* @__PURE__ */ __name(() => {
|
|
|
2435
2079
|
type: RuleType.PASS
|
|
2436
2080
|
},
|
|
2437
2081
|
{
|
|
2438
|
-
label: React6.createElement(Tab, null, "Inconclusive", React6.createElement(Badge2, { compact:
|
|
2082
|
+
label: React6.createElement(Tab, null, "Inconclusive", React6.createElement(Badge2, { compact: !0, status: tab === "incomplete" ? "active" : "neutral" }, incomplete.length)),
|
|
2439
2083
|
panel: React6.createElement(
|
|
2440
2084
|
Report,
|
|
2441
2085
|
{
|
|
@@ -2452,11 +2096,8 @@ var A11YPanel = /* @__PURE__ */ __name(() => {
|
|
|
2452
2096
|
}
|
|
2453
2097
|
];
|
|
2454
2098
|
}, [tab, results, handleSelectionChange, selectedItems, toggleOpen]);
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
}
|
|
2458
|
-
return React6.createElement(React6.Fragment, null, discrepancy && React6.createElement(TestDiscrepancyMessage, { discrepancy }), status === "ready" || status === "ran" ? React6.createElement(Tabs, { key: "tabs", tabs }) : React6.createElement(Centered, { style: { marginTop: discrepancy ? "1em" : 0 } }, status === "initial" && React6.createElement("div", null, React6.createElement(RotatingIcon, { size: 12 }), React6.createElement("strong", null, "Preparing accessibility scan"), React6.createElement("p", null, "Please wait while the addon is initializing...")), status === "manual" && React6.createElement(React6.Fragment, null, React6.createElement("div", null, React6.createElement("strong", null, "Accessibility tests run manually for this story"), React6.createElement("p", null, "Results will not show when using the testing module. You can still run accessibility tests manually.")), React6.createElement(Button4, { ariaLabel: false, size: "medium", onClick: handleManual }, "Run accessibility scan"), React6.createElement("p", null, "Update ", React6.createElement("code", null, "globals.a11y.manual"), " to disable manual mode.")), status === "running" && React6.createElement("div", null, React6.createElement(RotatingIcon, { size: 12 }), React6.createElement("strong", null, "Accessibility scan in progress"), React6.createElement("p", null, "Please wait while the accessibility scan is running...")), status === "error" && React6.createElement(React6.Fragment, null, React6.createElement("div", null, React6.createElement("strong", null, "The accessibility scan encountered an error"), React6.createElement("p", null, typeof error === "string" ? error : error instanceof Error ? error.toString() : JSON.stringify(error, null, 2))), React6.createElement(Button4, { ariaLabel: false, size: "medium", onClick: handleManual }, "Rerun accessibility scan")), status === "component-test-error" && React6.createElement(React6.Fragment, null, React6.createElement("div", null, React6.createElement("strong", null, "This story's component tests failed"), React6.createElement("p", null, "Automated accessibility tests will not run until this is resolved. You can still test manually.")), React6.createElement(Button4, { ariaLabel: false, size: "medium", onClick: handleManual }, "Run accessibility scan"))));
|
|
2459
|
-
}, "A11YPanel");
|
|
2099
|
+
return parameters.disable || parameters.test === "off" ? React6.createElement(Centered, null, React6.createElement("div", null, React6.createElement("strong", null, "Accessibility tests are disabled for this story"), React6.createElement("p", null, "Update", " ", React6.createElement("code", null, parameters.disable ? "parameters.a11y.disable" : "parameters.a11y.test"), " ", "to enable accessibility tests."))) : React6.createElement(React6.Fragment, null, discrepancy && React6.createElement(TestDiscrepancyMessage, { discrepancy }), status === "ready" || status === "ran" ? React6.createElement(Tabs, { key: "tabs", tabs }) : React6.createElement(Centered, { style: { marginTop: discrepancy ? "1em" : 0 } }, status === "initial" && React6.createElement("div", null, React6.createElement(RotatingIcon, { size: 12 }), React6.createElement("strong", null, "Preparing accessibility scan"), React6.createElement("p", null, "Please wait while the addon is initializing...")), status === "manual" && React6.createElement(React6.Fragment, null, React6.createElement("div", null, React6.createElement("strong", null, "Accessibility tests run manually for this story"), React6.createElement("p", null, "Results will not show when using the testing module. You can still run accessibility tests manually.")), React6.createElement(Button4, { ariaLabel: !1, size: "medium", onClick: handleManual }, "Run accessibility scan"), React6.createElement("p", null, "Update ", React6.createElement("code", null, "globals.a11y.manual"), " to disable manual mode.")), status === "running" && React6.createElement("div", null, React6.createElement(RotatingIcon, { size: 12 }), React6.createElement("strong", null, "Accessibility scan in progress"), React6.createElement("p", null, "Please wait while the accessibility scan is running...")), status === "error" && React6.createElement(React6.Fragment, null, React6.createElement("div", null, React6.createElement("strong", null, "The accessibility scan encountered an error"), React6.createElement("p", null, typeof error == "string" ? error : error instanceof Error ? error.toString() : JSON.stringify(error, null, 2))), React6.createElement(Button4, { ariaLabel: !1, size: "medium", onClick: handleManual }, "Rerun accessibility scan")), status === "component-test-error" && React6.createElement(React6.Fragment, null, React6.createElement("div", null, React6.createElement("strong", null, "This story's component tests failed"), React6.createElement("p", null, "Automated accessibility tests will not run until this is resolved. You can still test manually.")), React6.createElement(Button4, { ariaLabel: !1, size: "medium", onClick: handleManual }, "Run accessibility scan"))));
|
|
2100
|
+
};
|
|
2460
2101
|
|
|
2461
2102
|
// src/components/VisionSimulator.tsx
|
|
2462
2103
|
import React8, { useState as useState4 } from "react";
|
|
@@ -2466,7 +2107,7 @@ import { Global, styled as styled6 } from "storybook/theming";
|
|
|
2466
2107
|
|
|
2467
2108
|
// src/components/ColorFilters.tsx
|
|
2468
2109
|
import * as React7 from "react";
|
|
2469
|
-
var Filters =
|
|
2110
|
+
var Filters = (props) => React7.createElement("svg", { ...props }, React7.createElement("defs", null, React7.createElement("filter", { id: "protanopia" }, React7.createElement(
|
|
2470
2111
|
"feColorMatrix",
|
|
2471
2112
|
{
|
|
2472
2113
|
in: "SourceGraphic",
|
|
@@ -2515,11 +2156,10 @@ var Filters = /* @__PURE__ */ __name((props) => React7.createElement("svg", { ..
|
|
|
2515
2156
|
type: "matrix",
|
|
2516
2157
|
values: "0.299, 0.587, 0.114, 0, 0 0.299, 0.587, 0.114, 0, 0 0.299, 0.587, 0.114, 0, 0 0, 0, 0, 1, 0"
|
|
2517
2158
|
}
|
|
2518
|
-
))))
|
|
2159
|
+
))));
|
|
2519
2160
|
|
|
2520
2161
|
// src/components/VisionSimulator.tsx
|
|
2521
|
-
var iframeId = "storybook-preview-iframe"
|
|
2522
|
-
var baseList = [
|
|
2162
|
+
var iframeId = "storybook-preview-iframe", baseList = [
|
|
2523
2163
|
{ name: "blurred vision", percentage: 22.9 },
|
|
2524
2164
|
{ name: "deuteranomaly", percentage: 2.7 },
|
|
2525
2165
|
{ name: "deuteranopia", percentage: 0.56 },
|
|
@@ -2529,27 +2169,13 @@ var baseList = [
|
|
|
2529
2169
|
{ name: "tritanopia", percentage: 0.016 },
|
|
2530
2170
|
{ name: "achromatopsia", percentage: 1e-4 },
|
|
2531
2171
|
{ name: "grayscale" }
|
|
2532
|
-
]
|
|
2533
|
-
var getFilter = /* @__PURE__ */ __name((filterName) => {
|
|
2534
|
-
if (!filterName) {
|
|
2535
|
-
return "none";
|
|
2536
|
-
}
|
|
2537
|
-
if (filterName === "blurred vision") {
|
|
2538
|
-
return "blur(2px)";
|
|
2539
|
-
}
|
|
2540
|
-
if (filterName === "grayscale") {
|
|
2541
|
-
return "grayscale(100%)";
|
|
2542
|
-
}
|
|
2543
|
-
return `url('#${filterName}')`;
|
|
2544
|
-
}, "getFilter");
|
|
2545
|
-
var Hidden = styled6.div({
|
|
2172
|
+
], getFilter = (filterName) => filterName ? filterName === "blurred vision" ? "blur(2px)" : filterName === "grayscale" ? "grayscale(100%)" : `url('#${filterName}')` : "none", Hidden = styled6.div({
|
|
2546
2173
|
"&, & svg": {
|
|
2547
2174
|
position: "absolute",
|
|
2548
2175
|
width: 0,
|
|
2549
2176
|
height: 0
|
|
2550
2177
|
}
|
|
2551
|
-
})
|
|
2552
|
-
var ColorIcon = styled6.span(
|
|
2178
|
+
}), ColorIcon = styled6.span(
|
|
2553
2179
|
{
|
|
2554
2180
|
background: "linear-gradient(to right, #F44336, #FF9800, #FFEB3B, #8BC34A, #2196F3, #9C27B0)",
|
|
2555
2181
|
borderRadius: "1rem",
|
|
@@ -2563,11 +2189,9 @@ var ColorIcon = styled6.span(
|
|
|
2563
2189
|
({ theme: theme2 }) => ({
|
|
2564
2190
|
boxShadow: `${theme2.appBorderColor} 0 0 0 1px inset`
|
|
2565
2191
|
})
|
|
2566
|
-
)
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
const options = baseList.map(({ name, percentage }) => {
|
|
2570
|
-
const description = percentage !== void 0 ? `${percentage}% of users` : void 0;
|
|
2192
|
+
), VisionSimulator = () => {
|
|
2193
|
+
let [filter, setFilter] = useState4(null), options = baseList.map(({ name, percentage }) => {
|
|
2194
|
+
let description = percentage !== void 0 ? `${percentage}% of users` : void 0;
|
|
2571
2195
|
return {
|
|
2572
2196
|
title: name,
|
|
2573
2197
|
description,
|
|
@@ -2596,38 +2220,31 @@ var VisionSimulator = /* @__PURE__ */ __name(() => {
|
|
|
2596
2220
|
onSelect: (selected) => setFilter(() => ({ name: selected }))
|
|
2597
2221
|
}
|
|
2598
2222
|
), React8.createElement(Hidden, null, React8.createElement(Filters, null)));
|
|
2599
|
-
}
|
|
2223
|
+
};
|
|
2600
2224
|
|
|
2601
2225
|
// src/manager.tsx
|
|
2602
|
-
var Title2 =
|
|
2603
|
-
|
|
2604
|
-
const selectedPanel = api.getSelectedPanel();
|
|
2605
|
-
const [{ results }] = useAddonState2(ADDON_ID, {
|
|
2226
|
+
var Title2 = () => {
|
|
2227
|
+
let selectedPanel = useStorybookApi3().getSelectedPanel(), [{ results }] = useAddonState2(ADDON_ID, {
|
|
2606
2228
|
ui: {
|
|
2607
|
-
highlighted:
|
|
2229
|
+
highlighted: !1,
|
|
2608
2230
|
tab: RuleType.VIOLATION
|
|
2609
2231
|
},
|
|
2610
2232
|
results: void 0,
|
|
2611
2233
|
error: void 0,
|
|
2612
2234
|
status: "initial"
|
|
2613
|
-
});
|
|
2614
|
-
const violationsNb = results?.violations?.length ?? 0;
|
|
2615
|
-
const incompleteNb = results?.incomplete?.length ?? 0;
|
|
2616
|
-
const count = violationsNb + incompleteNb;
|
|
2617
|
-
const suffix = count === 0 ? null : React9.createElement(Badge3, { compact: true, status: selectedPanel === PANEL_ID ? "active" : "neutral" }, count);
|
|
2235
|
+
}), violationsNb = results?.violations?.length ?? 0, incompleteNb = results?.incomplete?.length ?? 0, count = violationsNb + incompleteNb, suffix = count === 0 ? null : React9.createElement(Badge3, { compact: !0, status: selectedPanel === PANEL_ID ? "active" : "neutral" }, count);
|
|
2618
2236
|
return React9.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6 } }, React9.createElement("span", null, "Accessibility"), suffix);
|
|
2619
|
-
}
|
|
2237
|
+
};
|
|
2620
2238
|
addons.register(ADDON_ID, (api) => {
|
|
2621
2239
|
addons.add(PANEL_ID, {
|
|
2622
2240
|
title: "",
|
|
2623
2241
|
type: types.TOOL,
|
|
2624
|
-
match:
|
|
2625
|
-
render:
|
|
2626
|
-
})
|
|
2627
|
-
addons.add(PANEL_ID, {
|
|
2242
|
+
match: ({ viewMode, tabId }) => viewMode === "story" && !tabId,
|
|
2243
|
+
render: () => React9.createElement(VisionSimulator, null)
|
|
2244
|
+
}), addons.add(PANEL_ID, {
|
|
2628
2245
|
title: Title2,
|
|
2629
2246
|
type: types.PANEL,
|
|
2630
|
-
render:
|
|
2247
|
+
render: ({ active = !0 }) => React9.createElement(A11yContextProvider, null, active ? React9.createElement(A11YPanel, null) : null),
|
|
2631
2248
|
paramKey: PARAM_KEY
|
|
2632
2249
|
});
|
|
2633
2250
|
});
|