@@ -28,6 +28,7 @@ const Demo = () => {
2828 const [ search , setSearch ] = useState ( false ) ;
2929 const [ copied , setCopied ] = useState ( false ) ;
3030 const [ dropdown , setDropdown ] = useState ( true ) ;
31+ const [ distinct , setDistinct ] = useState ( false ) ;
3132 const [ disabled , setDisabled ] = useState ( false ) ;
3233 const [ parentheses , setParentheses ] = useState ( true ) ;
3334 const [ algorithm , setAlgorithm ] = useState ( "defaultAlgorithm" ) ;
@@ -40,14 +41,15 @@ const Demo = () => {
4041 const code = useMemo ( ( ) => {
4142 let code = "<PhoneInput\n" ;
4243 if ( disabled ) code += " disabled\n" ;
44+ if ( distinct ) code += " distinct\n" ;
4345 if ( arrow ) code += " enableArrow\n" ;
4446 if ( search && dropdown ) code += " enableSearch\n" ;
4547 if ( ! dropdown ) code += " disableDropdown\n" ;
4648 if ( ! parentheses ) code += " disableParentheses\n" ;
4749 if ( code === "<PhoneInput\n" ) code = "<PhoneInput />" ;
4850 else code += "/>" ;
4951 return code ;
50- } , [ disabled , arrow , search , dropdown , parentheses ] )
52+ } , [ distinct , disabled , arrow , search , dropdown , parentheses ] )
5153
5254 const changeTheme = ( ) => {
5355 if ( algorithm === "defaultAlgorithm" ) {
@@ -85,59 +87,64 @@ const Demo = () => {
8587 </ Paragraph >
8688 < Divider orientation = "left" plain > Settings</ Divider >
8789 < div style = { { gap : 24 , display : "flex" , alignItems : "center" } } >
88- < Form . Item label = "Theme " >
90+ < Form . Item label = "Dropdown " >
8991 < Switch
90- onChange = { changeTheme }
91- checkedChildren = { < MoonOutlined /> }
92- unCheckedChildren = { < SunOutlined /> }
92+ defaultChecked
93+ checkedChildren = "enabled"
94+ unCheckedChildren = "disabled"
95+ onChange = { ( ) => setDropdown ( ! dropdown ) }
9396 />
9497 </ Form . Item >
95- < Form . Item label = "Validation " >
98+ < Form . Item label = "Parentheses " >
9699 < Switch
97- checkedChildren = "strict"
98- unCheckedChildren = "default"
99- onChange = { ( ) => setStrict ( ! strict ) }
100+ defaultChecked
101+ checkedChildren = "enabled"
102+ unCheckedChildren = "disabled"
103+ onChange = { ( ) => setParentheses ( ! parentheses ) }
100104 />
101105 </ Form . Item >
102- < Form . Item label = "Disabled" >
103- < Switch onChange = { ( ) => setDisabled ( ! disabled ) } />
104- </ Form . Item >
105106 </ div >
106107 < div style = { { gap : 24 , display : "flex" , alignItems : "center" } } >
107- < Form . Item label = "Dropdown " >
108+ < Form . Item label = "Search " >
108109 < Switch
109- defaultChecked
110+ disabled = { ! dropdown }
110111 checkedChildren = "enabled"
111112 unCheckedChildren = "disabled"
112- onChange = { ( ) => setDropdown ( ! dropdown ) }
113+ onChange = { ( ) => setSearch ( ! search ) }
113114 />
114115 </ Form . Item >
115- < Form . Item label = "Parentheses " >
116+ < Form . Item label = "Arrow " >
116117 < Switch
117- defaultChecked
118118 checkedChildren = "enabled"
119119 unCheckedChildren = "disabled"
120- onChange = { ( ) => setParentheses ( ! parentheses ) }
120+ onChange = { ( ) => setArrow ( ! arrow ) }
121121 />
122122 </ Form . Item >
123123 </ div >
124- < div style = { { gap : 24 , display : "flex" , alignItems : "center" } } >
125- < Form . Item label = "Search" style = { { margin : 0 } } >
126- < Switch
127- disabled = { ! dropdown }
128- checkedChildren = "enabled"
129- unCheckedChildren = "disabled"
130- onChange = { ( ) => setSearch ( ! search ) }
131- />
132- </ Form . Item >
133- < Form . Item label = "Arrow" style = { { margin : 0 } } >
134- < Switch
135- checkedChildren = "enabled"
136- unCheckedChildren = "disabled"
137- onChange = { ( ) => setArrow ( ! arrow ) }
138- />
139- </ Form . Item >
140- </ div >
124+ < div style = { { gap : 24 , display : "flex" , alignItems : "center" } } >
125+ < Form . Item label = "Theme" >
126+ < Switch
127+ onChange = { changeTheme }
128+ checkedChildren = { < MoonOutlined /> }
129+ unCheckedChildren = { < SunOutlined /> }
130+ />
131+ </ Form . Item >
132+ < Form . Item label = "Validation" >
133+ < Switch
134+ checkedChildren = "strict"
135+ unCheckedChildren = "default"
136+ onChange = { ( ) => setStrict ( ! strict ) }
137+ />
138+ </ Form . Item >
139+ </ div >
140+ < div style = { { gap : 24 , display : "flex" , alignItems : "center" } } >
141+ < Form . Item label = "Distinct" style = { { margin : 0 } } >
142+ < Switch onChange = { ( ) => setDistinct ( ! distinct ) } />
143+ </ Form . Item >
144+ < Form . Item label = "Disabled" style = { { margin : 0 } } >
145+ < Switch onChange = { ( ) => setDisabled ( ! disabled ) } />
146+ </ Form . Item >
147+ </ div >
141148 < Divider orientation = "left" plain > Code</ Divider >
142149 < div style = { { position : "relative" } } >
143150 < Button
0 commit comments