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