@webitel/ui-sdk 25.4.70 → 25.4.72

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": "@webitel/ui-sdk",
3
- "version": "25.4.70",
3
+ "version": "25.4.72",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -50,7 +50,6 @@ const getContactGroupsList = async (params) => {
50
50
  const { page, size, fields, sort, id, q, name, type, enabled } =
51
51
  applyTransform(params, [
52
52
  merge(getDefaultGetParams()),
53
- starToSearch('search'),
54
53
  (params) => ({ ...params, q: params.search }),
55
54
  sanitize(fieldsToSend),
56
55
  camelToSnake(),
@@ -2,12 +2,14 @@
2
2
  <div
3
3
  :class="{
4
4
  'wt-datepicker--disabled': disabled,
5
+ 'wt-datepicker--invalid': invalid,
5
6
  }"
6
7
  class="wt-datepicker"
7
8
  >
8
9
  <wt-label
9
10
  :disabled="disabled"
10
11
  v-bind="labelProps"
12
+ :invalid="invalid"
11
13
  >
12
14
  <!-- @slot Custom input label -->
13
15
  <slot
@@ -72,6 +74,12 @@
72
74
  </div>
73
75
  </template>
74
76
  </vue-datepicker>
77
+ <wt-input-info
78
+ v-if="isValidation"
79
+ :invalid="invalid"
80
+ >
81
+ {{ validationText }}
82
+ </wt-input-info>
75
83
  </div>
76
84
  </template>
77
85
 
@@ -79,7 +87,10 @@
79
87
  import '@vuepic/vue-datepicker/dist/main.css';
80
88
 
81
89
  import VueDatepicker from '@vuepic/vue-datepicker';
82
- import { computed, ref } from 'vue';
90
+ import { computed, ref, toRefs } from 'vue';
91
+
92
+ import { useValidation } from '../../mixins/validationMixin/useValidation.js';
93
+ import WtInputInfo from '../wt-input-info/wt-input-info.vue';
83
94
 
84
95
  const props = defineProps({
85
96
  /**
@@ -134,6 +145,12 @@ const props = defineProps({
134
145
  type: Boolean,
135
146
  default: false,
136
147
  },
148
+
149
+ // validation rules
150
+ // TODO: move to separate file to make it reusable
151
+ v: {
152
+ type: Object,
153
+ },
137
154
  clearable: {
138
155
  type: Boolean,
139
156
  default: false,
@@ -150,6 +167,14 @@ const requiredLabel = computed(() => {
150
167
  return props.required ? `${props.label}*` : props.label;
151
168
  });
152
169
 
170
+ // https://stackoverflow.com/questions/72408463/use-props-in-composables-vue3
171
+ const { v, customValidators } = toRefs(props);
172
+
173
+ const { isValidation, invalid, validationText } = useValidation({
174
+ v,
175
+ customValidators,
176
+ });
177
+
153
178
  const clearValue = () => {
154
179
  emit('input', null);
155
180
 
@@ -256,6 +281,18 @@ const clearValue = () => {
256
281
  }
257
282
  }
258
283
 
284
+ .wt-datepicker--invalid :deep(.dp__main) {
285
+ .dp__input {
286
+ outline: none; // prevent outline overlapping false color
287
+ border-color: var(--wt-text-field-input-border-error-color);
288
+ color: var(--wt-text-field-error-text-color);
289
+ }
290
+
291
+ .dp__input_icon {
292
+ --icon-color: var(--wt-text-field-input-border-error-color);
293
+ }
294
+ }
295
+
259
296
  .datepicker__timepicker {
260
297
  display: flex;
261
298
  align-items: center;