@nuxt/ui 0.4.0 → 2.8.0
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/LICENSE.md +9 -0
- package/README.md +63 -50
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +1234 -0
- package/dist/module.d.ts +1234 -0
- package/dist/module.json +8 -0
- package/dist/module.mjs +407 -0
- package/dist/runtime/app.config.d.ts +1203 -0
- package/dist/runtime/app.config.mjs +1057 -0
- package/dist/runtime/components/data/Table.vue +251 -0
- package/dist/runtime/components/data/Table.vue.d.ts +215 -0
- package/dist/runtime/components/elements/Accordion.vue +138 -0
- package/dist/runtime/components/elements/Accordion.vue.d.ts +80 -0
- package/dist/runtime/components/elements/Alert.vue +120 -0
- package/dist/runtime/components/elements/Alert.vue.d.ts +107 -0
- package/dist/runtime/components/elements/Avatar.vue +149 -0
- package/dist/runtime/components/elements/Avatar.vue.d.ts +115 -0
- package/dist/runtime/components/elements/AvatarGroup.d.ts +37 -0
- package/dist/runtime/components/elements/AvatarGroup.mjs +53 -0
- package/dist/runtime/components/elements/Badge.vue +69 -0
- package/dist/runtime/components/elements/Badge.vue.d.ts +63 -0
- package/dist/runtime/components/elements/Button.vue +182 -0
- package/dist/runtime/components/elements/Button.vue.d.ts +187 -0
- package/dist/runtime/components/elements/ButtonGroup.d.ts +39 -0
- package/dist/runtime/components/elements/ButtonGroup.mjs +70 -0
- package/dist/runtime/components/elements/Dropdown.vue +172 -0
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +96 -0
- package/dist/runtime/components/elements/Icon.vue +15 -0
- package/dist/runtime/components/elements/Icon.vue.d.ts +12 -0
- package/dist/runtime/components/elements/Kbd.vue +55 -0
- package/dist/runtime/components/elements/Kbd.vue.d.ts +42 -0
- package/dist/runtime/components/elements/Link.vue +80 -0
- package/dist/runtime/components/elements/Link.vue.d.ts +9 -0
- package/dist/runtime/components/forms/Checkbox.vue +136 -0
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +129 -0
- package/dist/runtime/components/forms/Form.vue +186 -0
- package/dist/runtime/components/forms/Form.vue.d.ts +50 -0
- package/dist/runtime/components/forms/FormGroup.vue +97 -0
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +98 -0
- package/dist/runtime/components/forms/Input.vue +250 -0
- package/dist/runtime/components/forms/Input.vue.d.ts +214 -0
- package/dist/runtime/components/forms/Radio.vue +122 -0
- package/dist/runtime/components/forms/Radio.vue.d.ts +109 -0
- package/dist/runtime/components/forms/Range.vue +163 -0
- package/dist/runtime/components/forms/Range.vue.d.ts +119 -0
- package/dist/runtime/components/forms/Select.vue +307 -0
- package/dist/runtime/components/forms/Select.vue.d.ts +229 -0
- package/dist/runtime/components/forms/SelectMenu.vue +429 -0
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +330 -0
- package/dist/runtime/components/forms/Textarea.vue +184 -0
- package/dist/runtime/components/forms/Textarea.vue.d.ts +161 -0
- package/dist/runtime/components/forms/Toggle.vue +113 -0
- package/dist/runtime/components/forms/Toggle.vue.d.ts +83 -0
- package/dist/runtime/components/layout/Card.vue +58 -0
- package/dist/runtime/components/layout/Card.vue.d.ts +31 -0
- package/dist/runtime/components/layout/Container.vue +43 -0
- package/dist/runtime/components/layout/Container.vue.d.ts +31 -0
- package/dist/runtime/components/layout/Skeleton.vue +37 -0
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +22 -0
- package/dist/runtime/components/navigation/CommandPalette.vue +304 -0
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +224 -0
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +152 -0
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue.d.ts +63 -0
- package/dist/runtime/components/navigation/Pagination.vue +197 -0
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +125 -0
- package/dist/runtime/components/navigation/Tabs.vue +138 -0
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +69 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue +79 -0
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +37 -0
- package/dist/runtime/components/overlays/ContextMenu.vue +74 -0
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +54 -0
- package/dist/runtime/components/overlays/Modal.vue +113 -0
- package/dist/runtime/components/overlays/Modal.vue.d.ts +82 -0
- package/dist/runtime/components/overlays/Notification.vue +197 -0
- package/dist/runtime/components/overlays/Notification.vue.d.ts +126 -0
- package/dist/runtime/components/overlays/Notifications.vue +61 -0
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +41 -0
- package/dist/runtime/components/overlays/Popover.vue +139 -0
- package/dist/runtime/components/overlays/Popover.vue.d.ts +82 -0
- package/dist/runtime/components/overlays/Slideover.vue +103 -0
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +84 -0
- package/dist/runtime/components/overlays/Tooltip.vue +118 -0
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +82 -0
- package/dist/runtime/composables/defineShortcuts.d.ts +13 -0
- package/dist/runtime/composables/defineShortcuts.mjs +108 -0
- package/dist/runtime/composables/useCopyToClipboard.d.ts +10 -0
- package/dist/runtime/composables/useCopyToClipboard.mjs +26 -0
- package/dist/runtime/composables/useFormGroup.d.ts +6 -0
- package/dist/runtime/composables/useFormGroup.mjs +30 -0
- package/dist/runtime/composables/usePopper.d.ts +232 -0
- package/dist/runtime/composables/usePopper.mjs +78 -0
- package/dist/runtime/composables/useShortcuts.d.ts +12 -0
- package/dist/runtime/composables/useShortcuts.mjs +24 -0
- package/dist/runtime/composables/useTimer.d.ts +8 -0
- package/dist/runtime/composables/useTimer.mjs +51 -0
- package/dist/runtime/composables/useToast.d.ts +18 -0
- package/dist/runtime/composables/useToast.mjs +22 -0
- package/dist/runtime/plugins/colors.d.ts +2 -0
- package/dist/runtime/plugins/colors.mjs +46 -0
- package/dist/runtime/types/accordion.d.ts +9 -0
- package/dist/runtime/types/avatar.d.ts +9 -0
- package/dist/runtime/types/button.d.ts +23 -0
- package/dist/runtime/types/clipboard.d.ts +3 -0
- package/dist/runtime/types/command-palette.d.ts +26 -0
- package/dist/runtime/types/dropdown.d.ts +13 -0
- package/dist/runtime/types/form.d.ts +21 -0
- package/dist/runtime/types/index.d.ts +12 -0
- package/dist/runtime/types/link.d.ts +8 -0
- package/dist/runtime/types/notification.d.ts +22 -0
- package/dist/runtime/types/popper.d.ts +14 -0
- package/dist/runtime/types/tabs.d.ts +6 -0
- package/dist/runtime/types/vertical-navigation.d.ts +11 -0
- package/dist/runtime/ui.css +13 -0
- package/dist/runtime/utils/StateEmitter.d.ts +17 -0
- package/dist/runtime/utils/StateEmitter.mjs +21 -0
- package/dist/runtime/utils/index.d.ts +11 -0
- package/dist/runtime/utils/index.mjs +33 -0
- package/dist/types.d.mts +15 -0
- package/dist/types.d.ts +15 -0
- package/package.json +57 -40
- package/LICENSE +0 -21
- package/dist/assets/styles.css +0 -14
- package/dist/components/NButton.vue +0 -19
- package/dist/components/NCard.vue +0 -5
- package/dist/components/NCheckbox.vue +0 -35
- package/dist/components/NDarkToggle.vue +0 -28
- package/dist/components/NDialog.vue +0 -59
- package/dist/components/NDropdown.vue +0 -31
- package/dist/components/NIcon.vue +0 -9
- package/dist/components/NLink.vue +0 -17
- package/dist/components/NRadio.vue +0 -40
- package/dist/components/NSwitch.vue +0 -37
- package/dist/components/NTextInput.vue +0 -34
- package/dist/components/NTip.vue +0 -16
- package/dist/components/NuxtContentLogo.vue +0 -7
- package/dist/components/NuxtExampleLayout.vue +0 -82
- package/dist/components/NuxtLogo.vue +0 -20
- package/dist/components/nuxt/NDarkToggle.vue +0 -28
- package/dist/nuxt.d.ts +0 -16
- package/dist/nuxt.mjs +0 -36
- package/dist/unocss.d.ts +0 -7
- package/dist/unocss.mjs +0 -117
- package/nuxt.cjs +0 -7
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { PopperOptions } from '../../types/popper';
|
|
4
|
+
declare const _default: import("vue").DefineComponent<{
|
|
5
|
+
modelValue: {
|
|
6
|
+
type: (ObjectConstructor | ArrayConstructor | StringConstructor | NumberConstructor)[];
|
|
7
|
+
default: string;
|
|
8
|
+
};
|
|
9
|
+
by: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
default: undefined;
|
|
12
|
+
};
|
|
13
|
+
options: {
|
|
14
|
+
type: PropType<string[] | {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
|
+
}[]>;
|
|
18
|
+
default: () => never[];
|
|
19
|
+
};
|
|
20
|
+
name: {
|
|
21
|
+
type: StringConstructor;
|
|
22
|
+
default: null;
|
|
23
|
+
};
|
|
24
|
+
required: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
icon: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: null;
|
|
31
|
+
};
|
|
32
|
+
loadingIcon: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: () => any;
|
|
35
|
+
};
|
|
36
|
+
leadingIcon: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: null;
|
|
39
|
+
};
|
|
40
|
+
trailingIcon: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
default: () => any;
|
|
43
|
+
};
|
|
44
|
+
trailing: {
|
|
45
|
+
type: BooleanConstructor;
|
|
46
|
+
default: boolean;
|
|
47
|
+
};
|
|
48
|
+
leading: {
|
|
49
|
+
type: BooleanConstructor;
|
|
50
|
+
default: boolean;
|
|
51
|
+
};
|
|
52
|
+
loading: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
56
|
+
selectedIcon: {
|
|
57
|
+
type: StringConstructor;
|
|
58
|
+
default: () => any;
|
|
59
|
+
};
|
|
60
|
+
disabled: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: boolean;
|
|
63
|
+
};
|
|
64
|
+
multiple: {
|
|
65
|
+
type: BooleanConstructor;
|
|
66
|
+
default: boolean;
|
|
67
|
+
};
|
|
68
|
+
searchable: {
|
|
69
|
+
type: PropType<boolean | ((query: string) => Promise<any[]> | any[])>;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
searchablePlaceholder: {
|
|
73
|
+
type: StringConstructor;
|
|
74
|
+
default: string;
|
|
75
|
+
};
|
|
76
|
+
debounce: {
|
|
77
|
+
type: NumberConstructor;
|
|
78
|
+
default: number;
|
|
79
|
+
};
|
|
80
|
+
creatable: {
|
|
81
|
+
type: BooleanConstructor;
|
|
82
|
+
default: boolean;
|
|
83
|
+
};
|
|
84
|
+
placeholder: {
|
|
85
|
+
type: StringConstructor;
|
|
86
|
+
default: null;
|
|
87
|
+
};
|
|
88
|
+
padded: {
|
|
89
|
+
type: BooleanConstructor;
|
|
90
|
+
default: boolean;
|
|
91
|
+
};
|
|
92
|
+
size: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: () => any;
|
|
95
|
+
validator(value: string): boolean;
|
|
96
|
+
};
|
|
97
|
+
color: {
|
|
98
|
+
type: StringConstructor;
|
|
99
|
+
default: () => any;
|
|
100
|
+
validator(value: string): boolean;
|
|
101
|
+
};
|
|
102
|
+
variant: {
|
|
103
|
+
type: StringConstructor;
|
|
104
|
+
default: () => any;
|
|
105
|
+
validator(value: string): boolean;
|
|
106
|
+
};
|
|
107
|
+
optionAttribute: {
|
|
108
|
+
type: StringConstructor;
|
|
109
|
+
default: string;
|
|
110
|
+
};
|
|
111
|
+
valueAttribute: {
|
|
112
|
+
type: StringConstructor;
|
|
113
|
+
default: null;
|
|
114
|
+
};
|
|
115
|
+
searchAttributes: {
|
|
116
|
+
type: ArrayConstructor;
|
|
117
|
+
default: null;
|
|
118
|
+
};
|
|
119
|
+
popper: {
|
|
120
|
+
type: PropType<PopperOptions>;
|
|
121
|
+
default: () => {};
|
|
122
|
+
};
|
|
123
|
+
selectClass: {
|
|
124
|
+
type: StringConstructor;
|
|
125
|
+
default: null;
|
|
126
|
+
};
|
|
127
|
+
ui: {
|
|
128
|
+
type: PropType<any>;
|
|
129
|
+
default: () => {};
|
|
130
|
+
};
|
|
131
|
+
uiMenu: {
|
|
132
|
+
type: PropType<any>;
|
|
133
|
+
default: () => {};
|
|
134
|
+
};
|
|
135
|
+
}, {
|
|
136
|
+
attrs: import("lodash").Omit<{
|
|
137
|
+
[x: string]: unknown;
|
|
138
|
+
}, "class">;
|
|
139
|
+
uiMenu: import("vue").ComputedRef<any>;
|
|
140
|
+
trigger: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
141
|
+
container: import("vue").Ref<import("@vueuse/core").MaybeElement>;
|
|
142
|
+
isLeading: import("vue").ComputedRef<string | true>;
|
|
143
|
+
isTrailing: import("vue").ComputedRef<string | true | undefined>;
|
|
144
|
+
wrapperClass: import("vue").ComputedRef<string>;
|
|
145
|
+
selectClass: import("vue").ComputedRef<string>;
|
|
146
|
+
leadingIconName: import("vue").ComputedRef<string | undefined>;
|
|
147
|
+
leadingIconClass: import("vue").ComputedRef<string>;
|
|
148
|
+
leadingWrapperIconClass: import("vue").ComputedRef<string>;
|
|
149
|
+
trailingIconName: import("vue").ComputedRef<string | undefined>;
|
|
150
|
+
trailingIconClass: import("vue").ComputedRef<string>;
|
|
151
|
+
trailingWrapperIconClass: import("vue").ComputedRef<string>;
|
|
152
|
+
filteredOptions: import("vue").Ref<any[]>;
|
|
153
|
+
queryOption: import("vue").ComputedRef<{
|
|
154
|
+
[x: string]: string;
|
|
155
|
+
} | null>;
|
|
156
|
+
query: import("vue").Ref<string>;
|
|
157
|
+
onUpdate: (event: any) => void;
|
|
158
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "open" | "update:modelValue")[], "change" | "close" | "open" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
159
|
+
modelValue: {
|
|
160
|
+
type: (ObjectConstructor | ArrayConstructor | StringConstructor | NumberConstructor)[];
|
|
161
|
+
default: string;
|
|
162
|
+
};
|
|
163
|
+
by: {
|
|
164
|
+
type: StringConstructor;
|
|
165
|
+
default: undefined;
|
|
166
|
+
};
|
|
167
|
+
options: {
|
|
168
|
+
type: PropType<string[] | {
|
|
169
|
+
[key: string]: any;
|
|
170
|
+
disabled?: boolean | undefined;
|
|
171
|
+
}[]>;
|
|
172
|
+
default: () => never[];
|
|
173
|
+
};
|
|
174
|
+
name: {
|
|
175
|
+
type: StringConstructor;
|
|
176
|
+
default: null;
|
|
177
|
+
};
|
|
178
|
+
required: {
|
|
179
|
+
type: BooleanConstructor;
|
|
180
|
+
default: boolean;
|
|
181
|
+
};
|
|
182
|
+
icon: {
|
|
183
|
+
type: StringConstructor;
|
|
184
|
+
default: null;
|
|
185
|
+
};
|
|
186
|
+
loadingIcon: {
|
|
187
|
+
type: StringConstructor;
|
|
188
|
+
default: () => any;
|
|
189
|
+
};
|
|
190
|
+
leadingIcon: {
|
|
191
|
+
type: StringConstructor;
|
|
192
|
+
default: null;
|
|
193
|
+
};
|
|
194
|
+
trailingIcon: {
|
|
195
|
+
type: StringConstructor;
|
|
196
|
+
default: () => any;
|
|
197
|
+
};
|
|
198
|
+
trailing: {
|
|
199
|
+
type: BooleanConstructor;
|
|
200
|
+
default: boolean;
|
|
201
|
+
};
|
|
202
|
+
leading: {
|
|
203
|
+
type: BooleanConstructor;
|
|
204
|
+
default: boolean;
|
|
205
|
+
};
|
|
206
|
+
loading: {
|
|
207
|
+
type: BooleanConstructor;
|
|
208
|
+
default: boolean;
|
|
209
|
+
};
|
|
210
|
+
selectedIcon: {
|
|
211
|
+
type: StringConstructor;
|
|
212
|
+
default: () => any;
|
|
213
|
+
};
|
|
214
|
+
disabled: {
|
|
215
|
+
type: BooleanConstructor;
|
|
216
|
+
default: boolean;
|
|
217
|
+
};
|
|
218
|
+
multiple: {
|
|
219
|
+
type: BooleanConstructor;
|
|
220
|
+
default: boolean;
|
|
221
|
+
};
|
|
222
|
+
searchable: {
|
|
223
|
+
type: PropType<boolean | ((query: string) => Promise<any[]> | any[])>;
|
|
224
|
+
default: boolean;
|
|
225
|
+
};
|
|
226
|
+
searchablePlaceholder: {
|
|
227
|
+
type: StringConstructor;
|
|
228
|
+
default: string;
|
|
229
|
+
};
|
|
230
|
+
debounce: {
|
|
231
|
+
type: NumberConstructor;
|
|
232
|
+
default: number;
|
|
233
|
+
};
|
|
234
|
+
creatable: {
|
|
235
|
+
type: BooleanConstructor;
|
|
236
|
+
default: boolean;
|
|
237
|
+
};
|
|
238
|
+
placeholder: {
|
|
239
|
+
type: StringConstructor;
|
|
240
|
+
default: null;
|
|
241
|
+
};
|
|
242
|
+
padded: {
|
|
243
|
+
type: BooleanConstructor;
|
|
244
|
+
default: boolean;
|
|
245
|
+
};
|
|
246
|
+
size: {
|
|
247
|
+
type: StringConstructor;
|
|
248
|
+
default: () => any;
|
|
249
|
+
validator(value: string): boolean;
|
|
250
|
+
};
|
|
251
|
+
color: {
|
|
252
|
+
type: StringConstructor;
|
|
253
|
+
default: () => any;
|
|
254
|
+
validator(value: string): boolean;
|
|
255
|
+
};
|
|
256
|
+
variant: {
|
|
257
|
+
type: StringConstructor;
|
|
258
|
+
default: () => any;
|
|
259
|
+
validator(value: string): boolean;
|
|
260
|
+
};
|
|
261
|
+
optionAttribute: {
|
|
262
|
+
type: StringConstructor;
|
|
263
|
+
default: string;
|
|
264
|
+
};
|
|
265
|
+
valueAttribute: {
|
|
266
|
+
type: StringConstructor;
|
|
267
|
+
default: null;
|
|
268
|
+
};
|
|
269
|
+
searchAttributes: {
|
|
270
|
+
type: ArrayConstructor;
|
|
271
|
+
default: null;
|
|
272
|
+
};
|
|
273
|
+
popper: {
|
|
274
|
+
type: PropType<PopperOptions>;
|
|
275
|
+
default: () => {};
|
|
276
|
+
};
|
|
277
|
+
selectClass: {
|
|
278
|
+
type: StringConstructor;
|
|
279
|
+
default: null;
|
|
280
|
+
};
|
|
281
|
+
ui: {
|
|
282
|
+
type: PropType<any>;
|
|
283
|
+
default: () => {};
|
|
284
|
+
};
|
|
285
|
+
uiMenu: {
|
|
286
|
+
type: PropType<any>;
|
|
287
|
+
default: () => {};
|
|
288
|
+
};
|
|
289
|
+
}>> & {
|
|
290
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
291
|
+
onOpen?: ((...args: any[]) => any) | undefined;
|
|
292
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
293
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
294
|
+
}, {
|
|
295
|
+
icon: string;
|
|
296
|
+
color: string;
|
|
297
|
+
ui: any;
|
|
298
|
+
name: string;
|
|
299
|
+
options: string[] | {
|
|
300
|
+
[key: string]: any;
|
|
301
|
+
disabled?: boolean | undefined;
|
|
302
|
+
}[];
|
|
303
|
+
popper: PopperOptions;
|
|
304
|
+
modelValue: string | number | unknown[] | Record<string, any>;
|
|
305
|
+
by: string;
|
|
306
|
+
loading: boolean;
|
|
307
|
+
disabled: boolean;
|
|
308
|
+
multiple: boolean;
|
|
309
|
+
variant: string;
|
|
310
|
+
required: boolean;
|
|
311
|
+
size: string;
|
|
312
|
+
placeholder: string;
|
|
313
|
+
padded: boolean;
|
|
314
|
+
loadingIcon: string;
|
|
315
|
+
leadingIcon: string;
|
|
316
|
+
trailingIcon: string;
|
|
317
|
+
trailing: boolean;
|
|
318
|
+
leading: boolean;
|
|
319
|
+
optionAttribute: string;
|
|
320
|
+
valueAttribute: string;
|
|
321
|
+
selectClass: string;
|
|
322
|
+
selectedIcon: string;
|
|
323
|
+
searchable: boolean | ((query: string) => Promise<any[]> | any[]);
|
|
324
|
+
searchablePlaceholder: string;
|
|
325
|
+
debounce: number;
|
|
326
|
+
creatable: boolean;
|
|
327
|
+
searchAttributes: unknown[];
|
|
328
|
+
uiMenu: any;
|
|
329
|
+
}, {}>;
|
|
330
|
+
export default _default;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="wrapperClass">
|
|
3
|
+
<textarea
|
|
4
|
+
ref="textarea"
|
|
5
|
+
:value="modelValue"
|
|
6
|
+
:name="name"
|
|
7
|
+
:rows="rows"
|
|
8
|
+
:required="required"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
:placeholder="placeholder"
|
|
11
|
+
class="form-textarea"
|
|
12
|
+
:class="textareaClass"
|
|
13
|
+
v-bind="attrs"
|
|
14
|
+
@input="onInput"
|
|
15
|
+
@blur="onBlur"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
import { ref, computed, watch, onMounted, nextTick, defineComponent } from "vue";
|
|
22
|
+
import { omit } from "lodash-es";
|
|
23
|
+
import { twMerge, twJoin } from "tailwind-merge";
|
|
24
|
+
import { defuTwMerge } from "../../utils";
|
|
25
|
+
import { useFormGroup } from "../../composables/useFormGroup";
|
|
26
|
+
import { useAppConfig } from "#imports";
|
|
27
|
+
import appConfig from "#build/app.config";
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
inheritAttrs: false,
|
|
30
|
+
props: {
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: [String, Number],
|
|
33
|
+
default: ""
|
|
34
|
+
},
|
|
35
|
+
name: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: null
|
|
38
|
+
},
|
|
39
|
+
placeholder: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: null
|
|
42
|
+
},
|
|
43
|
+
required: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
disabled: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
rows: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: 3
|
|
54
|
+
},
|
|
55
|
+
autoresize: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
autofocus: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
resize: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
padded: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: true
|
|
70
|
+
},
|
|
71
|
+
size: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: () => appConfig.ui.textarea.default.size,
|
|
74
|
+
validator(value) {
|
|
75
|
+
return Object.keys(appConfig.ui.textarea.size).includes(value);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
color: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: () => appConfig.ui.textarea.default.color,
|
|
81
|
+
validator(value) {
|
|
82
|
+
return [...appConfig.ui.colors, ...Object.keys(appConfig.ui.textarea.color)].includes(value);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
variant: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: () => appConfig.ui.textarea.default.variant,
|
|
88
|
+
validator(value) {
|
|
89
|
+
return [
|
|
90
|
+
...Object.keys(appConfig.ui.textarea.variant),
|
|
91
|
+
...Object.values(appConfig.ui.textarea.color).flatMap((value2) => Object.keys(value2))
|
|
92
|
+
].includes(value);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
textareaClass: {
|
|
96
|
+
type: String,
|
|
97
|
+
default: null
|
|
98
|
+
},
|
|
99
|
+
ui: {
|
|
100
|
+
type: Object,
|
|
101
|
+
default: () => ({})
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
emits: ["update:modelValue", "blur"],
|
|
105
|
+
setup(props, { emit, attrs }) {
|
|
106
|
+
const textarea = ref(null);
|
|
107
|
+
const appConfig2 = useAppConfig();
|
|
108
|
+
const ui = computed(() => defuTwMerge({}, props.ui, appConfig2.ui.textarea));
|
|
109
|
+
const { emitFormBlur, emitFormInput, formGroup } = useFormGroup();
|
|
110
|
+
const color = computed(() => formGroup?.error?.value ? "red" : props.color);
|
|
111
|
+
const size = computed(() => formGroup?.size?.value ?? props.size);
|
|
112
|
+
const autoFocus = () => {
|
|
113
|
+
if (props.autofocus) {
|
|
114
|
+
textarea.value?.focus();
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const autoResize = () => {
|
|
118
|
+
if (props.autoresize) {
|
|
119
|
+
if (!textarea.value) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
textarea.value.rows = props.rows;
|
|
123
|
+
const styles = window.getComputedStyle(textarea.value);
|
|
124
|
+
const paddingTop = parseInt(styles.paddingTop);
|
|
125
|
+
const paddingBottom = parseInt(styles.paddingBottom);
|
|
126
|
+
const padding = paddingTop + paddingBottom;
|
|
127
|
+
const lineHeight = parseInt(styles.lineHeight);
|
|
128
|
+
const { scrollHeight } = textarea.value;
|
|
129
|
+
const newRows = (scrollHeight - padding) / lineHeight;
|
|
130
|
+
if (newRows > props.rows) {
|
|
131
|
+
textarea.value.rows = newRows;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const onInput = (event) => {
|
|
136
|
+
autoResize();
|
|
137
|
+
emit("update:modelValue", event.target.value);
|
|
138
|
+
emitFormInput();
|
|
139
|
+
};
|
|
140
|
+
const onBlur = (event) => {
|
|
141
|
+
emit("blur", event);
|
|
142
|
+
emitFormBlur();
|
|
143
|
+
};
|
|
144
|
+
onMounted(() => {
|
|
145
|
+
setTimeout(() => {
|
|
146
|
+
autoFocus();
|
|
147
|
+
}, 100);
|
|
148
|
+
});
|
|
149
|
+
watch(() => props.modelValue, () => {
|
|
150
|
+
nextTick(autoResize);
|
|
151
|
+
});
|
|
152
|
+
onMounted(() => {
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
autoFocus();
|
|
155
|
+
autoResize();
|
|
156
|
+
}, 100);
|
|
157
|
+
});
|
|
158
|
+
const wrapperClass = computed(() => twMerge(ui.value.wrapper, attrs.class));
|
|
159
|
+
const textareaClass = computed(() => {
|
|
160
|
+
const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
|
|
161
|
+
return twMerge(twJoin(
|
|
162
|
+
ui.value.base,
|
|
163
|
+
ui.value.rounded,
|
|
164
|
+
ui.value.placeholder,
|
|
165
|
+
ui.value.size[size.value],
|
|
166
|
+
props.padded ? ui.value.padding[size.value] : "p-0",
|
|
167
|
+
variant?.replaceAll("{color}", color.value),
|
|
168
|
+
!props.resize && "resize-none"
|
|
169
|
+
), props.textareaClass);
|
|
170
|
+
});
|
|
171
|
+
return {
|
|
172
|
+
attrs: omit(attrs, ["class"]),
|
|
173
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
174
|
+
ui,
|
|
175
|
+
textarea,
|
|
176
|
+
wrapperClass,
|
|
177
|
+
// eslint-disable-next-line vue/no-dupe-keys
|
|
178
|
+
textareaClass,
|
|
179
|
+
onInput,
|
|
180
|
+
onBlur
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
</script>
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
modelValue: {
|
|
5
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
name: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: null;
|
|
11
|
+
};
|
|
12
|
+
placeholder: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: null;
|
|
15
|
+
};
|
|
16
|
+
required: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
disabled: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
rows: {
|
|
25
|
+
type: NumberConstructor;
|
|
26
|
+
default: number;
|
|
27
|
+
};
|
|
28
|
+
autoresize: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
autofocus: {
|
|
33
|
+
type: BooleanConstructor;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
resize: {
|
|
37
|
+
type: BooleanConstructor;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
padded: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
size: {
|
|
45
|
+
type: StringConstructor;
|
|
46
|
+
default: () => any;
|
|
47
|
+
validator(value: string): boolean;
|
|
48
|
+
};
|
|
49
|
+
color: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
default: () => any;
|
|
52
|
+
validator(value: string): boolean;
|
|
53
|
+
};
|
|
54
|
+
variant: {
|
|
55
|
+
type: StringConstructor;
|
|
56
|
+
default: () => any;
|
|
57
|
+
validator(value: string): boolean;
|
|
58
|
+
};
|
|
59
|
+
textareaClass: {
|
|
60
|
+
type: StringConstructor;
|
|
61
|
+
default: null;
|
|
62
|
+
};
|
|
63
|
+
ui: {
|
|
64
|
+
type: PropType<any>;
|
|
65
|
+
default: () => {};
|
|
66
|
+
};
|
|
67
|
+
}, {
|
|
68
|
+
attrs: import("lodash").Omit<{
|
|
69
|
+
[x: string]: unknown;
|
|
70
|
+
}, "class">;
|
|
71
|
+
ui: import("vue").ComputedRef<any>;
|
|
72
|
+
textarea: import("vue").Ref<HTMLTextAreaElement | null>;
|
|
73
|
+
wrapperClass: import("vue").ComputedRef<string>;
|
|
74
|
+
textareaClass: import("vue").ComputedRef<string>;
|
|
75
|
+
onInput: (event: InputEvent) => void;
|
|
76
|
+
onBlur: (event: FocusEvent) => void;
|
|
77
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("blur" | "update:modelValue")[], "blur" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
78
|
+
modelValue: {
|
|
79
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
80
|
+
default: string;
|
|
81
|
+
};
|
|
82
|
+
name: {
|
|
83
|
+
type: StringConstructor;
|
|
84
|
+
default: null;
|
|
85
|
+
};
|
|
86
|
+
placeholder: {
|
|
87
|
+
type: StringConstructor;
|
|
88
|
+
default: null;
|
|
89
|
+
};
|
|
90
|
+
required: {
|
|
91
|
+
type: BooleanConstructor;
|
|
92
|
+
default: boolean;
|
|
93
|
+
};
|
|
94
|
+
disabled: {
|
|
95
|
+
type: BooleanConstructor;
|
|
96
|
+
default: boolean;
|
|
97
|
+
};
|
|
98
|
+
rows: {
|
|
99
|
+
type: NumberConstructor;
|
|
100
|
+
default: number;
|
|
101
|
+
};
|
|
102
|
+
autoresize: {
|
|
103
|
+
type: BooleanConstructor;
|
|
104
|
+
default: boolean;
|
|
105
|
+
};
|
|
106
|
+
autofocus: {
|
|
107
|
+
type: BooleanConstructor;
|
|
108
|
+
default: boolean;
|
|
109
|
+
};
|
|
110
|
+
resize: {
|
|
111
|
+
type: BooleanConstructor;
|
|
112
|
+
default: boolean;
|
|
113
|
+
};
|
|
114
|
+
padded: {
|
|
115
|
+
type: BooleanConstructor;
|
|
116
|
+
default: boolean;
|
|
117
|
+
};
|
|
118
|
+
size: {
|
|
119
|
+
type: StringConstructor;
|
|
120
|
+
default: () => any;
|
|
121
|
+
validator(value: string): boolean;
|
|
122
|
+
};
|
|
123
|
+
color: {
|
|
124
|
+
type: StringConstructor;
|
|
125
|
+
default: () => any;
|
|
126
|
+
validator(value: string): boolean;
|
|
127
|
+
};
|
|
128
|
+
variant: {
|
|
129
|
+
type: StringConstructor;
|
|
130
|
+
default: () => any;
|
|
131
|
+
validator(value: string): boolean;
|
|
132
|
+
};
|
|
133
|
+
textareaClass: {
|
|
134
|
+
type: StringConstructor;
|
|
135
|
+
default: null;
|
|
136
|
+
};
|
|
137
|
+
ui: {
|
|
138
|
+
type: PropType<any>;
|
|
139
|
+
default: () => {};
|
|
140
|
+
};
|
|
141
|
+
}>> & {
|
|
142
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
143
|
+
onBlur?: ((...args: any[]) => any) | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
resize: boolean;
|
|
146
|
+
color: string;
|
|
147
|
+
ui: any;
|
|
148
|
+
name: string;
|
|
149
|
+
modelValue: string | number;
|
|
150
|
+
rows: number;
|
|
151
|
+
disabled: boolean;
|
|
152
|
+
variant: string;
|
|
153
|
+
required: boolean;
|
|
154
|
+
size: string;
|
|
155
|
+
placeholder: string;
|
|
156
|
+
padded: boolean;
|
|
157
|
+
autofocus: boolean;
|
|
158
|
+
autoresize: boolean;
|
|
159
|
+
textareaClass: string;
|
|
160
|
+
}, {}>;
|
|
161
|
+
export default _default;
|