Skip to content

Commit d91c04e

Browse files
committed
red line and no feedback icon
1 parent db8fbdb commit d91c04e

File tree

2 files changed

+22
-32
lines changed

2 files changed

+22
-32
lines changed

services/static-webserver/client/source/class/osparc/ui/form/IntlTelInput.js

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
7777
control = new qx.ui.embed.Html();
7878
this._add(control, { flex: 1 });
7979
break;
80-
case "feedback-icon":
81-
control = new qx.ui.basic.Image();
82-
control.exclude();
83-
this._add(control);
84-
break;
8580
}
8681
return control || this.base(arguments, id);
8782
},
@@ -120,7 +115,7 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
120115

121116
getFocusElement: function() {
122117
const phoneNumber = this.getChildControl("phone-input-field");
123-
// phoneNumber is a qx.ui.embed.Html it has a ContentElement (qx.html.Element)
118+
// phoneNumber is a qx.ui.embed.Html, it has a ContentElement (qx.html.Element)
124119
return phoneNumber.getContentElement();
125120
},
126121
// Make the widget tabbable/focusable
@@ -138,17 +133,10 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
138133
},
139134

140135
verifyPhoneNumber: function() {
141-
const value = this.getValue();
142-
const feedbackIcon = this.getChildControl("feedback-icon");
143-
feedbackIcon.setVisibility(value ? "visible" : "excluded");
144-
const isValid = this.isValidNumber();
145-
feedbackIcon.set({
146-
toolTipText: "E.164: " + this.getValue(),
147-
source: isValid ? "@FontAwesome5Solid/check/16" : "@FontAwesome5Solid/exclamation-triangle/16",
148-
textColor: isValid ? "text" : "failed-red",
149-
alignY: "middle",
150-
});
151-
if (!isValid) {
136+
if (this.isValidNumber()) {
137+
this.setValid(true);
138+
} else {
139+
this.setValid(false);
152140
const validationError = this.__phoneInput.getValidationError();
153141
const errorMap = {
154142
0: this.tr("Invalid number"),
@@ -157,22 +145,23 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
157145
3: this.tr("Number too long")
158146
};
159147
const errorMsg = errorMap[validationError] || this.tr("Invalid number");
160-
feedbackIcon.set({
161-
toolTipText: errorMsg + ". " + feedbackIcon.getToolTipText()
162-
});
148+
this.setInvalidMessage(errorMsg);
163149
}
164150
this.__updateStyle();
165151
},
166152

167153
__updateStyle: function() {
168-
const isCompact = this.isCompactField();
169154
const textColor = qx.theme.manager.Color.getInstance().resolve("text");
170155
const bgColor = qx.theme.manager.Color.getInstance().resolve("input_background");
171156
const productColor = qx.theme.manager.Color.getInstance().resolve("product-color");
157+
document.documentElement.style.setProperty('--country-list-dropdown-bg', bgColor);
158+
document.documentElement.style.setProperty('--country-list-dropdown-text', textColor);
159+
document.documentElement.style.setProperty('--tel-border-bottom-color', "rgb(9, 89, 122)");
160+
document.documentElement.style.setProperty('--tel-border-bottom-color-focused', productColor);
161+
162+
const isCompact = this.isCompactField();
172163
const phoneInputField = this.getChildControl("phone-input-field");
173-
const feedbackIcon = this.getChildControl("feedback-icon");
174-
const width = isCompact ? 152 : 215;
175-
const phoneInputWidth = feedbackIcon.isVisible() ? width - 14 : width;
164+
const width = isCompact ? 152 : 223;
176165
const height = isCompact ? 26 : 30;
177166

178167
phoneInputField.set({
@@ -183,16 +172,16 @@ qx.Class.define("osparc.ui.form.IntlTelInput", {
183172

184173
const phoneInput = this.__phoneInput;
185174
if (phoneInput) {
186-
phoneInput.a.style["width"] = phoneInputWidth + "px";
175+
phoneInput.a.style["width"] = width + "px";
187176
phoneInput.a.style["height"] = height + "px";
188177
phoneInput.a.style["borderWidth"] = "0px";
189178
phoneInput.a.style["backgroundColor"] = isCompact ? "transparent" : bgColor;
190179
phoneInput.a.style["color"] = textColor;
191-
}
192180

193-
document.documentElement.style.setProperty('--country-list-dropdown-bg', bgColor);
194-
document.documentElement.style.setProperty('--country-list-dropdown-text', textColor);
195-
document.documentElement.style.setProperty('--border-bottom-color-focused', productColor);
181+
if (this.getValue() && !this.isValidNumber()) {
182+
document.documentElement.style.setProperty('--tel-border-bottom-color', "red");
183+
}
184+
}
196185
},
197186

198187
__convertInputToPhoneInput: function() {

services/static-webserver/client/source/resource/intl-tel-input/css/intlTelInput.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -946,15 +946,16 @@
946946
/* osparc */
947947
.iti input {
948948
border: none !important;
949-
border-bottom: 1px solid var(--border-bottom-color, rgb(9, 89, 122)) !important;
949+
border-bottom: 1px solid var(--tel-border-bottom-color) !important;
950950
outline: none !important;
951951
box-shadow: none !important;
952952
}
953953

954954
.iti input:focus {
955-
border-bottom: 1px solid var(--border-bottom-color-focused) !important;
955+
border-bottom: 1px solid var(--tel-border-bottom-color-focused) !important;
956956
}
957-
957+
/*
958958
.iti input:invalid {
959959
border-bottom: 1px solid red !important;
960960
}
961+
*/

0 commit comments

Comments
 (0)