@astryxdesign/cli 0.1.6-canary.1a0fef5 → 0.1.6-canary.1b61ba6
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/docs/integration-authoring.md +105 -0
- package/docs/internationalization.doc.mjs +243 -0
- package/package.json +13 -9
- package/src/api/integration-block-exports.test.mjs +240 -0
- package/src/api/template-suffix.test.mjs +246 -0
- package/src/api/template.mjs +104 -28
- package/src/api/validate-integration.mjs +0 -8
- package/src/codemods/__tests__/registry.test.mjs +1 -0
- package/src/codemods/registry.mjs +1 -0
- package/src/codemods/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +120 -0
- package/src/codemods/transforms/v0.1.7/index.mjs +19 -0
- package/src/codemods/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +188 -0
- package/src/config.mjs +5 -14
- package/src/doc.mjs +27 -0
- package/src/doc.test.mjs +383 -0
- package/src/integration.mjs +4 -15
- package/src/lib/component-discovery.importpath.test.mjs +59 -0
- package/src/lib/component-discovery.mjs +15 -5
- package/src/lib/component-format.mjs +45 -13
- package/src/lib/component-format.test.mjs +95 -1
- package/src/lib/component-loader.mjs +104 -2
- package/src/lib/componentDocOverlay.test.mjs +111 -0
- package/src/lib/config-schema.mjs +0 -30
- package/src/lib/hook-format.mjs +8 -3
- package/src/lib/xle/registry.mjs +0 -5
- package/src/schemas/doc-schema.mjs +226 -0
- package/src/schemas/template-schema.mjs +47 -0
- package/src/template.mjs +9 -67
- package/src/types/config.d.ts +11 -66
- package/src/types/doc.d.ts +23 -0
- package/src/types/integration.d.ts +7 -18
- package/src/types/template-api.d.ts +14 -50
- package/templates/blocks/components/Avatar/AvatarGroup.tsx +5 -7
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +4 -6
- package/templates/blocks/components/Avatar/AvatarUserCard.tsx +3 -5
- package/templates/blocks/components/Avatar/AvatarWithImage.tsx +8 -6
- package/templates/blocks/components/Avatar/AvatarWithStatus.tsx +3 -5
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputControlledInput.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputDisabled.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputMentionTrigger.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputMultipleTriggers.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputShowcase.tsx +1 -1
- package/templates/blocks/components/ChatComposerInput/ChatComposerInputSlashCommands.tsx +1 -1
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenLiveRegion.doc.mjs +14 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenLiveRegion.tsx +41 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.doc.mjs +13 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenShowcase.tsx +78 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenStructuralHeading.doc.mjs +14 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenStructuralHeading.tsx +38 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.doc.mjs +14 -0
- package/templates/blocks/components/VisuallyHidden/VisuallyHiddenSupplementaryContext.tsx +47 -0
- package/templates/pages/theme-showcase/page.tsx +7 -7
- package/templates/themes/neutral/neutralTheme.ts +63 -32
|
@@ -5,24 +5,26 @@
|
|
|
5
5
|
import {Avatar} from '@astryxdesign/core/Avatar';
|
|
6
6
|
import {Stack} from '@astryxdesign/core/Layout';
|
|
7
7
|
|
|
8
|
-
const CDN = 'https://lookaside.facebook.com/assets/astryx';
|
|
9
|
-
|
|
10
8
|
export default function AvatarWithImage() {
|
|
11
9
|
return (
|
|
12
10
|
<Stack direction="horizontal" gap={4} vAlign="center">
|
|
13
|
-
<Avatar src={`${CDN}/DATA-Ami-Pena.png`} name="Ami Pena" size="tiny" />
|
|
14
11
|
<Avatar
|
|
15
|
-
src=
|
|
12
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Ami-Pena.png"
|
|
13
|
+
name="Ami Pena"
|
|
14
|
+
size="tiny"
|
|
15
|
+
/>
|
|
16
|
+
<Avatar
|
|
17
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Ana-Thomas.png"
|
|
16
18
|
name="Ana Thomas"
|
|
17
19
|
size="small"
|
|
18
20
|
/>
|
|
19
21
|
<Avatar
|
|
20
|
-
src=
|
|
22
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Daniela-Gimenez.png"
|
|
21
23
|
name="Daniela Gimenez"
|
|
22
24
|
size="medium"
|
|
23
25
|
/>
|
|
24
26
|
<Avatar
|
|
25
|
-
src=
|
|
27
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Gabriela-Fernandez.png"
|
|
26
28
|
name="Gabriela Fernandez"
|
|
27
29
|
size="large"
|
|
28
30
|
/>
|
|
@@ -5,25 +5,23 @@
|
|
|
5
5
|
import {Avatar, AvatarStatusDot} from '@astryxdesign/core/Avatar';
|
|
6
6
|
import {Stack} from '@astryxdesign/core/Layout';
|
|
7
7
|
|
|
8
|
-
const CDN = 'https://lookaside.facebook.com/assets/astryx';
|
|
9
|
-
|
|
10
8
|
export default function AvatarWithStatus() {
|
|
11
9
|
return (
|
|
12
10
|
<Stack direction="horizontal" gap={4} vAlign="center">
|
|
13
11
|
<Avatar
|
|
14
|
-
src=
|
|
12
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Itai-Jordaan.png"
|
|
15
13
|
name="Itai Jordaan"
|
|
16
14
|
size="large"
|
|
17
15
|
status={<AvatarStatusDot variant="success" label="Online" />}
|
|
18
16
|
/>
|
|
19
17
|
<Avatar
|
|
20
|
-
src=
|
|
18
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Margot-Schroder.png"
|
|
21
19
|
name="Margot Schroder"
|
|
22
20
|
size="large"
|
|
23
21
|
status={<AvatarStatusDot variant="neutral" label="Offline" />}
|
|
24
22
|
/>
|
|
25
23
|
<Avatar
|
|
26
|
-
src=
|
|
24
|
+
src="https://lookaside.facebook.com/assets/astryx/DATA-Pablo-Morales.png"
|
|
27
25
|
name="Pablo Morales"
|
|
28
26
|
size="large"
|
|
29
27
|
status={<AvatarStatusDot variant="error" label="Busy" />}
|
|
@@ -10,7 +10,7 @@ import {Text} from '@astryxdesign/core/Text';
|
|
|
10
10
|
export default function ChatComposerInputControlledInput() {
|
|
11
11
|
const [value, setValue] = useState('');
|
|
12
12
|
return (
|
|
13
|
-
<Stack direction="vertical" gap={3} style={{width:
|
|
13
|
+
<Stack direction="vertical" gap={3} style={{width: 450, maxWidth: '100%'}}>
|
|
14
14
|
<ChatComposer
|
|
15
15
|
onSubmit={() => setValue('')}
|
|
16
16
|
value={value}
|
|
@@ -7,7 +7,7 @@ import {Stack} from '@astryxdesign/core/Layout';
|
|
|
7
7
|
|
|
8
8
|
export default function ChatComposerInputDisabled() {
|
|
9
9
|
return (
|
|
10
|
-
<Stack direction="vertical" style={{width:
|
|
10
|
+
<Stack direction="vertical" style={{width: 450, maxWidth: '100%'}}>
|
|
11
11
|
<ChatComposer
|
|
12
12
|
onSubmit={() => {}}
|
|
13
13
|
isDisabled
|
|
@@ -43,7 +43,7 @@ export default function ChatComposerInputMentionTrigger() {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
|
-
<Stack direction="vertical" gap={3} style={{width:
|
|
46
|
+
<Stack direction="vertical" gap={3} style={{width: 450, maxWidth: '100%'}}>
|
|
47
47
|
<ChatComposer
|
|
48
48
|
onSubmit={() => setValue('')}
|
|
49
49
|
input={
|
|
@@ -54,7 +54,7 @@ export default function ChatComposerInputMultipleTriggers() {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
return (
|
|
57
|
-
<Stack direction="vertical" gap={3} style={{width:
|
|
57
|
+
<Stack direction="vertical" gap={3} style={{width: 450, maxWidth: '100%'}}>
|
|
58
58
|
<Text type="supporting" color="secondary">
|
|
59
59
|
Type @ for mentions (blue) or / for commands (yellow)
|
|
60
60
|
</Text>
|
|
@@ -7,7 +7,7 @@ import {Stack} from '@astryxdesign/core/Layout';
|
|
|
7
7
|
|
|
8
8
|
export default function ChatComposerInputShowcase() {
|
|
9
9
|
return (
|
|
10
|
-
<Stack direction="vertical" style={{width:
|
|
10
|
+
<Stack direction="vertical" style={{width: 450, maxWidth: '100%'}}>
|
|
11
11
|
<ChatComposer
|
|
12
12
|
onSubmit={() => {}}
|
|
13
13
|
input={
|
|
@@ -40,7 +40,7 @@ export default function ChatComposerInputSlashCommands() {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
return (
|
|
43
|
-
<Stack direction="vertical" style={{width:
|
|
43
|
+
<Stack direction="vertical" style={{width: 450, maxWidth: '100%'}}>
|
|
44
44
|
<ChatComposer
|
|
45
45
|
onSubmit={() => {}}
|
|
46
46
|
input={
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'block',
|
|
6
|
+
exampleFor: 'VisuallyHidden',
|
|
7
|
+
name: 'VisuallyHidden — Live Region',
|
|
8
|
+
displayName: 'VisuallyHidden — Live Region',
|
|
9
|
+
description:
|
|
10
|
+
'A polite aria-live region announces visual-only state changes to assistive technology.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 4 / 3,
|
|
13
|
+
componentsUsed: ['VisuallyHidden', 'Button', 'HStack', 'VStack', 'Text'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useState} from 'react';
|
|
6
|
+
import {VisuallyHidden} from '@astryxdesign/core/VisuallyHidden';
|
|
7
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
8
|
+
import {HStack, VStack} from '@astryxdesign/core/Layout';
|
|
9
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
10
|
+
|
|
11
|
+
const columns = ['Backlog', 'In progress', 'Done'] as const;
|
|
12
|
+
|
|
13
|
+
export default function VisuallyHiddenLiveRegion() {
|
|
14
|
+
const [column, setColumn] = useState(0);
|
|
15
|
+
const current = columns[column];
|
|
16
|
+
|
|
17
|
+
function move() {
|
|
18
|
+
setColumn(c => (c + 1) % columns.length);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<VStack gap={4} hAlign="start">
|
|
23
|
+
<Text type="supporting" color="secondary">
|
|
24
|
+
Drag-and-drop and other visual-only changes are silent to screen
|
|
25
|
+
readers. A live region narrates them.
|
|
26
|
+
</Text>
|
|
27
|
+
<HStack gap={3} vAlign="center">
|
|
28
|
+
<Button label="Move task" variant="secondary" onClick={move} />
|
|
29
|
+
<Text type="body">
|
|
30
|
+
Task is in{' '}
|
|
31
|
+
<Text as="span" weight="bold">
|
|
32
|
+
{current}
|
|
33
|
+
</Text>
|
|
34
|
+
</Text>
|
|
35
|
+
</HStack>
|
|
36
|
+
<VisuallyHidden as="div" aria-live="polite">
|
|
37
|
+
{`Task moved to ${current}`}
|
|
38
|
+
</VisuallyHidden>
|
|
39
|
+
</VStack>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'block',
|
|
6
|
+
exampleFor: 'VisuallyHidden',
|
|
7
|
+
name: 'VisuallyHidden',
|
|
8
|
+
displayName: 'VisuallyHidden',
|
|
9
|
+
isReady: true,
|
|
10
|
+
aspectRatio: 16 / 9,
|
|
11
|
+
isShowcase: true,
|
|
12
|
+
componentsUsed: ['VisuallyHidden', 'IconButton', 'Card', 'HStack', 'VStack', 'Text', 'Icon'],
|
|
13
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {VisuallyHidden} from '@astryxdesign/core/VisuallyHidden';
|
|
6
|
+
import {IconButton} from '@astryxdesign/core/IconButton';
|
|
7
|
+
import {Card} from '@astryxdesign/core/Card';
|
|
8
|
+
import {HStack, VStack} from '@astryxdesign/core/Layout';
|
|
9
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
10
|
+
import {Icon} from '@astryxdesign/core/Icon';
|
|
11
|
+
import {
|
|
12
|
+
ArrowDownTrayIcon,
|
|
13
|
+
ShareIcon,
|
|
14
|
+
TrashIcon,
|
|
15
|
+
} from '@heroicons/react/24/outline';
|
|
16
|
+
import {SpeakerWaveIcon} from '@heroicons/react/24/solid';
|
|
17
|
+
|
|
18
|
+
const actions = [
|
|
19
|
+
{label: 'Download', icon: ArrowDownTrayIcon},
|
|
20
|
+
{label: 'Share', icon: ShareIcon},
|
|
21
|
+
{label: 'Delete', icon: TrashIcon},
|
|
22
|
+
] as const;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* VisuallyHidden is invisible by design, so this hero teaches the concept by
|
|
26
|
+
* contrast: the icon-only buttons are all a sighted user sees, while the
|
|
27
|
+
* caption spells out the accessible name each one exposes. A live
|
|
28
|
+
* <VisuallyHidden> region below announces the same names to assistive tech,
|
|
29
|
+
* so the demo genuinely exercises the component it documents.
|
|
30
|
+
*/
|
|
31
|
+
export default function VisuallyHiddenShowcase() {
|
|
32
|
+
return (
|
|
33
|
+
<VStack gap={5} hAlign="center">
|
|
34
|
+
<HStack gap={6} vAlign="stretch" wrap="wrap" hAlign="center">
|
|
35
|
+
<Card variant="muted">
|
|
36
|
+
<VStack gap={4} hAlign="center">
|
|
37
|
+
<Text type="supporting" color="secondary">
|
|
38
|
+
What you see
|
|
39
|
+
</Text>
|
|
40
|
+
<HStack gap={2}>
|
|
41
|
+
{actions.map(({label, icon}) => (
|
|
42
|
+
<IconButton
|
|
43
|
+
key={label}
|
|
44
|
+
label={label}
|
|
45
|
+
icon={<Icon icon={icon} />}
|
|
46
|
+
variant="ghost"
|
|
47
|
+
/>
|
|
48
|
+
))}
|
|
49
|
+
</HStack>
|
|
50
|
+
</VStack>
|
|
51
|
+
</Card>
|
|
52
|
+
|
|
53
|
+
<Card variant="muted">
|
|
54
|
+
<VStack gap={4} hAlign="start">
|
|
55
|
+
<HStack gap={2} vAlign="center">
|
|
56
|
+
<Icon icon={SpeakerWaveIcon} size="sm" />
|
|
57
|
+
<Text type="supporting" color="secondary">
|
|
58
|
+
What a screen reader hears
|
|
59
|
+
</Text>
|
|
60
|
+
</HStack>
|
|
61
|
+
<VStack gap={2}>
|
|
62
|
+
{actions.map(({label}) => (
|
|
63
|
+
<Text key={label} type="body">
|
|
64
|
+
{label}, button
|
|
65
|
+
</Text>
|
|
66
|
+
))}
|
|
67
|
+
</VStack>
|
|
68
|
+
</VStack>
|
|
69
|
+
</Card>
|
|
70
|
+
</HStack>
|
|
71
|
+
|
|
72
|
+
{/* A real live region: silent to sighted users, announced by AT. */}
|
|
73
|
+
<VisuallyHidden as="div" aria-live="polite">
|
|
74
|
+
Actions available: Download, Share, Delete.
|
|
75
|
+
</VisuallyHidden>
|
|
76
|
+
</VStack>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'block',
|
|
6
|
+
exampleFor: 'VisuallyHidden',
|
|
7
|
+
name: 'VisuallyHidden — Structural Heading',
|
|
8
|
+
displayName: 'VisuallyHidden — Structural Heading',
|
|
9
|
+
description:
|
|
10
|
+
'Give a visually implicit section an accessible name so screen-reader users can navigate to it.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 4 / 3,
|
|
13
|
+
componentsUsed: ['VisuallyHidden', 'Card', 'HStack', 'VStack', 'Text', 'Badge'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {VisuallyHidden} from '@astryxdesign/core/VisuallyHidden';
|
|
6
|
+
import {Card} from '@astryxdesign/core/Card';
|
|
7
|
+
import {HStack, VStack} from '@astryxdesign/core/Layout';
|
|
8
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
9
|
+
import {Badge} from '@astryxdesign/core/Badge';
|
|
10
|
+
|
|
11
|
+
const items = [
|
|
12
|
+
{name: 'astryx-core', status: 'Passing', variant: 'success'},
|
|
13
|
+
{name: 'astryx-charts', status: 'Failing', variant: 'error'},
|
|
14
|
+
{name: 'astryx-cli', status: 'Passing', variant: 'success'},
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
export default function VisuallyHiddenStructuralHeading() {
|
|
18
|
+
return (
|
|
19
|
+
<VStack gap={3} hAlign="start">
|
|
20
|
+
<Text type="supporting" color="secondary">
|
|
21
|
+
The layout makes this group obvious to sighted users. A hidden heading
|
|
22
|
+
gives screen-reader users the same landmark to jump to.
|
|
23
|
+
</Text>
|
|
24
|
+
{/* No visible heading is needed here, but AT users navigate by heading. */}
|
|
25
|
+
<VisuallyHidden as="h2">Build status</VisuallyHidden>
|
|
26
|
+
<VStack gap={2}>
|
|
27
|
+
{items.map(({name, status, variant}) => (
|
|
28
|
+
<Card key={name} variant="muted" padding={3}>
|
|
29
|
+
<HStack gap={3} vAlign="center">
|
|
30
|
+
<Text type="body">{name}</Text>
|
|
31
|
+
<Badge label={status} variant={variant} />
|
|
32
|
+
</HStack>
|
|
33
|
+
</Card>
|
|
34
|
+
))}
|
|
35
|
+
</VStack>
|
|
36
|
+
</VStack>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @type {import('../../../../../core/src/docs-types').TemplateDoc} */
|
|
4
|
+
export const doc = {
|
|
5
|
+
type: 'block',
|
|
6
|
+
exampleFor: 'VisuallyHidden',
|
|
7
|
+
name: 'VisuallyHidden — Supplementary Context',
|
|
8
|
+
displayName: 'VisuallyHidden — Supplementary Context',
|
|
9
|
+
description:
|
|
10
|
+
'Add screen-reader-only context to terse visual data, like spelling out what a trend arrow means.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 4 / 3,
|
|
13
|
+
componentsUsed: ['VisuallyHidden', 'Card', 'HStack', 'VStack', 'Text', 'Icon'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {VisuallyHidden} from '@astryxdesign/core/VisuallyHidden';
|
|
6
|
+
import {Card} from '@astryxdesign/core/Card';
|
|
7
|
+
import {HStack, VStack} from '@astryxdesign/core/Layout';
|
|
8
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
9
|
+
import {Icon} from '@astryxdesign/core/Icon';
|
|
10
|
+
import {ArrowUpIcon, ArrowDownIcon} from '@heroicons/react/24/solid';
|
|
11
|
+
|
|
12
|
+
const stats = [
|
|
13
|
+
{label: 'Revenue', value: '$48.2k', delta: '+12%', direction: 'up'},
|
|
14
|
+
{label: 'Churn', value: '2.1%', delta: '-4%', direction: 'down'},
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
export default function VisuallyHiddenSupplementaryContext() {
|
|
18
|
+
return (
|
|
19
|
+
<HStack gap={4} wrap="wrap">
|
|
20
|
+
{stats.map(({label, value, delta, direction}) => (
|
|
21
|
+
<Card key={label} variant="muted">
|
|
22
|
+
<VStack gap={1}>
|
|
23
|
+
<Text type="supporting" color="secondary">
|
|
24
|
+
{label}
|
|
25
|
+
</Text>
|
|
26
|
+
<Text type="display-3">{value}</Text>
|
|
27
|
+
<HStack gap={1} vAlign="center">
|
|
28
|
+
<Icon
|
|
29
|
+
icon={direction === 'up' ? ArrowUpIcon : ArrowDownIcon}
|
|
30
|
+
size="sm"
|
|
31
|
+
color={direction === 'up' ? 'accent' : 'secondary'}
|
|
32
|
+
/>
|
|
33
|
+
<Text type="body">
|
|
34
|
+
{delta}
|
|
35
|
+
{/* The arrow is decorative; spell out the trend for AT. */}
|
|
36
|
+
<VisuallyHidden>
|
|
37
|
+
{direction === 'up' ? ' increase' : ' decrease'} from last
|
|
38
|
+
month
|
|
39
|
+
</VisuallyHidden>
|
|
40
|
+
</Text>
|
|
41
|
+
</HStack>
|
|
42
|
+
</VStack>
|
|
43
|
+
</Card>
|
|
44
|
+
))}
|
|
45
|
+
</HStack>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -282,14 +282,14 @@ const DEFAULT_PRODUCTS: ProductSpec[] = [
|
|
|
282
282
|
|
|
283
283
|
// Neutral product photos, served from the shared astryx asset CDN so the
|
|
284
284
|
// scaffolded template renders real imagery without needing local public assets.
|
|
285
|
-
const NEUTRAL_CDN = 'https://lookaside.facebook.com/assets/astryx';
|
|
286
285
|
const DEFAULT_IMAGES: Record<string, string> = {
|
|
287
|
-
watch:
|
|
288
|
-
headphones:
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
286
|
+
watch: 'https://lookaside.facebook.com/assets/astryx/Neutral-Watch.png',
|
|
287
|
+
headphones:
|
|
288
|
+
'https://lookaside.facebook.com/assets/astryx/Neutral-Headphones.png',
|
|
289
|
+
backpack: 'https://lookaside.facebook.com/assets/astryx/Neutral-Backpack.png',
|
|
290
|
+
wallet: 'https://lookaside.facebook.com/assets/astryx/Neutral-Wallet.png',
|
|
291
|
+
tumbler: 'https://lookaside.facebook.com/assets/astryx/Neutral-Tumbler.png',
|
|
292
|
+
throw_: 'https://lookaside.facebook.com/assets/astryx/Neutral-Blanket.png',
|
|
293
293
|
};
|
|
294
294
|
|
|
295
295
|
export interface ThemeShowcaseProps {
|
|
@@ -39,19 +39,19 @@ import {neutralIconRegistry} from './icons';
|
|
|
39
39
|
const neutralSyntax = defineSyntaxTheme({
|
|
40
40
|
name: 'xds-neutral',
|
|
41
41
|
tokens: {
|
|
42
|
-
keyword: ['#700084', '#efa8ff'],
|
|
43
|
-
string: ['#005600', '#a6d2a2'],
|
|
44
|
-
comment: ['#737373', '#a3a3a3'],
|
|
45
|
-
number: ['#6e3500', '#ffb37f'],
|
|
46
|
-
function: ['#00458c', '#a0caff'],
|
|
47
|
-
type: ['#700084', '#efa8ff'],
|
|
48
|
-
variable: ['#171717', '#e5e5e5'],
|
|
49
|
-
operator: ['#737373', '#a3a3a3'],
|
|
50
|
-
constant: ['#6e3500', '#ffb37f'],
|
|
51
|
-
tag: ['#89001a', '#ffaeaa'],
|
|
52
|
-
attribute: ['#584400', '#eec12f'],
|
|
53
|
-
property: ['#005348', '#83dac9'],
|
|
54
|
-
punctuation: ['#a3a3a3', '#525252']
|
|
42
|
+
keyword: ['#700084', '#efa8ff'], // purple T30/T80
|
|
43
|
+
string: ['#005600', '#a6d2a2'], // green (sat T30 / pastel T80)
|
|
44
|
+
comment: ['#737373', '#a3a3a3'], // neutral
|
|
45
|
+
number: ['#6e3500', '#ffb37f'], // orange
|
|
46
|
+
function: ['#00458c', '#a0caff'], // blue T30/T80 H=255
|
|
47
|
+
type: ['#700084', '#efa8ff'], // purple
|
|
48
|
+
variable: ['#171717', '#e5e5e5'], // near-black / near-white
|
|
49
|
+
operator: ['#737373', '#a3a3a3'], // neutral
|
|
50
|
+
constant: ['#6e3500', '#ffb37f'], // orange
|
|
51
|
+
tag: ['#89001a', '#ffaeaa'], // red
|
|
52
|
+
attribute: ['#584400', '#eec12f'], // yellow
|
|
53
|
+
property: ['#005348', '#83dac9'], // teal
|
|
54
|
+
punctuation: ['#a3a3a3', '#525252'], // neutral
|
|
55
55
|
background: ['#fafafa', '#0a0a0a'],
|
|
56
56
|
},
|
|
57
57
|
});
|
|
@@ -127,39 +127,39 @@ export const neutralTheme = defineTheme({
|
|
|
127
127
|
// All values use the OKLCH Neutral tonal palette (chroma=0).
|
|
128
128
|
// =========================================================================
|
|
129
129
|
'--color-background-surface': ['#ffffff', '#262626'],
|
|
130
|
-
'--color-background-body':
|
|
131
|
-
'--color-background-card':
|
|
130
|
+
'--color-background-body': ['#f1f1f1', '#1b1b1b'],
|
|
131
|
+
'--color-background-card': ['#ffffff', '#1b1b1b'],
|
|
132
132
|
'--color-background-popover': ['#ffffff', '#1b1b1b'],
|
|
133
|
-
'--color-background-muted':
|
|
133
|
+
'--color-background-muted': ['#f1f1f1', '#1b1b1b'],
|
|
134
134
|
|
|
135
135
|
// Accent + neutral surface tints (sit alongside backgrounds)
|
|
136
|
-
'--color-accent':
|
|
136
|
+
'--color-accent': ['#262626', '#ebebeb'],
|
|
137
137
|
'--color-accent-muted': ['#f1f1f1', '#262626'],
|
|
138
|
-
'--color-neutral':
|
|
138
|
+
'--color-neutral': ['#0000000F', '#FFFFFF1A'],
|
|
139
139
|
|
|
140
140
|
// Overlays (modal scrims, hover/pressed tints)
|
|
141
|
-
'--color-overlay':
|
|
142
|
-
'--color-overlay-hover':
|
|
141
|
+
'--color-overlay': ['#00000080', '#000000CC'],
|
|
142
|
+
'--color-overlay-hover': ['#0000000D', '#FFFFFF0D'],
|
|
143
143
|
'--color-overlay-pressed': ['#0000001A', '#FFFFFF1A'],
|
|
144
144
|
|
|
145
145
|
// Text
|
|
146
|
-
'--color-text-primary':
|
|
146
|
+
'--color-text-primary': ['#171717', '#fafafa'],
|
|
147
147
|
'--color-text-secondary': ['#737373', '#a3a3a3'],
|
|
148
|
-
'--color-text-disabled':
|
|
149
|
-
'--color-text-accent':
|
|
150
|
-
'--color-on-dark':
|
|
151
|
-
'--color-on-light':
|
|
148
|
+
'--color-text-disabled': ['#a3a3a3', '#525252'],
|
|
149
|
+
'--color-text-accent': ['#262626', '#ebebeb'],
|
|
150
|
+
'--color-on-dark': '#ffffff',
|
|
151
|
+
'--color-on-light': '#171717',
|
|
152
152
|
// Contrast: neutral accent is near-black (L) / near-white (D)
|
|
153
|
-
'--color-on-accent':
|
|
153
|
+
'--color-on-accent': ['#ffffff', '#171717'],
|
|
154
154
|
'--color-on-success': ['#ffffff', '#171717'],
|
|
155
|
-
'--color-on-error':
|
|
155
|
+
'--color-on-error': ['#ffffff', '#171717'],
|
|
156
156
|
'--color-on-warning': '#171717',
|
|
157
157
|
|
|
158
158
|
// Icon
|
|
159
|
-
'--color-icon-accent':
|
|
160
|
-
'--color-icon-primary':
|
|
159
|
+
'--color-icon-accent': ['#262626', '#ebebeb'],
|
|
160
|
+
'--color-icon-primary': ['#171717', '#fafafa'],
|
|
161
161
|
'--color-icon-secondary': ['#737373', '#a3a3a3'],
|
|
162
|
-
'--color-icon-disabled':
|
|
162
|
+
'--color-icon-disabled': ['#a3a3a3', '#525252'],
|
|
163
163
|
|
|
164
164
|
// Status / Sentiment — dark mode follows the issue #2150 rubric:
|
|
165
165
|
//
|
|
@@ -372,8 +372,8 @@ export const neutralTheme = defineTheme({
|
|
|
372
372
|
// =========================================================================
|
|
373
373
|
button: {
|
|
374
374
|
'variant:destructive': {
|
|
375
|
-
backgroundColor: 'var(--color-error-muted)',
|
|
376
|
-
color: 'var(--color-error)',
|
|
375
|
+
backgroundColor: 'var(--color-error-muted)', // locked pastel red bg
|
|
376
|
+
color: 'var(--color-error)', // locked T30 red — matches banner/input error text
|
|
377
377
|
},
|
|
378
378
|
},
|
|
379
379
|
|
|
@@ -482,6 +482,37 @@ export const neutralTheme = defineTheme({
|
|
|
482
482
|
},
|
|
483
483
|
},
|
|
484
484
|
|
|
485
|
+
// =========================================================================
|
|
486
|
+
// StatusDot — fill uses the SAME vivid stops as the filled semantic Badge
|
|
487
|
+
// (and ProgressBar), so a dot and its badge read as one status language.
|
|
488
|
+
//
|
|
489
|
+
// The default component maps each variant to a raw semantic token
|
|
490
|
+
// (--color-success / --color-error / --color-warning / --color-icon-
|
|
491
|
+
// secondary), which in light mode are the dark T30/T40 stops meant to
|
|
492
|
+
// sit as TEXT on a pastel surface — as a solid dot they read muddy
|
|
493
|
+
// (dark green / maroon / brown). Redirect them to the badge fills.
|
|
494
|
+
//
|
|
495
|
+
// success → badge success bg (green T45 / dark-ramp T60)
|
|
496
|
+
// warning → badge warning bg (yellow T85, same hex both modes)
|
|
497
|
+
// error → badge error bg (red T55 / dark-ramp T60)
|
|
498
|
+
// accent → badge info bg (blue T50 / dark-ramp T60) — the
|
|
499
|
+
// StatusDot "accent" is the info/attention color, so it
|
|
500
|
+
// pairs with the info badge rather than --color-accent
|
|
501
|
+
// (near-black #262626, the darkest offender).
|
|
502
|
+
//
|
|
503
|
+
// `neutral` is intentionally NOT overridden: the neutral badge bg is a
|
|
504
|
+
// near-invisible light gray (--color-background-gray #e5e5e5 / 10% white
|
|
505
|
+
// wash), fine as a large pill but unreadable as an 8px dot. It keeps the
|
|
506
|
+
// component default's visible mid-gray (--color-icon-secondary), which is
|
|
507
|
+
// not among the "too dark" cases.
|
|
508
|
+
// =========================================================================
|
|
509
|
+
statusdot: {
|
|
510
|
+
'variant:success': {backgroundColor: 'light-dark(#198100, #64af4c)'},
|
|
511
|
+
'variant:warning': {backgroundColor: '#ffce2f'},
|
|
512
|
+
'variant:error': {backgroundColor: 'light-dark(#e33f4a, #ff705d)'},
|
|
513
|
+
'variant:accent': {backgroundColor: 'light-dark(#0074e2, #6d9cfe)'},
|
|
514
|
+
},
|
|
515
|
+
|
|
485
516
|
// =========================================================================
|
|
486
517
|
// Banner — sits on a hue-tinted surface with colored text/icon:
|
|
487
518
|
// Light: pastel T90 bg (pulled from --color-{X}-muted / --color-background-blue)
|