@ankhorage/zora 28.8.3 → 28.10.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 +16 -0
- package/README.md +1 -1
- package/dist/capabilities/index.js +133 -5
- package/dist/capabilities/index.js.map +8 -7
- package/dist/constants/authoring.d.ts +4 -3
- package/dist/constants/authoring.d.ts.map +1 -1
- package/dist/constants/authoring.js +3 -0
- package/dist/constants/authoring.js.map +1 -1
- package/dist/features/accordion/accordionItemMeta.d.ts +1 -1
- package/dist/features/bottom-sheet/bottomSheetMeta.d.ts +1 -1
- package/dist/features/calendar/adapters/inbound/Calendar.d.ts +1 -1
- package/dist/features/calendar/adapters/inbound/Calendar.d.ts.map +1 -1
- package/dist/features/calendar/adapters/inbound/Calendar.js +207 -75
- package/dist/features/calendar/adapters/inbound/Calendar.js.map +1 -1
- package/dist/features/calendar/calendarMeta.d.ts +106 -4
- package/dist/features/calendar/calendarMeta.d.ts.map +1 -1
- package/dist/features/calendar/calendarMeta.js +44 -4
- package/dist/features/calendar/calendarMeta.js.map +1 -1
- package/dist/features/calendar/public.d.ts +1 -1
- package/dist/features/calendar/public.d.ts.map +1 -1
- package/dist/features/calendar/public.js.map +1 -1
- package/dist/features/card/cardMeta.d.ts +1 -1
- package/dist/features/card/mediaCardMeta.d.ts +1 -1
- package/dist/features/card/postCardMeta.d.ts +1 -1
- package/dist/features/chat/messageBubbleMeta.d.ts +1 -1
- package/dist/features/data-table/dataTableMeta.d.ts +10 -0
- package/dist/features/data-table/dataTableMeta.d.ts.map +1 -1
- package/dist/features/data-table/dataTableMeta.js +7 -0
- package/dist/features/data-table/dataTableMeta.js.map +1 -1
- package/dist/features/dialog/dialogMeta.d.ts +2 -2
- package/dist/features/gradient/gradientMeta.d.ts +1 -1
- package/dist/features/keyboard-avoiding-view/keyboardAvoidingViewMeta.d.ts +1 -1
- package/dist/features/layout/gridMeta.d.ts +1 -1
- package/dist/features/layout/screenMeta.d.ts +1 -1
- package/dist/features/layout/scrollViewMeta.d.ts +1 -1
- package/dist/features/layout/viewMeta.d.ts +1 -1
- package/dist/features/list/flatListMeta.d.ts +1 -1
- package/dist/features/list/sectionListMeta.d.ts +1 -1
- package/dist/features/master-detail/masterDetailMeta.d.ts +1 -1
- package/dist/features/popover/adapters/inbound/Popover.js +6 -3
- package/dist/features/popover/adapters/inbound/Popover.js.map +1 -1
- package/dist/features/popover/popoverMeta.d.ts +101 -0
- package/dist/features/popover/popoverMeta.d.ts.map +1 -0
- package/dist/features/popover/popoverMeta.js +78 -0
- package/dist/features/popover/popoverMeta.js.map +1 -0
- package/dist/features/reader/meta.d.ts +2 -2
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.d.ts.map +1 -1
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js +2 -0
- package/dist/features/registry/ZORA_BASE_COMPONENT_REGISTRY.js.map +1 -1
- package/dist/features/registry/bindableComponentMeta.d.ts +2 -2
- package/dist/features/registry/componentMeta.d.ts.map +1 -1
- package/dist/features/registry/componentMeta.js +2 -0
- package/dist/features/registry/componentMeta.js.map +1 -1
- package/dist/features/scanner/meta.d.ts +2 -2
- package/dist/features/section/screenSectionMeta.d.ts +1 -1
- package/dist/features/surface/surfaceMeta.d.ts +1 -1
- package/dist/features/tabs/tabPanelMeta.d.ts +1 -1
- package/dist/readerFree.d.ts +1 -0
- package/dist/readerFree.d.ts.map +1 -1
- package/dist/readerFree.js +1 -0
- package/dist/readerFree.js.map +1 -1
- package/dist/types/calendar.d.ts +40 -19
- package/dist/types/calendar.d.ts.map +1 -1
- package/dist/types/calendar.js.map +1 -1
- package/dist/types/popover.d.ts +4 -1
- package/dist/types/popover.d.ts.map +1 -1
- package/dist/types/popover.js.map +1 -1
- package/package.json +102 -1
- package/src/constants/authoring.ts +3 -0
- package/src/features/calendar/adapters/inbound/Calendar.interaction.test.tsx +95 -0
- package/src/features/calendar/adapters/inbound/Calendar.tsx +425 -135
- package/src/features/calendar/calendarMeta.ts +44 -4
- package/src/features/calendar/public.test.ts +8 -5
- package/src/features/calendar/public.ts +4 -0
- package/src/features/data-table/adapters/inbound/DataTable.test.tsx +52 -1
- package/src/features/data-table/dataTableMeta.test.ts +8 -1
- package/src/features/data-table/dataTableMeta.ts +7 -0
- package/src/features/popover/adapters/inbound/Popover.tsx +17 -2
- package/src/features/popover/manifest.test.tsx +153 -0
- package/src/features/popover/popoverMeta.ts +79 -0
- package/src/features/popover/public.test.ts +2 -1
- package/src/features/registry/ZORA_BASE_COMPONENT_REGISTRY.ts +2 -0
- package/src/features/registry/componentMeta.test.ts +2 -0
- package/src/features/registry/componentMeta.ts +2 -0
- package/src/features/registry/featureManifest.test.ts +11 -0
- package/src/readerFree.ts +6 -0
- package/src/types/calendar.ts +44 -19
- package/src/types/popover.ts +5 -1
- package/src/webPackageExports.test.ts +1 -0
- package/web-dist/chunks/Accordion-59x6e7bs.js +200 -0
- package/web-dist/chunks/Accordion-q2yxtdzc.js +426 -0
- package/web-dist/components/calendar/Calendar.d.ts +2 -2
- package/web-dist/components/calendar/Calendar.dependency-2.d.ts +165 -0
- package/web-dist/components/calendar/Calendar.js +2 -1
- package/web-dist/components/calendar/Calendar.types-0.d.ts +45 -19
- package/web-dist/components/calendar/index.d.ts +1 -1
- package/web-dist/components/date-picker/DatePicker.js +2 -1
- package/web-dist/components/popover/Popover.js +10 -2
- package/web-dist/components/popover/Popover.types-0.d.ts +4 -1
- package/web-dist/components/time-grid/TimeGrid.js +4 -198
- package/web-dist/manifest.json +6 -2
- package/web-dist/chunks/Accordion-v3bmbnfh.js +0 -237
|
@@ -3,9 +3,49 @@ import type { ZoraComponentMeta } from '../../types/authoring';
|
|
|
3
3
|
export const calendarMeta = {
|
|
4
4
|
name: 'Calendar',
|
|
5
5
|
category: 'component',
|
|
6
|
-
description: '
|
|
7
|
-
directManifestNode:
|
|
8
|
-
note: 'Uses Date values and executable change callbacks; available through the public code API.',
|
|
6
|
+
description: 'Serializable Calendar with GridView month and TimeGrid day/week views.',
|
|
7
|
+
directManifestNode: true,
|
|
9
8
|
allowedChildren: [],
|
|
10
|
-
|
|
9
|
+
blueprint: {
|
|
10
|
+
label: 'Calendar',
|
|
11
|
+
defaultProps: { displayedDate: '2026-12-04', events: [], view: 'month' },
|
|
12
|
+
},
|
|
13
|
+
events: {
|
|
14
|
+
dateChange: {
|
|
15
|
+
label: 'Date change',
|
|
16
|
+
eventType: 'calendar.dateChange',
|
|
17
|
+
payloadFields: [{ path: 'date', type: 'string', label: 'Date' }],
|
|
18
|
+
},
|
|
19
|
+
viewChange: {
|
|
20
|
+
label: 'View change',
|
|
21
|
+
eventType: 'calendar.viewChange',
|
|
22
|
+
payloadFields: [{ path: 'view', type: 'string', label: 'View' }],
|
|
23
|
+
},
|
|
24
|
+
eventActivate: {
|
|
25
|
+
label: 'Activate event',
|
|
26
|
+
eventType: 'calendar.eventActivate',
|
|
27
|
+
payloadFields: [{ path: 'eventId', type: 'string', label: 'Event ID' }],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
bindings: {
|
|
31
|
+
props: {
|
|
32
|
+
displayedDate: { value: { type: 'string' }, acceptsFallback: true, acceptsTransforms: true },
|
|
33
|
+
events: {
|
|
34
|
+
value: { type: 'array', itemType: 'object' },
|
|
35
|
+
acceptsFallback: true,
|
|
36
|
+
acceptsTransforms: true,
|
|
37
|
+
},
|
|
38
|
+
view: { value: { type: 'string' }, acceptsFallback: true },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
displayedDate: { type: 'string', category: 'State', label: 'Displayed date' },
|
|
43
|
+
defaultDisplayedDate: { type: 'string', category: 'State', label: 'Initial displayed date' },
|
|
44
|
+
view: { type: 'enum', category: 'State', enum: ['day', 'week', 'month'] },
|
|
45
|
+
timeZone: { type: 'string', category: 'State', label: 'Timezone' },
|
|
46
|
+
events: { type: 'array', category: 'Data', label: 'Events' },
|
|
47
|
+
locale: { type: 'string', category: 'Content', label: 'Locale' },
|
|
48
|
+
weekStartsOn: { type: 'number', category: 'Layout', label: 'Week starts on' },
|
|
49
|
+
density: { type: 'enum', category: 'Layout', enum: ['regular', 'compact'] },
|
|
50
|
+
},
|
|
11
51
|
} as const satisfies ZoraComponentMeta;
|
|
@@ -2,13 +2,16 @@ import { expect, test } from 'bun:test';
|
|
|
2
2
|
|
|
3
3
|
import { calendarMeta } from './calendarMeta';
|
|
4
4
|
|
|
5
|
-
test('Calendar publishes
|
|
5
|
+
test('Calendar publishes serializable GridView and TimeGrid manifest presentations', async () => {
|
|
6
6
|
const source = await Bun.file('src/features/calendar/adapters/inbound/Calendar.tsx').text();
|
|
7
7
|
|
|
8
|
-
expect(calendarMeta.directManifestNode).toBe(
|
|
8
|
+
expect(calendarMeta.directManifestNode).toBe(true);
|
|
9
9
|
expect(calendarMeta.description).toContain('GridView');
|
|
10
|
+
expect(calendarMeta.description).toContain('TimeGrid');
|
|
11
|
+
expect(calendarMeta.bindings.props.displayedDate.value.type).toBe('string');
|
|
12
|
+
expect(calendarMeta.events.eventActivate.eventType).toBe('calendar.eventActivate');
|
|
10
13
|
expect(source).toContain('<GridView');
|
|
11
|
-
expect(source).toContain('
|
|
12
|
-
expect(source).toContain(
|
|
13
|
-
expect(source).toContain('
|
|
14
|
+
expect(source).toContain('<TimeGrid');
|
|
15
|
+
expect(source).toContain('getZonedDateTimeParts');
|
|
16
|
+
expect(source).toContain('onEventActivate?.({ eventId: id })');
|
|
14
17
|
});
|
|
@@ -78,7 +78,20 @@ await mock.module('../../../card/public', () => ({
|
|
|
78
78
|
</div>
|
|
79
79
|
),
|
|
80
80
|
}));
|
|
81
|
-
await mock.module('../../../empty-state/public', () => ({
|
|
81
|
+
await mock.module('../../../empty-state/public', () => ({
|
|
82
|
+
EmptyState: ({
|
|
83
|
+
description,
|
|
84
|
+
title,
|
|
85
|
+
}: {
|
|
86
|
+
description?: React.ReactNode;
|
|
87
|
+
title?: React.ReactNode;
|
|
88
|
+
}) => (
|
|
89
|
+
<div data-testid="empty-state">
|
|
90
|
+
{title}
|
|
91
|
+
{description}
|
|
92
|
+
</div>
|
|
93
|
+
),
|
|
94
|
+
}));
|
|
82
95
|
await mock.module('../../../form/checkbox/public', () => ({
|
|
83
96
|
Checkbox: ({
|
|
84
97
|
accessibilityLabel,
|
|
@@ -232,6 +245,44 @@ test('keeps controlled selection visibly disabled in passive mode', async () =>
|
|
|
232
245
|
}
|
|
233
246
|
});
|
|
234
247
|
|
|
248
|
+
test('renders reactive row replacements while retaining supported loading and empty presentations', async () => {
|
|
249
|
+
const mounted = mount();
|
|
250
|
+
const columns = [{ accessor: 'name' as const, header: 'Company', id: 'company' }];
|
|
251
|
+
|
|
252
|
+
try {
|
|
253
|
+
await mounted.render(<DataTable columns={columns} loading rowKey="id" rows={[]} />);
|
|
254
|
+
expect(mounted.host.textContent).not.toContain('No data');
|
|
255
|
+
|
|
256
|
+
await mounted.render(
|
|
257
|
+
<DataTable columns={columns} rowKey="id" rows={[{ id: 'acme', name: 'Acme' }]} />,
|
|
258
|
+
);
|
|
259
|
+
expect(mounted.host.textContent).toContain('Acme');
|
|
260
|
+
|
|
261
|
+
await mounted.render(
|
|
262
|
+
<DataTable columns={columns} rowKey="id" rows={[{ id: 'zora', name: 'ZORA' }]} />,
|
|
263
|
+
);
|
|
264
|
+
expect(mounted.host.textContent).not.toContain('Acme');
|
|
265
|
+
expect(mounted.host.textContent).toContain('ZORA');
|
|
266
|
+
|
|
267
|
+
await mounted.render(
|
|
268
|
+
<DataTable
|
|
269
|
+
columns={columns}
|
|
270
|
+
emptyDescription="The request could not be completed."
|
|
271
|
+
emptyTitle="Unable to load companies"
|
|
272
|
+
rowKey="id"
|
|
273
|
+
rows={[]}
|
|
274
|
+
/>,
|
|
275
|
+
);
|
|
276
|
+
expect(mounted.host.querySelector('[data-testid="empty-state"]')?.textContent).toContain(
|
|
277
|
+
'Unable to load companies',
|
|
278
|
+
);
|
|
279
|
+
expect(mounted.host.textContent).toContain('The request could not be completed.');
|
|
280
|
+
} finally {
|
|
281
|
+
await mounted.unmount();
|
|
282
|
+
mounted.host.remove();
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
|
|
235
286
|
test('uses desktop stable row ids and the controlled callback in mobile cards', async () => {
|
|
236
287
|
mobilePresentation = true;
|
|
237
288
|
const mounted = mount();
|
|
@@ -9,7 +9,14 @@ test('describes serializable controlled selection and row activation manifest ev
|
|
|
9
9
|
rowActivate: { payload: { eventType: 'dataTable.rowActivate' } },
|
|
10
10
|
selectionChange: { payload: { eventType: 'dataTable.selectionChange' } },
|
|
11
11
|
},
|
|
12
|
-
props: {
|
|
12
|
+
props: {
|
|
13
|
+
rows: {
|
|
14
|
+
acceptsFallback: true,
|
|
15
|
+
acceptsTransforms: true,
|
|
16
|
+
value: { itemType: 'object', type: 'array' },
|
|
17
|
+
},
|
|
18
|
+
selectedRowIds: { value: { type: 'array' } },
|
|
19
|
+
},
|
|
13
20
|
},
|
|
14
21
|
events: {
|
|
15
22
|
rowActivate: { payloadFields: [{ path: 'rowId', type: 'string' }] },
|
|
@@ -28,6 +28,13 @@ export const dataTableMeta = {
|
|
|
28
28
|
},
|
|
29
29
|
bindings: {
|
|
30
30
|
props: {
|
|
31
|
+
rows: {
|
|
32
|
+
label: 'Rows',
|
|
33
|
+
description: 'Reactive serializable rows rendered by the data table.',
|
|
34
|
+
value: { type: 'array', itemType: 'object' },
|
|
35
|
+
acceptsFallback: true,
|
|
36
|
+
acceptsTransforms: true,
|
|
37
|
+
},
|
|
31
38
|
sort: {
|
|
32
39
|
value: {
|
|
33
40
|
type: 'object',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Popover as SurfacePopover } from '@ankhorage/surface';
|
|
1
|
+
import { Button as SurfaceButton, Popover as SurfacePopover } from '@ankhorage/surface';
|
|
2
2
|
|
|
3
3
|
import type { PopoverProps } from '../../../../types/popover';
|
|
4
4
|
import { withZoraThemeScope } from '../../../theme/adapters/inbound/withZoraThemeScope';
|
|
@@ -11,7 +11,22 @@ function PopoverInner({
|
|
|
11
11
|
inverted: _inverted,
|
|
12
12
|
mode: _mode,
|
|
13
13
|
themeId: _themeId,
|
|
14
|
+
anchor,
|
|
15
|
+
disabled,
|
|
16
|
+
triggerLabel,
|
|
14
17
|
...props
|
|
15
18
|
}: PopoverProps) {
|
|
16
|
-
return
|
|
19
|
+
return (
|
|
20
|
+
<SurfacePopover
|
|
21
|
+
{...props}
|
|
22
|
+
anchor={
|
|
23
|
+
anchor ??
|
|
24
|
+
(({ toggle }) => (
|
|
25
|
+
<SurfaceButton disabled={disabled} onPress={toggle}>
|
|
26
|
+
{triggerLabel}
|
|
27
|
+
</SurfaceButton>
|
|
28
|
+
))
|
|
29
|
+
}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
17
32
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import type { ComponentDataBindingRegistry, UiNode } from '@ankhorage/contracts';
|
|
2
|
+
import { expect, mock, test } from 'bun:test';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { renderToStaticMarkup } from 'react-dom/server';
|
|
5
|
+
|
|
6
|
+
interface CapturedPopoverProps {
|
|
7
|
+
readonly anchor: (controls: {
|
|
8
|
+
close: () => void;
|
|
9
|
+
open: boolean;
|
|
10
|
+
toggle: () => void;
|
|
11
|
+
}) => React.ReactNode;
|
|
12
|
+
readonly children?: React.ReactNode;
|
|
13
|
+
readonly onOpenChange?: (open: boolean) => void;
|
|
14
|
+
readonly open?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let capturedPopoverProps: CapturedPopoverProps | undefined;
|
|
18
|
+
|
|
19
|
+
await mock.module('@ankhorage/surface', () => ({
|
|
20
|
+
Button: ({ children, disabled }: React.PropsWithChildren<{ readonly disabled?: boolean }>) => (
|
|
21
|
+
<button disabled={disabled}>{children}</button>
|
|
22
|
+
),
|
|
23
|
+
Divider: () => <hr />,
|
|
24
|
+
Grid: ({ children }: React.PropsWithChildren) => <div>{children}</div>,
|
|
25
|
+
IconButton: () => <button />,
|
|
26
|
+
Popover: (props: CapturedPopoverProps) => {
|
|
27
|
+
capturedPopoverProps = props;
|
|
28
|
+
return (
|
|
29
|
+
<section>
|
|
30
|
+
{props.anchor({
|
|
31
|
+
close: () => props.onOpenChange?.(false),
|
|
32
|
+
open: props.open ?? false,
|
|
33
|
+
toggle: () => undefined,
|
|
34
|
+
})}
|
|
35
|
+
{props.children}
|
|
36
|
+
</section>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
ThemeScope: ({ children }: React.PropsWithChildren) => children,
|
|
40
|
+
View: ({ children }: React.PropsWithChildren) => <div>{children}</div>,
|
|
41
|
+
ScrollView: ({ children }: React.PropsWithChildren) => <div>{children}</div>,
|
|
42
|
+
useTheme: () => ({
|
|
43
|
+
colors: {},
|
|
44
|
+
config: {},
|
|
45
|
+
radii: {},
|
|
46
|
+
shadows: {},
|
|
47
|
+
spacing: {},
|
|
48
|
+
typography: { headings: {}, sizes: {}, weights: {} },
|
|
49
|
+
}),
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
await mock.module('react-native', () => ({
|
|
53
|
+
Platform: { OS: 'web' },
|
|
54
|
+
StyleSheet: { create: <T,>(styles: T) => styles },
|
|
55
|
+
Text: ({ children }: React.PropsWithChildren) => <span>{children}</span>,
|
|
56
|
+
View: ({ children }: React.PropsWithChildren) => <div>{children}</div>,
|
|
57
|
+
}));
|
|
58
|
+
|
|
59
|
+
const [
|
|
60
|
+
{ RuntimeRenderer, composeRuntimeCapabilityExecutor, createRuntimeMemoryStateAdapter },
|
|
61
|
+
{ Popover },
|
|
62
|
+
] = await Promise.all([import('@ankhorage/runtime'), import('./public')]);
|
|
63
|
+
|
|
64
|
+
const popoverNode = {
|
|
65
|
+
id: 'popover',
|
|
66
|
+
type: 'Popover',
|
|
67
|
+
props: { disabled: true, triggerLabel: 'Filter options' },
|
|
68
|
+
children: [
|
|
69
|
+
{
|
|
70
|
+
id: 'nested-select',
|
|
71
|
+
type: 'Select',
|
|
72
|
+
props: {
|
|
73
|
+
options: [{ label: 'Open', value: 'open' }],
|
|
74
|
+
searchable: true,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
} as const satisfies UiNode;
|
|
79
|
+
|
|
80
|
+
const popoverBindings = {
|
|
81
|
+
popover: {
|
|
82
|
+
componentId: 'popover',
|
|
83
|
+
events: {
|
|
84
|
+
openChange: [
|
|
85
|
+
{
|
|
86
|
+
target: {
|
|
87
|
+
capability: 'state.set',
|
|
88
|
+
input: {
|
|
89
|
+
path: { kind: 'literal', value: 'popover.open' },
|
|
90
|
+
value: { capability: 'popover.openChange', path: 'payload.open' },
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
props: {
|
|
97
|
+
open: {
|
|
98
|
+
value: { kind: 'state', path: { kind: 'literal', value: 'popover.open' } },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
} as const satisfies ComponentDataBindingRegistry;
|
|
103
|
+
|
|
104
|
+
/*** Allows the Runtime event dispatch scheduled by a component callback to complete. */
|
|
105
|
+
async function flushRuntimeEvent(): Promise<void> {
|
|
106
|
+
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
test('drives controlled manifest Popover opening and closing through StateAdapter with a nested searchable Select', async () => {
|
|
110
|
+
const stateAdapter = createRuntimeMemoryStateAdapter({
|
|
111
|
+
initialState: { popover: { open: false } },
|
|
112
|
+
});
|
|
113
|
+
const executeCapability = composeRuntimeCapabilityExecutor({ stateAdapter });
|
|
114
|
+
const diagnostics: unknown[] = [];
|
|
115
|
+
const render = () =>
|
|
116
|
+
renderToStaticMarkup(
|
|
117
|
+
<RuntimeRenderer
|
|
118
|
+
dataBindings={popoverBindings}
|
|
119
|
+
executeCapability={executeCapability}
|
|
120
|
+
isRoot
|
|
121
|
+
node={popoverNode}
|
|
122
|
+
onDiagnostics={(nextDiagnostics) => diagnostics.push(...nextDiagnostics)}
|
|
123
|
+
resolveEventCapability={({ eventName }) =>
|
|
124
|
+
eventName === 'openChange' ? 'popover.openChange' : undefined
|
|
125
|
+
}
|
|
126
|
+
registry={{
|
|
127
|
+
Popover,
|
|
128
|
+
Select: ({ searchable }: { readonly searchable?: boolean }) => (
|
|
129
|
+
<output data-searchable={searchable}>Searchable select</output>
|
|
130
|
+
),
|
|
131
|
+
}}
|
|
132
|
+
stateAdapter={stateAdapter}
|
|
133
|
+
/>,
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
const initialMarkup = render();
|
|
137
|
+
expect(initialMarkup).toContain('Filter options');
|
|
138
|
+
expect(initialMarkup).toContain('disabled=""');
|
|
139
|
+
expect(initialMarkup).toContain('data-searchable="true"');
|
|
140
|
+
expect(capturedPopoverProps?.open).toBe(false);
|
|
141
|
+
|
|
142
|
+
capturedPopoverProps?.onOpenChange?.(true);
|
|
143
|
+
await flushRuntimeEvent();
|
|
144
|
+
expect(diagnostics).toEqual([]);
|
|
145
|
+
expect(stateAdapter.get<boolean>('popover.open')).toEqual({ data: true, ok: true });
|
|
146
|
+
|
|
147
|
+
render();
|
|
148
|
+
expect(capturedPopoverProps?.open).toBe(true);
|
|
149
|
+
|
|
150
|
+
capturedPopoverProps?.onOpenChange?.(false);
|
|
151
|
+
await flushRuntimeEvent();
|
|
152
|
+
expect(stateAdapter.get<boolean>('popover.open')).toEqual({ data: false, ok: true });
|
|
153
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { CONTAINER_ALLOWED_CHILDREN } from '../../constants/authoring';
|
|
2
|
+
import type { ZoraComponentMeta } from '../../types/authoring';
|
|
3
|
+
|
|
4
|
+
export const popoverMeta = {
|
|
5
|
+
name: 'Popover',
|
|
6
|
+
category: 'component',
|
|
7
|
+
directManifestNode: true,
|
|
8
|
+
allowedChildren: [...CONTAINER_ALLOWED_CHILDREN],
|
|
9
|
+
description: 'Controlled anchored presentation with an ordinary manifest-content subtree.',
|
|
10
|
+
blueprint: {
|
|
11
|
+
label: 'Popover',
|
|
12
|
+
defaultProps: { disabled: false, open: false, triggerLabel: 'Open popover' },
|
|
13
|
+
},
|
|
14
|
+
bindings: {
|
|
15
|
+
props: {
|
|
16
|
+
triggerLabel: {
|
|
17
|
+
label: 'Trigger label',
|
|
18
|
+
description: 'Label for the declarative popover trigger.',
|
|
19
|
+
value: { type: 'string' },
|
|
20
|
+
acceptsFallback: true,
|
|
21
|
+
acceptsTransforms: true,
|
|
22
|
+
},
|
|
23
|
+
open: {
|
|
24
|
+
label: 'Open',
|
|
25
|
+
description: 'Whether the popover is currently open.',
|
|
26
|
+
value: { type: 'boolean' },
|
|
27
|
+
acceptsFallback: true,
|
|
28
|
+
acceptsTransforms: true,
|
|
29
|
+
},
|
|
30
|
+
disabled: {
|
|
31
|
+
label: 'Disabled',
|
|
32
|
+
description: 'Whether the declarative trigger is disabled.',
|
|
33
|
+
value: { type: 'boolean' },
|
|
34
|
+
acceptsFallback: true,
|
|
35
|
+
acceptsTransforms: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
events: {
|
|
39
|
+
openChange: {
|
|
40
|
+
label: 'Open change',
|
|
41
|
+
description: 'Runs when the popover requests a controlled open-state change.',
|
|
42
|
+
payload: {
|
|
43
|
+
eventType: 'popover.openChange',
|
|
44
|
+
fields: [{ path: 'open', type: 'boolean', label: 'Open' }],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
events: {
|
|
50
|
+
openChange: {
|
|
51
|
+
label: 'Open change',
|
|
52
|
+
eventType: 'popover.openChange',
|
|
53
|
+
description: 'Emitted when the popover requests a controlled open-state change.',
|
|
54
|
+
payloadFields: [{ path: 'open', type: 'boolean', label: 'Open' }],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
triggerLabel: {
|
|
59
|
+
type: 'string',
|
|
60
|
+
category: 'Content',
|
|
61
|
+
label: 'Trigger label',
|
|
62
|
+
authoring: { authority: 'instance' },
|
|
63
|
+
},
|
|
64
|
+
open: {
|
|
65
|
+
type: 'boolean',
|
|
66
|
+
category: 'State',
|
|
67
|
+
label: 'Open',
|
|
68
|
+
default: false,
|
|
69
|
+
authoring: { authority: 'instance' },
|
|
70
|
+
},
|
|
71
|
+
disabled: {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
category: 'State',
|
|
74
|
+
label: 'Disabled',
|
|
75
|
+
default: false,
|
|
76
|
+
authoring: { authority: 'instance' },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
} as const satisfies ZoraComponentMeta;
|
|
@@ -3,7 +3,8 @@ import { expect, test } from 'bun:test';
|
|
|
3
3
|
test('Popover exposes the narrow ZORA-owned Surface overlay boundary', async () => {
|
|
4
4
|
const source = await Bun.file('src/features/popover/adapters/inbound/Popover.tsx').text();
|
|
5
5
|
|
|
6
|
-
expect(source).toContain('Popover as SurfacePopover');
|
|
6
|
+
expect(source).toContain('Button as SurfaceButton, Popover as SurfacePopover');
|
|
7
7
|
expect(source).toContain('<SurfacePopover');
|
|
8
|
+
expect(source).toContain('<SurfaceButton');
|
|
8
9
|
expect(source).toContain('withZoraThemeScope');
|
|
9
10
|
});
|
|
@@ -64,6 +64,7 @@ import { MatrixGrid } from '../matrix-grid/public';
|
|
|
64
64
|
import { MissingElement } from '../missing-element/public';
|
|
65
65
|
import { Pagination } from '../pagination/public';
|
|
66
66
|
import { PaletteItem } from '../palette-item/public';
|
|
67
|
+
import { Popover } from '../popover/public';
|
|
67
68
|
import { PopoverMenu } from '../popover-menu/public';
|
|
68
69
|
import { Progress, ProgressRing } from '../progress/public';
|
|
69
70
|
import { Rating } from '../rating/public';
|
|
@@ -159,6 +160,7 @@ const _ZORA_BASE_COMPONENT_REGISTRY = {
|
|
|
159
160
|
MediaCard,
|
|
160
161
|
MetricCard,
|
|
161
162
|
Pagination,
|
|
163
|
+
Popover,
|
|
162
164
|
PopoverMenu,
|
|
163
165
|
Progress,
|
|
164
166
|
ProgressRing,
|
|
@@ -256,6 +256,7 @@ describe('ZORA_COMPONENT_META invariants', () => {
|
|
|
256
256
|
'ChipGroup',
|
|
257
257
|
'DataTable',
|
|
258
258
|
'DatePicker',
|
|
259
|
+
'Calendar',
|
|
259
260
|
'Pagination',
|
|
260
261
|
'Rating',
|
|
261
262
|
'SearchInput',
|
|
@@ -341,6 +342,7 @@ describe('ZORA_COMPONENT_META invariants', () => {
|
|
|
341
342
|
'TabList',
|
|
342
343
|
'TabPanel',
|
|
343
344
|
'Toolbar',
|
|
345
|
+
'Popover',
|
|
344
346
|
]);
|
|
345
347
|
|
|
346
348
|
for (const [key, meta] of Object.entries(ZORA_COMPONENT_META)) {
|
|
@@ -77,6 +77,7 @@ import { matrixGridMeta } from '../matrix-grid/meta';
|
|
|
77
77
|
import { missingElementMeta } from '../missing-element/missingElementMeta';
|
|
78
78
|
import { paginationMeta } from '../pagination/paginationMeta';
|
|
79
79
|
import { paletteItemMeta } from '../palette-item/paletteItemMeta';
|
|
80
|
+
import { popoverMeta } from '../popover/popoverMeta';
|
|
80
81
|
import { popoverMenuMeta } from '../popover-menu/popoverMenuMeta';
|
|
81
82
|
import { progressMeta, progressRingMeta } from '../progress/progressMeta';
|
|
82
83
|
import { ratingMeta } from '../rating/ratingMeta';
|
|
@@ -168,6 +169,7 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = finalizeFeatureMet
|
|
|
168
169
|
MediaCard: mediaCardMeta,
|
|
169
170
|
MetricCard: metricCardMeta,
|
|
170
171
|
Pagination: paginationMeta,
|
|
172
|
+
Popover: popoverMeta,
|
|
171
173
|
PopoverMenu: popoverMenuMeta,
|
|
172
174
|
Progress: progressMeta,
|
|
173
175
|
ProgressRing: progressRingMeta,
|
|
@@ -69,6 +69,17 @@ test('final ownership data components retain bindings in core metadata', () => {
|
|
|
69
69
|
expect(meta.Rating?.bindings?.props?.value?.value.type).toBe('number');
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
+
test('Popover retains declarative manifest bindings and nested Select support', () => {
|
|
73
|
+
const meta = ZORA_COMPONENT_META;
|
|
74
|
+
expect(meta.Popover?.bindings?.props?.open?.value.type).toBe('boolean');
|
|
75
|
+
expect(meta.Popover?.bindings?.events?.openChange?.payload?.fields).toContainEqual({
|
|
76
|
+
label: 'Open',
|
|
77
|
+
path: 'open',
|
|
78
|
+
type: 'boolean',
|
|
79
|
+
});
|
|
80
|
+
expect(meta.Popover?.allowedChildren).toContain('Select');
|
|
81
|
+
});
|
|
82
|
+
|
|
72
83
|
test('final ownership form and tab components retain bindings in core metadata', () => {
|
|
73
84
|
const meta = ZORA_COMPONENT_META;
|
|
74
85
|
expect(meta.SearchInput?.bindings?.props?.value?.value.type).toBe('string');
|
package/src/readerFree.ts
CHANGED
|
@@ -367,6 +367,12 @@ export { MissingElement, type MissingElementProps } from './features/missing-ele
|
|
|
367
367
|
export { Pagination, type PaginationProps } from './features/pagination/public';
|
|
368
368
|
export type { PaletteItemProps } from './features/palette-item/public';
|
|
369
369
|
export { PaletteItem } from './features/palette-item/public';
|
|
370
|
+
export {
|
|
371
|
+
Popover,
|
|
372
|
+
type PopoverAnchorRenderProps,
|
|
373
|
+
type PopoverPlacement,
|
|
374
|
+
type PopoverProps,
|
|
375
|
+
} from './features/popover/public';
|
|
370
376
|
export {
|
|
371
377
|
PopoverMenu,
|
|
372
378
|
type PopoverMenuAction,
|
package/src/types/calendar.ts
CHANGED
|
@@ -1,25 +1,50 @@
|
|
|
1
1
|
import type { ZoraBaseProps } from './base';
|
|
2
|
+
import type { TemporalDate, TemporalEvent, TemporalTimeZone } from './temporal';
|
|
2
3
|
|
|
3
4
|
export type CalendarDensity = 'regular' | 'compact';
|
|
4
|
-
export type CalendarView = 'month';
|
|
5
|
+
export type CalendarView = 'day' | 'month' | 'week';
|
|
5
6
|
export type CalendarWeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
7
|
|
|
7
|
-
/**
|
|
8
|
-
export interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
/** Serializable payload for a controlled Calendar date. */
|
|
9
|
+
export interface CalendarDateChangeEvent {
|
|
10
|
+
readonly date: TemporalDate;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Serializable payload for a controlled Calendar view. */
|
|
14
|
+
export interface CalendarViewChangeEvent {
|
|
15
|
+
readonly view: CalendarView;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Serializable payload emitted when an event is activated. */
|
|
19
|
+
export interface CalendarEventActivateEvent {
|
|
20
|
+
readonly eventId: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Serializable props accepted by a direct Calendar manifest node. */
|
|
24
|
+
export interface CalendarManifestProps {
|
|
25
|
+
readonly view?: CalendarView;
|
|
26
|
+
readonly displayedDate?: TemporalDate;
|
|
27
|
+
readonly defaultDisplayedDate?: TemporalDate;
|
|
28
|
+
readonly events?: readonly TemporalEvent[];
|
|
29
|
+
readonly timeZone?: TemporalTimeZone;
|
|
30
|
+
readonly locale?: string;
|
|
31
|
+
readonly weekStartsOn?: CalendarWeekStart;
|
|
32
|
+
readonly density?: CalendarDensity;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Code API retaining DatePicker's local-Date compatibility alongside manifest data. */
|
|
36
|
+
export interface CalendarProps extends ZoraBaseProps, CalendarManifestProps {
|
|
37
|
+
readonly displayedMonth?: Date;
|
|
38
|
+
readonly defaultDisplayedMonth?: Date;
|
|
39
|
+
readonly onDisplayedMonthChange?: (month: Date) => void;
|
|
40
|
+
readonly selectedDate?: Date | null;
|
|
41
|
+
readonly onSelectedDateChange?: (date: Date) => void;
|
|
42
|
+
readonly onDateChange?: (event: CalendarDateChangeEvent) => void;
|
|
43
|
+
readonly defaultView?: CalendarView;
|
|
44
|
+
readonly onViewChange?: (event: CalendarViewChangeEvent) => void;
|
|
45
|
+
readonly onEventActivate?: (event: CalendarEventActivateEvent) => void;
|
|
46
|
+
readonly minDate?: Date;
|
|
47
|
+
readonly maxDate?: Date;
|
|
48
|
+
readonly disabledDates?: readonly Date[];
|
|
49
|
+
readonly isDateDisabled?: (date: Date) => boolean;
|
|
25
50
|
}
|
package/src/types/popover.ts
CHANGED
|
@@ -9,4 +9,8 @@ import type { ZoraBaseProps } from './base';
|
|
|
9
9
|
export type PopoverAnchorRenderProps = SurfacePopoverAnchorRenderProps;
|
|
10
10
|
export type PopoverPlacement = SurfacePopoverPlacement;
|
|
11
11
|
|
|
12
|
-
export interface PopoverProps extends SurfacePopoverProps, ZoraBaseProps {
|
|
12
|
+
export interface PopoverProps extends Omit<SurfacePopoverProps, 'anchor'>, ZoraBaseProps {
|
|
13
|
+
anchor?: SurfacePopoverProps['anchor'];
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
triggerLabel?: string;
|
|
16
|
+
}
|
|
@@ -293,6 +293,7 @@ test('publishes SSR-safe ordinary UI through canonical web subpaths', async () =
|
|
|
293
293
|
"export { DataTable } from '@ankhorage/zora/web/data-table';",
|
|
294
294
|
"export { Dialog } from '@ankhorage/zora/web/dialog';",
|
|
295
295
|
"export { MetricCard } from '@ankhorage/zora/web/metric-card';",
|
|
296
|
+
"export { Popover } from '@ankhorage/zora/web/popover';",
|
|
296
297
|
"export { PopoverMenu } from '@ankhorage/zora/web/popover-menu';",
|
|
297
298
|
"export { Select } from '@ankhorage/zora/web/select';",
|
|
298
299
|
"export { TextInput } from '@ankhorage/zora/web/text-input';",
|