@webitel/ui-sdk 25.8.37 → 25.8.39

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.8.37",
3
+ "version": "25.8.39",
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",
@@ -56,7 +56,7 @@
56
56
  "@vuepic/vue-datepicker": "^4.5.1",
57
57
  "@vueuse/components": "^13.0.0",
58
58
  "@webitel/api-services": "^0.0.33",
59
- "@webitel/styleguide": "^24.12.44",
59
+ "@webitel/styleguide": "^24.12.47",
60
60
  "autosize": "^6.0.1",
61
61
  "axios": "^1.8.3",
62
62
  "clipboard-copy": "^4.0.1",
@@ -1,37 +1,25 @@
1
1
  <template>
2
- <div
3
- :class="{
4
- 'wt-checkbox--active': isChecked,
5
- 'wt-checkbox--disabled': disabled,
6
- }"
2
+ <div
7
3
  class="wt-checkbox"
8
4
  >
9
- <wt-label
5
+ <p-checkbox
6
+ v-model="model"
7
+ :input-id="checkboxId"
8
+ :disabled="disabled"
9
+ :value="value"
10
+ :binary="isSingle"
11
+ />
12
+ <wt-label
13
+ v-if="label"
14
+ :for="checkboxId"
10
15
  :disabled="disabled"
11
- class="wt-checkbox__wrapper"
12
- v-bind="labelProps"
13
16
  >
14
- <input
15
- :checked="isChecked"
16
- :disabled="disabled"
17
- :value="value"
18
- class="wt-checkbox__input"
19
- type="checkbox"
20
- @change="inputHandler"
21
- />
22
- <span class="wt-checkbox__checkmark">
23
- <wt-icon
24
- :color="iconColor"
25
- :icon="checkboxIcon"
26
- />
27
- </span>
28
17
  <!-- @slot Custom label markup -->
29
18
  <slot
30
19
  name="label"
31
20
  v-bind="{ label, isChecked, disabled }"
32
21
  >
33
22
  <div
34
- v-if="label"
35
23
  class="wt-checkbox__label"
36
24
  >
37
25
  {{ label }}
@@ -41,68 +29,34 @@
41
29
  </div>
42
30
  </template>
43
31
 
44
- <script>
45
- export default {
46
- name: 'WtCheckbox',
47
- model: {
48
- prop: 'selected',
49
- event: 'change',
50
- },
51
- props: {
52
- value: {
53
- type: [String, Boolean],
54
- default: '',
55
- },
56
- selected: {
57
- type: [Array, Boolean],
58
- default: () => [],
59
- },
60
- label: {
61
- type: String,
62
- default: '',
63
- },
64
- disabled: {
65
- type: Boolean,
66
- default: false,
67
- },
68
- labelProps: {
69
- type: Object,
70
- description: 'Object with props, passed down to wt-label as props',
71
- },
72
- },
73
- emits: ['change'],
74
- computed: {
75
- isChecked() {
76
- if (typeof this.selected === 'boolean') {
77
- return this.selected;
78
- }
79
- return this.selected.includes(this.value);
80
- },
81
- checkboxIcon() {
82
- return this.isChecked ? 'checkbox--checked' : 'checkbox';
83
- },
84
- iconColor() {
85
- if (this.disabled) return 'disabled';
86
- if (this.isChecked) return 'active';
87
- return null;
88
- },
89
- },
90
- methods: {
91
- inputHandler() {
92
- if (typeof this.selected === 'boolean') {
93
- this.$emit('change', !this.selected);
94
- } else {
95
- let selected = [...this.selected];
96
- if (selected.includes(this.value)) {
97
- selected = selected.filter((value) => value !== this.value);
98
- } else {
99
- selected.push(this.value);
100
- }
101
- this.$emit('change', selected);
102
- }
103
- },
104
- },
105
- };
32
+ <script setup lang="ts">
33
+ import type { CheckboxProps } from 'primevue/checkbox';
34
+ import { computed, defineModel, defineProps } from 'vue';
35
+
36
+ interface WtCheckboxProps extends CheckboxProps {
37
+ value?: string | boolean;
38
+ label?: string;
39
+ disabled?: boolean;
40
+ }
41
+
42
+ const props = withDefaults(defineProps<WtCheckboxProps>(), {
43
+ value: '',
44
+ label: '',
45
+ disabled: false,
46
+ });
47
+
48
+ const model = defineModel<boolean | string[]>('selected', {required: true});
49
+
50
+ const checkboxId = `checkbox-${Math.random().toString(36).slice(2, 11)}`;
51
+
52
+ const isSingle = computed(() => typeof model.value === 'boolean');
53
+
54
+ const isChecked = computed(() => {
55
+ if (isSingle.value) {
56
+ return model.value;
57
+ }
58
+ return model.value.includes(props.value);
59
+ });
106
60
  </script>
107
61
 
108
62
  <style lang="scss">
@@ -111,23 +65,10 @@ export default {
111
65
 
112
66
  <style lang="scss" scoped>
113
67
  .wt-checkbox {
114
- box-sizing: border-box;
115
- width: fit-content;
116
-
117
- .wt-label {
118
- cursor: pointer;
119
- }
120
- }
121
-
122
- .wt-checkbox__wrapper {
123
68
  display: flex;
124
69
  position: relative;
125
70
  align-items: center;
126
71
  user-select: none;
127
-
128
- .wt-checkbox__checkmark {
129
- line-height: 0; // prevent icon height >> content
130
- }
131
72
  }
132
73
 
133
74
  .wt-checkbox__label {
@@ -135,23 +76,4 @@ export default {
135
76
  cursor: pointer;
136
77
  margin-left: var(--checkbox-icon-margin);
137
78
  }
138
-
139
- /* Hide the browser's default checkbox */
140
- .wt-checkbox__input {
141
- position: absolute;
142
- opacity: 0;
143
- width: 0;
144
- height: 0;
145
- pointer-events: none;
146
- }
147
-
148
- .wt-checkbox:hover {
149
- :deep(.wt-icon__icon) {
150
- fill: var(--icon-active-color);
151
- }
152
- }
153
-
154
- .wt-checkbox--disabled {
155
- pointer-events: none;
156
- }
157
79
  </style>
@@ -18,7 +18,7 @@
18
18
  >
19
19
  <wt-checkbox
20
20
  :selected="isAllSelected"
21
- @change="selectAll"
21
+ @update:selected="selectAll"
22
22
  />
23
23
  </th>
24
24
  <th
@@ -71,7 +71,7 @@
71
71
  >
72
72
  <wt-checkbox
73
73
  :selected="_selected.includes(row)"
74
- @change="handleSelection(row, $event)"
74
+ @update:selected="handleSelection(row, $event)"
75
75
  />
76
76
  </td>
77
77
 
@@ -34,7 +34,7 @@
34
34
  <wt-checkbox
35
35
  :label="shownColLabel(column)"
36
36
  :selected="column.show"
37
- @change="column.show = $event"
37
+ @update:selected="column.show = $event"
38
38
  />
39
39
  </li>
40
40
  </ul>
@@ -23,7 +23,7 @@
23
23
  >
24
24
  <wt-checkbox
25
25
  :selected="isAllSelected"
26
- @change="selectAll"
26
+ @update:selected="selectAll"
27
27
  />
28
28
  </div>
29
29
  <div class="wt-tree-table-th__text">
@@ -21,7 +21,7 @@
21
21
  <wt-checkbox
22
22
  v-if="selectable"
23
23
  :selected="isSelectedRow"
24
- @change="
24
+ @update:selected="
25
25
  $emit('update:selected', {
26
26
  data,
27
27
  select: $event,
@@ -1,5 +1,6 @@
1
1
  import PAutoComplete from 'primevue/autocomplete';
2
2
  import PButton from 'primevue/button';
3
+ import PCheckbox from 'primevue/checkbox';
3
4
  import PrimeVue from 'primevue/config';
4
5
  import PInputText from 'primevue/inputtext';
5
6
  import PPopover from 'primevue/popover';
@@ -27,6 +28,7 @@ const initPrimevue = (app) => {
27
28
  app.component('PAutoComplete', changeComponentCompatMode(PAutoComplete));
28
29
  app.component('PInputText', changeComponentCompatMode(PInputText));
29
30
  app.component('PPopover', changeComponentCompatMode(PPopover));
31
+ app.component('PCheckbox', changeComponentCompatMode(PCheckbox));
30
32
 
31
33
  app.directive('tooltip', Tooltip);
32
34
  };
@@ -0,0 +1,8 @@
1
+ import { CheckboxScheme } from "@webitel/styleguide/component-schemes";
2
+
3
+ const checkbox = {
4
+ ...CheckboxScheme.sizes,
5
+ colorScheme: CheckboxScheme.colorScheme,
6
+ };
7
+
8
+ export default checkbox;
@@ -1,5 +1,6 @@
1
1
  import autocomplete from './autocomplete/autocomplete.js';
2
2
  import button from './button/button.js';
3
+ import checkbox from './checkbox/checkbox.js';
3
4
  import popover from './popover/popover.js';
4
5
  import tooltip from './tooltip/tooltip.js';
5
6
 
@@ -8,6 +9,7 @@ const components = {
8
9
  autocomplete,
9
10
  popover,
10
11
  tooltip,
12
+ checkbox,
11
13
  };
12
14
 
13
15
  export default components;
@@ -1,57 +1,53 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
- value: {
3
- type: (StringConstructor | BooleanConstructor)[];
4
- default: string;
5
- };
6
- selected: {
7
- type: (BooleanConstructor | ArrayConstructor)[];
8
- default: () => any[];
9
- };
10
- label: {
11
- type: StringConstructor;
12
- default: string;
13
- };
14
- disabled: {
15
- type: BooleanConstructor;
16
- default: boolean;
17
- };
18
- labelProps: {
19
- type: ObjectConstructor;
20
- description: string;
21
- };
22
- }>, {}, {}, {
23
- isChecked(): boolean;
24
- checkboxIcon(): "checkbox" | "checkbox--checked";
25
- iconColor(): "active" | "disabled";
26
- }, {
27
- inputHandler(): void;
28
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
29
- value: {
30
- type: (StringConstructor | BooleanConstructor)[];
31
- default: string;
32
- };
33
- selected: {
34
- type: (BooleanConstructor | ArrayConstructor)[];
35
- default: () => any[];
36
- };
37
- label: {
38
- type: StringConstructor;
39
- default: string;
40
- };
41
- disabled: {
42
- type: BooleanConstructor;
43
- default: boolean;
44
- };
45
- labelProps: {
46
- type: ObjectConstructor;
47
- description: string;
48
- };
49
- }>> & Readonly<{
50
- onChange?: (...args: any[]) => any;
1
+ import type { CheckboxProps } from 'primevue/checkbox';
2
+ interface WtCheckboxProps extends CheckboxProps {
3
+ value?: string | boolean;
4
+ label?: string;
5
+ disabled?: boolean;
6
+ }
7
+ type __VLS_Props = WtCheckboxProps;
8
+ declare const model: import("vue").ModelRef<boolean | string[], string, boolean | string[], boolean | string[]>;
9
+ declare const checkboxId: string;
10
+ declare const isSingle: import("vue").ComputedRef<boolean>;
11
+ declare const isChecked: import("vue").ComputedRef<any>;
12
+ type __VLS_PublicProps = __VLS_Props & {
13
+ 'selected': boolean | string[];
14
+ };
15
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
16
+ declare var __VLS_9: {
17
+ label: string;
18
+ isChecked: any;
19
+ disabled: boolean;
20
+ };
21
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
22
+ label?: (props: typeof __VLS_9) => any;
23
+ }>;
24
+ declare const __VLS_self: import("vue").DefineComponent<__VLS_PublicProps, {
25
+ model: typeof model;
26
+ checkboxId: typeof checkboxId;
27
+ isSingle: typeof isSingle;
28
+ isChecked: typeof isChecked;
29
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
+ "update:selected": (value: boolean | string[]) => any;
31
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
32
+ "onUpdate:selected"?: (value: boolean | string[]) => any;
33
+ }>, {
34
+ value: string | boolean;
35
+ label: string;
36
+ disabled: boolean;
37
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
+ "update:selected": (value: boolean | string[]) => any;
40
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
41
+ "onUpdate:selected"?: (value: boolean | string[]) => any;
51
42
  }>, {
52
43
  value: string | boolean;
53
44
  label: string;
54
- selected: boolean | unknown[];
55
45
  disabled: boolean;
56
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
46
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
47
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
57
48
  export default _default;
49
+ type __VLS_WithSlots<T, S> = T & {
50
+ new (): {
51
+ $slots: S;
52
+ };
53
+ };
@@ -118,8 +118,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
118
118
  default: boolean;
119
119
  };
120
120
  }>> & Readonly<{
121
- onSort?: (...args: any[]) => any;
122
121
  "onUpdate:selected"?: (...args: any[]) => any;
122
+ onSort?: (...args: any[]) => any;
123
123
  }>, {
124
124
  headers: unknown[];
125
125
  data: unknown[];
@@ -0,0 +1,90 @@
1
+ export default checkbox;
2
+ declare const checkbox: {
3
+ colorScheme: {
4
+ light: {
5
+ root: {
6
+ background: string;
7
+ checkedBackground: string;
8
+ checkedHoverBackground: string;
9
+ disabledBackground: string;
10
+ filledBackground: string;
11
+ borderColor: string;
12
+ hoverBorderColor: string;
13
+ focusBorderColor: string;
14
+ checkedBorderColor: string;
15
+ checkedHoverBorderColor: string;
16
+ checkedFocusBorderColor: string;
17
+ checkedDisabledBorderColor: string;
18
+ invalidBorderColor: string;
19
+ shadow: string;
20
+ focusRing: {
21
+ color: string;
22
+ shadow: string;
23
+ };
24
+ transitionDuration: string;
25
+ };
26
+ icon: {
27
+ color: string;
28
+ checkedColor: string;
29
+ checkedHoverColor: string;
30
+ disabledColor: string;
31
+ };
32
+ };
33
+ dark: {
34
+ root: {
35
+ background: string;
36
+ checkedBackground: string;
37
+ checkedHoverBackground: string;
38
+ disabledBackground: string;
39
+ filledBackground: string;
40
+ borderColor: string;
41
+ hoverBorderColor: string;
42
+ focusBorderColor: string;
43
+ checkedBorderColor: string;
44
+ checkedHoverBorderColor: string;
45
+ checkedFocusBorderColor: string;
46
+ checkedDisabledBorderColor: string;
47
+ invalidBorderColor: string;
48
+ shadow: string;
49
+ focusRing: {
50
+ color: string;
51
+ shadow: string;
52
+ };
53
+ transitionDuration: string;
54
+ };
55
+ icon: {
56
+ color: string;
57
+ checkedColor: string;
58
+ checkedHoverColor: string;
59
+ disabledColor: string;
60
+ };
61
+ };
62
+ };
63
+ root: {
64
+ borderRadius: string;
65
+ width: string;
66
+ height: string;
67
+ sm: {
68
+ width: string;
69
+ height: string;
70
+ };
71
+ lg: {
72
+ width: string;
73
+ height: string;
74
+ };
75
+ focusRing: {
76
+ width: string;
77
+ style: string;
78
+ offset: string;
79
+ };
80
+ };
81
+ icon: {
82
+ size: string;
83
+ sm: {
84
+ size: string;
85
+ };
86
+ lg: {
87
+ size: string;
88
+ };
89
+ };
90
+ };
@@ -4,8 +4,10 @@ declare namespace components {
4
4
  export { autocomplete };
5
5
  export { popover };
6
6
  export { tooltip };
7
+ export { checkbox };
7
8
  }
8
9
  import button from './button/button.js';
9
10
  import autocomplete from './autocomplete/autocomplete.js';
10
11
  import popover from './popover/popover.js';
11
12
  import tooltip from './tooltip/tooltip.js';
13
+ import checkbox from './checkbox/checkbox.js';