its_ui_vite 0.0.3 → 0.0.5

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/README.md CHANGED
@@ -45,10 +45,11 @@ export default {
45
45
 
46
46
  ```
47
47
  {
48
- size: 'lg' | 'md' | 'sm',
49
- variant: 'tonal' | 'outlined' | 'text',
50
- color: 'green' | 'black',
51
- disabled: Boolean,
48
+ size?: 'lg' | 'md' | 'sm',
49
+ variant?: 'tonal' | 'outlined' | 'text' | 'nav_item',
50
+ color?: 'green' | 'black',
51
+ disabled?: Boolean,
52
+ loading?: Boolean,
52
53
  }
53
54
 
54
55
  slots: ['без имени']
@@ -58,8 +59,11 @@ slots: ['без имени']
58
59
 
59
60
  ```
60
61
  {
61
- tabs: Record<string, any> & { id: any, text: string }[],
62
+ tabs: Record<string, any> & { value: any, text: string }[],
62
63
  activeId: any, <!-- activeId должен быть в tabs -->
64
+ transformVal?: Boolean,
65
+ scroll?: Boolean,
66
+ animationType?: 'worm' | 'trail',
63
67
  }
64
68
  ```
65
69
 
@@ -68,13 +72,17 @@ slots: ['без имени']
68
72
  ```
69
73
  {
70
74
  <!-- реактивна -->
71
- status: 'static' | 'focus' | 'error' | 'success'
72
-
73
- width: string,
74
- type: string,
75
- name: string,
76
- placeholder: string,
77
- value: string,
75
+ status?: 'static' | 'focus' | 'error' | 'success',
76
+ <!-- для v-mode -->
77
+ modelValue?: '',
78
+
79
+ width?: string,
80
+ type?: string,
81
+ size?: 'lg' | 'md' | 'sm',
82
+ name?: string,
83
+ disabled?: Boolean,
84
+ placeholder?: string,
85
+ value?: string,
78
86
  }
79
87
 
80
88
  slots: ['successIcon' <!-- есть дефольное значение -->, 'errorIcon' <!-- есть дефольное значение -->, 'customIcon']
@@ -85,14 +93,16 @@ slots: ['successIcon' <!-- есть дефольное значение -->, 'er
85
93
 
86
94
  ```
87
95
  {
88
- variant: 'checkbox' | 'radio' | 'toggle'
89
96
  <!-- по сути 'sm' используется только в CSelect -->
90
- size: 'lg' | 'sm',
91
- checked: Boolean,
92
- disabled: Boolean,
93
- text: string,
94
- name:string,
95
- value: string,
97
+ size?: 'lg' | 'sm',
98
+ <!-- работает с v-mode, modelValue работает как checked в случае с checkbox и toggle, в случае с radio в нем value -->
99
+ modelValue?: Boolean,
100
+
101
+ variant?: 'checkbox' | 'radio' | 'toggle',
102
+ disabled?: Boolean,
103
+ text?: string,
104
+ name?:string,
105
+ value?: string,
96
106
  }
97
107
 
98
108
  slots: ['без имени' <!-- есть дефольное значение (props.text) -->]
@@ -104,7 +114,14 @@ slots: ['без имени' <!-- есть дефольное значение (p
104
114
  {
105
115
  options: Array,
106
116
  variant: 'default' | 'multiple',
107
- placeholder: string,
117
+ size?: 'lg' | 'md' | 'sm',
118
+ placeholder?: string,
119
+ disabled?: Boolean,
120
+ autocomplete?: Boolean,
121
+ selectAll?: Boolean,
122
+ width?: string,
123
+ locale?: string,
124
+ transformVal?: Boolean,
108
125
  }
109
126
  ```
110
127
 
@@ -112,8 +129,8 @@ slots: ['без имени' <!-- есть дефольное значение (p
112
129
 
113
130
  ```
114
131
  {
115
- position: 'top' | 'bottom',
116
- interactive: Boolean,
132
+ position?: 'top' | 'top_left' | 'top_right' | 'bottom' | 'bottom_left' | 'bottom_right',
133
+ interactive?: Boolean,
117
134
  }
118
135
 
119
136
  slots: ['icon' <!-- есть дефольное значение -->, 'content']
@@ -123,7 +140,7 @@ slots: ['icon' <!-- есть дефольное значение -->, 'content']
123
140
 
124
141
  ```
125
142
  {
126
- <!-- нет props -->
143
+ isShowTitle?: Boolean,
127
144
  }
128
145
 
129
146
  slots: ['title', 'content']
@@ -143,10 +160,10 @@ slots: ['без имени']
143
160
 
144
161
  ```
145
162
  {
146
- liveTime: number,
147
- variant: 'notification' | 'success' | 'error',
148
- width: string,
149
- text: string,
163
+ liveTime?: number,
164
+ variant?: 'notification' | 'success' | 'error',
165
+ width?: string,
166
+ text?: string,
150
167
  }
151
168
 
152
169
  slots: ['без имени' <!-- есть дефольное значение (props.text) -->]
@@ -161,7 +178,34 @@ slots: ['без имени' <!-- есть дефольное значение (p
161
178
 
162
179
  * Run container:
163
180
  ```shell
164
- docker run -d -p 3000:3000 --env-file .env its-ui-kit_vue-host
181
+ docker run -rm -p 3000:3000 --env-file .env its-ui-kit_vue-host --name its-ui-kit_vue-host
182
+ ```
183
+
184
+ * Run container in deattach mode:
185
+ ```shell
186
+ docker run -d -p 3000:3000 --env-file .env its-ui-kit_vue-host --name its-ui-kit_vue-host
187
+ ```
188
+
189
+ Откройте в браузере: http://localhost:3000
190
+
191
+ ## Deployment via Docker
192
+
193
+ * Build container:
194
+ ```shell
195
+ docker build -f Dockerfile -t its-ui-kit-3 .
196
+ ```
197
+
198
+ * Push to Docker registry:
199
+ ```shell
200
+ docker login https://ca-sim-docker.appmath.ru
201
+ docker tag its-ui-kit-3 ca-sim-docker.appmath.ru/its-ui-kit-3
202
+ docker push ca-sim-docker.appmath.ru/its-ui-kit-3
203
+ ```
204
+
205
+ * Use on client-side (as DevOps):
206
+ ```shell
207
+ docker login https://ca-sim-docker.appmath.ru
208
+ docker compose -f docker-compose-ui-kit-stage.yml up
165
209
  ```
166
210
 
167
- Откройте в браузере: http://localhost:3000
211
+ * Navigate to http://localhost:28000 (exposed by Docker compose file) to see UI Kit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "its_ui_vite",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "main": "./src/libIndex.js",
5
5
  "module": "./src/libIndex.js",
6
6
  "files": [
@@ -22,8 +22,26 @@ export function fixDblEvent(foo) {
22
22
  return (...arg) => {
23
23
  clearTimeout(timer)
24
24
  timer = setTimeout(() => {
25
- console.log('fixDblEvent');
26
25
  foo(...arg)
27
26
  }, 10)
28
27
  }
28
+ }
29
+
30
+ /**
31
+ * @description проверка на телефон
32
+ */
33
+ export function isMobile() {
34
+ const toMatch = [
35
+ /Android/i,
36
+ /webOS/i,
37
+ /iPhone/i,
38
+ /iPad/i,
39
+ /iPod/i,
40
+ /BlackBerry/i,
41
+ /Windows Phone/i
42
+ ];
43
+
44
+ return toMatch.some((toMatchItem) => {
45
+ return navigator.userAgent.match(toMatchItem);
46
+ });
29
47
  }
@@ -186,6 +186,14 @@ export default {
186
186
 
187
187
  transition: var(--transition);
188
188
 
189
+ button,
190
+ input,
191
+ div,
192
+ a {
193
+ font-family: inherit;
194
+ font-weight: inherit;
195
+ }
196
+
189
197
  // prop.variant
190
198
  &.notification {
191
199
  border: 1px solid var(--orange-dark);
@@ -1,15 +1,33 @@
1
1
  <template>
2
- <button :class="['c-btn', size, variant, color]" :disabled="disabled">
2
+ <button :class="['c-btn', size, variant, color, { active, loading }]" :disabled="disabled">
3
3
  <div class="c-btn__container">
4
4
  <slot></slot>
5
5
  </div>
6
+ <div class="c-btn__loading">
7
+ <CIcon
8
+ iconId="loading"
9
+ :size="loadingSize[size]"
10
+ />
11
+ </div>
6
12
  </button>
7
13
  </template>
8
14
 
9
15
  <script>
16
+ import CIcon from './CIcons/index.vue'
17
+
10
18
  import { getPropValidator } from '../assets/js/helpers.js'
11
19
 
12
20
  export default {
21
+ data() {
22
+ return {
23
+ loadingSize: {
24
+ lg: 24,
25
+ md: 20,
26
+ sm: 16,
27
+ }
28
+ }
29
+ },
30
+
13
31
  props: {
14
32
  size: {
15
33
  type: String,
@@ -22,22 +40,38 @@ import { getPropValidator } from '../assets/js/helpers.js'
22
40
  type: String,
23
41
 
24
42
  default: "tonal",
25
- validator: getPropValidator('CButton', 'variant', ['tonal', 'outlined', 'text']),
43
+ validator: getPropValidator('CButton', 'variant', ['tonal', 'outlined', 'text', 'nav_item']),
26
44
  },
27
45
 
28
- disabled: {
46
+ color: {
47
+ type: String,
48
+
49
+ default: "green",
50
+ validator: getPropValidator('CButton', 'color', ['green', 'black']),
51
+ },
52
+
53
+ active: {
29
54
  type: Boolean,
30
55
 
31
56
  default: false,
32
57
  },
33
58
 
34
- color: {
35
- type: String,
59
+ disabled: {
60
+ type: Boolean,
36
61
 
37
- default: "green",
38
- validator: getPropValidator('CButton', 'color', ['green', 'black']),
62
+ default: false,
39
63
  },
64
+
65
+ loading: {
66
+ type: Boolean,
67
+
68
+ default: false,
69
+ }
40
70
  },
71
+
72
+ components: {
73
+ CIcon
74
+ }
41
75
  }
42
76
  </script>
43
77
 
@@ -45,6 +79,7 @@ import { getPropValidator } from '../assets/js/helpers.js'
45
79
  @import "../assets/scss/main.scss";
46
80
 
47
81
  .c-btn {
82
+ position: relative;
48
83
  border-radius: 30px;
49
84
 
50
85
  transition: var(--transition);
@@ -53,9 +88,34 @@ import { getPropValidator } from '../assets/js/helpers.js'
53
88
  outline: none;
54
89
  border: none;
55
90
 
91
+ // prop.disabled
56
92
  &:disabled {
57
93
  cursor: default;
58
94
  }
95
+ // ./prop.disabled
96
+
97
+ // ./prop.loading
98
+ &.loading {
99
+ pointer-events: none;
100
+
101
+ .c-btn__container {
102
+ opacity: 0;
103
+ pointer-events: none;
104
+ }
105
+
106
+ .c-btn__loading {
107
+ opacity: 1;
108
+ }
109
+ }
110
+ // ./prop.loading
111
+
112
+ button,
113
+ input,
114
+ div,
115
+ a {
116
+ font-family: inherit;
117
+ font-weight: inherit;
118
+ }
59
119
 
60
120
  // prop.size
61
121
  &.lg {
@@ -144,6 +204,61 @@ import { getPropValidator } from '../assets/js/helpers.js'
144
204
  color: var(--bg-disable-color);
145
205
  }
146
206
  }
207
+
208
+ &.nav_item {
209
+ height: 46px;
210
+
211
+ padding: 0 12px;
212
+
213
+ border-radius: 0;
214
+
215
+ font-size: 14px;
216
+ line-height: 16px;
217
+ font-weight: 500;
218
+
219
+ background: transparent;
220
+ color: var(--white);
221
+
222
+ &.active {
223
+ background: var(--green-dark);
224
+ }
225
+
226
+ .c-btn__container {
227
+ display: flex;
228
+ align-items: center;
229
+ justify-content: flex-start;
230
+
231
+ height: 100%;
232
+
233
+ text-align: left;
234
+ }
235
+ }
147
236
  // ./prop.variant
237
+
238
+ &__loading {
239
+ position: absolute;
240
+ left: 50%;
241
+ top: 50%;
242
+ transform: translate(-50%, -50%);
243
+ display: flex;
244
+ align-items: center;
245
+ justify-content: center;
246
+ opacity: 0;
247
+ pointer-events: none;
248
+
249
+ svg {
250
+ animation: animation-rotation steps(100) 1.5s infinite;
251
+ }
252
+ }
253
+ }
254
+
255
+ @keyframes animation-rotation {
256
+ 0% {
257
+ transform: rotate(0deg);
258
+ }
259
+
260
+ 100% {
261
+ transform: rotate(360deg);
262
+ }
148
263
  }
149
264
  </style>
@@ -3,12 +3,14 @@
3
3
  <input
4
4
  class="c-checkbox__inp"
5
5
  :type="variant === 'radio' ? 'radio' : 'checkbox'"
6
- :name="name"
7
- :value="value"
8
- :checked="checked"
6
+ :name="name"
7
+ :value="modelValue || value"
8
+ :checked="isRadio ? value === modelValue : modelValue"
9
9
  :disabled="disabled"
10
- @change="$emit('update:checked', $event.target.checked)"
10
+ @change="$emit('update:modelValue', isRadio ? value : $event.target.checked)"
11
11
  />
12
+ <!-- @change="(evt) => $emit('change', isRadio ? (modelValue || value) : evt.target.checked)" -->
13
+ <!-- @change="$emit('update:checked', $event.target.checked), $emit('update:modelValue', $event.target.value)" -->
12
14
 
13
15
  <div class="c-checkbox__checkmark"></div>
14
16
  <div class="c-checkbox__text">
@@ -22,10 +24,17 @@ import { getPropValidator } from '../assets/js/helpers.js'
22
24
 
23
25
  export default {
24
26
  name: 'CCheckbox',
25
- emits: ['update:checked'],
26
27
 
27
- props: {
28
+ data() {
29
+ return {
30
+ isRadio: this.variant === 'radio',
31
+ }
32
+ },
28
33
 
34
+ emits: ['update:checked', 'update:modelValue'],
35
+
36
+ props: {
37
+
29
38
  variant: {
30
39
  type: String,
31
40
 
@@ -41,12 +50,6 @@ export default {
41
50
  validator: getPropValidator('CCheckbox', 'size', ['lg', 'sm'])
42
51
  },
43
52
 
44
- checked: {
45
- type: Boolean,
46
-
47
- default: false,
48
- },
49
-
50
53
  disabled: {
51
54
  type: Boolean,
52
55
 
@@ -66,7 +69,11 @@ export default {
66
69
  },
67
70
 
68
71
  value: {
69
- type: String,
72
+ default: '',
73
+ },
74
+
75
+ modelValue: {
76
+ type: [Boolean, String, Number, Array],
70
77
 
71
78
  default: '',
72
79
  },
@@ -85,8 +92,6 @@ export default {
85
92
  --toggle-indentation: 1px;
86
93
  --toggle-padding: calc(var(--border-width) + var(--toggle-indentation) * 2);
87
94
 
88
- position: relative;
89
-
90
95
  display: flex;
91
96
  align-items: center;
92
97
 
@@ -94,6 +99,14 @@ export default {
94
99
 
95
100
  cursor: pointer;
96
101
 
102
+ button,
103
+ input,
104
+ div,
105
+ a {
106
+ font-family: inherit;
107
+ font-weight: inherit;
108
+ }
109
+
97
110
  &.disabled {
98
111
  cursor: default;
99
112
  }
@@ -102,10 +115,14 @@ export default {
102
115
  &.lg {
103
116
  --size: 28px;
104
117
  --toggle-size: 24px;
118
+
119
+ --font-size: 16px;
105
120
  }
106
121
 
107
122
  &.sm {
108
123
  --size: 20px;
124
+
125
+ --font-size: 14px;
109
126
  }
110
127
  // ./prop.size
111
128
 
@@ -132,7 +149,7 @@ export default {
132
149
  &~ .c-checkbox__checkmark {
133
150
 
134
151
  &::after {
135
- left: calc(var(--toggle-size) + var(--border-width) + var(--toggle-indentation)); // тоже самое что и left: 26px;
152
+ left: calc(var(--toggle-size) + var(--toggle-indentation)); // тоже самое что и left: 25px;
136
153
 
137
154
  background: var(--green-light);
138
155
  }
@@ -150,8 +167,8 @@ export default {
150
167
 
151
168
  &::after {
152
169
  position: absolute;
153
- left: 2px;
154
- top: 2px;
170
+ left: 1px;
171
+ top: 1px;
155
172
 
156
173
  width: var(--toggle-size);
157
174
  height: var(--toggle-size);
@@ -180,7 +197,7 @@ export default {
180
197
  }
181
198
 
182
199
  &~ .c-checkbox__text {
183
- color: var(--white);
200
+ color: var(--green-light);
184
201
  }
185
202
  }
186
203
 
@@ -205,6 +222,8 @@ export default {
205
222
  box-sizing: border-box;
206
223
  display: flex;
207
224
 
225
+ position: relative;
226
+
208
227
  width: var(--size);
209
228
  height: var(--size);
210
229
 
@@ -232,9 +251,9 @@ export default {
232
251
  }
233
252
 
234
253
  &__text {
235
- font-size: 16px;
254
+ font-size: var(--font-size);
236
255
 
237
- color: var(--green-medium);
256
+ color: var(--white);
238
257
  }
239
258
  }
240
259
 
@@ -36,6 +36,10 @@
36
36
  <path d="M12 16V16.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
37
37
  </svg>
38
38
 
39
+ <svg v-if="iconId === 'loading'" :width="w" :height="h" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
40
+ <path d="M10 0C8.68678 -1.489e-08 7.38642 0.258657 6.17317 0.761204C4.95991 1.26375 3.85752 2.00035 2.92893 2.92893C2.00035 3.85752 1.26375 4.95991 0.761204 6.17317C0.258657 7.38642 -1.489e-08 8.68678 0 10C-4.96335e-08 11.3132 0.258657 12.6136 0.761204 13.8268C1.26375 15.0401 2.00035 16.1425 2.92893 17.0711C3.85752 17.9997 4.95991 18.7362 6.17317 19.2388C7.38642 19.7413 8.68678 20 10 20C11.3132 20 12.6136 19.7413 13.8268 19.2388C15.0401 18.7362 16.1425 17.9997 17.0711 17.0711C17.9997 16.1425 18.7362 15.0401 19.2388 13.8268C19.7413 12.6136 20 11.3132 20 10C20 8.68678 19.7413 7.38642 19.2388 6.17317C18.7362 4.95991 17.9997 3.85752 17.0711 2.92893C16.1425 2.00035 15.0401 1.26375 13.8268 0.761204C12.6136 0.258657 11.3132 -4.96335e-08 10 0ZM10 1C11.314 1.00028 12.6119 1.28828 13.8027 1.84375L12.959 3.65625C12.0324 3.22403 11.0224 3.00003 10 3C8.97758 3.00003 7.96758 3.22403 7.04102 3.65625L6.19922 1.84961C7.38895 1.2924 8.68625 1.0024 10 1ZM10 4C10.7879 4 11.5681 4.15519 12.2961 4.45672C13.0241 4.75825 13.6855 5.20021 14.2426 5.75736C14.7998 6.31451 15.2417 6.97595 15.5433 7.7039C15.8448 8.43185 16 9.21207 16 10C16 10.7879 15.8448 11.5681 15.5433 12.2961C15.2417 13.0241 14.7998 13.6855 14.2426 14.2426C13.6855 14.7998 13.0241 15.2417 12.2961 15.5433C11.5681 15.8448 10.7879 16 10 16C8.4087 16 6.88258 15.3679 5.75736 14.2426C4.63214 13.1174 4 11.5913 4 10C4 8.4087 4.63214 6.88258 5.75736 5.75736C6.88258 4.63214 8.4087 4 10 4Z" fill="white"/>
41
+ </svg>
42
+
39
43
  </div>
40
44
  </template>
41
45
 
@@ -1,11 +1,12 @@
1
1
  <template>
2
- <div :class="['c-input__wrap', status]" :style="`--c-input-width: ${width}`">
2
+ <div :class="['c-input__wrap', status, size, {disabled}]" :style="`--c-input-width: ${width}`">
3
3
  <input
4
4
  class="c-input"
5
5
  :type="type"
6
6
  :name="name"
7
7
  :placeholder="placeholder"
8
8
  :value="modelValue"
9
+ :disabled="disabled"
9
10
  @input="$emit('update:modelValue', $event.target.value)"
10
11
  />
11
12
 
@@ -37,8 +38,8 @@ import { getPropValidator } from '../assets/js/helpers';
37
38
  components: {
38
39
  CIcon
39
40
  },
41
+
40
42
  props: {
41
-
42
43
  status: {
43
44
  type: String,
44
45
 
@@ -46,12 +47,23 @@ import { getPropValidator } from '../assets/js/helpers';
46
47
  validator: getPropValidator('CInput', 'status', ['static', 'focus'/* it rofls */, 'error', 'success'])
47
48
  },
48
49
 
50
+ size: {
51
+ type: String,
52
+
53
+ default: 'lg',
54
+ validator: getPropValidator('CInput', 'size', ['lg', 'md', 'sm'])
55
+ },
56
+
49
57
  width: {
50
58
  type: String,
51
59
 
52
60
  default: '350px'
53
61
  },
54
62
 
63
+ disabled: {
64
+ type: Boolean,
65
+ },
66
+
55
67
  type: {
56
68
  type: String,
57
69
 
@@ -71,8 +83,6 @@ import { getPropValidator } from '../assets/js/helpers';
71
83
  },
72
84
 
73
85
  modelValue: {
74
- type: String,
75
-
76
86
  default: '',
77
87
  }
78
88
  },
@@ -85,8 +95,8 @@ import { getPropValidator } from '../assets/js/helpers';
85
95
  box-sizing: border-box;
86
96
 
87
97
  width: var(--c-input-width);
88
- padding: 15px 25px;
89
- font-size: 21px;
98
+ padding: var(--padding);
99
+ font-size: inherit;
90
100
 
91
101
  outline: none;
92
102
  border: 1px solid var(--green-medium);
@@ -107,8 +117,28 @@ import { getPropValidator } from '../assets/js/helpers';
107
117
 
108
118
  &__wrap {
109
119
  position: relative;
120
+
121
+ min-width: var(--c-input-width);
122
+
123
+ font-size: var(--font-size);
124
+
125
+ button,
126
+ input,
127
+ div,
128
+ a {
129
+ font-family: inherit;
130
+ font-weight: inherit;
131
+ }
132
+
133
+ // prop.disabled
134
+ &.disabled {
135
+ opacity: 0.5;
136
+ pointer-events: none;
137
+ }
138
+ // ./prop.disabled
110
139
 
111
140
  // prop.status
141
+ &:hover .c-input,
112
142
  &.focus .c-input {
113
143
  border: 1px solid var(--green-light);
114
144
  }
@@ -143,6 +173,23 @@ import { getPropValidator } from '../assets/js/helpers';
143
173
  }
144
174
  }
145
175
  // ./prop.status
176
+
177
+ // prop.size
178
+ &.lg {
179
+ --padding: 15px 25px;
180
+ --font-size: 21px;
181
+ }
182
+
183
+ &.md {
184
+ --padding: 10px 17px;
185
+ --font-size: 21px;
186
+ }
187
+
188
+ &.sm {
189
+ --padding: 10px 12px;
190
+ --font-size: 14px;
191
+ }
192
+ // ./prop.size
146
193
  }
147
194
 
148
195
  &__icon {