Skip to content

Commit bcefc83

Browse files
committed
remove material-ui selector, add specialLabel, close bl00mber#218
1 parent 60893cd commit bcefc83

File tree

8 files changed

+74
-12
lines changed

8 files changed

+74
-12
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ If `enableAreaCodeStretch` is added, the part of the mask with the area code wil
391391
<td> defaultErrorMessage </td>
392392
<td> string </td>
393393
</tr>
394+
<tr>
395+
<td> specialLabel </td>
396+
<td> string </td>
397+
</tr>
394398
<tr>
395399
<td> disableInitialCountryGuess </td>
396400
<td> false </td>

src/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class PhoneInput extends React.Component {
9696
PropTypes.func,
9797
]),
9898
defaultErrorMessage: PropTypes.string,
99+
specialLabel: PropTypes.string,
99100
}
100101

101102
static defaultProps = {
@@ -160,6 +161,7 @@ class PhoneInput extends React.Component {
160161

161162
isValid: true, // (value, selectedCountry, onlyCountries, hiddenAreaCodes) => true | false | 'Message'
162163
defaultErrorMessage: '',
164+
specialLabel: 'Phone',
163165

164166
onEnterKeyPress: null, // null or function
165167

@@ -892,7 +894,7 @@ class PhoneInput extends React.Component {
892894

893895
render() {
894896
const { onlyCountries, selectedCountry, showDropdown, formattedNumber, hiddenAreaCodes } = this.state;
895-
const { disableDropdown, renderStringAsFlag, isValid, defaultErrorMessage } = this.props;
897+
const { disableDropdown, renderStringAsFlag, isValid, defaultErrorMessage, specialLabel } = this.props;
896898

897899
let isValidValue, errorMessage;
898900
if (typeof isValid === 'boolean') {
@@ -936,6 +938,7 @@ class PhoneInput extends React.Component {
936938
className={containerClasses}
937939
style={this.props.style || this.props.containerStyle}
938940
onKeyDown={this.handleKeydown}>
941+
{specialLabel && <div className='special-label'>{specialLabel}</div>}
939942
{errorMessage && <div className='invalid-number-message'>{errorMessage}</div>}
940943
<input
941944
className={inputClasses}

src/style/bootstrap.less

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,15 @@
172172
padding: 0 5px;
173173
color: #de0000;
174174
}
175+
.special-label {
176+
display: none;
177+
position: absolute;
178+
z-index: 1;
179+
font-size: 13px;
180+
left: 25px;
181+
top: -7px;
182+
background: #fff;
183+
padding: 0 5px;
184+
white-space: nowrap;
185+
}
175186
}

src/style/high-res.less

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,15 @@
157157
opacity: .7;
158158
}
159159
}
160+
.special-label {
161+
display: none;
162+
position: absolute;
163+
z-index: 1;
164+
font-size: 13px;
165+
left: 46px;
166+
top: -8px;
167+
background: #fff;
168+
padding: 0 2px;
169+
white-space: nowrap;
170+
}
160171
}

src/style/material.less

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,6 @@
3333
width: 27px;
3434
}
3535
}
36-
&+div:before {
37-
content: 'Phone input';
38-
position: absolute;
39-
top: -7px;
40-
left: 25px;
41-
display: block;
42-
background: white;
43-
padding: 0 5px;
44-
font-size: 13px;
45-
white-space: nowrap;
46-
}
4736
}
4837
.flag-dropdown {
4938
position: absolute;
@@ -186,4 +175,15 @@
186175
padding: 0 5px;
187176
color: #de0000;
188177
}
178+
.special-label {
179+
position: absolute;
180+
z-index: 1;
181+
top: -7px;
182+
left: 25px;
183+
display: block;
184+
background: white;
185+
padding: 0 5px;
186+
font-size: 13px;
187+
white-space: nowrap;
188+
}
189189
}

src/style/plain.less

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,4 +158,15 @@
158158
padding: 0 2px;
159159
color: #de0000;
160160
}
161+
.special-label {
162+
display: none;
163+
position: absolute;
164+
z-index: 1;
165+
font-size: 13px;
166+
left: 46px;
167+
top: -8px;
168+
background: #fff;
169+
padding: 0 2px;
170+
white-space: nowrap;
171+
}
161172
}

src/style/semantic-ui.less

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,15 @@
179179
padding: 0 2px;
180180
color: #de0000;
181181
}
182+
.special-label {
183+
display: none;
184+
position: absolute;
185+
z-index: 1;
186+
font-size: 13px;
187+
left: 46px;
188+
top: -8px;
189+
background: #fff;
190+
padding: 0 2px;
191+
white-space: nowrap;
192+
}
182193
}

src/style/style.less

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,15 @@
165165
padding: 0 2px;
166166
color: #de0000;
167167
}
168+
.special-label {
169+
display: none;
170+
position: absolute;
171+
z-index: 1;
172+
font-size: 13px;
173+
left: 46px;
174+
top: -8px;
175+
background: #fff;
176+
padding: 0 2px;
177+
white-space: nowrap;
178+
}
168179
}

0 commit comments

Comments
 (0)