its_ui_vite 0.0.3 → 0.0.4

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,10 @@ 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
52
  }
53
53
 
54
54
  slots: ['без имени']
@@ -58,8 +58,11 @@ slots: ['без имени']
58
58
 
59
59
  ```
60
60
  {
61
- tabs: Record<string, any> & { id: any, text: string }[],
61
+ tabs: Record<string, any> & { value: any, text: string }[],
62
62
  activeId: any, <!-- activeId должен быть в tabs -->
63
+ transformVal?: Boolean,
64
+ scroll?: Boolean,
65
+ animationType?: 'worm' | 'trail',
63
66
  }
64
67
  ```
65
68
 
@@ -68,13 +71,17 @@ slots: ['без имени']
68
71
  ```
69
72
  {
70
73
  <!-- реактивна -->
71
- status: 'static' | 'focus' | 'error' | 'success'
72
-
73
- width: string,
74
- type: string,
75
- name: string,
76
- placeholder: string,
77
- value: string,
74
+ status?: 'static' | 'focus' | 'error' | 'success',
75
+ <!-- для v-mode -->
76
+ modelValue?: '',
77
+
78
+ width?: string,
79
+ type?: string,
80
+ size?: 'lg' | 'md' | 'sm',
81
+ name?: string,
82
+ disabled?: Boolean,
83
+ placeholder?: string,
84
+ value?: string,
78
85
  }
79
86
 
80
87
  slots: ['successIcon' <!-- есть дефольное значение -->, 'errorIcon' <!-- есть дефольное значение -->, 'customIcon']
@@ -85,14 +92,16 @@ slots: ['successIcon' <!-- есть дефольное значение -->, 'er
85
92
 
86
93
  ```
87
94
  {
88
- variant: 'checkbox' | 'radio' | 'toggle'
89
95
  <!-- по сути 'sm' используется только в CSelect -->
90
- size: 'lg' | 'sm',
91
- checked: Boolean,
92
- disabled: Boolean,
93
- text: string,
94
- name:string,
95
- value: string,
96
+ size?: 'lg' | 'sm',
97
+ <!-- работает с v-mode, modelValue работает как checked в случае с checkbox и toggle, в случае с radio в нем value -->
98
+ modelValue?: Boolean,
99
+
100
+ variant?: 'checkbox' | 'radio' | 'toggle',
101
+ disabled?: Boolean,
102
+ text?: string,
103
+ name?:string,
104
+ value?: string,
96
105
  }
97
106
 
98
107
  slots: ['без имени' <!-- есть дефольное значение (props.text) -->]
@@ -104,7 +113,14 @@ slots: ['без имени' <!-- есть дефольное значение (p
104
113
  {
105
114
  options: Array,
106
115
  variant: 'default' | 'multiple',
107
- placeholder: string,
116
+ size?: 'lg' | 'md' | 'sm',
117
+ placeholder?: string,
118
+ disabled?: Boolean,
119
+ autocomplete?: Boolean,
120
+ selectAll?: Boolean,
121
+ width?: string,
122
+ locale?: string,
123
+ transformVal?: Boolean,
108
124
  }
109
125
  ```
110
126
 
@@ -112,8 +128,8 @@ slots: ['без имени' <!-- есть дефольное значение (p
112
128
 
113
129
  ```
114
130
  {
115
- position: 'top' | 'bottom',
116
- interactive: Boolean,
131
+ position?: 'top' | 'top_left' | 'top_right' | 'bottom' | 'bottom_left' | 'bottom_right',
132
+ interactive?: Boolean,
117
133
  }
118
134
 
119
135
  slots: ['icon' <!-- есть дефольное значение -->, 'content']
@@ -123,7 +139,7 @@ slots: ['icon' <!-- есть дефольное значение -->, 'content']
123
139
 
124
140
  ```
125
141
  {
126
- <!-- нет props -->
142
+ isShowTitle?: Boolean,
127
143
  }
128
144
 
129
145
  slots: ['title', 'content']
@@ -143,10 +159,10 @@ slots: ['без имени']
143
159
 
144
160
  ```
145
161
  {
146
- liveTime: number,
147
- variant: 'notification' | 'success' | 'error',
148
- width: string,
149
- text: string,
162
+ liveTime?: number,
163
+ variant?: 'notification' | 'success' | 'error',
164
+ width?: string,
165
+ text?: string,
150
166
  }
151
167
 
152
168
  slots: ['без имени' <!-- есть дефольное значение (props.text) -->]
@@ -161,7 +177,34 @@ slots: ['без имени' <!-- есть дефольное значение (p
161
177
 
162
178
  * Run container:
163
179
  ```shell
164
- docker run -d -p 3000:3000 --env-file .env its-ui-kit_vue-host
180
+ docker run -rm -p 3000:3000 --env-file .env its-ui-kit_vue-host --name its-ui-kit_vue-host
181
+ ```
182
+
183
+ * Run container in deattach mode:
184
+ ```shell
185
+ docker run -d -p 3000:3000 --env-file .env its-ui-kit_vue-host --name its-ui-kit_vue-host
186
+ ```
187
+
188
+ Откройте в браузере: http://localhost:3000
189
+
190
+ ## Deployment via Docker
191
+
192
+ * Build container:
193
+ ```shell
194
+ docker build -f Dockerfile -t its-ui-kit-3 .
195
+ ```
196
+
197
+ * Push to Docker registry:
198
+ ```shell
199
+ docker login https://ca-sim-docker.appmath.ru
200
+ docker tag its-ui-kit-3 ca-sim-docker.appmath.ru/its-ui-kit-3
201
+ docker push ca-sim-docker.appmath.ru/its-ui-kit-3
202
+ ```
203
+
204
+ * Use on client-side (as DevOps):
205
+ ```shell
206
+ docker login https://ca-sim-docker.appmath.ru
207
+ docker compose -f docker-compose-ui-kit-stage.yml up
165
208
  ```
166
209
 
167
- Откройте в браузере: http://localhost:3000
210
+ * 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.4",
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,5 +1,5 @@
1
1
  <template>
2
- <button :class="['c-btn', size, variant, color]" :disabled="disabled">
2
+ <button :class="['c-btn', size, variant, color, { active }]" :disabled="disabled">
3
3
  <div class="c-btn__container">
4
4
  <slot></slot>
5
5
  </div>
@@ -22,20 +22,26 @@ import { getPropValidator } from '../assets/js/helpers.js'
22
22
  type: String,
23
23
 
24
24
  default: "tonal",
25
- validator: getPropValidator('CButton', 'variant', ['tonal', 'outlined', 'text']),
25
+ validator: getPropValidator('CButton', 'variant', ['tonal', 'outlined', 'text', 'nav_item']),
26
26
  },
27
27
 
28
- disabled: {
28
+ color: {
29
+ type: String,
30
+
31
+ default: "green",
32
+ validator: getPropValidator('CButton', 'color', ['green', 'black']),
33
+ },
34
+
35
+ active: {
29
36
  type: Boolean,
30
37
 
31
38
  default: false,
32
39
  },
33
40
 
34
- color: {
35
- type: String,
41
+ disabled: {
42
+ type: Boolean,
36
43
 
37
- default: "green",
38
- validator: getPropValidator('CButton', 'color', ['green', 'black']),
44
+ default: false,
39
45
  },
40
46
  },
41
47
  }
@@ -57,6 +63,14 @@ import { getPropValidator } from '../assets/js/helpers.js'
57
63
  cursor: default;
58
64
  }
59
65
 
66
+ button,
67
+ input,
68
+ div,
69
+ a {
70
+ font-family: inherit;
71
+ font-weight: inherit;
72
+ }
73
+
60
74
  // prop.size
61
75
  &.lg {
62
76
  padding: 15px 70px;
@@ -144,6 +158,35 @@ import { getPropValidator } from '../assets/js/helpers.js'
144
158
  color: var(--bg-disable-color);
145
159
  }
146
160
  }
161
+
162
+ &.nav_item {
163
+ height: 46px;
164
+
165
+ padding: 0 12px;
166
+
167
+ border-radius: 0;
168
+
169
+ font-size: 14px;
170
+ line-height: 16px;
171
+ font-weight: 500;
172
+
173
+ background: transparent;
174
+ color: var(--white);
175
+
176
+ &.active {
177
+ background: var(--green-dark);
178
+ }
179
+
180
+ .c-btn__container {
181
+ display: flex;
182
+ align-items: center;
183
+ justify-content: flex-start;
184
+
185
+ height: 100%;
186
+
187
+ text-align: left;
188
+ }
189
+ }
147
190
  // ./prop.variant
148
191
  }
149
192
  </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
 
@@ -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 {
@@ -1,17 +1,28 @@
1
1
  <template>
2
2
  <div class="c-popup">
3
- <div class="c-popup__title">
4
- <slot name="title"></slot>
3
+ <div
4
+ v-if="isShowTitle"
5
+ class="c-popup__title"
6
+ >
7
+ <slot name="title">Label</slot>
5
8
  </div>
6
9
 
7
10
  <div class="c-popup__content">
8
- <slot name="content"></slot>
11
+ <slot name="content">Content goes here</slot>
9
12
  </div>
10
13
  </div>
11
14
  </template>
12
15
 
13
- <script setup lang="ts">
16
+ <script>
17
+ export default {
18
+ props: {
19
+ isShowTitle: {
20
+ type: Boolean,
14
21
 
22
+ default: true
23
+ }
24
+ }
25
+ }
15
26
  </script>
16
27
 
17
28
  <style lang="scss">
@@ -24,10 +35,20 @@
24
35
  background: var(--green-bg);
25
36
  box-shadow: var(--shadow);
26
37
 
38
+ button,
39
+ input,
40
+ div,
41
+ a {
42
+ font-family: inherit;
43
+ font-weight: inherit;
44
+ }
45
+
27
46
  &__title {
28
- height: 35px;
47
+ box-sizing: border-box;
48
+ min-height: 35px;
29
49
  width: 100%;
30
50
 
51
+ padding-bottom: 10px;
31
52
  border-bottom: 1px solid var(--green-medium);
32
53
 
33
54
  font-size: 16px;