@astryxdesign/cli 0.1.4-canary.39ffd21 → 0.1.4-canary.3d64ef2
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 +2 -1
- package/docs/getting-started.doc.mjs +4 -0
- package/docs/migration.doc.mjs +134 -0
- package/docs/styling.doc.mjs +53 -0
- package/package.json +14 -9
- package/src/api/component.mjs +2 -1
- package/src/api/doctor.mjs +13 -2
- package/src/api/template.mjs +14 -3
- package/src/codemods/__tests__/runner.test.mjs +38 -0
- package/src/codemods/runner.mjs +2 -0
- package/src/commands/agent-docs.mjs +9 -6
- package/src/commands/agent-docs.test.mjs +33 -0
- package/src/commands/build-theme.mjs +110 -13
- package/src/commands/build-theme.variants.test.mjs +204 -0
- package/src/commands/component-resolution.test.mjs +4 -4
- package/src/commands/doctor.test.mjs +34 -0
- package/src/commands/init.mjs +1 -1
- package/src/commands/swizzle.mjs +34 -0
- package/src/commands/swizzle.routing.test.mjs +67 -0
- package/src/lib/component-discovery.mjs +8 -4
- package/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.doc.mjs +14 -0
- package/templates/blocks/components/BaseTypeahead/BaseTypeaheadCustomSearch.tsx +58 -0
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.doc.mjs +14 -0
- package/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +24 -0
- package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.doc.mjs +13 -0
- package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.tsx +33 -0
- package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupShowcase.tsx +27 -48
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.tsx +39 -0
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.tsx +39 -0
- package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemShowcase.tsx +31 -54
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +27 -0
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.doc.mjs +15 -0
- package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +38 -0
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.doc.mjs +14 -0
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.tsx +44 -0
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.doc.mjs +15 -0
- package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.tsx +107 -0
- package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.doc.mjs +15 -0
- package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.tsx +47 -0
- package/templates/pages/table-page-chart/page.tsx +3 -13
- package/templates/pages/table-page-shoe-store-heatmap/page.tsx +4 -18
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useRef, useState} from 'react';
|
|
6
|
+
import {BaseTypeahead, createStaticSource} from '@astryxdesign/core/Typeahead';
|
|
7
|
+
import type {SearchableItem} from '@astryxdesign/core/Typeahead';
|
|
8
|
+
import {Icon} from '@astryxdesign/core/Icon';
|
|
9
|
+
import {HStack, VStack} from '@astryxdesign/core/Layout';
|
|
10
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
11
|
+
import {MagnifyingGlassIcon} from '@heroicons/react/24/outline';
|
|
12
|
+
|
|
13
|
+
const frameworks: SearchableItem[] = [
|
|
14
|
+
{id: 'react', label: 'React'},
|
|
15
|
+
{id: 'vue', label: 'Vue'},
|
|
16
|
+
{id: 'angular', label: 'Angular'},
|
|
17
|
+
{id: 'svelte', label: 'Svelte'},
|
|
18
|
+
{id: 'solid', label: 'SolidJS'},
|
|
19
|
+
{id: 'remix', label: 'Remix'},
|
|
20
|
+
{id: 'next', label: 'Next.js'},
|
|
21
|
+
{id: 'nuxt', label: 'Nuxt'},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const source = createStaticSource(frameworks);
|
|
25
|
+
|
|
26
|
+
export default function BaseTypeaheadCustomSearch() {
|
|
27
|
+
const [value, setValue] = useState<SearchableItem | null>(null);
|
|
28
|
+
const wrapperRef = useRef<HTMLElement>(null);
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<VStack gap={3} style={{width: 320}}>
|
|
32
|
+
<HStack
|
|
33
|
+
ref={wrapperRef}
|
|
34
|
+
gap={2}
|
|
35
|
+
vAlign="center"
|
|
36
|
+
style={{
|
|
37
|
+
border: '1px solid var(--color-border)',
|
|
38
|
+
borderRadius: 'var(--radius-control)',
|
|
39
|
+
padding: '6px 10px',
|
|
40
|
+
background: 'var(--color-surface)',
|
|
41
|
+
}}>
|
|
42
|
+
<Icon icon={MagnifyingGlassIcon} size="sm" color="secondary" />
|
|
43
|
+
<BaseTypeahead
|
|
44
|
+
searchSource={source}
|
|
45
|
+
value={value}
|
|
46
|
+
onChange={setValue}
|
|
47
|
+
anchorRef={wrapperRef}
|
|
48
|
+
placeholder="Search frameworks…"
|
|
49
|
+
hasEntriesOnFocus
|
|
50
|
+
debounceMs={0}
|
|
51
|
+
/>
|
|
52
|
+
</HStack>
|
|
53
|
+
<Text type="supporting" color="secondary">
|
|
54
|
+
{value != null ? `Selected: ${value.label}` : 'No selection'}
|
|
55
|
+
</Text>
|
|
56
|
+
</VStack>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -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: 'CodeBlock',
|
|
7
|
+
name: 'Code — Terminal',
|
|
8
|
+
displayName: 'Code — Terminal',
|
|
9
|
+
description:
|
|
10
|
+
'A dark terminal-style command block: a bash CodeBlock wrapped in SyntaxTheme with the GitHub Dark preset, copy button on, and no line numbers. Use for shell sessions or CLI output that should read as a terminal even on light pages. Reach for a dark syntax preset instead of hand-rolling a dark box with custom CSS.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['CodeBlock', 'SyntaxTheme'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {SyntaxTheme} from '@astryxdesign/core/theme';
|
|
6
|
+
import {githubDark} from '@astryxdesign/core/theme/syntax';
|
|
7
|
+
import {CodeBlock} from '@astryxdesign/core/CodeBlock';
|
|
8
|
+
|
|
9
|
+
const commands = `$ astryx init --features agents
|
|
10
|
+
✓ AI agent docs installed → .claude/CLAUDE.md
|
|
11
|
+
$ pnpm astryx component CodeBlock --dense`;
|
|
12
|
+
|
|
13
|
+
export default function CodeBlockTerminal() {
|
|
14
|
+
return (
|
|
15
|
+
<SyntaxTheme theme={githubDark}>
|
|
16
|
+
<CodeBlock
|
|
17
|
+
code={commands}
|
|
18
|
+
language="bash"
|
|
19
|
+
hasCopyButton
|
|
20
|
+
style={{width: '100%', maxWidth: 480}}
|
|
21
|
+
/>
|
|
22
|
+
</SyntaxTheme>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -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: 'Collapsible',
|
|
7
|
+
name: 'Collapsible — Divided Accordion',
|
|
8
|
+
displayName: 'Collapsible — Divided Accordion',
|
|
9
|
+
description: 'FAQ-style accordion using the dividers prop on CollapsibleGroup: built-in row hairlines and density padding with zero custom CSS. Use for FAQs, settings lists, and nav sections.',
|
|
10
|
+
isReady: true,
|
|
11
|
+
aspectRatio: 4 / 3,
|
|
12
|
+
componentsUsed: ['Collapsible', 'CollapsibleGroup', 'Text'],
|
|
13
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {Collapsible, CollapsibleGroup} from '@astryxdesign/core/Collapsible';
|
|
6
|
+
import {Text} from '@astryxdesign/core/Text';
|
|
7
|
+
|
|
8
|
+
export default function CollapsibleDividedAccordion() {
|
|
9
|
+
return (
|
|
10
|
+
<div style={{width: '100%', maxWidth: 400}}>
|
|
11
|
+
<CollapsibleGroup type="single" dividers="between" defaultValue="reset">
|
|
12
|
+
<Collapsible trigger="How do I reset my password?" value="reset">
|
|
13
|
+
<Text type="body">
|
|
14
|
+
Go to Settings → Security → Change Password. You'll receive a
|
|
15
|
+
confirmation email within a few minutes.
|
|
16
|
+
</Text>
|
|
17
|
+
</Collapsible>
|
|
18
|
+
<Collapsible trigger="Can I change my username?" value="username">
|
|
19
|
+
<Text type="body">
|
|
20
|
+
Usernames can be changed once every 30 days from your profile
|
|
21
|
+
settings.
|
|
22
|
+
</Text>
|
|
23
|
+
</Collapsible>
|
|
24
|
+
<Collapsible trigger="How do I delete my account?" value="delete">
|
|
25
|
+
<Text type="body">
|
|
26
|
+
Account deletion is permanent. Your data will be removed within 30
|
|
27
|
+
days.
|
|
28
|
+
</Text>
|
|
29
|
+
</Collapsible>
|
|
30
|
+
</CollapsibleGroup>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -3,66 +3,45 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
5
|
import {useMemo} from 'react';
|
|
6
|
-
import {
|
|
7
|
-
CommandPalette,
|
|
8
|
-
CommandPaletteList,
|
|
9
|
-
CommandPaletteGroup,
|
|
10
|
-
CommandPaletteItem,
|
|
11
|
-
} from '@astryxdesign/core/CommandPalette';
|
|
6
|
+
import {CommandPalette} from '@astryxdesign/core/CommandPalette';
|
|
12
7
|
import {createStaticSource} from '@astryxdesign/core/Typeahead';
|
|
13
|
-
import {Stack} from '@astryxdesign/core/Layout';
|
|
14
|
-
import {Text} from '@astryxdesign/core/Text';
|
|
15
8
|
|
|
16
9
|
export default function CommandPaletteGroupShowcase() {
|
|
17
10
|
const source = useMemo(
|
|
18
11
|
() =>
|
|
19
12
|
createStaticSource([
|
|
20
|
-
{
|
|
13
|
+
{
|
|
14
|
+
id: 'index',
|
|
15
|
+
label: 'index.tsx',
|
|
16
|
+
auxiliaryData: {group: 'Recent Files'},
|
|
17
|
+
},
|
|
21
18
|
{id: 'app', label: 'App.tsx', auxiliaryData: {group: 'Recent Files'}},
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
{
|
|
20
|
+
id: 'settings',
|
|
21
|
+
label: 'Open Settings',
|
|
22
|
+
auxiliaryData: {group: 'Commands'},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'terminal',
|
|
26
|
+
label: 'Toggle Terminal',
|
|
27
|
+
auxiliaryData: {group: 'Commands'},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'theme',
|
|
31
|
+
label: 'Color Theme',
|
|
32
|
+
auxiliaryData: {group: 'Preferences'},
|
|
33
|
+
},
|
|
25
34
|
{id: 'font', label: 'Font Size', auxiliaryData: {group: 'Preferences'}},
|
|
26
35
|
]),
|
|
27
36
|
[],
|
|
28
37
|
);
|
|
29
38
|
|
|
30
39
|
return (
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
isOpen
|
|
38
|
-
isInline
|
|
39
|
-
onOpenChange={() => {}}
|
|
40
|
-
searchSource={source}
|
|
41
|
-
/>
|
|
42
|
-
</Stack>
|
|
43
|
-
<Stack direction="vertical" gap={1}>
|
|
44
|
-
<Text type="supporting" color="secondary">
|
|
45
|
-
Composed form (CommandPaletteGroup + CommandPaletteItem)
|
|
46
|
-
</Text>
|
|
47
|
-
<CommandPaletteList>
|
|
48
|
-
<CommandPaletteGroup heading="Navigation">
|
|
49
|
-
<CommandPaletteItem value="home" onSelect={() => {}}>
|
|
50
|
-
Home
|
|
51
|
-
</CommandPaletteItem>
|
|
52
|
-
<CommandPaletteItem value="dashboard" onSelect={() => {}}>
|
|
53
|
-
Dashboard
|
|
54
|
-
</CommandPaletteItem>
|
|
55
|
-
</CommandPaletteGroup>
|
|
56
|
-
<CommandPaletteGroup heading="Actions">
|
|
57
|
-
<CommandPaletteItem value="new-file" onSelect={() => {}}>
|
|
58
|
-
New File
|
|
59
|
-
</CommandPaletteItem>
|
|
60
|
-
<CommandPaletteItem value="save" onSelect={() => {}}>
|
|
61
|
-
Save All
|
|
62
|
-
</CommandPaletteItem>
|
|
63
|
-
</CommandPaletteGroup>
|
|
64
|
-
</CommandPaletteList>
|
|
65
|
-
</Stack>
|
|
66
|
-
</Stack>
|
|
40
|
+
<CommandPalette
|
|
41
|
+
isOpen
|
|
42
|
+
isInline
|
|
43
|
+
onOpenChange={() => {}}
|
|
44
|
+
searchSource={source}
|
|
45
|
+
/>
|
|
67
46
|
);
|
|
68
47
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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: 'CommandPaletteInput',
|
|
7
|
+
name: 'CommandPaletteInput — With End Content',
|
|
8
|
+
displayName: 'CommandPaletteInput — With End Content',
|
|
9
|
+
description:
|
|
10
|
+
'Custom placeholder and a keyboard shortcut badge in the trailing slot via endContent.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
isShowcase: false,
|
|
13
|
+
aspectRatio: 4 / 3,
|
|
14
|
+
componentsUsed: ['CommandPalette', 'CommandPaletteInput', 'Kbd'],
|
|
15
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useMemo} from 'react';
|
|
6
|
+
import {
|
|
7
|
+
CommandPalette,
|
|
8
|
+
CommandPaletteInput,
|
|
9
|
+
} from '@astryxdesign/core/CommandPalette';
|
|
10
|
+
import {Kbd} from '@astryxdesign/core/Kbd';
|
|
11
|
+
import {createStaticSource} from '@astryxdesign/core/Typeahead';
|
|
12
|
+
|
|
13
|
+
export default function CommandPaletteInputBasic() {
|
|
14
|
+
const source = useMemo(
|
|
15
|
+
() =>
|
|
16
|
+
createStaticSource([
|
|
17
|
+
{id: 'home', label: 'Home'},
|
|
18
|
+
{id: 'settings', label: 'Settings'},
|
|
19
|
+
{id: 'profile', label: 'Profile'},
|
|
20
|
+
{id: 'help', label: 'Help'},
|
|
21
|
+
]),
|
|
22
|
+
[],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<CommandPalette
|
|
27
|
+
isOpen
|
|
28
|
+
isInline
|
|
29
|
+
onOpenChange={() => {}}
|
|
30
|
+
searchSource={source}
|
|
31
|
+
input={
|
|
32
|
+
<CommandPaletteInput
|
|
33
|
+
placeholder="Search commands, files, or actions..."
|
|
34
|
+
endContent={<Kbd keys="mod+k" />}
|
|
35
|
+
/>
|
|
36
|
+
}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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: 'CommandPaletteInput',
|
|
7
|
+
name: 'CommandPaletteInput',
|
|
8
|
+
displayName: 'Command Palette Input',
|
|
9
|
+
description:
|
|
10
|
+
'Command palette search input with a custom placeholder and a keyboard shortcut hint in the endContent slot.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
isShowcase: true,
|
|
13
|
+
aspectRatio: 4 / 3,
|
|
14
|
+
componentsUsed: ['CommandPalette', 'CommandPaletteInput', 'Kbd'],
|
|
15
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {useMemo} from 'react';
|
|
6
|
+
import {
|
|
7
|
+
CommandPalette,
|
|
8
|
+
CommandPaletteInput,
|
|
9
|
+
} from '@astryxdesign/core/CommandPalette';
|
|
10
|
+
import {Kbd} from '@astryxdesign/core/Kbd';
|
|
11
|
+
import {createStaticSource} from '@astryxdesign/core/Typeahead';
|
|
12
|
+
|
|
13
|
+
export default function CommandPaletteInputShowcase() {
|
|
14
|
+
const source = useMemo(
|
|
15
|
+
() =>
|
|
16
|
+
createStaticSource([
|
|
17
|
+
{id: 'home', label: 'Home'},
|
|
18
|
+
{id: 'settings', label: 'Settings'},
|
|
19
|
+
{id: 'profile', label: 'Profile'},
|
|
20
|
+
{id: 'help', label: 'Help'},
|
|
21
|
+
]),
|
|
22
|
+
[],
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<CommandPalette
|
|
27
|
+
isOpen
|
|
28
|
+
isInline
|
|
29
|
+
onOpenChange={() => {}}
|
|
30
|
+
searchSource={source}
|
|
31
|
+
input={
|
|
32
|
+
<CommandPaletteInput
|
|
33
|
+
placeholder="Search commands, files, or actions..."
|
|
34
|
+
endContent={<Kbd keys="mod+k" />}
|
|
35
|
+
/>
|
|
36
|
+
}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -3,16 +3,10 @@
|
|
|
3
3
|
'use client';
|
|
4
4
|
|
|
5
5
|
import {useMemo, type CSSProperties} from 'react';
|
|
6
|
-
import {
|
|
7
|
-
CommandPalette,
|
|
8
|
-
CommandPaletteList,
|
|
9
|
-
CommandPaletteItem,
|
|
10
|
-
} from '@astryxdesign/core/CommandPalette';
|
|
6
|
+
import {CommandPalette} from '@astryxdesign/core/CommandPalette';
|
|
11
7
|
import {Text} from '@astryxdesign/core/Text';
|
|
12
8
|
import {Kbd} from '@astryxdesign/core/Kbd';
|
|
13
|
-
import {Icon} from '@astryxdesign/core/Icon';
|
|
14
9
|
import {createStaticSource} from '@astryxdesign/core/Typeahead';
|
|
15
|
-
import {Stack} from '@astryxdesign/core/Layout';
|
|
16
10
|
import type {SearchableItem} from '@astryxdesign/core/Typeahead';
|
|
17
11
|
|
|
18
12
|
const itemLabel: CSSProperties = {
|
|
@@ -23,9 +17,21 @@ type CommandItem = SearchableItem<{shortcut?: string}>;
|
|
|
23
17
|
|
|
24
18
|
const commands: CommandItem[] = [
|
|
25
19
|
{id: 'save', label: 'Save File', auxiliaryData: {shortcut: 'mod+s'}},
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
{
|
|
21
|
+
id: 'find',
|
|
22
|
+
label: 'Find in Files',
|
|
23
|
+
auxiliaryData: {shortcut: 'mod+shift+f'},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: 'palette',
|
|
27
|
+
label: 'Command Palette',
|
|
28
|
+
auxiliaryData: {shortcut: 'mod+shift+p'},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: 'terminal',
|
|
32
|
+
label: 'Toggle Terminal',
|
|
33
|
+
auxiliaryData: {shortcut: 'ctrl+`'},
|
|
34
|
+
},
|
|
29
35
|
{id: 'sidebar', label: 'Toggle Sidebar', auxiliaryData: {shortcut: 'mod+b'}},
|
|
30
36
|
];
|
|
31
37
|
|
|
@@ -33,50 +39,21 @@ export default function CommandPaletteItemShowcase() {
|
|
|
33
39
|
const source = useMemo(() => createStaticSource(commands), []);
|
|
34
40
|
|
|
35
41
|
return (
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<Text type="body" style={itemLabel}>
|
|
49
|
-
{item.label}
|
|
50
|
-
</Text>
|
|
51
|
-
{item.auxiliaryData?.shortcut && (
|
|
52
|
-
<Kbd keys={item.auxiliaryData.shortcut} />
|
|
53
|
-
)}
|
|
54
|
-
</>
|
|
42
|
+
<CommandPalette
|
|
43
|
+
isOpen
|
|
44
|
+
isInline
|
|
45
|
+
onOpenChange={() => {}}
|
|
46
|
+
searchSource={source}
|
|
47
|
+
renderItem={(item: CommandItem) => (
|
|
48
|
+
<>
|
|
49
|
+
<Text type="body" style={itemLabel}>
|
|
50
|
+
{item.label}
|
|
51
|
+
</Text>
|
|
52
|
+
{item.auxiliaryData?.shortcut && (
|
|
53
|
+
<Kbd keys={item.auxiliaryData.shortcut} />
|
|
55
54
|
)}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
<Text type="supporting" color="secondary">
|
|
60
|
-
Composed items with icons and states
|
|
61
|
-
</Text>
|
|
62
|
-
<CommandPaletteList>
|
|
63
|
-
<CommandPaletteItem value="home" onSelect={() => {}}>
|
|
64
|
-
<Icon icon="externalLink" size="sm" />
|
|
65
|
-
<Text type="body" style={itemLabel}>Home</Text>
|
|
66
|
-
</CommandPaletteItem>
|
|
67
|
-
<CommandPaletteItem value="search" isHighlighted onSelect={() => {}}>
|
|
68
|
-
<Icon icon="search" size="sm" />
|
|
69
|
-
<Text type="body" style={itemLabel}>Search (highlighted)</Text>
|
|
70
|
-
</CommandPaletteItem>
|
|
71
|
-
<CommandPaletteItem value="selected" isSelected onSelect={() => {}}>
|
|
72
|
-
<Icon icon="check" size="sm" />
|
|
73
|
-
<Text type="body" style={itemLabel}>Selected item</Text>
|
|
74
|
-
</CommandPaletteItem>
|
|
75
|
-
<CommandPaletteItem value="disabled" isDisabled>
|
|
76
|
-
<Text type="body" style={itemLabel}>Disabled item</Text>
|
|
77
|
-
</CommandPaletteItem>
|
|
78
|
-
</CommandPaletteList>
|
|
79
|
-
</Stack>
|
|
80
|
-
</Stack>
|
|
55
|
+
</>
|
|
56
|
+
)}
|
|
57
|
+
/>
|
|
81
58
|
);
|
|
82
59
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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: 'CommandPaletteList',
|
|
7
|
+
name: 'CommandPaletteList — Item States',
|
|
8
|
+
displayName: 'CommandPaletteList — Item States',
|
|
9
|
+
description:
|
|
10
|
+
'Flat list showing the highlighted, selected, and disabled item states. Use CommandPaletteGroup to add section headings.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
isShowcase: false,
|
|
13
|
+
aspectRatio: 4 / 3,
|
|
14
|
+
componentsUsed: ['CommandPaletteList', 'CommandPaletteItem'],
|
|
15
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
CommandPaletteList,
|
|
7
|
+
CommandPaletteItem,
|
|
8
|
+
} from '@astryxdesign/core/CommandPalette';
|
|
9
|
+
|
|
10
|
+
export default function CommandPaletteListBasic() {
|
|
11
|
+
return (
|
|
12
|
+
<CommandPaletteList>
|
|
13
|
+
<CommandPaletteItem value="home" onSelect={() => {}}>
|
|
14
|
+
Go Home
|
|
15
|
+
</CommandPaletteItem>
|
|
16
|
+
<CommandPaletteItem value="settings" isHighlighted onSelect={() => {}}>
|
|
17
|
+
Open Settings
|
|
18
|
+
</CommandPaletteItem>
|
|
19
|
+
<CommandPaletteItem value="profile" isSelected onSelect={() => {}}>
|
|
20
|
+
View Profile
|
|
21
|
+
</CommandPaletteItem>
|
|
22
|
+
<CommandPaletteItem value="help" isDisabled onSelect={() => {}}>
|
|
23
|
+
Help (unavailable)
|
|
24
|
+
</CommandPaletteItem>
|
|
25
|
+
</CommandPaletteList>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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: 'CommandPaletteList',
|
|
7
|
+
name: 'CommandPaletteList',
|
|
8
|
+
displayName: 'Command Palette List',
|
|
9
|
+
description:
|
|
10
|
+
'Scrollable command palette list with grouped items, including a highlighted item, composed without a full CommandPalette.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
isShowcase: true,
|
|
13
|
+
aspectRatio: 4 / 3,
|
|
14
|
+
componentsUsed: ['CommandPaletteList', 'CommandPaletteGroup', 'CommandPaletteItem'],
|
|
15
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
CommandPaletteList,
|
|
7
|
+
CommandPaletteGroup,
|
|
8
|
+
CommandPaletteItem,
|
|
9
|
+
} from '@astryxdesign/core/CommandPalette';
|
|
10
|
+
|
|
11
|
+
export default function CommandPaletteListShowcase() {
|
|
12
|
+
return (
|
|
13
|
+
<CommandPaletteList>
|
|
14
|
+
<CommandPaletteGroup heading="Navigation">
|
|
15
|
+
<CommandPaletteItem value="home" onSelect={() => {}}>
|
|
16
|
+
Go Home
|
|
17
|
+
</CommandPaletteItem>
|
|
18
|
+
<CommandPaletteItem value="settings" onSelect={() => {}}>
|
|
19
|
+
Open Settings
|
|
20
|
+
</CommandPaletteItem>
|
|
21
|
+
<CommandPaletteItem value="profile" onSelect={() => {}}>
|
|
22
|
+
View Profile
|
|
23
|
+
</CommandPaletteItem>
|
|
24
|
+
</CommandPaletteGroup>
|
|
25
|
+
<CommandPaletteGroup heading="Actions">
|
|
26
|
+
<CommandPaletteItem value="new-file" onSelect={() => {}}>
|
|
27
|
+
New File
|
|
28
|
+
</CommandPaletteItem>
|
|
29
|
+
<CommandPaletteItem value="search" isHighlighted onSelect={() => {}}>
|
|
30
|
+
Search Files
|
|
31
|
+
</CommandPaletteItem>
|
|
32
|
+
<CommandPaletteItem value="save" onSelect={() => {}}>
|
|
33
|
+
Save All
|
|
34
|
+
</CommandPaletteItem>
|
|
35
|
+
</CommandPaletteGroup>
|
|
36
|
+
</CommandPaletteList>
|
|
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: 'ContextMenuItem',
|
|
7
|
+
name: 'ContextMenuItem — Basic',
|
|
8
|
+
displayName: 'ContextMenuItem — Basic',
|
|
9
|
+
description:
|
|
10
|
+
'Context menu items with labels and secondary descriptions. Use ContextMenuItem to render custom menu entries with consistent styling.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
aspectRatio: 16 / 9,
|
|
13
|
+
componentsUsed: ['ContextMenu', 'ContextMenuItem'],
|
|
14
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
import {ContextMenu, ContextMenuItem} from '@astryxdesign/core/ContextMenu';
|
|
6
|
+
|
|
7
|
+
export default function ContextMenuItemBasic() {
|
|
8
|
+
return (
|
|
9
|
+
<ContextMenu
|
|
10
|
+
menuContent={
|
|
11
|
+
<>
|
|
12
|
+
<ContextMenuItem
|
|
13
|
+
label="Edit"
|
|
14
|
+
description="Modify this item"
|
|
15
|
+
onClick={() => {}}
|
|
16
|
+
/>
|
|
17
|
+
<ContextMenuItem
|
|
18
|
+
label="Duplicate"
|
|
19
|
+
description="Create a copy"
|
|
20
|
+
onClick={() => {}}
|
|
21
|
+
/>
|
|
22
|
+
<ContextMenuItem
|
|
23
|
+
label="Delete"
|
|
24
|
+
description="This action cannot be undone"
|
|
25
|
+
onClick={() => {}}
|
|
26
|
+
/>
|
|
27
|
+
</>
|
|
28
|
+
}>
|
|
29
|
+
<div
|
|
30
|
+
style={{
|
|
31
|
+
padding: '48px',
|
|
32
|
+
borderWidth: '2px',
|
|
33
|
+
borderStyle: 'dashed',
|
|
34
|
+
borderColor: 'var(--color-border)',
|
|
35
|
+
borderRadius: '8px',
|
|
36
|
+
textAlign: 'center',
|
|
37
|
+
color: 'var(--color-text-secondary)',
|
|
38
|
+
userSelect: 'none',
|
|
39
|
+
}}>
|
|
40
|
+
Right-click this area
|
|
41
|
+
</div>
|
|
42
|
+
</ContextMenu>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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: 'ContextMenuItem',
|
|
7
|
+
name: 'ContextMenuItem',
|
|
8
|
+
displayName: 'Context Menu Item',
|
|
9
|
+
description:
|
|
10
|
+
'Context menu with custom-rendered items using ContextMenuItem for icons and descriptions.',
|
|
11
|
+
isReady: true,
|
|
12
|
+
isShowcase: true,
|
|
13
|
+
aspectRatio: 16 / 9,
|
|
14
|
+
componentsUsed: ['ContextMenu', 'ContextMenuItem'],
|
|
15
|
+
};
|