@ankhorage/zora 12.1.0 → 13.0.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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/features/accordion/accordionItemMeta.d.ts +53 -0
- package/dist/features/accordion/accordionItemMeta.d.ts.map +1 -0
- package/dist/features/accordion/accordionItemMeta.js +45 -0
- package/dist/features/accordion/accordionItemMeta.js.map +1 -0
- package/dist/features/accordion/accordionMeta.d.ts +36 -0
- package/dist/features/accordion/accordionMeta.d.ts.map +1 -0
- package/dist/features/accordion/accordionMeta.js +33 -0
- package/dist/features/accordion/accordionMeta.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/Accordion.d.ts +5 -0
- package/dist/features/accordion/adapters/inbound/Accordion.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/Accordion.js +41 -0
- package/dist/features/accordion/adapters/inbound/Accordion.js.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts +5 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.d.ts.map +1 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.js +52 -0
- package/dist/features/accordion/adapters/inbound/AccordionItem.js.map +1 -0
- package/dist/features/accordion/composition/AccordionPresentationContext.d.ts +4 -0
- package/dist/features/accordion/composition/AccordionPresentationContext.d.ts.map +1 -0
- package/dist/features/accordion/composition/AccordionPresentationContext.js +3 -0
- package/dist/features/accordion/composition/AccordionPresentationContext.js.map +1 -0
- package/dist/features/accordion/public.d.ts +4 -0
- package/dist/features/accordion/public.d.ts.map +1 -0
- package/dist/features/accordion/public.js +3 -0
- package/dist/features/accordion/public.js.map +1 -0
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/mediaCardMeta.d.ts +1 -1
- package/dist/features/card/postCardMeta.d.ts +1 -1
- package/dist/features/gradient/gradientMeta.d.ts +1 -1
- package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
- package/dist/features/layout/boxMeta.d.ts +1 -1
- package/dist/features/layout/containerMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/stackMeta.d.ts +1 -1
- package/dist/features/list/flatListMeta.d.ts +1 -1
- package/dist/features/list/sectionListMeta.d.ts +1 -1
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/screen/meta.d.ts +1 -1
- package/dist/layout/screen-section/meta.d.ts +1 -1
- package/dist/metadata/allowedChildren.d.ts +3 -3
- package/dist/metadata/allowedChildren.d.ts.map +1 -1
- package/dist/metadata/allowedChildren.js +1 -0
- package/dist/metadata/allowedChildren.js.map +1 -1
- package/dist/metadata/bindableComponentMeta.d.ts +2 -2
- package/dist/metadata/componentMeta.d.ts.map +1 -1
- package/dist/metadata/componentMeta.js +4 -2
- package/dist/metadata/componentMeta.js.map +1 -1
- package/dist/patterns/message-bubble/meta.d.ts +1 -1
- package/dist/patterns/notice/meta.d.ts +1 -1
- package/dist/patterns/panel/meta.d.ts +1 -1
- package/dist/patterns/reader/meta.d.ts +2 -2
- package/dist/patterns/scanner/meta.d.ts +2 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +3 -2
- package/dist/registry.js.map +1 -1
- package/dist/types/accordion.d.ts +23 -0
- package/dist/types/accordion.d.ts.map +1 -0
- package/dist/types/accordion.js +2 -0
- package/dist/types/accordion.js.map +1 -0
- package/package.json +2 -2
- package/src/features/accordion/accordionItemMeta.ts +46 -0
- package/src/features/accordion/accordionMeta.ts +34 -0
- package/src/features/accordion/adapters/inbound/Accordion.tsx +94 -0
- package/src/features/accordion/adapters/inbound/AccordionItem.tsx +86 -0
- package/src/features/accordion/composition/AccordionPresentationContext.ts +6 -0
- package/src/features/accordion/public.ts +9 -0
- package/src/index.ts +9 -2
- package/src/metadata/allowedChildren.ts +1 -0
- package/src/metadata/componentMeta.test.ts +9 -0
- package/src/metadata/componentMeta.ts +4 -2
- package/src/registry.ts +3 -2
- package/src/showcaseCoverage.test.ts +2 -1
- package/src/theme/themeScopeStructure.test.ts +3 -2
- package/src/types/accordion.ts +38 -0
- package/dist/patterns/disclosure-section/DisclosureSection.d.ts +0 -9
- package/dist/patterns/disclosure-section/DisclosureSection.d.ts.map +0 -1
- package/dist/patterns/disclosure-section/DisclosureSection.js +0 -86
- package/dist/patterns/disclosure-section/DisclosureSection.js.map +0 -1
- package/dist/patterns/disclosure-section/index.d.ts +0 -3
- package/dist/patterns/disclosure-section/index.d.ts.map +0 -1
- package/dist/patterns/disclosure-section/index.js +0 -3
- package/dist/patterns/disclosure-section/index.js.map +0 -1
- package/dist/patterns/disclosure-section/meta.d.ts +0 -9
- package/dist/patterns/disclosure-section/meta.d.ts.map +0 -1
- package/dist/patterns/disclosure-section/meta.js +0 -9
- package/dist/patterns/disclosure-section/meta.js.map +0 -1
- package/dist/patterns/disclosure-section/types.d.ts +0 -15
- package/dist/patterns/disclosure-section/types.d.ts.map +0 -1
- package/dist/patterns/disclosure-section/types.js +0 -2
- package/dist/patterns/disclosure-section/types.js.map +0 -1
- package/src/patterns/disclosure-section/DisclosureSection.tsx +0 -130
- package/src/patterns/disclosure-section/index.ts +0 -2
- package/src/patterns/disclosure-section/meta.ts +0 -10
- package/src/patterns/disclosure-section/types.ts +0 -16
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { DisclosureSectionProps } from './types';
|
|
3
|
-
/***
|
|
4
|
-
* Expandable section pattern with a summary header and collapsible content.
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
export declare const DisclosureSection: (props: DisclosureSectionProps) => React.ReactElement | null;
|
|
9
|
-
//# sourceMappingURL=DisclosureSection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DisclosureSection.d.ts","sourceRoot":"","sources":["../../../src/patterns/disclosure-section/DisclosureSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAmHtD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,8DAA6C,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Platform, Pressable } from 'react-native';
|
|
3
|
-
import { IconButton } from '../../features/button/public';
|
|
4
|
-
import { Box, Stack } from '../../features/layout/public';
|
|
5
|
-
import { Heading } from '../../features/typography/public';
|
|
6
|
-
import { Text } from '../../features/typography/public';
|
|
7
|
-
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
8
|
-
import { Panel } from '../panel';
|
|
9
|
-
const triggerTextStyle = {
|
|
10
|
-
flex: 1,
|
|
11
|
-
flexBasis: 0,
|
|
12
|
-
minWidth: 0,
|
|
13
|
-
};
|
|
14
|
-
const triggerCopyStyle = {
|
|
15
|
-
flexShrink: 1,
|
|
16
|
-
maxWidth: '100%',
|
|
17
|
-
minWidth: 0,
|
|
18
|
-
};
|
|
19
|
-
const trailingStyle = {
|
|
20
|
-
flexShrink: 0,
|
|
21
|
-
};
|
|
22
|
-
const getTriggerStyle = (disabled) => ({
|
|
23
|
-
alignSelf: 'stretch',
|
|
24
|
-
flex: 1,
|
|
25
|
-
flexBasis: 0,
|
|
26
|
-
justifyContent: 'center',
|
|
27
|
-
minWidth: 0,
|
|
28
|
-
...(Platform.OS === 'web'
|
|
29
|
-
? {
|
|
30
|
-
cursor: disabled ? 'default' : 'pointer',
|
|
31
|
-
}
|
|
32
|
-
: null),
|
|
33
|
-
});
|
|
34
|
-
function DisclosureSectionInner({ themeId: _themeId, mode: _mode, title, description, icon, defaultOpen = true, open: controlledOpen, onOpenChange, actions, children, disabled, testID, interactionPolicy, }) {
|
|
35
|
-
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
36
|
-
const isControlled = controlledOpen !== undefined;
|
|
37
|
-
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
38
|
-
const passive = interactionPolicy === 'passive';
|
|
39
|
-
const titleLabel = typeof title === 'string' || typeof title === 'number' ? `: ${title}` : '';
|
|
40
|
-
const toggleLabel = `${isOpen ? 'Collapse' : 'Expand'} section${titleLabel}`;
|
|
41
|
-
const toggleOpen = () => {
|
|
42
|
-
if (disabled || passive)
|
|
43
|
-
return;
|
|
44
|
-
if (isControlled) {
|
|
45
|
-
onOpenChange?.(!controlledOpen);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
setInternalOpen(!internalOpen);
|
|
49
|
-
onOpenChange?.(!internalOpen);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
return (<Panel compact testID={testID}>
|
|
53
|
-
<Stack gap="s">
|
|
54
|
-
<Stack direction="row" gap="m" align="center">
|
|
55
|
-
<Pressable accessibilityLabel={toggleLabel} accessibilityRole="button" accessibilityState={{ disabled, expanded: isOpen }} disabled={disabled} onPress={toggleOpen} style={getTriggerStyle(disabled)}>
|
|
56
|
-
<Box style={triggerTextStyle}>
|
|
57
|
-
<Stack gap="xs">
|
|
58
|
-
{icon ? <Box pb="xs">{/* Surface icon spec would go here */}</Box> : null}
|
|
59
|
-
<Heading level={4} style={triggerCopyStyle}>
|
|
60
|
-
{title}
|
|
61
|
-
</Heading>
|
|
62
|
-
{description ? (<Text emphasis="muted" variant="bodySmall" style={triggerCopyStyle}>
|
|
63
|
-
{description}
|
|
64
|
-
</Text>) : null}
|
|
65
|
-
</Stack>
|
|
66
|
-
</Box>
|
|
67
|
-
</Pressable>
|
|
68
|
-
|
|
69
|
-
{actions ? <Box style={trailingStyle}>{actions}</Box> : null}
|
|
70
|
-
|
|
71
|
-
<Box style={trailingStyle}>
|
|
72
|
-
<IconButton icon={{ name: isOpen ? 'chevron-up-outline' : 'chevron-down-outline' }} label={isOpen ? 'Collapse' : 'Expand'} variant="ghost" color="neutral" size="s" disabled={disabled} interactionPolicy={interactionPolicy} onPress={toggleOpen}/>
|
|
73
|
-
</Box>
|
|
74
|
-
</Stack>
|
|
75
|
-
|
|
76
|
-
{isOpen ? <Box pt="m">{children}</Box> : null}
|
|
77
|
-
</Stack>
|
|
78
|
-
</Panel>);
|
|
79
|
-
}
|
|
80
|
-
/***
|
|
81
|
-
* Expandable section pattern with a summary header and collapsible content.
|
|
82
|
-
*
|
|
83
|
-
|
|
84
|
-
*/
|
|
85
|
-
export const DisclosureSection = withZoraThemeScope(DisclosureSectionInner);
|
|
86
|
-
//# sourceMappingURL=DisclosureSection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DisclosureSection.js","sourceRoot":"","sources":["../../../src/patterns/disclosure-section/DisclosureSection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAkC,MAAM,cAAc,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,MAAM,gBAAgB,GAAc;IAClC,IAAI,EAAE,CAAC;IACP,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF,MAAM,gBAAgB,GAAc;IAClC,UAAU,EAAE,CAAC;IACb,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF,MA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,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, Pressable, type TextStyle, type ViewStyle } from 'react-native';\n\nimport { IconButton } from '../../features/button/public';\nimport { Box, Stack } from '../../features/layout/public';\nimport { Heading } from '../../features/typography/public';\nimport { Text } from '../../features/typography/public';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Panel } from '../panel';\nimport type { DisclosureSectionProps } from './types';\n\nconst triggerTextStyle: ViewStyle = {\n flex: 1,\n flexBasis: 0,\n minWidth: 0,\n};\n\nconst triggerCopyStyle: TextStyle = {\n flexShrink: 1,\n maxWidth: '100%',\n minWidth: 0,\n};\n\nconst trailingStyle: ViewStyle = {\n flexShrink: 0,\n};\n\nconst getTriggerStyle = (disabled?: boolean): ViewStyle =>\n ({\n alignSelf: 'stretch',\n flex: 1,\n flexBasis: 0,\n justifyContent: 'center',\n minWidth: 0,\n ...(Platform.OS === 'web'\n ? {\n cursor: disabled ? 'default' : 'pointer',\n }\n : null),\n }) as ViewStyle;\n\nfunction DisclosureSectionInner({\n themeId: _themeId,\n mode: _mode,\n title,\n description,\n icon,\n defaultOpen = true,\n open: controlledOpen,\n onOpenChange,\n actions,\n children,\n disabled,\n testID,\n interactionPolicy,\n}: DisclosureSectionProps) {\n const [internalOpen, setInternalOpen] = React.useState(defaultOpen);\n\n const isControlled = controlledOpen !== undefined;\n const isOpen = isControlled ? controlledOpen : internalOpen;\n const passive = interactionPolicy === 'passive';\n const titleLabel = typeof title === 'string' || typeof title === 'number' ? `: ${title}` : '';\n const toggleLabel = `${isOpen ? 'Collapse' : 'Expand'} section${titleLabel}`;\n\n const toggleOpen = () => {\n if (disabled || passive) return;\n\n if (isControlled) {\n onOpenChange?.(!controlledOpen);\n } else {\n setInternalOpen(!internalOpen);\n onOpenChange?.(!internalOpen);\n }\n };\n\n return (\n <Panel compact testID={testID}>\n <Stack gap=\"s\">\n <Stack direction=\"row\" gap=\"m\" align=\"center\">\n <Pressable\n accessibilityLabel={toggleLabel}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled, expanded: isOpen }}\n disabled={disabled}\n onPress={toggleOpen}\n style={getTriggerStyle(disabled)}\n >\n <Box style={triggerTextStyle}>\n <Stack gap=\"xs\">\n {icon ? <Box pb=\"xs\">{/* Surface icon spec would go here */}</Box> : null}\n <Heading level={4} style={triggerCopyStyle}>\n {title}\n </Heading>\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\" style={triggerCopyStyle}>\n {description}\n </Text>\n ) : null}\n </Stack>\n </Box>\n </Pressable>\n\n {actions ? <Box style={trailingStyle}>{actions}</Box> : null}\n\n <Box style={trailingStyle}>\n <IconButton\n icon={{ name: isOpen ? 'chevron-up-outline' : 'chevron-down-outline' }}\n label={isOpen ? 'Collapse' : 'Expand'}\n variant=\"ghost\"\n color=\"neutral\"\n size=\"s\"\n disabled={disabled}\n interactionPolicy={interactionPolicy}\n onPress={toggleOpen}\n />\n </Box>\n </Stack>\n\n {isOpen ? <Box pt=\"m\">{children}</Box> : null}\n </Stack>\n </Panel>\n );\n}\n\n/***\n * Expandable section pattern with a summary header and collapsible content.\n *\n\n */\nexport const DisclosureSection = withZoraThemeScope(DisclosureSectionInner);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/disclosure-section/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/disclosure-section/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC","sourcesContent":["export * from './DisclosureSection';\nexport * from './types';\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const disclosureSectionMeta: {
|
|
2
|
-
readonly name: "DisclosureSection";
|
|
3
|
-
readonly category: "pattern";
|
|
4
|
-
readonly directManifestNode: false;
|
|
5
|
-
readonly allowedChildren: readonly [];
|
|
6
|
-
readonly note: "Disclosure pattern; not represented as a manifest node in v1.";
|
|
7
|
-
readonly props: {};
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/patterns/disclosure-section/meta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;;;;;;CAOI,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export const disclosureSectionMeta = {
|
|
2
|
-
name: 'DisclosureSection',
|
|
3
|
-
category: 'pattern',
|
|
4
|
-
directManifestNode: false,
|
|
5
|
-
allowedChildren: [],
|
|
6
|
-
note: 'Disclosure pattern; not represented as a manifest node in v1.',
|
|
7
|
-
props: {},
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=meta.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/patterns/disclosure-section/meta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,mBAAmB;IACzB,QAAQ,EAAE,SAAS;IACnB,kBAAkB,EAAE,KAAK;IACzB,eAAe,EAAE,EAAE;IACnB,IAAI,EAAE,+DAA+D;IACrE,KAAK,EAAE,EAAE;CAC2B,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../metadata';\n\nexport const disclosureSectionMeta = {\n name: 'DisclosureSection',\n category: 'pattern',\n directManifestNode: false,\n allowedChildren: [],\n note: 'Disclosure pattern; not represented as a manifest node in v1.',\n props: {},\n} as const satisfies ZoraComponentMeta;\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
4
|
-
export interface DisclosureSectionProps extends ZoraBaseProps {
|
|
5
|
-
title: ReactNode;
|
|
6
|
-
description?: ReactNode;
|
|
7
|
-
icon?: ButtonIconSpec;
|
|
8
|
-
defaultOpen?: boolean;
|
|
9
|
-
open?: boolean;
|
|
10
|
-
onOpenChange?: (open: boolean) => void;
|
|
11
|
-
actions?: ReactNode;
|
|
12
|
-
children?: ReactNode;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/patterns/disclosure-section/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,sBAAuB,SAAQ,aAAa;IAC3D,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/patterns/disclosure-section/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec } from '@ankhorage/surface';\nimport type { ReactNode } from 'react';\n\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface DisclosureSectionProps extends ZoraBaseProps {\n title: ReactNode;\n description?: ReactNode;\n icon?: ButtonIconSpec;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n actions?: ReactNode;\n children?: ReactNode;\n disabled?: boolean;\n}\n"]}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Platform, Pressable, type TextStyle, type ViewStyle } from 'react-native';
|
|
3
|
-
|
|
4
|
-
import { IconButton } from '../../features/button/public';
|
|
5
|
-
import { Box, Stack } from '../../features/layout/public';
|
|
6
|
-
import { Heading } from '../../features/typography/public';
|
|
7
|
-
import { Text } from '../../features/typography/public';
|
|
8
|
-
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
9
|
-
import { Panel } from '../panel';
|
|
10
|
-
import type { DisclosureSectionProps } from './types';
|
|
11
|
-
|
|
12
|
-
const triggerTextStyle: ViewStyle = {
|
|
13
|
-
flex: 1,
|
|
14
|
-
flexBasis: 0,
|
|
15
|
-
minWidth: 0,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const triggerCopyStyle: TextStyle = {
|
|
19
|
-
flexShrink: 1,
|
|
20
|
-
maxWidth: '100%',
|
|
21
|
-
minWidth: 0,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const trailingStyle: ViewStyle = {
|
|
25
|
-
flexShrink: 0,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const getTriggerStyle = (disabled?: boolean): ViewStyle =>
|
|
29
|
-
({
|
|
30
|
-
alignSelf: 'stretch',
|
|
31
|
-
flex: 1,
|
|
32
|
-
flexBasis: 0,
|
|
33
|
-
justifyContent: 'center',
|
|
34
|
-
minWidth: 0,
|
|
35
|
-
...(Platform.OS === 'web'
|
|
36
|
-
? {
|
|
37
|
-
cursor: disabled ? 'default' : 'pointer',
|
|
38
|
-
}
|
|
39
|
-
: null),
|
|
40
|
-
}) as ViewStyle;
|
|
41
|
-
|
|
42
|
-
function DisclosureSectionInner({
|
|
43
|
-
themeId: _themeId,
|
|
44
|
-
mode: _mode,
|
|
45
|
-
title,
|
|
46
|
-
description,
|
|
47
|
-
icon,
|
|
48
|
-
defaultOpen = true,
|
|
49
|
-
open: controlledOpen,
|
|
50
|
-
onOpenChange,
|
|
51
|
-
actions,
|
|
52
|
-
children,
|
|
53
|
-
disabled,
|
|
54
|
-
testID,
|
|
55
|
-
interactionPolicy,
|
|
56
|
-
}: DisclosureSectionProps) {
|
|
57
|
-
const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
|
|
58
|
-
|
|
59
|
-
const isControlled = controlledOpen !== undefined;
|
|
60
|
-
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
61
|
-
const passive = interactionPolicy === 'passive';
|
|
62
|
-
const titleLabel = typeof title === 'string' || typeof title === 'number' ? `: ${title}` : '';
|
|
63
|
-
const toggleLabel = `${isOpen ? 'Collapse' : 'Expand'} section${titleLabel}`;
|
|
64
|
-
|
|
65
|
-
const toggleOpen = () => {
|
|
66
|
-
if (disabled || passive) return;
|
|
67
|
-
|
|
68
|
-
if (isControlled) {
|
|
69
|
-
onOpenChange?.(!controlledOpen);
|
|
70
|
-
} else {
|
|
71
|
-
setInternalOpen(!internalOpen);
|
|
72
|
-
onOpenChange?.(!internalOpen);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<Panel compact testID={testID}>
|
|
78
|
-
<Stack gap="s">
|
|
79
|
-
<Stack direction="row" gap="m" align="center">
|
|
80
|
-
<Pressable
|
|
81
|
-
accessibilityLabel={toggleLabel}
|
|
82
|
-
accessibilityRole="button"
|
|
83
|
-
accessibilityState={{ disabled, expanded: isOpen }}
|
|
84
|
-
disabled={disabled}
|
|
85
|
-
onPress={toggleOpen}
|
|
86
|
-
style={getTriggerStyle(disabled)}
|
|
87
|
-
>
|
|
88
|
-
<Box style={triggerTextStyle}>
|
|
89
|
-
<Stack gap="xs">
|
|
90
|
-
{icon ? <Box pb="xs">{/* Surface icon spec would go here */}</Box> : null}
|
|
91
|
-
<Heading level={4} style={triggerCopyStyle}>
|
|
92
|
-
{title}
|
|
93
|
-
</Heading>
|
|
94
|
-
{description ? (
|
|
95
|
-
<Text emphasis="muted" variant="bodySmall" style={triggerCopyStyle}>
|
|
96
|
-
{description}
|
|
97
|
-
</Text>
|
|
98
|
-
) : null}
|
|
99
|
-
</Stack>
|
|
100
|
-
</Box>
|
|
101
|
-
</Pressable>
|
|
102
|
-
|
|
103
|
-
{actions ? <Box style={trailingStyle}>{actions}</Box> : null}
|
|
104
|
-
|
|
105
|
-
<Box style={trailingStyle}>
|
|
106
|
-
<IconButton
|
|
107
|
-
icon={{ name: isOpen ? 'chevron-up-outline' : 'chevron-down-outline' }}
|
|
108
|
-
label={isOpen ? 'Collapse' : 'Expand'}
|
|
109
|
-
variant="ghost"
|
|
110
|
-
color="neutral"
|
|
111
|
-
size="s"
|
|
112
|
-
disabled={disabled}
|
|
113
|
-
interactionPolicy={interactionPolicy}
|
|
114
|
-
onPress={toggleOpen}
|
|
115
|
-
/>
|
|
116
|
-
</Box>
|
|
117
|
-
</Stack>
|
|
118
|
-
|
|
119
|
-
{isOpen ? <Box pt="m">{children}</Box> : null}
|
|
120
|
-
</Stack>
|
|
121
|
-
</Panel>
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/***
|
|
126
|
-
* Expandable section pattern with a summary header and collapsible content.
|
|
127
|
-
*
|
|
128
|
-
|
|
129
|
-
*/
|
|
130
|
-
export const DisclosureSection = withZoraThemeScope(DisclosureSectionInner);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ZoraComponentMeta } from '../../metadata';
|
|
2
|
-
|
|
3
|
-
export const disclosureSectionMeta = {
|
|
4
|
-
name: 'DisclosureSection',
|
|
5
|
-
category: 'pattern',
|
|
6
|
-
directManifestNode: false,
|
|
7
|
-
allowedChildren: [],
|
|
8
|
-
note: 'Disclosure pattern; not represented as a manifest node in v1.',
|
|
9
|
-
props: {},
|
|
10
|
-
} as const satisfies ZoraComponentMeta;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ButtonIconSpec } from '@ankhorage/surface';
|
|
2
|
-
import type { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
|
-
|
|
6
|
-
export interface DisclosureSectionProps extends ZoraBaseProps {
|
|
7
|
-
title: ReactNode;
|
|
8
|
-
description?: ReactNode;
|
|
9
|
-
icon?: ButtonIconSpec;
|
|
10
|
-
defaultOpen?: boolean;
|
|
11
|
-
open?: boolean;
|
|
12
|
-
onOpenChange?: (open: boolean) => void;
|
|
13
|
-
actions?: ReactNode;
|
|
14
|
-
children?: ReactNode;
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
}
|