mirror of
https://github.com/nextui-org/nextui.git
synced 2025-12-08 19:26:11 +00:00
* chore(deps): bump RA versions * chore(deps): bump RA versions * chore(deps): bump RA versions * chore: changeset * chore(deps): remove unnecessary dependencies * fix(calendar): typing issue * refactor(system): remove unused SupportedCalendars * refactor(system): move I18nProviderProps to type * refactor: use `spectrumCalendarProps<DateValue>["createCalendar"]` * feat: add consistent-type-imports * fix: eslint * chore: add changeset * refactor: remove unused deps
119 lines
2.2 KiB
TypeScript
119 lines
2.2 KiB
TypeScript
import type {Meta} from "@storybook/react";
|
|
import type {ChipProps} from "../src";
|
|
|
|
import React from "react";
|
|
import {chip} from "@heroui/theme";
|
|
import {Avatar} from "@heroui/avatar";
|
|
import {CheckIcon} from "@heroui/shared-icons";
|
|
|
|
import {Chip} from "../src";
|
|
|
|
export default {
|
|
title: "Components/Chip",
|
|
component: Chip,
|
|
argTypes: {
|
|
variant: {
|
|
control: {
|
|
type: "select",
|
|
},
|
|
options: ["solid", "bordered", "light", "flat", "faded", "shadow", "dot"],
|
|
},
|
|
color: {
|
|
control: {
|
|
type: "select",
|
|
},
|
|
options: ["default", "primary", "secondary", "success", "warning", "danger"],
|
|
},
|
|
radius: {
|
|
control: {
|
|
type: "select",
|
|
},
|
|
options: ["none", "sm", "md", "lg", "full"],
|
|
},
|
|
size: {
|
|
control: {
|
|
type: "select",
|
|
},
|
|
options: ["sm", "md", "lg"],
|
|
},
|
|
isDisabled: {
|
|
control: {
|
|
type: "boolean",
|
|
},
|
|
},
|
|
},
|
|
} as Meta<typeof Chip>;
|
|
|
|
const defaultProps = {
|
|
...chip.defaultVariants,
|
|
children: "Chip",
|
|
};
|
|
|
|
export const Default = {
|
|
args: {
|
|
...defaultProps,
|
|
},
|
|
};
|
|
|
|
export const StartContent = {
|
|
args: {
|
|
...defaultProps,
|
|
startContent: (
|
|
<span aria-label="celebration" className="ml-1" role="img">
|
|
🎉
|
|
</span>
|
|
),
|
|
},
|
|
};
|
|
|
|
export const EndContent = {
|
|
args: {
|
|
...defaultProps,
|
|
endContent: (
|
|
<span aria-label="rocket" className="mr-1" role="img">
|
|
🚀
|
|
</span>
|
|
),
|
|
},
|
|
};
|
|
|
|
export const Closeable = {
|
|
args: {
|
|
...defaultProps,
|
|
// eslint-disable-next-line
|
|
onClose: () => console.log("Close"),
|
|
},
|
|
};
|
|
|
|
export const CustomCloseIcon = {
|
|
args: {
|
|
...defaultProps,
|
|
endContent: <CheckIcon />,
|
|
// eslint-disable-next-line
|
|
onClose: () => console.log("Close"),
|
|
},
|
|
};
|
|
|
|
export const WithAvatar = {
|
|
args: {
|
|
...defaultProps,
|
|
variant: "flat",
|
|
color: "secondary",
|
|
avatar: <Avatar name="JW" src="https://i.pravatar.cc/300?u=a042581f4e29026709d" />,
|
|
},
|
|
};
|
|
|
|
const HiddenOverflowTemplate = (args: ChipProps) => (
|
|
<div className="w-20 border-danger-500 border-2">
|
|
<Chip {...args} />
|
|
</div>
|
|
);
|
|
|
|
export const HiddenOverflow = {
|
|
render: HiddenOverflowTemplate,
|
|
args: {
|
|
...defaultProps,
|
|
children: "Hello World!",
|
|
},
|
|
};
|