mirror of
https://github.com/hanzoai/o11y-components.git
synced 2026-10-30 14:54:15 +00:00
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.
115 lines
2.8 KiB
TypeScript
115 lines
2.8 KiB
TypeScript
import {
|
|
Combobox,
|
|
ComboboxCommand,
|
|
ComboboxContent,
|
|
ComboboxEmpty,
|
|
ComboboxInput,
|
|
ComboboxItem,
|
|
ComboboxList,
|
|
ComboboxTrigger,
|
|
} from '@signozhq/ui';
|
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
import { useState } from 'react';
|
|
|
|
const meta: Meta<typeof ComboboxTrigger> = {
|
|
title: 'Primitive Components/Combobox/ComboboxTrigger',
|
|
component: ComboboxTrigger,
|
|
argTypes: {
|
|
testId: {
|
|
control: 'text',
|
|
description: 'Test ID for the combobox trigger.',
|
|
table: { category: 'Testing', type: { summary: 'string' } },
|
|
},
|
|
id: {
|
|
control: 'text',
|
|
description: 'A unique identifier for the combobox trigger.',
|
|
table: { category: 'Accessibility', type: { summary: 'string' } },
|
|
},
|
|
placeholder: {
|
|
control: 'text',
|
|
description: 'Text shown when no value is selected.',
|
|
table: { category: 'Content', type: { summary: 'string' } },
|
|
},
|
|
value: {
|
|
control: 'text',
|
|
description: 'The selected value label displayed in the trigger.',
|
|
table: { category: 'Content', type: { summary: 'string' } },
|
|
},
|
|
disabled: {
|
|
control: 'boolean',
|
|
description: 'When true, disables the trigger.',
|
|
table: { category: 'State', type: { summary: 'boolean' } },
|
|
},
|
|
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 ComboboxTrigger>;
|
|
|
|
const frameworks = [
|
|
{ value: 'react', label: 'React' },
|
|
{ value: 'vue', label: 'Vue' },
|
|
{ value: 'angular', label: 'Angular' },
|
|
];
|
|
|
|
export const Default: Story = {
|
|
args: {
|
|
placeholder: 'Select a framework...',
|
|
value: '',
|
|
disabled: false,
|
|
},
|
|
render: (args) => {
|
|
const [value, setValue] = useState('');
|
|
const [open, setOpen] = useState(false);
|
|
const displayValue =
|
|
args.value !== undefined
|
|
? args.value
|
|
: frameworks.find((f) => f.value === value)?.label || '';
|
|
|
|
return (
|
|
<div style={{ padding: 32, width: '100%', maxWidth: 384 }}>
|
|
<Combobox open={open} onOpenChange={setOpen}>
|
|
<ComboboxTrigger
|
|
{...args}
|
|
value={displayValue}
|
|
placeholder={args.placeholder}
|
|
disabled={args.disabled}
|
|
/>
|
|
{open && (
|
|
<ComboboxContent>
|
|
<ComboboxCommand>
|
|
<ComboboxInput placeholder="Search frameworks..." />
|
|
<ComboboxList>
|
|
{frameworks.map((f) => (
|
|
<ComboboxItem
|
|
key={f.value}
|
|
value={f.value}
|
|
onSelect={() => {
|
|
setValue(f.value);
|
|
setOpen(false);
|
|
}}
|
|
isSelected={value === f.value}
|
|
>
|
|
{f.label}
|
|
</ComboboxItem>
|
|
))}
|
|
<ComboboxEmpty>No results.</ComboboxEmpty>
|
|
</ComboboxList>
|
|
</ComboboxCommand>
|
|
</ComboboxContent>
|
|
)}
|
|
</Combobox>
|
|
</div>
|
|
);
|
|
},
|
|
};
|