Skip to content

Commit 95e3f29

Browse files
committed
fix: CInput rename elementSize/size to size/sizeHtml
1 parent 50f8661 commit 95e3f29

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

src/CInput.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,36 @@ const CInput = props => {
2323
valid,
2424
invalid,
2525
plaintext,
26-
elementSize,
26+
size,
27+
sizeHtml,
2728
...attributes
2829
} = props
2930

3031
// render
3132
const classes = mapToCssModules(
3233
classNames(
3334
plaintext ? 'form-control-plaintext' : 'form-control',
34-
elementSize && `form-control-${elementSize}`,
35+
size && `form-control-${size}`,
3536
invalid && 'is-invalid',
3637
valid && 'is-valid',
3738
className
3839
), cssModule)
3940

40-
return <input className={classes} type={type} {...attributes} ref={innerRef}/>
41+
return <input
42+
className={classes}
43+
type={type}
44+
{...attributes}
45+
size={sizeHtml}
46+
ref={innerRef}
47+
/>
4148
}
4249

4350
CInput.propTypes = {
4451
...commonPropTypes,
4552
plaintext: PropTypes.bool,
4653
type: PropTypes.string,
47-
elementSize: PropTypes.string
54+
size: PropTypes.string,
55+
sizeHtml: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
4856
};
4957

5058
CInput.defaultProps = {
@@ -154,7 +162,8 @@ const CSelect = props => {
154162
innerRef,
155163
valid,
156164
invalid,
157-
elementSize,
165+
size,
166+
sizeHtml,
158167
custom,
159168
...attributes
160169
} = props
@@ -163,19 +172,24 @@ const CSelect = props => {
163172
const baseClass = custom ? 'custom-select' : 'form-control'
164173
const classes = mapToCssModules(classNames(
165174
baseClass,
166-
elementSize && `${baseClass}-${elementSize}`,
175+
size && `${baseClass}-${size}`,
167176
invalid && 'is-invalid',
168177
valid && 'is-valid',
169178
className
170179
), cssModule)
171180

172-
return <select className={classes} {...attributes} ref={innerRef}/>
181+
return <select
182+
className={classes}
183+
{...attributes}
184+
size={sizeHtml}
185+
ref={innerRef}
186+
/>
173187
}
174188

175189
CSelect.propTypes = {
176190
...commonPropTypes,
177-
elementSize: PropTypes. string,
178-
191+
size: PropTypes.string,
192+
sizeHtml: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
179193
};
180194

181195
export {

0 commit comments

Comments
 (0)