@webitel/ui-sdk 25.10.22 → 25.10.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": "@webitel/ui-sdk",
3
- "version": "25.10.22",
3
+ "version": "25.10.24",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "make-all": "npm version patch --git-tag-version false && npm run build && (npm run build:types || true) && (npm run lint:fix || true) && npm run publish-lib",
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <div
3
+ class="wt-image"
3
4
  :style="{
4
5
  width,
5
6
  height,
@@ -7,24 +8,33 @@
7
8
  minHeight,
8
9
  maxWidth,
9
10
  maxHeight,
11
+ cursor: overlayIcon ? 'pointer' : 'auto'
10
12
  }"
11
- class="wt-image"
12
13
  >
13
14
  <!-- @slot Replaces `<img>` tag
14
15
  @scope `{ alt, src }`
15
16
  -->
16
17
  <slot v-bind="{ alt, src }">
17
- <img
18
+ <p-image
18
19
  :alt="alt"
19
20
  :src="src"
20
21
  class="wt-image__img"
21
22
  />
23
+ <div v-if="overlayIcon" class="wt-image__overlay-icon">
24
+ <wt-icon
25
+ :icon="overlayIcon"
26
+ :icon-prefix="overlayIconPrefix"
27
+ :color="IconColor.ON_DARK"
28
+ />
29
+ </div>
22
30
  </slot>
23
31
  </div>
24
32
  </template>
25
33
 
26
- <script setup>
27
- import { computed } from 'vue';
34
+ <script setup lang="ts">
35
+ import { computed, defineProps } from 'vue';
36
+
37
+ import { IconColor } from '../../enums';
28
38
 
29
39
  const sizeToUnits = {
30
40
  '3xs': '32px',
@@ -36,53 +46,21 @@ const sizeToUnits = {
36
46
  xl: '380px',
37
47
  '2xl': '512px',
38
48
  '3xl': '600px',
39
- };
40
-
41
- const props = defineProps({
42
- src: {
43
- type: [Object, String],
44
- required: true,
45
- },
46
- // все в одну лінію, бо повалиться дока
47
- /**
48
- * `'3xs': '32px', '2xs': '64px', 'xs': '92px', 'sm': '128px', 'md': '192px', 'lg': '256px', 'xl': '380px', '2xl': '512px', '3xl': '600px',`
49
- */
50
- size: {
51
- type: String,
52
- // default: 'md',
53
- // required: true,
54
- validator: (v) =>
55
- ['3xs', '2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl'].includes(v),
56
- },
57
- alt: {
58
- type: String,
59
- default: 'wt-image',
60
- },
61
- width: {
62
- type: [String, Number],
63
- },
64
- height: {
65
- type: [String, Number],
66
- },
67
- minWidth: {
68
- type: [String, Number],
69
- },
70
- minHeight: {
71
- type: [String, Number],
72
- },
73
- maxWidth: {
74
- type: [String, Number],
75
- },
76
- maxHeight: {
77
- type: [String, Number],
78
- },
79
- // aspectRatio: {
80
- // type: [String, Number, null],
81
- // default: 1,
82
- // },
83
- });
49
+ } as const;
84
50
 
85
- const emit = defineEmits([]);
51
+ const props = defineProps<{
52
+ src: string | object;
53
+ size?: keyof typeof sizeToUnits;
54
+ alt?: string;
55
+ width?: string | number;
56
+ height?: string | number;
57
+ minWidth?: string | number;
58
+ minHeight?: string | number;
59
+ maxWidth?: string | number;
60
+ maxHeight?: string | number;
61
+ overlayIcon?: string;
62
+ overlayIconPrefix?: string;
63
+ }>();
86
64
 
87
65
  const width = computed(() => {
88
66
  const width = props.size ? sizeToUnits[props.size] : props.width;
@@ -107,7 +85,8 @@ const height = computed(() => {
107
85
 
108
86
  return height;
109
87
  });
110
- </script>
88
+ </script>
89
+
111
90
 
112
91
  <style lang="scss" scoped>
113
92
  //@use '../../css/styleguide/styleguide';
@@ -116,10 +95,32 @@ const height = computed(() => {
116
95
  display: flex;
117
96
  justify-content: center;
118
97
  align-items: center;
98
+ position: relative;
119
99
 
120
100
  &__img {
101
+ display: inline-flex;
121
102
  max-width: 100%;
122
103
  max-height: 100%;
104
+ width: 100%;
105
+ height: auto;
106
+ }
107
+ }
108
+
109
+ .wt-image__overlay-icon {
110
+ opacity: 0;
111
+ display: flex;
112
+ justify-content: center;
113
+ align-items: center;
114
+ position: absolute;
115
+ top: 50%;
116
+ left: 50%;
117
+ width: 100%;
118
+ height: 100%;
119
+ transform: translate(-50%, -50%);
120
+ background: rgba(0, 0, 0, 0.25);
121
+
122
+ &:hover {
123
+ opacity: 1;
123
124
  }
124
125
  }
125
126
  </style>
@@ -2,6 +2,9 @@
2
2
  --wt-tree-item-active: var(--primary-light-color);
3
3
  --wt-tree-item-active-on: var(--grey-darken-4);
4
4
 
5
+ --wt-tree-item-searched: var(--light-blue-lighten-4);
6
+ --wt-tree-item-searched-on: var(--grey-darken-4);
7
+
5
8
  --wt-tree-item: var(--primary-light-color);
6
9
  --wt-tree-item-on: var(--grey-darken-1);
7
10
 
@@ -13,6 +16,9 @@
13
16
  --wt-tree-item-active: var(--primary-light-color);
14
17
  --wt-tree-item-active-on: var(--grey-lighten-4);
15
18
 
19
+ --wt-tree-item-searched: var(--light-blue-lighten-2);
20
+ --wt-tree-item-searched-on: var(--grey-darken-4);
21
+
16
22
  --wt-tree-item: var(--primary-light-color);
17
23
  --wt-tree-item-on: var(--grey-lighten-3);
18
24
 
@@ -1,5 +1,6 @@
1
1
  <template>
2
- <div class="wt-tree-line">
2
+ <div
3
+ class="wt-tree-line">
3
4
  <div class="wt-tree-line__icon-wrapper">
4
5
  <wt-icon
5
6
  v-for="(icon, index) in nestedIcons"
@@ -18,7 +19,10 @@
18
19
  />
19
20
  </div>
20
21
  <div
21
- :class="{ active: displayActiveState }"
22
+ :class="{
23
+ active: displayActiveState,
24
+ searched: props.data[props.searchedProp]
25
+ }"
22
26
  class="wt-tree-line__label-wrapper"
23
27
  @click="selectElement"
24
28
  >
@@ -347,6 +351,11 @@ watch(
347
351
  color: var(--wt-tree-item-hover-on);
348
352
  }
349
353
 
354
+ &.searched:not(.active) {
355
+ background: var(--wt-tree-item-searched);
356
+ color: var(--wt-tree-item-searched-on);
357
+ }
358
+
350
359
  &.active {
351
360
  background: var(--wt-tree-item-active);
352
361
  color: var(--wt-tree-item-active-on);
@@ -8,6 +8,7 @@ import PColumn from 'primevue/column';
8
8
  import PrimeVue from 'primevue/config';
9
9
  import PTable from 'primevue/datatable';
10
10
  import PDivider from 'primevue/divider';
11
+ import PImage from 'primevue/image';
11
12
  import PInputText from 'primevue/inputtext';
12
13
  import PMenubar from 'primevue/menubar';
13
14
  import PPopover from 'primevue/popover';
@@ -51,6 +52,7 @@ const initPrimevue = (app) => {
51
52
  app.component('PBreadcrumb', changeComponentCompatMode(PBreadcrumb));
52
53
  app.component('PSlider', changeComponentCompatMode(PSlider));
53
54
  app.component('PDivider', changeComponentCompatMode(PDivider));
55
+ app.component('PImage', changeComponentCompatMode(PImage));
54
56
 
55
57
  app.directive('tooltip', Tooltip);
56
58
  };
@@ -5,6 +5,7 @@ import button from './button/button.js';
5
5
  import checkbox from './checkbox/checkbox.js';
6
6
  import chip from './chip/chip.js';
7
7
  import divider from './divider/divider.js';
8
+ import image from './image/image.js';
8
9
  import menubar from './menubar/menubar.js';
9
10
  import popover from './popover/popover.js';
10
11
  import radio from './radio/radio.js';
@@ -23,6 +24,7 @@ const components = {
23
24
  checkbox,
24
25
  toggleswitch: switcher,
25
26
  divider,
27
+ image,
26
28
  menubar,
27
29
  popover,
28
30
  radiobutton: radio,
@@ -0,0 +1,11 @@
1
+ const image = {
2
+ css: () => `
3
+ .p-image img{
4
+ height: auto;
5
+ width: 100%;
6
+ object-fit: cover;
7
+ }
8
+ `
9
+ }
10
+
11
+ export default image
@@ -1,5 +1,15 @@
1
1
  import { TableScheme } from '@webitel/styleguide/component-schemes';
2
2
 
3
+ const rowStateStyles = (state, dt) => `
4
+ .p-datatable-tbody > tr.row-${state} {
5
+ background: ${dt(`datatable.row.${state}Background`)};
6
+ }
7
+
8
+ .p-datatable-tbody > tr.row-${state}:hover {
9
+ background: ${dt(`datatable.row.${state}HoverBackground`)};
10
+ }
11
+ `;
12
+
3
13
  const table = {
4
14
  ...TableScheme.sizes,
5
15
  colorScheme: TableScheme.colorScheme,
@@ -19,6 +29,10 @@ const table = {
19
29
  background: ${dt('datatable.row.hoverBackground')};
20
30
  }
21
31
 
32
+ ${rowStateStyles('error', dt)}
33
+ ${rowStateStyles('warning', dt)}
34
+ ${rowStateStyles('success', dt)}
35
+
22
36
  .p-datatable-scrollable .p-datatable-frozen-column:not(.p-datatable-header-cell) {
23
37
  background: ${dt('datatable.frozenColumn.background')};
24
38
  }
@@ -1,34 +1,48 @@
1
- declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
2
- export default _default;
3
- type __VLS_WithSlots<T, S> = T & (new () => {
4
- $slots: S;
5
- });
6
- declare const __VLS_component: import("vue").DefineComponent<{}, {
7
- $emit: (event: any, ...args: any[]) => void;
8
- alt: string;
9
- src: string | Record<string, any>;
10
- size?: string;
1
+ import { IconColor } from '../../enums';
2
+ declare const sizeToUnits: {
3
+ readonly '3xs': "32px";
4
+ readonly '2xs': "64px";
5
+ readonly xs: "92px";
6
+ readonly sm: "128px";
7
+ readonly md: "192px";
8
+ readonly lg: "256px";
9
+ readonly xl: "380px";
10
+ readonly '2xl': "512px";
11
+ readonly '3xl': "600px";
12
+ };
13
+ type __VLS_Props = {
14
+ src: string | object;
15
+ size?: keyof typeof sizeToUnits;
16
+ alt?: string;
11
17
  width?: string | number;
12
- minWidth?: string | number;
13
- maxWidth?: string | number;
14
18
  height?: string | number;
19
+ minWidth?: string | number;
15
20
  minHeight?: string | number;
21
+ maxWidth?: string | number;
16
22
  maxHeight?: string | number;
17
- $props: {
18
- readonly alt?: string;
19
- readonly src?: string | Record<string, any>;
20
- readonly size?: string;
21
- readonly width?: string | number;
22
- readonly minWidth?: string | number;
23
- readonly maxWidth?: string | number;
24
- readonly height?: string | number;
25
- readonly minHeight?: string | number;
26
- readonly maxHeight?: string | number;
23
+ overlayIcon?: string;
24
+ overlayIconPrefix?: string;
25
+ };
26
+ declare const width: import("vue").ComputedRef<string | number>;
27
+ declare const height: import("vue").ComputedRef<string | number>;
28
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
29
+ declare var __VLS_1: {
30
+ alt: string;
31
+ src: string | object;
32
+ };
33
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
34
+ default?: (props: typeof __VLS_1) => any;
35
+ }>;
36
+ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
37
+ IconColor: typeof IconColor;
38
+ width: typeof width;
39
+ height: typeof height;
40
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
41
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
43
+ export default _default;
44
+ type __VLS_WithSlots<T, S> = T & {
45
+ new (): {
46
+ $slots: S;
27
47
  };
28
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
29
- type __VLS_Slots = {
30
- default?: (props: {
31
- alt: string;
32
- src: string | Record<string, any>;
33
- }) => any;
34
48
  };
@@ -8,6 +8,7 @@ declare namespace components {
8
8
  export { checkbox };
9
9
  export { switcher as toggleswitch };
10
10
  export { divider };
11
+ export { image };
11
12
  export { menubar };
12
13
  export { popover };
13
14
  export { radio as radiobutton };
@@ -24,6 +25,7 @@ import chip from './chip/chip.js';
24
25
  import checkbox from './checkbox/checkbox.js';
25
26
  import switcher from './switcher/switcher.js';
26
27
  import divider from './divider/divider.js';
28
+ import image from './image/image.js';
27
29
  import menubar from './menubar/menubar.js';
28
30
  import popover from './popover/popover.js';
29
31
  import radio from './radio/radio.js';
@@ -0,0 +1,4 @@
1
+ export default image;
2
+ declare namespace image {
3
+ function css(): string;
4
+ }