Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

test(command-palette): add group audit fixture (#7166)

Cindy Zhangdc3a939c9ab8
diff --git a/apps/storybook/rtl-audit/verified-not-applicable.json b/apps/storybook/rtl-audit/verified-not-applicable.json
index dd73dcc70c..74bdb3ecd2 100644
--- a/apps/storybook/rtl-audit/verified-not-applicable.json
+++ b/apps/storybook/rtl-audit/verified-not-applicable.json
@@ -318,5 +318,14 @@
"packages/core/src/Chat/index.ts": "sha256:0f4a9d3ee08b4fcd43698ad017460aad109c500d2411913f509506d2a27387bb",
"packages/core/src/Divider/Divider.tsx": "sha256:f302b5c9eecde40b486c09d49c71cb7dab158e2fcedcb38c0145671c45d9cf8d"
}
+ },
+ {
+ "component": "core/CommandPaletteGroup",
+ "reason": "CommandPaletteGroup owns a vertically stacked listbox group with logical inline padding and block spacing. Its visible heading and item content follow normal document direction; it renders no directional glyph, physical inline positioning, reordered controls, horizontal scrolling or dragging, side-placed overlay, or horizontal keyboard behavior. The dedicated fixtures exercise the supported composition and public heading theme target without adding a component-owned RTL dimension.",
+ "evidence": {
+ "apps/storybook/stories/CommandPaletteGroup.stories.tsx": "sha256:82d4d68c5cfd0b4f2d027fb62f2b381a9ff9669b72ccf195c1613e9a63e2cb6c",
+ "packages/core/src/CommandPalette/CommandPaletteGroup.tsx": "sha256:7c9a33733d68a42ea57a928a4d6ed20caa2562f53cb2340fe8122071bcc95924",
+ "packages/core/src/CommandPalette/index.ts": "sha256:ba38845bbde6d73172df2c0791ca513c9f2b7baab17440e066e783ff6cfc7558"
+ }
}
]
diff --git a/apps/storybook/stories/CommandPaletteGroup.stories.tsx b/apps/storybook/stories/CommandPaletteGroup.stories.tsx
new file mode 100644
index 0000000000..75675e2d11
--- /dev/null
+++ b/apps/storybook/stories/CommandPaletteGroup.stories.tsx
@@ -0,0 +1,66 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+
+import type {Meta, StoryObj} from '@storybook/react';
+import {
+ CommandPaletteGroup,
+ CommandPaletteItem,
+ CommandPaletteList,
+} from '@astryxdesign/core/CommandPalette';
+import {Theme, defineTheme} from '@astryxdesign/core/theme';
+
+const meta: Meta<typeof CommandPaletteGroup> = {
+ title: 'Core/CommandPaletteGroup',
+ component: CommandPaletteGroup,
+ tags: ['autodocs', 'visual-theme-matrix'],
+ parameters: {
+ layout: 'centered',
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof meta>;
+
+function GroupFixture({heading = 'Navigation'}: {heading?: string}) {
+ return (
+ <CommandPaletteList label="Grouped commands">
+ <CommandPaletteGroup heading={heading}>
+ <CommandPaletteItem value="home" onSelect={() => {}}>
+ Home
+ </CommandPaletteItem>
+ <CommandPaletteItem value="settings" onSelect={() => {}}>
+ Settings
+ </CommandPaletteItem>
+ <CommandPaletteItem value="profile" onSelect={() => {}}>
+ Profile
+ </CommandPaletteItem>
+ </CommandPaletteGroup>
+ </CommandPaletteList>
+ );
+}
+
+/** A labeled group in its supported listbox composition. */
+export const Default: Story = {
+ render: () => <GroupFixture />,
+};
+
+const groupHeadingTheme = defineTheme({
+ name: 'command-palette-group-heading-audit',
+ components: {
+ 'command-palette-group-heading': {
+ base: {
+ color: 'var(--color-accent)',
+ fontWeight: 'var(--font-weight-bold)',
+ textTransform: 'uppercase',
+ },
+ },
+ },
+});
+
+/** The public heading target remains independently themeable. */
+export const ThemedHeading: Story = {
+ render: () => (
+ <Theme theme={groupHeadingTheme} mode="light">
+ <GroupFixture heading="Suggestions" />
+ </Theme>
+ ),
+};