storybook 10.0.0-beta.7 → 10.0.0-beta.9
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/_node-chunks/{builder-manager-VFP7HSCF.js → builder-manager-ZMBCXQXV.js} +30 -15
- package/dist/_node-chunks/camelcase-JMK43JMF.js +18 -0
- package/dist/_node-chunks/{chunk-Z3PLI7S2.js → chunk-2RLHFYFA.js} +7 -7
- package/dist/_node-chunks/chunk-5G7GJHS7.js +62 -0
- package/dist/_node-chunks/{chunk-KVOP6ASA.js → chunk-75N2O5FL.js} +7 -7
- package/dist/_node-chunks/chunk-7VDHEICM.js +18 -0
- package/dist/_node-chunks/{chunk-2GCKJYK6.js → chunk-A33ZDBWG.js} +7 -7
- package/dist/_node-chunks/{chunk-3NIQHNDU.js → chunk-AEVVTNDL.js} +7 -7
- package/dist/_node-chunks/{chunk-XXVKM2ZR.js → chunk-AV6DOLF6.js} +104 -75
- package/dist/_node-chunks/{chunk-TXDIOSHI.js → chunk-B5W4OROC.js} +9 -9
- package/dist/_node-chunks/{chunk-3XXQRL3A.js → chunk-BUQRXXWE.js} +7 -7
- package/dist/_node-chunks/{chunk-ZM2HT2RW.js → chunk-CALGSUC5.js} +6 -6
- package/dist/_node-chunks/{chunk-FCNWWJV7.js → chunk-GEDTSFBQ.js} +7 -7
- package/dist/_node-chunks/{chunk-C4EOB63P.js → chunk-I5NPNO3G.js} +7 -7
- package/dist/_node-chunks/{chunk-A2DKPKBY.js → chunk-IXMF5FBT.js} +7 -7
- package/dist/_node-chunks/{chunk-5YUTWYNI.js → chunk-JIERQ4FU.js} +9 -9
- package/dist/_node-chunks/{chunk-U6MJQ7C6.js → chunk-JVFB6XG6.js} +72 -8
- package/dist/_node-chunks/{chunk-TFIGR2HH.js → chunk-LTKYC6VP.js} +7 -7
- package/dist/_node-chunks/{chunk-GBZZSL2K.js → chunk-NEEUVKLS.js} +8 -8
- package/dist/_node-chunks/{chunk-MRCMZPA2.js → chunk-NRBIODYE.js} +7 -7
- package/dist/_node-chunks/{chunk-MHVF6Y35.js → chunk-O2AHQDZJ.js} +7 -7
- package/dist/_node-chunks/{chunk-ZPNXCXIT.js → chunk-R4BIB4NX.js} +8 -8
- package/dist/_node-chunks/{chunk-RP3VMQPF.js → chunk-TO3ARZYO.js} +21 -27
- package/dist/_node-chunks/{chunk-I7SRMFT5.js → chunk-U3LOLMF3.js} +7 -7
- package/dist/_node-chunks/{chunk-3QZ7KLON.js → chunk-U3TBYKZA.js} +8 -8
- package/dist/_node-chunks/{chunk-BID2X7MU.js → chunk-UOCLAXMF.js} +7 -7
- package/dist/_node-chunks/{chunk-4DIDWIST.js → chunk-V5DK6ZKU.js} +7 -7
- package/dist/_node-chunks/{chunk-46BWYN3K.js → chunk-V6E6RSUO.js} +7 -7
- package/dist/_node-chunks/{chunk-IGWCAXA2.js → chunk-VM3IJPAW.js} +7 -7
- package/dist/_node-chunks/{chunk-YWU65VY4.js → chunk-XBOE5GD4.js} +6 -6
- package/dist/_node-chunks/{chunk-GCWAGPDV.js → chunk-XHXUIPIC.js} +12 -12
- package/dist/_node-chunks/{chunk-IEFSRAX2.js → chunk-XYRZ6AGE.js} +10 -10
- package/dist/_node-chunks/{chunk-DH7BCQMG.js → chunk-Z6UKYBDV.js} +8 -8
- package/dist/_node-chunks/{dist-PG4I7ZDU.js → dist-HAF4OXIQ.js} +9 -9
- package/dist/_node-chunks/{globby-HXB6X43W.js → globby-HUMXQF7C.js} +9 -9
- package/dist/_node-chunks/{lib-4JJTZC7T.js → lib-TOFZQAVG.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-3JBJ7PQF.js → mdx-N42X6CFJ-LCPMSYGS.js} +8 -8
- package/dist/_node-chunks/{p-limit-WBBNX4KI.js → p-limit-JSCSHFNF.js} +7 -7
- package/dist/_node-chunks/{plugin-SEQ2OPRK.js → plugin-4OW72VQ5.js} +10 -10
- package/dist/_node-chunks/{plugin-SG6I7RFC.js → plugin-XRJQD5ND.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-5O25VYCQ.js → webpack-inject-mocker-runtime-plugin-XI7KJK6X.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-35I32SAF.js → webpack-mock-plugin-6BAMUAJ3.js} +9 -9
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +11 -11
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +8 -8
- package/dist/cli/index.js +20 -20
- package/dist/common/index.js +20 -21
- package/dist/components/index.js +2 -2
- package/dist/core-server/index.js +34 -35
- package/dist/core-server/presets/common-manager.js +551 -512
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +22 -22
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +3 -3
- package/dist/manager/runtime.js +42 -15
- package/dist/manager-api/index.js +4 -4
- package/dist/node-logger/index.js +14 -14
- package/dist/preview/globals.js +1 -1
- package/dist/preview/runtime.js +1 -1
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +23 -24
- package/package.json +1 -33
- package/dist/_node-chunks/camelcase-ZLZNQMDD.js +0 -18
- package/dist/_node-chunks/chunk-BC23FKU4.js +0 -80
- package/dist/_node-chunks/chunk-IYOHZPPC.js +0 -18
- package/dist/_node-chunks/chunk-RNHUADRS.js +0 -62
|
@@ -71,7 +71,7 @@ import { global as global3 } from "@storybook/global";
|
|
|
71
71
|
import { addons as addons8 } from "storybook/manager-api";
|
|
72
72
|
|
|
73
73
|
// src/controls/manager.tsx
|
|
74
|
-
import
|
|
74
|
+
import React40 from "react";
|
|
75
75
|
import { AddonPanel } from "storybook/internal/components";
|
|
76
76
|
import { SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE } from "storybook/internal/core-events";
|
|
77
77
|
import { FailedIcon, PassedIcon } from "@storybook/icons";
|
|
@@ -79,7 +79,7 @@ import { addons, experimental_requestResponse, types } from "storybook/manager-a
|
|
|
79
79
|
import { color } from "storybook/theming";
|
|
80
80
|
|
|
81
81
|
// src/controls/components/ControlsPanel.tsx
|
|
82
|
-
import
|
|
82
|
+
import React38, { useEffect as useEffect11, useMemo as useMemo3, useState as useState14 } from "react";
|
|
83
83
|
import { global } from "@storybook/global";
|
|
84
84
|
import {
|
|
85
85
|
useArgTypes,
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
import { styled as styled30 } from "storybook/theming";
|
|
93
93
|
|
|
94
94
|
// ../addons/docs/src/blocks/components/ArgsTable/ArgsTable.tsx
|
|
95
|
-
import
|
|
95
|
+
import React36 from "react";
|
|
96
96
|
import { once } from "storybook/internal/client-logger";
|
|
97
97
|
import { IconButton as IconButton3, Link as Link3, ResetWrapper as ResetWrapper3 } from "storybook/internal/components";
|
|
98
98
|
import { includeConditionalArg } from "storybook/internal/csf";
|
|
@@ -600,10 +600,37 @@ var DocsWrapper = styled3.div(({ theme: theme3 }) => ({
|
|
|
600
600
|
}));
|
|
601
601
|
|
|
602
602
|
// ../addons/docs/src/blocks/components/Preview.tsx
|
|
603
|
-
import
|
|
603
|
+
import React8, { Children, useCallback, useContext as useContext2, useState as useState3 } from "react";
|
|
604
604
|
import { ActionBar, Zoom } from "storybook/internal/components";
|
|
605
605
|
import { styled as styled6 } from "storybook/theming";
|
|
606
606
|
|
|
607
|
+
// ../addons/docs/src/blocks/blocks/DocsContext.ts
|
|
608
|
+
import { createContext } from "react";
|
|
609
|
+
if (globalThis && globalThis.__DOCS_CONTEXT__ === void 0) {
|
|
610
|
+
globalThis.__DOCS_CONTEXT__ = createContext(null);
|
|
611
|
+
globalThis.__DOCS_CONTEXT__.displayName = "DocsContext";
|
|
612
|
+
}
|
|
613
|
+
var DocsContext = globalThis ? globalThis.__DOCS_CONTEXT__ : createContext(null);
|
|
614
|
+
|
|
615
|
+
// ../addons/docs/src/blocks/blocks/Story.tsx
|
|
616
|
+
import React4, { useContext } from "react";
|
|
617
|
+
|
|
618
|
+
// ../addons/docs/src/blocks/blocks/useStory.ts
|
|
619
|
+
import { useEffect, useState } from "react";
|
|
620
|
+
|
|
621
|
+
// ../addons/docs/src/blocks/blocks/Story.tsx
|
|
622
|
+
var getStoryId = /* @__PURE__ */ __name((props, context) => {
|
|
623
|
+
const { of, meta } = props;
|
|
624
|
+
if ("of" in props && of === void 0) {
|
|
625
|
+
throw new Error("Unexpected `of={undefined}`, did you mistype a CSF file reference?");
|
|
626
|
+
}
|
|
627
|
+
if (meta) {
|
|
628
|
+
context.referenceMeta(meta, false);
|
|
629
|
+
}
|
|
630
|
+
const resolved = context.resolveOf(of || "story", ["story"]);
|
|
631
|
+
return resolved.story.id;
|
|
632
|
+
}, "getStoryId");
|
|
633
|
+
|
|
607
634
|
// ../addons/docs/src/blocks/components/BlockBackgroundStyles.tsx
|
|
608
635
|
var getBlockBackgroundStyle = /* @__PURE__ */ __name((theme3) => ({
|
|
609
636
|
borderRadius: theme3.appBorderRadius,
|
|
@@ -613,17 +640,17 @@ var getBlockBackgroundStyle = /* @__PURE__ */ __name((theme3) => ({
|
|
|
613
640
|
}), "getBlockBackgroundStyle");
|
|
614
641
|
|
|
615
642
|
// ../addons/docs/src/blocks/components/Story.tsx
|
|
616
|
-
import
|
|
643
|
+
import React6, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
617
644
|
import { ErrorFormatter, Loader, getStoryHref } from "storybook/internal/components";
|
|
618
645
|
import { styled as styled4 } from "storybook/theming";
|
|
619
646
|
|
|
620
647
|
// ../addons/docs/src/blocks/components/IFrame.tsx
|
|
621
|
-
import
|
|
648
|
+
import React5, { Component } from "react";
|
|
622
649
|
var { window: globalWindow } = globalThis;
|
|
623
650
|
|
|
624
651
|
// ../addons/docs/src/blocks/components/ZoomContext.tsx
|
|
625
|
-
import { createContext } from "react";
|
|
626
|
-
var ZoomContext =
|
|
652
|
+
import { createContext as createContext2 } from "react";
|
|
653
|
+
var ZoomContext = createContext2({
|
|
627
654
|
scale: 1
|
|
628
655
|
});
|
|
629
656
|
|
|
@@ -634,9 +661,9 @@ var ErrorMessage = styled4.strong(({ theme: theme3 }) => ({
|
|
|
634
661
|
}));
|
|
635
662
|
|
|
636
663
|
// ../addons/docs/src/blocks/components/Toolbar.tsx
|
|
637
|
-
import
|
|
638
|
-
import { FlexBar, IconButton } from "storybook/internal/components";
|
|
639
|
-
import { ZoomIcon, ZoomOutIcon, ZoomResetIcon } from "@storybook/icons";
|
|
664
|
+
import React7 from "react";
|
|
665
|
+
import { FlexBar, IconButton, getStoryHref as getStoryHref2 } from "storybook/internal/components";
|
|
666
|
+
import { ShareAltIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon } from "@storybook/icons";
|
|
640
667
|
import { styled as styled5 } from "storybook/theming";
|
|
641
668
|
var Bar = styled5(FlexBar)({
|
|
642
669
|
position: "absolute",
|
|
@@ -665,7 +692,7 @@ var Toolbar = /* @__PURE__ */ __name(({
|
|
|
665
692
|
zoom,
|
|
666
693
|
resetZoom,
|
|
667
694
|
...rest
|
|
668
|
-
}) =>
|
|
695
|
+
}) => React7.createElement(Bar, { ...rest }, React7.createElement(Wrapper2, { key: "left" }, isLoading ? [1, 2, 3].map((key) => React7.createElement(IconPlaceholder, { key })) : React7.createElement(React7.Fragment, null, React7.createElement(
|
|
669
696
|
IconButton,
|
|
670
697
|
{
|
|
671
698
|
key: "zoomin",
|
|
@@ -675,8 +702,8 @@ var Toolbar = /* @__PURE__ */ __name(({
|
|
|
675
702
|
},
|
|
676
703
|
title: "Zoom in"
|
|
677
704
|
},
|
|
678
|
-
|
|
679
|
-
),
|
|
705
|
+
React7.createElement(ZoomIcon, null)
|
|
706
|
+
), React7.createElement(
|
|
680
707
|
IconButton,
|
|
681
708
|
{
|
|
682
709
|
key: "zoomout",
|
|
@@ -686,8 +713,8 @@ var Toolbar = /* @__PURE__ */ __name(({
|
|
|
686
713
|
},
|
|
687
714
|
title: "Zoom out"
|
|
688
715
|
},
|
|
689
|
-
|
|
690
|
-
),
|
|
716
|
+
React7.createElement(ZoomOutIcon, null)
|
|
717
|
+
), React7.createElement(
|
|
691
718
|
IconButton,
|
|
692
719
|
{
|
|
693
720
|
key: "zoomreset",
|
|
@@ -697,7 +724,16 @@ var Toolbar = /* @__PURE__ */ __name(({
|
|
|
697
724
|
},
|
|
698
725
|
title: "Reset zoom"
|
|
699
726
|
},
|
|
700
|
-
|
|
727
|
+
React7.createElement(ZoomResetIcon, null)
|
|
728
|
+
))), isLoading ? React7.createElement(Wrapper2, { key: "right" }, React7.createElement(IconPlaceholder, null)) : baseUrl && storyId && React7.createElement(Wrapper2, { key: "right" }, React7.createElement(IconButton, { key: "opener", asChild: true }, React7.createElement(
|
|
729
|
+
"a",
|
|
730
|
+
{
|
|
731
|
+
href: getStoryHref2(baseUrl, storyId),
|
|
732
|
+
target: "_blank",
|
|
733
|
+
rel: "noopener noreferrer",
|
|
734
|
+
"aria-label": "Open canvas in new tab"
|
|
735
|
+
},
|
|
736
|
+
React7.createElement(ShareAltIcon, null)
|
|
701
737
|
)))), "Toolbar");
|
|
702
738
|
|
|
703
739
|
// ../addons/docs/src/blocks/components/Preview.tsx
|
|
@@ -775,7 +811,7 @@ var getSource = /* @__PURE__ */ __name((withSource, expanded, setExpanded) => {
|
|
|
775
811
|
}
|
|
776
812
|
case expanded: {
|
|
777
813
|
return {
|
|
778
|
-
source:
|
|
814
|
+
source: React8.createElement(StyledSource, { ...withSource, dark: true }),
|
|
779
815
|
actionItem: {
|
|
780
816
|
title: "Hide code",
|
|
781
817
|
className: "docblock-code-toggle docblock-code-toggle--expanded",
|
|
@@ -785,7 +821,7 @@ var getSource = /* @__PURE__ */ __name((withSource, expanded, setExpanded) => {
|
|
|
785
821
|
}
|
|
786
822
|
default: {
|
|
787
823
|
return {
|
|
788
|
-
source:
|
|
824
|
+
source: React8.createElement(StyledSource, { ...withSource, dark: true }),
|
|
789
825
|
actionItem: {
|
|
790
826
|
title: "Show code",
|
|
791
827
|
className: "docblock-code-toggle",
|
|
@@ -795,16 +831,16 @@ var getSource = /* @__PURE__ */ __name((withSource, expanded, setExpanded) => {
|
|
|
795
831
|
}
|
|
796
832
|
}
|
|
797
833
|
}, "getSource");
|
|
798
|
-
function
|
|
834
|
+
function getChildProps(children) {
|
|
799
835
|
if (Children.count(children) === 1) {
|
|
800
836
|
const elt = children;
|
|
801
837
|
if (elt.props) {
|
|
802
|
-
return elt.props
|
|
838
|
+
return elt.props;
|
|
803
839
|
}
|
|
804
840
|
}
|
|
805
841
|
return null;
|
|
806
842
|
}
|
|
807
|
-
__name(
|
|
843
|
+
__name(getChildProps, "getChildProps");
|
|
808
844
|
var PositionedToolbar = styled6(Toolbar)({
|
|
809
845
|
position: "absolute",
|
|
810
846
|
top: 0,
|
|
@@ -830,16 +866,17 @@ var Preview = /* @__PURE__ */ __name(({
|
|
|
830
866
|
inline = false,
|
|
831
867
|
...props
|
|
832
868
|
}) => {
|
|
833
|
-
const [expanded, setExpanded] =
|
|
869
|
+
const [expanded, setExpanded] = useState3(isExpanded);
|
|
834
870
|
const { source, actionItem } = getSource(withSource, expanded, setExpanded);
|
|
835
|
-
const [scale, setScale] =
|
|
871
|
+
const [scale, setScale] = useState3(1);
|
|
836
872
|
const previewClasses = [className].concat(["sbdocs", "sbdocs-preview", "sb-unstyled"]);
|
|
837
873
|
const defaultActionItems = withSource ? [actionItem] : [];
|
|
838
|
-
const [additionalActionItems, setAdditionalActionItems] =
|
|
874
|
+
const [additionalActionItems, setAdditionalActionItems] = useState3(
|
|
839
875
|
additionalActions ? [...additionalActions] : []
|
|
840
876
|
);
|
|
841
877
|
const actionItems = [...defaultActionItems, ...additionalActionItems];
|
|
842
878
|
const { window: globalWindow3 } = globalThis;
|
|
879
|
+
const context = useContext2(DocsContext);
|
|
843
880
|
const copyToClipboard = useCallback(async (text) => {
|
|
844
881
|
const { createCopyToClipboardFunction } = await import("storybook/internal/components");
|
|
845
882
|
createCopyToClipboardFunction();
|
|
@@ -869,25 +906,26 @@ var Preview = /* @__PURE__ */ __name(({
|
|
|
869
906
|
});
|
|
870
907
|
}
|
|
871
908
|
}, "onCopyCapture");
|
|
872
|
-
|
|
909
|
+
const childProps = getChildProps(children);
|
|
910
|
+
return React8.createElement(
|
|
873
911
|
PreviewContainer,
|
|
874
912
|
{
|
|
875
913
|
...{ withSource, withToolbar },
|
|
876
914
|
...props,
|
|
877
915
|
className: previewClasses.join(" ")
|
|
878
916
|
},
|
|
879
|
-
withToolbar &&
|
|
917
|
+
withToolbar && React8.createElement(
|
|
880
918
|
PositionedToolbar,
|
|
881
919
|
{
|
|
882
920
|
isLoading,
|
|
883
921
|
border: true,
|
|
884
922
|
zoom: (z2) => setScale(scale * z2),
|
|
885
923
|
resetZoom: () => setScale(1),
|
|
886
|
-
storyId: getStoryId(
|
|
924
|
+
storyId: !isLoading && childProps ? getStoryId(childProps, context) : void 0,
|
|
887
925
|
baseUrl: "./iframe.html"
|
|
888
926
|
}
|
|
889
927
|
),
|
|
890
|
-
|
|
928
|
+
React8.createElement(ZoomContext.Provider, { value: { scale } }, React8.createElement(Relative, { className: "docs-story", onCopyCapture: withSource && onCopyCapture }, React8.createElement(
|
|
891
929
|
ChildrenContainer,
|
|
892
930
|
{
|
|
893
931
|
isColumn: isColumn || !Array.isArray(children),
|
|
@@ -895,8 +933,8 @@ var Preview = /* @__PURE__ */ __name(({
|
|
|
895
933
|
layout,
|
|
896
934
|
inline
|
|
897
935
|
},
|
|
898
|
-
|
|
899
|
-
),
|
|
936
|
+
React8.createElement(Zoom.Element, { centered: layout === "centered", scale: inline ? scale : 1 }, Array.isArray(children) ? children.map((child, i2) => React8.createElement("div", { key: i2 }, child)) : React8.createElement("div", null, children))
|
|
937
|
+
), React8.createElement(ActionBar, { actionItems }))),
|
|
900
938
|
withSource && expanded && source
|
|
901
939
|
);
|
|
902
940
|
}, "Preview");
|
|
@@ -908,11 +946,11 @@ var StyledPreview = styled6(Preview)(() => ({
|
|
|
908
946
|
}));
|
|
909
947
|
|
|
910
948
|
// ../addons/docs/src/blocks/components/ArgsTable/TabbedArgsTable.tsx
|
|
911
|
-
import
|
|
949
|
+
import React9 from "react";
|
|
912
950
|
import { TabsState } from "storybook/internal/components";
|
|
913
951
|
|
|
914
952
|
// ../addons/docs/src/blocks/components/Typeset.tsx
|
|
915
|
-
import
|
|
953
|
+
import React10 from "react";
|
|
916
954
|
import { withReset as withReset3 } from "storybook/internal/components";
|
|
917
955
|
import { styled as styled7 } from "storybook/theming";
|
|
918
956
|
var Label = styled7.div(({ theme: theme3 }) => ({
|
|
@@ -938,7 +976,7 @@ var Wrapper3 = styled7.div(withReset3, ({ theme: theme3 }) => ({
|
|
|
938
976
|
}));
|
|
939
977
|
|
|
940
978
|
// ../addons/docs/src/blocks/components/ColorPalette.tsx
|
|
941
|
-
import
|
|
979
|
+
import React11 from "react";
|
|
942
980
|
import { ResetWrapper } from "storybook/internal/components";
|
|
943
981
|
import { styled as styled8 } from "storybook/theming";
|
|
944
982
|
var ItemTitle = styled8.div(({ theme: theme3 }) => ({
|
|
@@ -1038,7 +1076,7 @@ var List = styled8.div(({ theme: theme3 }) => ({
|
|
|
1038
1076
|
}));
|
|
1039
1077
|
|
|
1040
1078
|
// ../addons/docs/src/blocks/components/IconGallery.tsx
|
|
1041
|
-
import
|
|
1079
|
+
import React12 from "react";
|
|
1042
1080
|
import { ResetWrapper as ResetWrapper2 } from "storybook/internal/components";
|
|
1043
1081
|
import { styled as styled9 } from "storybook/theming";
|
|
1044
1082
|
var ItemLabel = styled9.div(({ theme: theme3 }) => ({
|
|
@@ -1083,7 +1121,7 @@ var List2 = styled9.div({
|
|
|
1083
1121
|
});
|
|
1084
1122
|
|
|
1085
1123
|
// ../addons/docs/src/blocks/components/TableOfContents.tsx
|
|
1086
|
-
import
|
|
1124
|
+
import React13, { useEffect as useEffect3, useId } from "react";
|
|
1087
1125
|
import { NAVIGATE_URL } from "storybook/internal/core-events";
|
|
1088
1126
|
import { styled as styled10 } from "storybook/theming";
|
|
1089
1127
|
var Aside = styled10.aside(() => ({
|
|
@@ -1161,7 +1199,7 @@ var Heading = styled10.p(({ theme: theme3 }) => ({
|
|
|
1161
1199
|
}));
|
|
1162
1200
|
|
|
1163
1201
|
// ../addons/docs/src/blocks/components/ArgsTable/ArgRow.tsx
|
|
1164
|
-
import
|
|
1202
|
+
import React32, { useState as useState11 } from "react";
|
|
1165
1203
|
import { codeCommon as codeCommon3 } from "storybook/internal/components";
|
|
1166
1204
|
|
|
1167
1205
|
// ../node_modules/markdown-to-jsx/dist/index.modern.js
|
|
@@ -1625,14 +1663,14 @@ var index_modern_default = /* @__PURE__ */ __name((n2) => {
|
|
|
1625
1663
|
import { styled as styled24 } from "storybook/theming";
|
|
1626
1664
|
|
|
1627
1665
|
// ../addons/docs/src/blocks/components/ArgsTable/ArgControl.tsx
|
|
1628
|
-
import
|
|
1666
|
+
import React29, { useCallback as useCallback6, useEffect as useEffect9, useState as useState9 } from "react";
|
|
1629
1667
|
import { Link } from "storybook/internal/components";
|
|
1630
1668
|
|
|
1631
1669
|
// ../addons/docs/src/blocks/controls/index.tsx
|
|
1632
|
-
import
|
|
1670
|
+
import React28, { Suspense, lazy } from "react";
|
|
1633
1671
|
|
|
1634
1672
|
// ../addons/docs/src/blocks/controls/Boolean.tsx
|
|
1635
|
-
import
|
|
1673
|
+
import React14, { useCallback as useCallback2 } from "react";
|
|
1636
1674
|
import { Button } from "storybook/internal/components";
|
|
1637
1675
|
import { styled as styled11 } from "storybook/theming";
|
|
1638
1676
|
var Label2 = styled11.label(({ theme: theme3 }) => ({
|
|
@@ -1723,7 +1761,7 @@ var BooleanControl = /* @__PURE__ */ __name(({
|
|
|
1723
1761
|
const onSetFalse = useCallback2(() => onChange(false), [onChange]);
|
|
1724
1762
|
const readonly = !!argType?.table?.readonly;
|
|
1725
1763
|
if (value2 === void 0) {
|
|
1726
|
-
return
|
|
1764
|
+
return React14.createElement(
|
|
1727
1765
|
Button,
|
|
1728
1766
|
{
|
|
1729
1767
|
variant: "outline",
|
|
@@ -1737,7 +1775,7 @@ var BooleanControl = /* @__PURE__ */ __name(({
|
|
|
1737
1775
|
}
|
|
1738
1776
|
const controlId = getControlId(name);
|
|
1739
1777
|
const parsedValue = typeof value2 === "string" ? parse(value2) : value2;
|
|
1740
|
-
return
|
|
1778
|
+
return React14.createElement(Label2, { "aria-disabled": readonly, htmlFor: controlId, "aria-label": name }, React14.createElement(
|
|
1741
1779
|
"input",
|
|
1742
1780
|
{
|
|
1743
1781
|
id: controlId,
|
|
@@ -1748,11 +1786,11 @@ var BooleanControl = /* @__PURE__ */ __name(({
|
|
|
1748
1786
|
disabled: readonly,
|
|
1749
1787
|
...{ name, onBlur, onFocus }
|
|
1750
1788
|
}
|
|
1751
|
-
),
|
|
1789
|
+
), React14.createElement("span", { "aria-hidden": "true" }, "False"), React14.createElement("span", { "aria-hidden": "true" }, "True"));
|
|
1752
1790
|
}, "BooleanControl");
|
|
1753
1791
|
|
|
1754
1792
|
// ../addons/docs/src/blocks/controls/Date.tsx
|
|
1755
|
-
import
|
|
1793
|
+
import React15, { useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
|
|
1756
1794
|
import { Form } from "storybook/internal/components";
|
|
1757
1795
|
import { styled as styled12 } from "storybook/theming";
|
|
1758
1796
|
var parseDate = /* @__PURE__ */ __name((value2) => {
|
|
@@ -1807,11 +1845,11 @@ var FlexSpaced = styled12.div(({ theme: theme3 }) => ({
|
|
|
1807
1845
|
}
|
|
1808
1846
|
}));
|
|
1809
1847
|
var DateControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, onFocus, onBlur, argType }) => {
|
|
1810
|
-
const [valid, setValid] =
|
|
1848
|
+
const [valid, setValid] = useState4(true);
|
|
1811
1849
|
const dateRef = useRef2();
|
|
1812
1850
|
const timeRef = useRef2();
|
|
1813
1851
|
const readonly = !!argType?.table?.readonly;
|
|
1814
|
-
|
|
1852
|
+
useEffect4(() => {
|
|
1815
1853
|
if (valid !== false) {
|
|
1816
1854
|
if (dateRef && dateRef.current) {
|
|
1817
1855
|
dateRef.current.value = value2 ? formatDate(value2) : "";
|
|
@@ -1849,7 +1887,7 @@ var DateControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, onFoc
|
|
|
1849
1887
|
setValid(!!time);
|
|
1850
1888
|
}, "onTimeChange");
|
|
1851
1889
|
const controlId = getControlId(name);
|
|
1852
|
-
return
|
|
1890
|
+
return React15.createElement(FlexSpaced, null, React15.createElement(
|
|
1853
1891
|
FormInput,
|
|
1854
1892
|
{
|
|
1855
1893
|
type: "date",
|
|
@@ -1861,7 +1899,7 @@ var DateControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, onFoc
|
|
|
1861
1899
|
onChange: onDateChange,
|
|
1862
1900
|
...{ onFocus, onBlur }
|
|
1863
1901
|
}
|
|
1864
|
-
),
|
|
1902
|
+
), React15.createElement(
|
|
1865
1903
|
FormInput,
|
|
1866
1904
|
{
|
|
1867
1905
|
type: "time",
|
|
@@ -1872,11 +1910,11 @@ var DateControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, onFoc
|
|
|
1872
1910
|
readOnly: readonly,
|
|
1873
1911
|
...{ onFocus, onBlur }
|
|
1874
1912
|
}
|
|
1875
|
-
), !valid ?
|
|
1913
|
+
), !valid ? React15.createElement("div", null, "invalid") : null);
|
|
1876
1914
|
}, "DateControl");
|
|
1877
1915
|
|
|
1878
1916
|
// ../addons/docs/src/blocks/controls/Number.tsx
|
|
1879
|
-
import
|
|
1917
|
+
import React16, { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
|
|
1880
1918
|
import { Button as Button2, Form as Form2 } from "storybook/internal/components";
|
|
1881
1919
|
import { styled as styled13 } from "storybook/theming";
|
|
1882
1920
|
var Wrapper4 = styled13.label({
|
|
@@ -1900,9 +1938,9 @@ var NumberControl = /* @__PURE__ */ __name(({
|
|
|
1900
1938
|
onFocus,
|
|
1901
1939
|
argType
|
|
1902
1940
|
}) => {
|
|
1903
|
-
const [inputValue, setInputValue] =
|
|
1904
|
-
const [forceVisible, setForceVisible] =
|
|
1905
|
-
const [parseError, setParseError] =
|
|
1941
|
+
const [inputValue, setInputValue] = useState5(typeof value2 === "number" ? value2 : "");
|
|
1942
|
+
const [forceVisible, setForceVisible] = useState5(false);
|
|
1943
|
+
const [parseError, setParseError] = useState5(null);
|
|
1906
1944
|
const readonly = !!argType?.table?.readonly;
|
|
1907
1945
|
const handleChange = useCallback3(
|
|
1908
1946
|
(event) => {
|
|
@@ -1923,19 +1961,19 @@ var NumberControl = /* @__PURE__ */ __name(({
|
|
|
1923
1961
|
setForceVisible(true);
|
|
1924
1962
|
}, [setForceVisible]);
|
|
1925
1963
|
const htmlElRef = useRef3(null);
|
|
1926
|
-
|
|
1964
|
+
useEffect5(() => {
|
|
1927
1965
|
if (forceVisible && htmlElRef.current) {
|
|
1928
1966
|
htmlElRef.current.select();
|
|
1929
1967
|
}
|
|
1930
1968
|
}, [forceVisible]);
|
|
1931
|
-
|
|
1969
|
+
useEffect5(() => {
|
|
1932
1970
|
const newInputValue = typeof value2 === "number" ? value2 : "";
|
|
1933
1971
|
if (inputValue !== newInputValue) {
|
|
1934
1972
|
setInputValue(newInputValue);
|
|
1935
1973
|
}
|
|
1936
1974
|
}, [value2]);
|
|
1937
1975
|
if (value2 === void 0) {
|
|
1938
|
-
return
|
|
1976
|
+
return React16.createElement(
|
|
1939
1977
|
Button2,
|
|
1940
1978
|
{
|
|
1941
1979
|
variant: "outline",
|
|
@@ -1947,7 +1985,7 @@ var NumberControl = /* @__PURE__ */ __name(({
|
|
|
1947
1985
|
"Set number"
|
|
1948
1986
|
);
|
|
1949
1987
|
}
|
|
1950
|
-
return
|
|
1988
|
+
return React16.createElement(Wrapper4, null, React16.createElement(
|
|
1951
1989
|
FormInput2,
|
|
1952
1990
|
{
|
|
1953
1991
|
ref: htmlElRef,
|
|
@@ -1966,10 +2004,10 @@ var NumberControl = /* @__PURE__ */ __name(({
|
|
|
1966
2004
|
}, "NumberControl");
|
|
1967
2005
|
|
|
1968
2006
|
// ../addons/docs/src/blocks/controls/options/Options.tsx
|
|
1969
|
-
import
|
|
2007
|
+
import React20 from "react";
|
|
1970
2008
|
|
|
1971
2009
|
// ../addons/docs/src/blocks/controls/options/Checkbox.tsx
|
|
1972
|
-
import
|
|
2010
|
+
import React17, { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1973
2011
|
import { logger } from "storybook/internal/client-logger";
|
|
1974
2012
|
import { styled as styled14 } from "storybook/theming";
|
|
1975
2013
|
|
|
@@ -2033,10 +2071,10 @@ var CheckboxControl = /* @__PURE__ */ __name(({
|
|
|
2033
2071
|
}) => {
|
|
2034
2072
|
if (!options) {
|
|
2035
2073
|
logger.warn(`Checkbox with no options: ${name}`);
|
|
2036
|
-
return
|
|
2074
|
+
return React17.createElement(React17.Fragment, null, "-");
|
|
2037
2075
|
}
|
|
2038
2076
|
const initial = selectedKeys(value2 || [], options);
|
|
2039
|
-
const [selected, setSelected] =
|
|
2077
|
+
const [selected, setSelected] = useState6(initial);
|
|
2040
2078
|
const readonly = !!argType?.table?.readonly;
|
|
2041
2079
|
const handleChange = /* @__PURE__ */ __name((e2) => {
|
|
2042
2080
|
const option = e2.target.value;
|
|
@@ -2049,13 +2087,13 @@ var CheckboxControl = /* @__PURE__ */ __name(({
|
|
|
2049
2087
|
onChange(selectedValues(updated, options));
|
|
2050
2088
|
setSelected(updated);
|
|
2051
2089
|
}, "handleChange");
|
|
2052
|
-
|
|
2090
|
+
useEffect6(() => {
|
|
2053
2091
|
setSelected(selectedKeys(value2 || [], options));
|
|
2054
2092
|
}, [value2]);
|
|
2055
2093
|
const controlId = getControlId(name);
|
|
2056
|
-
return
|
|
2094
|
+
return React17.createElement(Wrapper5, { "aria-readonly": readonly, isInline }, Object.keys(options).map((key, index) => {
|
|
2057
2095
|
const id = `${controlId}-${index}`;
|
|
2058
|
-
return
|
|
2096
|
+
return React17.createElement(Label3, { key: id, htmlFor: id }, React17.createElement(
|
|
2059
2097
|
"input",
|
|
2060
2098
|
{
|
|
2061
2099
|
type: "checkbox",
|
|
@@ -2066,12 +2104,12 @@ var CheckboxControl = /* @__PURE__ */ __name(({
|
|
|
2066
2104
|
onChange: handleChange,
|
|
2067
2105
|
checked: selected?.includes(key)
|
|
2068
2106
|
}
|
|
2069
|
-
),
|
|
2107
|
+
), React17.createElement(Text, null, key));
|
|
2070
2108
|
}));
|
|
2071
2109
|
}, "CheckboxControl");
|
|
2072
2110
|
|
|
2073
2111
|
// ../addons/docs/src/blocks/controls/options/Radio.tsx
|
|
2074
|
-
import
|
|
2112
|
+
import React18 from "react";
|
|
2075
2113
|
import { logger as logger2 } from "storybook/internal/client-logger";
|
|
2076
2114
|
import { styled as styled15 } from "storybook/theming";
|
|
2077
2115
|
var Wrapper6 = styled15.div(
|
|
@@ -2125,14 +2163,14 @@ var RadioControl = /* @__PURE__ */ __name(({
|
|
|
2125
2163
|
}) => {
|
|
2126
2164
|
if (!options) {
|
|
2127
2165
|
logger2.warn(`Radio with no options: ${name}`);
|
|
2128
|
-
return
|
|
2166
|
+
return React18.createElement(React18.Fragment, null, "-");
|
|
2129
2167
|
}
|
|
2130
2168
|
const selection = selectedKey(value2, options);
|
|
2131
2169
|
const controlId = getControlId(name);
|
|
2132
2170
|
const readonly = !!argType?.table?.readonly;
|
|
2133
|
-
return
|
|
2171
|
+
return React18.createElement(Wrapper6, { "aria-readonly": readonly, isInline }, Object.keys(options).map((key, index) => {
|
|
2134
2172
|
const id = `${controlId}-${index}`;
|
|
2135
|
-
return
|
|
2173
|
+
return React18.createElement(Label4, { key: id, htmlFor: id }, React18.createElement(
|
|
2136
2174
|
"input",
|
|
2137
2175
|
{
|
|
2138
2176
|
type: "radio",
|
|
@@ -2143,12 +2181,12 @@ var RadioControl = /* @__PURE__ */ __name(({
|
|
|
2143
2181
|
onChange: (e2) => onChange(options[e2.currentTarget.value]),
|
|
2144
2182
|
checked: key === selection
|
|
2145
2183
|
}
|
|
2146
|
-
),
|
|
2184
|
+
), React18.createElement(Text2, null, key));
|
|
2147
2185
|
}));
|
|
2148
2186
|
}, "RadioControl");
|
|
2149
2187
|
|
|
2150
2188
|
// ../addons/docs/src/blocks/controls/options/Select.tsx
|
|
2151
|
-
import
|
|
2189
|
+
import React19 from "react";
|
|
2152
2190
|
import { logger as logger3 } from "storybook/internal/client-logger";
|
|
2153
2191
|
import { ChevronSmallDownIcon } from "@storybook/icons";
|
|
2154
2192
|
import { styled as styled16 } from "storybook/theming";
|
|
@@ -2226,7 +2264,7 @@ var SingleSelect = /* @__PURE__ */ __name(({ name, value: value2, options, onCha
|
|
|
2226
2264
|
const selection = selectedKey(value2, options) || NO_SELECTION;
|
|
2227
2265
|
const controlId = getControlId(name);
|
|
2228
2266
|
const readonly = !!argType?.table?.readonly;
|
|
2229
|
-
return
|
|
2267
|
+
return React19.createElement(SelectWrapper, null, React19.createElement(ChevronSmallDownIcon, null), React19.createElement(OptionsSelect, { disabled: readonly, id: controlId, value: selection, onChange: handleChange }, React19.createElement("option", { key: "no-selection", disabled: true }, NO_SELECTION), Object.keys(options).map((key) => React19.createElement("option", { key, value: key }, key))));
|
|
2230
2268
|
}, "SingleSelect");
|
|
2231
2269
|
var MultiSelect = /* @__PURE__ */ __name(({ name, value: value2, options, onChange, argType }) => {
|
|
2232
2270
|
const handleChange = /* @__PURE__ */ __name((e2) => {
|
|
@@ -2236,7 +2274,7 @@ var MultiSelect = /* @__PURE__ */ __name(({ name, value: value2, options, onChan
|
|
|
2236
2274
|
const selection = selectedKeys(value2, options);
|
|
2237
2275
|
const controlId = getControlId(name);
|
|
2238
2276
|
const readonly = !!argType?.table?.readonly;
|
|
2239
|
-
return
|
|
2277
|
+
return React19.createElement(SelectWrapper, null, React19.createElement(
|
|
2240
2278
|
OptionsSelect,
|
|
2241
2279
|
{
|
|
2242
2280
|
disabled: readonly,
|
|
@@ -2245,16 +2283,16 @@ var MultiSelect = /* @__PURE__ */ __name(({ name, value: value2, options, onChan
|
|
|
2245
2283
|
value: selection,
|
|
2246
2284
|
onChange: handleChange
|
|
2247
2285
|
},
|
|
2248
|
-
Object.keys(options).map((key) =>
|
|
2286
|
+
Object.keys(options).map((key) => React19.createElement("option", { key, value: key }, key))
|
|
2249
2287
|
));
|
|
2250
2288
|
}, "MultiSelect");
|
|
2251
2289
|
var SelectControl = /* @__PURE__ */ __name((props) => {
|
|
2252
2290
|
const { name, options } = props;
|
|
2253
2291
|
if (!options) {
|
|
2254
2292
|
logger3.warn(`Select with no options: ${name}`);
|
|
2255
|
-
return
|
|
2293
|
+
return React19.createElement(React19.Fragment, null, "-");
|
|
2256
2294
|
}
|
|
2257
|
-
return props.isMulti ?
|
|
2295
|
+
return props.isMulti ? React19.createElement(MultiSelect, { ...props }) : React19.createElement(SingleSelect, { ...props });
|
|
2258
2296
|
}, "SelectControl");
|
|
2259
2297
|
|
|
2260
2298
|
// ../addons/docs/src/blocks/controls/options/Options.tsx
|
|
@@ -2286,25 +2324,25 @@ var OptionsControl = /* @__PURE__ */ __name((props) => {
|
|
|
2286
2324
|
};
|
|
2287
2325
|
const Control = Controls[type];
|
|
2288
2326
|
if (Control) {
|
|
2289
|
-
return
|
|
2327
|
+
return React20.createElement(Control, { ...normalized });
|
|
2290
2328
|
}
|
|
2291
2329
|
throw new Error(`Unknown options type: ${type}`);
|
|
2292
2330
|
}, "OptionsControl");
|
|
2293
2331
|
|
|
2294
2332
|
// ../addons/docs/src/blocks/controls/Object.tsx
|
|
2295
|
-
import
|
|
2333
|
+
import React24, { useCallback as useCallback4, useEffect as useEffect7, useMemo, useRef as useRef4, useState as useState7 } from "react";
|
|
2296
2334
|
import { Button as Button3, Form as Form3, IconButton as IconButton2 } from "storybook/internal/components";
|
|
2297
2335
|
import { AddIcon, EyeCloseIcon, EyeIcon, SubtractIcon } from "@storybook/icons";
|
|
2298
2336
|
import { styled as styled18, useTheme as useTheme2 } from "storybook/theming";
|
|
2299
2337
|
|
|
2300
2338
|
// ../addons/docs/src/blocks/controls/react-editable-json-tree/index.tsx
|
|
2301
|
-
import
|
|
2339
|
+
import React23, { Component as Component3 } from "react";
|
|
2302
2340
|
|
|
2303
2341
|
// ../addons/docs/src/blocks/controls/react-editable-json-tree/JsonNodes.tsx
|
|
2304
|
-
import
|
|
2342
|
+
import React22, { Component as Component2, cloneElement as cloneElement2 } from "react";
|
|
2305
2343
|
|
|
2306
2344
|
// ../addons/docs/src/blocks/controls/react-editable-json-tree/JsonNodeAccordion.tsx
|
|
2307
|
-
import
|
|
2345
|
+
import React21 from "react";
|
|
2308
2346
|
import { styled as styled17 } from "storybook/theming";
|
|
2309
2347
|
var Container = styled17.div(({ theme: theme3 }) => ({
|
|
2310
2348
|
position: "relative",
|
|
@@ -2375,7 +2413,7 @@ function JsonNodeAccordion({
|
|
|
2375
2413
|
region: `${accordionKey}-region`
|
|
2376
2414
|
};
|
|
2377
2415
|
const containerTag = keyPath.length > 0 ? "li" : "div";
|
|
2378
|
-
return
|
|
2416
|
+
return React21.createElement(Container, { as: containerTag }, React21.createElement(
|
|
2379
2417
|
Trigger,
|
|
2380
2418
|
{
|
|
2381
2419
|
type: "button",
|
|
@@ -2387,7 +2425,7 @@ function JsonNodeAccordion({
|
|
|
2387
2425
|
},
|
|
2388
2426
|
name,
|
|
2389
2427
|
" :"
|
|
2390
|
-
),
|
|
2428
|
+
), React21.createElement(
|
|
2391
2429
|
Region,
|
|
2392
2430
|
{
|
|
2393
2431
|
role: "region",
|
|
@@ -2531,15 +2569,15 @@ var _JsonAddValue = class _JsonAddValue extends Component2 {
|
|
|
2531
2569
|
onKeyDown: this.onKeydown
|
|
2532
2570
|
});
|
|
2533
2571
|
}
|
|
2534
|
-
return
|
|
2572
|
+
return React22.createElement("span", { className: "rejt-add-value-node" }, inputElementKeyLayout, inputElementValueLayout, addButtonElementLayout, cancelButtonElementLayout);
|
|
2535
2573
|
}
|
|
2536
2574
|
};
|
|
2537
2575
|
__name(_JsonAddValue, "JsonAddValue");
|
|
2538
2576
|
var JsonAddValue = _JsonAddValue;
|
|
2539
2577
|
JsonAddValue.defaultProps = {
|
|
2540
2578
|
onlyValue: false,
|
|
2541
|
-
addButtonElement:
|
|
2542
|
-
cancelButtonElement:
|
|
2579
|
+
addButtonElement: React22.createElement("button", null, "+"),
|
|
2580
|
+
cancelButtonElement: React22.createElement("button", null, "c")
|
|
2543
2581
|
};
|
|
2544
2582
|
var _JsonArray = class _JsonArray extends Component2 {
|
|
2545
2583
|
constructor(props) {
|
|
@@ -2608,9 +2646,10 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
2608
2646
|
}).catch(logger5.error);
|
|
2609
2647
|
};
|
|
2610
2648
|
}
|
|
2611
|
-
handleAddValueAdd({
|
|
2649
|
+
handleAddValueAdd({ newValue }) {
|
|
2612
2650
|
const { data, keyPath = [], nextDeep: deep } = this.state;
|
|
2613
2651
|
const { beforeAddAction, logger: logger5 } = this.props;
|
|
2652
|
+
const key = data.length;
|
|
2614
2653
|
(beforeAddAction || Promise.resolve.bind(Promise))(key, keyPath, deep, newValue).then(() => {
|
|
2615
2654
|
data[key] = newValue;
|
|
2616
2655
|
this.setState({
|
|
@@ -2668,7 +2707,7 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
2668
2707
|
style: minus,
|
|
2669
2708
|
"aria-label": `remove the array '${String(name)}'`
|
|
2670
2709
|
});
|
|
2671
|
-
return
|
|
2710
|
+
return React22.createElement(React22.Fragment, null, React22.createElement("span", { style: collapsed }, "[...] ", data.length, " ", data.length === 1 ? "item" : "items"), !isReadOnly && removeItemButton);
|
|
2672
2711
|
}
|
|
2673
2712
|
renderNotCollapsed() {
|
|
2674
2713
|
const { name, data, keyPath, deep, addFormVisible, nextDeep } = this.state;
|
|
@@ -2708,7 +2747,7 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
2708
2747
|
const onlyValue = true;
|
|
2709
2748
|
const startObject = "[";
|
|
2710
2749
|
const endObject = "]";
|
|
2711
|
-
return
|
|
2750
|
+
return React22.createElement(React22.Fragment, null, React22.createElement("span", { className: "rejt-not-collapsed-delimiter", style: delimiter }, startObject), !addFormVisible && addItemButton, React22.createElement("ul", { className: "rejt-not-collapsed-list", style: ul }, data.map((item, index) => React22.createElement(
|
|
2712
2751
|
JsonNode,
|
|
2713
2752
|
{
|
|
2714
2753
|
key: index,
|
|
@@ -2735,7 +2774,7 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
2735
2774
|
logger: logger5,
|
|
2736
2775
|
onSubmitValueParser
|
|
2737
2776
|
}
|
|
2738
|
-
))), !isReadOnly && addFormVisible &&
|
|
2777
|
+
))), !isReadOnly && addFormVisible && React22.createElement("div", { className: "rejt-add-form", style: addForm }, React22.createElement(
|
|
2739
2778
|
JsonAddValue,
|
|
2740
2779
|
{
|
|
2741
2780
|
handleAdd: this.handleAddValueAdd,
|
|
@@ -2748,12 +2787,12 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
2748
2787
|
deep,
|
|
2749
2788
|
onSubmitValueParser
|
|
2750
2789
|
}
|
|
2751
|
-
)),
|
|
2790
|
+
)), React22.createElement("span", { className: "rejt-not-collapsed-delimiter", style: delimiter }, endObject), !isReadOnly && removeItemButton);
|
|
2752
2791
|
}
|
|
2753
2792
|
render() {
|
|
2754
2793
|
const { name, collapsed, keyPath, deep } = this.state;
|
|
2755
2794
|
const value2 = collapsed ? this.renderCollapsed() : this.renderNotCollapsed();
|
|
2756
|
-
return
|
|
2795
|
+
return React22.createElement(
|
|
2757
2796
|
JsonNodeAccordion,
|
|
2758
2797
|
{
|
|
2759
2798
|
name,
|
|
@@ -2771,8 +2810,8 @@ var JsonArray = _JsonArray;
|
|
|
2771
2810
|
JsonArray.defaultProps = {
|
|
2772
2811
|
keyPath: [],
|
|
2773
2812
|
deep: 0,
|
|
2774
|
-
minusMenuElement:
|
|
2775
|
-
plusMenuElement:
|
|
2813
|
+
minusMenuElement: React22.createElement("span", null, " - "),
|
|
2814
|
+
plusMenuElement: React22.createElement("span", null, " + ")
|
|
2776
2815
|
};
|
|
2777
2816
|
var _JsonFunctionValue = class _JsonFunctionValue extends Component2 {
|
|
2778
2817
|
constructor(props) {
|
|
@@ -2877,10 +2916,10 @@ var _JsonFunctionValue = class _JsonFunctionValue extends Component2 {
|
|
|
2877
2916
|
defaultValue: value2,
|
|
2878
2917
|
onKeyDown: this.onKeydown
|
|
2879
2918
|
});
|
|
2880
|
-
result =
|
|
2919
|
+
result = React22.createElement("span", { className: "rejt-edit-form", style: style.editForm }, textareaElementLayout);
|
|
2881
2920
|
minusElement = null;
|
|
2882
2921
|
} else {
|
|
2883
|
-
result =
|
|
2922
|
+
result = React22.createElement(
|
|
2884
2923
|
"span",
|
|
2885
2924
|
{
|
|
2886
2925
|
className: "rejt-value",
|
|
@@ -2898,7 +2937,7 @@ var _JsonFunctionValue = class _JsonFunctionValue extends Component2 {
|
|
|
2898
2937
|
});
|
|
2899
2938
|
minusElement = resultOnlyResult ? null : minusMenuLayout;
|
|
2900
2939
|
}
|
|
2901
|
-
return
|
|
2940
|
+
return React22.createElement("li", { className: "rejt-value-node", style: style.li }, React22.createElement("span", { className: "rejt-name", style: style.name }, name, " :", " "), result, minusElement);
|
|
2902
2941
|
}
|
|
2903
2942
|
};
|
|
2904
2943
|
__name(_JsonFunctionValue, "JsonFunctionValue");
|
|
@@ -2908,8 +2947,8 @@ JsonFunctionValue.defaultProps = {
|
|
|
2908
2947
|
deep: 0,
|
|
2909
2948
|
handleUpdateValue: /* @__PURE__ */ __name(() => {
|
|
2910
2949
|
}, "handleUpdateValue"),
|
|
2911
|
-
cancelButtonElement:
|
|
2912
|
-
minusMenuElement:
|
|
2950
|
+
cancelButtonElement: React22.createElement("button", null, "c"),
|
|
2951
|
+
minusMenuElement: React22.createElement("span", null, " - ")
|
|
2913
2952
|
};
|
|
2914
2953
|
var _JsonNode = class _JsonNode extends Component2 {
|
|
2915
2954
|
constructor(props) {
|
|
@@ -2950,7 +2989,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
2950
2989
|
const dataType = getObjectType(data);
|
|
2951
2990
|
switch (dataType) {
|
|
2952
2991
|
case ERROR:
|
|
2953
|
-
return
|
|
2992
|
+
return React22.createElement(
|
|
2954
2993
|
JsonObject,
|
|
2955
2994
|
{
|
|
2956
2995
|
data,
|
|
@@ -2978,7 +3017,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
2978
3017
|
}
|
|
2979
3018
|
);
|
|
2980
3019
|
case OBJECT:
|
|
2981
|
-
return
|
|
3020
|
+
return React22.createElement(
|
|
2982
3021
|
JsonObject,
|
|
2983
3022
|
{
|
|
2984
3023
|
data,
|
|
@@ -3006,7 +3045,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3006
3045
|
}
|
|
3007
3046
|
);
|
|
3008
3047
|
case ARRAY:
|
|
3009
|
-
return
|
|
3048
|
+
return React22.createElement(
|
|
3010
3049
|
JsonArray,
|
|
3011
3050
|
{
|
|
3012
3051
|
data,
|
|
@@ -3034,7 +3073,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3034
3073
|
}
|
|
3035
3074
|
);
|
|
3036
3075
|
case STRING:
|
|
3037
|
-
return
|
|
3076
|
+
return React22.createElement(
|
|
3038
3077
|
JsonValue,
|
|
3039
3078
|
{
|
|
3040
3079
|
name,
|
|
@@ -3055,7 +3094,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3055
3094
|
}
|
|
3056
3095
|
);
|
|
3057
3096
|
case NUMBER:
|
|
3058
|
-
return
|
|
3097
|
+
return React22.createElement(
|
|
3059
3098
|
JsonValue,
|
|
3060
3099
|
{
|
|
3061
3100
|
name,
|
|
@@ -3076,7 +3115,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3076
3115
|
}
|
|
3077
3116
|
);
|
|
3078
3117
|
case BOOLEAN:
|
|
3079
|
-
return
|
|
3118
|
+
return React22.createElement(
|
|
3080
3119
|
JsonValue,
|
|
3081
3120
|
{
|
|
3082
3121
|
name,
|
|
@@ -3097,7 +3136,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3097
3136
|
}
|
|
3098
3137
|
);
|
|
3099
3138
|
case DATE:
|
|
3100
|
-
return
|
|
3139
|
+
return React22.createElement(
|
|
3101
3140
|
JsonValue,
|
|
3102
3141
|
{
|
|
3103
3142
|
name,
|
|
@@ -3118,7 +3157,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3118
3157
|
}
|
|
3119
3158
|
);
|
|
3120
3159
|
case NULL:
|
|
3121
|
-
return
|
|
3160
|
+
return React22.createElement(
|
|
3122
3161
|
JsonValue,
|
|
3123
3162
|
{
|
|
3124
3163
|
name,
|
|
@@ -3139,7 +3178,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3139
3178
|
}
|
|
3140
3179
|
);
|
|
3141
3180
|
case UNDEFINED:
|
|
3142
|
-
return
|
|
3181
|
+
return React22.createElement(
|
|
3143
3182
|
JsonValue,
|
|
3144
3183
|
{
|
|
3145
3184
|
name,
|
|
@@ -3160,7 +3199,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3160
3199
|
}
|
|
3161
3200
|
);
|
|
3162
3201
|
case FUNCTION:
|
|
3163
|
-
return
|
|
3202
|
+
return React22.createElement(
|
|
3164
3203
|
JsonFunctionValue,
|
|
3165
3204
|
{
|
|
3166
3205
|
name,
|
|
@@ -3181,7 +3220,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
3181
3220
|
}
|
|
3182
3221
|
);
|
|
3183
3222
|
case SYMBOL:
|
|
3184
|
-
return
|
|
3223
|
+
return React22.createElement(
|
|
3185
3224
|
JsonValue,
|
|
3186
3225
|
{
|
|
3187
3226
|
name,
|
|
@@ -3340,7 +3379,7 @@ var _JsonObject = class _JsonObject extends Component2 {
|
|
|
3340
3379
|
style: minus,
|
|
3341
3380
|
"aria-label": `remove the object '${String(name)}'`
|
|
3342
3381
|
});
|
|
3343
|
-
return
|
|
3382
|
+
return React22.createElement(React22.Fragment, null, React22.createElement("span", { style: collapsed }, "{...}", " ", keyList.length, " ", keyList.length === 1 ? "key" : "keys"), !isReadOnly && removeItemButton);
|
|
3344
3383
|
}
|
|
3345
3384
|
renderNotCollapsed() {
|
|
3346
3385
|
const { name, data, keyPath, deep, nextDeep, addFormVisible } = this.state;
|
|
@@ -3378,7 +3417,7 @@ var _JsonObject = class _JsonObject extends Component2 {
|
|
|
3378
3417
|
style: minus,
|
|
3379
3418
|
"aria-label": `remove the object '${String(name)}'`
|
|
3380
3419
|
});
|
|
3381
|
-
const list = keyList.map((key) =>
|
|
3420
|
+
const list = keyList.map((key) => React22.createElement(
|
|
3382
3421
|
JsonNode,
|
|
3383
3422
|
{
|
|
3384
3423
|
key,
|
|
@@ -3408,7 +3447,7 @@ var _JsonObject = class _JsonObject extends Component2 {
|
|
|
3408
3447
|
));
|
|
3409
3448
|
const startObject = "{";
|
|
3410
3449
|
const endObject = "}";
|
|
3411
|
-
return
|
|
3450
|
+
return React22.createElement(React22.Fragment, null, React22.createElement("span", { className: "rejt-not-collapsed-delimiter", style: delimiter }, startObject), !isReadOnly && addItemButton, React22.createElement("ul", { className: "rejt-not-collapsed-list", style: ul }, list), !isReadOnly && addFormVisible && React22.createElement("div", { className: "rejt-add-form", style: addForm }, React22.createElement(
|
|
3412
3451
|
JsonAddValue,
|
|
3413
3452
|
{
|
|
3414
3453
|
handleAdd: this.handleAddValueAdd,
|
|
@@ -3420,12 +3459,12 @@ var _JsonObject = class _JsonObject extends Component2 {
|
|
|
3420
3459
|
deep,
|
|
3421
3460
|
onSubmitValueParser
|
|
3422
3461
|
}
|
|
3423
|
-
)),
|
|
3462
|
+
)), React22.createElement("span", { className: "rejt-not-collapsed-delimiter", style: delimiter }, endObject), !isReadOnly && removeItemButton);
|
|
3424
3463
|
}
|
|
3425
3464
|
render() {
|
|
3426
3465
|
const { name, collapsed, keyPath, deep = 0 } = this.state;
|
|
3427
3466
|
const value2 = collapsed ? this.renderCollapsed() : this.renderNotCollapsed();
|
|
3428
|
-
return
|
|
3467
|
+
return React22.createElement(
|
|
3429
3468
|
JsonNodeAccordion,
|
|
3430
3469
|
{
|
|
3431
3470
|
name,
|
|
@@ -3443,8 +3482,8 @@ var JsonObject = _JsonObject;
|
|
|
3443
3482
|
JsonObject.defaultProps = {
|
|
3444
3483
|
keyPath: [],
|
|
3445
3484
|
deep: 0,
|
|
3446
|
-
minusMenuElement:
|
|
3447
|
-
plusMenuElement:
|
|
3485
|
+
minusMenuElement: React22.createElement("span", null, " - "),
|
|
3486
|
+
plusMenuElement: React22.createElement("span", null, " + ")
|
|
3448
3487
|
};
|
|
3449
3488
|
var _JsonValue = class _JsonValue extends Component2 {
|
|
3450
3489
|
constructor(props) {
|
|
@@ -3554,7 +3593,7 @@ var _JsonValue = class _JsonValue extends Component2 {
|
|
|
3554
3593
|
style: style.minus,
|
|
3555
3594
|
"aria-label": `remove the property '${String(name)}' with value '${String(originalValue)}'${String(parentPropertyName) ? ` from '${String(parentPropertyName)}'` : ""}`
|
|
3556
3595
|
});
|
|
3557
|
-
return
|
|
3596
|
+
return React22.createElement("li", { className: "rejt-value-node", style: style.li }, React22.createElement("span", { className: "rejt-name", style: style.name }, name, " : "), isEditing ? React22.createElement("span", { className: "rejt-edit-form", style: style.editForm }, inputElementLayout) : React22.createElement(
|
|
3558
3597
|
"span",
|
|
3559
3598
|
{
|
|
3560
3599
|
className: "rejt-value",
|
|
@@ -3571,8 +3610,8 @@ JsonValue.defaultProps = {
|
|
|
3571
3610
|
keyPath: [],
|
|
3572
3611
|
deep: 0,
|
|
3573
3612
|
handleUpdateValue: /* @__PURE__ */ __name(() => Promise.resolve(), "handleUpdateValue"),
|
|
3574
|
-
cancelButtonElement:
|
|
3575
|
-
minusMenuElement:
|
|
3613
|
+
cancelButtonElement: React22.createElement("button", null, "c"),
|
|
3614
|
+
minusMenuElement: React22.createElement("span", null, " - ")
|
|
3576
3615
|
};
|
|
3577
3616
|
|
|
3578
3617
|
// ../addons/docs/src/blocks/controls/react-editable-json-tree/utils/parse.ts
|
|
@@ -3711,7 +3750,7 @@ var _JsonTree = class _JsonTree extends Component3 {
|
|
|
3711
3750
|
textareaElementFunction = /* @__PURE__ */ __name(() => textareaElement, "textareaElementFunction");
|
|
3712
3751
|
}
|
|
3713
3752
|
if (dataType === "Object" || dataType === "Array") {
|
|
3714
|
-
return
|
|
3753
|
+
return React23.createElement("div", { className: "rejt-tree" }, React23.createElement(
|
|
3715
3754
|
JsonNode,
|
|
3716
3755
|
{
|
|
3717
3756
|
data,
|
|
@@ -3768,8 +3807,8 @@ JsonTree.defaultProps = {
|
|
|
3768
3807
|
logger: { error: /* @__PURE__ */ __name(() => {
|
|
3769
3808
|
}, "error") },
|
|
3770
3809
|
onSubmitValueParser: /* @__PURE__ */ __name((isEditMode, keyPath, deep, name, rawValue) => parse3(rawValue), "onSubmitValueParser"),
|
|
3771
|
-
inputElement: /* @__PURE__ */ __name(() =>
|
|
3772
|
-
textareaElement: /* @__PURE__ */ __name(() =>
|
|
3810
|
+
inputElement: /* @__PURE__ */ __name(() => React23.createElement("input", null), "inputElement"),
|
|
3811
|
+
textareaElement: /* @__PURE__ */ __name(() => React23.createElement("textarea", null), "textareaElement"),
|
|
3773
3812
|
fallback: null
|
|
3774
3813
|
};
|
|
3775
3814
|
|
|
@@ -3939,8 +3978,8 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
3939
3978
|
const theme3 = useTheme2();
|
|
3940
3979
|
const data = useMemo(() => value2 && cloneDeep(value2), [value2]);
|
|
3941
3980
|
const hasData = data !== null && data !== void 0;
|
|
3942
|
-
const [showRaw, setShowRaw] =
|
|
3943
|
-
const [parseError, setParseError] =
|
|
3981
|
+
const [showRaw, setShowRaw] = useState7(!hasData);
|
|
3982
|
+
const [parseError, setParseError] = useState7(null);
|
|
3944
3983
|
const readonly = !!argType?.table?.readonly;
|
|
3945
3984
|
const updateRaw = useCallback4(
|
|
3946
3985
|
(raw) => {
|
|
@@ -3955,21 +3994,21 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
3955
3994
|
},
|
|
3956
3995
|
[onChange]
|
|
3957
3996
|
);
|
|
3958
|
-
const [forceVisible, setForceVisible] =
|
|
3997
|
+
const [forceVisible, setForceVisible] = useState7(false);
|
|
3959
3998
|
const onForceVisible = useCallback4(() => {
|
|
3960
3999
|
onChange({});
|
|
3961
4000
|
setForceVisible(true);
|
|
3962
4001
|
}, [setForceVisible]);
|
|
3963
4002
|
const htmlElRef = useRef4(null);
|
|
3964
|
-
|
|
4003
|
+
useEffect7(() => {
|
|
3965
4004
|
if (forceVisible && htmlElRef.current) {
|
|
3966
4005
|
htmlElRef.current.select();
|
|
3967
4006
|
}
|
|
3968
4007
|
}, [forceVisible]);
|
|
3969
4008
|
if (!hasData) {
|
|
3970
|
-
return
|
|
4009
|
+
return React24.createElement(Button3, { disabled: readonly, id: getControlSetterButtonId(name), onClick: onForceVisible }, "Set object");
|
|
3971
4010
|
}
|
|
3972
|
-
const rawJSONForm =
|
|
4011
|
+
const rawJSONForm = React24.createElement(
|
|
3973
4012
|
RawInput,
|
|
3974
4013
|
{
|
|
3975
4014
|
ref: htmlElRef,
|
|
@@ -3984,7 +4023,7 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
3984
4023
|
}
|
|
3985
4024
|
);
|
|
3986
4025
|
const isObjectOrArray = Array.isArray(value2) || typeof value2 === "object" && value2?.constructor === Object;
|
|
3987
|
-
return
|
|
4026
|
+
return React24.createElement(Wrapper7, { "aria-readonly": readonly }, isObjectOrArray && React24.createElement(
|
|
3988
4027
|
RawButton,
|
|
3989
4028
|
{
|
|
3990
4029
|
role: "switch",
|
|
@@ -3995,9 +4034,9 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
3995
4034
|
setShowRaw((isRaw) => !isRaw);
|
|
3996
4035
|
}
|
|
3997
4036
|
},
|
|
3998
|
-
showRaw ?
|
|
3999
|
-
|
|
4000
|
-
), !showRaw ?
|
|
4037
|
+
showRaw ? React24.createElement(EyeCloseIcon, null) : React24.createElement(EyeIcon, null),
|
|
4038
|
+
React24.createElement("span", null, "RAW")
|
|
4039
|
+
), !showRaw ? React24.createElement(
|
|
4001
4040
|
JsonTree,
|
|
4002
4041
|
{
|
|
4003
4042
|
readOnly: readonly || !isObjectOrArray,
|
|
@@ -4009,18 +4048,18 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
4009
4048
|
rootName: name,
|
|
4010
4049
|
onFullyUpdate: onChange,
|
|
4011
4050
|
getStyle: getCustomStyleFunction(theme3),
|
|
4012
|
-
cancelButtonElement:
|
|
4013
|
-
addButtonElement:
|
|
4014
|
-
plusMenuElement:
|
|
4015
|
-
minusMenuElement:
|
|
4016
|
-
inputElement: (_2, __, ___, key) => key ?
|
|
4051
|
+
cancelButtonElement: React24.createElement(ButtonInline, { type: "button" }, "Cancel"),
|
|
4052
|
+
addButtonElement: React24.createElement(ButtonInline, { type: "submit", primary: true }, "Save"),
|
|
4053
|
+
plusMenuElement: React24.createElement(ActionButton, { type: "button" }, React24.createElement(AddIcon, null)),
|
|
4054
|
+
minusMenuElement: React24.createElement(ActionButton, { type: "button" }, React24.createElement(SubtractIcon, null)),
|
|
4055
|
+
inputElement: (_2, __, ___, key) => key ? React24.createElement(Input, { onFocus: selectValue, onBlur: dispatchEnterKey }) : React24.createElement(Input, null),
|
|
4017
4056
|
fallback: rawJSONForm
|
|
4018
4057
|
}
|
|
4019
4058
|
) : rawJSONForm);
|
|
4020
4059
|
}, "ObjectControl");
|
|
4021
4060
|
|
|
4022
4061
|
// ../addons/docs/src/blocks/controls/Range.tsx
|
|
4023
|
-
import
|
|
4062
|
+
import React25, { useMemo as useMemo2 } from "react";
|
|
4024
4063
|
import { styled as styled19 } from "storybook/theming";
|
|
4025
4064
|
var RangeInput = styled19.input(
|
|
4026
4065
|
({ theme: theme3, min, max, value: value2, disabled }) => ({
|
|
@@ -4193,7 +4232,7 @@ var RangeControl = /* @__PURE__ */ __name(({
|
|
|
4193
4232
|
const hasValue = value2 !== void 0;
|
|
4194
4233
|
const numberOFDecimalsPlaces = useMemo2(() => getNumberOfDecimalPlaces(step), [step]);
|
|
4195
4234
|
const readonly = !!argType?.table?.readonly;
|
|
4196
|
-
return
|
|
4235
|
+
return React25.createElement(RangeWrapper, { "aria-readonly": readonly }, React25.createElement(RangeLabel, null, min), React25.createElement(
|
|
4197
4236
|
RangeInput,
|
|
4198
4237
|
{
|
|
4199
4238
|
id: getControlId(name),
|
|
@@ -4203,11 +4242,11 @@ var RangeControl = /* @__PURE__ */ __name(({
|
|
|
4203
4242
|
...{ name, min, max, step, onFocus, onBlur },
|
|
4204
4243
|
value: value2 ?? min
|
|
4205
4244
|
}
|
|
4206
|
-
),
|
|
4245
|
+
), React25.createElement(RangeCurrentAndMaxLabel, { numberOFDecimalsPlaces, max }, hasValue ? value2.toFixed(numberOFDecimalsPlaces) : "--", " / ", max));
|
|
4207
4246
|
}, "RangeControl");
|
|
4208
4247
|
|
|
4209
4248
|
// ../addons/docs/src/blocks/controls/Text.tsx
|
|
4210
|
-
import
|
|
4249
|
+
import React26, { useCallback as useCallback5, useState as useState8 } from "react";
|
|
4211
4250
|
import { Button as Button4, Form as Form4 } from "storybook/internal/components";
|
|
4212
4251
|
import { styled as styled20 } from "storybook/theming";
|
|
4213
4252
|
var Wrapper8 = styled20.label({
|
|
@@ -4231,13 +4270,13 @@ var TextControl = /* @__PURE__ */ __name(({
|
|
|
4231
4270
|
onChange(event.target.value);
|
|
4232
4271
|
}, "handleChange");
|
|
4233
4272
|
const readonly = !!argType?.table?.readonly;
|
|
4234
|
-
const [forceVisible, setForceVisible] =
|
|
4273
|
+
const [forceVisible, setForceVisible] = useState8(false);
|
|
4235
4274
|
const onForceVisible = useCallback5(() => {
|
|
4236
4275
|
onChange("");
|
|
4237
4276
|
setForceVisible(true);
|
|
4238
4277
|
}, [setForceVisible]);
|
|
4239
4278
|
if (value2 === void 0) {
|
|
4240
|
-
return
|
|
4279
|
+
return React26.createElement(
|
|
4241
4280
|
Button4,
|
|
4242
4281
|
{
|
|
4243
4282
|
variant: "outline",
|
|
@@ -4250,7 +4289,7 @@ var TextControl = /* @__PURE__ */ __name(({
|
|
|
4250
4289
|
);
|
|
4251
4290
|
}
|
|
4252
4291
|
const isValid = typeof value2 === "string";
|
|
4253
|
-
return
|
|
4292
|
+
return React26.createElement(Wrapper8, null, React26.createElement(
|
|
4254
4293
|
Form4.Textarea,
|
|
4255
4294
|
{
|
|
4256
4295
|
id: getControlId(name),
|
|
@@ -4263,11 +4302,11 @@ var TextControl = /* @__PURE__ */ __name(({
|
|
|
4263
4302
|
valid: isValid ? void 0 : "error",
|
|
4264
4303
|
...{ name, value: isValid ? value2 : "", onFocus, onBlur }
|
|
4265
4304
|
}
|
|
4266
|
-
), maxLength &&
|
|
4305
|
+
), maxLength && React26.createElement(MaxLength, { isMaxed: value2?.length === maxLength }, value2?.length ?? 0, " / ", maxLength));
|
|
4267
4306
|
}, "TextControl");
|
|
4268
4307
|
|
|
4269
4308
|
// ../addons/docs/src/blocks/controls/Files.tsx
|
|
4270
|
-
import
|
|
4309
|
+
import React27, { useEffect as useEffect8, useRef as useRef5 } from "react";
|
|
4271
4310
|
import { Form as Form5 } from "storybook/internal/components";
|
|
4272
4311
|
import { styled as styled21 } from "storybook/theming";
|
|
4273
4312
|
var FileInput = styled21(Form5.Input)({
|
|
@@ -4299,12 +4338,12 @@ var FilesControl = /* @__PURE__ */ __name(({
|
|
|
4299
4338
|
revokeOldUrls(value2 || []);
|
|
4300
4339
|
}
|
|
4301
4340
|
__name(handleFileChange, "handleFileChange");
|
|
4302
|
-
|
|
4341
|
+
useEffect8(() => {
|
|
4303
4342
|
if (value2 == null && inputElement.current) {
|
|
4304
4343
|
inputElement.current.value = "";
|
|
4305
4344
|
}
|
|
4306
4345
|
}, [value2, name]);
|
|
4307
|
-
return
|
|
4346
|
+
return React27.createElement(
|
|
4308
4347
|
FileInput,
|
|
4309
4348
|
{
|
|
4310
4349
|
ref: inputElement,
|
|
@@ -4322,7 +4361,7 @@ var FilesControl = /* @__PURE__ */ __name(({
|
|
|
4322
4361
|
|
|
4323
4362
|
// ../addons/docs/src/blocks/controls/index.tsx
|
|
4324
4363
|
var LazyColorControl = lazy(() => import("../../_browser-chunks/Color-KPLIACXP.js"));
|
|
4325
|
-
var ColorControl = /* @__PURE__ */ __name((props) =>
|
|
4364
|
+
var ColorControl = /* @__PURE__ */ __name((props) => React28.createElement(Suspense, { fallback: React28.createElement("div", null) }, React28.createElement(LazyColorControl, { ...props })), "ColorControl");
|
|
4326
4365
|
|
|
4327
4366
|
// ../addons/docs/src/blocks/components/ArgsTable/ArgControl.tsx
|
|
4328
4367
|
var Controls2 = {
|
|
@@ -4342,12 +4381,12 @@ var Controls2 = {
|
|
|
4342
4381
|
text: TextControl,
|
|
4343
4382
|
file: FilesControl
|
|
4344
4383
|
};
|
|
4345
|
-
var NoControl = /* @__PURE__ */ __name(() =>
|
|
4384
|
+
var NoControl = /* @__PURE__ */ __name(() => React29.createElement(React29.Fragment, null, "-"), "NoControl");
|
|
4346
4385
|
var ArgControl = /* @__PURE__ */ __name(({ row, arg, updateArgs, isHovered }) => {
|
|
4347
4386
|
const { key, control } = row;
|
|
4348
|
-
const [isFocused, setFocused] =
|
|
4349
|
-
const [boxedValue, setBoxedValue] =
|
|
4350
|
-
|
|
4387
|
+
const [isFocused, setFocused] = useState9(false);
|
|
4388
|
+
const [boxedValue, setBoxedValue] = useState9({ value: arg });
|
|
4389
|
+
useEffect9(() => {
|
|
4351
4390
|
if (!isFocused) {
|
|
4352
4391
|
setBoxedValue({ value: arg });
|
|
4353
4392
|
}
|
|
@@ -4364,7 +4403,7 @@ var ArgControl = /* @__PURE__ */ __name(({ row, arg, updateArgs, isHovered }) =>
|
|
|
4364
4403
|
const onFocus = useCallback6(() => setFocused(true), []);
|
|
4365
4404
|
if (!control || control.disable) {
|
|
4366
4405
|
const canBeSetup = control?.disable !== true && row?.type?.name !== "function";
|
|
4367
|
-
return isHovered && canBeSetup ?
|
|
4406
|
+
return isHovered && canBeSetup ? React29.createElement(
|
|
4368
4407
|
Link,
|
|
4369
4408
|
{
|
|
4370
4409
|
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
@@ -4372,15 +4411,15 @@ var ArgControl = /* @__PURE__ */ __name(({ row, arg, updateArgs, isHovered }) =>
|
|
|
4372
4411
|
withArrow: true
|
|
4373
4412
|
},
|
|
4374
4413
|
"Setup controls"
|
|
4375
|
-
) :
|
|
4414
|
+
) : React29.createElement(NoControl, null);
|
|
4376
4415
|
}
|
|
4377
4416
|
const props = { name: key, argType: row, value: boxedValue.value, onChange, onBlur, onFocus };
|
|
4378
4417
|
const Control = Controls2[control.type] || NoControl;
|
|
4379
|
-
return
|
|
4418
|
+
return React29.createElement(Control, { ...props, ...control, controlType: control.type });
|
|
4380
4419
|
}, "ArgControl");
|
|
4381
4420
|
|
|
4382
4421
|
// ../addons/docs/src/blocks/components/ArgsTable/ArgJsDoc.tsx
|
|
4383
|
-
import
|
|
4422
|
+
import React30 from "react";
|
|
4384
4423
|
import { codeCommon } from "storybook/internal/components";
|
|
4385
4424
|
import { styled as styled22 } from "storybook/theming";
|
|
4386
4425
|
var Table = styled22.table(({ theme: theme3 }) => ({
|
|
@@ -4440,13 +4479,13 @@ var ArgJsDoc = /* @__PURE__ */ __name(({ tags }) => {
|
|
|
4440
4479
|
if (!hasDisplayableParams && !hasDisplayableReturns && !hasDisplayableDeprecated) {
|
|
4441
4480
|
return null;
|
|
4442
4481
|
}
|
|
4443
|
-
return
|
|
4444
|
-
return
|
|
4445
|
-
}), hasDisplayableReturns &&
|
|
4482
|
+
return React30.createElement(React30.Fragment, null, React30.createElement(Table, null, React30.createElement("tbody", null, hasDisplayableDeprecated && React30.createElement("tr", { key: "deprecated" }, React30.createElement("td", { colSpan: 2 }, React30.createElement("strong", null, "Deprecated"), ": ", tags.deprecated?.toString())), hasDisplayableParams && params.map((x2) => {
|
|
4483
|
+
return React30.createElement("tr", { key: x2.name }, React30.createElement("td", null, React30.createElement("code", null, x2.name)), React30.createElement("td", null, x2.description));
|
|
4484
|
+
}), hasDisplayableReturns && React30.createElement("tr", { key: "returns" }, React30.createElement("td", null, React30.createElement("code", null, "Returns")), React30.createElement("td", null, tags.returns?.description)))));
|
|
4446
4485
|
}, "ArgJsDoc");
|
|
4447
4486
|
|
|
4448
4487
|
// ../addons/docs/src/blocks/components/ArgsTable/ArgValue.tsx
|
|
4449
|
-
import
|
|
4488
|
+
import React31, { useState as useState10 } from "react";
|
|
4450
4489
|
import { SyntaxHighlighter as SyntaxHighlighter2, WithTooltipPure, codeCommon as codeCommon2 } from "storybook/internal/components";
|
|
4451
4490
|
import { ChevronSmallDownIcon as ChevronSmallDownIcon2, ChevronSmallUpIcon } from "@storybook/icons";
|
|
4452
4491
|
var import_memoizerific = __toESM(require_memoizerific(), 1);
|
|
@@ -4517,10 +4556,10 @@ var ChevronDownIcon = styled23(ChevronSmallDownIcon2)({
|
|
|
4517
4556
|
marginLeft: 4
|
|
4518
4557
|
});
|
|
4519
4558
|
var EmptyArg = /* @__PURE__ */ __name(() => {
|
|
4520
|
-
return
|
|
4559
|
+
return React31.createElement("span", null, "-");
|
|
4521
4560
|
}, "EmptyArg");
|
|
4522
4561
|
var ArgText = /* @__PURE__ */ __name(({ text, simple }) => {
|
|
4523
|
-
return
|
|
4562
|
+
return React31.createElement(Text3, { simple }, text);
|
|
4524
4563
|
}, "ArgText");
|
|
4525
4564
|
var calculateDetailWidth = (0, import_memoizerific.default)(1e3)((detail) => {
|
|
4526
4565
|
const lines = detail.split(/\r?\n/);
|
|
@@ -4539,12 +4578,12 @@ var renderSummaryItems = /* @__PURE__ */ __name((summaryItems, isExpanded = true
|
|
|
4539
4578
|
if (!isExpanded) {
|
|
4540
4579
|
items = summaryItems.slice(0, ITEMS_BEFORE_EXPANSION);
|
|
4541
4580
|
}
|
|
4542
|
-
return items.map((item) =>
|
|
4581
|
+
return items.map((item) => React31.createElement(ArgText, { key: item, text: item === "" ? '""' : item }));
|
|
4543
4582
|
}, "renderSummaryItems");
|
|
4544
4583
|
var ArgSummary = /* @__PURE__ */ __name(({ value: value2, initialExpandedArgs }) => {
|
|
4545
4584
|
const { summary, detail } = value2;
|
|
4546
|
-
const [isOpen, setIsOpen] =
|
|
4547
|
-
const [isExpanded, setIsExpanded] =
|
|
4585
|
+
const [isOpen, setIsOpen] = useState10(false);
|
|
4586
|
+
const [isExpanded, setIsExpanded] = useState10(initialExpandedArgs || false);
|
|
4548
4587
|
if (summary === void 0 || summary === null) {
|
|
4549
4588
|
return null;
|
|
4550
4589
|
}
|
|
@@ -4552,14 +4591,14 @@ var ArgSummary = /* @__PURE__ */ __name(({ value: value2, initialExpandedArgs })
|
|
|
4552
4591
|
if (detail == null) {
|
|
4553
4592
|
const cannotBeSafelySplitted = /[(){}[\]<>]/.test(summaryAsString);
|
|
4554
4593
|
if (cannotBeSafelySplitted) {
|
|
4555
|
-
return
|
|
4594
|
+
return React31.createElement(ArgText, { text: summaryAsString });
|
|
4556
4595
|
}
|
|
4557
4596
|
const summaryItems = getSummaryItems(summaryAsString);
|
|
4558
4597
|
const itemsCount = summaryItems.length;
|
|
4559
4598
|
const hasManyItems = itemsCount > ITEMS_BEFORE_EXPANSION;
|
|
4560
|
-
return hasManyItems ?
|
|
4599
|
+
return hasManyItems ? React31.createElement(Summary, { isExpanded }, renderSummaryItems(summaryItems, isExpanded), React31.createElement(ExpandButton, { onClick: () => setIsExpanded(!isExpanded) }, isExpanded ? "Show less..." : `Show ${itemsCount - ITEMS_BEFORE_EXPANSION} more...`)) : React31.createElement(Summary, null, renderSummaryItems(summaryItems));
|
|
4561
4600
|
}
|
|
4562
|
-
return
|
|
4601
|
+
return React31.createElement(
|
|
4563
4602
|
WithTooltipPure,
|
|
4564
4603
|
{
|
|
4565
4604
|
closeOnOutsideClick: true,
|
|
@@ -4568,13 +4607,13 @@ var ArgSummary = /* @__PURE__ */ __name(({ value: value2, initialExpandedArgs })
|
|
|
4568
4607
|
onVisibleChange: (isVisible) => {
|
|
4569
4608
|
setIsOpen(isVisible);
|
|
4570
4609
|
},
|
|
4571
|
-
tooltip:
|
|
4610
|
+
tooltip: React31.createElement(Detail, { width: calculateDetailWidth(detail) }, React31.createElement(SyntaxHighlighter2, { language: "jsx", format: false }, detail))
|
|
4572
4611
|
},
|
|
4573
|
-
|
|
4612
|
+
React31.createElement(Expandable, { className: "sbdocs-expandable" }, React31.createElement("span", null, summaryAsString), isOpen ? React31.createElement(ChevronUpIcon, null) : React31.createElement(ChevronDownIcon, null))
|
|
4574
4613
|
);
|
|
4575
4614
|
}, "ArgSummary");
|
|
4576
4615
|
var ArgValue = /* @__PURE__ */ __name(({ value: value2, initialExpandedArgs }) => {
|
|
4577
|
-
return value2 == null ?
|
|
4616
|
+
return value2 == null ? React31.createElement(EmptyArg, null) : React31.createElement(ArgSummary, { value: value2, initialExpandedArgs });
|
|
4578
4617
|
}, "ArgValue");
|
|
4579
4618
|
|
|
4580
4619
|
// ../addons/docs/src/blocks/components/ArgsTable/ArgRow.tsx
|
|
@@ -4626,7 +4665,7 @@ var toSummary = /* @__PURE__ */ __name((value2) => {
|
|
|
4626
4665
|
return { summary: val };
|
|
4627
4666
|
}, "toSummary");
|
|
4628
4667
|
var ArgRow = /* @__PURE__ */ __name((props) => {
|
|
4629
|
-
const [isHovered, setIsHovered] =
|
|
4668
|
+
const [isHovered, setIsHovered] = useState11(false);
|
|
4630
4669
|
const { row, updateArgs, compact, expandable, initialExpandedArgs } = props;
|
|
4631
4670
|
const { name, description } = row;
|
|
4632
4671
|
const table = row.table || {};
|
|
@@ -4634,11 +4673,11 @@ var ArgRow = /* @__PURE__ */ __name((props) => {
|
|
|
4634
4673
|
const defaultValue = table.defaultValue || row.defaultValue;
|
|
4635
4674
|
const required = row.type?.required;
|
|
4636
4675
|
const hasDescription = description != null && description !== "";
|
|
4637
|
-
return
|
|
4676
|
+
return React32.createElement("tr", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) }, React32.createElement(StyledTd, { expandable: expandable ?? false }, React32.createElement(Name, null, name), required ? React32.createElement(Required, { title: "Required" }, "*") : null), compact ? null : React32.createElement("td", null, hasDescription && React32.createElement(Description, null, React32.createElement(index_modern_default, null, description)), table.jsDocTags != null ? React32.createElement(React32.Fragment, null, React32.createElement(TypeWithJsDoc, { hasDescription }, React32.createElement(ArgValue, { value: type, initialExpandedArgs })), React32.createElement(ArgJsDoc, { tags: table.jsDocTags })) : React32.createElement(Type, { hasDescription }, React32.createElement(ArgValue, { value: type, initialExpandedArgs }))), compact ? null : React32.createElement("td", null, React32.createElement(ArgValue, { value: defaultValue, initialExpandedArgs })), updateArgs ? React32.createElement("td", null, React32.createElement(ArgControl, { ...props, isHovered })) : null);
|
|
4638
4677
|
}, "ArgRow");
|
|
4639
4678
|
|
|
4640
4679
|
// ../addons/docs/src/blocks/components/ArgsTable/Empty.tsx
|
|
4641
|
-
import
|
|
4680
|
+
import React33, { useEffect as useEffect10, useState as useState12 } from "react";
|
|
4642
4681
|
import { EmptyTabContent, Link as Link2 } from "storybook/internal/components";
|
|
4643
4682
|
import { DocumentIcon } from "@storybook/icons";
|
|
4644
4683
|
import { styled as styled25 } from "storybook/theming";
|
|
@@ -4660,8 +4699,8 @@ var Links = styled25.div(({ theme: theme3 }) => ({
|
|
|
4660
4699
|
gap: 25
|
|
4661
4700
|
}));
|
|
4662
4701
|
var Empty = /* @__PURE__ */ __name(({ inAddonPanel }) => {
|
|
4663
|
-
const [isLoading, setIsLoading] =
|
|
4664
|
-
|
|
4702
|
+
const [isLoading, setIsLoading] = useState12(true);
|
|
4703
|
+
useEffect10(() => {
|
|
4665
4704
|
const load = setTimeout(() => {
|
|
4666
4705
|
setIsLoading(false);
|
|
4667
4706
|
}, 100);
|
|
@@ -4670,28 +4709,28 @@ var Empty = /* @__PURE__ */ __name(({ inAddonPanel }) => {
|
|
|
4670
4709
|
if (isLoading) {
|
|
4671
4710
|
return null;
|
|
4672
4711
|
}
|
|
4673
|
-
return
|
|
4712
|
+
return React33.createElement(Wrapper9, { inAddonPanel }, React33.createElement(
|
|
4674
4713
|
EmptyTabContent,
|
|
4675
4714
|
{
|
|
4676
4715
|
title: inAddonPanel ? "Interactive story playground" : "Args table with interactive controls couldn't be auto-generated",
|
|
4677
|
-
description:
|
|
4678
|
-
footer:
|
|
4716
|
+
description: React33.createElement(React33.Fragment, null, "Controls give you an easy to use interface to test your components. Set your story args and you'll see controls appearing here automatically."),
|
|
4717
|
+
footer: React33.createElement(Links, null, inAddonPanel && React33.createElement(React33.Fragment, null, React33.createElement(
|
|
4679
4718
|
Link2,
|
|
4680
4719
|
{
|
|
4681
4720
|
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
4682
4721
|
target: "_blank",
|
|
4683
4722
|
withArrow: true
|
|
4684
4723
|
},
|
|
4685
|
-
|
|
4724
|
+
React33.createElement(DocumentIcon, null),
|
|
4686
4725
|
" Read docs"
|
|
4687
|
-
)), !inAddonPanel &&
|
|
4726
|
+
)), !inAddonPanel && React33.createElement(
|
|
4688
4727
|
Link2,
|
|
4689
4728
|
{
|
|
4690
4729
|
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
4691
4730
|
target: "_blank",
|
|
4692
4731
|
withArrow: true
|
|
4693
4732
|
},
|
|
4694
|
-
|
|
4733
|
+
React33.createElement(DocumentIcon, null),
|
|
4695
4734
|
" Learn how to set that up"
|
|
4696
4735
|
))
|
|
4697
4736
|
}
|
|
@@ -4699,7 +4738,7 @@ var Empty = /* @__PURE__ */ __name(({ inAddonPanel }) => {
|
|
|
4699
4738
|
}, "Empty");
|
|
4700
4739
|
|
|
4701
4740
|
// ../addons/docs/src/blocks/components/ArgsTable/SectionRow.tsx
|
|
4702
|
-
import
|
|
4741
|
+
import React34, { useState as useState13 } from "react";
|
|
4703
4742
|
import { ChevronDownIcon as ChevronDownIcon2, ChevronRightIcon } from "@storybook/icons";
|
|
4704
4743
|
import { styled as styled26 } from "storybook/theming";
|
|
4705
4744
|
var ExpanderIconDown = styled26(ChevronDownIcon2)(({ theme: theme3 }) => ({
|
|
@@ -4781,12 +4820,12 @@ var SectionRow = /* @__PURE__ */ __name(({
|
|
|
4781
4820
|
initialExpanded = true,
|
|
4782
4821
|
colSpan = 3
|
|
4783
4822
|
}) => {
|
|
4784
|
-
const [expanded, setExpanded] =
|
|
4823
|
+
const [expanded, setExpanded] = useState13(initialExpanded);
|
|
4785
4824
|
const Level = level === "subsection" ? Subsection : Section;
|
|
4786
4825
|
const itemCount = children?.length || 0;
|
|
4787
4826
|
const caption = level === "subsection" ? `${itemCount} item${itemCount !== 1 ? "s" : ""}` : "";
|
|
4788
4827
|
const helperText = `${expanded ? "Hide" : "Show"} ${level === "subsection" ? itemCount : label} item${itemCount !== 1 ? "s" : ""}`;
|
|
4789
|
-
return
|
|
4828
|
+
return React34.createElement(React34.Fragment, null, React34.createElement(StyledTr, { title: helperText }, React34.createElement(Level, { colSpan: 1 }, React34.createElement(ClickIntercept, { onClick: (e2) => setExpanded(!expanded), tabIndex: 0 }, helperText), React34.createElement(FlexWrapper, null, expanded ? React34.createElement(ExpanderIconDown, null) : React34.createElement(ExpanderIconRight, null), label)), React34.createElement(StyledTd2, { colSpan: colSpan - 1 }, React34.createElement(
|
|
4790
4829
|
ClickIntercept,
|
|
4791
4830
|
{
|
|
4792
4831
|
onClick: (e2) => setExpanded(!expanded),
|
|
@@ -4798,7 +4837,7 @@ var SectionRow = /* @__PURE__ */ __name(({
|
|
|
4798
4837
|
}, "SectionRow");
|
|
4799
4838
|
|
|
4800
4839
|
// ../addons/docs/src/blocks/components/ArgsTable/Skeleton.tsx
|
|
4801
|
-
import
|
|
4840
|
+
import React35 from "react";
|
|
4802
4841
|
import { styled as styled27 } from "storybook/theming";
|
|
4803
4842
|
var TableWrapper = styled27.div(({ theme: theme3 }) => ({
|
|
4804
4843
|
width: "100%",
|
|
@@ -4856,7 +4895,7 @@ var SkeletonText = styled27.div(
|
|
|
4856
4895
|
borderRadius: 3
|
|
4857
4896
|
})
|
|
4858
4897
|
);
|
|
4859
|
-
var Skeleton = /* @__PURE__ */ __name(() =>
|
|
4898
|
+
var Skeleton = /* @__PURE__ */ __name(() => React35.createElement(TableWrapper, null, React35.createElement(Row, null, React35.createElement(Column, { position: "first" }, React35.createElement(SkeletonText, { width: "60%" })), React35.createElement(Column, { position: "second" }, React35.createElement(SkeletonText, { width: "30%" })), React35.createElement(Column, { position: "third" }, React35.createElement(SkeletonText, { width: "60%" })), React35.createElement(Column, { position: "last" }, React35.createElement(SkeletonText, { width: "60%" }))), React35.createElement(Row, null, React35.createElement(Column, { position: "first" }, React35.createElement(SkeletonText, { width: "60%" })), React35.createElement(Column, { position: "second" }, React35.createElement(SkeletonText, { width: "80%" }), React35.createElement(SkeletonText, { width: "30%" })), React35.createElement(Column, { position: "third" }, React35.createElement(SkeletonText, { width: "60%" })), React35.createElement(Column, { position: "last" }, React35.createElement(SkeletonText, { width: "60%" }))), React35.createElement(Row, null, React35.createElement(Column, { position: "first" }, React35.createElement(SkeletonText, { width: "60%" })), React35.createElement(Column, { position: "second" }, React35.createElement(SkeletonText, { width: "80%" }), React35.createElement(SkeletonText, { width: "30%" })), React35.createElement(Column, { position: "third" }, React35.createElement(SkeletonText, { width: "60%" })), React35.createElement(Column, { position: "last" }, React35.createElement(SkeletonText, { width: "60%" }))), React35.createElement(Row, null, React35.createElement(Column, { position: "first" }, React35.createElement(SkeletonText, { width: "60%" })), React35.createElement(Column, { position: "second" }, React35.createElement(SkeletonText, { width: "80%" }), React35.createElement(SkeletonText, { width: "30%" })), React35.createElement(Column, { position: "third" }, React35.createElement(SkeletonText, { width: "60%" })), React35.createElement(Column, { position: "last" }, React35.createElement(SkeletonText, { width: "60%" })))), "Skeleton");
|
|
4860
4899
|
|
|
4861
4900
|
// ../addons/docs/src/blocks/components/ArgsTable/ArgsTable.tsx
|
|
4862
4901
|
var TableWrapper2 = styled28.table(({ theme: theme3, compact, inAddonPanel }) => ({
|
|
@@ -5057,10 +5096,10 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
5057
5096
|
} = props;
|
|
5058
5097
|
if ("error" in props) {
|
|
5059
5098
|
const { error } = props;
|
|
5060
|
-
return
|
|
5099
|
+
return React36.createElement(EmptyBlock, null, error, "\xA0", React36.createElement(Link3, { href: "http://storybook.js.org/docs/?ref=ui", target: "_blank", withArrow: true }, React36.createElement(DocumentIcon2, null), " Read the docs"));
|
|
5061
5100
|
}
|
|
5062
5101
|
if (isLoading) {
|
|
5063
|
-
return
|
|
5102
|
+
return React36.createElement(Skeleton, null);
|
|
5064
5103
|
}
|
|
5065
5104
|
const { rows, args, globals } = "rows" in props ? props : { rows: void 0, args: void 0, globals: void 0 };
|
|
5066
5105
|
const groups = groupRows(
|
|
@@ -5074,7 +5113,7 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
5074
5113
|
const hasNoSections = Object.entries(groups.sections).length === 0;
|
|
5075
5114
|
const hasNoUngroupedSubsections = Object.entries(groups.ungroupedSubsections).length === 0;
|
|
5076
5115
|
if (hasNoUngrouped && hasNoSections && hasNoUngroupedSubsections) {
|
|
5077
|
-
return
|
|
5116
|
+
return React36.createElement(Empty, { inAddonPanel });
|
|
5078
5117
|
}
|
|
5079
5118
|
let colSpan = 1;
|
|
5080
5119
|
if (updateArgs) {
|
|
@@ -5085,15 +5124,15 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
5085
5124
|
}
|
|
5086
5125
|
const expandable = Object.keys(groups.sections).length > 0;
|
|
5087
5126
|
const common = { updateArgs, compact, inAddonPanel, initialExpandedArgs };
|
|
5088
|
-
return
|
|
5127
|
+
return React36.createElement(ResetWrapper3, null, React36.createElement(TablePositionWrapper, null, updateArgs && !isLoading && resetArgs && React36.createElement(ButtonPositionWrapper, null, React36.createElement(
|
|
5089
5128
|
IconButton3,
|
|
5090
5129
|
{
|
|
5091
5130
|
onClick: () => resetArgs(),
|
|
5092
5131
|
"aria-label": "Reset controls",
|
|
5093
5132
|
title: "Reset controls"
|
|
5094
5133
|
},
|
|
5095
|
-
|
|
5096
|
-
)),
|
|
5134
|
+
React36.createElement(UndoIcon, null)
|
|
5135
|
+
)), React36.createElement(TableWrapper2, { ...{ compact, inAddonPanel }, className: "docblock-argstable sb-unstyled" }, React36.createElement("thead", { className: "docblock-argstable-head" }, React36.createElement("tr", null, React36.createElement("th", null, React36.createElement("span", null, "Name")), compact ? null : React36.createElement("th", null, React36.createElement("span", null, "Description")), compact ? null : React36.createElement("th", null, React36.createElement("span", null, "Default")), updateArgs ? React36.createElement("th", null, React36.createElement("span", null, "Control")) : null)), React36.createElement("tbody", { className: "docblock-argstable-body" }, groups.ungrouped.map((row) => React36.createElement(ArgRow, { key: row.key, row, arg: args && args[row.key], ...common })), Object.entries(groups.ungroupedSubsections).map(([subcategory, subsection]) => React36.createElement(
|
|
5097
5136
|
SectionRow,
|
|
5098
5137
|
{
|
|
5099
5138
|
key: subcategory,
|
|
@@ -5101,7 +5140,7 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
5101
5140
|
level: "subsection",
|
|
5102
5141
|
colSpan
|
|
5103
5142
|
},
|
|
5104
|
-
subsection.map((row) =>
|
|
5143
|
+
subsection.map((row) => React36.createElement(
|
|
5105
5144
|
ArgRow,
|
|
5106
5145
|
{
|
|
5107
5146
|
key: row.key,
|
|
@@ -5111,7 +5150,7 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
5111
5150
|
...common
|
|
5112
5151
|
}
|
|
5113
5152
|
))
|
|
5114
|
-
)), Object.entries(groups.sections).map(([category, section]) =>
|
|
5153
|
+
)), Object.entries(groups.sections).map(([category, section]) => React36.createElement(SectionRow, { key: category, label: category, level: "section", colSpan }, section.ungrouped.map((row) => React36.createElement(ArgRow, { key: row.key, row, arg: args && args[row.key], ...common })), Object.entries(section.subsections).map(([subcategory, subsection]) => React36.createElement(
|
|
5115
5154
|
SectionRow,
|
|
5116
5155
|
{
|
|
5117
5156
|
key: subcategory,
|
|
@@ -5119,7 +5158,7 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
5119
5158
|
level: "subsection",
|
|
5120
5159
|
colSpan
|
|
5121
5160
|
},
|
|
5122
|
-
subsection.map((row) =>
|
|
5161
|
+
subsection.map((row) => React36.createElement(
|
|
5123
5162
|
ArgRow,
|
|
5124
5163
|
{
|
|
5125
5164
|
key: row.key,
|
|
@@ -5137,7 +5176,7 @@ var ADDON_ID6 = "addon-controls";
|
|
|
5137
5176
|
var PARAM_KEY5 = "controls";
|
|
5138
5177
|
|
|
5139
5178
|
// src/controls/components/SaveStory.tsx
|
|
5140
|
-
import
|
|
5179
|
+
import React37 from "react";
|
|
5141
5180
|
import {
|
|
5142
5181
|
Bar as BaseBar,
|
|
5143
5182
|
Button as Button5,
|
|
@@ -5225,11 +5264,11 @@ var SaveStory = /* @__PURE__ */ __name(({
|
|
|
5225
5264
|
resetArgs,
|
|
5226
5265
|
portalSelector
|
|
5227
5266
|
}) => {
|
|
5228
|
-
const inputRef =
|
|
5229
|
-
const [saving, setSaving] =
|
|
5230
|
-
const [creating, setCreating] =
|
|
5231
|
-
const [storyName, setStoryName] =
|
|
5232
|
-
const [errorMessage, setErrorMessage] =
|
|
5267
|
+
const inputRef = React37.useRef(null);
|
|
5268
|
+
const [saving, setSaving] = React37.useState(false);
|
|
5269
|
+
const [creating, setCreating] = React37.useState(false);
|
|
5270
|
+
const [storyName, setStoryName] = React37.useState("");
|
|
5271
|
+
const [errorMessage, setErrorMessage] = React37.useState(null);
|
|
5233
5272
|
const onSaveStory = /* @__PURE__ */ __name(async () => {
|
|
5234
5273
|
if (saving) {
|
|
5235
5274
|
return;
|
|
@@ -5264,34 +5303,34 @@ var SaveStory = /* @__PURE__ */ __name(({
|
|
|
5264
5303
|
setSaving(false);
|
|
5265
5304
|
}
|
|
5266
5305
|
}, "onSubmitForm");
|
|
5267
|
-
return
|
|
5306
|
+
return React37.createElement(Container2, { id: "save-from-controls" }, React37.createElement(Bar2, null, React37.createElement(Actions, null, React37.createElement(
|
|
5268
5307
|
WithTooltip,
|
|
5269
5308
|
{
|
|
5270
5309
|
as: "div",
|
|
5271
5310
|
hasChrome: false,
|
|
5272
5311
|
trigger: "hover",
|
|
5273
|
-
tooltip:
|
|
5312
|
+
tooltip: React37.createElement(TooltipNote, { note: "Save changes to story" })
|
|
5274
5313
|
},
|
|
5275
|
-
|
|
5276
|
-
),
|
|
5314
|
+
React37.createElement(IconButton4, { "aria-label": "Save changes to story", disabled: saving, onClick: onSaveStory }, React37.createElement(CheckIcon, null), React37.createElement(Label5, { "data-short-label": "Save" }, "Update story"))
|
|
5315
|
+
), React37.createElement(
|
|
5277
5316
|
WithTooltip,
|
|
5278
5317
|
{
|
|
5279
5318
|
as: "div",
|
|
5280
5319
|
hasChrome: false,
|
|
5281
5320
|
trigger: "hover",
|
|
5282
|
-
tooltip:
|
|
5321
|
+
tooltip: React37.createElement(TooltipNote, { note: "Create new story with these settings" })
|
|
5283
5322
|
},
|
|
5284
|
-
|
|
5285
|
-
),
|
|
5323
|
+
React37.createElement(IconButton4, { "aria-label": "Create new story with these settings", onClick: onShowForm }, React37.createElement(AddIcon2, null), React37.createElement(Label5, { "data-short-label": "New" }, "Create new story"))
|
|
5324
|
+
), React37.createElement(
|
|
5286
5325
|
WithTooltip,
|
|
5287
5326
|
{
|
|
5288
5327
|
as: "div",
|
|
5289
5328
|
hasChrome: false,
|
|
5290
5329
|
trigger: "hover",
|
|
5291
|
-
tooltip:
|
|
5330
|
+
tooltip: React37.createElement(TooltipNote, { note: "Reset changes" })
|
|
5292
5331
|
},
|
|
5293
|
-
|
|
5294
|
-
)),
|
|
5332
|
+
React37.createElement(IconButton4, { "aria-label": "Reset changes", onClick: () => resetArgs() }, React37.createElement(UndoIcon2, null), React37.createElement("span", null, "Reset"))
|
|
5333
|
+
)), React37.createElement(Info, null, React37.createElement(Label5, { "data-short-label": "Unsaved changes" }, "You modified this story. Do you want to save your changes?")), React37.createElement(
|
|
5295
5334
|
Modal,
|
|
5296
5335
|
{
|
|
5297
5336
|
width: 350,
|
|
@@ -5299,7 +5338,7 @@ var SaveStory = /* @__PURE__ */ __name(({
|
|
|
5299
5338
|
onOpenChange: setCreating,
|
|
5300
5339
|
portalSelector
|
|
5301
5340
|
},
|
|
5302
|
-
|
|
5341
|
+
React37.createElement(Form6, { onSubmit: onSubmitForm, id: "create-new-story-form" }, React37.createElement(Modal.Content, null, React37.createElement(Modal.Header, null, React37.createElement(Modal.Title, null, "Create new story"), React37.createElement(Modal.Description, null, "This will add a new story to your existing stories file.")), React37.createElement(
|
|
5303
5342
|
ModalInput,
|
|
5304
5343
|
{
|
|
5305
5344
|
onChange,
|
|
@@ -5308,8 +5347,8 @@ var SaveStory = /* @__PURE__ */ __name(({
|
|
|
5308
5347
|
ref: inputRef,
|
|
5309
5348
|
value: storyName
|
|
5310
5349
|
}
|
|
5311
|
-
),
|
|
5312
|
-
errorMessage &&
|
|
5350
|
+
), React37.createElement(Modal.Actions, null, React37.createElement(Button5, { disabled: saving || !storyName, size: "medium", type: "submit", variant: "solid" }, "Create"), React37.createElement(Modal.Dialog.Close, { asChild: true }, React37.createElement(Button5, { disabled: saving, size: "medium", type: "reset" }, "Cancel"))))),
|
|
5351
|
+
errorMessage && React37.createElement(Modal.Error, null, errorMessage)
|
|
5313
5352
|
)));
|
|
5314
5353
|
}, "SaveStory");
|
|
5315
5354
|
|
|
@@ -5327,7 +5366,7 @@ var AddonWrapper = styled30.div({
|
|
|
5327
5366
|
});
|
|
5328
5367
|
var ControlsPanel = /* @__PURE__ */ __name(({ saveStory, createStory }) => {
|
|
5329
5368
|
const api = useStorybookApi();
|
|
5330
|
-
const [isLoading, setIsLoading] =
|
|
5369
|
+
const [isLoading, setIsLoading] = useState14(true);
|
|
5331
5370
|
const [args, updateArgs, resetArgs, initialArgs] = useArgs();
|
|
5332
5371
|
const [globals] = useGlobals();
|
|
5333
5372
|
const rows = useArgTypes();
|
|
@@ -5339,7 +5378,7 @@ var ControlsPanel = /* @__PURE__ */ __name(({ saveStory, createStory }) => {
|
|
|
5339
5378
|
} = useParameter(PARAM_KEY5, {});
|
|
5340
5379
|
const { path, previewInitialized } = useStorybookState();
|
|
5341
5380
|
const storyData = api.getCurrentStoryData();
|
|
5342
|
-
|
|
5381
|
+
useEffect11(() => {
|
|
5343
5382
|
if (previewInitialized) {
|
|
5344
5383
|
setIsLoading(false);
|
|
5345
5384
|
}
|
|
@@ -5358,7 +5397,7 @@ var ControlsPanel = /* @__PURE__ */ __name(({ saveStory, createStory }) => {
|
|
|
5358
5397
|
() => !!args && !!initialArgs && !dequal(clean(args), clean(initialArgs)),
|
|
5359
5398
|
[args, initialArgs]
|
|
5360
5399
|
);
|
|
5361
|
-
return
|
|
5400
|
+
return React38.createElement(AddonWrapper, null, React38.createElement(
|
|
5362
5401
|
ArgsTable,
|
|
5363
5402
|
{
|
|
5364
5403
|
key: path,
|
|
@@ -5372,11 +5411,11 @@ var ControlsPanel = /* @__PURE__ */ __name(({ saveStory, createStory }) => {
|
|
|
5372
5411
|
sort,
|
|
5373
5412
|
isLoading
|
|
5374
5413
|
}
|
|
5375
|
-
), hasControls && storyData.type === "story" && storyData.subtype !== "test" && hasUpdatedArgs && global.CONFIG_TYPE === "DEVELOPMENT" && disableSaveFromUI !== true &&
|
|
5414
|
+
), hasControls && storyData.type === "story" && storyData.subtype !== "test" && hasUpdatedArgs && global.CONFIG_TYPE === "DEVELOPMENT" && disableSaveFromUI !== true && React38.createElement(SaveStory, { ...{ resetArgs, saveStory, createStory } }));
|
|
5376
5415
|
}, "ControlsPanel");
|
|
5377
5416
|
|
|
5378
5417
|
// src/controls/components/Title.tsx
|
|
5379
|
-
import
|
|
5418
|
+
import React39 from "react";
|
|
5380
5419
|
import { Badge } from "storybook/internal/components";
|
|
5381
5420
|
import { useArgTypes as useArgTypes2, useStorybookApi as useStorybookApi2 } from "storybook/manager-api";
|
|
5382
5421
|
function Title2() {
|
|
@@ -5386,8 +5425,8 @@ function Title2() {
|
|
|
5386
5425
|
const controlsCount = Object.values(rows).filter(
|
|
5387
5426
|
(argType) => argType?.control && !argType?.table?.disable
|
|
5388
5427
|
).length;
|
|
5389
|
-
const suffix = controlsCount === 0 ? null :
|
|
5390
|
-
return
|
|
5428
|
+
const suffix = controlsCount === 0 ? null : React39.createElement(Badge, { compact: true, status: selectedPanel === ADDON_ID6 ? "active" : "neutral" }, controlsCount);
|
|
5429
|
+
return React39.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6 } }, React39.createElement("span", null, "Controls"), suffix);
|
|
5391
5430
|
}
|
|
5392
5431
|
__name(Title2, "Title");
|
|
5393
5432
|
|
|
@@ -5424,17 +5463,17 @@ var manager_default = addons.register(ADDON_ID6, (api) => {
|
|
|
5424
5463
|
});
|
|
5425
5464
|
api.addNotification({
|
|
5426
5465
|
id: "save-story-success",
|
|
5427
|
-
icon:
|
|
5466
|
+
icon: React40.createElement(PassedIcon, { color: color.positive }),
|
|
5428
5467
|
content: {
|
|
5429
5468
|
headline: "Story saved",
|
|
5430
|
-
subHeadline:
|
|
5469
|
+
subHeadline: React40.createElement(React40.Fragment, null, "Updated story ", React40.createElement("b", null, response.sourceStoryName), ".")
|
|
5431
5470
|
},
|
|
5432
5471
|
duration: 8e3
|
|
5433
5472
|
});
|
|
5434
5473
|
} catch (error) {
|
|
5435
5474
|
api.addNotification({
|
|
5436
5475
|
id: "save-story-error",
|
|
5437
|
-
icon:
|
|
5476
|
+
icon: React40.createElement(FailedIcon, { color: color.negative }),
|
|
5438
5477
|
content: {
|
|
5439
5478
|
headline: "Failed to save story",
|
|
5440
5479
|
subHeadline: error?.message || "Check the Storybook process on the command line for more details."
|
|
@@ -5457,10 +5496,10 @@ var manager_default = addons.register(ADDON_ID6, (api) => {
|
|
|
5457
5496
|
});
|
|
5458
5497
|
api.addNotification({
|
|
5459
5498
|
id: "save-story-success",
|
|
5460
|
-
icon:
|
|
5499
|
+
icon: React40.createElement(PassedIcon, { color: color.positive }),
|
|
5461
5500
|
content: {
|
|
5462
5501
|
headline: "Story created",
|
|
5463
|
-
subHeadline:
|
|
5502
|
+
subHeadline: React40.createElement(React40.Fragment, null, "Added story ", React40.createElement("b", null, response.newStoryName), " based on ", React40.createElement("b", null, response.sourceStoryName), ".")
|
|
5464
5503
|
},
|
|
5465
5504
|
duration: 8e3,
|
|
5466
5505
|
onClick: /* @__PURE__ */ __name(({ onDismiss }) => {
|
|
@@ -5477,7 +5516,7 @@ var manager_default = addons.register(ADDON_ID6, (api) => {
|
|
|
5477
5516
|
if (!active || !api.getCurrentStoryData()) {
|
|
5478
5517
|
return null;
|
|
5479
5518
|
}
|
|
5480
|
-
return
|
|
5519
|
+
return React40.createElement(AddonPanel, { active }, React40.createElement(ControlsPanel, { saveStory, createStory }));
|
|
5481
5520
|
}, "render")
|
|
5482
5521
|
});
|
|
5483
5522
|
channel.on(SAVE_STORY_RESPONSE, (data) => {
|
|
@@ -5497,11 +5536,11 @@ var manager_default = addons.register(ADDON_ID6, (api) => {
|
|
|
5497
5536
|
});
|
|
5498
5537
|
|
|
5499
5538
|
// src/actions/manager.tsx
|
|
5500
|
-
import
|
|
5539
|
+
import React46 from "react";
|
|
5501
5540
|
import { addons as addons2, types as types2 } from "storybook/manager-api";
|
|
5502
5541
|
|
|
5503
5542
|
// src/actions/components/Title.tsx
|
|
5504
|
-
import
|
|
5543
|
+
import React41 from "react";
|
|
5505
5544
|
import { Badge as Badge2 } from "storybook/internal/components";
|
|
5506
5545
|
import { STORY_CHANGED } from "storybook/internal/core-events";
|
|
5507
5546
|
import { useAddonState, useChannel, useStorybookApi as useStorybookApi3 } from "storybook/manager-api";
|
|
@@ -5520,27 +5559,27 @@ function Title3() {
|
|
|
5520
5559
|
setCount((c2) => ({ ...c2, count: 0 }));
|
|
5521
5560
|
}
|
|
5522
5561
|
});
|
|
5523
|
-
const suffix = count === 0 ? null :
|
|
5524
|
-
return
|
|
5562
|
+
const suffix = count === 0 ? null : React41.createElement(Badge2, { compact: true, status: selectedPanel === PANEL_ID ? "active" : "neutral" }, count);
|
|
5563
|
+
return React41.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6 } }, React41.createElement("span", null, "Actions"), suffix);
|
|
5525
5564
|
}
|
|
5526
5565
|
__name(Title3, "Title");
|
|
5527
5566
|
|
|
5528
5567
|
// src/actions/containers/ActionLogger/index.tsx
|
|
5529
|
-
import
|
|
5568
|
+
import React45, { Component as Component4 } from "react";
|
|
5530
5569
|
import { STORY_CHANGED as STORY_CHANGED2 } from "storybook/internal/core-events";
|
|
5531
5570
|
|
|
5532
5571
|
// src/actions/components/ActionLogger/index.tsx
|
|
5533
|
-
import
|
|
5572
|
+
import React44, { Fragment, forwardRef, useEffect as useEffect12, useRef as useRef6 } from "react";
|
|
5534
5573
|
import { ActionBar as ActionBar2, ScrollArea } from "storybook/internal/components";
|
|
5535
5574
|
|
|
5536
5575
|
// ../node_modules/react-inspector/dist/index.mjs
|
|
5537
5576
|
import React92 from "react";
|
|
5538
|
-
import React310, { useContext as
|
|
5539
|
-
import { createContext as
|
|
5577
|
+
import React310, { useContext as useContext22, useCallback as useCallback7, useLayoutEffect, useState as useState15, memo as memo2 } from "react";
|
|
5578
|
+
import { createContext as createContext3 } from "react";
|
|
5540
5579
|
import React210, { Children as Children2, memo } from "react";
|
|
5541
|
-
import
|
|
5580
|
+
import React42, { createContext as createContext22, useContext as useContext3, useMemo as useMemo4 } from "react";
|
|
5542
5581
|
import React72 from "react";
|
|
5543
|
-
import
|
|
5582
|
+
import React43 from "react";
|
|
5544
5583
|
import React62 from "react";
|
|
5545
5584
|
import React52 from "react";
|
|
5546
5585
|
import React82 from "react";
|
|
@@ -5690,7 +5729,7 @@ var theme2 = {
|
|
|
5690
5729
|
TABLE_DATA_BACKGROUND_IMAGE: "linear-gradient(to bottom, white, white 50%, rgb(234, 243, 255) 50%, rgb(234, 243, 255))",
|
|
5691
5730
|
TABLE_DATA_BACKGROUND_SIZE: "128px 32px"
|
|
5692
5731
|
};
|
|
5693
|
-
var ExpandedPathsContext =
|
|
5732
|
+
var ExpandedPathsContext = createContext3([{}, () => {
|
|
5694
5733
|
}]);
|
|
5695
5734
|
var unselectable = {
|
|
5696
5735
|
WebkitTouchCallout: "none",
|
|
@@ -5958,7 +5997,7 @@ var createTheme = /* @__PURE__ */ __name((theme3) => ({
|
|
|
5958
5997
|
var DEFAULT_THEME_NAME = "chromeLight";
|
|
5959
5998
|
var ThemeContext = createContext22(createTheme(themes_exports[DEFAULT_THEME_NAME]));
|
|
5960
5999
|
var useStyles = /* @__PURE__ */ __name((baseStylesKey) => {
|
|
5961
|
-
const themeStyles =
|
|
6000
|
+
const themeStyles = useContext3(ThemeContext);
|
|
5962
6001
|
return themeStyles[baseStylesKey];
|
|
5963
6002
|
}, "useStyles");
|
|
5964
6003
|
var themeAcceptor = /* @__PURE__ */ __name((WrappedComponent) => {
|
|
@@ -5973,9 +6012,9 @@ var themeAcceptor = /* @__PURE__ */ __name((WrappedComponent) => {
|
|
|
5973
6012
|
return createTheme(themes_exports[DEFAULT_THEME_NAME]);
|
|
5974
6013
|
}
|
|
5975
6014
|
}, [theme3]);
|
|
5976
|
-
return
|
|
6015
|
+
return React42.createElement(ThemeContext.Provider, {
|
|
5977
6016
|
value: themeStyles
|
|
5978
|
-
},
|
|
6017
|
+
}, React42.createElement(WrappedComponent, {
|
|
5979
6018
|
...restProps
|
|
5980
6019
|
}));
|
|
5981
6020
|
}, "ThemeAcceptor");
|
|
@@ -6068,7 +6107,7 @@ var getExpandedPaths = /* @__PURE__ */ __name((data, dataIterator, expandPaths,
|
|
|
6068
6107
|
}, "getExpandedPaths");
|
|
6069
6108
|
var ConnectedTreeNode = memo2((props) => {
|
|
6070
6109
|
const { data, dataIterator, path, depth, nodeRenderer } = props;
|
|
6071
|
-
const [expandedPaths, setExpandedPaths] =
|
|
6110
|
+
const [expandedPaths, setExpandedPaths] = useContext22(ExpandedPathsContext);
|
|
6072
6111
|
const nodeHasChildNodes = hasChildNodes(data, dataIterator);
|
|
6073
6112
|
const expanded = !!expandedPaths[path];
|
|
6074
6113
|
const handleClick = useCallback7(() => nodeHasChildNodes && setExpandedPaths((prevExpandedPaths) => ({
|
|
@@ -6097,7 +6136,7 @@ var ConnectedTreeNode = memo2((props) => {
|
|
|
6097
6136
|
});
|
|
6098
6137
|
var TreeView = memo2(({ name, data, dataIterator, nodeRenderer, expandPaths, expandLevel }) => {
|
|
6099
6138
|
const styles = useStyles("TreeView");
|
|
6100
|
-
const stateAndSetter =
|
|
6139
|
+
const stateAndSetter = useState15({});
|
|
6101
6140
|
const [, setExpandedPaths] = stateAndSetter;
|
|
6102
6141
|
useLayoutEffect(() => setExpandedPaths((prevExpandedPaths) => getExpandedPaths(data, dataIterator, expandPaths, expandLevel, prevExpandedPaths)), [data, dataIterator, expandPaths, expandLevel]);
|
|
6103
6142
|
return React310.createElement(ExpandedPathsContext.Provider, {
|
|
@@ -6121,7 +6160,7 @@ var ObjectName = /* @__PURE__ */ __name(({ name, dimmed = false, styles = {} })
|
|
|
6121
6160
|
...dimmed ? themeStyles["dimmed"] : {},
|
|
6122
6161
|
...styles
|
|
6123
6162
|
};
|
|
6124
|
-
return
|
|
6163
|
+
return React43.createElement("span", {
|
|
6125
6164
|
style: appliedStyles
|
|
6126
6165
|
}, name);
|
|
6127
6166
|
}, "ObjectName");
|
|
@@ -6774,24 +6813,24 @@ var InspectorContainer = styled31.div({
|
|
|
6774
6813
|
|
|
6775
6814
|
// src/actions/components/ActionLogger/index.tsx
|
|
6776
6815
|
var UnstyledWrapped = forwardRef(
|
|
6777
|
-
({ children, className }, ref) =>
|
|
6816
|
+
({ children, className }, ref) => React44.createElement(ScrollArea, { ref, horizontal: true, vertical: true, className }, children)
|
|
6778
6817
|
);
|
|
6779
6818
|
UnstyledWrapped.displayName = "UnstyledWrapped";
|
|
6780
6819
|
var Wrapper10 = styled32(UnstyledWrapped)({
|
|
6781
6820
|
margin: 0,
|
|
6782
6821
|
padding: "10px 5px 20px"
|
|
6783
6822
|
});
|
|
6784
|
-
var ThemedInspector = withTheme(({ theme: theme3, ...props }) =>
|
|
6823
|
+
var ThemedInspector = withTheme(({ theme: theme3, ...props }) => React44.createElement(Inspector, { theme: theme3.addonActionsTheme || "chromeLight", table: false, ...props }));
|
|
6785
6824
|
var ActionLogger = /* @__PURE__ */ __name(({ actions, onClear }) => {
|
|
6786
6825
|
const wrapperRef = useRef6(null);
|
|
6787
6826
|
const wrapper = wrapperRef.current;
|
|
6788
6827
|
const wasAtBottom = wrapper && wrapper.scrollHeight - wrapper.scrollTop === wrapper.clientHeight;
|
|
6789
|
-
|
|
6828
|
+
useEffect12(() => {
|
|
6790
6829
|
if (wasAtBottom) {
|
|
6791
6830
|
wrapperRef.current.scrollTop = wrapperRef.current.scrollHeight;
|
|
6792
6831
|
}
|
|
6793
6832
|
}, [wasAtBottom, actions.length]);
|
|
6794
|
-
return
|
|
6833
|
+
return React44.createElement(Fragment, null, React44.createElement(Wrapper10, { ref: wrapperRef }, actions.map((action) => React44.createElement(Action, { key: action.id }, action.count > 1 && React44.createElement(Counter, null, action.count), React44.createElement(InspectorContainer, null, React44.createElement(
|
|
6795
6834
|
ThemedInspector,
|
|
6796
6835
|
{
|
|
6797
6836
|
sortObjectKeys: true,
|
|
@@ -6799,7 +6838,7 @@ var ActionLogger = /* @__PURE__ */ __name(({ actions, onClear }) => {
|
|
|
6799
6838
|
name: action.data.name,
|
|
6800
6839
|
data: action.data.args ?? action.data
|
|
6801
6840
|
}
|
|
6802
|
-
))))),
|
|
6841
|
+
))))), React44.createElement(ActionBar2, { actionItems: [{ title: "Clear", onClick: onClear }] }));
|
|
6803
6842
|
}, "ActionLogger");
|
|
6804
6843
|
|
|
6805
6844
|
// src/actions/containers/ActionLogger/index.tsx
|
|
@@ -6859,7 +6898,7 @@ var _ActionLogger = class _ActionLogger extends Component4 {
|
|
|
6859
6898
|
actions,
|
|
6860
6899
|
onClear: this.clearActions
|
|
6861
6900
|
};
|
|
6862
|
-
return active ?
|
|
6901
|
+
return active ? React45.createElement(ActionLogger, { ...props }) : null;
|
|
6863
6902
|
}
|
|
6864
6903
|
};
|
|
6865
6904
|
__name(_ActionLogger, "ActionLogger");
|
|
@@ -6871,19 +6910,19 @@ var manager_default2 = addons2.register(ADDON_ID, (api) => {
|
|
|
6871
6910
|
addons2.add(PANEL_ID, {
|
|
6872
6911
|
title: Title3,
|
|
6873
6912
|
type: types2.PANEL,
|
|
6874
|
-
render: /* @__PURE__ */ __name(({ active }) =>
|
|
6913
|
+
render: /* @__PURE__ */ __name(({ active }) => React46.createElement(ActionLogger2, { api, active: !!active }), "render"),
|
|
6875
6914
|
paramKey: PARAM_KEY
|
|
6876
6915
|
});
|
|
6877
6916
|
}
|
|
6878
6917
|
});
|
|
6879
6918
|
|
|
6880
6919
|
// src/component-testing/manager.tsx
|
|
6881
|
-
import
|
|
6920
|
+
import React69 from "react";
|
|
6882
6921
|
import { AddonPanel as AddonPanel2 } from "storybook/internal/components";
|
|
6883
6922
|
import { Consumer, addons as addons3, types as types3 } from "storybook/manager-api";
|
|
6884
6923
|
|
|
6885
6924
|
// src/component-testing/components/Panel.tsx
|
|
6886
|
-
import
|
|
6925
|
+
import React67, { Fragment as Fragment3, memo as memo4, useEffect as useEffect18, useMemo as useMemo5, useRef as useRef7, useState as useState23 } from "react";
|
|
6887
6926
|
import {
|
|
6888
6927
|
FORCE_REMOUNT,
|
|
6889
6928
|
PLAY_FUNCTION_THREW_EXCEPTION,
|
|
@@ -6967,7 +7006,7 @@ var STORE_CHANNEL_EVENT_NAME = `UNIVERSAL_STORE:${storeOptions.id}`;
|
|
|
6967
7006
|
var STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test";
|
|
6968
7007
|
|
|
6969
7008
|
// src/component-testing/components/InteractionsPanel.tsx
|
|
6970
|
-
import * as
|
|
7009
|
+
import * as React66 from "react";
|
|
6971
7010
|
import { styled as styled41 } from "storybook/theming";
|
|
6972
7011
|
|
|
6973
7012
|
// src/component-testing/utils.ts
|
|
@@ -7022,7 +7061,7 @@ function useAnsiToHtmlFilter() {
|
|
|
7022
7061
|
__name(useAnsiToHtmlFilter, "useAnsiToHtmlFilter");
|
|
7023
7062
|
|
|
7024
7063
|
// src/component-testing/components/DetachedDebuggerMessage.tsx
|
|
7025
|
-
import
|
|
7064
|
+
import React47 from "react";
|
|
7026
7065
|
import { Link as Link4 } from "storybook/internal/components";
|
|
7027
7066
|
import { styled as styled33 } from "storybook/theming";
|
|
7028
7067
|
var Wrapper11 = styled33.div(({ theme: { color: color2, typography: typography4, background } }) => ({
|
|
@@ -7038,7 +7077,7 @@ var Wrapper11 = styled33.div(({ theme: { color: color2, typography: typography4,
|
|
|
7038
7077
|
position: "relative"
|
|
7039
7078
|
}));
|
|
7040
7079
|
var DetachedDebuggerMessage = /* @__PURE__ */ __name(({ storyUrl }) => {
|
|
7041
|
-
return
|
|
7080
|
+
return React47.createElement(Wrapper11, null, "Debugger controls are not available on composed Storybooks.", " ", React47.createElement(
|
|
7042
7081
|
Link4,
|
|
7043
7082
|
{
|
|
7044
7083
|
href: `${storyUrl}&addonPanel=${PANEL_ID2}`,
|
|
@@ -7051,7 +7090,7 @@ var DetachedDebuggerMessage = /* @__PURE__ */ __name(({ storyUrl }) => {
|
|
|
7051
7090
|
}, "DetachedDebuggerMessage");
|
|
7052
7091
|
|
|
7053
7092
|
// src/component-testing/components/EmptyState.tsx
|
|
7054
|
-
import
|
|
7093
|
+
import React48, { useEffect as useEffect13, useState as useState16 } from "react";
|
|
7055
7094
|
import { EmptyTabContent as EmptyTabContent2, Link as Link5 } from "storybook/internal/components";
|
|
7056
7095
|
import { DocumentIcon as DocumentIcon3 } from "@storybook/icons";
|
|
7057
7096
|
import { useStorybookApi as useStorybookApi4 } from "storybook/manager-api";
|
|
@@ -7062,14 +7101,14 @@ var Links2 = styled34.div(({ theme: theme3 }) => ({
|
|
|
7062
7101
|
gap: 25
|
|
7063
7102
|
}));
|
|
7064
7103
|
var Empty2 = /* @__PURE__ */ __name(() => {
|
|
7065
|
-
const [isLoading, setIsLoading] =
|
|
7104
|
+
const [isLoading, setIsLoading] = useState16(true);
|
|
7066
7105
|
const api = useStorybookApi4();
|
|
7067
7106
|
const docsUrl = api.getDocsUrl({
|
|
7068
7107
|
subpath: DOCUMENTATION_PLAY_FUNCTION_LINK,
|
|
7069
7108
|
versioned: true,
|
|
7070
7109
|
renderer: true
|
|
7071
7110
|
});
|
|
7072
|
-
|
|
7111
|
+
useEffect13(() => {
|
|
7073
7112
|
const load = setTimeout(() => {
|
|
7074
7113
|
setIsLoading(false);
|
|
7075
7114
|
}, 100);
|
|
@@ -7078,32 +7117,32 @@ var Empty2 = /* @__PURE__ */ __name(() => {
|
|
|
7078
7117
|
if (isLoading) {
|
|
7079
7118
|
return null;
|
|
7080
7119
|
}
|
|
7081
|
-
return
|
|
7120
|
+
return React48.createElement("div", null, React48.createElement(
|
|
7082
7121
|
EmptyTabContent2,
|
|
7083
7122
|
{
|
|
7084
7123
|
title: "Interactions",
|
|
7085
|
-
description:
|
|
7086
|
-
footer:
|
|
7124
|
+
description: React48.createElement(React48.Fragment, null, "Interactions allow you to verify the functional aspects of UIs. Write a play function for your story and you'll see it run here."),
|
|
7125
|
+
footer: React48.createElement(Links2, null, React48.createElement(Link5, { href: docsUrl, target: "_blank", withArrow: true }, React48.createElement(DocumentIcon3, null), " Read docs"))
|
|
7087
7126
|
}
|
|
7088
7127
|
));
|
|
7089
7128
|
}, "Empty");
|
|
7090
7129
|
|
|
7091
7130
|
// src/component-testing/components/Interaction.tsx
|
|
7092
|
-
import * as
|
|
7131
|
+
import * as React61 from "react";
|
|
7093
7132
|
import { IconButton as IconButton5, TooltipNote as TooltipNote2, WithTooltip as WithTooltip2 } from "storybook/internal/components";
|
|
7094
7133
|
import { ChevronDownIcon as ChevronDownIcon3, ChevronUpIcon as ChevronUpIcon2 } from "@storybook/icons";
|
|
7095
7134
|
import { styled as styled37, typography as typography2 } from "storybook/theming";
|
|
7096
7135
|
|
|
7097
7136
|
// src/component-testing/components/MatcherResult.tsx
|
|
7098
|
-
import
|
|
7137
|
+
import React59 from "react";
|
|
7099
7138
|
import { styled as styled35, typography } from "storybook/theming";
|
|
7100
7139
|
|
|
7101
7140
|
// src/component-testing/components/MethodCall.tsx
|
|
7102
|
-
import
|
|
7141
|
+
import React58, { Fragment as Fragment2 } from "react";
|
|
7103
7142
|
import { logger as logger4 } from "storybook/internal/client-logger";
|
|
7104
7143
|
|
|
7105
7144
|
// ../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectInspector.js
|
|
7106
|
-
import
|
|
7145
|
+
import React57, { useEffect as useEffect17, useState as useState20 } from "react";
|
|
7107
7146
|
|
|
7108
7147
|
// ../node_modules/clsx/dist/clsx.m.js
|
|
7109
7148
|
function toVal(mix) {
|
|
@@ -7298,9 +7337,9 @@ function _objectSpread2(e2) {
|
|
|
7298
7337
|
__name(_objectSpread2, "_objectSpread2");
|
|
7299
7338
|
|
|
7300
7339
|
// ../node_modules/@devtools-ds/themes/dist/esm/utils.js
|
|
7301
|
-
import
|
|
7340
|
+
import React49 from "react";
|
|
7302
7341
|
var _excluded = ["children"];
|
|
7303
|
-
var ThemeContext2 =
|
|
7342
|
+
var ThemeContext2 = React49.createContext({
|
|
7304
7343
|
theme: "chrome",
|
|
7305
7344
|
colorScheme: "light"
|
|
7306
7345
|
});
|
|
@@ -7308,13 +7347,13 @@ var ThemeProvider2 = /* @__PURE__ */ __name((_ref) => {
|
|
|
7308
7347
|
let {
|
|
7309
7348
|
children
|
|
7310
7349
|
} = _ref, value2 = _objectWithoutProperties(_ref, _excluded);
|
|
7311
|
-
const wrappedTheme =
|
|
7312
|
-
return
|
|
7350
|
+
const wrappedTheme = React49.useContext(ThemeContext2);
|
|
7351
|
+
return React49.createElement(ThemeContext2.Provider, {
|
|
7313
7352
|
value: _objectSpread2(_objectSpread2({}, wrappedTheme), value2)
|
|
7314
7353
|
}, children);
|
|
7315
7354
|
}, "ThemeProvider");
|
|
7316
7355
|
var useTheme4 = /* @__PURE__ */ __name((props, styles = {}) => {
|
|
7317
|
-
const themeContext =
|
|
7356
|
+
const themeContext = React49.useContext(ThemeContext2);
|
|
7318
7357
|
const currentTheme = props.theme || themeContext.theme || "chrome";
|
|
7319
7358
|
const currentColorScheme = props.colorScheme || themeContext.colorScheme || "light";
|
|
7320
7359
|
const themeClass = clsx_m_default(styles[currentTheme], styles[currentColorScheme]);
|
|
@@ -7326,17 +7365,17 @@ var useTheme4 = /* @__PURE__ */ __name((props, styles = {}) => {
|
|
|
7326
7365
|
}, "useTheme");
|
|
7327
7366
|
|
|
7328
7367
|
// ../node_modules/@devtools-ds/themes/dist/esm/AutoThemeProvider.js
|
|
7329
|
-
import
|
|
7368
|
+
import React50 from "react";
|
|
7330
7369
|
|
|
7331
7370
|
// ../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectInspectorItem.js
|
|
7332
|
-
import
|
|
7371
|
+
import React56, { useEffect as useEffect16, useState as useState19 } from "react";
|
|
7333
7372
|
|
|
7334
7373
|
// ../node_modules/@devtools-ds/tree/dist/esm/index.js
|
|
7335
|
-
import
|
|
7374
|
+
import React53, { useState as useState17, useEffect as useEffect14 } from "react";
|
|
7336
7375
|
|
|
7337
7376
|
// ../node_modules/@devtools-ds/tree/dist/esm/TreeContext.js
|
|
7338
|
-
import
|
|
7339
|
-
var TreeContext =
|
|
7377
|
+
import React51 from "react";
|
|
7378
|
+
var TreeContext = React51.createContext({
|
|
7340
7379
|
isChild: false,
|
|
7341
7380
|
depth: 0,
|
|
7342
7381
|
hasHover: true
|
|
@@ -7367,15 +7406,15 @@ var Tree = /* @__PURE__ */ __name((props) => {
|
|
|
7367
7406
|
theme: theme3,
|
|
7368
7407
|
colorScheme
|
|
7369
7408
|
}, Tree_css_default);
|
|
7370
|
-
const [isOpen, setOpen] =
|
|
7371
|
-
|
|
7409
|
+
const [isOpen, setOpen] = useState17(open);
|
|
7410
|
+
useEffect14(() => {
|
|
7372
7411
|
setOpen(open);
|
|
7373
7412
|
}, [open]);
|
|
7374
7413
|
const updateState = /* @__PURE__ */ __name((value2) => {
|
|
7375
7414
|
setOpen(value2);
|
|
7376
7415
|
if (onUpdate) onUpdate(value2);
|
|
7377
7416
|
}, "updateState");
|
|
7378
|
-
const hasChildren =
|
|
7417
|
+
const hasChildren = React53.Children.count(children) > 0;
|
|
7379
7418
|
const updateFocus = /* @__PURE__ */ __name((newNode, previousNode) => {
|
|
7380
7419
|
if (newNode.isSameNode(previousNode || null)) return;
|
|
7381
7420
|
const focusableNode = newNode.querySelector('[tabindex="-1"]');
|
|
@@ -7516,28 +7555,28 @@ var Tree = /* @__PURE__ */ __name((props) => {
|
|
|
7516
7555
|
isChild,
|
|
7517
7556
|
depth,
|
|
7518
7557
|
hasHover
|
|
7519
|
-
} =
|
|
7558
|
+
} = React53.useContext(TreeContext_default);
|
|
7520
7559
|
const showHover = hasHover ? hover : false;
|
|
7521
7560
|
if (!isChild) {
|
|
7522
|
-
return
|
|
7561
|
+
return React53.createElement("ul", _extends({
|
|
7523
7562
|
role: "tree",
|
|
7524
7563
|
tabIndex: 0,
|
|
7525
7564
|
className: clsx_m_default(Tree_css_default.tree, Tree_css_default.group, themeClass, className),
|
|
7526
7565
|
onFocus: handleFocus,
|
|
7527
7566
|
onBlur: handleBlur
|
|
7528
|
-
}, html),
|
|
7567
|
+
}, html), React53.createElement(TreeContext_default.Provider, {
|
|
7529
7568
|
value: {
|
|
7530
7569
|
isChild: true,
|
|
7531
7570
|
depth: 0,
|
|
7532
7571
|
hasHover: showHover
|
|
7533
7572
|
}
|
|
7534
|
-
},
|
|
7573
|
+
}, React53.createElement(Tree, props)));
|
|
7535
7574
|
}
|
|
7536
7575
|
if (!hasChildren) {
|
|
7537
|
-
return
|
|
7576
|
+
return React53.createElement("li", _extends({
|
|
7538
7577
|
role: "treeitem",
|
|
7539
7578
|
className: Tree_css_default.item
|
|
7540
|
-
}, html),
|
|
7579
|
+
}, html), React53.createElement("div", {
|
|
7541
7580
|
role: "button",
|
|
7542
7581
|
className: clsx_m_default(Tree_css_default.label, {
|
|
7543
7582
|
[Tree_css_default.hover]: showHover,
|
|
@@ -7550,16 +7589,16 @@ var Tree = /* @__PURE__ */ __name((props) => {
|
|
|
7550
7589
|
}, "onKeyDown"),
|
|
7551
7590
|
onClick: /* @__PURE__ */ __name((e2) => handleClick(e2, true), "onClick"),
|
|
7552
7591
|
onFocus: handleButtonFocus
|
|
7553
|
-
},
|
|
7592
|
+
}, React53.createElement("span", null, label)));
|
|
7554
7593
|
}
|
|
7555
7594
|
const arrowClass = clsx_m_default(Tree_css_default.arrow, {
|
|
7556
7595
|
[Tree_css_default.open]: isOpen
|
|
7557
7596
|
});
|
|
7558
|
-
return
|
|
7597
|
+
return React53.createElement("li", {
|
|
7559
7598
|
role: "treeitem",
|
|
7560
7599
|
"aria-expanded": isOpen,
|
|
7561
7600
|
className: Tree_css_default.item
|
|
7562
|
-
},
|
|
7601
|
+
}, React53.createElement("div", {
|
|
7563
7602
|
role: "button",
|
|
7564
7603
|
tabIndex: -1,
|
|
7565
7604
|
className: clsx_m_default(Tree_css_default.label, {
|
|
@@ -7570,14 +7609,14 @@ var Tree = /* @__PURE__ */ __name((props) => {
|
|
|
7570
7609
|
onClick: /* @__PURE__ */ __name((e2) => handleClick(e2), "onClick"),
|
|
7571
7610
|
onKeyDown: /* @__PURE__ */ __name((e2) => handleKeypress(e2), "onKeyDown"),
|
|
7572
7611
|
onFocus: handleButtonFocus
|
|
7573
|
-
},
|
|
7612
|
+
}, React53.createElement("span", null, React53.createElement("span", {
|
|
7574
7613
|
"aria-hidden": true,
|
|
7575
7614
|
className: arrowClass
|
|
7576
|
-
}),
|
|
7615
|
+
}), React53.createElement("span", null, label))), React53.createElement("ul", _extends({
|
|
7577
7616
|
role: "group",
|
|
7578
7617
|
className: clsx_m_default(className, Tree_css_default.group)
|
|
7579
|
-
}, html), isOpen &&
|
|
7580
|
-
return
|
|
7618
|
+
}, html), isOpen && React53.Children.map(children, (child) => {
|
|
7619
|
+
return React53.createElement(TreeContext_default.Provider, {
|
|
7581
7620
|
value: {
|
|
7582
7621
|
isChild: true,
|
|
7583
7622
|
depth: depth + 1,
|
|
@@ -7592,7 +7631,7 @@ Tree.defaultProps = {
|
|
|
7592
7631
|
};
|
|
7593
7632
|
|
|
7594
7633
|
// ../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectValue.js
|
|
7595
|
-
import
|
|
7634
|
+
import React54, { useState as useState18, useEffect as useEffect15 } from "react";
|
|
7596
7635
|
|
|
7597
7636
|
// ../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectInspector.css.js
|
|
7598
7637
|
var ObjectInspector_css_default = { "object-inspector": "ObjectInspector-object-inspector-0c33e82", "objectInspector": "ObjectInspector-object-inspector-0c33e82", "object-label": "ObjectInspector-object-label-b81482b", "objectLabel": "ObjectInspector-object-label-b81482b", "text": "ObjectInspector-text-25f57f3", "key": "ObjectInspector-key-4f712bb", "value": "ObjectInspector-value-f7ec2e5", "string": "ObjectInspector-string-c496000", "regex": "ObjectInspector-regex-59d45a3", "error": "ObjectInspector-error-b818698", "boolean": "ObjectInspector-boolean-2dd1642", "number": "ObjectInspector-number-a6daabb", "undefined": "ObjectInspector-undefined-3a68263", "null": "ObjectInspector-null-74acb50", "function": "ObjectInspector-function-07bbdcd", "function-decorator": "ObjectInspector-function-decorator-3d22c24", "functionDecorator": "ObjectInspector-function-decorator-3d22c24", "prototype": "ObjectInspector-prototype-f2449ee", "dark": "ObjectInspector-dark-0c96c97", "chrome": "ObjectInspector-chrome-2f3ca98", "light": "ObjectInspector-light-78bef54" };
|
|
@@ -7602,11 +7641,11 @@ var _excluded3 = ["ast", "theme", "showKey", "colorScheme", "className"];
|
|
|
7602
7641
|
var buildValue = /* @__PURE__ */ __name((key, value2, valueClass, showKey, depth) => {
|
|
7603
7642
|
const computedKey = key.includes("-") ? `"${key}"` : key;
|
|
7604
7643
|
const isRoot = depth <= 0;
|
|
7605
|
-
return
|
|
7644
|
+
return React54.createElement("span", {
|
|
7606
7645
|
className: ObjectInspector_css_default.text
|
|
7607
|
-
}, !isRoot && showKey &&
|
|
7646
|
+
}, !isRoot && showKey && React54.createElement(React54.Fragment, null, React54.createElement("span", {
|
|
7608
7647
|
className: ObjectInspector_css_default.key
|
|
7609
|
-
}, computedKey),
|
|
7648
|
+
}, computedKey), React54.createElement("span", null, ":\xA0")), React54.createElement("span", {
|
|
7610
7649
|
className: valueClass
|
|
7611
7650
|
}, value2));
|
|
7612
7651
|
}, "buildValue");
|
|
@@ -7624,9 +7663,9 @@ var ObjectValue2 = /* @__PURE__ */ __name((props) => {
|
|
|
7624
7663
|
theme: theme3,
|
|
7625
7664
|
colorScheme
|
|
7626
7665
|
}, ObjectInspector_css_default);
|
|
7627
|
-
const [asyncValue, setAsyncValue] =
|
|
7628
|
-
let value2 =
|
|
7629
|
-
|
|
7666
|
+
const [asyncValue, setAsyncValue] = useState18(React54.createElement("span", null));
|
|
7667
|
+
let value2 = React54.createElement("span", null);
|
|
7668
|
+
useEffect15(() => {
|
|
7630
7669
|
if (ast.value instanceof Promise) {
|
|
7631
7670
|
const waitForPromiseResult = /* @__PURE__ */ __name(async (promise) => {
|
|
7632
7671
|
setAsyncValue(buildValue(ast.key, `Promise { "${await getPromiseState(promise)}" }`, ObjectInspector_css_default.key, showKey, ast.depth));
|
|
@@ -7663,7 +7702,7 @@ var ObjectValue2 = /* @__PURE__ */ __name((props) => {
|
|
|
7663
7702
|
value2 = buildValue(ast.key, ast.value.constructor.name, ObjectInspector_css_default.key, showKey, ast.depth);
|
|
7664
7703
|
}
|
|
7665
7704
|
}
|
|
7666
|
-
return
|
|
7705
|
+
return React54.createElement("span", _extends({
|
|
7667
7706
|
className: clsx_m_default(themeClass, className)
|
|
7668
7707
|
}, html), asyncValue, value2);
|
|
7669
7708
|
}, "ObjectValue");
|
|
@@ -7673,14 +7712,14 @@ ObjectValue2.defaultProps = {
|
|
|
7673
7712
|
var ObjectValue_default = ObjectValue2;
|
|
7674
7713
|
|
|
7675
7714
|
// ../node_modules/@devtools-ds/object-inspector/dist/esm/ObjectLabel.js
|
|
7676
|
-
import
|
|
7715
|
+
import React55 from "react";
|
|
7677
7716
|
var _excluded4 = ["ast", "theme", "previewMax", "open", "colorScheme", "className"];
|
|
7678
7717
|
var buildPreview = /* @__PURE__ */ __name((children, previewMax, showKey) => {
|
|
7679
7718
|
const previews = [];
|
|
7680
7719
|
for (let i2 = 0; i2 < children.length; i2++) {
|
|
7681
7720
|
const child = children[i2];
|
|
7682
7721
|
if (!child.isPrototype) {
|
|
7683
|
-
previews.push(
|
|
7722
|
+
previews.push(React55.createElement(ObjectValue_default, {
|
|
7684
7723
|
key: child.key,
|
|
7685
7724
|
ast: child,
|
|
7686
7725
|
showKey
|
|
@@ -7705,42 +7744,42 @@ var buildPreview = /* @__PURE__ */ __name((children, previewMax, showKey) => {
|
|
|
7705
7744
|
var getArrayLabel = /* @__PURE__ */ __name((ast, open, previewMax, theme3) => {
|
|
7706
7745
|
const l2 = ast.value.length;
|
|
7707
7746
|
if (open) {
|
|
7708
|
-
return
|
|
7747
|
+
return React55.createElement("span", null, "Array(", l2, ")");
|
|
7709
7748
|
}
|
|
7710
|
-
return
|
|
7749
|
+
return React55.createElement(React55.Fragment, null, React55.createElement("span", null, `${theme3 === "firefox" ? "Array" : ""}(${l2}) [ `), buildPreview(ast.children, previewMax, false), React55.createElement("span", null, "]"));
|
|
7711
7750
|
}, "getArrayLabel");
|
|
7712
7751
|
var getObjectLabel = /* @__PURE__ */ __name((ast, open, previewMax, theme3) => {
|
|
7713
7752
|
if (ast.isPrototype) {
|
|
7714
|
-
return
|
|
7753
|
+
return React55.createElement("span", null, `Object ${theme3 === "firefox" ? "{ \u2026 }" : ""}`);
|
|
7715
7754
|
}
|
|
7716
7755
|
if (open) {
|
|
7717
|
-
return
|
|
7756
|
+
return React55.createElement("span", null, "{\u2026}");
|
|
7718
7757
|
}
|
|
7719
|
-
return
|
|
7758
|
+
return React55.createElement(React55.Fragment, null, React55.createElement("span", null, `${theme3 === "firefox" ? "Object " : ""}{ `), buildPreview(ast.children, previewMax, true), React55.createElement("span", null, "}"));
|
|
7720
7759
|
}, "getObjectLabel");
|
|
7721
7760
|
var getPromiseLabel = /* @__PURE__ */ __name((ast, open, previewMax) => {
|
|
7722
7761
|
if (open) {
|
|
7723
|
-
return
|
|
7762
|
+
return React55.createElement("span", null, `Promise { "${String(ast.children[0].value)}" }`);
|
|
7724
7763
|
}
|
|
7725
|
-
return
|
|
7764
|
+
return React55.createElement(React55.Fragment, null, React55.createElement("span", null, `Promise { `), buildPreview(ast.children, previewMax, true), React55.createElement("span", null, "}"));
|
|
7726
7765
|
}, "getPromiseLabel");
|
|
7727
7766
|
var getMapLabel = /* @__PURE__ */ __name((ast, open, previewMax, theme3) => {
|
|
7728
7767
|
const {
|
|
7729
7768
|
size
|
|
7730
7769
|
} = ast.value;
|
|
7731
7770
|
if (open) {
|
|
7732
|
-
return
|
|
7771
|
+
return React55.createElement("span", null, `Map(${size})`);
|
|
7733
7772
|
}
|
|
7734
|
-
return
|
|
7773
|
+
return React55.createElement(React55.Fragment, null, React55.createElement("span", null, `Map${theme3 === "chrome" ? `(${size})` : ""} { `), buildPreview(ast.children, previewMax, true), React55.createElement("span", null, "}"));
|
|
7735
7774
|
}, "getMapLabel");
|
|
7736
7775
|
var getSetLabel = /* @__PURE__ */ __name((ast, open, previewMax) => {
|
|
7737
7776
|
const {
|
|
7738
7777
|
size
|
|
7739
7778
|
} = ast.value;
|
|
7740
7779
|
if (open) {
|
|
7741
|
-
return
|
|
7780
|
+
return React55.createElement("span", null, "Set(", size, ")");
|
|
7742
7781
|
}
|
|
7743
|
-
return
|
|
7782
|
+
return React55.createElement(React55.Fragment, null, React55.createElement("span", null, `Set(${ast.value.size}) {`), buildPreview(ast.children, previewMax, true), React55.createElement("span", null, "}"));
|
|
7744
7783
|
}, "getSetLabel");
|
|
7745
7784
|
var ObjectLabel2 = /* @__PURE__ */ __name((props) => {
|
|
7746
7785
|
const {
|
|
@@ -7764,44 +7803,44 @@ var ObjectLabel2 = /* @__PURE__ */ __name((props) => {
|
|
|
7764
7803
|
});
|
|
7765
7804
|
const isRoot = ast.depth <= 0;
|
|
7766
7805
|
const Key = /* @__PURE__ */ __name(() => {
|
|
7767
|
-
return
|
|
7806
|
+
return React55.createElement("span", {
|
|
7768
7807
|
className: isPrototype ? ObjectInspector_css_default.prototype : ObjectInspector_css_default.key
|
|
7769
7808
|
}, isRoot ? "" : `${ast.key}: `);
|
|
7770
7809
|
}, "Key");
|
|
7771
7810
|
if (ast.type === "array") {
|
|
7772
|
-
return
|
|
7811
|
+
return React55.createElement("span", _extends({
|
|
7773
7812
|
className: classes
|
|
7774
|
-
}, html),
|
|
7813
|
+
}, html), React55.createElement(Key, null), getArrayLabel(ast, open, previewMax, currentTheme));
|
|
7775
7814
|
}
|
|
7776
7815
|
if (ast.type === "function") {
|
|
7777
|
-
return
|
|
7816
|
+
return React55.createElement("span", _extends({
|
|
7778
7817
|
className: classes
|
|
7779
|
-
}, html),
|
|
7818
|
+
}, html), React55.createElement(Key, null), currentTheme === "chrome" && React55.createElement("span", {
|
|
7780
7819
|
className: ObjectInspector_css_default.functionDecorator
|
|
7781
|
-
}, "\u0192 "),
|
|
7820
|
+
}, "\u0192 "), React55.createElement("span", {
|
|
7782
7821
|
className: clsx_m_default({
|
|
7783
7822
|
[ObjectInspector_css_default.function]: !isPrototype
|
|
7784
7823
|
})
|
|
7785
7824
|
}, `${ast.value.name}()`));
|
|
7786
7825
|
}
|
|
7787
7826
|
if (ast.type === "promise") {
|
|
7788
|
-
return
|
|
7827
|
+
return React55.createElement("span", _extends({
|
|
7789
7828
|
className: classes
|
|
7790
|
-
}, html),
|
|
7829
|
+
}, html), React55.createElement(Key, null), getPromiseLabel(ast, open, previewMax));
|
|
7791
7830
|
}
|
|
7792
7831
|
if (ast.type === "map") {
|
|
7793
|
-
return
|
|
7832
|
+
return React55.createElement("span", _extends({
|
|
7794
7833
|
className: classes
|
|
7795
|
-
}, html),
|
|
7834
|
+
}, html), React55.createElement(Key, null), getMapLabel(ast, open, previewMax, currentTheme));
|
|
7796
7835
|
}
|
|
7797
7836
|
if (ast.type === "set") {
|
|
7798
|
-
return
|
|
7837
|
+
return React55.createElement("span", _extends({
|
|
7799
7838
|
className: classes
|
|
7800
|
-
}, html),
|
|
7839
|
+
}, html), React55.createElement(Key, null), getSetLabel(ast, open, previewMax));
|
|
7801
7840
|
}
|
|
7802
|
-
return
|
|
7841
|
+
return React55.createElement("span", _extends({
|
|
7803
7842
|
className: classes
|
|
7804
|
-
}, html),
|
|
7843
|
+
}, html), React55.createElement(Key, null), getObjectLabel(ast, open, previewMax, currentTheme));
|
|
7805
7844
|
}, "ObjectLabel");
|
|
7806
7845
|
ObjectLabel2.defaultProps = {
|
|
7807
7846
|
previewMax: 8,
|
|
@@ -7816,9 +7855,9 @@ var ObjectInspectorItem = /* @__PURE__ */ __name((props) => {
|
|
|
7816
7855
|
expandLevel,
|
|
7817
7856
|
depth
|
|
7818
7857
|
} = props;
|
|
7819
|
-
const [resolved, setResolved] =
|
|
7820
|
-
const [open, setOpen] =
|
|
7821
|
-
|
|
7858
|
+
const [resolved, setResolved] = useState19();
|
|
7859
|
+
const [open, setOpen] = useState19(Boolean(depth < expandLevel));
|
|
7860
|
+
useEffect16(() => {
|
|
7822
7861
|
const resolve = /* @__PURE__ */ __name(async () => {
|
|
7823
7862
|
if (ast.type !== "value") {
|
|
7824
7863
|
const promises = ast.children.map((f2) => f2());
|
|
@@ -7832,10 +7871,10 @@ var ObjectInspectorItem = /* @__PURE__ */ __name((props) => {
|
|
|
7832
7871
|
resolve();
|
|
7833
7872
|
}, [ast]);
|
|
7834
7873
|
if (resolved) {
|
|
7835
|
-
return
|
|
7874
|
+
return React56.createElement(Tree, {
|
|
7836
7875
|
hover: false,
|
|
7837
7876
|
open,
|
|
7838
|
-
label:
|
|
7877
|
+
label: React56.createElement(ObjectLabel_default, {
|
|
7839
7878
|
open,
|
|
7840
7879
|
ast: resolved
|
|
7841
7880
|
}),
|
|
@@ -7847,7 +7886,7 @@ var ObjectInspectorItem = /* @__PURE__ */ __name((props) => {
|
|
|
7847
7886
|
setOpen(value2);
|
|
7848
7887
|
}, "onUpdate")
|
|
7849
7888
|
}, resolved.children.map((child) => {
|
|
7850
|
-
return
|
|
7889
|
+
return React56.createElement(ObjectInspectorItem, {
|
|
7851
7890
|
key: child.key,
|
|
7852
7891
|
ast: child,
|
|
7853
7892
|
depth: depth + 1,
|
|
@@ -7856,9 +7895,9 @@ var ObjectInspectorItem = /* @__PURE__ */ __name((props) => {
|
|
|
7856
7895
|
});
|
|
7857
7896
|
}));
|
|
7858
7897
|
}
|
|
7859
|
-
return
|
|
7898
|
+
return React56.createElement(Tree, {
|
|
7860
7899
|
hover: false,
|
|
7861
|
-
label:
|
|
7900
|
+
label: React56.createElement(ObjectValue_default, {
|
|
7862
7901
|
ast
|
|
7863
7902
|
}),
|
|
7864
7903
|
onSelect: /* @__PURE__ */ __name(() => {
|
|
@@ -7886,7 +7925,7 @@ var ObjectInspector2 = /* @__PURE__ */ __name((props) => {
|
|
|
7886
7925
|
colorScheme,
|
|
7887
7926
|
onSelect
|
|
7888
7927
|
} = props, html = _objectWithoutProperties(props, _excluded5);
|
|
7889
|
-
const [ast, setAST] =
|
|
7928
|
+
const [ast, setAST] = useState20(void 0);
|
|
7890
7929
|
const {
|
|
7891
7930
|
themeClass,
|
|
7892
7931
|
currentTheme,
|
|
@@ -7895,18 +7934,18 @@ var ObjectInspector2 = /* @__PURE__ */ __name((props) => {
|
|
|
7895
7934
|
theme: theme3,
|
|
7896
7935
|
colorScheme
|
|
7897
7936
|
}, ObjectInspector_css_default);
|
|
7898
|
-
|
|
7937
|
+
useEffect17(() => {
|
|
7899
7938
|
const runParser = /* @__PURE__ */ __name(async () => {
|
|
7900
7939
|
setAST(await parse4(data, sortKeys, includePrototypes));
|
|
7901
7940
|
}, "runParser");
|
|
7902
7941
|
runParser();
|
|
7903
7942
|
}, [data, sortKeys, includePrototypes]);
|
|
7904
|
-
return
|
|
7943
|
+
return React57.createElement("div", _extends({
|
|
7905
7944
|
className: clsx_m_default(ObjectInspector_css_default.objectInspector, className, themeClass)
|
|
7906
|
-
}, html), ast &&
|
|
7945
|
+
}, html), ast && React57.createElement(ThemeProvider2, {
|
|
7907
7946
|
theme: currentTheme,
|
|
7908
7947
|
colorScheme: currentColorScheme
|
|
7909
|
-
},
|
|
7948
|
+
}, React57.createElement(ObjectInspectorItem_default, {
|
|
7910
7949
|
ast,
|
|
7911
7950
|
expandLevel,
|
|
7912
7951
|
onSelect
|
|
@@ -7997,7 +8036,7 @@ var stringify = /* @__PURE__ */ __name((value2) => {
|
|
|
7997
8036
|
}
|
|
7998
8037
|
}, "stringify");
|
|
7999
8038
|
var interleave = /* @__PURE__ */ __name((nodes, separator) => nodes.flatMap(
|
|
8000
|
-
(node, index) => index === nodes.length - 1 ? [node] : [node,
|
|
8039
|
+
(node, index) => index === nodes.length - 1 ? [node] : [node, React58.cloneElement(separator, { key: `sep${index}` })]
|
|
8001
8040
|
), "interleave");
|
|
8002
8041
|
var Node2 = /* @__PURE__ */ __name(({
|
|
8003
8042
|
value: value2,
|
|
@@ -8008,35 +8047,35 @@ var Node2 = /* @__PURE__ */ __name(({
|
|
|
8008
8047
|
}) => {
|
|
8009
8048
|
switch (true) {
|
|
8010
8049
|
case value2 === null:
|
|
8011
|
-
return
|
|
8050
|
+
return React58.createElement(NullNode, { ...props });
|
|
8012
8051
|
case value2 === void 0:
|
|
8013
|
-
return
|
|
8052
|
+
return React58.createElement(UndefinedNode, { ...props });
|
|
8014
8053
|
case Array.isArray(value2):
|
|
8015
|
-
return
|
|
8054
|
+
return React58.createElement(ArrayNode, { ...props, value: value2, callsById });
|
|
8016
8055
|
case typeof value2 === "string":
|
|
8017
|
-
return
|
|
8056
|
+
return React58.createElement(StringNode, { ...props, value: value2 });
|
|
8018
8057
|
case typeof value2 === "number":
|
|
8019
|
-
return
|
|
8058
|
+
return React58.createElement(NumberNode, { ...props, value: value2 });
|
|
8020
8059
|
case typeof value2 === "boolean":
|
|
8021
|
-
return
|
|
8060
|
+
return React58.createElement(BooleanNode, { ...props, value: value2 });
|
|
8022
8061
|
case Object.prototype.hasOwnProperty.call(value2, "__date__"):
|
|
8023
|
-
return
|
|
8062
|
+
return React58.createElement(DateNode, { ...props, ...value2.__date__ });
|
|
8024
8063
|
case Object.prototype.hasOwnProperty.call(value2, "__error__"):
|
|
8025
|
-
return
|
|
8064
|
+
return React58.createElement(ErrorNode, { ...props, ...value2.__error__ });
|
|
8026
8065
|
case Object.prototype.hasOwnProperty.call(value2, "__regexp__"):
|
|
8027
|
-
return
|
|
8066
|
+
return React58.createElement(RegExpNode, { ...props, ...value2.__regexp__ });
|
|
8028
8067
|
case Object.prototype.hasOwnProperty.call(value2, "__function__"):
|
|
8029
|
-
return
|
|
8068
|
+
return React58.createElement(FunctionNode, { ...props, ...value2.__function__ });
|
|
8030
8069
|
case Object.prototype.hasOwnProperty.call(value2, "__symbol__"):
|
|
8031
|
-
return
|
|
8070
|
+
return React58.createElement(SymbolNode, { ...props, ...value2.__symbol__ });
|
|
8032
8071
|
case Object.prototype.hasOwnProperty.call(value2, "__element__"):
|
|
8033
|
-
return
|
|
8072
|
+
return React58.createElement(ElementNode, { ...props, ...value2.__element__ });
|
|
8034
8073
|
case Object.prototype.hasOwnProperty.call(value2, "__class__"):
|
|
8035
|
-
return
|
|
8074
|
+
return React58.createElement(ClassNode, { ...props, ...value2.__class__ });
|
|
8036
8075
|
case Object.prototype.hasOwnProperty.call(value2, "__callId__"):
|
|
8037
|
-
return
|
|
8076
|
+
return React58.createElement(MethodCall, { call: callsById?.get(value2.__callId__), callsById });
|
|
8038
8077
|
case Object.prototype.toString.call(value2) === "[object Object]":
|
|
8039
|
-
return
|
|
8078
|
+
return React58.createElement(
|
|
8040
8079
|
ObjectNode,
|
|
8041
8080
|
{
|
|
8042
8081
|
value: value2,
|
|
@@ -8046,28 +8085,28 @@ var Node2 = /* @__PURE__ */ __name(({
|
|
|
8046
8085
|
}
|
|
8047
8086
|
);
|
|
8048
8087
|
default:
|
|
8049
|
-
return
|
|
8088
|
+
return React58.createElement(OtherNode, { value: value2, ...props });
|
|
8050
8089
|
}
|
|
8051
8090
|
}, "Node");
|
|
8052
8091
|
var NullNode = /* @__PURE__ */ __name((props) => {
|
|
8053
8092
|
const colors = useThemeColors();
|
|
8054
|
-
return
|
|
8093
|
+
return React58.createElement("span", { style: { color: colors.nullish }, ...props }, "null");
|
|
8055
8094
|
}, "NullNode");
|
|
8056
8095
|
var UndefinedNode = /* @__PURE__ */ __name((props) => {
|
|
8057
8096
|
const colors = useThemeColors();
|
|
8058
|
-
return
|
|
8097
|
+
return React58.createElement("span", { style: { color: colors.nullish }, ...props }, "undefined");
|
|
8059
8098
|
}, "UndefinedNode");
|
|
8060
8099
|
var StringNode = /* @__PURE__ */ __name(({ value: value2, ...props }) => {
|
|
8061
8100
|
const colors = useThemeColors();
|
|
8062
|
-
return
|
|
8101
|
+
return React58.createElement("span", { style: { color: colors.string }, ...props }, JSON.stringify(ellipsize(value2, 50)));
|
|
8063
8102
|
}, "StringNode");
|
|
8064
8103
|
var NumberNode = /* @__PURE__ */ __name(({ value: value2, ...props }) => {
|
|
8065
8104
|
const colors = useThemeColors();
|
|
8066
|
-
return
|
|
8105
|
+
return React58.createElement("span", { style: { color: colors.number }, ...props }, value2);
|
|
8067
8106
|
}, "NumberNode");
|
|
8068
8107
|
var BooleanNode = /* @__PURE__ */ __name(({ value: value2, ...props }) => {
|
|
8069
8108
|
const colors = useThemeColors();
|
|
8070
|
-
return
|
|
8109
|
+
return React58.createElement("span", { style: { color: colors.boolean }, ...props }, String(value2));
|
|
8071
8110
|
}, "BooleanNode");
|
|
8072
8111
|
var ArrayNode = /* @__PURE__ */ __name(({
|
|
8073
8112
|
value: value2,
|
|
@@ -8076,14 +8115,14 @@ var ArrayNode = /* @__PURE__ */ __name(({
|
|
|
8076
8115
|
}) => {
|
|
8077
8116
|
const colors = useThemeColors();
|
|
8078
8117
|
if (nested) {
|
|
8079
|
-
return
|
|
8118
|
+
return React58.createElement("span", { style: { color: colors.base } }, "[\u2026]");
|
|
8080
8119
|
}
|
|
8081
|
-
const nodes = value2.slice(0, 3).map((v2, index) =>
|
|
8082
|
-
const nodelist = interleave(nodes,
|
|
8120
|
+
const nodes = value2.slice(0, 3).map((v2, index) => React58.createElement(Node2, { key: `${index}--${JSON.stringify(v2)}`, value: v2, nested: true, callsById }));
|
|
8121
|
+
const nodelist = interleave(nodes, React58.createElement("span", null, ", "));
|
|
8083
8122
|
if (value2.length <= 3) {
|
|
8084
|
-
return
|
|
8123
|
+
return React58.createElement("span", { style: { color: colors.base } }, "[", nodelist, "]");
|
|
8085
8124
|
}
|
|
8086
|
-
return
|
|
8125
|
+
return React58.createElement("span", { style: { color: colors.base } }, "(", value2.length, ") [", nodelist, ", \u2026]");
|
|
8087
8126
|
}, "ArrayNode");
|
|
8088
8127
|
var ObjectNode = /* @__PURE__ */ __name(({
|
|
8089
8128
|
showInspector,
|
|
@@ -8094,7 +8133,7 @@ var ObjectNode = /* @__PURE__ */ __name(({
|
|
|
8094
8133
|
const isDarkMode = useTheme5().base === "dark";
|
|
8095
8134
|
const colors = useThemeColors();
|
|
8096
8135
|
if (showInspector) {
|
|
8097
|
-
return
|
|
8136
|
+
return React58.createElement(React58.Fragment, null, React58.createElement(
|
|
8098
8137
|
ObjectInspector2,
|
|
8099
8138
|
{
|
|
8100
8139
|
id: "interactions-object-inspector",
|
|
@@ -8105,24 +8144,24 @@ var ObjectNode = /* @__PURE__ */ __name(({
|
|
|
8105
8144
|
));
|
|
8106
8145
|
}
|
|
8107
8146
|
if (nested) {
|
|
8108
|
-
return
|
|
8147
|
+
return React58.createElement("span", { style: { color: colors.base } }, "{\u2026}");
|
|
8109
8148
|
}
|
|
8110
8149
|
const nodelist = interleave(
|
|
8111
|
-
Object.entries(value2).slice(0, 2).map(([k2, v2]) =>
|
|
8112
|
-
|
|
8150
|
+
Object.entries(value2).slice(0, 2).map(([k2, v2]) => React58.createElement(Fragment2, { key: k2 }, React58.createElement("span", { style: { color: colors.objectkey } }, k2, ": "), React58.createElement(Node2, { value: v2, callsById, nested: true }))),
|
|
8151
|
+
React58.createElement("span", null, ", ")
|
|
8113
8152
|
);
|
|
8114
8153
|
if (Object.keys(value2).length <= 2) {
|
|
8115
|
-
return
|
|
8154
|
+
return React58.createElement("span", { style: { color: colors.base } }, "{ ", nodelist, " }");
|
|
8116
8155
|
}
|
|
8117
|
-
return
|
|
8156
|
+
return React58.createElement("span", { style: { color: colors.base } }, "(", Object.keys(value2).length, ") ", "{ ", nodelist, ", \u2026 }");
|
|
8118
8157
|
}, "ObjectNode");
|
|
8119
8158
|
var ClassNode = /* @__PURE__ */ __name(({ name }) => {
|
|
8120
8159
|
const colors = useThemeColors();
|
|
8121
|
-
return
|
|
8160
|
+
return React58.createElement("span", { style: { color: colors.instance } }, name);
|
|
8122
8161
|
}, "ClassNode");
|
|
8123
8162
|
var FunctionNode = /* @__PURE__ */ __name(({ name }) => {
|
|
8124
8163
|
const colors = useThemeColors();
|
|
8125
|
-
return name ?
|
|
8164
|
+
return name ? React58.createElement("span", { style: { color: colors.function } }, name) : React58.createElement("span", { style: { color: colors.nullish, fontStyle: "italic" } }, "anonymous");
|
|
8126
8165
|
}, "FunctionNode");
|
|
8127
8166
|
var ElementNode = /* @__PURE__ */ __name(({
|
|
8128
8167
|
prefix,
|
|
@@ -8133,7 +8172,7 @@ var ElementNode = /* @__PURE__ */ __name(({
|
|
|
8133
8172
|
}) => {
|
|
8134
8173
|
const name = prefix ? `${prefix}:${localName}` : localName;
|
|
8135
8174
|
const colors = useThemeColors();
|
|
8136
|
-
return
|
|
8175
|
+
return React58.createElement("span", { style: { wordBreak: "keep-all" } }, React58.createElement("span", { key: `${name}_lt`, style: { color: colors.muted } }, "<"), React58.createElement("span", { key: `${name}_tag`, style: { color: colors.tag.name } }, name), React58.createElement("span", { key: `${name}_suffix`, style: { color: colors.tag.suffix } }, id ? `#${id}` : classNames.reduce((acc, className) => `${acc}.${className}`, "")), React58.createElement("span", { key: `${name}_gt`, style: { color: colors.muted } }, ">"), !id && classNames.length === 0 && innerText && React58.createElement(React58.Fragment, null, React58.createElement("span", { key: `${name}_text` }, innerText), React58.createElement("span", { key: `${name}_close_lt`, style: { color: colors.muted } }, "<"), React58.createElement("span", { key: `${name}_close_tag`, style: { color: colors.tag.name } }, "/", name), React58.createElement("span", { key: `${name}_close_gt`, style: { color: colors.muted } }, ">")));
|
|
8137
8176
|
}, "ElementNode");
|
|
8138
8177
|
var DateNode = /* @__PURE__ */ __name(({ value: value2 }) => {
|
|
8139
8178
|
let parsed = new Date(value2);
|
|
@@ -8143,31 +8182,31 @@ var DateNode = /* @__PURE__ */ __name(({ value: value2 }) => {
|
|
|
8143
8182
|
}
|
|
8144
8183
|
const colors = useThemeColors();
|
|
8145
8184
|
if (!parsed) {
|
|
8146
|
-
return
|
|
8185
|
+
return React58.createElement("span", { style: { whiteSpace: "nowrap", color: colors.date } }, "Invalid date");
|
|
8147
8186
|
}
|
|
8148
8187
|
const [date, time, ms] = parsed.toISOString().split(/[T.Z]/);
|
|
8149
|
-
return
|
|
8188
|
+
return React58.createElement("span", { style: { whiteSpace: "nowrap", color: colors.date } }, date, React58.createElement("span", { style: { opacity: 0.7 } }, "T"), time === "00:00:00" ? React58.createElement("span", { style: { opacity: 0.7 } }, time) : time, ms === "000" ? React58.createElement("span", { style: { opacity: 0.7 } }, ".", ms) : `.${ms}`, React58.createElement("span", { style: { opacity: 0.7 } }, "Z"));
|
|
8150
8189
|
}, "DateNode");
|
|
8151
8190
|
var ErrorNode = /* @__PURE__ */ __name(({ name, message }) => {
|
|
8152
8191
|
const colors = useThemeColors();
|
|
8153
|
-
return
|
|
8192
|
+
return React58.createElement("span", { style: { color: colors.error.name } }, name, message && ": ", message && React58.createElement("span", { style: { color: colors.error.message }, title: message.length > 50 ? message : "" }, ellipsize(message, 50)));
|
|
8154
8193
|
}, "ErrorNode");
|
|
8155
8194
|
var RegExpNode = /* @__PURE__ */ __name(({ flags, source }) => {
|
|
8156
8195
|
const colors = useThemeColors();
|
|
8157
|
-
return
|
|
8196
|
+
return React58.createElement("span", { style: { whiteSpace: "nowrap", color: colors.regex.flags } }, "/", React58.createElement("span", { style: { color: colors.regex.source } }, source), "/", flags);
|
|
8158
8197
|
}, "RegExpNode");
|
|
8159
8198
|
var SymbolNode = /* @__PURE__ */ __name(({ description }) => {
|
|
8160
8199
|
const colors = useThemeColors();
|
|
8161
|
-
return
|
|
8200
|
+
return React58.createElement("span", { style: { whiteSpace: "nowrap", color: colors.instance } }, "Symbol(", description && React58.createElement("span", { style: { color: colors.meta } }, '"', description, '"'), ")");
|
|
8162
8201
|
}, "SymbolNode");
|
|
8163
8202
|
var OtherNode = /* @__PURE__ */ __name(({ value: value2 }) => {
|
|
8164
8203
|
const colors = useThemeColors();
|
|
8165
|
-
return
|
|
8204
|
+
return React58.createElement("span", { style: { color: colors.meta } }, stringify(value2));
|
|
8166
8205
|
}, "OtherNode");
|
|
8167
8206
|
var StepNode = /* @__PURE__ */ __name(({ label }) => {
|
|
8168
8207
|
const colors = useThemeColors();
|
|
8169
8208
|
const { typography: typography4 } = useTheme5();
|
|
8170
|
-
return
|
|
8209
|
+
return React58.createElement(
|
|
8171
8210
|
"span",
|
|
8172
8211
|
{
|
|
8173
8212
|
style: {
|
|
@@ -8187,22 +8226,22 @@ var MethodCall = /* @__PURE__ */ __name(({
|
|
|
8187
8226
|
return null;
|
|
8188
8227
|
}
|
|
8189
8228
|
if (call.method === "step" && call.path?.length === 0) {
|
|
8190
|
-
return
|
|
8229
|
+
return React58.createElement(StepNode, { label: call.args[0] });
|
|
8191
8230
|
}
|
|
8192
8231
|
const path = call.path?.flatMap((elem, index) => {
|
|
8193
8232
|
const callId = elem.__callId__;
|
|
8194
8233
|
return [
|
|
8195
|
-
callId ?
|
|
8196
|
-
|
|
8197
|
-
|
|
8234
|
+
callId ? React58.createElement(MethodCall, { key: `elem${index}`, call: callsById?.get(callId), callsById }) : React58.createElement("span", { key: `elem${index}` }, elem),
|
|
8235
|
+
React58.createElement("wbr", { key: `wbr${index}` }),
|
|
8236
|
+
React58.createElement("span", { key: `dot${index}` }, ".")
|
|
8198
8237
|
];
|
|
8199
8238
|
});
|
|
8200
8239
|
const args = call.args?.flatMap((arg, index, array2) => {
|
|
8201
|
-
const node =
|
|
8202
|
-
return index < array2.length - 1 ? [node,
|
|
8240
|
+
const node = React58.createElement(Node2, { key: `node${index}`, value: arg, callsById });
|
|
8241
|
+
return index < array2.length - 1 ? [node, React58.createElement("span", { key: `comma${index}` }, ",\xA0"), React58.createElement("wbr", { key: `wbr${index}` })] : [node];
|
|
8203
8242
|
});
|
|
8204
8243
|
const colors = useThemeColors();
|
|
8205
|
-
return
|
|
8244
|
+
return React58.createElement(React58.Fragment, null, React58.createElement("span", { style: { color: colors.base } }, path), React58.createElement("span", { style: { color: colors.method } }, call.method), React58.createElement("span", { style: { color: colors.base } }, "(", React58.createElement("wbr", null), args, React58.createElement("wbr", null), ")"));
|
|
8206
8245
|
}, "MethodCall");
|
|
8207
8246
|
|
|
8208
8247
|
// src/component-testing/components/MatcherResult.tsx
|
|
@@ -8232,15 +8271,15 @@ var StyledExpected = styled35.span(({ theme: theme3 }) => ({
|
|
|
8232
8271
|
var StyledReceived = styled35.span(({ theme: theme3 }) => ({
|
|
8233
8272
|
color: theme3.base === "light" ? theme3.color.negativeText : theme3.color.negative
|
|
8234
8273
|
}));
|
|
8235
|
-
var Received = /* @__PURE__ */ __name(({ value: value2, parsed }) => parsed ?
|
|
8274
|
+
var Received = /* @__PURE__ */ __name(({ value: value2, parsed }) => parsed ? React59.createElement(Node2, { showObjectInspector: true, value: value2, style: { color: "#D43900" } }) : React59.createElement(StyledReceived, null, value2), "Received");
|
|
8236
8275
|
var Expected = /* @__PURE__ */ __name(({ value: value2, parsed }) => {
|
|
8237
8276
|
if (parsed) {
|
|
8238
8277
|
if (typeof value2 === "string" && value2.startsWith("called with")) {
|
|
8239
|
-
return
|
|
8278
|
+
return React59.createElement(React59.Fragment, null, value2);
|
|
8240
8279
|
}
|
|
8241
|
-
return
|
|
8280
|
+
return React59.createElement(Node2, { showObjectInspector: true, value: value2, style: { color: "#16B242" } });
|
|
8242
8281
|
}
|
|
8243
|
-
return
|
|
8282
|
+
return React59.createElement(StyledExpected, null, value2);
|
|
8244
8283
|
}, "Expected");
|
|
8245
8284
|
var MatcherResult = /* @__PURE__ */ __name(({
|
|
8246
8285
|
message,
|
|
@@ -8248,7 +8287,7 @@ var MatcherResult = /* @__PURE__ */ __name(({
|
|
|
8248
8287
|
}) => {
|
|
8249
8288
|
const filter = useAnsiToHtmlFilter();
|
|
8250
8289
|
const lines = message.split("\n");
|
|
8251
|
-
return
|
|
8290
|
+
return React59.createElement(
|
|
8252
8291
|
"pre",
|
|
8253
8292
|
{
|
|
8254
8293
|
style: {
|
|
@@ -8269,65 +8308,65 @@ var MatcherResult = /* @__PURE__ */ __name(({
|
|
|
8269
8308
|
if (expected) {
|
|
8270
8309
|
return [
|
|
8271
8310
|
"expect(",
|
|
8272
|
-
|
|
8311
|
+
React59.createElement(Received, { key: `received_${received}`, value: received }),
|
|
8273
8312
|
line.slice(remainderIndex, expectedIndex),
|
|
8274
|
-
|
|
8313
|
+
React59.createElement(Expected, { key: `expected_${expected}`, value: expected }),
|
|
8275
8314
|
line.slice(expectedIndex + expected.length),
|
|
8276
|
-
|
|
8315
|
+
React59.createElement("br", { key: `br${index}` })
|
|
8277
8316
|
];
|
|
8278
8317
|
}
|
|
8279
8318
|
}
|
|
8280
8319
|
}
|
|
8281
8320
|
if (line.match(/^\s*- /)) {
|
|
8282
|
-
return [
|
|
8321
|
+
return [React59.createElement(Expected, { key: line + index, value: line }), React59.createElement("br", { key: `br${index}` })];
|
|
8283
8322
|
}
|
|
8284
8323
|
if (line.match(/^\s*\+ /) || line.match(/^Received: $/)) {
|
|
8285
|
-
return [
|
|
8324
|
+
return [React59.createElement(Received, { key: line + index, value: line }), React59.createElement("br", { key: `br${index}` })];
|
|
8286
8325
|
}
|
|
8287
8326
|
const [, assertionLabel, assertionValue] = line.match(/^(Expected|Received): (.*)$/) || [];
|
|
8288
8327
|
if (assertionLabel && assertionValue) {
|
|
8289
8328
|
return assertionLabel === "Expected" ? [
|
|
8290
8329
|
"Expected: ",
|
|
8291
|
-
|
|
8292
|
-
|
|
8330
|
+
React59.createElement(Expected, { key: line + index, value: parseValue(assertionValue), parsed: true }),
|
|
8331
|
+
React59.createElement("br", { key: `br${index}` })
|
|
8293
8332
|
] : [
|
|
8294
8333
|
"Received: ",
|
|
8295
|
-
|
|
8296
|
-
|
|
8334
|
+
React59.createElement(Received, { key: line + index, value: parseValue(assertionValue), parsed: true }),
|
|
8335
|
+
React59.createElement("br", { key: `br${index}` })
|
|
8297
8336
|
];
|
|
8298
8337
|
}
|
|
8299
8338
|
const [, prefix, numberOfCalls] = line.match(/(Expected number|Received number|Number) of calls: (\d+)$/i) || [];
|
|
8300
8339
|
if (prefix && numberOfCalls) {
|
|
8301
8340
|
return [
|
|
8302
8341
|
`${prefix} of calls: `,
|
|
8303
|
-
|
|
8304
|
-
|
|
8342
|
+
React59.createElement(Node2, { key: line + index, value: Number(numberOfCalls) }),
|
|
8343
|
+
React59.createElement("br", { key: `br${index}` })
|
|
8305
8344
|
];
|
|
8306
8345
|
}
|
|
8307
8346
|
const [, receivedValue] = line.match(/^Received has value: (.+)$/) || [];
|
|
8308
8347
|
if (receivedValue) {
|
|
8309
8348
|
return [
|
|
8310
8349
|
"Received has value: ",
|
|
8311
|
-
|
|
8312
|
-
|
|
8350
|
+
React59.createElement(Node2, { key: line + index, value: parseValue(receivedValue) }),
|
|
8351
|
+
React59.createElement("br", { key: `br${index}` })
|
|
8313
8352
|
];
|
|
8314
8353
|
}
|
|
8315
8354
|
return [
|
|
8316
|
-
|
|
8355
|
+
React59.createElement(
|
|
8317
8356
|
"span",
|
|
8318
8357
|
{
|
|
8319
8358
|
key: line + index,
|
|
8320
8359
|
dangerouslySetInnerHTML: { __html: filter.toHtml(line) }
|
|
8321
8360
|
}
|
|
8322
8361
|
),
|
|
8323
|
-
|
|
8362
|
+
React59.createElement("br", { key: `br${index}` })
|
|
8324
8363
|
];
|
|
8325
8364
|
})
|
|
8326
8365
|
);
|
|
8327
8366
|
}, "MatcherResult");
|
|
8328
8367
|
|
|
8329
8368
|
// src/component-testing/components/StatusIcon.tsx
|
|
8330
|
-
import
|
|
8369
|
+
import React60 from "react";
|
|
8331
8370
|
import { CheckIcon as CheckIcon2, CircleIcon, PlayIcon, StopAltIcon } from "@storybook/icons";
|
|
8332
8371
|
import { styled as styled36, useTheme as useTheme6 } from "storybook/theming";
|
|
8333
8372
|
var WarningContainer = styled36.div({
|
|
@@ -8341,16 +8380,16 @@ var StatusIcon = /* @__PURE__ */ __name(({ status }) => {
|
|
|
8341
8380
|
const theme3 = useTheme6();
|
|
8342
8381
|
switch (status) {
|
|
8343
8382
|
case "done" /* DONE */: {
|
|
8344
|
-
return
|
|
8383
|
+
return React60.createElement(CheckIcon2, { color: theme3.color.positive, "data-testid": "icon-done" });
|
|
8345
8384
|
}
|
|
8346
8385
|
case "error" /* ERROR */: {
|
|
8347
|
-
return
|
|
8386
|
+
return React60.createElement(StopAltIcon, { color: theme3.color.negative, "data-testid": "icon-error" });
|
|
8348
8387
|
}
|
|
8349
8388
|
case "active" /* ACTIVE */: {
|
|
8350
|
-
return
|
|
8389
|
+
return React60.createElement(PlayIcon, { color: theme3.color.secondary, "data-testid": "icon-active" });
|
|
8351
8390
|
}
|
|
8352
8391
|
case "waiting" /* WAITING */: {
|
|
8353
|
-
return
|
|
8392
|
+
return React60.createElement(WarningContainer, { "data-testid": "icon-waiting" }, React60.createElement(CircleIcon, { color: curriedTransparentize$1(0.5, "#CCCCCC"), size: 6 }));
|
|
8354
8393
|
}
|
|
8355
8394
|
default: {
|
|
8356
8395
|
return null;
|
|
@@ -8466,13 +8505,13 @@ var Exception = /* @__PURE__ */ __name(({ exception }) => {
|
|
|
8466
8505
|
return null;
|
|
8467
8506
|
}
|
|
8468
8507
|
if (exception.callId === INTERNAL_RENDER_CALL_ID) {
|
|
8469
|
-
return
|
|
8508
|
+
return React61.createElement(RowMessage, null, React61.createElement("pre", null, React61.createElement(ErrorName, null, exception.name, ":"), " ", React61.createElement(ErrorMessage2, null, exception.message)), React61.createElement(ErrorExplainer, null, "The component failed to render properly. Automated component tests will not run until this is resolved. Check the full error message in Storybook\u2019s canvas to debug."));
|
|
8470
8509
|
}
|
|
8471
8510
|
if (isJestError(exception)) {
|
|
8472
|
-
return
|
|
8511
|
+
return React61.createElement(MatcherResult, { ...exception });
|
|
8473
8512
|
}
|
|
8474
8513
|
if (isChaiError(exception)) {
|
|
8475
|
-
return
|
|
8514
|
+
return React61.createElement(RowMessage, null, React61.createElement(
|
|
8476
8515
|
MatcherResult,
|
|
8477
8516
|
{
|
|
8478
8517
|
message: `${exception.message}${exception.diff ? `
|
|
@@ -8480,11 +8519,11 @@ var Exception = /* @__PURE__ */ __name(({ exception }) => {
|
|
|
8480
8519
|
${exception.diff}` : ""}`,
|
|
8481
8520
|
style: { padding: 0 }
|
|
8482
8521
|
}
|
|
8483
|
-
),
|
|
8522
|
+
), React61.createElement("p", null, "See the full stack trace in the browser console."));
|
|
8484
8523
|
}
|
|
8485
8524
|
const paragraphs = exception.message.split("\n\n");
|
|
8486
8525
|
const more = paragraphs.length > 1;
|
|
8487
|
-
return
|
|
8526
|
+
return React61.createElement(RowMessage, null, React61.createElement("pre", { dangerouslySetInnerHTML: { __html: filter.toHtml(paragraphs[0]) } }), more && React61.createElement("p", null, "See the full stack trace in the browser console."));
|
|
8488
8527
|
}, "Exception");
|
|
8489
8528
|
var Interaction = /* @__PURE__ */ __name(({
|
|
8490
8529
|
call,
|
|
@@ -8497,7 +8536,7 @@ var Interaction = /* @__PURE__ */ __name(({
|
|
|
8497
8536
|
toggleCollapsed,
|
|
8498
8537
|
pausedAt
|
|
8499
8538
|
}) => {
|
|
8500
|
-
const [isHovered, setIsHovered] =
|
|
8539
|
+
const [isHovered, setIsHovered] = React61.useState(false);
|
|
8501
8540
|
const isInteractive = !controlStates.goto || !call.interceptable || !!call.ancestors?.length;
|
|
8502
8541
|
if (isHidden) {
|
|
8503
8542
|
return null;
|
|
@@ -8505,7 +8544,7 @@ var Interaction = /* @__PURE__ */ __name(({
|
|
|
8505
8544
|
if (call.id === INTERNAL_RENDER_CALL_ID) {
|
|
8506
8545
|
return null;
|
|
8507
8546
|
}
|
|
8508
|
-
return
|
|
8547
|
+
return React61.createElement(RowContainer, { call, pausedAt }, React61.createElement(RowHeader, { isInteractive }, React61.createElement(
|
|
8509
8548
|
RowLabel,
|
|
8510
8549
|
{
|
|
8511
8550
|
"aria-label": "Interaction step",
|
|
@@ -8515,27 +8554,27 @@ var Interaction = /* @__PURE__ */ __name(({
|
|
|
8515
8554
|
onMouseEnter: () => controlStates.goto && setIsHovered(true),
|
|
8516
8555
|
onMouseLeave: () => controlStates.goto && setIsHovered(false)
|
|
8517
8556
|
},
|
|
8518
|
-
|
|
8519
|
-
|
|
8520
|
-
),
|
|
8557
|
+
React61.createElement(StatusIcon, { status: isHovered ? "active" /* ACTIVE */ : call.status }),
|
|
8558
|
+
React61.createElement(MethodCallWrapper, { style: { marginLeft: 6, marginBottom: 1 } }, React61.createElement(MethodCall, { call, callsById }))
|
|
8559
|
+
), React61.createElement(RowActions, null, (childCallIds?.length ?? 0) > 0 && React61.createElement(
|
|
8521
8560
|
WithTooltip2,
|
|
8522
8561
|
{
|
|
8523
8562
|
hasChrome: false,
|
|
8524
|
-
tooltip:
|
|
8563
|
+
tooltip: React61.createElement(Note, { note: `${isCollapsed ? "Show" : "Hide"} interactions` })
|
|
8525
8564
|
},
|
|
8526
|
-
|
|
8565
|
+
React61.createElement(
|
|
8527
8566
|
StyledIconButton,
|
|
8528
8567
|
{
|
|
8529
8568
|
onClick: toggleCollapsed,
|
|
8530
8569
|
"aria-label": isCollapsed ? "Expand interaction" : "Collapse interaction"
|
|
8531
8570
|
},
|
|
8532
|
-
isCollapsed ?
|
|
8571
|
+
isCollapsed ? React61.createElement(ChevronDownIcon3, null) : React61.createElement(ChevronUpIcon2, null)
|
|
8533
8572
|
)
|
|
8534
|
-
))), call.status === "error" /* ERROR */ && call.exception?.callId === call.id &&
|
|
8573
|
+
))), call.status === "error" /* ERROR */ && call.exception?.callId === call.id && React61.createElement(Exception, { exception: call.exception }));
|
|
8535
8574
|
}, "Interaction");
|
|
8536
8575
|
|
|
8537
8576
|
// src/component-testing/components/Subnav.tsx
|
|
8538
|
-
import
|
|
8577
|
+
import React64 from "react";
|
|
8539
8578
|
import {
|
|
8540
8579
|
Bar as Bar3,
|
|
8541
8580
|
Button as Button6,
|
|
@@ -8555,7 +8594,7 @@ import {
|
|
|
8555
8594
|
import { styled as styled39, useTheme as useTheme7 } from "storybook/theming";
|
|
8556
8595
|
|
|
8557
8596
|
// src/component-testing/components/StatusBadge.tsx
|
|
8558
|
-
import
|
|
8597
|
+
import React63 from "react";
|
|
8559
8598
|
import { styled as styled38, typography as typography3 } from "storybook/theming";
|
|
8560
8599
|
var StatusColorMapping = {
|
|
8561
8600
|
rendering: "mediumdark",
|
|
@@ -8590,7 +8629,7 @@ var StyledBadge = styled38.div(({ theme: theme3, status }) => {
|
|
|
8590
8629
|
});
|
|
8591
8630
|
var StatusBadge = /* @__PURE__ */ __name(({ status }) => {
|
|
8592
8631
|
const badgeText = StatusTextMapping[status];
|
|
8593
|
-
return
|
|
8632
|
+
return React63.createElement(StyledBadge, { "aria-label": "Status of the test run", status }, badgeText);
|
|
8594
8633
|
}, "StatusBadge");
|
|
8595
8634
|
|
|
8596
8635
|
// src/component-testing/components/Subnav.tsx
|
|
@@ -8671,46 +8710,46 @@ var Subnav = /* @__PURE__ */ __name(({
|
|
|
8671
8710
|
}) => {
|
|
8672
8711
|
const buttonText = status === "errored" ? "Scroll to error" : "Scroll to end";
|
|
8673
8712
|
const theme3 = useTheme7();
|
|
8674
|
-
return
|
|
8713
|
+
return React64.createElement(SubnavWrapper, null, React64.createElement(Bar3, { backgroundColor: theme3.background.app }, React64.createElement(StyledSubnav, { "aria-label": "Component tests toolbar" }, React64.createElement(Group, null, React64.createElement(StatusBadge, { status }), React64.createElement(JumpToEndButton, { onClick: onScrollToEnd, disabled: !onScrollToEnd }, buttonText), React64.createElement(StyledSeparator, null), React64.createElement(WithTooltip3, { trigger: "hover", hasChrome: false, tooltip: React64.createElement(Note2, { note: "Go to start" }) }, React64.createElement(
|
|
8675
8714
|
RewindButton,
|
|
8676
8715
|
{
|
|
8677
8716
|
"aria-label": "Go to start",
|
|
8678
8717
|
onClick: controls.start,
|
|
8679
8718
|
disabled: !controlStates.start
|
|
8680
8719
|
},
|
|
8681
|
-
|
|
8682
|
-
)),
|
|
8720
|
+
React64.createElement(RewindIcon, null)
|
|
8721
|
+
)), React64.createElement(WithTooltip3, { trigger: "hover", hasChrome: false, tooltip: React64.createElement(Note2, { note: "Go back" }) }, React64.createElement(
|
|
8683
8722
|
StyledIconButton2,
|
|
8684
8723
|
{
|
|
8685
8724
|
"aria-label": "Go back",
|
|
8686
8725
|
onClick: controls.back,
|
|
8687
8726
|
disabled: !controlStates.back
|
|
8688
8727
|
},
|
|
8689
|
-
|
|
8690
|
-
)),
|
|
8728
|
+
React64.createElement(PlayBackIcon, null)
|
|
8729
|
+
)), React64.createElement(WithTooltip3, { trigger: "hover", hasChrome: false, tooltip: React64.createElement(Note2, { note: "Go forward" }) }, React64.createElement(
|
|
8691
8730
|
StyledIconButton2,
|
|
8692
8731
|
{
|
|
8693
8732
|
"aria-label": "Go forward",
|
|
8694
8733
|
onClick: controls.next,
|
|
8695
8734
|
disabled: !controlStates.next
|
|
8696
8735
|
},
|
|
8697
|
-
|
|
8698
|
-
)),
|
|
8736
|
+
React64.createElement(PlayNextIcon, null)
|
|
8737
|
+
)), React64.createElement(WithTooltip3, { trigger: "hover", hasChrome: false, tooltip: React64.createElement(Note2, { note: "Go to end" }) }, React64.createElement(
|
|
8699
8738
|
StyledIconButton2,
|
|
8700
8739
|
{
|
|
8701
8740
|
"aria-label": "Go to end",
|
|
8702
8741
|
onClick: controls.end,
|
|
8703
8742
|
disabled: !controlStates.end
|
|
8704
8743
|
},
|
|
8705
|
-
|
|
8706
|
-
)),
|
|
8744
|
+
React64.createElement(FastForwardIcon, null)
|
|
8745
|
+
)), React64.createElement(WithTooltip3, { trigger: "hover", hasChrome: false, tooltip: React64.createElement(Note2, { note: "Rerun" }) }, React64.createElement(RerunButton, { "aria-label": "Rerun", onClick: controls.rerun }, React64.createElement(SyncIcon, null)))), (importPath || storyFileName) && React64.createElement(Group, null, canOpenInEditor ? React64.createElement(
|
|
8707
8746
|
WithTooltip3,
|
|
8708
8747
|
{
|
|
8709
8748
|
trigger: "hover",
|
|
8710
8749
|
hasChrome: false,
|
|
8711
|
-
tooltip:
|
|
8750
|
+
tooltip: React64.createElement(Note2, { note: "Open in editor" })
|
|
8712
8751
|
},
|
|
8713
|
-
|
|
8752
|
+
React64.createElement(
|
|
8714
8753
|
StyledLocation,
|
|
8715
8754
|
{
|
|
8716
8755
|
"aria-label": "Open in editor",
|
|
@@ -8722,11 +8761,11 @@ var Subnav = /* @__PURE__ */ __name(({
|
|
|
8722
8761
|
},
|
|
8723
8762
|
storyFileName
|
|
8724
8763
|
)
|
|
8725
|
-
) :
|
|
8764
|
+
) : React64.createElement(StyledLocation, { isText: true }, storyFileName)))));
|
|
8726
8765
|
}, "Subnav");
|
|
8727
8766
|
|
|
8728
8767
|
// src/component-testing/components/TestDiscrepancyMessage.tsx
|
|
8729
|
-
import
|
|
8768
|
+
import React65 from "react";
|
|
8730
8769
|
import { Link as Link6 } from "storybook/internal/components";
|
|
8731
8770
|
import { useStorybookApi as useStorybookApi5 } from "storybook/manager-api";
|
|
8732
8771
|
import { styled as styled40 } from "storybook/theming";
|
|
@@ -8759,7 +8798,7 @@ var TestDiscrepancyMessage = /* @__PURE__ */ __name(({ browserTestStatus }) => {
|
|
|
8759
8798
|
renderer: true
|
|
8760
8799
|
});
|
|
8761
8800
|
const [passed, failed] = browserTestStatus === "error" /* ERROR */ ? ["the CLI", "this browser"] : ["this browser", "the CLI"];
|
|
8762
|
-
return
|
|
8801
|
+
return React65.createElement(Wrapper12, null, "This interaction test passed in ", passed, ", but the tests failed in ", failed, ".", " ", React65.createElement(Link6, { href: docsUrl, target: "_blank", withArrow: true }, "Learn what could cause this"));
|
|
8763
8802
|
}, "TestDiscrepancyMessage");
|
|
8764
8803
|
|
|
8765
8804
|
// src/component-testing/components/InteractionsPanel.tsx
|
|
@@ -8800,7 +8839,7 @@ var CaughtExceptionStack = styled41.pre(({ theme: theme3 }) => ({
|
|
|
8800
8839
|
},
|
|
8801
8840
|
fontSize: theme3.typography.size.s1 - 1
|
|
8802
8841
|
}));
|
|
8803
|
-
var InteractionsPanel =
|
|
8842
|
+
var InteractionsPanel = React66.memo(
|
|
8804
8843
|
/* @__PURE__ */ __name(function InteractionsPanel2({
|
|
8805
8844
|
storyUrl,
|
|
8806
8845
|
status,
|
|
@@ -8823,7 +8862,7 @@ var InteractionsPanel = React65.memo(
|
|
|
8823
8862
|
}) {
|
|
8824
8863
|
const filter = useAnsiToHtmlFilter();
|
|
8825
8864
|
const hasRealInteractions = interactions.some((i2) => i2.id !== INTERNAL_RENDER_CALL_ID);
|
|
8826
|
-
return
|
|
8865
|
+
return React66.createElement(Container3, null, hasResultMismatch && React66.createElement(TestDiscrepancyMessage, { browserTestStatus }), controlStates.detached && (hasRealInteractions || hasException) && React66.createElement(DetachedDebuggerMessage, { storyUrl }), React66.createElement(
|
|
8827
8866
|
Subnav,
|
|
8828
8867
|
{
|
|
8829
8868
|
controls,
|
|
@@ -8835,7 +8874,7 @@ var InteractionsPanel = React65.memo(
|
|
|
8835
8874
|
canOpenInEditor,
|
|
8836
8875
|
api
|
|
8837
8876
|
}
|
|
8838
|
-
),
|
|
8877
|
+
), React66.createElement("div", { "aria-label": "Interactions list" }, interactions.map((call) => React66.createElement(
|
|
8839
8878
|
Interaction,
|
|
8840
8879
|
{
|
|
8841
8880
|
key: call.id,
|
|
@@ -8849,7 +8888,7 @@ var InteractionsPanel = React65.memo(
|
|
|
8849
8888
|
toggleCollapsed: call.toggleCollapsed,
|
|
8850
8889
|
pausedAt
|
|
8851
8890
|
}
|
|
8852
|
-
))), caughtException && !isTestAssertionError(caughtException) &&
|
|
8891
|
+
))), caughtException && !isTestAssertionError(caughtException) && React66.createElement(CaughtException, null, React66.createElement(CaughtExceptionTitle, null, "Caught exception in ", React66.createElement(CaughtExceptionCode, null, "play"), " function"), React66.createElement(
|
|
8853
8892
|
CaughtExceptionStack,
|
|
8854
8893
|
{
|
|
8855
8894
|
"data-chromatic": "ignore",
|
|
@@ -8857,7 +8896,7 @@ var InteractionsPanel = React65.memo(
|
|
|
8857
8896
|
__html: filter.toHtml(printSerializedError(caughtException))
|
|
8858
8897
|
}
|
|
8859
8898
|
}
|
|
8860
|
-
)), unhandledErrors &&
|
|
8899
|
+
)), unhandledErrors && React66.createElement(CaughtException, null, React66.createElement(CaughtExceptionTitle, null, "Unhandled Errors"), React66.createElement(CaughtExceptionDescription, null, "Found ", unhandledErrors.length, " unhandled error", unhandledErrors.length > 1 ? "s" : "", " ", "while running the play function. This might cause false positive assertions. Resolve unhandled errors or ignore unhandled errors with setting the", React66.createElement(CaughtExceptionCode, null, "test.dangerouslyIgnoreUnhandledErrors"), " ", "parameter to ", React66.createElement(CaughtExceptionCode, null, "true"), "."), unhandledErrors.map((error, i2) => React66.createElement(CaughtExceptionStack, { key: i2, "data-chromatic": "ignore" }, printSerializedError(error)))), React66.createElement("div", { ref: endRef }), status === "completed" && !caughtException && !hasRealInteractions && React66.createElement(Empty2, null));
|
|
8861
8900
|
}, "InteractionsPanel")
|
|
8862
8901
|
);
|
|
8863
8902
|
function printSerializedError(error) {
|
|
@@ -8990,9 +9029,9 @@ var Panel = memo4(
|
|
|
8990
9029
|
caughtException: void 0,
|
|
8991
9030
|
unhandledErrors: void 0
|
|
8992
9031
|
});
|
|
8993
|
-
const [scrollTarget, setScrollTarget] =
|
|
8994
|
-
const [collapsed, setCollapsed] =
|
|
8995
|
-
const [hasResultMismatch, setResultMismatch] =
|
|
9032
|
+
const [scrollTarget, setScrollTarget] = useState23(void 0);
|
|
9033
|
+
const [collapsed, setCollapsed] = useState23(/* @__PURE__ */ new Set());
|
|
9034
|
+
const [hasResultMismatch, setResultMismatch] = useState23(false);
|
|
8996
9035
|
const {
|
|
8997
9036
|
status = "rendering",
|
|
8998
9037
|
controlStates = INITIAL_CONTROL_STATES,
|
|
@@ -9007,7 +9046,7 @@ var Panel = memo4(
|
|
|
9007
9046
|
);
|
|
9008
9047
|
const setCall = /* @__PURE__ */ __name(({ status: status2, ...call }) => calls.current.set(call.id, call), "setCall");
|
|
9009
9048
|
const endRef = useRef7();
|
|
9010
|
-
|
|
9049
|
+
useEffect18(() => {
|
|
9011
9050
|
let observer;
|
|
9012
9051
|
if (global2.IntersectionObserver) {
|
|
9013
9052
|
observer = new global2.IntersectionObserver(
|
|
@@ -9094,7 +9133,7 @@ var Panel = memo4(
|
|
|
9094
9133
|
},
|
|
9095
9134
|
[collapsed]
|
|
9096
9135
|
);
|
|
9097
|
-
|
|
9136
|
+
useEffect18(() => {
|
|
9098
9137
|
set(
|
|
9099
9138
|
(state2) => getPanelState(state2, { log: log.current, calls: calls.current, collapsed, setCollapsed })
|
|
9100
9139
|
);
|
|
@@ -9122,7 +9161,7 @@ var Panel = memo4(
|
|
|
9122
9161
|
}
|
|
9123
9162
|
return status === "playing" ? "active" /* ACTIVE */ : void 0;
|
|
9124
9163
|
}, [status, interactions, hasException]);
|
|
9125
|
-
|
|
9164
|
+
useEffect18(() => {
|
|
9126
9165
|
const isMismatch = browserTestStatus && statusValue && statusValue !== "status-value:pending" && statusValue !== storyStatusMap[browserTestStatus];
|
|
9127
9166
|
if (isMismatch) {
|
|
9128
9167
|
const timeout = setTimeout(
|
|
@@ -9147,7 +9186,7 @@ var Panel = memo4(
|
|
|
9147
9186
|
setResultMismatch(false);
|
|
9148
9187
|
}
|
|
9149
9188
|
}, [emit, browserTestStatus, statusValue, storyId, testRunId]);
|
|
9150
|
-
return
|
|
9189
|
+
return React67.createElement(Fragment3, { key: "component-tests" }, React67.createElement(
|
|
9151
9190
|
InteractionsPanel,
|
|
9152
9191
|
{
|
|
9153
9192
|
storyUrl,
|
|
@@ -9174,7 +9213,7 @@ var Panel = memo4(
|
|
|
9174
9213
|
);
|
|
9175
9214
|
|
|
9176
9215
|
// src/component-testing/components/PanelTitle.tsx
|
|
9177
|
-
import
|
|
9216
|
+
import React68 from "react";
|
|
9178
9217
|
import { Badge as Badge3 } from "storybook/internal/components";
|
|
9179
9218
|
import { useAddonState as useAddonState3, useStorybookApi as useStorybookApi7 } from "storybook/manager-api";
|
|
9180
9219
|
function PanelTitle() {
|
|
@@ -9182,7 +9221,7 @@ function PanelTitle() {
|
|
|
9182
9221
|
const selectedPanel = api.getSelectedPanel();
|
|
9183
9222
|
const [addonState = {}] = useAddonState3(ADDON_ID7);
|
|
9184
9223
|
const { status, hasException, interactionsCount } = addonState;
|
|
9185
|
-
return
|
|
9224
|
+
return React68.createElement("div", { style: { display: "flex", alignItems: "center", gap: 6 } }, React68.createElement("span", null, "Interactions"), interactionsCount && status !== "errored" && !hasException ? React68.createElement(Badge3, { compact: true, status: selectedPanel === PANEL_ID2 ? "active" : "neutral" }, interactionsCount) : null, status === "errored" || hasException ? React68.createElement(StatusIcon, { status: "error" /* ERROR */ }) : null);
|
|
9186
9225
|
}
|
|
9187
9226
|
__name(PanelTitle, "PanelTitle");
|
|
9188
9227
|
|
|
@@ -9201,28 +9240,28 @@ var manager_default3 = addons3.register(ADDON_ID7, () => {
|
|
|
9201
9240
|
}, "filter");
|
|
9202
9241
|
addons3.add(PANEL_ID2, {
|
|
9203
9242
|
type: types3.PANEL,
|
|
9204
|
-
title: /* @__PURE__ */ __name(() =>
|
|
9243
|
+
title: /* @__PURE__ */ __name(() => React69.createElement(PanelTitle, null), "title"),
|
|
9205
9244
|
match: /* @__PURE__ */ __name(({ viewMode }) => viewMode === "story", "match"),
|
|
9206
9245
|
render: /* @__PURE__ */ __name(({ active }) => {
|
|
9207
|
-
return
|
|
9246
|
+
return React69.createElement(AddonPanel2, { active: !!active }, React69.createElement(Consumer, { filter }, (props) => React69.createElement(Panel, { ...props })));
|
|
9208
9247
|
}, "render")
|
|
9209
9248
|
});
|
|
9210
9249
|
}
|
|
9211
9250
|
});
|
|
9212
9251
|
|
|
9213
9252
|
// src/backgrounds/manager.tsx
|
|
9214
|
-
import
|
|
9253
|
+
import React71 from "react";
|
|
9215
9254
|
import { addons as addons4, types as types4 } from "storybook/manager-api";
|
|
9216
9255
|
|
|
9217
9256
|
// src/backgrounds/components/Tool.tsx
|
|
9218
|
-
import
|
|
9257
|
+
import React70, { Fragment as Fragment4, memo as memo5, useCallback as useCallback8, useState as useState24 } from "react";
|
|
9219
9258
|
import { IconButton as IconButton7, TooltipLinkList, WithTooltip as WithTooltip4 } from "storybook/internal/components";
|
|
9220
9259
|
import { CircleIcon as CircleIcon2, GridIcon, PhotoIcon, RefreshIcon } from "@storybook/icons";
|
|
9221
9260
|
import { useGlobals as useGlobals2, useParameter as useParameter3 } from "storybook/manager-api";
|
|
9222
9261
|
var BackgroundTool = memo5(/* @__PURE__ */ __name(function BackgroundSelector() {
|
|
9223
9262
|
const config = useParameter3(PARAM_KEY3);
|
|
9224
9263
|
const [globals, updateGlobals, storyGlobals] = useGlobals2();
|
|
9225
|
-
const [isTooltipVisible, setIsTooltipVisible] =
|
|
9264
|
+
const [isTooltipVisible, setIsTooltipVisible] = useState24(false);
|
|
9226
9265
|
const { options = DEFAULT_BACKGROUNDS, disable = true } = config || {};
|
|
9227
9266
|
if (disable) {
|
|
9228
9267
|
return null;
|
|
@@ -9233,7 +9272,7 @@ var BackgroundTool = memo5(/* @__PURE__ */ __name(function BackgroundSelector()
|
|
|
9233
9272
|
const item = options[backgroundName];
|
|
9234
9273
|
const isLocked = !!storyGlobals?.[PARAM_KEY3];
|
|
9235
9274
|
const length2 = Object.keys(options).length;
|
|
9236
|
-
return
|
|
9275
|
+
return React70.createElement(
|
|
9237
9276
|
Pure,
|
|
9238
9277
|
{
|
|
9239
9278
|
...{
|
|
@@ -9270,7 +9309,7 @@ var Pure = memo5(/* @__PURE__ */ __name(function PureTool(props) {
|
|
|
9270
9309
|
},
|
|
9271
9310
|
[updateGlobals]
|
|
9272
9311
|
);
|
|
9273
|
-
return
|
|
9312
|
+
return React70.createElement(Fragment4, null, React70.createElement(
|
|
9274
9313
|
IconButton7,
|
|
9275
9314
|
{
|
|
9276
9315
|
key: "grid",
|
|
@@ -9279,15 +9318,15 @@ var Pure = memo5(/* @__PURE__ */ __name(function PureTool(props) {
|
|
|
9279
9318
|
title: "Apply a grid to the preview",
|
|
9280
9319
|
onClick: () => update({ value: backgroundName, grid: !isGrid })
|
|
9281
9320
|
},
|
|
9282
|
-
|
|
9283
|
-
), length2 > 0 ?
|
|
9321
|
+
React70.createElement(GridIcon, null)
|
|
9322
|
+
), length2 > 0 ? React70.createElement(
|
|
9284
9323
|
WithTooltip4,
|
|
9285
9324
|
{
|
|
9286
9325
|
key: "background",
|
|
9287
9326
|
placement: "top",
|
|
9288
9327
|
closeOnOutsideClick: true,
|
|
9289
9328
|
tooltip: ({ onHide }) => {
|
|
9290
|
-
return
|
|
9329
|
+
return React70.createElement(
|
|
9291
9330
|
TooltipLinkList,
|
|
9292
9331
|
{
|
|
9293
9332
|
links: [
|
|
@@ -9295,7 +9334,7 @@ var Pure = memo5(/* @__PURE__ */ __name(function PureTool(props) {
|
|
|
9295
9334
|
{
|
|
9296
9335
|
id: "reset",
|
|
9297
9336
|
title: "Reset background",
|
|
9298
|
-
icon:
|
|
9337
|
+
icon: React70.createElement(RefreshIcon, null),
|
|
9299
9338
|
onClick: /* @__PURE__ */ __name(() => {
|
|
9300
9339
|
update(void 0);
|
|
9301
9340
|
onHide();
|
|
@@ -9305,7 +9344,7 @@ var Pure = memo5(/* @__PURE__ */ __name(function PureTool(props) {
|
|
|
9305
9344
|
...Object.entries(backgroundMap).map(([k2, value2]) => ({
|
|
9306
9345
|
id: k2,
|
|
9307
9346
|
title: value2.name,
|
|
9308
|
-
icon:
|
|
9347
|
+
icon: React70.createElement(CircleIcon2, { color: value2?.value || "grey" }),
|
|
9309
9348
|
active: k2 === backgroundName,
|
|
9310
9349
|
onClick: /* @__PURE__ */ __name(() => {
|
|
9311
9350
|
update({ value: k2, grid: isGrid });
|
|
@@ -9318,7 +9357,7 @@ var Pure = memo5(/* @__PURE__ */ __name(function PureTool(props) {
|
|
|
9318
9357
|
},
|
|
9319
9358
|
onVisibleChange: setIsTooltipVisible
|
|
9320
9359
|
},
|
|
9321
|
-
|
|
9360
|
+
React70.createElement(
|
|
9322
9361
|
IconButton7,
|
|
9323
9362
|
{
|
|
9324
9363
|
disabled: isLocked,
|
|
@@ -9326,7 +9365,7 @@ var Pure = memo5(/* @__PURE__ */ __name(function PureTool(props) {
|
|
|
9326
9365
|
title: "Change the background of the preview",
|
|
9327
9366
|
active: !!item || isTooltipVisible
|
|
9328
9367
|
},
|
|
9329
|
-
|
|
9368
|
+
React70.createElement(PhotoIcon, null)
|
|
9330
9369
|
)
|
|
9331
9370
|
) : null);
|
|
9332
9371
|
}, "PureTool"));
|
|
@@ -9338,17 +9377,17 @@ var manager_default4 = addons4.register(ADDON_ID3, () => {
|
|
|
9338
9377
|
title: "Backgrounds",
|
|
9339
9378
|
type: types4.TOOL,
|
|
9340
9379
|
match: /* @__PURE__ */ __name(({ viewMode, tabId }) => !!(viewMode && viewMode.match(/^(story|docs)$/)) && !tabId, "match"),
|
|
9341
|
-
render: /* @__PURE__ */ __name(() =>
|
|
9380
|
+
render: /* @__PURE__ */ __name(() => React71.createElement(BackgroundTool, null), "render")
|
|
9342
9381
|
});
|
|
9343
9382
|
}
|
|
9344
9383
|
});
|
|
9345
9384
|
|
|
9346
9385
|
// src/measure/manager.tsx
|
|
9347
|
-
import
|
|
9386
|
+
import React74 from "react";
|
|
9348
9387
|
import { addons as addons5, types as types5 } from "storybook/manager-api";
|
|
9349
9388
|
|
|
9350
9389
|
// src/measure/Tool.tsx
|
|
9351
|
-
import
|
|
9390
|
+
import React73, { useCallback as useCallback9, useEffect as useEffect19 } from "react";
|
|
9352
9391
|
import { IconButton as IconButton8 } from "storybook/internal/components";
|
|
9353
9392
|
import { RulerIcon } from "@storybook/icons";
|
|
9354
9393
|
import { useGlobals as useGlobals3, useStorybookApi as useStorybookApi8 } from "storybook/manager-api";
|
|
@@ -9362,7 +9401,7 @@ var Tool = /* @__PURE__ */ __name(() => {
|
|
|
9362
9401
|
}),
|
|
9363
9402
|
[updateGlobals, measureEnabled]
|
|
9364
9403
|
);
|
|
9365
|
-
|
|
9404
|
+
useEffect19(() => {
|
|
9366
9405
|
api.setAddonShortcut(ADDON_ID4, {
|
|
9367
9406
|
label: "Toggle Measure",
|
|
9368
9407
|
defaultShortcut: ["M"],
|
|
@@ -9371,7 +9410,7 @@ var Tool = /* @__PURE__ */ __name(() => {
|
|
|
9371
9410
|
action: toggleMeasure
|
|
9372
9411
|
});
|
|
9373
9412
|
}, [toggleMeasure, api]);
|
|
9374
|
-
return
|
|
9413
|
+
return React73.createElement(
|
|
9375
9414
|
IconButton8,
|
|
9376
9415
|
{
|
|
9377
9416
|
key: TOOL_ID2,
|
|
@@ -9379,7 +9418,7 @@ var Tool = /* @__PURE__ */ __name(() => {
|
|
|
9379
9418
|
title: "Enable measure",
|
|
9380
9419
|
onClick: toggleMeasure
|
|
9381
9420
|
},
|
|
9382
|
-
|
|
9421
|
+
React73.createElement(RulerIcon, null)
|
|
9383
9422
|
);
|
|
9384
9423
|
}, "Tool");
|
|
9385
9424
|
|
|
@@ -9390,17 +9429,17 @@ var manager_default5 = addons5.register(ADDON_ID4, () => {
|
|
|
9390
9429
|
type: types5.TOOL,
|
|
9391
9430
|
title: "Measure",
|
|
9392
9431
|
match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
|
|
9393
|
-
render: /* @__PURE__ */ __name(() =>
|
|
9432
|
+
render: /* @__PURE__ */ __name(() => React74.createElement(Tool, null), "render")
|
|
9394
9433
|
});
|
|
9395
9434
|
}
|
|
9396
9435
|
});
|
|
9397
9436
|
|
|
9398
9437
|
// src/outline/manager.tsx
|
|
9399
|
-
import
|
|
9438
|
+
import React76 from "react";
|
|
9400
9439
|
import { addons as addons6, types as types6 } from "storybook/manager-api";
|
|
9401
9440
|
|
|
9402
9441
|
// src/outline/OutlineSelector.tsx
|
|
9403
|
-
import
|
|
9442
|
+
import React75, { memo as memo6, useCallback as useCallback10, useEffect as useEffect20 } from "react";
|
|
9404
9443
|
import { IconButton as IconButton9 } from "storybook/internal/components";
|
|
9405
9444
|
import { OutlineIcon } from "@storybook/icons";
|
|
9406
9445
|
import { useGlobals as useGlobals4, useStorybookApi as useStorybookApi9 } from "storybook/manager-api";
|
|
@@ -9414,7 +9453,7 @@ var OutlineSelector = memo6(/* @__PURE__ */ __name(function OutlineSelector2() {
|
|
|
9414
9453
|
}),
|
|
9415
9454
|
[isActive]
|
|
9416
9455
|
);
|
|
9417
|
-
|
|
9456
|
+
useEffect20(() => {
|
|
9418
9457
|
api.setAddonShortcut(ADDON_ID5, {
|
|
9419
9458
|
label: "Toggle Outline",
|
|
9420
9459
|
defaultShortcut: ["alt", "O"],
|
|
@@ -9423,7 +9462,7 @@ var OutlineSelector = memo6(/* @__PURE__ */ __name(function OutlineSelector2() {
|
|
|
9423
9462
|
action: toggleOutline
|
|
9424
9463
|
});
|
|
9425
9464
|
}, [toggleOutline, api]);
|
|
9426
|
-
return
|
|
9465
|
+
return React75.createElement(
|
|
9427
9466
|
IconButton9,
|
|
9428
9467
|
{
|
|
9429
9468
|
key: "outline",
|
|
@@ -9431,7 +9470,7 @@ var OutlineSelector = memo6(/* @__PURE__ */ __name(function OutlineSelector2() {
|
|
|
9431
9470
|
title: "Apply outlines to the preview",
|
|
9432
9471
|
onClick: toggleOutline
|
|
9433
9472
|
},
|
|
9434
|
-
|
|
9473
|
+
React75.createElement(OutlineIcon, null)
|
|
9435
9474
|
);
|
|
9436
9475
|
}, "OutlineSelector"));
|
|
9437
9476
|
|
|
@@ -9442,17 +9481,17 @@ var manager_default6 = addons6.register(ADDON_ID5, () => {
|
|
|
9442
9481
|
title: "Outline",
|
|
9443
9482
|
type: types6.TOOL,
|
|
9444
9483
|
match: /* @__PURE__ */ __name(({ viewMode, tabId }) => !!(viewMode && viewMode.match(/^(story|docs)$/)) && !tabId, "match"),
|
|
9445
|
-
render: /* @__PURE__ */ __name(() =>
|
|
9484
|
+
render: /* @__PURE__ */ __name(() => React76.createElement(OutlineSelector, null), "render")
|
|
9446
9485
|
});
|
|
9447
9486
|
}
|
|
9448
9487
|
});
|
|
9449
9488
|
|
|
9450
9489
|
// src/viewport/manager.tsx
|
|
9451
|
-
import * as
|
|
9490
|
+
import * as React79 from "react";
|
|
9452
9491
|
import { addons as addons7, types as types7 } from "storybook/manager-api";
|
|
9453
9492
|
|
|
9454
9493
|
// src/viewport/components/Tool.tsx
|
|
9455
|
-
import
|
|
9494
|
+
import React78, { Fragment as Fragment6, useCallback as useCallback11, useEffect as useEffect21, useState as useState25 } from "react";
|
|
9456
9495
|
import { IconButton as IconButton11, TooltipLinkList as TooltipLinkList2, WithTooltip as WithTooltip5 } from "storybook/internal/components";
|
|
9457
9496
|
import { GrowIcon, RefreshIcon as RefreshIcon2, TransferIcon } from "@storybook/icons";
|
|
9458
9497
|
import { useGlobals as useGlobals5, useParameter as useParameter4 } from "storybook/manager-api";
|
|
@@ -9502,7 +9541,7 @@ var registerShortcuts = /* @__PURE__ */ __name(async (api, viewport, updateGloba
|
|
|
9502
9541
|
}, "registerShortcuts");
|
|
9503
9542
|
|
|
9504
9543
|
// src/viewport/utils.tsx
|
|
9505
|
-
import
|
|
9544
|
+
import React77, { Fragment as Fragment5 } from "react";
|
|
9506
9545
|
import { IconButton as IconButton10 } from "storybook/internal/components";
|
|
9507
9546
|
import { BrowserIcon, MobileIcon, TabletIcon } from "@storybook/icons";
|
|
9508
9547
|
import { styled as styled42 } from "storybook/theming";
|
|
@@ -9532,17 +9571,17 @@ var IconButtonLabel = styled42.div(({ theme: theme3 }) => ({
|
|
|
9532
9571
|
marginLeft: 10
|
|
9533
9572
|
}));
|
|
9534
9573
|
var iconsMap = {
|
|
9535
|
-
desktop:
|
|
9536
|
-
mobile:
|
|
9537
|
-
tablet:
|
|
9538
|
-
other:
|
|
9574
|
+
desktop: React77.createElement(BrowserIcon, null),
|
|
9575
|
+
mobile: React77.createElement(MobileIcon, null),
|
|
9576
|
+
tablet: React77.createElement(TabletIcon, null),
|
|
9577
|
+
other: React77.createElement(Fragment5, null)
|
|
9539
9578
|
};
|
|
9540
9579
|
|
|
9541
9580
|
// src/viewport/components/Tool.tsx
|
|
9542
9581
|
var ViewportTool = /* @__PURE__ */ __name(({ api }) => {
|
|
9543
9582
|
const config = useParameter4(PARAM_KEY2);
|
|
9544
9583
|
const [globals, updateGlobals, storyGlobals] = useGlobals5();
|
|
9545
|
-
const [isTooltipVisible, setIsTooltipVisible] =
|
|
9584
|
+
const [isTooltipVisible, setIsTooltipVisible] = useState25(false);
|
|
9546
9585
|
const { options = MINIMAL_VIEWPORTS, disable } = config || {};
|
|
9547
9586
|
const data = globals?.[PARAM_KEY2] || {};
|
|
9548
9587
|
const viewportName = typeof data === "string" ? data : data.value;
|
|
@@ -9551,7 +9590,7 @@ var ViewportTool = /* @__PURE__ */ __name(({ api }) => {
|
|
|
9551
9590
|
const isActive = isTooltipVisible || item !== responsiveViewport;
|
|
9552
9591
|
const isLocked = PARAM_KEY2 in storyGlobals;
|
|
9553
9592
|
const length2 = Object.keys(options).length;
|
|
9554
|
-
|
|
9593
|
+
useEffect21(() => {
|
|
9555
9594
|
registerShortcuts(api, viewportName, updateGlobals, Object.keys(options));
|
|
9556
9595
|
}, [options, viewportName, updateGlobals, api]);
|
|
9557
9596
|
if (item.styles === null || !options || length2 < 1) {
|
|
@@ -9568,7 +9607,7 @@ var ViewportTool = /* @__PURE__ */ __name(({ api }) => {
|
|
|
9568
9607
|
if (disable) {
|
|
9569
9608
|
return null;
|
|
9570
9609
|
}
|
|
9571
|
-
return
|
|
9610
|
+
return React78.createElement(
|
|
9572
9611
|
Pure2,
|
|
9573
9612
|
{
|
|
9574
9613
|
...{
|
|
@@ -9586,7 +9625,7 @@ var ViewportTool = /* @__PURE__ */ __name(({ api }) => {
|
|
|
9586
9625
|
}
|
|
9587
9626
|
);
|
|
9588
9627
|
}, "ViewportTool");
|
|
9589
|
-
var Pure2 =
|
|
9628
|
+
var Pure2 = React78.memo(/* @__PURE__ */ __name(function PureTool2(props) {
|
|
9590
9629
|
const {
|
|
9591
9630
|
item,
|
|
9592
9631
|
viewportMap,
|
|
@@ -9603,11 +9642,11 @@ var Pure2 = React77.memo(/* @__PURE__ */ __name(function PureTool2(props) {
|
|
|
9603
9642
|
(input) => updateGlobals({ [PARAM_KEY2]: input }),
|
|
9604
9643
|
[updateGlobals]
|
|
9605
9644
|
);
|
|
9606
|
-
return
|
|
9645
|
+
return React78.createElement(Fragment6, null, React78.createElement(
|
|
9607
9646
|
WithTooltip5,
|
|
9608
9647
|
{
|
|
9609
9648
|
placement: "bottom",
|
|
9610
|
-
tooltip: ({ onHide }) =>
|
|
9649
|
+
tooltip: ({ onHide }) => React78.createElement(
|
|
9611
9650
|
TooltipLinkList2,
|
|
9612
9651
|
{
|
|
9613
9652
|
links: [
|
|
@@ -9615,7 +9654,7 @@ var Pure2 = React77.memo(/* @__PURE__ */ __name(function PureTool2(props) {
|
|
|
9615
9654
|
{
|
|
9616
9655
|
id: "reset",
|
|
9617
9656
|
title: "Reset viewport",
|
|
9618
|
-
icon:
|
|
9657
|
+
icon: React78.createElement(RefreshIcon2, null),
|
|
9619
9658
|
onClick: /* @__PURE__ */ __name(() => {
|
|
9620
9659
|
update(void 0);
|
|
9621
9660
|
onHide();
|
|
@@ -9638,7 +9677,7 @@ var Pure2 = React77.memo(/* @__PURE__ */ __name(function PureTool2(props) {
|
|
|
9638
9677
|
closeOnOutsideClick: true,
|
|
9639
9678
|
onVisibleChange: setIsTooltipVisible
|
|
9640
9679
|
},
|
|
9641
|
-
|
|
9680
|
+
React78.createElement(
|
|
9642
9681
|
IconButtonWithLabel,
|
|
9643
9682
|
{
|
|
9644
9683
|
disabled: isLocked,
|
|
@@ -9649,17 +9688,17 @@ var Pure2 = React77.memo(/* @__PURE__ */ __name(function PureTool2(props) {
|
|
|
9649
9688
|
update({ value: void 0, isRotated: false });
|
|
9650
9689
|
}
|
|
9651
9690
|
},
|
|
9652
|
-
|
|
9653
|
-
item !== responsiveViewport ?
|
|
9691
|
+
React78.createElement(GrowIcon, null),
|
|
9692
|
+
item !== responsiveViewport ? React78.createElement(IconButtonLabel, null, item.name, " ", isRotated ? `(L)` : `(P)`) : null
|
|
9654
9693
|
)
|
|
9655
|
-
),
|
|
9694
|
+
), React78.createElement(
|
|
9656
9695
|
Global,
|
|
9657
9696
|
{
|
|
9658
9697
|
styles: {
|
|
9659
9698
|
[`iframe[data-is-storybook="true"]`]: { width, height }
|
|
9660
9699
|
}
|
|
9661
9700
|
}
|
|
9662
|
-
), item !== responsiveViewport ?
|
|
9701
|
+
), item !== responsiveViewport ? React78.createElement(ActiveViewportSize, null, React78.createElement(ActiveViewportLabel, { title: "Viewport width" }, width.replace("px", "")), !isLocked ? React78.createElement(
|
|
9663
9702
|
IconButton11,
|
|
9664
9703
|
{
|
|
9665
9704
|
key: "viewport-rotate",
|
|
@@ -9668,8 +9707,8 @@ var Pure2 = React77.memo(/* @__PURE__ */ __name(function PureTool2(props) {
|
|
|
9668
9707
|
update({ value: viewportName, isRotated: !isRotated });
|
|
9669
9708
|
}
|
|
9670
9709
|
},
|
|
9671
|
-
|
|
9672
|
-
) : "/",
|
|
9710
|
+
React78.createElement(TransferIcon, null)
|
|
9711
|
+
) : "/", React78.createElement(ActiveViewportLabel, { title: "Viewport height" }, height.replace("px", ""))) : null);
|
|
9673
9712
|
}, "PureTool"));
|
|
9674
9713
|
|
|
9675
9714
|
// src/viewport/manager.tsx
|
|
@@ -9679,7 +9718,7 @@ var manager_default7 = addons7.register(ADDON_ID2, (api) => {
|
|
|
9679
9718
|
title: "viewport / media-queries",
|
|
9680
9719
|
type: types7.TOOL,
|
|
9681
9720
|
match: /* @__PURE__ */ __name(({ viewMode, tabId }) => viewMode === "story" && !tabId, "match"),
|
|
9682
|
-
render: /* @__PURE__ */ __name(() =>
|
|
9721
|
+
render: /* @__PURE__ */ __name(() => React79.createElement(ViewportTool, { api }), "render")
|
|
9683
9722
|
});
|
|
9684
9723
|
}
|
|
9685
9724
|
});
|