= {
component: Tag,
-};
-
-export const Normal: Story = (): ReactElement => {
- const tags: TagValue[] = [
- { label: 'Tag 1', id: '1' },
- { label: 'Tag 2', id: '2' },
- { label: 'Tag 3', id: '3' },
- ];
+ title: 'Components/Tags/Tag',
+ args: {
+ value: {
+ label: 'Tag',
+ },
+ size: 'medium',
+ iconName: undefined,
+ color: 'default',
+ onRemove: undefined,
+ },
+ argTypes: {
+ value: {
+ control: {
+ type: 'object',
+ },
+ },
+ size: {
+ control: {
+ type: 'select',
- return (
- <>
-
- {tags.map((tag) => )}
-
-
-
- {tags.map((tag) => )}
-
- >
- );
+ },
+ defaultValue: 'medium',
+ },
+ iconName: {
+ control: {
+ type: 'select',
+ },
+ },
+ color: {
+ control: {
+ type: 'select',
+ },
+ },
+ onRemove: {
+ control: {
+ type: 'boolean',
+ },
+ },
+ },
+ render: (args) => (
+
+ ),
};
-export const Small: Story = (): ReactElement => (
-
-);
+export default TagMeta;
+type Story = StoryObj;
-export const Medium: Story = (): ReactElement => (
-
-);
-
-export const WithIcons: Story = (): ReactElement => {
- const options: TagProps[] = [
- { value: { label: 'Tag 1', id: 'tag1' }, iconName: 'calendar' },
- { value: { label: 'Tag 2', id: 'tag2' }, iconName: 'home' },
- { value: { label: 'Tag 3', id: 'tag3' }, iconName: 'info' },
- ];
-
- return (
-
- {options.map(({ iconName, value }) => )}
-
- );
+export const Default: Story = {
+ ...TagMeta,
};
-export const Deletable: Story = (): ReactElement => {
- const initialOptions: TagValue[] = [
- { label: 'Tag 1', id: 'tag1' },
- { label: 'Tag 2', id: 'tag2' },
- { label: 'Tag 3', id: 'tag3' },
- ];
- const [options, setOptions] = useState(initialOptions);
+export const Small: Story = {
+ ...Default,
+ args: {
+ size: 'small',
+ },
+};
- function handleDelete(tag: TagValue): void {
- const filteredOptionsArray = [...options].filter(({ id }) => id !== tag.id);
- setOptions(filteredOptionsArray);
- }
+export const Medium: Story = {
+ ...Default,
+ args: {
+ size: 'medium',
+ },
+};
- return (
-
- {options.map((tag) => )}
-
- );
+export const WithIcons: Story = {
+ ...Default,
+ args: {
+ iconName: 'copy',
+ },
};
-export const Clickable: Story = () => {
- function handleClick(tag: TagValue): void {
- console.info(`Clicked on ${tag.label}`);
- }
+export const Removable: Story = {
+ ...Default,
+ args: {
+ onRemove: (tag: TagValue) => console.info(`Removed ${tag.label}`),
+ },
+};
- return (
- <>
-
-
- >
- );
+export const Colored: Story = {
+ ...Default,
+ args: {
+ color: 'decorative-01',
+ },
};
export const WithRef: Story = () => {
diff --git a/packages/storybook/stories/toggle-tag.stories.tsx b/packages/storybook/stories/toggle-tag.stories.tsx
new file mode 100644
index 0000000000..e9c40b31f9
--- /dev/null
+++ b/packages/storybook/stories/toggle-tag.stories.tsx
@@ -0,0 +1,88 @@
+import { ToggleTagValue, ToggleTag } from '@equisoft/design-elements-react';
+import { Meta, StoryObj } from '@storybook/react';
+import { useRef } from 'react';
+import { rawCodeParameters } from './utils/parameters';
+
+const ToggleTagMeta: Meta = {
+ component: ToggleTag,
+ title: 'Components/Tags/ToggleTag',
+ args: {
+ value: {
+ label: 'Toggle Tag',
+ },
+ size: 'medium',
+ iconName: undefined,
+ selected: undefined,
+ onClick: (tag: ToggleTagValue) => console.info(`Clicked on ${tag.label}`),
+ },
+ argTypes: {
+ size: {
+ control: {
+ type: 'select',
+ },
+ defaultValue: 'medium',
+ },
+ value: {
+ control: {
+ type: 'object',
+ },
+ },
+ iconName: {
+ control: {
+ type: 'select',
+ },
+ },
+ selected: {
+ control: {
+ type: 'boolean',
+ },
+ },
+ },
+ render: (args) => (
+
+ ),
+};
+
+export default ToggleTagMeta;
+type Story = StoryObj;
+
+export const Default: Story = {
+ ...ToggleTagMeta,
+};
+
+export const Small: Story = {
+ ...Default,
+ args: {
+ size: 'small',
+ },
+};
+
+export const Medium: Story = {
+ ...Default,
+ args: {
+ size: 'medium',
+ },
+};
+
+export const WithIcons: Story = {
+ ...Default,
+ args: {
+ iconName: 'copy',
+ },
+};
+
+export const WithRef: Story = () => {
+ const ref = useRef(null);
+
+ return (
+
+ );
+};
+
+WithRef.parameters = rawCodeParameters;