@nuxt/ui 2.10.0 → 2.11.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.
- package/README.md +11 -0
- package/dist/module.d.mts +387 -104
- package/dist/module.d.ts +387 -104
- package/dist/module.json +1 -1
- package/dist/module.mjs +16 -7
- package/dist/runtime/components/data/Table.vue +3 -3
- package/dist/runtime/components/data/Table.vue.d.ts +7 -7
- package/dist/runtime/components/elements/Accordion.vue +2 -2
- package/dist/runtime/components/elements/Accordion.vue.d.ts +7 -7
- package/dist/runtime/components/elements/Alert.vue +13 -12
- package/dist/runtime/components/elements/Alert.vue.d.ts +12 -11
- package/dist/runtime/components/elements/Avatar.vue +2 -2
- package/dist/runtime/components/elements/Avatar.vue.d.ts +11 -10
- package/dist/runtime/components/elements/AvatarGroup.d.ts +11 -10
- package/dist/runtime/components/elements/AvatarGroup.mjs +2 -2
- package/dist/runtime/components/elements/Badge.vue +6 -4
- package/dist/runtime/components/elements/Badge.vue.d.ts +11 -11
- package/dist/runtime/components/elements/Button.vue +16 -12
- package/dist/runtime/components/elements/Button.vue.d.ts +13 -12
- package/dist/runtime/components/elements/ButtonGroup.d.ts +12 -11
- package/dist/runtime/components/elements/ButtonGroup.mjs +8 -34
- package/dist/runtime/components/elements/Chip.vue +85 -0
- package/dist/runtime/components/elements/Chip.vue.d.ts +90 -0
- package/dist/runtime/components/elements/Dropdown.vue +35 -21
- package/dist/runtime/components/elements/Dropdown.vue.d.ts +13 -7
- package/dist/runtime/components/elements/Icon.vue +16 -2
- package/dist/runtime/components/elements/Icon.vue.d.ts +14 -2
- package/dist/runtime/components/elements/Kbd.vue +2 -2
- package/dist/runtime/components/elements/Kbd.vue.d.ts +12 -11
- package/dist/runtime/components/elements/Link.vue +2 -5
- package/dist/runtime/components/elements/Meter.vue +2 -2
- package/dist/runtime/components/elements/Meter.vue.d.ts +9 -9
- package/dist/runtime/components/elements/MeterGroup.d.ts +10 -10
- package/dist/runtime/components/elements/MeterGroup.mjs +8 -21
- package/dist/runtime/components/elements/Progress.vue +6 -95
- package/dist/runtime/components/elements/Progress.vue.d.ts +123 -1
- package/dist/runtime/components/forms/Checkbox.vue +8 -10
- package/dist/runtime/components/forms/Checkbox.vue.d.ts +10 -10
- package/dist/runtime/components/forms/Form.vue +1 -1
- package/dist/runtime/components/forms/FormGroup.vue +9 -5
- package/dist/runtime/components/forms/FormGroup.vue.d.ts +21 -11
- package/dist/runtime/components/forms/Input.vue +43 -12
- package/dist/runtime/components/forms/Input.vue.d.ts +38 -15
- package/dist/runtime/components/forms/Radio.vue +18 -12
- package/dist/runtime/components/forms/Radio.vue.d.ts +11 -10
- package/dist/runtime/components/forms/RadioGroup.vue +3 -3
- package/dist/runtime/components/forms/RadioGroup.vue.d.ts +13 -13
- package/dist/runtime/components/forms/Range.vue +5 -5
- package/dist/runtime/components/forms/Range.vue.d.ts +11 -10
- package/dist/runtime/components/forms/Select.vue +12 -9
- package/dist/runtime/components/forms/Select.vue.d.ts +15 -14
- package/dist/runtime/components/forms/SelectMenu.vue +42 -25
- package/dist/runtime/components/forms/SelectMenu.vue.d.ts +28 -19
- package/dist/runtime/components/forms/Textarea.vue +36 -6
- package/dist/runtime/components/forms/Textarea.vue.d.ts +37 -14
- package/dist/runtime/components/forms/Toggle.vue +25 -7
- package/dist/runtime/components/forms/Toggle.vue.d.ts +20 -7
- package/dist/runtime/components/layout/Card.vue +2 -2
- package/dist/runtime/components/layout/Card.vue.d.ts +7 -7
- package/dist/runtime/components/layout/Container.vue +2 -2
- package/dist/runtime/components/layout/Container.vue.d.ts +7 -7
- package/dist/runtime/components/layout/Divider.vue +3 -8
- package/dist/runtime/components/layout/Divider.vue.d.ts +9 -9
- package/dist/runtime/components/layout/Skeleton.vue +2 -2
- package/dist/runtime/components/layout/Skeleton.vue.d.ts +7 -7
- package/dist/runtime/components/navigation/Breadcrumb.vue +78 -0
- package/dist/runtime/components/navigation/Breadcrumb.vue.d.ts +50 -0
- package/dist/runtime/components/navigation/CommandPalette.vue +50 -37
- package/dist/runtime/components/navigation/CommandPalette.vue.d.ts +15 -8
- package/dist/runtime/components/navigation/CommandPaletteGroup.vue +1 -3
- package/dist/runtime/components/navigation/Pagination.vue +7 -7
- package/dist/runtime/components/navigation/Pagination.vue.d.ts +11 -11
- package/dist/runtime/components/navigation/Tabs.vue +8 -5
- package/dist/runtime/components/navigation/Tabs.vue.d.ts +10 -10
- package/dist/runtime/components/navigation/VerticalNavigation.vue +2 -2
- package/dist/runtime/components/navigation/VerticalNavigation.vue.d.ts +7 -7
- package/dist/runtime/components/overlays/ContextMenu.vue +4 -3
- package/dist/runtime/components/overlays/ContextMenu.vue.d.ts +7 -7
- package/dist/runtime/components/overlays/Modal.vue +3 -6
- package/dist/runtime/components/overlays/Modal.vue.d.ts +7 -7
- package/dist/runtime/components/overlays/Notification.vue +30 -31
- package/dist/runtime/components/overlays/Notification.vue.d.ts +10 -9
- package/dist/runtime/components/overlays/Notifications.vue +18 -16
- package/dist/runtime/components/overlays/Notifications.vue.d.ts +7 -7
- package/dist/runtime/components/overlays/Popover.vue +14 -4
- package/dist/runtime/components/overlays/Popover.vue.d.ts +20 -9
- package/dist/runtime/components/overlays/Slideover.vue +6 -6
- package/dist/runtime/components/overlays/Slideover.vue.d.ts +7 -7
- package/dist/runtime/components/overlays/Tooltip.vue +6 -5
- package/dist/runtime/components/overlays/Tooltip.vue.d.ts +7 -7
- package/dist/runtime/composables/defineShortcuts.d.ts +1 -1
- package/dist/runtime/composables/defineShortcuts.mjs +8 -4
- package/dist/runtime/composables/useButtonGroup.d.ts +20 -0
- package/dist/runtime/composables/useButtonGroup.mjs +52 -0
- package/dist/runtime/composables/useFormGroup.d.ts +2 -0
- package/dist/runtime/composables/useFormGroup.mjs +3 -2
- package/dist/runtime/composables/useShortcuts.d.ts +2 -2
- package/dist/runtime/composables/useUI.d.ts +3 -3
- package/dist/runtime/types/alert.d.ts +7 -0
- package/dist/runtime/types/avatar.d.ts +3 -1
- package/dist/runtime/types/badge.d.ts +5 -4
- package/dist/runtime/types/breadcrumb.d.ts +9 -0
- package/dist/runtime/types/button.d.ts +5 -4
- package/dist/runtime/types/chip.d.ts +11 -0
- package/dist/runtime/types/dropdown.d.ts +2 -2
- package/dist/runtime/types/form-group.d.ts +5 -0
- package/dist/runtime/types/form.d.ts +3 -2
- package/dist/runtime/types/index.d.ts +10 -0
- package/dist/runtime/types/input.d.ts +8 -0
- package/dist/runtime/types/kbd.d.ts +5 -0
- package/dist/runtime/types/popper.d.ts +2 -0
- package/dist/runtime/types/range.d.ts +5 -0
- package/dist/runtime/types/select.d.ts +8 -0
- package/dist/runtime/types/textarea.d.ts +8 -0
- package/dist/runtime/types/toggle.d.ts +5 -0
- package/dist/runtime/types/utils.d.ts +24 -7
- package/dist/runtime/ui.config/data/table.d.ts +60 -0
- package/dist/runtime/ui.config/data/table.mjs +59 -0
- package/dist/runtime/ui.config/elements/accordion.d.ts +21 -0
- package/dist/runtime/ui.config/elements/accordion.mjs +20 -0
- package/dist/runtime/ui.config/elements/alert.d.ts +41 -0
- package/dist/runtime/ui.config/elements/alert.mjs +40 -0
- package/dist/runtime/ui.config/elements/avatar.d.ts +60 -0
- package/dist/runtime/ui.config/elements/avatar.mjs +59 -0
- package/dist/runtime/ui.config/elements/avatarGroup.d.ts +6 -0
- package/dist/runtime/ui.config/elements/avatarGroup.mjs +5 -0
- package/dist/runtime/ui.config/elements/badge.d.ts +34 -0
- package/dist/runtime/ui.config/elements/badge.mjs +33 -0
- package/dist/runtime/ui.config/elements/button.d.ts +81 -0
- package/dist/runtime/ui.config/elements/button.mjs +80 -0
- package/dist/runtime/ui.config/elements/buttonGroup.d.ts +101 -0
- package/dist/runtime/ui.config/elements/buttonGroup.mjs +19 -0
- package/dist/runtime/ui.config/elements/chip.d.ts +35 -0
- package/dist/runtime/ui.config/elements/chip.mjs +34 -0
- package/dist/runtime/ui.config/elements/dropdown.d.ts +55 -0
- package/dist/runtime/ui.config/elements/dropdown.mjs +53 -0
- package/dist/runtime/ui.config/elements/kbd.d.ts +17 -0
- package/dist/runtime/ui.config/elements/kbd.mjs +16 -0
- package/dist/runtime/ui.config/elements/meter.d.ts +77 -0
- package/dist/runtime/ui.config/elements/meter.mjs +76 -0
- package/dist/runtime/ui.config/elements/meterGroup.d.ts +52 -0
- package/dist/runtime/ui.config/elements/meterGroup.mjs +24 -0
- package/dist/runtime/ui.config/elements/progress.d.ts +75 -0
- package/dist/runtime/ui.config/elements/progress.mjs +74 -0
- package/dist/runtime/ui.config/forms/checkbox.d.ts +19 -0
- package/dist/runtime/ui.config/forms/checkbox.mjs +18 -0
- package/dist/runtime/ui.config/forms/formGroup.d.ts +25 -0
- package/dist/runtime/ui.config/forms/formGroup.mjs +25 -0
- package/dist/runtime/ui.config/forms/input.d.ts +107 -0
- package/dist/runtime/ui.config/forms/input.mjs +106 -0
- package/dist/runtime/ui.config/forms/radio.d.ts +18 -0
- package/dist/runtime/ui.config/forms/radio.mjs +17 -0
- package/dist/runtime/ui.config/forms/radioGroup.d.ts +8 -0
- package/dist/runtime/ui.config/forms/radioGroup.mjs +7 -0
- package/dist/runtime/ui.config/forms/range.d.ts +64 -0
- package/dist/runtime/ui.config/forms/range.mjs +63 -0
- package/dist/runtime/ui.config/forms/select.d.ts +108 -0
- package/dist/runtime/ui.config/forms/select.mjs +13 -0
- package/dist/runtime/ui.config/forms/selectMenu.d.ts +68 -0
- package/dist/runtime/ui.config/forms/selectMenu.mjs +66 -0
- package/dist/runtime/ui.config/forms/textarea.d.ts +106 -0
- package/dist/runtime/ui.config/forms/textarea.mjs +10 -0
- package/dist/runtime/ui.config/forms/toggle.d.ts +61 -0
- package/dist/runtime/ui.config/forms/toggle.mjs +60 -0
- package/dist/runtime/ui.config/index.d.ts +40 -0
- package/dist/runtime/ui.config/index.mjs +40 -0
- package/dist/runtime/ui.config/layout/card.d.ts +24 -0
- package/dist/runtime/ui.config/layout/card.mjs +23 -0
- package/dist/runtime/ui.config/layout/container.d.ts +6 -0
- package/dist/runtime/ui.config/layout/container.mjs +5 -0
- package/dist/runtime/ui.config/layout/divider.d.ts +35 -0
- package/dist/runtime/ui.config/layout/divider.mjs +34 -0
- package/dist/runtime/ui.config/layout/skeleton.d.ts +6 -0
- package/dist/runtime/ui.config/layout/skeleton.mjs +5 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.d.ts +20 -0
- package/dist/runtime/ui.config/navigation/breadcrumb.mjs +19 -0
- package/dist/runtime/ui.config/navigation/commandPalette.d.ts +72 -0
- package/dist/runtime/ui.config/navigation/commandPalette.mjs +71 -0
- package/dist/runtime/ui.config/navigation/pagination.d.ts +35 -0
- package/dist/runtime/ui.config/navigation/pagination.mjs +34 -0
- package/dist/runtime/ui.config/navigation/tabs.d.ts +34 -0
- package/dist/runtime/ui.config/navigation/tabs.mjs +33 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.d.ts +28 -0
- package/dist/runtime/ui.config/navigation/verticalNavigation.mjs +27 -0
- package/dist/runtime/ui.config/overlays/contextMenu.d.ts +31 -0
- package/dist/runtime/ui.config/overlays/contextMenu.mjs +25 -0
- package/dist/runtime/ui.config/overlays/modal.d.ts +36 -0
- package/dist/runtime/ui.config/overlays/modal.mjs +37 -0
- package/dist/runtime/ui.config/overlays/notification.d.ts +50 -0
- package/dist/runtime/ui.config/overlays/notification.mjs +50 -0
- package/dist/runtime/ui.config/overlays/notifications.d.ts +7 -0
- package/dist/runtime/ui.config/overlays/notifications.mjs +6 -0
- package/dist/runtime/ui.config/overlays/popover.d.ts +43 -0
- package/dist/runtime/ui.config/overlays/popover.mjs +37 -0
- package/dist/runtime/ui.config/overlays/slideover.d.ts +32 -0
- package/dist/runtime/ui.config/overlays/slideover.mjs +33 -0
- package/dist/runtime/ui.config/overlays/tooltip.d.ts +33 -0
- package/dist/runtime/ui.config/overlays/tooltip.mjs +27 -0
- package/dist/runtime/ui.config/popper.d.ts +8 -0
- package/dist/runtime/ui.config/popper.mjs +8 -0
- package/dist/runtime/ui.css +1 -13
- package/dist/runtime/utils/index.d.ts +5 -0
- package/dist/runtime/utils/index.mjs +7 -3
- package/dist/types.d.mts +3 -2
- package/dist/types.d.ts +3 -2
- package/package.json +32 -21
- package/dist/runtime/ui.config.d.ts +0 -1470
- package/dist/runtime/ui.config.mjs +0 -1273
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
:value="modelValue"
|
|
7
7
|
:required="required"
|
|
8
8
|
:disabled="disabled || loading"
|
|
9
|
-
class="form-select"
|
|
10
9
|
:class="selectClass"
|
|
11
10
|
v-bind="attrs"
|
|
12
11
|
@input="onInput"
|
|
@@ -60,6 +59,7 @@ import UIcon from "../elements/Icon.vue";
|
|
|
60
59
|
import { useUI } from "../../composables/useUI";
|
|
61
60
|
import { useFormGroup } from "../../composables/useFormGroup";
|
|
62
61
|
import { mergeConfig, get } from "../../utils";
|
|
62
|
+
import { useInjectButtonGroup } from "../../composables/useButtonGroup";
|
|
63
63
|
import appConfig from "#build/app.config";
|
|
64
64
|
import { select } from "#ui/ui.config";
|
|
65
65
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.select, select);
|
|
@@ -167,17 +167,19 @@ export default defineComponent({
|
|
|
167
167
|
},
|
|
168
168
|
class: {
|
|
169
169
|
type: [String, Object, Array],
|
|
170
|
-
default:
|
|
170
|
+
default: () => ""
|
|
171
171
|
},
|
|
172
172
|
ui: {
|
|
173
173
|
type: Object,
|
|
174
|
-
default:
|
|
174
|
+
default: () => ({})
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
emits: ["update:modelValue", "change"],
|
|
178
178
|
setup(props, { emit, slots }) {
|
|
179
179
|
const { ui, attrs } = useUI("select", toRef(props, "ui"), config, toRef(props, "class"));
|
|
180
|
-
const {
|
|
180
|
+
const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
|
|
181
|
+
const { emitFormChange, inputId, color, size: sizeFormGroup, name } = useFormGroup(props, config);
|
|
182
|
+
const size = computed(() => sizeButtonGroup.value || sizeFormGroup.value);
|
|
181
183
|
const onInput = (event) => {
|
|
182
184
|
emit("update:modelValue", event.target.value);
|
|
183
185
|
};
|
|
@@ -232,7 +234,8 @@ export default defineComponent({
|
|
|
232
234
|
const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
|
|
233
235
|
return twMerge(twJoin(
|
|
234
236
|
ui.value.base,
|
|
235
|
-
ui.value.
|
|
237
|
+
ui.value.form,
|
|
238
|
+
rounded.value,
|
|
236
239
|
ui.value.size[size.value],
|
|
237
240
|
props.padded ? ui.value.padding[size.value] : "p-0",
|
|
238
241
|
variant?.replaceAll("{color}", color.value),
|
|
@@ -268,9 +271,9 @@ export default defineComponent({
|
|
|
268
271
|
const leadingIconClass = computed(() => {
|
|
269
272
|
return twJoin(
|
|
270
273
|
ui.value.icon.base,
|
|
271
|
-
appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
|
|
274
|
+
color.value && appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
|
|
272
275
|
ui.value.icon.size[size.value],
|
|
273
|
-
props.loading &&
|
|
276
|
+
props.loading && ui.value.icon.loading
|
|
274
277
|
);
|
|
275
278
|
});
|
|
276
279
|
const trailingWrapperIconClass = computed(() => {
|
|
@@ -283,9 +286,9 @@ export default defineComponent({
|
|
|
283
286
|
const trailingIconClass = computed(() => {
|
|
284
287
|
return twJoin(
|
|
285
288
|
ui.value.icon.base,
|
|
286
|
-
appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
|
|
289
|
+
color.value && appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
|
|
287
290
|
ui.value.icon.size[size.value],
|
|
288
|
-
props.loading && !isLeading.value &&
|
|
291
|
+
props.loading && !isLeading.value && ui.value.icon.loading
|
|
289
292
|
);
|
|
290
293
|
});
|
|
291
294
|
return {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PropType, ComputedRef } from 'vue';
|
|
2
|
+
import type { SelectSize, SelectVariant } from '../../types';
|
|
2
3
|
declare const _default: import("vue").DefineComponent<{
|
|
3
4
|
modelValue: {
|
|
4
5
|
type: (ObjectConstructor | NumberConstructor | StringConstructor)[];
|
|
@@ -61,7 +62,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
61
62
|
default: () => never[];
|
|
62
63
|
};
|
|
63
64
|
size: {
|
|
64
|
-
type: PropType<
|
|
65
|
+
type: PropType<SelectSize>;
|
|
65
66
|
default: null;
|
|
66
67
|
validator(value: string): boolean;
|
|
67
68
|
};
|
|
@@ -71,7 +72,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
71
72
|
validator(value: string): boolean;
|
|
72
73
|
};
|
|
73
74
|
variant: {
|
|
74
|
-
type: PropType<
|
|
75
|
+
type: PropType<SelectVariant>;
|
|
75
76
|
default: () => any;
|
|
76
77
|
validator(value: string): boolean;
|
|
77
78
|
};
|
|
@@ -89,11 +90,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
89
90
|
};
|
|
90
91
|
class: {
|
|
91
92
|
type: PropType<any>;
|
|
92
|
-
default:
|
|
93
|
+
default: () => "";
|
|
93
94
|
};
|
|
94
95
|
ui: {
|
|
95
|
-
type: PropType<
|
|
96
|
-
default:
|
|
96
|
+
type: PropType<any>;
|
|
97
|
+
default: () => {};
|
|
97
98
|
};
|
|
98
99
|
}, {
|
|
99
100
|
ui: ComputedRef<any>;
|
|
@@ -118,7 +119,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
118
119
|
trailingIconName: ComputedRef<string | undefined>;
|
|
119
120
|
trailingIconClass: ComputedRef<string>;
|
|
120
121
|
trailingWrapperIconClass: ComputedRef<string>;
|
|
121
|
-
onInput: (event:
|
|
122
|
+
onInput: (event: Event) => void;
|
|
122
123
|
onChange: (event: Event) => void;
|
|
123
124
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
124
125
|
modelValue: {
|
|
@@ -182,7 +183,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
182
183
|
default: () => never[];
|
|
183
184
|
};
|
|
184
185
|
size: {
|
|
185
|
-
type: PropType<
|
|
186
|
+
type: PropType<SelectSize>;
|
|
186
187
|
default: null;
|
|
187
188
|
validator(value: string): boolean;
|
|
188
189
|
};
|
|
@@ -192,7 +193,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
192
193
|
validator(value: string): boolean;
|
|
193
194
|
};
|
|
194
195
|
variant: {
|
|
195
|
-
type: PropType<
|
|
196
|
+
type: PropType<SelectVariant>;
|
|
196
197
|
default: () => any;
|
|
197
198
|
validator(value: string): boolean;
|
|
198
199
|
};
|
|
@@ -210,29 +211,29 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
210
211
|
};
|
|
211
212
|
class: {
|
|
212
213
|
type: PropType<any>;
|
|
213
|
-
default:
|
|
214
|
+
default: () => "";
|
|
214
215
|
};
|
|
215
216
|
ui: {
|
|
216
|
-
type: PropType<
|
|
217
|
-
default:
|
|
217
|
+
type: PropType<any>;
|
|
218
|
+
default: () => {};
|
|
218
219
|
};
|
|
219
220
|
}>> & {
|
|
220
221
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
221
222
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
222
223
|
}, {
|
|
224
|
+
size: SelectSize;
|
|
225
|
+
ui: any;
|
|
223
226
|
id: string;
|
|
224
227
|
icon: string;
|
|
225
228
|
color: any;
|
|
226
|
-
ui: Partial<any>;
|
|
227
229
|
options: unknown[];
|
|
228
230
|
name: string;
|
|
229
231
|
class: any;
|
|
230
232
|
modelValue: string | number | Record<string, any>;
|
|
231
233
|
loading: boolean;
|
|
232
234
|
disabled: boolean;
|
|
233
|
-
variant:
|
|
235
|
+
variant: SelectVariant;
|
|
234
236
|
required: boolean;
|
|
235
|
-
size: string | number | symbol;
|
|
236
237
|
placeholder: string;
|
|
237
238
|
padded: boolean;
|
|
238
239
|
loadingIcon: string;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
v-if="required"
|
|
16
16
|
:value="modelValue"
|
|
17
17
|
:required="required"
|
|
18
|
-
class="
|
|
18
|
+
:class="uiMenu.required"
|
|
19
19
|
tabindex="-1"
|
|
20
20
|
aria-hidden="true"
|
|
21
21
|
>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
ref="trigger"
|
|
26
26
|
as="div"
|
|
27
27
|
role="button"
|
|
28
|
-
class="
|
|
28
|
+
:class="uiMenu.trigger"
|
|
29
29
|
>
|
|
30
30
|
<slot :open="open" :disabled="disabled" :loading="loading">
|
|
31
31
|
<button :id="inputId" :class="selectClass" :disabled="disabled || loading" type="button" v-bind="attrs">
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
</span>
|
|
37
37
|
|
|
38
38
|
<slot name="label">
|
|
39
|
-
<span v-if="multiple && Array.isArray(modelValue) && modelValue.length" class="
|
|
40
|
-
<span v-else-if="!multiple && modelValue" class="
|
|
41
|
-
<span v-else
|
|
39
|
+
<span v-if="multiple && Array.isArray(modelValue) && modelValue.length" :class="uiMenu.label">{{ modelValue.length }} selected</span>
|
|
40
|
+
<span v-else-if="!multiple && modelValue" :class="uiMenu.label">{{ ['string', 'number'].includes(typeof modelValue) ? modelValue : modelValue[optionAttribute] }}</span>
|
|
41
|
+
<span v-else :class="uiMenu.label">{{ placeholder || ' ' }}</span>
|
|
42
42
|
</slot>
|
|
43
43
|
|
|
44
44
|
<span v-if="(isTrailing && trailingIconName) || $slots.trailing" :class="trailingWrapperIconClass">
|
|
@@ -53,8 +53,9 @@
|
|
|
53
53
|
<div v-if="open" ref="container" :class="[uiMenu.container, uiMenu.width]">
|
|
54
54
|
<Transition appear v-bind="uiMenu.transition">
|
|
55
55
|
<div>
|
|
56
|
-
<div v-if="popper.arrow" data-popper-arrow :class="
|
|
57
|
-
|
|
56
|
+
<div v-if="popper.arrow" data-popper-arrow :class="Object.values(uiMenu.arrow)" />
|
|
57
|
+
|
|
58
|
+
<component :is="searchable ? 'HComboboxOptions' : 'HListboxOptions'" static :class="[uiMenu.base, uiMenu.ring, uiMenu.rounded, uiMenu.shadow, uiMenu.background, uiMenu.padding, uiMenu.height]">
|
|
58
59
|
<HComboboxInput
|
|
59
60
|
v-if="searchable"
|
|
60
61
|
ref="searchInput"
|
|
@@ -86,22 +87,22 @@
|
|
|
86
87
|
aria-hidden="true"
|
|
87
88
|
/>
|
|
88
89
|
<span v-else-if="option.chip" :class="uiMenu.option.chip.base" :style="{ background: `#${option.chip}` }" />
|
|
89
|
-
|
|
90
|
+
|
|
90
91
|
<span class="truncate">{{ ['string', 'number'].includes(typeof option) ? option : option[optionAttribute] }}</span>
|
|
91
92
|
</slot>
|
|
92
93
|
</div>
|
|
93
|
-
|
|
94
|
+
|
|
94
95
|
<span v-if="selected" :class="[uiMenu.option.selectedIcon.wrapper, uiMenu.option.selectedIcon.padding]">
|
|
95
96
|
<UIcon :name="selectedIcon" :class="uiMenu.option.selectedIcon.base" aria-hidden="true" />
|
|
96
97
|
</span>
|
|
97
98
|
</li>
|
|
98
99
|
</component>
|
|
99
|
-
|
|
100
|
+
|
|
100
101
|
<component :is="searchable ? 'HComboboxOption' : 'HListboxOption'" v-if="creatable && queryOption && !filteredOptions.length" v-slot="{ active, selected }" :value="queryOption" as="template">
|
|
101
102
|
<li :class="[uiMenu.option.base, uiMenu.option.rounded, uiMenu.option.padding, uiMenu.option.size, uiMenu.option.color, active ? uiMenu.option.active : uiMenu.option.inactive]">
|
|
102
103
|
<div :class="uiMenu.option.container">
|
|
103
104
|
<slot name="option-create" :option="queryOption" :active="active" :selected="selected">
|
|
104
|
-
<span class="
|
|
105
|
+
<span :class="uiMenu.option.create">Create "{{ queryOption[optionAttribute] }}"</span>
|
|
105
106
|
</slot>
|
|
106
107
|
</div>
|
|
107
108
|
</li>
|
|
@@ -139,7 +140,8 @@ import UAvatar from "../elements/Avatar.vue";
|
|
|
139
140
|
import { useUI } from "../../composables/useUI";
|
|
140
141
|
import { usePopper } from "../../composables/usePopper";
|
|
141
142
|
import { useFormGroup } from "../../composables/useFormGroup";
|
|
142
|
-
import { mergeConfig } from "../../utils";
|
|
143
|
+
import { get, mergeConfig } from "../../utils";
|
|
144
|
+
import { useInjectButtonGroup } from "../../composables/useButtonGroup";
|
|
143
145
|
import appConfig from "#build/app.config";
|
|
144
146
|
import { select, selectMenu } from "#ui/ui.config";
|
|
145
147
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.select, select);
|
|
@@ -232,6 +234,10 @@ export default defineComponent({
|
|
|
232
234
|
type: String,
|
|
233
235
|
default: "Search..."
|
|
234
236
|
},
|
|
237
|
+
clearSearchOnClose: {
|
|
238
|
+
type: Boolean,
|
|
239
|
+
default: () => configMenu.default.clearOnClose
|
|
240
|
+
},
|
|
235
241
|
debounce: {
|
|
236
242
|
type: Number,
|
|
237
243
|
default: 200
|
|
@@ -294,15 +300,15 @@ export default defineComponent({
|
|
|
294
300
|
},
|
|
295
301
|
class: {
|
|
296
302
|
type: [String, Object, Array],
|
|
297
|
-
default:
|
|
303
|
+
default: () => ""
|
|
298
304
|
},
|
|
299
305
|
ui: {
|
|
300
306
|
type: Object,
|
|
301
|
-
default:
|
|
307
|
+
default: () => ({})
|
|
302
308
|
},
|
|
303
309
|
uiMenu: {
|
|
304
310
|
type: Object,
|
|
305
|
-
default:
|
|
311
|
+
default: () => ({})
|
|
306
312
|
}
|
|
307
313
|
},
|
|
308
314
|
emits: ["update:modelValue", "open", "close", "change"],
|
|
@@ -311,22 +317,23 @@ export default defineComponent({
|
|
|
311
317
|
const { ui: uiMenu } = useUI("selectMenu", toRef(props, "uiMenu"), configMenu);
|
|
312
318
|
const popper = computed(() => defu({}, props.popper, uiMenu.value.popper));
|
|
313
319
|
const [trigger, container] = usePopper(popper.value);
|
|
314
|
-
const {
|
|
320
|
+
const { size: sizeButtonGroup, rounded } = useInjectButtonGroup({ ui, props });
|
|
321
|
+
const { emitFormBlur, emitFormChange, inputId, color, size: sizeFormGroup, name } = useFormGroup(props, config);
|
|
322
|
+
const size = computed(() => sizeButtonGroup.value || sizeFormGroup.value);
|
|
315
323
|
const query = ref("");
|
|
316
324
|
const searchInput = ref();
|
|
317
325
|
const selectClass = computed(() => {
|
|
318
326
|
const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
|
|
319
327
|
return twMerge(twJoin(
|
|
320
328
|
ui.value.base,
|
|
321
|
-
|
|
322
|
-
|
|
329
|
+
uiMenu.value.select,
|
|
330
|
+
rounded.value,
|
|
323
331
|
ui.value.size[size.value],
|
|
324
332
|
ui.value.gap[size.value],
|
|
325
333
|
props.padded ? ui.value.padding[size.value] : "p-0",
|
|
326
334
|
variant?.replaceAll("{color}", color.value),
|
|
327
335
|
(isLeading.value || slots.leading) && ui.value.leading.padding[size.value],
|
|
328
|
-
(isTrailing.value || slots.trailing) && ui.value.trailing.padding[size.value]
|
|
329
|
-
"inline-flex items-center"
|
|
336
|
+
(isTrailing.value || slots.trailing) && ui.value.trailing.padding[size.value]
|
|
330
337
|
), props.selectClass);
|
|
331
338
|
});
|
|
332
339
|
const isLeading = computed(() => {
|
|
@@ -357,9 +364,9 @@ export default defineComponent({
|
|
|
357
364
|
const leadingIconClass = computed(() => {
|
|
358
365
|
return twJoin(
|
|
359
366
|
ui.value.icon.base,
|
|
360
|
-
appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
|
|
367
|
+
color.value && appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
|
|
361
368
|
ui.value.icon.size[size.value],
|
|
362
|
-
props.loading &&
|
|
369
|
+
props.loading && ui.value.icon.loading
|
|
363
370
|
);
|
|
364
371
|
});
|
|
365
372
|
const trailingWrapperIconClass = computed(() => {
|
|
@@ -372,9 +379,9 @@ export default defineComponent({
|
|
|
372
379
|
const trailingIconClass = computed(() => {
|
|
373
380
|
return twJoin(
|
|
374
381
|
ui.value.icon.base,
|
|
375
|
-
appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
|
|
382
|
+
color.value && appConfig.ui.colors.includes(color.value) && ui.value.icon.color.replaceAll("{color}", color.value),
|
|
376
383
|
ui.value.icon.size[size.value],
|
|
377
|
-
props.loading && !isLeading.value &&
|
|
384
|
+
props.loading && !isLeading.value && ui.value.icon.loading
|
|
378
385
|
);
|
|
379
386
|
});
|
|
380
387
|
const debouncedSearch = typeof props.searchable === "function" ? useDebounceFn(props.searchable, props.debounce) : void 0;
|
|
@@ -387,17 +394,27 @@ export default defineComponent({
|
|
|
387
394
|
}
|
|
388
395
|
return props.options.filter((option) => {
|
|
389
396
|
return (props.searchAttributes?.length ? props.searchAttributes : [props.optionAttribute]).some((searchAttribute) => {
|
|
390
|
-
|
|
397
|
+
if (["string", "number"].includes(typeof option)) {
|
|
398
|
+
return String(option).search(new RegExp(query.value, "i")) !== -1;
|
|
399
|
+
}
|
|
400
|
+
const child = get(option, searchAttribute);
|
|
401
|
+
return child !== null && child !== void 0 && String(child).search(new RegExp(query.value, "i")) !== -1;
|
|
391
402
|
});
|
|
392
403
|
});
|
|
393
404
|
});
|
|
394
405
|
const queryOption = computed(() => {
|
|
395
406
|
return query.value === "" ? null : { [props.optionAttribute]: query.value };
|
|
396
407
|
});
|
|
408
|
+
function clearOnClose() {
|
|
409
|
+
if (props.clearSearchOnClose) {
|
|
410
|
+
query.value = "";
|
|
411
|
+
}
|
|
412
|
+
}
|
|
397
413
|
watch(container, (value) => {
|
|
398
414
|
if (value) {
|
|
399
415
|
emit("open");
|
|
400
416
|
} else {
|
|
417
|
+
clearOnClose();
|
|
401
418
|
emit("close");
|
|
402
419
|
emitFormBlur();
|
|
403
420
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PropType } from 'vue';
|
|
2
|
-
import type { PopperOptions } from '../../types';
|
|
2
|
+
import type { SelectSize, SelectVariant, PopperOptions } from '../../types';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
modelValue: {
|
|
5
5
|
type: (ObjectConstructor | NumberConstructor | ArrayConstructor | StringConstructor)[];
|
|
@@ -76,6 +76,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
76
76
|
type: StringConstructor;
|
|
77
77
|
default: string;
|
|
78
78
|
};
|
|
79
|
+
clearSearchOnClose: {
|
|
80
|
+
type: BooleanConstructor;
|
|
81
|
+
default: () => any;
|
|
82
|
+
};
|
|
79
83
|
debounce: {
|
|
80
84
|
type: NumberConstructor;
|
|
81
85
|
default: number;
|
|
@@ -93,7 +97,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
93
97
|
default: boolean;
|
|
94
98
|
};
|
|
95
99
|
size: {
|
|
96
|
-
type: PropType<
|
|
100
|
+
type: PropType<SelectSize>;
|
|
97
101
|
default: null;
|
|
98
102
|
validator(value: string): boolean;
|
|
99
103
|
};
|
|
@@ -103,7 +107,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
103
107
|
validator(value: string): boolean;
|
|
104
108
|
};
|
|
105
109
|
variant: {
|
|
106
|
-
type: PropType<
|
|
110
|
+
type: PropType<SelectVariant>;
|
|
107
111
|
default: () => any;
|
|
108
112
|
validator(value: string): boolean;
|
|
109
113
|
};
|
|
@@ -129,15 +133,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
129
133
|
};
|
|
130
134
|
class: {
|
|
131
135
|
type: PropType<any>;
|
|
132
|
-
default:
|
|
136
|
+
default: () => "";
|
|
133
137
|
};
|
|
134
138
|
ui: {
|
|
135
|
-
type: PropType<
|
|
136
|
-
default:
|
|
139
|
+
type: PropType<any>;
|
|
140
|
+
default: () => {};
|
|
137
141
|
};
|
|
138
142
|
uiMenu: {
|
|
139
|
-
type: PropType<
|
|
140
|
-
default:
|
|
143
|
+
type: PropType<any>;
|
|
144
|
+
default: () => {};
|
|
141
145
|
};
|
|
142
146
|
}, {
|
|
143
147
|
ui: import("vue").ComputedRef<any>;
|
|
@@ -241,6 +245,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
241
245
|
type: StringConstructor;
|
|
242
246
|
default: string;
|
|
243
247
|
};
|
|
248
|
+
clearSearchOnClose: {
|
|
249
|
+
type: BooleanConstructor;
|
|
250
|
+
default: () => any;
|
|
251
|
+
};
|
|
244
252
|
debounce: {
|
|
245
253
|
type: NumberConstructor;
|
|
246
254
|
default: number;
|
|
@@ -258,7 +266,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
258
266
|
default: boolean;
|
|
259
267
|
};
|
|
260
268
|
size: {
|
|
261
|
-
type: PropType<
|
|
269
|
+
type: PropType<SelectSize>;
|
|
262
270
|
default: null;
|
|
263
271
|
validator(value: string): boolean;
|
|
264
272
|
};
|
|
@@ -268,7 +276,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
268
276
|
validator(value: string): boolean;
|
|
269
277
|
};
|
|
270
278
|
variant: {
|
|
271
|
-
type: PropType<
|
|
279
|
+
type: PropType<SelectVariant>;
|
|
272
280
|
default: () => any;
|
|
273
281
|
validator(value: string): boolean;
|
|
274
282
|
};
|
|
@@ -294,15 +302,15 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
294
302
|
};
|
|
295
303
|
class: {
|
|
296
304
|
type: PropType<any>;
|
|
297
|
-
default:
|
|
305
|
+
default: () => "";
|
|
298
306
|
};
|
|
299
307
|
ui: {
|
|
300
|
-
type: PropType<
|
|
301
|
-
default:
|
|
308
|
+
type: PropType<any>;
|
|
309
|
+
default: () => {};
|
|
302
310
|
};
|
|
303
311
|
uiMenu: {
|
|
304
|
-
type: PropType<
|
|
305
|
-
default:
|
|
312
|
+
type: PropType<any>;
|
|
313
|
+
default: () => {};
|
|
306
314
|
};
|
|
307
315
|
}>> & {
|
|
308
316
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
@@ -310,10 +318,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
310
318
|
onClose?: ((...args: any[]) => any) | undefined;
|
|
311
319
|
onOpen?: ((...args: any[]) => any) | undefined;
|
|
312
320
|
}, {
|
|
321
|
+
size: SelectSize;
|
|
322
|
+
ui: any;
|
|
313
323
|
id: string;
|
|
314
324
|
icon: string;
|
|
315
325
|
color: any;
|
|
316
|
-
ui: Partial<any>;
|
|
317
326
|
options: string[] | {
|
|
318
327
|
[key: string]: any;
|
|
319
328
|
disabled?: boolean | undefined;
|
|
@@ -326,9 +335,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
326
335
|
loading: boolean;
|
|
327
336
|
disabled: boolean;
|
|
328
337
|
multiple: boolean;
|
|
329
|
-
variant:
|
|
338
|
+
variant: SelectVariant;
|
|
330
339
|
required: boolean;
|
|
331
|
-
size: string | number | symbol;
|
|
332
340
|
placeholder: string;
|
|
333
341
|
padded: boolean;
|
|
334
342
|
loadingIcon: string;
|
|
@@ -342,9 +350,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
342
350
|
selectedIcon: string;
|
|
343
351
|
searchable: boolean | ((query: string) => Promise<any[]> | any[]);
|
|
344
352
|
searchablePlaceholder: string;
|
|
353
|
+
clearSearchOnClose: boolean;
|
|
345
354
|
debounce: number;
|
|
346
355
|
creatable: boolean;
|
|
347
356
|
searchAttributes: unknown[];
|
|
348
|
-
uiMenu:
|
|
357
|
+
uiMenu: any;
|
|
349
358
|
}, {}>;
|
|
350
359
|
export default _default;
|
|
@@ -9,21 +9,24 @@
|
|
|
9
9
|
:required="required"
|
|
10
10
|
:disabled="disabled"
|
|
11
11
|
:placeholder="placeholder"
|
|
12
|
-
class="form-textarea"
|
|
13
12
|
:class="textareaClass"
|
|
14
13
|
v-bind="attrs"
|
|
15
14
|
@input="onInput"
|
|
16
15
|
@blur="onBlur"
|
|
16
|
+
@change="onChange"
|
|
17
17
|
/>
|
|
18
|
+
|
|
19
|
+
<slot />
|
|
18
20
|
</div>
|
|
19
21
|
</template>
|
|
20
22
|
|
|
21
23
|
<script>
|
|
22
24
|
import { ref, computed, toRef, watch, onMounted, nextTick, defineComponent } from "vue";
|
|
23
25
|
import { twMerge, twJoin } from "tailwind-merge";
|
|
26
|
+
import { defu } from "defu";
|
|
24
27
|
import { useUI } from "../../composables/useUI";
|
|
25
28
|
import { useFormGroup } from "../../composables/useFormGroup";
|
|
26
|
-
import { mergeConfig } from "../../utils";
|
|
29
|
+
import { mergeConfig, looseToNumber } from "../../utils";
|
|
27
30
|
import appConfig from "#build/app.config";
|
|
28
31
|
import { textarea } from "#ui/ui.config";
|
|
29
32
|
const config = mergeConfig(appConfig.ui.strategy, appConfig.ui.textarea, textarea);
|
|
@@ -108,17 +111,22 @@ export default defineComponent({
|
|
|
108
111
|
},
|
|
109
112
|
class: {
|
|
110
113
|
type: [String, Object, Array],
|
|
111
|
-
default:
|
|
114
|
+
default: () => ""
|
|
112
115
|
},
|
|
113
116
|
ui: {
|
|
114
117
|
type: Object,
|
|
115
|
-
default:
|
|
118
|
+
default: () => ({})
|
|
119
|
+
},
|
|
120
|
+
modelModifiers: {
|
|
121
|
+
type: Object,
|
|
122
|
+
default: () => ({})
|
|
116
123
|
}
|
|
117
124
|
},
|
|
118
125
|
emits: ["update:modelValue", "blur"],
|
|
119
126
|
setup(props, { emit }) {
|
|
120
127
|
const { ui, attrs } = useUI("textarea", toRef(props, "ui"), config, toRef(props, "class"));
|
|
121
128
|
const { emitFormBlur, emitFormInput, inputId, color, size, name } = useFormGroup(props, config);
|
|
129
|
+
const modelModifiers = ref(defu({}, props.modelModifiers, { trim: false, lazy: false, number: false }));
|
|
122
130
|
const textarea2 = ref(null);
|
|
123
131
|
const autoFocus = () => {
|
|
124
132
|
if (props.autofocus) {
|
|
@@ -143,10 +151,30 @@ export default defineComponent({
|
|
|
143
151
|
}
|
|
144
152
|
}
|
|
145
153
|
};
|
|
154
|
+
const updateInput = (value) => {
|
|
155
|
+
if (modelModifiers.value.trim) {
|
|
156
|
+
value = value.trim();
|
|
157
|
+
}
|
|
158
|
+
if (modelModifiers.value.number) {
|
|
159
|
+
value = looseToNumber(value);
|
|
160
|
+
}
|
|
161
|
+
emit("update:modelValue", value);
|
|
162
|
+
emitFormInput();
|
|
163
|
+
};
|
|
146
164
|
const onInput = (event) => {
|
|
147
165
|
autoResize();
|
|
148
|
-
|
|
149
|
-
|
|
166
|
+
if (!modelModifiers.value.lazy) {
|
|
167
|
+
updateInput(event.target.value);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const onChange = (event) => {
|
|
171
|
+
const value = event.target.value;
|
|
172
|
+
if (modelModifiers.value.lazy) {
|
|
173
|
+
updateInput(value);
|
|
174
|
+
}
|
|
175
|
+
if (modelModifiers.value.trim) {
|
|
176
|
+
event.target.value = value.trim();
|
|
177
|
+
}
|
|
150
178
|
};
|
|
151
179
|
const onBlur = (event) => {
|
|
152
180
|
emit("blur", event);
|
|
@@ -170,6 +198,7 @@ export default defineComponent({
|
|
|
170
198
|
const variant = ui.value.color?.[color.value]?.[props.variant] || ui.value.variant[props.variant];
|
|
171
199
|
return twMerge(twJoin(
|
|
172
200
|
ui.value.base,
|
|
201
|
+
ui.value.form,
|
|
173
202
|
ui.value.rounded,
|
|
174
203
|
ui.value.placeholder,
|
|
175
204
|
ui.value.size[size.value],
|
|
@@ -189,6 +218,7 @@ export default defineComponent({
|
|
|
189
218
|
// eslint-disable-next-line vue/no-dupe-keys
|
|
190
219
|
textareaClass,
|
|
191
220
|
onInput,
|
|
221
|
+
onChange,
|
|
192
222
|
onBlur
|
|
193
223
|
};
|
|
194
224
|
}
|