@storybook/addon-docs 10.0.0-beta.7 → 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/_node-chunks/{chunk-AGJIZPPI.js → chunk-3RDFO5MA.js} +7 -7
- package/dist/_node-chunks/{chunk-ZWB5EL6N.js → chunk-D6324MCA.js} +6 -6
- package/dist/_node-chunks/{chunk-PZ25TROW.js → chunk-KITNKLDD.js} +9 -9
- package/dist/_node-chunks/{chunk-YXA7CFIU.js → chunk-QD6FYNJS.js} +7 -7
- package/dist/_node-chunks/{mdx-plugin-YI33UEWL.js → mdx-plugin-VUX2G6E4.js} +12 -12
- package/dist/_node-chunks/{rehype-external-links-46MRPJIG.js → rehype-external-links-DZ3BLVQO.js} +9 -9
- package/dist/_node-chunks/{rehype-slug-UITIK4GV.js → rehype-slug-MCQJAPPE.js} +8 -8
- package/dist/blocks.js +368 -358
- package/dist/mdx-loader.js +10 -10
- package/dist/preset.js +318 -10
- package/package.json +4 -4
package/dist/blocks.js
CHANGED
|
@@ -256,7 +256,7 @@ var require_memoizerific = __commonJS({
|
|
|
256
256
|
});
|
|
257
257
|
|
|
258
258
|
// src/blocks/components/ArgsTable/ArgsTable.tsx
|
|
259
|
-
import
|
|
259
|
+
import React34 from "react";
|
|
260
260
|
import { once } from "storybook/internal/client-logger";
|
|
261
261
|
import { IconButton as IconButton3, Link as Link3, ResetWrapper as ResetWrapper3 } from "storybook/internal/components";
|
|
262
262
|
import { includeConditionalArg } from "storybook/internal/csf";
|
|
@@ -656,10 +656,108 @@ var DocsWrapper = styled.div(({ theme }) => ({
|
|
|
656
656
|
var DocsPageWrapper = /* @__PURE__ */ __name(({ children, toc }) => React.createElement(DocsWrapper, { className: "sbdocs sbdocs-wrapper" }, toc, React.createElement(DocsContent, { className: "sbdocs sbdocs-content" }, children)), "DocsPageWrapper");
|
|
657
657
|
|
|
658
658
|
// src/blocks/components/Preview.tsx
|
|
659
|
-
import
|
|
659
|
+
import React6, { Children, useCallback, useContext as useContext2, useState as useState3 } from "react";
|
|
660
660
|
import { ActionBar, Zoom } from "storybook/internal/components";
|
|
661
661
|
import { styled as styled4 } from "storybook/theming";
|
|
662
662
|
|
|
663
|
+
// src/blocks/blocks/DocsContext.ts
|
|
664
|
+
import { createContext } from "react";
|
|
665
|
+
if (globalThis && globalThis.__DOCS_CONTEXT__ === void 0) {
|
|
666
|
+
globalThis.__DOCS_CONTEXT__ = createContext(null);
|
|
667
|
+
globalThis.__DOCS_CONTEXT__.displayName = "DocsContext";
|
|
668
|
+
}
|
|
669
|
+
var DocsContext = globalThis ? globalThis.__DOCS_CONTEXT__ : createContext(null);
|
|
670
|
+
|
|
671
|
+
// src/blocks/blocks/Story.tsx
|
|
672
|
+
import React2, { useContext } from "react";
|
|
673
|
+
|
|
674
|
+
// src/blocks/blocks/useStory.ts
|
|
675
|
+
import { useEffect, useState } from "react";
|
|
676
|
+
function useStory(storyId, context) {
|
|
677
|
+
const stories = useStories([storyId], context);
|
|
678
|
+
return stories && stories[0];
|
|
679
|
+
}
|
|
680
|
+
__name(useStory, "useStory");
|
|
681
|
+
function useStories(storyIds, context) {
|
|
682
|
+
const [storiesById, setStories] = useState({});
|
|
683
|
+
useEffect(() => {
|
|
684
|
+
Promise.all(
|
|
685
|
+
storyIds.map(async (storyId) => {
|
|
686
|
+
const story = await context.loadStory(storyId);
|
|
687
|
+
setStories(
|
|
688
|
+
(current) => current[storyId] === story ? current : { ...current, [storyId]: story }
|
|
689
|
+
);
|
|
690
|
+
})
|
|
691
|
+
);
|
|
692
|
+
});
|
|
693
|
+
return storyIds.map((storyId) => {
|
|
694
|
+
if (storiesById[storyId]) {
|
|
695
|
+
return storiesById[storyId];
|
|
696
|
+
}
|
|
697
|
+
try {
|
|
698
|
+
return context.storyById(storyId);
|
|
699
|
+
} catch (err) {
|
|
700
|
+
return void 0;
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
__name(useStories, "useStories");
|
|
705
|
+
|
|
706
|
+
// src/blocks/blocks/Story.tsx
|
|
707
|
+
var getStoryId = /* @__PURE__ */ __name((props, context) => {
|
|
708
|
+
const { of, meta } = props;
|
|
709
|
+
if ("of" in props && of === void 0) {
|
|
710
|
+
throw new Error("Unexpected `of={undefined}`, did you mistype a CSF file reference?");
|
|
711
|
+
}
|
|
712
|
+
if (meta) {
|
|
713
|
+
context.referenceMeta(meta, false);
|
|
714
|
+
}
|
|
715
|
+
const resolved = context.resolveOf(of || "story", ["story"]);
|
|
716
|
+
return resolved.story.id;
|
|
717
|
+
}, "getStoryId");
|
|
718
|
+
var getStoryProps = /* @__PURE__ */ __name((props, story, context) => {
|
|
719
|
+
const { parameters = {} } = story || {};
|
|
720
|
+
const { docs = {} } = parameters;
|
|
721
|
+
const storyParameters = docs.story || {};
|
|
722
|
+
if (docs.disable) {
|
|
723
|
+
return null;
|
|
724
|
+
}
|
|
725
|
+
const inline = props.inline ?? storyParameters.inline ?? false;
|
|
726
|
+
if (inline) {
|
|
727
|
+
const height2 = props.height ?? storyParameters.height;
|
|
728
|
+
const autoplay = props.autoplay ?? storyParameters.autoplay ?? false;
|
|
729
|
+
return {
|
|
730
|
+
story,
|
|
731
|
+
inline: true,
|
|
732
|
+
height: height2,
|
|
733
|
+
autoplay,
|
|
734
|
+
forceInitialArgs: !!props.__forceInitialArgs,
|
|
735
|
+
primary: !!props.__primary,
|
|
736
|
+
renderStoryToElement: context.renderStoryToElement
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
const height = props.height ?? storyParameters.height ?? storyParameters.iframeHeight ?? "100px";
|
|
740
|
+
return {
|
|
741
|
+
story,
|
|
742
|
+
inline: false,
|
|
743
|
+
height,
|
|
744
|
+
primary: !!props.__primary
|
|
745
|
+
};
|
|
746
|
+
}, "getStoryProps");
|
|
747
|
+
var Story2 = /* @__PURE__ */ __name((props = { __forceInitialArgs: false, __primary: false }) => {
|
|
748
|
+
const context = useContext(DocsContext);
|
|
749
|
+
const storyId = getStoryId(props, context);
|
|
750
|
+
const story = useStory(storyId, context);
|
|
751
|
+
if (!story) {
|
|
752
|
+
return React2.createElement(StorySkeleton, null);
|
|
753
|
+
}
|
|
754
|
+
const storyProps = getStoryProps(props, story, context);
|
|
755
|
+
if (!storyProps) {
|
|
756
|
+
return null;
|
|
757
|
+
}
|
|
758
|
+
return React2.createElement(Story, { ...storyProps });
|
|
759
|
+
}, "Story");
|
|
760
|
+
|
|
663
761
|
// src/blocks/components/BlockBackgroundStyles.tsx
|
|
664
762
|
var getBlockBackgroundStyle = /* @__PURE__ */ __name((theme) => ({
|
|
665
763
|
borderRadius: theme.appBorderRadius,
|
|
@@ -669,12 +767,12 @@ var getBlockBackgroundStyle = /* @__PURE__ */ __name((theme) => ({
|
|
|
669
767
|
}), "getBlockBackgroundStyle");
|
|
670
768
|
|
|
671
769
|
// src/blocks/components/Story.tsx
|
|
672
|
-
import
|
|
770
|
+
import React4, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
673
771
|
import { ErrorFormatter, Loader, getStoryHref } from "storybook/internal/components";
|
|
674
772
|
import { styled as styled2 } from "storybook/theming";
|
|
675
773
|
|
|
676
774
|
// src/blocks/components/IFrame.tsx
|
|
677
|
-
import
|
|
775
|
+
import React3, { Component } from "react";
|
|
678
776
|
var { window: globalWindow } = globalThis;
|
|
679
777
|
var _IFrame = class _IFrame extends Component {
|
|
680
778
|
constructor() {
|
|
@@ -702,7 +800,7 @@ var _IFrame = class _IFrame extends Component {
|
|
|
702
800
|
}
|
|
703
801
|
render() {
|
|
704
802
|
const { id, title, src, allowFullScreen, scale, ...rest } = this.props;
|
|
705
|
-
return
|
|
803
|
+
return React3.createElement(
|
|
706
804
|
"iframe",
|
|
707
805
|
{
|
|
708
806
|
id,
|
|
@@ -719,8 +817,8 @@ __name(_IFrame, "IFrame");
|
|
|
719
817
|
var IFrame = _IFrame;
|
|
720
818
|
|
|
721
819
|
// src/blocks/components/ZoomContext.tsx
|
|
722
|
-
import { createContext } from "react";
|
|
723
|
-
var ZoomContext =
|
|
820
|
+
import { createContext as createContext2 } from "react";
|
|
821
|
+
var ZoomContext = createContext2({
|
|
724
822
|
scale: 1
|
|
725
823
|
});
|
|
726
824
|
|
|
@@ -730,10 +828,10 @@ var BASE_URL = PREVIEW_URL || "iframe.html";
|
|
|
730
828
|
var storyBlockIdFromId = /* @__PURE__ */ __name(({ story, primary }) => `story--${story.id}${primary ? "--primary" : ""}`, "storyBlockIdFromId");
|
|
731
829
|
var InlineStory = /* @__PURE__ */ __name((props) => {
|
|
732
830
|
const storyRef = useRef();
|
|
733
|
-
const [showLoader, setShowLoader] =
|
|
734
|
-
const [error, setError] =
|
|
831
|
+
const [showLoader, setShowLoader] = useState2(true);
|
|
832
|
+
const [error, setError] = useState2();
|
|
735
833
|
const { story, height, autoplay, forceInitialArgs, renderStoryToElement } = props;
|
|
736
|
-
|
|
834
|
+
useEffect2(() => {
|
|
737
835
|
if (!(story && storyRef.current)) {
|
|
738
836
|
return () => {
|
|
739
837
|
};
|
|
@@ -756,14 +854,14 @@ var InlineStory = /* @__PURE__ */ __name((props) => {
|
|
|
756
854
|
};
|
|
757
855
|
}, [autoplay, renderStoryToElement, story]);
|
|
758
856
|
if (error) {
|
|
759
|
-
return
|
|
857
|
+
return React4.createElement("pre", null, React4.createElement(ErrorFormatter, { error }));
|
|
760
858
|
}
|
|
761
|
-
return
|
|
859
|
+
return React4.createElement(React4.Fragment, null, height ? React4.createElement("style", null, `#${storyBlockIdFromId(
|
|
762
860
|
props
|
|
763
|
-
)} { min-height: ${height}; transform: translateZ(0); overflow: auto }`) : null, showLoader &&
|
|
861
|
+
)} { min-height: ${height}; transform: translateZ(0); overflow: auto }`) : null, showLoader && React4.createElement(StorySkeleton, null), React4.createElement("div", { ref: storyRef, id: `${storyBlockIdFromId(props)}-inner`, "data-name": story.name }));
|
|
764
862
|
}, "InlineStory");
|
|
765
|
-
var IFrameStory = /* @__PURE__ */ __name(({ story, height = "500px" }) =>
|
|
766
|
-
return
|
|
863
|
+
var IFrameStory = /* @__PURE__ */ __name(({ story, height = "500px" }) => React4.createElement("div", { style: { width: "100%", height } }, React4.createElement(ZoomContext.Consumer, null, ({ scale }) => {
|
|
864
|
+
return React4.createElement(
|
|
767
865
|
IFrame,
|
|
768
866
|
{
|
|
769
867
|
key: "iframe",
|
|
@@ -786,16 +884,16 @@ var ErrorMessage = styled2.strong(({ theme }) => ({
|
|
|
786
884
|
var Story = /* @__PURE__ */ __name((props) => {
|
|
787
885
|
const { inline, story } = props;
|
|
788
886
|
if (inline && !props.autoplay && story.usesMount) {
|
|
789
|
-
return
|
|
887
|
+
return React4.createElement(ErrorMessage, null, "This story mounts inside of play. Set", " ", React4.createElement("a", { href: "https://storybook.js.org/docs/api/doc-blocks/doc-block-story?ref=ui#autoplay" }, "autoplay"), " ", "to true to view this story.");
|
|
790
888
|
}
|
|
791
|
-
return
|
|
889
|
+
return React4.createElement("div", { id: storyBlockIdFromId(props), className: "sb-story sb-unstyled", "data-story-block": "true" }, inline ? React4.createElement(InlineStory, { ...props }) : React4.createElement(IFrameStory, { ...props }));
|
|
792
890
|
}, "Story");
|
|
793
|
-
var StorySkeleton = /* @__PURE__ */ __name(() =>
|
|
891
|
+
var StorySkeleton = /* @__PURE__ */ __name(() => React4.createElement(Loader, null), "StorySkeleton");
|
|
794
892
|
|
|
795
893
|
// src/blocks/components/Toolbar.tsx
|
|
796
|
-
import
|
|
797
|
-
import { FlexBar, IconButton } from "storybook/internal/components";
|
|
798
|
-
import { ZoomIcon, ZoomOutIcon, ZoomResetIcon } from "@storybook/icons";
|
|
894
|
+
import React5 from "react";
|
|
895
|
+
import { FlexBar, IconButton, getStoryHref as getStoryHref2 } from "storybook/internal/components";
|
|
896
|
+
import { ShareAltIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon } from "@storybook/icons";
|
|
799
897
|
import { styled as styled3 } from "storybook/theming";
|
|
800
898
|
var Bar = styled3(FlexBar)({
|
|
801
899
|
position: "absolute",
|
|
@@ -824,7 +922,7 @@ var Toolbar = /* @__PURE__ */ __name(({
|
|
|
824
922
|
zoom,
|
|
825
923
|
resetZoom,
|
|
826
924
|
...rest
|
|
827
|
-
}) =>
|
|
925
|
+
}) => React5.createElement(Bar, { ...rest }, React5.createElement(Wrapper, { key: "left" }, isLoading ? [1, 2, 3].map((key) => React5.createElement(IconPlaceholder, { key })) : React5.createElement(React5.Fragment, null, React5.createElement(
|
|
828
926
|
IconButton,
|
|
829
927
|
{
|
|
830
928
|
key: "zoomin",
|
|
@@ -834,8 +932,8 @@ var Toolbar = /* @__PURE__ */ __name(({
|
|
|
834
932
|
},
|
|
835
933
|
title: "Zoom in"
|
|
836
934
|
},
|
|
837
|
-
|
|
838
|
-
),
|
|
935
|
+
React5.createElement(ZoomIcon, null)
|
|
936
|
+
), React5.createElement(
|
|
839
937
|
IconButton,
|
|
840
938
|
{
|
|
841
939
|
key: "zoomout",
|
|
@@ -845,8 +943,8 @@ var Toolbar = /* @__PURE__ */ __name(({
|
|
|
845
943
|
},
|
|
846
944
|
title: "Zoom out"
|
|
847
945
|
},
|
|
848
|
-
|
|
849
|
-
),
|
|
946
|
+
React5.createElement(ZoomOutIcon, null)
|
|
947
|
+
), React5.createElement(
|
|
850
948
|
IconButton,
|
|
851
949
|
{
|
|
852
950
|
key: "zoomreset",
|
|
@@ -856,7 +954,16 @@ var Toolbar = /* @__PURE__ */ __name(({
|
|
|
856
954
|
},
|
|
857
955
|
title: "Reset zoom"
|
|
858
956
|
},
|
|
859
|
-
|
|
957
|
+
React5.createElement(ZoomResetIcon, null)
|
|
958
|
+
))), isLoading ? React5.createElement(Wrapper, { key: "right" }, React5.createElement(IconPlaceholder, null)) : baseUrl && storyId && React5.createElement(Wrapper, { key: "right" }, React5.createElement(IconButton, { key: "opener", asChild: true }, React5.createElement(
|
|
959
|
+
"a",
|
|
960
|
+
{
|
|
961
|
+
href: getStoryHref2(baseUrl, storyId),
|
|
962
|
+
target: "_blank",
|
|
963
|
+
rel: "noopener noreferrer",
|
|
964
|
+
"aria-label": "Open canvas in new tab"
|
|
965
|
+
},
|
|
966
|
+
React5.createElement(ShareAltIcon, null)
|
|
860
967
|
)))), "Toolbar");
|
|
861
968
|
|
|
862
969
|
// src/blocks/components/Preview.tsx
|
|
@@ -934,7 +1041,7 @@ var getSource = /* @__PURE__ */ __name((withSource, expanded, setExpanded) => {
|
|
|
934
1041
|
}
|
|
935
1042
|
case expanded: {
|
|
936
1043
|
return {
|
|
937
|
-
source:
|
|
1044
|
+
source: React6.createElement(StyledSource, { ...withSource, dark: true }),
|
|
938
1045
|
actionItem: {
|
|
939
1046
|
title: "Hide code",
|
|
940
1047
|
className: "docblock-code-toggle docblock-code-toggle--expanded",
|
|
@@ -944,7 +1051,7 @@ var getSource = /* @__PURE__ */ __name((withSource, expanded, setExpanded) => {
|
|
|
944
1051
|
}
|
|
945
1052
|
default: {
|
|
946
1053
|
return {
|
|
947
|
-
source:
|
|
1054
|
+
source: React6.createElement(StyledSource, { ...withSource, dark: true }),
|
|
948
1055
|
actionItem: {
|
|
949
1056
|
title: "Show code",
|
|
950
1057
|
className: "docblock-code-toggle",
|
|
@@ -954,16 +1061,16 @@ var getSource = /* @__PURE__ */ __name((withSource, expanded, setExpanded) => {
|
|
|
954
1061
|
}
|
|
955
1062
|
}
|
|
956
1063
|
}, "getSource");
|
|
957
|
-
function
|
|
1064
|
+
function getChildProps(children) {
|
|
958
1065
|
if (Children.count(children) === 1) {
|
|
959
1066
|
const elt = children;
|
|
960
1067
|
if (elt.props) {
|
|
961
|
-
return elt.props
|
|
1068
|
+
return elt.props;
|
|
962
1069
|
}
|
|
963
1070
|
}
|
|
964
1071
|
return null;
|
|
965
1072
|
}
|
|
966
|
-
__name(
|
|
1073
|
+
__name(getChildProps, "getChildProps");
|
|
967
1074
|
var PositionedToolbar = styled4(Toolbar)({
|
|
968
1075
|
position: "absolute",
|
|
969
1076
|
top: 0,
|
|
@@ -989,16 +1096,17 @@ var Preview = /* @__PURE__ */ __name(({
|
|
|
989
1096
|
inline = false,
|
|
990
1097
|
...props
|
|
991
1098
|
}) => {
|
|
992
|
-
const [expanded, setExpanded] =
|
|
1099
|
+
const [expanded, setExpanded] = useState3(isExpanded);
|
|
993
1100
|
const { source, actionItem } = getSource(withSource, expanded, setExpanded);
|
|
994
|
-
const [scale, setScale] =
|
|
1101
|
+
const [scale, setScale] = useState3(1);
|
|
995
1102
|
const previewClasses = [className].concat(["sbdocs", "sbdocs-preview", "sb-unstyled"]);
|
|
996
1103
|
const defaultActionItems = withSource ? [actionItem] : [];
|
|
997
|
-
const [additionalActionItems, setAdditionalActionItems] =
|
|
1104
|
+
const [additionalActionItems, setAdditionalActionItems] = useState3(
|
|
998
1105
|
additionalActions ? [...additionalActions] : []
|
|
999
1106
|
);
|
|
1000
1107
|
const actionItems = [...defaultActionItems, ...additionalActionItems];
|
|
1001
1108
|
const { window: globalWindow4 } = globalThis;
|
|
1109
|
+
const context = useContext2(DocsContext);
|
|
1002
1110
|
const copyToClipboard = useCallback(async (text) => {
|
|
1003
1111
|
const { createCopyToClipboardFunction } = await import("storybook/internal/components");
|
|
1004
1112
|
createCopyToClipboardFunction();
|
|
@@ -1028,25 +1136,26 @@ var Preview = /* @__PURE__ */ __name(({
|
|
|
1028
1136
|
});
|
|
1029
1137
|
}
|
|
1030
1138
|
}, "onCopyCapture");
|
|
1031
|
-
|
|
1139
|
+
const childProps = getChildProps(children);
|
|
1140
|
+
return React6.createElement(
|
|
1032
1141
|
PreviewContainer,
|
|
1033
1142
|
{
|
|
1034
1143
|
...{ withSource, withToolbar },
|
|
1035
1144
|
...props,
|
|
1036
1145
|
className: previewClasses.join(" ")
|
|
1037
1146
|
},
|
|
1038
|
-
withToolbar &&
|
|
1147
|
+
withToolbar && React6.createElement(
|
|
1039
1148
|
PositionedToolbar,
|
|
1040
1149
|
{
|
|
1041
1150
|
isLoading,
|
|
1042
1151
|
border: true,
|
|
1043
1152
|
zoom: (z2) => setScale(scale * z2),
|
|
1044
1153
|
resetZoom: () => setScale(1),
|
|
1045
|
-
storyId: getStoryId(
|
|
1154
|
+
storyId: !isLoading && childProps ? getStoryId(childProps, context) : void 0,
|
|
1046
1155
|
baseUrl: "./iframe.html"
|
|
1047
1156
|
}
|
|
1048
1157
|
),
|
|
1049
|
-
|
|
1158
|
+
React6.createElement(ZoomContext.Provider, { value: { scale } }, React6.createElement(Relative, { className: "docs-story", onCopyCapture: withSource && onCopyCapture }, React6.createElement(
|
|
1050
1159
|
ChildrenContainer,
|
|
1051
1160
|
{
|
|
1052
1161
|
isColumn: isColumn || !Array.isArray(children),
|
|
@@ -1054,8 +1163,8 @@ var Preview = /* @__PURE__ */ __name(({
|
|
|
1054
1163
|
layout,
|
|
1055
1164
|
inline
|
|
1056
1165
|
},
|
|
1057
|
-
|
|
1058
|
-
),
|
|
1166
|
+
React6.createElement(Zoom.Element, { centered: layout === "centered", scale: inline ? scale : 1 }, Array.isArray(children) ? children.map((child, i2) => React6.createElement("div", { key: i2 }, child)) : React6.createElement("div", null, children))
|
|
1167
|
+
), React6.createElement(ActionBar, { actionItems }))),
|
|
1059
1168
|
withSource && expanded && source
|
|
1060
1169
|
);
|
|
1061
1170
|
}, "Preview");
|
|
@@ -1067,24 +1176,24 @@ var StyledPreview = styled4(Preview)(() => ({
|
|
|
1067
1176
|
}));
|
|
1068
1177
|
|
|
1069
1178
|
// src/blocks/components/ArgsTable/TabbedArgsTable.tsx
|
|
1070
|
-
import
|
|
1179
|
+
import React7 from "react";
|
|
1071
1180
|
import { TabsState } from "storybook/internal/components";
|
|
1072
1181
|
var TabbedArgsTable = /* @__PURE__ */ __name(({ tabs, ...props }) => {
|
|
1073
1182
|
const entries = Object.entries(tabs);
|
|
1074
1183
|
if (entries.length === 1) {
|
|
1075
|
-
return
|
|
1184
|
+
return React7.createElement(ArgsTable, { ...entries[0][1], ...props });
|
|
1076
1185
|
}
|
|
1077
|
-
return
|
|
1186
|
+
return React7.createElement(TabsState, null, entries.map((entry, index) => {
|
|
1078
1187
|
const [label, table] = entry;
|
|
1079
1188
|
const id = `prop_table_div_${label}`;
|
|
1080
1189
|
const Component4 = "div";
|
|
1081
1190
|
const argsTableProps = index === 0 ? props : { sort: props.sort };
|
|
1082
|
-
return
|
|
1191
|
+
return React7.createElement(Component4, { key: id, id, title: label }, ({ active }) => active ? React7.createElement(ArgsTable, { key: `prop_table_${label}`, ...table, ...argsTableProps }) : null);
|
|
1083
1192
|
}));
|
|
1084
1193
|
}, "TabbedArgsTable");
|
|
1085
1194
|
|
|
1086
1195
|
// src/blocks/components/Typeset.tsx
|
|
1087
|
-
import
|
|
1196
|
+
import React8 from "react";
|
|
1088
1197
|
import { withReset as withReset2 } from "storybook/internal/components";
|
|
1089
1198
|
import { styled as styled5 } from "storybook/theming";
|
|
1090
1199
|
var Label = styled5.div(({ theme }) => ({
|
|
@@ -1114,7 +1223,7 @@ var Typeset = /* @__PURE__ */ __name(({
|
|
|
1114
1223
|
fontWeight,
|
|
1115
1224
|
sampleText,
|
|
1116
1225
|
...props
|
|
1117
|
-
}) =>
|
|
1226
|
+
}) => React8.createElement(Wrapper2, { ...props, className: "docblock-typeset sb-unstyled" }, fontSizes.map((size) => React8.createElement(TypeSpecimen, { key: size }, React8.createElement(Label, null, size), React8.createElement(
|
|
1118
1227
|
Sample,
|
|
1119
1228
|
{
|
|
1120
1229
|
style: {
|
|
@@ -1128,7 +1237,7 @@ var Typeset = /* @__PURE__ */ __name(({
|
|
|
1128
1237
|
)))), "Typeset");
|
|
1129
1238
|
|
|
1130
1239
|
// src/blocks/components/ColorPalette.tsx
|
|
1131
|
-
import
|
|
1240
|
+
import React9 from "react";
|
|
1132
1241
|
import { ResetWrapper } from "storybook/internal/components";
|
|
1133
1242
|
import { styled as styled6 } from "storybook/theming";
|
|
1134
1243
|
var ItemTitle = styled6.div(({ theme }) => ({
|
|
@@ -1227,16 +1336,16 @@ var List = styled6.div(({ theme }) => ({
|
|
|
1227
1336
|
flexDirection: "column"
|
|
1228
1337
|
}));
|
|
1229
1338
|
function renderSwatch(color, index) {
|
|
1230
|
-
return
|
|
1339
|
+
return React9.createElement(Swatch, { key: `${color}-${index}`, title: color, background: color });
|
|
1231
1340
|
}
|
|
1232
1341
|
__name(renderSwatch, "renderSwatch");
|
|
1233
1342
|
function renderSwatchLabel(color, index, colorDescription) {
|
|
1234
|
-
return
|
|
1343
|
+
return React9.createElement(SwatchLabel, { key: `${color}-${index}`, title: color }, React9.createElement("div", null, color, colorDescription && React9.createElement("span", null, colorDescription)));
|
|
1235
1344
|
}
|
|
1236
1345
|
__name(renderSwatchLabel, "renderSwatchLabel");
|
|
1237
1346
|
function renderSwatchSpecimen(colors) {
|
|
1238
1347
|
if (Array.isArray(colors)) {
|
|
1239
|
-
return
|
|
1348
|
+
return React9.createElement(SwatchSpecimen, null, React9.createElement(SwatchColors, null, colors.map((color, index) => renderSwatch(color, index))), React9.createElement(SwatchLabels, null, colors.map((color, index) => renderSwatchLabel(color, index))));
|
|
1240
1349
|
}
|
|
1241
1350
|
const swatchElements = [];
|
|
1242
1351
|
const labelElements = [];
|
|
@@ -1245,16 +1354,16 @@ function renderSwatchSpecimen(colors) {
|
|
|
1245
1354
|
swatchElements.push(renderSwatch(colorValue, swatchElements.length));
|
|
1246
1355
|
labelElements.push(renderSwatchLabel(colorKey, labelElements.length, colorValue));
|
|
1247
1356
|
}
|
|
1248
|
-
return
|
|
1357
|
+
return React9.createElement(SwatchSpecimen, null, React9.createElement(SwatchColors, null, swatchElements), React9.createElement(SwatchLabels, null, labelElements));
|
|
1249
1358
|
}
|
|
1250
1359
|
__name(renderSwatchSpecimen, "renderSwatchSpecimen");
|
|
1251
1360
|
var ColorItem = /* @__PURE__ */ __name(({ title, subtitle, colors }) => {
|
|
1252
|
-
return
|
|
1361
|
+
return React9.createElement(Item, null, React9.createElement(ItemDescription, null, React9.createElement(ItemTitle, null, title), React9.createElement(ItemSubtitle, null, subtitle)), React9.createElement(Swatches, null, renderSwatchSpecimen(colors)));
|
|
1253
1362
|
}, "ColorItem");
|
|
1254
|
-
var ColorPalette = /* @__PURE__ */ __name(({ children, ...props }) =>
|
|
1363
|
+
var ColorPalette = /* @__PURE__ */ __name(({ children, ...props }) => React9.createElement(ResetWrapper, null, React9.createElement(List, { ...props, className: "docblock-colorpalette sb-unstyled" }, React9.createElement(ListHeading, null, React9.createElement(ListName, null, "Name"), React9.createElement(ListSwatches, null, "Swatches")), children)), "ColorPalette");
|
|
1255
1364
|
|
|
1256
1365
|
// src/blocks/components/IconGallery.tsx
|
|
1257
|
-
import
|
|
1366
|
+
import React10 from "react";
|
|
1258
1367
|
import { ResetWrapper as ResetWrapper2 } from "storybook/internal/components";
|
|
1259
1368
|
import { styled as styled7 } from "storybook/theming";
|
|
1260
1369
|
var ItemLabel = styled7.div(({ theme }) => ({
|
|
@@ -1297,11 +1406,11 @@ var List2 = styled7.div({
|
|
|
1297
1406
|
gridAutoFlow: "row dense",
|
|
1298
1407
|
gridAutoRows: 50
|
|
1299
1408
|
});
|
|
1300
|
-
var IconItem = /* @__PURE__ */ __name(({ name, children }) =>
|
|
1301
|
-
var IconGallery = /* @__PURE__ */ __name(({ children, ...props }) =>
|
|
1409
|
+
var IconItem = /* @__PURE__ */ __name(({ name, children }) => React10.createElement(Item2, null, React10.createElement(ItemSpecimen, null, children), React10.createElement(ItemLabel, null, name)), "IconItem");
|
|
1410
|
+
var IconGallery = /* @__PURE__ */ __name(({ children, ...props }) => React10.createElement(ResetWrapper2, null, React10.createElement(List2, { ...props, className: "docblock-icongallery sb-unstyled" }, children)), "IconGallery");
|
|
1302
1411
|
|
|
1303
1412
|
// src/blocks/components/TableOfContents.tsx
|
|
1304
|
-
import
|
|
1413
|
+
import React11, { useEffect as useEffect3, useId } from "react";
|
|
1305
1414
|
import { NAVIGATE_URL } from "storybook/internal/core-events";
|
|
1306
1415
|
import { styled as styled8 } from "storybook/theming";
|
|
1307
1416
|
|
|
@@ -2209,9 +2318,9 @@ var Heading = styled8.p(({ theme }) => ({
|
|
|
2209
2318
|
}));
|
|
2210
2319
|
var Title2 = /* @__PURE__ */ __name(({ headingId, title }) => {
|
|
2211
2320
|
if (typeof title === "string" || !title) {
|
|
2212
|
-
return
|
|
2321
|
+
return React11.createElement(Heading, { as: "h2", id: headingId, className: title ? "" : "sb-sr-only" }, title || "Table of contents");
|
|
2213
2322
|
}
|
|
2214
|
-
return
|
|
2323
|
+
return React11.createElement("div", { id: headingId }, title);
|
|
2215
2324
|
}, "Title");
|
|
2216
2325
|
var TableOfContents = /* @__PURE__ */ __name(({
|
|
2217
2326
|
title,
|
|
@@ -2223,7 +2332,7 @@ var TableOfContents = /* @__PURE__ */ __name(({
|
|
|
2223
2332
|
channel,
|
|
2224
2333
|
className
|
|
2225
2334
|
}) => {
|
|
2226
|
-
|
|
2335
|
+
useEffect3(() => {
|
|
2227
2336
|
if (disable) {
|
|
2228
2337
|
return () => {
|
|
2229
2338
|
};
|
|
@@ -2256,11 +2365,11 @@ var TableOfContents = /* @__PURE__ */ __name(({
|
|
|
2256
2365
|
};
|
|
2257
2366
|
}, [channel, disable, ignoreSelector, contentsSelector, headingSelector, unsafeTocbotOptions]);
|
|
2258
2367
|
const headingId = useId();
|
|
2259
|
-
return
|
|
2368
|
+
return React11.createElement(Aside, { className }, !disable ? React11.createElement(Nav, { "aria-labelledby": headingId }, React11.createElement(Title2, { headingId, title }), React11.createElement("div", { className: "toc-wrapper" })) : null);
|
|
2260
2369
|
}, "TableOfContents");
|
|
2261
2370
|
|
|
2262
2371
|
// src/blocks/components/ArgsTable/ArgRow.tsx
|
|
2263
|
-
import
|
|
2372
|
+
import React30, { useState as useState11 } from "react";
|
|
2264
2373
|
import { codeCommon as codeCommon3 } from "storybook/internal/components";
|
|
2265
2374
|
|
|
2266
2375
|
// ../../node_modules/markdown-to-jsx/dist/index.modern.js
|
|
@@ -2724,14 +2833,14 @@ var index_modern_default = /* @__PURE__ */ __name((n2) => {
|
|
|
2724
2833
|
import { styled as styled22 } from "storybook/theming";
|
|
2725
2834
|
|
|
2726
2835
|
// src/blocks/components/ArgsTable/ArgControl.tsx
|
|
2727
|
-
import
|
|
2836
|
+
import React27, { useCallback as useCallback6, useEffect as useEffect9, useState as useState9 } from "react";
|
|
2728
2837
|
import { Link } from "storybook/internal/components";
|
|
2729
2838
|
|
|
2730
2839
|
// src/blocks/controls/index.tsx
|
|
2731
|
-
import
|
|
2840
|
+
import React26, { Suspense, lazy } from "react";
|
|
2732
2841
|
|
|
2733
2842
|
// src/blocks/controls/Boolean.tsx
|
|
2734
|
-
import
|
|
2843
|
+
import React12, { useCallback as useCallback2 } from "react";
|
|
2735
2844
|
import { Button } from "storybook/internal/components";
|
|
2736
2845
|
import { styled as styled9 } from "storybook/theming";
|
|
2737
2846
|
var Label2 = styled9.label(({ theme }) => ({
|
|
@@ -2822,7 +2931,7 @@ var BooleanControl = /* @__PURE__ */ __name(({
|
|
|
2822
2931
|
const onSetFalse = useCallback2(() => onChange(false), [onChange]);
|
|
2823
2932
|
const readonly = !!argType?.table?.readonly;
|
|
2824
2933
|
if (value2 === void 0) {
|
|
2825
|
-
return
|
|
2934
|
+
return React12.createElement(
|
|
2826
2935
|
Button,
|
|
2827
2936
|
{
|
|
2828
2937
|
variant: "outline",
|
|
@@ -2836,7 +2945,7 @@ var BooleanControl = /* @__PURE__ */ __name(({
|
|
|
2836
2945
|
}
|
|
2837
2946
|
const controlId = getControlId(name);
|
|
2838
2947
|
const parsedValue = typeof value2 === "string" ? parse(value2) : value2;
|
|
2839
|
-
return
|
|
2948
|
+
return React12.createElement(Label2, { "aria-disabled": readonly, htmlFor: controlId, "aria-label": name }, React12.createElement(
|
|
2840
2949
|
"input",
|
|
2841
2950
|
{
|
|
2842
2951
|
id: controlId,
|
|
@@ -2847,11 +2956,11 @@ var BooleanControl = /* @__PURE__ */ __name(({
|
|
|
2847
2956
|
disabled: readonly,
|
|
2848
2957
|
...{ name, onBlur, onFocus }
|
|
2849
2958
|
}
|
|
2850
|
-
),
|
|
2959
|
+
), React12.createElement("span", { "aria-hidden": "true" }, "False"), React12.createElement("span", { "aria-hidden": "true" }, "True"));
|
|
2851
2960
|
}, "BooleanControl");
|
|
2852
2961
|
|
|
2853
2962
|
// src/blocks/controls/Date.tsx
|
|
2854
|
-
import
|
|
2963
|
+
import React13, { useEffect as useEffect4, useRef as useRef2, useState as useState4 } from "react";
|
|
2855
2964
|
import { Form } from "storybook/internal/components";
|
|
2856
2965
|
import { styled as styled10 } from "storybook/theming";
|
|
2857
2966
|
var parseDate = /* @__PURE__ */ __name((value2) => {
|
|
@@ -2906,11 +3015,11 @@ var FlexSpaced = styled10.div(({ theme }) => ({
|
|
|
2906
3015
|
}
|
|
2907
3016
|
}));
|
|
2908
3017
|
var DateControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, onFocus, onBlur, argType }) => {
|
|
2909
|
-
const [valid, setValid] =
|
|
3018
|
+
const [valid, setValid] = useState4(true);
|
|
2910
3019
|
const dateRef = useRef2();
|
|
2911
3020
|
const timeRef = useRef2();
|
|
2912
3021
|
const readonly = !!argType?.table?.readonly;
|
|
2913
|
-
|
|
3022
|
+
useEffect4(() => {
|
|
2914
3023
|
if (valid !== false) {
|
|
2915
3024
|
if (dateRef && dateRef.current) {
|
|
2916
3025
|
dateRef.current.value = value2 ? formatDate(value2) : "";
|
|
@@ -2948,7 +3057,7 @@ var DateControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, onFoc
|
|
|
2948
3057
|
setValid(!!time);
|
|
2949
3058
|
}, "onTimeChange");
|
|
2950
3059
|
const controlId = getControlId(name);
|
|
2951
|
-
return
|
|
3060
|
+
return React13.createElement(FlexSpaced, null, React13.createElement(
|
|
2952
3061
|
FormInput,
|
|
2953
3062
|
{
|
|
2954
3063
|
type: "date",
|
|
@@ -2960,7 +3069,7 @@ var DateControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, onFoc
|
|
|
2960
3069
|
onChange: onDateChange,
|
|
2961
3070
|
...{ onFocus, onBlur }
|
|
2962
3071
|
}
|
|
2963
|
-
),
|
|
3072
|
+
), React13.createElement(
|
|
2964
3073
|
FormInput,
|
|
2965
3074
|
{
|
|
2966
3075
|
type: "time",
|
|
@@ -2971,11 +3080,11 @@ var DateControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, onFoc
|
|
|
2971
3080
|
readOnly: readonly,
|
|
2972
3081
|
...{ onFocus, onBlur }
|
|
2973
3082
|
}
|
|
2974
|
-
), !valid ?
|
|
3083
|
+
), !valid ? React13.createElement("div", null, "invalid") : null);
|
|
2975
3084
|
}, "DateControl");
|
|
2976
3085
|
|
|
2977
3086
|
// src/blocks/controls/Number.tsx
|
|
2978
|
-
import
|
|
3087
|
+
import React14, { useCallback as useCallback3, useEffect as useEffect5, useRef as useRef3, useState as useState5 } from "react";
|
|
2979
3088
|
import { Button as Button2, Form as Form2 } from "storybook/internal/components";
|
|
2980
3089
|
import { styled as styled11 } from "storybook/theming";
|
|
2981
3090
|
var Wrapper3 = styled11.label({
|
|
@@ -3000,9 +3109,9 @@ var NumberControl = /* @__PURE__ */ __name(({
|
|
|
3000
3109
|
onFocus,
|
|
3001
3110
|
argType
|
|
3002
3111
|
}) => {
|
|
3003
|
-
const [inputValue, setInputValue] =
|
|
3004
|
-
const [forceVisible, setForceVisible] =
|
|
3005
|
-
const [parseError, setParseError] =
|
|
3112
|
+
const [inputValue, setInputValue] = useState5(typeof value2 === "number" ? value2 : "");
|
|
3113
|
+
const [forceVisible, setForceVisible] = useState5(false);
|
|
3114
|
+
const [parseError, setParseError] = useState5(null);
|
|
3006
3115
|
const readonly = !!argType?.table?.readonly;
|
|
3007
3116
|
const handleChange = useCallback3(
|
|
3008
3117
|
(event) => {
|
|
@@ -3023,19 +3132,19 @@ var NumberControl = /* @__PURE__ */ __name(({
|
|
|
3023
3132
|
setForceVisible(true);
|
|
3024
3133
|
}, [setForceVisible]);
|
|
3025
3134
|
const htmlElRef = useRef3(null);
|
|
3026
|
-
|
|
3135
|
+
useEffect5(() => {
|
|
3027
3136
|
if (forceVisible && htmlElRef.current) {
|
|
3028
3137
|
htmlElRef.current.select();
|
|
3029
3138
|
}
|
|
3030
3139
|
}, [forceVisible]);
|
|
3031
|
-
|
|
3140
|
+
useEffect5(() => {
|
|
3032
3141
|
const newInputValue = typeof value2 === "number" ? value2 : "";
|
|
3033
3142
|
if (inputValue !== newInputValue) {
|
|
3034
3143
|
setInputValue(newInputValue);
|
|
3035
3144
|
}
|
|
3036
3145
|
}, [value2]);
|
|
3037
3146
|
if (value2 === void 0) {
|
|
3038
|
-
return
|
|
3147
|
+
return React14.createElement(
|
|
3039
3148
|
Button2,
|
|
3040
3149
|
{
|
|
3041
3150
|
variant: "outline",
|
|
@@ -3047,7 +3156,7 @@ var NumberControl = /* @__PURE__ */ __name(({
|
|
|
3047
3156
|
"Set number"
|
|
3048
3157
|
);
|
|
3049
3158
|
}
|
|
3050
|
-
return
|
|
3159
|
+
return React14.createElement(Wrapper3, null, React14.createElement(
|
|
3051
3160
|
FormInput2,
|
|
3052
3161
|
{
|
|
3053
3162
|
ref: htmlElRef,
|
|
@@ -3066,10 +3175,10 @@ var NumberControl = /* @__PURE__ */ __name(({
|
|
|
3066
3175
|
}, "NumberControl");
|
|
3067
3176
|
|
|
3068
3177
|
// src/blocks/controls/options/Options.tsx
|
|
3069
|
-
import
|
|
3178
|
+
import React18 from "react";
|
|
3070
3179
|
|
|
3071
3180
|
// src/blocks/controls/options/Checkbox.tsx
|
|
3072
|
-
import
|
|
3181
|
+
import React15, { useEffect as useEffect6, useState as useState6 } from "react";
|
|
3073
3182
|
import { logger } from "storybook/internal/client-logger";
|
|
3074
3183
|
import { styled as styled12 } from "storybook/theming";
|
|
3075
3184
|
|
|
@@ -3133,10 +3242,10 @@ var CheckboxControl = /* @__PURE__ */ __name(({
|
|
|
3133
3242
|
}) => {
|
|
3134
3243
|
if (!options) {
|
|
3135
3244
|
logger.warn(`Checkbox with no options: ${name}`);
|
|
3136
|
-
return
|
|
3245
|
+
return React15.createElement(React15.Fragment, null, "-");
|
|
3137
3246
|
}
|
|
3138
3247
|
const initial = selectedKeys(value2 || [], options);
|
|
3139
|
-
const [selected, setSelected] =
|
|
3248
|
+
const [selected, setSelected] = useState6(initial);
|
|
3140
3249
|
const readonly = !!argType?.table?.readonly;
|
|
3141
3250
|
const handleChange = /* @__PURE__ */ __name((e2) => {
|
|
3142
3251
|
const option = e2.target.value;
|
|
@@ -3149,13 +3258,13 @@ var CheckboxControl = /* @__PURE__ */ __name(({
|
|
|
3149
3258
|
onChange(selectedValues(updated, options));
|
|
3150
3259
|
setSelected(updated);
|
|
3151
3260
|
}, "handleChange");
|
|
3152
|
-
|
|
3261
|
+
useEffect6(() => {
|
|
3153
3262
|
setSelected(selectedKeys(value2 || [], options));
|
|
3154
3263
|
}, [value2]);
|
|
3155
3264
|
const controlId = getControlId(name);
|
|
3156
|
-
return
|
|
3265
|
+
return React15.createElement(Wrapper4, { "aria-readonly": readonly, isInline }, Object.keys(options).map((key, index) => {
|
|
3157
3266
|
const id = `${controlId}-${index}`;
|
|
3158
|
-
return
|
|
3267
|
+
return React15.createElement(Label3, { key: id, htmlFor: id }, React15.createElement(
|
|
3159
3268
|
"input",
|
|
3160
3269
|
{
|
|
3161
3270
|
type: "checkbox",
|
|
@@ -3166,12 +3275,12 @@ var CheckboxControl = /* @__PURE__ */ __name(({
|
|
|
3166
3275
|
onChange: handleChange,
|
|
3167
3276
|
checked: selected?.includes(key)
|
|
3168
3277
|
}
|
|
3169
|
-
),
|
|
3278
|
+
), React15.createElement(Text, null, key));
|
|
3170
3279
|
}));
|
|
3171
3280
|
}, "CheckboxControl");
|
|
3172
3281
|
|
|
3173
3282
|
// src/blocks/controls/options/Radio.tsx
|
|
3174
|
-
import
|
|
3283
|
+
import React16 from "react";
|
|
3175
3284
|
import { logger as logger2 } from "storybook/internal/client-logger";
|
|
3176
3285
|
import { styled as styled13 } from "storybook/theming";
|
|
3177
3286
|
var Wrapper5 = styled13.div(
|
|
@@ -3225,14 +3334,14 @@ var RadioControl = /* @__PURE__ */ __name(({
|
|
|
3225
3334
|
}) => {
|
|
3226
3335
|
if (!options) {
|
|
3227
3336
|
logger2.warn(`Radio with no options: ${name}`);
|
|
3228
|
-
return
|
|
3337
|
+
return React16.createElement(React16.Fragment, null, "-");
|
|
3229
3338
|
}
|
|
3230
3339
|
const selection = selectedKey(value2, options);
|
|
3231
3340
|
const controlId = getControlId(name);
|
|
3232
3341
|
const readonly = !!argType?.table?.readonly;
|
|
3233
|
-
return
|
|
3342
|
+
return React16.createElement(Wrapper5, { "aria-readonly": readonly, isInline }, Object.keys(options).map((key, index) => {
|
|
3234
3343
|
const id = `${controlId}-${index}`;
|
|
3235
|
-
return
|
|
3344
|
+
return React16.createElement(Label4, { key: id, htmlFor: id }, React16.createElement(
|
|
3236
3345
|
"input",
|
|
3237
3346
|
{
|
|
3238
3347
|
type: "radio",
|
|
@@ -3243,12 +3352,12 @@ var RadioControl = /* @__PURE__ */ __name(({
|
|
|
3243
3352
|
onChange: (e2) => onChange(options[e2.currentTarget.value]),
|
|
3244
3353
|
checked: key === selection
|
|
3245
3354
|
}
|
|
3246
|
-
),
|
|
3355
|
+
), React16.createElement(Text2, null, key));
|
|
3247
3356
|
}));
|
|
3248
3357
|
}, "RadioControl");
|
|
3249
3358
|
|
|
3250
3359
|
// src/blocks/controls/options/Select.tsx
|
|
3251
|
-
import
|
|
3360
|
+
import React17 from "react";
|
|
3252
3361
|
import { logger as logger3 } from "storybook/internal/client-logger";
|
|
3253
3362
|
import { ChevronSmallDownIcon } from "@storybook/icons";
|
|
3254
3363
|
import { styled as styled14 } from "storybook/theming";
|
|
@@ -3326,7 +3435,7 @@ var SingleSelect = /* @__PURE__ */ __name(({ name, value: value2, options, onCha
|
|
|
3326
3435
|
const selection = selectedKey(value2, options) || NO_SELECTION;
|
|
3327
3436
|
const controlId = getControlId(name);
|
|
3328
3437
|
const readonly = !!argType?.table?.readonly;
|
|
3329
|
-
return
|
|
3438
|
+
return React17.createElement(SelectWrapper, null, React17.createElement(ChevronSmallDownIcon, null), React17.createElement(OptionsSelect, { disabled: readonly, id: controlId, value: selection, onChange: handleChange }, React17.createElement("option", { key: "no-selection", disabled: true }, NO_SELECTION), Object.keys(options).map((key) => React17.createElement("option", { key, value: key }, key))));
|
|
3330
3439
|
}, "SingleSelect");
|
|
3331
3440
|
var MultiSelect = /* @__PURE__ */ __name(({ name, value: value2, options, onChange, argType }) => {
|
|
3332
3441
|
const handleChange = /* @__PURE__ */ __name((e2) => {
|
|
@@ -3336,7 +3445,7 @@ var MultiSelect = /* @__PURE__ */ __name(({ name, value: value2, options, onChan
|
|
|
3336
3445
|
const selection = selectedKeys(value2, options);
|
|
3337
3446
|
const controlId = getControlId(name);
|
|
3338
3447
|
const readonly = !!argType?.table?.readonly;
|
|
3339
|
-
return
|
|
3448
|
+
return React17.createElement(SelectWrapper, null, React17.createElement(
|
|
3340
3449
|
OptionsSelect,
|
|
3341
3450
|
{
|
|
3342
3451
|
disabled: readonly,
|
|
@@ -3345,16 +3454,16 @@ var MultiSelect = /* @__PURE__ */ __name(({ name, value: value2, options, onChan
|
|
|
3345
3454
|
value: selection,
|
|
3346
3455
|
onChange: handleChange
|
|
3347
3456
|
},
|
|
3348
|
-
Object.keys(options).map((key) =>
|
|
3457
|
+
Object.keys(options).map((key) => React17.createElement("option", { key, value: key }, key))
|
|
3349
3458
|
));
|
|
3350
3459
|
}, "MultiSelect");
|
|
3351
3460
|
var SelectControl = /* @__PURE__ */ __name((props) => {
|
|
3352
3461
|
const { name, options } = props;
|
|
3353
3462
|
if (!options) {
|
|
3354
3463
|
logger3.warn(`Select with no options: ${name}`);
|
|
3355
|
-
return
|
|
3464
|
+
return React17.createElement(React17.Fragment, null, "-");
|
|
3356
3465
|
}
|
|
3357
|
-
return props.isMulti ?
|
|
3466
|
+
return props.isMulti ? React17.createElement(MultiSelect, { ...props }) : React17.createElement(SingleSelect, { ...props });
|
|
3358
3467
|
}, "SelectControl");
|
|
3359
3468
|
|
|
3360
3469
|
// src/blocks/controls/options/Options.tsx
|
|
@@ -3386,25 +3495,25 @@ var OptionsControl = /* @__PURE__ */ __name((props) => {
|
|
|
3386
3495
|
};
|
|
3387
3496
|
const Control = Controls[type];
|
|
3388
3497
|
if (Control) {
|
|
3389
|
-
return
|
|
3498
|
+
return React18.createElement(Control, { ...normalized });
|
|
3390
3499
|
}
|
|
3391
3500
|
throw new Error(`Unknown options type: ${type}`);
|
|
3392
3501
|
}, "OptionsControl");
|
|
3393
3502
|
|
|
3394
3503
|
// src/blocks/controls/Object.tsx
|
|
3395
|
-
import
|
|
3504
|
+
import React22, { useCallback as useCallback4, useEffect as useEffect7, useMemo, useRef as useRef4, useState as useState7 } from "react";
|
|
3396
3505
|
import { Button as Button3, Form as Form3, IconButton as IconButton2 } from "storybook/internal/components";
|
|
3397
3506
|
import { AddIcon, EyeCloseIcon, EyeIcon, SubtractIcon } from "@storybook/icons";
|
|
3398
3507
|
import { styled as styled16, useTheme } from "storybook/theming";
|
|
3399
3508
|
|
|
3400
3509
|
// src/blocks/controls/react-editable-json-tree/index.tsx
|
|
3401
|
-
import
|
|
3510
|
+
import React21, { Component as Component3 } from "react";
|
|
3402
3511
|
|
|
3403
3512
|
// src/blocks/controls/react-editable-json-tree/JsonNodes.tsx
|
|
3404
|
-
import
|
|
3513
|
+
import React20, { Component as Component2, cloneElement as cloneElement2 } from "react";
|
|
3405
3514
|
|
|
3406
3515
|
// src/blocks/controls/react-editable-json-tree/JsonNodeAccordion.tsx
|
|
3407
|
-
import
|
|
3516
|
+
import React19 from "react";
|
|
3408
3517
|
import { styled as styled15 } from "storybook/theming";
|
|
3409
3518
|
var Container = styled15.div(({ theme }) => ({
|
|
3410
3519
|
position: "relative",
|
|
@@ -3475,7 +3584,7 @@ function JsonNodeAccordion({
|
|
|
3475
3584
|
region: `${accordionKey}-region`
|
|
3476
3585
|
};
|
|
3477
3586
|
const containerTag = keyPath.length > 0 ? "li" : "div";
|
|
3478
|
-
return
|
|
3587
|
+
return React19.createElement(Container, { as: containerTag }, React19.createElement(
|
|
3479
3588
|
Trigger,
|
|
3480
3589
|
{
|
|
3481
3590
|
type: "button",
|
|
@@ -3487,7 +3596,7 @@ function JsonNodeAccordion({
|
|
|
3487
3596
|
},
|
|
3488
3597
|
name,
|
|
3489
3598
|
" :"
|
|
3490
|
-
),
|
|
3599
|
+
), React19.createElement(
|
|
3491
3600
|
Region,
|
|
3492
3601
|
{
|
|
3493
3602
|
role: "region",
|
|
@@ -3631,15 +3740,15 @@ var _JsonAddValue = class _JsonAddValue extends Component2 {
|
|
|
3631
3740
|
onKeyDown: this.onKeydown
|
|
3632
3741
|
});
|
|
3633
3742
|
}
|
|
3634
|
-
return
|
|
3743
|
+
return React20.createElement("span", { className: "rejt-add-value-node" }, inputElementKeyLayout, inputElementValueLayout, addButtonElementLayout, cancelButtonElementLayout);
|
|
3635
3744
|
}
|
|
3636
3745
|
};
|
|
3637
3746
|
__name(_JsonAddValue, "JsonAddValue");
|
|
3638
3747
|
var JsonAddValue = _JsonAddValue;
|
|
3639
3748
|
JsonAddValue.defaultProps = {
|
|
3640
3749
|
onlyValue: false,
|
|
3641
|
-
addButtonElement:
|
|
3642
|
-
cancelButtonElement:
|
|
3750
|
+
addButtonElement: React20.createElement("button", null, "+"),
|
|
3751
|
+
cancelButtonElement: React20.createElement("button", null, "c")
|
|
3643
3752
|
};
|
|
3644
3753
|
var _JsonArray = class _JsonArray extends Component2 {
|
|
3645
3754
|
constructor(props) {
|
|
@@ -3708,9 +3817,10 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
3708
3817
|
}).catch(logger4.error);
|
|
3709
3818
|
};
|
|
3710
3819
|
}
|
|
3711
|
-
handleAddValueAdd({
|
|
3820
|
+
handleAddValueAdd({ newValue }) {
|
|
3712
3821
|
const { data, keyPath = [], nextDeep: deep } = this.state;
|
|
3713
3822
|
const { beforeAddAction, logger: logger4 } = this.props;
|
|
3823
|
+
const key = data.length;
|
|
3714
3824
|
(beforeAddAction || Promise.resolve.bind(Promise))(key, keyPath, deep, newValue).then(() => {
|
|
3715
3825
|
data[key] = newValue;
|
|
3716
3826
|
this.setState({
|
|
@@ -3768,7 +3878,7 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
3768
3878
|
style: minus,
|
|
3769
3879
|
"aria-label": `remove the array '${String(name)}'`
|
|
3770
3880
|
});
|
|
3771
|
-
return
|
|
3881
|
+
return React20.createElement(React20.Fragment, null, React20.createElement("span", { style: collapsed }, "[...] ", data.length, " ", data.length === 1 ? "item" : "items"), !isReadOnly && removeItemButton);
|
|
3772
3882
|
}
|
|
3773
3883
|
renderNotCollapsed() {
|
|
3774
3884
|
const { name, data, keyPath, deep, addFormVisible, nextDeep } = this.state;
|
|
@@ -3808,7 +3918,7 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
3808
3918
|
const onlyValue = true;
|
|
3809
3919
|
const startObject = "[";
|
|
3810
3920
|
const endObject = "]";
|
|
3811
|
-
return
|
|
3921
|
+
return React20.createElement(React20.Fragment, null, React20.createElement("span", { className: "rejt-not-collapsed-delimiter", style: delimiter }, startObject), !addFormVisible && addItemButton, React20.createElement("ul", { className: "rejt-not-collapsed-list", style: ul }, data.map((item, index) => React20.createElement(
|
|
3812
3922
|
JsonNode,
|
|
3813
3923
|
{
|
|
3814
3924
|
key: index,
|
|
@@ -3835,7 +3945,7 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
3835
3945
|
logger: logger4,
|
|
3836
3946
|
onSubmitValueParser
|
|
3837
3947
|
}
|
|
3838
|
-
))), !isReadOnly && addFormVisible &&
|
|
3948
|
+
))), !isReadOnly && addFormVisible && React20.createElement("div", { className: "rejt-add-form", style: addForm }, React20.createElement(
|
|
3839
3949
|
JsonAddValue,
|
|
3840
3950
|
{
|
|
3841
3951
|
handleAdd: this.handleAddValueAdd,
|
|
@@ -3848,12 +3958,12 @@ var _JsonArray = class _JsonArray extends Component2 {
|
|
|
3848
3958
|
deep,
|
|
3849
3959
|
onSubmitValueParser
|
|
3850
3960
|
}
|
|
3851
|
-
)),
|
|
3961
|
+
)), React20.createElement("span", { className: "rejt-not-collapsed-delimiter", style: delimiter }, endObject), !isReadOnly && removeItemButton);
|
|
3852
3962
|
}
|
|
3853
3963
|
render() {
|
|
3854
3964
|
const { name, collapsed, keyPath, deep } = this.state;
|
|
3855
3965
|
const value2 = collapsed ? this.renderCollapsed() : this.renderNotCollapsed();
|
|
3856
|
-
return
|
|
3966
|
+
return React20.createElement(
|
|
3857
3967
|
JsonNodeAccordion,
|
|
3858
3968
|
{
|
|
3859
3969
|
name,
|
|
@@ -3871,8 +3981,8 @@ var JsonArray = _JsonArray;
|
|
|
3871
3981
|
JsonArray.defaultProps = {
|
|
3872
3982
|
keyPath: [],
|
|
3873
3983
|
deep: 0,
|
|
3874
|
-
minusMenuElement:
|
|
3875
|
-
plusMenuElement:
|
|
3984
|
+
minusMenuElement: React20.createElement("span", null, " - "),
|
|
3985
|
+
plusMenuElement: React20.createElement("span", null, " + ")
|
|
3876
3986
|
};
|
|
3877
3987
|
var _JsonFunctionValue = class _JsonFunctionValue extends Component2 {
|
|
3878
3988
|
constructor(props) {
|
|
@@ -3977,10 +4087,10 @@ var _JsonFunctionValue = class _JsonFunctionValue extends Component2 {
|
|
|
3977
4087
|
defaultValue: value2,
|
|
3978
4088
|
onKeyDown: this.onKeydown
|
|
3979
4089
|
});
|
|
3980
|
-
result =
|
|
4090
|
+
result = React20.createElement("span", { className: "rejt-edit-form", style: style.editForm }, textareaElementLayout);
|
|
3981
4091
|
minusElement = null;
|
|
3982
4092
|
} else {
|
|
3983
|
-
result =
|
|
4093
|
+
result = React20.createElement(
|
|
3984
4094
|
"span",
|
|
3985
4095
|
{
|
|
3986
4096
|
className: "rejt-value",
|
|
@@ -3998,7 +4108,7 @@ var _JsonFunctionValue = class _JsonFunctionValue extends Component2 {
|
|
|
3998
4108
|
});
|
|
3999
4109
|
minusElement = resultOnlyResult ? null : minusMenuLayout;
|
|
4000
4110
|
}
|
|
4001
|
-
return
|
|
4111
|
+
return React20.createElement("li", { className: "rejt-value-node", style: style.li }, React20.createElement("span", { className: "rejt-name", style: style.name }, name, " :", " "), result, minusElement);
|
|
4002
4112
|
}
|
|
4003
4113
|
};
|
|
4004
4114
|
__name(_JsonFunctionValue, "JsonFunctionValue");
|
|
@@ -4008,8 +4118,8 @@ JsonFunctionValue.defaultProps = {
|
|
|
4008
4118
|
deep: 0,
|
|
4009
4119
|
handleUpdateValue: /* @__PURE__ */ __name(() => {
|
|
4010
4120
|
}, "handleUpdateValue"),
|
|
4011
|
-
cancelButtonElement:
|
|
4012
|
-
minusMenuElement:
|
|
4121
|
+
cancelButtonElement: React20.createElement("button", null, "c"),
|
|
4122
|
+
minusMenuElement: React20.createElement("span", null, " - ")
|
|
4013
4123
|
};
|
|
4014
4124
|
var _JsonNode = class _JsonNode extends Component2 {
|
|
4015
4125
|
constructor(props) {
|
|
@@ -4050,7 +4160,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4050
4160
|
const dataType = getObjectType(data);
|
|
4051
4161
|
switch (dataType) {
|
|
4052
4162
|
case ERROR:
|
|
4053
|
-
return
|
|
4163
|
+
return React20.createElement(
|
|
4054
4164
|
JsonObject,
|
|
4055
4165
|
{
|
|
4056
4166
|
data,
|
|
@@ -4078,7 +4188,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4078
4188
|
}
|
|
4079
4189
|
);
|
|
4080
4190
|
case OBJECT:
|
|
4081
|
-
return
|
|
4191
|
+
return React20.createElement(
|
|
4082
4192
|
JsonObject,
|
|
4083
4193
|
{
|
|
4084
4194
|
data,
|
|
@@ -4106,7 +4216,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4106
4216
|
}
|
|
4107
4217
|
);
|
|
4108
4218
|
case ARRAY:
|
|
4109
|
-
return
|
|
4219
|
+
return React20.createElement(
|
|
4110
4220
|
JsonArray,
|
|
4111
4221
|
{
|
|
4112
4222
|
data,
|
|
@@ -4134,7 +4244,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4134
4244
|
}
|
|
4135
4245
|
);
|
|
4136
4246
|
case STRING:
|
|
4137
|
-
return
|
|
4247
|
+
return React20.createElement(
|
|
4138
4248
|
JsonValue,
|
|
4139
4249
|
{
|
|
4140
4250
|
name,
|
|
@@ -4155,7 +4265,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4155
4265
|
}
|
|
4156
4266
|
);
|
|
4157
4267
|
case NUMBER:
|
|
4158
|
-
return
|
|
4268
|
+
return React20.createElement(
|
|
4159
4269
|
JsonValue,
|
|
4160
4270
|
{
|
|
4161
4271
|
name,
|
|
@@ -4176,7 +4286,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4176
4286
|
}
|
|
4177
4287
|
);
|
|
4178
4288
|
case BOOLEAN:
|
|
4179
|
-
return
|
|
4289
|
+
return React20.createElement(
|
|
4180
4290
|
JsonValue,
|
|
4181
4291
|
{
|
|
4182
4292
|
name,
|
|
@@ -4197,7 +4307,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4197
4307
|
}
|
|
4198
4308
|
);
|
|
4199
4309
|
case DATE:
|
|
4200
|
-
return
|
|
4310
|
+
return React20.createElement(
|
|
4201
4311
|
JsonValue,
|
|
4202
4312
|
{
|
|
4203
4313
|
name,
|
|
@@ -4218,7 +4328,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4218
4328
|
}
|
|
4219
4329
|
);
|
|
4220
4330
|
case NULL:
|
|
4221
|
-
return
|
|
4331
|
+
return React20.createElement(
|
|
4222
4332
|
JsonValue,
|
|
4223
4333
|
{
|
|
4224
4334
|
name,
|
|
@@ -4239,7 +4349,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4239
4349
|
}
|
|
4240
4350
|
);
|
|
4241
4351
|
case UNDEFINED:
|
|
4242
|
-
return
|
|
4352
|
+
return React20.createElement(
|
|
4243
4353
|
JsonValue,
|
|
4244
4354
|
{
|
|
4245
4355
|
name,
|
|
@@ -4260,7 +4370,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4260
4370
|
}
|
|
4261
4371
|
);
|
|
4262
4372
|
case FUNCTION:
|
|
4263
|
-
return
|
|
4373
|
+
return React20.createElement(
|
|
4264
4374
|
JsonFunctionValue,
|
|
4265
4375
|
{
|
|
4266
4376
|
name,
|
|
@@ -4281,7 +4391,7 @@ var _JsonNode = class _JsonNode extends Component2 {
|
|
|
4281
4391
|
}
|
|
4282
4392
|
);
|
|
4283
4393
|
case SYMBOL:
|
|
4284
|
-
return
|
|
4394
|
+
return React20.createElement(
|
|
4285
4395
|
JsonValue,
|
|
4286
4396
|
{
|
|
4287
4397
|
name,
|
|
@@ -4440,7 +4550,7 @@ var _JsonObject = class _JsonObject extends Component2 {
|
|
|
4440
4550
|
style: minus,
|
|
4441
4551
|
"aria-label": `remove the object '${String(name)}'`
|
|
4442
4552
|
});
|
|
4443
|
-
return
|
|
4553
|
+
return React20.createElement(React20.Fragment, null, React20.createElement("span", { style: collapsed }, "{...}", " ", keyList.length, " ", keyList.length === 1 ? "key" : "keys"), !isReadOnly && removeItemButton);
|
|
4444
4554
|
}
|
|
4445
4555
|
renderNotCollapsed() {
|
|
4446
4556
|
const { name, data, keyPath, deep, nextDeep, addFormVisible } = this.state;
|
|
@@ -4478,7 +4588,7 @@ var _JsonObject = class _JsonObject extends Component2 {
|
|
|
4478
4588
|
style: minus,
|
|
4479
4589
|
"aria-label": `remove the object '${String(name)}'`
|
|
4480
4590
|
});
|
|
4481
|
-
const list = keyList.map((key) =>
|
|
4591
|
+
const list = keyList.map((key) => React20.createElement(
|
|
4482
4592
|
JsonNode,
|
|
4483
4593
|
{
|
|
4484
4594
|
key,
|
|
@@ -4508,7 +4618,7 @@ var _JsonObject = class _JsonObject extends Component2 {
|
|
|
4508
4618
|
));
|
|
4509
4619
|
const startObject = "{";
|
|
4510
4620
|
const endObject = "}";
|
|
4511
|
-
return
|
|
4621
|
+
return React20.createElement(React20.Fragment, null, React20.createElement("span", { className: "rejt-not-collapsed-delimiter", style: delimiter }, startObject), !isReadOnly && addItemButton, React20.createElement("ul", { className: "rejt-not-collapsed-list", style: ul }, list), !isReadOnly && addFormVisible && React20.createElement("div", { className: "rejt-add-form", style: addForm }, React20.createElement(
|
|
4512
4622
|
JsonAddValue,
|
|
4513
4623
|
{
|
|
4514
4624
|
handleAdd: this.handleAddValueAdd,
|
|
@@ -4520,12 +4630,12 @@ var _JsonObject = class _JsonObject extends Component2 {
|
|
|
4520
4630
|
deep,
|
|
4521
4631
|
onSubmitValueParser
|
|
4522
4632
|
}
|
|
4523
|
-
)),
|
|
4633
|
+
)), React20.createElement("span", { className: "rejt-not-collapsed-delimiter", style: delimiter }, endObject), !isReadOnly && removeItemButton);
|
|
4524
4634
|
}
|
|
4525
4635
|
render() {
|
|
4526
4636
|
const { name, collapsed, keyPath, deep = 0 } = this.state;
|
|
4527
4637
|
const value2 = collapsed ? this.renderCollapsed() : this.renderNotCollapsed();
|
|
4528
|
-
return
|
|
4638
|
+
return React20.createElement(
|
|
4529
4639
|
JsonNodeAccordion,
|
|
4530
4640
|
{
|
|
4531
4641
|
name,
|
|
@@ -4543,8 +4653,8 @@ var JsonObject = _JsonObject;
|
|
|
4543
4653
|
JsonObject.defaultProps = {
|
|
4544
4654
|
keyPath: [],
|
|
4545
4655
|
deep: 0,
|
|
4546
|
-
minusMenuElement:
|
|
4547
|
-
plusMenuElement:
|
|
4656
|
+
minusMenuElement: React20.createElement("span", null, " - "),
|
|
4657
|
+
plusMenuElement: React20.createElement("span", null, " + ")
|
|
4548
4658
|
};
|
|
4549
4659
|
var _JsonValue = class _JsonValue extends Component2 {
|
|
4550
4660
|
constructor(props) {
|
|
@@ -4654,7 +4764,7 @@ var _JsonValue = class _JsonValue extends Component2 {
|
|
|
4654
4764
|
style: style.minus,
|
|
4655
4765
|
"aria-label": `remove the property '${String(name)}' with value '${String(originalValue)}'${String(parentPropertyName) ? ` from '${String(parentPropertyName)}'` : ""}`
|
|
4656
4766
|
});
|
|
4657
|
-
return
|
|
4767
|
+
return React20.createElement("li", { className: "rejt-value-node", style: style.li }, React20.createElement("span", { className: "rejt-name", style: style.name }, name, " : "), isEditing ? React20.createElement("span", { className: "rejt-edit-form", style: style.editForm }, inputElementLayout) : React20.createElement(
|
|
4658
4768
|
"span",
|
|
4659
4769
|
{
|
|
4660
4770
|
className: "rejt-value",
|
|
@@ -4671,8 +4781,8 @@ JsonValue.defaultProps = {
|
|
|
4671
4781
|
keyPath: [],
|
|
4672
4782
|
deep: 0,
|
|
4673
4783
|
handleUpdateValue: /* @__PURE__ */ __name(() => Promise.resolve(), "handleUpdateValue"),
|
|
4674
|
-
cancelButtonElement:
|
|
4675
|
-
minusMenuElement:
|
|
4784
|
+
cancelButtonElement: React20.createElement("button", null, "c"),
|
|
4785
|
+
minusMenuElement: React20.createElement("span", null, " - ")
|
|
4676
4786
|
};
|
|
4677
4787
|
|
|
4678
4788
|
// src/blocks/controls/react-editable-json-tree/utils/parse.ts
|
|
@@ -4811,7 +4921,7 @@ var _JsonTree = class _JsonTree extends Component3 {
|
|
|
4811
4921
|
textareaElementFunction = /* @__PURE__ */ __name(() => textareaElement, "textareaElementFunction");
|
|
4812
4922
|
}
|
|
4813
4923
|
if (dataType === "Object" || dataType === "Array") {
|
|
4814
|
-
return
|
|
4924
|
+
return React21.createElement("div", { className: "rejt-tree" }, React21.createElement(
|
|
4815
4925
|
JsonNode,
|
|
4816
4926
|
{
|
|
4817
4927
|
data,
|
|
@@ -4868,8 +4978,8 @@ JsonTree.defaultProps = {
|
|
|
4868
4978
|
logger: { error: /* @__PURE__ */ __name(() => {
|
|
4869
4979
|
}, "error") },
|
|
4870
4980
|
onSubmitValueParser: /* @__PURE__ */ __name((isEditMode, keyPath, deep, name, rawValue) => parse3(rawValue), "onSubmitValueParser"),
|
|
4871
|
-
inputElement: /* @__PURE__ */ __name(() =>
|
|
4872
|
-
textareaElement: /* @__PURE__ */ __name(() =>
|
|
4981
|
+
inputElement: /* @__PURE__ */ __name(() => React21.createElement("input", null), "inputElement"),
|
|
4982
|
+
textareaElement: /* @__PURE__ */ __name(() => React21.createElement("textarea", null), "textareaElement"),
|
|
4873
4983
|
fallback: null
|
|
4874
4984
|
};
|
|
4875
4985
|
|
|
@@ -5039,8 +5149,8 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
5039
5149
|
const theme = useTheme();
|
|
5040
5150
|
const data = useMemo(() => value2 && cloneDeep(value2), [value2]);
|
|
5041
5151
|
const hasData = data !== null && data !== void 0;
|
|
5042
|
-
const [showRaw, setShowRaw] =
|
|
5043
|
-
const [parseError, setParseError] =
|
|
5152
|
+
const [showRaw, setShowRaw] = useState7(!hasData);
|
|
5153
|
+
const [parseError, setParseError] = useState7(null);
|
|
5044
5154
|
const readonly = !!argType?.table?.readonly;
|
|
5045
5155
|
const updateRaw = useCallback4(
|
|
5046
5156
|
(raw) => {
|
|
@@ -5055,21 +5165,21 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
5055
5165
|
},
|
|
5056
5166
|
[onChange]
|
|
5057
5167
|
);
|
|
5058
|
-
const [forceVisible, setForceVisible] =
|
|
5168
|
+
const [forceVisible, setForceVisible] = useState7(false);
|
|
5059
5169
|
const onForceVisible = useCallback4(() => {
|
|
5060
5170
|
onChange({});
|
|
5061
5171
|
setForceVisible(true);
|
|
5062
5172
|
}, [setForceVisible]);
|
|
5063
5173
|
const htmlElRef = useRef4(null);
|
|
5064
|
-
|
|
5174
|
+
useEffect7(() => {
|
|
5065
5175
|
if (forceVisible && htmlElRef.current) {
|
|
5066
5176
|
htmlElRef.current.select();
|
|
5067
5177
|
}
|
|
5068
5178
|
}, [forceVisible]);
|
|
5069
5179
|
if (!hasData) {
|
|
5070
|
-
return
|
|
5180
|
+
return React22.createElement(Button3, { disabled: readonly, id: getControlSetterButtonId(name), onClick: onForceVisible }, "Set object");
|
|
5071
5181
|
}
|
|
5072
|
-
const rawJSONForm =
|
|
5182
|
+
const rawJSONForm = React22.createElement(
|
|
5073
5183
|
RawInput,
|
|
5074
5184
|
{
|
|
5075
5185
|
ref: htmlElRef,
|
|
@@ -5084,7 +5194,7 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
5084
5194
|
}
|
|
5085
5195
|
);
|
|
5086
5196
|
const isObjectOrArray = Array.isArray(value2) || typeof value2 === "object" && value2?.constructor === Object;
|
|
5087
|
-
return
|
|
5197
|
+
return React22.createElement(Wrapper6, { "aria-readonly": readonly }, isObjectOrArray && React22.createElement(
|
|
5088
5198
|
RawButton,
|
|
5089
5199
|
{
|
|
5090
5200
|
role: "switch",
|
|
@@ -5095,9 +5205,9 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
5095
5205
|
setShowRaw((isRaw) => !isRaw);
|
|
5096
5206
|
}
|
|
5097
5207
|
},
|
|
5098
|
-
showRaw ?
|
|
5099
|
-
|
|
5100
|
-
), !showRaw ?
|
|
5208
|
+
showRaw ? React22.createElement(EyeCloseIcon, null) : React22.createElement(EyeIcon, null),
|
|
5209
|
+
React22.createElement("span", null, "RAW")
|
|
5210
|
+
), !showRaw ? React22.createElement(
|
|
5101
5211
|
JsonTree,
|
|
5102
5212
|
{
|
|
5103
5213
|
readOnly: readonly || !isObjectOrArray,
|
|
@@ -5109,18 +5219,18 @@ var ObjectControl = /* @__PURE__ */ __name(({ name, value: value2, onChange, arg
|
|
|
5109
5219
|
rootName: name,
|
|
5110
5220
|
onFullyUpdate: onChange,
|
|
5111
5221
|
getStyle: getCustomStyleFunction(theme),
|
|
5112
|
-
cancelButtonElement:
|
|
5113
|
-
addButtonElement:
|
|
5114
|
-
plusMenuElement:
|
|
5115
|
-
minusMenuElement:
|
|
5116
|
-
inputElement: (_2, __, ___, key) => key ?
|
|
5222
|
+
cancelButtonElement: React22.createElement(ButtonInline, { type: "button" }, "Cancel"),
|
|
5223
|
+
addButtonElement: React22.createElement(ButtonInline, { type: "submit", primary: true }, "Save"),
|
|
5224
|
+
plusMenuElement: React22.createElement(ActionButton, { type: "button" }, React22.createElement(AddIcon, null)),
|
|
5225
|
+
minusMenuElement: React22.createElement(ActionButton, { type: "button" }, React22.createElement(SubtractIcon, null)),
|
|
5226
|
+
inputElement: (_2, __, ___, key) => key ? React22.createElement(Input, { onFocus: selectValue, onBlur: dispatchEnterKey }) : React22.createElement(Input, null),
|
|
5117
5227
|
fallback: rawJSONForm
|
|
5118
5228
|
}
|
|
5119
5229
|
) : rawJSONForm);
|
|
5120
5230
|
}, "ObjectControl");
|
|
5121
5231
|
|
|
5122
5232
|
// src/blocks/controls/Range.tsx
|
|
5123
|
-
import
|
|
5233
|
+
import React23, { useMemo as useMemo2 } from "react";
|
|
5124
5234
|
import { styled as styled17 } from "storybook/theming";
|
|
5125
5235
|
var RangeInput = styled17.input(
|
|
5126
5236
|
({ theme, min, max, value: value2, disabled }) => ({
|
|
@@ -5293,7 +5403,7 @@ var RangeControl = /* @__PURE__ */ __name(({
|
|
|
5293
5403
|
const hasValue = value2 !== void 0;
|
|
5294
5404
|
const numberOFDecimalsPlaces = useMemo2(() => getNumberOfDecimalPlaces(step), [step]);
|
|
5295
5405
|
const readonly = !!argType?.table?.readonly;
|
|
5296
|
-
return
|
|
5406
|
+
return React23.createElement(RangeWrapper, { "aria-readonly": readonly }, React23.createElement(RangeLabel, null, min), React23.createElement(
|
|
5297
5407
|
RangeInput,
|
|
5298
5408
|
{
|
|
5299
5409
|
id: getControlId(name),
|
|
@@ -5303,11 +5413,11 @@ var RangeControl = /* @__PURE__ */ __name(({
|
|
|
5303
5413
|
...{ name, min, max, step, onFocus, onBlur },
|
|
5304
5414
|
value: value2 ?? min
|
|
5305
5415
|
}
|
|
5306
|
-
),
|
|
5416
|
+
), React23.createElement(RangeCurrentAndMaxLabel, { numberOFDecimalsPlaces, max }, hasValue ? value2.toFixed(numberOFDecimalsPlaces) : "--", " / ", max));
|
|
5307
5417
|
}, "RangeControl");
|
|
5308
5418
|
|
|
5309
5419
|
// src/blocks/controls/Text.tsx
|
|
5310
|
-
import
|
|
5420
|
+
import React24, { useCallback as useCallback5, useState as useState8 } from "react";
|
|
5311
5421
|
import { Button as Button4, Form as Form4 } from "storybook/internal/components";
|
|
5312
5422
|
import { styled as styled18 } from "storybook/theming";
|
|
5313
5423
|
var Wrapper7 = styled18.label({
|
|
@@ -5331,13 +5441,13 @@ var TextControl = /* @__PURE__ */ __name(({
|
|
|
5331
5441
|
onChange(event.target.value);
|
|
5332
5442
|
}, "handleChange");
|
|
5333
5443
|
const readonly = !!argType?.table?.readonly;
|
|
5334
|
-
const [forceVisible, setForceVisible] =
|
|
5444
|
+
const [forceVisible, setForceVisible] = useState8(false);
|
|
5335
5445
|
const onForceVisible = useCallback5(() => {
|
|
5336
5446
|
onChange("");
|
|
5337
5447
|
setForceVisible(true);
|
|
5338
5448
|
}, [setForceVisible]);
|
|
5339
5449
|
if (value2 === void 0) {
|
|
5340
|
-
return
|
|
5450
|
+
return React24.createElement(
|
|
5341
5451
|
Button4,
|
|
5342
5452
|
{
|
|
5343
5453
|
variant: "outline",
|
|
@@ -5350,7 +5460,7 @@ var TextControl = /* @__PURE__ */ __name(({
|
|
|
5350
5460
|
);
|
|
5351
5461
|
}
|
|
5352
5462
|
const isValid = typeof value2 === "string";
|
|
5353
|
-
return
|
|
5463
|
+
return React24.createElement(Wrapper7, null, React24.createElement(
|
|
5354
5464
|
Form4.Textarea,
|
|
5355
5465
|
{
|
|
5356
5466
|
id: getControlId(name),
|
|
@@ -5363,11 +5473,11 @@ var TextControl = /* @__PURE__ */ __name(({
|
|
|
5363
5473
|
valid: isValid ? void 0 : "error",
|
|
5364
5474
|
...{ name, value: isValid ? value2 : "", onFocus, onBlur }
|
|
5365
5475
|
}
|
|
5366
|
-
), maxLength &&
|
|
5476
|
+
), maxLength && React24.createElement(MaxLength, { isMaxed: value2?.length === maxLength }, value2?.length ?? 0, " / ", maxLength));
|
|
5367
5477
|
}, "TextControl");
|
|
5368
5478
|
|
|
5369
5479
|
// src/blocks/controls/Files.tsx
|
|
5370
|
-
import
|
|
5480
|
+
import React25, { useEffect as useEffect8, useRef as useRef5 } from "react";
|
|
5371
5481
|
import { Form as Form5 } from "storybook/internal/components";
|
|
5372
5482
|
import { styled as styled19 } from "storybook/theming";
|
|
5373
5483
|
var FileInput = styled19(Form5.Input)({
|
|
@@ -5399,12 +5509,12 @@ var FilesControl = /* @__PURE__ */ __name(({
|
|
|
5399
5509
|
revokeOldUrls(value2 || []);
|
|
5400
5510
|
}
|
|
5401
5511
|
__name(handleFileChange, "handleFileChange");
|
|
5402
|
-
|
|
5512
|
+
useEffect8(() => {
|
|
5403
5513
|
if (value2 == null && inputElement.current) {
|
|
5404
5514
|
inputElement.current.value = "";
|
|
5405
5515
|
}
|
|
5406
5516
|
}, [value2, name]);
|
|
5407
|
-
return
|
|
5517
|
+
return React25.createElement(
|
|
5408
5518
|
FileInput,
|
|
5409
5519
|
{
|
|
5410
5520
|
ref: inputElement,
|
|
@@ -5422,7 +5532,7 @@ var FilesControl = /* @__PURE__ */ __name(({
|
|
|
5422
5532
|
|
|
5423
5533
|
// src/blocks/controls/index.tsx
|
|
5424
5534
|
var LazyColorControl = lazy(() => import("./_browser-chunks/Color-4NTW6CRW.js"));
|
|
5425
|
-
var ColorControl = /* @__PURE__ */ __name((props) =>
|
|
5535
|
+
var ColorControl = /* @__PURE__ */ __name((props) => React26.createElement(Suspense, { fallback: React26.createElement("div", null) }, React26.createElement(LazyColorControl, { ...props })), "ColorControl");
|
|
5426
5536
|
|
|
5427
5537
|
// src/blocks/components/ArgsTable/ArgControl.tsx
|
|
5428
5538
|
var Controls2 = {
|
|
@@ -5442,12 +5552,12 @@ var Controls2 = {
|
|
|
5442
5552
|
text: TextControl,
|
|
5443
5553
|
file: FilesControl
|
|
5444
5554
|
};
|
|
5445
|
-
var NoControl = /* @__PURE__ */ __name(() =>
|
|
5555
|
+
var NoControl = /* @__PURE__ */ __name(() => React27.createElement(React27.Fragment, null, "-"), "NoControl");
|
|
5446
5556
|
var ArgControl = /* @__PURE__ */ __name(({ row, arg, updateArgs, isHovered }) => {
|
|
5447
5557
|
const { key, control } = row;
|
|
5448
|
-
const [isFocused, setFocused] =
|
|
5449
|
-
const [boxedValue, setBoxedValue] =
|
|
5450
|
-
|
|
5558
|
+
const [isFocused, setFocused] = useState9(false);
|
|
5559
|
+
const [boxedValue, setBoxedValue] = useState9({ value: arg });
|
|
5560
|
+
useEffect9(() => {
|
|
5451
5561
|
if (!isFocused) {
|
|
5452
5562
|
setBoxedValue({ value: arg });
|
|
5453
5563
|
}
|
|
@@ -5464,7 +5574,7 @@ var ArgControl = /* @__PURE__ */ __name(({ row, arg, updateArgs, isHovered }) =>
|
|
|
5464
5574
|
const onFocus = useCallback6(() => setFocused(true), []);
|
|
5465
5575
|
if (!control || control.disable) {
|
|
5466
5576
|
const canBeSetup = control?.disable !== true && row?.type?.name !== "function";
|
|
5467
|
-
return isHovered && canBeSetup ?
|
|
5577
|
+
return isHovered && canBeSetup ? React27.createElement(
|
|
5468
5578
|
Link,
|
|
5469
5579
|
{
|
|
5470
5580
|
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
@@ -5472,15 +5582,15 @@ var ArgControl = /* @__PURE__ */ __name(({ row, arg, updateArgs, isHovered }) =>
|
|
|
5472
5582
|
withArrow: true
|
|
5473
5583
|
},
|
|
5474
5584
|
"Setup controls"
|
|
5475
|
-
) :
|
|
5585
|
+
) : React27.createElement(NoControl, null);
|
|
5476
5586
|
}
|
|
5477
5587
|
const props = { name: key, argType: row, value: boxedValue.value, onChange, onBlur, onFocus };
|
|
5478
5588
|
const Control = Controls2[control.type] || NoControl;
|
|
5479
|
-
return
|
|
5589
|
+
return React27.createElement(Control, { ...props, ...control, controlType: control.type });
|
|
5480
5590
|
}, "ArgControl");
|
|
5481
5591
|
|
|
5482
5592
|
// src/blocks/components/ArgsTable/ArgJsDoc.tsx
|
|
5483
|
-
import
|
|
5593
|
+
import React28 from "react";
|
|
5484
5594
|
import { codeCommon } from "storybook/internal/components";
|
|
5485
5595
|
import { styled as styled20 } from "storybook/theming";
|
|
5486
5596
|
var Table = styled20.table(({ theme }) => ({
|
|
@@ -5540,13 +5650,13 @@ var ArgJsDoc = /* @__PURE__ */ __name(({ tags }) => {
|
|
|
5540
5650
|
if (!hasDisplayableParams && !hasDisplayableReturns && !hasDisplayableDeprecated) {
|
|
5541
5651
|
return null;
|
|
5542
5652
|
}
|
|
5543
|
-
return
|
|
5544
|
-
return
|
|
5545
|
-
}), hasDisplayableReturns &&
|
|
5653
|
+
return React28.createElement(React28.Fragment, null, React28.createElement(Table, null, React28.createElement("tbody", null, hasDisplayableDeprecated && React28.createElement("tr", { key: "deprecated" }, React28.createElement("td", { colSpan: 2 }, React28.createElement("strong", null, "Deprecated"), ": ", tags.deprecated?.toString())), hasDisplayableParams && params.map((x2) => {
|
|
5654
|
+
return React28.createElement("tr", { key: x2.name }, React28.createElement("td", null, React28.createElement("code", null, x2.name)), React28.createElement("td", null, x2.description));
|
|
5655
|
+
}), hasDisplayableReturns && React28.createElement("tr", { key: "returns" }, React28.createElement("td", null, React28.createElement("code", null, "Returns")), React28.createElement("td", null, tags.returns?.description)))));
|
|
5546
5656
|
}, "ArgJsDoc");
|
|
5547
5657
|
|
|
5548
5658
|
// src/blocks/components/ArgsTable/ArgValue.tsx
|
|
5549
|
-
import
|
|
5659
|
+
import React29, { useState as useState10 } from "react";
|
|
5550
5660
|
import { SyntaxHighlighter, WithTooltipPure, codeCommon as codeCommon2 } from "storybook/internal/components";
|
|
5551
5661
|
import { ChevronSmallDownIcon as ChevronSmallDownIcon2, ChevronSmallUpIcon } from "@storybook/icons";
|
|
5552
5662
|
var import_memoizerific = __toESM(require_memoizerific(), 1);
|
|
@@ -5617,10 +5727,10 @@ var ChevronDownIcon = styled21(ChevronSmallDownIcon2)({
|
|
|
5617
5727
|
marginLeft: 4
|
|
5618
5728
|
});
|
|
5619
5729
|
var EmptyArg = /* @__PURE__ */ __name(() => {
|
|
5620
|
-
return
|
|
5730
|
+
return React29.createElement("span", null, "-");
|
|
5621
5731
|
}, "EmptyArg");
|
|
5622
5732
|
var ArgText = /* @__PURE__ */ __name(({ text, simple }) => {
|
|
5623
|
-
return
|
|
5733
|
+
return React29.createElement(Text3, { simple }, text);
|
|
5624
5734
|
}, "ArgText");
|
|
5625
5735
|
var calculateDetailWidth = (0, import_memoizerific.default)(1e3)((detail) => {
|
|
5626
5736
|
const lines = detail.split(/\r?\n/);
|
|
@@ -5639,12 +5749,12 @@ var renderSummaryItems = /* @__PURE__ */ __name((summaryItems, isExpanded = true
|
|
|
5639
5749
|
if (!isExpanded) {
|
|
5640
5750
|
items = summaryItems.slice(0, ITEMS_BEFORE_EXPANSION);
|
|
5641
5751
|
}
|
|
5642
|
-
return items.map((item) =>
|
|
5752
|
+
return items.map((item) => React29.createElement(ArgText, { key: item, text: item === "" ? '""' : item }));
|
|
5643
5753
|
}, "renderSummaryItems");
|
|
5644
5754
|
var ArgSummary = /* @__PURE__ */ __name(({ value: value2, initialExpandedArgs }) => {
|
|
5645
5755
|
const { summary, detail } = value2;
|
|
5646
|
-
const [isOpen, setIsOpen] =
|
|
5647
|
-
const [isExpanded, setIsExpanded] =
|
|
5756
|
+
const [isOpen, setIsOpen] = useState10(false);
|
|
5757
|
+
const [isExpanded, setIsExpanded] = useState10(initialExpandedArgs || false);
|
|
5648
5758
|
if (summary === void 0 || summary === null) {
|
|
5649
5759
|
return null;
|
|
5650
5760
|
}
|
|
@@ -5652,14 +5762,14 @@ var ArgSummary = /* @__PURE__ */ __name(({ value: value2, initialExpandedArgs })
|
|
|
5652
5762
|
if (detail == null) {
|
|
5653
5763
|
const cannotBeSafelySplitted = /[(){}[\]<>]/.test(summaryAsString);
|
|
5654
5764
|
if (cannotBeSafelySplitted) {
|
|
5655
|
-
return
|
|
5765
|
+
return React29.createElement(ArgText, { text: summaryAsString });
|
|
5656
5766
|
}
|
|
5657
5767
|
const summaryItems = getSummaryItems(summaryAsString);
|
|
5658
5768
|
const itemsCount = summaryItems.length;
|
|
5659
5769
|
const hasManyItems = itemsCount > ITEMS_BEFORE_EXPANSION;
|
|
5660
|
-
return hasManyItems ?
|
|
5770
|
+
return hasManyItems ? React29.createElement(Summary, { isExpanded }, renderSummaryItems(summaryItems, isExpanded), React29.createElement(ExpandButton, { onClick: () => setIsExpanded(!isExpanded) }, isExpanded ? "Show less..." : `Show ${itemsCount - ITEMS_BEFORE_EXPANSION} more...`)) : React29.createElement(Summary, null, renderSummaryItems(summaryItems));
|
|
5661
5771
|
}
|
|
5662
|
-
return
|
|
5772
|
+
return React29.createElement(
|
|
5663
5773
|
WithTooltipPure,
|
|
5664
5774
|
{
|
|
5665
5775
|
closeOnOutsideClick: true,
|
|
@@ -5668,13 +5778,13 @@ var ArgSummary = /* @__PURE__ */ __name(({ value: value2, initialExpandedArgs })
|
|
|
5668
5778
|
onVisibleChange: (isVisible) => {
|
|
5669
5779
|
setIsOpen(isVisible);
|
|
5670
5780
|
},
|
|
5671
|
-
tooltip:
|
|
5781
|
+
tooltip: React29.createElement(Detail, { width: calculateDetailWidth(detail) }, React29.createElement(SyntaxHighlighter, { language: "jsx", format: false }, detail))
|
|
5672
5782
|
},
|
|
5673
|
-
|
|
5783
|
+
React29.createElement(Expandable, { className: "sbdocs-expandable" }, React29.createElement("span", null, summaryAsString), isOpen ? React29.createElement(ChevronUpIcon, null) : React29.createElement(ChevronDownIcon, null))
|
|
5674
5784
|
);
|
|
5675
5785
|
}, "ArgSummary");
|
|
5676
5786
|
var ArgValue = /* @__PURE__ */ __name(({ value: value2, initialExpandedArgs }) => {
|
|
5677
|
-
return value2 == null ?
|
|
5787
|
+
return value2 == null ? React29.createElement(EmptyArg, null) : React29.createElement(ArgSummary, { value: value2, initialExpandedArgs });
|
|
5678
5788
|
}, "ArgValue");
|
|
5679
5789
|
|
|
5680
5790
|
// src/blocks/components/ArgsTable/ArgRow.tsx
|
|
@@ -5726,7 +5836,7 @@ var toSummary = /* @__PURE__ */ __name((value2) => {
|
|
|
5726
5836
|
return { summary: val };
|
|
5727
5837
|
}, "toSummary");
|
|
5728
5838
|
var ArgRow = /* @__PURE__ */ __name((props) => {
|
|
5729
|
-
const [isHovered, setIsHovered] =
|
|
5839
|
+
const [isHovered, setIsHovered] = useState11(false);
|
|
5730
5840
|
const { row, updateArgs, compact, expandable, initialExpandedArgs } = props;
|
|
5731
5841
|
const { name, description } = row;
|
|
5732
5842
|
const table = row.table || {};
|
|
@@ -5734,11 +5844,11 @@ var ArgRow = /* @__PURE__ */ __name((props) => {
|
|
|
5734
5844
|
const defaultValue = table.defaultValue || row.defaultValue;
|
|
5735
5845
|
const required = row.type?.required;
|
|
5736
5846
|
const hasDescription = description != null && description !== "";
|
|
5737
|
-
return
|
|
5847
|
+
return React30.createElement("tr", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false) }, React30.createElement(StyledTd, { expandable: expandable ?? false }, React30.createElement(Name, null, name), required ? React30.createElement(Required, { title: "Required" }, "*") : null), compact ? null : React30.createElement("td", null, hasDescription && React30.createElement(Description, null, React30.createElement(index_modern_default, null, description)), table.jsDocTags != null ? React30.createElement(React30.Fragment, null, React30.createElement(TypeWithJsDoc, { hasDescription }, React30.createElement(ArgValue, { value: type, initialExpandedArgs })), React30.createElement(ArgJsDoc, { tags: table.jsDocTags })) : React30.createElement(Type, { hasDescription }, React30.createElement(ArgValue, { value: type, initialExpandedArgs }))), compact ? null : React30.createElement("td", null, React30.createElement(ArgValue, { value: defaultValue, initialExpandedArgs })), updateArgs ? React30.createElement("td", null, React30.createElement(ArgControl, { ...props, isHovered })) : null);
|
|
5738
5848
|
}, "ArgRow");
|
|
5739
5849
|
|
|
5740
5850
|
// src/blocks/components/ArgsTable/Empty.tsx
|
|
5741
|
-
import
|
|
5851
|
+
import React31, { useEffect as useEffect10, useState as useState12 } from "react";
|
|
5742
5852
|
import { EmptyTabContent, Link as Link2 } from "storybook/internal/components";
|
|
5743
5853
|
import { DocumentIcon } from "@storybook/icons";
|
|
5744
5854
|
import { styled as styled23 } from "storybook/theming";
|
|
@@ -5760,8 +5870,8 @@ var Links = styled23.div(({ theme }) => ({
|
|
|
5760
5870
|
gap: 25
|
|
5761
5871
|
}));
|
|
5762
5872
|
var Empty = /* @__PURE__ */ __name(({ inAddonPanel }) => {
|
|
5763
|
-
const [isLoading, setIsLoading] =
|
|
5764
|
-
|
|
5873
|
+
const [isLoading, setIsLoading] = useState12(true);
|
|
5874
|
+
useEffect10(() => {
|
|
5765
5875
|
const load = setTimeout(() => {
|
|
5766
5876
|
setIsLoading(false);
|
|
5767
5877
|
}, 100);
|
|
@@ -5770,28 +5880,28 @@ var Empty = /* @__PURE__ */ __name(({ inAddonPanel }) => {
|
|
|
5770
5880
|
if (isLoading) {
|
|
5771
5881
|
return null;
|
|
5772
5882
|
}
|
|
5773
|
-
return
|
|
5883
|
+
return React31.createElement(Wrapper8, { inAddonPanel }, React31.createElement(
|
|
5774
5884
|
EmptyTabContent,
|
|
5775
5885
|
{
|
|
5776
5886
|
title: inAddonPanel ? "Interactive story playground" : "Args table with interactive controls couldn't be auto-generated",
|
|
5777
|
-
description:
|
|
5778
|
-
footer:
|
|
5887
|
+
description: React31.createElement(React31.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."),
|
|
5888
|
+
footer: React31.createElement(Links, null, inAddonPanel && React31.createElement(React31.Fragment, null, React31.createElement(
|
|
5779
5889
|
Link2,
|
|
5780
5890
|
{
|
|
5781
5891
|
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
5782
5892
|
target: "_blank",
|
|
5783
5893
|
withArrow: true
|
|
5784
5894
|
},
|
|
5785
|
-
|
|
5895
|
+
React31.createElement(DocumentIcon, null),
|
|
5786
5896
|
" Read docs"
|
|
5787
|
-
)), !inAddonPanel &&
|
|
5897
|
+
)), !inAddonPanel && React31.createElement(
|
|
5788
5898
|
Link2,
|
|
5789
5899
|
{
|
|
5790
5900
|
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
5791
5901
|
target: "_blank",
|
|
5792
5902
|
withArrow: true
|
|
5793
5903
|
},
|
|
5794
|
-
|
|
5904
|
+
React31.createElement(DocumentIcon, null),
|
|
5795
5905
|
" Learn how to set that up"
|
|
5796
5906
|
))
|
|
5797
5907
|
}
|
|
@@ -5799,7 +5909,7 @@ var Empty = /* @__PURE__ */ __name(({ inAddonPanel }) => {
|
|
|
5799
5909
|
}, "Empty");
|
|
5800
5910
|
|
|
5801
5911
|
// src/blocks/components/ArgsTable/SectionRow.tsx
|
|
5802
|
-
import
|
|
5912
|
+
import React32, { useState as useState13 } from "react";
|
|
5803
5913
|
import { ChevronDownIcon as ChevronDownIcon2, ChevronRightIcon } from "@storybook/icons";
|
|
5804
5914
|
import { styled as styled24 } from "storybook/theming";
|
|
5805
5915
|
var ExpanderIconDown = styled24(ChevronDownIcon2)(({ theme }) => ({
|
|
@@ -5881,12 +5991,12 @@ var SectionRow = /* @__PURE__ */ __name(({
|
|
|
5881
5991
|
initialExpanded = true,
|
|
5882
5992
|
colSpan = 3
|
|
5883
5993
|
}) => {
|
|
5884
|
-
const [expanded, setExpanded] =
|
|
5994
|
+
const [expanded, setExpanded] = useState13(initialExpanded);
|
|
5885
5995
|
const Level = level === "subsection" ? Subsection : Section;
|
|
5886
5996
|
const itemCount = children?.length || 0;
|
|
5887
5997
|
const caption = level === "subsection" ? `${itemCount} item${itemCount !== 1 ? "s" : ""}` : "";
|
|
5888
5998
|
const helperText = `${expanded ? "Hide" : "Show"} ${level === "subsection" ? itemCount : label} item${itemCount !== 1 ? "s" : ""}`;
|
|
5889
|
-
return
|
|
5999
|
+
return React32.createElement(React32.Fragment, null, React32.createElement(StyledTr, { title: helperText }, React32.createElement(Level, { colSpan: 1 }, React32.createElement(ClickIntercept, { onClick: (e2) => setExpanded(!expanded), tabIndex: 0 }, helperText), React32.createElement(FlexWrapper, null, expanded ? React32.createElement(ExpanderIconDown, null) : React32.createElement(ExpanderIconRight, null), label)), React32.createElement(StyledTd2, { colSpan: colSpan - 1 }, React32.createElement(
|
|
5890
6000
|
ClickIntercept,
|
|
5891
6001
|
{
|
|
5892
6002
|
onClick: (e2) => setExpanded(!expanded),
|
|
@@ -5898,7 +6008,7 @@ var SectionRow = /* @__PURE__ */ __name(({
|
|
|
5898
6008
|
}, "SectionRow");
|
|
5899
6009
|
|
|
5900
6010
|
// src/blocks/components/ArgsTable/Skeleton.tsx
|
|
5901
|
-
import
|
|
6011
|
+
import React33 from "react";
|
|
5902
6012
|
import { styled as styled25 } from "storybook/theming";
|
|
5903
6013
|
var TableWrapper = styled25.div(({ theme }) => ({
|
|
5904
6014
|
width: "100%",
|
|
@@ -5956,7 +6066,7 @@ var SkeletonText = styled25.div(
|
|
|
5956
6066
|
borderRadius: 3
|
|
5957
6067
|
})
|
|
5958
6068
|
);
|
|
5959
|
-
var Skeleton = /* @__PURE__ */ __name(() =>
|
|
6069
|
+
var Skeleton = /* @__PURE__ */ __name(() => React33.createElement(TableWrapper, null, React33.createElement(Row, null, React33.createElement(Column, { position: "first" }, React33.createElement(SkeletonText, { width: "60%" })), React33.createElement(Column, { position: "second" }, React33.createElement(SkeletonText, { width: "30%" })), React33.createElement(Column, { position: "third" }, React33.createElement(SkeletonText, { width: "60%" })), React33.createElement(Column, { position: "last" }, React33.createElement(SkeletonText, { width: "60%" }))), React33.createElement(Row, null, React33.createElement(Column, { position: "first" }, React33.createElement(SkeletonText, { width: "60%" })), React33.createElement(Column, { position: "second" }, React33.createElement(SkeletonText, { width: "80%" }), React33.createElement(SkeletonText, { width: "30%" })), React33.createElement(Column, { position: "third" }, React33.createElement(SkeletonText, { width: "60%" })), React33.createElement(Column, { position: "last" }, React33.createElement(SkeletonText, { width: "60%" }))), React33.createElement(Row, null, React33.createElement(Column, { position: "first" }, React33.createElement(SkeletonText, { width: "60%" })), React33.createElement(Column, { position: "second" }, React33.createElement(SkeletonText, { width: "80%" }), React33.createElement(SkeletonText, { width: "30%" })), React33.createElement(Column, { position: "third" }, React33.createElement(SkeletonText, { width: "60%" })), React33.createElement(Column, { position: "last" }, React33.createElement(SkeletonText, { width: "60%" }))), React33.createElement(Row, null, React33.createElement(Column, { position: "first" }, React33.createElement(SkeletonText, { width: "60%" })), React33.createElement(Column, { position: "second" }, React33.createElement(SkeletonText, { width: "80%" }), React33.createElement(SkeletonText, { width: "30%" })), React33.createElement(Column, { position: "third" }, React33.createElement(SkeletonText, { width: "60%" })), React33.createElement(Column, { position: "last" }, React33.createElement(SkeletonText, { width: "60%" })))), "Skeleton");
|
|
5960
6070
|
|
|
5961
6071
|
// src/blocks/components/ArgsTable/ArgsTable.tsx
|
|
5962
6072
|
var TableWrapper2 = styled26.table(({ theme, compact, inAddonPanel }) => ({
|
|
@@ -6157,10 +6267,10 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
6157
6267
|
} = props;
|
|
6158
6268
|
if ("error" in props) {
|
|
6159
6269
|
const { error } = props;
|
|
6160
|
-
return
|
|
6270
|
+
return React34.createElement(EmptyBlock, null, error, "\xA0", React34.createElement(Link3, { href: "http://storybook.js.org/docs/?ref=ui", target: "_blank", withArrow: true }, React34.createElement(DocumentIcon2, null), " Read the docs"));
|
|
6161
6271
|
}
|
|
6162
6272
|
if (isLoading) {
|
|
6163
|
-
return
|
|
6273
|
+
return React34.createElement(Skeleton, null);
|
|
6164
6274
|
}
|
|
6165
6275
|
const { rows, args, globals } = "rows" in props ? props : { rows: void 0, args: void 0, globals: void 0 };
|
|
6166
6276
|
const groups = groupRows(
|
|
@@ -6174,7 +6284,7 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
6174
6284
|
const hasNoSections = Object.entries(groups.sections).length === 0;
|
|
6175
6285
|
const hasNoUngroupedSubsections = Object.entries(groups.ungroupedSubsections).length === 0;
|
|
6176
6286
|
if (hasNoUngrouped && hasNoSections && hasNoUngroupedSubsections) {
|
|
6177
|
-
return
|
|
6287
|
+
return React34.createElement(Empty, { inAddonPanel });
|
|
6178
6288
|
}
|
|
6179
6289
|
let colSpan = 1;
|
|
6180
6290
|
if (updateArgs) {
|
|
@@ -6185,15 +6295,15 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
6185
6295
|
}
|
|
6186
6296
|
const expandable = Object.keys(groups.sections).length > 0;
|
|
6187
6297
|
const common = { updateArgs, compact, inAddonPanel, initialExpandedArgs };
|
|
6188
|
-
return
|
|
6298
|
+
return React34.createElement(ResetWrapper3, null, React34.createElement(TablePositionWrapper, null, updateArgs && !isLoading && resetArgs && React34.createElement(ButtonPositionWrapper, null, React34.createElement(
|
|
6189
6299
|
IconButton3,
|
|
6190
6300
|
{
|
|
6191
6301
|
onClick: () => resetArgs(),
|
|
6192
6302
|
"aria-label": "Reset controls",
|
|
6193
6303
|
title: "Reset controls"
|
|
6194
6304
|
},
|
|
6195
|
-
|
|
6196
|
-
)),
|
|
6305
|
+
React34.createElement(UndoIcon, null)
|
|
6306
|
+
)), React34.createElement(TableWrapper2, { ...{ compact, inAddonPanel }, className: "docblock-argstable sb-unstyled" }, React34.createElement("thead", { className: "docblock-argstable-head" }, React34.createElement("tr", null, React34.createElement("th", null, React34.createElement("span", null, "Name")), compact ? null : React34.createElement("th", null, React34.createElement("span", null, "Description")), compact ? null : React34.createElement("th", null, React34.createElement("span", null, "Default")), updateArgs ? React34.createElement("th", null, React34.createElement("span", null, "Control")) : null)), React34.createElement("tbody", { className: "docblock-argstable-body" }, groups.ungrouped.map((row) => React34.createElement(ArgRow, { key: row.key, row, arg: args && args[row.key], ...common })), Object.entries(groups.ungroupedSubsections).map(([subcategory, subsection]) => React34.createElement(
|
|
6197
6307
|
SectionRow,
|
|
6198
6308
|
{
|
|
6199
6309
|
key: subcategory,
|
|
@@ -6201,7 +6311,7 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
6201
6311
|
level: "subsection",
|
|
6202
6312
|
colSpan
|
|
6203
6313
|
},
|
|
6204
|
-
subsection.map((row) =>
|
|
6314
|
+
subsection.map((row) => React34.createElement(
|
|
6205
6315
|
ArgRow,
|
|
6206
6316
|
{
|
|
6207
6317
|
key: row.key,
|
|
@@ -6211,7 +6321,7 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
6211
6321
|
...common
|
|
6212
6322
|
}
|
|
6213
6323
|
))
|
|
6214
|
-
)), Object.entries(groups.sections).map(([category, section]) =>
|
|
6324
|
+
)), Object.entries(groups.sections).map(([category, section]) => React34.createElement(SectionRow, { key: category, label: category, level: "section", colSpan }, section.ungrouped.map((row) => React34.createElement(ArgRow, { key: row.key, row, arg: args && args[row.key], ...common })), Object.entries(section.subsections).map(([subcategory, subsection]) => React34.createElement(
|
|
6215
6325
|
SectionRow,
|
|
6216
6326
|
{
|
|
6217
6327
|
key: subcategory,
|
|
@@ -6219,7 +6329,7 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
6219
6329
|
level: "subsection",
|
|
6220
6330
|
colSpan
|
|
6221
6331
|
},
|
|
6222
|
-
subsection.map((row) =>
|
|
6332
|
+
subsection.map((row) => React34.createElement(
|
|
6223
6333
|
ArgRow,
|
|
6224
6334
|
{
|
|
6225
6335
|
key: row.key,
|
|
@@ -6233,28 +6343,18 @@ var ArgsTable = /* @__PURE__ */ __name((props) => {
|
|
|
6233
6343
|
}, "ArgsTable");
|
|
6234
6344
|
|
|
6235
6345
|
// src/blocks/blocks/Anchor.tsx
|
|
6236
|
-
import
|
|
6346
|
+
import React35 from "react";
|
|
6237
6347
|
var anchorBlockIdFromId = /* @__PURE__ */ __name((storyId) => `anchor--${storyId}`, "anchorBlockIdFromId");
|
|
6238
|
-
var Anchor = /* @__PURE__ */ __name(({ storyId, children }) =>
|
|
6348
|
+
var Anchor = /* @__PURE__ */ __name(({ storyId, children }) => React35.createElement("div", { id: anchorBlockIdFromId(storyId), className: "sb-anchor" }, children), "Anchor");
|
|
6239
6349
|
|
|
6240
6350
|
// src/blocks/blocks/ArgTypes.tsx
|
|
6241
|
-
import
|
|
6351
|
+
import React36 from "react";
|
|
6242
6352
|
import { filterArgTypes } from "storybook/preview-api";
|
|
6243
6353
|
|
|
6244
6354
|
// src/blocks/blocks/useOf.ts
|
|
6245
|
-
import { useContext } from "react";
|
|
6246
|
-
|
|
6247
|
-
// src/blocks/blocks/DocsContext.ts
|
|
6248
|
-
import { createContext as createContext2 } from "react";
|
|
6249
|
-
if (globalThis && globalThis.__DOCS_CONTEXT__ === void 0) {
|
|
6250
|
-
globalThis.__DOCS_CONTEXT__ = createContext2(null);
|
|
6251
|
-
globalThis.__DOCS_CONTEXT__.displayName = "DocsContext";
|
|
6252
|
-
}
|
|
6253
|
-
var DocsContext = globalThis ? globalThis.__DOCS_CONTEXT__ : createContext2(null);
|
|
6254
|
-
|
|
6255
|
-
// src/blocks/blocks/useOf.ts
|
|
6355
|
+
import { useContext as useContext3 } from "react";
|
|
6256
6356
|
var useOf = /* @__PURE__ */ __name((moduleExportOrType, validTypes) => {
|
|
6257
|
-
const context =
|
|
6357
|
+
const context = useContext3(DocsContext);
|
|
6258
6358
|
return context.resolveOf(moduleExportOrType, validTypes);
|
|
6259
6359
|
}, "useOf");
|
|
6260
6360
|
|
|
@@ -6331,7 +6431,7 @@ var ArgTypes = /* @__PURE__ */ __name((props) => {
|
|
|
6331
6431
|
const filteredArgTypes = filterArgTypes(argTypes, include, exclude);
|
|
6332
6432
|
const hasSubcomponents = Boolean(subcomponents) && Object.keys(subcomponents || {}).length > 0;
|
|
6333
6433
|
if (!hasSubcomponents) {
|
|
6334
|
-
return
|
|
6434
|
+
return React36.createElement(ArgsTable, { rows: filteredArgTypes, sort });
|
|
6335
6435
|
}
|
|
6336
6436
|
const mainComponentName = getComponentName(component) || "Main";
|
|
6337
6437
|
const subcomponentTabs = Object.fromEntries(
|
|
@@ -6351,18 +6451,18 @@ var ArgTypes = /* @__PURE__ */ __name((props) => {
|
|
|
6351
6451
|
[mainComponentName]: { rows: filteredArgTypes, sort },
|
|
6352
6452
|
...subcomponentTabs
|
|
6353
6453
|
};
|
|
6354
|
-
return
|
|
6454
|
+
return React36.createElement(TabbedArgsTable, { tabs, sort });
|
|
6355
6455
|
}, "ArgTypes");
|
|
6356
6456
|
|
|
6357
6457
|
// src/blocks/blocks/Canvas.tsx
|
|
6358
|
-
import React39, { useContext as
|
|
6458
|
+
import React39, { useContext as useContext5 } from "react";
|
|
6359
6459
|
|
|
6360
6460
|
// src/blocks/blocks/Source.tsx
|
|
6361
|
-
import
|
|
6461
|
+
import React38, { useContext as useContext4, useMemo as useMemo3 } from "react";
|
|
6362
6462
|
import { SourceType } from "storybook/internal/docs-tools";
|
|
6363
6463
|
|
|
6364
6464
|
// src/blocks/blocks/SourceContainer.tsx
|
|
6365
|
-
import
|
|
6465
|
+
import React37, { createContext as createContext3, useEffect as useEffect11, useState as useState14 } from "react";
|
|
6366
6466
|
import { SNIPPET_RENDERED } from "storybook/internal/docs-tools";
|
|
6367
6467
|
|
|
6368
6468
|
// ../../node_modules/telejson/dist/chunk-EAFQLD22.mjs
|
|
@@ -7902,8 +8002,8 @@ var SourceContainer = /* @__PURE__ */ __name(({
|
|
|
7902
8002
|
children,
|
|
7903
8003
|
channel
|
|
7904
8004
|
}) => {
|
|
7905
|
-
const [sources, setSources] =
|
|
7906
|
-
|
|
8005
|
+
const [sources, setSources] = useState14({});
|
|
8006
|
+
useEffect11(() => {
|
|
7907
8007
|
const handleSnippetRendered = /* @__PURE__ */ __name((idOrEvent, inputSource = null, inputFormat = false) => {
|
|
7908
8008
|
const {
|
|
7909
8009
|
id,
|
|
@@ -7930,15 +8030,15 @@ var SourceContainer = /* @__PURE__ */ __name(({
|
|
|
7930
8030
|
channel.on(SNIPPET_RENDERED, handleSnippetRendered);
|
|
7931
8031
|
return () => channel.off(SNIPPET_RENDERED, handleSnippetRendered);
|
|
7932
8032
|
}, []);
|
|
7933
|
-
return
|
|
8033
|
+
return React37.createElement(SourceContext.Provider, { value: { sources } }, children);
|
|
7934
8034
|
}, "SourceContainer");
|
|
7935
8035
|
|
|
7936
8036
|
// src/blocks/blocks/useTransformCode.tsx
|
|
7937
|
-
import { useEffect as
|
|
8037
|
+
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
7938
8038
|
function useTransformCode(source, transform, storyContext) {
|
|
7939
|
-
const [transformedCode, setTransformedCode] =
|
|
8039
|
+
const [transformedCode, setTransformedCode] = useState15("Transforming...");
|
|
7940
8040
|
const transformed = transform ? transform?.(source, storyContext) : source;
|
|
7941
|
-
|
|
8041
|
+
useEffect12(() => {
|
|
7942
8042
|
async function getTransformedCode() {
|
|
7943
8043
|
const transformResult = await transformed;
|
|
7944
8044
|
if (transformResult !== transformedCode) {
|
|
@@ -8034,106 +8134,16 @@ var useSourceProps = /* @__PURE__ */ __name((props, docsContext, sourceContext)
|
|
|
8034
8134
|
};
|
|
8035
8135
|
}, "useSourceProps");
|
|
8036
8136
|
var Source2 = /* @__PURE__ */ __name((props) => {
|
|
8037
|
-
const sourceContext =
|
|
8038
|
-
const docsContext =
|
|
8137
|
+
const sourceContext = useContext4(SourceContext);
|
|
8138
|
+
const docsContext = useContext4(DocsContext);
|
|
8039
8139
|
const sourceProps = useSourceProps(props, docsContext, sourceContext);
|
|
8040
|
-
return
|
|
8140
|
+
return React38.createElement(Source, { ...sourceProps });
|
|
8041
8141
|
}, "Source");
|
|
8042
8142
|
|
|
8043
|
-
// src/blocks/blocks/Story.tsx
|
|
8044
|
-
import React38, { useContext as useContext3 } from "react";
|
|
8045
|
-
|
|
8046
|
-
// src/blocks/blocks/useStory.ts
|
|
8047
|
-
import { useEffect as useEffect12, useState as useState15 } from "react";
|
|
8048
|
-
function useStory(storyId, context) {
|
|
8049
|
-
const stories = useStories([storyId], context);
|
|
8050
|
-
return stories && stories[0];
|
|
8051
|
-
}
|
|
8052
|
-
__name(useStory, "useStory");
|
|
8053
|
-
function useStories(storyIds, context) {
|
|
8054
|
-
const [storiesById, setStories] = useState15({});
|
|
8055
|
-
useEffect12(() => {
|
|
8056
|
-
Promise.all(
|
|
8057
|
-
storyIds.map(async (storyId) => {
|
|
8058
|
-
const story = await context.loadStory(storyId);
|
|
8059
|
-
setStories(
|
|
8060
|
-
(current) => current[storyId] === story ? current : { ...current, [storyId]: story }
|
|
8061
|
-
);
|
|
8062
|
-
})
|
|
8063
|
-
);
|
|
8064
|
-
});
|
|
8065
|
-
return storyIds.map((storyId) => {
|
|
8066
|
-
if (storiesById[storyId]) {
|
|
8067
|
-
return storiesById[storyId];
|
|
8068
|
-
}
|
|
8069
|
-
try {
|
|
8070
|
-
return context.storyById(storyId);
|
|
8071
|
-
} catch (err) {
|
|
8072
|
-
return void 0;
|
|
8073
|
-
}
|
|
8074
|
-
});
|
|
8075
|
-
}
|
|
8076
|
-
__name(useStories, "useStories");
|
|
8077
|
-
|
|
8078
|
-
// src/blocks/blocks/Story.tsx
|
|
8079
|
-
var getStoryId2 = /* @__PURE__ */ __name((props, context) => {
|
|
8080
|
-
const { of, meta } = props;
|
|
8081
|
-
if ("of" in props && of === void 0) {
|
|
8082
|
-
throw new Error("Unexpected `of={undefined}`, did you mistype a CSF file reference?");
|
|
8083
|
-
}
|
|
8084
|
-
if (meta) {
|
|
8085
|
-
context.referenceMeta(meta, false);
|
|
8086
|
-
}
|
|
8087
|
-
const resolved = context.resolveOf(of || "story", ["story"]);
|
|
8088
|
-
return resolved.story.id;
|
|
8089
|
-
}, "getStoryId");
|
|
8090
|
-
var getStoryProps = /* @__PURE__ */ __name((props, story, context) => {
|
|
8091
|
-
const { parameters = {} } = story || {};
|
|
8092
|
-
const { docs = {} } = parameters;
|
|
8093
|
-
const storyParameters = docs.story || {};
|
|
8094
|
-
if (docs.disable) {
|
|
8095
|
-
return null;
|
|
8096
|
-
}
|
|
8097
|
-
const inline = props.inline ?? storyParameters.inline ?? false;
|
|
8098
|
-
if (inline) {
|
|
8099
|
-
const height2 = props.height ?? storyParameters.height;
|
|
8100
|
-
const autoplay = props.autoplay ?? storyParameters.autoplay ?? false;
|
|
8101
|
-
return {
|
|
8102
|
-
story,
|
|
8103
|
-
inline: true,
|
|
8104
|
-
height: height2,
|
|
8105
|
-
autoplay,
|
|
8106
|
-
forceInitialArgs: !!props.__forceInitialArgs,
|
|
8107
|
-
primary: !!props.__primary,
|
|
8108
|
-
renderStoryToElement: context.renderStoryToElement
|
|
8109
|
-
};
|
|
8110
|
-
}
|
|
8111
|
-
const height = props.height ?? storyParameters.height ?? storyParameters.iframeHeight ?? "100px";
|
|
8112
|
-
return {
|
|
8113
|
-
story,
|
|
8114
|
-
inline: false,
|
|
8115
|
-
height,
|
|
8116
|
-
primary: !!props.__primary
|
|
8117
|
-
};
|
|
8118
|
-
}, "getStoryProps");
|
|
8119
|
-
var Story2 = /* @__PURE__ */ __name((props = { __forceInitialArgs: false, __primary: false }) => {
|
|
8120
|
-
const context = useContext3(DocsContext);
|
|
8121
|
-
const storyId = getStoryId2(props, context);
|
|
8122
|
-
const story = useStory(storyId, context);
|
|
8123
|
-
if (!story) {
|
|
8124
|
-
return React38.createElement(StorySkeleton, null);
|
|
8125
|
-
}
|
|
8126
|
-
const storyProps = getStoryProps(props, story, context);
|
|
8127
|
-
if (!storyProps) {
|
|
8128
|
-
return null;
|
|
8129
|
-
}
|
|
8130
|
-
return React38.createElement(Story, { ...storyProps });
|
|
8131
|
-
}, "Story");
|
|
8132
|
-
|
|
8133
8143
|
// src/blocks/blocks/Canvas.tsx
|
|
8134
8144
|
var Canvas = /* @__PURE__ */ __name((props) => {
|
|
8135
|
-
const docsContext =
|
|
8136
|
-
const sourceContext =
|
|
8145
|
+
const docsContext = useContext5(DocsContext);
|
|
8146
|
+
const sourceContext = useContext5(SourceContext);
|
|
8137
8147
|
const { of, source } = props;
|
|
8138
8148
|
if ("of" in props && of === void 0) {
|
|
8139
8149
|
throw new Error("Unexpected `of={undefined}`, did you mistype a CSF file reference?");
|
|
@@ -8162,7 +8172,7 @@ var Canvas = /* @__PURE__ */ __name((props) => {
|
|
|
8162
8172
|
}, "Canvas");
|
|
8163
8173
|
|
|
8164
8174
|
// src/blocks/blocks/Controls.tsx
|
|
8165
|
-
import React40, { useContext as
|
|
8175
|
+
import React40, { useContext as useContext6 } from "react";
|
|
8166
8176
|
import { filterArgTypes as filterArgTypes2 } from "storybook/preview-api";
|
|
8167
8177
|
|
|
8168
8178
|
// src/blocks/blocks/useArgs.ts
|
|
@@ -8233,7 +8243,7 @@ var Controls3 = /* @__PURE__ */ __name((props) => {
|
|
|
8233
8243
|
if ("of" in props && of === void 0) {
|
|
8234
8244
|
throw new Error("Unexpected `of={undefined}`, did you mistype a CSF file reference?");
|
|
8235
8245
|
}
|
|
8236
|
-
const context =
|
|
8246
|
+
const context = useContext6(DocsContext);
|
|
8237
8247
|
const { story } = context.resolveOf(of || "story", ["story"]);
|
|
8238
8248
|
const { parameters, argTypes, component, subcomponents } = story;
|
|
8239
8249
|
const controlsParameters = parameters.docs?.controls || {};
|
|
@@ -8295,7 +8305,7 @@ import React42 from "react";
|
|
|
8295
8305
|
import { dedent } from "ts-dedent";
|
|
8296
8306
|
|
|
8297
8307
|
// src/blocks/blocks/mdx.tsx
|
|
8298
|
-
import React41, { useContext as
|
|
8308
|
+
import React41, { useContext as useContext7 } from "react";
|
|
8299
8309
|
import { Code, components, nameSpaceClassNames } from "storybook/internal/components";
|
|
8300
8310
|
import { NAVIGATE_URL as NAVIGATE_URL2 } from "storybook/internal/core-events";
|
|
8301
8311
|
import { LinkIcon } from "@storybook/icons";
|
|
@@ -8337,7 +8347,7 @@ function navigate(context, url) {
|
|
|
8337
8347
|
__name(navigate, "navigate");
|
|
8338
8348
|
var A2 = components.a;
|
|
8339
8349
|
var AnchorInPage = /* @__PURE__ */ __name(({ hash, children }) => {
|
|
8340
|
-
const context =
|
|
8350
|
+
const context = useContext7(DocsContext);
|
|
8341
8351
|
return React41.createElement(
|
|
8342
8352
|
A2,
|
|
8343
8353
|
{
|
|
@@ -8356,7 +8366,7 @@ var AnchorInPage = /* @__PURE__ */ __name(({ hash, children }) => {
|
|
|
8356
8366
|
}, "AnchorInPage");
|
|
8357
8367
|
var AnchorMdx = /* @__PURE__ */ __name((props) => {
|
|
8358
8368
|
const { href, target, children, ...rest } = props;
|
|
8359
|
-
const context =
|
|
8369
|
+
const context = useContext7(DocsContext);
|
|
8360
8370
|
if (!href || target === "_blank" || /^https?:\/\//.test(href)) {
|
|
8361
8371
|
return React41.createElement(A2, { ...props });
|
|
8362
8372
|
}
|
|
@@ -8414,7 +8424,7 @@ var HeaderWithOcticonAnchor = /* @__PURE__ */ __name(({
|
|
|
8414
8424
|
children,
|
|
8415
8425
|
...rest
|
|
8416
8426
|
}) => {
|
|
8417
|
-
const context =
|
|
8427
|
+
const context = useContext7(DocsContext);
|
|
8418
8428
|
const OcticonHeader = OcticonHeaders[as];
|
|
8419
8429
|
const hash = `#${id}`;
|
|
8420
8430
|
return React41.createElement(OcticonHeader, { id, ...rest }, React41.createElement(
|
|
@@ -8601,7 +8611,7 @@ var DocsContainer = /* @__PURE__ */ __name(({
|
|
|
8601
8611
|
import React52 from "react";
|
|
8602
8612
|
|
|
8603
8613
|
// src/blocks/blocks/Primary.tsx
|
|
8604
|
-
import React48, { useContext as
|
|
8614
|
+
import React48, { useContext as useContext8 } from "react";
|
|
8605
8615
|
|
|
8606
8616
|
// src/blocks/blocks/DocsStory.tsx
|
|
8607
8617
|
import React47 from "react";
|
|
@@ -8721,13 +8731,13 @@ var Primary = /* @__PURE__ */ __name((props) => {
|
|
|
8721
8731
|
throw new Error("Unexpected `of={undefined}`, did you mistype a CSF file reference?");
|
|
8722
8732
|
}
|
|
8723
8733
|
const { csfFile } = useOf(of || "meta", ["meta"]);
|
|
8724
|
-
const context =
|
|
8734
|
+
const context = useContext8(DocsContext);
|
|
8725
8735
|
const primaryStory = context.componentStoriesFromCSFFile(csfFile)[0];
|
|
8726
8736
|
return primaryStory ? React48.createElement(DocsStory, { of: primaryStory.moduleExport, expanded: false, __primary: true, withToolbar: true }) : null;
|
|
8727
8737
|
}, "Primary");
|
|
8728
8738
|
|
|
8729
8739
|
// src/blocks/blocks/Stories.tsx
|
|
8730
|
-
import React49, { useContext as
|
|
8740
|
+
import React49, { useContext as useContext9 } from "react";
|
|
8731
8741
|
import { styled as styled28 } from "storybook/theming";
|
|
8732
8742
|
var StyledHeading = styled28(Heading2)(({ theme }) => ({
|
|
8733
8743
|
fontSize: `${theme.typography.size.s2 - 1}px`,
|
|
@@ -8744,7 +8754,7 @@ var StyledHeading = styled28(Heading2)(({ theme }) => ({
|
|
|
8744
8754
|
}
|
|
8745
8755
|
}));
|
|
8746
8756
|
var Stories = /* @__PURE__ */ __name(({ title = "Stories", includePrimary = true }) => {
|
|
8747
|
-
const { componentStories, projectAnnotations, getStoryContext } =
|
|
8757
|
+
const { componentStories, projectAnnotations, getStoryContext } = useContext9(DocsContext);
|
|
8748
8758
|
let stories = componentStories();
|
|
8749
8759
|
const { stories: { filter } = { filter: void 0 } } = projectAnnotations.parameters?.docs || {};
|
|
8750
8760
|
if (filter) {
|
|
@@ -8971,9 +8981,9 @@ var ExternalDocsContainer = /* @__PURE__ */ __name(({ projectAnnotations, childr
|
|
|
8971
8981
|
}, "ExternalDocsContainer");
|
|
8972
8982
|
|
|
8973
8983
|
// src/blocks/blocks/Meta.tsx
|
|
8974
|
-
import React56, { useContext as
|
|
8984
|
+
import React56, { useContext as useContext10 } from "react";
|
|
8975
8985
|
var Meta = /* @__PURE__ */ __name(({ of }) => {
|
|
8976
|
-
const context =
|
|
8986
|
+
const context = useContext10(DocsContext);
|
|
8977
8987
|
if (of) {
|
|
8978
8988
|
context.referenceMeta(of, true);
|
|
8979
8989
|
}
|
|
@@ -9053,7 +9063,7 @@ export {
|
|
|
9053
9063
|
format,
|
|
9054
9064
|
formatDate,
|
|
9055
9065
|
formatTime,
|
|
9056
|
-
|
|
9066
|
+
getStoryId,
|
|
9057
9067
|
getStoryProps,
|
|
9058
9068
|
parse2 as parse,
|
|
9059
9069
|
parseDate,
|