@aziontech/webkit 0.0.1

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 (105) hide show
  1. package/package.json +46 -0
  2. package/src/core/field-auto-complete/field-auto-complete.vue +121 -0
  3. package/src/core/field-auto-complete/field-auto-complete.vue.d.ts +107 -0
  4. package/src/core/field-auto-complete/field-auto-complete.vue.d.ts.map +1 -0
  5. package/src/core/field-auto-complete/package.json +11 -0
  6. package/src/core/field-checkbox-block/field-checkbox-block.vue +106 -0
  7. package/src/core/field-checkbox-block/field-checkbox-block.vue.d.ts +111 -0
  8. package/src/core/field-checkbox-block/field-checkbox-block.vue.d.ts.map +1 -0
  9. package/src/core/field-checkbox-block/package.json +11 -0
  10. package/src/core/field-dropdown/field-dropdown.vue +240 -0
  11. package/src/core/field-dropdown/field-dropdown.vue.d.ts +203 -0
  12. package/src/core/field-dropdown/field-dropdown.vue.d.ts.map +1 -0
  13. package/src/core/field-dropdown/package.json +11 -0
  14. package/src/core/field-dropdown-icon/field-dropdown-icon.vue +129 -0
  15. package/src/core/field-dropdown-icon/field-dropdown-icon.vue.d.ts +111 -0
  16. package/src/core/field-dropdown-icon/field-dropdown-icon.vue.d.ts.map +1 -0
  17. package/src/core/field-dropdown-icon/package.json +11 -0
  18. package/src/core/field-dropdown-lazy-loader/field-dropdown-lazy-loader.vue +631 -0
  19. package/src/core/field-dropdown-lazy-loader/field-dropdown-lazy-loader.vue.d.ts +196 -0
  20. package/src/core/field-dropdown-lazy-loader/field-dropdown-lazy-loader.vue.d.ts.map +1 -0
  21. package/src/core/field-dropdown-lazy-loader/package.json +11 -0
  22. package/src/core/field-dropdown-lazy-loader-dynamic/field-dropdown-lazy-loader-dynamic.vue +426 -0
  23. package/src/core/field-dropdown-lazy-loader-dynamic/field-dropdown-lazy-loader-dynamic.vue.d.ts +158 -0
  24. package/src/core/field-dropdown-lazy-loader-dynamic/field-dropdown-lazy-loader-dynamic.vue.d.ts.map +1 -0
  25. package/src/core/field-dropdown-lazy-loader-dynamic/package.json +11 -0
  26. package/src/core/field-dropdown-lazy-loader-with-filter/field-dropdown-lazy-loader-with-filter.vue +527 -0
  27. package/src/core/field-dropdown-lazy-loader-with-filter/field-dropdown-lazy-loader-with-filter.vue.d.ts +203 -0
  28. package/src/core/field-dropdown-lazy-loader-with-filter/field-dropdown-lazy-loader-with-filter.vue.d.ts.map +1 -0
  29. package/src/core/field-dropdown-lazy-loader-with-filter/package.json +11 -0
  30. package/src/core/field-dropdown-multi-select-lazy-loader/field-dropdown-multi-select-lazy-loader.vue +439 -0
  31. package/src/core/field-dropdown-multi-select-lazy-loader/field-dropdown-multi-select-lazy-loader.vue.d.ts +162 -0
  32. package/src/core/field-dropdown-multi-select-lazy-loader/field-dropdown-multi-select-lazy-loader.vue.d.ts.map +1 -0
  33. package/src/core/field-dropdown-multi-select-lazy-loader/package.json +11 -0
  34. package/src/core/field-group-checkbox/field-group-checkbox.vue +102 -0
  35. package/src/core/field-group-checkbox/field-group-checkbox.vue.d.ts +87 -0
  36. package/src/core/field-group-checkbox/field-group-checkbox.vue.d.ts.map +1 -0
  37. package/src/core/field-group-checkbox/package.json +11 -0
  38. package/src/core/field-group-radio/field-group-radio.vue +149 -0
  39. package/src/core/field-group-radio/field-group-radio.vue.d.ts +99 -0
  40. package/src/core/field-group-radio/field-group-radio.vue.d.ts.map +1 -0
  41. package/src/core/field-group-radio/package.json +11 -0
  42. package/src/core/field-group-switch/field-group-switch.vue +121 -0
  43. package/src/core/field-group-switch/field-group-switch.vue.d.ts +87 -0
  44. package/src/core/field-group-switch/field-group-switch.vue.d.ts.map +1 -0
  45. package/src/core/field-group-switch/package.json +11 -0
  46. package/src/core/field-input-group/field-input-group.vue +111 -0
  47. package/src/core/field-input-group/field-input-group.vue.d.ts +87 -0
  48. package/src/core/field-input-group/field-input-group.vue.d.ts.map +1 -0
  49. package/src/core/field-input-group/package.json +11 -0
  50. package/src/core/field-multi-select/field-multi-select.vue +167 -0
  51. package/src/core/field-multi-select/field-multi-select.vue.d.ts +136 -0
  52. package/src/core/field-multi-select/field-multi-select.vue.d.ts.map +1 -0
  53. package/src/core/field-multi-select/package.json +11 -0
  54. package/src/core/field-number/field-number.vue +144 -0
  55. package/src/core/field-number/field-number.vue.d.ts +132 -0
  56. package/src/core/field-number/field-number.vue.d.ts.map +1 -0
  57. package/src/core/field-number/package.json +11 -0
  58. package/src/core/field-phone-number/field-phone-number.vue +151 -0
  59. package/src/core/field-phone-number/field-phone-number.vue.d.ts +76 -0
  60. package/src/core/field-phone-number/field-phone-number.vue.d.ts.map +1 -0
  61. package/src/core/field-phone-number/package.json +11 -0
  62. package/src/core/field-phone-number-country/field-phone-number-country.vue +60 -0
  63. package/src/core/field-phone-number-country/field-phone-number-country.vue.d.ts +18 -0
  64. package/src/core/field-phone-number-country/field-phone-number-country.vue.d.ts.map +1 -0
  65. package/src/core/field-phone-number-country/package.json +11 -0
  66. package/src/core/field-pick-list/field-pick-list.vue +285 -0
  67. package/src/core/field-pick-list/field-pick-list.vue.d.ts +43 -0
  68. package/src/core/field-pick-list/field-pick-list.vue.d.ts.map +1 -0
  69. package/src/core/field-pick-list/package.json +11 -0
  70. package/src/core/field-radio-block/field-radio-block.vue +108 -0
  71. package/src/core/field-radio-block/field-radio-block.vue.d.ts +115 -0
  72. package/src/core/field-radio-block/field-radio-block.vue.d.ts.map +1 -0
  73. package/src/core/field-radio-block/package.json +11 -0
  74. package/src/core/field-switch/field-switch.vue +41 -0
  75. package/src/core/field-switch/field-switch.vue.d.ts +33 -0
  76. package/src/core/field-switch/field-switch.vue.d.ts.map +1 -0
  77. package/src/core/field-switch/package.json +11 -0
  78. package/src/core/field-switch-block/field-switch-block.vue +123 -0
  79. package/src/core/field-switch-block/field-switch-block.vue.d.ts +123 -0
  80. package/src/core/field-switch-block/field-switch-block.vue.d.ts.map +1 -0
  81. package/src/core/field-switch-block/package.json +11 -0
  82. package/src/core/field-text/field-text.vue +128 -0
  83. package/src/core/field-text/field-text.vue.d.ts +108 -0
  84. package/src/core/field-text/field-text.vue.d.ts.map +1 -0
  85. package/src/core/field-text/package.json +11 -0
  86. package/src/core/field-text-area/field-text-area.vue +178 -0
  87. package/src/core/field-text-area/field-text-area.vue.d.ts +142 -0
  88. package/src/core/field-text-area/field-text-area.vue.d.ts.map +1 -0
  89. package/src/core/field-text-area/package.json +11 -0
  90. package/src/core/field-text-icon/field-text-icon.vue +127 -0
  91. package/src/core/field-text-icon/field-text-icon.vue.d.ts +100 -0
  92. package/src/core/field-text-icon/field-text-icon.vue.d.ts.map +1 -0
  93. package/src/core/field-text-icon/package.json +11 -0
  94. package/src/core/field-text-password/field-text-password.vue +127 -0
  95. package/src/core/field-text-password/field-text-password.vue.d.ts +108 -0
  96. package/src/core/field-text-password/field-text-password.vue.d.ts.map +1 -0
  97. package/src/core/field-text-password/package.json +11 -0
  98. package/src/core/label/label.vue +35 -0
  99. package/src/core/label/label.vue.d.ts +24 -0
  100. package/src/core/label/label.vue.d.ts.map +1 -0
  101. package/src/core/label/package.json +11 -0
  102. package/src/core/selector-block/package.json +11 -0
  103. package/src/core/selector-block/selector-block.vue +128 -0
  104. package/src/core/selector-block/selector-block.vue.d.ts +99 -0
  105. package/src/core/selector-block/selector-block.vue.d.ts.map +1 -0
@@ -0,0 +1,121 @@
1
+ <script setup>
2
+ import FieldSwitchBlock from '../field-switch-block'
3
+ import { computed, ref, useAttrs } from 'vue'
4
+ import PrimeDivider from 'primevue/divider'
5
+
6
+ defineOptions({ name: 'FieldGroupSwitch' })
7
+
8
+ const props = defineProps({
9
+ hideSelector: {
10
+ type: Boolean,
11
+ default: false
12
+ },
13
+ auto: {
14
+ type: Boolean,
15
+ default: false
16
+ },
17
+ isCard: {
18
+ type: Boolean,
19
+ default: true
20
+ },
21
+ label: {
22
+ type: String,
23
+ default: ''
24
+ },
25
+ helpText: {
26
+ type: String,
27
+ default: ''
28
+ },
29
+ disabled: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ options: {
34
+ type: Array,
35
+ required: true
36
+ },
37
+ inputClass: {
38
+ type: String,
39
+ default: ''
40
+ }
41
+ })
42
+
43
+ const pickListSize = ref(props.options.length - 1)
44
+
45
+ const classStateRoot = computed(() => ({
46
+ 'p-disabled': props.disabled
47
+ }))
48
+
49
+ const classListSelector = computed(() => ({
50
+ 'flex-wrap': props.auto,
51
+ 'flex-col': !props.auto,
52
+ 'gap-3': !props.divider
53
+ }))
54
+
55
+ const showDivider = (position) => {
56
+ return position < pickListSize.value && !props.isCard
57
+ }
58
+
59
+ const attrs = useAttrs()
60
+
61
+ const customTestId = (type, name = 'default') => {
62
+ const id = attrs['data-testid'] || 'field-group-switch'
63
+
64
+ const options = {
65
+ label: `${id}__label`,
66
+ switch: `${id}__switch-${name}`,
67
+ description: `${id}__description`
68
+ }
69
+
70
+ return options[type] || id
71
+ }
72
+ </script>
73
+
74
+ <template>
75
+ <div :class="['flex flex-col gap-2', classStateRoot]">
76
+ <label
77
+ class="text-color text-base font-medium leading-5"
78
+ :data-testid="customTestId('label')"
79
+ >
80
+ {{ props.label }}
81
+ </label>
82
+ <div
83
+ class="flex"
84
+ :class="classListSelector"
85
+ >
86
+ <template
87
+ v-for="(item, index) in props.options"
88
+ :key="index"
89
+ >
90
+ <FieldSwitchBlock
91
+ :nameField="`${item.nameField}`"
92
+ :name="`${item.nameField}-switch-${index}`"
93
+ :auto="props.auto"
94
+ :hideSelector="props.hideSelector"
95
+ :isCard="props.isCard"
96
+ v-bind="item"
97
+ :selectorClass="props.inputClass"
98
+ :data-testid="customTestId('switch', item.nameField)"
99
+ >
100
+ <template #footer>
101
+ <slot
102
+ name="footer"
103
+ :item="item"
104
+ />
105
+ </template>
106
+ </FieldSwitchBlock>
107
+ <PrimeDivider
108
+ v-if="showDivider(index)"
109
+ class="my-2"
110
+ />
111
+ </template>
112
+ </div>
113
+ <small
114
+ class="text-xs text-color-secondary font-normal leading-5"
115
+ v-if="props.helpText"
116
+ :data-testid="customTestId('description')"
117
+ >
118
+ {{ props.helpText }}
119
+ </small>
120
+ </div>
121
+ </template>
@@ -0,0 +1,87 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
4
+ type __VLS_WithSlots<T, S> = T & (new () => {
5
+ $slots: S;
6
+ });
7
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ hideSelector: {
9
+ type: BooleanConstructor;
10
+ default: boolean;
11
+ };
12
+ auto: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ isCard: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ label: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ helpText: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ };
28
+ disabled: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ options: {
33
+ type: ArrayConstructor;
34
+ required: true;
35
+ };
36
+ inputClass: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
40
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
41
+ hideSelector: {
42
+ type: BooleanConstructor;
43
+ default: boolean;
44
+ };
45
+ auto: {
46
+ type: BooleanConstructor;
47
+ default: boolean;
48
+ };
49
+ isCard: {
50
+ type: BooleanConstructor;
51
+ default: boolean;
52
+ };
53
+ label: {
54
+ type: StringConstructor;
55
+ default: string;
56
+ };
57
+ helpText: {
58
+ type: StringConstructor;
59
+ default: string;
60
+ };
61
+ disabled: {
62
+ type: BooleanConstructor;
63
+ default: boolean;
64
+ };
65
+ options: {
66
+ type: ArrayConstructor;
67
+ required: true;
68
+ };
69
+ inputClass: {
70
+ type: StringConstructor;
71
+ default: string;
72
+ };
73
+ }>> & Readonly<{}>, {
74
+ label: string;
75
+ disabled: boolean;
76
+ inputClass: string;
77
+ auto: boolean;
78
+ isCard: boolean;
79
+ hideSelector: boolean;
80
+ helpText: string;
81
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
82
+ type __VLS_Slots = {
83
+ footer?: ((props: {
84
+ item: unknown;
85
+ }) => any) | undefined;
86
+ };
87
+ //# sourceMappingURL=field-group-switch.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-group-switch.vue.d.ts","sourceRoot":"","sources":["field-group-switch.vue"],"names":[],"mappings":"wBA0VqB,OAAO,YAAY;;AADxC,4BAA2B,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;qBAEtD,CAAC,EAAE,CAAC;;;AAtCzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EAmCG"}
@@ -0,0 +1,11 @@
1
+ {
2
+ "main": "./field-group-switch.vue",
3
+ "module": "./field-group-switch.vue",
4
+ "types": "./field-group-switch.vue.d.ts",
5
+ "browser": {
6
+ "./sfc": "./field-group-switch.vue"
7
+ },
8
+ "sideEffects": [
9
+ "*.vue"
10
+ ]
11
+ }
@@ -0,0 +1,111 @@
1
+ <script setup>
2
+ import { toRef, useSlots, computed, useAttrs } from 'vue'
3
+ import { useField } from 'vee-validate'
4
+ import InputText from 'primevue/inputtext'
5
+ import LabelBlock from '../label'
6
+
7
+ const props = defineProps({
8
+ value: {
9
+ type: String,
10
+ default: ''
11
+ },
12
+ name: {
13
+ type: String,
14
+ required: true
15
+ },
16
+ label: {
17
+ type: String,
18
+ default: ''
19
+ },
20
+ disabled: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ readonly: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ placeholder: {
29
+ type: String,
30
+ default: ''
31
+ },
32
+ description: {
33
+ type: String,
34
+ default: ''
35
+ },
36
+ inputClass: {
37
+ type: String,
38
+ default: ''
39
+ }
40
+ })
41
+
42
+ const name = toRef(props, 'name')
43
+ const attrs = useAttrs()
44
+
45
+ const customTestId = computed(() => {
46
+ const id = attrs['data-testid'] || 'field-input-group'
47
+
48
+ return {
49
+ label: `${id}__label`,
50
+ input: `${id}__input`,
51
+ description: `${id}__description`,
52
+ error: `${id}__error-message`
53
+ }
54
+ })
55
+
56
+ const slots = useSlots()
57
+ const hasIconSlot = !!slots.icon
58
+
59
+ const {
60
+ value: inputValue,
61
+ errorMessage,
62
+ handleBlur,
63
+ handleChange
64
+ } = useField(name, undefined, {
65
+ initialValue: props.value
66
+ })
67
+ </script>
68
+
69
+ <template>
70
+ <LabelBlock
71
+ v-if="props.label"
72
+ :for="props.name"
73
+ :data-testid="customTestId.label"
74
+ :label="props.label"
75
+ :isRequired="attrs.required"
76
+ />
77
+ <div class="p-inputgroup">
78
+ <div
79
+ class="p-inputgroup-addon"
80
+ v-if="hasIconSlot"
81
+ >
82
+ <slot name="icon"></slot>
83
+ </div>
84
+
85
+ <InputText
86
+ :id="name"
87
+ v-model="inputValue"
88
+ :name="name"
89
+ :readonly="readonly"
90
+ :disabled="disabled"
91
+ :class="[{ 'p-invalid': errorMessage }, $attrs.class, inputClass]"
92
+ type="text"
93
+ :placeholder="props.placeholder"
94
+ @input="handleChange"
95
+ @blur="handleBlur"
96
+ />
97
+ <slot name="button"></slot>
98
+ </div>
99
+ <small
100
+ v-if="errorMessage"
101
+ class="p-error text-xs font-normal leading-tight"
102
+ >
103
+ {{ errorMessage }}
104
+ </small>
105
+ <small
106
+ class="text-xs text-color-secondary font-normal leading-5"
107
+ v-if="props.description"
108
+ >
109
+ {{ props.description }}
110
+ </small>
111
+ </template>
@@ -0,0 +1,87 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
4
+ type __VLS_WithSlots<T, S> = T & (new () => {
5
+ $slots: S;
6
+ });
7
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ value: {
9
+ type: StringConstructor;
10
+ default: string;
11
+ };
12
+ name: {
13
+ type: StringConstructor;
14
+ required: true;
15
+ };
16
+ label: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ disabled: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ readonly: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ placeholder: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ description: {
33
+ type: StringConstructor;
34
+ default: string;
35
+ };
36
+ inputClass: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
40
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
41
+ value: {
42
+ type: StringConstructor;
43
+ default: string;
44
+ };
45
+ name: {
46
+ type: StringConstructor;
47
+ required: true;
48
+ };
49
+ label: {
50
+ type: StringConstructor;
51
+ default: string;
52
+ };
53
+ disabled: {
54
+ type: BooleanConstructor;
55
+ default: boolean;
56
+ };
57
+ readonly: {
58
+ type: BooleanConstructor;
59
+ default: boolean;
60
+ };
61
+ placeholder: {
62
+ type: StringConstructor;
63
+ default: string;
64
+ };
65
+ description: {
66
+ type: StringConstructor;
67
+ default: string;
68
+ };
69
+ inputClass: {
70
+ type: StringConstructor;
71
+ default: string;
72
+ };
73
+ }>> & Readonly<{}>, {
74
+ value: string;
75
+ label: string;
76
+ placeholder: string;
77
+ description: string;
78
+ disabled: boolean;
79
+ readonly: boolean;
80
+ inputClass: string;
81
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
82
+ type __VLS_Slots = {
83
+ icon?: ((props: {}) => any) | undefined;
84
+ } & {
85
+ button?: ((props: {}) => any) | undefined;
86
+ };
87
+ //# sourceMappingURL=field-input-group.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-input-group.vue.d.ts","sourceRoot":"","sources":["field-input-group.vue"],"names":[],"mappings":"wBAmVqB,OAAO,YAAY;;AADxC,4BAA2B,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;qBAEtD,CAAC,EAAE,CAAC;;;AAtCzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EAmCG"}
@@ -0,0 +1,11 @@
1
+ {
2
+ "main": "./field-input-group.vue",
3
+ "module": "./field-input-group.vue",
4
+ "types": "./field-input-group.vue.d.ts",
5
+ "browser": {
6
+ "./sfc": "./field-input-group.vue"
7
+ },
8
+ "sideEffects": [
9
+ "*.vue"
10
+ ]
11
+ }
@@ -0,0 +1,167 @@
1
+ <script setup>
2
+ import Checkbox from 'primevue/checkbox'
3
+ import { useField } from 'vee-validate'
4
+ import { computed, toRef, useSlots, useAttrs } from 'vue'
5
+ import LabelBlock from '../label'
6
+
7
+ const props = defineProps({
8
+ value: {
9
+ type: Array,
10
+ default: () => []
11
+ },
12
+ name: {
13
+ type: String,
14
+ required: true
15
+ },
16
+ label: {
17
+ type: String,
18
+ default: ''
19
+ },
20
+ placeholder: {
21
+ type: String,
22
+ default: ''
23
+ },
24
+ description: {
25
+ type: String,
26
+ default: ''
27
+ },
28
+ optionLabel: {
29
+ type: String,
30
+ default: 'label'
31
+ },
32
+ optionValue: {
33
+ type: String,
34
+ default: 'value'
35
+ },
36
+ optionDisabled: {
37
+ type: [String, Function],
38
+ default: ''
39
+ },
40
+ options: {
41
+ type: Array,
42
+ default: () => []
43
+ },
44
+ loading: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ disabled: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ filter: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ pt: {
57
+ type: Object,
58
+ default: () => {}
59
+ }
60
+ })
61
+
62
+ const emit = defineEmits(['onBlur', 'onChange'])
63
+
64
+ const name = toRef(props, 'name')
65
+ const slots = useSlots()
66
+
67
+ const hasDescriptionSlot = !!slots.description
68
+ const { value: inputValue, errorMessage } = useField(name, undefined, {
69
+ initialValue: props.value
70
+ })
71
+
72
+ const emitBlur = () => {
73
+ emit('onBlur')
74
+ }
75
+
76
+ const emitChange = () => {
77
+ emit('onChange', inputValue.value)
78
+ }
79
+
80
+ const attrs = useAttrs()
81
+
82
+ const customTestId = computed(() => {
83
+ const id = attrs['data-testid'] || 'field-multiselect'
84
+
85
+ return {
86
+ label: `${id}__label`,
87
+ multiselect: `${id}__multiselect`,
88
+ description: `${id}__description`,
89
+ error: `${id}__error-message`,
90
+ filterInput: `${id}__multiselect-filter-input`,
91
+ trigger: `${id}__multiselect-trigger`,
92
+ loadingIcon: `${id}__loading-icon`
93
+ }
94
+ })
95
+ </script>
96
+
97
+ <template>
98
+ <LabelBlock
99
+ :for="props.name"
100
+ :label="props.label"
101
+ :isRequired="$attrs.required"
102
+ :data-testid="customTestId.label"
103
+ v-if="props.label"
104
+ />
105
+
106
+ <div
107
+ class="flex flex-col gap-3"
108
+ :data-testid="customTestId.multiselect"
109
+ >
110
+ <div
111
+ v-for="option in props.options"
112
+ :key="option[props.optionValue]"
113
+ class="flex items-center gap-3"
114
+ >
115
+ <Checkbox
116
+ :id="`${props.name}_${option[props.optionValue]}`"
117
+ :name="props.name"
118
+ :value="option[props.optionValue]"
119
+ v-model="inputValue"
120
+ :disabled="
121
+ props.disabled ||
122
+ (typeof props.optionDisabled === 'function'
123
+ ? props.optionDisabled(option)
124
+ : option[props.optionDisabled])
125
+ "
126
+ @change="emitChange"
127
+ @blur="emitBlur"
128
+ />
129
+ <label
130
+ :for="`${props.name}_${option[props.optionValue]}`"
131
+ class="cursor-pointer"
132
+ :class="{
133
+ 'opacity-50':
134
+ props.disabled ||
135
+ (typeof props.optionDisabled === 'function'
136
+ ? props.optionDisabled(option)
137
+ : option[props.optionDisabled])
138
+ }"
139
+ >
140
+ <div class="font-medium">{{ option[props.optionLabel] }}</div>
141
+ <div
142
+ v-if="option.description"
143
+ class="text-sm text-color-secondary"
144
+ >
145
+ {{ option.description }}
146
+ </div>
147
+ </label>
148
+ </div>
149
+ </div>
150
+
151
+ <small
152
+ v-if="errorMessage"
153
+ :data-testid="customTestId.error"
154
+ class="p-error text-xs font-normal leading-tight"
155
+ >
156
+ {{ errorMessage }}
157
+ </small>
158
+ <small
159
+ class="text-xs text-color-secondary font-normal leading-5"
160
+ :data-testid="customTestId.description"
161
+ v-if="props.description || hasDescriptionSlot"
162
+ >
163
+ <slot name="description">
164
+ {{ props.description }}
165
+ </slot>
166
+ </small>
167
+ </template>