@storybook/react-native-ui 8.5.2-alpha.0 → 8.5.2-alpha.2
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.js +425 -352
- package/package.json +3 -3
- package/src/Layout.tsx +162 -102
- package/src/MobileAddonsPanel.tsx +96 -49
- package/src/MobileMenuDrawer.tsx +34 -20
- package/src/Search.tsx +6 -4
- package/src/StorybookLogo.tsx +5 -2
- package/src/TreeNode.tsx +17 -12
- package/src/icon/CloseFullscreenIcon.tsx +6 -8
- package/src/icon/CollapseAllIcon.tsx +6 -1
- package/src/icon/ExpandAllIcon.tsx +7 -1
- package/src/icon/FullscreenIcon.tsx +6 -1
- package/src/util/status.tsx +7 -7
- package/src/util/useStyle.ts +28 -0
package/dist/index.js
CHANGED
|
@@ -3087,17 +3087,13 @@ var GroupNode = import_react.default.memo(function GroupNode2({
|
|
|
3087
3087
|
...props
|
|
3088
3088
|
}) {
|
|
3089
3089
|
const theme = (0, import_react_native_theming2.useTheme)();
|
|
3090
|
+
const color = (0, import_react.useMemo)(() => {
|
|
3091
|
+
return theme.base === "dark" ? theme.color.primary : theme.color.ultraviolet;
|
|
3092
|
+
}, [theme.base, theme.color.primary, theme.color.ultraviolet]);
|
|
3090
3093
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(BranchNode, { isExpandable, ...props, children: [
|
|
3091
3094
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Wrapper, { children: [
|
|
3092
3095
|
isExpandable && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapseIcon, { isExpanded }),
|
|
3093
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3094
|
-
GroupIcon,
|
|
3095
|
-
{
|
|
3096
|
-
width: "14",
|
|
3097
|
-
height: "14",
|
|
3098
|
-
color: theme.base === "dark" ? theme.color.primary : theme.color.ultraviolet
|
|
3099
|
-
}
|
|
3100
|
-
)
|
|
3096
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GroupIcon, { width: 14, height: 14, color })
|
|
3101
3097
|
] }),
|
|
3102
3098
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BranchNodeText, { children })
|
|
3103
3099
|
] });
|
|
@@ -3105,10 +3101,13 @@ var GroupNode = import_react.default.memo(function GroupNode2({
|
|
|
3105
3101
|
var ComponentNode = import_react.default.memo(
|
|
3106
3102
|
function ComponentNode2({ children, isExpanded, isExpandable, ...props }) {
|
|
3107
3103
|
const theme = (0, import_react_native_theming2.useTheme)();
|
|
3104
|
+
const color = (0, import_react.useMemo)(() => {
|
|
3105
|
+
return theme.color.secondary;
|
|
3106
|
+
}, [theme.color.secondary]);
|
|
3108
3107
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(BranchNode, { isExpandable, ...props, children: [
|
|
3109
3108
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Wrapper, { children: [
|
|
3110
3109
|
isExpandable && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapseIcon, { isExpanded }),
|
|
3111
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ComponentIcon, { width: 12, height: 12, color
|
|
3110
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ComponentIcon, { width: 12, height: 12, color })
|
|
3112
3111
|
] }),
|
|
3113
3112
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BranchNodeText, { children })
|
|
3114
3113
|
] });
|
|
@@ -3119,22 +3118,18 @@ var StoryNode = import_react.default.memo(function StoryNode2({
|
|
|
3119
3118
|
...props
|
|
3120
3119
|
}) {
|
|
3121
3120
|
const theme = (0, import_react_native_theming2.useTheme)();
|
|
3121
|
+
const color = (0, import_react.useMemo)(() => {
|
|
3122
|
+
return props.selected ? theme.color.lightest : theme.color.seafoam;
|
|
3123
|
+
}, [props.selected, theme.color.lightest, theme.color.seafoam]);
|
|
3122
3124
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(LeafNode, { ...props, children: [
|
|
3123
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
3124
|
-
StoryIcon,
|
|
3125
|
-
{
|
|
3126
|
-
width: 14,
|
|
3127
|
-
height: 14,
|
|
3128
|
-
color: props.selected ? theme.color.lightest : theme.color.seafoam
|
|
3129
|
-
}
|
|
3130
|
-
) }),
|
|
3125
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StoryIcon, { width: 14, height: 14, color }) }),
|
|
3131
3126
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LeafNodeText, { selected: props.selected, children })
|
|
3132
3127
|
] });
|
|
3133
3128
|
});
|
|
3134
3129
|
|
|
3135
3130
|
// src/Tree.tsx
|
|
3136
3131
|
var import_react_native_theming7 = require("@storybook/react-native-theming");
|
|
3137
|
-
var
|
|
3132
|
+
var import_react8 = __toESM(require("react"));
|
|
3138
3133
|
|
|
3139
3134
|
// src/Button.tsx
|
|
3140
3135
|
var import_react_native_theming3 = require("@storybook/react-native-theming");
|
|
@@ -3294,6 +3289,7 @@ IconButton.displayName = "IconButton";
|
|
|
3294
3289
|
// src/icon/CollapseAllIcon.tsx
|
|
3295
3290
|
var import_react_native_svg5 = require("react-native-svg");
|
|
3296
3291
|
var import_react_native_theming4 = require("@storybook/react-native-theming");
|
|
3292
|
+
var import_react4 = require("react");
|
|
3297
3293
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3298
3294
|
var CollapseAllIcon = ({
|
|
3299
3295
|
color,
|
|
@@ -3303,11 +3299,14 @@ var CollapseAllIcon = ({
|
|
|
3303
3299
|
...props
|
|
3304
3300
|
}) => {
|
|
3305
3301
|
const theme = (0, import_react_native_theming4.useTheme)();
|
|
3302
|
+
const fillColor = (0, import_react4.useMemo)(() => {
|
|
3303
|
+
return color ?? theme.color.defaultText;
|
|
3304
|
+
}, [color, theme.color.defaultText]);
|
|
3306
3305
|
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)(
|
|
3307
3306
|
import_react_native_svg5.Path,
|
|
3308
3307
|
{
|
|
3309
3308
|
d: "M3.354.146a.5.5 0 10-.708.708l4 4a.5.5 0 00.708 0l4-4a.5.5 0 00-.708-.708L7 3.793 3.354.146zM6.646 9.146a.5.5 0 01.708 0l4 4a.5.5 0 01-.708.708L7 10.207l-3.646 3.647a.5.5 0 01-.708-.708l4-4z",
|
|
3310
|
-
fill:
|
|
3309
|
+
fill: fillColor
|
|
3311
3310
|
}
|
|
3312
3311
|
) });
|
|
3313
3312
|
};
|
|
@@ -3315,6 +3314,7 @@ var CollapseAllIcon = ({
|
|
|
3315
3314
|
// src/icon/ExpandAllIcon.tsx
|
|
3316
3315
|
var import_react_native_svg6 = require("react-native-svg");
|
|
3317
3316
|
var import_react_native_theming5 = require("@storybook/react-native-theming");
|
|
3317
|
+
var import_react5 = require("react");
|
|
3318
3318
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3319
3319
|
var ExpandAllIcon = ({
|
|
3320
3320
|
color,
|
|
@@ -3324,17 +3324,20 @@ var ExpandAllIcon = ({
|
|
|
3324
3324
|
...props
|
|
3325
3325
|
}) => {
|
|
3326
3326
|
const theme = (0, import_react_native_theming5.useTheme)();
|
|
3327
|
+
const fillColor = (0, import_react5.useMemo)(() => {
|
|
3328
|
+
return color ?? theme.color.defaultText;
|
|
3329
|
+
}, [color, theme.color.defaultText]);
|
|
3327
3330
|
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)(
|
|
3328
3331
|
import_react_native_svg6.Path,
|
|
3329
3332
|
{
|
|
3330
3333
|
d: "M7.354.146l4 4a.5.5 0 01-.708.708L7 1.207 3.354 4.854a.5.5 0 11-.708-.708l4-4a.5.5 0 01.708 0zM11.354 9.146a.5.5 0 010 .708l-4 4a.5.5 0 01-.708 0l-4-4a.5.5 0 11.708-.708L7 12.793l3.646-3.647a.5.5 0 01.708 0z",
|
|
3331
|
-
fill:
|
|
3334
|
+
fill: fillColor
|
|
3332
3335
|
}
|
|
3333
3336
|
) });
|
|
3334
3337
|
};
|
|
3335
3338
|
|
|
3336
3339
|
// src/hooks/useExpanded.ts
|
|
3337
|
-
var
|
|
3340
|
+
var import_react6 = require("react");
|
|
3338
3341
|
|
|
3339
3342
|
// src/util/tree.ts
|
|
3340
3343
|
var import_memoizerific = __toESM(require("memoizerific"));
|
|
@@ -3415,21 +3418,22 @@ var useExpanded = ({
|
|
|
3415
3418
|
rootIds,
|
|
3416
3419
|
selectedStoryId
|
|
3417
3420
|
}) => {
|
|
3418
|
-
const [expanded, setExpanded] = (0,
|
|
3421
|
+
const [expanded, setExpanded] = (0, import_react6.useReducer)(
|
|
3419
3422
|
(state, { ids, value }) => ids.reduce((acc, id) => Object.assign(acc, { [id]: value }), { ...state }),
|
|
3420
3423
|
{ refId, data, rootIds, initialExpanded },
|
|
3421
3424
|
initializeExpanded
|
|
3422
3425
|
);
|
|
3423
|
-
const updateExpanded = (0,
|
|
3426
|
+
const updateExpanded = (0, import_react6.useCallback)(({ ids, value }) => {
|
|
3424
3427
|
setExpanded({ ids, value });
|
|
3425
3428
|
}, []);
|
|
3426
|
-
(0,
|
|
3429
|
+
(0, import_react6.useEffect)(() => {
|
|
3427
3430
|
setExpanded({ ids: getAncestorIds(data, selectedStoryId), value: true });
|
|
3428
3431
|
}, [data, selectedStoryId]);
|
|
3429
3432
|
return [expanded, updateExpanded];
|
|
3430
3433
|
};
|
|
3431
3434
|
|
|
3432
3435
|
// src/util/status.tsx
|
|
3436
|
+
var import_react7 = require("react");
|
|
3433
3437
|
var import_react_native_theming6 = require("@storybook/react-native-theming");
|
|
3434
3438
|
var import_react_native_svg7 = __toESM(require("react-native-svg"));
|
|
3435
3439
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
@@ -3441,13 +3445,10 @@ function SmallIcons(props) {
|
|
|
3441
3445
|
}
|
|
3442
3446
|
function LoadingIcons(props) {
|
|
3443
3447
|
const theme = (0, import_react_native_theming6.useTheme)();
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
...props
|
|
3449
|
-
}
|
|
3450
|
-
);
|
|
3448
|
+
const color = (0, import_react7.useMemo)(() => {
|
|
3449
|
+
return theme.base === "light" ? theme.color.mediumdark : theme.color.darker;
|
|
3450
|
+
}, [theme.base, theme.color.darker, theme.color.mediumdark]);
|
|
3451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SmallIcons, { color, ...props });
|
|
3451
3452
|
}
|
|
3452
3453
|
var statusPriority = ["unknown", "pending", "success", "warn", "error"];
|
|
3453
3454
|
var statusMapping = {
|
|
@@ -3483,7 +3484,7 @@ var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
|
3483
3484
|
var TextItem = import_react_native_theming7.styled.Text(({ theme }) => ({
|
|
3484
3485
|
color: theme.color.defaultText
|
|
3485
3486
|
}));
|
|
3486
|
-
var Node =
|
|
3487
|
+
var Node = import_react8.default.memo(function Node2({
|
|
3487
3488
|
item,
|
|
3488
3489
|
refId,
|
|
3489
3490
|
isOrphan,
|
|
@@ -3611,9 +3612,9 @@ var CollapseButton = import_react_native_theming7.styled.TouchableOpacity(({}) =
|
|
|
3611
3612
|
cursor: "pointer",
|
|
3612
3613
|
height: 28
|
|
3613
3614
|
}));
|
|
3614
|
-
var Tree =
|
|
3615
|
-
const containerRef = (0,
|
|
3616
|
-
const [rootIds, orphanIds, initialExpanded] = (0,
|
|
3615
|
+
var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, status, docsMode, selectedStoryId, onSelectStoryId }) {
|
|
3616
|
+
const containerRef = (0, import_react8.useRef)(null);
|
|
3617
|
+
const [rootIds, orphanIds, initialExpanded] = (0, import_react8.useMemo)(
|
|
3617
3618
|
() => Object.keys(data).reduce(
|
|
3618
3619
|
(acc, id) => {
|
|
3619
3620
|
const item = data[id];
|
|
@@ -3629,7 +3630,7 @@ var Tree = import_react5.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3629
3630
|
),
|
|
3630
3631
|
[data]
|
|
3631
3632
|
);
|
|
3632
|
-
const { expandableDescendants } = (0,
|
|
3633
|
+
const { expandableDescendants } = (0, import_react8.useMemo)(() => {
|
|
3633
3634
|
return [...orphanIds, ...rootIds].reduce(
|
|
3634
3635
|
(acc, nodeId) => {
|
|
3635
3636
|
acc.expandableDescendants[nodeId] = getDescendantIds(data, nodeId, false).filter(
|
|
@@ -3640,7 +3641,7 @@ var Tree = import_react5.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3640
3641
|
{ orphansFirst: [], expandableDescendants: {} }
|
|
3641
3642
|
);
|
|
3642
3643
|
}, [data, rootIds, orphanIds]);
|
|
3643
|
-
const singleStoryComponentIds = (0,
|
|
3644
|
+
const singleStoryComponentIds = (0, import_react8.useMemo)(() => {
|
|
3644
3645
|
return Object.keys(data).filter((id) => {
|
|
3645
3646
|
const entry = data[id];
|
|
3646
3647
|
if (entry.type !== "component")
|
|
@@ -3656,12 +3657,12 @@ var Tree = import_react5.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3656
3657
|
return false;
|
|
3657
3658
|
});
|
|
3658
3659
|
}, [data]);
|
|
3659
|
-
const collapsedItems = (0,
|
|
3660
|
+
const collapsedItems = (0, import_react8.useMemo)(
|
|
3660
3661
|
() => Object.keys(data).filter((id) => !singleStoryComponentIds.includes(id)),
|
|
3661
3662
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3662
3663
|
[singleStoryComponentIds]
|
|
3663
3664
|
);
|
|
3664
|
-
const collapsedData = (0,
|
|
3665
|
+
const collapsedData = (0, import_react8.useMemo)(() => {
|
|
3665
3666
|
return singleStoryComponentIds.reduce(
|
|
3666
3667
|
(acc, id) => {
|
|
3667
3668
|
const { children, parent, name } = data[id];
|
|
@@ -3682,7 +3683,7 @@ var Tree = import_react5.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3682
3683
|
{ ...data }
|
|
3683
3684
|
);
|
|
3684
3685
|
}, [data]);
|
|
3685
|
-
const ancestry = (0,
|
|
3686
|
+
const ancestry = (0, import_react8.useMemo)(() => {
|
|
3686
3687
|
return collapsedItems.reduce(
|
|
3687
3688
|
(acc, id) => Object.assign(acc, { [id]: getAncestorIds(collapsedData, id) }),
|
|
3688
3689
|
{}
|
|
@@ -3696,8 +3697,8 @@ var Tree = import_react5.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3696
3697
|
selectedStoryId,
|
|
3697
3698
|
onSelectStoryId
|
|
3698
3699
|
});
|
|
3699
|
-
const groupStatus = (0,
|
|
3700
|
-
const treeItems = (0,
|
|
3700
|
+
const groupStatus = (0, import_react8.useMemo)(() => getGroupStatus(collapsedData, status), [collapsedData, status]);
|
|
3701
|
+
const treeItems = (0, import_react8.useMemo)(() => {
|
|
3701
3702
|
return collapsedItems.map((itemId) => {
|
|
3702
3703
|
const item = collapsedData[itemId];
|
|
3703
3704
|
const id = createId(itemId, refId);
|
|
@@ -3765,13 +3766,13 @@ var Container = import_react_native_theming7.styled.View((props) => ({
|
|
|
3765
3766
|
marginTop: props.hasOrphans ? 20 : 0,
|
|
3766
3767
|
marginBottom: 20
|
|
3767
3768
|
}));
|
|
3768
|
-
var Root =
|
|
3769
|
+
var Root = import_react8.default.memo(function Root2({
|
|
3769
3770
|
setExpanded,
|
|
3770
3771
|
isFullyExpanded,
|
|
3771
3772
|
expandableDescendants,
|
|
3772
3773
|
...props
|
|
3773
3774
|
}) {
|
|
3774
|
-
const setFullyExpanded = (0,
|
|
3775
|
+
const setFullyExpanded = (0, import_react8.useCallback)(
|
|
3775
3776
|
() => setExpanded({ ids: expandableDescendants, value: !isFullyExpanded }),
|
|
3776
3777
|
[setExpanded, isFullyExpanded, expandableDescendants]
|
|
3777
3778
|
);
|
|
@@ -3787,10 +3788,10 @@ var Root = import_react5.default.memo(function Root2({
|
|
|
3787
3788
|
});
|
|
3788
3789
|
|
|
3789
3790
|
// src/LayoutProvider.tsx
|
|
3790
|
-
var
|
|
3791
|
+
var import_react9 = require("react");
|
|
3791
3792
|
var import_react_native = require("react-native");
|
|
3792
3793
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3793
|
-
var LayoutContext = (0,
|
|
3794
|
+
var LayoutContext = (0, import_react9.createContext)({
|
|
3794
3795
|
isDesktop: false,
|
|
3795
3796
|
isMobile: true
|
|
3796
3797
|
});
|
|
@@ -3798,7 +3799,7 @@ var LayoutProvider = ({ children }) => {
|
|
|
3798
3799
|
const { width } = (0, import_react_native.useWindowDimensions)();
|
|
3799
3800
|
const isDesktop = width >= BREAKPOINT;
|
|
3800
3801
|
const isMobile = !isDesktop;
|
|
3801
|
-
const contextValue = (0,
|
|
3802
|
+
const contextValue = (0, import_react9.useMemo)(
|
|
3802
3803
|
() => ({
|
|
3803
3804
|
isDesktop,
|
|
3804
3805
|
isMobile
|
|
@@ -3807,19 +3808,19 @@ var LayoutProvider = ({ children }) => {
|
|
|
3807
3808
|
);
|
|
3808
3809
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LayoutContext.Provider, { value: contextValue, children });
|
|
3809
3810
|
};
|
|
3810
|
-
var useLayout = () => (0,
|
|
3811
|
+
var useLayout = () => (0, import_react9.useContext)(LayoutContext);
|
|
3811
3812
|
|
|
3812
3813
|
// src/Explorer.tsx
|
|
3813
|
-
var
|
|
3814
|
+
var import_react11 = __toESM(require("react"));
|
|
3814
3815
|
|
|
3815
3816
|
// src/Refs.tsx
|
|
3816
|
-
var
|
|
3817
|
+
var import_react10 = __toESM(require("react"));
|
|
3817
3818
|
var import_react_native_theming8 = require("@storybook/react-native-theming");
|
|
3818
3819
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3819
3820
|
var Wrapper2 = import_react_native_theming8.styled.View(({}) => ({
|
|
3820
3821
|
position: "relative"
|
|
3821
3822
|
}));
|
|
3822
|
-
var Ref =
|
|
3823
|
+
var Ref = import_react10.default.memo(function Ref2(props) {
|
|
3823
3824
|
const {
|
|
3824
3825
|
index,
|
|
3825
3826
|
id: refId,
|
|
@@ -3834,20 +3835,20 @@ var Ref = import_react7.default.memo(function Ref2(props) {
|
|
|
3834
3835
|
previewInitialized,
|
|
3835
3836
|
setSelection
|
|
3836
3837
|
} = props;
|
|
3837
|
-
const length = (0,
|
|
3838
|
+
const length = (0, import_react10.useMemo)(() => index ? Object.keys(index).length : 0, [index]);
|
|
3838
3839
|
const isLoadingInjected = type === "auto-inject" && !previewInitialized || type === "server-checked";
|
|
3839
3840
|
const isLoading = isLoadingMain || isLoadingInjected || type === "unknown";
|
|
3840
3841
|
const isError = !!indexError;
|
|
3841
3842
|
const isEmpty = !isLoading && length === 0;
|
|
3842
3843
|
const isAuthRequired = !!loginUrl && length === 0;
|
|
3843
3844
|
const state = getStateType(isLoading, isAuthRequired, isError, isEmpty);
|
|
3844
|
-
const [isExpanded, setExpanded] = (0,
|
|
3845
|
-
(0,
|
|
3845
|
+
const [isExpanded, setExpanded] = (0, import_react10.useState)(expanded);
|
|
3846
|
+
(0, import_react10.useEffect)(() => {
|
|
3846
3847
|
if (index && selectedStoryId && index[selectedStoryId]) {
|
|
3847
3848
|
setExpanded(true);
|
|
3848
3849
|
}
|
|
3849
3850
|
}, [setExpanded, index, selectedStoryId]);
|
|
3850
|
-
const onSelectStoryId = (0,
|
|
3851
|
+
const onSelectStoryId = (0, import_react10.useCallback)(
|
|
3851
3852
|
(storyId) => {
|
|
3852
3853
|
setSelection({ refId, storyId });
|
|
3853
3854
|
},
|
|
@@ -3871,16 +3872,16 @@ var Ref = import_react7.default.memo(function Ref2(props) {
|
|
|
3871
3872
|
// src/Explorer.tsx
|
|
3872
3873
|
var import_react_native2 = require("react-native");
|
|
3873
3874
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3874
|
-
var
|
|
3875
|
-
var Explorer =
|
|
3875
|
+
var import_react12 = require("react");
|
|
3876
|
+
var Explorer = import_react11.default.memo(function Explorer2({
|
|
3876
3877
|
isLoading,
|
|
3877
3878
|
isBrowsing,
|
|
3878
3879
|
dataset,
|
|
3879
3880
|
selected,
|
|
3880
3881
|
setSelection
|
|
3881
3882
|
}) {
|
|
3882
|
-
const containerRef = (0,
|
|
3883
|
-
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,
|
|
3883
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
3884
|
+
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)(
|
|
3884
3885
|
Ref,
|
|
3885
3886
|
{
|
|
3886
3887
|
...ref,
|
|
@@ -3894,14 +3895,14 @@ var Explorer = import_react8.default.memo(function Explorer2({
|
|
|
3894
3895
|
});
|
|
3895
3896
|
|
|
3896
3897
|
// src/Sidebar.tsx
|
|
3897
|
-
var
|
|
3898
|
+
var import_react17 = __toESM(require("react"));
|
|
3898
3899
|
var import_react_native_theming11 = require("@storybook/react-native-theming");
|
|
3899
3900
|
|
|
3900
3901
|
// src/Search.tsx
|
|
3901
3902
|
var import_bottom_sheet = require("@gorhom/bottom-sheet");
|
|
3902
3903
|
var import_react_native_theming9 = require("@storybook/react-native-theming");
|
|
3903
3904
|
var import_fuse = __toESM(require("fuse.js"));
|
|
3904
|
-
var
|
|
3905
|
+
var import_react13 = __toESM(require("react"));
|
|
3905
3906
|
var import_react_native3 = require("react-native");
|
|
3906
3907
|
|
|
3907
3908
|
// src/icon/CloseIcon.tsx
|
|
@@ -3998,6 +3999,8 @@ var BottomSheetInput = (0, import_react_native_theming9.styled)(import_bottom_sh
|
|
|
3998
3999
|
height: 32,
|
|
3999
4000
|
paddingLeft: 28,
|
|
4000
4001
|
paddingRight: 28,
|
|
4002
|
+
paddingTop: import_react_native3.Platform.OS === "android" ? 0 : void 0,
|
|
4003
|
+
paddingBottom: import_react_native3.Platform.OS === "android" ? 0 : void 0,
|
|
4001
4004
|
borderWidth: 1,
|
|
4002
4005
|
borderColor: theme.appBorderColor,
|
|
4003
4006
|
backgroundColor: "transparent",
|
|
@@ -4031,13 +4034,13 @@ var ClearIcon = import_react_native_theming9.styled.TouchableOpacity(({ theme })
|
|
|
4031
4034
|
justifyContent: "center",
|
|
4032
4035
|
height: "100%"
|
|
4033
4036
|
}));
|
|
4034
|
-
var Search =
|
|
4035
|
-
const inputRef = (0,
|
|
4036
|
-
const [inputValue, setInputValue] = (0,
|
|
4037
|
-
const [isOpen, setIsOpen] = (0,
|
|
4038
|
-
const [allComponents, showAllComponents] = (0,
|
|
4037
|
+
var Search = import_react13.default.memo(function Search2({ children, dataset, setSelection, getLastViewed, initialQuery = "" }) {
|
|
4038
|
+
const inputRef = (0, import_react13.useRef)(null);
|
|
4039
|
+
const [inputValue, setInputValue] = (0, import_react13.useState)(initialQuery);
|
|
4040
|
+
const [isOpen, setIsOpen] = (0, import_react13.useState)(false);
|
|
4041
|
+
const [allComponents, showAllComponents] = (0, import_react13.useState)(false);
|
|
4039
4042
|
const { isMobile } = useLayout();
|
|
4040
|
-
const selectStory = (0,
|
|
4043
|
+
const selectStory = (0, import_react13.useCallback)(
|
|
4041
4044
|
(id, refId) => {
|
|
4042
4045
|
setSelection({ storyId: id, refId });
|
|
4043
4046
|
inputRef.current?.blur();
|
|
@@ -4046,7 +4049,7 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
|
|
|
4046
4049
|
},
|
|
4047
4050
|
[setSelection]
|
|
4048
4051
|
);
|
|
4049
|
-
const getItemProps = (0,
|
|
4052
|
+
const getItemProps = (0, import_react13.useCallback)(
|
|
4050
4053
|
({ item: result }) => {
|
|
4051
4054
|
return {
|
|
4052
4055
|
icon: result?.item?.type === "component" ? "component" : "story",
|
|
@@ -4069,7 +4072,7 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
|
|
|
4069
4072
|
},
|
|
4070
4073
|
[selectStory]
|
|
4071
4074
|
);
|
|
4072
|
-
const makeFuse = (0,
|
|
4075
|
+
const makeFuse = (0, import_react13.useCallback)(() => {
|
|
4073
4076
|
const list = dataset.entries.reduce((acc, [refId, { index, status }]) => {
|
|
4074
4077
|
const groupStatus = getGroupStatus(index || {}, status);
|
|
4075
4078
|
if (index) {
|
|
@@ -4087,7 +4090,7 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
|
|
|
4087
4090
|
}, []);
|
|
4088
4091
|
return new import_fuse.default(list, options);
|
|
4089
4092
|
}, [dataset]);
|
|
4090
|
-
const getResults = (0,
|
|
4093
|
+
const getResults = (0, import_react13.useCallback)(
|
|
4091
4094
|
(input2) => {
|
|
4092
4095
|
const fuse = makeFuse();
|
|
4093
4096
|
if (!input2)
|
|
@@ -4129,7 +4132,8 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
|
|
|
4129
4132
|
},
|
|
4130
4133
|
[allComponents, dataset.hash, getLastViewed, makeFuse]
|
|
4131
4134
|
);
|
|
4132
|
-
const
|
|
4135
|
+
const deferredQuery = (0, import_react13.useDeferredValue)(inputValue);
|
|
4136
|
+
const input = deferredQuery ? deferredQuery.trim() : "";
|
|
4133
4137
|
const results = input ? getResults(input) : [];
|
|
4134
4138
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native3.View, { style: { flex: 1 }, children: [
|
|
4135
4139
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SearchField, { children: [
|
|
@@ -4168,11 +4172,11 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
|
|
|
4168
4172
|
|
|
4169
4173
|
// src/SearchResults.tsx
|
|
4170
4174
|
var import_react_native_theming10 = require("@storybook/react-native-theming");
|
|
4171
|
-
var
|
|
4175
|
+
var import_react14 = __toESM(require("react"));
|
|
4172
4176
|
var import_polished2 = require("polished");
|
|
4173
4177
|
var import_react_native4 = require("react-native");
|
|
4174
4178
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4175
|
-
var
|
|
4179
|
+
var import_react15 = require("react");
|
|
4176
4180
|
var ResultsList = import_react_native_theming10.styled.View({
|
|
4177
4181
|
margin: 0,
|
|
4178
4182
|
padding: 0,
|
|
@@ -4238,7 +4242,7 @@ var RecentlyOpenedTitle = import_react_native_theming10.styled.View(({ theme })
|
|
|
4238
4242
|
marginBottom: 4,
|
|
4239
4243
|
alignItems: "center"
|
|
4240
4244
|
}));
|
|
4241
|
-
var Highlight =
|
|
4245
|
+
var Highlight = import_react14.default.memo(
|
|
4242
4246
|
function Highlight2({ children, match }) {
|
|
4243
4247
|
if (!match)
|
|
4244
4248
|
return children;
|
|
@@ -4273,14 +4277,14 @@ var PathText = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
|
4273
4277
|
fontSize: theme.typography.size.s1 - 1,
|
|
4274
4278
|
color: theme.textMutedColor
|
|
4275
4279
|
}));
|
|
4276
|
-
var Result =
|
|
4280
|
+
var Result = import_react14.default.memo(function Result2({
|
|
4277
4281
|
item,
|
|
4278
4282
|
matches,
|
|
4279
4283
|
icon: _icon,
|
|
4280
4284
|
onPress,
|
|
4281
4285
|
...props
|
|
4282
4286
|
}) {
|
|
4283
|
-
const press = (0,
|
|
4287
|
+
const press = (0, import_react14.useCallback)(
|
|
4284
4288
|
(event) => {
|
|
4285
4289
|
event.preventDefault();
|
|
4286
4290
|
onPress?.(event);
|
|
@@ -4314,7 +4318,7 @@ var Result = import_react11.default.memo(function Result2({
|
|
|
4314
4318
|
var Text = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
4315
4319
|
color: theme.color.defaultText
|
|
4316
4320
|
}));
|
|
4317
|
-
var SearchResults =
|
|
4321
|
+
var SearchResults = import_react14.default.memo(function SearchResults2({
|
|
4318
4322
|
query,
|
|
4319
4323
|
results,
|
|
4320
4324
|
closeMenu,
|
|
@@ -4349,7 +4353,7 @@ var SearchResults = import_react11.default.memo(function SearchResults2({
|
|
|
4349
4353
|
}
|
|
4350
4354
|
const { item } = result;
|
|
4351
4355
|
const key = `${item.refId}::${item.id}`;
|
|
4352
|
-
return /* @__PURE__ */ (0,
|
|
4356
|
+
return /* @__PURE__ */ (0, import_react15.createElement)(
|
|
4353
4357
|
Result,
|
|
4354
4358
|
{
|
|
4355
4359
|
...result,
|
|
@@ -4364,11 +4368,11 @@ var SearchResults = import_react11.default.memo(function SearchResults2({
|
|
|
4364
4368
|
|
|
4365
4369
|
// src/hooks/useLastViewed.ts
|
|
4366
4370
|
var import_debounce = __toESM(require_debounce());
|
|
4367
|
-
var
|
|
4371
|
+
var import_react16 = require("react");
|
|
4368
4372
|
var import_store2 = __toESM(require("store2"));
|
|
4369
4373
|
var save = (0, import_debounce.default)((value) => import_store2.default.set("lastViewedStoryIds", value), 1e3);
|
|
4370
4374
|
var useLastViewed = (selection) => {
|
|
4371
|
-
const initialLastViewedStoryIds = (0,
|
|
4375
|
+
const initialLastViewedStoryIds = (0, import_react16.useMemo)(() => {
|
|
4372
4376
|
const items = import_store2.default.get("lastViewedStoryIds");
|
|
4373
4377
|
if (!items || !Array.isArray(items))
|
|
4374
4378
|
return [];
|
|
@@ -4376,8 +4380,8 @@ var useLastViewed = (selection) => {
|
|
|
4376
4380
|
return [];
|
|
4377
4381
|
return items;
|
|
4378
4382
|
}, []);
|
|
4379
|
-
const lastViewedRef = (0,
|
|
4380
|
-
const updateLastViewed = (0,
|
|
4383
|
+
const lastViewedRef = (0, import_react16.useRef)(initialLastViewedStoryIds);
|
|
4384
|
+
const updateLastViewed = (0, import_react16.useCallback)(
|
|
4381
4385
|
(story) => {
|
|
4382
4386
|
const items = lastViewedRef.current;
|
|
4383
4387
|
const index = items.findIndex(
|
|
@@ -4394,13 +4398,13 @@ var useLastViewed = (selection) => {
|
|
|
4394
4398
|
},
|
|
4395
4399
|
[lastViewedRef]
|
|
4396
4400
|
);
|
|
4397
|
-
(0,
|
|
4401
|
+
(0, import_react16.useEffect)(() => {
|
|
4398
4402
|
if (selection)
|
|
4399
4403
|
updateLastViewed(selection);
|
|
4400
4404
|
}, [selection]);
|
|
4401
4405
|
return {
|
|
4402
|
-
getLastViewed: (0,
|
|
4403
|
-
clearLastViewed: (0,
|
|
4406
|
+
getLastViewed: (0, import_react16.useCallback)(() => lastViewedRef.current, [lastViewedRef]),
|
|
4407
|
+
clearLastViewed: (0, import_react16.useCallback)(() => {
|
|
4404
4408
|
lastViewedRef.current = lastViewedRef.current.slice(0, 1);
|
|
4405
4409
|
save(lastViewedRef.current);
|
|
4406
4410
|
}, [lastViewedRef])
|
|
@@ -4424,18 +4428,18 @@ var Top = import_react_native_theming11.styled.View({
|
|
|
4424
4428
|
flex: 1,
|
|
4425
4429
|
flexDirection: "row"
|
|
4426
4430
|
});
|
|
4427
|
-
var Swap =
|
|
4431
|
+
var Swap = import_react17.default.memo(function Swap2({
|
|
4428
4432
|
children,
|
|
4429
4433
|
condition
|
|
4430
4434
|
}) {
|
|
4431
|
-
const [a, b] =
|
|
4435
|
+
const [a, b] = import_react17.default.Children.toArray(children);
|
|
4432
4436
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
4433
4437
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native5.View, { style: { display: condition ? "flex" : "none" }, children: a }),
|
|
4434
4438
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native5.View, { style: { display: condition ? "none" : "flex" }, children: b })
|
|
4435
4439
|
] });
|
|
4436
4440
|
});
|
|
4437
4441
|
var useCombination = (index, indexError, previewInitialized, status, refs) => {
|
|
4438
|
-
const hash = (0,
|
|
4442
|
+
const hash = (0, import_react17.useMemo)(
|
|
4439
4443
|
() => ({
|
|
4440
4444
|
[DEFAULT_REF_ID]: {
|
|
4441
4445
|
index,
|
|
@@ -4450,9 +4454,9 @@ var useCombination = (index, indexError, previewInitialized, status, refs) => {
|
|
|
4450
4454
|
}),
|
|
4451
4455
|
[refs, index, indexError, previewInitialized, status]
|
|
4452
4456
|
);
|
|
4453
|
-
return (0,
|
|
4457
|
+
return (0, import_react17.useMemo)(() => ({ hash, entries: Object.entries(hash) }), [hash]);
|
|
4454
4458
|
};
|
|
4455
|
-
var Sidebar =
|
|
4459
|
+
var Sidebar = import_react17.default.memo(function Sidebar2({
|
|
4456
4460
|
storyId = null,
|
|
4457
4461
|
refId = DEFAULT_REF_ID,
|
|
4458
4462
|
index,
|
|
@@ -4462,7 +4466,7 @@ var Sidebar = import_react14.default.memo(function Sidebar2({
|
|
|
4462
4466
|
refs = {},
|
|
4463
4467
|
setSelection
|
|
4464
4468
|
}) {
|
|
4465
|
-
const selected = (0,
|
|
4469
|
+
const selected = (0, import_react17.useMemo)(() => storyId && { storyId, refId }, [storyId, refId]);
|
|
4466
4470
|
const dataset = useCombination(index, indexError, previewInitialized, status, refs);
|
|
4467
4471
|
const lastViewedProps = useLastViewed(selected);
|
|
4468
4472
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Container2, { style: { paddingHorizontal: 10 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Top, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Search, { dataset, setSelection, ...lastViewedProps, children: ({ query, results, isBrowsing, closeMenu, getItemProps, highlightedIndex }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Swap, { condition: isBrowsing, children: [
|
|
@@ -4495,7 +4499,7 @@ var Sidebar = import_react14.default.memo(function Sidebar2({
|
|
|
4495
4499
|
var import_core_events = require("@storybook/core/core-events");
|
|
4496
4500
|
var import_manager_api2 = require("@storybook/core/manager-api");
|
|
4497
4501
|
var import_react_native_theming17 = require("@storybook/react-native-theming");
|
|
4498
|
-
var
|
|
4502
|
+
var import_react26 = require("react");
|
|
4499
4503
|
var import_react_native9 = require("react-native");
|
|
4500
4504
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
4501
4505
|
|
|
@@ -4504,22 +4508,37 @@ var import_bottom_sheet2 = require("@gorhom/bottom-sheet");
|
|
|
4504
4508
|
var import_manager_api = require("@storybook/core/manager-api");
|
|
4505
4509
|
var import_react_native_theming12 = require("@storybook/react-native-theming");
|
|
4506
4510
|
var import_types3 = require("@storybook/core/types");
|
|
4507
|
-
var
|
|
4511
|
+
var import_react19 = require("react");
|
|
4508
4512
|
var import_react_native6 = require("react-native");
|
|
4509
4513
|
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
4510
4514
|
var import_react_native_reanimated = __toESM(require("react-native-reanimated"));
|
|
4511
4515
|
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
4512
4516
|
var import_react_native_theming13 = require("@storybook/react-native-theming");
|
|
4517
|
+
|
|
4518
|
+
// src/util/useStyle.ts
|
|
4519
|
+
var import_react18 = require("react");
|
|
4520
|
+
var useStyle = (styleFactory, deps) => (
|
|
4521
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4522
|
+
(0, import_react18.useMemo)(styleFactory, deps)
|
|
4523
|
+
);
|
|
4524
|
+
|
|
4525
|
+
// src/MobileAddonsPanel.tsx
|
|
4513
4526
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4514
|
-
var
|
|
4527
|
+
var bottomSheetStyle = {
|
|
4528
|
+
paddingTop: 8
|
|
4529
|
+
};
|
|
4530
|
+
var contentStyle = {
|
|
4531
|
+
flex: 1
|
|
4532
|
+
};
|
|
4533
|
+
var MobileAddonsPanel = (0, import_react19.forwardRef)(
|
|
4515
4534
|
({ storyId }, ref) => {
|
|
4516
4535
|
const theme = (0, import_react_native_theming13.useTheme)();
|
|
4517
4536
|
const reducedMotion = (0, import_react_native_reanimated.useReducedMotion)();
|
|
4518
|
-
const addonsPanelBottomSheetRef = (0,
|
|
4537
|
+
const addonsPanelBottomSheetRef = (0, import_react19.useRef)(null);
|
|
4519
4538
|
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
4520
4539
|
const animatedPosition = (0, import_react_native_reanimated.useSharedValue)(0);
|
|
4521
4540
|
(0, import_react_native_reanimated.useAnimatedKeyboard)();
|
|
4522
|
-
(0,
|
|
4541
|
+
(0, import_react19.useImperativeHandle)(ref, () => ({
|
|
4523
4542
|
setAddonsPanelOpen: (open) => {
|
|
4524
4543
|
if (open) {
|
|
4525
4544
|
addonsPanelBottomSheetRef.current?.present();
|
|
@@ -4535,6 +4554,19 @@ var MobileAddonsPanel = (0, import_react15.forwardRef)(
|
|
|
4535
4554
|
maxHeight: height - animatedPosition.value - insets.bottom - extraPadding
|
|
4536
4555
|
};
|
|
4537
4556
|
}, [animatedPosition, height, insets.bottom]);
|
|
4557
|
+
const backgroundStyle = useStyle(() => {
|
|
4558
|
+
return {
|
|
4559
|
+
borderRadius: 0,
|
|
4560
|
+
borderTopColor: theme.appBorderColor,
|
|
4561
|
+
borderTopWidth: 1,
|
|
4562
|
+
backgroundColor: theme.background.content
|
|
4563
|
+
};
|
|
4564
|
+
});
|
|
4565
|
+
const handleIndicatorStyle = useStyle(() => {
|
|
4566
|
+
return {
|
|
4567
|
+
backgroundColor: theme.textMutedColor
|
|
4568
|
+
};
|
|
4569
|
+
});
|
|
4538
4570
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4539
4571
|
import_bottom_sheet2.BottomSheetModal,
|
|
4540
4572
|
{
|
|
@@ -4542,24 +4574,16 @@ var MobileAddonsPanel = (0, import_react15.forwardRef)(
|
|
|
4542
4574
|
index: 1,
|
|
4543
4575
|
animateOnMount: !reducedMotion,
|
|
4544
4576
|
snapPoints: ["25%", "50%", "75%"],
|
|
4545
|
-
style:
|
|
4546
|
-
paddingTop: 8
|
|
4547
|
-
},
|
|
4577
|
+
style: bottomSheetStyle,
|
|
4548
4578
|
animatedPosition,
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
borderRadius: 0,
|
|
4552
|
-
borderTopColor: theme.appBorderColor,
|
|
4553
|
-
borderTopWidth: 1,
|
|
4554
|
-
backgroundColor: theme.background.content
|
|
4555
|
-
},
|
|
4556
|
-
handleIndicatorStyle: { backgroundColor: theme.textMutedColor },
|
|
4579
|
+
backgroundStyle,
|
|
4580
|
+
handleIndicatorStyle,
|
|
4557
4581
|
keyboardBehavior: "extend",
|
|
4558
4582
|
enableDismissOnClose: true,
|
|
4559
4583
|
enableHandlePanningGesture: true,
|
|
4560
4584
|
stackBehavior: "replace",
|
|
4561
4585
|
enableDynamicSizing: false,
|
|
4562
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native_reanimated.default.View, { style: [
|
|
4586
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native_reanimated.default.View, { style: [contentStyle, adjustedBottomSheetSize], children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4563
4587
|
AddonsTabs,
|
|
4564
4588
|
{
|
|
4565
4589
|
onClose: () => {
|
|
@@ -4572,20 +4596,57 @@ var MobileAddonsPanel = (0, import_react15.forwardRef)(
|
|
|
4572
4596
|
);
|
|
4573
4597
|
}
|
|
4574
4598
|
);
|
|
4599
|
+
var addonsTabsContainerStyle = {
|
|
4600
|
+
flex: 1
|
|
4601
|
+
};
|
|
4602
|
+
var addonsTabsStyle = {
|
|
4603
|
+
flexDirection: "row",
|
|
4604
|
+
borderBottomWidth: 1,
|
|
4605
|
+
borderBottomColor: "lightgrey"
|
|
4606
|
+
};
|
|
4607
|
+
var addonsTabsContentContainerStyle = {
|
|
4608
|
+
justifyContent: "center"
|
|
4609
|
+
};
|
|
4610
|
+
var closeIconStyle = {
|
|
4611
|
+
marginRight: 4,
|
|
4612
|
+
marginBottom: 4,
|
|
4613
|
+
alignItems: "center",
|
|
4614
|
+
justifyContent: "center"
|
|
4615
|
+
};
|
|
4616
|
+
var addonsScrollStyle = {
|
|
4617
|
+
flex: 1
|
|
4618
|
+
};
|
|
4619
|
+
var centeredStyle = {
|
|
4620
|
+
alignItems: "center",
|
|
4621
|
+
justifyContent: "center"
|
|
4622
|
+
};
|
|
4623
|
+
var hitSlop = { top: 10, right: 10, bottom: 10, left: 10 };
|
|
4575
4624
|
var AddonsTabs = ({ onClose, storyId }) => {
|
|
4576
4625
|
const panels = import_manager_api.addons.getElements(import_types3.Addon_TypesEnum.PANEL);
|
|
4577
|
-
const [addonSelected, setAddonSelected] = (0,
|
|
4626
|
+
const [addonSelected, setAddonSelected] = (0, import_react19.useState)(Object.keys(panels)[0]);
|
|
4578
4627
|
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
4579
|
-
|
|
4580
|
-
|
|
4628
|
+
const scrollContentContainerStyle = useStyle(() => {
|
|
4629
|
+
return {
|
|
4630
|
+
paddingBottom: insets.bottom + 16
|
|
4631
|
+
};
|
|
4632
|
+
});
|
|
4633
|
+
const panel = (0, import_react19.useMemo)(() => {
|
|
4634
|
+
if (!storyId) {
|
|
4635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native6.View, { style: centeredStyle, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native6.Text, { children: "No Story Selected" }) });
|
|
4636
|
+
}
|
|
4637
|
+
if (Object.keys(panels).length === 0) {
|
|
4638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native6.View, { style: centeredStyle, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native6.Text, { children: "No addons loaded." }) });
|
|
4639
|
+
}
|
|
4640
|
+
return panels[addonSelected].render({ active: true });
|
|
4641
|
+
}, [addonSelected, panels, storyId]);
|
|
4642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native6.View, { style: addonsTabsContainerStyle, children: [
|
|
4643
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_react_native6.View, { style: addonsTabsStyle, children: [
|
|
4581
4644
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4582
4645
|
import_react_native_gesture_handler.ScrollView,
|
|
4583
4646
|
{
|
|
4584
4647
|
horizontal: true,
|
|
4585
4648
|
showsHorizontalScrollIndicator: false,
|
|
4586
|
-
contentContainerStyle:
|
|
4587
|
-
justifyContent: "center"
|
|
4588
|
-
},
|
|
4649
|
+
contentContainerStyle: addonsTabsContentContainerStyle,
|
|
4589
4650
|
children: Object.values(panels).map(({ id, title }) => {
|
|
4590
4651
|
const resolvedTitle = typeof title === "function" ? title({}) : title;
|
|
4591
4652
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -4603,13 +4664,8 @@ var AddonsTabs = ({ onClose, storyId }) => {
|
|
|
4603
4664
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4604
4665
|
IconButton,
|
|
4605
4666
|
{
|
|
4606
|
-
style:
|
|
4607
|
-
|
|
4608
|
-
marginBottom: 4,
|
|
4609
|
-
alignItems: "center",
|
|
4610
|
-
justifyContent: "center"
|
|
4611
|
-
},
|
|
4612
|
-
hitSlop: { top: 10, right: 10, bottom: 10, left: 10 },
|
|
4667
|
+
style: closeIconStyle,
|
|
4668
|
+
hitSlop,
|
|
4613
4669
|
Icon: CloseIcon,
|
|
4614
4670
|
onPress: () => onClose?.()
|
|
4615
4671
|
}
|
|
@@ -4618,19 +4674,9 @@ var AddonsTabs = ({ onClose, storyId }) => {
|
|
|
4618
4674
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4619
4675
|
import_react_native_gesture_handler.ScrollView,
|
|
4620
4676
|
{
|
|
4621
|
-
style:
|
|
4622
|
-
contentContainerStyle:
|
|
4623
|
-
|
|
4624
|
-
},
|
|
4625
|
-
children: (() => {
|
|
4626
|
-
if (!storyId) {
|
|
4627
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native6.View, { style: { alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native6.Text, { children: "No Story Selected" }) });
|
|
4628
|
-
}
|
|
4629
|
-
if (Object.keys(panels).length === 0) {
|
|
4630
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native6.View, { style: { alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native6.Text, { children: "No addons loaded." }) });
|
|
4631
|
-
}
|
|
4632
|
-
return panels[addonSelected].render({ active: true });
|
|
4633
|
-
})()
|
|
4677
|
+
style: addonsScrollStyle,
|
|
4678
|
+
contentContainerStyle: scrollContentContainerStyle,
|
|
4679
|
+
children: panel
|
|
4634
4680
|
}
|
|
4635
4681
|
)
|
|
4636
4682
|
] });
|
|
@@ -4655,8 +4701,8 @@ var TabText = import_react_native_theming12.styled.Text(({ theme, active }) => (
|
|
|
4655
4701
|
}));
|
|
4656
4702
|
|
|
4657
4703
|
// src/MobileMenuDrawer.tsx
|
|
4658
|
-
var import_bottom_sheet3 = require("@gorhom/bottom-sheet");
|
|
4659
|
-
var
|
|
4704
|
+
var import_bottom_sheet3 = __toESM(require("@gorhom/bottom-sheet"));
|
|
4705
|
+
var import_react20 = require("react");
|
|
4660
4706
|
var import_react_native7 = require("react-native");
|
|
4661
4707
|
var import_react_native_reanimated2 = require("react-native-reanimated");
|
|
4662
4708
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
@@ -4672,56 +4718,63 @@ var BottomSheetBackdropComponent = (backdropComponentProps) => /* @__PURE__ */ (
|
|
|
4672
4718
|
style: [backdropComponentProps.style, { backgroundColor: "rgba(0,0,0,0.5)" }]
|
|
4673
4719
|
}
|
|
4674
4720
|
);
|
|
4675
|
-
var
|
|
4676
|
-
|
|
4721
|
+
var snapPoints = ["50%", "75%"];
|
|
4722
|
+
var MobileMenuDrawer = (0, import_react20.memo)(
|
|
4723
|
+
(0, import_react20.forwardRef)(({ children }, ref) => {
|
|
4677
4724
|
const reducedMotion = (0, import_react_native_reanimated2.useReducedMotion)();
|
|
4678
4725
|
const insets = (0, import_react_native_safe_area_context2.useSafeAreaInsets)();
|
|
4679
4726
|
const theme = (0, import_react_native_theming14.useTheme)();
|
|
4680
|
-
const menuBottomSheetRef = (0,
|
|
4681
|
-
(0,
|
|
4727
|
+
const menuBottomSheetRef = (0, import_react20.useRef)(null);
|
|
4728
|
+
(0, import_react20.useImperativeHandle)(ref, () => ({
|
|
4682
4729
|
setMobileMenuOpen: (open) => {
|
|
4683
4730
|
if (open) {
|
|
4684
|
-
menuBottomSheetRef.current?.
|
|
4731
|
+
menuBottomSheetRef.current?.snapToIndex(1);
|
|
4685
4732
|
} else {
|
|
4686
4733
|
import_react_native7.Keyboard.dismiss();
|
|
4687
|
-
menuBottomSheetRef.current?.
|
|
4734
|
+
menuBottomSheetRef.current?.close();
|
|
4688
4735
|
}
|
|
4689
4736
|
}
|
|
4690
4737
|
}));
|
|
4738
|
+
const bgColorStyle = (0, import_react20.useMemo)(() => {
|
|
4739
|
+
return { backgroundColor: theme.background.content };
|
|
4740
|
+
}, [theme.background.content]);
|
|
4741
|
+
const handleIndicatorStyle = (0, import_react20.useMemo)(() => {
|
|
4742
|
+
return { backgroundColor: theme.textMutedColor };
|
|
4743
|
+
}, [theme.textMutedColor]);
|
|
4744
|
+
const contentContainerStyle = (0, import_react20.useMemo)(() => {
|
|
4745
|
+
return { paddingBottom: insets.bottom };
|
|
4746
|
+
}, [insets.bottom]);
|
|
4691
4747
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4692
|
-
import_bottom_sheet3.
|
|
4748
|
+
import_bottom_sheet3.default,
|
|
4693
4749
|
{
|
|
4694
4750
|
ref: menuBottomSheetRef,
|
|
4695
|
-
index: 1,
|
|
4751
|
+
index: -1,
|
|
4696
4752
|
animateOnMount: !reducedMotion,
|
|
4697
|
-
snapPoints
|
|
4698
|
-
enableDismissOnClose: true,
|
|
4753
|
+
snapPoints,
|
|
4699
4754
|
enableHandlePanningGesture: true,
|
|
4700
4755
|
enableContentPanningGesture: true,
|
|
4701
4756
|
enableDynamicSizing: false,
|
|
4702
4757
|
keyboardBehavior: "extend",
|
|
4703
4758
|
keyboardBlurBehavior: "restore",
|
|
4704
|
-
|
|
4759
|
+
enablePanDownToClose: true,
|
|
4705
4760
|
backdropComponent: BottomSheetBackdropComponent,
|
|
4706
|
-
backgroundStyle:
|
|
4707
|
-
handleIndicatorStyle
|
|
4761
|
+
backgroundStyle: bgColorStyle,
|
|
4762
|
+
handleIndicatorStyle,
|
|
4708
4763
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4709
4764
|
import_bottom_sheet3.BottomSheetScrollView,
|
|
4710
4765
|
{
|
|
4711
4766
|
keyboardShouldPersistTaps: "handled",
|
|
4712
|
-
contentContainerStyle
|
|
4713
|
-
paddingBottom: insets.bottom
|
|
4714
|
-
},
|
|
4767
|
+
contentContainerStyle,
|
|
4715
4768
|
children
|
|
4716
4769
|
}
|
|
4717
4770
|
)
|
|
4718
4771
|
}
|
|
4719
4772
|
);
|
|
4720
|
-
}
|
|
4773
|
+
})
|
|
4721
4774
|
);
|
|
4722
4775
|
|
|
4723
4776
|
// src/StorybookLogo.tsx
|
|
4724
|
-
var
|
|
4777
|
+
var import_react21 = require("react");
|
|
4725
4778
|
var import_react_native8 = require("react-native");
|
|
4726
4779
|
|
|
4727
4780
|
// src/icon/DarkLogo.tsx
|
|
@@ -4862,11 +4915,11 @@ var WIDTH = 125;
|
|
|
4862
4915
|
var HEIGHT = 25;
|
|
4863
4916
|
var NoBrandLogo = ({ theme }) => theme.base === "light" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Logo, { height: HEIGHT, width: WIDTH }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DarkLogo, { height: HEIGHT, width: WIDTH });
|
|
4864
4917
|
function isElement(value) {
|
|
4865
|
-
return (0,
|
|
4918
|
+
return (0, import_react21.isValidElement)(value);
|
|
4866
4919
|
}
|
|
4867
4920
|
var BrandLogo = ({ theme }) => {
|
|
4868
4921
|
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));
|
|
4869
|
-
(0,
|
|
4922
|
+
(0, import_react21.useEffect)(() => {
|
|
4870
4923
|
if (imageHasNoWidthOrHeight) {
|
|
4871
4924
|
console.warn(
|
|
4872
4925
|
"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}}"
|
|
@@ -4903,7 +4956,7 @@ var BrandLogo = ({ theme }) => {
|
|
|
4903
4956
|
}
|
|
4904
4957
|
};
|
|
4905
4958
|
var BrandTitle = ({ theme }) => {
|
|
4906
|
-
const brandTitleStyle = (0,
|
|
4959
|
+
const brandTitleStyle = (0, import_react21.useMemo)(() => {
|
|
4907
4960
|
return {
|
|
4908
4961
|
width: WIDTH,
|
|
4909
4962
|
height: HEIGHT,
|
|
@@ -4928,9 +4981,11 @@ var BrandTitle = ({ theme }) => {
|
|
|
4928
4981
|
}
|
|
4929
4982
|
};
|
|
4930
4983
|
var StorybookLogo = ({ theme }) => {
|
|
4931
|
-
|
|
4984
|
+
const image = (0, import_react21.useMemo)(() => theme.brand?.image, [theme.brand?.image]);
|
|
4985
|
+
const title = (0, import_react21.useMemo)(() => theme.brand?.title, [theme.brand?.title]);
|
|
4986
|
+
if (image) {
|
|
4932
4987
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BrandLogo, { theme });
|
|
4933
|
-
} else if (
|
|
4988
|
+
} else if (title) {
|
|
4934
4989
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(BrandTitle, { theme });
|
|
4935
4990
|
} else {
|
|
4936
4991
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(NoBrandLogo, { theme });
|
|
@@ -4938,12 +4993,12 @@ var StorybookLogo = ({ theme }) => {
|
|
|
4938
4993
|
};
|
|
4939
4994
|
|
|
4940
4995
|
// src/hooks/useStoreState.ts
|
|
4941
|
-
var
|
|
4996
|
+
var import_react23 = require("react");
|
|
4942
4997
|
|
|
4943
4998
|
// src/StorageProvider.tsx
|
|
4944
|
-
var
|
|
4999
|
+
var import_react22 = require("react");
|
|
4945
5000
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4946
|
-
var StorageContext = (0,
|
|
5001
|
+
var StorageContext = (0, import_react22.createContext)({
|
|
4947
5002
|
getItem: async () => null,
|
|
4948
5003
|
setItem: async () => {
|
|
4949
5004
|
}
|
|
@@ -4954,13 +5009,13 @@ var StorageProvider = ({
|
|
|
4954
5009
|
}) => {
|
|
4955
5010
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StorageContext.Provider, { value: storage, children });
|
|
4956
5011
|
};
|
|
4957
|
-
var useStorage = () => (0,
|
|
5012
|
+
var useStorage = () => (0, import_react22.useContext)(StorageContext);
|
|
4958
5013
|
|
|
4959
5014
|
// src/hooks/useStoreState.ts
|
|
4960
5015
|
var useStoreBooleanState = (key, defaultValue) => {
|
|
4961
5016
|
const storage = useStorage();
|
|
4962
|
-
const [val, setVal] = (0,
|
|
4963
|
-
(0,
|
|
5017
|
+
const [val, setVal] = (0, import_react23.useState)(defaultValue);
|
|
5018
|
+
(0, import_react23.useEffect)(() => {
|
|
4964
5019
|
storage.getItem(key).then((newVal) => {
|
|
4965
5020
|
if (newVal === null || newVal === void 0) {
|
|
4966
5021
|
setVal(defaultValue);
|
|
@@ -4969,7 +5024,7 @@ var useStoreBooleanState = (key, defaultValue) => {
|
|
|
4969
5024
|
}
|
|
4970
5025
|
});
|
|
4971
5026
|
}, [key, storage, defaultValue]);
|
|
4972
|
-
(0,
|
|
5027
|
+
(0, import_react23.useEffect)(() => {
|
|
4973
5028
|
storage.setItem(key, val.toString());
|
|
4974
5029
|
}, [key, storage, val]);
|
|
4975
5030
|
return [val, setVal];
|
|
@@ -5005,35 +5060,33 @@ var BottomBarToggleIcon = ({
|
|
|
5005
5060
|
};
|
|
5006
5061
|
|
|
5007
5062
|
// src/icon/CloseFullscreenIcon.tsx
|
|
5063
|
+
var import_react24 = require("react");
|
|
5008
5064
|
var import_react_native_svg13 = __toESM(require("react-native-svg"));
|
|
5009
5065
|
var import_react_native_theming15 = require("@storybook/react-native-theming");
|
|
5010
5066
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5011
5067
|
function CloseFullscreenIcon({ color, width = 14, height = 14, ...props }) {
|
|
5012
5068
|
const theme = (0, import_react_native_theming15.useTheme)();
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
height,
|
|
5018
|
-
viewBox: "0 0 16 16",
|
|
5019
|
-
width,
|
|
5020
|
-
...props,
|
|
5021
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime27.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" })
|
|
5022
|
-
}
|
|
5023
|
-
);
|
|
5069
|
+
const fillColor = (0, import_react24.useMemo)(() => {
|
|
5070
|
+
return color ?? theme.color.defaultText;
|
|
5071
|
+
}, [color, theme.color.defaultText]);
|
|
5072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_native_svg13.default, { fill: fillColor, height, viewBox: "0 0 16 16", width, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime27.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" }) });
|
|
5024
5073
|
}
|
|
5025
5074
|
|
|
5026
5075
|
// src/icon/FullscreenIcon.tsx
|
|
5027
5076
|
var import_react_native_svg14 = __toESM(require("react-native-svg"));
|
|
5028
5077
|
var import_react_native_theming16 = require("@storybook/react-native-theming");
|
|
5078
|
+
var import_react25 = require("react");
|
|
5029
5079
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5030
5080
|
function FullscreenIcon({ color, width = 14, height = 14, ...props }) {
|
|
5031
5081
|
const theme = (0, import_react_native_theming16.useTheme)();
|
|
5082
|
+
const fillColor = (0, import_react25.useMemo)(() => {
|
|
5083
|
+
return color ?? theme.color.defaultText;
|
|
5084
|
+
}, [color, theme.color.defaultText]);
|
|
5032
5085
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native_svg14.default, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5033
5086
|
import_react_native_svg14.Path,
|
|
5034
5087
|
{
|
|
5035
5088
|
d: "M1.5 1h2a.5.5 0 010 1h-.793l3.147 3.146a.5.5 0 11-.708.708L2 2.707V3.5a.5.5 0 01-1 0v-2a.5.5 0 01.5-.5zm8.5.5a.5.5 0 01.5-.5h2a.5.5 0 01.5.5v2a.5.5 0 01-1 0v-.793L8.854 5.854a.5.5 0 11-.708-.708L11.293 2H10.5a.5.5 0 01-.5-.5zm2.5 8.5a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 010-1h.793L8.146 8.854a.5.5 0 11.708-.708L12 11.293V10.5a.5.5 0 01.5-.5zM2 11.293V10.5a.5.5 0 00-1 0v2a.5.5 0 00.5.5h2a.5.5 0 000-1h-.793l3.147-3.146a.5.5 0 10-.708-.708L2 11.293z",
|
|
5036
|
-
fill:
|
|
5089
|
+
fill: fillColor
|
|
5037
5090
|
}
|
|
5038
5091
|
) });
|
|
5039
5092
|
}
|
|
@@ -5058,14 +5111,36 @@ var MenuIcon = ({
|
|
|
5058
5111
|
|
|
5059
5112
|
// src/Layout.tsx
|
|
5060
5113
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5114
|
+
var desktopLogoContainer = {
|
|
5115
|
+
flexDirection: "row",
|
|
5116
|
+
alignItems: "center",
|
|
5117
|
+
paddingTop: 10,
|
|
5118
|
+
paddingLeft: 16,
|
|
5119
|
+
paddingBottom: 4,
|
|
5120
|
+
paddingRight: 10,
|
|
5121
|
+
justifyContent: "space-between"
|
|
5122
|
+
};
|
|
5123
|
+
var desktopContentContainerStyle = { flex: 1 };
|
|
5124
|
+
var desktopContentStyle = { flex: 1, overflow: "hidden" };
|
|
5125
|
+
var mobileContentStyle = { flex: 1, overflow: "hidden" };
|
|
5126
|
+
var placeholderObject = {};
|
|
5127
|
+
var placeholderArray = [];
|
|
5128
|
+
var iconFloatRightStyle = { marginLeft: "auto" };
|
|
5129
|
+
var navButtonStyle = { flexShrink: 1 };
|
|
5130
|
+
var navButtonHitSlop = { bottom: 10, left: 10, right: 10, top: 10 };
|
|
5131
|
+
var mobileMenuDrawerContentStyle = {
|
|
5132
|
+
paddingLeft: 16,
|
|
5133
|
+
paddingTop: 4,
|
|
5134
|
+
paddingBottom: 4
|
|
5135
|
+
};
|
|
5061
5136
|
var Layout = ({
|
|
5062
5137
|
storyHash,
|
|
5063
5138
|
story,
|
|
5064
5139
|
children
|
|
5065
5140
|
}) => {
|
|
5066
5141
|
const theme = (0, import_react_native_theming17.useTheme)();
|
|
5067
|
-
const mobileMenuDrawerRef = (0,
|
|
5068
|
-
const addonPanelRef = (0,
|
|
5142
|
+
const mobileMenuDrawerRef = (0, import_react26.useRef)(null);
|
|
5143
|
+
const addonPanelRef = (0, import_react26.useRef)(null);
|
|
5069
5144
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
5070
5145
|
const { isDesktop } = useLayout();
|
|
5071
5146
|
const [desktopSidebarOpen, setDesktopSidebarOpen] = useStoreBooleanState(
|
|
@@ -5076,184 +5151,182 @@ var Layout = ({
|
|
|
5076
5151
|
"desktopPanelState",
|
|
5077
5152
|
true
|
|
5078
5153
|
);
|
|
5079
|
-
const [uiHidden, setUiHidden] = (0,
|
|
5154
|
+
const [uiHidden, setUiHidden] = (0, import_react26.useState)(false);
|
|
5155
|
+
const desktopContainerStyle = useStyle(
|
|
5156
|
+
() => ({
|
|
5157
|
+
flex: 1,
|
|
5158
|
+
paddingTop: insets.top,
|
|
5159
|
+
backgroundColor: theme.background.content,
|
|
5160
|
+
flexDirection: "row"
|
|
5161
|
+
}),
|
|
5162
|
+
[theme.background.content, insets.top]
|
|
5163
|
+
);
|
|
5164
|
+
const desktopSidebarStyle = useStyle(
|
|
5165
|
+
() => ({
|
|
5166
|
+
width: desktopSidebarOpen ? 240 : void 0,
|
|
5167
|
+
padding: desktopSidebarOpen ? 0 : 10,
|
|
5168
|
+
borderColor: theme.appBorderColor,
|
|
5169
|
+
borderRightWidth: 1
|
|
5170
|
+
}),
|
|
5171
|
+
[desktopSidebarOpen, theme.appBorderColor]
|
|
5172
|
+
);
|
|
5173
|
+
const desktopScrollViewContentContainerStyle = useStyle(
|
|
5174
|
+
() => ({
|
|
5175
|
+
paddingBottom: insets.bottom
|
|
5176
|
+
}),
|
|
5177
|
+
[insets.bottom]
|
|
5178
|
+
);
|
|
5179
|
+
const desktopAddonsPanelStyle = useStyle(
|
|
5180
|
+
() => ({
|
|
5181
|
+
height: desktopAddonsPanelOpen ? 300 : void 0,
|
|
5182
|
+
borderTopWidth: 1,
|
|
5183
|
+
borderColor: theme.appBorderColor,
|
|
5184
|
+
paddingTop: desktopAddonsPanelOpen ? 4 : 0,
|
|
5185
|
+
padding: desktopAddonsPanelOpen ? 0 : 10
|
|
5186
|
+
}),
|
|
5187
|
+
[desktopAddonsPanelOpen, theme.appBorderColor]
|
|
5188
|
+
);
|
|
5189
|
+
const mobileContainerStyle = useStyle(
|
|
5190
|
+
() => ({
|
|
5191
|
+
flex: 1,
|
|
5192
|
+
paddingTop: story?.parameters?.noSafeArea ? 0 : insets.top,
|
|
5193
|
+
backgroundColor: theme.background.content
|
|
5194
|
+
}),
|
|
5195
|
+
[theme.background.content, insets.top, story?.parameters?.noSafeArea]
|
|
5196
|
+
);
|
|
5197
|
+
const fullScreenButtonStyle = useStyle(
|
|
5198
|
+
() => ({
|
|
5199
|
+
position: "absolute",
|
|
5200
|
+
bottom: uiHidden ? 56 + insets.bottom : 16,
|
|
5201
|
+
right: 16,
|
|
5202
|
+
backgroundColor: theme.background.content,
|
|
5203
|
+
padding: 4,
|
|
5204
|
+
borderRadius: 4,
|
|
5205
|
+
borderWidth: 1,
|
|
5206
|
+
borderColor: theme.appBorderColor
|
|
5207
|
+
}),
|
|
5208
|
+
[uiHidden, insets.bottom, theme.background.content, theme.appBorderColor]
|
|
5209
|
+
);
|
|
5210
|
+
const containerStyle = useStyle(
|
|
5211
|
+
() => ({
|
|
5212
|
+
marginBottom: insets.bottom
|
|
5213
|
+
}),
|
|
5214
|
+
[insets.bottom]
|
|
5215
|
+
);
|
|
5216
|
+
const navButtonTextStyle = useStyle(
|
|
5217
|
+
() => ({
|
|
5218
|
+
flexShrink: 1,
|
|
5219
|
+
color: theme.color.defaultText
|
|
5220
|
+
}),
|
|
5221
|
+
[theme.color.defaultText]
|
|
5222
|
+
);
|
|
5223
|
+
const openMobileMenu = (0, import_react26.useCallback)(() => {
|
|
5224
|
+
mobileMenuDrawerRef.current.setMobileMenuOpen(true);
|
|
5225
|
+
}, [mobileMenuDrawerRef]);
|
|
5226
|
+
const setSelection = (0, import_react26.useCallback)(({ storyId: newStoryId }) => {
|
|
5227
|
+
const channel = import_manager_api2.addons.getChannel();
|
|
5228
|
+
channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
|
|
5229
|
+
}, []);
|
|
5080
5230
|
if (isDesktop) {
|
|
5081
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5082
|
-
import_react_native9.View,
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
import_react_native9.View,
|
|
5093
|
-
{
|
|
5094
|
-
style: {
|
|
5095
|
-
width: desktopSidebarOpen ? 240 : void 0,
|
|
5096
|
-
padding: desktopSidebarOpen ? 0 : 10,
|
|
5097
|
-
borderColor: theme.appBorderColor,
|
|
5098
|
-
borderRightWidth: 1
|
|
5099
|
-
},
|
|
5100
|
-
children: desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5101
|
-
import_react_native9.ScrollView,
|
|
5102
|
-
{
|
|
5103
|
-
keyboardShouldPersistTaps: "handled",
|
|
5104
|
-
contentContainerStyle: {
|
|
5105
|
-
paddingBottom: insets.bottom
|
|
5106
|
-
},
|
|
5107
|
-
children: [
|
|
5108
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5109
|
-
import_react_native9.View,
|
|
5110
|
-
{
|
|
5111
|
-
style: {
|
|
5112
|
-
flexDirection: "row",
|
|
5113
|
-
alignItems: "center",
|
|
5114
|
-
paddingTop: 10,
|
|
5115
|
-
paddingLeft: 16,
|
|
5116
|
-
paddingBottom: 4,
|
|
5117
|
-
paddingRight: 10,
|
|
5118
|
-
justifyContent: "space-between"
|
|
5119
|
-
},
|
|
5120
|
-
children: [
|
|
5121
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }),
|
|
5122
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(false), Icon: MenuIcon })
|
|
5123
|
-
]
|
|
5124
|
-
}
|
|
5125
|
-
),
|
|
5126
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5127
|
-
Sidebar,
|
|
5128
|
-
{
|
|
5129
|
-
extra: [],
|
|
5130
|
-
previewInitialized: true,
|
|
5131
|
-
indexError: void 0,
|
|
5132
|
-
refs: {},
|
|
5133
|
-
setSelection: ({ storyId: newStoryId }) => {
|
|
5134
|
-
const channel = import_manager_api2.addons.getChannel();
|
|
5135
|
-
channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
|
|
5136
|
-
},
|
|
5137
|
-
status: {},
|
|
5138
|
-
index: storyHash,
|
|
5139
|
-
storyId: story?.id,
|
|
5140
|
-
refId: DEFAULT_REF_ID
|
|
5141
|
-
}
|
|
5142
|
-
)
|
|
5143
|
-
]
|
|
5144
|
-
}
|
|
5145
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(true), Icon: MenuIcon })
|
|
5146
|
-
}
|
|
5147
|
-
),
|
|
5148
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: { flex: 1 }, children: [
|
|
5149
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: { flex: 1, overflow: "hidden" }, children }),
|
|
5231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: desktopContainerStyle, children: [
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: desktopSidebarStyle, children: desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5233
|
+
import_react_native9.ScrollView,
|
|
5234
|
+
{
|
|
5235
|
+
keyboardShouldPersistTaps: "handled",
|
|
5236
|
+
contentContainerStyle: desktopScrollViewContentContainerStyle,
|
|
5237
|
+
children: [
|
|
5238
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: desktopLogoContainer, children: [
|
|
5239
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }),
|
|
5240
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(false), Icon: MenuIcon })
|
|
5241
|
+
] }),
|
|
5150
5242
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5151
|
-
|
|
5243
|
+
Sidebar,
|
|
5152
5244
|
{
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
{
|
|
5163
|
-
style: { marginLeft: "auto" },
|
|
5164
|
-
onPress: () => setDesktopAddonsPanelOpen(true),
|
|
5165
|
-
Icon: BottomBarToggleIcon
|
|
5166
|
-
}
|
|
5167
|
-
)
|
|
5245
|
+
extra: placeholderArray,
|
|
5246
|
+
previewInitialized: true,
|
|
5247
|
+
indexError: void 0,
|
|
5248
|
+
refs: placeholderObject,
|
|
5249
|
+
setSelection,
|
|
5250
|
+
status: placeholderObject,
|
|
5251
|
+
index: storyHash,
|
|
5252
|
+
storyId: story?.id,
|
|
5253
|
+
refId: DEFAULT_REF_ID
|
|
5168
5254
|
}
|
|
5169
5255
|
)
|
|
5170
|
-
]
|
|
5171
|
-
|
|
5172
|
-
}
|
|
5173
|
-
|
|
5256
|
+
]
|
|
5257
|
+
}
|
|
5258
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(true), Icon: MenuIcon }) }),
|
|
5259
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: desktopContentContainerStyle, children: [
|
|
5260
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: desktopContentStyle, children }),
|
|
5261
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: desktopAddonsPanelStyle, children: desktopAddonsPanelOpen ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonsTabs, { storyId: story?.id, onClose: () => setDesktopAddonsPanelOpen(false) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5262
|
+
IconButton,
|
|
5263
|
+
{
|
|
5264
|
+
style: iconFloatRightStyle,
|
|
5265
|
+
onPress: () => setDesktopAddonsPanelOpen(true),
|
|
5266
|
+
Icon: BottomBarToggleIcon
|
|
5267
|
+
}
|
|
5268
|
+
) })
|
|
5269
|
+
] })
|
|
5270
|
+
] });
|
|
5174
5271
|
}
|
|
5175
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5176
|
-
import_react_native9.View,
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
}
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5209
|
-
|
|
5210
|
-
|
|
5211
|
-
|
|
5212
|
-
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
mobileMenuDrawerRef.current.setMobileMenuOpen(true);
|
|
5234
|
-
},
|
|
5235
|
-
children: [
|
|
5236
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MenuIcon, { color: theme.color.mediumdark }),
|
|
5237
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.Text, { style: { flexShrink: 1, color: theme.color.defaultText }, numberOfLines: 1, children: [
|
|
5238
|
-
story?.title,
|
|
5239
|
-
"/",
|
|
5240
|
-
story?.name
|
|
5241
|
-
] })
|
|
5242
|
-
]
|
|
5243
|
-
}
|
|
5244
|
-
),
|
|
5245
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5246
|
-
IconButton,
|
|
5247
|
-
{
|
|
5248
|
-
testID: "mobile-addons-button",
|
|
5249
|
-
onPress: () => addonPanelRef.current.setAddonsPanelOpen(true),
|
|
5250
|
-
Icon: BottomBarToggleIcon
|
|
5251
|
-
}
|
|
5252
|
-
)
|
|
5253
|
-
] }) }) : null
|
|
5254
|
-
]
|
|
5255
|
-
}
|
|
5256
|
-
);
|
|
5272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: mobileContainerStyle, children: [
|
|
5273
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: mobileContentStyle, children: [
|
|
5274
|
+
children,
|
|
5275
|
+
story?.parameters?.hideFullScreenButton ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5276
|
+
import_react_native9.TouchableOpacity,
|
|
5277
|
+
{
|
|
5278
|
+
style: fullScreenButtonStyle,
|
|
5279
|
+
onPress: () => setUiHidden((prev) => !prev),
|
|
5280
|
+
children: uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CloseFullscreenIcon, { color: theme.color.mediumdark }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FullscreenIcon, { color: theme.color.mediumdark })
|
|
5281
|
+
}
|
|
5282
|
+
)
|
|
5283
|
+
] }),
|
|
5284
|
+
!uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Container3, { style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Nav, { children: [
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5286
|
+
Button2,
|
|
5287
|
+
{
|
|
5288
|
+
testID: "mobile-menu-button",
|
|
5289
|
+
style: navButtonStyle,
|
|
5290
|
+
hitSlop: navButtonHitSlop,
|
|
5291
|
+
onPress: openMobileMenu,
|
|
5292
|
+
children: [
|
|
5293
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MenuIcon, { color: theme.color.mediumdark }),
|
|
5294
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.Text, { style: navButtonTextStyle, numberOfLines: 1, children: [
|
|
5295
|
+
story?.title,
|
|
5296
|
+
"/",
|
|
5297
|
+
story?.name
|
|
5298
|
+
] })
|
|
5299
|
+
]
|
|
5300
|
+
}
|
|
5301
|
+
),
|
|
5302
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5303
|
+
IconButton,
|
|
5304
|
+
{
|
|
5305
|
+
testID: "mobile-addons-button",
|
|
5306
|
+
onPress: () => addonPanelRef.current.setAddonsPanelOpen(true),
|
|
5307
|
+
Icon: BottomBarToggleIcon
|
|
5308
|
+
}
|
|
5309
|
+
)
|
|
5310
|
+
] }) }) : null,
|
|
5311
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
|
|
5312
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: mobileMenuDrawerContentStyle, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }) }),
|
|
5313
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5314
|
+
Sidebar,
|
|
5315
|
+
{
|
|
5316
|
+
extra: placeholderArray,
|
|
5317
|
+
previewInitialized: true,
|
|
5318
|
+
indexError: void 0,
|
|
5319
|
+
refs: placeholderObject,
|
|
5320
|
+
setSelection,
|
|
5321
|
+
status: placeholderObject,
|
|
5322
|
+
index: storyHash,
|
|
5323
|
+
storyId: story?.id,
|
|
5324
|
+
refId: DEFAULT_REF_ID
|
|
5325
|
+
}
|
|
5326
|
+
)
|
|
5327
|
+
] }),
|
|
5328
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
|
|
5329
|
+
] });
|
|
5257
5330
|
};
|
|
5258
5331
|
var Nav = import_react_native_theming17.styled.View({
|
|
5259
5332
|
display: "flex",
|