adata-ui 0.1.32 → 0.1.35

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-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adata-ui",
3
- "version": "0.1.24",
3
+ "version": "0.1.33",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -13152,6 +13152,11 @@
13152
13152
  "integrity": "sha512-X1DFb6wxXpZLLqM9NX0Wm+4xoN6xAyJn8OwuiHsV0JJvLfD18Z+wbgJ1lM7ykTVINdu8v7Mu0gIzWMvnhKWBkA==",
13153
13153
  "dev": true
13154
13154
  },
13155
+ "flush-promises": {
13156
+ "version": "1.0.2",
13157
+ "resolved": "https://registry.npmjs.org/flush-promises/-/flush-promises-1.0.2.tgz",
13158
+ "integrity": "sha512-G0sYfLQERwKz4+4iOZYQEZVpOt9zQrlItIxQAAYAWpfby3gbHrx0osCHz5RLl/XoXevXk0xoN4hDFky/VV9TrA=="
13159
+ },
13155
13160
  "flush-write-stream": {
13156
13161
  "version": "1.1.1",
13157
13162
  "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.1.1.tgz",
@@ -25234,6 +25239,11 @@
25234
25239
  "resolved": "https://registry.npmjs.org/v-click-outside/-/v-click-outside-3.1.2.tgz",
25235
25240
  "integrity": "sha512-gMdRqfRE6m6XU6SiFi3dyBlFB2MWogiXpof8Aa3LQysrl9pzTndqp/iEaAphLoadaQUFnQ0ec6fLLaxr7LiY6A=="
25236
25241
  },
25242
+ "v-mask": {
25243
+ "version": "2.3.0",
25244
+ "resolved": "https://registry.npmjs.org/v-mask/-/v-mask-2.3.0.tgz",
25245
+ "integrity": "sha512-ap7pTtCTvj25CqX4VYXqudCBd0+XvYyhiiLbzWQQR7AMQosJ2+DPu0a94P9stk0EGmGcmYxJaPkFkfjD8hquWQ=="
25246
+ },
25237
25247
  "v8-compile-cache": {
25238
25248
  "version": "2.3.0",
25239
25249
  "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adata-ui",
3
- "version": "0.1.32",
3
+ "version": "0.1.35",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -15,9 +15,11 @@
15
15
  "@storybook/addons": "^6.4.14",
16
16
  "@storybook/theming": "^6.4.14",
17
17
  "core-js": "^3.6.5",
18
+ "flush-promises": "^1.0.2",
18
19
  "node-sass": "^5.0.0",
19
20
  "user": "0.0.0",
20
21
  "v-click-outside": "^3.1.2",
22
+ "v-mask": "^2.3.0",
21
23
  "vue": "^2.6.11",
22
24
  "vue-the-mask": "^0.11.1",
23
25
  "vue2-perfect-scrollbar": "^1.5.2"
package/src/App.vue CHANGED
@@ -1,13 +1,36 @@
1
1
  <template>
2
2
  <div id="app">
3
+ <!-- <text-field label="Пример" v-model="value" @input="inputHandle" @enterPressed="inputHandle" />-->
4
+ <search-text-field label="Пример2" v-model="value" @input="inputHandle" @enterPressed="inputHandle" :options="options" :optionFields="['id', 'name']" />
3
5
  </div>
4
6
  </template>
5
7
 
6
8
  <script>
7
9
 
10
+ // import TextField from "./components/TextField/TextField";
11
+ import SearchTextField from "./components/SearchTextField/SearchTextField";
12
+
8
13
  export default {
9
14
  name: 'App',
10
- components: {}
15
+ components: {
16
+ // TextField,
17
+ SearchTextField
18
+ },
19
+ data() {
20
+ return {
21
+ value: "",
22
+ options: [{
23
+ id: 1,
24
+ name: "reg"
25
+ }
26
+ ]
27
+ }
28
+ },
29
+ methods: {
30
+ inputHandle(val) {
31
+ console.log(val);
32
+ }
33
+ }
11
34
  }
12
35
  </script>
13
36
 
@@ -45,7 +45,7 @@
45
45
  font-size: 10px;
46
46
  line-height: 14px;
47
47
  color: #ff2e43;
48
- margin-top: 9px;
48
+ margin-top: 8px;
49
49
  display: flex;
50
50
  align-items: center;
51
51
  svg {
@@ -76,7 +76,6 @@
76
76
  @media(max-width: 1025px) {
77
77
  padding: 19px 36px 7px 12px;
78
78
  height: 40px;
79
- border: 1px solid #71757A;
80
79
  font-size: 12px;
81
80
  }
82
81
 
@@ -111,6 +110,7 @@
111
110
  }
112
111
 
113
112
  &.error {
113
+ border: 1px solid #FF2E43;
114
114
  background: #ff2e431f;
115
115
  }
116
116
  }
@@ -126,7 +126,7 @@
126
126
  line-height: 40px;
127
127
  transition: 0.3s;
128
128
  color: #71757A;
129
- font-size: 12px;
129
+ font-size: 14px;
130
130
  @media(max-width: 1025px) {
131
131
  left: 12px;
132
132
  font-size: 14px;
@@ -171,7 +171,7 @@
171
171
  }
172
172
 
173
173
  &__required {
174
- color: #FF000087;
174
+ color: #FF2E43;
175
175
  }
176
176
 
177
177
  &__options {
@@ -182,8 +182,7 @@
182
182
  background: #fff;
183
183
  z-index: 1000;
184
184
  border-radius: 2px;
185
- border: 1px solid #71757A;
186
- padding: 12px 0;
185
+ padding: 8px 0;
187
186
  @media(max-width: 1025px) {
188
187
  overflow: auto;
189
188
  }
@@ -202,7 +201,7 @@
202
201
  transition: 0.3s all;
203
202
  cursor: pointer;
204
203
  @media(max-width: 1025px) {
205
- font-size: 10px;
204
+ font-size: 12px;
206
205
  }
207
206
 
208
207
  &:hover {
@@ -218,7 +217,6 @@
218
217
  height: 40px;
219
218
  width: 40px;
220
219
  min-width: 40px;
221
- border: 1px solid #71757A;
222
220
  border-radius: 0 2px 2px 0;
223
221
  border-left: none;
224
222
  background: #FFCD33;
@@ -226,7 +224,6 @@
226
224
 
227
225
  &__input-mob-filter {
228
226
  background: #ffffff;
229
- border: 1px solid #71757A;
230
227
  border-bottom: none;
231
228
  box-sizing: border-box;
232
229
  border-radius: 2px;
@@ -262,6 +259,7 @@
262
259
  }
263
260
 
264
261
  &.error {
262
+ border: 1px solid #FF2E43;
265
263
  background: #ff2e431f;
266
264
  }
267
265
  }
@@ -50,7 +50,7 @@ export default {
50
50
  @media(max-width: 1025px) {
51
51
  width: 100%;
52
52
  font-weight: 400;
53
- font-size: 10px;
53
+ font-size: 12px;
54
54
  line-height: 16px;
55
55
  margin: 0 0 16px;
56
56
  }
@@ -2,15 +2,13 @@
2
2
  <component
3
3
  :class="[
4
4
  'btn',
5
- {'full-width': fullwidth},
6
- `btn-${variant}`,
7
- `size size-${size}`,
8
- `size-fz-${fontSize}`,
5
+ `btn_${variant}`,
6
+ `size_${size}`,
9
7
  ]"
10
8
  v-bind="$attrs"
11
9
  v-on="$listeners"
12
- :is="url ? 'nuxt-link' : 'button'"
13
- :to="url"
10
+ :is="url ? 'button' : 'button'"
11
+ :href="url"
14
12
  :event="event ? 'click' : ''"
15
13
  >
16
14
  <slot></slot>
@@ -20,7 +18,7 @@
20
18
 
21
19
  <script>
22
20
  export default {
23
- name: "BaseButton",
21
+ name: "AButton",
24
22
  props: {
25
23
  variant: {
26
24
  type: String,
@@ -31,20 +29,10 @@ export default {
31
29
  'white',
32
30
  'grey',
33
31
  'yellow',
34
- 'danger',
35
- 'success',
36
- 'primary-outlined',
37
- 'primary'
38
- ].includes(value)
39
- );
40
- },
41
- },
42
- fontSize: {
43
- type: String,
44
- validator: function (value) {
45
- return (
46
- [
47
- 'sm',
32
+ 'red',
33
+ 'green',
34
+ 'blue_outlined',
35
+ 'blue'
48
36
  ].includes(value)
49
37
  );
50
38
  },
@@ -57,28 +45,18 @@ export default {
57
45
  [
58
46
  'sm',
59
47
  'md',
60
- 'md-short',
61
- 'lg',
48
+ 'extra_sm',
62
49
  ].includes(value)
63
50
  );
64
51
  },
65
52
  },
66
- tag: {
67
- type: String,
68
- default: "button",
69
- },
70
53
  url: {
71
- type: [String, Boolean],
72
- default: false
54
+ type: String,
73
55
  },
74
56
  event: {
75
57
  type: Boolean,
76
58
  default: true
77
59
  },
78
- fullwidth: {
79
- type: Boolean,
80
- default: false
81
- },
82
60
  disabled: {
83
61
  type: Boolean,
84
62
  default: false
@@ -92,13 +70,15 @@ export default {
92
70
  .btn {
93
71
  cursor: pointer;
94
72
  border: none;
73
+ border-radius: 2px;
74
+ font-size: 14px;
95
75
 
96
- &:disabled {
97
- cursor: not-allowed;
76
+ @media screen and (max-width: 560px) {
77
+ width: 100%;
98
78
  }
99
79
 
100
- &.full-width {
101
- width: 100%;
80
+ svg {
81
+ margin-right: 8px;
102
82
  }
103
83
 
104
84
  &:disabled {
@@ -106,39 +86,21 @@ export default {
106
86
  }
107
87
 
108
88
  &.size {
109
- box-sizing: border-box;
110
-
111
- &-sm {
112
- padding: 6px 16px;
113
- font-size: 12px;
114
- line-height: 18px;
89
+ &_extra_sm {
90
+ padding: 2px 16px;
91
+ line-height: 20px;
115
92
  }
116
-
117
- &-md {
118
- padding: 8px 36px;
119
- font-size: 14px;
120
- line-height: 24px;
121
-
122
- &-short {
123
- padding: 8px 16px;
124
- font-size: 14px;
125
- line-height: 24px;
126
- }
93
+ &_sm {
94
+ padding: 6px 20px;
95
+ line-height: 20px;
127
96
  }
128
-
129
- &-lg {
130
- padding: 8px 40px;
131
- font-size: 14px;
97
+ &_md {
98
+ padding: 8px 30px;
132
99
  line-height: 24px;
133
100
  }
134
-
135
- &-fz-sm {
136
- font-size: 12px;
137
- line-height: 20px;
138
- }
139
101
  }
140
102
 
141
- &-grey {
103
+ &_grey {
142
104
  color: var(--newGray);
143
105
  border: 1px solid #9da3ac;
144
106
  background: #fff;
@@ -165,23 +127,23 @@ export default {
165
127
  }
166
128
  }
167
129
 
168
- &-yellow {
169
- background: #FFCD33;
130
+ &_yellow {
131
+ background: linear-gradient(236.46deg, #FFE364 -2.39%, #FBC920 79.1%);
170
132
  color: #333333;
171
133
 
172
134
  &:hover {
173
- background: rgba(255, 205, 51, 0.7);
135
+ background: linear-gradient(236.46deg, #FFE364 -2.39%, #FBC920 79.1%);
174
136
  }
175
137
 
176
138
  &:active {
177
- background: #fab619;
139
+ background: linear-gradient(236.46deg, #FFE364 -2.39%, #FBC920 79.1%);
178
140
  }
179
141
  }
180
142
 
181
- &-danger {
143
+ &_red {
182
144
  border: 1px solid #FF2E43;
183
145
  color: #FF2E43;
184
-
146
+ background-color: transparent;
185
147
  &:hover {
186
148
  background: #FF2E43;
187
149
  color: #fff;
@@ -193,7 +155,7 @@ export default {
193
155
  }
194
156
  }
195
157
 
196
- &-success {
158
+ &_green {
197
159
  background: #00B92D;
198
160
  color: #fff;
199
161
 
@@ -206,9 +168,10 @@ export default {
206
168
  }
207
169
  }
208
170
 
209
- &-primary-outlined {
171
+ &_blue_outlined {
210
172
  border: 1px solid #007AFF;
211
173
  color: #007AFF;
174
+ background-color: transparent;
212
175
 
213
176
  &:hover {
214
177
  background: #007AFF;
@@ -221,7 +184,7 @@ export default {
221
184
  }
222
185
  }
223
186
 
224
- &-primary {
187
+ &_blue {
225
188
  background: #1E88E5;
226
189
  color: #FFF;
227
190
 
@@ -236,6 +199,9 @@ export default {
236
199
  }
237
200
  }
238
201
 
239
- box-sizing: border-box;
202
+ box-sizing: border-box !important;
203
+ -webkit-box-sizing: border-box !important;
204
+ -moz-box-sizing: border-box !important;
205
+ -ms-box-sizing: border-box !important;
240
206
  }
241
207
  </style>
@@ -1,4 +1,4 @@
1
- import AButton from './BaseButton.vue'
1
+ import AButton from './AButton.vue'
2
2
  import { action } from "@storybook/addon-actions"
3
3
 
4
4
  export default {
@@ -11,12 +11,7 @@ export default {
11
11
  const Template = (args, { argTypes }) => ({
12
12
  components: { ASearchTextField },
13
13
  props: Object.keys(argTypes),
14
- template: '<a-search-text-field v-bind="$props" @enterPressed="enterPressed"></a-search-text-field>',
15
- methods: {
16
- enterPressed(){
17
- console.log('hihi')
18
- }
19
- }
14
+ template: '<a-search-text-field v-bind="$props" @enterPressed="enterPressed"></a-search-text-field>'
20
15
  })
21
16
 
22
17
  export const WithIcon = Template.bind({});
@@ -1,72 +1,40 @@
1
1
  <template>
2
- <div :class="[{magnifier: isWithIcon},{'magnifier-mobile': magnifierMob}]"
3
- class="adt-text-block"
2
+ <div class="adt-text-block"
4
3
  v-click-outside="onOutsideClick"
5
4
  @keydown.down.up.prevent="onUpOrDownClicked"
6
5
  >
7
- <div class="adt-text-block__field">
6
+ <div :class="['adt-text-block__field', { error: !!errorText }]">
8
7
  <input
9
- v-if="!mask"
10
8
  ref="input"
11
9
  :type="type"
12
- :value="value"
10
+ v-mask="mask"
11
+ v-model="value"
13
12
  :placeholder="placeholder"
14
13
  required
15
- @input="$emit('input', $event.target.value)"
16
- @keyup.enter="enterPressed"
14
+ @keyup.enter="pressedEnter"
15
+ @input="inputHandler"
17
16
  @focus="showAutocomplete = true"
18
17
  @click="$emit('showVTour')"
19
- :class="[
20
- {'adt-text-block__input-mob-search' : magnifierMob},
21
- {'adt-text-block__input-mob-filter' : forMobileFilter},
22
- {'adt-text-block__input': !forMobileFilter}
23
- ]"
24
- />
25
- <TheMask
26
- v-else
27
- ref="maskInput"
28
- :value="value"
29
- :mask="mask"
30
- :type="type"
31
- :masked="false"
32
- :placeholder="inputPlaceholder"
33
- required
34
- @input.native="$emit('input', $event.target.value)"
35
- @focus.native="showPlaceholder = true"
36
- @blur.native="showPlaceholder = false"
37
18
  class="adt-text-block__input"
38
19
  :class="{ error: !!errorText }"
39
-
40
20
  />
41
- <label
42
- :class="{
43
- 'adt-text-block__label-red' : !forMobileFilter && getIsError,
44
- 'adt-text-block__label' : !forMobileFilter && !getIsError,
45
- 'adt-text-block__label-mob-filter' : forMobileFilter,
46
- }"
47
- >
21
+ <label class="adt-text-block__label">
48
22
  {{ label }}
49
23
  </label>
50
- <div class="mobile mobile-magnifier" v-if="magnifierMob" @click="$emit('onMagnifierClick')">
51
- <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="magnifier">
52
- <path d="M13.95 13.95L10 10" stroke="#2C3E50" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round">
53
- </path>
54
- <circle cx="6.5" cy="6.5" r="4.5" stroke="#2C3E50"></circle>
55
- </svg>
56
- </div>
57
- <div class="adt-text-block__icon adt-text-block__magnifier" v-if="isWithIcon" @click="$emit('input', '')">
58
- <svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="magnifier">
59
- <path d="M13.95 13.95L10 10" stroke="#2C3E50" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round">
60
- </path>
61
- <circle cx="6.5" cy="6.5" r="4.5" stroke="#2C3E50"></circle>
62
- </svg>
63
- </div>
64
- <div class="adt-text-block__icon" v-if="clearable && value && value.length > 0" @click="$emit('input', '')">
24
+ <div class="adt-text-block__icon" v-if="clearable && value" @click="$emit('input', '')">
65
25
  <svg width="12" height="12" fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" id="clearIcon">
66
26
  <path d="M2 2l12 12m0-12L2 14" stroke="#2C3E50" stroke-linecap="round" stroke-linejoin="round"></path>
67
27
  </svg>
68
28
  </div>
69
29
  </div>
30
+ <div class="adt-text-block__error" v-if="!!errorText">
31
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" id="icon__attention">
32
+ <path d="M8.5 4C8.5 3.72386 8.27614 3.5 8 3.5C7.72386 3.5 7.5 3.72386 7.5 4H8.5ZM7.5 9C7.5 9.27614 7.72386 9.5 8 9.5C8.27614 9.5 8.5 9.27614 8.5 9H7.5ZM7.5 4V9H8.5V4H7.5Z" fill="#FF2E43"/>
33
+ <path d="M8.5 11C8.5 10.7239 8.27614 10.5 8 10.5C7.72386 10.5 7.5 10.7239 7.5 11H8.5ZM7.5 11.5C7.5 11.7761 7.72386 12 8 12C8.27614 12 8.5 11.7761 8.5 11.5H7.5ZM7.5 11V11.5H8.5V11H7.5Z" fill="#FF2E43"/>
34
+ <circle cx="8" cy="8" r="7" stroke="#FF2E43"/>
35
+ </svg>
36
+ {{ errorText }}
37
+ </div>
70
38
  <div class="adt-text-block__options search-options" v-show="options && options.length > 0 && showAutocomplete">
71
39
  <PerfectScrollbar>
72
40
  <div class="search-options__wrapper">
@@ -88,14 +56,15 @@
88
56
 
89
57
  <script>
90
58
  import '../../assets/style.scss';
91
- import {TheMask} from 'vue-the-mask';
59
+ import { VueMaskDirective } from "v-mask";
92
60
  import { PerfectScrollbar } from "vue2-perfect-scrollbar";
93
61
  import vClickOutside from "v-click-outside";
94
62
 
95
63
  export default {
96
64
  name: "SearchTextField",
97
65
  directives: {
98
- clickOutside: vClickOutside.directive
66
+ clickOutside: vClickOutside.directive,
67
+ mask: VueMaskDirective
99
68
  },
100
69
  props: {
101
70
  errorText: {
@@ -118,11 +87,6 @@ export default {
118
87
  type: String,
119
88
  default: "text",
120
89
  },
121
- value: {
122
- type: String,
123
- required: true,
124
- default: ""
125
- },
126
90
  clearable: {
127
91
  type: Boolean,
128
92
  default: false
@@ -131,14 +95,6 @@ export default {
131
95
  type: Boolean,
132
96
  default: false
133
97
  },
134
- magnifierMob: {
135
- type: Boolean,
136
- default: false
137
- },
138
- forMobileFilter: {
139
- type: Boolean,
140
- default: false
141
- },
142
98
  isTypeRequired: {
143
99
  type: Boolean,
144
100
  default: false
@@ -155,19 +111,15 @@ export default {
155
111
  type: Boolean,
156
112
  default: false
157
113
  },
158
- getIsError: {
159
- type: Boolean,
160
- default: false
161
- }
162
114
  },
163
115
  components: {
164
- PerfectScrollbar,
165
- TheMask
116
+ PerfectScrollbar
166
117
  },
167
118
  data() {
168
119
  return {
169
120
  showAutocomplete: false,
170
- showPlaceholder: false
121
+ showPlaceholder: false,
122
+ value: ""
171
123
  }
172
124
  },
173
125
  computed: {
@@ -176,8 +128,8 @@ export default {
176
128
  }
177
129
  },
178
130
  methods: {
179
- enterPressed() {
180
- this.$emit('enterPressed', this.showAutocomplete)
131
+ pressedEnter() {
132
+ this.$emit('enter', this.showAutocomplete, this.value);
181
133
  },
182
134
  onOutsideClick() {
183
135
  if (!this.isMobile) this.showAutocomplete = false
@@ -220,8 +172,8 @@ export default {
220
172
  autocompleteOption.setAttribute("id", 'searchVariant');
221
173
  return autocompleteOption.innerText;
222
174
  },
223
- inputHandler(e) {
224
- this.$emit('input', e.target.value);
175
+ inputHandler() {
176
+ this.$emit('input', this.value);
225
177
  this.showAutocomplete = true;
226
178
  },
227
179
  onAutocompleteOptionClick(option) {
@@ -10,12 +10,7 @@ export default {
10
10
  const Template = (args, { argTypes }) => ({
11
11
  components: { ATextField },
12
12
  props: Object.keys(argTypes),
13
- template: '<a-text-field v-bind="$props" @enterPressed="enterPressed"></a-text-field>',
14
- methods: {
15
- enterPressed(){
16
- console.log('hihi')
17
- }
18
- }
13
+ template: '<a-text-field v-bind="$props"></a-text-field>'
19
14
  })
20
15
 
21
16
  export const Clearable = Template.bind({});