@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,240 @@
1
+ <script setup>
2
+ import Dropdown from 'primevue/dropdown'
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: [String, Number],
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: ''
31
+ },
32
+ optionValue: {
33
+ type: String,
34
+ default: ''
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
+ enableWorkaroundLabelToDisabledOptions: {
49
+ type: Boolean,
50
+ default: false
51
+ },
52
+ disabled: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ filter: {
57
+ type: Boolean,
58
+ default: false
59
+ },
60
+ pt: {
61
+ type: Object,
62
+ default: () => {}
63
+ },
64
+ optionGroupLabel: {
65
+ type: String,
66
+ default: ''
67
+ },
68
+ optionGroupChildren: {
69
+ type: String,
70
+ default: ''
71
+ },
72
+ editable: {
73
+ type: Boolean,
74
+ default: false
75
+ },
76
+ emptyMessage: {
77
+ type: String,
78
+ default: 'No available options'
79
+ },
80
+ emptyFilterMessage: {
81
+ type: String,
82
+ default: 'No results found'
83
+ },
84
+ aditionalError: {
85
+ type: String,
86
+ default: ''
87
+ }
88
+ })
89
+
90
+ const emit = defineEmits(['onBlur', 'onChange', 'onSelectOption'])
91
+
92
+ const name = toRef(props, 'name')
93
+ const slots = useSlots()
94
+
95
+ const hasDescriptionSlot = !!slots.description
96
+ const { value: inputValue, errorMessage } = useField(name, undefined, {
97
+ initialValue: props.value
98
+ })
99
+
100
+ const emitBlur = () => {
101
+ emit('onBlur')
102
+ }
103
+
104
+ const emitChange = () => {
105
+ const selectedOption = props.options.find(
106
+ (option) => option[props.optionValue] === inputValue.value
107
+ )
108
+
109
+ emit('onChange', inputValue.value)
110
+
111
+ if (selectedOption) {
112
+ emit('onSelectOption', selectedOption)
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Workaround to resolve the issue described in https://github.com/primefaces/primevue/issues/4431
118
+ * This should be remove from this field component as soon as the
119
+ * primevue team fixes the issue.
120
+ * When we select a disabled value, the label is not showing
121
+ * @param {*} selectedValue The selected value in the Dropdown component.
122
+ * @returns {string | null} The selected value if it corresponds to a disabled option, or null otherwise.
123
+ */
124
+ const getLabelBySelectedValue = (selectedValue) => {
125
+ const result = props.options.find((option) => option.value === selectedValue)
126
+ return result?.label
127
+ }
128
+ const enableCustomLabel = computed(() => {
129
+ return props.enableWorkaroundLabelToDisabledOptions && !!inputValue.value
130
+ })
131
+ /**
132
+ * end of primevue workaround
133
+ */
134
+
135
+ const attrs = useAttrs()
136
+
137
+ const customTestId = computed(() => {
138
+ const id = attrs['data-testid'] || 'field-dropdown'
139
+
140
+ return {
141
+ label: `${id}__label`,
142
+ dropdown: `${id}__dropdown`,
143
+ value: `${id}__value`,
144
+ description: `${id}__description`,
145
+ error: `${id}__error-message`,
146
+ filterInput: `${id}__dropdown-filter-input`,
147
+ trigger: `${id}__dropdown-trigger`,
148
+ loadingIcon: `${id}__loading-icon`
149
+ }
150
+ })
151
+
152
+ const isDisabledIcon = computed(() => {
153
+ const iconDisabled = props.iconDisabled || 'pi pi-lock'
154
+ return props.disabled ? iconDisabled : ''
155
+ })
156
+
157
+ const passThrough = computed(() => {
158
+ return {
159
+ filterInput: {
160
+ class: 'w-full',
161
+ 'data-testid': customTestId.value.filterInput
162
+ },
163
+ trigger: {
164
+ 'data-testid': customTestId.value.trigger
165
+ },
166
+ loadingIcon: {
167
+ 'data-testid': customTestId.value.loadingIcon
168
+ },
169
+ ...props.pt
170
+ }
171
+ })
172
+ </script>
173
+
174
+ <template>
175
+ <LabelBlock
176
+ :for="props.name"
177
+ :label="props.label"
178
+ :isRequired="$attrs.required"
179
+ :data-testid="customTestId.label"
180
+ v-if="props.label"
181
+ />
182
+ <Dropdown
183
+ :dropdown-icon="isDisabledIcon"
184
+ :editable="props.editable"
185
+ appendTo="self"
186
+ :id="name"
187
+ :name="props.name"
188
+ :loading="props.loading"
189
+ v-model="inputValue"
190
+ :options="props.options"
191
+ :optionLabel="props.optionLabel"
192
+ :optionDisabled="props.optionDisabled"
193
+ :filter="props.filter"
194
+ :optionValue="props.optionValue"
195
+ :optionGroupLabel="props.optionGroupLabel"
196
+ :optionGroupChildren="props.optionGroupChildren"
197
+ :placeholder="props.placeholder"
198
+ :autoFilterFocus="props.filter"
199
+ :emptyMessage="props.emptyMessage"
200
+ :emptyFilterMessage="props.emptyFilterMessage"
201
+ @change="emitChange"
202
+ @blur="emitBlur"
203
+ :class="{ 'p-invalid': aditionalError || errorMessage }"
204
+ v-bind="$attrs"
205
+ :disabled="props.disabled"
206
+ class="w-full"
207
+ :pt="passThrough"
208
+ :data-testid="customTestId.dropdown"
209
+ >
210
+ <template
211
+ v-if="enableCustomLabel"
212
+ #value="slotProps"
213
+ >
214
+ <span :data-testid="customTestId.value">
215
+ {{ getLabelBySelectedValue(slotProps.value) }}
216
+ </span>
217
+ </template>
218
+
219
+ <template #footer>
220
+ <slot name="footer" />
221
+ </template>
222
+ </Dropdown>
223
+
224
+ <small
225
+ v-if="aditionalError || errorMessage"
226
+ :data-testid="customTestId.error"
227
+ class="p-error text-xs font-normal leading-tight"
228
+ >
229
+ {{ aditionalError || errorMessage }}
230
+ </small>
231
+ <small
232
+ class="text-xs text-color-secondary font-normal leading-5"
233
+ :data-testid="customTestId.description"
234
+ v-if="props.description || hasDescriptionSlot"
235
+ >
236
+ <slot name="description">
237
+ {{ props.description }}
238
+ </slot>
239
+ </small>
240
+ </template>
@@ -0,0 +1,203 @@
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 | NumberConstructor)[];
10
+ default: string;
11
+ };
12
+ name: {
13
+ type: StringConstructor;
14
+ required: true;
15
+ };
16
+ label: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ placeholder: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ description: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ };
28
+ optionLabel: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ optionValue: {
33
+ type: StringConstructor;
34
+ default: string;
35
+ };
36
+ optionDisabled: {
37
+ type: (StringConstructor | FunctionConstructor)[];
38
+ default: string;
39
+ };
40
+ options: {
41
+ type: ArrayConstructor;
42
+ default: () => never[];
43
+ };
44
+ loading: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ enableWorkaroundLabelToDisabledOptions: {
49
+ type: BooleanConstructor;
50
+ default: boolean;
51
+ };
52
+ disabled: {
53
+ type: BooleanConstructor;
54
+ default: boolean;
55
+ };
56
+ filter: {
57
+ type: BooleanConstructor;
58
+ default: boolean;
59
+ };
60
+ pt: {
61
+ type: ObjectConstructor;
62
+ default: () => void;
63
+ };
64
+ optionGroupLabel: {
65
+ type: StringConstructor;
66
+ default: string;
67
+ };
68
+ optionGroupChildren: {
69
+ type: StringConstructor;
70
+ default: string;
71
+ };
72
+ editable: {
73
+ type: BooleanConstructor;
74
+ default: boolean;
75
+ };
76
+ emptyMessage: {
77
+ type: StringConstructor;
78
+ default: string;
79
+ };
80
+ emptyFilterMessage: {
81
+ type: StringConstructor;
82
+ default: string;
83
+ };
84
+ aditionalError: {
85
+ type: StringConstructor;
86
+ default: string;
87
+ };
88
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
89
+ onBlur: (...args: any[]) => void;
90
+ onChange: (...args: any[]) => void;
91
+ onSelectOption: (...args: any[]) => void;
92
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
93
+ value: {
94
+ type: (StringConstructor | NumberConstructor)[];
95
+ default: string;
96
+ };
97
+ name: {
98
+ type: StringConstructor;
99
+ required: true;
100
+ };
101
+ label: {
102
+ type: StringConstructor;
103
+ default: string;
104
+ };
105
+ placeholder: {
106
+ type: StringConstructor;
107
+ default: string;
108
+ };
109
+ description: {
110
+ type: StringConstructor;
111
+ default: string;
112
+ };
113
+ optionLabel: {
114
+ type: StringConstructor;
115
+ default: string;
116
+ };
117
+ optionValue: {
118
+ type: StringConstructor;
119
+ default: string;
120
+ };
121
+ optionDisabled: {
122
+ type: (StringConstructor | FunctionConstructor)[];
123
+ default: string;
124
+ };
125
+ options: {
126
+ type: ArrayConstructor;
127
+ default: () => never[];
128
+ };
129
+ loading: {
130
+ type: BooleanConstructor;
131
+ default: boolean;
132
+ };
133
+ enableWorkaroundLabelToDisabledOptions: {
134
+ type: BooleanConstructor;
135
+ default: boolean;
136
+ };
137
+ disabled: {
138
+ type: BooleanConstructor;
139
+ default: boolean;
140
+ };
141
+ filter: {
142
+ type: BooleanConstructor;
143
+ default: boolean;
144
+ };
145
+ pt: {
146
+ type: ObjectConstructor;
147
+ default: () => void;
148
+ };
149
+ optionGroupLabel: {
150
+ type: StringConstructor;
151
+ default: string;
152
+ };
153
+ optionGroupChildren: {
154
+ type: StringConstructor;
155
+ default: string;
156
+ };
157
+ editable: {
158
+ type: BooleanConstructor;
159
+ default: boolean;
160
+ };
161
+ emptyMessage: {
162
+ type: StringConstructor;
163
+ default: string;
164
+ };
165
+ emptyFilterMessage: {
166
+ type: StringConstructor;
167
+ default: string;
168
+ };
169
+ aditionalError: {
170
+ type: StringConstructor;
171
+ default: string;
172
+ };
173
+ }>> & Readonly<{
174
+ onOnBlur?: ((...args: any[]) => any) | undefined;
175
+ onOnChange?: ((...args: any[]) => any) | undefined;
176
+ onOnSelectOption?: ((...args: any[]) => any) | undefined;
177
+ }>, {
178
+ value: string | number;
179
+ label: string;
180
+ placeholder: string;
181
+ description: string;
182
+ disabled: boolean;
183
+ filter: boolean;
184
+ optionLabel: string;
185
+ optionDisabled: string | Function;
186
+ optionGroupLabel: string;
187
+ optionGroupChildren: string;
188
+ loading: boolean;
189
+ pt: Record<string, any>;
190
+ optionValue: string;
191
+ options: unknown[];
192
+ enableWorkaroundLabelToDisabledOptions: boolean;
193
+ editable: boolean;
194
+ emptyMessage: string;
195
+ emptyFilterMessage: string;
196
+ aditionalError: string;
197
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
198
+ type __VLS_Slots = {
199
+ footer?: ((props: {}) => any) | undefined;
200
+ } & {
201
+ description?: ((props: {}) => any) | undefined;
202
+ };
203
+ //# sourceMappingURL=field-dropdown.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-dropdown.vue.d.ts","sourceRoot":"","sources":["field-dropdown.vue"],"names":[],"mappings":"wBA+pBqB,OAAO,YAAY;;AADxC,4BAA2B,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;qBAEtD,CAAC,EAAE,CAAC;;;AAvFzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EAoFG"}
@@ -0,0 +1,11 @@
1
+ {
2
+ "main": "./field-dropdown.vue",
3
+ "module": "./field-dropdown.vue",
4
+ "types": "./field-dropdown.vue.d.ts",
5
+ "browser": {
6
+ "./sfc": "./field-dropdown.vue"
7
+ },
8
+ "sideEffects": [
9
+ "*.vue"
10
+ ]
11
+ }
@@ -0,0 +1,129 @@
1
+ <script setup>
2
+ import { ref, toRef } from 'vue'
3
+ import { useField } from 'vee-validate'
4
+ import Dropdown from 'primevue/dropdown'
5
+
6
+ const emit = defineEmits(['onChange'])
7
+
8
+ const props = defineProps({
9
+ value: {
10
+ type: String,
11
+ default: ''
12
+ },
13
+ name: {
14
+ type: String,
15
+ required: true
16
+ },
17
+ label: {
18
+ type: String,
19
+ default: ''
20
+ },
21
+ placeholder: {
22
+ type: String,
23
+ default: ''
24
+ },
25
+ description: {
26
+ type: String,
27
+ default: ''
28
+ },
29
+ disabled: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ readonly: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ icon: {
38
+ type: String,
39
+ default: ''
40
+ },
41
+ suggestions: {
42
+ type: Array,
43
+ default: () => []
44
+ },
45
+ onComplete: {
46
+ type: Function,
47
+ default: () => {}
48
+ },
49
+ completeOnFocus: {
50
+ type: Boolean,
51
+ default: false
52
+ }
53
+ })
54
+
55
+ const autoCompleteRef = ref(null)
56
+ const nameInput = toRef(props, 'name')
57
+
58
+ const {
59
+ value: inputValue,
60
+ errorMessage,
61
+ handleBlur,
62
+ handleChange
63
+ } = useField(nameInput, undefined, {
64
+ initialValue: props.value
65
+ })
66
+
67
+ const handleChangeEvent = ({ value }) => {
68
+ emit('onChange', value)
69
+ }
70
+
71
+ defineExpose({
72
+ autoCompleteRef
73
+ })
74
+ </script>
75
+
76
+ <template>
77
+ <label
78
+ :for="props.name"
79
+ class="text-color text-base font-medium leading-5"
80
+ >
81
+ {{ props.label }}
82
+ </label>
83
+
84
+ <div
85
+ class="p-inputgroup h-fit"
86
+ :class="{ 'border border-red-500 rounded-md surface-border': errorMessage }"
87
+ >
88
+ <div
89
+ class="p-inputgroup-addon"
90
+ :class="{ 'opacity-20': props.disabled }"
91
+ >
92
+ <i
93
+ v-if="props.icon"
94
+ :class="props.icon"
95
+ class="text-color-secondary"
96
+ />
97
+ </div>
98
+ <Dropdown
99
+ ref="autoCompleteRef"
100
+ :readonly="props.readonly"
101
+ class="w-full"
102
+ :placeholder="props.placeholder"
103
+ :id="props.name"
104
+ :name="props.name"
105
+ v-model="inputValue"
106
+ :suggestions="props.suggestions"
107
+ @complete="props.onComplete"
108
+ :disabled="props.disabled"
109
+ :completeOnFocus="props.completeOnFocus"
110
+ @input="handleChange"
111
+ @blur="handleBlur"
112
+ v-bind="$attrs"
113
+ @change="handleChangeEvent"
114
+ />
115
+ </div>
116
+
117
+ <small
118
+ v-if="errorMessage"
119
+ class="p-error text-xs font-normal leading-tight"
120
+ >
121
+ {{ errorMessage }}
122
+ </small>
123
+ <small
124
+ class="text-xs text-color-secondary font-normal leading-5"
125
+ v-if="props.description"
126
+ >
127
+ {{ props.description }}
128
+ </small>
129
+ </template>
@@ -0,0 +1,111 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ value: {
5
+ type: StringConstructor;
6
+ default: string;
7
+ };
8
+ name: {
9
+ type: StringConstructor;
10
+ required: true;
11
+ };
12
+ label: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ placeholder: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ description: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ disabled: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ readonly: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ icon: {
33
+ type: StringConstructor;
34
+ default: string;
35
+ };
36
+ suggestions: {
37
+ type: ArrayConstructor;
38
+ default: () => never[];
39
+ };
40
+ onComplete: {
41
+ type: FunctionConstructor;
42
+ default: () => void;
43
+ };
44
+ completeOnFocus: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ }>, {
49
+ autoCompleteRef: import("vue").Ref<null, null>;
50
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
51
+ onChange: (...args: any[]) => void;
52
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
53
+ value: {
54
+ type: StringConstructor;
55
+ default: string;
56
+ };
57
+ name: {
58
+ type: StringConstructor;
59
+ required: true;
60
+ };
61
+ label: {
62
+ type: StringConstructor;
63
+ default: string;
64
+ };
65
+ placeholder: {
66
+ type: StringConstructor;
67
+ default: string;
68
+ };
69
+ description: {
70
+ type: StringConstructor;
71
+ default: string;
72
+ };
73
+ disabled: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ readonly: {
78
+ type: BooleanConstructor;
79
+ default: boolean;
80
+ };
81
+ icon: {
82
+ type: StringConstructor;
83
+ default: string;
84
+ };
85
+ suggestions: {
86
+ type: ArrayConstructor;
87
+ default: () => never[];
88
+ };
89
+ onComplete: {
90
+ type: FunctionConstructor;
91
+ default: () => void;
92
+ };
93
+ completeOnFocus: {
94
+ type: BooleanConstructor;
95
+ default: boolean;
96
+ };
97
+ }>> & Readonly<{
98
+ onOnChange?: ((...args: any[]) => any) | undefined;
99
+ }>, {
100
+ value: string;
101
+ label: string;
102
+ placeholder: string;
103
+ description: string;
104
+ disabled: boolean;
105
+ readonly: boolean;
106
+ icon: string;
107
+ suggestions: unknown[];
108
+ onComplete: Function;
109
+ completeOnFocus: boolean;
110
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
111
+ //# sourceMappingURL=field-dropdown-icon.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-dropdown-icon.vue.d.ts","sourceRoot":"","sources":["field-dropdown-icon.vue"],"names":[],"mappings":"wBAuYqB,OAAO,YAAY;;AAlDxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EAiDG"}
@@ -0,0 +1,11 @@
1
+ {
2
+ "main": "./field-dropdown-icon.vue",
3
+ "module": "./field-dropdown-icon.vue",
4
+ "types": "./field-dropdown-icon.vue.d.ts",
5
+ "browser": {
6
+ "./sfc": "./field-dropdown-icon.vue"
7
+ },
8
+ "sideEffects": [
9
+ "*.vue"
10
+ ]
11
+ }