mediacube-ui 0.1.23 → 0.1.24

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": "mediacube-ui",
3
- "version": "0.1.23",
3
+ "version": "0.1.24",
4
4
  "description": "Design system for Mediacube services",
5
5
  "author": "Mediacube",
6
6
  "private": false,
@@ -13,6 +13,7 @@
13
13
  "src/styles",
14
14
  "src/tokens",
15
15
  "src/utils",
16
+ "src/mixins",
16
17
  "src/elements/**/*.vue",
17
18
  "src/patterns/**/*.vue",
18
19
  "src/templates/**/*.vue",
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Миксин для работы ошибок с инпутами
3
+ * Возвращает поле errorText на основе массива errors
4
+ * is_error_visible - скрывает ошибки, если пользователь взаимодействует с полем
5
+ * для того, чтобы работало - прокидывать вызов метода toggleErrorVisible внутрь события изменения инпута
6
+ */
7
+
8
+ export default {
9
+ data: () => ({
10
+ is_error_visible: true,
11
+ }),
12
+ computed: {
13
+ errorText() {
14
+ if (this.errors === null || !this.errors.length || !this.is_error_visible) return null
15
+ return this.errors.join(', ')
16
+ },
17
+ },
18
+ watch: {
19
+ errors() {
20
+ this.is_error_visible = true
21
+ },
22
+ },
23
+ methods: {
24
+ toggleErrorVisible() {
25
+ this.is_error_visible = false
26
+ },
27
+ },
28
+ }