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

127 lines
3.5 KiB
TypeScript

import { ChevronLeft, ChevronRight, Code } from '@signozhq/icons';
import { Button, ButtonColor, ButtonGroup, ButtonSize, ButtonVariant } from '@signozhq/ui';
import type { Meta, StoryObj } from '@storybook/react-vite';
import { COLORS, VARIANTS } from './shared/button-arg-types.js';
const meta: Meta<typeof ButtonGroup> = {
title: 'Primitive Components/Button/ButtonGroup',
component: ButtonGroup,
parameters: {
layout: 'fullscreen',
controls: { disable: false },
},
argTypes: {
variant: {
control: 'select',
options: VARIANTS,
description:
'Default `variant` applied to descendant Buttons that do not set their own `variant`.',
table: { defaultValue: { summary: 'solid' } },
},
size: {
control: 'select',
options: ['sm', 'md', 'icon'],
description: 'Default `size` applied to descendant Buttons that do not set their own `size`.',
table: { defaultValue: { summary: 'md' } },
},
color: {
control: 'select',
options: COLORS,
description:
'Default `color` applied to descendant Buttons that do not set their own `color`.',
table: { defaultValue: { summary: 'primary' } },
},
testId: {
control: 'text',
description: 'Forwarded to the rendered group element as `data-testid`.',
},
},
args: {
variant: ButtonVariant.Outlined,
color: ButtonColor.Secondary,
size: ButtonSize.MD,
},
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof ButtonGroup>;
export const Default: Story = {
render: (args) => (
<ButtonGroup {...args}>
<Button>Day</Button>
<Button>Week</Button>
<Button>Month</Button>
</ButtonGroup>
),
};
export const Variants: Story = {
parameters: { controls: { disable: true } },
render: () => (
<div style={{ padding: 32, display: 'flex', flexDirection: 'column', gap: 12 }}>
<ButtonGroup variant={ButtonVariant.Outlined} color={ButtonColor.Secondary}>
<Button>Day</Button>
<Button>Week</Button>
<Button>Month</Button>
</ButtonGroup>
<ButtonGroup variant={ButtonVariant.Solid}>
<Button>Day</Button>
<Button>Week</Button>
<Button>Month</Button>
</ButtonGroup>
<ButtonGroup variant={ButtonVariant.Ghost}>
<Button>Day</Button>
<Button>Week</Button>
<Button>Month</Button>
</ButtonGroup>
</div>
),
};
export const Sizes: Story = {
parameters: { controls: { disable: true } },
render: () => (
<div style={{ padding: 32, display: 'flex', alignItems: 'flex-end', gap: 16 }}>
{[ButtonSize.SM, ButtonSize.MD].map((size) => (
<ButtonGroup
key={size}
size={size}
variant={ButtonVariant.Outlined}
color={ButtonColor.Secondary}
>
<Button>Prev</Button>
<Button>Next</Button>
</ButtonGroup>
))}
</div>
),
};
export const IconCluster: Story = {
parameters: { controls: { disable: true } },
render: () => (
<div style={{ padding: 32 }}>
<ButtonGroup variant={ButtonVariant.Outlined} color={ButtonColor.Secondary} size="icon">
<Button prefix={<ChevronLeft />} aria-label="Previous" />
<Button prefix={<Code />} aria-label="Code" />
<Button prefix={<ChevronRight />} aria-label="Next" />
</ButtonGroup>
</div>
),
};
export const PerButtonOverride: Story = {
parameters: { controls: { disable: true } },
render: () => (
<div style={{ padding: 32 }}>
<ButtonGroup variant={ButtonVariant.Outlined} color={ButtonColor.Secondary}>
<Button>Approve</Button>
<Button>Hold</Button>
<Button color={ButtonColor.Destructive}>Reject</Button>
</ButtonGroup>
</div>
),
};