@ankhorage/zora 28.6.11 → 28.7.1
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/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/capabilities/index.js +21 -3
- package/dist/capabilities/index.js.map +3 -3
- package/dist/features/master-detail/adapters/inbound/MasterDetail.js +21 -10
- package/dist/features/master-detail/adapters/inbound/MasterDetail.js.map +1 -1
- package/dist/features/master-detail/masterDetailMeta.d.ts +15 -1
- package/dist/features/master-detail/masterDetailMeta.d.ts.map +1 -1
- package/dist/features/master-detail/masterDetailMeta.js +20 -2
- package/dist/features/master-detail/masterDetailMeta.js.map +1 -1
- package/dist/types/master-detail.d.ts +4 -0
- package/dist/types/master-detail.d.ts.map +1 -1
- package/dist/types/master-detail.js.map +1 -1
- package/package.json +2 -2
- package/src/features/master-detail/adapters/inbound/MasterDetail.runtime.test.tsx +38 -0
- package/src/features/master-detail/adapters/inbound/MasterDetail.tsx +34 -19
- package/src/features/master-detail/masterDetailMeta.ts +20 -2
- package/src/features/registry/componentMeta.test.ts +2 -0
- package/src/types/master-detail.ts +4 -0
- package/web-dist/components/master-detail/MasterDetail.js +30 -6
- package/web-dist/components/master-detail/MasterDetail.types-0.d.ts +4 -0
- package/web-dist/runtime/ZoraProvider.js +6 -2
|
@@ -6,11 +6,11 @@ import { resolveMasterDetailPresentation } from '../../application/resolveMaster
|
|
|
6
6
|
/** Renders responsive master and detail panes while leaving route transitions to the host. */
|
|
7
7
|
export const MasterDetail = withZoraThemeScope(MasterDetailInner);
|
|
8
8
|
/*** Projects the first two children into a desktop split or one compact route pane. */
|
|
9
|
-
function MasterDetailInner({ themeId: _themeId, mode: _mode, interactionPolicy: _interactionPolicy, activePane = 'master', desktopMode = 'split', children, masterWidth = 30, testID, }) {
|
|
9
|
+
function MasterDetailInner({ themeId: _themeId, mode: _mode, interactionPolicy: _interactionPolicy, activePane = 'master', desktopMode = 'split', children, masterWidth = 30, masterScroll = true, detailScroll = true, testID, }) {
|
|
10
10
|
const presentation = resolveMasterDetailPresentation(useBreakpoint(), activePane, desktopMode);
|
|
11
11
|
const [master, detail] = React.Children.toArray(children);
|
|
12
|
-
const masterPane = <MasterPane master={master} testID={testID}/>;
|
|
13
|
-
const detailPane = <DetailPane detail={detail} testID={testID}/>;
|
|
12
|
+
const masterPane = <MasterPane master={master} scroll={masterScroll} testID={testID}/>;
|
|
13
|
+
const detailPane = <DetailPane detail={detail} scroll={detailScroll} testID={testID}/>;
|
|
14
14
|
if (presentation === 'master')
|
|
15
15
|
return masterPane;
|
|
16
16
|
if (presentation === 'detail')
|
|
@@ -24,16 +24,27 @@ function MasterDetailInner({ themeId: _themeId, mode: _mode, interactionPolicy:
|
|
|
24
24
|
</View>
|
|
25
25
|
</View>);
|
|
26
26
|
}
|
|
27
|
-
/*** Provides the independently bounded master
|
|
28
|
-
function MasterPane({ master, testID, }) {
|
|
29
|
-
return (<
|
|
27
|
+
/*** Provides the independently bounded master pane, scrolling unless the host owns its scrolling. */
|
|
28
|
+
function MasterPane({ master, scroll, testID, }) {
|
|
29
|
+
return (<PaneRegion scroll={scroll} testID={testID ? `${testID}-master` : undefined}>
|
|
30
30
|
{master}
|
|
31
|
-
</
|
|
31
|
+
</PaneRegion>);
|
|
32
32
|
}
|
|
33
|
-
/*** Provides the independently bounded detail
|
|
34
|
-
function DetailPane({ detail, testID, }) {
|
|
35
|
-
return (<
|
|
33
|
+
/*** Provides the independently bounded detail pane, scrolling unless the host owns its scrolling. */
|
|
34
|
+
function DetailPane({ detail, scroll, testID, }) {
|
|
35
|
+
return (<PaneRegion scroll={scroll} testID={testID ? `${testID}-detail` : undefined}>
|
|
36
36
|
{detail}
|
|
37
|
+
</PaneRegion>);
|
|
38
|
+
}
|
|
39
|
+
/*** Fills the available area with a scroll region, or a bounded flex container when not scrolling. */
|
|
40
|
+
function PaneRegion({ children, scroll, testID, }) {
|
|
41
|
+
if (!scroll) {
|
|
42
|
+
return (<View flex={1} minHeight={0} minWidth={0} testID={testID}>
|
|
43
|
+
{children}
|
|
44
|
+
</View>);
|
|
45
|
+
}
|
|
46
|
+
return (<ScrollView flex={1} minHeight={0} minWidth={0} testID={testID}>
|
|
47
|
+
{children}
|
|
37
48
|
</ScrollView>);
|
|
38
49
|
}
|
|
39
50
|
//# sourceMappingURL=MasterDetail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MasterDetail.js","sourceRoot":"","sources":["../../../../../src/features/master-detail/adapters/inbound/MasterDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AAEpG,8FAA8F;AAC9F,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC;AAElE,uFAAuF;AACvF,SAAS,iBAAiB,CAAC,EACzB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,iBAAiB,EAAE,kBAAkB,EACrC,UAAU,GAAG,QAAQ,EACrB,WAAW,GAAG,OAAO,EACrB,QAAQ,EACR,WAAW,GAAG,EAAE,EAChB,MAAM,GACY;IAClB,MAAM,YAAY,GAAG,+BAA+B,CAAC,aAAa,EAAE,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IAC/F,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAG,C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C,CAAC,GAAG,MAAM,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAC1E;MAAA,CAAC,MAAM,CACT;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC;AAED,sGAAsG;AACtG,SAAS,UAAU,CAAC,EAClB,QAAQ,EACR,MAAM,EACN,MAAM,GACwD;IAC9D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CACvD;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,IAAI,CAAC,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAC7D;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC","sourcesContent":["import { useBreakpoint } from '@ankhorage/surface';\nimport React from 'react';\n\nimport type { MasterDetailProps } from '../../../../types/master-detail';\nimport { ScrollView, View } from '../../../layout/public';\nimport { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';\nimport { resolveMasterDetailPresentation } from '../../application/resolveMasterDetailPresentation';\n\n/** Renders responsive master and detail panes while leaving route transitions to the host. */\nexport const MasterDetail = withZoraThemeScope(MasterDetailInner);\n\n/*** Projects the first two children into a desktop split or one compact route pane. */\nfunction MasterDetailInner({\n themeId: _themeId,\n mode: _mode,\n interactionPolicy: _interactionPolicy,\n activePane = 'master',\n desktopMode = 'split',\n children,\n masterWidth = 30,\n masterScroll = true,\n detailScroll = true,\n testID,\n}: MasterDetailProps) {\n const presentation = resolveMasterDetailPresentation(useBreakpoint(), activePane, desktopMode);\n const [master, detail] = React.Children.toArray(children);\n const masterPane = <MasterPane master={master} scroll={masterScroll} testID={testID} />;\n const detailPane = <DetailPane detail={detail} scroll={detailScroll} testID={testID} />;\n\n if (presentation === 'master') return masterPane;\n if (presentation === 'detail') return detailPane;\n\n return (\n <View direction=\"row\" flex={1} minHeight={0} minWidth={0} testID={testID}>\n <View flex={masterWidth} minHeight={0} minWidth={0}>\n {masterPane}\n </View>\n <View flex={100 - masterWidth} minHeight={0} minWidth={0}>\n {detailPane}\n </View>\n </View>\n );\n}\n\n/*** Provides the independently bounded master pane, scrolling unless the host owns its scrolling. */\nfunction MasterPane({\n master,\n scroll,\n testID,\n}: Pick<MasterDetailProps, 'testID'> & { master?: React.ReactNode; scroll: boolean }) {\n return (\n <PaneRegion scroll={scroll} testID={testID ? `${testID}-master` : undefined}>\n {master}\n </PaneRegion>\n );\n}\n\n/*** Provides the independently bounded detail pane, scrolling unless the host owns its scrolling. */\nfunction DetailPane({\n detail,\n scroll,\n testID,\n}: Pick<MasterDetailProps, 'testID'> & { detail?: React.ReactNode; scroll: boolean }) {\n return (\n <PaneRegion scroll={scroll} testID={testID ? `${testID}-detail` : undefined}>\n {detail}\n </PaneRegion>\n );\n}\n\n/*** Fills the available area with a scroll region, or a bounded flex container when not scrolling. */\nfunction PaneRegion({\n children,\n scroll,\n testID,\n}: React.PropsWithChildren<{ scroll: boolean; testID?: string }>) {\n if (!scroll) {\n return (\n <View flex={1} minHeight={0} minWidth={0} testID={testID}>\n {children}\n </View>\n );\n }\n\n return (\n <ScrollView flex={1} minHeight={0} minWidth={0} testID={testID}>\n {children}\n </ScrollView>\n );\n}\n"]}
|
|
@@ -3,13 +3,15 @@ export declare const masterDetailMeta: {
|
|
|
3
3
|
readonly category: "layout";
|
|
4
4
|
readonly directManifestNode: true;
|
|
5
5
|
readonly allowedChildren: readonly ["ActivityIndicator", "Audio", "AuthScreen", "ForgotPasswordForm", "OAuthProviderButton", "OAuthProviderList", "OtpForm", "SignInForm", "SignUpForm", "Accordion", "Surface", "Avatar", "AvatarGroup", "Badge", "MediaCard", "MetricCard", "Chip", "ChipGroup", "DataTable", "DatePicker", "Dialog", "Pagination", "Rating", "SearchInput", "Tabs", "Toolbar", "Skeleton", "SkeletonCard", "SkeletonList", "SkeletonText", "IconButton", "Uploader", "MediaExplorer", "FileExplorer", "FlatList", "SectionList", "BottomSheet", "ProductCard", "View", "ScrollView", "Grid", "Gradient", "Divider", "Text", "Heading", "Icon", "Image", "Hero", "KeyboardAvoidingView", "Link", "MasterDetail", "Button", "ButtonGroup", "RadioGroup", "ThemeModeToggle", "TextInput", "RichText", "TimePicker", "Timeline", "Form", "Card", "EmptyState", "SectionHeader", "PostCard", "ChatListItem", "MessageBubble", "ProgressRing", "Reader", "ContentRail", "MissingElement", "Video"];
|
|
6
|
-
readonly description: "Responsive visual projection for host-owned list and detail routes. Its first child is the master list and its second child is the detail pane. Place it as a direct child of a non-scrolling Screen. On expanded widths it displays both in independently
|
|
6
|
+
readonly description: "Responsive visual projection for host-owned list and detail routes. Its first child is the master list and its second child is the detail pane. Place it as a direct child of a non-scrolling Screen. On expanded widths it displays both in independently bounded panes that scroll by default; set masterScroll or detailScroll to false to give a pane bounded, non-scrolling space for children with flex: 1 that own their scrolling; on compact widths it displays the pane selected by activePane.";
|
|
7
7
|
readonly blueprint: {
|
|
8
8
|
readonly label: "Master detail";
|
|
9
9
|
readonly defaultProps: {
|
|
10
10
|
readonly activePane: "master";
|
|
11
11
|
readonly desktopMode: "split";
|
|
12
12
|
readonly masterWidth: 30;
|
|
13
|
+
readonly masterScroll: true;
|
|
14
|
+
readonly detailScroll: true;
|
|
13
15
|
};
|
|
14
16
|
};
|
|
15
17
|
readonly bindings: {
|
|
@@ -47,6 +49,18 @@ export declare const masterDetailMeta: {
|
|
|
47
49
|
readonly enum: readonly [25, 30, 35, 40];
|
|
48
50
|
readonly default: 30;
|
|
49
51
|
};
|
|
52
|
+
readonly masterScroll: {
|
|
53
|
+
readonly type: "boolean";
|
|
54
|
+
readonly category: "Layout";
|
|
55
|
+
readonly label: "Scroll master";
|
|
56
|
+
readonly default: true;
|
|
57
|
+
};
|
|
58
|
+
readonly detailScroll: {
|
|
59
|
+
readonly type: "boolean";
|
|
60
|
+
readonly category: "Layout";
|
|
61
|
+
readonly label: "Scroll detail";
|
|
62
|
+
readonly default: true;
|
|
63
|
+
};
|
|
50
64
|
};
|
|
51
65
|
};
|
|
52
66
|
//# sourceMappingURL=masterDetailMeta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterDetailMeta.d.ts","sourceRoot":"","sources":["../../../src/features/master-detail/masterDetailMeta.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"masterDetailMeta.d.ts","sourceRoot":"","sources":["../../../src/features/master-detail/masterDetailMeta.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DS,CAAC"}
|
|
@@ -4,10 +4,16 @@ export const masterDetailMeta = {
|
|
|
4
4
|
category: 'layout',
|
|
5
5
|
directManifestNode: true,
|
|
6
6
|
allowedChildren: [...CONTAINER_ALLOWED_CHILDREN],
|
|
7
|
-
description: 'Responsive visual projection for host-owned list and detail routes. Its first child is the master list and its second child is the detail pane. Place it as a direct child of a non-scrolling Screen. On expanded widths it displays both in independently
|
|
7
|
+
description: 'Responsive visual projection for host-owned list and detail routes. Its first child is the master list and its second child is the detail pane. Place it as a direct child of a non-scrolling Screen. On expanded widths it displays both in independently bounded panes that scroll by default; set masterScroll or detailScroll to false to give a pane bounded, non-scrolling space for children with flex: 1 that own their scrolling; on compact widths it displays the pane selected by activePane.',
|
|
8
8
|
blueprint: {
|
|
9
9
|
label: 'Master detail',
|
|
10
|
-
defaultProps: {
|
|
10
|
+
defaultProps: {
|
|
11
|
+
activePane: 'master',
|
|
12
|
+
desktopMode: 'split',
|
|
13
|
+
masterWidth: 30,
|
|
14
|
+
masterScroll: true,
|
|
15
|
+
detailScroll: true,
|
|
16
|
+
},
|
|
11
17
|
},
|
|
12
18
|
bindings: {
|
|
13
19
|
props: {
|
|
@@ -42,6 +48,18 @@ export const masterDetailMeta = {
|
|
|
42
48
|
enum: [25, 30, 35, 40],
|
|
43
49
|
default: 30,
|
|
44
50
|
},
|
|
51
|
+
masterScroll: {
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
category: 'Layout',
|
|
54
|
+
label: 'Scroll master',
|
|
55
|
+
default: true,
|
|
56
|
+
},
|
|
57
|
+
detailScroll: {
|
|
58
|
+
type: 'boolean',
|
|
59
|
+
category: 'Layout',
|
|
60
|
+
label: 'Scroll detail',
|
|
61
|
+
default: true,
|
|
62
|
+
},
|
|
45
63
|
},
|
|
46
64
|
};
|
|
47
65
|
//# sourceMappingURL=masterDetailMeta.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masterDetailMeta.js","sourceRoot":"","sources":["../../../src/features/master-detail/masterDetailMeta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAGvE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,QAAQ;IAClB,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,CAAC,GAAG,0BAA0B,CAAC;IAChD,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"masterDetailMeta.js","sourceRoot":"","sources":["../../../src/features/master-detail/masterDetailMeta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAGvE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,QAAQ;IAClB,kBAAkB,EAAE,IAA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;YAClB,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,IAAI;SACd;KACF;CACmC,CAAC","sourcesContent":["import { CONTAINER_ALLOWED_CHILDREN } from '../../constants/authoring';\nimport type { ZoraComponentMeta } from '../../types/authoring';\n\nexport const masterDetailMeta = {\n name: 'MasterDetail',\n category: 'layout',\n directManifestNode: true,\n allowedChildren: [...CONTAINER_ALLOWED_CHILDREN],\n description:\n 'Responsive visual projection for host-owned list and detail routes. Its first child is the master list and its second child is the detail pane. Place it as a direct child of a non-scrolling Screen. On expanded widths it displays both in independently bounded panes that scroll by default; set masterScroll or detailScroll to false to give a pane bounded, non-scrolling space for children with flex: 1 that own their scrolling; on compact widths it displays the pane selected by activePane.',\n blueprint: {\n label: 'Master detail',\n defaultProps: {\n activePane: 'master',\n desktopMode: 'split',\n masterWidth: 30,\n masterScroll: true,\n detailScroll: true,\n },\n },\n bindings: {\n props: {\n activePane: {\n label: 'Active compact pane',\n description: 'Bind this to host-owned list or detail route state; ZORA does not navigate.',\n value: { type: 'string' },\n acceptsFallback: true,\n acceptsTransforms: true,\n },\n },\n },\n props: {\n activePane: {\n type: 'enum',\n category: 'Navigation',\n label: 'Active compact pane',\n enum: ['master', 'detail'],\n default: 'master',\n },\n desktopMode: {\n type: 'enum',\n category: 'Layout',\n label: 'Desktop mode',\n enum: ['split', 'master'],\n default: 'split',\n },\n masterWidth: {\n type: 'enum',\n category: 'Layout',\n label: 'Master width percent',\n enum: [25, 30, 35, 40],\n default: 30,\n },\n masterScroll: {\n type: 'boolean',\n category: 'Layout',\n label: 'Scroll master',\n default: true,\n },\n detailScroll: {\n type: 'boolean',\n category: 'Layout',\n label: 'Scroll detail',\n default: true,\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -17,5 +17,9 @@ export interface MasterDetailProps extends ZoraBaseProps {
|
|
|
17
17
|
activePane?: MasterDetailActivePane;
|
|
18
18
|
desktopMode?: MasterDetailDesktopMode;
|
|
19
19
|
masterWidth?: MasterDetailMasterWidth;
|
|
20
|
+
/** Scrolls the master pane. Set false for bounded content that owns its own scrolling. */
|
|
21
|
+
masterScroll?: boolean;
|
|
22
|
+
/** Scrolls the detail pane. Set false for bounded content, such as a nested app, that owns its own scrolling. */
|
|
23
|
+
detailScroll?: boolean;
|
|
20
24
|
}
|
|
21
25
|
//# sourceMappingURL=master-detail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"master-detail.d.ts","sourceRoot":"","sources":["../../src/types/master-detail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,sEAAsE;AACtE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD,6EAA6E;AAC7E,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzD,kEAAkE;AAClE,MAAM,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,kFAAkF;IAClF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,WAAW,CAAC,EAAE,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"master-detail.d.ts","sourceRoot":"","sources":["../../src/types/master-detail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,sEAAsE;AACtE,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEzD,6EAA6E;AAC7E,MAAM,MAAM,uBAAuB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzD,kEAAkE;AAClE,MAAM,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,kFAAkF;IAClF,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,sBAAsB,CAAC;IACpC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,0FAA0F;IAC1F,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iHAAiH;IACjH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"master-detail.js","sourceRoot":"","sources":["../../src/types/master-detail.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ZoraBaseProps } from './base';\n\n/** Identifies the compact pane selected by host-owned route state. */\nexport type MasterDetailActivePane = 'master' | 'detail';\n\n/** Controls the expanded-width presentation without changing route state. */\nexport type MasterDetailDesktopMode = 'split' | 'master';\n\n/** Limits the master column to readable workspace proportions. */\nexport type MasterDetailMasterWidth = 25 | 30 | 35 | 40;\n\n/**\n * Presentation-only workspace composition. Place it as a direct child of a non-scrolling Screen\n * so its panes own bounded scrolling. The host supplies activePane from its route state; ZORA\n * never creates routes or handles back navigation.\n */\nexport interface MasterDetailProps extends ZoraBaseProps {\n /** The first child is the master pane and the second child is the detail pane. */\n children?: React.ReactNode;\n activePane?: MasterDetailActivePane;\n desktopMode?: MasterDetailDesktopMode;\n masterWidth?: MasterDetailMasterWidth;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"master-detail.js","sourceRoot":"","sources":["../../src/types/master-detail.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\n\nimport type { ZoraBaseProps } from './base';\n\n/** Identifies the compact pane selected by host-owned route state. */\nexport type MasterDetailActivePane = 'master' | 'detail';\n\n/** Controls the expanded-width presentation without changing route state. */\nexport type MasterDetailDesktopMode = 'split' | 'master';\n\n/** Limits the master column to readable workspace proportions. */\nexport type MasterDetailMasterWidth = 25 | 30 | 35 | 40;\n\n/**\n * Presentation-only workspace composition. Place it as a direct child of a non-scrolling Screen\n * so its panes own bounded scrolling. The host supplies activePane from its route state; ZORA\n * never creates routes or handles back navigation.\n */\nexport interface MasterDetailProps extends ZoraBaseProps {\n /** The first child is the master pane and the second child is the detail pane. */\n children?: React.ReactNode;\n activePane?: MasterDetailActivePane;\n desktopMode?: MasterDetailDesktopMode;\n masterWidth?: MasterDetailMasterWidth;\n /** Scrolls the master pane. Set false for bounded content that owns its own scrolling. */\n masterScroll?: boolean;\n /** Scrolls the detail pane. Set false for bounded content, such as a nested app, that owns its own scrolling. */\n detailScroll?: boolean;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/zora",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "28.
|
|
4
|
+
"version": "28.7.1",
|
|
5
5
|
"description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/zora#readme",
|
|
7
7
|
"bugs": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@ankhorage/grid-view": "^0.5.0",
|
|
51
51
|
"@ankhorage/reader": "^0.1.4",
|
|
52
52
|
"@ankhorage/runtime": "^5.8.1",
|
|
53
|
-
"@ankhorage/surface": "^9.8.
|
|
53
|
+
"@ankhorage/surface": "^9.8.10",
|
|
54
54
|
"@ankhorage/utility": "^1.11.0",
|
|
55
55
|
"expo-asset": "~57.0.21",
|
|
56
56
|
"expo-audio": "~57.0.5",
|
|
@@ -120,3 +120,41 @@ test('projects the same Runtime children through host-owned compact pane state',
|
|
|
120
120
|
expect(markup).toContain('data-scroll="workspace-detail"');
|
|
121
121
|
expect(markup).not.toContain('data-scroll="workspace-master"');
|
|
122
122
|
});
|
|
123
|
+
|
|
124
|
+
test('renders non-scrolling bounded panes when masterScroll and detailScroll are false', () => {
|
|
125
|
+
runtimeEnvironment.breakpoint = 'md';
|
|
126
|
+
const markup = renderWorkspace({
|
|
127
|
+
...workspaceNode,
|
|
128
|
+
children: [
|
|
129
|
+
{
|
|
130
|
+
...workspaceNode.children[0],
|
|
131
|
+
props: { ...workspaceNode.children[0].props, masterScroll: false, detailScroll: false },
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
expect(markup).toContain('Master content');
|
|
137
|
+
expect(markup).toContain('Detail content');
|
|
138
|
+
expect(markup).not.toContain('data-scroll="workspace-master"');
|
|
139
|
+
expect(markup).not.toContain('data-scroll="workspace-detail"');
|
|
140
|
+
expect(markup).toContain('data-view="workspace-master"');
|
|
141
|
+
expect(markup).toContain('data-view="workspace-detail"');
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test('keeps the compact detail pane bounded without scrolling', () => {
|
|
145
|
+
runtimeEnvironment.breakpoint = 'base';
|
|
146
|
+
const markup = renderWorkspace({
|
|
147
|
+
...workspaceNode,
|
|
148
|
+
children: [
|
|
149
|
+
{
|
|
150
|
+
...workspaceNode.children[0],
|
|
151
|
+
props: { ...workspaceNode.children[0].props, activePane: 'detail', detailScroll: false },
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
expect(markup).not.toContain('Master content');
|
|
157
|
+
expect(markup).toContain('Detail content');
|
|
158
|
+
expect(markup).toContain('data-view="workspace-detail"');
|
|
159
|
+
expect(markup).not.toContain('data-scroll="workspace-detail"');
|
|
160
|
+
});
|
|
@@ -18,12 +18,14 @@ function MasterDetailInner({
|
|
|
18
18
|
desktopMode = 'split',
|
|
19
19
|
children,
|
|
20
20
|
masterWidth = 30,
|
|
21
|
+
masterScroll = true,
|
|
22
|
+
detailScroll = true,
|
|
21
23
|
testID,
|
|
22
24
|
}: MasterDetailProps) {
|
|
23
25
|
const presentation = resolveMasterDetailPresentation(useBreakpoint(), activePane, desktopMode);
|
|
24
26
|
const [master, detail] = React.Children.toArray(children);
|
|
25
|
-
const masterPane = <MasterPane master={master} testID={testID} />;
|
|
26
|
-
const detailPane = <DetailPane detail={detail} testID={testID} />;
|
|
27
|
+
const masterPane = <MasterPane master={master} scroll={masterScroll} testID={testID} />;
|
|
28
|
+
const detailPane = <DetailPane detail={detail} scroll={detailScroll} testID={testID} />;
|
|
27
29
|
|
|
28
30
|
if (presentation === 'master') return masterPane;
|
|
29
31
|
if (presentation === 'detail') return detailPane;
|
|
@@ -40,36 +42,49 @@ function MasterDetailInner({
|
|
|
40
42
|
);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
/*** Provides the independently bounded master
|
|
45
|
+
/*** Provides the independently bounded master pane, scrolling unless the host owns its scrolling. */
|
|
44
46
|
function MasterPane({
|
|
45
47
|
master,
|
|
48
|
+
scroll,
|
|
46
49
|
testID,
|
|
47
|
-
}: Pick<MasterDetailProps, 'testID'> & { master?: React.ReactNode }) {
|
|
50
|
+
}: Pick<MasterDetailProps, 'testID'> & { master?: React.ReactNode; scroll: boolean }) {
|
|
48
51
|
return (
|
|
49
|
-
<
|
|
50
|
-
flex={1}
|
|
51
|
-
minHeight={0}
|
|
52
|
-
minWidth={0}
|
|
53
|
-
testID={testID ? `${testID}-master` : undefined}
|
|
54
|
-
>
|
|
52
|
+
<PaneRegion scroll={scroll} testID={testID ? `${testID}-master` : undefined}>
|
|
55
53
|
{master}
|
|
56
|
-
</
|
|
54
|
+
</PaneRegion>
|
|
57
55
|
);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
/*** Provides the independently bounded detail
|
|
58
|
+
/*** Provides the independently bounded detail pane, scrolling unless the host owns its scrolling. */
|
|
61
59
|
function DetailPane({
|
|
62
60
|
detail,
|
|
61
|
+
scroll,
|
|
63
62
|
testID,
|
|
64
|
-
}: Pick<MasterDetailProps, 'testID'> & { detail?: React.ReactNode }) {
|
|
63
|
+
}: Pick<MasterDetailProps, 'testID'> & { detail?: React.ReactNode; scroll: boolean }) {
|
|
65
64
|
return (
|
|
66
|
-
<
|
|
67
|
-
flex={1}
|
|
68
|
-
minHeight={0}
|
|
69
|
-
minWidth={0}
|
|
70
|
-
testID={testID ? `${testID}-detail` : undefined}
|
|
71
|
-
>
|
|
65
|
+
<PaneRegion scroll={scroll} testID={testID ? `${testID}-detail` : undefined}>
|
|
72
66
|
{detail}
|
|
67
|
+
</PaneRegion>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/*** Fills the available area with a scroll region, or a bounded flex container when not scrolling. */
|
|
72
|
+
function PaneRegion({
|
|
73
|
+
children,
|
|
74
|
+
scroll,
|
|
75
|
+
testID,
|
|
76
|
+
}: React.PropsWithChildren<{ scroll: boolean; testID?: string }>) {
|
|
77
|
+
if (!scroll) {
|
|
78
|
+
return (
|
|
79
|
+
<View flex={1} minHeight={0} minWidth={0} testID={testID}>
|
|
80
|
+
{children}
|
|
81
|
+
</View>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<ScrollView flex={1} minHeight={0} minWidth={0} testID={testID}>
|
|
87
|
+
{children}
|
|
73
88
|
</ScrollView>
|
|
74
89
|
);
|
|
75
90
|
}
|
|
@@ -7,10 +7,16 @@ export const masterDetailMeta = {
|
|
|
7
7
|
directManifestNode: true,
|
|
8
8
|
allowedChildren: [...CONTAINER_ALLOWED_CHILDREN],
|
|
9
9
|
description:
|
|
10
|
-
'Responsive visual projection for host-owned list and detail routes. Its first child is the master list and its second child is the detail pane. Place it as a direct child of a non-scrolling Screen. On expanded widths it displays both in independently
|
|
10
|
+
'Responsive visual projection for host-owned list and detail routes. Its first child is the master list and its second child is the detail pane. Place it as a direct child of a non-scrolling Screen. On expanded widths it displays both in independently bounded panes that scroll by default; set masterScroll or detailScroll to false to give a pane bounded, non-scrolling space for children with flex: 1 that own their scrolling; on compact widths it displays the pane selected by activePane.',
|
|
11
11
|
blueprint: {
|
|
12
12
|
label: 'Master detail',
|
|
13
|
-
defaultProps: {
|
|
13
|
+
defaultProps: {
|
|
14
|
+
activePane: 'master',
|
|
15
|
+
desktopMode: 'split',
|
|
16
|
+
masterWidth: 30,
|
|
17
|
+
masterScroll: true,
|
|
18
|
+
detailScroll: true,
|
|
19
|
+
},
|
|
14
20
|
},
|
|
15
21
|
bindings: {
|
|
16
22
|
props: {
|
|
@@ -45,5 +51,17 @@ export const masterDetailMeta = {
|
|
|
45
51
|
enum: [25, 30, 35, 40],
|
|
46
52
|
default: 30,
|
|
47
53
|
},
|
|
54
|
+
masterScroll: {
|
|
55
|
+
type: 'boolean',
|
|
56
|
+
category: 'Layout',
|
|
57
|
+
label: 'Scroll master',
|
|
58
|
+
default: true,
|
|
59
|
+
},
|
|
60
|
+
detailScroll: {
|
|
61
|
+
type: 'boolean',
|
|
62
|
+
category: 'Layout',
|
|
63
|
+
label: 'Scroll detail',
|
|
64
|
+
default: true,
|
|
65
|
+
},
|
|
48
66
|
},
|
|
49
67
|
} as const satisfies ZoraComponentMeta;
|
|
@@ -564,6 +564,8 @@ describe('ZORA_COMPONENT_META invariants', () => {
|
|
|
564
564
|
expect(masterDetail.allowedChildren).toEqual(CONTAINER_ALLOWED_CHILDREN);
|
|
565
565
|
expect(masterDetail.props.activePane?.enum).toEqual(['master', 'detail']);
|
|
566
566
|
expect(masterDetail.props.masterWidth?.enum).toEqual([25, 30, 35, 40]);
|
|
567
|
+
expect(masterDetail.props.masterScroll).toMatchObject({ type: 'boolean', default: true });
|
|
568
|
+
expect(masterDetail.props.detailScroll).toMatchObject({ type: 'boolean', default: true });
|
|
567
569
|
expect(masterDetail.slots).toBeUndefined();
|
|
568
570
|
expect(masterDetail.bindings?.props?.activePane).toMatchObject({
|
|
569
571
|
acceptsFallback: true,
|
|
@@ -22,4 +22,8 @@ export interface MasterDetailProps extends ZoraBaseProps {
|
|
|
22
22
|
activePane?: MasterDetailActivePane;
|
|
23
23
|
desktopMode?: MasterDetailDesktopMode;
|
|
24
24
|
masterWidth?: MasterDetailMasterWidth;
|
|
25
|
+
/** Scrolls the master pane. Set false for bounded content that owns its own scrolling. */
|
|
26
|
+
masterScroll?: boolean;
|
|
27
|
+
/** Scrolls the detail pane. Set false for bounded content, such as a nested app, that owns its own scrolling. */
|
|
28
|
+
detailScroll?: boolean;
|
|
25
29
|
}
|
|
@@ -43,16 +43,20 @@ function MasterDetailInner({
|
|
|
43
43
|
desktopMode = "split",
|
|
44
44
|
children,
|
|
45
45
|
masterWidth = 30,
|
|
46
|
+
masterScroll = true,
|
|
47
|
+
detailScroll = true,
|
|
46
48
|
testID
|
|
47
49
|
}) {
|
|
48
50
|
const presentation = resolveMasterDetailPresentation(useBreakpoint(), activePane, desktopMode);
|
|
49
51
|
const [master, detail] = React.Children.toArray(children);
|
|
50
52
|
const masterPane = /* @__PURE__ */ jsx(MasterPane, {
|
|
51
53
|
master,
|
|
54
|
+
scroll: masterScroll,
|
|
52
55
|
testID
|
|
53
56
|
});
|
|
54
57
|
const detailPane = /* @__PURE__ */ jsx(DetailPane, {
|
|
55
58
|
detail,
|
|
59
|
+
scroll: detailScroll,
|
|
56
60
|
testID
|
|
57
61
|
});
|
|
58
62
|
if (presentation === "master")
|
|
@@ -83,26 +87,46 @@ function MasterDetailInner({
|
|
|
83
87
|
}
|
|
84
88
|
function MasterPane({
|
|
85
89
|
master,
|
|
90
|
+
scroll,
|
|
86
91
|
testID
|
|
87
92
|
}) {
|
|
88
|
-
return /* @__PURE__ */ jsx(
|
|
89
|
-
|
|
90
|
-
minHeight: 0,
|
|
91
|
-
minWidth: 0,
|
|
93
|
+
return /* @__PURE__ */ jsx(PaneRegion, {
|
|
94
|
+
scroll,
|
|
92
95
|
testID: testID ? `${testID}-master` : undefined,
|
|
93
96
|
children: master
|
|
94
97
|
});
|
|
95
98
|
}
|
|
96
99
|
function DetailPane({
|
|
97
100
|
detail,
|
|
101
|
+
scroll,
|
|
102
|
+
testID
|
|
103
|
+
}) {
|
|
104
|
+
return /* @__PURE__ */ jsx(PaneRegion, {
|
|
105
|
+
scroll,
|
|
106
|
+
testID: testID ? `${testID}-detail` : undefined,
|
|
107
|
+
children: detail
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function PaneRegion({
|
|
111
|
+
children,
|
|
112
|
+
scroll,
|
|
98
113
|
testID
|
|
99
114
|
}) {
|
|
115
|
+
if (!scroll) {
|
|
116
|
+
return /* @__PURE__ */ jsx(View2, {
|
|
117
|
+
flex: 1,
|
|
118
|
+
minHeight: 0,
|
|
119
|
+
minWidth: 0,
|
|
120
|
+
testID,
|
|
121
|
+
children
|
|
122
|
+
});
|
|
123
|
+
}
|
|
100
124
|
return /* @__PURE__ */ jsx(ScrollView2, {
|
|
101
125
|
flex: 1,
|
|
102
126
|
minHeight: 0,
|
|
103
127
|
minWidth: 0,
|
|
104
|
-
testID
|
|
105
|
-
children
|
|
128
|
+
testID,
|
|
129
|
+
children
|
|
106
130
|
});
|
|
107
131
|
}
|
|
108
132
|
export {
|
|
@@ -22,4 +22,8 @@ export interface MasterDetailProps extends ZoraBaseProps {
|
|
|
22
22
|
activePane?: MasterDetailActivePane;
|
|
23
23
|
desktopMode?: MasterDetailDesktopMode;
|
|
24
24
|
masterWidth?: MasterDetailMasterWidth;
|
|
25
|
+
/** Scrolls the master pane. Set false for bounded content that owns its own scrolling. */
|
|
26
|
+
masterScroll?: boolean;
|
|
27
|
+
/** Scrolls the detail pane. Set false for bounded content, such as a nested app, that owns its own scrolling. */
|
|
28
|
+
detailScroll?: boolean;
|
|
25
29
|
}
|
|
@@ -108,9 +108,13 @@ function useOverlayStackRuntime() {
|
|
|
108
108
|
const topmost = overlaysRef.current.at(-1);
|
|
109
109
|
topmost?.onDismiss?.();
|
|
110
110
|
}, []);
|
|
111
|
+
const isDescendantOf = React2.useCallback((id, ancestorId) => {
|
|
112
|
+
const entry = overlaysRef.current.find((item) => item.id === id);
|
|
113
|
+
return entry === undefined ? false : isOverlayDescendantOf(entry, ancestorId, overlaysRef.current);
|
|
114
|
+
}, []);
|
|
111
115
|
const isTopmost = React2.useCallback((id) => overlaysRef.current.at(-1)?.id === id, []);
|
|
112
|
-
const actions = React2.useMemo(() => ({ dismissTopmost, isTopmost, removeOverlay, setOverlay }), [dismissTopmost, isTopmost, removeOverlay, setOverlay]);
|
|
113
|
-
const value = React2.useMemo(() => ({ dismissTopmost, isTopmost, overlays, removeOverlay, setOverlay }), [dismissTopmost, isTopmost, overlays, removeOverlay, setOverlay]);
|
|
116
|
+
const actions = React2.useMemo(() => ({ dismissTopmost, isDescendantOf, isTopmost, removeOverlay, setOverlay }), [dismissTopmost, isDescendantOf, isTopmost, removeOverlay, setOverlay]);
|
|
117
|
+
const value = React2.useMemo(() => ({ dismissTopmost, isDescendantOf, isTopmost, overlays, removeOverlay, setOverlay }), [dismissTopmost, isDescendantOf, isTopmost, overlays, removeOverlay, setOverlay]);
|
|
114
118
|
return { actions, value };
|
|
115
119
|
}
|
|
116
120
|
function isOverlayDescendantOf(entry, removedId, overlays) {
|