@storybook/react-native-ui 9.0.0-alpha.8 → 9.0.0-beta.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/index.d.ts +3 -5
- package/dist/index.js +227 -226
- package/package.json +8 -8
- package/src/Layout.tsx +1 -4
- package/src/MobileAddonsPanel.tsx +3 -2
- package/src/Refs.tsx +59 -59
- package/src/Search.tsx +3 -4
- package/src/SelectedNodeProvider.tsx +2 -1
- package/src/Sidebar.stories.tsx +4 -40
- package/src/Sidebar.tsx +1 -7
- package/src/Tree.tsx +2 -3
- package/src/TreeNode.tsx +1 -2
- package/src/hooks/useExpanded.ts +3 -11
- package/src/util/StoryHash.ts +41 -36
- package/src/util/tree.ts +14 -12
- package/src/util/useStyle.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -3018,9 +3018,8 @@ function CollapseSVG(props) {
|
|
|
3018
3018
|
}
|
|
3019
3019
|
|
|
3020
3020
|
// src/TreeNode.tsx
|
|
3021
|
-
var import_react = require("react");
|
|
3021
|
+
var import_react = __toESM(require("react"));
|
|
3022
3022
|
var import_polished = require("polished");
|
|
3023
|
-
var import_react2 = __toESM(require("react"));
|
|
3024
3023
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3025
3024
|
var BranchNodeText = import_react_native_theming2.styled.Text(({ theme }) => ({
|
|
3026
3025
|
textAlign: "left",
|
|
@@ -3082,7 +3081,7 @@ var Wrapper = import_react_native_theming2.styled.View({
|
|
|
3082
3081
|
gap: 6,
|
|
3083
3082
|
marginTop: 2
|
|
3084
3083
|
});
|
|
3085
|
-
var GroupNode =
|
|
3084
|
+
var GroupNode = import_react.default.memo(function GroupNode2({
|
|
3086
3085
|
children,
|
|
3087
3086
|
isExpanded = false,
|
|
3088
3087
|
isExpandable = false,
|
|
@@ -3100,7 +3099,7 @@ var GroupNode = import_react2.default.memo(function GroupNode2({
|
|
|
3100
3099
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BranchNodeText, { children })
|
|
3101
3100
|
] });
|
|
3102
3101
|
});
|
|
3103
|
-
var ComponentNode =
|
|
3102
|
+
var ComponentNode = import_react.default.memo(
|
|
3104
3103
|
function ComponentNode2({ children, isExpanded, isExpandable, ...props }) {
|
|
3105
3104
|
const theme = (0, import_react_native_theming2.useTheme)();
|
|
3106
3105
|
const color = (0, import_react.useMemo)(() => {
|
|
@@ -3115,7 +3114,7 @@ var ComponentNode = import_react2.default.memo(
|
|
|
3115
3114
|
] });
|
|
3116
3115
|
}
|
|
3117
3116
|
);
|
|
3118
|
-
var StoryNode =
|
|
3117
|
+
var StoryNode = import_react.default.memo(
|
|
3119
3118
|
(0, import_react.forwardRef)(function StoryNode2({ children, ...props }, ref) {
|
|
3120
3119
|
const theme = (0, import_react_native_theming2.useTheme)();
|
|
3121
3120
|
const color = (0, import_react.useMemo)(() => {
|
|
@@ -3131,13 +3130,13 @@ StoryNode.displayName = "StoryNode";
|
|
|
3131
3130
|
|
|
3132
3131
|
// src/Tree.tsx
|
|
3133
3132
|
var import_react_native_theming6 = require("@storybook/react-native-theming");
|
|
3134
|
-
var
|
|
3133
|
+
var import_react8 = __toESM(require("react"));
|
|
3135
3134
|
|
|
3136
3135
|
// src/Button.tsx
|
|
3137
3136
|
var import_react_native_theming3 = require("@storybook/react-native-theming");
|
|
3138
|
-
var
|
|
3137
|
+
var import_react2 = require("react");
|
|
3139
3138
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3140
|
-
var Button = (0,
|
|
3139
|
+
var Button = (0, import_react2.forwardRef)(
|
|
3141
3140
|
({
|
|
3142
3141
|
Icon,
|
|
3143
3142
|
animation = "none",
|
|
@@ -3151,7 +3150,7 @@ var Button = (0, import_react3.forwardRef)(
|
|
|
3151
3150
|
text,
|
|
3152
3151
|
...props
|
|
3153
3152
|
}, ref) => {
|
|
3154
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
3153
|
+
const [isAnimating, setIsAnimating] = (0, import_react2.useState)(false);
|
|
3155
3154
|
const handleClick = (event) => {
|
|
3156
3155
|
if (onPress)
|
|
3157
3156
|
onPress(event);
|
|
@@ -3159,7 +3158,7 @@ var Button = (0, import_react3.forwardRef)(
|
|
|
3159
3158
|
return;
|
|
3160
3159
|
setIsAnimating(true);
|
|
3161
3160
|
};
|
|
3162
|
-
(0,
|
|
3161
|
+
(0, import_react2.useEffect)(() => {
|
|
3163
3162
|
const timer = setTimeout(() => {
|
|
3164
3163
|
if (isAnimating)
|
|
3165
3164
|
setIsAnimating(false);
|
|
@@ -3257,7 +3256,7 @@ var ButtonIcon = ({
|
|
|
3257
3256
|
variant
|
|
3258
3257
|
}) => {
|
|
3259
3258
|
const theme = (0, import_react_native_theming3.useTheme)();
|
|
3260
|
-
const color = (0,
|
|
3259
|
+
const color = (0, import_react2.useMemo)(() => {
|
|
3261
3260
|
if (variant === "solid")
|
|
3262
3261
|
return theme.color.lightest;
|
|
3263
3262
|
if (variant === "outline")
|
|
@@ -3279,9 +3278,9 @@ var ButtonIcon = ({
|
|
|
3279
3278
|
};
|
|
3280
3279
|
|
|
3281
3280
|
// src/IconButton.tsx
|
|
3282
|
-
var
|
|
3281
|
+
var import_react3 = require("react");
|
|
3283
3282
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3284
|
-
var IconButton = (0,
|
|
3283
|
+
var IconButton = (0, import_react3.forwardRef)(
|
|
3285
3284
|
({ padding = "small", variant = "ghost", ...props }, ref) => {
|
|
3286
3285
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { padding, variant, ref, ...props });
|
|
3287
3286
|
}
|
|
@@ -3291,7 +3290,7 @@ IconButton.displayName = "IconButton";
|
|
|
3291
3290
|
// src/icon/CollapseAllIcon.tsx
|
|
3292
3291
|
var import_react_native_svg5 = require("react-native-svg");
|
|
3293
3292
|
var import_react_native_theming4 = require("@storybook/react-native-theming");
|
|
3294
|
-
var
|
|
3293
|
+
var import_react4 = require("react");
|
|
3295
3294
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3296
3295
|
var CollapseAllIcon = ({
|
|
3297
3296
|
color,
|
|
@@ -3301,7 +3300,7 @@ var CollapseAllIcon = ({
|
|
|
3301
3300
|
...props
|
|
3302
3301
|
}) => {
|
|
3303
3302
|
const theme = (0, import_react_native_theming4.useTheme)();
|
|
3304
|
-
const fillColor = (0,
|
|
3303
|
+
const fillColor = (0, import_react4.useMemo)(() => {
|
|
3305
3304
|
return color ?? theme.color.defaultText;
|
|
3306
3305
|
}, [color, theme.color.defaultText]);
|
|
3307
3306
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_svg5.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
@@ -3316,7 +3315,7 @@ var CollapseAllIcon = ({
|
|
|
3316
3315
|
// src/icon/ExpandAllIcon.tsx
|
|
3317
3316
|
var import_react_native_svg6 = require("react-native-svg");
|
|
3318
3317
|
var import_react_native_theming5 = require("@storybook/react-native-theming");
|
|
3319
|
-
var
|
|
3318
|
+
var import_react5 = require("react");
|
|
3320
3319
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3321
3320
|
var ExpandAllIcon = ({
|
|
3322
3321
|
color,
|
|
@@ -3326,7 +3325,7 @@ var ExpandAllIcon = ({
|
|
|
3326
3325
|
...props
|
|
3327
3326
|
}) => {
|
|
3328
3327
|
const theme = (0, import_react_native_theming5.useTheme)();
|
|
3329
|
-
const fillColor = (0,
|
|
3328
|
+
const fillColor = (0, import_react5.useMemo)(() => {
|
|
3330
3329
|
return color ?? theme.color.defaultText;
|
|
3331
3330
|
}, [color, theme.color.defaultText]);
|
|
3332
3331
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_svg6.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
@@ -3339,7 +3338,7 @@ var ExpandAllIcon = ({
|
|
|
3339
3338
|
};
|
|
3340
3339
|
|
|
3341
3340
|
// src/hooks/useExpanded.ts
|
|
3342
|
-
var
|
|
3341
|
+
var import_react6 = require("react");
|
|
3343
3342
|
|
|
3344
3343
|
// src/util/tree.ts
|
|
3345
3344
|
var import_memoizerific = __toESM(require("memoizerific"));
|
|
@@ -3363,19 +3362,17 @@ var getParents = (0, import_memoizerific.default)(1e3)((id, dataset) => {
|
|
|
3363
3362
|
var getAncestorIds = (0, import_memoizerific.default)(1e3)(
|
|
3364
3363
|
(data, id) => getParents(id, data).map((item) => item.id)
|
|
3365
3364
|
);
|
|
3366
|
-
var getDescendantIds = (0, import_memoizerific.default)(1e3)(
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
if (!child || skipLeafs && (child.type === "story" || child.type === "docs"))
|
|
3373
|
-
return acc;
|
|
3374
|
-
acc.push(childId, ...getDescendantIds(data, childId, skipLeafs));
|
|
3365
|
+
var getDescendantIds = (0, import_memoizerific.default)(1e3)((data, id, skipLeafs) => {
|
|
3366
|
+
const entry = data[id];
|
|
3367
|
+
const children = entry.type === "story" || entry.type === "docs" ? [] : entry.children;
|
|
3368
|
+
return children.reduce((acc, childId) => {
|
|
3369
|
+
const child = data[childId];
|
|
3370
|
+
if (!child || skipLeafs && (child.type === "story" || child.type === "docs"))
|
|
3375
3371
|
return acc;
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
);
|
|
3372
|
+
acc.push(childId, ...getDescendantIds(data, childId, skipLeafs));
|
|
3373
|
+
return acc;
|
|
3374
|
+
}, []);
|
|
3375
|
+
});
|
|
3379
3376
|
function getPath(item, ref) {
|
|
3380
3377
|
const parent = item.type !== "root" && item.parent ? ref.index[item.parent] : null;
|
|
3381
3378
|
if (parent)
|
|
@@ -3420,24 +3417,24 @@ var useExpanded = ({
|
|
|
3420
3417
|
rootIds,
|
|
3421
3418
|
selectedStoryId
|
|
3422
3419
|
}) => {
|
|
3423
|
-
const [expanded, setExpanded] = (0,
|
|
3420
|
+
const [expanded, setExpanded] = (0, import_react6.useReducer)(
|
|
3424
3421
|
(state, { ids, value }) => ids.reduce((acc, id) => Object.assign(acc, { [id]: value }), { ...state }),
|
|
3425
3422
|
{ refId, data, rootIds, initialExpanded },
|
|
3426
3423
|
initializeExpanded
|
|
3427
3424
|
);
|
|
3428
|
-
const updateExpanded = (0,
|
|
3425
|
+
const updateExpanded = (0, import_react6.useCallback)(({ ids, value }) => {
|
|
3429
3426
|
setExpanded({ ids, value });
|
|
3430
3427
|
}, []);
|
|
3431
|
-
(0,
|
|
3428
|
+
(0, import_react6.useEffect)(() => {
|
|
3432
3429
|
setExpanded({ ids: getAncestorIds(data, selectedStoryId), value: true });
|
|
3433
3430
|
}, [data, selectedStoryId]);
|
|
3434
3431
|
return [expanded, updateExpanded];
|
|
3435
3432
|
};
|
|
3436
3433
|
|
|
3437
3434
|
// src/SelectedNodeProvider.tsx
|
|
3438
|
-
var
|
|
3435
|
+
var import_react7 = require("react");
|
|
3439
3436
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3440
|
-
var SelectedNodeContext = (0,
|
|
3437
|
+
var SelectedNodeContext = (0, import_react7.createContext)({
|
|
3441
3438
|
nodeRef: { current: null },
|
|
3442
3439
|
setNodeRef: () => {
|
|
3443
3440
|
},
|
|
@@ -3446,19 +3443,19 @@ var SelectedNodeContext = (0, import_react8.createContext)({
|
|
|
3446
3443
|
scrollRef: null
|
|
3447
3444
|
});
|
|
3448
3445
|
var SelectedNodeProvider = ({ children }) => {
|
|
3449
|
-
const nodeRef = (0,
|
|
3450
|
-
const setNodeRef = (0,
|
|
3446
|
+
const nodeRef = (0, import_react7.useRef)(null);
|
|
3447
|
+
const setNodeRef = (0, import_react7.useCallback)((node) => {
|
|
3451
3448
|
nodeRef.current = node;
|
|
3452
3449
|
}, []);
|
|
3453
|
-
const scrollRef = (0,
|
|
3454
|
-
const scrollToSelectedNode = (0,
|
|
3450
|
+
const scrollRef = (0, import_react7.useRef)(null);
|
|
3451
|
+
const scrollToSelectedNode = (0, import_react7.useCallback)(() => {
|
|
3455
3452
|
setTimeout(() => {
|
|
3456
3453
|
if (nodeRef?.current && scrollRef?.current) {
|
|
3457
3454
|
try {
|
|
3458
3455
|
nodeRef.current.measureLayout?.(scrollRef.current, (_x, y) => {
|
|
3459
3456
|
scrollRef.current?.scrollTo({ y: y - 100, animated: true });
|
|
3460
3457
|
});
|
|
3461
|
-
} catch (
|
|
3458
|
+
} catch (_error) {
|
|
3462
3459
|
}
|
|
3463
3460
|
}
|
|
3464
3461
|
}, 500);
|
|
@@ -3476,14 +3473,14 @@ var SelectedNodeProvider = ({ children }) => {
|
|
|
3476
3473
|
}
|
|
3477
3474
|
);
|
|
3478
3475
|
};
|
|
3479
|
-
var useSelectedNode = () => (0,
|
|
3476
|
+
var useSelectedNode = () => (0, import_react7.useContext)(SelectedNodeContext);
|
|
3480
3477
|
|
|
3481
3478
|
// src/Tree.tsx
|
|
3482
3479
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3483
3480
|
var TextItem = import_react_native_theming6.styled.Text(({ theme }) => ({
|
|
3484
3481
|
color: theme.color.defaultText
|
|
3485
3482
|
}));
|
|
3486
|
-
var Node =
|
|
3483
|
+
var Node = import_react8.default.memo(function Node2({
|
|
3487
3484
|
item,
|
|
3488
3485
|
refId,
|
|
3489
3486
|
isOrphan,
|
|
@@ -3497,7 +3494,7 @@ var Node = import_react9.default.memo(function Node2({
|
|
|
3497
3494
|
onSelectStoryId
|
|
3498
3495
|
}) {
|
|
3499
3496
|
const { setNodeRef } = useSelectedNode();
|
|
3500
|
-
const setRef = (0,
|
|
3497
|
+
const setRef = (0, import_react8.useCallback)(
|
|
3501
3498
|
(node) => {
|
|
3502
3499
|
if (isSelected && node) {
|
|
3503
3500
|
setNodeRef(node);
|
|
@@ -3592,7 +3589,7 @@ var LeafNodeStyleWrapper = import_react_native_theming6.styled.View(({ theme })
|
|
|
3592
3589
|
minHeight: 28,
|
|
3593
3590
|
borderRadius: 4
|
|
3594
3591
|
}));
|
|
3595
|
-
var RootNode = import_react_native_theming6.styled.View((
|
|
3592
|
+
var RootNode = import_react_native_theming6.styled.View(() => ({
|
|
3596
3593
|
display: "flex",
|
|
3597
3594
|
flexDirection: "row",
|
|
3598
3595
|
alignItems: "center",
|
|
@@ -3609,7 +3606,7 @@ var RootNodeText = import_react_native_theming6.styled.Text(({ theme }) => ({
|
|
|
3609
3606
|
letterSpacing: 2.5,
|
|
3610
3607
|
textTransform: "uppercase"
|
|
3611
3608
|
}));
|
|
3612
|
-
var CollapseButton = import_react_native_theming6.styled.TouchableOpacity((
|
|
3609
|
+
var CollapseButton = import_react_native_theming6.styled.TouchableOpacity(() => ({
|
|
3613
3610
|
display: "flex",
|
|
3614
3611
|
flexDirection: "row",
|
|
3615
3612
|
paddingVertical: 0,
|
|
@@ -3620,9 +3617,9 @@ var CollapseButton = import_react_native_theming6.styled.TouchableOpacity(({}) =
|
|
|
3620
3617
|
cursor: "pointer",
|
|
3621
3618
|
height: 28
|
|
3622
3619
|
}));
|
|
3623
|
-
var Tree =
|
|
3624
|
-
const containerRef = (0,
|
|
3625
|
-
const [rootIds, orphanIds, initialExpanded] = (0,
|
|
3620
|
+
var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, status, docsMode, selectedStoryId, onSelectStoryId }) {
|
|
3621
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
3622
|
+
const [rootIds, orphanIds, initialExpanded] = (0, import_react8.useMemo)(
|
|
3626
3623
|
() => Object.keys(data).reduce(
|
|
3627
3624
|
(acc, id) => {
|
|
3628
3625
|
const item = data[id];
|
|
@@ -3638,7 +3635,7 @@ var Tree = import_react9.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3638
3635
|
),
|
|
3639
3636
|
[data]
|
|
3640
3637
|
);
|
|
3641
|
-
const { expandableDescendants } = (0,
|
|
3638
|
+
const { expandableDescendants } = (0, import_react8.useMemo)(() => {
|
|
3642
3639
|
return [...orphanIds, ...rootIds].reduce(
|
|
3643
3640
|
(acc, nodeId) => {
|
|
3644
3641
|
acc.expandableDescendants[nodeId] = getDescendantIds(data, nodeId, false).filter(
|
|
@@ -3649,7 +3646,7 @@ var Tree = import_react9.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3649
3646
|
{ orphansFirst: [], expandableDescendants: {} }
|
|
3650
3647
|
);
|
|
3651
3648
|
}, [data, rootIds, orphanIds]);
|
|
3652
|
-
const singleStoryComponentIds = (0,
|
|
3649
|
+
const singleStoryComponentIds = (0, import_react8.useMemo)(() => {
|
|
3653
3650
|
return Object.keys(data).filter((id) => {
|
|
3654
3651
|
const entry = data[id];
|
|
3655
3652
|
if (entry.type !== "component")
|
|
@@ -3665,12 +3662,12 @@ var Tree = import_react9.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3665
3662
|
return false;
|
|
3666
3663
|
});
|
|
3667
3664
|
}, [data]);
|
|
3668
|
-
const collapsedItems = (0,
|
|
3665
|
+
const collapsedItems = (0, import_react8.useMemo)(
|
|
3669
3666
|
() => Object.keys(data).filter((id) => !singleStoryComponentIds.includes(id)),
|
|
3670
3667
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3671
3668
|
[singleStoryComponentIds]
|
|
3672
3669
|
);
|
|
3673
|
-
const collapsedData = (0,
|
|
3670
|
+
const collapsedData = (0, import_react8.useMemo)(() => {
|
|
3674
3671
|
return singleStoryComponentIds.reduce(
|
|
3675
3672
|
(acc, id) => {
|
|
3676
3673
|
const { children, parent, name } = data[id];
|
|
@@ -3691,7 +3688,7 @@ var Tree = import_react9.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3691
3688
|
{ ...data }
|
|
3692
3689
|
);
|
|
3693
3690
|
}, [data]);
|
|
3694
|
-
const ancestry = (0,
|
|
3691
|
+
const ancestry = (0, import_react8.useMemo)(() => {
|
|
3695
3692
|
return collapsedItems.reduce(
|
|
3696
3693
|
(acc, id) => Object.assign(acc, { [id]: getAncestorIds(collapsedData, id) }),
|
|
3697
3694
|
{}
|
|
@@ -3705,7 +3702,7 @@ var Tree = import_react9.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3705
3702
|
selectedStoryId,
|
|
3706
3703
|
onSelectStoryId
|
|
3707
3704
|
});
|
|
3708
|
-
const treeItems = (0,
|
|
3705
|
+
const treeItems = (0, import_react8.useMemo)(() => {
|
|
3709
3706
|
return collapsedItems.map((itemId) => {
|
|
3710
3707
|
const item = collapsedData[itemId];
|
|
3711
3708
|
const id = createId(itemId, refId);
|
|
@@ -3771,13 +3768,13 @@ var Container = import_react_native_theming6.styled.View((props) => ({
|
|
|
3771
3768
|
marginTop: props.hasOrphans ? 20 : 0,
|
|
3772
3769
|
marginBottom: 20
|
|
3773
3770
|
}));
|
|
3774
|
-
var Root =
|
|
3771
|
+
var Root = import_react8.default.memo(function Root2({
|
|
3775
3772
|
setExpanded,
|
|
3776
3773
|
isFullyExpanded,
|
|
3777
3774
|
expandableDescendants,
|
|
3778
3775
|
...props
|
|
3779
3776
|
}) {
|
|
3780
|
-
const setFullyExpanded = (0,
|
|
3777
|
+
const setFullyExpanded = (0, import_react8.useCallback)(
|
|
3781
3778
|
() => setExpanded({ ids: expandableDescendants, value: !isFullyExpanded }),
|
|
3782
3779
|
[setExpanded, isFullyExpanded, expandableDescendants]
|
|
3783
3780
|
);
|
|
@@ -3793,10 +3790,10 @@ var Root = import_react9.default.memo(function Root2({
|
|
|
3793
3790
|
});
|
|
3794
3791
|
|
|
3795
3792
|
// src/LayoutProvider.tsx
|
|
3796
|
-
var
|
|
3793
|
+
var import_react9 = require("react");
|
|
3797
3794
|
var import_react_native = require("react-native");
|
|
3798
3795
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3799
|
-
var LayoutContext = (0,
|
|
3796
|
+
var LayoutContext = (0, import_react9.createContext)({
|
|
3800
3797
|
isDesktop: false,
|
|
3801
3798
|
isMobile: true
|
|
3802
3799
|
});
|
|
@@ -3804,7 +3801,7 @@ var LayoutProvider = ({ children }) => {
|
|
|
3804
3801
|
const { width } = (0, import_react_native.useWindowDimensions)();
|
|
3805
3802
|
const isDesktop = width >= BREAKPOINT;
|
|
3806
3803
|
const isMobile = !isDesktop;
|
|
3807
|
-
const contextValue = (0,
|
|
3804
|
+
const contextValue = (0, import_react9.useMemo)(
|
|
3808
3805
|
() => ({
|
|
3809
3806
|
isDesktop,
|
|
3810
3807
|
isMobile
|
|
@@ -3813,80 +3810,82 @@ var LayoutProvider = ({ children }) => {
|
|
|
3813
3810
|
);
|
|
3814
3811
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LayoutContext.Provider, { value: contextValue, children });
|
|
3815
3812
|
};
|
|
3816
|
-
var useLayout = () => (0,
|
|
3813
|
+
var useLayout = () => (0, import_react9.useContext)(LayoutContext);
|
|
3817
3814
|
|
|
3818
3815
|
// src/Explorer.tsx
|
|
3819
|
-
var
|
|
3816
|
+
var import_react11 = __toESM(require("react"));
|
|
3820
3817
|
|
|
3821
3818
|
// src/Refs.tsx
|
|
3822
|
-
var
|
|
3819
|
+
var import_react10 = __toESM(require("react"));
|
|
3823
3820
|
var import_react_native_theming7 = require("@storybook/react-native-theming");
|
|
3824
3821
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3825
|
-
var Wrapper2 = import_react_native_theming7.styled.View((
|
|
3822
|
+
var Wrapper2 = import_react_native_theming7.styled.View(() => ({
|
|
3826
3823
|
position: "relative"
|
|
3827
3824
|
}));
|
|
3828
|
-
var Ref =
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
selectedStoryId,
|
|
3836
|
-
loginUrl,
|
|
3837
|
-
type,
|
|
3838
|
-
expanded = true,
|
|
3839
|
-
indexError,
|
|
3840
|
-
previewInitialized,
|
|
3841
|
-
setSelection
|
|
3842
|
-
} = props;
|
|
3843
|
-
const length = (0, import_react11.useMemo)(() => index ? Object.keys(index).length : 0, [index]);
|
|
3844
|
-
const isLoadingInjected = type === "auto-inject" && !previewInitialized || type === "server-checked";
|
|
3845
|
-
const isLoading = isLoadingMain || isLoadingInjected || type === "unknown";
|
|
3846
|
-
const isError = !!indexError;
|
|
3847
|
-
const isEmpty = !isLoading && length === 0;
|
|
3848
|
-
const isAuthRequired = !!loginUrl && length === 0;
|
|
3849
|
-
const state = getStateType(isLoading, isAuthRequired, isError, isEmpty);
|
|
3850
|
-
const [isExpanded, setExpanded] = (0, import_react11.useState)(expanded);
|
|
3851
|
-
(0, import_react11.useEffect)(() => {
|
|
3852
|
-
if (index && selectedStoryId && index[selectedStoryId]) {
|
|
3853
|
-
setExpanded(true);
|
|
3854
|
-
}
|
|
3855
|
-
}, [setExpanded, index, selectedStoryId]);
|
|
3856
|
-
const onSelectStoryId = (0, import_react11.useCallback)(
|
|
3857
|
-
(storyId) => {
|
|
3858
|
-
setSelection({ refId, storyId });
|
|
3859
|
-
},
|
|
3860
|
-
[refId, setSelection]
|
|
3861
|
-
);
|
|
3862
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: isExpanded && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Wrapper2, { "data-title": title, isMain: true, children: state === "ready" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3863
|
-
Tree,
|
|
3864
|
-
{
|
|
3865
|
-
status: props.status,
|
|
3825
|
+
var Ref = import_react10.default.memo(
|
|
3826
|
+
function Ref2(props) {
|
|
3827
|
+
const {
|
|
3828
|
+
index,
|
|
3829
|
+
id: refId,
|
|
3830
|
+
title = refId,
|
|
3831
|
+
isLoading: isLoadingMain,
|
|
3866
3832
|
isBrowsing,
|
|
3867
|
-
isMain: true,
|
|
3868
|
-
refId,
|
|
3869
|
-
data: index,
|
|
3870
|
-
docsMode: false,
|
|
3871
3833
|
selectedStoryId,
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3834
|
+
loginUrl,
|
|
3835
|
+
type,
|
|
3836
|
+
expanded = true,
|
|
3837
|
+
indexError,
|
|
3838
|
+
previewInitialized,
|
|
3839
|
+
setSelection
|
|
3840
|
+
} = props;
|
|
3841
|
+
const length = (0, import_react10.useMemo)(() => index ? Object.keys(index).length : 0, [index]);
|
|
3842
|
+
const isLoadingInjected = type === "auto-inject" && !previewInitialized || type === "server-checked";
|
|
3843
|
+
const isLoading = isLoadingMain || isLoadingInjected || type === "unknown";
|
|
3844
|
+
const isError = !!indexError;
|
|
3845
|
+
const isEmpty = !isLoading && length === 0;
|
|
3846
|
+
const isAuthRequired = !!loginUrl && length === 0;
|
|
3847
|
+
const state = getStateType(isLoading, isAuthRequired, isError, isEmpty);
|
|
3848
|
+
const [isExpanded, setExpanded] = (0, import_react10.useState)(expanded);
|
|
3849
|
+
(0, import_react10.useEffect)(() => {
|
|
3850
|
+
if (index && selectedStoryId && index[selectedStoryId]) {
|
|
3851
|
+
setExpanded(true);
|
|
3852
|
+
}
|
|
3853
|
+
}, [setExpanded, index, selectedStoryId]);
|
|
3854
|
+
const onSelectStoryId = (0, import_react10.useCallback)(
|
|
3855
|
+
(storyId) => {
|
|
3856
|
+
setSelection({ refId, storyId });
|
|
3857
|
+
},
|
|
3858
|
+
[refId, setSelection]
|
|
3859
|
+
);
|
|
3860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: isExpanded && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Wrapper2, { "data-title": title, isMain: true, children: state === "ready" && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3861
|
+
Tree,
|
|
3862
|
+
{
|
|
3863
|
+
status: props.status,
|
|
3864
|
+
isBrowsing,
|
|
3865
|
+
isMain: true,
|
|
3866
|
+
refId,
|
|
3867
|
+
data: index,
|
|
3868
|
+
docsMode: false,
|
|
3869
|
+
selectedStoryId,
|
|
3870
|
+
onSelectStoryId
|
|
3871
|
+
}
|
|
3872
|
+
) }) });
|
|
3873
|
+
}
|
|
3874
|
+
);
|
|
3876
3875
|
|
|
3877
3876
|
// src/Explorer.tsx
|
|
3878
3877
|
var import_react_native2 = require("react-native");
|
|
3879
3878
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3880
|
-
var
|
|
3881
|
-
var Explorer =
|
|
3879
|
+
var import_react12 = require("react");
|
|
3880
|
+
var Explorer = import_react11.default.memo(function Explorer2({
|
|
3882
3881
|
isLoading,
|
|
3883
3882
|
isBrowsing,
|
|
3884
3883
|
dataset,
|
|
3885
3884
|
selected,
|
|
3886
3885
|
setSelection
|
|
3887
3886
|
}) {
|
|
3888
|
-
const containerRef = (0,
|
|
3889
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native2.View, { ref: containerRef, id: "storybook-explorer-tree", children: dataset.entries.map(([refId, ref]) => /* @__PURE__ */ (0,
|
|
3887
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
3888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native2.View, { ref: containerRef, id: "storybook-explorer-tree", children: dataset.entries.map(([refId, ref]) => /* @__PURE__ */ (0, import_react12.createElement)(
|
|
3890
3889
|
Ref,
|
|
3891
3890
|
{
|
|
3892
3891
|
...ref,
|
|
@@ -3900,14 +3899,14 @@ var Explorer = import_react12.default.memo(function Explorer2({
|
|
|
3900
3899
|
});
|
|
3901
3900
|
|
|
3902
3901
|
// src/Sidebar.tsx
|
|
3903
|
-
var
|
|
3902
|
+
var import_react18 = __toESM(require("react"));
|
|
3904
3903
|
var import_react_native_theming12 = require("@storybook/react-native-theming");
|
|
3905
3904
|
|
|
3906
3905
|
// src/Search.tsx
|
|
3907
3906
|
var import_bottom_sheet = require("@gorhom/bottom-sheet");
|
|
3908
3907
|
var import_react_native_theming9 = require("@storybook/react-native-theming");
|
|
3909
3908
|
var import_fuse = __toESM(require("fuse.js"));
|
|
3910
|
-
var
|
|
3909
|
+
var import_react13 = __toESM(require("react"));
|
|
3911
3910
|
var import_react_native3 = require("react-native");
|
|
3912
3911
|
|
|
3913
3912
|
// src/icon/CloseIcon.tsx
|
|
@@ -4034,16 +4033,15 @@ var ClearIcon = import_react_native_theming9.styled.TouchableOpacity(({ theme })
|
|
|
4034
4033
|
justifyContent: "center",
|
|
4035
4034
|
height: "100%"
|
|
4036
4035
|
}));
|
|
4037
|
-
var Search =
|
|
4036
|
+
var Search = import_react13.default.memo(function Search2({ children, dataset, setSelection, getLastViewed, initialQuery = "" }) {
|
|
4038
4037
|
const context = (0, import_bottom_sheet.useBottomSheetInternal)(true);
|
|
4039
4038
|
const isBottomSheet = context !== null;
|
|
4040
|
-
const inputRef = (0,
|
|
4041
|
-
const [inputValue, setInputValue] = (0,
|
|
4042
|
-
const [isOpen, setIsOpen] = (0,
|
|
4043
|
-
const [allComponents, showAllComponents] = (0,
|
|
4044
|
-
const { isMobile } = useLayout();
|
|
4039
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
4040
|
+
const [inputValue, setInputValue] = (0, import_react13.useState)(initialQuery);
|
|
4041
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
4042
|
+
const [allComponents, showAllComponents] = (0, import_react13.useState)(false);
|
|
4045
4043
|
const { scrollToSelectedNode } = useSelectedNode();
|
|
4046
|
-
const selectStory = (0,
|
|
4044
|
+
const selectStory = (0, import_react13.useCallback)(
|
|
4047
4045
|
(id, refId) => {
|
|
4048
4046
|
setSelection({ storyId: id, refId });
|
|
4049
4047
|
inputRef.current?.blur();
|
|
@@ -4053,7 +4051,7 @@ var Search = import_react14.default.memo(function Search2({ children, dataset, s
|
|
|
4053
4051
|
},
|
|
4054
4052
|
[scrollToSelectedNode, setSelection]
|
|
4055
4053
|
);
|
|
4056
|
-
const getItemProps = (0,
|
|
4054
|
+
const getItemProps = (0, import_react13.useCallback)(
|
|
4057
4055
|
({ item: result }) => {
|
|
4058
4056
|
return {
|
|
4059
4057
|
icon: result?.item?.type === "component" ? "component" : "story",
|
|
@@ -4076,7 +4074,7 @@ var Search = import_react14.default.memo(function Search2({ children, dataset, s
|
|
|
4076
4074
|
},
|
|
4077
4075
|
[selectStory]
|
|
4078
4076
|
);
|
|
4079
|
-
const makeFuse = (0,
|
|
4077
|
+
const makeFuse = (0, import_react13.useCallback)(() => {
|
|
4080
4078
|
const list = dataset.entries.reduce((acc, [refId, { index }]) => {
|
|
4081
4079
|
if (index) {
|
|
4082
4080
|
acc.push(
|
|
@@ -4089,7 +4087,7 @@ var Search = import_react14.default.memo(function Search2({ children, dataset, s
|
|
|
4089
4087
|
}, []);
|
|
4090
4088
|
return new import_fuse.default(list, options);
|
|
4091
4089
|
}, [dataset]);
|
|
4092
|
-
const getResults = (0,
|
|
4090
|
+
const getResults = (0, import_react13.useCallback)(
|
|
4093
4091
|
(input2) => {
|
|
4094
4092
|
const fuse = makeFuse();
|
|
4095
4093
|
if (!input2)
|
|
@@ -4131,7 +4129,7 @@ var Search = import_react14.default.memo(function Search2({ children, dataset, s
|
|
|
4131
4129
|
},
|
|
4132
4130
|
[allComponents, dataset.hash, getLastViewed, makeFuse]
|
|
4133
4131
|
);
|
|
4134
|
-
const deferredQuery = (0,
|
|
4132
|
+
const deferredQuery = (0, import_react13.useDeferredValue)(inputValue);
|
|
4135
4133
|
const input = deferredQuery ? deferredQuery.trim() : "";
|
|
4136
4134
|
const results = input ? getResults(input) : [];
|
|
4137
4135
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native3.View, { style: { flex: 1 }, children: [
|
|
@@ -4171,12 +4169,12 @@ var Search = import_react14.default.memo(function Search2({ children, dataset, s
|
|
|
4171
4169
|
|
|
4172
4170
|
// src/SearchResults.tsx
|
|
4173
4171
|
var import_react_native_theming11 = require("@storybook/react-native-theming");
|
|
4174
|
-
var
|
|
4172
|
+
var import_react15 = __toESM(require("react"));
|
|
4175
4173
|
var import_polished2 = require("polished");
|
|
4176
4174
|
var import_react_native4 = require("react-native");
|
|
4177
4175
|
|
|
4178
4176
|
// src/util/status.tsx
|
|
4179
|
-
var
|
|
4177
|
+
var import_react14 = require("react");
|
|
4180
4178
|
var import_react_native_theming10 = require("@storybook/react-native-theming");
|
|
4181
4179
|
var import_react_native_svg9 = __toESM(require("react-native-svg"));
|
|
4182
4180
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -4188,7 +4186,7 @@ function SmallIcons(props) {
|
|
|
4188
4186
|
}
|
|
4189
4187
|
function LoadingIcons(props) {
|
|
4190
4188
|
const theme = (0, import_react_native_theming10.useTheme)();
|
|
4191
|
-
const color = (0,
|
|
4189
|
+
const color = (0, import_react14.useMemo)(() => {
|
|
4192
4190
|
return theme.base === "light" ? theme.color.mediumdark : theme.color.darker;
|
|
4193
4191
|
}, [theme.base, theme.color.darker, theme.color.mediumdark]);
|
|
4194
4192
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SmallIcons, { color, ...props });
|
|
@@ -4203,7 +4201,7 @@ var statusMapping = {
|
|
|
4203
4201
|
|
|
4204
4202
|
// src/SearchResults.tsx
|
|
4205
4203
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4206
|
-
var
|
|
4204
|
+
var import_react16 = require("react");
|
|
4207
4205
|
var ResultsList = import_react_native_theming11.styled.View({
|
|
4208
4206
|
margin: 0,
|
|
4209
4207
|
padding: 0,
|
|
@@ -4269,7 +4267,7 @@ var RecentlyOpenedTitle = import_react_native_theming11.styled.View(({ theme })
|
|
|
4269
4267
|
marginBottom: 4,
|
|
4270
4268
|
alignItems: "center"
|
|
4271
4269
|
}));
|
|
4272
|
-
var Highlight =
|
|
4270
|
+
var Highlight = import_react15.default.memo(
|
|
4273
4271
|
function Highlight2({ children, match }) {
|
|
4274
4272
|
if (!match)
|
|
4275
4273
|
return children;
|
|
@@ -4304,14 +4302,14 @@ var PathText = import_react_native_theming11.styled.Text(({ theme }) => ({
|
|
|
4304
4302
|
fontSize: theme.typography.size.s1 - 1,
|
|
4305
4303
|
color: theme.textMutedColor
|
|
4306
4304
|
}));
|
|
4307
|
-
var Result =
|
|
4305
|
+
var Result = import_react15.default.memo(function Result2({
|
|
4308
4306
|
item,
|
|
4309
4307
|
matches,
|
|
4310
4308
|
icon: _icon,
|
|
4311
4309
|
onPress,
|
|
4312
4310
|
...props
|
|
4313
4311
|
}) {
|
|
4314
|
-
const press = (0,
|
|
4312
|
+
const press = (0, import_react15.useCallback)(
|
|
4315
4313
|
(event) => {
|
|
4316
4314
|
event.preventDefault();
|
|
4317
4315
|
onPress?.(event);
|
|
@@ -4345,7 +4343,7 @@ var Result = import_react16.default.memo(function Result2({
|
|
|
4345
4343
|
var Text = import_react_native_theming11.styled.Text(({ theme }) => ({
|
|
4346
4344
|
color: theme.color.defaultText
|
|
4347
4345
|
}));
|
|
4348
|
-
var SearchResults =
|
|
4346
|
+
var SearchResults = import_react15.default.memo(function SearchResults2({
|
|
4349
4347
|
query,
|
|
4350
4348
|
results,
|
|
4351
4349
|
closeMenu,
|
|
@@ -4380,7 +4378,7 @@ var SearchResults = import_react16.default.memo(function SearchResults2({
|
|
|
4380
4378
|
}
|
|
4381
4379
|
const { item } = result;
|
|
4382
4380
|
const key = `${item.refId}::${item.id}`;
|
|
4383
|
-
return /* @__PURE__ */ (0,
|
|
4381
|
+
return /* @__PURE__ */ (0, import_react16.createElement)(
|
|
4384
4382
|
Result,
|
|
4385
4383
|
{
|
|
4386
4384
|
...result,
|
|
@@ -4395,11 +4393,11 @@ var SearchResults = import_react16.default.memo(function SearchResults2({
|
|
|
4395
4393
|
|
|
4396
4394
|
// src/hooks/useLastViewed.ts
|
|
4397
4395
|
var import_debounce = __toESM(require_debounce());
|
|
4398
|
-
var
|
|
4396
|
+
var import_react17 = require("react");
|
|
4399
4397
|
var import_store2 = __toESM(require("store2"));
|
|
4400
4398
|
var save = (0, import_debounce.default)((value) => import_store2.default.set("lastViewedStoryIds", value), 1e3);
|
|
4401
4399
|
var useLastViewed = (selection) => {
|
|
4402
|
-
const initialLastViewedStoryIds = (0,
|
|
4400
|
+
const initialLastViewedStoryIds = (0, import_react17.useMemo)(() => {
|
|
4403
4401
|
const items = import_store2.default.get("lastViewedStoryIds");
|
|
4404
4402
|
if (!items || !Array.isArray(items))
|
|
4405
4403
|
return [];
|
|
@@ -4407,8 +4405,8 @@ var useLastViewed = (selection) => {
|
|
|
4407
4405
|
return [];
|
|
4408
4406
|
return items;
|
|
4409
4407
|
}, []);
|
|
4410
|
-
const lastViewedRef = (0,
|
|
4411
|
-
const updateLastViewed = (0,
|
|
4408
|
+
const lastViewedRef = (0, import_react17.useRef)(initialLastViewedStoryIds);
|
|
4409
|
+
const updateLastViewed = (0, import_react17.useCallback)(
|
|
4412
4410
|
(story) => {
|
|
4413
4411
|
const items = lastViewedRef.current;
|
|
4414
4412
|
const index = items.findIndex(
|
|
@@ -4425,13 +4423,13 @@ var useLastViewed = (selection) => {
|
|
|
4425
4423
|
},
|
|
4426
4424
|
[lastViewedRef]
|
|
4427
4425
|
);
|
|
4428
|
-
(0,
|
|
4426
|
+
(0, import_react17.useEffect)(() => {
|
|
4429
4427
|
if (selection)
|
|
4430
4428
|
updateLastViewed(selection);
|
|
4431
4429
|
}, [selection]);
|
|
4432
4430
|
return {
|
|
4433
|
-
getLastViewed: (0,
|
|
4434
|
-
clearLastViewed: (0,
|
|
4431
|
+
getLastViewed: (0, import_react17.useCallback)(() => lastViewedRef.current, [lastViewedRef]),
|
|
4432
|
+
clearLastViewed: (0, import_react17.useCallback)(() => {
|
|
4435
4433
|
lastViewedRef.current = lastViewedRef.current.slice(0, 1);
|
|
4436
4434
|
save(lastViewedRef.current);
|
|
4437
4435
|
}, [lastViewedRef])
|
|
@@ -4455,18 +4453,18 @@ var Top = import_react_native_theming12.styled.View({
|
|
|
4455
4453
|
flex: 1,
|
|
4456
4454
|
flexDirection: "row"
|
|
4457
4455
|
});
|
|
4458
|
-
var Swap =
|
|
4456
|
+
var Swap = import_react18.default.memo(function Swap2({
|
|
4459
4457
|
children,
|
|
4460
4458
|
condition
|
|
4461
4459
|
}) {
|
|
4462
|
-
const [a, b] =
|
|
4460
|
+
const [a, b] = import_react18.default.Children.toArray(children);
|
|
4463
4461
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
4464
4462
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native5.View, { style: { display: condition ? "flex" : "none" }, children: a }),
|
|
4465
4463
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native5.View, { style: { display: condition ? "none" : "flex" }, children: b })
|
|
4466
4464
|
] });
|
|
4467
4465
|
});
|
|
4468
4466
|
var useCombination = (index, indexError, previewInitialized, status, refs) => {
|
|
4469
|
-
const hash = (0,
|
|
4467
|
+
const hash = (0, import_react18.useMemo)(
|
|
4470
4468
|
() => ({
|
|
4471
4469
|
[DEFAULT_REF_ID]: {
|
|
4472
4470
|
index,
|
|
@@ -4481,9 +4479,9 @@ var useCombination = (index, indexError, previewInitialized, status, refs) => {
|
|
|
4481
4479
|
}),
|
|
4482
4480
|
[refs, index, indexError, previewInitialized, status]
|
|
4483
4481
|
);
|
|
4484
|
-
return (0,
|
|
4482
|
+
return (0, import_react18.useMemo)(() => ({ hash, entries: Object.entries(hash) }), [hash]);
|
|
4485
4483
|
};
|
|
4486
|
-
var Sidebar =
|
|
4484
|
+
var Sidebar = import_react18.default.memo(function Sidebar2({
|
|
4487
4485
|
storyId = null,
|
|
4488
4486
|
refId = DEFAULT_REF_ID,
|
|
4489
4487
|
index,
|
|
@@ -4493,7 +4491,7 @@ var Sidebar = import_react19.default.memo(function Sidebar2({
|
|
|
4493
4491
|
refs = {},
|
|
4494
4492
|
setSelection
|
|
4495
4493
|
}) {
|
|
4496
|
-
const selected = (0,
|
|
4494
|
+
const selected = (0, import_react18.useMemo)(() => storyId && { storyId, refId }, [storyId, refId]);
|
|
4497
4495
|
const dataset = useCombination(index, indexError, previewInitialized, status, refs);
|
|
4498
4496
|
const lastViewedProps = useLastViewed(selected);
|
|
4499
4497
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Container2, { style: { paddingHorizontal: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Top, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Search, { dataset, setSelection, ...lastViewedProps, children: ({ query, results, isBrowsing, closeMenu, getItemProps, highlightedIndex }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Swap, { condition: isBrowsing, children: [
|
|
@@ -4525,8 +4523,8 @@ var Sidebar = import_react19.default.memo(function Sidebar2({
|
|
|
4525
4523
|
// src/Layout.tsx
|
|
4526
4524
|
var import_core_events = require("storybook/internal/core-events");
|
|
4527
4525
|
var import_manager_api2 = require("storybook/internal/manager-api");
|
|
4528
|
-
var
|
|
4529
|
-
var
|
|
4526
|
+
var import_react_native_theming17 = require("@storybook/react-native-theming");
|
|
4527
|
+
var import_react27 = require("react");
|
|
4530
4528
|
var import_react_native9 = require("react-native");
|
|
4531
4529
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
4532
4530
|
|
|
@@ -4535,18 +4533,17 @@ var import_bottom_sheet2 = require("@gorhom/bottom-sheet");
|
|
|
4535
4533
|
var import_manager_api = require("storybook/internal/manager-api");
|
|
4536
4534
|
var import_react_native_theming13 = require("@storybook/react-native-theming");
|
|
4537
4535
|
var import_types3 = require("storybook/internal/types");
|
|
4538
|
-
var
|
|
4536
|
+
var import_react20 = require("react");
|
|
4539
4537
|
var import_react_native6 = require("react-native");
|
|
4540
4538
|
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
4541
4539
|
var import_react_native_reanimated = __toESM(require("react-native-reanimated"));
|
|
4542
4540
|
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
4543
|
-
var import_react_native_theming14 = require("@storybook/react-native-theming");
|
|
4544
4541
|
|
|
4545
4542
|
// src/util/useStyle.ts
|
|
4546
|
-
var
|
|
4543
|
+
var import_react19 = require("react");
|
|
4547
4544
|
var useStyle = (styleFactory, deps) => (
|
|
4548
4545
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4549
|
-
(0,
|
|
4546
|
+
(0, import_react19.useMemo)(styleFactory, deps)
|
|
4550
4547
|
);
|
|
4551
4548
|
|
|
4552
4549
|
// src/MobileAddonsPanel.tsx
|
|
@@ -4557,15 +4554,15 @@ var bottomSheetStyle = {
|
|
|
4557
4554
|
var contentStyle = {
|
|
4558
4555
|
flex: 1
|
|
4559
4556
|
};
|
|
4560
|
-
var MobileAddonsPanel = (0,
|
|
4557
|
+
var MobileAddonsPanel = (0, import_react20.forwardRef)(
|
|
4561
4558
|
({ storyId }, ref) => {
|
|
4562
|
-
const theme = (0,
|
|
4559
|
+
const theme = (0, import_react_native_theming13.useTheme)();
|
|
4563
4560
|
const reducedMotion = (0, import_react_native_reanimated.useReducedMotion)();
|
|
4564
|
-
const addonsPanelBottomSheetRef = (0,
|
|
4561
|
+
const addonsPanelBottomSheetRef = (0, import_react20.useRef)(null);
|
|
4565
4562
|
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
4566
4563
|
const animatedPosition = (0, import_react_native_reanimated.useSharedValue)(0);
|
|
4567
4564
|
(0, import_react_native_reanimated.useAnimatedKeyboard)();
|
|
4568
|
-
(0,
|
|
4565
|
+
(0, import_react20.useImperativeHandle)(ref, () => ({
|
|
4569
4566
|
setAddonsPanelOpen: (open) => {
|
|
4570
4567
|
if (open) {
|
|
4571
4568
|
addonsPanelBottomSheetRef.current?.present();
|
|
@@ -4623,6 +4620,7 @@ var MobileAddonsPanel = (0, import_react21.forwardRef)(
|
|
|
4623
4620
|
);
|
|
4624
4621
|
}
|
|
4625
4622
|
);
|
|
4623
|
+
MobileAddonsPanel.displayName = "MobileAddonsPanel";
|
|
4626
4624
|
var addonsTabsContainerStyle = {
|
|
4627
4625
|
flex: 1
|
|
4628
4626
|
};
|
|
@@ -4650,14 +4648,14 @@ var centeredStyle = {
|
|
|
4650
4648
|
var hitSlop = { top: 10, right: 10, bottom: 10, left: 10 };
|
|
4651
4649
|
var AddonsTabs = ({ onClose, storyId }) => {
|
|
4652
4650
|
const panels = import_manager_api.addons.getElements(import_types3.Addon_TypesEnum.PANEL);
|
|
4653
|
-
const [addonSelected, setAddonSelected] = (0,
|
|
4651
|
+
const [addonSelected, setAddonSelected] = (0, import_react20.useState)(Object.keys(panels)[0]);
|
|
4654
4652
|
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
4655
4653
|
const scrollContentContainerStyle = useStyle(() => {
|
|
4656
4654
|
return {
|
|
4657
4655
|
paddingBottom: insets.bottom + 16
|
|
4658
4656
|
};
|
|
4659
4657
|
});
|
|
4660
|
-
const panel = (0,
|
|
4658
|
+
const panel = (0, import_react20.useMemo)(() => {
|
|
4661
4659
|
if (!storyId) {
|
|
4662
4660
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native6.View, { style: centeredStyle, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native6.Text, { children: "No Story Selected" }) });
|
|
4663
4661
|
}
|
|
@@ -4729,8 +4727,8 @@ var TabText = import_react_native_theming13.styled.Text(({ theme, active }) => (
|
|
|
4729
4727
|
|
|
4730
4728
|
// src/MobileMenuDrawer.tsx
|
|
4731
4729
|
var import_bottom_sheet3 = __toESM(require("@gorhom/bottom-sheet"));
|
|
4732
|
-
var
|
|
4733
|
-
var
|
|
4730
|
+
var import_react_native_theming14 = require("@storybook/react-native-theming");
|
|
4731
|
+
var import_react21 = require("react");
|
|
4734
4732
|
var import_react_native7 = require("react-native");
|
|
4735
4733
|
var import_react_native_reanimated2 = require("react-native-reanimated");
|
|
4736
4734
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
@@ -4746,14 +4744,14 @@ var BottomSheetBackdropComponent = (backdropComponentProps) => /* @__PURE__ */ (
|
|
|
4746
4744
|
}
|
|
4747
4745
|
);
|
|
4748
4746
|
var snapPoints = ["50%", "75%"];
|
|
4749
|
-
var MobileMenuDrawer = (0,
|
|
4750
|
-
(0,
|
|
4747
|
+
var MobileMenuDrawer = (0, import_react21.memo)(
|
|
4748
|
+
(0, import_react21.forwardRef)(({ children }, ref) => {
|
|
4751
4749
|
const reducedMotion = (0, import_react_native_reanimated2.useReducedMotion)();
|
|
4752
4750
|
const insets = (0, import_react_native_safe_area_context2.useSafeAreaInsets)();
|
|
4753
|
-
const theme = (0,
|
|
4754
|
-
const menuBottomSheetRef = (0,
|
|
4751
|
+
const theme = (0, import_react_native_theming14.useTheme)();
|
|
4752
|
+
const menuBottomSheetRef = (0, import_react21.useRef)(null);
|
|
4755
4753
|
const { scrollToSelectedNode, scrollRef } = useSelectedNode();
|
|
4756
|
-
(0,
|
|
4754
|
+
(0, import_react21.useImperativeHandle)(ref, () => ({
|
|
4757
4755
|
setMobileMenuOpen: (open) => {
|
|
4758
4756
|
if (open) {
|
|
4759
4757
|
menuBottomSheetRef.current?.snapToIndex(1);
|
|
@@ -4764,13 +4762,13 @@ var MobileMenuDrawer = (0, import_react22.memo)(
|
|
|
4764
4762
|
}
|
|
4765
4763
|
}
|
|
4766
4764
|
}));
|
|
4767
|
-
const bgColorStyle = (0,
|
|
4765
|
+
const bgColorStyle = (0, import_react21.useMemo)(() => {
|
|
4768
4766
|
return { backgroundColor: theme.background.content };
|
|
4769
4767
|
}, [theme.background.content]);
|
|
4770
|
-
const handleIndicatorStyle = (0,
|
|
4768
|
+
const handleIndicatorStyle = (0, import_react21.useMemo)(() => {
|
|
4771
4769
|
return { backgroundColor: theme.textMutedColor };
|
|
4772
4770
|
}, [theme.textMutedColor]);
|
|
4773
|
-
const contentContainerStyle2 = (0,
|
|
4771
|
+
const contentContainerStyle2 = (0, import_react21.useMemo)(() => {
|
|
4774
4772
|
return { paddingBottom: insets.bottom };
|
|
4775
4773
|
}, [insets.bottom]);
|
|
4776
4774
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
@@ -4804,7 +4802,7 @@ var MobileMenuDrawer = (0, import_react22.memo)(
|
|
|
4804
4802
|
);
|
|
4805
4803
|
|
|
4806
4804
|
// src/StorybookLogo.tsx
|
|
4807
|
-
var
|
|
4805
|
+
var import_react22 = require("react");
|
|
4808
4806
|
var import_react_native8 = require("react-native");
|
|
4809
4807
|
|
|
4810
4808
|
// src/icon/DarkLogo.tsx
|
|
@@ -4945,11 +4943,11 @@ var WIDTH = 125;
|
|
|
4945
4943
|
var HEIGHT = 25;
|
|
4946
4944
|
var NoBrandLogo = ({ theme }) => theme.base === "light" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Logo, { height: HEIGHT, width: WIDTH }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DarkLogo, { height: HEIGHT, width: WIDTH });
|
|
4947
4945
|
function isElement(value) {
|
|
4948
|
-
return (0,
|
|
4946
|
+
return (0, import_react22.isValidElement)(value);
|
|
4949
4947
|
}
|
|
4950
4948
|
var BrandLogo = ({ theme }) => {
|
|
4951
4949
|
const imageHasNoWidthOrHeight = typeof theme.brand.image === "object" && typeof theme.brand.image === "object" && "uri" in theme.brand.image && (!("height" in theme.brand.image) || !("width" in theme.brand.image));
|
|
4952
|
-
(0,
|
|
4950
|
+
(0, import_react22.useEffect)(() => {
|
|
4953
4951
|
if (imageHasNoWidthOrHeight) {
|
|
4954
4952
|
console.warn(
|
|
4955
4953
|
"STORYBOOK: When using a remote image as the brand logo, you must also set the width and height.\nFor example: brand: { image: { uri: 'https://sb.com/img.png', height: 25, width: 25}}"
|
|
@@ -4986,7 +4984,7 @@ var BrandLogo = ({ theme }) => {
|
|
|
4986
4984
|
}
|
|
4987
4985
|
};
|
|
4988
4986
|
var BrandTitle = ({ theme }) => {
|
|
4989
|
-
const brandTitleStyle = (0,
|
|
4987
|
+
const brandTitleStyle = (0, import_react22.useMemo)(() => {
|
|
4990
4988
|
return {
|
|
4991
4989
|
width: WIDTH,
|
|
4992
4990
|
height: HEIGHT,
|
|
@@ -5011,8 +5009,8 @@ var BrandTitle = ({ theme }) => {
|
|
|
5011
5009
|
}
|
|
5012
5010
|
};
|
|
5013
5011
|
var StorybookLogo = ({ theme }) => {
|
|
5014
|
-
const image = (0,
|
|
5015
|
-
const title = (0,
|
|
5012
|
+
const image = (0, import_react22.useMemo)(() => theme.brand?.image, [theme.brand?.image]);
|
|
5013
|
+
const title = (0, import_react22.useMemo)(() => theme.brand?.title, [theme.brand?.title]);
|
|
5016
5014
|
if (image) {
|
|
5017
5015
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BrandLogo, { theme });
|
|
5018
5016
|
} else if (title) {
|
|
@@ -5023,12 +5021,12 @@ var StorybookLogo = ({ theme }) => {
|
|
|
5023
5021
|
};
|
|
5024
5022
|
|
|
5025
5023
|
// src/hooks/useStoreState.ts
|
|
5026
|
-
var
|
|
5024
|
+
var import_react24 = require("react");
|
|
5027
5025
|
|
|
5028
5026
|
// src/StorageProvider.tsx
|
|
5029
|
-
var
|
|
5027
|
+
var import_react23 = require("react");
|
|
5030
5028
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5031
|
-
var StorageContext = (0,
|
|
5029
|
+
var StorageContext = (0, import_react23.createContext)({
|
|
5032
5030
|
getItem: async () => null,
|
|
5033
5031
|
setItem: async () => {
|
|
5034
5032
|
}
|
|
@@ -5039,13 +5037,13 @@ var StorageProvider = ({
|
|
|
5039
5037
|
}) => {
|
|
5040
5038
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StorageContext.Provider, { value: storage, children });
|
|
5041
5039
|
};
|
|
5042
|
-
var useStorage = () => (0,
|
|
5040
|
+
var useStorage = () => (0, import_react23.useContext)(StorageContext);
|
|
5043
5041
|
|
|
5044
5042
|
// src/hooks/useStoreState.ts
|
|
5045
5043
|
var useStoreBooleanState = (key, defaultValue) => {
|
|
5046
5044
|
const storage = useStorage();
|
|
5047
|
-
const [val, setVal] = (0,
|
|
5048
|
-
(0,
|
|
5045
|
+
const [val, setVal] = (0, import_react24.useState)(defaultValue);
|
|
5046
|
+
(0, import_react24.useEffect)(() => {
|
|
5049
5047
|
storage.getItem(key).then((newVal) => {
|
|
5050
5048
|
if (newVal === null || newVal === void 0) {
|
|
5051
5049
|
setVal(defaultValue);
|
|
@@ -5054,7 +5052,7 @@ var useStoreBooleanState = (key, defaultValue) => {
|
|
|
5054
5052
|
}
|
|
5055
5053
|
});
|
|
5056
5054
|
}, [key, storage, defaultValue]);
|
|
5057
|
-
(0,
|
|
5055
|
+
(0, import_react24.useEffect)(() => {
|
|
5058
5056
|
storage.setItem(key, val.toString());
|
|
5059
5057
|
}, [key, storage, val]);
|
|
5060
5058
|
return [val, setVal];
|
|
@@ -5090,13 +5088,13 @@ var BottomBarToggleIcon = ({
|
|
|
5090
5088
|
};
|
|
5091
5089
|
|
|
5092
5090
|
// src/icon/CloseFullscreenIcon.tsx
|
|
5093
|
-
var
|
|
5091
|
+
var import_react25 = require("react");
|
|
5094
5092
|
var import_react_native_svg13 = __toESM(require("react-native-svg"));
|
|
5095
|
-
var
|
|
5093
|
+
var import_react_native_theming15 = require("@storybook/react-native-theming");
|
|
5096
5094
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5097
5095
|
function CloseFullscreenIcon({ color, width = 14, height = 14, ...props }) {
|
|
5098
|
-
const theme = (0,
|
|
5099
|
-
const fillColor = (0,
|
|
5096
|
+
const theme = (0, import_react_native_theming15.useTheme)();
|
|
5097
|
+
const fillColor = (0, import_react25.useMemo)(() => {
|
|
5100
5098
|
return color ?? theme.color.defaultText;
|
|
5101
5099
|
}, [color, theme.color.defaultText]);
|
|
5102
5100
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native_svg13.default, { fill: fillColor, height, viewBox: "0 0 16 16", width, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native_svg13.Path, { d: "M5.5 0a.5.5 0 01.5.5v4A1.5 1.5 0 014.5 6h-4a.5.5 0 010-1h4a.5.5 0 00.5-.5v-4a.5.5 0 01.5-.5zm5 0a.5.5 0 01.5.5v4a.5.5 0 00.5.5h4a.5.5 0 010 1h-4A1.5 1.5 0 0110 4.5v-4a.5.5 0 01.5-.5zM0 10.5a.5.5 0 01.5-.5h4A1.5 1.5 0 016 11.5v4a.5.5 0 01-1 0v-4a.5.5 0 00-.5-.5h-4a.5.5 0 01-.5-.5zm10 1a1.5 1.5 0 011.5-1.5h4a.5.5 0 010 1h-4a.5.5 0 00-.5.5v4a.5.5 0 01-1 0v-4z" }) });
|
|
@@ -5104,12 +5102,12 @@ function CloseFullscreenIcon({ color, width = 14, height = 14, ...props }) {
|
|
|
5104
5102
|
|
|
5105
5103
|
// src/icon/FullscreenIcon.tsx
|
|
5106
5104
|
var import_react_native_svg14 = __toESM(require("react-native-svg"));
|
|
5107
|
-
var
|
|
5108
|
-
var
|
|
5105
|
+
var import_react_native_theming16 = require("@storybook/react-native-theming");
|
|
5106
|
+
var import_react26 = require("react");
|
|
5109
5107
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5110
5108
|
function FullscreenIcon({ color, width = 14, height = 14, ...props }) {
|
|
5111
|
-
const theme = (0,
|
|
5112
|
-
const fillColor = (0,
|
|
5109
|
+
const theme = (0, import_react_native_theming16.useTheme)();
|
|
5110
|
+
const fillColor = (0, import_react26.useMemo)(() => {
|
|
5113
5111
|
return color ?? theme.color.defaultText;
|
|
5114
5112
|
}, [color, theme.color.defaultText]);
|
|
5115
5113
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native_svg14.default, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
@@ -5153,7 +5151,6 @@ var desktopLogoContainer = {
|
|
|
5153
5151
|
var contentContainerStyle = { flex: 1, overflow: "hidden" };
|
|
5154
5152
|
var mobileContentStyle = { flex: 1, overflow: "hidden" };
|
|
5155
5153
|
var placeholderObject = {};
|
|
5156
|
-
var placeholderArray = [];
|
|
5157
5154
|
var iconFloatRightStyle = { marginLeft: "auto" };
|
|
5158
5155
|
var navButtonStyle = { flexShrink: 1 };
|
|
5159
5156
|
var navButtonHitSlop = { bottom: 10, left: 10, right: 10, top: 10 };
|
|
@@ -5167,9 +5164,9 @@ var Layout = ({
|
|
|
5167
5164
|
story,
|
|
5168
5165
|
children
|
|
5169
5166
|
}) => {
|
|
5170
|
-
const theme = (0,
|
|
5171
|
-
const mobileMenuDrawerRef = (0,
|
|
5172
|
-
const addonPanelRef = (0,
|
|
5167
|
+
const theme = (0, import_react_native_theming17.useTheme)();
|
|
5168
|
+
const mobileMenuDrawerRef = (0, import_react27.useRef)(null);
|
|
5169
|
+
const addonPanelRef = (0, import_react27.useRef)(null);
|
|
5173
5170
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
5174
5171
|
const { isDesktop } = useLayout();
|
|
5175
5172
|
const [desktopSidebarOpen, setDesktopSidebarOpen] = useStoreBooleanState(
|
|
@@ -5180,7 +5177,7 @@ var Layout = ({
|
|
|
5180
5177
|
"desktopPanelState",
|
|
5181
5178
|
true
|
|
5182
5179
|
);
|
|
5183
|
-
const [uiHidden, setUiHidden] = (0,
|
|
5180
|
+
const [uiHidden, setUiHidden] = (0, import_react27.useState)(false);
|
|
5184
5181
|
const desktopSidebarStyle = useStyle(
|
|
5185
5182
|
() => ({
|
|
5186
5183
|
width: desktopSidebarOpen ? 240 : void 0,
|
|
@@ -5247,10 +5244,10 @@ var Layout = ({
|
|
|
5247
5244
|
}),
|
|
5248
5245
|
[theme.barTextColor]
|
|
5249
5246
|
);
|
|
5250
|
-
const openMobileMenu = (0,
|
|
5247
|
+
const openMobileMenu = (0, import_react27.useCallback)(() => {
|
|
5251
5248
|
mobileMenuDrawerRef.current.setMobileMenuOpen(true);
|
|
5252
5249
|
}, [mobileMenuDrawerRef]);
|
|
5253
|
-
const setSelection = (0,
|
|
5250
|
+
const setSelection = (0, import_react27.useCallback)(({ storyId: newStoryId }) => {
|
|
5254
5251
|
const channel = import_manager_api2.addons.getChannel();
|
|
5255
5252
|
channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
|
|
5256
5253
|
}, []);
|
|
@@ -5268,7 +5265,6 @@ var Layout = ({
|
|
|
5268
5265
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5269
5266
|
Sidebar,
|
|
5270
5267
|
{
|
|
5271
|
-
extra: placeholderArray,
|
|
5272
5268
|
previewInitialized: true,
|
|
5273
5269
|
indexError: void 0,
|
|
5274
5270
|
refs: placeholderObject,
|
|
@@ -5333,7 +5329,6 @@ var Layout = ({
|
|
|
5333
5329
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5334
5330
|
Sidebar,
|
|
5335
5331
|
{
|
|
5336
|
-
extra: placeholderArray,
|
|
5337
5332
|
previewInitialized: true,
|
|
5338
5333
|
indexError: void 0,
|
|
5339
5334
|
refs: placeholderObject,
|
|
@@ -5348,7 +5343,7 @@ var Layout = ({
|
|
|
5348
5343
|
isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
|
|
5349
5344
|
] });
|
|
5350
5345
|
};
|
|
5351
|
-
var Nav =
|
|
5346
|
+
var Nav = import_react_native_theming17.styled.View({
|
|
5352
5347
|
display: "flex",
|
|
5353
5348
|
flexDirection: "row",
|
|
5354
5349
|
alignItems: "center",
|
|
@@ -5357,14 +5352,14 @@ var Nav = import_react_native_theming18.styled.View({
|
|
|
5357
5352
|
height: 40,
|
|
5358
5353
|
paddingHorizontal: 6
|
|
5359
5354
|
});
|
|
5360
|
-
var Container3 =
|
|
5355
|
+
var Container3 = import_react_native_theming17.styled.View(({ theme }) => ({
|
|
5361
5356
|
alignSelf: "flex-end",
|
|
5362
5357
|
width: "100%",
|
|
5363
5358
|
backgroundColor: theme.barBg,
|
|
5364
5359
|
borderTopColor: theme.appBorderColor,
|
|
5365
5360
|
borderTopWidth: 1
|
|
5366
5361
|
}));
|
|
5367
|
-
var Button2 =
|
|
5362
|
+
var Button2 = import_react_native_theming17.styled.TouchableOpacity(({ theme }) => ({
|
|
5368
5363
|
display: "flex",
|
|
5369
5364
|
flexDirection: "row",
|
|
5370
5365
|
alignItems: "center",
|
|
@@ -5633,35 +5628,41 @@ var transformStoryIndexToStoriesHash = (input, { provider, docsOptions, filters,
|
|
|
5633
5628
|
var transformStoryIndexV2toV3 = (index) => {
|
|
5634
5629
|
return {
|
|
5635
5630
|
v: 3,
|
|
5636
|
-
stories: Object.values(index.stories).reduce(
|
|
5637
|
-
acc
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5631
|
+
stories: Object.values(index.stories).reduce(
|
|
5632
|
+
(acc, entry) => {
|
|
5633
|
+
acc[entry.id] = {
|
|
5634
|
+
...entry,
|
|
5635
|
+
title: entry.kind,
|
|
5636
|
+
name: entry.name || entry.story,
|
|
5637
|
+
importPath: entry.parameters.fileName || ""
|
|
5638
|
+
};
|
|
5639
|
+
return acc;
|
|
5640
|
+
},
|
|
5641
|
+
{}
|
|
5642
|
+
)
|
|
5645
5643
|
};
|
|
5646
5644
|
};
|
|
5647
5645
|
var transformStoryIndexV3toV4 = (index) => {
|
|
5648
5646
|
const countByTitle = (0, import_countBy.default)(Object.values(index.stories), "title");
|
|
5649
5647
|
return {
|
|
5650
5648
|
v: 4,
|
|
5651
|
-
entries: Object.values(index.stories).reduce(
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5649
|
+
entries: Object.values(index.stories).reduce(
|
|
5650
|
+
(acc, entry) => {
|
|
5651
|
+
let type = "story";
|
|
5652
|
+
if (entry.parameters?.docsOnly || entry.name === "Page" && countByTitle[entry.title] === 1) {
|
|
5653
|
+
type = "docs";
|
|
5654
|
+
}
|
|
5655
|
+
acc[entry.id] = {
|
|
5656
|
+
type,
|
|
5657
|
+
...type === "docs" && { tags: ["stories-mdx"], storiesImports: [] },
|
|
5658
|
+
...entry
|
|
5659
|
+
};
|
|
5660
|
+
delete acc[entry.id].story;
|
|
5661
|
+
delete acc[entry.id].kind;
|
|
5662
|
+
return acc;
|
|
5663
|
+
},
|
|
5664
|
+
{}
|
|
5665
|
+
)
|
|
5665
5666
|
};
|
|
5666
5667
|
};
|
|
5667
5668
|
// Annotate the CommonJS export names for ESM import in node:
|