diff --git a/packages/react/src/components/MultiSelect/__snapshots__/index.story.storyshot b/packages/react/src/components/MultiSelect/__snapshots__/index.story.storyshot
index d34a4ac36..06d041bb0 100644
--- a/packages/react/src/components/MultiSelect/__snapshots__/index.story.storyshot
+++ b/packages/react/src/components/MultiSelect/__snapshots__/index.story.storyshot
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Storybook Tests MultiSelect Default 1`] = `
+exports[`Storybook Tests MultiSelect Basic 1`] = `
.c1 {
display: grid;
grid-template-columns: auto 1fr;
@@ -136,7 +136,7 @@ exports[`Storybook Tests MultiSelect Default 1`] = `
data-dark={false}
>
@@ -149,7 +149,7 @@ exports[`Storybook Tests MultiSelect Default 1`] = `
checked={true}
className="c2"
disabled={false}
- name=""
+ name="name"
onChange={[Function]}
type="checkbox"
value="選択肢1"
@@ -166,8 +166,7 @@ exports[`Storybook Tests MultiSelect Default 1`] = `
- 選択肢
- 1
+ 選択肢1
@@ -405,7 +401,7 @@ exports[`Storybook Tests MultiSelect Invalid 1`] = `
data-dark={false}
>
@@ -418,7 +414,7 @@ exports[`Storybook Tests MultiSelect Invalid 1`] = `
checked={false}
className="c2"
disabled={false}
- name="defaultName"
+ name="name"
onChange={[Function]}
type="checkbox"
value="選択肢1"
@@ -435,8 +431,7 @@ exports[`Storybook Tests MultiSelect Invalid 1`] = `
- 選択肢
- 1
+ 選択肢1
@@ -673,7 +665,7 @@ exports[`Storybook Tests MultiSelect Overlay 1`] = `
data-dark={false}
>
@@ -686,7 +678,7 @@ exports[`Storybook Tests MultiSelect Overlay 1`] = `
checked={false}
className="c2"
disabled={false}
- name="defaultName"
+ name="name"
onChange={[Function]}
type="checkbox"
value="選択肢1"
@@ -703,8 +695,7 @@ exports[`Storybook Tests MultiSelect Overlay 1`] = `
- 選択肢
- 1
+ 選択肢1
@@ -950,7 +938,7 @@ exports[`Storybook Tests MultiSelect Playground 1`] = `
checked={false}
className="c2"
disabled={false}
- name="defaultName"
+ name=""
onChange={[Function]}
type="checkbox"
value="選択肢1"
@@ -980,7 +968,7 @@ exports[`Storybook Tests MultiSelect Playground 1`] = `
checked={false}
className="c2"
disabled={false}
- name="defaultName"
+ name=""
onChange={[Function]}
type="checkbox"
value="選択肢2"
@@ -1010,7 +998,7 @@ exports[`Storybook Tests MultiSelect Playground 1`] = `
checked={false}
className="c2"
disabled={false}
- name="defaultName"
+ name=""
onChange={[Function]}
type="checkbox"
value="選択肢3"
@@ -1040,7 +1028,7 @@ exports[`Storybook Tests MultiSelect Playground 1`] = `
checked={false}
className="c2"
disabled={false}
- name="defaultName"
+ name=""
onChange={[Function]}
type="checkbox"
value="選択肢4"
diff --git a/packages/react/src/components/MultiSelect/index.story.tsx b/packages/react/src/components/MultiSelect/index.story.tsx
index 3de025dc1..81ceb67d3 100644
--- a/packages/react/src/components/MultiSelect/index.story.tsx
+++ b/packages/react/src/components/MultiSelect/index.story.tsx
@@ -1,42 +1,19 @@
import { useState } from 'react'
-import { Story } from '../../_lib/compat'
import styled from 'styled-components'
import { MultiSelectGroup, default as MultiSelect } from '.'
+import { Meta, StoryObj } from '@storybook/react'
+import { action } from '@storybook/addon-actions'
+
+const StyledMultiSelectGroup = styled(MultiSelectGroup)`
+ display: grid;
+ grid-template-columns: 1fr;
+ gap: 8px;
+`
export default {
title: 'MultiSelect',
component: MultiSelect,
argTypes: {
- name: {
- control: {
- type: 'text',
- },
- },
- label: {
- control: {
- type: 'text',
- },
- },
- selected: {
- control: {
- type: 'boolean',
- },
- },
- disabled: {
- control: {
- type: 'boolean',
- },
- },
- readonly: {
- control: {
- type: 'boolean',
- },
- },
- invalid: {
- control: {
- type: 'boolean',
- },
- },
variant: {
control: {
type: 'inline-radio',
@@ -44,173 +21,92 @@ export default {
},
},
},
-}
-
-type Props = {
- name: string
- label: string
- selected: boolean
- onChange: (selected: string[]) => void
- disabled?: boolean
- readonly?: boolean
- invalid?: boolean
- variant?: 'default' | 'overlay'
- className?: string
-}
-
-const StyledMultiSelectGroup = styled(MultiSelectGroup)`
- display: grid;
- grid-template-columns: 1fr;
- gap: 8px;
-`
-
-const Template: Story = ({
- name,
- label,
- selected,
- onChange,
- disabled,
- readonly,
- invalid,
- variant,
- className,
-}) => {
- return (
-
- {[1, 2, 3, 4].map((idx) => (
-
- 選択肢{idx}
-
- ))}
-
- )
-}
-
-export const Default = Template.bind({})
-Default.args = {
- name: '',
- label: '',
- selected: true,
- disabled: false,
- readonly: false,
- invalid: false,
- variant: 'default',
- // eslint-disable-next-line no-console
- onChange: (selected) => console.log(selected),
-}
+ args: {
+ variant: 'default',
+ },
+} as Meta
-type PlaygroundProps = {
- name: string
- label: string
- disabled?: boolean
- readonly?: boolean
- invalid?: boolean
- className?: string
- variant?: 'default' | 'overlay'
+export const Basic: StoryObj = {
+ render: function Render(args) {
+ const options = ['選択肢1', '選択肢2', '選択肢3', '選択肢4']
+ return (
+
+ {options.map((option) => (
+
+ {option}
+
+ ))}
+
+ )
+ },
}
-export const Playground: Story = ({ className, ...props }) => {
- const [selected, setSelected] = useState([])
-
- return (
-
- {[1, 2, 3, 4].map((idx) => (
-
- 選択肢{idx}
-
- ))}
-
- )
-}
-Playground.args = {
- name: 'defaultName',
- label: '',
- disabled: false,
- readonly: false,
- invalid: false,
- variant: 'default',
+export const Invalid: StoryObj = {
+ render: function Render(args) {
+ const options = ['選択肢1', '選択肢2', '選択肢3', '選択肢4']
+ return (
+
+ {options.map((option) => (
+
+ {option}
+
+ ))}
+
+ )
+ },
}
-export const Invalid: Story = ({ className, ...props }) => {
- const [selected, setSelected] = useState([])
-
- return (
-
- {[1, 2, 3, 4].map((idx) => (
-
- 選択肢{idx}
-
- ))}
-
- )
-}
-Invalid.args = {
- name: 'defaultName',
- label: '',
- disabled: false,
- readonly: false,
- variant: 'default',
+export const Overlay: StoryObj = {
+ render: function Render(args) {
+ const options = ['選択肢1', '選択肢2', '選択肢3', '選択肢4']
+ return (
+
+ {options.map((option) => (
+
+ {option}
+
+ ))}
+
+ )
+ },
+ args: {
+ variant: 'overlay',
+ },
}
-export const Overlay: Story = ({ className, ...props }) => {
- const [selected, setSelected] = useState([])
+export const Playground: StoryObj = {
+ render: function Render(args) {
+ const [selected, setSelected] = useState([])
- return (
-
- {[1, 2, 3, 4].map((idx) => (
-
- 選択肢{idx}
-
- ))}
-
- )
-}
-Overlay.args = {
- name: 'defaultName',
- label: '',
- disabled: false,
- readonly: false,
+ return (
+
+ {[1, 2, 3, 4].map((idx) => (
+
+ 選択肢{idx}
+
+ ))}
+
+ )
+ },
}