@storybook/addon-docs 10.5.0-alpha.0 → 10.5.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_browser-chunks/{Color-23OOGO2C.js → Color-6AOWCN3U.js} +9 -6
- package/dist/_browser-chunks/{DocsRenderer-LL677BLK.js → DocsRenderer-JROSPFPF.js} +1 -1
- package/dist/_browser-chunks/{chunk-S4QKU6I5.js → chunk-6Z2O5XYJ.js} +2 -2
- package/dist/_browser-chunks/chunk-QQBDHPVZ.js +13 -0
- package/dist/_browser-chunks/{chunk-SL3VIQZ3.js → chunk-UAWMPV5J.js} +5 -1
- package/dist/_node-chunks/{chunk-35WYHZTQ.js → chunk-4PS7XBET.js} +198 -198
- package/dist/_node-chunks/{chunk-JOQFTI6P.js → chunk-DVPTS3HN.js} +6 -6
- package/dist/_node-chunks/{chunk-KOSZ4OFX.js → chunk-KLL5RTY5.js} +18 -9
- package/dist/_node-chunks/{chunk-TXD6QBPP.js → chunk-NOY765A3.js} +6 -6
- package/dist/_node-chunks/{mdx-plugin-AGMUJNOQ.js → mdx-plugin-PNWQJL3O.js} +17 -12
- package/dist/_node-chunks/{rehype-external-links-LI2JTKJL.js → rehype-external-links-VWGGYBH3.js} +9 -9
- package/dist/_node-chunks/{rehype-slug-JUQPLQ3T.js → rehype-slug-5IVSCV7M.js} +8 -8
- package/dist/angular/index.js +1 -1
- package/dist/blocks.d.ts +20 -2
- package/dist/blocks.js +786 -325
- package/dist/ember/index.js +1 -1
- package/dist/index.d.ts +25 -2
- package/dist/index.js +2 -2
- package/dist/manager.js +33 -25
- package/dist/mdx-loader.js +10 -10
- package/dist/preset.js +459 -32
- package/dist/preview.js +2 -2
- package/package.json +4 -4
- package/dist/_browser-chunks/chunk-S2IHWCOG.js +0 -13
package/dist/blocks.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getControlId,
|
|
3
3
|
getControlSetterButtonId
|
|
4
|
-
} from "./_browser-chunks/chunk-
|
|
4
|
+
} from "./_browser-chunks/chunk-QQBDHPVZ.js";
|
|
5
5
|
import {
|
|
6
6
|
EmptyBlock,
|
|
7
7
|
Source,
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
curriedTransparentize$1,
|
|
12
12
|
rgba
|
|
13
13
|
} from "./_browser-chunks/chunk-SPXYZZB5.js";
|
|
14
|
-
import "./_browser-chunks/chunk-
|
|
14
|
+
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
|
15
15
|
|
|
16
16
|
// src/blocks/components/ArgsTable/ArgsTable.tsx
|
|
17
|
-
import React23 from "react";
|
|
17
|
+
import React23, { useCallback as useCallback6, useEffect as useEffect8, useRef as useRef5, useState as useState10 } from "react";
|
|
18
18
|
import { once } from "storybook/internal/client-logger";
|
|
19
19
|
import { Button as Button5, Link as Link3, ResetWrapper } from "storybook/internal/components";
|
|
20
20
|
import { includeConditionalArg } from "storybook/internal/csf";
|
|
@@ -189,7 +189,7 @@ var CASE_SPLIT_PATTERN = new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})
|
|
|
189
189
|
import { styled as styled18 } from "storybook/theming";
|
|
190
190
|
|
|
191
191
|
// src/blocks/components/ArgsTable/ArgRow.tsx
|
|
192
|
-
import React19
|
|
192
|
+
import React19 from "react";
|
|
193
193
|
import { codeCommon as codeCommon3 } from "storybook/internal/components";
|
|
194
194
|
|
|
195
195
|
// ../../../node_modules/markdown-to-jsx/dist/index.modern.js
|
|
@@ -569,7 +569,7 @@ var index_modern_default = (n2) => {
|
|
|
569
569
|
};
|
|
570
570
|
|
|
571
571
|
// src/blocks/components/ArgsTable/ArgRow.tsx
|
|
572
|
-
import { styled as styled14 } from "storybook/theming";
|
|
572
|
+
import { srOnlyStyles as srOnlyStyles2, srOnlyUnsetStyles, styled as styled14 } from "storybook/theming";
|
|
573
573
|
|
|
574
574
|
// src/blocks/components/ArgsTable/ArgControl.tsx
|
|
575
575
|
import React16, { useCallback as useCallback5, useEffect as useEffect6, useState as useState6 } from "react";
|
|
@@ -663,11 +663,13 @@ var getBooleanControlStyles = (theme) => ({
|
|
|
663
663
|
}), Label = styled.label(({ theme }) => getBooleanControlStyles(theme)), parse = (value) => value === "true", BooleanControl = ({
|
|
664
664
|
name,
|
|
665
665
|
storyId,
|
|
666
|
+
controlsId,
|
|
666
667
|
value,
|
|
667
668
|
onChange,
|
|
668
669
|
onBlur,
|
|
669
670
|
onFocus,
|
|
670
|
-
argType
|
|
671
|
+
argType,
|
|
672
|
+
required
|
|
671
673
|
}) => {
|
|
672
674
|
let onSetFalse = useCallback(() => onChange(!1), [onChange]), readonly = !!argType?.table?.readonly;
|
|
673
675
|
if (value === void 0)
|
|
@@ -677,13 +679,13 @@ var getBooleanControlStyles = (theme) => ({
|
|
|
677
679
|
ariaLabel: !1,
|
|
678
680
|
variant: "outline",
|
|
679
681
|
size: "medium",
|
|
680
|
-
id: getControlSetterButtonId(name, storyId),
|
|
682
|
+
id: getControlSetterButtonId(name, storyId, controlsId),
|
|
681
683
|
onClick: onSetFalse,
|
|
682
684
|
disabled: readonly
|
|
683
685
|
},
|
|
684
686
|
"Set boolean"
|
|
685
687
|
);
|
|
686
|
-
let controlId = getControlId(name, storyId), parsedValue = typeof value == "string" ? parse(value) : value;
|
|
688
|
+
let controlId = getControlId(name, storyId, controlsId), parsedValue = typeof value == "string" ? parse(value) : value;
|
|
687
689
|
return React.createElement(Label, { "aria-disabled": readonly, htmlFor: controlId, "aria-label": name }, React.createElement(
|
|
688
690
|
"input",
|
|
689
691
|
{
|
|
@@ -693,6 +695,7 @@ var getBooleanControlStyles = (theme) => ({
|
|
|
693
695
|
checked: parsedValue,
|
|
694
696
|
role: "switch",
|
|
695
697
|
disabled: readonly,
|
|
698
|
+
"aria-required": required || void 0,
|
|
696
699
|
name,
|
|
697
700
|
onBlur,
|
|
698
701
|
onFocus
|
|
@@ -741,11 +744,13 @@ var parseDate = (value) => {
|
|
|
741
744
|
}), DateControl = ({
|
|
742
745
|
name,
|
|
743
746
|
storyId,
|
|
747
|
+
controlsId,
|
|
744
748
|
value,
|
|
745
749
|
onChange,
|
|
746
750
|
onFocus,
|
|
747
751
|
onBlur,
|
|
748
|
-
argType
|
|
752
|
+
argType,
|
|
753
|
+
required
|
|
749
754
|
}) => {
|
|
750
755
|
let [valid, setValid] = useState(!0), dateRef = useRef(), timeRef = useRef(), readonly = !!argType?.table?.readonly;
|
|
751
756
|
useEffect(() => {
|
|
@@ -765,7 +770,7 @@ var parseDate = (value) => {
|
|
|
765
770
|
result.setHours(parsed.getHours()), result.setMinutes(parsed.getMinutes());
|
|
766
771
|
let time = result.getTime();
|
|
767
772
|
time && onChange(time), setValid(!!time);
|
|
768
|
-
}, controlId = getControlId(name, storyId);
|
|
773
|
+
}, controlId = getControlId(name, storyId, controlsId);
|
|
769
774
|
return React2.createElement(FlexSpaced, null, React2.createElement("legend", { className: "sb-sr-only" }, name), React2.createElement("label", { htmlFor: `${controlId}-date`, className: "sb-sr-only" }, "Date"), React2.createElement(
|
|
770
775
|
FormInput,
|
|
771
776
|
{
|
|
@@ -775,6 +780,7 @@ var parseDate = (value) => {
|
|
|
775
780
|
id: `${controlId}-date`,
|
|
776
781
|
name: `${controlId}-date`,
|
|
777
782
|
readOnly: readonly,
|
|
783
|
+
"aria-required": required || void 0,
|
|
778
784
|
onChange: onDateChange,
|
|
779
785
|
onFocus,
|
|
780
786
|
onBlur
|
|
@@ -788,6 +794,7 @@ var parseDate = (value) => {
|
|
|
788
794
|
ref: timeRef,
|
|
789
795
|
onChange: onTimeChange,
|
|
790
796
|
readOnly: readonly,
|
|
797
|
+
"aria-required": required || void 0,
|
|
791
798
|
onFocus,
|
|
792
799
|
onBlur
|
|
793
800
|
}
|
|
@@ -808,6 +815,7 @@ var Wrapper = styled3.label({
|
|
|
808
815
|
})), NumberControl = ({
|
|
809
816
|
name,
|
|
810
817
|
storyId,
|
|
818
|
+
controlsId,
|
|
811
819
|
value,
|
|
812
820
|
onChange,
|
|
813
821
|
min,
|
|
@@ -815,7 +823,8 @@ var Wrapper = styled3.label({
|
|
|
815
823
|
step,
|
|
816
824
|
onBlur,
|
|
817
825
|
onFocus,
|
|
818
|
-
argType
|
|
826
|
+
argType,
|
|
827
|
+
required
|
|
819
828
|
}) => {
|
|
820
829
|
let [inputValue, setInputValue] = useState2(typeof value == "number" ? value : ""), [forceVisible, setForceVisible] = useState2(!1), [parseError, setParseError] = useState2(null), readonly = !!argType?.table?.readonly, handleChange = useCallback2(
|
|
821
830
|
(event) => {
|
|
@@ -843,7 +852,7 @@ var Wrapper = styled3.label({
|
|
|
843
852
|
ariaLabel: !1,
|
|
844
853
|
variant: "outline",
|
|
845
854
|
size: "medium",
|
|
846
|
-
id: getControlSetterButtonId(name, storyId),
|
|
855
|
+
id: getControlSetterButtonId(name, storyId, controlsId),
|
|
847
856
|
onClick: onForceVisible,
|
|
848
857
|
disabled: readonly
|
|
849
858
|
},
|
|
@@ -852,7 +861,7 @@ var Wrapper = styled3.label({
|
|
|
852
861
|
FormInput2,
|
|
853
862
|
{
|
|
854
863
|
ref: htmlElRef,
|
|
855
|
-
id: getControlId(name, storyId),
|
|
864
|
+
id: getControlId(name, storyId, controlsId),
|
|
856
865
|
type: "number",
|
|
857
866
|
onChange: handleChange,
|
|
858
867
|
size: "flex",
|
|
@@ -860,6 +869,7 @@ var Wrapper = styled3.label({
|
|
|
860
869
|
value: inputValue,
|
|
861
870
|
valid: parseError ? "error" : void 0,
|
|
862
871
|
autoFocus: forceVisible,
|
|
872
|
+
"aria-required": required || void 0,
|
|
863
873
|
readOnly: readonly,
|
|
864
874
|
name,
|
|
865
875
|
min,
|
|
@@ -921,11 +931,13 @@ var Wrapper2 = styled4.fieldset(
|
|
|
921
931
|
})), CheckboxControl = ({
|
|
922
932
|
name,
|
|
923
933
|
storyId,
|
|
934
|
+
controlsId,
|
|
924
935
|
options,
|
|
925
936
|
value,
|
|
926
937
|
onChange,
|
|
927
938
|
isInline,
|
|
928
|
-
argType
|
|
939
|
+
argType,
|
|
940
|
+
required
|
|
929
941
|
}) => {
|
|
930
942
|
if (!options)
|
|
931
943
|
return logger.warn(`Checkbox with no options: ${name}`), React4.createElement(React4.Fragment, null, "-");
|
|
@@ -936,8 +948,8 @@ var Wrapper2 = styled4.fieldset(
|
|
|
936
948
|
useEffect3(() => {
|
|
937
949
|
setSelected(selectedKeys(value || [], options));
|
|
938
950
|
}, [value]);
|
|
939
|
-
let controlId = getControlId(name, storyId);
|
|
940
|
-
return React4.createElement(Wrapper2, { $isInline: isInline }, React4.createElement("legend", { className: "sb-sr-only" }, name), Object.keys(options).map((key, index) => {
|
|
951
|
+
let controlId = getControlId(name, storyId, controlsId);
|
|
952
|
+
return React4.createElement(Wrapper2, { $isInline: isInline }, React4.createElement("legend", { className: "sb-sr-only" }, name, required ? " (required)" : ""), Object.keys(options).map((key, index) => {
|
|
941
953
|
let id = `${controlId}-${index}`;
|
|
942
954
|
return React4.createElement(Label2, { key: id, htmlFor: id, $readOnly: readonly }, React4.createElement(
|
|
943
955
|
"input",
|
|
@@ -993,16 +1005,18 @@ var Wrapper3 = styled5.fieldset(
|
|
|
993
1005
|
})), RadioControl = ({
|
|
994
1006
|
name,
|
|
995
1007
|
storyId,
|
|
1008
|
+
controlsId,
|
|
996
1009
|
options,
|
|
997
1010
|
value,
|
|
998
1011
|
onChange,
|
|
999
1012
|
isInline,
|
|
1000
|
-
argType
|
|
1013
|
+
argType,
|
|
1014
|
+
required
|
|
1001
1015
|
}) => {
|
|
1002
1016
|
if (!options)
|
|
1003
1017
|
return logger2.warn(`Radio with no options: ${name}`), React5.createElement(React5.Fragment, null, "-");
|
|
1004
|
-
let selection = selectedKey(value, options), controlId = getControlId(name, storyId), readonly = !!argType?.table?.readonly;
|
|
1005
|
-
return React5.createElement(Wrapper3, { isInline }, React5.createElement("legend", { className: "sb-sr-only" }, name), Object.keys(options).map((key, index) => {
|
|
1018
|
+
let selection = selectedKey(value, options), controlId = getControlId(name, storyId, controlsId), readonly = !!argType?.table?.readonly;
|
|
1019
|
+
return React5.createElement(Wrapper3, { isInline }, React5.createElement("legend", { className: "sb-sr-only" }, name, required ? " (required)" : ""), Object.keys(options).map((key, index) => {
|
|
1006
1020
|
let id = `${controlId}-${index}`;
|
|
1007
1021
|
return React5.createElement(Label3, { key: id, htmlFor: id, $readOnly: readonly }, React5.createElement(
|
|
1008
1022
|
"input",
|
|
@@ -1095,16 +1109,45 @@ var styleResets = {
|
|
|
1095
1109
|
fill: theme.textMutedColor
|
|
1096
1110
|
}
|
|
1097
1111
|
}
|
|
1098
|
-
})), NO_SELECTION = "Choose option...", SingleSelect = ({
|
|
1112
|
+
})), NO_SELECTION = "Choose option...", SingleSelect = ({
|
|
1113
|
+
name,
|
|
1114
|
+
storyId,
|
|
1115
|
+
controlsId,
|
|
1116
|
+
value,
|
|
1117
|
+
options,
|
|
1118
|
+
onChange,
|
|
1119
|
+
argType,
|
|
1120
|
+
required
|
|
1121
|
+
}) => {
|
|
1099
1122
|
let handleChange = (e2) => {
|
|
1100
1123
|
onChange(options[e2.currentTarget.value]);
|
|
1101
|
-
}, selection = selectedKey(value, options) || NO_SELECTION, controlId = getControlId(name, storyId), readonly = !!argType?.table?.readonly;
|
|
1102
|
-
return React6.createElement(SelectWrapper, null, React6.createElement(ChevronSmallDownIcon, null), React6.createElement("label", { htmlFor: controlId, className: "sb-sr-only" }, name), React6.createElement(
|
|
1103
|
-
|
|
1124
|
+
}, selection = selectedKey(value, options) || NO_SELECTION, controlId = getControlId(name, storyId, controlsId), readonly = !!argType?.table?.readonly;
|
|
1125
|
+
return React6.createElement(SelectWrapper, null, React6.createElement(ChevronSmallDownIcon, null), React6.createElement("label", { htmlFor: controlId, className: "sb-sr-only" }, name), React6.createElement(
|
|
1126
|
+
OptionsSelect,
|
|
1127
|
+
{
|
|
1128
|
+
disabled: readonly,
|
|
1129
|
+
id: controlId,
|
|
1130
|
+
value: selection,
|
|
1131
|
+
onChange: handleChange,
|
|
1132
|
+
"aria-required": required || void 0
|
|
1133
|
+
},
|
|
1134
|
+
React6.createElement("option", { disabled: selection === NO_SELECTION, key: "no-selection" }, NO_SELECTION),
|
|
1135
|
+
Object.keys(options).map((key) => React6.createElement("option", { key, value: key }, key))
|
|
1136
|
+
));
|
|
1137
|
+
}, MultiSelect = ({
|
|
1138
|
+
name,
|
|
1139
|
+
storyId,
|
|
1140
|
+
controlsId,
|
|
1141
|
+
value,
|
|
1142
|
+
options,
|
|
1143
|
+
onChange,
|
|
1144
|
+
argType,
|
|
1145
|
+
required
|
|
1146
|
+
}) => {
|
|
1104
1147
|
let handleChange = (e2) => {
|
|
1105
1148
|
let selection2 = Array.from(e2.currentTarget.options).filter((option) => option.selected).map((option) => option.value);
|
|
1106
1149
|
onChange(selectedValues(selection2, options));
|
|
1107
|
-
}, selection = selectedKeys(value, options), controlId = getControlId(name, storyId), readonly = !!argType?.table?.readonly;
|
|
1150
|
+
}, selection = selectedKeys(value, options), controlId = getControlId(name, storyId, controlsId), readonly = !!argType?.table?.readonly;
|
|
1108
1151
|
return React6.createElement(SelectWrapper, null, React6.createElement("label", { htmlFor: controlId, className: "sb-sr-only" }, name), React6.createElement(
|
|
1109
1152
|
OptionsSelect,
|
|
1110
1153
|
{
|
|
@@ -1112,7 +1155,8 @@ var styleResets = {
|
|
|
1112
1155
|
id: controlId,
|
|
1113
1156
|
multiple: !0,
|
|
1114
1157
|
value: selection,
|
|
1115
|
-
onChange: handleChange
|
|
1158
|
+
onChange: handleChange,
|
|
1159
|
+
"aria-required": required || void 0
|
|
1116
1160
|
},
|
|
1117
1161
|
Object.keys(options).map((key) => React6.createElement("option", { key, value: key }, key))
|
|
1118
1162
|
));
|
|
@@ -1122,7 +1166,10 @@ var styleResets = {
|
|
|
1122
1166
|
};
|
|
1123
1167
|
|
|
1124
1168
|
// src/blocks/controls/options/Options.tsx
|
|
1125
|
-
var normalizeOptions = (options, labels) => Array.isArray(options) ? options.reduce((acc, item) =>
|
|
1169
|
+
var normalizeOptions = (options, labels) => Array.isArray(options) ? options.reduce((acc, item) => {
|
|
1170
|
+
let label = labels != null && !Array.isArray(labels) && typeof labels[item] == "string" ? labels[item] : String(item);
|
|
1171
|
+
return acc[label] = item, acc;
|
|
1172
|
+
}, {}) : options, Controls = {
|
|
1126
1173
|
check: CheckboxControl,
|
|
1127
1174
|
"inline-check": CheckboxControl,
|
|
1128
1175
|
radio: RadioControl,
|
|
@@ -1146,7 +1193,7 @@ var normalizeOptions = (options, labels) => Array.isArray(options) ? options.red
|
|
|
1146
1193
|
import React11, { useCallback as useCallback3, useEffect as useEffect4, useMemo, useRef as useRef3, useState as useState4 } from "react";
|
|
1147
1194
|
import { Button as Button3, Form as Form3, ToggleButton } from "storybook/internal/components";
|
|
1148
1195
|
import { AddIcon, EditIcon, SubtractIcon } from "@storybook/icons";
|
|
1149
|
-
import { styled as styled8
|
|
1196
|
+
import { styled as styled8 } from "storybook/theming";
|
|
1150
1197
|
|
|
1151
1198
|
// src/blocks/controls/react-editable-json-tree/index.tsx
|
|
1152
1199
|
import React10, { Component as Component2 } from "react";
|
|
@@ -2401,8 +2448,16 @@ var { window: globalWindow } = globalThis, Wrapper4 = styled8.div(({ theme }) =>
|
|
|
2401
2448
|
event.currentTarget.dispatchEvent(new globalWindow.KeyboardEvent("keydown", ENTER_EVENT));
|
|
2402
2449
|
}, selectValue = (event) => {
|
|
2403
2450
|
event.currentTarget.select();
|
|
2404
|
-
}, ObjectControl = ({
|
|
2405
|
-
|
|
2451
|
+
}, ObjectControl = ({
|
|
2452
|
+
name,
|
|
2453
|
+
storyId,
|
|
2454
|
+
controlsId,
|
|
2455
|
+
value,
|
|
2456
|
+
onChange,
|
|
2457
|
+
argType,
|
|
2458
|
+
required
|
|
2459
|
+
}) => {
|
|
2460
|
+
let data = useMemo(() => value && cloneDeep(value), [value]), hasData = data != null, [showRaw, setShowRaw] = useState4(!hasData), hadDataRef = useRef3(hasData), [parseError, setParseError] = useState4(null), readonly = !!argType?.table?.readonly, updateRaw = useCallback3(
|
|
2406
2461
|
(raw) => {
|
|
2407
2462
|
try {
|
|
2408
2463
|
raw && onChange(JSON.parse(raw)), setParseError(null);
|
|
@@ -2413,7 +2468,11 @@ var { window: globalWindow } = globalThis, Wrapper4 = styled8.div(({ theme }) =>
|
|
|
2413
2468
|
[onChange]
|
|
2414
2469
|
), [forceVisible, setForceVisible] = useState4(!1), onForceVisible = useCallback3(() => {
|
|
2415
2470
|
onChange({}), setForceVisible(!0);
|
|
2416
|
-
}, [onChange, setForceVisible])
|
|
2471
|
+
}, [onChange, setForceVisible]);
|
|
2472
|
+
useEffect4(() => {
|
|
2473
|
+
!hadDataRef.current && hasData && showRaw && !forceVisible && setShowRaw(!1), hadDataRef.current = hasData;
|
|
2474
|
+
}, [forceVisible, hasData, showRaw]);
|
|
2475
|
+
let htmlElRef = useRef3(null);
|
|
2417
2476
|
useEffect4(() => {
|
|
2418
2477
|
forceVisible && htmlElRef.current && htmlElRef.current.select();
|
|
2419
2478
|
}, [forceVisible]);
|
|
@@ -2424,16 +2483,16 @@ var { window: globalWindow } = globalThis, Wrapper4 = styled8.div(({ theme }) =>
|
|
|
2424
2483
|
{
|
|
2425
2484
|
ariaLabel: !1,
|
|
2426
2485
|
disabled: readonly,
|
|
2427
|
-
id: getControlSetterButtonId(name, storyId),
|
|
2486
|
+
id: getControlSetterButtonId(name, storyId, controlsId),
|
|
2428
2487
|
onClick: onForceVisible
|
|
2429
2488
|
},
|
|
2430
2489
|
"Set object"
|
|
2431
2490
|
);
|
|
2432
|
-
let rawJSONForm = React11.createElement(
|
|
2491
|
+
let rawInputId = getControlId(name, storyId, controlsId), rawJSONForm = React11.createElement(React11.Fragment, null, React11.createElement("label", { htmlFor: rawInputId, className: "sb-sr-only" }, "Edit ", name, " as JSON"), React11.createElement(
|
|
2433
2492
|
RawInput,
|
|
2434
2493
|
{
|
|
2435
2494
|
ref: htmlElRef,
|
|
2436
|
-
id:
|
|
2495
|
+
id: rawInputId,
|
|
2437
2496
|
minRows: 3,
|
|
2438
2497
|
name,
|
|
2439
2498
|
key: jsonString,
|
|
@@ -2442,9 +2501,10 @@ var { window: globalWindow } = globalThis, Wrapper4 = styled8.div(({ theme }) =>
|
|
|
2442
2501
|
placeholder: "Edit JSON string...",
|
|
2443
2502
|
autoFocus: forceVisible,
|
|
2444
2503
|
valid: parseError ? "error" : void 0,
|
|
2445
|
-
readOnly: readonly
|
|
2504
|
+
readOnly: readonly,
|
|
2505
|
+
"aria-required": required || void 0
|
|
2446
2506
|
}
|
|
2447
|
-
), isObjectOrArray = Array.isArray(value) || typeof value == "object" && value?.constructor === Object;
|
|
2507
|
+
)), isObjectOrArray = Array.isArray(value) || typeof value == "object" && value?.constructor === Object;
|
|
2448
2508
|
return React11.createElement(Wrapper4, null, isObjectOrArray && React11.createElement(
|
|
2449
2509
|
RawButton,
|
|
2450
2510
|
{
|
|
@@ -2600,6 +2660,7 @@ function getNumberOfDecimalPlaces(number) {
|
|
|
2600
2660
|
var RangeControl = ({
|
|
2601
2661
|
name,
|
|
2602
2662
|
storyId,
|
|
2663
|
+
controlsId,
|
|
2603
2664
|
value,
|
|
2604
2665
|
onChange,
|
|
2605
2666
|
min = 0,
|
|
@@ -2607,11 +2668,12 @@ var RangeControl = ({
|
|
|
2607
2668
|
step = 1,
|
|
2608
2669
|
onBlur,
|
|
2609
2670
|
onFocus,
|
|
2610
|
-
argType
|
|
2671
|
+
argType,
|
|
2672
|
+
required
|
|
2611
2673
|
}) => {
|
|
2612
2674
|
let handleChange = (event) => {
|
|
2613
2675
|
onChange(parse2(event.target.value));
|
|
2614
|
-
}, hasValue = value !== void 0, numberOFDecimalsPlaces = useMemo2(() => getNumberOfDecimalPlaces(step), [step]), readonly = !!argType?.table?.readonly, controlId = getControlId(name, storyId);
|
|
2676
|
+
}, hasValue = value !== void 0, numberOFDecimalsPlaces = useMemo2(() => getNumberOfDecimalPlaces(step), [step]), readonly = !!argType?.table?.readonly, controlId = getControlId(name, storyId, controlsId);
|
|
2615
2677
|
return React12.createElement(RangeWrapper, { readOnly: readonly }, React12.createElement("label", { htmlFor: controlId, className: "sb-sr-only" }, name), React12.createElement(RangeLabel, null, min), React12.createElement(
|
|
2616
2678
|
RangeInput,
|
|
2617
2679
|
{
|
|
@@ -2619,6 +2681,7 @@ var RangeControl = ({
|
|
|
2619
2681
|
type: "range",
|
|
2620
2682
|
disabled: readonly,
|
|
2621
2683
|
onChange: handleChange,
|
|
2684
|
+
"aria-required": required || void 0,
|
|
2622
2685
|
name,
|
|
2623
2686
|
min,
|
|
2624
2687
|
max,
|
|
@@ -2643,12 +2706,14 @@ var Wrapper5 = styled10.label({
|
|
|
2643
2706
|
})), TextControl = ({
|
|
2644
2707
|
name,
|
|
2645
2708
|
storyId,
|
|
2709
|
+
controlsId,
|
|
2646
2710
|
value,
|
|
2647
2711
|
onChange,
|
|
2648
2712
|
onFocus,
|
|
2649
2713
|
onBlur,
|
|
2650
2714
|
maxLength,
|
|
2651
|
-
argType
|
|
2715
|
+
argType,
|
|
2716
|
+
required
|
|
2652
2717
|
}) => {
|
|
2653
2718
|
let handleChange = (event) => {
|
|
2654
2719
|
onChange(event.target.value);
|
|
@@ -2663,7 +2728,7 @@ var Wrapper5 = styled10.label({
|
|
|
2663
2728
|
variant: "outline",
|
|
2664
2729
|
size: "medium",
|
|
2665
2730
|
disabled: readonly,
|
|
2666
|
-
id: getControlSetterButtonId(name, storyId),
|
|
2731
|
+
id: getControlSetterButtonId(name, storyId, controlsId),
|
|
2667
2732
|
onClick: onForceVisible
|
|
2668
2733
|
},
|
|
2669
2734
|
"Set string"
|
|
@@ -2672,13 +2737,14 @@ var Wrapper5 = styled10.label({
|
|
|
2672
2737
|
return React13.createElement(Wrapper5, null, React13.createElement(
|
|
2673
2738
|
Form4.Textarea,
|
|
2674
2739
|
{
|
|
2675
|
-
id: getControlId(name, storyId),
|
|
2740
|
+
id: getControlId(name, storyId, controlsId),
|
|
2676
2741
|
maxLength,
|
|
2677
2742
|
onChange: handleChange,
|
|
2678
2743
|
disabled: readonly,
|
|
2679
2744
|
size: "flex",
|
|
2680
2745
|
placeholder: "Edit string...",
|
|
2681
2746
|
autoFocus: forceVisible,
|
|
2747
|
+
"aria-required": required || void 0,
|
|
2682
2748
|
valid: isValid ? void 0 : "error",
|
|
2683
2749
|
name,
|
|
2684
2750
|
value: isValid ? value : "",
|
|
@@ -2704,9 +2770,11 @@ var FilesControl = ({
|
|
|
2704
2770
|
onChange,
|
|
2705
2771
|
name,
|
|
2706
2772
|
storyId,
|
|
2773
|
+
controlsId,
|
|
2707
2774
|
accept = "image/*",
|
|
2708
2775
|
value,
|
|
2709
|
-
argType
|
|
2776
|
+
argType,
|
|
2777
|
+
required
|
|
2710
2778
|
}) => {
|
|
2711
2779
|
let inputElement = useRef4(null), readonly = argType?.control?.readOnly;
|
|
2712
2780
|
function handleFileChange(e2) {
|
|
@@ -2718,7 +2786,7 @@ var FilesControl = ({
|
|
|
2718
2786
|
useEffect5(() => {
|
|
2719
2787
|
value == null && inputElement.current && (inputElement.current.value = "");
|
|
2720
2788
|
}, [value, name]);
|
|
2721
|
-
let controlId = getControlId(name, storyId);
|
|
2789
|
+
let controlId = getControlId(name, storyId, controlsId);
|
|
2722
2790
|
return React14.createElement(React14.Fragment, null, React14.createElement("label", { htmlFor: controlId, className: "sb-sr-only" }, name), React14.createElement(
|
|
2723
2791
|
FileInput,
|
|
2724
2792
|
{
|
|
@@ -2730,13 +2798,14 @@ var FilesControl = ({
|
|
|
2730
2798
|
disabled: readonly,
|
|
2731
2799
|
onChange: handleFileChange,
|
|
2732
2800
|
accept,
|
|
2801
|
+
"aria-required": required || void 0,
|
|
2733
2802
|
size: "flex"
|
|
2734
2803
|
}
|
|
2735
2804
|
));
|
|
2736
2805
|
};
|
|
2737
2806
|
|
|
2738
2807
|
// src/blocks/controls/index.tsx
|
|
2739
|
-
var LazyColorControl = lazy(() => import("./_browser-chunks/Color-
|
|
2808
|
+
var LazyColorControl = lazy(() => import("./_browser-chunks/Color-6AOWCN3U.js")), ColorControl = (props) => React15.createElement(Suspense, { fallback: React15.createElement("div", null) }, React15.createElement(LazyColorControl, { ...props }));
|
|
2740
2809
|
|
|
2741
2810
|
// src/blocks/components/ArgsTable/ArgControl.tsx
|
|
2742
2811
|
var Controls2 = {
|
|
@@ -2755,7 +2824,14 @@ var Controls2 = {
|
|
|
2755
2824
|
range: RangeControl,
|
|
2756
2825
|
text: TextControl,
|
|
2757
2826
|
file: FilesControl
|
|
2758
|
-
}, NoControl = () => React16.createElement(React16.Fragment, null, "-"), ArgControl = ({
|
|
2827
|
+
}, NoControl = () => React16.createElement(React16.Fragment, null, "-"), ArgControl = ({
|
|
2828
|
+
row,
|
|
2829
|
+
arg,
|
|
2830
|
+
updateArgs,
|
|
2831
|
+
isRequired,
|
|
2832
|
+
storyId,
|
|
2833
|
+
controlsId
|
|
2834
|
+
}) => {
|
|
2759
2835
|
let { key, control } = row, [isFocused, setFocused] = useState6(!1), [boxedValue, setBoxedValue] = useState6({ value: arg });
|
|
2760
2836
|
useEffect6(() => {
|
|
2761
2837
|
isFocused || setBoxedValue({ value: arg });
|
|
@@ -2764,9 +2840,8 @@ var Controls2 = {
|
|
|
2764
2840
|
(argVal) => (setBoxedValue({ value: argVal }), updateArgs({ [key]: argVal }), argVal),
|
|
2765
2841
|
[updateArgs, key]
|
|
2766
2842
|
), onBlur = useCallback5(() => setFocused(!1), []), onFocus = useCallback5(() => setFocused(!0), []);
|
|
2767
|
-
if (!control || control.disable)
|
|
2768
|
-
|
|
2769
|
-
return isHovered && canBeSetup ? React16.createElement(
|
|
2843
|
+
if (!control || control.disable)
|
|
2844
|
+
return control?.disable !== !0 && row?.type?.name !== "function" ? React16.createElement(React16.Fragment, null, React16.createElement("span", { className: "sbdocs sbdocs-argcontrol-setup" }, React16.createElement(
|
|
2770
2845
|
Link,
|
|
2771
2846
|
{
|
|
2772
2847
|
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
@@ -2774,13 +2849,14 @@ var Controls2 = {
|
|
|
2774
2849
|
withArrow: !0
|
|
2775
2850
|
},
|
|
2776
2851
|
"Setup controls"
|
|
2777
|
-
) : React16.createElement(NoControl, null);
|
|
2778
|
-
}
|
|
2852
|
+
)), React16.createElement("span", { className: "sbdocs sbdocs-argcontrol-placeholder" }, React16.createElement(NoControl, null))) : React16.createElement(NoControl, null);
|
|
2779
2853
|
let props = {
|
|
2780
2854
|
name: key,
|
|
2781
2855
|
storyId,
|
|
2856
|
+
controlsId,
|
|
2782
2857
|
argType: row,
|
|
2783
2858
|
value: boxedValue.value,
|
|
2859
|
+
required: isRequired,
|
|
2784
2860
|
onChange,
|
|
2785
2861
|
onBlur,
|
|
2786
2862
|
onFocus
|
|
@@ -3008,13 +3084,25 @@ var Name = styled14.span({ fontWeight: "bold" }), Required = styled14.span(({ th
|
|
|
3008
3084
|
marginBottom: 12
|
|
3009
3085
|
})), StyledTd = styled14.td(({ expandable }) => ({
|
|
3010
3086
|
paddingLeft: expandable ? "40px !important" : "20px !important"
|
|
3011
|
-
})),
|
|
3012
|
-
|
|
3013
|
-
|
|
3087
|
+
})), StyledTr = styled14.tr({
|
|
3088
|
+
"span.sbdocs-argcontrol-setup": {
|
|
3089
|
+
...srOnlyStyles2
|
|
3090
|
+
},
|
|
3091
|
+
"&:hover, &:focus-within": {
|
|
3092
|
+
"span.sbdocs-argcontrol-setup": {
|
|
3093
|
+
...srOnlyUnsetStyles
|
|
3094
|
+
},
|
|
3095
|
+
"span.sbdocs-argcontrol-placeholder": {
|
|
3096
|
+
...srOnlyStyles2
|
|
3097
|
+
}
|
|
3098
|
+
}
|
|
3099
|
+
}), toSummary = (value) => value && { summary: typeof value == "string" ? value : value.name }, ArgRow = (props) => {
|
|
3100
|
+
let { row, updateArgs, compact: compact2, expandable, initialExpandedArgs, docsLang } = props, { name, description } = row, table = row.table || {}, type = table.type || toSummary(row.type), defaultValue = table.defaultValue || row.defaultValue, required = row.type?.required, hasDescription = description != null && description !== "";
|
|
3101
|
+
return React19.createElement(StyledTr, null, React19.createElement(StyledTd, { expandable: expandable ?? !1 }, React19.createElement(Name, null, name), required ? React19.createElement(Required, { "aria-hidden": !0, title: "Required" }, "*") : null), compact2 ? null : React19.createElement("td", null, hasDescription && React19.createElement(Description, { lang: docsLang }, React19.createElement(index_modern_default, null, description)), table.jsDocTags != null ? React19.createElement(React19.Fragment, null, React19.createElement(TypeWithJsDoc, { hasDescription }, React19.createElement(ArgValue, { value: type, initialExpandedArgs })), React19.createElement(ArgJsDoc, { tags: table.jsDocTags })) : React19.createElement(Type, { hasDescription }, React19.createElement(ArgValue, { value: type, initialExpandedArgs }))), compact2 ? null : React19.createElement("td", null, React19.createElement(ArgValue, { value: defaultValue, initialExpandedArgs })), updateArgs ? React19.createElement("td", null, React19.createElement(ArgControl, { ...props, isRequired: !!required })) : null);
|
|
3014
3102
|
};
|
|
3015
3103
|
|
|
3016
3104
|
// src/blocks/components/ArgsTable/Empty.tsx
|
|
3017
|
-
import React20, { useEffect as useEffect7, useState as
|
|
3105
|
+
import React20, { useEffect as useEffect7, useState as useState8 } from "react";
|
|
3018
3106
|
import { EmptyTabContent, Link as Link2 } from "storybook/internal/components";
|
|
3019
3107
|
import { DocumentIcon } from "@storybook/icons";
|
|
3020
3108
|
import { styled as styled15 } from "storybook/theming";
|
|
@@ -3034,7 +3122,7 @@ var Wrapper6 = styled15.div(({ inAddonPanel, theme }) => ({
|
|
|
3034
3122
|
fontSize: theme.typography.size.s2 - 1,
|
|
3035
3123
|
gap: 25
|
|
3036
3124
|
})), Empty = ({ inAddonPanel }) => {
|
|
3037
|
-
let [isLoading, setIsLoading] =
|
|
3125
|
+
let [isLoading, setIsLoading] = useState8(!0);
|
|
3038
3126
|
return useEffect7(() => {
|
|
3039
3127
|
let load = setTimeout(() => {
|
|
3040
3128
|
setIsLoading(!1);
|
|
@@ -3043,9 +3131,9 @@ var Wrapper6 = styled15.div(({ inAddonPanel, theme }) => ({
|
|
|
3043
3131
|
}, []), isLoading ? null : React20.createElement(Wrapper6, { inAddonPanel }, React20.createElement(
|
|
3044
3132
|
EmptyTabContent,
|
|
3045
3133
|
{
|
|
3046
|
-
title:
|
|
3047
|
-
description: React20.createElement(React20.Fragment, null, "
|
|
3048
|
-
footer: React20.createElement(Links, null,
|
|
3134
|
+
title: "This story has no controls",
|
|
3135
|
+
description: React20.createElement(React20.Fragment, null, "Storybook couldn't find or generate any controls for this story. Define", " ", React20.createElement("code", null, "args"), " or ", React20.createElement("code", null, "argTypes"), ", or configure docgen to let Storybook generate controls automatically."),
|
|
3136
|
+
footer: React20.createElement(Links, null, React20.createElement(
|
|
3049
3137
|
Link2,
|
|
3050
3138
|
{
|
|
3051
3139
|
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
@@ -3054,22 +3142,13 @@ var Wrapper6 = styled15.div(({ inAddonPanel, theme }) => ({
|
|
|
3054
3142
|
},
|
|
3055
3143
|
React20.createElement(DocumentIcon, null),
|
|
3056
3144
|
" Read docs"
|
|
3057
|
-
)), !inAddonPanel && React20.createElement(
|
|
3058
|
-
Link2,
|
|
3059
|
-
{
|
|
3060
|
-
href: "https://storybook.js.org/docs/essentials/controls?ref=ui",
|
|
3061
|
-
target: "_blank",
|
|
3062
|
-
withArrow: !0
|
|
3063
|
-
},
|
|
3064
|
-
React20.createElement(DocumentIcon, null),
|
|
3065
|
-
" Learn how to set that up"
|
|
3066
3145
|
))
|
|
3067
3146
|
}
|
|
3068
3147
|
));
|
|
3069
3148
|
};
|
|
3070
3149
|
|
|
3071
3150
|
// src/blocks/components/ArgsTable/SectionRow.tsx
|
|
3072
|
-
import React21, { useState as
|
|
3151
|
+
import React21, { useState as useState9 } from "react";
|
|
3073
3152
|
import { ChevronDownIcon as ChevronDownIcon2, ChevronRightIcon } from "@storybook/icons";
|
|
3074
3153
|
import { styled as styled16 } from "storybook/theming";
|
|
3075
3154
|
var ExpanderIconDown = styled16(ChevronDownIcon2)(({ theme }) => ({
|
|
@@ -3114,7 +3193,7 @@ var ExpanderIconDown = styled16(ChevronDownIcon2)(({ theme }) => ({
|
|
|
3114
3193
|
background: theme.background.app
|
|
3115
3194
|
})), StyledTd2 = styled16.td({
|
|
3116
3195
|
position: "relative"
|
|
3117
|
-
}),
|
|
3196
|
+
}), StyledTr2 = styled16.tr(({ theme }) => ({
|
|
3118
3197
|
"&:hover > td": {
|
|
3119
3198
|
backgroundColor: `${curriedLighten$1(5e-3, theme.background.app)} !important`,
|
|
3120
3199
|
boxShadow: `${theme.color.mediumlight} 0 - 1px 0 0 inset`,
|
|
@@ -3143,8 +3222,8 @@ var ExpanderIconDown = styled16(ChevronDownIcon2)(({ theme }) => ({
|
|
|
3143
3222
|
initialExpanded = !0,
|
|
3144
3223
|
colSpan = 3
|
|
3145
3224
|
}) => {
|
|
3146
|
-
let [expanded, setExpanded] =
|
|
3147
|
-
return React21.createElement(React21.Fragment, null, React21.createElement(
|
|
3225
|
+
let [expanded, setExpanded] = useState9(initialExpanded), Level = level === "subsection" ? Subsection : Section, itemCount = children?.length || 0, caption = level === "subsection" ? `${itemCount} item${itemCount !== 1 ? "s" : ""}` : "", helperText = `${expanded ? "Hide" : "Show"} ${level === "subsection" ? itemCount : label} item${itemCount !== 1 ? "s" : ""}`;
|
|
3226
|
+
return React21.createElement(React21.Fragment, null, React21.createElement(StyledTr2, { title: helperText }, React21.createElement(Level, { colSpan: 1 }, React21.createElement(ClickIntercept, { onClick: (e2) => setExpanded(!expanded), tabIndex: 0 }, helperText), React21.createElement(FlexWrapper, null, expanded ? React21.createElement(ExpanderIconDown, null) : React21.createElement(ExpanderIconRight, null), label)), React21.createElement(StyledTd2, { colSpan: colSpan - 1 }, React21.createElement(
|
|
3148
3227
|
ClickIntercept,
|
|
3149
3228
|
{
|
|
3150
3229
|
onClick: (e2) => setExpanded(!expanded),
|
|
@@ -3403,15 +3482,23 @@ var sortFns = {
|
|
|
3403
3482
|
initialExpandedArgs,
|
|
3404
3483
|
sort = "none",
|
|
3405
3484
|
isLoading,
|
|
3406
|
-
storyId
|
|
3407
|
-
|
|
3485
|
+
storyId,
|
|
3486
|
+
controlsId,
|
|
3487
|
+
docsLang
|
|
3488
|
+
} = props, { rows, args, globals } = "rows" in props ? props : { rows: void 0, args: void 0, globals: void 0 }, isResettingRef = useRef5(!1), [isResetting, setIsResetting] = useState10(!1);
|
|
3489
|
+
useEffect8(() => {
|
|
3490
|
+
isResettingRef.current = !1, setIsResetting(!1);
|
|
3491
|
+
}, [args]);
|
|
3492
|
+
let handleResetClick = useCallback6(() => {
|
|
3493
|
+
!isResettingRef.current && resetArgs && (isResettingRef.current = !0, setIsResetting(!0), resetArgs());
|
|
3494
|
+
}, [resetArgs]);
|
|
3408
3495
|
if ("error" in props) {
|
|
3409
3496
|
let { error } = props;
|
|
3410
3497
|
return React23.createElement(EmptyBlock, null, error, "\xA0", React23.createElement(Link3, { href: "http://storybook.js.org/docs/?ref=ui", target: "_blank", withArrow: !0 }, React23.createElement(DocumentIcon2, null), " Read the docs"));
|
|
3411
3498
|
}
|
|
3412
3499
|
if (isLoading)
|
|
3413
3500
|
return React23.createElement(Skeleton, null);
|
|
3414
|
-
let
|
|
3501
|
+
let groups = groupRows(
|
|
3415
3502
|
pickBy(
|
|
3416
3503
|
rows || {},
|
|
3417
3504
|
(row) => !row?.table?.disable && safeIncludeConditionalArg(row, args || {}, globals || {})
|
|
@@ -3422,14 +3509,23 @@ var sortFns = {
|
|
|
3422
3509
|
return React23.createElement(Empty, { inAddonPanel });
|
|
3423
3510
|
let colSpan = 1;
|
|
3424
3511
|
updateArgs && (colSpan += 1), compact2 || (colSpan += 2);
|
|
3425
|
-
let expandable = Object.keys(groups.sections).length > 0, common = {
|
|
3512
|
+
let expandable = Object.keys(groups.sections).length > 0, common = {
|
|
3513
|
+
updateArgs,
|
|
3514
|
+
compact: compact2,
|
|
3515
|
+
inAddonPanel,
|
|
3516
|
+
initialExpandedArgs,
|
|
3517
|
+
storyId,
|
|
3518
|
+
controlsId
|
|
3519
|
+
};
|
|
3426
3520
|
return React23.createElement(ResetWrapper, null, React23.createElement(TablePositionWrapper, null, updateArgs && !isLoading && resetArgs && React23.createElement(ButtonPositionWrapper, null, React23.createElement(
|
|
3427
3521
|
StyledButton,
|
|
3428
3522
|
{
|
|
3429
3523
|
variant: "ghost",
|
|
3430
3524
|
padding: "small",
|
|
3431
|
-
onClick:
|
|
3432
|
-
|
|
3525
|
+
onClick: handleResetClick,
|
|
3526
|
+
disabled: isResetting,
|
|
3527
|
+
ariaLabel: isResetting ? "Resetting controls..." : "Reset controls",
|
|
3528
|
+
lang: "en"
|
|
3433
3529
|
},
|
|
3434
3530
|
React23.createElement(UndoIcon, null)
|
|
3435
3531
|
)), React23.createElement(
|
|
@@ -3438,10 +3534,20 @@ var sortFns = {
|
|
|
3438
3534
|
compact: compact2,
|
|
3439
3535
|
inAddonPanel,
|
|
3440
3536
|
inTabPanel,
|
|
3441
|
-
className: "docblock-argstable sb-unstyled"
|
|
3537
|
+
className: "docblock-argstable sb-unstyled",
|
|
3538
|
+
lang: "en"
|
|
3442
3539
|
},
|
|
3443
3540
|
React23.createElement("thead", { className: "docblock-argstable-head" }, React23.createElement("tr", null, React23.createElement("th", null, React23.createElement("span", null, "Name")), compact2 ? null : React23.createElement("th", null, React23.createElement("span", null, "Description")), compact2 ? null : React23.createElement("th", null, React23.createElement("span", null, "Default")), updateArgs ? React23.createElement("th", null, React23.createElement("span", null, "Control")) : null)),
|
|
3444
|
-
React23.createElement("tbody", { className: "docblock-argstable-body" }, groups.ungrouped.map((row) => React23.createElement(
|
|
3541
|
+
React23.createElement("tbody", { className: "docblock-argstable-body" }, groups.ungrouped.map((row) => React23.createElement(
|
|
3542
|
+
ArgRow,
|
|
3543
|
+
{
|
|
3544
|
+
key: row.key,
|
|
3545
|
+
row,
|
|
3546
|
+
arg: args && args[row.key],
|
|
3547
|
+
docsLang,
|
|
3548
|
+
...common
|
|
3549
|
+
}
|
|
3550
|
+
)), Object.entries(groups.ungroupedSubsections).map(([subcategory, subsection]) => React23.createElement(
|
|
3445
3551
|
SectionRow,
|
|
3446
3552
|
{
|
|
3447
3553
|
key: subcategory,
|
|
@@ -3549,6 +3655,7 @@ var toGlobalSelector = (element) => `& :where(${element}:not(.sb-anchor, .sb-uns
|
|
|
3549
3655
|
maxWidth: 1e3,
|
|
3550
3656
|
width: "100%",
|
|
3551
3657
|
minWidth: 0,
|
|
3658
|
+
flex: 1,
|
|
3552
3659
|
[toGlobalSelector("a")]: {
|
|
3553
3660
|
...reset,
|
|
3554
3661
|
fontSize: "inherit",
|
|
@@ -3867,15 +3974,15 @@ var toGlobalSelector = (element) => `& :where(${element}:not(.sb-anchor, .sb-uns
|
|
|
3867
3974
|
display: "flex",
|
|
3868
3975
|
flexDirection: "row-reverse",
|
|
3869
3976
|
justifyContent: "center",
|
|
3870
|
-
padding: "4rem
|
|
3977
|
+
padding: "4rem 40px",
|
|
3871
3978
|
minHeight: "100vh",
|
|
3872
3979
|
boxSizing: "border-box",
|
|
3873
3980
|
gap: "3rem",
|
|
3874
3981
|
[`@media (min-width: ${breakpoint}px)`]: {}
|
|
3875
|
-
})), DocsPageWrapper = ({ children, toc }) => React24.createElement(DocsWrapper, { className: "sbdocs sbdocs-wrapper" }, toc, React24.createElement(DocsContent, { className: "sbdocs sbdocs-content" }, children));
|
|
3982
|
+
})), DocsPageWrapper = ({ children, toc, lang = "en" }) => React24.createElement(DocsWrapper, { className: "sbdocs sbdocs-wrapper" }, toc, React24.createElement(DocsContent, { className: "sbdocs sbdocs-content", lang }, children));
|
|
3876
3983
|
|
|
3877
3984
|
// src/blocks/components/Preview.tsx
|
|
3878
|
-
import React30, { Children, useCallback as
|
|
3985
|
+
import React30, { Children, useCallback as useCallback7, useContext as useContext2, useMemo as useMemo3, useState as useState13 } from "react";
|
|
3879
3986
|
import { logger as logger4 } from "storybook/internal/client-logger";
|
|
3880
3987
|
import { Bar, Button as Button7, ToggleButton as ToggleButton2, Zoom } from "storybook/internal/components";
|
|
3881
3988
|
import { CopyIcon, MarkupIcon } from "@storybook/icons";
|
|
@@ -4205,14 +4312,14 @@ import React26, { useContext } from "react";
|
|
|
4205
4312
|
import { InvalidBlockOfPropError } from "storybook/internal/preview-errors";
|
|
4206
4313
|
|
|
4207
4314
|
// src/blocks/blocks/useStory.ts
|
|
4208
|
-
import { useEffect as
|
|
4315
|
+
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
4209
4316
|
function useStory(storyId, context) {
|
|
4210
4317
|
let stories = useStories([storyId], context);
|
|
4211
4318
|
return stories && stories[0];
|
|
4212
4319
|
}
|
|
4213
4320
|
function useStories(storyIds, context) {
|
|
4214
4321
|
let [storiesById, setStories] = useState11({});
|
|
4215
|
-
return
|
|
4322
|
+
return useEffect9(() => {
|
|
4216
4323
|
Promise.all(
|
|
4217
4324
|
storyIds.map(async (storyId) => {
|
|
4218
4325
|
let story = await context.loadStory(storyId);
|
|
@@ -4235,7 +4342,7 @@ function useStories(storyIds, context) {
|
|
|
4235
4342
|
// src/blocks/blocks/with-mdx-component-override.tsx
|
|
4236
4343
|
import React25 from "react";
|
|
4237
4344
|
import { useMDXComponents } from "@mdx-js/react";
|
|
4238
|
-
var MDX_WRAPPED_BLOCK = Symbol("mdxWrappedBlock"), MdxWrappedBlockContext = React25.createContext(null), withMdxComponentOverride = (blockName, Block) => {
|
|
4345
|
+
var MDX_WRAPPED_BLOCK = /* @__PURE__ */ Symbol("mdxWrappedBlock"), MdxWrappedBlockContext = React25.createContext(null), withMdxComponentOverride = (blockName, Block) => {
|
|
4239
4346
|
let WrappedBlock = (props) => {
|
|
4240
4347
|
let wrappedBlocks = React25.useContext(MdxWrappedBlockContext), Override = useMDXComponents()[blockName];
|
|
4241
4348
|
if (wrappedBlocks?.has(blockName) || Override === WrappedBlock)
|
|
@@ -4295,7 +4402,7 @@ var getBlockBackgroundStyle = (theme) => ({
|
|
|
4295
4402
|
});
|
|
4296
4403
|
|
|
4297
4404
|
// src/blocks/components/Story.tsx
|
|
4298
|
-
import React28, { useEffect as
|
|
4405
|
+
import React28, { useEffect as useEffect10, useRef as useRef6, useState as useState12 } from "react";
|
|
4299
4406
|
import { ErrorFormatter, Loader } from "storybook/internal/components";
|
|
4300
4407
|
import { styled as styled20 } from "storybook/theming";
|
|
4301
4408
|
|
|
@@ -4354,8 +4461,8 @@ var ZoomContext = createContext2({
|
|
|
4354
4461
|
|
|
4355
4462
|
// src/blocks/components/Story.tsx
|
|
4356
4463
|
var storyBlockIdFromId = ({ story, primary }) => `story--${story.id}${primary ? "--primary" : ""}`, InlineStory = (props) => {
|
|
4357
|
-
let storyRef =
|
|
4358
|
-
return
|
|
4464
|
+
let storyRef = useRef6(), [showLoader, setShowLoader] = useState12(!0), [error, setError] = useState12(), { story, height, autoplay, forceInitialArgs, renderStoryToElement } = props;
|
|
4465
|
+
return useEffect10(() => {
|
|
4359
4466
|
if (!(story && storyRef.current))
|
|
4360
4467
|
return () => {
|
|
4361
4468
|
};
|
|
@@ -4375,7 +4482,15 @@ var storyBlockIdFromId = ({ story, primary }) => `story--${story.id}${primary ?
|
|
|
4375
4482
|
};
|
|
4376
4483
|
}, [autoplay, renderStoryToElement, story]), error ? React28.createElement("pre", null, React28.createElement(ErrorFormatter, { error })) : React28.createElement(React28.Fragment, null, height ? React28.createElement("style", null, `#${storyBlockIdFromId(
|
|
4377
4484
|
props
|
|
4378
|
-
)} { min-height: ${height}; transform: translateZ(0); overflow: auto }`) : null, showLoader && React28.createElement(StorySkeleton, null), React28.createElement(
|
|
4485
|
+
)} { min-height: ${height}; transform: translateZ(0); overflow: auto }`) : null, showLoader && React28.createElement(StorySkeleton, null), React28.createElement(
|
|
4486
|
+
"div",
|
|
4487
|
+
{
|
|
4488
|
+
ref: storyRef,
|
|
4489
|
+
id: `${storyBlockIdFromId(props)}-inner`,
|
|
4490
|
+
"data-name": story.name,
|
|
4491
|
+
lang: story.parameters?.htmlLang || "en"
|
|
4492
|
+
}
|
|
4493
|
+
));
|
|
4379
4494
|
}, IFrameStory = ({ story, height = "500px" }) => React28.createElement("div", { style: { width: "100%", height } }, React28.createElement(ZoomContext.Consumer, null, ({ scale }) => React28.createElement(
|
|
4380
4495
|
IFrame,
|
|
4381
4496
|
{
|
|
@@ -4429,63 +4544,72 @@ var AbsoluteBar = styled21(SharedToolbar)({
|
|
|
4429
4544
|
resetZoom,
|
|
4430
4545
|
onReloadStory,
|
|
4431
4546
|
...rest
|
|
4432
|
-
}) => React29.createElement(
|
|
4433
|
-
|
|
4547
|
+
}) => React29.createElement(
|
|
4548
|
+
AbsoluteBar,
|
|
4434
4549
|
{
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
onClick: onReloadStory,
|
|
4439
|
-
ariaLabel: "Reload story"
|
|
4550
|
+
innerStyle: { gap: 4, paddingInline: 7, justifyContent: "space-between" },
|
|
4551
|
+
lang: "en",
|
|
4552
|
+
...rest
|
|
4440
4553
|
},
|
|
4441
|
-
React29.createElement(
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
e2.preventDefault(), zoom(0.8);
|
|
4554
|
+
React29.createElement(Wrapper7, { key: "left" }, isLoading ? [1, 2, 3].map((key) => React29.createElement(IconPlaceholder, { key })) : React29.createElement(React29.Fragment, null, onReloadStory && React29.createElement(
|
|
4555
|
+
Button6,
|
|
4556
|
+
{
|
|
4557
|
+
padding: "small",
|
|
4558
|
+
variant: "ghost",
|
|
4559
|
+
key: "reload",
|
|
4560
|
+
onClick: onReloadStory,
|
|
4561
|
+
ariaLabel: "Reload story"
|
|
4450
4562
|
},
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4563
|
+
React29.createElement(SyncIcon, null)
|
|
4564
|
+
), React29.createElement(
|
|
4565
|
+
Button6,
|
|
4566
|
+
{
|
|
4567
|
+
padding: "small",
|
|
4568
|
+
variant: "ghost",
|
|
4569
|
+
key: "zoomin",
|
|
4570
|
+
onClick: (e2) => {
|
|
4571
|
+
e2.preventDefault(), zoom(0.8);
|
|
4572
|
+
},
|
|
4573
|
+
ariaLabel: "Zoom in"
|
|
4462
4574
|
},
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4575
|
+
React29.createElement(ZoomIcon, null)
|
|
4576
|
+
), React29.createElement(
|
|
4577
|
+
Button6,
|
|
4578
|
+
{
|
|
4579
|
+
padding: "small",
|
|
4580
|
+
variant: "ghost",
|
|
4581
|
+
key: "zoomout",
|
|
4582
|
+
onClick: (e2) => {
|
|
4583
|
+
e2.preventDefault(), zoom(1.25);
|
|
4584
|
+
},
|
|
4585
|
+
ariaLabel: "Zoom out"
|
|
4474
4586
|
},
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
)))
|
|
4587
|
+
React29.createElement(ZoomOutIcon, null)
|
|
4588
|
+
), React29.createElement(
|
|
4589
|
+
Button6,
|
|
4590
|
+
{
|
|
4591
|
+
padding: "small",
|
|
4592
|
+
variant: "ghost",
|
|
4593
|
+
key: "zoomreset",
|
|
4594
|
+
onClick: (e2) => {
|
|
4595
|
+
e2.preventDefault(), resetZoom();
|
|
4596
|
+
},
|
|
4597
|
+
ariaLabel: "Reset zoom"
|
|
4598
|
+
},
|
|
4599
|
+
React29.createElement(ZoomResetIcon, null)
|
|
4600
|
+
))),
|
|
4601
|
+
isLoading ? React29.createElement(Wrapper7, { key: "right" }, React29.createElement(IconPlaceholder, null)) : storyId && React29.createElement(Wrapper7, { key: "right" }, React29.createElement(
|
|
4602
|
+
Button6,
|
|
4603
|
+
{
|
|
4604
|
+
asChild: !0,
|
|
4605
|
+
padding: "small",
|
|
4606
|
+
variant: "ghost",
|
|
4607
|
+
key: "opener",
|
|
4608
|
+
ariaLabel: "Open canvas in new tab"
|
|
4609
|
+
},
|
|
4610
|
+
React29.createElement("a", { href: getStoryHref(storyId), target: "_blank", rel: "noopener noreferrer" }, React29.createElement(ShareAltIcon, null))
|
|
4611
|
+
))
|
|
4612
|
+
);
|
|
4489
4613
|
|
|
4490
4614
|
// src/blocks/components/Preview.tsx
|
|
4491
4615
|
var ChildrenContainer = styled22.div(
|
|
@@ -4577,10 +4701,10 @@ var PositionedToolbar = styled22(Toolbar)({
|
|
|
4577
4701
|
let [expanded, setExpanded] = useState13(isExpanded), [copied, setCopied] = useState13(null), [scale, setScale] = useState13(1), additionalActionItems = useMemo3(
|
|
4578
4702
|
() => additionalActions ? [...additionalActions] : [],
|
|
4579
4703
|
[additionalActions]
|
|
4580
|
-
), sourceId = $bdb11010cef70236$export$f680877a34711e37(), previewClasses = [className].concat(["sbdocs", "sbdocs-preview", "sb-unstyled"]), context = useContext2(DocsContext), copyToClipboard =
|
|
4704
|
+
), sourceId = $bdb11010cef70236$export$f680877a34711e37(), previewClasses = [className].concat(["sbdocs", "sbdocs-preview", "sb-unstyled"]), context = useContext2(DocsContext), copyToClipboard = useCallback7(async (text) => {
|
|
4581
4705
|
let { createCopyToClipboardFunction } = await import("storybook/internal/components");
|
|
4582
4706
|
await createCopyToClipboardFunction()(text);
|
|
4583
|
-
}, []), handleCopyCode =
|
|
4707
|
+
}, []), handleCopyCode = useCallback7(async () => {
|
|
4584
4708
|
try {
|
|
4585
4709
|
await copyToClipboard(withSource?.code ?? ""), setCopied("Copied!");
|
|
4586
4710
|
} catch (err) {
|
|
@@ -4622,6 +4746,7 @@ var PositionedToolbar = styled22(Toolbar)({
|
|
|
4622
4746
|
), (withSource || additionalActionItems.length > 0) && React30.createElement(ActionBar, { className: "sbdocs sbdocs-preview-actions", innerStyle: { paddingInline: 0 } }, hasSourceError && React30.createElement(
|
|
4623
4747
|
Button7,
|
|
4624
4748
|
{
|
|
4749
|
+
lang: "en",
|
|
4625
4750
|
ariaLabel: !1,
|
|
4626
4751
|
disabled: !0,
|
|
4627
4752
|
variant: "ghost",
|
|
@@ -4632,6 +4757,7 @@ var PositionedToolbar = styled22(Toolbar)({
|
|
|
4632
4757
|
), hasValidSource && React30.createElement(React30.Fragment, null, React30.createElement(
|
|
4633
4758
|
ToggleButton2,
|
|
4634
4759
|
{
|
|
4760
|
+
lang: "en",
|
|
4635
4761
|
ariaLabel: !1,
|
|
4636
4762
|
pressed: expanded,
|
|
4637
4763
|
"aria-expanded": expanded,
|
|
@@ -4643,17 +4769,20 @@ var PositionedToolbar = styled22(Toolbar)({
|
|
|
4643
4769
|
React30.createElement(MarkupIcon, null),
|
|
4644
4770
|
" ",
|
|
4645
4771
|
expanded ? "Hide code" : "Show code"
|
|
4646
|
-
), React30.createElement(Button7, { ariaLabel: !1, variant: "ghost", onClick: handleCopyCode }, React30.createElement(CopyIcon, null), " ", copied ?? "Copy code")), additionalActionItems.map(
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4772
|
+
), React30.createElement(Button7, { lang: "en", ariaLabel: !1, variant: "ghost", onClick: handleCopyCode }, React30.createElement(CopyIcon, null), " ", copied ?? "Copy code")), additionalActionItems.map(
|
|
4773
|
+
({ title, ariaLabel, className: className2, onClick, disabled }, index) => React30.createElement(
|
|
4774
|
+
Button7,
|
|
4775
|
+
{
|
|
4776
|
+
key: index,
|
|
4777
|
+
ariaLabel: ariaLabel ?? !1,
|
|
4778
|
+
className: className2,
|
|
4779
|
+
onClick,
|
|
4780
|
+
disabled: !!disabled,
|
|
4781
|
+
variant: "ghost"
|
|
4782
|
+
},
|
|
4783
|
+
title
|
|
4784
|
+
)
|
|
4785
|
+
)));
|
|
4657
4786
|
}, StyledPreview = styled22(Preview)(() => ({
|
|
4658
4787
|
".docs-story": {
|
|
4659
4788
|
paddingTop: 32,
|
|
@@ -4671,14 +4800,14 @@ var StyledTabsView = styled23(TabsView)({
|
|
|
4671
4800
|
let entries = Object.entries(tabs);
|
|
4672
4801
|
if (entries.length === 1)
|
|
4673
4802
|
return React31.createElement(ArgsTable, { ...entries[0][1], ...props });
|
|
4674
|
-
let tabsFromEntries = entries.map(([label, table], index) =>
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
}
|
|
4681
|
-
})
|
|
4803
|
+
let tabsFromEntries = entries.map(([label, table], index) => {
|
|
4804
|
+
let argsTableProps = index === 0 ? props : { sort: props.sort, docsLang: props.docsLang };
|
|
4805
|
+
return {
|
|
4806
|
+
id: `prop_table_div_${label}`,
|
|
4807
|
+
title: label,
|
|
4808
|
+
children: React31.createElement(ArgsTable, { inTabPanel: !0, ...table, ...argsTableProps })
|
|
4809
|
+
};
|
|
4810
|
+
});
|
|
4682
4811
|
return React31.createElement(StyledTabsView, { tabs: tabsFromEntries });
|
|
4683
4812
|
};
|
|
4684
4813
|
|
|
@@ -4869,7 +4998,7 @@ var ItemLabel = styled26.div(({ theme }) => ({
|
|
|
4869
4998
|
}), IconItem = ({ name, children }) => React34.createElement(Item2, null, React34.createElement(ItemSpecimen, null, children), React34.createElement(ItemLabel, null, name)), IconGallery = ({ children, ...props }) => React34.createElement(ResetWrapper3, null, React34.createElement(List2, { ...props, className: "docblock-icongallery sb-unstyled" }, children));
|
|
4870
4999
|
|
|
4871
5000
|
// src/blocks/components/TableOfContents.tsx
|
|
4872
|
-
import React35, { useEffect as
|
|
5001
|
+
import React35, { useEffect as useEffect11 } from "react";
|
|
4873
5002
|
import { NAVIGATE_URL } from "storybook/internal/core-events";
|
|
4874
5003
|
import { styled as styled27 } from "storybook/theming";
|
|
4875
5004
|
|
|
@@ -5457,7 +5586,16 @@ var Aside = styled27.aside(() => ({
|
|
|
5457
5586
|
color: theme.color.defaultText,
|
|
5458
5587
|
textTransform: "uppercase",
|
|
5459
5588
|
marginBottom: 10
|
|
5460
|
-
})), Title2 = ({ headingId, title }) => typeof title == "string" || !title ? React35.createElement(
|
|
5589
|
+
})), Title2 = ({ headingId, title }) => typeof title == "string" || !title ? React35.createElement(
|
|
5590
|
+
Heading,
|
|
5591
|
+
{
|
|
5592
|
+
as: "h2",
|
|
5593
|
+
id: headingId,
|
|
5594
|
+
className: title ? "" : "sb-sr-only",
|
|
5595
|
+
lang: title ? void 0 : "en"
|
|
5596
|
+
},
|
|
5597
|
+
title || "Table of contents"
|
|
5598
|
+
) : React35.createElement("div", { id: headingId }, title), TableOfContents = ({
|
|
5461
5599
|
title,
|
|
5462
5600
|
disable,
|
|
5463
5601
|
headingSelector,
|
|
@@ -5467,7 +5605,7 @@ var Aside = styled27.aside(() => ({
|
|
|
5467
5605
|
channel,
|
|
5468
5606
|
className
|
|
5469
5607
|
}) => {
|
|
5470
|
-
|
|
5608
|
+
useEffect11(() => {
|
|
5471
5609
|
if (disable)
|
|
5472
5610
|
return () => {
|
|
5473
5611
|
};
|
|
@@ -5502,10 +5640,110 @@ import React36 from "react";
|
|
|
5502
5640
|
var anchorBlockIdFromId = (storyId) => `anchor--${storyId}`, Anchor = ({ storyId, children }) => React36.createElement("div", { id: anchorBlockIdFromId(storyId), className: "sb-anchor" }, children);
|
|
5503
5641
|
|
|
5504
5642
|
// src/blocks/blocks/ArgTypes.tsx
|
|
5505
|
-
import React37 from "react";
|
|
5643
|
+
import React37, { useContext as useContext4 } from "react";
|
|
5506
5644
|
import { InvalidBlockOfPropError as InvalidBlockOfPropError2 } from "storybook/internal/preview-errors";
|
|
5507
5645
|
import { filterArgTypes } from "storybook/preview-api";
|
|
5508
5646
|
|
|
5647
|
+
// src/blocks/blocks/argTypesShared.ts
|
|
5648
|
+
import {
|
|
5649
|
+
getServiceSubcomponentArgTypes,
|
|
5650
|
+
mergeServiceArgTypes
|
|
5651
|
+
} from "storybook/internal/docs-tools";
|
|
5652
|
+
|
|
5653
|
+
// src/blocks/blocks/use-service-docgen.ts
|
|
5654
|
+
import { getService } from "storybook/preview-api";
|
|
5655
|
+
|
|
5656
|
+
// src/blocks/blocks/use-query-subscription.ts
|
|
5657
|
+
import { useCallback as useCallback8, useRef as useRef7 } from "react";
|
|
5658
|
+
import { seedQueryState } from "storybook/open-service";
|
|
5659
|
+
|
|
5660
|
+
// src/blocks/blocks/useSyncExternalStoreShim.ts
|
|
5661
|
+
import { useEffect as useEffect12, useLayoutEffect, useState as useState14 } from "react";
|
|
5662
|
+
function useSyncExternalStoreShim(subscribe, getSnapshot) {
|
|
5663
|
+
let value = getSnapshot(), [{ inst }, forceUpdate] = useState14({ inst: { value, getSnapshot } });
|
|
5664
|
+
return useLayoutEffect(() => {
|
|
5665
|
+
inst.value = value, inst.getSnapshot = getSnapshot, didSnapshotChange(inst) && forceUpdate({ inst });
|
|
5666
|
+
}, [subscribe, value, getSnapshot]), useEffect12(() => (didSnapshotChange(inst) && forceUpdate({ inst }), subscribe(() => {
|
|
5667
|
+
didSnapshotChange(inst) && forceUpdate({ inst });
|
|
5668
|
+
})), [subscribe]), value;
|
|
5669
|
+
}
|
|
5670
|
+
function didSnapshotChange(inst) {
|
|
5671
|
+
let latestGetSnapshot = inst.getSnapshot, prevValue = inst.value;
|
|
5672
|
+
try {
|
|
5673
|
+
let nextValue = latestGetSnapshot();
|
|
5674
|
+
return !Object.is(prevValue, nextValue);
|
|
5675
|
+
} catch {
|
|
5676
|
+
return !0;
|
|
5677
|
+
}
|
|
5678
|
+
}
|
|
5679
|
+
|
|
5680
|
+
// src/blocks/blocks/use-query-subscription.ts
|
|
5681
|
+
function useQuerySubscription(cacheKey, query, input, selector) {
|
|
5682
|
+
let cache = useRef7(void 0);
|
|
5683
|
+
(cache.current?.key !== cacheKey || cache.current.selector !== selector) && (cache.current = {
|
|
5684
|
+
key: cacheKey,
|
|
5685
|
+
selector,
|
|
5686
|
+
state: selector ? seedQueryState(query, input, selector) : seedQueryState(query, input)
|
|
5687
|
+
});
|
|
5688
|
+
let inputRef = useRef7(input);
|
|
5689
|
+
inputRef.current = input;
|
|
5690
|
+
let subscribe = useCallback8(
|
|
5691
|
+
(listener) => {
|
|
5692
|
+
let onQueryState = (state) => {
|
|
5693
|
+
cache.current = { key: cacheKey, selector, state }, listener();
|
|
5694
|
+
};
|
|
5695
|
+
return selector ? query.subscribe(inputRef.current, selector, onQueryState) : query.subscribe(inputRef.current, onQueryState);
|
|
5696
|
+
},
|
|
5697
|
+
[query, cacheKey, selector]
|
|
5698
|
+
), getSnapshot = useCallback8(() => cache.current.state, []);
|
|
5699
|
+
return useSyncExternalStoreShim(subscribe, getSnapshot);
|
|
5700
|
+
}
|
|
5701
|
+
|
|
5702
|
+
// src/blocks/blocks/use-service-docgen.ts
|
|
5703
|
+
function useServiceDocgen(id) {
|
|
5704
|
+
let service = getService("core/docgen");
|
|
5705
|
+
return useQuerySubscription(id, service.queries.docgen, { id });
|
|
5706
|
+
}
|
|
5707
|
+
|
|
5708
|
+
// src/blocks/blocks/argTypesShared.ts
|
|
5709
|
+
function extractComponentArgTypes(component, parameters) {
|
|
5710
|
+
let { extractArgTypes } = parameters.docs || {};
|
|
5711
|
+
if (!extractArgTypes)
|
|
5712
|
+
throw new Error("Args unsupported. See Args documentation for your framework." /* ARGS_UNSUPPORTED */);
|
|
5713
|
+
return extractArgTypes(component);
|
|
5714
|
+
}
|
|
5715
|
+
function extractSubcomponentArgTypes(subcomponents, parameters) {
|
|
5716
|
+
return Object.fromEntries(
|
|
5717
|
+
Object.entries(subcomponents || {}).map(([key, comp]) => [
|
|
5718
|
+
key,
|
|
5719
|
+
extractComponentArgTypes(comp, parameters)
|
|
5720
|
+
])
|
|
5721
|
+
);
|
|
5722
|
+
}
|
|
5723
|
+
function useDocgenServiceRows({
|
|
5724
|
+
componentId,
|
|
5725
|
+
storyId,
|
|
5726
|
+
parameters,
|
|
5727
|
+
initialArgs,
|
|
5728
|
+
customArgTypes
|
|
5729
|
+
}) {
|
|
5730
|
+
let { data: servicePayload, isInitialLoading } = useServiceDocgen(componentId);
|
|
5731
|
+
return servicePayload ? {
|
|
5732
|
+
rows: {
|
|
5733
|
+
serviceComponentName: servicePayload.name,
|
|
5734
|
+
mainRows: mergeServiceArgTypes({
|
|
5735
|
+
payload: servicePayload,
|
|
5736
|
+
storyId: storyId ?? componentId,
|
|
5737
|
+
parameters,
|
|
5738
|
+
initialArgs,
|
|
5739
|
+
customArgTypes
|
|
5740
|
+
}),
|
|
5741
|
+
subcomponentRows: getServiceSubcomponentArgTypes(servicePayload)
|
|
5742
|
+
},
|
|
5743
|
+
isInitialLoading
|
|
5744
|
+
} : { rows: null, isInitialLoading };
|
|
5745
|
+
}
|
|
5746
|
+
|
|
5509
5747
|
// src/blocks/blocks/useOf.ts
|
|
5510
5748
|
import { useContext as useContext3 } from "react";
|
|
5511
5749
|
var useOf = (moduleExportOrType, validTypes) => useContext3(DocsContext).resolveOf(moduleExportOrType, validTypes);
|
|
@@ -5524,73 +5762,120 @@ function scrollToElement(element, block = "start") {
|
|
|
5524
5762
|
}
|
|
5525
5763
|
|
|
5526
5764
|
// src/blocks/blocks/ArgTypes.tsx
|
|
5527
|
-
function
|
|
5528
|
-
let {
|
|
5529
|
-
if (
|
|
5530
|
-
throw new
|
|
5531
|
-
|
|
5532
|
-
}
|
|
5533
|
-
function getArgTypesFromResolved(resolved) {
|
|
5765
|
+
function useResolveArgTypes(props) {
|
|
5766
|
+
let { of } = props;
|
|
5767
|
+
if ("of" in props && of === void 0)
|
|
5768
|
+
throw new InvalidBlockOfPropError2();
|
|
5769
|
+
let context = useContext4(DocsContext), resolved = useOf(of || "meta"), resolvedArgTypes;
|
|
5534
5770
|
if (resolved.type === "component") {
|
|
5535
5771
|
let {
|
|
5536
|
-
component
|
|
5537
|
-
projectAnnotations: { parameters
|
|
5772
|
+
component,
|
|
5773
|
+
projectAnnotations: { parameters }
|
|
5538
5774
|
} = resolved;
|
|
5539
|
-
|
|
5540
|
-
|
|
5541
|
-
|
|
5542
|
-
component
|
|
5775
|
+
resolvedArgTypes = {
|
|
5776
|
+
parameters,
|
|
5777
|
+
// Bare `of={Component}` has no story/meta annotations; the docgen service is addressed by
|
|
5778
|
+
// component id, recovered from the CSF file that declares this component.
|
|
5779
|
+
componentId: context.getComponentId(component),
|
|
5780
|
+
argTypes: extractComponentArgTypes(component, parameters),
|
|
5781
|
+
component
|
|
5782
|
+
};
|
|
5783
|
+
} else if (resolved.type === "meta") {
|
|
5784
|
+
let { id, argTypes, parameters, initialArgs, component, subcomponents } = resolved.preparedMeta;
|
|
5785
|
+
resolvedArgTypes = {
|
|
5786
|
+
parameters,
|
|
5787
|
+
componentId: id.split("--")[0],
|
|
5788
|
+
initialArgs,
|
|
5789
|
+
argTypes,
|
|
5790
|
+
component,
|
|
5791
|
+
subcomponents
|
|
5792
|
+
};
|
|
5793
|
+
} else {
|
|
5794
|
+
let { id, argTypes, parameters, initialArgs, component, subcomponents } = resolved.story;
|
|
5795
|
+
resolvedArgTypes = {
|
|
5796
|
+
parameters,
|
|
5797
|
+
componentId: id.split("--")[0],
|
|
5798
|
+
storyId: id,
|
|
5799
|
+
initialArgs,
|
|
5800
|
+
argTypes,
|
|
5801
|
+
component,
|
|
5802
|
+
subcomponents
|
|
5543
5803
|
};
|
|
5544
5804
|
}
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
}
|
|
5554
|
-
return { argTypes, parameters, component, subcomponents };
|
|
5805
|
+
let argTypesParameters = resolvedArgTypes.parameters?.docs?.argTypes || {};
|
|
5806
|
+
return {
|
|
5807
|
+
...resolvedArgTypes,
|
|
5808
|
+
filterProps: {
|
|
5809
|
+
include: props.include ?? argTypesParameters.include,
|
|
5810
|
+
exclude: props.exclude ?? argTypesParameters.exclude,
|
|
5811
|
+
sort: props.sort ?? argTypesParameters.sort
|
|
5812
|
+
}
|
|
5813
|
+
};
|
|
5555
5814
|
}
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5568
|
-
|
|
5569
|
-
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5815
|
+
function renderArgTypesTables({
|
|
5816
|
+
mainName = "Main",
|
|
5817
|
+
mainRows,
|
|
5818
|
+
subcomponentRows,
|
|
5819
|
+
include,
|
|
5820
|
+
exclude,
|
|
5821
|
+
sort,
|
|
5822
|
+
docsLang
|
|
5823
|
+
}) {
|
|
5824
|
+
let filteredMainRows = filterArgTypes(mainRows, include, exclude);
|
|
5825
|
+
if (Object.keys(subcomponentRows).length === 0)
|
|
5826
|
+
return React37.createElement(ArgsTable, { rows: filteredMainRows, sort, docsLang });
|
|
5827
|
+
let tabs = {
|
|
5828
|
+
[mainName]: { rows: filteredMainRows, sort },
|
|
5829
|
+
...Object.fromEntries(
|
|
5830
|
+
Object.entries(subcomponentRows).map(([key, rows]) => [
|
|
5831
|
+
key,
|
|
5832
|
+
{
|
|
5833
|
+
rows: filterArgTypes(rows, include, exclude),
|
|
5834
|
+
sort
|
|
5835
|
+
}
|
|
5836
|
+
])
|
|
5837
|
+
)
|
|
5578
5838
|
};
|
|
5579
|
-
return React37.createElement(TabbedArgsTable, { tabs, sort });
|
|
5580
|
-
}
|
|
5839
|
+
return React37.createElement(TabbedArgsTable, { tabs, sort, docsLang });
|
|
5840
|
+
}
|
|
5841
|
+
var LegacyArgTypes = (props) => {
|
|
5842
|
+
let { argTypes, parameters, component, subcomponents, filterProps } = useResolveArgTypes(props);
|
|
5843
|
+
return argTypes ? renderArgTypesTables({
|
|
5844
|
+
mainName: getComponentName(component),
|
|
5845
|
+
mainRows: argTypes,
|
|
5846
|
+
subcomponentRows: extractSubcomponentArgTypes(subcomponents, parameters),
|
|
5847
|
+
docsLang: parameters?.docs?.lang,
|
|
5848
|
+
...filterProps
|
|
5849
|
+
}) : null;
|
|
5850
|
+
}, DocgenServiceArgTypes = (props) => {
|
|
5851
|
+
let { argTypes, parameters, componentId, storyId, initialArgs, filterProps, component } = useResolveArgTypes(props), { rows: serviceRows, isInitialLoading } = useDocgenServiceRows({
|
|
5852
|
+
componentId,
|
|
5853
|
+
storyId,
|
|
5854
|
+
parameters,
|
|
5855
|
+
initialArgs,
|
|
5856
|
+
customArgTypes: argTypes
|
|
5857
|
+
});
|
|
5858
|
+
return isInitialLoading ? React37.createElement(ArgsTable, { isLoading: !0 }) : serviceRows ? renderArgTypesTables({
|
|
5859
|
+
mainName: getComponentName(component) ?? serviceRows.serviceComponentName,
|
|
5860
|
+
mainRows: serviceRows.mainRows,
|
|
5861
|
+
subcomponentRows: serviceRows.subcomponentRows,
|
|
5862
|
+
docsLang: parameters?.docs?.lang,
|
|
5863
|
+
...filterProps
|
|
5864
|
+
}) : null;
|
|
5865
|
+
}, ArgTypesImpl = (props) => globalThis.FEATURES?.experimentalDocgenServer ? React37.createElement(DocgenServiceArgTypes, { ...props }) : React37.createElement(LegacyArgTypes, { ...props }), ArgTypes = withMdxComponentOverride("ArgTypes", ArgTypesImpl);
|
|
5581
5866
|
|
|
5582
5867
|
// src/blocks/blocks/Canvas.tsx
|
|
5583
|
-
import React40, { useCallback as
|
|
5868
|
+
import React40, { useCallback as useCallback10, useContext as useContext6 } from "react";
|
|
5584
5869
|
import { FORCE_REMOUNT } from "storybook/internal/core-events";
|
|
5585
5870
|
import { InvalidBlockOfPropError as InvalidBlockOfPropError4 } from "storybook/internal/preview-errors";
|
|
5586
5871
|
|
|
5587
5872
|
// src/blocks/blocks/Source.tsx
|
|
5588
|
-
import React39, { useContext as
|
|
5873
|
+
import React39, { useContext as useContext5, useMemo as useMemo4 } from "react";
|
|
5589
5874
|
import { SourceType } from "storybook/internal/docs-tools";
|
|
5590
5875
|
import { InvalidBlockOfPropError as InvalidBlockOfPropError3 } from "storybook/internal/preview-errors";
|
|
5591
5876
|
|
|
5592
5877
|
// src/blocks/blocks/SourceContainer.tsx
|
|
5593
|
-
import React38, { createContext as createContext3, useEffect as
|
|
5878
|
+
import React38, { createContext as createContext3, useEffect as useEffect13, useState as useState15 } from "react";
|
|
5594
5879
|
import { SNIPPET_RENDERED } from "storybook/internal/docs-tools";
|
|
5595
5880
|
|
|
5596
5881
|
// ../../../node_modules/telejson/dist/chunk-EAFQLD22.mjs
|
|
@@ -5756,7 +6041,7 @@ var require_es_object_atoms = __commonJS({
|
|
|
5756
6041
|
return !1;
|
|
5757
6042
|
if (typeof Symbol.iterator == "symbol")
|
|
5758
6043
|
return !0;
|
|
5759
|
-
var obj = {}, sym = Symbol("test"), symObj = Object(sym);
|
|
6044
|
+
var obj = {}, sym = /* @__PURE__ */ Symbol("test"), symObj = Object(sym);
|
|
5760
6045
|
if (typeof sym == "string" || Object.prototype.toString.call(sym) !== "[object Symbol]" || Object.prototype.toString.call(symObj) !== "[object Symbol]")
|
|
5761
6046
|
return !1;
|
|
5762
6047
|
var symVal = 42;
|
|
@@ -5784,7 +6069,7 @@ var require_es_object_atoms = __commonJS({
|
|
|
5784
6069
|
"use strict";
|
|
5785
6070
|
var origSymbol = typeof Symbol < "u" && Symbol, hasSymbolSham = require_shams();
|
|
5786
6071
|
module.exports = function() {
|
|
5787
|
-
return typeof origSymbol != "function" || typeof Symbol != "function" || typeof origSymbol("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : hasSymbolSham();
|
|
6072
|
+
return typeof origSymbol != "function" || typeof Symbol != "function" || typeof origSymbol("foo") != "symbol" || typeof /* @__PURE__ */ Symbol("bar") != "symbol" ? !1 : hasSymbolSham();
|
|
5788
6073
|
};
|
|
5789
6074
|
}
|
|
5790
6075
|
}), require_Reflect_getPrototypeOf = __commonJS({
|
|
@@ -6621,8 +6906,8 @@ var SourceContext = createContext3({ sources: {} }), UNKNOWN_ARGS_HASH = "--unkn
|
|
|
6621
6906
|
children,
|
|
6622
6907
|
channel
|
|
6623
6908
|
}) => {
|
|
6624
|
-
let [sources, setSources] =
|
|
6625
|
-
return
|
|
6909
|
+
let [sources, setSources] = useState15({});
|
|
6910
|
+
return useEffect13(() => {
|
|
6626
6911
|
let handleSnippetRendered = (idOrEvent, inputSource = null, inputFormat = !1) => {
|
|
6627
6912
|
let {
|
|
6628
6913
|
id,
|
|
@@ -6646,11 +6931,34 @@ var SourceContext = createContext3({ sources: {} }), UNKNOWN_ARGS_HASH = "--unkn
|
|
|
6646
6931
|
}, []), React38.createElement(SourceContext.Provider, { value: { sources } }, children);
|
|
6647
6932
|
};
|
|
6648
6933
|
|
|
6934
|
+
// src/blocks/blocks/use-service-story-docs.ts
|
|
6935
|
+
import { useCallback as useCallback9 } from "react";
|
|
6936
|
+
import { selectSnippetForStory, selectStoryDoc } from "storybook/open-service";
|
|
6937
|
+
import { getService as getService2 } from "storybook/preview-api";
|
|
6938
|
+
function useServiceStory(storyId, selector) {
|
|
6939
|
+
let componentId = storyId.split("--")[0], service = getService2("core/story-docs"), boundSelector = useCallback9(
|
|
6940
|
+
(payload) => selector(payload, storyId),
|
|
6941
|
+
[selector, storyId]
|
|
6942
|
+
);
|
|
6943
|
+
return useQuerySubscription(
|
|
6944
|
+
storyId,
|
|
6945
|
+
service.queries.storyDocs,
|
|
6946
|
+
{ id: componentId },
|
|
6947
|
+
boundSelector
|
|
6948
|
+
);
|
|
6949
|
+
}
|
|
6950
|
+
function useServiceStoryDoc(storyId) {
|
|
6951
|
+
return useServiceStory(storyId, selectStoryDoc);
|
|
6952
|
+
}
|
|
6953
|
+
function useServiceStorySnippet(storyId) {
|
|
6954
|
+
return useServiceStory(storyId, selectSnippetForStory);
|
|
6955
|
+
}
|
|
6956
|
+
|
|
6649
6957
|
// src/blocks/blocks/useTransformCode.tsx
|
|
6650
|
-
import { useEffect as
|
|
6958
|
+
import { useEffect as useEffect14, useState as useState16 } from "react";
|
|
6651
6959
|
function useTransformCode(source, transform, storyContext) {
|
|
6652
|
-
let [transformedCode, setTransformedCode] =
|
|
6653
|
-
return
|
|
6960
|
+
let [transformedCode, setTransformedCode] = useState16("Transforming..."), transformed = transform ? transform?.(source, storyContext) : source;
|
|
6961
|
+
return useEffect14(() => {
|
|
6654
6962
|
async function getTransformedCode() {
|
|
6655
6963
|
let transformResult = await transformed;
|
|
6656
6964
|
transformResult !== transformedCode && setTransformedCode(transformResult);
|
|
@@ -6665,14 +6973,15 @@ var EMPTY_SOURCE_CONTEXT = { sources: {} }, getStorySource = (storyId, args, sou
|
|
|
6665
6973
|
return sourceMap?.[argsHash(args)] || sourceMap?.[UNKNOWN_ARGS_HASH] || { code: "" };
|
|
6666
6974
|
}, useCode = ({
|
|
6667
6975
|
snippet,
|
|
6976
|
+
serviceSnippet,
|
|
6668
6977
|
storyContext,
|
|
6669
6978
|
typeFromProps,
|
|
6670
6979
|
transformFromProps
|
|
6671
6980
|
}) => {
|
|
6672
|
-
let parameters = storyContext.parameters ?? {}, { __isArgsStory: isArgsStory } = parameters, sourceParameters = parameters.docs?.source || {}, type = typeFromProps || sourceParameters.type || SourceType.AUTO, code = /* if user has explicitly set this as dynamic, use snippet */ type === SourceType.DYNAMIC || // if this is an args story and there's a snippet
|
|
6673
|
-
type === SourceType.AUTO &&
|
|
6981
|
+
let parameters = storyContext.parameters ?? {}, { __isArgsStory: isArgsStory } = parameters, sourceParameters = parameters.docs?.source || {}, type = typeFromProps || sourceParameters.type || SourceType.AUTO, staticSnippet = serviceSnippet || snippet, code = /* if user has explicitly set this as dynamic, use snippet */ type === SourceType.DYNAMIC || // if this is an args story and there's a snippet
|
|
6982
|
+
type === SourceType.AUTO && staticSnippet && isArgsStory ? staticSnippet : sourceParameters.originalSource || "", transformer = transformFromProps ?? sourceParameters.transform, transformedCode = transformer ? useTransformCode(code, transformer, storyContext) : code;
|
|
6674
6983
|
return sourceParameters.code !== void 0 ? sourceParameters.code : transformedCode;
|
|
6675
|
-
}, useSourceProps = (props, docsContext, sourceContext) => {
|
|
6984
|
+
}, useSourceProps = (props, docsContext, sourceContext, serviceSnippet = "") => {
|
|
6676
6985
|
let { of } = props, story = useMemo4(() => {
|
|
6677
6986
|
if (of)
|
|
6678
6987
|
return docsContext.resolveOf(of, ["story"]).story;
|
|
@@ -6682,6 +6991,7 @@ var EMPTY_SOURCE_CONTEXT = { sources: {} }, getStorySource = (storyId, args, sou
|
|
|
6682
6991
|
}
|
|
6683
6992
|
}, [docsContext, of]), storyContext = story ? docsContext.getStoryContext(story) : {}, argsForSource = props.__forceInitialArgs ? storyContext.initialArgs : storyContext.unmappedArgs, source = story ? getStorySource(story.id, argsForSource, sourceContext) : null, transformedCode = useCode({
|
|
6684
6993
|
snippet: source ? source.code : "",
|
|
6994
|
+
serviceSnippet,
|
|
6685
6995
|
storyContext: { ...storyContext, args: argsForSource },
|
|
6686
6996
|
typeFromProps: props.type,
|
|
6687
6997
|
transformFromProps: props.transform
|
|
@@ -6700,20 +7010,41 @@ var EMPTY_SOURCE_CONTEXT = { sources: {} }, getStorySource = (storyId, args, sou
|
|
|
6700
7010
|
language,
|
|
6701
7011
|
dark
|
|
6702
7012
|
});
|
|
7013
|
+
}, SourceWithStoryDocsSnippet = ({ storyId, docsContext, sourceContext, ...props }) => {
|
|
7014
|
+
let serviceSnippet = useServiceStorySnippet(storyId).data ?? "", sourceProps = useSourceProps(props, docsContext, sourceContext, serviceSnippet);
|
|
7015
|
+
return React39.createElement(Source, { ...sourceProps });
|
|
6703
7016
|
}, SourceWithStorySnippet = (props) => {
|
|
6704
|
-
let sourceContext =
|
|
7017
|
+
let { of } = props, sourceContext = useContext5(SourceContext), docsContext = useContext5(DocsContext), story = useMemo4(() => {
|
|
7018
|
+
if (of)
|
|
7019
|
+
return docsContext.resolveOf(of, ["story"]).story;
|
|
7020
|
+
try {
|
|
7021
|
+
return docsContext.storyById();
|
|
7022
|
+
} catch {
|
|
7023
|
+
}
|
|
7024
|
+
}, [docsContext, of]);
|
|
7025
|
+
if (globalThis.FEATURES?.experimentalDocgenServer && story?.id)
|
|
7026
|
+
return React39.createElement(
|
|
7027
|
+
SourceWithStoryDocsSnippet,
|
|
7028
|
+
{
|
|
7029
|
+
...props,
|
|
7030
|
+
docsContext,
|
|
7031
|
+
sourceContext,
|
|
7032
|
+
storyId: story.id
|
|
7033
|
+
}
|
|
7034
|
+
);
|
|
7035
|
+
let sourceProps = useSourceProps(props, docsContext, sourceContext);
|
|
6705
7036
|
return React39.createElement(Source, { ...sourceProps });
|
|
6706
7037
|
}, SourceWithCode = (props) => {
|
|
6707
|
-
let docsContext =
|
|
7038
|
+
let docsContext = useContext5(DocsContext), sourceProps = useSourceProps(props, docsContext, EMPTY_SOURCE_CONTEXT);
|
|
6708
7039
|
return React39.createElement(Source, { ...sourceProps });
|
|
6709
7040
|
}, SourceImpl = (props) => props.code !== void 0 ? React39.createElement(SourceWithCode, { ...props }) : React39.createElement(SourceWithStorySnippet, { ...props }), Source2 = withMdxComponentOverride("Source", SourceImpl);
|
|
6710
7041
|
|
|
6711
7042
|
// src/blocks/blocks/Canvas.tsx
|
|
6712
7043
|
var CanvasImpl = (props) => {
|
|
6713
|
-
let docsContext =
|
|
7044
|
+
let docsContext = useContext6(DocsContext), sourceContext = useContext6(SourceContext), { of, source } = props;
|
|
6714
7045
|
if ("of" in props && of === void 0)
|
|
6715
7046
|
throw new InvalidBlockOfPropError4();
|
|
6716
|
-
let { story } = useOf(of || "story", ["story"]), sourceProps = useSourceProps({ ...source, ...of && { of } }, docsContext, sourceContext), layout = props.layout ?? story.parameters.layout ?? story.parameters.docs?.canvas?.layout ?? "padded", withToolbar = props.withToolbar ?? story.parameters.docs?.canvas?.withToolbar ?? !1, additionalActions = props.additionalActions ?? story.parameters.docs?.canvas?.additionalActions, sourceState = props.sourceState ?? story.parameters.docs?.canvas?.sourceState ?? "hidden", className = props.className ?? story.parameters.docs?.canvas?.className, inline = props.story?.inline ?? story.parameters?.docs?.story?.inline ?? !1, handleReloadStory =
|
|
7047
|
+
let { story } = useOf(of || "story", ["story"]), sourceProps = useSourceProps({ ...source, ...of && { of } }, docsContext, sourceContext), layout = props.layout ?? story.parameters.layout ?? story.parameters.docs?.canvas?.layout ?? "padded", withToolbar = props.withToolbar ?? story.parameters.docs?.canvas?.withToolbar ?? !1, additionalActions = props.additionalActions ?? story.parameters.docs?.canvas?.additionalActions, sourceState = props.sourceState ?? story.parameters.docs?.canvas?.sourceState ?? "hidden", className = props.className ?? story.parameters.docs?.canvas?.className, inline = props.story?.inline ?? story.parameters?.docs?.story?.inline ?? !1, handleReloadStory = useCallback10(() => {
|
|
6717
7048
|
docsContext.channel.emit(FORCE_REMOUNT, { storyId: story.id });
|
|
6718
7049
|
}, [docsContext.channel, story.id]);
|
|
6719
7050
|
return React40.createElement(
|
|
@@ -6733,11 +7064,11 @@ var CanvasImpl = (props) => {
|
|
|
6733
7064
|
}, Canvas = withMdxComponentOverride("Canvas", CanvasImpl);
|
|
6734
7065
|
|
|
6735
7066
|
// src/blocks/blocks/Controls.tsx
|
|
6736
|
-
import React41, { useContext as
|
|
7067
|
+
import React41, { useContext as useContext8 } from "react";
|
|
6737
7068
|
import { filterArgTypes as filterArgTypes2 } from "storybook/preview-api";
|
|
6738
7069
|
|
|
6739
7070
|
// src/blocks/blocks/useArgs.ts
|
|
6740
|
-
import { useCallback as
|
|
7071
|
+
import { useCallback as useCallback11, useEffect as useEffect15, useState as useState17 } from "react";
|
|
6741
7072
|
import {
|
|
6742
7073
|
RESET_STORY_ARGS,
|
|
6743
7074
|
STORY_ARGS_UPDATED,
|
|
@@ -6749,17 +7080,17 @@ var useArgs = (story, context) => {
|
|
|
6749
7080
|
throw new Error("No result when story was defined");
|
|
6750
7081
|
return result;
|
|
6751
7082
|
}, useArgsIfDefined = (story, context) => {
|
|
6752
|
-
let storyContext = story ? context.getStoryContext(story) : { args: {} }, { id: storyId } = story || { id: "none" }, [args, setArgs] =
|
|
6753
|
-
|
|
7083
|
+
let storyContext = story ? context.getStoryContext(story) : { args: {} }, { id: storyId } = story || { id: "none" }, [args, setArgs] = useState17(storyContext.args);
|
|
7084
|
+
useEffect15(() => {
|
|
6754
7085
|
let onArgsUpdated = (changed) => {
|
|
6755
7086
|
changed.storyId === storyId && setArgs(changed.args);
|
|
6756
7087
|
};
|
|
6757
7088
|
return context.channel.on(STORY_ARGS_UPDATED, onArgsUpdated), () => context.channel.off(STORY_ARGS_UPDATED, onArgsUpdated);
|
|
6758
7089
|
}, [storyId, context.channel]);
|
|
6759
|
-
let updateArgs =
|
|
7090
|
+
let updateArgs = useCallback11(
|
|
6760
7091
|
(updatedArgs) => context.channel.emit(UPDATE_STORY_ARGS, { storyId, updatedArgs }),
|
|
6761
7092
|
[storyId, context.channel]
|
|
6762
|
-
), resetArgs =
|
|
7093
|
+
), resetArgs = useCallback11(
|
|
6763
7094
|
(argNames) => context.channel.emit(RESET_STORY_ARGS, { storyId, argNames }),
|
|
6764
7095
|
[storyId, context.channel]
|
|
6765
7096
|
);
|
|
@@ -6767,11 +7098,11 @@ var useArgs = (story, context) => {
|
|
|
6767
7098
|
};
|
|
6768
7099
|
|
|
6769
7100
|
// src/blocks/blocks/useGlobals.ts
|
|
6770
|
-
import { useEffect as
|
|
7101
|
+
import { useEffect as useEffect16, useState as useState18 } from "react";
|
|
6771
7102
|
import { GLOBALS_UPDATED } from "storybook/internal/core-events";
|
|
6772
7103
|
var useGlobals = (story, context) => {
|
|
6773
|
-
let storyContext = context.getStoryContext(story), [globals, setGlobals] =
|
|
6774
|
-
return
|
|
7104
|
+
let storyContext = context.getStoryContext(story), [globals, setGlobals] = useState18(storyContext.globals);
|
|
7105
|
+
return useEffect16(() => {
|
|
6775
7106
|
let onGlobalsUpdated = (changed) => {
|
|
6776
7107
|
setGlobals(changed.globals);
|
|
6777
7108
|
};
|
|
@@ -6780,46 +7111,68 @@ var useGlobals = (story, context) => {
|
|
|
6780
7111
|
};
|
|
6781
7112
|
|
|
6782
7113
|
// src/blocks/blocks/usePrimaryStory.ts
|
|
6783
|
-
import { useContext as
|
|
7114
|
+
import { useContext as useContext7 } from "react";
|
|
6784
7115
|
import { Tag } from "storybook/internal/preview-api";
|
|
6785
|
-
var usePrimaryStory = () =>
|
|
7116
|
+
var usePrimaryStory = () => {
|
|
7117
|
+
let context = useContext7(DocsContext), stories = context.componentStories();
|
|
7118
|
+
return context.filterByAutodocs === !1 ? stories[0] : stories.find((story) => story.tags.includes(Tag.AUTODOCS));
|
|
7119
|
+
};
|
|
6786
7120
|
|
|
6787
7121
|
// src/blocks/blocks/Controls.tsx
|
|
6788
|
-
function
|
|
6789
|
-
let
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
7122
|
+
function getControlsFilterProps(story, props) {
|
|
7123
|
+
let controlsParameters = story.parameters.docs?.controls || {};
|
|
7124
|
+
return {
|
|
7125
|
+
include: props.include ?? controlsParameters.include,
|
|
7126
|
+
exclude: props.exclude ?? controlsParameters.exclude,
|
|
7127
|
+
sort: props.sort ?? controlsParameters.sort
|
|
7128
|
+
};
|
|
6793
7129
|
}
|
|
6794
|
-
|
|
6795
|
-
let
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
7130
|
+
function useControlsInteractiveState(story, context) {
|
|
7131
|
+
let controlsId = $bdb11010cef70236$export$f680877a34711e37(), [args, updateArgs, resetArgs] = useArgs(story, context), [globals] = useGlobals(story, context);
|
|
7132
|
+
return { controlsId, args, globals, updateArgs, resetArgs };
|
|
7133
|
+
}
|
|
7134
|
+
var ControlsTables = ({
|
|
7135
|
+
mainName = "Story",
|
|
7136
|
+
mainRows,
|
|
7137
|
+
subcomponentRows,
|
|
7138
|
+
include,
|
|
7139
|
+
exclude,
|
|
7140
|
+
sort,
|
|
7141
|
+
storyId,
|
|
7142
|
+
controlsId,
|
|
7143
|
+
args,
|
|
7144
|
+
globals,
|
|
7145
|
+
updateArgs,
|
|
7146
|
+
resetArgs,
|
|
7147
|
+
docsLang
|
|
7148
|
+
}) => {
|
|
7149
|
+
let filteredMainRows = filterArgTypes2(mainRows, include, exclude);
|
|
7150
|
+
if (Object.keys(subcomponentRows).length === 0)
|
|
7151
|
+
return Object.keys(filteredMainRows).length > 0 || Object.keys(args).length > 0 ? React41.createElement(
|
|
6801
7152
|
ArgsTable,
|
|
6802
7153
|
{
|
|
6803
|
-
storyId
|
|
6804
|
-
|
|
7154
|
+
storyId,
|
|
7155
|
+
controlsId,
|
|
7156
|
+
rows: filteredMainRows,
|
|
6805
7157
|
sort,
|
|
6806
7158
|
args,
|
|
6807
7159
|
globals,
|
|
6808
7160
|
updateArgs,
|
|
6809
|
-
resetArgs
|
|
7161
|
+
resetArgs,
|
|
7162
|
+
docsLang
|
|
6810
7163
|
}
|
|
6811
7164
|
) : null;
|
|
6812
|
-
let
|
|
6813
|
-
|
|
6814
|
-
|
|
6815
|
-
|
|
6816
|
-
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
7165
|
+
let tabs = {
|
|
7166
|
+
[mainName]: { rows: filteredMainRows, sort },
|
|
7167
|
+
...Object.fromEntries(
|
|
7168
|
+
Object.entries(subcomponentRows).map(([key, rows]) => [
|
|
7169
|
+
key,
|
|
7170
|
+
{
|
|
7171
|
+
rows: filterArgTypes2(rows, include, exclude),
|
|
7172
|
+
sort
|
|
7173
|
+
}
|
|
7174
|
+
])
|
|
7175
|
+
)
|
|
6823
7176
|
};
|
|
6824
7177
|
return React41.createElement(
|
|
6825
7178
|
TabbedArgsTable,
|
|
@@ -6830,13 +7183,55 @@ var ControlsImpl = (props) => {
|
|
|
6830
7183
|
globals,
|
|
6831
7184
|
updateArgs,
|
|
6832
7185
|
resetArgs,
|
|
6833
|
-
storyId
|
|
7186
|
+
storyId,
|
|
7187
|
+
controlsId,
|
|
7188
|
+
docsLang
|
|
6834
7189
|
}
|
|
6835
7190
|
);
|
|
7191
|
+
}, LegacyControls = ({ story, context, ...props }) => {
|
|
7192
|
+
let { parameters, argTypes, component, subcomponents } = story, filterProps = getControlsFilterProps(story, props), interactiveState = useControlsInteractiveState(story, context);
|
|
7193
|
+
return argTypes ? React41.createElement(
|
|
7194
|
+
ControlsTables,
|
|
7195
|
+
{
|
|
7196
|
+
mainName: getComponentName(component) || "Story",
|
|
7197
|
+
mainRows: argTypes,
|
|
7198
|
+
subcomponentRows: extractSubcomponentArgTypes(subcomponents, parameters),
|
|
7199
|
+
...filterProps,
|
|
7200
|
+
storyId: story.id,
|
|
7201
|
+
...interactiveState,
|
|
7202
|
+
docsLang: parameters?.docs?.lang
|
|
7203
|
+
}
|
|
7204
|
+
) : null;
|
|
7205
|
+
}, DocgenServiceControls = ({ story, context, ...props }) => {
|
|
7206
|
+
let { parameters, argTypes, component } = story, filterProps = getControlsFilterProps(story, props), interactiveState = useControlsInteractiveState(story, context), { rows: serviceRows, isInitialLoading } = useDocgenServiceRows({
|
|
7207
|
+
componentId: story.id.split("--")[0],
|
|
7208
|
+
storyId: story.id,
|
|
7209
|
+
parameters,
|
|
7210
|
+
initialArgs: story.initialArgs,
|
|
7211
|
+
customArgTypes: argTypes
|
|
7212
|
+
});
|
|
7213
|
+
return isInitialLoading ? React41.createElement(ArgsTable, { isLoading: !0 }) : serviceRows ? React41.createElement(
|
|
7214
|
+
ControlsTables,
|
|
7215
|
+
{
|
|
7216
|
+
mainName: getComponentName(component) ?? serviceRows.serviceComponentName,
|
|
7217
|
+
mainRows: serviceRows.mainRows,
|
|
7218
|
+
subcomponentRows: serviceRows.subcomponentRows,
|
|
7219
|
+
...filterProps,
|
|
7220
|
+
storyId: story.id,
|
|
7221
|
+
...interactiveState,
|
|
7222
|
+
docsLang: parameters?.docs?.lang
|
|
7223
|
+
}
|
|
7224
|
+
) : null;
|
|
7225
|
+
}, ControlsImpl = (props) => {
|
|
7226
|
+
let { of } = props, context = useContext8(DocsContext), primaryStory = usePrimaryStory(), story = of ? context.resolveOf(of, ["story"]).story : primaryStory;
|
|
7227
|
+
if (!story)
|
|
7228
|
+
return null;
|
|
7229
|
+
let storyProps = { ...props, story, context };
|
|
7230
|
+
return globalThis.FEATURES?.experimentalDocgenServer ? React41.createElement(DocgenServiceControls, { ...storyProps }) : React41.createElement(LegacyControls, { ...storyProps });
|
|
6836
7231
|
}, Controls3 = withMdxComponentOverride("Controls", ControlsImpl);
|
|
6837
7232
|
|
|
6838
7233
|
// src/blocks/blocks/Description.tsx
|
|
6839
|
-
import React44 from "react";
|
|
7234
|
+
import React44, { useContext as useContext10 } from "react";
|
|
6840
7235
|
import { InvalidBlockOfPropError as InvalidBlockOfPropError5 } from "storybook/internal/preview-errors";
|
|
6841
7236
|
|
|
6842
7237
|
// src/blocks/blocks/Markdown.tsx
|
|
@@ -6844,8 +7239,8 @@ import React43 from "react";
|
|
|
6844
7239
|
import { dedent } from "ts-dedent";
|
|
6845
7240
|
|
|
6846
7241
|
// src/blocks/blocks/mdx.tsx
|
|
6847
|
-
import React42, { useContext as
|
|
6848
|
-
import { Code, components, nameSpaceClassNames } from "storybook/internal/components";
|
|
7242
|
+
import React42, { useContext as useContext9 } from "react";
|
|
7243
|
+
import { Button as Button8, Code, components, nameSpaceClassNames } from "storybook/internal/components";
|
|
6849
7244
|
import { NAVIGATE_URL as NAVIGATE_URL2 } from "storybook/internal/core-events";
|
|
6850
7245
|
import { LinkIcon } from "@storybook/icons";
|
|
6851
7246
|
import { styled as styled28 } from "storybook/theming";
|
|
@@ -6878,7 +7273,7 @@ function navigate(context, url) {
|
|
|
6878
7273
|
context.channel.emit(NAVIGATE_URL2, url);
|
|
6879
7274
|
}
|
|
6880
7275
|
var A2 = components.a, AnchorInPage = ({ hash, children }) => {
|
|
6881
|
-
let context =
|
|
7276
|
+
let context = useContext9(DocsContext);
|
|
6882
7277
|
return React42.createElement(
|
|
6883
7278
|
A2,
|
|
6884
7279
|
{
|
|
@@ -6892,7 +7287,7 @@ var A2 = components.a, AnchorInPage = ({ hash, children }) => {
|
|
|
6892
7287
|
children
|
|
6893
7288
|
);
|
|
6894
7289
|
}, AnchorMdx = (props) => {
|
|
6895
|
-
let { href, target, children, ...rest } = props, context =
|
|
7290
|
+
let { href, target, children, ...rest } = props, context = useContext9(DocsContext);
|
|
6896
7291
|
return !href || target === "_blank" || /^https?:\/\//.test(href) ? React42.createElement(A2, { ...props }) : href.startsWith("#") ? React42.createElement(AnchorInPage, { hash: href }, children) : React42.createElement(
|
|
6897
7292
|
A2,
|
|
6898
7293
|
{
|
|
@@ -6908,47 +7303,69 @@ var A2 = components.a, AnchorInPage = ({ hash, children }) => {
|
|
|
6908
7303
|
}, SUPPORTED_MDX_HEADERS = ["h1", "h2", "h3", "h4", "h5", "h6"], OcticonHeaders = SUPPORTED_MDX_HEADERS.reduce(
|
|
6909
7304
|
(acc, headerType) => ({
|
|
6910
7305
|
...acc,
|
|
6911
|
-
[headerType]: styled28(headerType)({
|
|
6912
|
-
"& svg": {
|
|
6913
|
-
position: "relative",
|
|
6914
|
-
top: "-0.1em",
|
|
6915
|
-
visibility: "hidden"
|
|
6916
|
-
},
|
|
6917
|
-
"&:hover svg": {
|
|
6918
|
-
visibility: "visible"
|
|
6919
|
-
}
|
|
6920
|
-
})
|
|
7306
|
+
[headerType]: styled28(headerType)({})
|
|
6921
7307
|
}),
|
|
6922
7308
|
{}
|
|
6923
|
-
),
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
}
|
|
6932
|
-
),
|
|
7309
|
+
), OcticonAlignmentWrapper = styled28.span({
|
|
7310
|
+
display: "block",
|
|
7311
|
+
position: "relative",
|
|
7312
|
+
"& svg": {
|
|
7313
|
+
visibility: "hidden"
|
|
7314
|
+
},
|
|
7315
|
+
"&:hover svg, &:focus-within svg": {
|
|
7316
|
+
visibility: "visible"
|
|
7317
|
+
}
|
|
7318
|
+
}), OcticonAnchorWrapper = styled28.span({
|
|
7319
|
+
// Position the anchor in the heading's left gutter instead of floating it, so the
|
|
7320
|
+
// Button's dimensions never shift the heading text. The parent header is relatively
|
|
7321
|
+
// positioned to anchor this.
|
|
7322
|
+
position: "absolute",
|
|
7323
|
+
top: "50%",
|
|
7324
|
+
right: "100%",
|
|
7325
|
+
lineHeight: "inherit",
|
|
7326
|
+
paddingRight: "8px",
|
|
7327
|
+
// Increase specificity to avoid being overridden by DocsPage based on
|
|
7328
|
+
// CSS block load order.
|
|
7329
|
+
"&&": {
|
|
7330
|
+
marginTop: -14
|
|
7331
|
+
// Half the Button's height to center it vertically
|
|
7332
|
+
},
|
|
7333
|
+
// Allow the theme's text color to override the default link color.
|
|
7334
|
+
color: "inherit",
|
|
7335
|
+
"& a": {
|
|
7336
|
+
color: "inherit",
|
|
7337
|
+
textDecoration: "none"
|
|
7338
|
+
}
|
|
7339
|
+
}), HeaderTitle = styled28.span({
|
|
7340
|
+
// marginInlineStart: -40,
|
|
7341
|
+
}), HeaderWithOcticonAnchor = ({
|
|
6933
7342
|
as,
|
|
6934
7343
|
id,
|
|
6935
7344
|
children,
|
|
6936
7345
|
...rest
|
|
6937
7346
|
}) => {
|
|
6938
|
-
let context =
|
|
6939
|
-
return React42.createElement(OcticonHeader, { id, ...rest }, React42.createElement(
|
|
6940
|
-
|
|
7347
|
+
let context = useContext9(DocsContext), OcticonHeader = OcticonHeaders[as], hash = `#${id}`;
|
|
7348
|
+
return React42.createElement(OcticonHeader, { id, ...rest }, React42.createElement(OcticonAlignmentWrapper, { className: "sb-unstyled" }, React42.createElement(OcticonAnchorWrapper, null, React42.createElement(
|
|
7349
|
+
Button8,
|
|
6941
7350
|
{
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
document2.getElementById(id) && navigate(context, hash);
|
|
6948
|
-
}
|
|
7351
|
+
asChild: !0,
|
|
7352
|
+
variant: "ghost",
|
|
7353
|
+
size: "small",
|
|
7354
|
+
padding: "small",
|
|
7355
|
+
ariaLabel: "Copy heading URL to address bar"
|
|
6949
7356
|
},
|
|
6950
|
-
React42.createElement(
|
|
6951
|
-
|
|
7357
|
+
React42.createElement(
|
|
7358
|
+
"a",
|
|
7359
|
+
{
|
|
7360
|
+
href: hash,
|
|
7361
|
+
target: "_self",
|
|
7362
|
+
onClick: (event) => {
|
|
7363
|
+
event.preventDefault(), document2.getElementById(id) && navigate(context, hash);
|
|
7364
|
+
}
|
|
7365
|
+
},
|
|
7366
|
+
React42.createElement(LinkIcon, null)
|
|
7367
|
+
)
|
|
7368
|
+
)), children));
|
|
6952
7369
|
}, HeaderMdx = (props) => {
|
|
6953
7370
|
let { as, id, children, ...rest } = props;
|
|
6954
7371
|
if (id)
|
|
@@ -7007,16 +7424,18 @@ var MarkdownImpl = (props) => {
|
|
|
7007
7424
|
}, Markdown = withMdxComponentOverride("Markdown", MarkdownImpl);
|
|
7008
7425
|
|
|
7009
7426
|
// src/blocks/blocks/Description.tsx
|
|
7010
|
-
var DescriptionType = /* @__PURE__ */ ((DescriptionType2) => (DescriptionType2.INFO = "info", DescriptionType2.NOTES = "notes", DescriptionType2.DOCGEN = "docgen", DescriptionType2.AUTO = "auto", DescriptionType2))(DescriptionType || {}), getDescriptionFromResolvedOf = (resolvedOf) => {
|
|
7427
|
+
var DescriptionType = /* @__PURE__ */ ((DescriptionType2) => (DescriptionType2.INFO = "info", DescriptionType2.NOTES = "notes", DescriptionType2.DOCGEN = "docgen", DescriptionType2.AUTO = "auto", DescriptionType2))(DescriptionType || {}), getDescriptionFromResolvedOf = (resolvedOf, serviceComponentDescription, storyDocsDescription) => {
|
|
7011
7428
|
switch (resolvedOf.type) {
|
|
7012
|
-
case "story":
|
|
7013
|
-
|
|
7429
|
+
case "story": {
|
|
7430
|
+
let storyDescription = resolvedOf.story.parameters.docs?.description?.story;
|
|
7431
|
+
return storyDescription !== void 0 ? storyDescription : storyDocsDescription ?? null;
|
|
7432
|
+
}
|
|
7014
7433
|
case "meta": {
|
|
7015
7434
|
let { parameters, component } = resolvedOf.preparedMeta, metaDescription = parameters.docs?.description?.component;
|
|
7016
7435
|
return metaDescription || parameters.docs?.extractComponentDescription?.(component, {
|
|
7017
7436
|
component,
|
|
7018
7437
|
parameters
|
|
7019
|
-
}) || null;
|
|
7438
|
+
}) || serviceComponentDescription || null;
|
|
7020
7439
|
}
|
|
7021
7440
|
case "component": {
|
|
7022
7441
|
let {
|
|
@@ -7026,27 +7445,62 @@ var DescriptionType = /* @__PURE__ */ ((DescriptionType2) => (DescriptionType2.I
|
|
|
7026
7445
|
return parameters?.docs?.extractComponentDescription?.(component, {
|
|
7027
7446
|
component,
|
|
7028
7447
|
parameters
|
|
7029
|
-
}) || null;
|
|
7448
|
+
}) || serviceComponentDescription || null;
|
|
7030
7449
|
}
|
|
7031
7450
|
default:
|
|
7032
7451
|
throw new Error(
|
|
7033
7452
|
`Unrecognized module type resolved from 'useOf', got: ${resolvedOf.type}`
|
|
7034
7453
|
);
|
|
7035
7454
|
}
|
|
7455
|
+
}, DescriptionBody = ({ resolvedOf, serviceComponentDescription, lang, storyDocsDescription }) => {
|
|
7456
|
+
let markdown = getDescriptionFromResolvedOf(
|
|
7457
|
+
resolvedOf,
|
|
7458
|
+
serviceComponentDescription,
|
|
7459
|
+
storyDocsDescription
|
|
7460
|
+
);
|
|
7461
|
+
return markdown ? React44.createElement(Markdown, { lang }, markdown) : null;
|
|
7462
|
+
}, DescriptionStoryWithServices = ({ resolvedOf }) => {
|
|
7463
|
+
let storyDocsDescription = useServiceStoryDoc(resolvedOf.story.id).data?.description, lang = resolvedOf.story.parameters.docs?.lang || "en";
|
|
7464
|
+
return React44.createElement(
|
|
7465
|
+
DescriptionBody,
|
|
7466
|
+
{
|
|
7467
|
+
resolvedOf,
|
|
7468
|
+
storyDocsDescription,
|
|
7469
|
+
lang
|
|
7470
|
+
}
|
|
7471
|
+
);
|
|
7472
|
+
}, DescriptionComponentWithServices = ({ resolvedOf, componentId }) => {
|
|
7473
|
+
let serviceComponentDescription = useServiceDocgen(componentId).data?.description || void 0, lang = resolvedOf.type === "meta" ? resolvedOf.preparedMeta.parameters.docs?.lang || "en" : resolvedOf.projectAnnotations.parameters?.docs?.lang || "en";
|
|
7474
|
+
return React44.createElement(
|
|
7475
|
+
DescriptionBody,
|
|
7476
|
+
{
|
|
7477
|
+
resolvedOf,
|
|
7478
|
+
serviceComponentDescription,
|
|
7479
|
+
lang
|
|
7480
|
+
}
|
|
7481
|
+
);
|
|
7036
7482
|
}, DescriptionImpl = (props) => {
|
|
7037
|
-
let { of } = props;
|
|
7483
|
+
let { of } = props, context = useContext10(DocsContext);
|
|
7038
7484
|
if ("of" in props && of === void 0)
|
|
7039
7485
|
throw new InvalidBlockOfPropError5();
|
|
7040
|
-
let resolvedOf = useOf(of || "meta")
|
|
7041
|
-
|
|
7486
|
+
let resolvedOf = useOf(of || "meta");
|
|
7487
|
+
if (globalThis.FEATURES?.experimentalDocgenServer) {
|
|
7488
|
+
if (resolvedOf.type === "story")
|
|
7489
|
+
return React44.createElement(DescriptionStoryWithServices, { resolvedOf });
|
|
7490
|
+
let componentId = resolvedOf.type === "meta" ? resolvedOf.preparedMeta.componentId : context.getComponentId(resolvedOf.component);
|
|
7491
|
+
if (componentId)
|
|
7492
|
+
return React44.createElement(DescriptionComponentWithServices, { resolvedOf, componentId });
|
|
7493
|
+
}
|
|
7494
|
+
let lang = (resolvedOf.type === "story" ? resolvedOf.story.parameters : resolvedOf.type === "meta" ? resolvedOf.preparedMeta.parameters : resolvedOf.projectAnnotations.parameters)?.docs?.lang || "en";
|
|
7495
|
+
return React44.createElement(DescriptionBody, { resolvedOf, lang });
|
|
7042
7496
|
}, Description2 = withMdxComponentOverride("Description", DescriptionImpl);
|
|
7043
7497
|
|
|
7044
7498
|
// src/blocks/blocks/Docs.tsx
|
|
7045
7499
|
import React54 from "react";
|
|
7046
7500
|
|
|
7047
7501
|
// src/blocks/blocks/DocsContainer.tsx
|
|
7048
|
-
import React45, { useEffect as
|
|
7049
|
-
import {
|
|
7502
|
+
import React45, { useEffect as useEffect17, useMemo as useMemo5 } from "react";
|
|
7503
|
+
import { ensure as ensureTheme, ThemeProvider } from "storybook/theming";
|
|
7050
7504
|
|
|
7051
7505
|
// src/blocks/blocks/DocsSluggerContext.ts
|
|
7052
7506
|
import { createContext as createContext4 } from "react";
|
|
@@ -7106,13 +7560,14 @@ var { document: document3, window: globalWindow3 } = globalThis, DocsContainer =
|
|
|
7106
7560
|
theme,
|
|
7107
7561
|
children
|
|
7108
7562
|
}) => {
|
|
7109
|
-
let slugger = useMemo5(() => createDocsSlugger(), []), toc;
|
|
7563
|
+
let slugger = useMemo5(() => createDocsSlugger(), []), toc, lang;
|
|
7110
7564
|
try {
|
|
7111
|
-
|
|
7565
|
+
let metaParameters = context.resolveOf("meta", ["meta"]).preparedMeta.parameters;
|
|
7566
|
+
toc = metaParameters?.docs?.toc, lang = metaParameters?.docs?.lang || "en";
|
|
7112
7567
|
} catch {
|
|
7113
|
-
toc = context?.projectAnnotations?.parameters?.docs?.toc;
|
|
7568
|
+
toc = context?.projectAnnotations?.parameters?.docs?.toc, lang = context?.projectAnnotations?.parameters?.docs?.lang || "en";
|
|
7114
7569
|
}
|
|
7115
|
-
return
|
|
7570
|
+
return useEffect17(() => {
|
|
7116
7571
|
let url;
|
|
7117
7572
|
try {
|
|
7118
7573
|
if (url = new URL(globalWindow3.parent.location.toString()), url.hash) {
|
|
@@ -7126,6 +7581,7 @@ var { document: document3, window: globalWindow3 } = globalThis, DocsContainer =
|
|
|
7126
7581
|
}), React45.createElement(DocsSluggerContext.Provider, { value: slugger }, React45.createElement(DocsContext.Provider, { value: context }, React45.createElement(SourceContainer, { channel: context.channel }, React45.createElement(ThemeProvider, { theme: ensureTheme(theme) }, React45.createElement(
|
|
7127
7582
|
DocsPageWrapper,
|
|
7128
7583
|
{
|
|
7584
|
+
lang,
|
|
7129
7585
|
toc: toc ? React45.createElement(
|
|
7130
7586
|
TableOfContents,
|
|
7131
7587
|
{
|
|
@@ -7201,7 +7657,7 @@ var PrimaryImpl = () => {
|
|
|
7201
7657
|
}, Primary = withMdxComponentOverride("Primary", PrimaryImpl);
|
|
7202
7658
|
|
|
7203
7659
|
// src/blocks/blocks/Stories.tsx
|
|
7204
|
-
import React50, { useContext as
|
|
7660
|
+
import React50, { useContext as useContext11 } from "react";
|
|
7205
7661
|
import { Tag as Tag2 } from "storybook/internal/preview-api";
|
|
7206
7662
|
import { styled as styled29 } from "storybook/theming";
|
|
7207
7663
|
var StyledHeading = styled29(Heading2)(({ theme }) => ({
|
|
@@ -7218,7 +7674,7 @@ var StyledHeading = styled29(Heading2)(({ theme }) => ({
|
|
|
7218
7674
|
marginTop: "56px"
|
|
7219
7675
|
}
|
|
7220
7676
|
})), StoriesImpl = ({ title = "Stories", includePrimary = !0 }) => {
|
|
7221
|
-
let { componentStories, projectAnnotations, getStoryContext } =
|
|
7677
|
+
let { componentStories, projectAnnotations, getStoryContext } = useContext11(DocsContext), stories = componentStories(), filter = projectAnnotations.parameters?.docs?.stories?.filter;
|
|
7222
7678
|
return filter && (stories = stories.filter((story) => filter(story, getStoryContext(story)))), stories.some((story) => story.tags?.includes(Tag2.AUTODOCS)) && (stories = stories.filter((story) => story.tags?.includes(Tag2.AUTODOCS) && !story.usesMount)), includePrimary || (stories = stories.slice(1)), !stories || stories.length === 0 ? null : React50.createElement(React50.Fragment, null, typeof title == "string" ? React50.createElement(StyledHeading, null, title) : title, stories.map(
|
|
7223
7679
|
(story) => story && React50.createElement(DocsStory, { key: story.id, of: story.moduleExport, expanded: !0, __forceInitialArgs: !0 })
|
|
7224
7680
|
));
|
|
@@ -7284,7 +7740,8 @@ function Docs({
|
|
|
7284
7740
|
}
|
|
7285
7741
|
|
|
7286
7742
|
// src/blocks/blocks/external/ExternalDocs.tsx
|
|
7287
|
-
import React55, { useRef as
|
|
7743
|
+
import React55, { useRef as useRef8 } from "react";
|
|
7744
|
+
import { deprecate as deprecate2 } from "storybook/internal/client-logger";
|
|
7288
7745
|
import { composeConfigs as composeConfigs2 } from "storybook/preview-api";
|
|
7289
7746
|
|
|
7290
7747
|
// src/blocks/blocks/external/ExternalPreview.ts
|
|
@@ -7309,6 +7766,7 @@ var ExternalDocsContext = class extends DocsContext2 {
|
|
|
7309
7766
|
let csfFile = this.processMetaExports(metaExports);
|
|
7310
7767
|
this.referenceCSFFile(csfFile), super.referenceMeta(metaExports, attach);
|
|
7311
7768
|
};
|
|
7769
|
+
this.filterByAutodocs = !1;
|
|
7312
7770
|
}
|
|
7313
7771
|
};
|
|
7314
7772
|
|
|
@@ -7365,13 +7823,14 @@ var ConstantMap = class {
|
|
|
7365
7823
|
|
|
7366
7824
|
// src/blocks/blocks/external/ExternalDocs.tsx
|
|
7367
7825
|
function usePreview(projectAnnotations) {
|
|
7368
|
-
let previewRef =
|
|
7826
|
+
let previewRef = useRef8();
|
|
7369
7827
|
return previewRef.current || (previewRef.current = new ExternalPreview(projectAnnotations)), previewRef.current;
|
|
7370
7828
|
}
|
|
7371
7829
|
function ExternalDocs({
|
|
7372
7830
|
projectAnnotationsList,
|
|
7373
7831
|
children
|
|
7374
7832
|
}) {
|
|
7833
|
+
deprecate2("ExternalDocs is deprecated and will be removed in Storybook 11.");
|
|
7375
7834
|
let projectAnnotations = composeConfigs2(projectAnnotationsList), preview2 = usePreview(projectAnnotations), docsParameter = {
|
|
7376
7835
|
...projectAnnotations.parameters?.docs,
|
|
7377
7836
|
page: () => children
|
|
@@ -7381,13 +7840,14 @@ function ExternalDocs({
|
|
|
7381
7840
|
|
|
7382
7841
|
// src/blocks/blocks/external/ExternalDocsContainer.tsx
|
|
7383
7842
|
import React56 from "react";
|
|
7843
|
+
import { deprecate as deprecate3 } from "storybook/internal/client-logger";
|
|
7384
7844
|
import { ThemeProvider as ThemeProvider2, ensure, themes } from "storybook/theming";
|
|
7385
|
-
var preview, ExternalDocsContainer = ({ projectAnnotations, children }) => (preview || (preview = new ExternalPreview(projectAnnotations)), React56.createElement(DocsContext.Provider, { value: preview.docsContext() }, React56.createElement(ThemeProvider2, { theme: ensure(themes.light) }, children)));
|
|
7845
|
+
var preview, ExternalDocsContainer = ({ projectAnnotations, children }) => (deprecate3("ExternalDocsContainer is deprecated and will be removed in Storybook 11."), preview || (preview = new ExternalPreview(projectAnnotations)), React56.createElement(DocsContext.Provider, { value: preview.docsContext() }, React56.createElement(ThemeProvider2, { theme: ensure(themes.light) }, children)));
|
|
7386
7846
|
|
|
7387
7847
|
// src/blocks/blocks/Meta.tsx
|
|
7388
|
-
import React57, { useContext as
|
|
7848
|
+
import React57, { useContext as useContext12 } from "react";
|
|
7389
7849
|
var Meta = ({ of }) => {
|
|
7390
|
-
let context =
|
|
7850
|
+
let context = useContext12(DocsContext);
|
|
7391
7851
|
of && context.referenceMeta(of, !0);
|
|
7392
7852
|
try {
|
|
7393
7853
|
let primary = context.storyById();
|
|
@@ -7467,6 +7927,7 @@ export {
|
|
|
7467
7927
|
formatTime,
|
|
7468
7928
|
getStoryId,
|
|
7469
7929
|
getStoryProps,
|
|
7930
|
+
normalizeOptions,
|
|
7470
7931
|
parse2 as parse,
|
|
7471
7932
|
parseDate,
|
|
7472
7933
|
parseTime,
|