@ankhorage/zora 4.4.1 → 5.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 +13 -0
- package/README.md +1 -1
- package/dist/components/radio/RadioGroup.d.ts +1 -3
- package/dist/components/radio/RadioGroup.d.ts.map +1 -1
- package/dist/components/radio/RadioGroup.js +52 -40
- package/dist/components/radio/RadioGroup.js.map +1 -1
- package/dist/components/radio/RadioOptionControl.d.ts +15 -0
- package/dist/components/radio/RadioOptionControl.d.ts.map +1 -0
- package/dist/components/radio/RadioOptionControl.js +105 -0
- package/dist/components/radio/RadioOptionControl.js.map +1 -0
- package/dist/components/radio/handleRadioOptionKeyDown.d.ts +13 -0
- package/dist/components/radio/handleRadioOptionKeyDown.d.ts.map +1 -0
- package/dist/components/radio/handleRadioOptionKeyDown.js +22 -0
- package/dist/components/radio/handleRadioOptionKeyDown.js.map +1 -0
- package/dist/components/radio/meta.d.ts +38 -3
- package/dist/components/radio/meta.d.ts.map +1 -1
- package/dist/components/radio/meta.js +28 -3
- package/dist/components/radio/meta.js.map +1 -1
- package/dist/components/radio/resolveRadioOptionColors.d.ts +10 -0
- package/dist/components/radio/resolveRadioOptionColors.d.ts.map +1 -0
- package/dist/components/radio/resolveRadioOptionColors.js +27 -0
- package/dist/components/radio/resolveRadioOptionColors.js.map +1 -0
- package/dist/components/radio/types.d.ts +12 -2
- package/dist/components/radio/types.d.ts.map +1 -1
- package/dist/components/radio/types.js.map +1 -1
- package/dist/constants/keyboard.d.ts +3 -0
- package/dist/constants/keyboard.d.ts.map +1 -0
- package/dist/constants/keyboard.js +8 -0
- package/dist/constants/keyboard.js.map +1 -0
- package/dist/index.d.ts +0 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -6
- package/dist/index.js.map +1 -1
- package/dist/metadata/componentMeta.d.ts.map +1 -1
- package/dist/metadata/componentMeta.js +0 -12
- package/dist/metadata/componentMeta.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +0 -12
- package/dist/registry.js.map +1 -1
- package/package.json +1 -1
- package/src/audit.test.ts +0 -29
- package/src/components/radio/RadioGroup.test.ts +13 -9
- package/src/components/radio/RadioGroup.tsx +85 -111
- package/src/components/radio/RadioOptionControl.tsx +192 -0
- package/src/components/radio/handleRadioOptionKeyDown.test.ts +47 -0
- package/src/components/radio/handleRadioOptionKeyDown.ts +37 -0
- package/src/components/radio/meta.ts +28 -3
- package/src/components/radio/resolveRadioOptionColors.test.ts +29 -0
- package/src/components/radio/resolveRadioOptionColors.ts +37 -0
- package/src/components/radio/types.ts +10 -2
- package/src/constants/keyboard.ts +7 -0
- package/src/index.ts +0 -23
- package/src/interactionPolicy.test.ts +0 -17
- package/src/metadata/componentMeta.test.ts +1 -0
- package/src/metadata/componentMeta.ts +0 -12
- package/src/registry.ts +0 -12
- package/src/showcaseCoverage.test.ts +0 -6
- package/src/theme/themeScopeStructure.test.ts +0 -4
- package/dist/components/drawer/Drawer.d.ts +0 -7
- package/dist/components/drawer/Drawer.d.ts.map +0 -1
- package/dist/components/drawer/Drawer.js +0 -36
- package/dist/components/drawer/Drawer.js.map +0 -1
- package/dist/components/drawer/index.d.ts +0 -3
- package/dist/components/drawer/index.d.ts.map +0 -1
- package/dist/components/drawer/index.js +0 -2
- package/dist/components/drawer/index.js.map +0 -1
- package/dist/components/drawer/meta.d.ts +0 -9
- package/dist/components/drawer/meta.d.ts.map +0 -1
- package/dist/components/drawer/meta.js +0 -9
- package/dist/components/drawer/meta.js.map +0 -1
- package/dist/components/drawer/types.d.ts +0 -10
- package/dist/components/drawer/types.d.ts.map +0 -1
- package/dist/components/drawer/types.js +0 -2
- package/dist/components/drawer/types.js.map +0 -1
- package/dist/components/navigation-item/NavigationItem.d.ts +0 -7
- package/dist/components/navigation-item/NavigationItem.d.ts.map +0 -1
- package/dist/components/navigation-item/NavigationItem.js +0 -21
- package/dist/components/navigation-item/NavigationItem.js.map +0 -1
- package/dist/components/navigation-item/index.d.ts +0 -3
- package/dist/components/navigation-item/index.d.ts.map +0 -1
- package/dist/components/navigation-item/index.js +0 -2
- package/dist/components/navigation-item/index.js.map +0 -1
- package/dist/components/navigation-item/meta.d.ts +0 -9
- package/dist/components/navigation-item/meta.d.ts.map +0 -1
- package/dist/components/navigation-item/meta.js +0 -9
- package/dist/components/navigation-item/meta.js.map +0 -1
- package/dist/components/navigation-item/types.d.ts +0 -23
- package/dist/components/navigation-item/types.d.ts.map +0 -1
- package/dist/components/navigation-item/types.js +0 -2
- package/dist/components/navigation-item/types.js.map +0 -1
- package/dist/components/navigation-list/NavigationList.d.ts +0 -7
- package/dist/components/navigation-list/NavigationList.d.ts.map +0 -1
- package/dist/components/navigation-list/NavigationList.js +0 -29
- package/dist/components/navigation-list/NavigationList.js.map +0 -1
- package/dist/components/navigation-list/index.d.ts +0 -3
- package/dist/components/navigation-list/index.d.ts.map +0 -1
- package/dist/components/navigation-list/index.js +0 -2
- package/dist/components/navigation-list/index.js.map +0 -1
- package/dist/components/navigation-list/meta.d.ts +0 -9
- package/dist/components/navigation-list/meta.d.ts.map +0 -1
- package/dist/components/navigation-list/meta.js +0 -9
- package/dist/components/navigation-list/meta.js.map +0 -1
- package/dist/components/navigation-list/types.d.ts +0 -15
- package/dist/components/navigation-list/types.d.ts.map +0 -1
- package/dist/components/navigation-list/types.js +0 -2
- package/dist/components/navigation-list/types.js.map +0 -1
- package/dist/internal/resolveZoraNavigationItems.d.ts +0 -65
- package/dist/internal/resolveZoraNavigationItems.d.ts.map +0 -1
- package/dist/internal/resolveZoraNavigationItems.js +0 -56
- package/dist/internal/resolveZoraNavigationItems.js.map +0 -1
- package/dist/patterns/responsive-panel/ResponsivePanel.d.ts +0 -16
- package/dist/patterns/responsive-panel/ResponsivePanel.d.ts.map +0 -1
- package/dist/patterns/responsive-panel/ResponsivePanel.js +0 -101
- package/dist/patterns/responsive-panel/ResponsivePanel.js.map +0 -1
- package/dist/patterns/responsive-panel/index.d.ts +0 -3
- package/dist/patterns/responsive-panel/index.d.ts.map +0 -1
- package/dist/patterns/responsive-panel/index.js +0 -3
- package/dist/patterns/responsive-panel/index.js.map +0 -1
- package/dist/patterns/responsive-panel/meta.d.ts +0 -9
- package/dist/patterns/responsive-panel/meta.d.ts.map +0 -1
- package/dist/patterns/responsive-panel/meta.js +0 -9
- package/dist/patterns/responsive-panel/meta.js.map +0 -1
- package/dist/patterns/responsive-panel/types.d.ts +0 -23
- package/dist/patterns/responsive-panel/types.d.ts.map +0 -1
- package/dist/patterns/responsive-panel/types.js +0 -2
- package/dist/patterns/responsive-panel/types.js.map +0 -1
- package/dist/patterns/zora-drawer-content/ZoraDrawerContent.d.ts +0 -9
- package/dist/patterns/zora-drawer-content/ZoraDrawerContent.d.ts.map +0 -1
- package/dist/patterns/zora-drawer-content/ZoraDrawerContent.js +0 -31
- package/dist/patterns/zora-drawer-content/ZoraDrawerContent.js.map +0 -1
- package/dist/patterns/zora-drawer-content/index.d.ts +0 -3
- package/dist/patterns/zora-drawer-content/index.d.ts.map +0 -1
- package/dist/patterns/zora-drawer-content/index.js +0 -2
- package/dist/patterns/zora-drawer-content/index.js.map +0 -1
- package/dist/patterns/zora-drawer-content/meta.d.ts +0 -9
- package/dist/patterns/zora-drawer-content/meta.d.ts.map +0 -1
- package/dist/patterns/zora-drawer-content/meta.js +0 -9
- package/dist/patterns/zora-drawer-content/meta.js.map +0 -1
- package/dist/patterns/zora-drawer-content/types.d.ts +0 -15
- package/dist/patterns/zora-drawer-content/types.d.ts.map +0 -1
- package/dist/patterns/zora-drawer-content/types.js +0 -2
- package/dist/patterns/zora-drawer-content/types.js.map +0 -1
- package/dist/patterns/zora-tab-bar/ZoraTabBar.d.ts +0 -9
- package/dist/patterns/zora-tab-bar/ZoraTabBar.d.ts.map +0 -1
- package/dist/patterns/zora-tab-bar/ZoraTabBar.js +0 -89
- package/dist/patterns/zora-tab-bar/ZoraTabBar.js.map +0 -1
- package/dist/patterns/zora-tab-bar/index.d.ts +0 -3
- package/dist/patterns/zora-tab-bar/index.d.ts.map +0 -1
- package/dist/patterns/zora-tab-bar/index.js +0 -2
- package/dist/patterns/zora-tab-bar/index.js.map +0 -1
- package/dist/patterns/zora-tab-bar/meta.d.ts +0 -9
- package/dist/patterns/zora-tab-bar/meta.d.ts.map +0 -1
- package/dist/patterns/zora-tab-bar/meta.js +0 -9
- package/dist/patterns/zora-tab-bar/meta.js.map +0 -1
- package/dist/patterns/zora-tab-bar/types.d.ts +0 -19
- package/dist/patterns/zora-tab-bar/types.d.ts.map +0 -1
- package/dist/patterns/zora-tab-bar/types.js +0 -2
- package/dist/patterns/zora-tab-bar/types.js.map +0 -1
- package/src/components/drawer/Drawer.tsx +0 -59
- package/src/components/drawer/index.ts +0 -2
- package/src/components/drawer/meta.ts +0 -10
- package/src/components/drawer/types.ts +0 -17
- package/src/components/navigation-item/NavigationItem.tsx +0 -41
- package/src/components/navigation-item/index.ts +0 -6
- package/src/components/navigation-item/meta.ts +0 -10
- package/src/components/navigation-item/types.ts +0 -26
- package/src/components/navigation-list/NavigationList.tsx +0 -68
- package/src/components/navigation-list/index.ts +0 -2
- package/src/components/navigation-list/meta.ts +0 -10
- package/src/components/navigation-list/types.ts +0 -17
- package/src/internal/resolveZoraNavigationItems.test.ts +0 -174
- package/src/internal/resolveZoraNavigationItems.ts +0 -157
- package/src/navigationExports.test.ts +0 -15
- package/src/patterns/responsive-panel/ResponsivePanel.tsx +0 -172
- package/src/patterns/responsive-panel/index.ts +0 -2
- package/src/patterns/responsive-panel/meta.ts +0 -10
- package/src/patterns/responsive-panel/types.ts +0 -25
- package/src/patterns/zora-drawer-content/ZoraDrawerContent.tsx +0 -60
- package/src/patterns/zora-drawer-content/index.ts +0 -2
- package/src/patterns/zora-drawer-content/meta.ts +0 -10
- package/src/patterns/zora-drawer-content/types.ts +0 -20
- package/src/patterns/zora-tab-bar/ZoraTabBar.tsx +0 -157
- package/src/patterns/zora-tab-bar/index.ts +0 -2
- package/src/patterns/zora-tab-bar/meta.ts +0 -10
- package/src/patterns/zora-tab-bar/types.ts +0 -18
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { expect, test } from 'bun:test';
|
|
2
|
+
import type { KeyboardEvent } from 'react';
|
|
3
|
+
|
|
4
|
+
import { DIRECTION_MODIFIERS } from '../../constants/keyboard';
|
|
5
|
+
import {
|
|
6
|
+
handleRadioOptionKeyDown,
|
|
7
|
+
type RadioOptionKeyboardTarget,
|
|
8
|
+
} from './handleRadioOptionKeyDown';
|
|
9
|
+
|
|
10
|
+
test('Space selects the focused radio and prevents page scrolling', () => {
|
|
11
|
+
let selected = 0;
|
|
12
|
+
let prevented = 0;
|
|
13
|
+
handleRadioOptionKeyDown(
|
|
14
|
+
{ key: ' ', preventDefault: () => prevented++ } as KeyboardEvent<RadioOptionKeyboardTarget>,
|
|
15
|
+
() => selected++,
|
|
16
|
+
);
|
|
17
|
+
expect(selected).toBe(1);
|
|
18
|
+
expect(prevented).toBe(1);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
for (const [key, direction] of DIRECTION_MODIFIERS) {
|
|
22
|
+
test(`${key} wraps and skips disabled radio options`, () => {
|
|
23
|
+
const activated: number[] = [];
|
|
24
|
+
const focused: number[] = [];
|
|
25
|
+
let prevented = 0;
|
|
26
|
+
const options: RadioOptionKeyboardTarget[] = [0, 1, 2, 3].map((index) => ({
|
|
27
|
+
closest: () => ({ querySelectorAll: () => options }),
|
|
28
|
+
getAttribute: () => (index === 1 ? 'true' : 'false'),
|
|
29
|
+
focus: () => focused.push(index),
|
|
30
|
+
click: () => activated.push(index),
|
|
31
|
+
}));
|
|
32
|
+
for (const currentTarget of [options[0], options[2], options[3]]) {
|
|
33
|
+
handleRadioOptionKeyDown(
|
|
34
|
+
{
|
|
35
|
+
key,
|
|
36
|
+
currentTarget,
|
|
37
|
+
preventDefault: () => prevented++,
|
|
38
|
+
} as KeyboardEvent<RadioOptionKeyboardTarget>,
|
|
39
|
+
() => undefined,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
const expected = direction === 1 ? [2, 3, 0] : [3, 0, 2];
|
|
43
|
+
expect(focused).toEqual(expected);
|
|
44
|
+
expect(activated).toEqual(expected);
|
|
45
|
+
expect(prevented).toBe(3);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { KeyboardEvent } from 'react';
|
|
2
|
+
|
|
3
|
+
import { DIRECTION_MODIFIERS } from '../../constants/keyboard';
|
|
4
|
+
|
|
5
|
+
/*** Support Space and directional navigation for web radio options without affecting native presses. */
|
|
6
|
+
export function handleRadioOptionKeyDown(
|
|
7
|
+
event: KeyboardEvent<RadioOptionKeyboardTarget>,
|
|
8
|
+
select: () => void,
|
|
9
|
+
): void {
|
|
10
|
+
if (event.key === ' ') {
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
select();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const direction = DIRECTION_MODIFIERS.get(event.key);
|
|
16
|
+
if (direction === undefined) return;
|
|
17
|
+
const group = event.currentTarget.closest('[role="radiogroup"]');
|
|
18
|
+
const options = Array.from(group?.querySelectorAll('[role="radio"]') ?? []).filter(
|
|
19
|
+
(option) => option.getAttribute('aria-disabled') !== 'true',
|
|
20
|
+
);
|
|
21
|
+
const index = options.indexOf(event.currentTarget);
|
|
22
|
+
if (index < 0 || options.length === 0) return;
|
|
23
|
+
event.preventDefault();
|
|
24
|
+
const next = options.at((index + direction + options.length) % options.length);
|
|
25
|
+
next?.focus();
|
|
26
|
+
next?.click();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Minimal web target contract keeps the native build independent of DOM ambient libraries. */
|
|
30
|
+
export interface RadioOptionKeyboardTarget {
|
|
31
|
+
closest(
|
|
32
|
+
selector: string,
|
|
33
|
+
): { querySelectorAll(selector: string): ArrayLike<RadioOptionKeyboardTarget> } | null;
|
|
34
|
+
getAttribute(name: string): string | null;
|
|
35
|
+
focus(): void;
|
|
36
|
+
click(): void;
|
|
37
|
+
}
|
|
@@ -24,16 +24,16 @@ export const radioGroupMeta = {
|
|
|
24
24
|
directManifestNode: true,
|
|
25
25
|
allowedChildren: [],
|
|
26
26
|
blueprint: {
|
|
27
|
-
label: 'Radio group',
|
|
27
|
+
label: 'Radio button group',
|
|
28
28
|
defaultProps: {
|
|
29
|
-
|
|
29
|
+
defaultValue: 'option-b',
|
|
30
30
|
options: [
|
|
31
31
|
{ value: 'option-a', label: 'First option', description: 'Supporting detail' },
|
|
32
32
|
{ value: 'option-b', label: 'Second option', description: 'Supporting detail' },
|
|
33
33
|
{ value: 'option-c', label: 'Third option', description: 'Supporting detail' },
|
|
34
34
|
],
|
|
35
35
|
orientation: 'vertical',
|
|
36
|
-
presentation: '
|
|
36
|
+
presentation: 'card',
|
|
37
37
|
invalid: false,
|
|
38
38
|
readOnly: false,
|
|
39
39
|
disabled: false,
|
|
@@ -76,6 +76,12 @@ export const radioGroupMeta = {
|
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
78
|
props: {
|
|
79
|
+
defaultValue: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
category: 'State',
|
|
82
|
+
label: 'Initial value',
|
|
83
|
+
authoring: { authority: 'instance' },
|
|
84
|
+
},
|
|
79
85
|
value: {
|
|
80
86
|
type: 'string',
|
|
81
87
|
category: 'State',
|
|
@@ -111,6 +117,10 @@ export const radioGroupMeta = {
|
|
|
111
117
|
label: 'Description',
|
|
112
118
|
},
|
|
113
119
|
},
|
|
120
|
+
{
|
|
121
|
+
key: 'iconSource',
|
|
122
|
+
schema: { type: 'media', category: 'Content', label: 'Icon', mediaKinds: ['image'] },
|
|
123
|
+
},
|
|
114
124
|
{
|
|
115
125
|
key: 'disabled',
|
|
116
126
|
schema: {
|
|
@@ -146,6 +156,21 @@ export const radioGroupMeta = {
|
|
|
146
156
|
default: 'inline',
|
|
147
157
|
authoring: { authority: 'instance' },
|
|
148
158
|
},
|
|
159
|
+
contentOrientation: {
|
|
160
|
+
type: 'enum',
|
|
161
|
+
category: 'Layout',
|
|
162
|
+
label: 'Option content orientation',
|
|
163
|
+
enum: ['horizontal', 'vertical'],
|
|
164
|
+
default: 'horizontal',
|
|
165
|
+
authoring: { authority: 'instance' },
|
|
166
|
+
},
|
|
167
|
+
columns: {
|
|
168
|
+
type: 'enum',
|
|
169
|
+
category: 'Layout',
|
|
170
|
+
label: 'Option columns',
|
|
171
|
+
enum: [1, 2, 3, 4],
|
|
172
|
+
authoring: { authority: 'instance' },
|
|
173
|
+
},
|
|
149
174
|
color: {
|
|
150
175
|
type: 'enum',
|
|
151
176
|
category: 'Style',
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createTheme } from '@ankhorage/surface/theme';
|
|
2
|
+
import { expect, test } from 'bun:test';
|
|
3
|
+
|
|
4
|
+
import { resolveRadioOptionColors } from './resolveRadioOptionColors';
|
|
5
|
+
|
|
6
|
+
const source = {
|
|
7
|
+
id: 'radio',
|
|
8
|
+
name: 'Radio',
|
|
9
|
+
light: { primaryColor: '#0060FF', harmony: 'monochromatic' as const },
|
|
10
|
+
dark: { primaryColor: '#0060FF', harmony: 'monochromatic' as const },
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
for (const mode of ['light', 'dark'] as const) {
|
|
14
|
+
test(`radio selection preserves role contrast and field states in ${mode} mode`, () => {
|
|
15
|
+
const theme = createTheme(source, mode);
|
|
16
|
+
const selected = resolveRadioOptionColors(theme, { color: 'secondary' });
|
|
17
|
+
expect(selected.accent).toBe(theme.semantics.secondary.base);
|
|
18
|
+
expect(selected.onAccent).toBe(theme.semantics.secondary.onSolidText);
|
|
19
|
+
const invalid = resolveRadioOptionColors(theme, { color: 'secondary', invalid: true });
|
|
20
|
+
expect(invalid.accent).toBe(theme.semantics.error.base);
|
|
21
|
+
const disabled = resolveRadioOptionColors(theme, {
|
|
22
|
+
color: 'secondary',
|
|
23
|
+
invalid: true,
|
|
24
|
+
disabled: true,
|
|
25
|
+
});
|
|
26
|
+
expect(disabled.accent).toBe(theme.semantics.content.disabled);
|
|
27
|
+
expect(disabled.surface).toBe(theme.semantics.surface.disabled);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { RoleSemantics, SurfaceTheme } from '@ankhorage/surface';
|
|
2
|
+
|
|
3
|
+
import type { RadioGroupProps } from './types';
|
|
4
|
+
|
|
5
|
+
/*** Resolve selection-card decoration from the requested semantic role and field state. */
|
|
6
|
+
export function resolveRadioOptionColors(
|
|
7
|
+
theme: SurfaceTheme,
|
|
8
|
+
{
|
|
9
|
+
color = 'primary',
|
|
10
|
+
invalid,
|
|
11
|
+
disabled,
|
|
12
|
+
}: Pick<RadioGroupProps<string>, 'color' | 'invalid' | 'disabled'>,
|
|
13
|
+
) {
|
|
14
|
+
const roles = new Map<string, RoleSemantics>([
|
|
15
|
+
['primary', theme.semantics.action.primary],
|
|
16
|
+
['secondary', theme.semantics.secondary],
|
|
17
|
+
['tertiary', theme.semantics.accent],
|
|
18
|
+
['quaternary', theme.semantics.highlight],
|
|
19
|
+
['neutral', theme.semantics.action.neutral],
|
|
20
|
+
['danger', theme.semantics.action.danger],
|
|
21
|
+
['error', theme.semantics.error],
|
|
22
|
+
['success', theme.semantics.success],
|
|
23
|
+
['warning', theme.semantics.warning],
|
|
24
|
+
['info', theme.semantics.info],
|
|
25
|
+
]);
|
|
26
|
+
const role = roles.get(invalid ? 'error' : color) ?? theme.semantics.action.primary;
|
|
27
|
+
return {
|
|
28
|
+
accent: disabled ? theme.semantics.content.disabled : role.base,
|
|
29
|
+
onAccent: disabled ? theme.semantics.surface.disabled : role.onSolidText,
|
|
30
|
+
border: disabled
|
|
31
|
+
? theme.semantics.border.subtle
|
|
32
|
+
: invalid
|
|
33
|
+
? role.outline
|
|
34
|
+
: theme.semantics.border.default,
|
|
35
|
+
surface: disabled ? theme.semantics.surface.disabled : theme.semantics.surface.default,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -2,6 +2,7 @@ import type { RadioProps as SurfaceRadioProps } from '@ankhorage/surface';
|
|
|
2
2
|
import type React from 'react';
|
|
3
3
|
|
|
4
4
|
import type { ZoraBaseProps } from '../../theme/ZoraBaseProps';
|
|
5
|
+
import type { IconProps } from '../icon';
|
|
5
6
|
|
|
6
7
|
export interface RadioProps extends ZoraBaseProps, Omit<SurfaceRadioProps, 'mode' | 'themeId'> {}
|
|
7
8
|
|
|
@@ -9,6 +10,8 @@ export interface RadioGroupOption<TValue extends string> {
|
|
|
9
10
|
value: TValue;
|
|
10
11
|
label: React.ReactNode;
|
|
11
12
|
description?: React.ReactNode;
|
|
13
|
+
/** SVG media is resolved by the consuming runtime before rendering. */
|
|
14
|
+
iconSource?: Extract<IconProps, { source: unknown }>['source'];
|
|
12
15
|
disabled?: boolean;
|
|
13
16
|
testID?: string;
|
|
14
17
|
}
|
|
@@ -20,10 +23,15 @@ export interface RadioGroupProps<TValue extends string>
|
|
|
20
23
|
Omit<SurfaceRadioProps, 'mode' | 'themeId'>,
|
|
21
24
|
'color' | 'size' | 'invalid' | 'readOnly' | 'disabled'
|
|
22
25
|
> {
|
|
23
|
-
value
|
|
24
|
-
|
|
26
|
+
value?: TValue;
|
|
27
|
+
defaultValue?: TValue;
|
|
28
|
+
onValueChange?: (value: TValue) => void;
|
|
25
29
|
options: readonly RadioGroupOption<TValue>[];
|
|
26
30
|
orientation?: 'horizontal' | 'vertical';
|
|
27
31
|
gap?: 'xs' | 's' | 'm' | 'l';
|
|
28
32
|
presentation?: 'inline' | 'card';
|
|
33
|
+
/** Arrangement inside a selection card, independent of the group direction. */
|
|
34
|
+
contentOrientation?: 'horizontal' | 'vertical';
|
|
35
|
+
/** Equal-width card columns; omitted columns follow orientation. */
|
|
36
|
+
columns?: 1 | 2 | 3 | 4;
|
|
29
37
|
}
|
package/src/index.ts
CHANGED
|
@@ -39,8 +39,6 @@ export type {
|
|
|
39
39
|
export { DataTable } from './components/data-table';
|
|
40
40
|
export type { DatePickerProps, DatePickerValue } from './components/date-picker';
|
|
41
41
|
export { DatePicker } from './components/date-picker';
|
|
42
|
-
export type { DrawerProps } from './components/drawer';
|
|
43
|
-
export { Drawer } from './components/drawer';
|
|
44
42
|
export type {
|
|
45
43
|
FormActionsProps,
|
|
46
44
|
FormErrorProps,
|
|
@@ -105,14 +103,6 @@ export type { MetricCardProps } from './components/metric-card';
|
|
|
105
103
|
export { MetricCard } from './components/metric-card';
|
|
106
104
|
export type { ModalProps } from './components/modal';
|
|
107
105
|
export { Modal } from './components/modal';
|
|
108
|
-
export type {
|
|
109
|
-
NavigationItemProps,
|
|
110
|
-
ZoraNavigationRouteMetadata,
|
|
111
|
-
ZoraNavigationRouteState,
|
|
112
|
-
} from './components/navigation-item';
|
|
113
|
-
export { NavigationItem } from './components/navigation-item';
|
|
114
|
-
export type { NavigationListProps, ZoraNavigationRouteMap } from './components/navigation-list';
|
|
115
|
-
export { NavigationList } from './components/navigation-list';
|
|
116
106
|
export type { PaginationProps } from './components/pagination';
|
|
117
107
|
export { Pagination } from './components/pagination';
|
|
118
108
|
export type { ProgressProps, ProgressRingProps } from './components/progress';
|
|
@@ -356,15 +346,6 @@ export type {
|
|
|
356
346
|
ReaderSurfaceProps,
|
|
357
347
|
} from './patterns/reader';
|
|
358
348
|
export { ReaderSurface, resolveReaderProgress } from './patterns/reader';
|
|
359
|
-
export type {
|
|
360
|
-
ResponsivePanelDesktopMode,
|
|
361
|
-
ResponsivePanelMobileMode,
|
|
362
|
-
ResponsivePanelProps,
|
|
363
|
-
ResponsivePanelScroll,
|
|
364
|
-
ResponsivePanelSide,
|
|
365
|
-
ResponsivePanelSize,
|
|
366
|
-
} from './patterns/responsive-panel';
|
|
367
|
-
export { ResponsivePanel } from './patterns/responsive-panel';
|
|
368
349
|
export type {
|
|
369
350
|
BarcodeScannerViewProps,
|
|
370
351
|
BarcodeScanResult,
|
|
@@ -396,10 +377,6 @@ export type { TimelineItem, TimelineProps } from './patterns/timeline';
|
|
|
396
377
|
export { Timeline } from './patterns/timeline';
|
|
397
378
|
export type { TreeItemNode, TreeItemRenderProps, TreeViewProps } from './patterns/tree-view';
|
|
398
379
|
export { TreeItem, TreeView } from './patterns/tree-view';
|
|
399
|
-
export type { ZoraDrawerContentProps } from './patterns/zora-drawer-content';
|
|
400
|
-
export { ZoraDrawerContent } from './patterns/zora-drawer-content';
|
|
401
|
-
export type { ZoraTabBarProps } from './patterns/zora-tab-bar';
|
|
402
|
-
export { ZoraTabBar } from './patterns/zora-tab-bar';
|
|
403
380
|
export type {
|
|
404
381
|
ComposedZoraPluginCatalog,
|
|
405
382
|
ComposedZoraPluginMetadataCatalog,
|
|
@@ -44,7 +44,6 @@ describe('InteractionPolicy declaration', () => {
|
|
|
44
44
|
readPattern('product-card', 'types.ts'),
|
|
45
45
|
readPattern('reader', 'types.ts'),
|
|
46
46
|
readPattern('scanner', 'types.ts'),
|
|
47
|
-
readPattern('zora-tab-bar', 'types.ts'),
|
|
48
47
|
readComponent('select', 'types.ts'),
|
|
49
48
|
readPattern('tree-view', 'types.ts'),
|
|
50
49
|
];
|
|
@@ -229,22 +228,6 @@ describe('BarcodeScannerView', () => {
|
|
|
229
228
|
});
|
|
230
229
|
});
|
|
231
230
|
|
|
232
|
-
describe('ZoraTabBar', () => {
|
|
233
|
-
test('does not discard interactionPolicy', () => {
|
|
234
|
-
const source = readPattern('zora-tab-bar', 'ZoraTabBar.tsx');
|
|
235
|
-
|
|
236
|
-
expect(source).not.toMatch(/interactionPolicy:\s*_interactionPolicy/);
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
test('prevents navigation under passive without disabled semantics', () => {
|
|
240
|
-
const source = readPattern('zora-tab-bar', 'ZoraTabBar.tsx');
|
|
241
|
-
|
|
242
|
-
expect(source).toMatch(/onPress=\{[\s\S]*?interactionPolicy === 'passive'\s*\?\s*undefined/);
|
|
243
|
-
expect(source).not.toMatch(/disabled:\s*interactionPolicy === 'passive'/);
|
|
244
|
-
expect(source).not.toMatch(/accessibilityState.*disabled.*interactionPolicy === 'passive'/);
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
|
|
248
231
|
describe('Select', () => {
|
|
249
232
|
test('keeps Picker enabled controlled only by real disabled prop', () => {
|
|
250
233
|
const source = readComponent('select', 'Select.tsx');
|
|
@@ -12,7 +12,6 @@ import { chipMeta } from '../components/chip/meta';
|
|
|
12
12
|
import { chipGroupMeta } from '../components/chip-group/meta';
|
|
13
13
|
import { dataTableMeta } from '../components/data-table/meta';
|
|
14
14
|
import { datePickerMeta } from '../components/date-picker/meta';
|
|
15
|
-
import { drawerMeta } from '../components/drawer/meta';
|
|
16
15
|
import { formActionsMeta, formErrorMeta, formFieldMeta, formMeta } from '../components/form/meta';
|
|
17
16
|
import { gradientMeta } from '../components/gradient/meta';
|
|
18
17
|
import { headingMeta } from '../components/heading/meta';
|
|
@@ -24,8 +23,6 @@ import { mediaCardMeta } from '../components/media-card/meta';
|
|
|
24
23
|
import { dropdownMenuMeta, menuMeta } from '../components/menu/meta';
|
|
25
24
|
import { metricCardMeta } from '../components/metric-card/meta';
|
|
26
25
|
import { modalMeta } from '../components/modal/meta';
|
|
27
|
-
import { navigationItemMeta } from '../components/navigation-item/meta';
|
|
28
|
-
import { navigationListMeta } from '../components/navigation-list/meta';
|
|
29
26
|
import { paginationMeta } from '../components/pagination/meta';
|
|
30
27
|
import { progressMeta, progressRingMeta } from '../components/progress/meta';
|
|
31
28
|
import { radioGroupMeta, radioMeta } from '../components/radio/meta';
|
|
@@ -79,7 +76,6 @@ import { panelMeta } from '../patterns/panel/meta';
|
|
|
79
76
|
import { postCardMeta } from '../patterns/post-card/meta';
|
|
80
77
|
import { productCardMeta } from '../patterns/product-card/meta';
|
|
81
78
|
import { readerSurfaceMeta } from '../patterns/reader/meta';
|
|
82
|
-
import { responsivePanelMeta } from '../patterns/responsive-panel/meta';
|
|
83
79
|
import {
|
|
84
80
|
barcodeScannerViewMeta,
|
|
85
81
|
cameraPermissionViewMeta,
|
|
@@ -93,8 +89,6 @@ import { themeComposerMeta } from '../patterns/theme-composer/meta';
|
|
|
93
89
|
import { paletteItemMeta, tileGridMeta } from '../patterns/tile-grid/meta';
|
|
94
90
|
import { timelineMeta } from '../patterns/timeline/meta';
|
|
95
91
|
import { treeItemMeta, treeViewMeta } from '../patterns/tree-view/meta';
|
|
96
|
-
import { zoraDrawerContentMeta } from '../patterns/zora-drawer-content/meta';
|
|
97
|
-
import { zoraTabBarMeta } from '../patterns/zora-tab-bar/meta';
|
|
98
92
|
import { themeModeToggleMeta } from '../theme/ThemeModeToggle.meta';
|
|
99
93
|
import type { ZoraComponentMetaRegistry } from './types';
|
|
100
94
|
|
|
@@ -116,7 +110,6 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = {
|
|
|
116
110
|
ChipGroup: chipGroupMeta,
|
|
117
111
|
DataTable: dataTableMeta,
|
|
118
112
|
DatePicker: datePickerMeta,
|
|
119
|
-
Drawer: drawerMeta,
|
|
120
113
|
DropdownMenu: dropdownMenuMeta,
|
|
121
114
|
Form: formMeta,
|
|
122
115
|
FormActions: formActionsMeta,
|
|
@@ -132,8 +125,6 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = {
|
|
|
132
125
|
Menu: menuMeta,
|
|
133
126
|
MetricCard: metricCardMeta,
|
|
134
127
|
Modal: modalMeta,
|
|
135
|
-
NavigationItem: navigationItemMeta,
|
|
136
|
-
NavigationList: navigationListMeta,
|
|
137
128
|
Pagination: paginationMeta,
|
|
138
129
|
Progress: progressMeta,
|
|
139
130
|
ProgressRing: progressRingMeta,
|
|
@@ -188,7 +179,6 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = {
|
|
|
188
179
|
Panel: panelMeta,
|
|
189
180
|
PostCard: postCardMeta,
|
|
190
181
|
ProductCard: productCardMeta,
|
|
191
|
-
ResponsivePanel: responsivePanelMeta,
|
|
192
182
|
ReaderSurface: readerSurfaceMeta,
|
|
193
183
|
BarcodeScannerView: barcodeScannerViewMeta,
|
|
194
184
|
CameraPermissionView: cameraPermissionViewMeta,
|
|
@@ -204,6 +194,4 @@ export const ZORA_COMPONENT_META: ZoraComponentMetaRegistry = {
|
|
|
204
194
|
Timeline: timelineMeta,
|
|
205
195
|
TreeItem: treeItemMeta,
|
|
206
196
|
TreeView: treeViewMeta,
|
|
207
|
-
ZoraDrawerContent: zoraDrawerContentMeta,
|
|
208
|
-
ZoraTabBar: zoraTabBarMeta,
|
|
209
197
|
};
|
package/src/registry.ts
CHANGED
|
@@ -15,7 +15,6 @@ import { Chip } from './components/chip';
|
|
|
15
15
|
import { ChipGroup } from './components/chip-group';
|
|
16
16
|
import { DataTable } from './components/data-table';
|
|
17
17
|
import { DatePicker } from './components/date-picker';
|
|
18
|
-
import { Drawer } from './components/drawer';
|
|
19
18
|
import { Form, FormActions, FormError, FormField } from './components/form';
|
|
20
19
|
import { Gradient } from './components/gradient';
|
|
21
20
|
import { Heading } from './components/heading';
|
|
@@ -27,8 +26,6 @@ import { MediaCard } from './components/media-card';
|
|
|
27
26
|
import { DropdownMenu, Menu } from './components/menu';
|
|
28
27
|
import { MetricCard } from './components/metric-card';
|
|
29
28
|
import { Modal } from './components/modal';
|
|
30
|
-
import { NavigationItem } from './components/navigation-item';
|
|
31
|
-
import { NavigationList } from './components/navigation-list';
|
|
32
29
|
import { Pagination } from './components/pagination';
|
|
33
30
|
import { Progress, ProgressRing } from './components/progress';
|
|
34
31
|
import { Radio, RadioGroup } from './components/radio';
|
|
@@ -88,7 +85,6 @@ import { Panel } from './patterns/panel';
|
|
|
88
85
|
import { PostCard } from './patterns/post-card';
|
|
89
86
|
import { ProductCard } from './patterns/product-card';
|
|
90
87
|
import { ReaderSurface } from './patterns/reader';
|
|
91
|
-
import { ResponsivePanel } from './patterns/responsive-panel';
|
|
92
88
|
import { BarcodeScannerView, CameraPermissionView, ScanOverlay } from './patterns/scanner';
|
|
93
89
|
import { SectionHeader } from './patterns/section-header';
|
|
94
90
|
import { SelectableItem } from './patterns/selection';
|
|
@@ -98,8 +94,6 @@ import { ThemeComposer } from './patterns/theme-composer';
|
|
|
98
94
|
import { PaletteItem, TileGrid } from './patterns/tile-grid';
|
|
99
95
|
import { Timeline } from './patterns/timeline';
|
|
100
96
|
import { TreeItem, TreeView } from './patterns/tree-view';
|
|
101
|
-
import { ZoraDrawerContent } from './patterns/zora-drawer-content';
|
|
102
|
-
import { ZoraTabBar } from './patterns/zora-tab-bar';
|
|
103
97
|
import { ThemeModeToggle } from './theme/ThemeModeToggle';
|
|
104
98
|
|
|
105
99
|
export type ZoraComponentRegistry = Readonly<Record<string, React.ElementType>>;
|
|
@@ -144,7 +138,6 @@ const _ZORA_COMPONENT_REGISTRY = {
|
|
|
144
138
|
ChipGroup,
|
|
145
139
|
DataTable,
|
|
146
140
|
DatePicker,
|
|
147
|
-
Drawer,
|
|
148
141
|
DropdownMenu,
|
|
149
142
|
Form,
|
|
150
143
|
FormActions,
|
|
@@ -160,8 +153,6 @@ const _ZORA_COMPONENT_REGISTRY = {
|
|
|
160
153
|
Menu,
|
|
161
154
|
MetricCard,
|
|
162
155
|
Modal,
|
|
163
|
-
NavigationItem,
|
|
164
|
-
NavigationList,
|
|
165
156
|
Pagination,
|
|
166
157
|
Progress,
|
|
167
158
|
ProgressRing,
|
|
@@ -225,7 +216,6 @@ const _ZORA_COMPONENT_REGISTRY = {
|
|
|
225
216
|
Panel,
|
|
226
217
|
PostCard,
|
|
227
218
|
ProductCard,
|
|
228
|
-
ResponsivePanel,
|
|
229
219
|
ReaderSurface,
|
|
230
220
|
BarcodeScannerView,
|
|
231
221
|
CameraPermissionView,
|
|
@@ -240,8 +230,6 @@ const _ZORA_COMPONENT_REGISTRY = {
|
|
|
240
230
|
Timeline,
|
|
241
231
|
TreeItem,
|
|
242
232
|
TreeView,
|
|
243
|
-
ZoraDrawerContent,
|
|
244
|
-
ZoraTabBar,
|
|
245
233
|
} as const satisfies ZoraComponentRegistry;
|
|
246
234
|
|
|
247
235
|
export const ZORA_COMPONENT_REGISTRY: ZoraComponentRegistry = _ZORA_COMPONENT_REGISTRY;
|
|
@@ -28,7 +28,6 @@ const REQUIRED_SHOWCASE_COVERAGE = {
|
|
|
28
28
|
'CheckboxGroup',
|
|
29
29
|
'Chip',
|
|
30
30
|
'ChipGroup',
|
|
31
|
-
'Drawer',
|
|
32
31
|
'Form',
|
|
33
32
|
'FormActions',
|
|
34
33
|
'FormError',
|
|
@@ -41,8 +40,6 @@ const REQUIRED_SHOWCASE_COVERAGE = {
|
|
|
41
40
|
'MediaCard',
|
|
42
41
|
'MetricCard',
|
|
43
42
|
'Modal',
|
|
44
|
-
'NavigationItem',
|
|
45
|
-
'NavigationList',
|
|
46
43
|
'Progress',
|
|
47
44
|
'ProgressRing',
|
|
48
45
|
'Radio',
|
|
@@ -97,7 +94,6 @@ const REQUIRED_SHOWCASE_COVERAGE = {
|
|
|
97
94
|
'ImageUploadField',
|
|
98
95
|
'Notice',
|
|
99
96
|
'Panel',
|
|
100
|
-
'ResponsivePanel',
|
|
101
97
|
'ReaderSurface',
|
|
102
98
|
'SectionHeader',
|
|
103
99
|
'SettingsRow',
|
|
@@ -108,8 +104,6 @@ const REQUIRED_SHOWCASE_COVERAGE = {
|
|
|
108
104
|
'TileGrid',
|
|
109
105
|
'TreeItem',
|
|
110
106
|
'TreeView',
|
|
111
|
-
'ZoraDrawerContent',
|
|
112
|
-
'ZoraTabBar',
|
|
113
107
|
],
|
|
114
108
|
} as const;
|
|
115
109
|
|
|
@@ -62,7 +62,6 @@ const scopedComponentFiles = [
|
|
|
62
62
|
join(srcDir, 'components', 'metric-card', 'MetricCard.tsx'),
|
|
63
63
|
join(srcDir, 'components', 'checkbox', 'Checkbox.tsx'),
|
|
64
64
|
join(srcDir, 'components', 'checkbox', 'CheckboxGroup.tsx'),
|
|
65
|
-
join(srcDir, 'components', 'drawer', 'Drawer.tsx'),
|
|
66
65
|
join(srcDir, 'components', 'form', 'Form.tsx'),
|
|
67
66
|
join(srcDir, 'components', 'form', 'FormActions.tsx'),
|
|
68
67
|
join(srcDir, 'components', 'form', 'FormError.tsx'),
|
|
@@ -105,7 +104,6 @@ const scopedComponentFiles = [
|
|
|
105
104
|
join(srcDir, 'patterns', 'list', 'ListSection.tsx'),
|
|
106
105
|
join(srcDir, 'patterns', 'notice', 'Notice.tsx'),
|
|
107
106
|
join(srcDir, 'patterns', 'panel', 'Panel.tsx'),
|
|
108
|
-
join(srcDir, 'patterns', 'responsive-panel', 'ResponsivePanel.tsx'),
|
|
109
107
|
join(srcDir, 'patterns', 'section-header', 'SectionHeader.tsx'),
|
|
110
108
|
join(srcDir, 'patterns', 'settings-row', 'SettingsRow.tsx'),
|
|
111
109
|
join(srcDir, 'patterns', 'switch-field', 'SwitchField.tsx'),
|
|
@@ -136,7 +134,6 @@ const scopedPropTypeFiles = [
|
|
|
136
134
|
join(srcDir, 'components', 'media-card', 'types.ts'),
|
|
137
135
|
join(srcDir, 'components', 'metric-card', 'types.ts'),
|
|
138
136
|
join(srcDir, 'components', 'checkbox', 'types.ts'),
|
|
139
|
-
join(srcDir, 'components', 'drawer', 'types.ts'),
|
|
140
137
|
join(srcDir, 'components', 'form', 'types.ts'),
|
|
141
138
|
join(srcDir, 'components', 'heading', 'types.ts'),
|
|
142
139
|
join(srcDir, 'components', 'icon', 'Icon.tsx'),
|
|
@@ -169,7 +166,6 @@ const scopedPropTypeFiles = [
|
|
|
169
166
|
join(srcDir, 'patterns', 'list', 'types.ts'),
|
|
170
167
|
join(srcDir, 'patterns', 'notice', 'types.ts'),
|
|
171
168
|
join(srcDir, 'patterns', 'panel', 'types.ts'),
|
|
172
|
-
join(srcDir, 'patterns', 'responsive-panel', 'types.ts'),
|
|
173
169
|
join(srcDir, 'patterns', 'section-header', 'types.ts'),
|
|
174
170
|
join(srcDir, 'patterns', 'settings-row', 'types.ts'),
|
|
175
171
|
join(srcDir, 'patterns', 'switch-field', 'types.ts'),
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { DrawerProps } from './types';
|
|
3
|
-
/***
|
|
4
|
-
* Side panel overlay for navigation, settings, and secondary content.
|
|
5
|
-
*/
|
|
6
|
-
export declare const Drawer: (props: DrawerProps) => React.ReactElement | null;
|
|
7
|
-
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AACA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAM9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAgD3C;;GAEG;AACH,eAAO,MAAM,MAAM,mDAAkC,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Drawer as SurfaceDrawer } from '@ankhorage/surface';
|
|
2
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
3
|
-
import { Box, Stack } from '../../foundation';
|
|
4
|
-
import { withZoraThemeScope } from '../../theme/withZoraThemeScope';
|
|
5
|
-
import { Heading } from '../heading';
|
|
6
|
-
import { Text } from '../text';
|
|
7
|
-
function useStableCallback(callback) {
|
|
8
|
-
const callbackRef = useRef(callback);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
callbackRef.current = callback;
|
|
11
|
-
}, [callback]);
|
|
12
|
-
return useCallback(() => {
|
|
13
|
-
callbackRef.current?.();
|
|
14
|
-
}, []);
|
|
15
|
-
}
|
|
16
|
-
function DrawerInner({ themeId: _themeId, mode: _mode, children, title, description, footer, onDismiss, interactionPolicy, ...props }) {
|
|
17
|
-
const hasHeader = title != null || description != null;
|
|
18
|
-
const stableOnDismiss = useStableCallback(onDismiss);
|
|
19
|
-
return (<SurfaceDrawer {...props} onDismiss={stableOnDismiss} interactionPolicy={interactionPolicy}>
|
|
20
|
-
<Stack gap="m">
|
|
21
|
-
{hasHeader ? (<Stack gap="xs">
|
|
22
|
-
{title ? <Heading level={3}>{title}</Heading> : null}
|
|
23
|
-
{description ? (<Text emphasis="muted" variant="bodySmall">
|
|
24
|
-
{description}
|
|
25
|
-
</Text>) : null}
|
|
26
|
-
</Stack>) : null}
|
|
27
|
-
{children ? <Box flex={1}>{children}</Box> : null}
|
|
28
|
-
{footer ? <Box pt="xs">{footer}</Box> : null}
|
|
29
|
-
</Stack>
|
|
30
|
-
</SurfaceDrawer>);
|
|
31
|
-
}
|
|
32
|
-
/***
|
|
33
|
-
* Side panel overlay for navigation, settings, and secondary content.
|
|
34
|
-
*/
|
|
35
|
-
export const Drawer = withZoraThemeScope(DrawerInner);
|
|
36
|
-
//# sourceMappingURL=Drawer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE9D,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAG/B,SAAS,iBAAiB,CAAC,QAAkC;IAC3D,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IAErC,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,WAAW,CAAC,GAAG,EAAE;QACtB,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;IAC1B,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED,SAAS,WAAW,CAAC,EACnB,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,QAAQ,EACR,KAAK,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,GAAG,KAAK,EACI;IACZ,MAAM,SAAS,GAAG,KAAK,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,CAAC;IACvD,MAAM,eAAe,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAErD,OAAO,CACL,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACzF;MAAA,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CACZ;QAAA,CAAC,SAAS,CAAC,CAAC,CAAC,CACX,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CACb;YAAA,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CACpD;YAAA,CAAC,WAAW,CAAC,CAAC,CAAC,CACb,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CACxC;gBAAA,CAAC,WAAW,CACd;cAAA,EAAE,IAAI,CAAC,CACR,CAAC,CAAC,CAAC,IAAI,CACV;UAAA,EAAE,KAAK,CAAC,CACT,CAAC,CAAC,CAAC,IAAI,CACR;QAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CACjD;QAAA,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9C;MAAA,EAAE,KAAK,CACT;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC","sourcesContent":["import { Drawer as SurfaceDrawer } from '@ankhorage/surface';\nimport React, { useCallback, useEffect, useRef } from 'react';\n\nimport { Box, Stack } from '../../foundation';\nimport { withZoraThemeScope } from '../../theme/withZoraThemeScope';\nimport { Heading } from '../heading';\nimport { Text } from '../text';\nimport type { DrawerProps } from './types';\n\nfunction useStableCallback(callback: (() => void) | undefined): (() => void) | undefined {\n const callbackRef = useRef(callback);\n\n useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n return useCallback(() => {\n callbackRef.current?.();\n }, []);\n}\n\nfunction DrawerInner({\n themeId: _themeId,\n mode: _mode,\n children,\n title,\n description,\n footer,\n onDismiss,\n interactionPolicy,\n ...props\n}: DrawerProps) {\n const hasHeader = title != null || description != null;\n const stableOnDismiss = useStableCallback(onDismiss);\n\n return (\n <SurfaceDrawer {...props} onDismiss={stableOnDismiss} interactionPolicy={interactionPolicy}>\n <Stack gap=\"m\">\n {hasHeader ? (\n <Stack gap=\"xs\">\n {title ? <Heading level={3}>{title}</Heading> : null}\n {description ? (\n <Text emphasis=\"muted\" variant=\"bodySmall\">\n {description}\n </Text>\n ) : null}\n </Stack>\n ) : null}\n {children ? <Box flex={1}>{children}</Box> : null}\n {footer ? <Box pt=\"xs\">{footer}</Box> : null}\n </Stack>\n </SurfaceDrawer>\n );\n}\n\n/***\n * Side panel overlay for navigation, settings, and secondary content.\n */\nexport const Drawer = withZoraThemeScope(DrawerInner);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC","sourcesContent":["export { Drawer } from './Drawer';\nexport type { DrawerProps } from './types';\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const drawerMeta: {
|
|
2
|
-
readonly name: "Drawer";
|
|
3
|
-
readonly category: "component";
|
|
4
|
-
readonly directManifestNode: false;
|
|
5
|
-
readonly allowedChildren: readonly [];
|
|
6
|
-
readonly note: "Shell/navigation component; not represented as a manifest node in v1.";
|
|
7
|
-
readonly props: {};
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/drawer/meta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;CAOe,CAAC"}
|