@webitel/ui-sdk 25.6.25 → 25.6.27

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.
Files changed (40) hide show
  1. package/dist/types/components/wt-button/wt-button.vue.d.ts +51 -87
  2. package/dist/types/components/wt-empty/wt-empty.vue.d.ts +2 -2
  3. package/dist/types/components/wt-popover/wt-popover.vue.d.ts +56 -0
  4. package/dist/types/components/wt-select/wt-select-v2.vue.d.ts +20 -0
  5. package/dist/types/components/wt-select/wt-select.vue.d.ts +2 -0
  6. package/dist/types/enums/ButtonColor/ButtonColor.d.ts +10 -0
  7. package/dist/types/enums/index.d.ts +2 -1
  8. package/dist/types/install.d.ts +1 -0
  9. package/dist/ui-sdk.css +1 -1
  10. package/dist/ui-sdk.js +26162 -17575
  11. package/dist/ui-sdk.umd.cjs +1631 -19
  12. package/package.json +5 -1
  13. package/src/api/transformers/addQueryParamsToUrl/addQueryParamsToUrl.transformer.js +19 -0
  14. package/src/api/transformers/index.js +2 -0
  15. package/src/components/index.js +3 -0
  16. package/src/components/wt-button/wt-button.vue +80 -238
  17. package/src/components/wt-popover/wt-popover.vue +45 -0
  18. package/src/components/wt-select/wt-select-v2.vue +278 -0
  19. package/src/components/wt-select/wt-select.vue +10 -5
  20. package/src/css/main.scss +1 -0
  21. package/src/css/tailwind.css +1 -0
  22. package/src/enums/ButtonColor/ButtonColor.js +9 -0
  23. package/src/enums/ButtonColor/ButtonColor.ts +11 -0
  24. package/src/enums/index.js +2 -0
  25. package/src/enums/index.ts +2 -0
  26. package/src/install.ts +3 -0
  27. package/src/plugins/primevue/primevue.plugin.js +34 -0
  28. package/src/plugins/primevue/theme/components/autocomplete/autocomplete.js +35 -0
  29. package/src/plugins/primevue/theme/components/button/button.js +175 -0
  30. package/src/plugins/primevue/theme/components/components.js +13 -0
  31. package/src/plugins/primevue/theme/components/popover/popover.js +11 -0
  32. package/src/plugins/primevue/theme/components/tooltip/tooltip.js +9 -0
  33. package/src/plugins/primevue/theme/extend/extend.js +7 -0
  34. package/src/plugins/primevue/theme/extend/spacings/spacings.js +15 -0
  35. package/src/plugins/primevue/theme/semantic/color-scheme/color-schema.js +16 -0
  36. package/src/plugins/primevue/theme/semantic/color-scheme/dark-color.js +198 -0
  37. package/src/plugins/primevue/theme/semantic/color-scheme/light-color.js +198 -0
  38. package/src/plugins/primevue/theme/semantic/color-scheme/palette.js +516 -0
  39. package/src/plugins/primevue/theme/semantic/semantic.js +7 -0
  40. package/src/plugins/primevue/theme/webitel-theme.js +16 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "25.6.25",
3
+ "version": "25.6.27",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "npm run docs:dev",
@@ -82,6 +82,8 @@
82
82
  "dependencies": {
83
83
  "@floating-ui/vue": "^1.1.6",
84
84
  "@morev/vue-transitions": "^3.0.5",
85
+ "@primeuix/themes": "^1.1.1",
86
+ "@tailwindcss/vite": "^4.1.7",
85
87
  "@vuelidate/core": "^2.0.3",
86
88
  "@vuelidate/validators": "^2.0.4",
87
89
  "@vuepic/vue-datepicker": "^4.5.1",
@@ -105,8 +107,10 @@
105
107
  "mitt": "^3.0.1",
106
108
  "path-browserify": "^1.0.1",
107
109
  "plyr": "^3.7.8",
110
+ "primevue": "^4.3.4",
108
111
  "query-string": "^9.1.1",
109
112
  "sortablejs": "^1.15.3",
113
+ "tailwindcss": "^4.1.7",
110
114
  "vue-i18n": "^11.1.2",
111
115
  "vue-multiselect": "^3.1.0",
112
116
  "vue-observe-visibility": "^2.0.0-alpha.1",
@@ -0,0 +1,19 @@
1
+ // @author @stanislav-kozak
2
+ // This function adds query parameters to a given URL.
3
+ // Where queryArray is an array of query parameters in the format 'key=value'.
4
+ const addQueryParamsToUrl = (queryArray) => (url) => {
5
+ let modifyUrl = url;
6
+
7
+ if (queryArray && queryArray.length > 0) {
8
+ if (modifyUrl.includes('?')) {
9
+ modifyUrl += '&' + queryArray.join('&');
10
+
11
+ return modifyUrl;
12
+ }
13
+
14
+ modifyUrl += '?' + queryArray.join('&');
15
+ }
16
+
17
+ return modifyUrl;
18
+ };
19
+ export default addQueryParamsToUrl;
@@ -1,3 +1,4 @@
1
+ import addQueryParamsToUrl from './addQueryParamsToUrl/addQueryParamsToUrl.transformer.js';
1
2
  import applyTransform from './applyTransform.js';
2
3
  import camelToSnake from './camelToSnake/camelToSnake.transformer.js';
3
4
  import generateUrl from './generateUrl/generateUrl.transformer.js';
@@ -11,6 +12,7 @@ import snakeToCamel from './snakeToCamel/snakeToCamel.transformer.js';
11
12
  import starToSearch from './starToSearch/starToSearch.transformer.js';
12
13
 
13
14
  export {
15
+ addQueryParamsToUrl,
14
16
  camelToSnake,
15
17
  generateUrl,
16
18
  log,
@@ -47,6 +47,7 @@ import WtPageHeader from './wt-page-header/wt-page-header.vue';
47
47
  import WtPageWrapper from './wt-page-wrapper/wt-page-wrapper.vue';
48
48
  import WtPagination from './wt-pagination/wt-pagination.vue';
49
49
  import WtPlayer from './wt-player/wt-player.vue';
50
+ import WtPopover from './wt-popover/wt-popover.vue';
50
51
  import WtPopup from './wt-popup/wt-popup.vue';
51
52
  import WtProgressBar from './wt-progress-bar/wt-progress-bar.vue';
52
53
  import WtRadio from './wt-radio/wt-radio.vue';
@@ -120,6 +121,7 @@ const Components = {
120
121
  WtDualPanel,
121
122
  WtPagination,
122
123
  WtPlayer,
124
+ WtPopover,
123
125
  WtStatusSelect,
124
126
  WtTable,
125
127
  WtTree,
@@ -187,6 +189,7 @@ export {
187
189
  WtPageWrapper,
188
190
  WtPagination,
189
191
  WtPlayer,
192
+ WtPopover,
190
193
  WtPopup,
191
194
  WtProgressBar,
192
195
  WtRadio,
@@ -1,22 +1,19 @@
1
1
  <template>
2
- <button
3
- type="button"
2
+ <p-button
3
+ v-bind="$attrs"
4
+ :severity="color"
4
5
  :disabled="disabled"
5
- :class="[
6
- colorClass,
7
- `wt-button--size-${size}`,
8
- {
9
- 'wt-button--width-by-content': widthByContent,
10
- 'wt-button--contains-icon': containsIcon,
11
- 'wt-button--wide': wide,
12
- 'wt-button--disabled': disabled,
13
- 'wt-button--loading': showLoader,
14
- },
15
- ]"
16
- class="wt-button"
17
- @click="$emit('click', $event)"
6
+ :loading="showLoader"
7
+ :size="primevueSizeMap[size]"
8
+ class="wt-button mt-2"
9
+ :class="{
10
+ 'p-button--width-by-content': widthByContent,
11
+ 'p-button--contains-icon': containsIcon,
12
+ 'p-button--wide': wide,
13
+ 'p-button--loading': showLoader,
14
+ }"
15
+ @click.prevent="emit('click', $event)"
18
16
  >
19
- <!-- Show loader and button contents at the same time to prevent width shift if content > min-width of button -->
20
17
  <wt-loader
21
18
  v-if="showLoader"
22
19
  :color="loaderColor"
@@ -25,231 +22,76 @@
25
22
  <div class="wt-button__contents">
26
23
  <slot> no content provided</slot>
27
24
  </div>
28
- </button>
25
+ </p-button>
29
26
  </template>
30
27
 
31
- <script>
32
- export default {
33
- name: 'WtButton',
34
- props: {
35
- /**
36
- * @values 'primary', 'secondary', 'success', 'error', 'transfer', 'job', 'info'
37
- * @example <wt-button color="success"></wt-button>
38
- */
39
- color: {
40
- type: String,
41
- default: 'primary',
42
- },
43
- disabled: {
44
- type: Boolean,
45
- default: false,
46
- },
47
- loading: {
48
- type: Boolean,
49
- default: false,
50
- },
51
- /**
52
- * @values 'sm', 'md'
53
- * @example <wt-button size="sm"></wt-button>
54
- */
55
- size: {
56
- type: String,
57
- default: 'md',
58
- options: ['sm', 'md'],
59
- },
60
- /**
61
- * Stretches button to all available width
62
- */
63
- wide: {
64
- type: Boolean,
65
- default: false,
66
- },
67
- /**
68
- * Shrinks button to content width
69
- */
70
- widthByContent: {
71
- type: Boolean,
72
- default: false,
73
- },
74
- /**
75
- * sets wt-button line-height to 0 to prevent height changing: [stack overflow](https://stackoverflow.com/a/11126701)
76
- */
77
- containsIcon: {
78
- type: Boolean,
79
- default: false,
80
- description: 'https://stackoverflow.com/a/11126701',
81
- },
82
- },
83
- emits: ['click'],
84
- data: () => ({
85
- showLoader: false,
86
- }),
87
- computed: {
88
- colorClass() {
89
- if (!this.disabled) return `${this.color}`;
90
- return '';
91
- },
92
- loaderColor() {
93
- return 'on-dark';
94
- // if (['success', 'transfer', 'error', 'job'].includes(this.color)) return 'on-dark';
95
- // return 'on-light';
96
- },
97
- },
98
- watch: {
99
- loading: {
100
- immediate: true,
101
- handler(value) {
102
- if (value) {
103
- this.showLoader = true;
104
- } else {
105
- setTimeout(() => {
106
- this.showLoader = value;
107
- }, 1000); // why 1s? https://ux.stackexchange.com/a/104782
108
- }
109
- },
110
- },
111
- },
112
- };
113
- </script>
114
-
115
- <style lang="scss">
116
- @use './variables.scss';
117
- </style>
118
-
119
- <style lang="scss" scoped>
120
- @use '@webitel/styleguide/typography' as *;
121
-
122
- .wt-button {
123
- cursor: pointer;
124
- background-clip: padding-box;
125
- @extend %typo-button;
126
- display: inline-block;
127
- position: relative;
128
- transition: var(--transition);
129
- box-sizing: border-box;
130
- border-radius: var(--border-radius);
131
- background-color: var(--btn-primary-color);
132
- padding: var(--btn-padding);
133
- min-width: var(--btn-min-width);
134
- color: var(--btn-primary-text-color);
135
-
136
- &__contents {
137
- display: contents;
138
- }
139
-
140
- .wt-loader {
141
- position: absolute;
142
- top: 50%;
143
- left: 50%;
144
- transform: translate(-50%, -50%);
145
- }
146
-
147
- &--wide {
148
- width: 100%;
149
- }
150
-
151
- &--width-by-content {
152
- min-width: 0;
153
- }
154
-
155
- // https://stackoverflow.com/a/11126701
156
- &--contains-icon {
157
- line-height: 0;
158
- }
159
-
160
- &--loading {
161
- pointer-events: none;
162
-
163
- .wt-button__contents {
164
- visibility: hidden;
165
- }
166
- }
167
-
168
- &--size {
169
- &-sm {
170
- padding: var(--btn-padding--size-sm);
171
- }
172
-
173
- &-md {
174
- padding: var(--btn-padding);
175
- }
176
- }
28
+ <script setup lang="ts">
29
+ import { computed, defineEmits, defineProps, ref, watch } from 'vue';
177
30
 
178
- &:hover,
179
- &:active {
180
- background-color: var(--btn-primary-hover-color);
181
- }
31
+ import { ButtonColor,ComponentSize } from '../../enums';
182
32
 
183
- &.secondary {
184
- background-color: var(--btn-secondary-color);
185
- color: var(--btn-secondary-text-color);
186
-
187
- &:hover,
188
- &:active {
189
- background-color: var(--btn-secondary-hover-color);
190
- }
191
- }
192
-
193
- &.success {
194
- background-color: var(--btn-success-color);
195
- color: var(--btn-success-text-color);
196
-
197
- &:hover,
198
- &:active {
199
- background-color: var(--btn-success-hover-color);
200
- }
201
- }
202
-
203
- &.info {
204
- background-color: var(--btn-info-color);
205
- color: var(--btn-info-text-color);
206
-
207
- &:hover,
208
- &:active {
209
- background-color: var(--btn-info-hover-color);
210
- }
211
- }
212
-
213
- &.job {
214
- background-color: var(--btn-job-color);
215
- color: var(--btn-job-text-color);
216
-
217
- &:hover,
218
- &:active {
219
- background-color: var(--btn-job-hover-color);
220
- }
221
- }
222
-
223
- &.transfer {
224
- background-color: var(--btn-transfer-color);
225
- color: var(--btn-transfer-text-color);
226
-
227
- &:hover,
228
- &:active {
229
- background-color: var(--btn-transfer-hover-color);
230
- }
231
- }
232
-
233
- &.error {
234
- background-color: var(--btn-error-color);
235
- color: var(--btn-error-text-color);
33
+ const primevueSizeMap = {
34
+ [ComponentSize.SM]: 'small',
35
+ [ComponentSize.MD]: 'medium',
36
+ };
236
37
 
237
- &:hover,
238
- &:active {
239
- background-color: var(--btn-error-hover-color);
38
+ const props = withDefaults(defineProps<{
39
+ /**
40
+ * @values 'primary', 'secondary', 'success', 'error', 'transfer', 'job', 'info'
41
+ * @example <wt-button color="success"></wt-button>
42
+ */
43
+ color?: ButtonColor;
44
+ disabled?: boolean;
45
+ loading?: boolean;
46
+ /**
47
+ * @values 'sm', 'md'
48
+ * @example <wt-button size="sm"></wt-button>
49
+ */
50
+ size?: ComponentSize;
51
+ /**
52
+ * Stretches button to all available width
53
+ */
54
+ wide?: boolean;
55
+ /**
56
+ * Shrinks button to content width
57
+ */
58
+ widthByContent?: boolean;
59
+ /**
60
+ * sets wt-button line-height to 0 to prevent height changing: [stack overflow](https://stackoverflow.com/a/11126701)
61
+ */
62
+ containsIcon?: boolean;
63
+ }>(), {
64
+ color: ButtonColor.PRIMARY,
65
+ disabled: false,
66
+ loading: false,
67
+ size: ComponentSize.MD,
68
+ wide: false,
69
+ widthByContent: false,
70
+ containsIcon: false,
71
+ });
72
+
73
+ const emit = defineEmits(['click']);
74
+
75
+ const showLoader = ref(false);
76
+
77
+ const loaderColor = computed(() => {
78
+ return 'on-dark';
79
+ // if (['success', 'transfer', 'error', 'job'].includes(props.color)) return 'on-dark';
80
+ // return 'on-light';
81
+ });
82
+
83
+ watch(
84
+ () => props.loading,
85
+ (value) => {
86
+ if (value) {
87
+ showLoader.value = true;
88
+ } else {
89
+ setTimeout(() => {
90
+ showLoader.value = value;
91
+ }, 1000); // why 1s? https://ux.stackexchange.com/a/104782
240
92
  }
241
- }
242
-
243
- &.wt-button--disabled {
244
- cursor: auto;
245
- box-shadow: none;
246
- background-color: var(--btn-disabled-color);
247
- pointer-events: none;
248
- color: var(--btn-disabled-text-color);
249
- }
250
-
251
- .wt-loader {
252
- margin: auto;
253
- }
254
- }
255
- </style>
93
+ }, {
94
+ immediate: true,
95
+ },
96
+ );
97
+ </script>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <popover
3
+ ref="innerPopover"
4
+ v-bind="attrs"
5
+ :append-to="appendTo"
6
+ :base-z-index="baseZIndex"
7
+ :auto-z-index="autoZIndex"
8
+ :breakpoints="breakpoints"
9
+ :dt="dt"
10
+ :pt="pt"
11
+ :pt-options="ptOptions"
12
+ :close-on-escape="closeOnEscape"
13
+ v-on="attrs"
14
+ >
15
+ <slot />
16
+ </popover>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import { PopoverEmitsOptions, PopoverProps } from 'primevue';
21
+ import Popover from 'primevue/popover';
22
+ import { defineExpose, useAttrs, useTemplateRef } from 'vue';
23
+
24
+ const attrs = useAttrs();
25
+ const innerPopover = useTemplateRef('innerPopover');
26
+
27
+ withDefaults(defineProps<PopoverProps>(), {
28
+ appendTo: 'body',
29
+ baseZIndex: 0,
30
+ autoZIndex: true,
31
+ breakpoints: null,
32
+ dt: null,
33
+ pt: null,
34
+ ptOptions: null,
35
+ closeOnEscape: true,
36
+ });
37
+ defineEmits<PopoverEmitsOptions>();
38
+
39
+ // Expose useful Popover methods
40
+ defineExpose({
41
+ toggle: (...args) => innerPopover.value?.toggle?.(...args),
42
+ show: (...args) => innerPopover.value?.show?.(...args),
43
+ hide: (...args) => innerPopover.value?.hide?.(...args),
44
+ });
45
+ </script>