@storybook/react-native-ui 8.5.5-alpha.2 → 8.5.5-alpha.4
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 +10 -11
- package/dist/index.js +344 -285
- package/package.json +3 -3
- package/src/Layout.tsx +20 -17
- package/src/MobileMenuDrawer.tsx +7 -5
- package/src/Search.tsx +5 -1
- package/src/SelectedNodeProvider.tsx +58 -0
- package/src/Tree.tsx +15 -4
- package/src/TreeNode.tsx +24 -19
package/dist/index.js
CHANGED
|
@@ -3018,8 +3018,9 @@ function CollapseSVG(props) {
|
|
|
3018
3018
|
}
|
|
3019
3019
|
|
|
3020
3020
|
// src/TreeNode.tsx
|
|
3021
|
-
var import_react =
|
|
3021
|
+
var import_react = require("react");
|
|
3022
3022
|
var import_polished = require("polished");
|
|
3023
|
+
var import_react2 = __toESM(require("react"));
|
|
3023
3024
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3024
3025
|
var BranchNodeText = import_react_native_theming2.styled.Text(({ theme }) => ({
|
|
3025
3026
|
textAlign: "left",
|
|
@@ -3081,7 +3082,7 @@ var Wrapper = import_react_native_theming2.styled.View({
|
|
|
3081
3082
|
gap: 6,
|
|
3082
3083
|
marginTop: 2
|
|
3083
3084
|
});
|
|
3084
|
-
var GroupNode =
|
|
3085
|
+
var GroupNode = import_react2.default.memo(function GroupNode2({
|
|
3085
3086
|
children,
|
|
3086
3087
|
isExpanded = false,
|
|
3087
3088
|
isExpandable = false,
|
|
@@ -3099,7 +3100,7 @@ var GroupNode = import_react.default.memo(function GroupNode2({
|
|
|
3099
3100
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BranchNodeText, { children })
|
|
3100
3101
|
] });
|
|
3101
3102
|
});
|
|
3102
|
-
var ComponentNode =
|
|
3103
|
+
var ComponentNode = import_react2.default.memo(
|
|
3103
3104
|
function ComponentNode2({ children, isExpanded, isExpandable, ...props }) {
|
|
3104
3105
|
const theme = (0, import_react_native_theming2.useTheme)();
|
|
3105
3106
|
const color = (0, import_react.useMemo)(() => {
|
|
@@ -3114,29 +3115,29 @@ var ComponentNode = import_react.default.memo(
|
|
|
3114
3115
|
] });
|
|
3115
3116
|
}
|
|
3116
3117
|
);
|
|
3117
|
-
var StoryNode =
|
|
3118
|
-
children,
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
return
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3118
|
+
var StoryNode = import_react2.default.memo(
|
|
3119
|
+
(0, import_react.forwardRef)(function StoryNode2({ children, ...props }, ref) {
|
|
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]);
|
|
3124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(LeafNode, { ...props, ref, children: [
|
|
3125
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StoryIcon, { width: 14, height: 14, color }) }),
|
|
3126
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LeafNodeText, { selected: props.selected, children })
|
|
3127
|
+
] });
|
|
3128
|
+
})
|
|
3129
|
+
);
|
|
3130
|
+
StoryNode.displayName = "StoryNode";
|
|
3130
3131
|
|
|
3131
3132
|
// src/Tree.tsx
|
|
3132
3133
|
var import_react_native_theming7 = require("@storybook/react-native-theming");
|
|
3133
|
-
var
|
|
3134
|
+
var import_react10 = __toESM(require("react"));
|
|
3134
3135
|
|
|
3135
3136
|
// src/Button.tsx
|
|
3136
3137
|
var import_react_native_theming3 = require("@storybook/react-native-theming");
|
|
3137
|
-
var
|
|
3138
|
+
var import_react3 = require("react");
|
|
3138
3139
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
3139
|
-
var Button = (0,
|
|
3140
|
+
var Button = (0, import_react3.forwardRef)(
|
|
3140
3141
|
({
|
|
3141
3142
|
Icon,
|
|
3142
3143
|
animation = "none",
|
|
@@ -3150,7 +3151,7 @@ var Button = (0, import_react2.forwardRef)(
|
|
|
3150
3151
|
text,
|
|
3151
3152
|
...props
|
|
3152
3153
|
}, ref) => {
|
|
3153
|
-
const [isAnimating, setIsAnimating] = (0,
|
|
3154
|
+
const [isAnimating, setIsAnimating] = (0, import_react3.useState)(false);
|
|
3154
3155
|
const handleClick = (event) => {
|
|
3155
3156
|
if (onPress)
|
|
3156
3157
|
onPress(event);
|
|
@@ -3158,7 +3159,7 @@ var Button = (0, import_react2.forwardRef)(
|
|
|
3158
3159
|
return;
|
|
3159
3160
|
setIsAnimating(true);
|
|
3160
3161
|
};
|
|
3161
|
-
(0,
|
|
3162
|
+
(0, import_react3.useEffect)(() => {
|
|
3162
3163
|
const timer = setTimeout(() => {
|
|
3163
3164
|
if (isAnimating)
|
|
3164
3165
|
setIsAnimating(false);
|
|
@@ -3256,7 +3257,7 @@ var ButtonIcon = ({
|
|
|
3256
3257
|
variant
|
|
3257
3258
|
}) => {
|
|
3258
3259
|
const theme = (0, import_react_native_theming3.useTheme)();
|
|
3259
|
-
const color = (0,
|
|
3260
|
+
const color = (0, import_react3.useMemo)(() => {
|
|
3260
3261
|
if (variant === "solid")
|
|
3261
3262
|
return theme.color.lightest;
|
|
3262
3263
|
if (variant === "outline")
|
|
@@ -3278,9 +3279,9 @@ var ButtonIcon = ({
|
|
|
3278
3279
|
};
|
|
3279
3280
|
|
|
3280
3281
|
// src/IconButton.tsx
|
|
3281
|
-
var
|
|
3282
|
+
var import_react4 = require("react");
|
|
3282
3283
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
3283
|
-
var IconButton = (0,
|
|
3284
|
+
var IconButton = (0, import_react4.forwardRef)(
|
|
3284
3285
|
({ padding = "small", variant = "ghost", ...props }, ref) => {
|
|
3285
3286
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Button, { padding, variant, ref, ...props });
|
|
3286
3287
|
}
|
|
@@ -3290,7 +3291,7 @@ IconButton.displayName = "IconButton";
|
|
|
3290
3291
|
// src/icon/CollapseAllIcon.tsx
|
|
3291
3292
|
var import_react_native_svg5 = require("react-native-svg");
|
|
3292
3293
|
var import_react_native_theming4 = require("@storybook/react-native-theming");
|
|
3293
|
-
var
|
|
3294
|
+
var import_react5 = require("react");
|
|
3294
3295
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3295
3296
|
var CollapseAllIcon = ({
|
|
3296
3297
|
color,
|
|
@@ -3300,7 +3301,7 @@ var CollapseAllIcon = ({
|
|
|
3300
3301
|
...props
|
|
3301
3302
|
}) => {
|
|
3302
3303
|
const theme = (0, import_react_native_theming4.useTheme)();
|
|
3303
|
-
const fillColor = (0,
|
|
3304
|
+
const fillColor = (0, import_react5.useMemo)(() => {
|
|
3304
3305
|
return color ?? theme.color.defaultText;
|
|
3305
3306
|
}, [color, theme.color.defaultText]);
|
|
3306
3307
|
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)(
|
|
@@ -3315,7 +3316,7 @@ var CollapseAllIcon = ({
|
|
|
3315
3316
|
// src/icon/ExpandAllIcon.tsx
|
|
3316
3317
|
var import_react_native_svg6 = require("react-native-svg");
|
|
3317
3318
|
var import_react_native_theming5 = require("@storybook/react-native-theming");
|
|
3318
|
-
var
|
|
3319
|
+
var import_react6 = require("react");
|
|
3319
3320
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3320
3321
|
var ExpandAllIcon = ({
|
|
3321
3322
|
color,
|
|
@@ -3325,7 +3326,7 @@ var ExpandAllIcon = ({
|
|
|
3325
3326
|
...props
|
|
3326
3327
|
}) => {
|
|
3327
3328
|
const theme = (0, import_react_native_theming5.useTheme)();
|
|
3328
|
-
const fillColor = (0,
|
|
3329
|
+
const fillColor = (0, import_react6.useMemo)(() => {
|
|
3329
3330
|
return color ?? theme.color.defaultText;
|
|
3330
3331
|
}, [color, theme.color.defaultText]);
|
|
3331
3332
|
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)(
|
|
@@ -3338,7 +3339,7 @@ var ExpandAllIcon = ({
|
|
|
3338
3339
|
};
|
|
3339
3340
|
|
|
3340
3341
|
// src/hooks/useExpanded.ts
|
|
3341
|
-
var
|
|
3342
|
+
var import_react7 = require("react");
|
|
3342
3343
|
|
|
3343
3344
|
// src/util/tree.ts
|
|
3344
3345
|
var import_memoizerific = __toESM(require("memoizerific"));
|
|
@@ -3419,22 +3420,22 @@ var useExpanded = ({
|
|
|
3419
3420
|
rootIds,
|
|
3420
3421
|
selectedStoryId
|
|
3421
3422
|
}) => {
|
|
3422
|
-
const [expanded, setExpanded] = (0,
|
|
3423
|
+
const [expanded, setExpanded] = (0, import_react7.useReducer)(
|
|
3423
3424
|
(state, { ids, value }) => ids.reduce((acc, id) => Object.assign(acc, { [id]: value }), { ...state }),
|
|
3424
3425
|
{ refId, data, rootIds, initialExpanded },
|
|
3425
3426
|
initializeExpanded
|
|
3426
3427
|
);
|
|
3427
|
-
const updateExpanded = (0,
|
|
3428
|
+
const updateExpanded = (0, import_react7.useCallback)(({ ids, value }) => {
|
|
3428
3429
|
setExpanded({ ids, value });
|
|
3429
3430
|
}, []);
|
|
3430
|
-
(0,
|
|
3431
|
+
(0, import_react7.useEffect)(() => {
|
|
3431
3432
|
setExpanded({ ids: getAncestorIds(data, selectedStoryId), value: true });
|
|
3432
3433
|
}, [data, selectedStoryId]);
|
|
3433
3434
|
return [expanded, updateExpanded];
|
|
3434
3435
|
};
|
|
3435
3436
|
|
|
3436
3437
|
// src/util/status.tsx
|
|
3437
|
-
var
|
|
3438
|
+
var import_react8 = require("react");
|
|
3438
3439
|
var import_react_native_theming6 = require("@storybook/react-native-theming");
|
|
3439
3440
|
var import_react_native_svg7 = __toESM(require("react-native-svg"));
|
|
3440
3441
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
@@ -3446,7 +3447,7 @@ function SmallIcons(props) {
|
|
|
3446
3447
|
}
|
|
3447
3448
|
function LoadingIcons(props) {
|
|
3448
3449
|
const theme = (0, import_react_native_theming6.useTheme)();
|
|
3449
|
-
const color = (0,
|
|
3450
|
+
const color = (0, import_react8.useMemo)(() => {
|
|
3450
3451
|
return theme.base === "light" ? theme.color.mediumdark : theme.color.darker;
|
|
3451
3452
|
}, [theme.base, theme.color.darker, theme.color.mediumdark]);
|
|
3452
3453
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SmallIcons, { color, ...props });
|
|
@@ -3480,12 +3481,56 @@ function getGroupStatus(collapsedData, status) {
|
|
|
3480
3481
|
}, {});
|
|
3481
3482
|
}
|
|
3482
3483
|
|
|
3483
|
-
// src/
|
|
3484
|
+
// src/SelectedNodeProvider.tsx
|
|
3485
|
+
var import_react9 = require("react");
|
|
3484
3486
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3487
|
+
var SelectedNodeContext = (0, import_react9.createContext)({
|
|
3488
|
+
nodeRef: { current: null },
|
|
3489
|
+
setNodeRef: () => {
|
|
3490
|
+
},
|
|
3491
|
+
scrollToSelectedNode: () => {
|
|
3492
|
+
},
|
|
3493
|
+
scrollRef: null
|
|
3494
|
+
});
|
|
3495
|
+
var SelectedNodeProvider = ({ children }) => {
|
|
3496
|
+
const nodeRef = (0, import_react9.useRef)(null);
|
|
3497
|
+
const setNodeRef = (0, import_react9.useCallback)((node) => {
|
|
3498
|
+
nodeRef.current = node;
|
|
3499
|
+
}, []);
|
|
3500
|
+
const scrollRef = (0, import_react9.useRef)(null);
|
|
3501
|
+
const scrollToSelectedNode = (0, import_react9.useCallback)(() => {
|
|
3502
|
+
setTimeout(() => {
|
|
3503
|
+
if (nodeRef?.current && scrollRef?.current) {
|
|
3504
|
+
try {
|
|
3505
|
+
nodeRef.current.measureLayout?.(scrollRef.current, (_x, y) => {
|
|
3506
|
+
scrollRef.current?.scrollTo({ y: y - 100, animated: true });
|
|
3507
|
+
});
|
|
3508
|
+
} catch (error) {
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
}, 500);
|
|
3512
|
+
}, []);
|
|
3513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3514
|
+
SelectedNodeContext.Provider,
|
|
3515
|
+
{
|
|
3516
|
+
value: {
|
|
3517
|
+
nodeRef,
|
|
3518
|
+
setNodeRef,
|
|
3519
|
+
scrollToSelectedNode,
|
|
3520
|
+
scrollRef
|
|
3521
|
+
},
|
|
3522
|
+
children
|
|
3523
|
+
}
|
|
3524
|
+
);
|
|
3525
|
+
};
|
|
3526
|
+
var useSelectedNode = () => (0, import_react9.useContext)(SelectedNodeContext);
|
|
3527
|
+
|
|
3528
|
+
// src/Tree.tsx
|
|
3529
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3485
3530
|
var TextItem = import_react_native_theming7.styled.Text(({ theme }) => ({
|
|
3486
3531
|
color: theme.color.defaultText
|
|
3487
3532
|
}));
|
|
3488
|
-
var Node =
|
|
3533
|
+
var Node = import_react10.default.memo(function Node2({
|
|
3489
3534
|
item,
|
|
3490
3535
|
refId,
|
|
3491
3536
|
isOrphan,
|
|
@@ -3498,15 +3543,24 @@ var Node = import_react8.default.memo(function Node2({
|
|
|
3498
3543
|
setExpanded,
|
|
3499
3544
|
onSelectStoryId
|
|
3500
3545
|
}) {
|
|
3546
|
+
const { setNodeRef } = useSelectedNode();
|
|
3547
|
+
const setRef = (0, import_react10.useCallback)(
|
|
3548
|
+
(node) => {
|
|
3549
|
+
if (isSelected && node) {
|
|
3550
|
+
setNodeRef(node);
|
|
3551
|
+
}
|
|
3552
|
+
},
|
|
3553
|
+
[isSelected, setNodeRef]
|
|
3554
|
+
);
|
|
3501
3555
|
if (!isDisplayed) {
|
|
3502
3556
|
return null;
|
|
3503
3557
|
}
|
|
3504
3558
|
const id = createId(item.id, refId);
|
|
3505
3559
|
if (item.type === "story") {
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
LeafNode2,
|
|
3560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LeafNodeStyleWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3561
|
+
StoryNode,
|
|
3509
3562
|
{
|
|
3563
|
+
ref: setRef,
|
|
3510
3564
|
selected: isSelected,
|
|
3511
3565
|
id,
|
|
3512
3566
|
depth: isOrphan ? item.depth : item.depth - 1,
|
|
@@ -3519,8 +3573,8 @@ var Node = import_react8.default.memo(function Node2({
|
|
|
3519
3573
|
) });
|
|
3520
3574
|
}
|
|
3521
3575
|
if (item.type === "root") {
|
|
3522
|
-
return /* @__PURE__ */ (0,
|
|
3523
|
-
/* @__PURE__ */ (0,
|
|
3576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(RootNode, { id, children: [
|
|
3577
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3524
3578
|
CollapseButton,
|
|
3525
3579
|
{
|
|
3526
3580
|
"data-action": "collapse-root",
|
|
@@ -3530,12 +3584,12 @@ var Node = import_react8.default.memo(function Node2({
|
|
|
3530
3584
|
},
|
|
3531
3585
|
"aria-expanded": isExpanded,
|
|
3532
3586
|
children: [
|
|
3533
|
-
/* @__PURE__ */ (0,
|
|
3534
|
-
/* @__PURE__ */ (0,
|
|
3587
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CollapseIcon, { isExpanded }),
|
|
3588
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TextItem, { children: item.renderLabel?.(item, {}) || item.name })
|
|
3535
3589
|
]
|
|
3536
3590
|
}
|
|
3537
3591
|
),
|
|
3538
|
-
isExpanded && /* @__PURE__ */ (0,
|
|
3592
|
+
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3539
3593
|
IconButton,
|
|
3540
3594
|
{
|
|
3541
3595
|
"aria-label": isFullyExpanded ? "Expand" : "Collapse",
|
|
@@ -3545,14 +3599,14 @@ var Node = import_react8.default.memo(function Node2({
|
|
|
3545
3599
|
event.preventDefault();
|
|
3546
3600
|
setFullyExpanded();
|
|
3547
3601
|
},
|
|
3548
|
-
children: isFullyExpanded ? /* @__PURE__ */ (0,
|
|
3602
|
+
children: isFullyExpanded ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CollapseAllIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ExpandAllIcon, {})
|
|
3549
3603
|
}
|
|
3550
3604
|
)
|
|
3551
3605
|
] }, id);
|
|
3552
3606
|
}
|
|
3553
3607
|
if (item.type === "component" || item.type === "group") {
|
|
3554
3608
|
const BranchNode2 = item.type === "component" ? ComponentNode : GroupNode;
|
|
3555
|
-
return /* @__PURE__ */ (0,
|
|
3609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3556
3610
|
BranchNode2,
|
|
3557
3611
|
{
|
|
3558
3612
|
id,
|
|
@@ -3613,9 +3667,9 @@ var CollapseButton = import_react_native_theming7.styled.TouchableOpacity(({}) =
|
|
|
3613
3667
|
cursor: "pointer",
|
|
3614
3668
|
height: 28
|
|
3615
3669
|
}));
|
|
3616
|
-
var Tree =
|
|
3617
|
-
const containerRef = (0,
|
|
3618
|
-
const [rootIds, orphanIds, initialExpanded] = (0,
|
|
3670
|
+
var Tree = import_react10.default.memo(function Tree2({ isMain, refId, data, status, docsMode, selectedStoryId, onSelectStoryId }) {
|
|
3671
|
+
const containerRef = (0, import_react10.useRef)(null);
|
|
3672
|
+
const [rootIds, orphanIds, initialExpanded] = (0, import_react10.useMemo)(
|
|
3619
3673
|
() => Object.keys(data).reduce(
|
|
3620
3674
|
(acc, id) => {
|
|
3621
3675
|
const item = data[id];
|
|
@@ -3631,7 +3685,7 @@ var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3631
3685
|
),
|
|
3632
3686
|
[data]
|
|
3633
3687
|
);
|
|
3634
|
-
const { expandableDescendants } = (0,
|
|
3688
|
+
const { expandableDescendants } = (0, import_react10.useMemo)(() => {
|
|
3635
3689
|
return [...orphanIds, ...rootIds].reduce(
|
|
3636
3690
|
(acc, nodeId) => {
|
|
3637
3691
|
acc.expandableDescendants[nodeId] = getDescendantIds(data, nodeId, false).filter(
|
|
@@ -3642,7 +3696,7 @@ var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3642
3696
|
{ orphansFirst: [], expandableDescendants: {} }
|
|
3643
3697
|
);
|
|
3644
3698
|
}, [data, rootIds, orphanIds]);
|
|
3645
|
-
const singleStoryComponentIds = (0,
|
|
3699
|
+
const singleStoryComponentIds = (0, import_react10.useMemo)(() => {
|
|
3646
3700
|
return Object.keys(data).filter((id) => {
|
|
3647
3701
|
const entry = data[id];
|
|
3648
3702
|
if (entry.type !== "component")
|
|
@@ -3658,12 +3712,12 @@ var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3658
3712
|
return false;
|
|
3659
3713
|
});
|
|
3660
3714
|
}, [data]);
|
|
3661
|
-
const collapsedItems = (0,
|
|
3715
|
+
const collapsedItems = (0, import_react10.useMemo)(
|
|
3662
3716
|
() => Object.keys(data).filter((id) => !singleStoryComponentIds.includes(id)),
|
|
3663
3717
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3664
3718
|
[singleStoryComponentIds]
|
|
3665
3719
|
);
|
|
3666
|
-
const collapsedData = (0,
|
|
3720
|
+
const collapsedData = (0, import_react10.useMemo)(() => {
|
|
3667
3721
|
return singleStoryComponentIds.reduce(
|
|
3668
3722
|
(acc, id) => {
|
|
3669
3723
|
const { children, parent, name } = data[id];
|
|
@@ -3684,7 +3738,7 @@ var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3684
3738
|
{ ...data }
|
|
3685
3739
|
);
|
|
3686
3740
|
}, [data]);
|
|
3687
|
-
const ancestry = (0,
|
|
3741
|
+
const ancestry = (0, import_react10.useMemo)(() => {
|
|
3688
3742
|
return collapsedItems.reduce(
|
|
3689
3743
|
(acc, id) => Object.assign(acc, { [id]: getAncestorIds(collapsedData, id) }),
|
|
3690
3744
|
{}
|
|
@@ -3698,15 +3752,15 @@ var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3698
3752
|
selectedStoryId,
|
|
3699
3753
|
onSelectStoryId
|
|
3700
3754
|
});
|
|
3701
|
-
const groupStatus = (0,
|
|
3702
|
-
const treeItems = (0,
|
|
3755
|
+
const groupStatus = (0, import_react10.useMemo)(() => getGroupStatus(collapsedData, status), [collapsedData, status]);
|
|
3756
|
+
const treeItems = (0, import_react10.useMemo)(() => {
|
|
3703
3757
|
return collapsedItems.map((itemId) => {
|
|
3704
3758
|
const item = collapsedData[itemId];
|
|
3705
3759
|
const id = createId(itemId, refId);
|
|
3706
3760
|
if (item.type === "root") {
|
|
3707
3761
|
const descendants = expandableDescendants[item.id];
|
|
3708
3762
|
const isFullyExpanded = descendants.every((d) => expanded[d]);
|
|
3709
|
-
return /* @__PURE__ */ (0,
|
|
3763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3710
3764
|
Root,
|
|
3711
3765
|
{
|
|
3712
3766
|
item,
|
|
@@ -3728,7 +3782,7 @@ var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3728
3782
|
}
|
|
3729
3783
|
const isDisplayed = !item.parent || ancestry[itemId].every((a) => expanded[a]);
|
|
3730
3784
|
const color = groupStatus[itemId] ? statusMapping[groupStatus[itemId]][1] : null;
|
|
3731
|
-
return /* @__PURE__ */ (0,
|
|
3785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3732
3786
|
Node,
|
|
3733
3787
|
{
|
|
3734
3788
|
item,
|
|
@@ -3761,23 +3815,23 @@ var Tree = import_react8.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3761
3815
|
setExpanded,
|
|
3762
3816
|
status
|
|
3763
3817
|
]);
|
|
3764
|
-
return /* @__PURE__ */ (0,
|
|
3818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Container, { ref: containerRef, hasOrphans: isMain && orphanIds.length > 0, children: treeItems });
|
|
3765
3819
|
});
|
|
3766
3820
|
var Container = import_react_native_theming7.styled.View((props) => ({
|
|
3767
3821
|
marginTop: props.hasOrphans ? 20 : 0,
|
|
3768
3822
|
marginBottom: 20
|
|
3769
3823
|
}));
|
|
3770
|
-
var Root =
|
|
3824
|
+
var Root = import_react10.default.memo(function Root2({
|
|
3771
3825
|
setExpanded,
|
|
3772
3826
|
isFullyExpanded,
|
|
3773
3827
|
expandableDescendants,
|
|
3774
3828
|
...props
|
|
3775
3829
|
}) {
|
|
3776
|
-
const setFullyExpanded = (0,
|
|
3830
|
+
const setFullyExpanded = (0, import_react10.useCallback)(
|
|
3777
3831
|
() => setExpanded({ ids: expandableDescendants, value: !isFullyExpanded }),
|
|
3778
3832
|
[setExpanded, isFullyExpanded, expandableDescendants]
|
|
3779
3833
|
);
|
|
3780
|
-
return /* @__PURE__ */ (0,
|
|
3834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3781
3835
|
Node,
|
|
3782
3836
|
{
|
|
3783
3837
|
...props,
|
|
@@ -3789,10 +3843,10 @@ var Root = import_react8.default.memo(function Root2({
|
|
|
3789
3843
|
});
|
|
3790
3844
|
|
|
3791
3845
|
// src/LayoutProvider.tsx
|
|
3792
|
-
var
|
|
3846
|
+
var import_react11 = require("react");
|
|
3793
3847
|
var import_react_native = require("react-native");
|
|
3794
|
-
var
|
|
3795
|
-
var LayoutContext = (0,
|
|
3848
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3849
|
+
var LayoutContext = (0, import_react11.createContext)({
|
|
3796
3850
|
isDesktop: false,
|
|
3797
3851
|
isMobile: true
|
|
3798
3852
|
});
|
|
@@ -3800,28 +3854,28 @@ var LayoutProvider = ({ children }) => {
|
|
|
3800
3854
|
const { width } = (0, import_react_native.useWindowDimensions)();
|
|
3801
3855
|
const isDesktop = width >= BREAKPOINT;
|
|
3802
3856
|
const isMobile = !isDesktop;
|
|
3803
|
-
const contextValue = (0,
|
|
3857
|
+
const contextValue = (0, import_react11.useMemo)(
|
|
3804
3858
|
() => ({
|
|
3805
3859
|
isDesktop,
|
|
3806
3860
|
isMobile
|
|
3807
3861
|
}),
|
|
3808
3862
|
[isDesktop, isMobile]
|
|
3809
3863
|
);
|
|
3810
|
-
return /* @__PURE__ */ (0,
|
|
3864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(LayoutContext.Provider, { value: contextValue, children });
|
|
3811
3865
|
};
|
|
3812
|
-
var useLayout = () => (0,
|
|
3866
|
+
var useLayout = () => (0, import_react11.useContext)(LayoutContext);
|
|
3813
3867
|
|
|
3814
3868
|
// src/Explorer.tsx
|
|
3815
|
-
var
|
|
3869
|
+
var import_react13 = __toESM(require("react"));
|
|
3816
3870
|
|
|
3817
3871
|
// src/Refs.tsx
|
|
3818
|
-
var
|
|
3872
|
+
var import_react12 = __toESM(require("react"));
|
|
3819
3873
|
var import_react_native_theming8 = require("@storybook/react-native-theming");
|
|
3820
|
-
var
|
|
3874
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3821
3875
|
var Wrapper2 = import_react_native_theming8.styled.View(({}) => ({
|
|
3822
3876
|
position: "relative"
|
|
3823
3877
|
}));
|
|
3824
|
-
var Ref =
|
|
3878
|
+
var Ref = import_react12.default.memo(function Ref2(props) {
|
|
3825
3879
|
const {
|
|
3826
3880
|
index,
|
|
3827
3881
|
id: refId,
|
|
@@ -3836,26 +3890,26 @@ var Ref = import_react10.default.memo(function Ref2(props) {
|
|
|
3836
3890
|
previewInitialized,
|
|
3837
3891
|
setSelection
|
|
3838
3892
|
} = props;
|
|
3839
|
-
const length = (0,
|
|
3893
|
+
const length = (0, import_react12.useMemo)(() => index ? Object.keys(index).length : 0, [index]);
|
|
3840
3894
|
const isLoadingInjected = type === "auto-inject" && !previewInitialized || type === "server-checked";
|
|
3841
3895
|
const isLoading = isLoadingMain || isLoadingInjected || type === "unknown";
|
|
3842
3896
|
const isError = !!indexError;
|
|
3843
3897
|
const isEmpty = !isLoading && length === 0;
|
|
3844
3898
|
const isAuthRequired = !!loginUrl && length === 0;
|
|
3845
3899
|
const state = getStateType(isLoading, isAuthRequired, isError, isEmpty);
|
|
3846
|
-
const [isExpanded, setExpanded] = (0,
|
|
3847
|
-
(0,
|
|
3900
|
+
const [isExpanded, setExpanded] = (0, import_react12.useState)(expanded);
|
|
3901
|
+
(0, import_react12.useEffect)(() => {
|
|
3848
3902
|
if (index && selectedStoryId && index[selectedStoryId]) {
|
|
3849
3903
|
setExpanded(true);
|
|
3850
3904
|
}
|
|
3851
3905
|
}, [setExpanded, index, selectedStoryId]);
|
|
3852
|
-
const onSelectStoryId = (0,
|
|
3906
|
+
const onSelectStoryId = (0, import_react12.useCallback)(
|
|
3853
3907
|
(storyId) => {
|
|
3854
3908
|
setSelection({ refId, storyId });
|
|
3855
3909
|
},
|
|
3856
3910
|
[refId, setSelection]
|
|
3857
3911
|
);
|
|
3858
|
-
return /* @__PURE__ */ (0,
|
|
3912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: isExpanded && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Wrapper2, { "data-title": title, isMain: true, children: state === "ready" && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3859
3913
|
Tree,
|
|
3860
3914
|
{
|
|
3861
3915
|
status: props.status,
|
|
@@ -3872,17 +3926,17 @@ var Ref = import_react10.default.memo(function Ref2(props) {
|
|
|
3872
3926
|
|
|
3873
3927
|
// src/Explorer.tsx
|
|
3874
3928
|
var import_react_native2 = require("react-native");
|
|
3875
|
-
var
|
|
3876
|
-
var
|
|
3877
|
-
var Explorer =
|
|
3929
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
3930
|
+
var import_react14 = require("react");
|
|
3931
|
+
var Explorer = import_react13.default.memo(function Explorer2({
|
|
3878
3932
|
isLoading,
|
|
3879
3933
|
isBrowsing,
|
|
3880
3934
|
dataset,
|
|
3881
3935
|
selected,
|
|
3882
3936
|
setSelection
|
|
3883
3937
|
}) {
|
|
3884
|
-
const containerRef = (0,
|
|
3885
|
-
return /* @__PURE__ */ (0,
|
|
3938
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
3939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_native2.View, { ref: containerRef, id: "storybook-explorer-tree", children: dataset.entries.map(([refId, ref]) => /* @__PURE__ */ (0, import_react14.createElement)(
|
|
3886
3940
|
Ref,
|
|
3887
3941
|
{
|
|
3888
3942
|
...ref,
|
|
@@ -3896,34 +3950,34 @@ var Explorer = import_react11.default.memo(function Explorer2({
|
|
|
3896
3950
|
});
|
|
3897
3951
|
|
|
3898
3952
|
// src/Sidebar.tsx
|
|
3899
|
-
var
|
|
3953
|
+
var import_react19 = __toESM(require("react"));
|
|
3900
3954
|
var import_react_native_theming11 = require("@storybook/react-native-theming");
|
|
3901
3955
|
|
|
3902
3956
|
// src/Search.tsx
|
|
3903
3957
|
var import_bottom_sheet = require("@gorhom/bottom-sheet");
|
|
3904
3958
|
var import_react_native_theming9 = require("@storybook/react-native-theming");
|
|
3905
3959
|
var import_fuse = __toESM(require("fuse.js"));
|
|
3906
|
-
var
|
|
3960
|
+
var import_react15 = __toESM(require("react"));
|
|
3907
3961
|
var import_react_native3 = require("react-native");
|
|
3908
3962
|
|
|
3909
3963
|
// src/icon/CloseIcon.tsx
|
|
3910
3964
|
var import_react_native_svg8 = require("react-native-svg");
|
|
3911
|
-
var
|
|
3965
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3912
3966
|
var CloseIcon = ({
|
|
3913
3967
|
color = "currentColor",
|
|
3914
3968
|
width = 14,
|
|
3915
3969
|
height = 14,
|
|
3916
3970
|
...props
|
|
3917
3971
|
}) => {
|
|
3918
|
-
return /* @__PURE__ */ (0,
|
|
3919
|
-
/* @__PURE__ */ (0,
|
|
3972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react_native_svg8.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: [
|
|
3973
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3920
3974
|
import_react_native_svg8.Path,
|
|
3921
3975
|
{
|
|
3922
3976
|
d: "M9.854 4.146a.5.5 0 010 .708L7.707 7l2.147 2.146a.5.5 0 01-.708.708L7 7.707 4.854 9.854a.5.5 0 01-.708-.708L6.293 7 4.146 4.854a.5.5 0 11.708-.708L7 6.293l2.146-2.147a.5.5 0 01.708 0z",
|
|
3923
3977
|
fill: color
|
|
3924
3978
|
}
|
|
3925
3979
|
),
|
|
3926
|
-
/* @__PURE__ */ (0,
|
|
3980
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3927
3981
|
import_react_native_svg8.Path,
|
|
3928
3982
|
{
|
|
3929
3983
|
fillRule: "evenodd",
|
|
@@ -3937,14 +3991,14 @@ var CloseIcon = ({
|
|
|
3937
3991
|
|
|
3938
3992
|
// src/icon/SearchIcon.tsx
|
|
3939
3993
|
var import_react_native_svg9 = require("react-native-svg");
|
|
3940
|
-
var
|
|
3994
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3941
3995
|
var SearchIcon = ({
|
|
3942
3996
|
color = "currentColor",
|
|
3943
3997
|
width = 14,
|
|
3944
3998
|
height = 14,
|
|
3945
3999
|
...props
|
|
3946
4000
|
}) => {
|
|
3947
|
-
return /* @__PURE__ */ (0,
|
|
4001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native_svg9.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3948
4002
|
import_react_native_svg9.Path,
|
|
3949
4003
|
{
|
|
3950
4004
|
fillRule: "evenodd",
|
|
@@ -3961,7 +4015,7 @@ function isExpandType(x2) {
|
|
|
3961
4015
|
}
|
|
3962
4016
|
|
|
3963
4017
|
// src/Search.tsx
|
|
3964
|
-
var
|
|
4018
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3965
4019
|
var DEFAULT_MAX_SEARCH_RESULTS = 50;
|
|
3966
4020
|
var options = {
|
|
3967
4021
|
shouldSort: true,
|
|
@@ -4035,22 +4089,24 @@ var ClearIcon = import_react_native_theming9.styled.TouchableOpacity(({ theme })
|
|
|
4035
4089
|
justifyContent: "center",
|
|
4036
4090
|
height: "100%"
|
|
4037
4091
|
}));
|
|
4038
|
-
var Search =
|
|
4039
|
-
const inputRef = (0,
|
|
4040
|
-
const [inputValue, setInputValue] = (0,
|
|
4041
|
-
const [isOpen, setIsOpen] = (0,
|
|
4042
|
-
const [allComponents, showAllComponents] = (0,
|
|
4092
|
+
var Search = import_react15.default.memo(function Search2({ children, dataset, setSelection, getLastViewed, initialQuery = "" }) {
|
|
4093
|
+
const inputRef = (0, import_react15.useRef)(null);
|
|
4094
|
+
const [inputValue, setInputValue] = (0, import_react15.useState)(initialQuery);
|
|
4095
|
+
const [isOpen, setIsOpen] = (0, import_react15.useState)(false);
|
|
4096
|
+
const [allComponents, showAllComponents] = (0, import_react15.useState)(false);
|
|
4043
4097
|
const { isMobile } = useLayout();
|
|
4044
|
-
const
|
|
4098
|
+
const { scrollToSelectedNode } = useSelectedNode();
|
|
4099
|
+
const selectStory = (0, import_react15.useCallback)(
|
|
4045
4100
|
(id, refId) => {
|
|
4046
4101
|
setSelection({ storyId: id, refId });
|
|
4047
4102
|
inputRef.current?.blur();
|
|
4048
4103
|
setIsOpen(false);
|
|
4049
4104
|
showAllComponents(false);
|
|
4105
|
+
scrollToSelectedNode();
|
|
4050
4106
|
},
|
|
4051
|
-
[setSelection]
|
|
4107
|
+
[scrollToSelectedNode, setSelection]
|
|
4052
4108
|
);
|
|
4053
|
-
const getItemProps = (0,
|
|
4109
|
+
const getItemProps = (0, import_react15.useCallback)(
|
|
4054
4110
|
({ item: result }) => {
|
|
4055
4111
|
return {
|
|
4056
4112
|
icon: result?.item?.type === "component" ? "component" : "story",
|
|
@@ -4073,7 +4129,7 @@ var Search = import_react13.default.memo(function Search2({ children, dataset, s
|
|
|
4073
4129
|
},
|
|
4074
4130
|
[selectStory]
|
|
4075
4131
|
);
|
|
4076
|
-
const makeFuse = (0,
|
|
4132
|
+
const makeFuse = (0, import_react15.useCallback)(() => {
|
|
4077
4133
|
const list = dataset.entries.reduce((acc, [refId, { index, status }]) => {
|
|
4078
4134
|
const groupStatus = getGroupStatus(index || {}, status);
|
|
4079
4135
|
if (index) {
|
|
@@ -4091,7 +4147,7 @@ var Search = import_react13.default.memo(function Search2({ children, dataset, s
|
|
|
4091
4147
|
}, []);
|
|
4092
4148
|
return new import_fuse.default(list, options);
|
|
4093
4149
|
}, [dataset]);
|
|
4094
|
-
const getResults = (0,
|
|
4150
|
+
const getResults = (0, import_react15.useCallback)(
|
|
4095
4151
|
(input2) => {
|
|
4096
4152
|
const fuse = makeFuse();
|
|
4097
4153
|
if (!input2)
|
|
@@ -4133,13 +4189,13 @@ var Search = import_react13.default.memo(function Search2({ children, dataset, s
|
|
|
4133
4189
|
},
|
|
4134
4190
|
[allComponents, dataset.hash, getLastViewed, makeFuse]
|
|
4135
4191
|
);
|
|
4136
|
-
const deferredQuery = (0,
|
|
4192
|
+
const deferredQuery = (0, import_react15.useDeferredValue)(inputValue);
|
|
4137
4193
|
const input = deferredQuery ? deferredQuery.trim() : "";
|
|
4138
4194
|
const results = input ? getResults(input) : [];
|
|
4139
|
-
return /* @__PURE__ */ (0,
|
|
4140
|
-
/* @__PURE__ */ (0,
|
|
4141
|
-
/* @__PURE__ */ (0,
|
|
4142
|
-
isMobile ? /* @__PURE__ */ (0,
|
|
4195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_react_native3.View, { style: { flex: 1 }, children: [
|
|
4196
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SearchField, { children: [
|
|
4197
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SearchIconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SearchIcon, {}) }),
|
|
4198
|
+
isMobile ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4143
4199
|
BottomSheetInput,
|
|
4144
4200
|
{
|
|
4145
4201
|
ref: inputRef,
|
|
@@ -4147,15 +4203,15 @@ var Search = import_react13.default.memo(function Search2({ children, dataset, s
|
|
|
4147
4203
|
onFocus: () => setIsOpen(true),
|
|
4148
4204
|
onBlur: () => setIsOpen(false)
|
|
4149
4205
|
}
|
|
4150
|
-
) : /* @__PURE__ */ (0,
|
|
4151
|
-
isOpen && /* @__PURE__ */ (0,
|
|
4206
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Input, { ref: inputRef, onChangeText: setInputValue, onFocus: () => setIsOpen(true) }),
|
|
4207
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4152
4208
|
ClearIcon,
|
|
4153
4209
|
{
|
|
4154
4210
|
onPress: () => {
|
|
4155
4211
|
setInputValue("");
|
|
4156
4212
|
inputRef.current.clear();
|
|
4157
4213
|
},
|
|
4158
|
-
children: /* @__PURE__ */ (0,
|
|
4214
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CloseIcon, {})
|
|
4159
4215
|
}
|
|
4160
4216
|
)
|
|
4161
4217
|
] }),
|
|
@@ -4173,11 +4229,11 @@ var Search = import_react13.default.memo(function Search2({ children, dataset, s
|
|
|
4173
4229
|
|
|
4174
4230
|
// src/SearchResults.tsx
|
|
4175
4231
|
var import_react_native_theming10 = require("@storybook/react-native-theming");
|
|
4176
|
-
var
|
|
4232
|
+
var import_react16 = __toESM(require("react"));
|
|
4177
4233
|
var import_polished2 = require("polished");
|
|
4178
4234
|
var import_react_native4 = require("react-native");
|
|
4179
|
-
var
|
|
4180
|
-
var
|
|
4235
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4236
|
+
var import_react17 = require("react");
|
|
4181
4237
|
var ResultsList = import_react_native_theming10.styled.View({
|
|
4182
4238
|
margin: 0,
|
|
4183
4239
|
padding: 0,
|
|
@@ -4243,23 +4299,23 @@ var RecentlyOpenedTitle = import_react_native_theming10.styled.View(({ theme })
|
|
|
4243
4299
|
marginBottom: 4,
|
|
4244
4300
|
alignItems: "center"
|
|
4245
4301
|
}));
|
|
4246
|
-
var Highlight =
|
|
4302
|
+
var Highlight = import_react16.default.memo(
|
|
4247
4303
|
function Highlight2({ children, match }) {
|
|
4248
4304
|
if (!match)
|
|
4249
4305
|
return children;
|
|
4250
4306
|
const { value, indices } = match;
|
|
4251
4307
|
const { nodes: result } = indices.reduce(
|
|
4252
4308
|
({ cursor, nodes }, [start, end], index, { length }) => {
|
|
4253
|
-
nodes.push(/* @__PURE__ */ (0,
|
|
4254
|
-
nodes.push(/* @__PURE__ */ (0,
|
|
4309
|
+
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: value.slice(cursor, start) }, `text-${index}`));
|
|
4310
|
+
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Mark, { children: value.slice(start, end + 1) }, `mark-${index}`));
|
|
4255
4311
|
if (index === length - 1) {
|
|
4256
|
-
nodes.push(/* @__PURE__ */ (0,
|
|
4312
|
+
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: value.slice(end + 1) }, `last-${index}`));
|
|
4257
4313
|
}
|
|
4258
4314
|
return { cursor: end + 1, nodes };
|
|
4259
4315
|
},
|
|
4260
4316
|
{ cursor: 0, nodes: [] }
|
|
4261
4317
|
);
|
|
4262
|
-
return /* @__PURE__ */ (0,
|
|
4318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: result }, `end-${match.key}`);
|
|
4263
4319
|
}
|
|
4264
4320
|
);
|
|
4265
4321
|
var Title = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
@@ -4278,14 +4334,14 @@ var PathText = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
|
4278
4334
|
fontSize: theme.typography.size.s1 - 1,
|
|
4279
4335
|
color: theme.textMutedColor
|
|
4280
4336
|
}));
|
|
4281
|
-
var Result =
|
|
4337
|
+
var Result = import_react16.default.memo(function Result2({
|
|
4282
4338
|
item,
|
|
4283
4339
|
matches,
|
|
4284
4340
|
icon: _icon,
|
|
4285
4341
|
onPress,
|
|
4286
4342
|
...props
|
|
4287
4343
|
}) {
|
|
4288
|
-
const press = (0,
|
|
4344
|
+
const press = (0, import_react16.useCallback)(
|
|
4289
4345
|
(event) => {
|
|
4290
4346
|
event.preventDefault();
|
|
4291
4347
|
onPress?.(event);
|
|
@@ -4295,16 +4351,16 @@ var Result = import_react14.default.memo(function Result2({
|
|
|
4295
4351
|
const nameMatch = matches.find((match) => match.key === "name");
|
|
4296
4352
|
const pathMatches = matches.filter((match) => match.key === "path");
|
|
4297
4353
|
const [i] = item.status ? statusMapping[item.status] : [];
|
|
4298
|
-
return /* @__PURE__ */ (0,
|
|
4299
|
-
/* @__PURE__ */ (0,
|
|
4300
|
-
item.type === "component" && /* @__PURE__ */ (0,
|
|
4301
|
-
item.type === "story" && /* @__PURE__ */ (0,
|
|
4354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ResultRow, { ...props, onPress: press, children: [
|
|
4355
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(IconWrapper, { children: [
|
|
4356
|
+
item.type === "component" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ComponentIcon, { width: "14", height: "14" }),
|
|
4357
|
+
item.type === "story" && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(StoryIcon, { width: "14", height: "14" })
|
|
4302
4358
|
] }),
|
|
4303
|
-
/* @__PURE__ */ (0,
|
|
4304
|
-
/* @__PURE__ */ (0,
|
|
4305
|
-
/* @__PURE__ */ (0,
|
|
4359
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ResultRowContent, { testID: "search-result-item--label", children: [
|
|
4360
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Highlight, { match: nameMatch, children: item.name }, "search-result-item--label-highlight") }),
|
|
4361
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Path10, { children: item.path.map((group, index) => {
|
|
4306
4362
|
const pathSeparator = index === item.path.length - 1 ? "" : "/";
|
|
4307
|
-
return /* @__PURE__ */ (0,
|
|
4363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native4.View, { style: { flexShrink: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(PathText, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4308
4364
|
Highlight,
|
|
4309
4365
|
{
|
|
4310
4366
|
match: pathMatches.find((match) => match.refIndex === index),
|
|
@@ -4319,7 +4375,7 @@ var Result = import_react14.default.memo(function Result2({
|
|
|
4319
4375
|
var Text = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
4320
4376
|
color: theme.color.defaultText
|
|
4321
4377
|
}));
|
|
4322
|
-
var SearchResults =
|
|
4378
|
+
var SearchResults = import_react16.default.memo(function SearchResults2({
|
|
4323
4379
|
query,
|
|
4324
4380
|
results,
|
|
4325
4381
|
closeMenu,
|
|
@@ -4331,18 +4387,18 @@ var SearchResults = import_react14.default.memo(function SearchResults2({
|
|
|
4331
4387
|
clearLastViewed();
|
|
4332
4388
|
closeMenu();
|
|
4333
4389
|
};
|
|
4334
|
-
return /* @__PURE__ */ (0,
|
|
4335
|
-
results.length > 0 && !query ? /* @__PURE__ */ (0,
|
|
4336
|
-
/* @__PURE__ */ (0,
|
|
4337
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(ResultsList, { children: [
|
|
4391
|
+
results.length > 0 && !query ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(RecentlyOpenedTitle, { children: [
|
|
4392
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: "Recently opened" }),
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { onPress: handleClearLastViewed })
|
|
4338
4394
|
] }) : null,
|
|
4339
|
-
results.length === 0 && query ? /* @__PURE__ */ (0,
|
|
4340
|
-
/* @__PURE__ */ (0,
|
|
4341
|
-
/* @__PURE__ */ (0,
|
|
4395
|
+
results.length === 0 && query ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native4.View, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(NoResults, { children: [
|
|
4396
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { style: { marginBottom: 8 }, children: "No components found" }),
|
|
4397
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: "Find components by name or path." })
|
|
4342
4398
|
] }) }) : null,
|
|
4343
4399
|
results.map((result, index) => {
|
|
4344
4400
|
if (isExpandType(result)) {
|
|
4345
|
-
return /* @__PURE__ */ (0,
|
|
4401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MoreWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4346
4402
|
Button,
|
|
4347
4403
|
{
|
|
4348
4404
|
...result,
|
|
@@ -4354,7 +4410,7 @@ var SearchResults = import_react14.default.memo(function SearchResults2({
|
|
|
4354
4410
|
}
|
|
4355
4411
|
const { item } = result;
|
|
4356
4412
|
const key = `${item.refId}::${item.id}`;
|
|
4357
|
-
return /* @__PURE__ */ (0,
|
|
4413
|
+
return /* @__PURE__ */ (0, import_react17.createElement)(
|
|
4358
4414
|
Result,
|
|
4359
4415
|
{
|
|
4360
4416
|
...result,
|
|
@@ -4369,11 +4425,11 @@ var SearchResults = import_react14.default.memo(function SearchResults2({
|
|
|
4369
4425
|
|
|
4370
4426
|
// src/hooks/useLastViewed.ts
|
|
4371
4427
|
var import_debounce = __toESM(require_debounce());
|
|
4372
|
-
var
|
|
4428
|
+
var import_react18 = require("react");
|
|
4373
4429
|
var import_store2 = __toESM(require("store2"));
|
|
4374
4430
|
var save = (0, import_debounce.default)((value) => import_store2.default.set("lastViewedStoryIds", value), 1e3);
|
|
4375
4431
|
var useLastViewed = (selection) => {
|
|
4376
|
-
const initialLastViewedStoryIds = (0,
|
|
4432
|
+
const initialLastViewedStoryIds = (0, import_react18.useMemo)(() => {
|
|
4377
4433
|
const items = import_store2.default.get("lastViewedStoryIds");
|
|
4378
4434
|
if (!items || !Array.isArray(items))
|
|
4379
4435
|
return [];
|
|
@@ -4381,8 +4437,8 @@ var useLastViewed = (selection) => {
|
|
|
4381
4437
|
return [];
|
|
4382
4438
|
return items;
|
|
4383
4439
|
}, []);
|
|
4384
|
-
const lastViewedRef = (0,
|
|
4385
|
-
const updateLastViewed = (0,
|
|
4440
|
+
const lastViewedRef = (0, import_react18.useRef)(initialLastViewedStoryIds);
|
|
4441
|
+
const updateLastViewed = (0, import_react18.useCallback)(
|
|
4386
4442
|
(story) => {
|
|
4387
4443
|
const items = lastViewedRef.current;
|
|
4388
4444
|
const index = items.findIndex(
|
|
@@ -4399,13 +4455,13 @@ var useLastViewed = (selection) => {
|
|
|
4399
4455
|
},
|
|
4400
4456
|
[lastViewedRef]
|
|
4401
4457
|
);
|
|
4402
|
-
(0,
|
|
4458
|
+
(0, import_react18.useEffect)(() => {
|
|
4403
4459
|
if (selection)
|
|
4404
4460
|
updateLastViewed(selection);
|
|
4405
4461
|
}, [selection]);
|
|
4406
4462
|
return {
|
|
4407
|
-
getLastViewed: (0,
|
|
4408
|
-
clearLastViewed: (0,
|
|
4463
|
+
getLastViewed: (0, import_react18.useCallback)(() => lastViewedRef.current, [lastViewedRef]),
|
|
4464
|
+
clearLastViewed: (0, import_react18.useCallback)(() => {
|
|
4409
4465
|
lastViewedRef.current = lastViewedRef.current.slice(0, 1);
|
|
4410
4466
|
save(lastViewedRef.current);
|
|
4411
4467
|
}, [lastViewedRef])
|
|
@@ -4414,7 +4470,7 @@ var useLastViewed = (selection) => {
|
|
|
4414
4470
|
|
|
4415
4471
|
// src/Sidebar.tsx
|
|
4416
4472
|
var import_react_native5 = require("react-native");
|
|
4417
|
-
var
|
|
4473
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
4418
4474
|
var Container2 = import_react_native_theming11.styled.View(({ theme }) => ({
|
|
4419
4475
|
width: "100%",
|
|
4420
4476
|
height: "100%",
|
|
@@ -4429,18 +4485,18 @@ var Top = import_react_native_theming11.styled.View({
|
|
|
4429
4485
|
flex: 1,
|
|
4430
4486
|
flexDirection: "row"
|
|
4431
4487
|
});
|
|
4432
|
-
var Swap =
|
|
4488
|
+
var Swap = import_react19.default.memo(function Swap2({
|
|
4433
4489
|
children,
|
|
4434
4490
|
condition
|
|
4435
4491
|
}) {
|
|
4436
|
-
const [a, b] =
|
|
4437
|
-
return /* @__PURE__ */ (0,
|
|
4438
|
-
/* @__PURE__ */ (0,
|
|
4439
|
-
/* @__PURE__ */ (0,
|
|
4492
|
+
const [a, b] = import_react19.default.Children.toArray(children);
|
|
4493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
4494
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native5.View, { style: { display: condition ? "flex" : "none" }, children: a }),
|
|
4495
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_native5.View, { style: { display: condition ? "none" : "flex" }, children: b })
|
|
4440
4496
|
] });
|
|
4441
4497
|
});
|
|
4442
4498
|
var useCombination = (index, indexError, previewInitialized, status, refs) => {
|
|
4443
|
-
const hash = (0,
|
|
4499
|
+
const hash = (0, import_react19.useMemo)(
|
|
4444
4500
|
() => ({
|
|
4445
4501
|
[DEFAULT_REF_ID]: {
|
|
4446
4502
|
index,
|
|
@@ -4455,9 +4511,9 @@ var useCombination = (index, indexError, previewInitialized, status, refs) => {
|
|
|
4455
4511
|
}),
|
|
4456
4512
|
[refs, index, indexError, previewInitialized, status]
|
|
4457
4513
|
);
|
|
4458
|
-
return (0,
|
|
4514
|
+
return (0, import_react19.useMemo)(() => ({ hash, entries: Object.entries(hash) }), [hash]);
|
|
4459
4515
|
};
|
|
4460
|
-
var Sidebar =
|
|
4516
|
+
var Sidebar = import_react19.default.memo(function Sidebar2({
|
|
4461
4517
|
storyId = null,
|
|
4462
4518
|
refId = DEFAULT_REF_ID,
|
|
4463
4519
|
index,
|
|
@@ -4467,11 +4523,11 @@ var Sidebar = import_react17.default.memo(function Sidebar2({
|
|
|
4467
4523
|
refs = {},
|
|
4468
4524
|
setSelection
|
|
4469
4525
|
}) {
|
|
4470
|
-
const selected = (0,
|
|
4526
|
+
const selected = (0, import_react19.useMemo)(() => storyId && { storyId, refId }, [storyId, refId]);
|
|
4471
4527
|
const dataset = useCombination(index, indexError, previewInitialized, status, refs);
|
|
4472
4528
|
const lastViewedProps = useLastViewed(selected);
|
|
4473
|
-
return /* @__PURE__ */ (0,
|
|
4474
|
-
/* @__PURE__ */ (0,
|
|
4529
|
+
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: [
|
|
4530
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4475
4531
|
Explorer,
|
|
4476
4532
|
{
|
|
4477
4533
|
dataset,
|
|
@@ -4481,7 +4537,7 @@ var Sidebar = import_react17.default.memo(function Sidebar2({
|
|
|
4481
4537
|
setSelection
|
|
4482
4538
|
}
|
|
4483
4539
|
),
|
|
4484
|
-
/* @__PURE__ */ (0,
|
|
4540
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
4485
4541
|
SearchResults,
|
|
4486
4542
|
{
|
|
4487
4543
|
query,
|
|
@@ -4500,7 +4556,7 @@ var Sidebar = import_react17.default.memo(function Sidebar2({
|
|
|
4500
4556
|
var import_core_events = require("@storybook/core/core-events");
|
|
4501
4557
|
var import_manager_api2 = require("@storybook/core/manager-api");
|
|
4502
4558
|
var import_react_native_theming17 = require("@storybook/react-native-theming");
|
|
4503
|
-
var
|
|
4559
|
+
var import_react28 = require("react");
|
|
4504
4560
|
var import_react_native9 = require("react-native");
|
|
4505
4561
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
4506
4562
|
|
|
@@ -4509,7 +4565,7 @@ var import_bottom_sheet2 = require("@gorhom/bottom-sheet");
|
|
|
4509
4565
|
var import_manager_api = require("@storybook/core/manager-api");
|
|
4510
4566
|
var import_react_native_theming12 = require("@storybook/react-native-theming");
|
|
4511
4567
|
var import_types3 = require("@storybook/core/types");
|
|
4512
|
-
var
|
|
4568
|
+
var import_react21 = require("react");
|
|
4513
4569
|
var import_react_native6 = require("react-native");
|
|
4514
4570
|
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
4515
4571
|
var import_react_native_reanimated = __toESM(require("react-native-reanimated"));
|
|
@@ -4517,29 +4573,29 @@ var import_react_native_safe_area_context = require("react-native-safe-area-cont
|
|
|
4517
4573
|
var import_react_native_theming13 = require("@storybook/react-native-theming");
|
|
4518
4574
|
|
|
4519
4575
|
// src/util/useStyle.ts
|
|
4520
|
-
var
|
|
4576
|
+
var import_react20 = require("react");
|
|
4521
4577
|
var useStyle = (styleFactory, deps) => (
|
|
4522
4578
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4523
|
-
(0,
|
|
4579
|
+
(0, import_react20.useMemo)(styleFactory, deps)
|
|
4524
4580
|
);
|
|
4525
4581
|
|
|
4526
4582
|
// src/MobileAddonsPanel.tsx
|
|
4527
|
-
var
|
|
4583
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4528
4584
|
var bottomSheetStyle = {
|
|
4529
4585
|
paddingTop: 8
|
|
4530
4586
|
};
|
|
4531
4587
|
var contentStyle = {
|
|
4532
4588
|
flex: 1
|
|
4533
4589
|
};
|
|
4534
|
-
var MobileAddonsPanel = (0,
|
|
4590
|
+
var MobileAddonsPanel = (0, import_react21.forwardRef)(
|
|
4535
4591
|
({ storyId }, ref) => {
|
|
4536
4592
|
const theme = (0, import_react_native_theming13.useTheme)();
|
|
4537
4593
|
const reducedMotion = (0, import_react_native_reanimated.useReducedMotion)();
|
|
4538
|
-
const addonsPanelBottomSheetRef = (0,
|
|
4594
|
+
const addonsPanelBottomSheetRef = (0, import_react21.useRef)(null);
|
|
4539
4595
|
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
4540
4596
|
const animatedPosition = (0, import_react_native_reanimated.useSharedValue)(0);
|
|
4541
4597
|
(0, import_react_native_reanimated.useAnimatedKeyboard)();
|
|
4542
|
-
(0,
|
|
4598
|
+
(0, import_react21.useImperativeHandle)(ref, () => ({
|
|
4543
4599
|
setAddonsPanelOpen: (open) => {
|
|
4544
4600
|
if (open) {
|
|
4545
4601
|
addonsPanelBottomSheetRef.current?.present();
|
|
@@ -4568,7 +4624,7 @@ var MobileAddonsPanel = (0, import_react19.forwardRef)(
|
|
|
4568
4624
|
backgroundColor: theme.textMutedColor
|
|
4569
4625
|
};
|
|
4570
4626
|
});
|
|
4571
|
-
return /* @__PURE__ */ (0,
|
|
4627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4572
4628
|
import_bottom_sheet2.BottomSheetModal,
|
|
4573
4629
|
{
|
|
4574
4630
|
ref: addonsPanelBottomSheetRef,
|
|
@@ -4584,7 +4640,7 @@ var MobileAddonsPanel = (0, import_react19.forwardRef)(
|
|
|
4584
4640
|
enableHandlePanningGesture: true,
|
|
4585
4641
|
stackBehavior: "replace",
|
|
4586
4642
|
enableDynamicSizing: false,
|
|
4587
|
-
children: /* @__PURE__ */ (0,
|
|
4643
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native_reanimated.default.View, { style: [contentStyle, adjustedBottomSheetSize], children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4588
4644
|
AddonsTabs,
|
|
4589
4645
|
{
|
|
4590
4646
|
onClose: () => {
|
|
@@ -4624,25 +4680,25 @@ var centeredStyle = {
|
|
|
4624
4680
|
var hitSlop = { top: 10, right: 10, bottom: 10, left: 10 };
|
|
4625
4681
|
var AddonsTabs = ({ onClose, storyId }) => {
|
|
4626
4682
|
const panels = import_manager_api.addons.getElements(import_types3.Addon_TypesEnum.PANEL);
|
|
4627
|
-
const [addonSelected, setAddonSelected] = (0,
|
|
4683
|
+
const [addonSelected, setAddonSelected] = (0, import_react21.useState)(Object.keys(panels)[0]);
|
|
4628
4684
|
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
4629
4685
|
const scrollContentContainerStyle = useStyle(() => {
|
|
4630
4686
|
return {
|
|
4631
4687
|
paddingBottom: insets.bottom + 16
|
|
4632
4688
|
};
|
|
4633
4689
|
});
|
|
4634
|
-
const panel = (0,
|
|
4690
|
+
const panel = (0, import_react21.useMemo)(() => {
|
|
4635
4691
|
if (!storyId) {
|
|
4636
|
-
return /* @__PURE__ */ (0,
|
|
4692
|
+
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" }) });
|
|
4637
4693
|
}
|
|
4638
4694
|
if (Object.keys(panels).length === 0) {
|
|
4639
|
-
return /* @__PURE__ */ (0,
|
|
4695
|
+
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 addons loaded." }) });
|
|
4640
4696
|
}
|
|
4641
4697
|
return panels[addonSelected].render({ active: true });
|
|
4642
4698
|
}, [addonSelected, panels, storyId]);
|
|
4643
|
-
return /* @__PURE__ */ (0,
|
|
4644
|
-
/* @__PURE__ */ (0,
|
|
4645
|
-
/* @__PURE__ */ (0,
|
|
4699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native6.View, { style: addonsTabsContainerStyle, children: [
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_react_native6.View, { style: addonsTabsStyle, children: [
|
|
4701
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4646
4702
|
import_react_native_gesture_handler.ScrollView,
|
|
4647
4703
|
{
|
|
4648
4704
|
horizontal: true,
|
|
@@ -4650,7 +4706,7 @@ var AddonsTabs = ({ onClose, storyId }) => {
|
|
|
4650
4706
|
contentContainerStyle: addonsTabsContentContainerStyle,
|
|
4651
4707
|
children: Object.values(panels).map(({ id, title }) => {
|
|
4652
4708
|
const resolvedTitle = typeof title === "function" ? title({}) : title;
|
|
4653
|
-
return /* @__PURE__ */ (0,
|
|
4709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4654
4710
|
Tab,
|
|
4655
4711
|
{
|
|
4656
4712
|
active: id === addonSelected,
|
|
@@ -4662,7 +4718,7 @@ var AddonsTabs = ({ onClose, storyId }) => {
|
|
|
4662
4718
|
})
|
|
4663
4719
|
}
|
|
4664
4720
|
),
|
|
4665
|
-
/* @__PURE__ */ (0,
|
|
4721
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4666
4722
|
IconButton,
|
|
4667
4723
|
{
|
|
4668
4724
|
style: closeIconStyle,
|
|
@@ -4672,7 +4728,7 @@ var AddonsTabs = ({ onClose, storyId }) => {
|
|
|
4672
4728
|
}
|
|
4673
4729
|
)
|
|
4674
4730
|
] }),
|
|
4675
|
-
/* @__PURE__ */ (0,
|
|
4731
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4676
4732
|
import_react_native_gesture_handler.ScrollView,
|
|
4677
4733
|
{
|
|
4678
4734
|
style: addonsScrollStyle,
|
|
@@ -4683,7 +4739,7 @@ var AddonsTabs = ({ onClose, storyId }) => {
|
|
|
4683
4739
|
] });
|
|
4684
4740
|
};
|
|
4685
4741
|
var Tab = ({ active, onPress, text }) => {
|
|
4686
|
-
return /* @__PURE__ */ (0,
|
|
4742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TabButton, { active, onPress, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TabText, { active, children: text }) });
|
|
4687
4743
|
};
|
|
4688
4744
|
var TabButton = import_react_native_theming12.styled.TouchableOpacity(({ theme, active }) => ({
|
|
4689
4745
|
borderBottomWidth: active ? 2 : 0,
|
|
@@ -4703,13 +4759,13 @@ var TabText = import_react_native_theming12.styled.Text(({ theme, active }) => (
|
|
|
4703
4759
|
|
|
4704
4760
|
// src/MobileMenuDrawer.tsx
|
|
4705
4761
|
var import_bottom_sheet3 = __toESM(require("@gorhom/bottom-sheet"));
|
|
4706
|
-
var
|
|
4762
|
+
var import_react_native_theming14 = require("@storybook/react-native-theming");
|
|
4763
|
+
var import_react22 = require("react");
|
|
4707
4764
|
var import_react_native7 = require("react-native");
|
|
4708
4765
|
var import_react_native_reanimated2 = require("react-native-reanimated");
|
|
4709
4766
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
4710
|
-
var
|
|
4711
|
-
var
|
|
4712
|
-
var BottomSheetBackdropComponent = (backdropComponentProps) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4767
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4768
|
+
var BottomSheetBackdropComponent = (backdropComponentProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4713
4769
|
import_bottom_sheet3.BottomSheetBackdrop,
|
|
4714
4770
|
{
|
|
4715
4771
|
...backdropComponentProps,
|
|
@@ -4720,32 +4776,34 @@ var BottomSheetBackdropComponent = (backdropComponentProps) => /* @__PURE__ */ (
|
|
|
4720
4776
|
}
|
|
4721
4777
|
);
|
|
4722
4778
|
var snapPoints = ["50%", "75%"];
|
|
4723
|
-
var MobileMenuDrawer = (0,
|
|
4724
|
-
(0,
|
|
4779
|
+
var MobileMenuDrawer = (0, import_react22.memo)(
|
|
4780
|
+
(0, import_react22.forwardRef)(({ children }, ref) => {
|
|
4725
4781
|
const reducedMotion = (0, import_react_native_reanimated2.useReducedMotion)();
|
|
4726
4782
|
const insets = (0, import_react_native_safe_area_context2.useSafeAreaInsets)();
|
|
4727
4783
|
const theme = (0, import_react_native_theming14.useTheme)();
|
|
4728
|
-
const menuBottomSheetRef = (0,
|
|
4729
|
-
|
|
4784
|
+
const menuBottomSheetRef = (0, import_react22.useRef)(null);
|
|
4785
|
+
const { scrollToSelectedNode, scrollRef } = useSelectedNode();
|
|
4786
|
+
(0, import_react22.useImperativeHandle)(ref, () => ({
|
|
4730
4787
|
setMobileMenuOpen: (open) => {
|
|
4731
4788
|
if (open) {
|
|
4732
4789
|
menuBottomSheetRef.current?.snapToIndex(1);
|
|
4790
|
+
scrollToSelectedNode();
|
|
4733
4791
|
} else {
|
|
4734
4792
|
import_react_native7.Keyboard.dismiss();
|
|
4735
4793
|
menuBottomSheetRef.current?.close();
|
|
4736
4794
|
}
|
|
4737
4795
|
}
|
|
4738
4796
|
}));
|
|
4739
|
-
const bgColorStyle = (0,
|
|
4797
|
+
const bgColorStyle = (0, import_react22.useMemo)(() => {
|
|
4740
4798
|
return { backgroundColor: theme.background.content };
|
|
4741
4799
|
}, [theme.background.content]);
|
|
4742
|
-
const handleIndicatorStyle = (0,
|
|
4800
|
+
const handleIndicatorStyle = (0, import_react22.useMemo)(() => {
|
|
4743
4801
|
return { backgroundColor: theme.textMutedColor };
|
|
4744
4802
|
}, [theme.textMutedColor]);
|
|
4745
|
-
const contentContainerStyle2 = (0,
|
|
4803
|
+
const contentContainerStyle2 = (0, import_react22.useMemo)(() => {
|
|
4746
4804
|
return { paddingBottom: insets.bottom };
|
|
4747
4805
|
}, [insets.bottom]);
|
|
4748
|
-
return /* @__PURE__ */ (0,
|
|
4806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4749
4807
|
import_bottom_sheet3.default,
|
|
4750
4808
|
{
|
|
4751
4809
|
ref: menuBottomSheetRef,
|
|
@@ -4761,9 +4819,10 @@ var MobileMenuDrawer = (0, import_react20.memo)(
|
|
|
4761
4819
|
backdropComponent: BottomSheetBackdropComponent,
|
|
4762
4820
|
backgroundStyle: bgColorStyle,
|
|
4763
4821
|
handleIndicatorStyle,
|
|
4764
|
-
children: /* @__PURE__ */ (0,
|
|
4822
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4765
4823
|
import_bottom_sheet3.BottomSheetScrollView,
|
|
4766
4824
|
{
|
|
4825
|
+
ref: scrollRef,
|
|
4767
4826
|
keyboardShouldPersistTaps: "handled",
|
|
4768
4827
|
contentContainerStyle: contentContainerStyle2,
|
|
4769
4828
|
children
|
|
@@ -4775,23 +4834,23 @@ var MobileMenuDrawer = (0, import_react20.memo)(
|
|
|
4775
4834
|
);
|
|
4776
4835
|
|
|
4777
4836
|
// src/StorybookLogo.tsx
|
|
4778
|
-
var
|
|
4837
|
+
var import_react23 = require("react");
|
|
4779
4838
|
var import_react_native8 = require("react-native");
|
|
4780
4839
|
|
|
4781
4840
|
// src/icon/DarkLogo.tsx
|
|
4782
4841
|
var import_react_native_svg10 = __toESM(require("react-native-svg"));
|
|
4783
|
-
var
|
|
4842
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4784
4843
|
function DarkLogo({ width = 300, height = 60, ...props }) {
|
|
4785
|
-
return /* @__PURE__ */ (0,
|
|
4786
|
-
/* @__PURE__ */ (0,
|
|
4787
|
-
/* @__PURE__ */ (0,
|
|
4844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native_svg10.default, { width, height, viewBox: "0 0 300 60", ...props, children: [
|
|
4845
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native_svg10.Defs, { children: [
|
|
4846
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4788
4847
|
import_react_native_svg10.Path,
|
|
4789
4848
|
{
|
|
4790
4849
|
id: "a",
|
|
4791
4850
|
d: "M1.848 54.92L.002 5.723A2.997 2.997 0 012.81 2.621L44.654.006a2.997 2.997 0 013.183 2.99v53.607a2.997 2.997 0 01-3.13 2.994l-40-1.796a2.997 2.997 0 01-2.86-2.882z"
|
|
4792
4851
|
}
|
|
4793
4852
|
),
|
|
4794
|
-
/* @__PURE__ */ (0,
|
|
4853
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4795
4854
|
import_react_native_svg10.Path,
|
|
4796
4855
|
{
|
|
4797
4856
|
id: "c",
|
|
@@ -4799,8 +4858,8 @@ function DarkLogo({ width = 300, height = 60, ...props }) {
|
|
|
4799
4858
|
}
|
|
4800
4859
|
)
|
|
4801
4860
|
] }),
|
|
4802
|
-
/* @__PURE__ */ (0,
|
|
4803
|
-
/* @__PURE__ */ (0,
|
|
4861
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native_svg10.G, { fill: "none", fillRule: "evenodd", children: [
|
|
4862
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4804
4863
|
import_react_native_svg10.Path,
|
|
4805
4864
|
{
|
|
4806
4865
|
fill: "#FFF",
|
|
@@ -4808,7 +4867,7 @@ function DarkLogo({ width = 300, height = 60, ...props }) {
|
|
|
4808
4867
|
d: "M80.387 47.178c-2.543 0-4.99-.342-7.343-1.025-2.352-.684-4.307-1.63-5.864-2.837l2.384-5.293c3.242 2.257 6.882 3.386 10.919 3.386 2.097 0 3.71-.342 4.84-1.026 1.128-.683 1.692-1.629 1.692-2.836 0-1.081-.517-1.924-1.55-2.528-1.033-.603-2.869-1.192-5.507-1.764-2.956-.604-5.316-1.335-7.08-2.193-1.765-.858-3.052-1.915-3.862-3.17-.811-1.256-1.216-2.806-1.216-4.65 0-2.034.564-3.846 1.692-5.435 1.129-1.59 2.71-2.837 4.744-3.743 2.035-.906 4.387-1.359 7.057-1.359 2.384 0 4.68.35 6.89 1.05 2.21.699 3.965 1.636 5.269 2.812l-2.384 5.293c-3.084-2.257-6.326-3.385-9.727-3.385-1.94 0-3.465.373-4.577 1.12-1.113.747-1.67 1.772-1.67 3.075 0 .763.215 1.391.644 1.884.43.492 1.145.93 2.146 1.31 1.001.382 2.424.78 4.267 1.193 4.323.954 7.43 2.177 9.322 3.671 1.891 1.494 2.837 3.56 2.837 6.199 0 3.178-1.224 5.682-3.672 7.51-2.447 1.827-5.864 2.74-10.25 2.74zm31.183-5.34c.731 0 1.494-.048 2.289-.143l-.382 5.244c-.922.128-1.844.191-2.765.191-3.56 0-6.159-.779-7.796-2.336-1.637-1.558-2.456-3.926-2.456-7.104v-8.964h-4.434v-5.388h4.434v-6.866h7.2v6.866h5.865v5.388h-5.865v8.916c0 2.797 1.303 4.196 3.91 4.196zm16.736 5.292c-2.48 0-4.657-.5-6.533-1.502-1.875-1.001-3.321-2.416-4.338-4.243-1.018-1.828-1.526-3.982-1.526-6.46 0-2.48.508-4.634 1.526-6.462 1.017-1.827 2.463-3.234 4.338-4.22 1.876-.985 4.053-1.477 6.533-1.477 2.479 0 4.656.492 6.532 1.478 1.875.985 3.321 2.392 4.339 4.22 1.017 1.827 1.525 3.98 1.525 6.46s-.508 4.633-1.525 6.46c-1.018 1.828-2.464 3.243-4.34 4.244-1.875 1.002-4.052 1.502-6.531 1.502zm0-5.483c3.496 0 5.244-2.24 5.244-6.723 0-2.257-.453-3.941-1.358-5.054-.906-1.113-2.202-1.669-3.886-1.669-3.497 0-5.245 2.241-5.245 6.723 0 4.482 1.748 6.723 5.245 6.723zm32.327-12.969l-4.053.43c-2.003.19-3.417.754-4.244 1.692-.826.938-1.24 2.185-1.24 3.743v12.206h-7.199V23.338h6.914v3.957c1.176-2.702 3.607-4.18 7.295-4.434l2.098-.143.429 5.96zm20.92-5.292h7.056L174.496 55.33H167.2l4.481-9.87-9.63-22.075h7.485l5.912 14.876 6.103-14.876zm23.744-.62c2.034 0 3.83.492 5.388 1.478 1.557.985 2.773 2.392 3.647 4.22.874 1.827 1.311 3.949 1.311 6.365 0 2.416-.437 4.553-1.31 6.413-.875 1.86-2.099 3.306-3.672 4.339-1.574 1.033-3.362 1.55-5.364 1.55-1.621 0-3.083-.343-4.387-1.026-1.303-.683-2.304-1.629-3.004-2.837v3.48h-7.104V13.135h7.2v13.35c.7-1.175 1.692-2.09 2.98-2.74 1.287-.652 2.726-.978 4.315-.978zm-2.098 18.881c1.685 0 2.988-.596 3.91-1.788.922-1.192 1.382-2.869 1.382-5.03 0-2.13-.46-3.759-1.382-4.887-.922-1.129-2.225-1.693-3.91-1.693s-2.988.58-3.91 1.74c-.922 1.16-1.383 2.805-1.383 4.935 0 2.162.461 3.822 1.383 4.983.922 1.16 2.225 1.74 3.91 1.74zm28.083 5.483c-2.479 0-4.656-.5-6.532-1.502-1.875-1.001-3.321-2.416-4.339-4.243-1.017-1.828-1.525-3.982-1.525-6.46 0-2.48.508-4.634 1.525-6.462 1.018-1.827 2.464-3.234 4.34-4.22 1.875-.985 4.052-1.477 6.531-1.477 2.48 0 4.657.492 6.533 1.478 1.875.985 3.321 2.392 4.339 4.22 1.017 1.827 1.525 3.98 1.525 6.46s-.508 4.633-1.525 6.46c-1.018 1.828-2.464 3.243-4.34 4.244-1.875 1.002-4.052 1.502-6.532 1.502zm0-5.483c3.497 0 5.245-2.24 5.245-6.723 0-2.257-.453-3.941-1.359-5.054-.906-1.113-2.2-1.669-3.886-1.669-3.496 0-5.244 2.241-5.244 6.723 0 4.482 1.748 6.723 5.244 6.723zm26.844 5.483c-2.48 0-4.656-.5-6.532-1.502-1.875-1.001-3.322-2.416-4.339-4.243-1.017-1.828-1.525-3.982-1.525-6.46 0-2.48.508-4.634 1.525-6.462 1.017-1.827 2.464-3.234 4.34-4.22 1.875-.985 4.052-1.477 6.531-1.477 2.48 0 4.657.492 6.532 1.478 1.876.985 3.322 2.392 4.34 4.22 1.017 1.827 1.525 3.98 1.525 6.46s-.508 4.633-1.526 6.46c-1.017 1.828-2.463 3.243-4.339 4.244-1.875 1.002-4.052 1.502-6.532 1.502zm0-5.483c3.497 0 5.245-2.24 5.245-6.723 0-2.257-.453-3.941-1.359-5.054-.906-1.113-2.201-1.669-3.886-1.669-3.496 0-5.244 2.241-5.244 6.723 0 4.482 1.748 6.723 5.244 6.723zM299 46.749h-8.82l-8.965-10.442v10.442h-7.2V13.134h7.2v20.217l8.63-9.965h8.583l-9.822 11.157L299 46.749z"
|
|
4809
4868
|
}
|
|
4810
4869
|
),
|
|
4811
|
-
/* @__PURE__ */ (0,
|
|
4870
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4812
4871
|
import_react_native_svg10.Path,
|
|
4813
4872
|
{
|
|
4814
4873
|
d: "M48.831 2.81c.004.062.006.124.006.187v53.606a2.997 2.997 0 01-3.13 2.994l-40-1.796a2.997 2.997 0 01-2.86-2.882L1.002 5.724A2.997 2.997 0 013.81 2.621L36.609.57l-.285 6.756a.447.447 0 00.05.223l.04.066c.15.196.43.235.627.085l2.623-1.99 2.217 1.746a.447.447 0 00.723-.367L42.356.211l3.298-.205A2.997 2.997 0 0148.83 2.81z",
|
|
@@ -4816,9 +4875,9 @@ function DarkLogo({ width = 300, height = 60, ...props }) {
|
|
|
4816
4875
|
fillRule: "nonzero"
|
|
4817
4876
|
}
|
|
4818
4877
|
),
|
|
4819
|
-
/* @__PURE__ */ (0,
|
|
4820
|
-
/* @__PURE__ */ (0,
|
|
4821
|
-
/* @__PURE__ */ (0,
|
|
4878
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native_svg10.G, { transform: "translate(1)", children: [
|
|
4879
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native_svg10.Mask, { id: "b", fill: "#fff", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native_svg10.Use, { xlinkHref: "#a" }) }),
|
|
4880
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4822
4881
|
import_react_native_svg10.Path,
|
|
4823
4882
|
{
|
|
4824
4883
|
fill: "#FFF",
|
|
@@ -4828,9 +4887,9 @@ function DarkLogo({ width = 300, height = 60, ...props }) {
|
|
|
4828
4887
|
}
|
|
4829
4888
|
)
|
|
4830
4889
|
] }),
|
|
4831
|
-
/* @__PURE__ */ (0,
|
|
4832
|
-
/* @__PURE__ */ (0,
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
4890
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native_svg10.G, { transform: "translate(1)", children: [
|
|
4891
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native_svg10.Mask, { id: "d", fill: "#fff", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native_svg10.Use, { xlinkHref: "#c" }) }),
|
|
4892
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4834
4893
|
import_react_native_svg10.Path,
|
|
4835
4894
|
{
|
|
4836
4895
|
fill: "#FFF",
|
|
@@ -4846,18 +4905,18 @@ function DarkLogo({ width = 300, height = 60, ...props }) {
|
|
|
4846
4905
|
|
|
4847
4906
|
// src/icon/Logo.tsx
|
|
4848
4907
|
var import_react_native_svg11 = __toESM(require("react-native-svg"));
|
|
4849
|
-
var
|
|
4908
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
4850
4909
|
function Logo({ width = 300, height = 60, ...props }) {
|
|
4851
|
-
return /* @__PURE__ */ (0,
|
|
4852
|
-
/* @__PURE__ */ (0,
|
|
4853
|
-
/* @__PURE__ */ (0,
|
|
4910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_native_svg11.default, { width, height, viewBox: "0 0 300 60", ...props, children: [
|
|
4911
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_native_svg11.Defs, { children: [
|
|
4912
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4854
4913
|
import_react_native_svg11.Path,
|
|
4855
4914
|
{
|
|
4856
4915
|
id: "a",
|
|
4857
4916
|
d: "M1.848 54.92L.002 5.723A2.997 2.997 0 012.81 2.621L44.654.006a2.997 2.997 0 013.183 2.99v53.607a2.997 2.997 0 01-3.13 2.994l-40-1.796a2.997 2.997 0 01-2.86-2.882z"
|
|
4858
4917
|
}
|
|
4859
4918
|
),
|
|
4860
|
-
/* @__PURE__ */ (0,
|
|
4919
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4861
4920
|
import_react_native_svg11.Path,
|
|
4862
4921
|
{
|
|
4863
4922
|
id: "c",
|
|
@@ -4865,8 +4924,8 @@ function Logo({ width = 300, height = 60, ...props }) {
|
|
|
4865
4924
|
}
|
|
4866
4925
|
)
|
|
4867
4926
|
] }),
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
4869
|
-
/* @__PURE__ */ (0,
|
|
4927
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_native_svg11.G, { fill: "none", fillRule: "evenodd", children: [
|
|
4928
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4870
4929
|
import_react_native_svg11.Path,
|
|
4871
4930
|
{
|
|
4872
4931
|
fill: "#333",
|
|
@@ -4874,7 +4933,7 @@ function Logo({ width = 300, height = 60, ...props }) {
|
|
|
4874
4933
|
d: "M80.387 47.178c-2.543 0-4.99-.342-7.343-1.025-2.352-.684-4.307-1.63-5.864-2.837l2.384-5.293c3.242 2.257 6.882 3.386 10.919 3.386 2.097 0 3.71-.342 4.84-1.026 1.128-.683 1.692-1.629 1.692-2.836 0-1.081-.517-1.924-1.55-2.528-1.033-.603-2.869-1.192-5.507-1.764-2.956-.604-5.316-1.335-7.08-2.193-1.765-.858-3.052-1.915-3.862-3.17-.811-1.256-1.216-2.806-1.216-4.65 0-2.034.564-3.846 1.692-5.435 1.129-1.59 2.71-2.837 4.744-3.743 2.035-.906 4.387-1.359 7.057-1.359 2.384 0 4.68.35 6.89 1.05 2.21.699 3.965 1.636 5.269 2.812l-2.384 5.293c-3.084-2.257-6.326-3.385-9.727-3.385-1.94 0-3.465.373-4.577 1.12-1.113.747-1.67 1.772-1.67 3.075 0 .763.215 1.391.644 1.884.43.492 1.145.93 2.146 1.31 1.001.382 2.424.78 4.267 1.193 4.323.954 7.43 2.177 9.322 3.671 1.891 1.494 2.837 3.56 2.837 6.199 0 3.178-1.224 5.682-3.672 7.51-2.447 1.827-5.864 2.74-10.25 2.74zm31.183-5.34c.731 0 1.494-.048 2.289-.143l-.382 5.244c-.922.128-1.844.191-2.765.191-3.56 0-6.159-.779-7.796-2.336-1.637-1.558-2.456-3.926-2.456-7.104v-8.964h-4.434v-5.388h4.434v-6.866h7.2v6.866h5.865v5.388h-5.865v8.916c0 2.797 1.303 4.196 3.91 4.196zm16.736 5.292c-2.48 0-4.657-.5-6.533-1.502-1.875-1.001-3.321-2.416-4.338-4.243-1.018-1.828-1.526-3.982-1.526-6.46 0-2.48.508-4.634 1.526-6.462 1.017-1.827 2.463-3.234 4.338-4.22 1.876-.985 4.053-1.477 6.533-1.477 2.479 0 4.656.492 6.532 1.478 1.875.985 3.321 2.392 4.339 4.22 1.017 1.827 1.525 3.98 1.525 6.46s-.508 4.633-1.525 6.46c-1.018 1.828-2.464 3.243-4.34 4.244-1.875 1.002-4.052 1.502-6.531 1.502zm0-5.483c3.496 0 5.244-2.24 5.244-6.723 0-2.257-.453-3.941-1.358-5.054-.906-1.113-2.202-1.669-3.886-1.669-3.497 0-5.245 2.241-5.245 6.723 0 4.482 1.748 6.723 5.245 6.723zm32.327-12.969l-4.053.43c-2.003.19-3.417.754-4.244 1.692-.826.938-1.24 2.185-1.24 3.743v12.206h-7.199V23.338h6.914v3.957c1.176-2.702 3.607-4.18 7.295-4.434l2.098-.143.429 5.96zm20.92-5.292h7.056L174.496 55.33H167.2l4.481-9.87-9.63-22.075h7.485l5.912 14.876 6.103-14.876zm23.744-.62c2.034 0 3.83.492 5.388 1.478 1.557.985 2.773 2.392 3.647 4.22.874 1.827 1.311 3.949 1.311 6.365 0 2.416-.437 4.553-1.31 6.413-.875 1.86-2.099 3.306-3.672 4.339-1.574 1.033-3.362 1.55-5.364 1.55-1.621 0-3.083-.343-4.387-1.026-1.303-.683-2.304-1.629-3.004-2.837v3.48h-7.104V13.135h7.2v13.35c.7-1.175 1.692-2.09 2.98-2.74 1.287-.652 2.726-.978 4.315-.978zm-2.098 18.881c1.685 0 2.988-.596 3.91-1.788.922-1.192 1.382-2.869 1.382-5.03 0-2.13-.46-3.759-1.382-4.887-.922-1.129-2.225-1.693-3.91-1.693s-2.988.58-3.91 1.74c-.922 1.16-1.383 2.805-1.383 4.935 0 2.162.461 3.822 1.383 4.983.922 1.16 2.225 1.74 3.91 1.74zm28.083 5.483c-2.479 0-4.656-.5-6.532-1.502-1.875-1.001-3.321-2.416-4.339-4.243-1.017-1.828-1.525-3.982-1.525-6.46 0-2.48.508-4.634 1.525-6.462 1.018-1.827 2.464-3.234 4.34-4.22 1.875-.985 4.052-1.477 6.531-1.477 2.48 0 4.657.492 6.533 1.478 1.875.985 3.321 2.392 4.339 4.22 1.017 1.827 1.525 3.98 1.525 6.46s-.508 4.633-1.525 6.46c-1.018 1.828-2.464 3.243-4.34 4.244-1.875 1.002-4.052 1.502-6.532 1.502zm0-5.483c3.497 0 5.245-2.24 5.245-6.723 0-2.257-.453-3.941-1.359-5.054-.906-1.113-2.2-1.669-3.886-1.669-3.496 0-5.244 2.241-5.244 6.723 0 4.482 1.748 6.723 5.244 6.723zm26.844 5.483c-2.48 0-4.656-.5-6.532-1.502-1.875-1.001-3.322-2.416-4.339-4.243-1.017-1.828-1.525-3.982-1.525-6.46 0-2.48.508-4.634 1.525-6.462 1.017-1.827 2.464-3.234 4.34-4.22 1.875-.985 4.052-1.477 6.531-1.477 2.48 0 4.657.492 6.532 1.478 1.876.985 3.322 2.392 4.34 4.22 1.017 1.827 1.525 3.98 1.525 6.46s-.508 4.633-1.526 6.46c-1.017 1.828-2.463 3.243-4.339 4.244-1.875 1.002-4.052 1.502-6.532 1.502zm0-5.483c3.497 0 5.245-2.24 5.245-6.723 0-2.257-.453-3.941-1.359-5.054-.906-1.113-2.201-1.669-3.886-1.669-3.496 0-5.244 2.241-5.244 6.723 0 4.482 1.748 6.723 5.244 6.723zM299 46.749h-8.82l-8.965-10.442v10.442h-7.2V13.134h7.2v20.217l8.63-9.965h8.583l-9.822 11.157L299 46.749z"
|
|
4875
4934
|
}
|
|
4876
4935
|
),
|
|
4877
|
-
/* @__PURE__ */ (0,
|
|
4936
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4878
4937
|
import_react_native_svg11.Path,
|
|
4879
4938
|
{
|
|
4880
4939
|
d: "M48.831 2.81c.004.062.006.124.006.187v53.606a2.997 2.997 0 01-3.13 2.994l-40-1.796a2.997 2.997 0 01-2.86-2.882L1.002 5.724A2.997 2.997 0 013.81 2.621L36.609.57l-.285 6.756a.447.447 0 00.05.223l.04.066c.15.196.43.235.627.085l2.623-1.99 2.217 1.746a.447.447 0 00.723-.367L42.356.211l3.298-.205A2.997 2.997 0 0148.83 2.81z",
|
|
@@ -4882,9 +4941,9 @@ function Logo({ width = 300, height = 60, ...props }) {
|
|
|
4882
4941
|
fillRule: "nonzero"
|
|
4883
4942
|
}
|
|
4884
4943
|
),
|
|
4885
|
-
/* @__PURE__ */ (0,
|
|
4886
|
-
/* @__PURE__ */ (0,
|
|
4887
|
-
/* @__PURE__ */ (0,
|
|
4944
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_native_svg11.G, { transform: "translate(1)", children: [
|
|
4945
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native_svg11.Mask, { id: "b", fill: "#fff", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native_svg11.Use, { xlinkHref: "#a" }) }),
|
|
4946
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4888
4947
|
import_react_native_svg11.Path,
|
|
4889
4948
|
{
|
|
4890
4949
|
fill: "#FFF",
|
|
@@ -4894,9 +4953,9 @@ function Logo({ width = 300, height = 60, ...props }) {
|
|
|
4894
4953
|
}
|
|
4895
4954
|
)
|
|
4896
4955
|
] }),
|
|
4897
|
-
/* @__PURE__ */ (0,
|
|
4898
|
-
/* @__PURE__ */ (0,
|
|
4899
|
-
/* @__PURE__ */ (0,
|
|
4956
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_native_svg11.G, { transform: "translate(1)", children: [
|
|
4957
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native_svg11.Mask, { id: "d", fill: "#fff", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native_svg11.Use, { xlinkHref: "#c" }) }),
|
|
4958
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4900
4959
|
import_react_native_svg11.Path,
|
|
4901
4960
|
{
|
|
4902
4961
|
fill: "#FFF",
|
|
@@ -4911,16 +4970,16 @@ function Logo({ width = 300, height = 60, ...props }) {
|
|
|
4911
4970
|
}
|
|
4912
4971
|
|
|
4913
4972
|
// src/StorybookLogo.tsx
|
|
4914
|
-
var
|
|
4973
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4915
4974
|
var WIDTH = 125;
|
|
4916
4975
|
var HEIGHT = 25;
|
|
4917
|
-
var NoBrandLogo = ({ theme }) => theme.base === "light" ? /* @__PURE__ */ (0,
|
|
4976
|
+
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 });
|
|
4918
4977
|
function isElement(value) {
|
|
4919
|
-
return (0,
|
|
4978
|
+
return (0, import_react23.isValidElement)(value);
|
|
4920
4979
|
}
|
|
4921
4980
|
var BrandLogo = ({ theme }) => {
|
|
4922
4981
|
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));
|
|
4923
|
-
(0,
|
|
4982
|
+
(0, import_react23.useEffect)(() => {
|
|
4924
4983
|
if (imageHasNoWidthOrHeight) {
|
|
4925
4984
|
console.warn(
|
|
4926
4985
|
"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}}"
|
|
@@ -4933,7 +4992,7 @@ var BrandLogo = ({ theme }) => {
|
|
|
4933
4992
|
if (isElement(theme.brand.image)) {
|
|
4934
4993
|
return theme.brand.image;
|
|
4935
4994
|
}
|
|
4936
|
-
const image = /* @__PURE__ */ (0,
|
|
4995
|
+
const image = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4937
4996
|
import_react_native8.Image,
|
|
4938
4997
|
{
|
|
4939
4998
|
source: theme.brand.image,
|
|
@@ -4942,7 +5001,7 @@ var BrandLogo = ({ theme }) => {
|
|
|
4942
5001
|
}
|
|
4943
5002
|
);
|
|
4944
5003
|
if (theme.brand.url) {
|
|
4945
|
-
return /* @__PURE__ */ (0,
|
|
5004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4946
5005
|
import_react_native8.TouchableOpacity,
|
|
4947
5006
|
{
|
|
4948
5007
|
onPress: () => {
|
|
@@ -4957,7 +5016,7 @@ var BrandLogo = ({ theme }) => {
|
|
|
4957
5016
|
}
|
|
4958
5017
|
};
|
|
4959
5018
|
var BrandTitle = ({ theme }) => {
|
|
4960
|
-
const brandTitleStyle = (0,
|
|
5019
|
+
const brandTitleStyle = (0, import_react23.useMemo)(() => {
|
|
4961
5020
|
return {
|
|
4962
5021
|
width: WIDTH,
|
|
4963
5022
|
height: HEIGHT,
|
|
@@ -4965,9 +5024,9 @@ var BrandTitle = ({ theme }) => {
|
|
|
4965
5024
|
fontSize: theme.typography.size.m1
|
|
4966
5025
|
};
|
|
4967
5026
|
}, [theme]);
|
|
4968
|
-
const title = /* @__PURE__ */ (0,
|
|
5027
|
+
const title = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_native8.Text, { style: brandTitleStyle, numberOfLines: 1, ellipsizeMode: "tail", children: theme.brand.title });
|
|
4969
5028
|
if (theme.brand.url) {
|
|
4970
|
-
return /* @__PURE__ */ (0,
|
|
5029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4971
5030
|
import_react_native8.TouchableOpacity,
|
|
4972
5031
|
{
|
|
4973
5032
|
onPress: () => {
|
|
@@ -4982,24 +5041,24 @@ var BrandTitle = ({ theme }) => {
|
|
|
4982
5041
|
}
|
|
4983
5042
|
};
|
|
4984
5043
|
var StorybookLogo = ({ theme }) => {
|
|
4985
|
-
const image = (0,
|
|
4986
|
-
const title = (0,
|
|
5044
|
+
const image = (0, import_react23.useMemo)(() => theme.brand?.image, [theme.brand?.image]);
|
|
5045
|
+
const title = (0, import_react23.useMemo)(() => theme.brand?.title, [theme.brand?.title]);
|
|
4987
5046
|
if (image) {
|
|
4988
|
-
return /* @__PURE__ */ (0,
|
|
5047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BrandLogo, { theme });
|
|
4989
5048
|
} else if (title) {
|
|
4990
|
-
return /* @__PURE__ */ (0,
|
|
5049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(BrandTitle, { theme });
|
|
4991
5050
|
} else {
|
|
4992
|
-
return /* @__PURE__ */ (0,
|
|
5051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(NoBrandLogo, { theme });
|
|
4993
5052
|
}
|
|
4994
5053
|
};
|
|
4995
5054
|
|
|
4996
5055
|
// src/hooks/useStoreState.ts
|
|
4997
|
-
var
|
|
5056
|
+
var import_react25 = require("react");
|
|
4998
5057
|
|
|
4999
5058
|
// src/StorageProvider.tsx
|
|
5000
|
-
var
|
|
5001
|
-
var
|
|
5002
|
-
var StorageContext = (0,
|
|
5059
|
+
var import_react24 = require("react");
|
|
5060
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
5061
|
+
var StorageContext = (0, import_react24.createContext)({
|
|
5003
5062
|
getItem: async () => null,
|
|
5004
5063
|
setItem: async () => {
|
|
5005
5064
|
}
|
|
@@ -5008,15 +5067,15 @@ var StorageProvider = ({
|
|
|
5008
5067
|
storage,
|
|
5009
5068
|
children
|
|
5010
5069
|
}) => {
|
|
5011
|
-
return /* @__PURE__ */ (0,
|
|
5070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(StorageContext.Provider, { value: storage, children });
|
|
5012
5071
|
};
|
|
5013
|
-
var useStorage = () => (0,
|
|
5072
|
+
var useStorage = () => (0, import_react24.useContext)(StorageContext);
|
|
5014
5073
|
|
|
5015
5074
|
// src/hooks/useStoreState.ts
|
|
5016
5075
|
var useStoreBooleanState = (key, defaultValue) => {
|
|
5017
5076
|
const storage = useStorage();
|
|
5018
|
-
const [val, setVal] = (0,
|
|
5019
|
-
(0,
|
|
5077
|
+
const [val, setVal] = (0, import_react25.useState)(defaultValue);
|
|
5078
|
+
(0, import_react25.useEffect)(() => {
|
|
5020
5079
|
storage.getItem(key).then((newVal) => {
|
|
5021
5080
|
if (newVal === null || newVal === void 0) {
|
|
5022
5081
|
setVal(defaultValue);
|
|
@@ -5025,7 +5084,7 @@ var useStoreBooleanState = (key, defaultValue) => {
|
|
|
5025
5084
|
}
|
|
5026
5085
|
});
|
|
5027
5086
|
}, [key, storage, defaultValue]);
|
|
5028
|
-
(0,
|
|
5087
|
+
(0, import_react25.useEffect)(() => {
|
|
5029
5088
|
storage.setItem(key, val.toString());
|
|
5030
5089
|
}, [key, storage, val]);
|
|
5031
5090
|
return [val, setVal];
|
|
@@ -5033,22 +5092,22 @@ var useStoreBooleanState = (key, defaultValue) => {
|
|
|
5033
5092
|
|
|
5034
5093
|
// src/icon/BottomBarToggleIcon.tsx
|
|
5035
5094
|
var import_react_native_svg12 = require("react-native-svg");
|
|
5036
|
-
var
|
|
5095
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5037
5096
|
var BottomBarToggleIcon = ({
|
|
5038
5097
|
color = "currentColor",
|
|
5039
5098
|
width = 14,
|
|
5040
5099
|
height = 14,
|
|
5041
5100
|
...props
|
|
5042
5101
|
}) => {
|
|
5043
|
-
return /* @__PURE__ */ (0,
|
|
5044
|
-
/* @__PURE__ */ (0,
|
|
5102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_react_native_svg12.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: [
|
|
5103
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5045
5104
|
import_react_native_svg12.Path,
|
|
5046
5105
|
{
|
|
5047
5106
|
d: "M3.5 10.004a.5.5 0 000 1h1a.5.5 0 000-1h-1zM6 10.504a.5.5 0 01.5-.5h1a.5.5 0 010 1h-1a.5.5 0 01-.5-.5zM9.5 10.004a.5.5 0 000 1h1a.5.5 0 000-1h-1z",
|
|
5048
5107
|
fill: color
|
|
5049
5108
|
}
|
|
5050
5109
|
),
|
|
5051
|
-
/* @__PURE__ */ (0,
|
|
5110
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5052
5111
|
import_react_native_svg12.Path,
|
|
5053
5112
|
{
|
|
5054
5113
|
fillRule: "evenodd",
|
|
@@ -5061,29 +5120,29 @@ var BottomBarToggleIcon = ({
|
|
|
5061
5120
|
};
|
|
5062
5121
|
|
|
5063
5122
|
// src/icon/CloseFullscreenIcon.tsx
|
|
5064
|
-
var
|
|
5123
|
+
var import_react26 = require("react");
|
|
5065
5124
|
var import_react_native_svg13 = __toESM(require("react-native-svg"));
|
|
5066
5125
|
var import_react_native_theming15 = require("@storybook/react-native-theming");
|
|
5067
|
-
var
|
|
5126
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
5068
5127
|
function CloseFullscreenIcon({ color, width = 14, height = 14, ...props }) {
|
|
5069
5128
|
const theme = (0, import_react_native_theming15.useTheme)();
|
|
5070
|
-
const fillColor = (0,
|
|
5129
|
+
const fillColor = (0, import_react26.useMemo)(() => {
|
|
5071
5130
|
return color ?? theme.color.defaultText;
|
|
5072
5131
|
}, [color, theme.color.defaultText]);
|
|
5073
|
-
return /* @__PURE__ */ (0,
|
|
5132
|
+
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" }) });
|
|
5074
5133
|
}
|
|
5075
5134
|
|
|
5076
5135
|
// src/icon/FullscreenIcon.tsx
|
|
5077
5136
|
var import_react_native_svg14 = __toESM(require("react-native-svg"));
|
|
5078
5137
|
var import_react_native_theming16 = require("@storybook/react-native-theming");
|
|
5079
|
-
var
|
|
5080
|
-
var
|
|
5138
|
+
var import_react27 = require("react");
|
|
5139
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
5081
5140
|
function FullscreenIcon({ color, width = 14, height = 14, ...props }) {
|
|
5082
5141
|
const theme = (0, import_react_native_theming16.useTheme)();
|
|
5083
|
-
const fillColor = (0,
|
|
5142
|
+
const fillColor = (0, import_react27.useMemo)(() => {
|
|
5084
5143
|
return color ?? theme.color.defaultText;
|
|
5085
5144
|
}, [color, theme.color.defaultText]);
|
|
5086
|
-
return /* @__PURE__ */ (0,
|
|
5145
|
+
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)(
|
|
5087
5146
|
import_react_native_svg14.Path,
|
|
5088
5147
|
{
|
|
5089
5148
|
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",
|
|
@@ -5094,14 +5153,14 @@ function FullscreenIcon({ color, width = 14, height = 14, ...props }) {
|
|
|
5094
5153
|
|
|
5095
5154
|
// src/icon/MenuIcon.tsx
|
|
5096
5155
|
var import_react_native_svg15 = require("react-native-svg");
|
|
5097
|
-
var
|
|
5156
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
5098
5157
|
var MenuIcon = ({
|
|
5099
5158
|
color = "currentColor",
|
|
5100
5159
|
width = 14,
|
|
5101
5160
|
height = 14,
|
|
5102
5161
|
...props
|
|
5103
5162
|
}) => {
|
|
5104
|
-
return /* @__PURE__ */ (0,
|
|
5163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native_svg15.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5105
5164
|
import_react_native_svg15.Path,
|
|
5106
5165
|
{
|
|
5107
5166
|
d: "M13 3.5a.5.5 0 010 1H1a.5.5 0 010-1h12zM13.5 10a.5.5 0 00-.5-.5H1a.5.5 0 000 1h12a.5.5 0 00.5-.5zM13 6.5a.5.5 0 010 1H1a.5.5 0 010-1h12z",
|
|
@@ -5111,7 +5170,7 @@ var MenuIcon = ({
|
|
|
5111
5170
|
};
|
|
5112
5171
|
|
|
5113
5172
|
// src/Layout.tsx
|
|
5114
|
-
var
|
|
5173
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
5115
5174
|
var desktopLogoContainer = {
|
|
5116
5175
|
flexDirection: "row",
|
|
5117
5176
|
alignItems: "center",
|
|
@@ -5139,8 +5198,8 @@ var Layout = ({
|
|
|
5139
5198
|
children
|
|
5140
5199
|
}) => {
|
|
5141
5200
|
const theme = (0, import_react_native_theming17.useTheme)();
|
|
5142
|
-
const mobileMenuDrawerRef = (0,
|
|
5143
|
-
const addonPanelRef = (0,
|
|
5201
|
+
const mobileMenuDrawerRef = (0, import_react28.useRef)(null);
|
|
5202
|
+
const addonPanelRef = (0, import_react28.useRef)(null);
|
|
5144
5203
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
5145
5204
|
const { isDesktop } = useLayout();
|
|
5146
5205
|
const [desktopSidebarOpen, setDesktopSidebarOpen] = useStoreBooleanState(
|
|
@@ -5151,7 +5210,7 @@ var Layout = ({
|
|
|
5151
5210
|
"desktopPanelState",
|
|
5152
5211
|
true
|
|
5153
5212
|
);
|
|
5154
|
-
const [uiHidden, setUiHidden] = (0,
|
|
5213
|
+
const [uiHidden, setUiHidden] = (0, import_react28.useState)(false);
|
|
5155
5214
|
const desktopSidebarStyle = useStyle(
|
|
5156
5215
|
() => ({
|
|
5157
5216
|
width: desktopSidebarOpen ? 240 : void 0,
|
|
@@ -5218,25 +5277,25 @@ var Layout = ({
|
|
|
5218
5277
|
}),
|
|
5219
5278
|
[theme.color.defaultText]
|
|
5220
5279
|
);
|
|
5221
|
-
const openMobileMenu = (0,
|
|
5280
|
+
const openMobileMenu = (0, import_react28.useCallback)(() => {
|
|
5222
5281
|
mobileMenuDrawerRef.current.setMobileMenuOpen(true);
|
|
5223
5282
|
}, [mobileMenuDrawerRef]);
|
|
5224
|
-
const setSelection = (0,
|
|
5283
|
+
const setSelection = (0, import_react28.useCallback)(({ storyId: newStoryId }) => {
|
|
5225
5284
|
const channel = import_manager_api2.addons.getChannel();
|
|
5226
5285
|
channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
|
|
5227
5286
|
}, []);
|
|
5228
|
-
return /* @__PURE__ */ (0,
|
|
5229
|
-
isDesktop ? /* @__PURE__ */ (0,
|
|
5287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native9.View, { style: containerStyle, children: [
|
|
5288
|
+
isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native9.View, { style: desktopSidebarStyle, children: desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5230
5289
|
import_react_native9.ScrollView,
|
|
5231
5290
|
{
|
|
5232
5291
|
keyboardShouldPersistTaps: "handled",
|
|
5233
5292
|
contentContainerStyle: desktopScrollViewContentContainerStyle,
|
|
5234
5293
|
children: [
|
|
5235
|
-
/* @__PURE__ */ (0,
|
|
5236
|
-
/* @__PURE__ */ (0,
|
|
5237
|
-
/* @__PURE__ */ (0,
|
|
5294
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native9.View, { style: desktopLogoContainer, children: [
|
|
5295
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StorybookLogo, { theme }),
|
|
5296
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(false), Icon: MenuIcon })
|
|
5238
5297
|
] }),
|
|
5239
|
-
/* @__PURE__ */ (0,
|
|
5298
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5240
5299
|
Sidebar,
|
|
5241
5300
|
{
|
|
5242
5301
|
extra: placeholderArray,
|
|
@@ -5252,18 +5311,18 @@ var Layout = ({
|
|
|
5252
5311
|
)
|
|
5253
5312
|
]
|
|
5254
5313
|
}
|
|
5255
|
-
) : /* @__PURE__ */ (0,
|
|
5256
|
-
/* @__PURE__ */ (0,
|
|
5257
|
-
/* @__PURE__ */ (0,
|
|
5258
|
-
story?.parameters?.hideFullScreenButton || isDesktop ? null : /* @__PURE__ */ (0,
|
|
5314
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(true), Icon: MenuIcon }) }) : null,
|
|
5315
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native9.View, { style: mobileContentStyle, children: [
|
|
5316
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native9.View, { style: contentContainerStyle, children }),
|
|
5317
|
+
story?.parameters?.hideFullScreenButton || isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5259
5318
|
import_react_native9.TouchableOpacity,
|
|
5260
5319
|
{
|
|
5261
5320
|
style: fullScreenButtonStyle,
|
|
5262
5321
|
onPress: () => setUiHidden((prev) => !prev),
|
|
5263
|
-
children: uiHidden ? /* @__PURE__ */ (0,
|
|
5322
|
+
children: uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CloseFullscreenIcon, { color: theme.color.mediumdark }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FullscreenIcon, { color: theme.color.mediumdark })
|
|
5264
5323
|
}
|
|
5265
5324
|
),
|
|
5266
|
-
isDesktop ? /* @__PURE__ */ (0,
|
|
5325
|
+
isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native9.View, { style: desktopAddonsPanelStyle, children: desktopAddonsPanelOpen ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(AddonsTabs, { storyId: story?.id, onClose: () => setDesktopAddonsPanelOpen(false) }) : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5267
5326
|
IconButton,
|
|
5268
5327
|
{
|
|
5269
5328
|
style: iconFloatRightStyle,
|
|
@@ -5272,8 +5331,8 @@ var Layout = ({
|
|
|
5272
5331
|
}
|
|
5273
5332
|
) }) : null
|
|
5274
5333
|
] }),
|
|
5275
|
-
!uiHidden && !isDesktop ? /* @__PURE__ */ (0,
|
|
5276
|
-
/* @__PURE__ */ (0,
|
|
5334
|
+
!uiHidden && !isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Container3, { style: menuContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Nav, { children: [
|
|
5335
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
5277
5336
|
Button2,
|
|
5278
5337
|
{
|
|
5279
5338
|
testID: "mobile-menu-button",
|
|
@@ -5281,8 +5340,8 @@ var Layout = ({
|
|
|
5281
5340
|
hitSlop: navButtonHitSlop,
|
|
5282
5341
|
onPress: openMobileMenu,
|
|
5283
5342
|
children: [
|
|
5284
|
-
/* @__PURE__ */ (0,
|
|
5285
|
-
/* @__PURE__ */ (0,
|
|
5343
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(MenuIcon, { color: theme.color.mediumdark }),
|
|
5344
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react_native9.Text, { style: navButtonTextStyle, numberOfLines: 1, children: [
|
|
5286
5345
|
story?.title,
|
|
5287
5346
|
"/",
|
|
5288
5347
|
story?.name
|
|
@@ -5290,7 +5349,7 @@ var Layout = ({
|
|
|
5290
5349
|
]
|
|
5291
5350
|
}
|
|
5292
5351
|
),
|
|
5293
|
-
/* @__PURE__ */ (0,
|
|
5352
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5294
5353
|
IconButton,
|
|
5295
5354
|
{
|
|
5296
5355
|
testID: "mobile-addons-button",
|
|
@@ -5299,9 +5358,9 @@ var Layout = ({
|
|
|
5299
5358
|
}
|
|
5300
5359
|
)
|
|
5301
5360
|
] }) }) : null,
|
|
5302
|
-
isDesktop ? null : /* @__PURE__ */ (0,
|
|
5303
|
-
/* @__PURE__ */ (0,
|
|
5304
|
-
/* @__PURE__ */ (0,
|
|
5361
|
+
isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SelectedNodeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
|
|
5362
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_react_native9.View, { style: mobileMenuDrawerContentStyle, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(StorybookLogo, { theme }) }),
|
|
5363
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
5305
5364
|
Sidebar,
|
|
5306
5365
|
{
|
|
5307
5366
|
extra: placeholderArray,
|
|
@@ -5315,8 +5374,8 @@ var Layout = ({
|
|
|
5315
5374
|
refId: DEFAULT_REF_ID
|
|
5316
5375
|
}
|
|
5317
5376
|
)
|
|
5318
|
-
] }),
|
|
5319
|
-
isDesktop ? null : /* @__PURE__ */ (0,
|
|
5377
|
+
] }) }),
|
|
5378
|
+
isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
|
|
5320
5379
|
] });
|
|
5321
5380
|
};
|
|
5322
5381
|
var Nav = import_react_native_theming17.styled.View({
|