@ankhorage/zora 17.0.0 → 18.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.
Files changed (145) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/constants.d.ts +1 -1
  4. package/dist/constants.js +1 -1
  5. package/dist/constants.js.map +1 -1
  6. package/dist/features/auth/adapters/inbound/AuthFormField.js +3 -3
  7. package/dist/features/auth/adapters/inbound/AuthFormField.js.map +1 -1
  8. package/dist/features/form/field/adapters/inbound/Field.d.ts +5 -0
  9. package/dist/features/form/field/adapters/inbound/Field.d.ts.map +1 -0
  10. package/dist/features/form/field/adapters/inbound/Field.js +20 -0
  11. package/dist/features/form/field/adapters/inbound/Field.js.map +1 -0
  12. package/dist/features/form/{formFieldMeta.d.ts → field/meta.d.ts} +4 -4
  13. package/dist/features/form/field/meta.d.ts.map +1 -0
  14. package/dist/features/form/{formFieldMeta.js → field/meta.js} +4 -4
  15. package/dist/features/form/field/meta.js.map +1 -0
  16. package/dist/features/form/field/public.d.ts +2 -0
  17. package/dist/features/form/field/public.d.ts.map +1 -0
  18. package/dist/features/form/field/public.js +2 -0
  19. package/dist/features/form/field/public.js.map +1 -0
  20. package/dist/features/form/formMeta.d.ts +1 -1
  21. package/dist/features/form/formMeta.js +1 -1
  22. package/dist/features/form/formMeta.js.map +1 -1
  23. package/dist/features/form/public.d.ts +2 -2
  24. package/dist/features/form/public.d.ts.map +1 -1
  25. package/dist/features/form/public.js +1 -1
  26. package/dist/features/form/public.js.map +1 -1
  27. package/dist/features/list/adapters/inbound/List.d.ts +5 -0
  28. package/dist/features/list/adapters/inbound/List.d.ts.map +1 -0
  29. package/dist/features/list/adapters/inbound/List.js +34 -0
  30. package/dist/features/list/adapters/inbound/List.js.map +1 -0
  31. package/dist/features/list/adapters/inbound/ListItem.d.ts +5 -0
  32. package/dist/features/list/adapters/inbound/ListItem.d.ts.map +1 -0
  33. package/dist/features/list/adapters/inbound/ListItem.js +43 -0
  34. package/dist/features/list/adapters/inbound/ListItem.js.map +1 -0
  35. package/dist/features/list/adapters/inbound/ListSection.d.ts +5 -0
  36. package/dist/features/list/adapters/inbound/ListSection.d.ts.map +1 -0
  37. package/dist/{patterns/list → features/list/adapters/inbound}/ListSection.js +4 -8
  38. package/dist/features/list/adapters/inbound/ListSection.js.map +1 -0
  39. package/dist/{patterns → features}/list/meta.d.ts +6 -6
  40. package/dist/features/list/meta.d.ts.map +1 -0
  41. package/dist/{patterns → features}/list/meta.js +6 -14
  42. package/dist/features/list/meta.js.map +1 -0
  43. package/dist/features/list/public.d.ts +4 -0
  44. package/dist/features/list/public.d.ts.map +1 -1
  45. package/dist/features/list/public.js +3 -0
  46. package/dist/features/list/public.js.map +1 -1
  47. package/dist/features/list/utils/resolveListSeparator.d.ts +5 -0
  48. package/dist/features/list/utils/resolveListSeparator.d.ts.map +1 -0
  49. package/dist/{patterns/list → features/list/utils}/resolveListSeparator.js +1 -0
  50. package/dist/features/list/utils/resolveListSeparator.js.map +1 -0
  51. package/dist/features/skeleton/adapters/inbound/SkeletonList.d.ts.map +1 -1
  52. package/dist/features/skeleton/adapters/inbound/SkeletonList.js +2 -2
  53. package/dist/features/skeleton/adapters/inbound/SkeletonList.js.map +1 -1
  54. package/dist/features/uploader/adapters/inbound/Uploader.js +3 -3
  55. package/dist/features/uploader/adapters/inbound/Uploader.js.map +1 -1
  56. package/dist/index.d.ts +4 -4
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +2 -2
  59. package/dist/index.js.map +1 -1
  60. package/dist/metadata/bindableComponentMeta.d.ts +1 -1
  61. package/dist/metadata/bindableComponentMeta.js +1 -1
  62. package/dist/metadata/bindableComponentMeta.js.map +1 -1
  63. package/dist/metadata/componentMeta.js +4 -4
  64. package/dist/metadata/componentMeta.js.map +1 -1
  65. package/dist/patterns/inspector-field/InspectorField.js +3 -3
  66. package/dist/patterns/inspector-field/InspectorField.js.map +1 -1
  67. package/dist/patterns/switch-field/SwitchField.d.ts +1 -2
  68. package/dist/patterns/switch-field/SwitchField.d.ts.map +1 -1
  69. package/dist/patterns/switch-field/SwitchField.js +3 -4
  70. package/dist/patterns/switch-field/SwitchField.js.map +1 -1
  71. package/dist/patterns/tree-view/TreeItem.d.ts.map +1 -1
  72. package/dist/patterns/tree-view/TreeItem.js +2 -2
  73. package/dist/patterns/tree-view/TreeItem.js.map +1 -1
  74. package/dist/registry.js +4 -4
  75. package/dist/registry.js.map +1 -1
  76. package/dist/types/form.d.ts +1 -1
  77. package/dist/types/form.d.ts.map +1 -1
  78. package/dist/types/form.js.map +1 -1
  79. package/dist/{patterns/list/types.d.ts → types/list.d.ts} +14 -18
  80. package/dist/types/list.d.ts.map +1 -0
  81. package/dist/types/list.js +2 -0
  82. package/dist/types/list.js.map +1 -0
  83. package/package.json +2 -2
  84. package/src/constants.ts +1 -1
  85. package/src/features/auth/adapters/inbound/AuthFormField.tsx +3 -3
  86. package/src/features/bottom-sheet/public.test.ts +1 -1
  87. package/src/features/form/{adapters/inbound/FormField.tsx → field/adapters/inbound/Field.tsx} +10 -10
  88. package/src/features/form/{formFieldMeta.ts → field/meta.ts} +5 -4
  89. package/src/features/form/field/public.ts +1 -0
  90. package/src/features/form/formMeta.ts +1 -1
  91. package/src/features/form/public.ts +2 -2
  92. package/src/features/list/adapters/inbound/List.tsx +77 -0
  93. package/src/features/list/adapters/inbound/ListItem.tsx +89 -0
  94. package/src/{patterns/list → features/list/adapters/inbound}/ListSection.tsx +5 -10
  95. package/src/{patterns → features}/list/meta.ts +7 -14
  96. package/src/features/list/public.ts +11 -0
  97. package/src/features/list/utils/resolveListSeparator.ts +9 -0
  98. package/src/features/skeleton/adapters/inbound/SkeletonList.tsx +3 -3
  99. package/src/features/uploader/adapters/inbound/Uploader.tsx +3 -3
  100. package/src/index.ts +11 -10
  101. package/src/metadata/bindableComponentMeta.ts +1 -1
  102. package/src/metadata/componentMeta.test.ts +5 -5
  103. package/src/metadata/componentMeta.ts +4 -4
  104. package/src/patterns/inspector-field/InspectorField.tsx +3 -3
  105. package/src/patterns/switch-field/SwitchField.tsx +8 -8
  106. package/src/patterns/tree-view/TreeItem.tsx +2 -2
  107. package/src/registry.ts +4 -4
  108. package/src/showcaseCoverage.test.ts +2 -2
  109. package/src/theme/themeScopeStructure.test.ts +5 -5
  110. package/src/types/form.ts +1 -1
  111. package/src/{patterns/list/types.ts → types/list.ts} +17 -18
  112. package/dist/features/form/adapters/inbound/FormField.d.ts +0 -5
  113. package/dist/features/form/adapters/inbound/FormField.d.ts.map +0 -1
  114. package/dist/features/form/adapters/inbound/FormField.js +0 -20
  115. package/dist/features/form/adapters/inbound/FormField.js.map +0 -1
  116. package/dist/features/form/formFieldMeta.d.ts.map +0 -1
  117. package/dist/features/form/formFieldMeta.js.map +0 -1
  118. package/dist/patterns/list/List.d.ts +0 -9
  119. package/dist/patterns/list/List.d.ts.map +0 -1
  120. package/dist/patterns/list/List.js +0 -40
  121. package/dist/patterns/list/List.js.map +0 -1
  122. package/dist/patterns/list/ListRow.d.ts +0 -9
  123. package/dist/patterns/list/ListRow.d.ts.map +0 -1
  124. package/dist/patterns/list/ListRow.js +0 -113
  125. package/dist/patterns/list/ListRow.js.map +0 -1
  126. package/dist/patterns/list/ListSection.d.ts +0 -9
  127. package/dist/patterns/list/ListSection.d.ts.map +0 -1
  128. package/dist/patterns/list/ListSection.js.map +0 -1
  129. package/dist/patterns/list/index.d.ts +0 -5
  130. package/dist/patterns/list/index.d.ts.map +0 -1
  131. package/dist/patterns/list/index.js +0 -4
  132. package/dist/patterns/list/index.js.map +0 -1
  133. package/dist/patterns/list/meta.d.ts.map +0 -1
  134. package/dist/patterns/list/meta.js.map +0 -1
  135. package/dist/patterns/list/resolveListSeparator.d.ts +0 -5
  136. package/dist/patterns/list/resolveListSeparator.d.ts.map +0 -1
  137. package/dist/patterns/list/resolveListSeparator.js.map +0 -1
  138. package/dist/patterns/list/types.d.ts.map +0 -1
  139. package/dist/patterns/list/types.js +0 -2
  140. package/dist/patterns/list/types.js.map +0 -1
  141. package/src/patterns/list/List.tsx +0 -77
  142. package/src/patterns/list/ListRow.tsx +0 -198
  143. package/src/patterns/list/index.ts +0 -10
  144. package/src/patterns/list/resolveListSeparator.test.ts +0 -18
  145. package/src/patterns/list/resolveListSeparator.ts +0 -8
@@ -1,198 +0,0 @@
1
- import { ButtonBase } from '@ankhorage/surface';
2
- import React from 'react';
3
-
4
- import { View } from '../../features/layout/public';
5
- import { Text } from '../../features/typography/public';
6
- import { useZoraTheme } from '../../theme/useZoraTheme';
7
- import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
8
- import type { ListRowProps, ListRowVariant } from './types';
9
-
10
- function resolvePadding(compact: boolean) {
11
- return compact ? { px: 'm' as const, py: 's' as const } : { px: 'm' as const, py: 'm' as const };
12
- }
13
-
14
- function resolveContainerStyles({
15
- variant,
16
- theme,
17
- selected,
18
- pressed,
19
- hovered,
20
- disabled,
21
- }: {
22
- variant: ListRowVariant;
23
- theme: ReturnType<typeof useZoraTheme>['theme'];
24
- selected: boolean;
25
- pressed: boolean;
26
- hovered: boolean;
27
- disabled: boolean;
28
- }) {
29
- const borderColor = selected ? theme.semantics.border.focus : theme.semantics.border.default;
30
- const dividerBorderColor = selected ? theme.semantics.border.focus : 'transparent';
31
-
32
- if (variant === 'card') {
33
- return {
34
- bg: pressed
35
- ? theme.semantics.neutral.surfaceActive
36
- : hovered
37
- ? theme.semantics.neutral.surfaceHover
38
- : theme.semantics.surface.raised,
39
- borderColor,
40
- borderWidth: 1,
41
- radius: 'l' as const,
42
- opacity: disabled ? 0.72 : 1,
43
- };
44
- }
45
-
46
- return {
47
- bg: pressed
48
- ? theme.semantics.neutral.surfaceActive
49
- : hovered
50
- ? theme.semantics.neutral.surfaceHover
51
- : selected
52
- ? theme.semantics.neutral.surface
53
- : 'transparent',
54
- borderColor: dividerBorderColor,
55
- borderWidth: selected ? 1 : 0,
56
- radius: 'm' as const,
57
- opacity: disabled ? 0.72 : 1,
58
- };
59
- }
60
-
61
- function ListRowInner({
62
- themeId: _themeId,
63
- mode: _mode,
64
- testID,
65
- title,
66
- description,
67
- meta,
68
- leading,
69
- trailing,
70
- action,
71
- onPress,
72
- selected = false,
73
- disabled = false,
74
- compact = false,
75
- variant = 'divider',
76
- }: ListRowProps) {
77
- const { theme } = useZoraTheme();
78
- const padding = resolvePadding(compact);
79
- const isInteractive = Boolean(onPress) && !action;
80
-
81
- const content = (
82
- <View
83
- align="center"
84
- direction="row"
85
- style={{
86
- flex: 1,
87
- }}
88
- >
89
- {leading ? (
90
- <>
91
- <View>{leading}</View>
92
- <View width="m" />
93
- </>
94
- ) : null}
95
-
96
- <View flex={1}>
97
- <View gap="xxs">
98
- <Text variant="body" weight={selected ? 'semiBold' : 'medium'}>
99
- {title}
100
- </Text>
101
- {description ? (
102
- <Text emphasis="muted" variant="bodySmall">
103
- {description}
104
- </Text>
105
- ) : null}
106
- {meta ? (
107
- <Text emphasis="subtle" variant="caption">
108
- {meta}
109
- </Text>
110
- ) : null}
111
- </View>
112
- </View>
113
-
114
- {trailing || action ? (
115
- <>
116
- <View width="m" />
117
- <View direction="row" align="center" gap="s" wrap="nowrap">
118
- {trailing}
119
- {action}
120
- </View>
121
- </>
122
- ) : null}
123
- </View>
124
- );
125
-
126
- if (!isInteractive) {
127
- const styles = resolveContainerStyles({
128
- variant,
129
- theme,
130
- selected,
131
- pressed: false,
132
- hovered: false,
133
- disabled,
134
- });
135
-
136
- return (
137
- <View
138
- bg={styles.bg}
139
- borderColor={styles.borderColor}
140
- borderWidth={styles.borderWidth}
141
- px={padding.px}
142
- py={padding.py}
143
- radius={styles.radius}
144
- testID={testID}
145
- style={{
146
- opacity: styles.opacity,
147
- }}
148
- >
149
- {content}
150
- </View>
151
- );
152
- }
153
-
154
- return (
155
- <ButtonBase
156
- accessibilityRole="button"
157
- accessibilityState={{ disabled, selected }}
158
- disabled={disabled}
159
- onPress={onPress}
160
- radius={variant === 'card' ? 'l' : 'm'}
161
- testID={testID}
162
- >
163
- {(state) => {
164
- const styles = resolveContainerStyles({
165
- variant,
166
- theme,
167
- selected,
168
- pressed: state.pressed,
169
- hovered: state.hovered,
170
- disabled: state.disabled,
171
- });
172
-
173
- return (
174
- <View
175
- bg={styles.bg}
176
- borderColor={styles.borderColor}
177
- borderWidth={styles.borderWidth}
178
- px={padding.px}
179
- py={padding.py}
180
- radius={styles.radius}
181
- style={{
182
- opacity: styles.opacity,
183
- }}
184
- >
185
- {content}
186
- </View>
187
- );
188
- }}
189
- </ButtonBase>
190
- );
191
- }
192
-
193
- /***
194
- * Row pattern for lists with leading/trailing slots and optional press behavior.
195
- *
196
-
197
- */
198
- export const ListRow = withZoraThemeScope(ListRowInner);
@@ -1,10 +0,0 @@
1
- export { List } from './List';
2
- export { ListRow } from './ListRow';
3
- export { ListSection } from './ListSection';
4
- export type {
5
- ListChildrenProps,
6
- ListItemsProps,
7
- ListProps,
8
- ListRowProps,
9
- ListRowVariant,
10
- } from './types';
@@ -1,18 +0,0 @@
1
- import { describe, expect, it } from 'bun:test';
2
-
3
- import { resolveListSeparator } from './resolveListSeparator';
4
-
5
- describe('resolveListSeparator', () => {
6
- it('returns none for the first item', () => {
7
- expect(resolveListSeparator('divider', 0)).toBe('none');
8
- expect(resolveListSeparator('card', 0)).toBe('none');
9
- });
10
-
11
- it('returns divider for divider rows', () => {
12
- expect(resolveListSeparator('divider', 1)).toBe('divider');
13
- });
14
-
15
- it('returns spacer for card rows', () => {
16
- expect(resolveListSeparator('card', 1)).toBe('spacer');
17
- });
18
- });
@@ -1,8 +0,0 @@
1
- import type { ListRowVariant } from './types';
2
-
3
- type ListSeparatorKind = 'none' | 'divider' | 'spacer';
4
-
5
- export function resolveListSeparator(variant: ListRowVariant, index: number): ListSeparatorKind {
6
- if (index === 0) return 'none';
7
- return variant === 'divider' ? 'divider' : 'spacer';
8
- }