@designcrowd/fe-shared-lib 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designcrowd/fe-shared-lib",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "scripts": {
5
5
  "start": "run-p storybook watch:translation",
6
6
  "build": "npm run build:css --production",
@@ -97,11 +97,20 @@ export default {
97
97
  required: false,
98
98
  default: false,
99
99
  },
100
+ requiredMessage: {
101
+ type: String,
102
+ required: false,
103
+ default: 'Please fill in this field.',
104
+ },
100
105
  },
101
106
  methods: {
102
- input(modelValue) {
107
+ input(modelValue, event) {
103
108
  this.$emit('update:modelValue', modelValue);
104
109
  this.$emit('input', modelValue);
110
+
111
+ if (event?.target) {
112
+ event.target.setCustomValidity('');
113
+ }
105
114
  },
106
115
  keyup(modelValue) {
107
116
  this.$emit('keyup', modelValue);
@@ -73,7 +73,8 @@
73
73
  },
74
74
  ]"
75
75
  class="tw-text-grayscale-600 tw-box-border tw-w-full tw-text-base tw-px-4 tw-border tw-border-solid focus:tw-outline-none tw-transition-colors tw-duration-300 tw-ease-out tw-shadow-inner"
76
- @input.stop="input($event.target.value)"
76
+ @invalid="setValidationMessage"
77
+ @input.stop="input($event.target.value, $event)"
77
78
  @keyup.stop="keyup($event.target.value)"
78
79
  @keydown.stop="keydown($event.target.value, $event)"
79
80
  @focus="focus($event.target.value)"
@@ -151,6 +152,9 @@ export default {
151
152
  this.$emit('on-clear-confirmation');
152
153
  }
153
154
  },
155
+ setValidationMessage(event) {
156
+ event.target.setCustomValidity(this.requiredMessage);
157
+ },
154
158
  },
155
159
  };
156
160
  </script>