@@ -2,6 +2,7 @@ import type { Meta, StoryObj } from "@storybook/react-vite";
22import { useState } from "react" ;
33import { css } from "../../../styled-system/css" ;
44import { Radio , RadioGroup } from "./RadioGroup" ;
5+ import { Flex } from "../.." ;
56
67export default {
78 component : RadioGroup ,
@@ -41,35 +42,43 @@ export const WithDefaultValue: Story = {
4142} ;
4243
4344export const Orientation : Story = {
44- render : ( ) => {
45+ render : ( args ) => {
4546 return (
4647 < div
4748 className = { css ( { display : "flex" , flexDirection : "column" , gap : "32" } ) }
4849 >
4950 < RadioGroup
51+ { ...args }
5052 name = "vertical-orientation"
5153 label = "세로 방향 (Vertical)"
5254 orientation = "vertical"
5355 defaultValue = "apple"
54- >
55- < Radio value = "apple" > 사과</ Radio >
56- < Radio value = "banana" > 바나나</ Radio >
57- < Radio value = "orange" > 오렌지</ Radio >
58- </ RadioGroup >
56+ />
5957
6058 < RadioGroup
59+ { ...args }
6160 name = "horizontal-orientation"
6261 label = "가로 방향 (Horizontal)"
6362 orientation = "horizontal"
6463 defaultValue = "banana"
65- >
66- < Radio value = "apple" > 사과</ Radio >
67- < Radio value = "banana" > 바나나</ Radio >
68- < Radio value = "orange" > 오렌지</ Radio >
69- </ RadioGroup >
64+ />
7065 </ div >
7166 ) ;
7267 } ,
68+ argTypes : {
69+ name : {
70+ control : false ,
71+ } ,
72+ label : {
73+ control : false ,
74+ } ,
75+ orientation : {
76+ control : false ,
77+ } ,
78+ defaultValue : {
79+ control : false ,
80+ } ,
81+ } ,
7382} ;
7483
7584export const GroupDisabled : Story = {
@@ -115,79 +124,69 @@ export const ItemDisabled: Story = {
115124} ;
116125
117126export const Tones : Story = {
118- render : ( ) => {
127+ render : ( args ) => {
119128 return (
120129 < div
121130 className = { css ( { display : "flex" , flexDirection : "column" , gap : "32" } ) }
122131 >
123132 < RadioGroup
133+ { ...args }
124134 name = "neutral-tone"
125135 label = "중립 색조 (Neutral)"
126- defaultValue = "apple"
127136 tone = "neutral"
128- >
129- < Radio value = "apple" > 사과</ Radio >
130- < Radio value = "banana" > 바나나</ Radio >
131- < Radio value = "orange" > 오렌지</ Radio >
132- </ RadioGroup >
137+ />
133138
134139 < RadioGroup
140+ { ...args }
135141 name = "brand-tone"
136142 label = "브랜드 색조 (Brand)"
137- defaultValue = "apple"
138143 tone = "brand"
139- >
140- < Radio value = "apple" > 사과</ Radio >
141- < Radio value = "banana" > 바나나</ Radio >
142- < Radio value = "orange" > 오렌지</ Radio >
143- </ RadioGroup >
144+ />
144145
145146 < RadioGroup
147+ { ...args }
146148 name = "danger-tone"
147149 label = "위험 색조 (Danger)"
148- defaultValue = "apple"
149150 tone = "danger"
150- >
151- < Radio value = "apple" > 사과</ Radio >
152- < Radio value = "banana" > 바나나</ Radio >
153- < Radio value = "orange" > 오렌지</ Radio >
154- </ RadioGroup >
151+ />
155152
156153 < RadioGroup
154+ { ...args }
157155 name = "warning-tone"
158156 label = "경고 색조 (Warning)"
159- defaultValue = "apple"
160157 tone = "warning"
161- >
162- < Radio value = "apple" > 사과</ Radio >
163- < Radio value = "banana" > 바나나</ Radio >
164- < Radio value = "orange" > 오렌지</ Radio >
165- </ RadioGroup >
158+ />
166159
167160 < RadioGroup
161+ { ...args }
168162 name = "success-tone"
169163 label = "성공 색조 (Success)"
170- defaultValue = "apple"
171164 tone = "success"
172- >
173- < Radio value = "apple" > 사과</ Radio >
174- < Radio value = "banana" > 바나나</ Radio >
175- < Radio value = "orange" > 오렌지</ Radio >
176- </ RadioGroup >
165+ />
177166
178167 < RadioGroup
168+ { ...args }
179169 name = "info-tone"
180170 label = "정보 색조 (Info)"
181- defaultValue = "apple"
182171 tone = "info"
183- >
184- < Radio value = "apple" > 사과</ Radio >
185- < Radio value = "banana" > 바나나</ Radio >
186- < Radio value = "orange" > 오렌지</ Radio >
187- </ RadioGroup >
172+ />
188173 </ div >
189174 ) ;
190175 } ,
176+ argTypes : {
177+ name : {
178+ control : false ,
179+ } ,
180+ label : {
181+ control : false ,
182+ } ,
183+ tone : {
184+ control : false ,
185+ } ,
186+ } ,
187+ args : {
188+ defaultValue : "apple" ,
189+ } ,
191190} ;
192191
193192export const Controlled = ( ) => {
@@ -212,3 +211,38 @@ export const Controlled = () => {
212211 </ div >
213212 ) ;
214213} ;
214+
215+ export const Invalid : Story = {
216+ render : ( args ) => {
217+ return (
218+ < Flex gap = "16" direction = "column" >
219+ < RadioGroup
220+ { ...args }
221+ name = "valid-radio-group"
222+ label = "유효한 상태"
223+ invalid = { false }
224+ />
225+ < RadioGroup
226+ { ...args }
227+ name = "invalid-radio-group"
228+ label = "유효하지 않은 상태"
229+ invalid
230+ />
231+ </ Flex >
232+ ) ;
233+ } ,
234+ args : {
235+ defaultValue : "banana" ,
236+ } ,
237+ argTypes : {
238+ invalid : {
239+ control : false ,
240+ } ,
241+ label : {
242+ control : false ,
243+ } ,
244+ name : {
245+ control : false ,
246+ } ,
247+ } ,
248+ } ;
0 commit comments