@webitel/ui-sdk 25.10.5 → 25.10.7

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.5",
3
+ "version": "25.10.7",
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.42",
59
- "@webitel/styleguide": "^24.12.59",
59
+ "@webitel/styleguide": "^24.12.61",
60
60
  "autosize": "^6.0.1",
61
61
  "axios": "^1.8.3",
62
62
  "clipboard-copy": "^4.0.1",
@@ -19,8 +19,8 @@
19
19
  >
20
20
  <wt-switcher
21
21
  v-bind="sharedChildrenProps"
22
- :value="value"
23
- @change="setValue"
22
+ :model-value="value"
23
+ @update:model-value="setValue"
24
24
  />
25
25
  </slot>
26
26
  <slot
@@ -1,26 +1,18 @@
1
1
  <template>
2
- <div
3
- :class="{
4
- 'wt-switcher--off': !value,
5
- 'wt-switcher--on': value,
6
- 'wt-switcher--disabled': disabled,
7
- }"
8
- class="wt-switcher"
2
+ <div
3
+ class="wt-switcher"
4
+ :class="{ 'wt-switcher--label-left': labelLeft }"
9
5
  >
6
+ <p-toggle-switch
7
+ v-model="model"
8
+ :input-id="switcherId"
9
+ :disabled="disabled"
10
+ />
10
11
  <wt-label
11
- :class="{ 'wt-switcher__wrapper--label-left': labelLeft }"
12
12
  :disabled="disabled"
13
- class="wt-switcher__wrapper"
13
+ :for="switcherId"
14
14
  v-bind="labelProps"
15
15
  >
16
- <input
17
- :checked="value"
18
- :disabled="disabled"
19
- class="wt-switcher__input"
20
- type="checkbox"
21
- @change="inputHandler"
22
- />
23
- <span class="wt-switcher__checkmark" />
24
16
  <!-- @slot Custom input label -->
25
17
  <slot
26
18
  name="label"
@@ -37,42 +29,31 @@
37
29
  </div>
38
30
  </template>
39
31
 
40
- <script>
41
- export default {
42
- name: 'WtSwitcher',
43
- model: {
44
- prop: 'value',
45
- event: 'change',
46
- },
47
- props: {
48
- value: {
49
- type: Boolean,
50
- default: false,
51
- },
52
- label: {
53
- type: String,
54
- default: '',
55
- },
56
- labelLeft: {
57
- type: Boolean,
58
- default: false,
59
- },
60
- disabled: {
61
- type: Boolean,
62
- default: false,
63
- },
64
- labelProps: {
65
- type: Object,
66
- description: 'Object with props, passed down to wt-label as props',
67
- },
68
- },
69
- emits: ['change'],
70
- methods: {
71
- inputHandler() {
72
- this.$emit('change', !this.value);
73
- },
74
- },
75
- };
32
+ <script setup lang="ts">
33
+ import { ToggleSwitchProps } from 'primevue/toggleswitch';
34
+ import { defineModel, defineProps, withDefaults } from 'vue';
35
+
36
+ interface LabelProps {
37
+ [key: string]: any;
38
+ }
39
+
40
+ interface Props extends ToggleSwitchProps {
41
+ label?: string;
42
+ labelLeft?: boolean;
43
+ disabled?: boolean;
44
+ labelProps?: LabelProps;
45
+ }
46
+
47
+ withDefaults(defineProps<Props>(), {
48
+ label: '',
49
+ labelLeft: false,
50
+ disabled: false,
51
+ labelProps: () => ({}),
52
+ });
53
+
54
+ const model = defineModel<boolean>();
55
+
56
+ const switcherId = `switcher-${Math.random().toString(36).slice(2, 11)}`;
76
57
  </script>
77
58
 
78
59
  <style lang="scss">
@@ -84,126 +65,24 @@ export default {
84
65
  position: relative;
85
66
  box-sizing: border-box;
86
67
  width: fit-content;
87
-
88
- .wt-label {
89
- cursor: pointer;
90
- }
91
- }
92
-
93
- .wt-switcher__wrapper {
94
68
  display: flex;
95
- position: relative;
96
69
  align-items: center;
97
70
  cursor: pointer;
98
- user-select: none;
99
71
 
100
- &.wt-switcher__wrapper--label-left {
72
+ &.wt-switcher--label-left {
101
73
  flex-direction: row-reverse;
102
74
  }
103
75
  }
104
76
 
105
77
  .wt-switcher__label {
78
+ cursor: pointer;
79
+ user-select: none;
106
80
  transition: var(--transition);
107
81
  margin-left: var(--switcher-icon-margin);
108
82
 
109
- .wt-switcher__wrapper--label-left & {
83
+ .wt-switcher--label-left & {
110
84
  margin-right: var(--switcher-icon-margin);
111
85
  margin-left: 0;
112
86
  }
113
87
  }
114
-
115
- .wt-switcher__input {
116
- position: absolute;
117
- opacity: 0;
118
- width: 0;
119
- height: 0;
120
- pointer-events: none;
121
- }
122
-
123
- .wt-switcher__checkmark {
124
- display: block;
125
- position: relative;
126
- flex: 0 0 var(--switcher-width);
127
- transition: var(--transition);
128
- border-radius: var(--switcher-border-radius);
129
- width: var(--switcher-width);
130
- height: var(--switcher-height);
131
-
132
- &:before {
133
- position: absolute;
134
- bottom: var(--switcher-cicle-margin);
135
- left: var(--switcher-cicle-margin);
136
- transition: var(--transition);
137
- border-radius: 50%;
138
- width: var(--switcher-cicle-size);
139
- height: var(--switcher-cicle-size);
140
- content: '';
141
- }
142
- }
143
-
144
- .wt-switcher--off {
145
- .wt-switcher__checkmark {
146
- background: var(--wt-switcher-background-color-off);
147
-
148
- &:before {
149
- background: var(--wt-switcher-circle-background-color-off);
150
- }
151
- }
152
-
153
- &:hover {
154
- .wt-switcher__checkmark {
155
- background: var(--wt-switcher-background-color-off-hover);
156
-
157
- &:before {
158
- background: var(--wt-switcher-circle-background-color-off-hover);
159
- }
160
- }
161
- }
162
-
163
- &.wt-switcher--disabled {
164
- .wt-switcher__checkmark {
165
- background: var(--wt-switcher-background-color-off-disabled);
166
-
167
- &:before {
168
- background: var(--wt-switcher-circle-background-color-off-disabled);
169
- }
170
- }
171
- }
172
- }
173
-
174
- .wt-switcher--on {
175
- .wt-switcher__checkmark {
176
- background: var(--wt-switcher-background-color-on);
177
-
178
- /* Show the indicator (dot/circle) when checked */
179
- &:before {
180
- transform: translateX(var(--switcher-cicle-translateX));
181
- background: var(--wt-switcher-circle-background-color-on);
182
- }
183
- }
184
-
185
- &:hover {
186
- .wt-switcher__checkmark {
187
- background: var(--wt-switcher-background-color-on-hover);
188
-
189
- &:before {
190
- background: var(--wt-switcher-circle-background-color-on-hover);
191
- }
192
- }
193
- }
194
-
195
- &.wt-switcher--disabled {
196
- .wt-switcher__checkmark {
197
- background: var(--wt-switcher-background-color-on-disabled);
198
-
199
- &:before {
200
- background: var(--wt-switcher-circle-background-color-on-disabled);
201
- }
202
- }
203
- }
204
- }
205
-
206
- .wt-switcher--disabled {
207
- pointer-events: none;
208
- }
209
88
  </style>
@@ -55,8 +55,8 @@ if (cachedTheme) {
55
55
  <div class="wt-dark-mode-switcher">
56
56
  <wt-icon icon="dark-mode" />
57
57
  <wt-switcher
58
- :value="mode === 'dark'"
59
- @change="toggleDarkMode"
58
+ :model-value="mode === 'dark'"
59
+ @update:model-value="toggleDarkMode"
60
60
  />
61
61
  </div>
62
62
  </template>
@@ -4,8 +4,8 @@
4
4
  <wt-switcher
5
5
  :disabled="first"
6
6
  :label="t('reusable.required')"
7
- :value="question.required"
8
- @change="updateQuestion({ path: 'required', value: $event })"
7
+ :model-value="question.required"
8
+ @update:model-value="updateQuestion({ path: 'required', value: $event })"
9
9
  />
10
10
  <div class="audit-form-question-write-header__actions">
11
11
  <wt-icon-btn
@@ -9,6 +9,7 @@ import PInputText from 'primevue/inputtext';
9
9
  import PPopover from 'primevue/popover';
10
10
  import PRadio from 'primevue/radiobutton';
11
11
  import PSlider from 'primevue/slider'
12
+ import PToggleSwitch from 'primevue/toggleswitch';
12
13
  import Tooltip from 'primevue/tooltip';
13
14
 
14
15
  import WebitelTheme from './theme/webitel-theme.js';
@@ -36,6 +37,7 @@ const initPrimevue = (app) => {
36
37
  app.component('PCheckbox', changeComponentCompatMode(PCheckbox));
37
38
  app.component('PRadio', changeComponentCompatMode(PRadio));
38
39
  app.component('PChip', changeComponentCompatMode(PChip));
40
+ app.component('PToggleSwitch', changeComponentCompatMode(PToggleSwitch));
39
41
  app.component('PBreadcrumb', changeComponentCompatMode(PBreadcrumb));
40
42
  app.component('PSlider', changeComponentCompatMode(PSlider));
41
43
  app.component('PDivider', changeComponentCompatMode(PDivider));
@@ -7,6 +7,7 @@ import divider from './divider/divider.js';
7
7
  import popover from './popover/popover.js';
8
8
  import radio from './radio/radio.js';
9
9
  import slider from './slider/slider.js'
10
+ import switcher from './switcher/switcher.js';
10
11
  import tooltip from './tooltip/tooltip.js';
11
12
 
12
13
  const components = {
@@ -16,6 +17,7 @@ const components = {
16
17
  tooltip,
17
18
  chip,
18
19
  checkbox,
20
+ toggleswitch: switcher,
19
21
  breadcrumb,
20
22
  slider,
21
23
  divider,
@@ -0,0 +1,8 @@
1
+ import { SwitcherScheme } from '@webitel/styleguide/component-schemes';
2
+
3
+ const switcher = {
4
+ ...SwitcherScheme.sizes,
5
+ colorScheme: SwitcherScheme.colorScheme,
6
+ };
7
+
8
+ export default switcher;
@@ -1,53 +1,55 @@
1
- declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
- value: {
3
- type: BooleanConstructor;
4
- default: boolean;
5
- };
6
- label: {
7
- type: StringConstructor;
8
- default: string;
9
- };
10
- labelLeft: {
11
- type: BooleanConstructor;
12
- default: boolean;
13
- };
14
- disabled: {
15
- type: BooleanConstructor;
16
- default: boolean;
17
- };
18
- labelProps: {
19
- type: ObjectConstructor;
20
- description: string;
21
- };
22
- }>, {}, {}, {}, {
23
- inputHandler(): void;
24
- }, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "change"[], "change", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
25
- value: {
26
- type: BooleanConstructor;
27
- default: boolean;
28
- };
29
- label: {
30
- type: StringConstructor;
31
- default: string;
32
- };
33
- labelLeft: {
34
- type: BooleanConstructor;
35
- default: boolean;
36
- };
37
- disabled: {
38
- type: BooleanConstructor;
39
- default: boolean;
40
- };
41
- labelProps: {
42
- type: ObjectConstructor;
43
- description: string;
44
- };
45
- }>> & Readonly<{
46
- onChange?: (...args: any[]) => any;
1
+ import { ToggleSwitchProps } from 'primevue/toggleswitch';
2
+ interface LabelProps {
3
+ [key: string]: any;
4
+ }
5
+ interface Props extends ToggleSwitchProps {
6
+ label?: string;
7
+ labelLeft?: boolean;
8
+ disabled?: boolean;
9
+ labelProps?: LabelProps;
10
+ }
11
+ type __VLS_Props = Props;
12
+ declare const model: import("vue").ModelRef<boolean, string, boolean, boolean>;
13
+ declare const switcherId: string;
14
+ type __VLS_PublicProps = __VLS_Props & {
15
+ modelValue?: boolean;
16
+ };
17
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
18
+ declare var __VLS_9: {
19
+ label: string;
20
+ value: any;
21
+ disabled: boolean;
22
+ };
23
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
24
+ label?: (props: typeof __VLS_9) => any;
25
+ }>;
26
+ declare const __VLS_self: import("vue").DefineComponent<__VLS_PublicProps, {
27
+ model: typeof model;
28
+ switcherId: typeof switcherId;
29
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
+ "update:modelValue": (value: boolean) => any;
31
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
32
+ "onUpdate:modelValue"?: (value: boolean) => any;
47
33
  }>, {
48
- value: boolean;
49
34
  label: string;
50
35
  disabled: boolean;
36
+ labelProps: LabelProps;
51
37
  labelLeft: boolean;
52
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
39
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
40
+ "update:modelValue": (value: boolean) => any;
41
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
42
+ "onUpdate:modelValue"?: (value: boolean) => any;
43
+ }>, {
44
+ label: string;
45
+ disabled: boolean;
46
+ labelProps: LabelProps;
47
+ labelLeft: boolean;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
49
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
53
50
  export default _default;
51
+ type __VLS_WithSlots<T, S> = T & {
52
+ new (): {
53
+ $slots: S;
54
+ };
55
+ };
@@ -6,6 +6,7 @@ declare namespace components {
6
6
  export { tooltip };
7
7
  export { chip };
8
8
  export { checkbox };
9
+ export { switcher as toggleswitch };
9
10
  export { breadcrumb };
10
11
  export { slider };
11
12
  export { divider };
@@ -17,6 +18,7 @@ import popover from './popover/popover.js';
17
18
  import tooltip from './tooltip/tooltip.js';
18
19
  import chip from './chip/chip.js';
19
20
  import checkbox from './checkbox/checkbox.js';
21
+ import switcher from './switcher/switcher.js';
20
22
  import breadcrumb from './breadcrumb/breadcrumb.js';
21
23
  import slider from './slider/slider.js';
22
24
  import divider from './divider/divider.js';
@@ -0,0 +1,78 @@
1
+ export default switcher;
2
+ declare const switcher: {
3
+ colorScheme: {
4
+ light: {
5
+ root: {
6
+ shadow: string;
7
+ focusRing: {
8
+ color: string;
9
+ shadow: string;
10
+ };
11
+ borderColor: string;
12
+ hoverBorderColor: string;
13
+ checkedBorderColor: string;
14
+ checkedHoverBorderColor: string;
15
+ invalidBorderColor: string;
16
+ background: string;
17
+ disabledBackground: string;
18
+ hoverBackground: string;
19
+ checkedBackground: string;
20
+ checkedHoverBackground: string;
21
+ };
22
+ handle: {
23
+ background: string;
24
+ disabledBackground: string;
25
+ hoverBackground: string;
26
+ checkedBackground: string;
27
+ checkedHoverBackground: string;
28
+ color: string;
29
+ hoverColor: string;
30
+ checkedColor: string;
31
+ checkedHoverColor: string;
32
+ };
33
+ };
34
+ dark: {
35
+ root: {
36
+ shadow: string;
37
+ focusRing: {
38
+ color: string;
39
+ shadow: string;
40
+ };
41
+ borderColor: string;
42
+ hoverBorderColor: string;
43
+ checkedBorderColor: string;
44
+ checkedHoverBorderColor: string;
45
+ invalidBorderColor: string;
46
+ background: string;
47
+ disabledBackground: string;
48
+ hoverBackground: string;
49
+ checkedBackground: string;
50
+ checkedHoverBackground: string;
51
+ };
52
+ handle: {
53
+ background: string;
54
+ disabledBackground: string;
55
+ hoverBackground: string;
56
+ checkedBackground: string;
57
+ checkedHoverBackground: string;
58
+ color: string;
59
+ hoverColor: string;
60
+ checkedColor: string;
61
+ checkedHoverColor: string;
62
+ };
63
+ };
64
+ };
65
+ root: {
66
+ width: string;
67
+ height: string;
68
+ borderRadius: string;
69
+ gap: string;
70
+ borderWidth: string;
71
+ transitionDuration: string;
72
+ slideDuration: string;
73
+ };
74
+ handle: {
75
+ borderRadius: string;
76
+ size: string;
77
+ };
78
+ };