diff --git a/assets/errorIcon.svg b/assets/errorIcon.svg
new file mode 100644
index 00000000..2295b82a
--- /dev/null
+++ b/assets/errorIcon.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/successIcon.svg b/assets/successIcon.svg
new file mode 100644
index 00000000..2dd88e7a
--- /dev/null
+++ b/assets/successIcon.svg
@@ -0,0 +1,4 @@
+
\ No newline at end of file
diff --git a/src/core/internal/index.ts b/src/core/internal/index.ts
index d6b87201..462ba2fd 100644
--- a/src/core/internal/index.ts
+++ b/src/core/internal/index.ts
@@ -45,6 +45,8 @@ import {
appendZeroToOne, domReady, getMaskedOutput, handleCopyIconClick, styleToString,
} from '../../utils/helpers';
import { ContainerType } from '../../skyflow';
+import successIcon from '../../../assets/successIcon.svg'
+import errorIcon from '../../../assets/errorIcon.svg'
export class FrameController {
controller?: FrameController;
@@ -128,6 +130,10 @@ export class FrameElement {
private isRequiredLabel?: HTMLLabelElement;
+ private isValidIcon?: HTMLImageElement;
+
+ private isInvalidIcon?: HTMLImageElement;
+
private dropdownIcon?: HTMLImageElement;
private dropdownSelect?: HTMLSelectElement;
@@ -239,6 +245,16 @@ export class FrameElement {
this.isRequiredLabel.className = `SkyflowElement-label-${this.options.elementName}-${STYLE_TYPE.REQUIRED_ASTERISK}`;
this.labelDiv.append(this.isRequiredLabel);
}
+ if (this.domError) {
+ this.isValidIcon = document.createElement('img');
+ this.isValidIcon.src = successIcon;
+ this.labelDiv.append(this.isValidIcon);
+ }
+ if (this.domError) {
+ this.isInvalidIcon = document.createElement('img');
+ this.isInvalidIcon.src = errorIcon;
+ this.labelDiv.append(this.isInvalidIcon);
+ }
this.iFrameFormElement.on(ELEMENT_EVENTS_TO_CLIENT.FOCUS, (state) => {
this.focusChange(true);
state.isEmpty = !state.value;
@@ -296,6 +312,18 @@ export class FrameElement {
this.domCopy.style.display = 'none';
}
+ if (!state.isEmpty && state.isValid && this.domError && this.isValidIcon) {
+ this.isValidIcon.style.display = 'block';
+ } else if(this.isValidIcon) {
+ this.isValidIcon.style.display = 'none';
+ }
+
+ if(!state.isEmpty && !state.isValid && this.domError && this.isInvalidIcon) {
+ this.isInvalidIcon.style.display = 'block';
+ } else if(this.isInvalidIcon) {
+ this.isInvalidIcon.style.display = 'none';
+ }
+
// On CHANGE set isEmpty to false
state.isEmpty = !state.value;