@astryxdesign/cli 0.1.4-canary.2b3ac0f → 0.1.4-canary.2e11603

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +1 -2
  2. package/package.json +9 -14
  3. package/src/api/doctor.mjs +2 -13
  4. package/src/codemods/__tests__/runner.test.mjs +0 -38
  5. package/src/codemods/runner.mjs +0 -2
  6. package/src/commands/build-theme.mjs +13 -110
  7. package/src/commands/doctor.test.mjs +0 -34
  8. package/templates/blocks/components/CodeBlock/CodeBlockTerminal.doc.mjs +1 -1
  9. package/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupShowcase.tsx +48 -27
  10. package/templates/blocks/components/CommandPaletteItem/CommandPaletteItemShowcase.tsx +54 -31
  11. package/templates/pages/table-page-chart/page.tsx +13 -3
  12. package/templates/pages/table-page-shoe-store-heatmap/page.tsx +18 -4
  13. package/src/commands/build-theme.variants.test.mjs +0 -204
  14. package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.doc.mjs +0 -13
  15. package/templates/blocks/components/Collapsible/CollapsibleDividedAccordion.tsx +0 -33
  16. package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.doc.mjs +0 -15
  17. package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputBasic.tsx +0 -39
  18. package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.doc.mjs +0 -15
  19. package/templates/blocks/components/CommandPaletteInput/CommandPaletteInputShowcase.tsx +0 -39
  20. package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.doc.mjs +0 -15
  21. package/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +0 -27
  22. package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.doc.mjs +0 -15
  23. package/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +0 -38
  24. package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.doc.mjs +0 -14
  25. package/templates/blocks/components/ContextMenuItem/ContextMenuItemBasic.tsx +0 -44
  26. package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.doc.mjs +0 -15
  27. package/templates/blocks/components/ContextMenuItem/ContextMenuItemShowcase.tsx +0 -107
  28. package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.doc.mjs +0 -15
  29. package/templates/blocks/components/NavHeadingMenu/NavHeadingMenuShowcase.tsx +0 -47
package/CHANGELOG.md CHANGED
@@ -36,7 +36,7 @@ Thanks to everyone who contributed to this release:
36
36
  - Strict config + integration v1 schema (integrations, issuesUrl, hooks.postCodemod) and new @astryxdesign/cli/integration export.
37
37
  - File-based codemod API (createCodemod/createConfigCodemod) with the @astryxdesign/cli/codemod export and integration codemod discovery in upgrade.
38
38
  - component, template, and upgrade now print a one-line non-blocking warning when a configured integration has validation issues, pointing to validate-integration.
39
- - Add a Kanban Board page template: color-coded status columns, draggable task cards with priority tags, and board toolbar. Based on a design by @cg-hub18.
39
+ - Add a Kanban Board page template: color-coded status columns, draggable task cards with priority tags, and board toolbar.
40
40
  - Add frame-first layout guidance: new `astryx docs layout` topic (shell choice, region budgets, app archetypes, cards-vs-rows policy, responsive contracts), layout rules in the generated agent cheat sheet, and layout anti-patterns in `docs principles`.
41
41
  - Add a v0.1.3 config codemod that migrates astryx.config layout.components to experimental.xle.components.
42
42
  - Add v0.1.0 codemods for migrating `declare module "@xds/core/..."` type augmentations and `.xds-*` / `[data-xds-theme]` / `@layer xds-theme` CSS surfaces to their `@astryxdesign`/`astryx-*` equivalents.
@@ -80,7 +80,6 @@ Thanks to everyone who contributed to this release:
80
80
  Thanks to everyone who contributed to this release:
81
81
 
82
82
  - @AKnassa
83
- - @cg-hub18
84
83
  - @ejhammond
85
84
  - @ernestt
86
85
  - @harshavardhan194
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.1.4-canary.2b3ac0f",
3
+ "version": "0.1.4-canary.2e11603",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -75,16 +75,12 @@
75
75
  "zod": "^4.4.3"
76
76
  },
77
77
  "peerDependencies": {
78
- "@astryxdesign/charts": "0.1.4-canary.2b3ac0f",
79
- "@astryxdesign/core": "0.1.4-canary.2b3ac0f",
80
- "@astryxdesign/lab": "0.1.4-canary.2b3ac0f",
81
- "@astryxdesign/theme-neutral": "0.1.4-canary.2b3ac0f",
82
- "gpt-tokenizer": "^3.4.0"
78
+ "@astryxdesign/core": "0.1.4-canary.2e11603",
79
+ "@astryxdesign/lab": "0.1.4-canary.2e11603",
80
+ "@astryxdesign/theme-neutral": "0.1.4-canary.2e11603",
81
+ "gpt-tokenizer": "^2.0.0"
83
82
  },
84
83
  "peerDependenciesMeta": {
85
- "@astryxdesign/charts": {
86
- "optional": true
87
- },
88
84
  "@astryxdesign/core": {
89
85
  "optional": true
90
86
  },
@@ -96,11 +92,10 @@
96
92
  }
97
93
  },
98
94
  "devDependencies": {
99
- "@astryxdesign/charts": "0.1.4-canary.2b3ac0f",
100
- "@astryxdesign/core": "0.1.4-canary.2b3ac0f",
101
- "@astryxdesign/lab": "0.1.4-canary.2b3ac0f",
102
- "@astryxdesign/theme-neutral": "0.1.4-canary.2b3ac0f",
103
- "gpt-tokenizer": "^3.4.0"
95
+ "@astryxdesign/core": "0.1.4-canary.2e11603",
96
+ "@astryxdesign/lab": "0.1.4-canary.2e11603",
97
+ "@astryxdesign/theme-neutral": "0.1.4-canary.2e11603",
98
+ "gpt-tokenizer": "^2.0.0"
104
99
  },
105
100
  "scripts": {
106
101
  "astryx": "node bin/astryx.mjs",
@@ -115,21 +115,10 @@ function findThemePackages(cwd) {
115
115
  return found;
116
116
  }
117
117
  for (const entry of entries) {
118
+ if (!entry.isDirectory()) continue;
118
119
  if (!entry.name.startsWith('theme-')) continue;
119
- const dir = path.join(scopeDir, entry.name);
120
- // pnpm installs packages as symlinks into node_modules/.pnpm, and a
121
- // symlink dirent reports isDirectory() as false — stat the target instead.
122
- let isDir = entry.isDirectory();
123
- if (!isDir && entry.isSymbolicLink()) {
124
- try {
125
- isDir = fs.statSync(dir).isDirectory();
126
- } catch {
127
- isDir = false;
128
- }
129
- }
130
- if (!isDir) continue;
131
120
  const name = `@astryxdesign/${entry.name}`;
132
- found.push({name, version: pkgVersion(dir)});
121
+ found.push({name, version: pkgVersion(path.join(scopeDir, entry.name))});
133
122
  }
134
123
  return found;
135
124
  }
@@ -99,43 +99,5 @@ describe('runCodemods — unified config codemod path', () => {
99
99
  expect(fs.readFileSync(path.join(srcDir, 'a.ts'), 'utf-8')).toContain(
100
100
  'const bar = 1',
101
101
  );
102
- // writtenFiles must be returned (consumed by upgrade.mjs to run the
103
- // post-codemod formatting/lint hooks). Regression guard: it was previously
104
- // built internally but omitted from the return object, so hooks received an
105
- // empty file list and silently skipped, leaving codemod output unformatted.
106
- expect(result.writtenFiles).toEqual([path.join(srcDir, 'a.ts')]);
107
- });
108
-
109
- it('returns writtenFiles for every changed file (post-codemod hook input)', async () => {
110
- const srcDir = path.join(tmpDir, 'src');
111
- fs.mkdirSync(srcDir);
112
- fs.writeFileSync(path.join(srcDir, 'a.ts'), 'const foo = 1;\n');
113
- fs.writeFileSync(path.join(srcDir, 'b.ts'), 'const foo = 2;\n');
114
- fs.writeFileSync(path.join(srcDir, 'c.ts'), 'const untouched = 3;\n');
115
-
116
- const versionManifests = [
117
- {
118
- version: '0.1.3',
119
- transforms: [
120
- {
121
- name: 'synthetic-code-codemod',
122
- meta: {title: 'Synthetic code codemod'},
123
- transform: file => file.source.replace(/foo/g, 'bar'),
124
- },
125
- ],
126
- },
127
- ];
128
-
129
- const result = await runCodemods(versionManifests, {
130
- apply: true,
131
- path: './src',
132
- silent: true,
133
- });
134
-
135
- expect(result.totalFilesChanged).toBe(2);
136
- // Only the two files that actually changed are reported (not c.ts).
137
- expect([...result.writtenFiles].sort()).toEqual(
138
- [path.join(srcDir, 'a.ts'), path.join(srcDir, 'b.ts')].sort(),
139
- );
140
102
  });
141
103
  });
@@ -178,7 +178,6 @@ function toUnifiedEntry(transformEntry, version) {
178
178
  * @param {string|undefined} options.codemod - Run only this specific transform
179
179
  * @param {Set<string>} [options.skipCodemods] - Transform names to exclude
180
180
  * @param {boolean} [options.silent] - Suppress all human-facing output (for --json)
181
- * @returns {{totalFilesChanged: number, totalTransformsApplied: number, totalValidationBlocked: number, writtenFiles: string[], errors: Array, skippedOptional: Array}}
182
181
  */
183
182
  export async function runCodemods(
184
183
  versionManifests,
@@ -406,7 +405,6 @@ export async function runCodemods(
406
405
  totalFilesChanged,
407
406
  totalTransformsApplied,
408
407
  totalValidationBlocked,
409
- writtenFiles,
410
408
  errors,
411
409
  skippedOptional,
412
410
  };
@@ -175,85 +175,14 @@ async function getKnownValues(componentName) {
175
175
  return _knownValuesCache.get(componentName);
176
176
  }
177
177
 
178
- /**
179
- * Resolve `@astryxdesign/core`'s package root relative to the CLI package. Core
180
- * and the CLI ship as siblings (`@astryxdesign/core`, `@astryxdesign/cli`), so
181
- * `../../../core` from `src/commands/` reaches core whether installed from npm
182
- * or run inside the monorepo. Returns null if it can't be found.
183
- */
184
- function resolveCoreRoot() {
185
- const cliDir = path.dirname(fileURLToPath(import.meta.url));
186
- const coreRoot = path.resolve(cliDir, '../../../core');
187
- return fs.existsSync(coreRoot) ? coreRoot : null;
188
- }
189
-
190
- /**
191
- * Read the type declarations `@astryxdesign/core/<Component>` exposes so we can
192
- * check whether a given augmentation-target interface actually exists before
193
- * generating a module augmentation against it.
194
- *
195
- * Reads the shipped `dist/<Component>/index.d.ts` (what a consumer's TypeScript
196
- * actually sees), falling back to the `src/<Component>/index.ts` in the
197
- * monorepo. Returns the file contents, or '' if nothing is found.
198
- */
199
- const _componentDeclCache = new Map();
200
- function readComponentDeclarations(pascalName) {
201
- if (_componentDeclCache.has(pascalName)) {
202
- return _componentDeclCache.get(pascalName);
203
- }
204
- let contents = '';
205
- const coreRoot = resolveCoreRoot();
206
- if (coreRoot) {
207
- const candidates = [
208
- path.join(coreRoot, 'dist', pascalName, 'index.d.ts'),
209
- path.join(coreRoot, 'src', pascalName, 'index.ts'),
210
- ];
211
- for (const file of candidates) {
212
- try {
213
- if (fs.existsSync(file)) {
214
- contents = fs.readFileSync(file, 'utf-8');
215
- break;
216
- }
217
- } catch {
218
- // ignore and try the next candidate
219
- }
220
- }
221
- }
222
- _componentDeclCache.set(pascalName, contents);
223
- return contents;
224
- }
225
-
226
- /**
227
- * Determine whether `@astryxdesign/core/<Component>` exports an interface named
228
- * `interfaceName` that can be augmented via module augmentation.
229
- *
230
- * Only interfaces are extension points — closed literal-union types (e.g.
231
- * `HeadingType`, `ButtonSize`) are NOT augmentable, so a generated augmentation
232
- * against them is dead code. We check that the name is exported (directly or
233
- * re-exported) as a type/interface.
234
- */
235
- function componentHasAugmentableInterface(pascalName, interfaceName) {
236
- const decl = readComponentDeclarations(pascalName);
237
- if (!decl) return false;
238
- // Word-boundary match so `ButtonVariantMap` doesn't match `XButtonVariantMap`.
239
- const re = new RegExp(`\\b${interfaceName}\\b`);
240
- return re.test(decl);
241
- }
242
-
243
178
  /**
244
179
  * Generate TypeScript declaration content with module augmentation for custom
245
180
  * component prop values found in the theme's `components` keys. Reads known
246
181
  * values from doc files to filter out base prop values.
247
182
  *
248
- * Interface naming convention: PascalCase(component) + PascalCase(prop) + Map
249
- * banner + status → BannerStatusMap
250
- * button + variant → ButtonVariantMap
251
- *
252
- * An augmentation is only emitted when `@astryxdesign/core/<Component>` actually
253
- * exports a matching interface. Props backed by closed literal-union types
254
- * (e.g. Button `size`, Heading `type`/`level`) have no augmentation point, so
255
- * generating a `declare module` block for them would be dead code — those are
256
- * skipped.
183
+ * Interface naming convention: Astryx + PascalCase(component) + PascalCase(prop) + Map
184
+ * banner + status → XDSBannerStatusMap
185
+ * button + variant → XDSButtonVariantMap
257
186
  *
258
187
  * @param {object} themeDef - Theme definition (resolved by defineTheme)
259
188
  * @returns {Promise<string|null>} TypeScript declaration content, or null if no augmentations needed
@@ -305,14 +234,7 @@ async function generateVariantDeclarationsAsync(themeDef) {
305
234
  const pascal = toPascalCase(component);
306
235
  const propPascal = prop.charAt(0).toUpperCase() + prop.slice(1);
307
236
  const modulePath = `@astryxdesign/core/${pascal}`;
308
- const interfaceName = `${pascal}${propPascal}Map`;
309
-
310
- // Only augment interfaces that actually exist as an extension point in
311
- // core. Props backed by closed literal-union types (e.g. Button `size`,
312
- // Heading `type`/`level`) have no `*Map` interface — a `declare module`
313
- // block against a non-existent interface just creates a new, unused
314
- // interface and never extends the component's prop union, so skip it.
315
- if (!componentHasAugmentableInterface(pascal, interfaceName)) continue;
237
+ const interfaceName = `XDS${pascal}${propPascal}Map`;
316
238
 
317
239
  sections.push(`declare module '${modulePath}' {`);
318
240
  sections.push(` interface ${interfaceName} {`);
@@ -325,13 +247,6 @@ async function generateVariantDeclarationsAsync(themeDef) {
325
247
  }
326
248
  }
327
249
 
328
- // If every custom value targeted a non-augmentable prop, there's nothing to
329
- // emit beyond the header — return null so no `.variants.d.ts` is written.
330
- const hasEmittedAugmentation = sections.some(line =>
331
- line.startsWith('declare module'),
332
- );
333
- if (!hasEmittedAugmentation) return null;
334
-
335
250
  return sections.join('\n');
336
251
  }
337
252
 
@@ -518,21 +433,13 @@ ${iconReExport}`;
518
433
  /**
519
434
  * Generate TypeScript declarations for a built theme module.
520
435
  */
521
- function generateBuiltTypes(themeDef, iconInfo, variantsFileName) {
436
+ function generateBuiltTypes(themeDef, iconInfo) {
522
437
  const iconType = iconInfo
523
438
  ? `import type { IconRegistry } from '@astryxdesign/core/Icon';
524
439
  export declare const ${iconInfo.exportName}: IconRegistry;
525
440
  `
526
441
  : '';
527
- // Pull in the generated custom-variant augmentations so that importing the
528
- // theme's types also loads the module augmentations (otherwise the
529
- // `.variants.d.ts` is emitted but never referenced, and the custom variants
530
- // never widen the component prop unions for consumers).
531
- const variantsRef = variantsFileName
532
- ? `/// <reference path="./${variantsFileName}" />
533
- `
534
- : '';
535
- return `${variantsRef}import type { DefinedTheme } from '@astryxdesign/core/theme';
442
+ return `import type { DefinedTheme } from '@astryxdesign/core/theme';
536
443
  ${iconType}export declare const ${toIdentifier(themeDef.name)}Theme: DefinedTheme;
537
444
  `;
538
445
  }
@@ -987,23 +894,19 @@ export function registerTheme(program) {
987
894
 
988
895
  const iconInfo = extractIconInfo(filePath);
989
896
 
990
- // Type augmentation .d.ts if theme has custom prop values. Computed
991
- // before the main .d.ts so the latter can reference it (see below).
897
+ // Generate all file contents in memory first.
898
+ const cssContent = generatedHeader(sourceRelative, 'css', buildCommand) + css;
899
+ const jsContent = generatedHeader(sourceRelative, 'js', buildCommand) + generateBuiltModule(resolvedTheme || themeDef, iconInfo);
900
+ const dtsContent = generatedHeader(sourceRelative, 'ts', buildCommand) + generateBuiltTypes(themeDef, iconInfo);
901
+
902
+ // Type augmentation .d.ts if theme has custom prop values
992
903
  const augmentationSource = resolvedTheme || themeDef;
993
904
  const variantDecl = await generateVariantDeclarationsAsync(augmentationSource);
994
- const variantsFileName = variantDecl ? `${baseName}.variants.d.ts` : null;
995
- const variantDtsPath = variantDecl ? path.join(outDir, variantsFileName) : null;
905
+ const variantDtsPath = variantDecl ? path.join(outDir, `${baseName}.variants.d.ts`) : null;
996
906
  const variantContent = variantDecl
997
907
  ? generatedHeader(sourceRelative, 'ts', buildCommand) + variantDecl
998
908
  : null;
999
909
 
1000
- // Generate all file contents in memory first. The main .d.ts references
1001
- // the variants file (when present) via a triple-slash directive so
1002
- // importing the theme also loads the custom-variant augmentations.
1003
- const cssContent = generatedHeader(sourceRelative, 'css', buildCommand) + css;
1004
- const jsContent = generatedHeader(sourceRelative, 'js', buildCommand) + generateBuiltModule(resolvedTheme || themeDef, iconInfo);
1005
- const dtsContent = generatedHeader(sourceRelative, 'ts', buildCommand) + generateBuiltTypes(themeDef, iconInfo, variantsFileName);
1006
-
1007
910
  // Atomic-ish write: stage every file as `<dest>.tmp`, then rename
1008
911
  // each into place. If any stage step fails we clean up partials and
1009
912
  // exit; if a rename fails mid-way we still have the originals (or
@@ -63,33 +63,6 @@ function installPkg(name, version = '1.0.0') {
63
63
  return dir;
64
64
  }
65
65
 
66
- /**
67
- * Mirror pnpm's layout: the real package lives under node_modules/.pnpm and
68
- * the entry in the scope directory is a symlink to it.
69
- */
70
- function installPkgPnpmStyle(name, version = '1.0.0') {
71
- const realDir = path.join(
72
- tmpDir,
73
- 'node_modules',
74
- '.pnpm',
75
- `${name.replace('/', '+')}@${version}`,
76
- 'node_modules',
77
- ...name.split('/'),
78
- );
79
- fs.mkdirSync(realDir, {recursive: true});
80
- fs.writeFileSync(
81
- path.join(realDir, 'package.json'),
82
- JSON.stringify({name, version, main: 'index.js'}),
83
- );
84
- fs.writeFileSync(path.join(realDir, 'index.js'), 'module.exports = {};');
85
- const linkPath = path.join(tmpDir, 'node_modules', ...name.split('/'));
86
- fs.mkdirSync(path.dirname(linkPath), {recursive: true});
87
- // 'junction' keeps this working on Windows without elevated permissions;
88
- // it is ignored on posix.
89
- fs.symlinkSync(realDir, linkPath, 'junction');
90
- return linkPath;
91
- }
92
-
93
66
  function find(checks, id) {
94
67
  return checks.find(c => c.id === id);
95
68
  }
@@ -146,13 +119,6 @@ describe('doctor — individual checks', () => {
146
119
  expect(res.status).toBe('pass');
147
120
  });
148
121
 
149
- it('themes: detects pnpm-style symlinked theme packages (#3530)', () => {
150
- installPkgPnpmStyle('@astryxdesign/theme-neutral', '0.1.2');
151
- const res = checkThemes({cwd: tmpDir, configTheme: 'default'});
152
- expect(res.status).toBe('pass');
153
- expect(res.message).toContain('@astryxdesign/theme-neutral');
154
- });
155
-
156
122
  it('config: INFO when no astryx.config.mjs', async () => {
157
123
  const res = await checkConfig({cwd: tmpDir, configPath: null});
158
124
  expect(res.status).toBe('info');
@@ -7,7 +7,7 @@ export const doc = {
7
7
  name: 'Code — Terminal',
8
8
  displayName: 'Code — Terminal',
9
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.',
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
11
  isReady: true,
12
12
  aspectRatio: 16 / 9,
13
13
  componentsUsed: ['CodeBlock', 'SyntaxTheme'],
@@ -3,45 +3,66 @@
3
3
  'use client';
4
4
 
5
5
  import {useMemo} from 'react';
6
- import {CommandPalette} from '@astryxdesign/core/CommandPalette';
6
+ import {
7
+ CommandPalette,
8
+ CommandPaletteList,
9
+ CommandPaletteGroup,
10
+ CommandPaletteItem,
11
+ } from '@astryxdesign/core/CommandPalette';
7
12
  import {createStaticSource} from '@astryxdesign/core/Typeahead';
13
+ import {Stack} from '@astryxdesign/core/Layout';
14
+ import {Text} from '@astryxdesign/core/Text';
8
15
 
9
16
  export default function CommandPaletteGroupShowcase() {
10
17
  const source = useMemo(
11
18
  () =>
12
19
  createStaticSource([
13
- {
14
- id: 'index',
15
- label: 'index.tsx',
16
- auxiliaryData: {group: 'Recent Files'},
17
- },
20
+ {id: 'index', label: 'index.tsx', auxiliaryData: {group: 'Recent Files'}},
18
21
  {id: 'app', label: 'App.tsx', auxiliaryData: {group: 'Recent Files'}},
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
- },
22
+ {id: 'settings', label: 'Open Settings', auxiliaryData: {group: 'Commands'}},
23
+ {id: 'terminal', label: 'Toggle Terminal', auxiliaryData: {group: 'Commands'}},
24
+ {id: 'theme', label: 'Color Theme', auxiliaryData: {group: 'Preferences'}},
34
25
  {id: 'font', label: 'Font Size', auxiliaryData: {group: 'Preferences'}},
35
26
  ]),
36
27
  [],
37
28
  );
38
29
 
39
30
  return (
40
- <CommandPalette
41
- isOpen
42
- isInline
43
- onOpenChange={() => {}}
44
- searchSource={source}
45
- />
31
+ <Stack direction="vertical" gap={4}>
32
+ <Stack direction="vertical" gap={1}>
33
+ <Text type="supporting" color="secondary">
34
+ Data-driven grouping (auxiliaryData.group)
35
+ </Text>
36
+ <CommandPalette
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>
46
67
  );
47
68
  }
@@ -3,10 +3,16 @@
3
3
  'use client';
4
4
 
5
5
  import {useMemo, type CSSProperties} from 'react';
6
- import {CommandPalette} from '@astryxdesign/core/CommandPalette';
6
+ import {
7
+ CommandPalette,
8
+ CommandPaletteList,
9
+ CommandPaletteItem,
10
+ } from '@astryxdesign/core/CommandPalette';
7
11
  import {Text} from '@astryxdesign/core/Text';
8
12
  import {Kbd} from '@astryxdesign/core/Kbd';
13
+ import {Icon} from '@astryxdesign/core/Icon';
9
14
  import {createStaticSource} from '@astryxdesign/core/Typeahead';
15
+ import {Stack} from '@astryxdesign/core/Layout';
10
16
  import type {SearchableItem} from '@astryxdesign/core/Typeahead';
11
17
 
12
18
  const itemLabel: CSSProperties = {
@@ -17,21 +23,9 @@ type CommandItem = SearchableItem<{shortcut?: string}>;
17
23
 
18
24
  const commands: CommandItem[] = [
19
25
  {id: 'save', label: 'Save File', auxiliaryData: {shortcut: 'mod+s'}},
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
- },
26
+ {id: 'find', label: 'Find in Files', auxiliaryData: {shortcut: 'mod+shift+f'}},
27
+ {id: 'palette', label: 'Command Palette', auxiliaryData: {shortcut: 'mod+shift+p'}},
28
+ {id: 'terminal', label: 'Toggle Terminal', auxiliaryData: {shortcut: 'ctrl+`'}},
35
29
  {id: 'sidebar', label: 'Toggle Sidebar', auxiliaryData: {shortcut: 'mod+b'}},
36
30
  ];
37
31
 
@@ -39,21 +33,50 @@ export default function CommandPaletteItemShowcase() {
39
33
  const source = useMemo(() => createStaticSource(commands), []);
40
34
 
41
35
  return (
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} />
36
+ <Stack direction="vertical" gap={4}>
37
+ <Stack direction="vertical" gap={1}>
38
+ <Text type="supporting" color="secondary">
39
+ Custom renderItem with keyboard shortcuts
40
+ </Text>
41
+ <CommandPalette
42
+ isOpen
43
+ isInline
44
+ onOpenChange={() => {}}
45
+ searchSource={source}
46
+ renderItem={(item: CommandItem) => (
47
+ <>
48
+ <Text type="body" style={itemLabel}>
49
+ {item.label}
50
+ </Text>
51
+ {item.auxiliaryData?.shortcut && (
52
+ <Kbd keys={item.auxiliaryData.shortcut} />
53
+ )}
54
+ </>
54
55
  )}
55
- </>
56
- )}
57
- />
56
+ />
57
+ </Stack>
58
+ <Stack direction="vertical" gap={1}>
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>
58
81
  );
59
82
  }
@@ -19,7 +19,13 @@ import {Link} from '@astryxdesign/core/Link';
19
19
  import {Thumbnail} from '@astryxdesign/core/Thumbnail';
20
20
  import {Table, proportional, pixel} from '@astryxdesign/core/Table';
21
21
  import type {TableColumn} from '@astryxdesign/core/Table';
22
- import {Chart, ChartGrid, ChartAxis, area, line} from '@astryxdesign/charts';
22
+ import {
23
+ ChartV2 as Chart,
24
+ ChartGrid,
25
+ ChartAxis,
26
+ area,
27
+ line,
28
+ } from '@astryxdesign/lab';
23
29
  import {
24
30
  FunnelIcon,
25
31
  ArrowDownTrayIcon,
@@ -475,13 +481,17 @@ const columns: TableColumn<OrderRow>[] = [
475
481
  key: 'amount',
476
482
  header: 'Amount',
477
483
  width: pixel(90),
478
- renderCell: (item: OrderRow) => <Text type="body">${item.amount}</Text>,
484
+ renderCell: (item: OrderRow) => (
485
+ <Text type="body">${item.amount}</Text>
486
+ ),
479
487
  },
480
488
  {
481
489
  key: 'customer',
482
490
  header: 'Customer',
483
491
  width: proportional(2),
484
- renderCell: (item: OrderRow) => <Text type="body">{item.customer}</Text>,
492
+ renderCell: (item: OrderRow) => (
493
+ <Text type="body">{item.customer}</Text>
494
+ ),
485
495
  },
486
496
  {
487
497
  key: 'email',