@ankhorage/zora 1.4.8 → 1.4.9

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +119 -0
  3. package/dist/components/card/meta.d.ts +1 -1
  4. package/dist/foundation/meta.d.ts +4 -4
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/layout/auth-layout/meta.d.ts +1 -1
  10. package/dist/layout/page/meta.d.ts +1 -1
  11. package/dist/layout/page-section/meta.d.ts +1 -1
  12. package/dist/metadata/allowedChildren.d.ts +3 -3
  13. package/dist/metadata/allowedChildren.d.ts.map +1 -1
  14. package/dist/metadata/allowedChildren.js +1 -0
  15. package/dist/metadata/allowedChildren.js.map +1 -1
  16. package/dist/metadata/componentMeta.d.ts.map +1 -1
  17. package/dist/metadata/componentMeta.js +2 -0
  18. package/dist/metadata/componentMeta.js.map +1 -1
  19. package/dist/patterns/chat-list-item/ChatListItem.d.ts +4 -0
  20. package/dist/patterns/chat-list-item/ChatListItem.d.ts.map +1 -0
  21. package/dist/patterns/chat-list-item/ChatListItem.js +110 -0
  22. package/dist/patterns/chat-list-item/ChatListItem.js.map +1 -0
  23. package/dist/patterns/chat-list-item/index.d.ts +3 -0
  24. package/dist/patterns/chat-list-item/index.d.ts.map +1 -0
  25. package/dist/patterns/chat-list-item/index.js +2 -0
  26. package/dist/patterns/chat-list-item/index.js.map +1 -0
  27. package/dist/patterns/chat-list-item/meta.d.ts +74 -0
  28. package/dist/patterns/chat-list-item/meta.d.ts.map +1 -0
  29. package/dist/patterns/chat-list-item/meta.js +72 -0
  30. package/dist/patterns/chat-list-item/meta.js.map +1 -0
  31. package/dist/patterns/chat-list-item/types.d.ts +31 -0
  32. package/dist/patterns/chat-list-item/types.d.ts.map +1 -0
  33. package/dist/patterns/chat-list-item/types.js +2 -0
  34. package/dist/patterns/chat-list-item/types.js.map +1 -0
  35. package/dist/patterns/notice/meta.d.ts +1 -1
  36. package/dist/patterns/panel/meta.d.ts +1 -1
  37. package/dist/patterns/post-card/meta.d.ts +1 -1
  38. package/package.json +1 -1
  39. package/src/index.ts +2 -0
  40. package/src/metadata/allowedChildren.ts +1 -0
  41. package/src/metadata/componentMeta.test.ts +1 -0
  42. package/src/metadata/componentMeta.ts +2 -0
  43. package/src/patterns/chat-list-item/ChatListItem.test.tsx +11 -0
  44. package/src/patterns/chat-list-item/ChatListItem.tsx +219 -0
  45. package/src/patterns/chat-list-item/index.ts +2 -0
  46. package/src/patterns/chat-list-item/meta.ts +74 -0
  47. package/src/patterns/chat-list-item/types.ts +33 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChatListItem.js","sourceRoot":"","sources":["../../../src/patterns/chat-list-item/ChatListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,SAAS,iBAAiB,CAAC,EACzB,MAAM,EACN,KAAK,GAIN;IACC,IAAI,MAAM,EAAE,IAAI,EAAE,CAAC;QACjB,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvD,CA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AAC,OAAO;YACtB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CACH,CACF;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC,iBAAiB,CAAC,CAAC","sourcesContent":["import { ButtonBase } from '@ankhorage/surface';\nimport React from 'react';\n\nimport { Avatar } from '../../components/avatar';\nimport { Badge } from '../../components/badge';\nimport { Text } from '../../components/text';\nimport { Box, Inline, Stack } from '../../foundation';\nimport { useZoraTheme } from '../../theme/useZoraTheme';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport type { ChatListAvatar, ChatListItemProps } from './types';\n\nfunction resolveAvatarName({\n avatar,\n title,\n}: {\n avatar: ChatListAvatar | undefined;\n title: React.ReactNode;\n}): string | undefined {\n if (avatar?.name) {\n return avatar.name;\n }\n\n return typeof title === 'string' ? title : undefined;\n}\n\nfunction resolvePadding(compact: boolean) {\n return compact ? { px: 'm' as const, py: 's' as const } : { px: 'm' as const, py: 'm' as const };\n}\n\nfunction resolveContainerStyles({\n theme,\n selected,\n pressed,\n hovered,\n disabled,\n}: {\n theme: ReturnType<typeof useZoraTheme>['theme'];\n selected: boolean;\n pressed: boolean;\n hovered: boolean;\n disabled: boolean;\n}) {\n const borderColor = selected ? theme.semantics.border.focus : 'transparent';\n\n return {\n bg: pressed\n ? theme.semantics.neutral.surfaceActive\n : hovered\n ? theme.semantics.neutral.surfaceHover\n : selected\n ? theme.semantics.neutral.surface\n : 'transparent',\n borderColor,\n borderWidth: selected ? 1 : 0,\n opacity: disabled ? 0.72 : 1,\n };\n}\n\nfunction renderUnreadCount(unreadCount: React.ReactNode) {\n if (unreadCount == null) {\n return null;\n }\n\n return (\n <Badge size=\"s\" tone=\"primary\">\n {unreadCount}\n </Badge>\n );\n}\n\nfunction ChatListItemInner({\n themeId: _themeId,\n mode: _mode,\n testID,\n title,\n preview,\n meta,\n timestamp,\n avatar,\n leading,\n trailing,\n unread = false,\n unreadCount,\n selected = false,\n disabled = false,\n compact = false,\n accessibilityLabel,\n onPress,\n}: ChatListItemProps) {\n const { theme } = useZoraTheme();\n const padding = resolvePadding(compact);\n const avatarName = resolveAvatarName({ avatar, title });\n const isInteractive = Boolean(onPress);\n const hasTimestamp = timestamp != null;\n const hasPreview = preview != null;\n const hasMeta = meta != null;\n const hasTrailing = trailing != null;\n const hasUnreadCount = unreadCount != null;\n const hasSecondaryRow = hasPreview || hasMeta || hasUnreadCount || hasTrailing;\n\n const content = ({ pressed, hovered }: { pressed: boolean; hovered: boolean }) => {\n const styles = resolveContainerStyles({\n theme,\n selected,\n pressed,\n hovered,\n disabled,\n });\n\n return (\n <Box\n bg={styles.bg}\n borderColor={styles.borderColor}\n borderWidth={styles.borderWidth}\n px={padding.px}\n py={padding.py}\n radius=\"m\"\n style={{ opacity: styles.opacity }}\n >\n <Inline align=\"center\" gap=\"m\" wrap=\"nowrap\">\n {leading ?? (\n <Avatar\n initials={avatar?.initials}\n label={avatar?.label ?? avatarName}\n name={avatarName}\n shape={avatar?.shape}\n size={avatar?.size ?? (compact ? 's' : 'm')}\n source={avatar?.source}\n tone={avatar?.tone}\n />\n )}\n\n <Box flex={1}>\n <Stack gap=\"xxs\">\n <Inline align=\"center\" gap=\"s\" justify=\"space-between\" wrap=\"nowrap\">\n <Box flex={1}>\n <Text\n numberOfLines={1}\n tone={disabled ? 'muted' : 'default'}\n variant=\"bodySmall\"\n weight={unread || selected ? 'semiBold' : 'medium'}\n >\n {title}\n </Text>\n </Box>\n {hasTimestamp ? (\n <Text\n numberOfLines={1}\n tone={unread ? 'primary' : 'subtle'}\n variant=\"caption\"\n weight={unread ? 'semiBold' : 'regular'}\n >\n {timestamp}\n </Text>\n ) : null}\n </Inline>\n\n {hasSecondaryRow ? (\n <Inline align=\"center\" gap=\"s\" justify=\"space-between\" wrap=\"nowrap\">\n <Box flex={1}>\n <Stack gap=\"xxs\">\n {hasPreview ? (\n <Text\n numberOfLines={1}\n tone={unread ? 'default' : 'muted'}\n variant=\"bodySmall\"\n weight={unread ? 'medium' : 'regular'}\n >\n {preview}\n </Text>\n ) : null}\n {hasMeta ? (\n <Text numberOfLines={1} tone=\"subtle\" variant=\"caption\">\n {meta}\n </Text>\n ) : null}\n </Stack>\n </Box>\n\n {hasUnreadCount || hasTrailing ? (\n <Inline align=\"center\" gap=\"s\" wrap=\"nowrap\">\n {renderUnreadCount(unreadCount)}\n {trailing}\n </Inline>\n ) : null}\n </Inline>\n ) : null}\n </Stack>\n </Box>\n </Inline>\n </Box>\n );\n };\n\n if (!isInteractive) {\n return <Box testID={testID}>{content({ pressed: false, hovered: false })}</Box>;\n }\n\n return (\n <ButtonBase\n accessibilityLabel={accessibilityLabel}\n accessibilityRole=\"button\"\n accessibilityState={{ disabled, selected }}\n disabled={disabled}\n onPress={onPress}\n radius=\"m\"\n testID={testID}\n >\n {(state) =>\n content({\n pressed: state.pressed,\n hovered: state.hovered,\n })\n }\n </ButtonBase>\n );\n}\n\nexport const ChatListItem = withZoraThemeScope(ChatListItemInner);\n"]}
@@ -0,0 +1,3 @@
1
+ export { ChatListItem } from './ChatListItem';
2
+ export type { ChatListAvatar, ChatListItemProps } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/chat-list-item/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ChatListItem } from './ChatListItem';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/chat-list-item/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { ChatListItem } from './ChatListItem';\nexport type { ChatListAvatar, ChatListItemProps } from './types';\n"]}
@@ -0,0 +1,74 @@
1
+ export declare const chatListItemMeta: {
2
+ readonly name: "ChatListItem";
3
+ readonly category: "pattern";
4
+ readonly description: "Conversation preview row with avatar, title, preview text, timestamp, and unread state.";
5
+ readonly directManifestNode: true;
6
+ readonly allowedChildren: readonly [];
7
+ readonly blueprint: {
8
+ readonly label: "Chat list item";
9
+ readonly icon: {
10
+ readonly name: "chatbubble-outline";
11
+ };
12
+ readonly defaultProps: {
13
+ readonly title: "Ada Lovelace";
14
+ readonly preview: "Can you review the latest UI update?";
15
+ readonly timestamp: "2m";
16
+ readonly avatar: {
17
+ readonly name: "Ada Lovelace";
18
+ };
19
+ };
20
+ };
21
+ readonly props: {
22
+ readonly title: {
23
+ readonly type: "string";
24
+ readonly category: "Content";
25
+ readonly label: "Title";
26
+ readonly default: "Ada Lovelace";
27
+ };
28
+ readonly preview: {
29
+ readonly type: "string";
30
+ readonly category: "Content";
31
+ readonly label: "Preview";
32
+ };
33
+ readonly meta: {
34
+ readonly type: "string";
35
+ readonly category: "Content";
36
+ readonly label: "Meta";
37
+ };
38
+ readonly timestamp: {
39
+ readonly type: "string";
40
+ readonly category: "Content";
41
+ readonly label: "Timestamp";
42
+ };
43
+ readonly unread: {
44
+ readonly type: "boolean";
45
+ readonly category: "State";
46
+ readonly label: "Unread";
47
+ readonly default: false;
48
+ };
49
+ readonly unreadCount: {
50
+ readonly type: "string";
51
+ readonly category: "State";
52
+ readonly label: "Unread count";
53
+ };
54
+ readonly selected: {
55
+ readonly type: "boolean";
56
+ readonly category: "State";
57
+ readonly label: "Selected";
58
+ readonly default: false;
59
+ };
60
+ readonly disabled: {
61
+ readonly type: "boolean";
62
+ readonly category: "State";
63
+ readonly label: "Disabled";
64
+ readonly default: false;
65
+ };
66
+ readonly compact: {
67
+ readonly type: "boolean";
68
+ readonly category: "Layout";
69
+ readonly label: "Compact";
70
+ readonly default: false;
71
+ };
72
+ };
73
+ };
74
+ //# sourceMappingURL=meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/patterns/chat-list-item/meta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuES,CAAC"}
@@ -0,0 +1,72 @@
1
+ export const chatListItemMeta = {
2
+ name: 'ChatListItem',
3
+ category: 'pattern',
4
+ description: 'Conversation preview row with avatar, title, preview text, timestamp, and unread state.',
5
+ directManifestNode: true,
6
+ allowedChildren: [],
7
+ blueprint: {
8
+ label: 'Chat list item',
9
+ icon: { name: 'chatbubble-outline' },
10
+ defaultProps: {
11
+ title: 'Ada Lovelace',
12
+ preview: 'Can you review the latest UI update?',
13
+ timestamp: '2m',
14
+ avatar: {
15
+ name: 'Ada Lovelace',
16
+ },
17
+ },
18
+ },
19
+ props: {
20
+ title: {
21
+ type: 'string',
22
+ category: 'Content',
23
+ label: 'Title',
24
+ default: 'Ada Lovelace',
25
+ },
26
+ preview: {
27
+ type: 'string',
28
+ category: 'Content',
29
+ label: 'Preview',
30
+ },
31
+ meta: {
32
+ type: 'string',
33
+ category: 'Content',
34
+ label: 'Meta',
35
+ },
36
+ timestamp: {
37
+ type: 'string',
38
+ category: 'Content',
39
+ label: 'Timestamp',
40
+ },
41
+ unread: {
42
+ type: 'boolean',
43
+ category: 'State',
44
+ label: 'Unread',
45
+ default: false,
46
+ },
47
+ unreadCount: {
48
+ type: 'string',
49
+ category: 'State',
50
+ label: 'Unread count',
51
+ },
52
+ selected: {
53
+ type: 'boolean',
54
+ category: 'State',
55
+ label: 'Selected',
56
+ default: false,
57
+ },
58
+ disabled: {
59
+ type: 'boolean',
60
+ category: 'State',
61
+ label: 'Disabled',
62
+ default: false,
63
+ },
64
+ compact: {
65
+ type: 'boolean',
66
+ category: 'Layout',
67
+ label: 'Compact',
68
+ default: false,
69
+ },
70
+ },
71
+ };
72
+ //# sourceMappingURL=meta.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/patterns/chat-list-item/meta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,cAAc;IACpB,QAAQ,EAAE,SAAS;IACnB,WAAW,EACT,yFAAyF;IAC3F,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE;QACT,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE;QACpC,YAAY,EAAE;YACZ,KAAK,EAAE,cAAc;YACrB,OAAO,EAAE,sCAAsC;YAC/C,SAAS,EAAE,IAAI;YACf,MAAM,EAAE;gBACN,IAAI,EAAE,cAAc;aACrB;SACF;KACF;IACD,KAAK,EAAE;QACL,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,OAAO;YACd,OAAO,EAAE,cAAc;SACxB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,SAAS;SACjB;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,MAAM;SACd;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,WAAW;SACnB;QACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,KAAK;SACf;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,cAAc;SACtB;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;SACf;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,KAAK;SACf;KACF;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../metadata';\n\nexport const chatListItemMeta = {\n name: 'ChatListItem',\n category: 'pattern',\n description:\n 'Conversation preview row with avatar, title, preview text, timestamp, and unread state.',\n directManifestNode: true,\n allowedChildren: [],\n blueprint: {\n label: 'Chat list item',\n icon: { name: 'chatbubble-outline' },\n defaultProps: {\n title: 'Ada Lovelace',\n preview: 'Can you review the latest UI update?',\n timestamp: '2m',\n avatar: {\n name: 'Ada Lovelace',\n },\n },\n },\n props: {\n title: {\n type: 'string',\n category: 'Content',\n label: 'Title',\n default: 'Ada Lovelace',\n },\n preview: {\n type: 'string',\n category: 'Content',\n label: 'Preview',\n },\n meta: {\n type: 'string',\n category: 'Content',\n label: 'Meta',\n },\n timestamp: {\n type: 'string',\n category: 'Content',\n label: 'Timestamp',\n },\n unread: {\n type: 'boolean',\n category: 'State',\n label: 'Unread',\n default: false,\n },\n unreadCount: {\n type: 'string',\n category: 'State',\n label: 'Unread count',\n },\n selected: {\n type: 'boolean',\n category: 'State',\n label: 'Selected',\n default: false,\n },\n disabled: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n },\n compact: {\n type: 'boolean',\n category: 'Layout',\n label: 'Compact',\n default: false,\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
@@ -0,0 +1,31 @@
1
+ import type React from 'react';
2
+ import type { ImageSourcePropType } from 'react-native';
3
+ import type { AvatarShape, AvatarSize } from '../../components/avatar';
4
+ import type { ZoraTone } from '../../internal/recipes';
5
+ import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
6
+ export interface ChatListAvatar {
7
+ source?: ImageSourcePropType;
8
+ name?: string;
9
+ initials?: string;
10
+ label?: string;
11
+ size?: AvatarSize;
12
+ shape?: AvatarShape;
13
+ tone?: ZoraTone;
14
+ }
15
+ export interface ChatListItemProps extends ZoraBaseProps {
16
+ title: React.ReactNode;
17
+ preview?: React.ReactNode;
18
+ meta?: React.ReactNode;
19
+ timestamp?: React.ReactNode;
20
+ avatar?: ChatListAvatar;
21
+ leading?: React.ReactNode;
22
+ trailing?: React.ReactNode;
23
+ unread?: boolean;
24
+ unreadCount?: React.ReactNode;
25
+ selected?: boolean;
26
+ disabled?: boolean;
27
+ compact?: boolean;
28
+ accessibilityLabel?: string;
29
+ onPress?: () => void;
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/patterns/chat-list-item/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/patterns/chat-list-item/types.ts"],"names":[],"mappings":"","sourcesContent":["import type React from 'react';\nimport type { ImageSourcePropType } from 'react-native';\n\nimport type { AvatarShape, AvatarSize } from '../../components/avatar';\nimport type { ZoraTone } from '../../internal/recipes';\nimport type { ZoraBaseProps } from '../../theme/ZoraBaseProps';\n\nexport interface ChatListAvatar {\n source?: ImageSourcePropType;\n name?: string;\n initials?: string;\n label?: string;\n size?: AvatarSize;\n shape?: AvatarShape;\n tone?: ZoraTone;\n}\n\nexport interface ChatListItemProps extends ZoraBaseProps {\n title: React.ReactNode;\n preview?: React.ReactNode;\n meta?: React.ReactNode;\n timestamp?: React.ReactNode;\n avatar?: ChatListAvatar;\n leading?: React.ReactNode;\n trailing?: React.ReactNode;\n unread?: boolean;\n unreadCount?: React.ReactNode;\n selected?: boolean;\n disabled?: boolean;\n compact?: boolean;\n accessibilityLabel?: string;\n onPress?: () => void;\n}\n"]}
@@ -2,7 +2,7 @@ export declare const noticeMeta: {
2
2
  readonly name: "Notice";
3
3
  readonly category: "pattern";
4
4
  readonly directManifestNode: true;
5
- readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard"];
5
+ readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem"];
6
6
  readonly blueprint: {
7
7
  readonly label: "Notice";
8
8
  readonly defaultProps: {
@@ -2,7 +2,7 @@ export declare const panelMeta: {
2
2
  readonly name: "Panel";
3
3
  readonly category: "pattern";
4
4
  readonly directManifestNode: true;
5
- readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard"];
5
+ readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem"];
6
6
  readonly blueprint: {
7
7
  readonly label: "Panel";
8
8
  readonly defaultProps: {
@@ -3,7 +3,7 @@ export declare const postCardMeta: {
3
3
  readonly category: "pattern";
4
4
  readonly description: "Social/content post card with author identity, body, media, actions, and comment previews.";
5
5
  readonly directManifestNode: true;
6
- readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard"];
6
+ readonly allowedChildren: readonly ["Box", "Stack", "Grid", "Container", "Divider", "Text", "Heading", "Button", "Input", "Textarea", "FormField", "Card", "Panel", "Notice", "EmptyState", "SectionHeader", "SettingsRow", "PostCard", "ChatListItem"];
7
7
  readonly blueprint: {
8
8
  readonly label: "Post card";
9
9
  readonly icon: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/zora",
3
3
  "type": "module",
4
- "version": "1.4.8",
4
+ "version": "1.4.9",
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": {
package/src/index.ts CHANGED
@@ -163,6 +163,8 @@ export type {
163
163
  SignUpFormValues,
164
164
  } from './patterns/auth';
165
165
  export { ForgotPasswordForm, OtpForm, SignInForm, SignUpForm } from './patterns/auth';
166
+ export type { ChatListAvatar, ChatListItemProps } from './patterns/chat-list-item';
167
+ export { ChatListItem } from './patterns/chat-list-item';
166
168
  export type {
167
169
  CollectionEditorProps,
168
170
  CollectionEditorRenderItemProps,
@@ -17,6 +17,7 @@ export const CONTAINER_ALLOWED_CHILDREN = [
17
17
  'SectionHeader',
18
18
  'SettingsRow',
19
19
  'PostCard',
20
+ 'ChatListItem',
20
21
  ] as const;
21
22
 
22
23
  export const PAGE_SECTION_ALLOWED_CHILDREN = [...CONTAINER_ALLOWED_CHILDREN] as const;
@@ -141,6 +141,7 @@ describe('ZORA_COMPONENT_META invariants', () => {
141
141
  'Text',
142
142
  'Heading',
143
143
  'Divider',
144
+ 'ChatListItem',
144
145
  ]);
145
146
 
146
147
  const expectedContainerNodes = new Set([
@@ -43,6 +43,7 @@ import {
43
43
  signInFormMeta,
44
44
  signUpFormMeta,
45
45
  } from '../patterns/auth/meta';
46
+ import { chatListItemMeta } from '../patterns/chat-list-item/meta';
46
47
  import { collectionEditorMeta } from '../patterns/collection-editor/meta';
47
48
  import { confirmDialogMeta } from '../patterns/confirm-dialog/meta';
48
49
  import { disclosureSectionMeta } from '../patterns/disclosure-section/meta';
@@ -119,6 +120,7 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = {
119
120
  OtpForm: otpFormMeta,
120
121
  SignInForm: signInFormMeta,
121
122
  SignUpForm: signUpFormMeta,
123
+ ChatListItem: chatListItemMeta,
122
124
  CollectionEditor: collectionEditorMeta,
123
125
  ConfirmDialog: confirmDialogMeta,
124
126
  DisclosureSection: disclosureSectionMeta,
@@ -0,0 +1,11 @@
1
+ import { describe, expect, test } from 'bun:test';
2
+
3
+ import { ZORA_COMPONENT_META } from '../../metadata';
4
+
5
+ describe('ChatListItem', () => {
6
+ test('is registered as a public ZORA pattern', () => {
7
+ expect(ZORA_COMPONENT_META.ChatListItem?.name).toBe('ChatListItem');
8
+ expect(ZORA_COMPONENT_META.ChatListItem?.category).toBe('pattern');
9
+ expect(ZORA_COMPONENT_META.ChatListItem?.directManifestNode).toBe(true);
10
+ });
11
+ });
@@ -0,0 +1,219 @@
1
+ import { ButtonBase } from '@ankhorage/surface';
2
+ import React from 'react';
3
+
4
+ import { Avatar } from '../../components/avatar';
5
+ import { Badge } from '../../components/badge';
6
+ import { Text } from '../../components/text';
7
+ import { Box, Inline, Stack } from '../../foundation';
8
+ import { useZoraTheme } from '../../theme/useZoraTheme';
9
+ import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
10
+ import type { ChatListAvatar, ChatListItemProps } from './types';
11
+
12
+ function resolveAvatarName({
13
+ avatar,
14
+ title,
15
+ }: {
16
+ avatar: ChatListAvatar | undefined;
17
+ title: React.ReactNode;
18
+ }): string | undefined {
19
+ if (avatar?.name) {
20
+ return avatar.name;
21
+ }
22
+
23
+ return typeof title === 'string' ? title : undefined;
24
+ }
25
+
26
+ function resolvePadding(compact: boolean) {
27
+ return compact ? { px: 'm' as const, py: 's' as const } : { px: 'm' as const, py: 'm' as const };
28
+ }
29
+
30
+ function resolveContainerStyles({
31
+ theme,
32
+ selected,
33
+ pressed,
34
+ hovered,
35
+ disabled,
36
+ }: {
37
+ theme: ReturnType<typeof useZoraTheme>['theme'];
38
+ selected: boolean;
39
+ pressed: boolean;
40
+ hovered: boolean;
41
+ disabled: boolean;
42
+ }) {
43
+ const borderColor = selected ? theme.semantics.border.focus : 'transparent';
44
+
45
+ return {
46
+ bg: pressed
47
+ ? theme.semantics.neutral.surfaceActive
48
+ : hovered
49
+ ? theme.semantics.neutral.surfaceHover
50
+ : selected
51
+ ? theme.semantics.neutral.surface
52
+ : 'transparent',
53
+ borderColor,
54
+ borderWidth: selected ? 1 : 0,
55
+ opacity: disabled ? 0.72 : 1,
56
+ };
57
+ }
58
+
59
+ function renderUnreadCount(unreadCount: React.ReactNode) {
60
+ if (unreadCount == null) {
61
+ return null;
62
+ }
63
+
64
+ return (
65
+ <Badge size="s" tone="primary">
66
+ {unreadCount}
67
+ </Badge>
68
+ );
69
+ }
70
+
71
+ function ChatListItemInner({
72
+ themeId: _themeId,
73
+ mode: _mode,
74
+ testID,
75
+ title,
76
+ preview,
77
+ meta,
78
+ timestamp,
79
+ avatar,
80
+ leading,
81
+ trailing,
82
+ unread = false,
83
+ unreadCount,
84
+ selected = false,
85
+ disabled = false,
86
+ compact = false,
87
+ accessibilityLabel,
88
+ onPress,
89
+ }: ChatListItemProps) {
90
+ const { theme } = useZoraTheme();
91
+ const padding = resolvePadding(compact);
92
+ const avatarName = resolveAvatarName({ avatar, title });
93
+ const isInteractive = Boolean(onPress);
94
+ const hasTimestamp = timestamp != null;
95
+ const hasPreview = preview != null;
96
+ const hasMeta = meta != null;
97
+ const hasTrailing = trailing != null;
98
+ const hasUnreadCount = unreadCount != null;
99
+ const hasSecondaryRow = hasPreview || hasMeta || hasUnreadCount || hasTrailing;
100
+
101
+ const content = ({ pressed, hovered }: { pressed: boolean; hovered: boolean }) => {
102
+ const styles = resolveContainerStyles({
103
+ theme,
104
+ selected,
105
+ pressed,
106
+ hovered,
107
+ disabled,
108
+ });
109
+
110
+ return (
111
+ <Box
112
+ bg={styles.bg}
113
+ borderColor={styles.borderColor}
114
+ borderWidth={styles.borderWidth}
115
+ px={padding.px}
116
+ py={padding.py}
117
+ radius="m"
118
+ style={{ opacity: styles.opacity }}
119
+ >
120
+ <Inline align="center" gap="m" wrap="nowrap">
121
+ {leading ?? (
122
+ <Avatar
123
+ initials={avatar?.initials}
124
+ label={avatar?.label ?? avatarName}
125
+ name={avatarName}
126
+ shape={avatar?.shape}
127
+ size={avatar?.size ?? (compact ? 's' : 'm')}
128
+ source={avatar?.source}
129
+ tone={avatar?.tone}
130
+ />
131
+ )}
132
+
133
+ <Box flex={1}>
134
+ <Stack gap="xxs">
135
+ <Inline align="center" gap="s" justify="space-between" wrap="nowrap">
136
+ <Box flex={1}>
137
+ <Text
138
+ numberOfLines={1}
139
+ tone={disabled ? 'muted' : 'default'}
140
+ variant="bodySmall"
141
+ weight={unread || selected ? 'semiBold' : 'medium'}
142
+ >
143
+ {title}
144
+ </Text>
145
+ </Box>
146
+ {hasTimestamp ? (
147
+ <Text
148
+ numberOfLines={1}
149
+ tone={unread ? 'primary' : 'subtle'}
150
+ variant="caption"
151
+ weight={unread ? 'semiBold' : 'regular'}
152
+ >
153
+ {timestamp}
154
+ </Text>
155
+ ) : null}
156
+ </Inline>
157
+
158
+ {hasSecondaryRow ? (
159
+ <Inline align="center" gap="s" justify="space-between" wrap="nowrap">
160
+ <Box flex={1}>
161
+ <Stack gap="xxs">
162
+ {hasPreview ? (
163
+ <Text
164
+ numberOfLines={1}
165
+ tone={unread ? 'default' : 'muted'}
166
+ variant="bodySmall"
167
+ weight={unread ? 'medium' : 'regular'}
168
+ >
169
+ {preview}
170
+ </Text>
171
+ ) : null}
172
+ {hasMeta ? (
173
+ <Text numberOfLines={1} tone="subtle" variant="caption">
174
+ {meta}
175
+ </Text>
176
+ ) : null}
177
+ </Stack>
178
+ </Box>
179
+
180
+ {hasUnreadCount || hasTrailing ? (
181
+ <Inline align="center" gap="s" wrap="nowrap">
182
+ {renderUnreadCount(unreadCount)}
183
+ {trailing}
184
+ </Inline>
185
+ ) : null}
186
+ </Inline>
187
+ ) : null}
188
+ </Stack>
189
+ </Box>
190
+ </Inline>
191
+ </Box>
192
+ );
193
+ };
194
+
195
+ if (!isInteractive) {
196
+ return <Box testID={testID}>{content({ pressed: false, hovered: false })}</Box>;
197
+ }
198
+
199
+ return (
200
+ <ButtonBase
201
+ accessibilityLabel={accessibilityLabel}
202
+ accessibilityRole="button"
203
+ accessibilityState={{ disabled, selected }}
204
+ disabled={disabled}
205
+ onPress={onPress}
206
+ radius="m"
207
+ testID={testID}
208
+ >
209
+ {(state) =>
210
+ content({
211
+ pressed: state.pressed,
212
+ hovered: state.hovered,
213
+ })
214
+ }
215
+ </ButtonBase>
216
+ );
217
+ }
218
+
219
+ export const ChatListItem = withZoraThemeScope(ChatListItemInner);
@@ -0,0 +1,2 @@
1
+ export { ChatListItem } from './ChatListItem';
2
+ export type { ChatListAvatar, ChatListItemProps } from './types';
@@ -0,0 +1,74 @@
1
+ import type { ZoraComponentMeta } from '../../metadata';
2
+
3
+ export const chatListItemMeta = {
4
+ name: 'ChatListItem',
5
+ category: 'pattern',
6
+ description:
7
+ 'Conversation preview row with avatar, title, preview text, timestamp, and unread state.',
8
+ directManifestNode: true,
9
+ allowedChildren: [],
10
+ blueprint: {
11
+ label: 'Chat list item',
12
+ icon: { name: 'chatbubble-outline' },
13
+ defaultProps: {
14
+ title: 'Ada Lovelace',
15
+ preview: 'Can you review the latest UI update?',
16
+ timestamp: '2m',
17
+ avatar: {
18
+ name: 'Ada Lovelace',
19
+ },
20
+ },
21
+ },
22
+ props: {
23
+ title: {
24
+ type: 'string',
25
+ category: 'Content',
26
+ label: 'Title',
27
+ default: 'Ada Lovelace',
28
+ },
29
+ preview: {
30
+ type: 'string',
31
+ category: 'Content',
32
+ label: 'Preview',
33
+ },
34
+ meta: {
35
+ type: 'string',
36
+ category: 'Content',
37
+ label: 'Meta',
38
+ },
39
+ timestamp: {
40
+ type: 'string',
41
+ category: 'Content',
42
+ label: 'Timestamp',
43
+ },
44
+ unread: {
45
+ type: 'boolean',
46
+ category: 'State',
47
+ label: 'Unread',
48
+ default: false,
49
+ },
50
+ unreadCount: {
51
+ type: 'string',
52
+ category: 'State',
53
+ label: 'Unread count',
54
+ },
55
+ selected: {
56
+ type: 'boolean',
57
+ category: 'State',
58
+ label: 'Selected',
59
+ default: false,
60
+ },
61
+ disabled: {
62
+ type: 'boolean',
63
+ category: 'State',
64
+ label: 'Disabled',
65
+ default: false,
66
+ },
67
+ compact: {
68
+ type: 'boolean',
69
+ category: 'Layout',
70
+ label: 'Compact',
71
+ default: false,
72
+ },
73
+ },
74
+ } as const satisfies ZoraComponentMeta;