@ankhorage/zora 27.10.6 → 27.11.1
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 +13 -0
- package/README.md +1 -1
- package/dist/capabilities/index.js +17 -1
- package/dist/capabilities/index.js.map +3 -3
- 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 +11 -6
- 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/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
|
@@ -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;
|
|
@@ -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';
|
package/web-dist/manifest.json
CHANGED
|
@@ -3635,10 +3635,13 @@
|
|
|
3635
3635
|
"components/select/Select.d.ts",
|
|
3636
3636
|
"components/select/Select.dependency-0.d.ts",
|
|
3637
3637
|
"components/select/Select.dependency-1.d.ts",
|
|
3638
|
+
"components/select/Select.dependency-2.d.ts",
|
|
3639
|
+
"components/select/Select.dependency-3.d.ts",
|
|
3638
3640
|
"components/select/Select.types-0.d.ts",
|
|
3639
3641
|
"components/select/index.js",
|
|
3640
3642
|
"components/select/index.d.ts",
|
|
3641
3643
|
"chunks/Accordion-0kr0h68p.js",
|
|
3644
|
+
"chunks/Accordion-1etqb3cj.js",
|
|
3642
3645
|
"chunks/Accordion-3s7zeagv.js",
|
|
3643
3646
|
"chunks/Accordion-49w9bc2f.js",
|
|
3644
3647
|
"chunks/Accordion-61e19g3e.js",
|
|
@@ -3647,12 +3650,14 @@
|
|
|
3647
3650
|
"chunks/Accordion-6m3k4avp.js",
|
|
3648
3651
|
"chunks/Accordion-705yrq6w.js",
|
|
3649
3652
|
"chunks/Accordion-an5prgty.js",
|
|
3653
|
+
"chunks/Accordion-aws0caav.js",
|
|
3650
3654
|
"chunks/Accordion-c3nna2bz.js",
|
|
3651
3655
|
"chunks/Accordion-c6edgxay.js",
|
|
3652
3656
|
"chunks/Accordion-dtt4qkrb.js",
|
|
3653
3657
|
"chunks/Accordion-e5jr9ahb.js",
|
|
3654
3658
|
"chunks/Accordion-fcczvwgg.js",
|
|
3655
3659
|
"chunks/Accordion-fre84yaq.js",
|
|
3660
|
+
"chunks/Accordion-h2nd5y0z.js",
|
|
3656
3661
|
"chunks/Accordion-kcx57mk5.js",
|
|
3657
3662
|
"chunks/Accordion-mnac2z83.js",
|
|
3658
3663
|
"chunks/Accordion-nh0cs9hq.js",
|