Files
zeekay 464e1eece0 State a version once
A version written into a manifest is written into every manifest that wants it,
which is how eslint came to exist in a hundred and four forms across this estate
and how a package came to resolve twice at run time. The catalog moves the number
out of the manifest: a manifest names the package, the workspace names the
version.

Four are held below their latest because the newer release cannot be used, and
the reason is recorded rather than the version alone: @noble/hashes 2 renamed
every subpath the web3 stack imports, @splinetool/runtime 2 depends on a package
that was never published, @dynamic-labs 5.4.1 the same, and react-resizable-panels
3 points its types condition at the bundle.
2026-09-15 11:45:32 -07:00

156 lines
3.7 KiB
TypeScript

import {
Select,
SelectContent,
SelectGroup,
SelectItem,
SelectLabel,
SelectSeparator,
SelectTrigger,
} from '@signozhq/ui';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
const meta: Meta<typeof SelectGroup> = {
title: 'Primitive Components/Select/SelectGroup',
component: SelectGroup,
argTypes: {
className: {
control: 'text',
description: 'Additional CSS classes.',
table: { category: 'Styling', type: { summary: 'string' } },
},
},
parameters: {
layout: 'fullscreen',
},
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof SelectGroup>;
const frameworks = [
{ value: 'react', label: 'React' },
{ value: 'vue', label: 'Vue' },
];
const languages = [
{ value: 'typescript', label: 'TypeScript' },
{ value: 'javascript', label: 'JavaScript' },
];
export const Default: Story = {
args: {},
render: (args) => {
const [value, setValue] = useState('');
const allItems = [
{ heading: 'Frameworks', items: frameworks },
{ heading: 'Languages', items: languages },
];
return (
<div style={{ padding: 32, width: '100%', maxWidth: 384 }}>
<Select value={value} onChange={(v) => setValue(v as string)}>
<SelectTrigger placeholder="Select an option..." />
<SelectContent>
{allItems.map((group, idx) => (
<>
{idx > 0 && <SelectSeparator key={`sep-${group.heading}`} />}
<SelectGroup key={group.heading} {...args}>
<SelectLabel>{group.heading}</SelectLabel>
{group.items.map((item) => (
<SelectItem key={item.value} value={item.value}>
{item.label}
</SelectItem>
))}
</SelectGroup>
</>
))}
</SelectContent>
</Select>
</div>
);
},
};
export const WithoutLabel: Story = {
render: () => {
const [value, setValue] = useState('');
return (
<div style={{ padding: 32, width: '100%', maxWidth: 384 }}>
<Select value={value} onChange={(v) => setValue(v as string)}>
<SelectTrigger placeholder="Select a framework..." />
<SelectContent>
<SelectGroup>
{frameworks.map((f) => (
<SelectItem key={f.value} value={f.value}>
{f.label}
</SelectItem>
))}
</SelectGroup>
<SelectSeparator />
<SelectGroup>
{languages.map((l) => (
<SelectItem key={l.value} value={l.value}>
{l.label}
</SelectItem>
))}
</SelectGroup>
</SelectContent>
</Select>
</div>
);
},
};
export const MultipleGroups: Story = {
render: () => {
const [value, setValue] = useState('');
const groups = [
{ heading: 'Frameworks', items: frameworks },
{ heading: 'Languages', items: languages },
{
heading: 'Databases',
items: [
{ value: 'postgres', label: 'PostgreSQL' },
{ value: 'redis', label: 'Redis' },
],
},
];
return (
<div style={{ padding: 32, width: '100%', maxWidth: 384 }}>
<Select value={value} onChange={(v) => setValue(v as string)}>
<SelectTrigger placeholder="Select an option..." />
<SelectContent>
{groups.map((group, idx) => (
<>
{idx > 0 && <SelectSeparator key={`sep-${group.heading}`} />}
<SelectGroup key={group.heading}>
<SelectLabel>{group.heading}</SelectLabel>
{group.items.map((item) => (
<SelectItem key={item.value} value={item.value}>
{item.label}
</SelectItem>
))}
</SelectGroup>
</>
))}
</SelectContent>
</Select>
<p
style={{
marginTop: 16,
fontSize: 14,
lineHeight: 1.42857,
color: 'var(--muted-foreground)',
}}
>
Selected: {value || 'none'}
</p>
</div>
);
},
};