@ankhorage/zora 27.10.5 → 27.11.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 +12 -0
- package/README.md +1 -1
- package/dist/capabilities/index.js +17 -1
- package/dist/capabilities/index.js.map +3 -3
- package/dist/features/carousel/Carousel.js +3 -1
- package/dist/features/carousel/Carousel.js.map +1 -1
- package/dist/features/carousel/useCarouselPlayback.d.ts.map +1 -1
- package/dist/features/carousel/useCarouselPlayback.js +2 -1
- package/dist/features/carousel/useCarouselPlayback.js.map +1 -1
- package/dist/features/form/select/adapters/inbound/Select.native.js +1 -1
- package/dist/features/form/select/adapters/inbound/Select.native.js.map +1 -1
- package/dist/features/form/select/adapters/inbound/Select.web.js +1 -1
- package/dist/features/form/select/adapters/inbound/Select.web.js.map +1 -1
- package/dist/features/form/select/composition/SelectOptionRow.d.ts.map +1 -1
- package/dist/features/form/select/composition/SelectOptionRow.js +20 -0
- package/dist/features/form/select/composition/SelectOptionRow.js.map +1 -1
- package/dist/features/form/select/composition/SelectTrigger.d.ts +2 -1
- package/dist/features/form/select/composition/SelectTrigger.d.ts.map +1 -1
- package/dist/features/form/select/composition/SelectTrigger.js +22 -1
- package/dist/features/form/select/composition/SelectTrigger.js.map +1 -1
- package/dist/features/form/select/selectMeta.d.ts +17 -0
- package/dist/features/form/select/selectMeta.d.ts.map +1 -1
- package/dist/features/form/select/selectMeta.js +16 -0
- package/dist/features/form/select/selectMeta.js.map +1 -1
- package/dist/types/select.d.ts +8 -0
- package/dist/types/select.d.ts.map +1 -1
- package/dist/types/select.js.map +1 -1
- package/package.json +8 -3
- package/src/features/carousel/Carousel.test.ts +1 -0
- package/src/features/carousel/Carousel.tsx +3 -1
- package/src/features/carousel/useCarouselPlayback.ts +2 -1
- package/src/features/form/select/adapters/inbound/Select.native.tsx +6 -1
- package/src/features/form/select/adapters/inbound/Select.web.tsx +6 -1
- package/src/features/form/select/composition/SelectOptionRow.tsx +42 -0
- package/src/features/form/select/composition/SelectTrigger.tsx +50 -0
- package/src/features/form/select/public.test.ts +33 -1
- package/src/features/form/select/selectMeta.ts +16 -0
- package/src/metadata/repository.json +30 -0
- package/src/metadata/repository.test.ts +29 -0
- package/src/types/select.ts +8 -0
- package/src/webPackageExports.test.ts +28 -0
- package/web-dist/components/carousel/Carousel.js +5 -2
- package/web-dist/components/select/Select.dependency-2.d.ts +9 -0
- package/web-dist/components/select/Select.dependency-3.d.ts +23 -0
- package/web-dist/components/select/Select.js +108 -4
- package/web-dist/components/select/Select.types-0.d.ts +9 -0
- package/web-dist/index.d.ts +4 -0
- package/web-dist/index.js +4 -0
- package/web-dist/manifest.json +5 -0
|
@@ -59,6 +59,7 @@ test('renders configurable accessible arrows, indicators and progress', () => {
|
|
|
59
59
|
expect(html).toContain('carousel-indicator-0');
|
|
60
60
|
expect(html).toContain('carousel-indicator-1');
|
|
61
61
|
expect(html).toContain('carousel-progress');
|
|
62
|
+
expect(html).toContain('transform-origin:left center');
|
|
62
63
|
expect(html).toContain('Go to slide 1 of 2');
|
|
63
64
|
const minimal = renderCarousel({ slides, showProgress: false });
|
|
64
65
|
expect(minimal).not.toContain('progress');
|
|
@@ -427,7 +427,9 @@ function CarouselProgress({
|
|
|
427
427
|
style={[
|
|
428
428
|
{
|
|
429
429
|
height: '100%',
|
|
430
|
-
width:
|
|
430
|
+
width: '100%',
|
|
431
|
+
transformOrigin: 'left center',
|
|
432
|
+
transform: [{ scaleX: progress }],
|
|
431
433
|
backgroundColor: indicatorColor,
|
|
432
434
|
},
|
|
433
435
|
indicatorStyle,
|
|
@@ -66,7 +66,12 @@ function SelectInner<TValue extends string = string>({
|
|
|
66
66
|
|
|
67
67
|
return (
|
|
68
68
|
<SelectField props={props}>
|
|
69
|
-
<SelectTrigger
|
|
69
|
+
<SelectTrigger
|
|
70
|
+
displayLabel={selectedOption?.label}
|
|
71
|
+
leadingMedia={selectedOption?.leadingMedia}
|
|
72
|
+
onPress={openSelect}
|
|
73
|
+
props={props}
|
|
74
|
+
/>
|
|
70
75
|
</SelectField>
|
|
71
76
|
);
|
|
72
77
|
}
|
|
@@ -35,7 +35,12 @@ function SelectInner<TValue extends string = string>({
|
|
|
35
35
|
<SelectField props={props}>
|
|
36
36
|
<Popover
|
|
37
37
|
anchor={({ toggle }) => (
|
|
38
|
-
<SelectTrigger
|
|
38
|
+
<SelectTrigger
|
|
39
|
+
displayLabel={selectedOption?.label}
|
|
40
|
+
leadingMedia={selectedOption?.leadingMedia}
|
|
41
|
+
onPress={toggle}
|
|
42
|
+
props={props}
|
|
43
|
+
/>
|
|
39
44
|
)}
|
|
40
45
|
interactionPolicy={props.interactionPolicy}
|
|
41
46
|
onOpenChange={setOpen}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { Pressable } from '@ankhorage/surface';
|
|
2
|
+
|
|
1
3
|
import type { SelectOption, SelectProps } from '../../../../types/select';
|
|
2
4
|
import { Button } from '../../../button/public';
|
|
5
|
+
import { Icon } from '../../../icon/public';
|
|
6
|
+
import { Image } from '../../../image/public';
|
|
7
|
+
import { View } from '../../../layout/public';
|
|
8
|
+
import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
|
|
9
|
+
import { Text } from '../../../typography/public';
|
|
3
10
|
|
|
4
11
|
const SELECTED_ICON = { name: 'checkmark' } as const;
|
|
5
12
|
|
|
@@ -11,6 +18,41 @@ export function SelectOptionRow<TValue extends string>({
|
|
|
11
18
|
selected,
|
|
12
19
|
testID,
|
|
13
20
|
}: SelectOptionRowProps<TValue>) {
|
|
21
|
+
const { theme } = useZoraTheme();
|
|
22
|
+
|
|
23
|
+
if (option.leadingMedia) {
|
|
24
|
+
return (
|
|
25
|
+
<Pressable
|
|
26
|
+
accessibilityLabel={option.label}
|
|
27
|
+
disabled={option.disabled}
|
|
28
|
+
interactionPolicy={interactionPolicy}
|
|
29
|
+
onPress={() => onSelect(option.value)}
|
|
30
|
+
style={{ alignSelf: 'stretch' }}
|
|
31
|
+
testID={testID ? `${testID}-option-${option.value}` : undefined}
|
|
32
|
+
>
|
|
33
|
+
<View
|
|
34
|
+
align="center"
|
|
35
|
+
bg={selected ? theme.semantics.action.primary.softBg : 'transparent'}
|
|
36
|
+
direction="row"
|
|
37
|
+
gap="s"
|
|
38
|
+
minHeight={44}
|
|
39
|
+
px="m"
|
|
40
|
+
radius="m"
|
|
41
|
+
>
|
|
42
|
+
<Image alt="" height={28} radius="s" source={option.leadingMedia} width={28} />
|
|
43
|
+
<View flex={1}>
|
|
44
|
+
<Text color={selected ? 'primary' : undefined} numberOfLines={1} variant="label">
|
|
45
|
+
{option.label}
|
|
46
|
+
</Text>
|
|
47
|
+
</View>
|
|
48
|
+
{selected ? (
|
|
49
|
+
<Icon color={theme.semantics.action.primary.base} name="checkmark" size={18} />
|
|
50
|
+
) : null}
|
|
51
|
+
</View>
|
|
52
|
+
</Pressable>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
14
56
|
return (
|
|
15
57
|
<Button
|
|
16
58
|
color={selected ? 'primary' : 'neutral'}
|
|
@@ -1,14 +1,63 @@
|
|
|
1
|
+
import { Pressable } from '@ankhorage/surface';
|
|
2
|
+
|
|
1
3
|
import type { SelectProps } from '../../../../types/select';
|
|
2
4
|
import { Button } from '../../../button/public';
|
|
5
|
+
import { Icon } from '../../../icon/public';
|
|
6
|
+
import { Image } from '../../../image/public';
|
|
7
|
+
import { View } from '../../../layout/public';
|
|
8
|
+
import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
|
|
9
|
+
import { Text } from '../../../typography/public';
|
|
3
10
|
|
|
4
11
|
const SELECT_CHEVRON_ICON = { name: 'chevron-down' } as const;
|
|
5
12
|
|
|
6
13
|
/*** Renders the shared Select trigger with the resolved option label or placeholder. */
|
|
7
14
|
export function SelectTrigger<TValue extends string>({
|
|
8
15
|
displayLabel,
|
|
16
|
+
leadingMedia,
|
|
9
17
|
onPress,
|
|
10
18
|
props,
|
|
11
19
|
}: SelectTriggerProps<TValue>) {
|
|
20
|
+
const { theme } = useZoraTheme();
|
|
21
|
+
const media = leadingMedia ?? props.leadingMedia;
|
|
22
|
+
|
|
23
|
+
if (media) {
|
|
24
|
+
return (
|
|
25
|
+
<Pressable
|
|
26
|
+
accessibilityLabel={displayLabel ?? props.placeholder ?? 'Select'}
|
|
27
|
+
disabled={props.disabled}
|
|
28
|
+
interactionPolicy={props.interactionPolicy}
|
|
29
|
+
onPress={props.readOnly ? undefined : onPress}
|
|
30
|
+
style={{ alignSelf: 'stretch' }}
|
|
31
|
+
testID={props.testID ? `${props.testID}-trigger` : undefined}
|
|
32
|
+
>
|
|
33
|
+
<View
|
|
34
|
+
align="center"
|
|
35
|
+
bg={props.invalid ? theme.semantics.error.softBg : theme.semantics.neutral.surface}
|
|
36
|
+
borderColor={props.invalid ? theme.semantics.error.base : theme.semantics.neutral.divider}
|
|
37
|
+
borderWidth={1}
|
|
38
|
+
direction="row"
|
|
39
|
+
gap="s"
|
|
40
|
+
minHeight={44}
|
|
41
|
+
px="m"
|
|
42
|
+
radius="m"
|
|
43
|
+
>
|
|
44
|
+
<Image alt="" height={28} radius="s" source={media} width={28} />
|
|
45
|
+
<View flex={1}>
|
|
46
|
+
<Text
|
|
47
|
+
emphasis={displayLabel ? 'default' : 'muted'}
|
|
48
|
+
numberOfLines={1}
|
|
49
|
+
variant="label"
|
|
50
|
+
weight={props.labelWeight ?? 'semiBold'}
|
|
51
|
+
>
|
|
52
|
+
{displayLabel ?? props.placeholder ?? 'Select'}
|
|
53
|
+
</Text>
|
|
54
|
+
</View>
|
|
55
|
+
<Icon name="chevron-down" size={18} />
|
|
56
|
+
</View>
|
|
57
|
+
</Pressable>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
12
61
|
return (
|
|
13
62
|
<Button
|
|
14
63
|
color={props.invalid ? 'danger' : 'neutral'}
|
|
@@ -29,6 +78,7 @@ export function SelectTrigger<TValue extends string>({
|
|
|
29
78
|
|
|
30
79
|
interface SelectTriggerProps<TValue extends string> {
|
|
31
80
|
displayLabel: string | undefined;
|
|
81
|
+
leadingMedia: SelectProps<TValue>['leadingMedia'];
|
|
32
82
|
onPress: () => void;
|
|
33
83
|
props: SelectProps<TValue>;
|
|
34
84
|
}
|
|
@@ -21,6 +21,25 @@ test('Select registers the optional leading icon as instance-owned media metadat
|
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
+
test('Select registers leading images for the trigger and individual options', () => {
|
|
25
|
+
expect(selectMeta.props.leadingMedia).toEqual({
|
|
26
|
+
type: 'media',
|
|
27
|
+
category: 'Content',
|
|
28
|
+
label: 'Leading image',
|
|
29
|
+
mediaKinds: ['image'],
|
|
30
|
+
authoring: { authority: 'instance' },
|
|
31
|
+
});
|
|
32
|
+
expect(selectMeta.props.options.itemSchema).toContainEqual({
|
|
33
|
+
key: 'leadingMedia',
|
|
34
|
+
schema: {
|
|
35
|
+
type: 'media',
|
|
36
|
+
category: 'Content',
|
|
37
|
+
label: 'Leading image',
|
|
38
|
+
mediaKinds: ['image'],
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
24
43
|
test('Select registers optional trigger label emphasis as serializable metadata', () => {
|
|
25
44
|
expect(selectMeta.props.labelWeight).toEqual({
|
|
26
45
|
type: 'string',
|
|
@@ -52,10 +71,12 @@ test('Select uses web Popover and native BottomSheetFlatList presentation', asyn
|
|
|
52
71
|
expect(web).toContain("import { Popover } from '@ankhorage/surface';");
|
|
53
72
|
expect(native).toContain('<BottomSheetFlatList');
|
|
54
73
|
expect(native).toContain("contentMode: 'direct'");
|
|
74
|
+
expect(web).toContain('leadingMedia={selectedOption?.leadingMedia}');
|
|
75
|
+
expect(native).toContain('leadingMedia={selectedOption?.leadingMedia}');
|
|
55
76
|
expect(`${neutral}\n${web}\n${native}`).not.toContain('@react-native-picker/picker');
|
|
56
77
|
});
|
|
57
78
|
|
|
58
|
-
test('Select supports
|
|
79
|
+
test('Select supports label emphasis, SVG icons, and leading images', async () => {
|
|
59
80
|
const props: SelectProps = {
|
|
60
81
|
options: [{ label: 'Workspace', value: 'workspace' }],
|
|
61
82
|
};
|
|
@@ -69,11 +90,22 @@ test('Select supports default weight, bold emphasis, SVG icons, and their combin
|
|
|
69
90
|
{ ...props, leadingIcon: svgIcon },
|
|
70
91
|
{ ...props, labelWeight: 'bold', leadingIcon: svgIcon },
|
|
71
92
|
] satisfies readonly SelectProps[];
|
|
93
|
+
const imageSource = { uri: 'https://cdn.example.test/atlas-option.png' } as const;
|
|
94
|
+
const mediaConfigurations = [
|
|
95
|
+
{ ...props, leadingMedia: imageSource },
|
|
96
|
+
{ ...props, options: [{ label: 'Workspace', value: 'workspace', leadingMedia: imageSource }] },
|
|
97
|
+
] satisfies readonly SelectProps[];
|
|
72
98
|
const selectTrigger = await Bun.file(
|
|
73
99
|
'src/features/form/select/composition/SelectTrigger.tsx',
|
|
74
100
|
).text();
|
|
101
|
+
const selectOptionRow = await Bun.file(
|
|
102
|
+
'src/features/form/select/composition/SelectOptionRow.tsx',
|
|
103
|
+
).text();
|
|
75
104
|
|
|
76
105
|
expect(configurations).toHaveLength(4);
|
|
106
|
+
expect(mediaConfigurations).toHaveLength(2);
|
|
77
107
|
expect(selectTrigger).toContain("labelWeight={props.labelWeight ?? 'semiBold'}");
|
|
78
108
|
expect(selectTrigger).toContain('leadingIcon={props.leadingIcon}');
|
|
109
|
+
expect(selectTrigger).toContain('source={media}');
|
|
110
|
+
expect(selectOptionRow).toContain('source={option.leadingMedia}');
|
|
79
111
|
});
|
|
@@ -85,6 +85,15 @@ export const selectMeta = {
|
|
|
85
85
|
key: 'label',
|
|
86
86
|
schema: { type: 'string', category: 'Content', label: 'Label' },
|
|
87
87
|
},
|
|
88
|
+
{
|
|
89
|
+
key: 'leadingMedia',
|
|
90
|
+
schema: {
|
|
91
|
+
type: 'media',
|
|
92
|
+
category: 'Content',
|
|
93
|
+
label: 'Leading image',
|
|
94
|
+
mediaKinds: ['image'],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
88
97
|
{
|
|
89
98
|
key: 'disabled',
|
|
90
99
|
schema: {
|
|
@@ -129,6 +138,13 @@ export const selectMeta = {
|
|
|
129
138
|
mediaKinds: ['image'],
|
|
130
139
|
authoring: { authority: 'instance' },
|
|
131
140
|
},
|
|
141
|
+
leadingMedia: {
|
|
142
|
+
type: 'media',
|
|
143
|
+
category: 'Content',
|
|
144
|
+
label: 'Leading image',
|
|
145
|
+
mediaKinds: ['image'],
|
|
146
|
+
authoring: { authority: 'instance' },
|
|
147
|
+
},
|
|
132
148
|
labelWeight: {
|
|
133
149
|
type: 'string',
|
|
134
150
|
category: 'Style',
|
|
@@ -38,5 +38,35 @@
|
|
|
38
38
|
"Consumers must provide the declared React Native peer dependencies required by the entrypoints they use.",
|
|
39
39
|
"Platform-native behavior is available only where the underlying declared React Native or Expo dependency supports it."
|
|
40
40
|
]
|
|
41
|
+
},
|
|
42
|
+
"build": {
|
|
43
|
+
"targets": {
|
|
44
|
+
"native": {
|
|
45
|
+
"language": "typescript",
|
|
46
|
+
"framework": "react-native",
|
|
47
|
+
"platforms": ["ios", "android", "web"],
|
|
48
|
+
"entry": ".",
|
|
49
|
+
"outDir": "dist",
|
|
50
|
+
"sources": {
|
|
51
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"]
|
|
52
|
+
},
|
|
53
|
+
"builder": {
|
|
54
|
+
"script": "build"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"web": {
|
|
58
|
+
"language": "typescript",
|
|
59
|
+
"framework": "react",
|
|
60
|
+
"platforms": ["web"],
|
|
61
|
+
"entry": "./web/*",
|
|
62
|
+
"outDir": "web-dist",
|
|
63
|
+
"sources": {
|
|
64
|
+
"include": ["src/features/**/public.ts", "src/authoring.browser.ts"]
|
|
65
|
+
},
|
|
66
|
+
"builder": {
|
|
67
|
+
"script": "build"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
41
71
|
}
|
|
42
72
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import repository from './repository.json';
|
|
4
|
+
|
|
5
|
+
/** Verifies that the declared build targets retain their independently owned compiler inputs. */
|
|
6
|
+
test('declares explicit universal and browser compiler roots', () => {
|
|
7
|
+
expect(repository.build).toEqual({
|
|
8
|
+
targets: {
|
|
9
|
+
native: {
|
|
10
|
+
language: 'typescript',
|
|
11
|
+
framework: 'react-native',
|
|
12
|
+
platforms: ['ios', 'android', 'web'],
|
|
13
|
+
entry: '.',
|
|
14
|
+
outDir: 'dist',
|
|
15
|
+
sources: { include: ['src/**/*.ts', 'src/**/*.tsx'] },
|
|
16
|
+
builder: { script: 'build' },
|
|
17
|
+
},
|
|
18
|
+
web: {
|
|
19
|
+
language: 'typescript',
|
|
20
|
+
framework: 'react',
|
|
21
|
+
platforms: ['web'],
|
|
22
|
+
entry: './web/*',
|
|
23
|
+
outDir: 'web-dist',
|
|
24
|
+
sources: { include: ['src/features/**/public.ts', 'src/authoring.browser.ts'] },
|
|
25
|
+
builder: { script: 'build' },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
});
|
package/src/types/select.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { ButtonIconSpec, ButtonLabelWeight } from '@ankhorage/surface';
|
|
2
2
|
|
|
3
3
|
import type { ZoraBaseProps } from './base';
|
|
4
|
+
import type { ImageProps } from './image';
|
|
4
5
|
|
|
5
6
|
export interface SelectOption<TValue extends string = string> {
|
|
6
7
|
value: TValue;
|
|
7
8
|
label: string;
|
|
9
|
+
/** Optional image rendered before this option label and in the trigger when selected. */
|
|
10
|
+
leadingMedia?: ImageProps['source'];
|
|
8
11
|
disabled?: boolean;
|
|
9
12
|
}
|
|
10
13
|
|
|
@@ -19,6 +22,11 @@ export interface SelectProps<TValue extends string = string> extends ZoraBasePro
|
|
|
19
22
|
placeholder?: string;
|
|
20
23
|
/** Optional Surface icon source rendered before the trigger label. */
|
|
21
24
|
leadingIcon?: ButtonIconSpec;
|
|
25
|
+
/**
|
|
26
|
+
* Optional image rendered before the trigger label. A selected option's leadingMedia takes
|
|
27
|
+
* precedence. When present, media takes precedence over leadingIcon.
|
|
28
|
+
*/
|
|
29
|
+
leadingMedia?: ImageProps['source'];
|
|
22
30
|
/** Optional Surface Button label emphasis; defaults to semiBold. */
|
|
23
31
|
labelWeight?: ButtonLabelWeight;
|
|
24
32
|
required?: boolean;
|
|
@@ -28,9 +28,37 @@ interface WebArtifactManifest {
|
|
|
28
28
|
readonly component: string;
|
|
29
29
|
readonly exportName: string;
|
|
30
30
|
readonly files: readonly string[];
|
|
31
|
+
readonly sourceKind: 'public' | 'web-artifact';
|
|
31
32
|
}[];
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
/** Verifies that the web facade is generated from the canonical web-only artifact catalog. */
|
|
36
|
+
test('publishes every generated web-only artifact through the web package facade', async () => {
|
|
37
|
+
const manifest = (await Bun.file('web-dist/manifest.json').json()) as WebArtifactManifest;
|
|
38
|
+
const packageJson = (await Bun.file('package.json').json()) as {
|
|
39
|
+
readonly exports: Record<string, unknown>;
|
|
40
|
+
};
|
|
41
|
+
const facade = await Bun.file('web-dist/index.js').text();
|
|
42
|
+
const artifact = (await import('@ankhorage/zora/web')) as Record<string, unknown>;
|
|
43
|
+
|
|
44
|
+
expect(packageJson.exports['./web']).toEqual({
|
|
45
|
+
types: './web-dist/index.d.ts',
|
|
46
|
+
import: './web-dist/index.js',
|
|
47
|
+
default: './web-dist/index.js',
|
|
48
|
+
});
|
|
49
|
+
expect(Object.keys(artifact).sort()).toEqual(
|
|
50
|
+
[
|
|
51
|
+
'ZoraProvider',
|
|
52
|
+
'useZoraTheme',
|
|
53
|
+
...manifest.artifacts
|
|
54
|
+
.filter(({ sourceKind }) => sourceKind === 'web-artifact')
|
|
55
|
+
.map(({ exportName }) => exportName),
|
|
56
|
+
].sort(),
|
|
57
|
+
);
|
|
58
|
+
expect(facade).not.toContain('/src/');
|
|
59
|
+
expect(facade).not.toContain('@ankhorage/surface');
|
|
60
|
+
});
|
|
61
|
+
|
|
34
62
|
/** Verifies that each generated package subpath exposes exactly its discovered component contract. */
|
|
35
63
|
test('isolates every generated component web runtime and declaration entrypoint', async () => {
|
|
36
64
|
const manifest = (await Bun.file('web-dist/manifest.json').json()) as WebArtifactManifest;
|
|
@@ -64,7 +64,8 @@ function useCarouselPlayback({
|
|
|
64
64
|
toValue: 1,
|
|
65
65
|
duration,
|
|
66
66
|
easing: import_react_native.Easing.linear,
|
|
67
|
-
useNativeDriver:
|
|
67
|
+
useNativeDriver: true,
|
|
68
|
+
isInteraction: false
|
|
68
69
|
});
|
|
69
70
|
animation.start();
|
|
70
71
|
return () => animation.stop();
|
|
@@ -439,7 +440,9 @@ function CarouselProgress({
|
|
|
439
440
|
style: [
|
|
440
441
|
{
|
|
441
442
|
height: "100%",
|
|
442
|
-
width:
|
|
443
|
+
width: "100%",
|
|
444
|
+
transformOrigin: "left center",
|
|
445
|
+
transform: [{ scaleX: progress }],
|
|
443
446
|
backgroundColor: indicatorColor
|
|
444
447
|
},
|
|
445
448
|
indicatorStyle
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ImageProps as SurfaceImageProps, SurfaceImageSource } from '@ankhorage/surface';
|
|
2
|
+
|
|
3
|
+
import type { ZoraBaseProps } from './Select.dependency-0.js';
|
|
4
|
+
|
|
5
|
+
import type { UploadAsset } from './Select.dependency-3.js';
|
|
6
|
+
|
|
7
|
+
export interface ImageProps extends ZoraBaseProps, Omit<SurfaceImageProps, 'mode' | 'source' | 'themeId'> {
|
|
8
|
+
source?: SurfaceImageSource | UploadAsset | null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface UploadAssetBase {
|
|
2
|
+
fileName?: string;
|
|
3
|
+
sizeBytes?: number;
|
|
4
|
+
contentType?: string;
|
|
5
|
+
width?: number;
|
|
6
|
+
height?: number;
|
|
7
|
+
alt?: string;
|
|
8
|
+
createdAt?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type UploadAsset = (UploadAssetBase & {
|
|
12
|
+
kind: 'local';
|
|
13
|
+
uri: string;
|
|
14
|
+
}) | (UploadAssetBase & {
|
|
15
|
+
kind: 'url';
|
|
16
|
+
url: string;
|
|
17
|
+
}) | (UploadAssetBase & {
|
|
18
|
+
kind: 'storage';
|
|
19
|
+
storageId?: string;
|
|
20
|
+
bucket: string;
|
|
21
|
+
path: string;
|
|
22
|
+
publicUrl?: string;
|
|
23
|
+
});
|
|
@@ -22,15 +22,28 @@ import"../../chunks/Accordion-705yrq6w.js";
|
|
|
22
22
|
import {
|
|
23
23
|
Field3
|
|
24
24
|
} from "../../chunks/Accordion-6m3k4avp.js";
|
|
25
|
+
import {
|
|
26
|
+
Pressable
|
|
27
|
+
} from "../../chunks/Accordion-rzf52xq8.js";
|
|
25
28
|
import"../../chunks/Accordion-pmfdf08d.js";
|
|
26
|
-
import"../../chunks/Accordion-rzf52xq8.js";
|
|
27
29
|
import {
|
|
28
30
|
Button3
|
|
29
31
|
} from "../../chunks/Accordion-0kr0h68p.js";
|
|
32
|
+
import {
|
|
33
|
+
Icon2
|
|
34
|
+
} from "../../chunks/Accordion-1etqb3cj.js";
|
|
35
|
+
import {
|
|
36
|
+
Image2
|
|
37
|
+
} from "../../chunks/Accordion-h2nd5y0z.js";
|
|
38
|
+
import {
|
|
39
|
+
Text3
|
|
40
|
+
} from "../../chunks/Accordion-aws0caav.js";
|
|
30
41
|
import"../../chunks/Accordion-61e19g3e.js";
|
|
31
42
|
import"../../chunks/Accordion-c6edgxay.js";
|
|
32
43
|
import"../../chunks/Accordion-vnrqvfca.js";
|
|
33
|
-
import
|
|
44
|
+
import {
|
|
45
|
+
useZoraTheme2
|
|
46
|
+
} from "../../chunks/Accordion-c3nna2bz.js";
|
|
34
47
|
import"../../chunks/Accordion-fre84yaq.js";
|
|
35
48
|
import"../../chunks/Accordion-xgpzh4wq.js";
|
|
36
49
|
|
|
@@ -54,7 +67,7 @@ function SelectField({ children, props }) {
|
|
|
54
67
|
}
|
|
55
68
|
|
|
56
69
|
// src/features/form/select/composition/SelectOptionRow.tsx
|
|
57
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
70
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
58
71
|
var SELECTED_ICON = { name: "checkmark" };
|
|
59
72
|
function SelectOptionRow({
|
|
60
73
|
interactionPolicy,
|
|
@@ -63,6 +76,49 @@ function SelectOptionRow({
|
|
|
63
76
|
selected,
|
|
64
77
|
testID
|
|
65
78
|
}) {
|
|
79
|
+
const { theme } = useZoraTheme2();
|
|
80
|
+
if (option.leadingMedia) {
|
|
81
|
+
return /* @__PURE__ */ jsx2(Pressable, {
|
|
82
|
+
accessibilityLabel: option.label,
|
|
83
|
+
disabled: option.disabled,
|
|
84
|
+
interactionPolicy,
|
|
85
|
+
onPress: () => onSelect(option.value),
|
|
86
|
+
style: { alignSelf: "stretch" },
|
|
87
|
+
testID: testID ? `${testID}-option-${option.value}` : undefined,
|
|
88
|
+
children: /* @__PURE__ */ jsxs(View2, {
|
|
89
|
+
align: "center",
|
|
90
|
+
bg: selected ? theme.semantics.action.primary.softBg : "transparent",
|
|
91
|
+
direction: "row",
|
|
92
|
+
gap: "s",
|
|
93
|
+
minHeight: 44,
|
|
94
|
+
px: "m",
|
|
95
|
+
radius: "m",
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx2(Image2, {
|
|
98
|
+
alt: "",
|
|
99
|
+
height: 28,
|
|
100
|
+
radius: "s",
|
|
101
|
+
source: option.leadingMedia,
|
|
102
|
+
width: 28
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ jsx2(View2, {
|
|
105
|
+
flex: 1,
|
|
106
|
+
children: /* @__PURE__ */ jsx2(Text3, {
|
|
107
|
+
color: selected ? "primary" : undefined,
|
|
108
|
+
numberOfLines: 1,
|
|
109
|
+
variant: "label",
|
|
110
|
+
children: option.label
|
|
111
|
+
})
|
|
112
|
+
}),
|
|
113
|
+
selected ? /* @__PURE__ */ jsx2(Icon2, {
|
|
114
|
+
color: theme.semantics.action.primary.base,
|
|
115
|
+
name: "checkmark",
|
|
116
|
+
size: 18
|
|
117
|
+
}) : null
|
|
118
|
+
]
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
}
|
|
66
122
|
return /* @__PURE__ */ jsx2(Button3, {
|
|
67
123
|
color: selected ? "primary" : "neutral",
|
|
68
124
|
disabled: option.disabled,
|
|
@@ -77,13 +133,60 @@ function SelectOptionRow({
|
|
|
77
133
|
}
|
|
78
134
|
|
|
79
135
|
// src/features/form/select/composition/SelectTrigger.tsx
|
|
80
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
136
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
81
137
|
var SELECT_CHEVRON_ICON = { name: "chevron-down" };
|
|
82
138
|
function SelectTrigger({
|
|
83
139
|
displayLabel,
|
|
140
|
+
leadingMedia,
|
|
84
141
|
onPress,
|
|
85
142
|
props
|
|
86
143
|
}) {
|
|
144
|
+
const { theme } = useZoraTheme2();
|
|
145
|
+
const media = leadingMedia ?? props.leadingMedia;
|
|
146
|
+
if (media) {
|
|
147
|
+
return /* @__PURE__ */ jsx3(Pressable, {
|
|
148
|
+
accessibilityLabel: displayLabel ?? props.placeholder ?? "Select",
|
|
149
|
+
disabled: props.disabled,
|
|
150
|
+
interactionPolicy: props.interactionPolicy,
|
|
151
|
+
onPress: props.readOnly ? undefined : onPress,
|
|
152
|
+
style: { alignSelf: "stretch" },
|
|
153
|
+
testID: props.testID ? `${props.testID}-trigger` : undefined,
|
|
154
|
+
children: /* @__PURE__ */ jsxs2(View2, {
|
|
155
|
+
align: "center",
|
|
156
|
+
bg: props.invalid ? theme.semantics.error.softBg : theme.semantics.neutral.surface,
|
|
157
|
+
borderColor: props.invalid ? theme.semantics.error.base : theme.semantics.neutral.divider,
|
|
158
|
+
borderWidth: 1,
|
|
159
|
+
direction: "row",
|
|
160
|
+
gap: "s",
|
|
161
|
+
minHeight: 44,
|
|
162
|
+
px: "m",
|
|
163
|
+
radius: "m",
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsx3(Image2, {
|
|
166
|
+
alt: "",
|
|
167
|
+
height: 28,
|
|
168
|
+
radius: "s",
|
|
169
|
+
source: media,
|
|
170
|
+
width: 28
|
|
171
|
+
}),
|
|
172
|
+
/* @__PURE__ */ jsx3(View2, {
|
|
173
|
+
flex: 1,
|
|
174
|
+
children: /* @__PURE__ */ jsx3(Text3, {
|
|
175
|
+
emphasis: displayLabel ? "default" : "muted",
|
|
176
|
+
numberOfLines: 1,
|
|
177
|
+
variant: "label",
|
|
178
|
+
weight: props.labelWeight ?? "semiBold",
|
|
179
|
+
children: displayLabel ?? props.placeholder ?? "Select"
|
|
180
|
+
})
|
|
181
|
+
}),
|
|
182
|
+
/* @__PURE__ */ jsx3(Icon2, {
|
|
183
|
+
name: "chevron-down",
|
|
184
|
+
size: 18
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
})
|
|
188
|
+
});
|
|
189
|
+
}
|
|
87
190
|
return /* @__PURE__ */ jsx3(Button3, {
|
|
88
191
|
color: props.invalid ? "danger" : "neutral",
|
|
89
192
|
disabled: props.disabled,
|
|
@@ -134,6 +237,7 @@ function SelectInner({
|
|
|
134
237
|
children: /* @__PURE__ */ jsx4(Popover, {
|
|
135
238
|
anchor: ({ toggle }) => /* @__PURE__ */ jsx4(SelectTrigger, {
|
|
136
239
|
displayLabel: selectedOption?.label,
|
|
240
|
+
leadingMedia: selectedOption?.leadingMedia,
|
|
137
241
|
onPress: toggle,
|
|
138
242
|
props
|
|
139
243
|
}),
|
|
@@ -2,9 +2,13 @@ import type { ButtonIconSpec, ButtonLabelWeight } from '@ankhorage/surface';
|
|
|
2
2
|
|
|
3
3
|
import type { ZoraBaseProps } from './Select.dependency-0.js';
|
|
4
4
|
|
|
5
|
+
import type { ImageProps } from './Select.dependency-2.js';
|
|
6
|
+
|
|
5
7
|
export interface SelectOption<TValue extends string = string> {
|
|
6
8
|
value: TValue;
|
|
7
9
|
label: string;
|
|
10
|
+
/** Optional image rendered before this option label and in the trigger when selected. */
|
|
11
|
+
leadingMedia?: ImageProps['source'];
|
|
8
12
|
disabled?: boolean;
|
|
9
13
|
}
|
|
10
14
|
|
|
@@ -19,6 +23,11 @@ export interface SelectProps<TValue extends string = string> extends ZoraBasePro
|
|
|
19
23
|
placeholder?: string;
|
|
20
24
|
/** Optional Surface icon source rendered before the trigger label. */
|
|
21
25
|
leadingIcon?: ButtonIconSpec;
|
|
26
|
+
/**
|
|
27
|
+
* Optional image rendered before the trigger label. A selected option's leadingMedia takes
|
|
28
|
+
* precedence. When present, media takes precedence over leadingIcon.
|
|
29
|
+
*/
|
|
30
|
+
leadingMedia?: ImageProps['source'];
|
|
22
31
|
/** Optional Surface Button label emphasis; defaults to semiBold. */
|
|
23
32
|
labelWeight?: ButtonLabelWeight;
|
|
24
33
|
required?: boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ZoraProvider, useZoraTheme } from './runtime/ZoraProvider.js';
|
|
2
|
+
export { ActivityIndicator } from './components/activity-indicator/index.js';
|
|
3
|
+
export { GraphView } from './components/graph-view/index.js';
|
|
4
|
+
export { TreeView } from './components/tree-view/index.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ZoraProvider, useZoraTheme } from './runtime/ZoraProvider.js';
|
|
2
|
+
export { ActivityIndicator } from './components/activity-indicator/index.js';
|
|
3
|
+
export { GraphView } from './components/graph-view/index.js';
|
|
4
|
+
export { TreeView } from './components/tree-view/index.js';
|