@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.
- package/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/features/auth/adapters/inbound/AuthFormField.js +3 -3
- package/dist/features/auth/adapters/inbound/AuthFormField.js.map +1 -1
- package/dist/features/form/field/adapters/inbound/Field.d.ts +5 -0
- package/dist/features/form/field/adapters/inbound/Field.d.ts.map +1 -0
- package/dist/features/form/field/adapters/inbound/Field.js +20 -0
- package/dist/features/form/field/adapters/inbound/Field.js.map +1 -0
- package/dist/features/form/{formFieldMeta.d.ts → field/meta.d.ts} +4 -4
- package/dist/features/form/field/meta.d.ts.map +1 -0
- package/dist/features/form/{formFieldMeta.js → field/meta.js} +4 -4
- package/dist/features/form/field/meta.js.map +1 -0
- package/dist/features/form/field/public.d.ts +2 -0
- package/dist/features/form/field/public.d.ts.map +1 -0
- package/dist/features/form/field/public.js +2 -0
- package/dist/features/form/field/public.js.map +1 -0
- package/dist/features/form/formMeta.d.ts +1 -1
- package/dist/features/form/formMeta.js +1 -1
- package/dist/features/form/formMeta.js.map +1 -1
- package/dist/features/form/public.d.ts +2 -2
- package/dist/features/form/public.d.ts.map +1 -1
- package/dist/features/form/public.js +1 -1
- package/dist/features/form/public.js.map +1 -1
- package/dist/features/list/adapters/inbound/List.d.ts +5 -0
- package/dist/features/list/adapters/inbound/List.d.ts.map +1 -0
- package/dist/features/list/adapters/inbound/List.js +34 -0
- package/dist/features/list/adapters/inbound/List.js.map +1 -0
- package/dist/features/list/adapters/inbound/ListItem.d.ts +5 -0
- package/dist/features/list/adapters/inbound/ListItem.d.ts.map +1 -0
- package/dist/features/list/adapters/inbound/ListItem.js +43 -0
- package/dist/features/list/adapters/inbound/ListItem.js.map +1 -0
- package/dist/features/list/adapters/inbound/ListSection.d.ts +5 -0
- package/dist/features/list/adapters/inbound/ListSection.d.ts.map +1 -0
- package/dist/{patterns/list → features/list/adapters/inbound}/ListSection.js +4 -8
- package/dist/features/list/adapters/inbound/ListSection.js.map +1 -0
- package/dist/{patterns → features}/list/meta.d.ts +6 -6
- package/dist/features/list/meta.d.ts.map +1 -0
- package/dist/{patterns → features}/list/meta.js +6 -14
- package/dist/features/list/meta.js.map +1 -0
- package/dist/features/list/public.d.ts +4 -0
- package/dist/features/list/public.d.ts.map +1 -1
- package/dist/features/list/public.js +3 -0
- package/dist/features/list/public.js.map +1 -1
- package/dist/features/list/utils/resolveListSeparator.d.ts +5 -0
- package/dist/features/list/utils/resolveListSeparator.d.ts.map +1 -0
- package/dist/{patterns/list → features/list/utils}/resolveListSeparator.js +1 -0
- package/dist/features/list/utils/resolveListSeparator.js.map +1 -0
- package/dist/features/skeleton/adapters/inbound/SkeletonList.d.ts.map +1 -1
- package/dist/features/skeleton/adapters/inbound/SkeletonList.js +2 -2
- package/dist/features/skeleton/adapters/inbound/SkeletonList.js.map +1 -1
- package/dist/features/uploader/adapters/inbound/Uploader.js +3 -3
- package/dist/features/uploader/adapters/inbound/Uploader.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/metadata/bindableComponentMeta.d.ts +1 -1
- package/dist/metadata/bindableComponentMeta.js +1 -1
- package/dist/metadata/bindableComponentMeta.js.map +1 -1
- package/dist/metadata/componentMeta.js +4 -4
- package/dist/metadata/componentMeta.js.map +1 -1
- package/dist/patterns/inspector-field/InspectorField.js +3 -3
- package/dist/patterns/inspector-field/InspectorField.js.map +1 -1
- package/dist/patterns/switch-field/SwitchField.d.ts +1 -2
- package/dist/patterns/switch-field/SwitchField.d.ts.map +1 -1
- package/dist/patterns/switch-field/SwitchField.js +3 -4
- package/dist/patterns/switch-field/SwitchField.js.map +1 -1
- package/dist/patterns/tree-view/TreeItem.d.ts.map +1 -1
- package/dist/patterns/tree-view/TreeItem.js +2 -2
- package/dist/patterns/tree-view/TreeItem.js.map +1 -1
- package/dist/registry.js +4 -4
- package/dist/registry.js.map +1 -1
- package/dist/types/form.d.ts +1 -1
- package/dist/types/form.d.ts.map +1 -1
- package/dist/types/form.js.map +1 -1
- package/dist/{patterns/list/types.d.ts → types/list.d.ts} +14 -18
- package/dist/types/list.d.ts.map +1 -0
- package/dist/types/list.js +2 -0
- package/dist/types/list.js.map +1 -0
- package/package.json +2 -2
- package/src/constants.ts +1 -1
- package/src/features/auth/adapters/inbound/AuthFormField.tsx +3 -3
- package/src/features/bottom-sheet/public.test.ts +1 -1
- package/src/features/form/{adapters/inbound/FormField.tsx → field/adapters/inbound/Field.tsx} +10 -10
- package/src/features/form/{formFieldMeta.ts → field/meta.ts} +5 -4
- package/src/features/form/field/public.ts +1 -0
- package/src/features/form/formMeta.ts +1 -1
- package/src/features/form/public.ts +2 -2
- package/src/features/list/adapters/inbound/List.tsx +77 -0
- package/src/features/list/adapters/inbound/ListItem.tsx +89 -0
- package/src/{patterns/list → features/list/adapters/inbound}/ListSection.tsx +5 -10
- package/src/{patterns → features}/list/meta.ts +7 -14
- package/src/features/list/public.ts +11 -0
- package/src/features/list/utils/resolveListSeparator.ts +9 -0
- package/src/features/skeleton/adapters/inbound/SkeletonList.tsx +3 -3
- package/src/features/uploader/adapters/inbound/Uploader.tsx +3 -3
- package/src/index.ts +11 -10
- package/src/metadata/bindableComponentMeta.ts +1 -1
- package/src/metadata/componentMeta.test.ts +5 -5
- package/src/metadata/componentMeta.ts +4 -4
- package/src/patterns/inspector-field/InspectorField.tsx +3 -3
- package/src/patterns/switch-field/SwitchField.tsx +8 -8
- package/src/patterns/tree-view/TreeItem.tsx +2 -2
- package/src/registry.ts +4 -4
- package/src/showcaseCoverage.test.ts +2 -2
- package/src/theme/themeScopeStructure.test.ts +5 -5
- package/src/types/form.ts +1 -1
- package/src/{patterns/list/types.ts → types/list.ts} +17 -18
- package/dist/features/form/adapters/inbound/FormField.d.ts +0 -5
- package/dist/features/form/adapters/inbound/FormField.d.ts.map +0 -1
- package/dist/features/form/adapters/inbound/FormField.js +0 -20
- package/dist/features/form/adapters/inbound/FormField.js.map +0 -1
- package/dist/features/form/formFieldMeta.d.ts.map +0 -1
- package/dist/features/form/formFieldMeta.js.map +0 -1
- package/dist/patterns/list/List.d.ts +0 -9
- package/dist/patterns/list/List.d.ts.map +0 -1
- package/dist/patterns/list/List.js +0 -40
- package/dist/patterns/list/List.js.map +0 -1
- package/dist/patterns/list/ListRow.d.ts +0 -9
- package/dist/patterns/list/ListRow.d.ts.map +0 -1
- package/dist/patterns/list/ListRow.js +0 -113
- package/dist/patterns/list/ListRow.js.map +0 -1
- package/dist/patterns/list/ListSection.d.ts +0 -9
- package/dist/patterns/list/ListSection.d.ts.map +0 -1
- package/dist/patterns/list/ListSection.js.map +0 -1
- package/dist/patterns/list/index.d.ts +0 -5
- package/dist/patterns/list/index.d.ts.map +0 -1
- package/dist/patterns/list/index.js +0 -4
- package/dist/patterns/list/index.js.map +0 -1
- package/dist/patterns/list/meta.d.ts.map +0 -1
- package/dist/patterns/list/meta.js.map +0 -1
- package/dist/patterns/list/resolveListSeparator.d.ts +0 -5
- package/dist/patterns/list/resolveListSeparator.d.ts.map +0 -1
- package/dist/patterns/list/resolveListSeparator.js.map +0 -1
- package/dist/patterns/list/types.d.ts.map +0 -1
- package/dist/patterns/list/types.js +0 -2
- package/dist/patterns/list/types.js.map +0 -1
- package/src/patterns/list/List.tsx +0 -77
- package/src/patterns/list/ListRow.tsx +0 -198
- package/src/patterns/list/index.ts +0 -10
- package/src/patterns/list/resolveListSeparator.test.ts +0 -18
- 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,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
|
-
}
|