@storybook/react-native-ui 8.2.0-alpha.1 → 8.3.0-alpha.0
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 +7 -7
- package/dist/index.js +252 -233
- package/package.json +5 -5
- package/src/Button.tsx +2 -2
- package/src/Layout.tsx +2 -2
- package/src/MobileAddonsPanel.tsx +10 -7
- package/src/MobileMenuDrawer.tsx +4 -0
- package/src/SearchResults.tsx +6 -2
- package/src/Tree.tsx +11 -7
- package/src/TreeNode.tsx +1 -0
- package/src/icon/CollapseAllIcon.tsx +5 -2
- package/src/icon/CollapseIcon.tsx +1 -2
- package/src/icon/ExpandAllIcon.tsx +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _storybook_react_native_theming from '@storybook/react-native-theming';
|
|
2
2
|
import * as react_native from 'react-native';
|
|
3
|
-
import { PressableProps, View,
|
|
3
|
+
import { PressableProps, View, TouchableOpacityProps, TouchableOpacity } from 'react-native';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import React__default, { FC, ComponentProps, ReactElement, PropsWithChildren, ReactNode } from 'react';
|
|
6
6
|
import { State, StoriesHash, API } from '@storybook/core/manager-api';
|
|
@@ -43,11 +43,6 @@ declare const GroupNode: FC<ComponentProps<typeof BranchNode> & {
|
|
|
43
43
|
declare const ComponentNode: FC<ComponentProps<typeof BranchNode>>;
|
|
44
44
|
declare const StoryNode: FC<ComponentProps<typeof LeafNode>>;
|
|
45
45
|
|
|
46
|
-
interface ExpandAction {
|
|
47
|
-
ids: string[];
|
|
48
|
-
value: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
46
|
type Refs = State['refs'];
|
|
52
47
|
type RefType = Refs[keyof Refs] & {
|
|
53
48
|
status?: API_StatusState;
|
|
@@ -100,6 +95,11 @@ type SearchChildrenFn = (args: {
|
|
|
100
95
|
highlightedIndex: number | null;
|
|
101
96
|
}) => React.ReactNode;
|
|
102
97
|
|
|
98
|
+
interface ExpandAction {
|
|
99
|
+
ids: string[];
|
|
100
|
+
value: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
103
|
interface NodeProps {
|
|
104
104
|
item: Item;
|
|
105
105
|
refId: string;
|
|
@@ -132,7 +132,7 @@ declare const RootNodeText: _storybook_react_native_theming.StyledComponent<reac
|
|
|
132
132
|
theme?: _storybook_react_native_theming.Theme;
|
|
133
133
|
as?: React__default.ElementType<any, keyof React__default.JSX.IntrinsicElements>;
|
|
134
134
|
}, {}, {
|
|
135
|
-
ref?: React__default.Ref<Text>;
|
|
135
|
+
ref?: React__default.Ref<react_native.Text>;
|
|
136
136
|
}>;
|
|
137
137
|
declare const Tree: React__default.NamedExoticComponent<{
|
|
138
138
|
isBrowsing: boolean;
|
package/dist/index.js
CHANGED
|
@@ -2990,7 +2990,6 @@ function StoryIcon({ color = "#37D5D3", ...props }) {
|
|
|
2990
2990
|
|
|
2991
2991
|
// src/icon/CollapseIcon.tsx
|
|
2992
2992
|
var import_react_native_theming = require("@storybook/react-native-theming");
|
|
2993
|
-
var import_polished = require("polished");
|
|
2994
2993
|
var import_react_native_svg4 = __toESM(require("react-native-svg"));
|
|
2995
2994
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2996
2995
|
var CollapseIconWrapper = import_react_native_theming.styled.View(
|
|
@@ -3000,7 +2999,7 @@ var CollapseIconWrapper = import_react_native_theming.styled.View(
|
|
|
3000
2999
|
display: "flex",
|
|
3001
3000
|
justifyContent: "center",
|
|
3002
3001
|
alignItems: "center",
|
|
3003
|
-
color:
|
|
3002
|
+
color: theme.textMutedColor,
|
|
3004
3003
|
transform: isExpanded ? "rotateZ(90deg)" : "none",
|
|
3005
3004
|
transition: "transform .1s ease-out"
|
|
3006
3005
|
})
|
|
@@ -3018,12 +3017,13 @@ function CollapseSVG(props) {
|
|
|
3018
3017
|
|
|
3019
3018
|
// src/TreeNode.tsx
|
|
3020
3019
|
var import_react = __toESM(require("react"));
|
|
3021
|
-
var
|
|
3020
|
+
var import_polished = require("polished");
|
|
3022
3021
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
3023
3022
|
var BranchNodeText = import_react_native_theming2.styled.Text(({ theme }) => ({
|
|
3024
3023
|
textAlign: "left",
|
|
3025
3024
|
fontSize: theme.typography.size.s2,
|
|
3026
|
-
flexShrink: 1
|
|
3025
|
+
flexShrink: 1,
|
|
3026
|
+
color: theme.color.defaultText
|
|
3027
3027
|
}));
|
|
3028
3028
|
var BranchNode = import_react_native_theming2.styled.TouchableOpacity(({ depth = 0, isExpandable = false, theme }) => ({
|
|
3029
3029
|
width: "100%",
|
|
@@ -3042,7 +3042,7 @@ var BranchNode = import_react_native_theming2.styled.TouchableOpacity(({ depth =
|
|
|
3042
3042
|
paddingBottom: 4,
|
|
3043
3043
|
// will this actually do anything?
|
|
3044
3044
|
"&:hover, &:focus": {
|
|
3045
|
-
background: (0,
|
|
3045
|
+
background: (0, import_polished.transparentize)(0.93, theme.color.secondary),
|
|
3046
3046
|
outline: "none"
|
|
3047
3047
|
}
|
|
3048
3048
|
}));
|
|
@@ -3131,7 +3131,7 @@ var StoryNode = import_react.default.memo(function StoryNode2({
|
|
|
3131
3131
|
});
|
|
3132
3132
|
|
|
3133
3133
|
// src/Tree.tsx
|
|
3134
|
-
var
|
|
3134
|
+
var import_react_native_theming7 = require("@storybook/react-native-theming");
|
|
3135
3135
|
var import_react6 = __toESM(require("react"));
|
|
3136
3136
|
|
|
3137
3137
|
// src/Button.tsx
|
|
@@ -3224,12 +3224,12 @@ var StyledButton = import_react_native_theming3.styled.TouchableOpacity(({ theme
|
|
|
3224
3224
|
if (variant === "solid")
|
|
3225
3225
|
return theme.color.secondary;
|
|
3226
3226
|
if (variant === "outline")
|
|
3227
|
-
return theme.button
|
|
3227
|
+
return theme.button.background;
|
|
3228
3228
|
if (variant === "ghost" && active)
|
|
3229
3229
|
return theme.background.hoverable;
|
|
3230
3230
|
return "transparent";
|
|
3231
3231
|
})(),
|
|
3232
|
-
boxShadow: variant === "outline" ? `${theme.button
|
|
3232
|
+
boxShadow: variant === "outline" ? `${theme.button.border} 0 0 0 1px inset` : "none",
|
|
3233
3233
|
borderRadius: theme.input.borderRadius,
|
|
3234
3234
|
// Making sure that the button never shrinks below its minimum size
|
|
3235
3235
|
flexShrink: 0
|
|
@@ -3289,18 +3289,116 @@ var IconButton = (0, import_react3.forwardRef)(
|
|
|
3289
3289
|
);
|
|
3290
3290
|
IconButton.displayName = "IconButton";
|
|
3291
3291
|
|
|
3292
|
-
// src/
|
|
3292
|
+
// src/LayoutProvider.tsx
|
|
3293
3293
|
var import_react4 = require("react");
|
|
3294
3294
|
|
|
3295
|
-
// src/util/tree.ts
|
|
3296
|
-
var import_memoizerific = __toESM(require("memoizerific"));
|
|
3297
|
-
|
|
3298
3295
|
// src/constants.ts
|
|
3299
3296
|
var BREAKPOINT = 600;
|
|
3300
3297
|
var MEDIA_DESKTOP_BREAKPOINT = `@media (min-width: ${BREAKPOINT}px)`;
|
|
3301
3298
|
var DEFAULT_REF_ID = "storybook_internal";
|
|
3302
3299
|
|
|
3300
|
+
// src/LayoutProvider.tsx
|
|
3301
|
+
var import_react_native = require("react-native");
|
|
3302
|
+
var import_jsx_runtime8 = (
|
|
3303
|
+
// <BottomSheetModalProvider>
|
|
3304
|
+
require("react/jsx-runtime")
|
|
3305
|
+
);
|
|
3306
|
+
var LayoutContext = (0, import_react4.createContext)({
|
|
3307
|
+
// isMobileMenuOpen: false,
|
|
3308
|
+
openMobileMenu: () => {
|
|
3309
|
+
},
|
|
3310
|
+
closeMobileMenu: () => {
|
|
3311
|
+
},
|
|
3312
|
+
// isMobileAboutOpen: false,
|
|
3313
|
+
// setMobileAboutOpen: () => {},
|
|
3314
|
+
// isMobilePanelOpen: false,
|
|
3315
|
+
// setMobilePanelOpen: () => {},
|
|
3316
|
+
isDesktop: false,
|
|
3317
|
+
isMobile: false
|
|
3318
|
+
});
|
|
3319
|
+
var LayoutProvider = ({ children }) => {
|
|
3320
|
+
const { width } = (0, import_react_native.useWindowDimensions)();
|
|
3321
|
+
const isDesktop = width >= BREAKPOINT;
|
|
3322
|
+
const isMobile = !isDesktop;
|
|
3323
|
+
const openMobileMenu = (0, import_react4.useCallback)(() => {
|
|
3324
|
+
}, []);
|
|
3325
|
+
const closeMobileMenu = (0, import_react4.useCallback)(() => {
|
|
3326
|
+
}, []);
|
|
3327
|
+
const contextValue = (0, import_react4.useMemo)(
|
|
3328
|
+
() => ({
|
|
3329
|
+
// isMobileMenuOpen,
|
|
3330
|
+
openMobileMenu,
|
|
3331
|
+
closeMobileMenu,
|
|
3332
|
+
// isMobileAboutOpen,
|
|
3333
|
+
// setMobileAboutOpen,
|
|
3334
|
+
// isMobilePanelOpen,
|
|
3335
|
+
// setMobilePanelOpen,
|
|
3336
|
+
isDesktop,
|
|
3337
|
+
isMobile
|
|
3338
|
+
}),
|
|
3339
|
+
[
|
|
3340
|
+
// isMobileMenuOpen,
|
|
3341
|
+
openMobileMenu,
|
|
3342
|
+
closeMobileMenu,
|
|
3343
|
+
// // isMobileAboutOpen,
|
|
3344
|
+
// setMobileAboutOpen,
|
|
3345
|
+
// isMobilePanelOpen,
|
|
3346
|
+
// setMobilePanelOpen,
|
|
3347
|
+
isDesktop,
|
|
3348
|
+
isMobile
|
|
3349
|
+
]
|
|
3350
|
+
);
|
|
3351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(LayoutContext.Provider, { value: contextValue, children }) });
|
|
3352
|
+
};
|
|
3353
|
+
var useLayout = () => (0, import_react4.useContext)(LayoutContext);
|
|
3354
|
+
|
|
3355
|
+
// src/icon/CollapseAllIcon.tsx
|
|
3356
|
+
var import_react_native_svg5 = require("react-native-svg");
|
|
3357
|
+
var import_react_native_theming4 = require("@storybook/react-native-theming");
|
|
3358
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3359
|
+
var CollapseAllIcon = ({
|
|
3360
|
+
color,
|
|
3361
|
+
//= '#2E3438',
|
|
3362
|
+
width = 14,
|
|
3363
|
+
height = 14,
|
|
3364
|
+
...props
|
|
3365
|
+
}) => {
|
|
3366
|
+
const theme = (0, import_react_native_theming4.useTheme)();
|
|
3367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native_svg5.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3368
|
+
import_react_native_svg5.Path,
|
|
3369
|
+
{
|
|
3370
|
+
d: "M3.354.146a.5.5 0 10-.708.708l4 4a.5.5 0 00.708 0l4-4a.5.5 0 00-.708-.708L7 3.793 3.354.146zM6.646 9.146a.5.5 0 01.708 0l4 4a.5.5 0 01-.708.708L7 10.207l-3.646 3.647a.5.5 0 01-.708-.708l4-4z",
|
|
3371
|
+
fill: color ?? theme.color.defaultText
|
|
3372
|
+
}
|
|
3373
|
+
) });
|
|
3374
|
+
};
|
|
3375
|
+
|
|
3376
|
+
// src/icon/ExpandAllIcon.tsx
|
|
3377
|
+
var import_react_native_svg6 = require("react-native-svg");
|
|
3378
|
+
var import_react_native_theming5 = require("@storybook/react-native-theming");
|
|
3379
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3380
|
+
var ExpandAllIcon = ({
|
|
3381
|
+
color,
|
|
3382
|
+
//= '#2E3438',
|
|
3383
|
+
width = 14,
|
|
3384
|
+
height = 14,
|
|
3385
|
+
...props
|
|
3386
|
+
}) => {
|
|
3387
|
+
const theme = (0, import_react_native_theming5.useTheme)();
|
|
3388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_svg6.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3389
|
+
import_react_native_svg6.Path,
|
|
3390
|
+
{
|
|
3391
|
+
d: "M7.354.146l4 4a.5.5 0 01-.708.708L7 1.207 3.354 4.854a.5.5 0 11-.708-.708l4-4a.5.5 0 01.708 0zM11.354 9.146a.5.5 0 010 .708l-4 4a.5.5 0 01-.708 0l-4-4a.5.5 0 11.708-.708L7 12.793l3.646-3.647a.5.5 0 01.708 0z",
|
|
3392
|
+
fill: color ?? theme.color.defaultText
|
|
3393
|
+
}
|
|
3394
|
+
) });
|
|
3395
|
+
};
|
|
3396
|
+
|
|
3397
|
+
// src/useExpanded.ts
|
|
3398
|
+
var import_react5 = require("react");
|
|
3399
|
+
|
|
3303
3400
|
// src/util/tree.ts
|
|
3401
|
+
var import_memoizerific = __toESM(require("memoizerific"));
|
|
3304
3402
|
var createId = (itemId, refId) => !refId || refId === DEFAULT_REF_ID ? itemId : `${refId}_${itemId}`;
|
|
3305
3403
|
var get = (0, import_memoizerific.default)(1e3)((id, dataset) => dataset[id]);
|
|
3306
3404
|
var getParent = (0, import_memoizerific.default)(1e3)((id, dataset) => {
|
|
@@ -3371,33 +3469,33 @@ var useExpanded = ({
|
|
|
3371
3469
|
rootIds,
|
|
3372
3470
|
selectedStoryId
|
|
3373
3471
|
}) => {
|
|
3374
|
-
const [expanded, setExpanded] = (0,
|
|
3472
|
+
const [expanded, setExpanded] = (0, import_react5.useReducer)(
|
|
3375
3473
|
(state, { ids, value }) => ids.reduce((acc, id) => Object.assign(acc, { [id]: value }), { ...state }),
|
|
3376
3474
|
{ refId, data, rootIds, initialExpanded },
|
|
3377
3475
|
initializeExpanded
|
|
3378
3476
|
);
|
|
3379
|
-
const updateExpanded = (0,
|
|
3477
|
+
const updateExpanded = (0, import_react5.useCallback)(({ ids, value }) => {
|
|
3380
3478
|
setExpanded({ ids, value });
|
|
3381
3479
|
}, []);
|
|
3382
|
-
(0,
|
|
3480
|
+
(0, import_react5.useEffect)(() => {
|
|
3383
3481
|
setExpanded({ ids: getAncestorIds(data, selectedStoryId), value: true });
|
|
3384
3482
|
}, [data, selectedStoryId]);
|
|
3385
3483
|
return [expanded, updateExpanded];
|
|
3386
3484
|
};
|
|
3387
3485
|
|
|
3388
3486
|
// src/util/status.tsx
|
|
3389
|
-
var
|
|
3390
|
-
var
|
|
3391
|
-
var
|
|
3487
|
+
var import_react_native_theming6 = require("@storybook/react-native-theming");
|
|
3488
|
+
var import_react_native_svg7 = __toESM(require("react-native-svg"));
|
|
3489
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3392
3490
|
function CircleIcon({ height = 14, width = 14, color, ...props }) {
|
|
3393
|
-
return /* @__PURE__ */ (0,
|
|
3491
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_svg7.default, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native_svg7.Path, { d: "M14 7A7 7 0 110 7a7 7 0 0114 0z", fill: color }) });
|
|
3394
3492
|
}
|
|
3395
3493
|
function SmallIcons(props) {
|
|
3396
|
-
return /* @__PURE__ */ (0,
|
|
3494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CircleIcon, { width: 6, height: 6, ...props });
|
|
3397
3495
|
}
|
|
3398
3496
|
function LoadingIcons(props) {
|
|
3399
|
-
const theme = (0,
|
|
3400
|
-
return /* @__PURE__ */ (0,
|
|
3497
|
+
const theme = (0, import_react_native_theming6.useTheme)();
|
|
3498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3401
3499
|
SmallIcons,
|
|
3402
3500
|
{
|
|
3403
3501
|
color: theme.base === "light" ? theme.color.mediumdark : theme.color.darker,
|
|
@@ -3408,10 +3506,10 @@ function LoadingIcons(props) {
|
|
|
3408
3506
|
var statusPriority = ["unknown", "pending", "success", "warn", "error"];
|
|
3409
3507
|
var statusMapping = {
|
|
3410
3508
|
unknown: [null, null],
|
|
3411
|
-
pending: [/* @__PURE__ */ (0,
|
|
3412
|
-
success: [/* @__PURE__ */ (0,
|
|
3413
|
-
warn: [/* @__PURE__ */ (0,
|
|
3414
|
-
error: [/* @__PURE__ */ (0,
|
|
3509
|
+
pending: [/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LoadingIcons, {}, "icon"), "currentColor"],
|
|
3510
|
+
success: [/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SmallIcons, { color: "green" }, "icon"), "currentColor"],
|
|
3511
|
+
warn: [/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SmallIcons, { color: "orange" }, "icon"), "#A15C20"],
|
|
3512
|
+
error: [/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SmallIcons, { color: "red" }, "icon"), "brown"]
|
|
3415
3513
|
};
|
|
3416
3514
|
var getHighestStatus = (statuses) => {
|
|
3417
3515
|
return statusPriority.reduce(
|
|
@@ -3434,103 +3532,11 @@ function getGroupStatus(collapsedData, status) {
|
|
|
3434
3532
|
}, {});
|
|
3435
3533
|
}
|
|
3436
3534
|
|
|
3437
|
-
// src/Tree.tsx
|
|
3438
|
-
var import_react_native2 = require("react-native");
|
|
3439
|
-
|
|
3440
|
-
// src/icon/ExpandAllIcon.tsx
|
|
3441
|
-
var import_react_native_svg6 = require("react-native-svg");
|
|
3442
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3443
|
-
var ExpandAllIcon = ({
|
|
3444
|
-
color = "#2E3438",
|
|
3445
|
-
width = 14,
|
|
3446
|
-
height = 14,
|
|
3447
|
-
...props
|
|
3448
|
-
}) => {
|
|
3449
|
-
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)(
|
|
3450
|
-
import_react_native_svg6.Path,
|
|
3451
|
-
{
|
|
3452
|
-
d: "M7.354.146l4 4a.5.5 0 01-.708.708L7 1.207 3.354 4.854a.5.5 0 11-.708-.708l4-4a.5.5 0 01.708 0zM11.354 9.146a.5.5 0 010 .708l-4 4a.5.5 0 01-.708 0l-4-4a.5.5 0 11.708-.708L7 12.793l3.646-3.647a.5.5 0 01.708 0z",
|
|
3453
|
-
fill: color
|
|
3454
|
-
}
|
|
3455
|
-
) });
|
|
3456
|
-
};
|
|
3457
|
-
|
|
3458
|
-
// src/icon/CollapseAllIcon.tsx
|
|
3459
|
-
var import_react_native_svg7 = require("react-native-svg");
|
|
3460
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3461
|
-
var CollapseAllIcon = ({
|
|
3462
|
-
color = "#2E3438",
|
|
3463
|
-
width = 14,
|
|
3464
|
-
height = 14,
|
|
3465
|
-
...props
|
|
3466
|
-
}) => {
|
|
3467
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_native_svg7.Svg, { width, height, viewBox: "0 0 14 14", fill: "none", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3468
|
-
import_react_native_svg7.Path,
|
|
3469
|
-
{
|
|
3470
|
-
d: "M3.354.146a.5.5 0 10-.708.708l4 4a.5.5 0 00.708 0l4-4a.5.5 0 00-.708-.708L7 3.793 3.354.146zM6.646 9.146a.5.5 0 01.708 0l4 4a.5.5 0 01-.708.708L7 10.207l-3.646 3.647a.5.5 0 01-.708-.708l4-4z",
|
|
3471
|
-
fill: color
|
|
3472
|
-
}
|
|
3473
|
-
) });
|
|
3474
|
-
};
|
|
3475
|
-
|
|
3476
|
-
// src/LayoutProvider.tsx
|
|
3477
|
-
var import_react5 = require("react");
|
|
3478
|
-
var import_react_native = require("react-native");
|
|
3479
|
-
var import_jsx_runtime11 = (
|
|
3480
|
-
// <BottomSheetModalProvider>
|
|
3481
|
-
require("react/jsx-runtime")
|
|
3482
|
-
);
|
|
3483
|
-
var LayoutContext = (0, import_react5.createContext)({
|
|
3484
|
-
// isMobileMenuOpen: false,
|
|
3485
|
-
openMobileMenu: () => {
|
|
3486
|
-
},
|
|
3487
|
-
closeMobileMenu: () => {
|
|
3488
|
-
},
|
|
3489
|
-
// isMobileAboutOpen: false,
|
|
3490
|
-
// setMobileAboutOpen: () => {},
|
|
3491
|
-
// isMobilePanelOpen: false,
|
|
3492
|
-
// setMobilePanelOpen: () => {},
|
|
3493
|
-
isDesktop: false,
|
|
3494
|
-
isMobile: false
|
|
3495
|
-
});
|
|
3496
|
-
var LayoutProvider = ({ children }) => {
|
|
3497
|
-
const { width } = (0, import_react_native.useWindowDimensions)();
|
|
3498
|
-
const isDesktop = width >= BREAKPOINT;
|
|
3499
|
-
const isMobile = !isDesktop;
|
|
3500
|
-
const openMobileMenu = (0, import_react5.useCallback)(() => {
|
|
3501
|
-
}, []);
|
|
3502
|
-
const closeMobileMenu = (0, import_react5.useCallback)(() => {
|
|
3503
|
-
}, []);
|
|
3504
|
-
const contextValue = (0, import_react5.useMemo)(
|
|
3505
|
-
() => ({
|
|
3506
|
-
// isMobileMenuOpen,
|
|
3507
|
-
openMobileMenu,
|
|
3508
|
-
closeMobileMenu,
|
|
3509
|
-
// isMobileAboutOpen,
|
|
3510
|
-
// setMobileAboutOpen,
|
|
3511
|
-
// isMobilePanelOpen,
|
|
3512
|
-
// setMobilePanelOpen,
|
|
3513
|
-
isDesktop,
|
|
3514
|
-
isMobile
|
|
3515
|
-
}),
|
|
3516
|
-
[
|
|
3517
|
-
// isMobileMenuOpen,
|
|
3518
|
-
openMobileMenu,
|
|
3519
|
-
closeMobileMenu,
|
|
3520
|
-
// // isMobileAboutOpen,
|
|
3521
|
-
// setMobileAboutOpen,
|
|
3522
|
-
// isMobilePanelOpen,
|
|
3523
|
-
// setMobilePanelOpen,
|
|
3524
|
-
isDesktop,
|
|
3525
|
-
isMobile
|
|
3526
|
-
]
|
|
3527
|
-
);
|
|
3528
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(LayoutContext.Provider, { value: contextValue, children }) });
|
|
3529
|
-
};
|
|
3530
|
-
var useLayout = () => (0, import_react5.useContext)(LayoutContext);
|
|
3531
|
-
|
|
3532
3535
|
// src/Tree.tsx
|
|
3533
3536
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3537
|
+
var TextItem = import_react_native_theming7.styled.Text(({ theme }) => ({
|
|
3538
|
+
color: theme.color.defaultText
|
|
3539
|
+
}));
|
|
3534
3540
|
var Node = import_react6.default.memo(function Node2({
|
|
3535
3541
|
item,
|
|
3536
3542
|
refId,
|
|
@@ -3580,7 +3586,7 @@ var Node = import_react6.default.memo(function Node2({
|
|
|
3580
3586
|
"aria-expanded": isExpanded,
|
|
3581
3587
|
children: [
|
|
3582
3588
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CollapseIcon, { isExpanded }),
|
|
3583
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3589
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TextItem, { children: item.renderLabel?.(item, {}) || item.name })
|
|
3584
3590
|
]
|
|
3585
3591
|
}
|
|
3586
3592
|
),
|
|
@@ -3624,7 +3630,7 @@ var Node = import_react6.default.memo(function Node2({
|
|
|
3624
3630
|
}
|
|
3625
3631
|
return null;
|
|
3626
3632
|
});
|
|
3627
|
-
var LeafNodeStyleWrapper =
|
|
3633
|
+
var LeafNodeStyleWrapper = import_react_native_theming7.styled.View(({ theme }) => ({
|
|
3628
3634
|
position: "relative",
|
|
3629
3635
|
display: "flex",
|
|
3630
3636
|
flexDirection: "row",
|
|
@@ -3636,7 +3642,7 @@ var LeafNodeStyleWrapper = import_react_native_theming5.styled.View(({ theme })
|
|
|
3636
3642
|
minHeight: 28,
|
|
3637
3643
|
borderRadius: 4
|
|
3638
3644
|
}));
|
|
3639
|
-
var RootNode =
|
|
3645
|
+
var RootNode = import_react_native_theming7.styled.View(({}) => ({
|
|
3640
3646
|
display: "flex",
|
|
3641
3647
|
flexDirection: "row",
|
|
3642
3648
|
alignItems: "center",
|
|
@@ -3645,7 +3651,7 @@ var RootNode = import_react_native_theming5.styled.View(({}) => ({
|
|
|
3645
3651
|
marginBottom: 4,
|
|
3646
3652
|
minHeight: 28
|
|
3647
3653
|
}));
|
|
3648
|
-
var RootNodeText =
|
|
3654
|
+
var RootNodeText = import_react_native_theming7.styled.Text(({ theme }) => ({
|
|
3649
3655
|
fontSize: theme.typography.size.s1 - 1,
|
|
3650
3656
|
fontWeight: theme.typography.weight.bold,
|
|
3651
3657
|
color: theme.textMutedColor,
|
|
@@ -3653,7 +3659,7 @@ var RootNodeText = import_react_native_theming5.styled.Text(({ theme }) => ({
|
|
|
3653
3659
|
letterSpacing: 2.5,
|
|
3654
3660
|
textTransform: "uppercase"
|
|
3655
3661
|
}));
|
|
3656
|
-
var CollapseButton =
|
|
3662
|
+
var CollapseButton = import_react_native_theming7.styled.TouchableOpacity(({}) => ({
|
|
3657
3663
|
display: "flex",
|
|
3658
3664
|
flexDirection: "row",
|
|
3659
3665
|
paddingVertical: 0,
|
|
@@ -3814,7 +3820,7 @@ var Tree = import_react6.default.memo(function Tree2({ isMain, refId, data, stat
|
|
|
3814
3820
|
]);
|
|
3815
3821
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Container, { ref: containerRef, hasOrphans: isMain && orphanIds.length > 0, children: treeItems });
|
|
3816
3822
|
});
|
|
3817
|
-
var Container =
|
|
3823
|
+
var Container = import_react_native_theming7.styled.View((props) => ({
|
|
3818
3824
|
marginTop: props.hasOrphans ? 20 : 0,
|
|
3819
3825
|
marginBottom: 20
|
|
3820
3826
|
}));
|
|
@@ -3844,9 +3850,9 @@ var import_react8 = __toESM(require("react"));
|
|
|
3844
3850
|
|
|
3845
3851
|
// src/Refs.tsx
|
|
3846
3852
|
var import_react7 = __toESM(require("react"));
|
|
3847
|
-
var
|
|
3853
|
+
var import_react_native_theming8 = require("@storybook/react-native-theming");
|
|
3848
3854
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3849
|
-
var Wrapper2 =
|
|
3855
|
+
var Wrapper2 = import_react_native_theming8.styled.View(({}) => ({
|
|
3850
3856
|
position: "relative"
|
|
3851
3857
|
}));
|
|
3852
3858
|
var Ref = import_react7.default.memo(function Ref2(props) {
|
|
@@ -3899,7 +3905,7 @@ var Ref = import_react7.default.memo(function Ref2(props) {
|
|
|
3899
3905
|
});
|
|
3900
3906
|
|
|
3901
3907
|
// src/Explorer.tsx
|
|
3902
|
-
var
|
|
3908
|
+
var import_react_native2 = require("react-native");
|
|
3903
3909
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3904
3910
|
var import_react9 = require("react");
|
|
3905
3911
|
var Explorer = import_react8.default.memo(function Explorer2({
|
|
@@ -3910,7 +3916,7 @@ var Explorer = import_react8.default.memo(function Explorer2({
|
|
|
3910
3916
|
setSelection
|
|
3911
3917
|
}) {
|
|
3912
3918
|
const containerRef = (0, import_react8.useRef)(null);
|
|
3913
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native2.View, { ref: containerRef, id: "storybook-explorer-tree", children: dataset.entries.map(([refId, ref]) => /* @__PURE__ */ (0, import_react9.createElement)(
|
|
3914
3920
|
Ref,
|
|
3915
3921
|
{
|
|
3916
3922
|
...ref,
|
|
@@ -3925,10 +3931,10 @@ var Explorer = import_react8.default.memo(function Explorer2({
|
|
|
3925
3931
|
|
|
3926
3932
|
// src/Sidebar.tsx
|
|
3927
3933
|
var import_react14 = __toESM(require("react"));
|
|
3928
|
-
var
|
|
3934
|
+
var import_react_native_theming11 = require("@storybook/react-native-theming");
|
|
3929
3935
|
|
|
3930
3936
|
// src/Search.tsx
|
|
3931
|
-
var
|
|
3937
|
+
var import_react_native_theming9 = require("@storybook/react-native-theming");
|
|
3932
3938
|
var import_fuse = __toESM(require("fuse.js"));
|
|
3933
3939
|
var import_react10 = __toESM(require("react"));
|
|
3934
3940
|
|
|
@@ -3987,7 +3993,7 @@ var CloseIcon = ({
|
|
|
3987
3993
|
};
|
|
3988
3994
|
|
|
3989
3995
|
// src/Search.tsx
|
|
3990
|
-
var
|
|
3996
|
+
var import_react_native3 = require("react-native");
|
|
3991
3997
|
var import_bottom_sheet = require("@gorhom/bottom-sheet");
|
|
3992
3998
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
3993
3999
|
var DEFAULT_MAX_SEARCH_RESULTS = 50;
|
|
@@ -4007,7 +4013,7 @@ var options = {
|
|
|
4007
4013
|
{ name: "path", weight: 0.3 }
|
|
4008
4014
|
]
|
|
4009
4015
|
};
|
|
4010
|
-
var SearchIconWrapper =
|
|
4016
|
+
var SearchIconWrapper = import_react_native_theming9.styled.View(({ theme }) => ({
|
|
4011
4017
|
position: "absolute",
|
|
4012
4018
|
top: 0,
|
|
4013
4019
|
left: 8,
|
|
@@ -4019,12 +4025,12 @@ var SearchIconWrapper = import_react_native_theming7.styled.View(({ theme }) =>
|
|
|
4019
4025
|
alignItems: "center",
|
|
4020
4026
|
height: "100%"
|
|
4021
4027
|
}));
|
|
4022
|
-
var SearchField =
|
|
4028
|
+
var SearchField = import_react_native_theming9.styled.View({
|
|
4023
4029
|
display: "flex",
|
|
4024
4030
|
flexDirection: "column",
|
|
4025
4031
|
position: "relative"
|
|
4026
4032
|
});
|
|
4027
|
-
var Input = (0,
|
|
4033
|
+
var Input = (0, import_react_native_theming9.styled)(import_bottom_sheet.BottomSheetTextInput)(({ theme }) => ({
|
|
4028
4034
|
height: 32,
|
|
4029
4035
|
paddingLeft: 28,
|
|
4030
4036
|
paddingRight: 28,
|
|
@@ -4036,7 +4042,7 @@ var Input = (0, import_react_native_theming7.styled)(import_bottom_sheet.BottomS
|
|
|
4036
4042
|
color: theme.color.defaultText,
|
|
4037
4043
|
width: "100%"
|
|
4038
4044
|
}));
|
|
4039
|
-
var ClearIcon =
|
|
4045
|
+
var ClearIcon = import_react_native_theming9.styled.TouchableOpacity(({ theme }) => ({
|
|
4040
4046
|
position: "absolute",
|
|
4041
4047
|
top: 0,
|
|
4042
4048
|
bottom: 0,
|
|
@@ -4147,7 +4153,7 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
|
|
|
4147
4153
|
);
|
|
4148
4154
|
const input = inputValue ? inputValue.trim() : "";
|
|
4149
4155
|
const results = input ? getResults(input) : [];
|
|
4150
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
4156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native3.View, { style: { flex: 1 }, children: [
|
|
4151
4157
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SearchField, { children: [
|
|
4152
4158
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SearchIconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SearchIcon, {}) }),
|
|
4153
4159
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
@@ -4183,18 +4189,18 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
|
|
|
4183
4189
|
});
|
|
4184
4190
|
|
|
4185
4191
|
// src/SearchResults.tsx
|
|
4186
|
-
var
|
|
4192
|
+
var import_react_native_theming10 = require("@storybook/react-native-theming");
|
|
4187
4193
|
var import_react11 = __toESM(require("react"));
|
|
4188
|
-
var
|
|
4189
|
-
var
|
|
4194
|
+
var import_polished2 = require("polished");
|
|
4195
|
+
var import_react_native4 = require("react-native");
|
|
4190
4196
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
4191
4197
|
var import_react12 = require("react");
|
|
4192
|
-
var ResultsList =
|
|
4198
|
+
var ResultsList = import_react_native_theming10.styled.View({
|
|
4193
4199
|
margin: 0,
|
|
4194
4200
|
padding: 0,
|
|
4195
4201
|
marginTop: 8
|
|
4196
4202
|
});
|
|
4197
|
-
var ResultRow =
|
|
4203
|
+
var ResultRow = import_react_native_theming10.styled.TouchableOpacity(
|
|
4198
4204
|
({ theme, isHighlighted }) => ({
|
|
4199
4205
|
width: "100%",
|
|
4200
4206
|
border: "none",
|
|
@@ -4203,7 +4209,7 @@ var ResultRow = import_react_native_theming8.styled.TouchableOpacity(
|
|
|
4203
4209
|
flexDirection: "row",
|
|
4204
4210
|
alignItems: "flex-start",
|
|
4205
4211
|
textAlign: "left",
|
|
4206
|
-
color:
|
|
4212
|
+
color: theme.color.defaultText,
|
|
4207
4213
|
fontSize: theme.typography.size.s2,
|
|
4208
4214
|
backgroundColor: isHighlighted ? theme.background.hoverable : "transparent",
|
|
4209
4215
|
minHeight: 28,
|
|
@@ -4214,33 +4220,33 @@ var ResultRow = import_react_native_theming8.styled.TouchableOpacity(
|
|
|
4214
4220
|
paddingLeft: 8,
|
|
4215
4221
|
paddingRight: 8,
|
|
4216
4222
|
"&:hover, &:focus": {
|
|
4217
|
-
backgroundColor: (0,
|
|
4223
|
+
backgroundColor: (0, import_polished2.transparentize)(0.93, theme.color.secondary),
|
|
4218
4224
|
outline: "none"
|
|
4219
4225
|
}
|
|
4220
4226
|
})
|
|
4221
4227
|
);
|
|
4222
|
-
var IconWrapper =
|
|
4228
|
+
var IconWrapper = import_react_native_theming10.styled.View({
|
|
4223
4229
|
marginTop: 2
|
|
4224
4230
|
});
|
|
4225
|
-
var ResultRowContent =
|
|
4231
|
+
var ResultRowContent = import_react_native_theming10.styled.View(() => ({
|
|
4226
4232
|
display: "flex",
|
|
4227
4233
|
flexDirection: "column"
|
|
4228
4234
|
}));
|
|
4229
|
-
var NoResults =
|
|
4235
|
+
var NoResults = import_react_native_theming10.styled.View(({ theme }) => ({
|
|
4230
4236
|
marginTop: 20,
|
|
4231
4237
|
textAlign: "center",
|
|
4232
4238
|
fontSize: theme.typography.size.s2,
|
|
4233
4239
|
lineHeight: 18,
|
|
4234
4240
|
color: theme.color.defaultText
|
|
4235
4241
|
}));
|
|
4236
|
-
var Mark =
|
|
4242
|
+
var Mark = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
4237
4243
|
backgroundColor: "transparent",
|
|
4238
4244
|
color: theme.color.secondary
|
|
4239
4245
|
}));
|
|
4240
|
-
var MoreWrapper =
|
|
4246
|
+
var MoreWrapper = import_react_native_theming10.styled.View({
|
|
4241
4247
|
marginTop: 8
|
|
4242
4248
|
});
|
|
4243
|
-
var RecentlyOpenedTitle =
|
|
4249
|
+
var RecentlyOpenedTitle = import_react_native_theming10.styled.View(({ theme }) => ({
|
|
4244
4250
|
display: "flex",
|
|
4245
4251
|
flexDirection: "row",
|
|
4246
4252
|
justifyContent: "space-between",
|
|
@@ -4261,31 +4267,31 @@ var Highlight = import_react11.default.memo(
|
|
|
4261
4267
|
const { value, indices } = match;
|
|
4262
4268
|
const { nodes: result } = indices.reduce(
|
|
4263
4269
|
({ cursor, nodes }, [start, end], index, { length }) => {
|
|
4264
|
-
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4270
|
+
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: value.slice(cursor, start) }, `text-${index}`));
|
|
4265
4271
|
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Mark, { children: value.slice(start, end + 1) }, `mark-${index}`));
|
|
4266
4272
|
if (index === length - 1) {
|
|
4267
|
-
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4273
|
+
nodes.push(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: value.slice(end + 1) }, `last-${index}`));
|
|
4268
4274
|
}
|
|
4269
4275
|
return { cursor: end + 1, nodes };
|
|
4270
4276
|
},
|
|
4271
4277
|
{ cursor: 0, nodes: [] }
|
|
4272
4278
|
);
|
|
4273
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: result }, `end-${match.key}`);
|
|
4274
4280
|
}
|
|
4275
4281
|
);
|
|
4276
|
-
var Title =
|
|
4282
|
+
var Title = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
4277
4283
|
justifyContent: "flex-start",
|
|
4278
4284
|
color: theme.textMutedColor,
|
|
4279
4285
|
fontSize: theme.typography.size.s2
|
|
4280
4286
|
}));
|
|
4281
|
-
var Path10 =
|
|
4287
|
+
var Path10 = import_react_native_theming10.styled.View(({ theme }) => ({
|
|
4282
4288
|
justifyContent: "flex-start",
|
|
4283
4289
|
marginVertical: 2,
|
|
4284
4290
|
color: theme.textMutedColor,
|
|
4285
4291
|
fontSize: theme.typography.size.s1 - 1,
|
|
4286
4292
|
flexDirection: "row"
|
|
4287
4293
|
}));
|
|
4288
|
-
var PathText =
|
|
4294
|
+
var PathText = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
4289
4295
|
fontSize: theme.typography.size.s1 - 1,
|
|
4290
4296
|
color: theme.textMutedColor
|
|
4291
4297
|
}));
|
|
@@ -4313,7 +4319,7 @@ var Result = import_react11.default.memo(function Result2({
|
|
|
4313
4319
|
] }),
|
|
4314
4320
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(ResultRowContent, { testID: "search-result-item--label", children: [
|
|
4315
4321
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Highlight, { match: nameMatch, children: item.name }, "search-result-item--label-highlight") }),
|
|
4316
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Path10, { children: item.path.map((group, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4322
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Path10, { children: item.path.map((group, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native4.View, { style: { flexShrink: 1 }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PathText, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4317
4323
|
Highlight,
|
|
4318
4324
|
{
|
|
4319
4325
|
match: pathMatches.find((match) => match.refIndex === index),
|
|
@@ -4324,6 +4330,9 @@ var Result = import_react11.default.memo(function Result2({
|
|
|
4324
4330
|
item.status ? i : null
|
|
4325
4331
|
] });
|
|
4326
4332
|
});
|
|
4333
|
+
var Text = import_react_native_theming10.styled.Text(({ theme }) => ({
|
|
4334
|
+
color: theme.color.defaultText
|
|
4335
|
+
}));
|
|
4327
4336
|
var SearchResults = import_react11.default.memo(function SearchResults2({
|
|
4328
4337
|
query,
|
|
4329
4338
|
results,
|
|
@@ -4341,9 +4350,9 @@ var SearchResults = import_react11.default.memo(function SearchResults2({
|
|
|
4341
4350
|
"Recently opened",
|
|
4342
4351
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(IconButton, { onPress: handleClearLastViewed })
|
|
4343
4352
|
] }),
|
|
4344
|
-
results.length === 0 && query && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4345
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4346
|
-
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
4353
|
+
results.length === 0 && query && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native4.View, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(NoResults, { children: [
|
|
4354
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { style: { marginBottom: 8 }, children: "No components found" }),
|
|
4355
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: "Find components by name or path." })
|
|
4347
4356
|
] }) }),
|
|
4348
4357
|
results.map((result, index) => {
|
|
4349
4358
|
if (isExpandType(result)) {
|
|
@@ -4418,16 +4427,16 @@ var useLastViewed = (selection) => {
|
|
|
4418
4427
|
};
|
|
4419
4428
|
|
|
4420
4429
|
// src/Sidebar.tsx
|
|
4421
|
-
var
|
|
4430
|
+
var import_react_native5 = require("react-native");
|
|
4422
4431
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
4423
|
-
var Container2 =
|
|
4432
|
+
var Container2 = import_react_native_theming11.styled.View(({ theme }) => ({
|
|
4424
4433
|
width: "100%",
|
|
4425
4434
|
height: "100%",
|
|
4426
4435
|
display: "flex",
|
|
4427
4436
|
flexDirection: "column",
|
|
4428
4437
|
background: theme.background.content
|
|
4429
4438
|
}));
|
|
4430
|
-
var Top =
|
|
4439
|
+
var Top = import_react_native_theming11.styled.View({
|
|
4431
4440
|
paddingLeft: 4,
|
|
4432
4441
|
paddingRight: 4,
|
|
4433
4442
|
paddingTop: 16,
|
|
@@ -4440,8 +4449,8 @@ var Swap = import_react14.default.memo(function Swap2({
|
|
|
4440
4449
|
}) {
|
|
4441
4450
|
const [a, b] = import_react14.default.Children.toArray(children);
|
|
4442
4451
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
4443
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4444
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4452
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native5.View, { style: { display: condition ? "flex" : "none" }, children: a }),
|
|
4453
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native5.View, { style: { display: condition ? "none" : "flex" }, children: b })
|
|
4445
4454
|
] });
|
|
4446
4455
|
});
|
|
4447
4456
|
var useCombination = (index, indexError, previewInitialized, status, refs) => {
|
|
@@ -4504,9 +4513,9 @@ var Sidebar = import_react14.default.memo(function Sidebar2({
|
|
|
4504
4513
|
// src/Layout.tsx
|
|
4505
4514
|
var import_core_events = require("@storybook/core/core-events");
|
|
4506
4515
|
var import_manager_api2 = require("@storybook/core/manager-api");
|
|
4507
|
-
var
|
|
4516
|
+
var import_react_native_theming15 = require("@storybook/react-native-theming");
|
|
4508
4517
|
var import_react17 = require("react");
|
|
4509
|
-
var
|
|
4518
|
+
var import_react_native8 = require("react-native");
|
|
4510
4519
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
4511
4520
|
|
|
4512
4521
|
// src/icon/BottomBarToggleIcon.tsx
|
|
@@ -4559,9 +4568,10 @@ var MenuIcon = ({
|
|
|
4559
4568
|
// src/MobileMenuDrawer.tsx
|
|
4560
4569
|
var import_bottom_sheet2 = require("@gorhom/bottom-sheet");
|
|
4561
4570
|
var import_react15 = require("react");
|
|
4562
|
-
var
|
|
4571
|
+
var import_react_native6 = require("react-native");
|
|
4563
4572
|
var import_react_native_reanimated = require("react-native-reanimated");
|
|
4564
4573
|
var import_react_native_safe_area_context = require("react-native-safe-area-context");
|
|
4574
|
+
var import_react_native_theming12 = require("@storybook/react-native-theming");
|
|
4565
4575
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4566
4576
|
var BottomSheetBackdropComponent = (backdropComponentProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4567
4577
|
import_bottom_sheet2.BottomSheetBackdrop,
|
|
@@ -4577,6 +4587,7 @@ var MobileMenuDrawer = (0, import_react15.forwardRef)(
|
|
|
4577
4587
|
({ children, onStateChange }, ref) => {
|
|
4578
4588
|
const reducedMotion = (0, import_react_native_reanimated.useReducedMotion)();
|
|
4579
4589
|
const insets = (0, import_react_native_safe_area_context.useSafeAreaInsets)();
|
|
4590
|
+
const theme = (0, import_react_native_theming12.useTheme)();
|
|
4580
4591
|
const menuBottomSheetRef = (0, import_react15.useRef)(null);
|
|
4581
4592
|
(0, import_react15.useImperativeHandle)(ref, () => ({
|
|
4582
4593
|
setMobileMenuOpen: (open) => {
|
|
@@ -4584,7 +4595,7 @@ var MobileMenuDrawer = (0, import_react15.forwardRef)(
|
|
|
4584
4595
|
onStateChange(true);
|
|
4585
4596
|
menuBottomSheetRef.current?.present();
|
|
4586
4597
|
} else {
|
|
4587
|
-
|
|
4598
|
+
import_react_native6.Keyboard.dismiss();
|
|
4588
4599
|
onStateChange(false);
|
|
4589
4600
|
menuBottomSheetRef.current?.dismiss();
|
|
4590
4601
|
}
|
|
@@ -4607,6 +4618,8 @@ var MobileMenuDrawer = (0, import_react15.forwardRef)(
|
|
|
4607
4618
|
keyboardBlurBehavior: "restore",
|
|
4608
4619
|
stackBehavior: "replace",
|
|
4609
4620
|
backdropComponent: BottomSheetBackdropComponent,
|
|
4621
|
+
backgroundStyle: { backgroundColor: theme.background.content },
|
|
4622
|
+
handleIndicatorStyle: { backgroundColor: theme.textMutedColor },
|
|
4610
4623
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4611
4624
|
import_bottom_sheet2.BottomSheetScrollView,
|
|
4612
4625
|
{
|
|
@@ -4625,15 +4638,17 @@ var MobileMenuDrawer = (0, import_react15.forwardRef)(
|
|
|
4625
4638
|
// src/MobileAddonsPanel.tsx
|
|
4626
4639
|
var import_bottom_sheet3 = require("@gorhom/bottom-sheet");
|
|
4627
4640
|
var import_manager_api = require("@storybook/core/manager-api");
|
|
4628
|
-
var
|
|
4641
|
+
var import_react_native_theming13 = require("@storybook/react-native-theming");
|
|
4629
4642
|
var import_types3 = require("@storybook/core/types");
|
|
4630
4643
|
var import_react16 = require("react");
|
|
4631
|
-
var
|
|
4644
|
+
var import_react_native7 = require("react-native");
|
|
4632
4645
|
var import_react_native_gesture_handler = require("react-native-gesture-handler");
|
|
4633
4646
|
var import_react_native_reanimated2 = __toESM(require("react-native-reanimated"));
|
|
4634
4647
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
4648
|
+
var import_react_native_theming14 = require("@storybook/react-native-theming");
|
|
4635
4649
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
4636
4650
|
var MobileAddonsPanel = (0, import_react16.forwardRef)(({ storyId, onStateChange }, ref) => {
|
|
4651
|
+
const theme = (0, import_react_native_theming14.useTheme)();
|
|
4637
4652
|
const reducedMotion = (0, import_react_native_reanimated2.useReducedMotion)();
|
|
4638
4653
|
const addonsPanelBottomSheetRef = (0, import_react16.useRef)(null);
|
|
4639
4654
|
const insets = (0, import_react_native_safe_area_context2.useSafeAreaInsets)();
|
|
@@ -4652,7 +4667,7 @@ var MobileAddonsPanel = (0, import_react16.forwardRef)(({ storyId, onStateChange
|
|
|
4652
4667
|
}
|
|
4653
4668
|
}
|
|
4654
4669
|
}));
|
|
4655
|
-
const { height } = (0,
|
|
4670
|
+
const { height } = (0, import_react_native7.useWindowDimensions)();
|
|
4656
4671
|
const adjustedBottomSheetSize = (0, import_react_native_reanimated2.useAnimatedStyle)(() => {
|
|
4657
4672
|
return {
|
|
4658
4673
|
maxHeight: height - animatedPosition.value - insets.bottom
|
|
@@ -4675,72 +4690,76 @@ var MobileAddonsPanel = (0, import_react16.forwardRef)(({ storyId, onStateChange
|
|
|
4675
4690
|
containerStyle: {},
|
|
4676
4691
|
backgroundStyle: {
|
|
4677
4692
|
borderRadius: 0,
|
|
4678
|
-
borderTopColor:
|
|
4679
|
-
borderTopWidth: 1
|
|
4693
|
+
borderTopColor: theme.appBorderColor,
|
|
4694
|
+
borderTopWidth: 1,
|
|
4695
|
+
backgroundColor: theme.background.content
|
|
4680
4696
|
},
|
|
4697
|
+
handleIndicatorStyle: { backgroundColor: theme.textMutedColor },
|
|
4681
4698
|
keyboardBehavior: "extend",
|
|
4682
4699
|
enableDismissOnClose: true,
|
|
4683
4700
|
enableHandlePanningGesture: true,
|
|
4684
4701
|
stackBehavior: "replace",
|
|
4685
4702
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_react_native_reanimated2.default.View, { style: [{ flex: 1 }, adjustedBottomSheetSize], children: [
|
|
4686
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
{
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4699
|
-
Tab,
|
|
4700
|
-
{
|
|
4701
|
-
active: id === addonSelected,
|
|
4702
|
-
onPress: () => setAddonSelected(id),
|
|
4703
|
-
text: resolvedTitle
|
|
4703
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4704
|
+
import_react_native7.View,
|
|
4705
|
+
{
|
|
4706
|
+
style: { flexDirection: "row", borderBottomWidth: 1, borderBottomColor: "lightgrey" },
|
|
4707
|
+
children: [
|
|
4708
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4709
|
+
import_react_native_gesture_handler.ScrollView,
|
|
4710
|
+
{
|
|
4711
|
+
horizontal: true,
|
|
4712
|
+
showsHorizontalScrollIndicator: false,
|
|
4713
|
+
contentContainerStyle: {
|
|
4714
|
+
justifyContent: "center"
|
|
4704
4715
|
},
|
|
4705
|
-
id
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4716
|
+
children: Object.values(panels).map(({ id, title }) => {
|
|
4717
|
+
const resolvedTitle = typeof title === "function" ? title({}) : title;
|
|
4718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4719
|
+
Tab,
|
|
4720
|
+
{
|
|
4721
|
+
active: id === addonSelected,
|
|
4722
|
+
onPress: () => setAddonSelected(id),
|
|
4723
|
+
text: resolvedTitle
|
|
4724
|
+
},
|
|
4725
|
+
id
|
|
4726
|
+
);
|
|
4727
|
+
})
|
|
4728
|
+
}
|
|
4729
|
+
),
|
|
4730
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4731
|
+
IconButton,
|
|
4732
|
+
{
|
|
4733
|
+
style: {
|
|
4734
|
+
marginRight: 4,
|
|
4735
|
+
marginBottom: 4,
|
|
4736
|
+
alignItems: "center",
|
|
4737
|
+
justifyContent: "center"
|
|
4738
|
+
},
|
|
4739
|
+
hitSlop: { top: 10, right: 10, bottom: 10, left: 10 },
|
|
4740
|
+
Icon: CloseIcon,
|
|
4741
|
+
onPress: () => {
|
|
4742
|
+
onStateChange(false);
|
|
4743
|
+
addonsPanelBottomSheetRef.current?.dismiss();
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
)
|
|
4747
|
+
]
|
|
4748
|
+
}
|
|
4749
|
+
),
|
|
4728
4750
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4729
4751
|
import_react_native_gesture_handler.ScrollView,
|
|
4730
4752
|
{
|
|
4731
4753
|
style: { flex: 1 },
|
|
4732
|
-
keyboardShouldPersistTaps: "handled",
|
|
4733
4754
|
contentContainerStyle: {
|
|
4734
|
-
paddingBottom: insets.bottom + 16
|
|
4735
|
-
marginTop: 10,
|
|
4736
|
-
paddingHorizontal: 16
|
|
4755
|
+
paddingBottom: insets.bottom + 16
|
|
4737
4756
|
},
|
|
4738
4757
|
children: (() => {
|
|
4739
4758
|
if (!storyId) {
|
|
4740
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native7.View, { style: { alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native7.Text, { children: "No Story Selected" }) });
|
|
4741
4760
|
}
|
|
4742
4761
|
if (Object.keys(panels).length === 0) {
|
|
4743
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native7.View, { style: { alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_react_native7.Text, { children: "No addons loaded." }) });
|
|
4744
4763
|
}
|
|
4745
4764
|
return panels[addonSelected].render({ active: true });
|
|
4746
4765
|
})()
|
|
@@ -4753,7 +4772,7 @@ var MobileAddonsPanel = (0, import_react16.forwardRef)(({ storyId, onStateChange
|
|
|
4753
4772
|
var Tab = ({ active, onPress, text }) => {
|
|
4754
4773
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TabButton, { active, onPress, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TabText, { active, children: text }) });
|
|
4755
4774
|
};
|
|
4756
|
-
var TabButton =
|
|
4775
|
+
var TabButton = import_react_native_theming13.styled.TouchableOpacity(({ theme, active }) => ({
|
|
4757
4776
|
borderBottomWidth: active ? 2 : 0,
|
|
4758
4777
|
borderBottomColor: active ? theme.barSelectedColor : void 0,
|
|
4759
4778
|
overflow: "hidden",
|
|
@@ -4761,7 +4780,7 @@ var TabButton = import_react_native_theming10.styled.TouchableOpacity(({ theme,
|
|
|
4761
4780
|
justifyContent: "center",
|
|
4762
4781
|
alignItems: "center"
|
|
4763
4782
|
}));
|
|
4764
|
-
var TabText =
|
|
4783
|
+
var TabText = import_react_native_theming13.styled.Text(({ theme, active }) => ({
|
|
4765
4784
|
color: active ? theme.barSelectedColor : theme.color.mediumdark,
|
|
4766
4785
|
textAlign: "center",
|
|
4767
4786
|
fontWeight: "bold",
|
|
@@ -4776,14 +4795,14 @@ var Layout = ({
|
|
|
4776
4795
|
story,
|
|
4777
4796
|
children
|
|
4778
4797
|
}) => {
|
|
4779
|
-
const theme = (0,
|
|
4798
|
+
const theme = (0, import_react_native_theming15.useTheme)();
|
|
4780
4799
|
const mobileMenuDrawerRef = (0, import_react17.useRef)(null);
|
|
4781
4800
|
const [menuOpen, setMenuOpen] = (0, import_react17.useState)(false);
|
|
4782
4801
|
const [drawerOpen, setDrawerOpen] = (0, import_react17.useState)(false);
|
|
4783
4802
|
const addonPanelRef = (0, import_react17.useRef)(null);
|
|
4784
4803
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
4785
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4786
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_native8.View, { style: { flex: 1, paddingTop: insets.top, backgroundColor: theme.background.content }, children: [
|
|
4805
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_native8.View, { style: { flex: 1 }, children }),
|
|
4787
4806
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, onStateChange: setDrawerOpen, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4788
4807
|
Sidebar,
|
|
4789
4808
|
{
|
|
@@ -4802,7 +4821,7 @@ var Layout = ({
|
|
|
4802
4821
|
}
|
|
4803
4822
|
) }),
|
|
4804
4823
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id, onStateChange: setMenuOpen }),
|
|
4805
|
-
(
|
|
4824
|
+
(import_react_native8.Platform.OS !== "android" || !menuOpen && !drawerOpen) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Container3, { style: { marginBottom: insets.bottom }, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Nav, { children: [
|
|
4806
4825
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4807
4826
|
Button2,
|
|
4808
4827
|
{
|
|
@@ -4813,7 +4832,7 @@ var Layout = ({
|
|
|
4813
4832
|
},
|
|
4814
4833
|
children: [
|
|
4815
4834
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(MenuIcon, { color: theme.color.mediumdark }),
|
|
4816
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4835
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_react_native8.Text, { style: { flexShrink: 1, color: theme.color.defaultText }, numberOfLines: 1, children: [
|
|
4817
4836
|
story?.title,
|
|
4818
4837
|
"/",
|
|
4819
4838
|
story?.name
|
|
@@ -4831,7 +4850,7 @@ var Layout = ({
|
|
|
4831
4850
|
] }) })
|
|
4832
4851
|
] });
|
|
4833
4852
|
};
|
|
4834
|
-
var Nav =
|
|
4853
|
+
var Nav = import_react_native_theming15.styled.View({
|
|
4835
4854
|
display: "flex",
|
|
4836
4855
|
flexDirection: "row",
|
|
4837
4856
|
alignItems: "center",
|
|
@@ -4840,7 +4859,7 @@ var Nav = import_react_native_theming11.styled.View({
|
|
|
4840
4859
|
height: 40,
|
|
4841
4860
|
paddingHorizontal: 12
|
|
4842
4861
|
});
|
|
4843
|
-
var Container3 =
|
|
4862
|
+
var Container3 = import_react_native_theming15.styled.View(({ theme }) => ({
|
|
4844
4863
|
alignSelf: "flex-end",
|
|
4845
4864
|
width: "100%",
|
|
4846
4865
|
zIndex: 10,
|
|
@@ -4848,7 +4867,7 @@ var Container3 = import_react_native_theming11.styled.View(({ theme }) => ({
|
|
|
4848
4867
|
borderTopColor: theme.appBorderColor,
|
|
4849
4868
|
borderTopWidth: 1
|
|
4850
4869
|
}));
|
|
4851
|
-
var Button2 =
|
|
4870
|
+
var Button2 = import_react_native_theming15.styled.TouchableOpacity(({ theme }) => ({
|
|
4852
4871
|
display: "flex",
|
|
4853
4872
|
flexDirection: "row",
|
|
4854
4873
|
alignItems: "center",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native-ui",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0-alpha.0",
|
|
4
4
|
"description": "ui components for react native storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"typescript": "~5.3.3"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@storybook/core": "^8.
|
|
61
|
-
"@storybook/react": "^8.
|
|
62
|
-
"@storybook/react-native-theming": "^8.
|
|
60
|
+
"@storybook/core": "^8.3.0",
|
|
61
|
+
"@storybook/react": "^8.3.0",
|
|
62
|
+
"@storybook/react-native-theming": "^8.3.0-alpha.0",
|
|
63
63
|
"fuse.js": "^7.0.0",
|
|
64
64
|
"memoizerific": "^1.11.3",
|
|
65
65
|
"polished": "^4.3.1",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "b2629231f25c031146cdb880136d876852031e7b"
|
|
84
84
|
}
|
package/src/Button.tsx
CHANGED
|
@@ -111,13 +111,13 @@ const StyledButton = styled.TouchableOpacity<
|
|
|
111
111
|
|
|
112
112
|
backgroundColor: (() => {
|
|
113
113
|
if (variant === 'solid') return theme.color.secondary;
|
|
114
|
-
if (variant === 'outline') return theme.button
|
|
114
|
+
if (variant === 'outline') return theme.button.background;
|
|
115
115
|
if (variant === 'ghost' && active) return theme.background.hoverable;
|
|
116
116
|
|
|
117
117
|
return 'transparent';
|
|
118
118
|
})(),
|
|
119
119
|
|
|
120
|
-
boxShadow: variant === 'outline' ? `${theme.button
|
|
120
|
+
boxShadow: variant === 'outline' ? `${theme.button.border} 0 0 0 1px inset` : 'none',
|
|
121
121
|
borderRadius: theme.input.borderRadius,
|
|
122
122
|
// Making sure that the button never shrinks below its minimum size
|
|
123
123
|
flexShrink: 0,
|
package/src/Layout.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export const Layout = ({
|
|
|
32
32
|
const insets = useSafeAreaInsets();
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<View style={{ flex: 1, paddingTop: insets.top }}>
|
|
35
|
+
<View style={{ flex: 1, paddingTop: insets.top, backgroundColor: theme.background.content }}>
|
|
36
36
|
<View style={{ flex: 1 }}>{children}</View>
|
|
37
37
|
<MobileMenuDrawer ref={mobileMenuDrawerRef} onStateChange={setDrawerOpen}>
|
|
38
38
|
<Sidebar
|
|
@@ -63,7 +63,7 @@ export const Layout = ({
|
|
|
63
63
|
}}
|
|
64
64
|
>
|
|
65
65
|
<MenuIcon color={theme.color.mediumdark} />
|
|
66
|
-
<Text style={{ flexShrink: 1 }} numberOfLines={1}>
|
|
66
|
+
<Text style={{ flexShrink: 1, color: theme.color.defaultText }} numberOfLines={1}>
|
|
67
67
|
{story?.title}/{story?.name}
|
|
68
68
|
</Text>
|
|
69
69
|
</Button>
|
|
@@ -12,7 +12,7 @@ import Animated, {
|
|
|
12
12
|
useSharedValue,
|
|
13
13
|
} from 'react-native-reanimated';
|
|
14
14
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
15
|
-
|
|
15
|
+
import { useTheme } from '@storybook/react-native-theming';
|
|
16
16
|
import { IconButton } from './IconButton';
|
|
17
17
|
import { CloseIcon } from './icon/CloseIcon';
|
|
18
18
|
|
|
@@ -24,6 +24,7 @@ export const MobileAddonsPanel = forwardRef<
|
|
|
24
24
|
MobileAddonsPanelRef,
|
|
25
25
|
{ storyId?: string; onStateChange: (open: boolean) => void }
|
|
26
26
|
>(({ storyId, onStateChange }, ref) => {
|
|
27
|
+
const theme = useTheme();
|
|
27
28
|
const reducedMotion = useReducedMotion();
|
|
28
29
|
|
|
29
30
|
const addonsPanelBottomSheetRef = useRef<BottomSheetModal>(null);
|
|
@@ -73,9 +74,11 @@ export const MobileAddonsPanel = forwardRef<
|
|
|
73
74
|
containerStyle={{}}
|
|
74
75
|
backgroundStyle={{
|
|
75
76
|
borderRadius: 0,
|
|
76
|
-
borderTopColor:
|
|
77
|
+
borderTopColor: theme.appBorderColor,
|
|
77
78
|
borderTopWidth: 1,
|
|
79
|
+
backgroundColor: theme.background.content,
|
|
78
80
|
}}
|
|
81
|
+
handleIndicatorStyle={{ backgroundColor: theme.textMutedColor }}
|
|
79
82
|
keyboardBehavior="extend"
|
|
80
83
|
// keyboardBlurBehavior="restore"
|
|
81
84
|
enableDismissOnClose
|
|
@@ -84,12 +87,13 @@ export const MobileAddonsPanel = forwardRef<
|
|
|
84
87
|
stackBehavior="replace"
|
|
85
88
|
>
|
|
86
89
|
<Animated.View style={[{ flex: 1 }, adjustedBottomSheetSize]}>
|
|
87
|
-
<View
|
|
90
|
+
<View
|
|
91
|
+
style={{ flexDirection: 'row', borderBottomWidth: 1, borderBottomColor: 'lightgrey' }}
|
|
92
|
+
>
|
|
88
93
|
<ScrollView
|
|
89
94
|
horizontal
|
|
90
95
|
showsHorizontalScrollIndicator={false}
|
|
91
96
|
contentContainerStyle={{
|
|
92
|
-
paddingHorizontal: 8,
|
|
93
97
|
justifyContent: 'center',
|
|
94
98
|
}}
|
|
95
99
|
>
|
|
@@ -106,6 +110,7 @@ export const MobileAddonsPanel = forwardRef<
|
|
|
106
110
|
);
|
|
107
111
|
})}
|
|
108
112
|
</ScrollView>
|
|
113
|
+
|
|
109
114
|
<IconButton
|
|
110
115
|
style={{
|
|
111
116
|
marginRight: 4,
|
|
@@ -123,11 +128,9 @@ export const MobileAddonsPanel = forwardRef<
|
|
|
123
128
|
</View>
|
|
124
129
|
<ScrollView
|
|
125
130
|
style={{ flex: 1 }}
|
|
126
|
-
keyboardShouldPersistTaps="handled"
|
|
131
|
+
// keyboardShouldPersistTaps="handled"
|
|
127
132
|
contentContainerStyle={{
|
|
128
133
|
paddingBottom: insets.bottom + 16,
|
|
129
|
-
marginTop: 10,
|
|
130
|
-
paddingHorizontal: 16,
|
|
131
134
|
}}
|
|
132
135
|
>
|
|
133
136
|
{(() => {
|
package/src/MobileMenuDrawer.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { ReactNode, forwardRef, useImperativeHandle, useRef } from 'react';
|
|
|
8
8
|
import { Keyboard } from 'react-native';
|
|
9
9
|
import { useReducedMotion } from 'react-native-reanimated';
|
|
10
10
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
11
|
+
import { useTheme } from '@storybook/react-native-theming';
|
|
11
12
|
|
|
12
13
|
interface MobileMenuDrawerProps {
|
|
13
14
|
children: ReactNode | ReactNode[];
|
|
@@ -32,6 +33,7 @@ export const MobileMenuDrawer = forwardRef<MobileMenuDrawerRef, MobileMenuDrawer
|
|
|
32
33
|
({ children, onStateChange }, ref) => {
|
|
33
34
|
const reducedMotion = useReducedMotion();
|
|
34
35
|
const insets = useSafeAreaInsets();
|
|
36
|
+
const theme = useTheme();
|
|
35
37
|
|
|
36
38
|
const menuBottomSheetRef = useRef<BottomSheetModal>(null);
|
|
37
39
|
|
|
@@ -65,6 +67,8 @@ export const MobileMenuDrawer = forwardRef<MobileMenuDrawerRef, MobileMenuDrawer
|
|
|
65
67
|
keyboardBlurBehavior="restore"
|
|
66
68
|
stackBehavior="replace"
|
|
67
69
|
backdropComponent={BottomSheetBackdropComponent}
|
|
70
|
+
backgroundStyle={{ backgroundColor: theme.background.content }}
|
|
71
|
+
handleIndicatorStyle={{ backgroundColor: theme.textMutedColor }}
|
|
68
72
|
>
|
|
69
73
|
<BottomSheetScrollView
|
|
70
74
|
keyboardShouldPersistTaps="handled"
|
package/src/SearchResults.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import type { GetSearchItemProps, SearchResult, SearchResultProps } from './type
|
|
|
6
6
|
import { isExpandType } from './types';
|
|
7
7
|
|
|
8
8
|
import { FuseResultMatch } from 'fuse.js';
|
|
9
|
-
import { PressableProps,
|
|
9
|
+
import { PressableProps, View } from 'react-native';
|
|
10
10
|
import { Button } from './Button';
|
|
11
11
|
import { IconButton } from './IconButton';
|
|
12
12
|
import { ComponentIcon } from './icon/ComponentIcon';
|
|
@@ -28,7 +28,7 @@ const ResultRow = styled.TouchableOpacity<{ isHighlighted: boolean }>(
|
|
|
28
28
|
flexDirection: 'row',
|
|
29
29
|
alignItems: 'flex-start',
|
|
30
30
|
textAlign: 'left',
|
|
31
|
-
color:
|
|
31
|
+
color: theme.color.defaultText,
|
|
32
32
|
fontSize: theme.typography.size.s2,
|
|
33
33
|
backgroundColor: isHighlighted ? theme.background.hoverable : 'transparent',
|
|
34
34
|
minHeight: 28,
|
|
@@ -177,6 +177,10 @@ const Result: FC<SearchResultProps> = React.memo(function Result({
|
|
|
177
177
|
);
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
+
const Text = styled.Text(({ theme }) => ({
|
|
181
|
+
color: theme.color.defaultText,
|
|
182
|
+
}));
|
|
183
|
+
|
|
180
184
|
export const SearchResults: FC<{
|
|
181
185
|
query: string;
|
|
182
186
|
results: SearchResult[];
|
package/src/Tree.tsx
CHANGED
|
@@ -7,18 +7,18 @@ import type {
|
|
|
7
7
|
} from '@storybook/core/manager-api';
|
|
8
8
|
import { styled } from '@storybook/react-native-theming';
|
|
9
9
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
10
|
+
import { View } from 'react-native';
|
|
10
11
|
import { IconButton } from './IconButton';
|
|
12
|
+
import { useLayout } from './LayoutProvider';
|
|
11
13
|
import { ComponentNode, GroupNode, StoryNode } from './TreeNode';
|
|
14
|
+
import { CollapseAllIcon } from './icon/CollapseAllIcon';
|
|
12
15
|
import { CollapseIcon } from './icon/CollapseIcon';
|
|
16
|
+
import { ExpandAllIcon } from './icon/ExpandAllIcon';
|
|
17
|
+
import { Item } from './types';
|
|
13
18
|
import type { ExpandAction, ExpandedState } from './useExpanded';
|
|
14
19
|
import { useExpanded } from './useExpanded';
|
|
15
|
-
import { createId, getAncestorIds, getDescendantIds, isStoryHoistable } from './util/tree';
|
|
16
20
|
import { getGroupStatus, statusMapping } from './util/status';
|
|
17
|
-
import {
|
|
18
|
-
import { ExpandAllIcon } from './icon/ExpandAllIcon';
|
|
19
|
-
import { CollapseAllIcon } from './icon/CollapseAllIcon';
|
|
20
|
-
import { Item } from './types';
|
|
21
|
-
import { useLayout } from './LayoutProvider';
|
|
21
|
+
import { createId, getAncestorIds, getDescendantIds, isStoryHoistable } from './util/tree';
|
|
22
22
|
|
|
23
23
|
interface NodeProps {
|
|
24
24
|
item: Item;
|
|
@@ -36,6 +36,10 @@ interface NodeProps {
|
|
|
36
36
|
status: State['status'][keyof State['status']];
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
const TextItem = styled.Text(({ theme }) => ({
|
|
40
|
+
color: theme.color.defaultText,
|
|
41
|
+
}));
|
|
42
|
+
|
|
39
43
|
export const Node = React.memo<NodeProps>(function Node({
|
|
40
44
|
item,
|
|
41
45
|
refId,
|
|
@@ -90,7 +94,7 @@ export const Node = React.memo<NodeProps>(function Node({
|
|
|
90
94
|
aria-expanded={isExpanded}
|
|
91
95
|
>
|
|
92
96
|
<CollapseIcon isExpanded={isExpanded} />
|
|
93
|
-
<
|
|
97
|
+
<TextItem>{item.renderLabel?.(item, {}) || item.name}</TextItem>
|
|
94
98
|
</CollapseButton>
|
|
95
99
|
{isExpanded && (
|
|
96
100
|
<IconButton
|
package/src/TreeNode.tsx
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Path, Svg, SvgProps } from 'react-native-svg';
|
|
2
|
+
import { useTheme } from '@storybook/react-native-theming';
|
|
2
3
|
|
|
3
4
|
export const CollapseAllIcon = ({
|
|
4
|
-
color
|
|
5
|
+
color, //= '#2E3438',
|
|
5
6
|
width = 14,
|
|
6
7
|
height = 14,
|
|
7
8
|
...props
|
|
8
9
|
}: SvgProps) => {
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
|
|
9
12
|
return (
|
|
10
13
|
<Svg width={width} height={height} viewBox="0 0 14 14" fill="none" {...props}>
|
|
11
14
|
<Path
|
|
12
15
|
d="M3.354.146a.5.5 0 10-.708.708l4 4a.5.5 0 00.708 0l4-4a.5.5 0 00-.708-.708L7 3.793 3.354.146zM6.646 9.146a.5.5 0 01.708 0l4 4a.5.5 0 01-.708.708L7 10.207l-3.646 3.647a.5.5 0 01-.708-.708l4-4z"
|
|
13
|
-
fill={color}
|
|
16
|
+
fill={color ?? theme.color.defaultText}
|
|
14
17
|
/>
|
|
15
18
|
</Svg>
|
|
16
19
|
);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { styled } from '@storybook/react-native-theming';
|
|
2
2
|
import type { FC } from 'react';
|
|
3
|
-
import { transparentize } from 'polished';
|
|
4
3
|
import Svg, { Path, SvgProps } from 'react-native-svg';
|
|
5
4
|
|
|
6
5
|
interface CollapseIconProps {
|
|
@@ -14,7 +13,7 @@ export const CollapseIconWrapper = styled.View<{ isExpanded: boolean }>(
|
|
|
14
13
|
display: 'flex',
|
|
15
14
|
justifyContent: 'center',
|
|
16
15
|
alignItems: 'center',
|
|
17
|
-
color:
|
|
16
|
+
color: theme.textMutedColor,
|
|
18
17
|
transform: isExpanded ? 'rotateZ(90deg)' : 'none',
|
|
19
18
|
transition: 'transform .1s ease-out',
|
|
20
19
|
})
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { Path, Svg, SvgProps } from 'react-native-svg';
|
|
2
|
-
|
|
2
|
+
import { useTheme } from '@storybook/react-native-theming';
|
|
3
3
|
export const ExpandAllIcon = ({
|
|
4
|
-
color
|
|
4
|
+
color, //= '#2E3438',
|
|
5
5
|
width = 14,
|
|
6
6
|
height = 14,
|
|
7
7
|
...props
|
|
8
8
|
}: SvgProps) => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
|
|
9
11
|
return (
|
|
10
12
|
<Svg width={width} height={height} viewBox="0 0 14 14" fill="none" {...props}>
|
|
11
13
|
<Path
|
|
12
14
|
d="M7.354.146l4 4a.5.5 0 01-.708.708L7 1.207 3.354 4.854a.5.5 0 11-.708-.708l4-4a.5.5 0 01.708 0zM11.354 9.146a.5.5 0 010 .708l-4 4a.5.5 0 01-.708 0l-4-4a.5.5 0 11.708-.708L7 12.793l3.646-3.647a.5.5 0 01.708 0z"
|
|
13
|
-
fill={color}
|
|
15
|
+
fill={color ?? theme.color.defaultText}
|
|
14
16
|
/>
|
|
15
17
|
</Svg>
|
|
16
18
|
);
|