@nuxt/ui 4.11.1 → 4.11.3
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 +3 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Accordion.d.vue.ts +1 -1
- package/dist/runtime/components/Accordion.vue.d.ts +1 -1
- package/dist/runtime/components/App.vue +2 -1
- package/dist/runtime/components/AuthForm.d.vue.ts +4 -0
- package/dist/runtime/components/AuthForm.vue.d.ts +4 -0
- package/dist/runtime/components/Breadcrumb.d.vue.ts +1 -1
- package/dist/runtime/components/Breadcrumb.vue.d.ts +1 -1
- package/dist/runtime/components/Carousel.d.vue.ts +1 -1
- package/dist/runtime/components/Carousel.vue.d.ts +1 -1
- package/dist/runtime/components/ChatPrompt.vue +1 -1
- package/dist/runtime/components/CheckboxGroup.d.vue.ts +1 -1
- package/dist/runtime/components/CheckboxGroup.vue.d.ts +1 -1
- package/dist/runtime/components/CommandPalette.d.vue.ts +1 -1
- package/dist/runtime/components/CommandPalette.vue.d.ts +1 -1
- package/dist/runtime/components/ContextMenu.d.vue.ts +1 -1
- package/dist/runtime/components/ContextMenu.vue.d.ts +1 -1
- package/dist/runtime/components/DashboardNavbar.vue +1 -1
- package/dist/runtime/components/DashboardSearch.vue +3 -3
- package/dist/runtime/components/DashboardSidebar.vue +3 -3
- package/dist/runtime/components/DropdownMenu.d.vue.ts +1 -1
- package/dist/runtime/components/DropdownMenu.vue.d.ts +1 -1
- package/dist/runtime/components/EditorToolbar.vue +6 -5
- package/dist/runtime/components/FooterColumns.d.vue.ts +1 -1
- package/dist/runtime/components/FooterColumns.vue.d.ts +1 -1
- package/dist/runtime/components/Form.d.vue.ts +2 -0
- package/dist/runtime/components/Form.vue +57 -30
- package/dist/runtime/components/Form.vue.d.ts +2 -0
- package/dist/runtime/components/Header.vue +3 -3
- package/dist/runtime/components/Input.vue +5 -5
- package/dist/runtime/components/InputDate.vue +12 -6
- package/dist/runtime/components/InputMenu.d.vue.ts +1 -1
- package/dist/runtime/components/InputMenu.vue +18 -7
- package/dist/runtime/components/InputMenu.vue.d.ts +1 -1
- package/dist/runtime/components/InputTime.vue +12 -6
- package/dist/runtime/components/LinkBase.vue +3 -1
- package/dist/runtime/components/Listbox.d.vue.ts +1 -1
- package/dist/runtime/components/Listbox.vue.d.ts +1 -1
- package/dist/runtime/components/NavigationMenu.d.vue.ts +1 -1
- package/dist/runtime/components/NavigationMenu.vue.d.ts +1 -1
- package/dist/runtime/components/PageAnchors.d.vue.ts +1 -1
- package/dist/runtime/components/PageAnchors.vue.d.ts +1 -1
- package/dist/runtime/components/PageLinks.d.vue.ts +1 -1
- package/dist/runtime/components/PageLinks.vue.d.ts +1 -1
- package/dist/runtime/components/PinInput.d.vue.ts +5 -3
- package/dist/runtime/components/PinInput.vue +15 -7
- package/dist/runtime/components/PinInput.vue.d.ts +5 -3
- package/dist/runtime/components/ProgressGroup.d.vue.ts +1 -1
- package/dist/runtime/components/ProgressGroup.vue.d.ts +1 -1
- package/dist/runtime/components/RadioGroup.d.vue.ts +1 -1
- package/dist/runtime/components/RadioGroup.vue.d.ts +1 -1
- package/dist/runtime/components/Select.d.vue.ts +1 -1
- package/dist/runtime/components/Select.vue +7 -1
- package/dist/runtime/components/Select.vue.d.ts +1 -1
- package/dist/runtime/components/SelectMenu.d.vue.ts +1 -1
- package/dist/runtime/components/SelectMenu.vue +22 -3
- package/dist/runtime/components/SelectMenu.vue.d.ts +1 -1
- package/dist/runtime/components/Splitter.d.vue.ts +1 -1
- package/dist/runtime/components/Splitter.vue.d.ts +1 -1
- package/dist/runtime/components/Stepper.d.vue.ts +1 -1
- package/dist/runtime/components/Stepper.vue.d.ts +1 -1
- package/dist/runtime/components/Table.vue +24 -2
- package/dist/runtime/components/Tabs.d.vue.ts +1 -1
- package/dist/runtime/components/Tabs.vue.d.ts +1 -1
- package/dist/runtime/components/Textarea.vue +5 -5
- package/dist/runtime/components/Timeline.d.vue.ts +1 -1
- package/dist/runtime/components/Timeline.vue.d.ts +1 -1
- package/dist/runtime/components/Toaster.vue +1 -1
- package/dist/runtime/components/Tree.d.vue.ts +1 -1
- package/dist/runtime/components/Tree.vue +1 -1
- package/dist/runtime/components/Tree.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentNavigation.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentSearch.vue +3 -3
- package/dist/runtime/components/content/ContentSurround.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentSurround.vue.d.ts +1 -1
- package/dist/runtime/components/content/ContentToc.d.vue.ts +1 -1
- package/dist/runtime/components/content/ContentToc.vue.d.ts +1 -1
- package/dist/runtime/composables/useFilter.js +7 -1
- package/dist/runtime/composables/useFormField.d.ts +1 -1
- package/dist/runtime/composables/useFormField.js +8 -4
- package/dist/runtime/composables/useForwardProps.js +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +2 -2
- package/dist/runtime/composables/useOverlay.js +5 -5
- package/dist/runtime/composables/useResizable.js +1 -1
- package/dist/runtime/index.css +1 -1
- package/dist/runtime/types/form.d.ts +3 -0
- package/dist/runtime/utils/form.js +3 -20
- package/dist/runtime/utils/index.js +22 -18
- package/dist/runtime/utils/virtualizer.d.ts +1 -1
- package/dist/runtime/utils/virtualizer.js +9 -11
- package/dist/runtime/vue/overrides/inertia/LinkBase.vue +3 -1
- package/dist/shared/{ui.DCJ9twx8.mjs → ui.CNAeRcb0.mjs} +45 -13
- package/dist/unplugin.d.mts +2 -1
- package/dist/unplugin.mjs +22 -10
- package/dist/vite.mjs +1 -1
- package/package.json +57 -60
- package/cli/commands/make/component.mjs +0 -86
- package/cli/commands/make/index.mjs +0 -14
- package/cli/commands/make/locale.mjs +0 -93
- package/cli/index.mjs +0 -15
- package/cli/package.json +0 -13
- package/cli/templates.mjs +0 -256
- package/cli/utils.mjs +0 -50
|
@@ -11,7 +11,7 @@ import { useComponentProps } from "../composables/useComponentProps";
|
|
|
11
11
|
import { useFieldGroup } from "../composables/useFieldGroup";
|
|
12
12
|
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
13
13
|
import { useFormField } from "../composables/useFormField";
|
|
14
|
-
import { looseToNumber } from "../utils";
|
|
14
|
+
import { isEmpty, looseToNumber } from "../utils";
|
|
15
15
|
import { tv } from "../utils/tv";
|
|
16
16
|
import UIcon from "./Icon.vue";
|
|
17
17
|
import UAvatar from "./Avatar.vue";
|
|
@@ -78,11 +78,11 @@ function updateInput(value) {
|
|
|
78
78
|
if (props.modelModifiers?.number || props.type === "number") {
|
|
79
79
|
value = looseToNumber(value);
|
|
80
80
|
}
|
|
81
|
-
if (props.modelModifiers?.nullable) {
|
|
82
|
-
value
|
|
81
|
+
if (props.modelModifiers?.nullable && isEmpty(value)) {
|
|
82
|
+
value = null;
|
|
83
83
|
}
|
|
84
|
-
if (props.modelModifiers?.optional && !props.modelModifiers?.nullable && value !== null) {
|
|
85
|
-
value
|
|
84
|
+
if (props.modelModifiers?.optional && !props.modelModifiers?.nullable && value !== null && isEmpty(value)) {
|
|
85
|
+
value = void 0;
|
|
86
86
|
}
|
|
87
87
|
modelValue.value = value;
|
|
88
88
|
emitFormInput();
|
|
@@ -90,13 +90,19 @@ function onUpdate(value) {
|
|
|
90
90
|
emitFormChange();
|
|
91
91
|
emitFormInput();
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
93
|
+
function onFocusOut(event) {
|
|
94
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
95
97
|
emits("blur", event);
|
|
98
|
+
emitFormBlur();
|
|
96
99
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
100
|
+
function onFocusIn(event) {
|
|
101
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
99
104
|
emits("focus", event);
|
|
105
|
+
emitFormFocus();
|
|
100
106
|
}
|
|
101
107
|
function autoFocus() {
|
|
102
108
|
if (props.autofocus) {
|
|
@@ -143,8 +149,8 @@ defineExpose({
|
|
|
143
149
|
:disabled="disabled"
|
|
144
150
|
:class="ui.base({ class: [props.ui?.base, props.class] })"
|
|
145
151
|
@update:model-value="onUpdate"
|
|
146
|
-
@
|
|
147
|
-
@
|
|
152
|
+
@focusout="onFocusOut"
|
|
153
|
+
@focusin="onFocusIn"
|
|
148
154
|
>
|
|
149
155
|
<template v-if="Array.isArray(segments)">
|
|
150
156
|
<ReuseSegmentsTemplate :segments="segments" />
|
|
@@ -31,7 +31,7 @@ export type InputMenuItem = InputMenuValue | {
|
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
onSelect?: (e: Event) => void;
|
|
33
33
|
class?: any;
|
|
34
|
-
ui?: Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
34
|
+
ui?: Partial<Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
35
35
|
[key: string]: any;
|
|
36
36
|
};
|
|
37
37
|
type ExcludeItem = {
|
|
@@ -89,12 +89,13 @@ const { t } = useLocale();
|
|
|
89
89
|
const appConfig = useAppConfig();
|
|
90
90
|
const { filterGroups } = useFilter();
|
|
91
91
|
const isAutocomplete = computed(() => props.mode === "autocomplete");
|
|
92
|
+
const isMultiple = computed(() => !!props.multiple && !isAutocomplete.value);
|
|
92
93
|
const rootPropsPick = reactivePick(props, "as", "modelValue", "defaultValue", "open", "defaultOpen", "required", "multiple", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "openOnClick", "openOnFocus", "by");
|
|
93
94
|
const rootPropsOmitted = reactiveOmit(rootPropsPick, "multiple", "resetSearchTermOnSelect", "resetModelValueOnClear", "by");
|
|
94
95
|
const rootProps = useForwardProps(computed(() => isAutocomplete.value ? rootPropsOmitted : rootPropsPick), emits);
|
|
95
96
|
const Component = computed(() => isAutocomplete.value ? Autocomplete : Combobox);
|
|
96
97
|
const attrs = useAttrs();
|
|
97
|
-
const baseDataSlot = computed(() =>
|
|
98
|
+
const baseDataSlot = computed(() => isMultiple.value ? attrs["data-slot"] ?? "base" : "base");
|
|
98
99
|
const portalProps = usePortal(toRef(() => props.portal));
|
|
99
100
|
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
100
101
|
const arrowProps = toRef(() => defu(props.arrow, { rounded: true }));
|
|
@@ -142,7 +143,7 @@ const ui = computed(() => tv({ extend: theme, ...appConfig.ui?.inputMenu || {} }
|
|
|
142
143
|
fixed: props.fixed,
|
|
143
144
|
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
144
145
|
trailing: isTrailing.value || !!slots.trailing,
|
|
145
|
-
multiple:
|
|
146
|
+
multiple: isMultiple.value,
|
|
146
147
|
fieldGroup: orientation.value,
|
|
147
148
|
virtualize: !!props.virtualize
|
|
148
149
|
}));
|
|
@@ -298,8 +299,17 @@ function isModelValueEmpty(modelValue) {
|
|
|
298
299
|
return modelValue === void 0 || modelValue === null || modelValue === "";
|
|
299
300
|
}
|
|
300
301
|
function onClear() {
|
|
302
|
+
if (disabled.value) {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
301
305
|
emits("clear");
|
|
302
306
|
}
|
|
307
|
+
function onTagsInputKeydown(event) {
|
|
308
|
+
if (event.isComposing || !searchTerm.value) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
event.preventDefault();
|
|
312
|
+
}
|
|
303
313
|
const viewportRef = useTemplateRef("viewportRef");
|
|
304
314
|
const comboboxRootRef = useTemplateRef("comboboxRootRef");
|
|
305
315
|
watch(() => props.items, async () => {
|
|
@@ -394,14 +404,14 @@ defineExpose({
|
|
|
394
404
|
:disabled="disabled"
|
|
395
405
|
:data-slot="$attrs['data-slot'] ?? 'root'"
|
|
396
406
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
397
|
-
:as-child="
|
|
407
|
+
:as-child="isMultiple"
|
|
398
408
|
ignore-filter
|
|
399
409
|
@update:model-value="onUpdate"
|
|
400
410
|
@update:open="onUpdateOpen"
|
|
401
411
|
>
|
|
402
|
-
<Component.Anchor :as-child="!
|
|
412
|
+
<Component.Anchor :as-child="!isMultiple" :data-slot="baseDataSlot" :class="ui.base({ class: props.ui?.base })">
|
|
403
413
|
<TagsInputRoot
|
|
404
|
-
v-if="
|
|
414
|
+
v-if="isMultiple"
|
|
405
415
|
v-slot="{ modelValue: tags }"
|
|
406
416
|
:model-value="modelValue"
|
|
407
417
|
:disabled="disabled"
|
|
@@ -435,6 +445,7 @@ defineExpose({
|
|
|
435
445
|
data-slot="tagsInput"
|
|
436
446
|
:class="ui.tagsInput({ class: props.ui?.tagsInput })"
|
|
437
447
|
@change.stop
|
|
448
|
+
@keydown.enter="onTagsInputKeydown"
|
|
438
449
|
/>
|
|
439
450
|
</Component.Input>
|
|
440
451
|
</TagsInputRoot>
|
|
@@ -444,7 +455,7 @@ defineExpose({
|
|
|
444
455
|
:id="id"
|
|
445
456
|
ref="inputRef"
|
|
446
457
|
v-bind="{ ...!isAutocomplete ? { displayValue } : {}, ...$attrs, ...ariaAttrs }"
|
|
447
|
-
|
|
458
|
+
data-slot="base"
|
|
448
459
|
:type="props.type"
|
|
449
460
|
:placeholder="props.placeholder"
|
|
450
461
|
:required="props.required"
|
|
@@ -463,7 +474,7 @@ defineExpose({
|
|
|
463
474
|
|
|
464
475
|
<Component.Trigger v-if="isTrailing || !!slots.trailing || !!props.clear" data-slot="trailing" :class="ui.trailing({ class: props.ui?.trailing })">
|
|
465
476
|
<slot name="trailing" :model-value="modelValue" :open="open" :ui="ui">
|
|
466
|
-
<Component.Cancel v-if="!!props.clear && !isModelValueEmpty(modelValue)" as-child>
|
|
477
|
+
<Component.Cancel v-if="!!props.clear && !disabled && !isModelValueEmpty(modelValue)" as-child>
|
|
467
478
|
<UButton
|
|
468
479
|
as="span"
|
|
469
480
|
:icon="props.clearIcon || appConfig.ui.icons.close"
|
|
@@ -31,7 +31,7 @@ export type InputMenuItem = InputMenuValue | {
|
|
|
31
31
|
disabled?: boolean;
|
|
32
32
|
onSelect?: (e: Event) => void;
|
|
33
33
|
class?: any;
|
|
34
|
-
ui?: Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
34
|
+
ui?: Partial<Pick<InputMenu['slots'], 'tagsItem' | 'tagsItemText' | 'tagsItemDelete' | 'tagsItemDeleteIcon' | 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
35
35
|
[key: string]: any;
|
|
36
36
|
};
|
|
37
37
|
type ExcludeItem = {
|
|
@@ -93,13 +93,19 @@ function onUpdate(value) {
|
|
|
93
93
|
emitFormChange();
|
|
94
94
|
emitFormInput();
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
|
|
96
|
+
function onFocusOut(event) {
|
|
97
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
98
100
|
emits("blur", event);
|
|
101
|
+
emitFormBlur();
|
|
99
102
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
103
|
+
function onFocusIn(event) {
|
|
104
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
102
107
|
emits("focus", event);
|
|
108
|
+
emitFormFocus();
|
|
103
109
|
}
|
|
104
110
|
function autoFocus() {
|
|
105
111
|
if (props.autofocus) {
|
|
@@ -145,8 +151,8 @@ defineExpose({
|
|
|
145
151
|
:default-value="props.defaultValue"
|
|
146
152
|
:class="ui.base({ class: [props.ui?.base, props.class] })"
|
|
147
153
|
@update:model-value="onUpdate"
|
|
148
|
-
@
|
|
149
|
-
@
|
|
154
|
+
@focusout="onFocusOut"
|
|
155
|
+
@focusin="onFocusIn"
|
|
150
156
|
>
|
|
151
157
|
<template v-if="Array.isArray(segments)">
|
|
152
158
|
<ReuseSegmentsTemplate :segments="segments" />
|
|
@@ -22,14 +22,16 @@ function onClickWrapper(e) {
|
|
|
22
22
|
e.preventDefault();
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
|
+
const results = [];
|
|
25
26
|
if (props.onClick) {
|
|
26
27
|
for (const onClick of Array.isArray(props.onClick) ? props.onClick : [props.onClick]) {
|
|
27
|
-
onClick(e);
|
|
28
|
+
results.push(onClick(e));
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
if (props.href && props.navigate && !props.isExternal) {
|
|
31
32
|
props.navigate(e);
|
|
32
33
|
}
|
|
34
|
+
return Promise.all(results);
|
|
33
35
|
}
|
|
34
36
|
</script>
|
|
35
37
|
|
|
@@ -27,7 +27,7 @@ export interface ListboxItem {
|
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
onSelect?: (e: Event) => void;
|
|
29
29
|
class?: any;
|
|
30
|
-
ui?: Pick<Listbox['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatar' | 'itemLeadingAvatarSize' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
30
|
+
ui?: Partial<Pick<Listbox['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatar' | 'itemLeadingAvatarSize' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
31
31
|
[key: string]: any;
|
|
32
32
|
}
|
|
33
33
|
export interface ListboxProps<T extends ArrayOrNested<ListboxItem> = ArrayOrNested<ListboxItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false, Mod extends Omit<ModelModifiers, 'lazy'> = Omit<ModelModifiers, 'lazy'>> extends Pick<ListboxRootProps, 'by' | 'disabled' | 'highlightOnHover' | 'name' | 'orientation' | 'required' | 'selectionBehavior'> {
|
|
@@ -27,7 +27,7 @@ export interface ListboxItem {
|
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
onSelect?: (e: Event) => void;
|
|
29
29
|
class?: any;
|
|
30
|
-
ui?: Pick<Listbox['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatar' | 'itemLeadingAvatarSize' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
30
|
+
ui?: Partial<Pick<Listbox['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatar' | 'itemLeadingAvatarSize' | 'itemLeadingChip' | 'itemLeadingChipSize' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
31
31
|
[key: string]: any;
|
|
32
32
|
}
|
|
33
33
|
export interface ListboxProps<T extends ArrayOrNested<ListboxItem> = ArrayOrNested<ListboxItem>, VK extends GetItemKeys<T> | undefined = undefined, M extends boolean = false, Mod extends Omit<ModelModifiers, 'lazy'> = Omit<ModelModifiers, 'lazy'>> extends Pick<ListboxRootProps, 'by' | 'disabled' | 'highlightOnHover' | 'name' | 'orientation' | 'required' | 'selectionBehavior'> {
|
|
@@ -67,7 +67,7 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|
|
67
67
|
open?: boolean;
|
|
68
68
|
onSelect?: (e: Event) => void;
|
|
69
69
|
class?: any;
|
|
70
|
-
ui?: Pick<NavigationMenu['slots'], 'item' | 'linkLeadingAvatarSize' | 'linkLeadingAvatar' | 'linkLeadingIcon' | 'linkLeadingChipSize' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkTrailing' | 'linkTrailingBadgeSize' | 'linkTrailingBadge' | 'linkTrailingIcon' | 'label' | 'link' | 'content' | 'childList' | 'childLabel' | 'childItem' | 'childLink' | 'childLinkIcon' | 'childLinkWrapper' | 'childLinkLabel' | 'childLinkLabelExternalIcon' | 'childLinkDescription'
|
|
70
|
+
ui?: Partial<Pick<NavigationMenu['slots'], 'item' | 'linkLeadingAvatarSize' | 'linkLeadingAvatar' | 'linkLeadingIcon' | 'linkLeadingChipSize' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkTrailing' | 'linkTrailingBadgeSize' | 'linkTrailingBadge' | 'linkTrailingIcon' | 'label' | 'link' | 'content' | 'childList' | 'childLabel' | 'childItem' | 'childLink' | 'childLinkIcon' | 'childLinkWrapper' | 'childLinkLabel' | 'childLinkLabelExternalIcon' | 'childLinkDescription'>>;
|
|
71
71
|
[key: string]: any;
|
|
72
72
|
}
|
|
73
73
|
type SingleOrMultipleType = 'single' | 'multiple';
|
|
@@ -67,7 +67,7 @@ export interface NavigationMenuItem extends Omit<LinkProps, 'type' | 'raw' | 'cu
|
|
|
67
67
|
open?: boolean;
|
|
68
68
|
onSelect?: (e: Event) => void;
|
|
69
69
|
class?: any;
|
|
70
|
-
ui?: Pick<NavigationMenu['slots'], 'item' | 'linkLeadingAvatarSize' | 'linkLeadingAvatar' | 'linkLeadingIcon' | 'linkLeadingChipSize' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkTrailing' | 'linkTrailingBadgeSize' | 'linkTrailingBadge' | 'linkTrailingIcon' | 'label' | 'link' | 'content' | 'childList' | 'childLabel' | 'childItem' | 'childLink' | 'childLinkIcon' | 'childLinkWrapper' | 'childLinkLabel' | 'childLinkLabelExternalIcon' | 'childLinkDescription'
|
|
70
|
+
ui?: Partial<Pick<NavigationMenu['slots'], 'item' | 'linkLeadingAvatarSize' | 'linkLeadingAvatar' | 'linkLeadingIcon' | 'linkLeadingChipSize' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkTrailing' | 'linkTrailingBadgeSize' | 'linkTrailingBadge' | 'linkTrailingIcon' | 'label' | 'link' | 'content' | 'childList' | 'childLabel' | 'childItem' | 'childLink' | 'childLinkIcon' | 'childLinkWrapper' | 'childLinkLabel' | 'childLinkLabelExternalIcon' | 'childLinkDescription'>>;
|
|
71
71
|
[key: string]: any;
|
|
72
72
|
}
|
|
73
73
|
type SingleOrMultipleType = 'single' | 'multiple';
|
|
@@ -12,7 +12,7 @@ export interface PageAnchor extends Omit<LinkProps, 'custom'> {
|
|
|
12
12
|
*/
|
|
13
13
|
icon?: IconProps['name'];
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<PageAnchors['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeading' | 'linkLeadingIcon'
|
|
15
|
+
ui?: Partial<Pick<PageAnchors['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeading' | 'linkLeadingIcon'>>;
|
|
16
16
|
}
|
|
17
17
|
export interface PageAnchorsProps<T extends PageAnchor = PageAnchor> {
|
|
18
18
|
/**
|
|
@@ -12,7 +12,7 @@ export interface PageAnchor extends Omit<LinkProps, 'custom'> {
|
|
|
12
12
|
*/
|
|
13
13
|
icon?: IconProps['name'];
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<PageAnchors['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeading' | 'linkLeadingIcon'
|
|
15
|
+
ui?: Partial<Pick<PageAnchors['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeading' | 'linkLeadingIcon'>>;
|
|
16
16
|
}
|
|
17
17
|
export interface PageAnchorsProps<T extends PageAnchor = PageAnchor> {
|
|
18
18
|
/**
|
|
@@ -12,7 +12,7 @@ export interface PageLink extends Omit<LinkProps, 'custom'> {
|
|
|
12
12
|
*/
|
|
13
13
|
icon?: IconProps['name'];
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<PageLinks['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeadingIcon'
|
|
15
|
+
ui?: Partial<Pick<PageLinks['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeadingIcon'>>;
|
|
16
16
|
}
|
|
17
17
|
export interface PageLinksProps<T extends PageLink = PageLink> {
|
|
18
18
|
/**
|
|
@@ -12,7 +12,7 @@ export interface PageLink extends Omit<LinkProps, 'custom'> {
|
|
|
12
12
|
*/
|
|
13
13
|
icon?: IconProps['name'];
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<PageLinks['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeadingIcon'
|
|
15
|
+
ui?: Partial<Pick<PageLinks['slots'], 'item' | 'link' | 'linkLabel' | 'linkLabelExternalIcon' | 'linkLeadingIcon'>>;
|
|
16
16
|
}
|
|
17
17
|
export interface PageLinksProps<T extends PageLink = PageLink> {
|
|
18
18
|
/**
|
|
@@ -46,6 +46,7 @@ export interface PinInputProps<T extends PinInputType = 'text'> extends Pick<Pin
|
|
|
46
46
|
export type PinInputEmits<T extends PinInputType = 'text'> = PinInputRootEmits<T> & {
|
|
47
47
|
change: [event: Event];
|
|
48
48
|
blur: [event: Event];
|
|
49
|
+
focus: [event: Event];
|
|
49
50
|
};
|
|
50
51
|
export interface PinInputSlots {
|
|
51
52
|
separator?(props: {
|
|
@@ -58,8 +59,9 @@ declare const __VLS_export: <T extends PinInputType>(__VLS_props: NonNullable<Aw
|
|
|
58
59
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<PinInputProps<T> & {
|
|
59
60
|
onBlur?: ((event: Event) => any) | undefined;
|
|
60
61
|
onChange?: ((event: Event) => any) | undefined;
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
onFocus?: ((event: Event) => any) | undefined;
|
|
63
|
+
"onUpdate:modelValue"?: ((value: [T] extends ["number"] ? (number | undefined)[] : string[]) => any) | undefined;
|
|
64
|
+
onComplete?: ((value: [T] extends ["number"] ? (number | undefined)[] : string[]) => any) | undefined;
|
|
63
65
|
}> & (typeof globalThis extends {
|
|
64
66
|
__VLS_PROPS_FALLBACK: infer P;
|
|
65
67
|
} ? P : {});
|
|
@@ -68,7 +70,7 @@ declare const __VLS_export: <T extends PinInputType>(__VLS_props: NonNullable<Aw
|
|
|
68
70
|
}>) => void;
|
|
69
71
|
attrs: any;
|
|
70
72
|
slots: PinInputSlots;
|
|
71
|
-
emit: ((evt: "blur", event: Event) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: [T] extends ["number"] ? number[] : string[]) => void) & ((evt: "complete", value: [T] extends ["number"] ? number[] : string[]) => void);
|
|
73
|
+
emit: ((evt: "blur", event: Event) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: Event) => void) & ((evt: "update:modelValue", value: [T] extends ["number"] ? (number | undefined)[] : string[]) => void) & ((evt: "complete", value: [T] extends ["number"] ? (number | undefined)[] : string[]) => void);
|
|
72
74
|
}>) => import("vue").VNode & {
|
|
73
75
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
74
76
|
};
|
|
@@ -36,7 +36,7 @@ const _props = defineProps({
|
|
|
36
36
|
required: { type: Boolean, required: false },
|
|
37
37
|
type: { type: null, required: false, default: "text" }
|
|
38
38
|
});
|
|
39
|
-
const emits = defineEmits(["update:modelValue", "complete", "change", "blur"]);
|
|
39
|
+
const emits = defineEmits(["update:modelValue", "complete", "change", "blur", "focus"]);
|
|
40
40
|
defineSlots();
|
|
41
41
|
const props = useComponentProps("pinInput", _props);
|
|
42
42
|
const appConfig = useAppConfig();
|
|
@@ -62,11 +62,19 @@ function onComplete(value) {
|
|
|
62
62
|
emits("change", event);
|
|
63
63
|
emitFormChange();
|
|
64
64
|
}
|
|
65
|
-
function
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
emitFormBlur();
|
|
65
|
+
function onFocusOut(event) {
|
|
66
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
67
|
+
return;
|
|
69
68
|
}
|
|
69
|
+
emits("blur", event);
|
|
70
|
+
emitFormBlur();
|
|
71
|
+
}
|
|
72
|
+
function onFocusIn(event) {
|
|
73
|
+
if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
emits("focus", event);
|
|
77
|
+
emitFormFocus();
|
|
70
78
|
}
|
|
71
79
|
function autoFocus() {
|
|
72
80
|
if (props.autofocus) {
|
|
@@ -111,6 +119,8 @@ defineExpose({
|
|
|
111
119
|
:class="ui.root({ class: [props.ui?.root, props.class] })"
|
|
112
120
|
@update:model-value="emitFormInput()"
|
|
113
121
|
@complete="onComplete"
|
|
122
|
+
@focusout="onFocusOut"
|
|
123
|
+
@focusin="onFocusIn"
|
|
114
124
|
>
|
|
115
125
|
<template v-for="(ids, index) in looseToNumber(props.length)" :key="ids">
|
|
116
126
|
<PinInputInput
|
|
@@ -119,8 +129,6 @@ defineExpose({
|
|
|
119
129
|
data-slot="base"
|
|
120
130
|
:class="ui.base({ class: props.ui?.base })"
|
|
121
131
|
:disabled="disabled"
|
|
122
|
-
@blur="onBlur"
|
|
123
|
-
@focus="emitFormFocus"
|
|
124
132
|
/>
|
|
125
133
|
<span
|
|
126
134
|
v-if="shouldInsertSeparator(index)"
|
|
@@ -46,6 +46,7 @@ export interface PinInputProps<T extends PinInputType = 'text'> extends Pick<Pin
|
|
|
46
46
|
export type PinInputEmits<T extends PinInputType = 'text'> = PinInputRootEmits<T> & {
|
|
47
47
|
change: [event: Event];
|
|
48
48
|
blur: [event: Event];
|
|
49
|
+
focus: [event: Event];
|
|
49
50
|
};
|
|
50
51
|
export interface PinInputSlots {
|
|
51
52
|
separator?(props: {
|
|
@@ -58,8 +59,9 @@ declare const __VLS_export: <T extends PinInputType>(__VLS_props: NonNullable<Aw
|
|
|
58
59
|
props: import("vue").PublicProps & __VLS_PrettifyLocal<PinInputProps<T> & {
|
|
59
60
|
onBlur?: ((event: Event) => any) | undefined;
|
|
60
61
|
onChange?: ((event: Event) => any) | undefined;
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
onFocus?: ((event: Event) => any) | undefined;
|
|
63
|
+
"onUpdate:modelValue"?: ((value: [T] extends ["number"] ? (number | undefined)[] : string[]) => any) | undefined;
|
|
64
|
+
onComplete?: ((value: [T] extends ["number"] ? (number | undefined)[] : string[]) => any) | undefined;
|
|
63
65
|
}> & (typeof globalThis extends {
|
|
64
66
|
__VLS_PROPS_FALLBACK: infer P;
|
|
65
67
|
} ? P : {});
|
|
@@ -68,7 +70,7 @@ declare const __VLS_export: <T extends PinInputType>(__VLS_props: NonNullable<Aw
|
|
|
68
70
|
}>) => void;
|
|
69
71
|
attrs: any;
|
|
70
72
|
slots: PinInputSlots;
|
|
71
|
-
emit: ((evt: "blur", event: Event) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: [T] extends ["number"] ? number[] : string[]) => void) & ((evt: "complete", value: [T] extends ["number"] ? number[] : string[]) => void);
|
|
73
|
+
emit: ((evt: "blur", event: Event) => void) & ((evt: "change", event: Event) => void) & ((evt: "focus", event: Event) => void) & ((evt: "update:modelValue", value: [T] extends ["number"] ? (number | undefined)[] : string[]) => void) & ((evt: "complete", value: [T] extends ["number"] ? (number | undefined)[] : string[]) => void);
|
|
72
74
|
}>) => import("vue").VNode & {
|
|
73
75
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
74
76
|
};
|
|
@@ -20,7 +20,7 @@ export interface ProgressGroupItem {
|
|
|
20
20
|
color?: ProgressGroup['variants']['color'] | (string & {});
|
|
21
21
|
slot?: string;
|
|
22
22
|
class?: any;
|
|
23
|
-
ui?: Pick<ProgressGroup['slots'], 'segment' | 'indicator' | 'item' | 'itemLeadingIcon' | 'itemLeadingDot' | 'itemLabel' | 'itemTrailing'
|
|
23
|
+
ui?: Partial<Pick<ProgressGroup['slots'], 'segment' | 'indicator' | 'item' | 'itemLeadingIcon' | 'itemLeadingDot' | 'itemLabel' | 'itemTrailing'>>;
|
|
24
24
|
[key: string]: any;
|
|
25
25
|
}
|
|
26
26
|
export interface ProgressGroupProps<T extends ProgressGroupItem = ProgressGroupItem> {
|
|
@@ -20,7 +20,7 @@ export interface ProgressGroupItem {
|
|
|
20
20
|
color?: ProgressGroup['variants']['color'] | (string & {});
|
|
21
21
|
slot?: string;
|
|
22
22
|
class?: any;
|
|
23
|
-
ui?: Pick<ProgressGroup['slots'], 'segment' | 'indicator' | 'item' | 'itemLeadingIcon' | 'itemLeadingDot' | 'itemLabel' | 'itemTrailing'
|
|
23
|
+
ui?: Partial<Pick<ProgressGroup['slots'], 'segment' | 'indicator' | 'item' | 'itemLeadingIcon' | 'itemLeadingDot' | 'itemLabel' | 'itemTrailing'>>;
|
|
24
24
|
[key: string]: any;
|
|
25
25
|
}
|
|
26
26
|
export interface ProgressGroupProps<T extends ProgressGroupItem = ProgressGroupItem> {
|
|
@@ -18,7 +18,7 @@ export type RadioGroupItem = RadioGroupValue | {
|
|
|
18
18
|
*/
|
|
19
19
|
icon?: IconProps['name'];
|
|
20
20
|
class?: any;
|
|
21
|
-
ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'icon' | 'description'
|
|
21
|
+
ui?: Partial<Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'icon' | 'description'>>;
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
};
|
|
24
24
|
export interface RadioGroupProps<T extends RadioGroupItem[] = RadioGroupItem[], VK extends GetItemKeys<T> = 'value'> extends Pick<RadioGroupRootProps, 'disabled' | 'loop' | 'name' | 'required'> {
|
|
@@ -18,7 +18,7 @@ export type RadioGroupItem = RadioGroupValue | {
|
|
|
18
18
|
*/
|
|
19
19
|
icon?: IconProps['name'];
|
|
20
20
|
class?: any;
|
|
21
|
-
ui?: Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'icon' | 'description'
|
|
21
|
+
ui?: Partial<Pick<RadioGroup['slots'], 'item' | 'container' | 'base' | 'indicator' | 'wrapper' | 'label' | 'icon' | 'description'>>;
|
|
22
22
|
[key: string]: any;
|
|
23
23
|
};
|
|
24
24
|
export interface RadioGroupProps<T extends RadioGroupItem[] = RadioGroupItem[], VK extends GetItemKeys<T> = 'value'> extends Pick<RadioGroupRootProps, 'disabled' | 'loop' | 'name' | 'required'> {
|
|
@@ -30,7 +30,7 @@ export type SelectItem = SelectValue | {
|
|
|
30
30
|
disabled?: boolean;
|
|
31
31
|
onSelect?: (e: Event) => void;
|
|
32
32
|
class?: any;
|
|
33
|
-
ui?: Pick<Select['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
33
|
+
ui?: Partial<Pick<Select['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
};
|
|
36
36
|
type ExcludeItem = {
|
|
@@ -167,6 +167,12 @@ function onTriggerClick(open) {
|
|
|
167
167
|
triggerRef.value?.$el?.dispatchEvent(new PointerEvent("pointerdown", { bubbles: true, button: 0 }));
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
|
+
function onCloseAutoFocus(event) {
|
|
171
|
+
const activeElement = document.activeElement;
|
|
172
|
+
if (activeElement && activeElement !== document.body && !event.target.contains(activeElement)) {
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
170
176
|
const viewportRef = useTemplateRef("viewportRef");
|
|
171
177
|
defineExpose({
|
|
172
178
|
triggerRef: toRef(() => triggerRef.value?.$el),
|
|
@@ -224,7 +230,7 @@ defineExpose({
|
|
|
224
230
|
|
|
225
231
|
<SelectPortal v-bind="portalProps">
|
|
226
232
|
<FieldGroupReset>
|
|
227
|
-
<SelectContent data-slot="content" :class="ui.content({ class: props.ui?.content })" v-bind="contentProps">
|
|
233
|
+
<SelectContent data-slot="content" :class="ui.content({ class: props.ui?.content })" v-bind="contentProps" @close-auto-focus="onCloseAutoFocus">
|
|
228
234
|
<slot name="content-top" />
|
|
229
235
|
|
|
230
236
|
<component :is="isItemAligned ? SelectViewport : 'div'" ref="viewportRef" role="presentation" data-slot="viewport" :class="ui.viewport({ class: props.ui?.viewport })">
|
|
@@ -30,7 +30,7 @@ export type SelectItem = SelectValue | {
|
|
|
30
30
|
disabled?: boolean;
|
|
31
31
|
onSelect?: (e: Event) => void;
|
|
32
32
|
class?: any;
|
|
33
|
-
ui?: Pick<Select['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
33
|
+
ui?: Partial<Pick<Select['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
34
34
|
[key: string]: any;
|
|
35
35
|
};
|
|
36
36
|
type ExcludeItem = {
|
|
@@ -32,7 +32,7 @@ export type SelectMenuItem = SelectMenuValue | {
|
|
|
32
32
|
disabled?: boolean;
|
|
33
33
|
onSelect?: (e: Event) => void;
|
|
34
34
|
class?: any;
|
|
35
|
-
ui?: Pick<SelectMenu['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
35
|
+
ui?: Partial<Pick<SelectMenu['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
36
36
|
[key: string]: any;
|
|
37
37
|
};
|
|
38
38
|
type ExcludeItem = {
|
|
@@ -237,6 +237,14 @@ function onUpdateOpen(value) {
|
|
|
237
237
|
clearTimeout(timeoutId);
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
|
+
function onTriggerKeydown(e) {
|
|
241
|
+
if (isOpen.value) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const trigger = e.currentTarget;
|
|
245
|
+
e.preventDefault();
|
|
246
|
+
trigger.click();
|
|
247
|
+
}
|
|
240
248
|
function onCreate(e) {
|
|
241
249
|
e.preventDefault();
|
|
242
250
|
e.stopPropagation();
|
|
@@ -262,6 +270,9 @@ function isModelValueEmpty(modelValue) {
|
|
|
262
270
|
return modelValue === void 0 || modelValue === null || modelValue === "";
|
|
263
271
|
}
|
|
264
272
|
function onClear() {
|
|
273
|
+
if (disabled.value) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
265
276
|
emits("clear");
|
|
266
277
|
}
|
|
267
278
|
function onMountAutoFocus(event) {
|
|
@@ -269,6 +280,12 @@ function onMountAutoFocus(event) {
|
|
|
269
280
|
event.preventDefault();
|
|
270
281
|
}
|
|
271
282
|
}
|
|
283
|
+
function onUnmountAutoFocus(event) {
|
|
284
|
+
const activeElement = document.activeElement;
|
|
285
|
+
if (activeElement && activeElement !== document.body && !event.target.contains(activeElement)) {
|
|
286
|
+
event.preventDefault();
|
|
287
|
+
}
|
|
288
|
+
}
|
|
272
289
|
const viewportRef = useTemplateRef("viewportRef");
|
|
273
290
|
const comboboxRootRef = useTemplateRef("comboboxRootRef");
|
|
274
291
|
watch(() => props.items, async () => {
|
|
@@ -373,7 +390,9 @@ defineExpose({
|
|
|
373
390
|
data-slot="base"
|
|
374
391
|
:class="ui.base({ class: [props.ui?.base, props.class] })"
|
|
375
392
|
tabindex="0"
|
|
376
|
-
v-bind="{ ...$attrs, ...ariaAttrs }"
|
|
393
|
+
v-bind="{ 'aria-label': void 0, ...$attrs, ...ariaAttrs }"
|
|
394
|
+
@keydown.down="onTriggerKeydown"
|
|
395
|
+
@keydown.up="onTriggerKeydown"
|
|
377
396
|
>
|
|
378
397
|
<span v-if="isLeading || !!props.avatar || !!slots.leading" data-slot="leading" :class="ui.leading({ class: props.ui?.leading })">
|
|
379
398
|
<slot name="leading" :model-value="modelValue" :open="open" :ui="ui">
|
|
@@ -395,7 +414,7 @@ defineExpose({
|
|
|
395
414
|
|
|
396
415
|
<span v-if="isTrailing || !!slots.trailing || !!props.clear" data-slot="trailing" :class="ui.trailing({ class: props.ui?.trailing })">
|
|
397
416
|
<slot name="trailing" :model-value="modelValue" :open="open" :ui="ui">
|
|
398
|
-
<ComboboxCancel v-if="!!props.clear && !isModelValueEmpty(modelValue)" as-child>
|
|
417
|
+
<ComboboxCancel v-if="!!props.clear && !disabled && !isModelValueEmpty(modelValue)" as-child>
|
|
399
418
|
<UButton
|
|
400
419
|
as="span"
|
|
401
420
|
:icon="props.clearIcon || appConfig.ui.icons.close"
|
|
@@ -419,7 +438,7 @@ defineExpose({
|
|
|
419
438
|
<ComboboxPortal v-bind="portalProps">
|
|
420
439
|
<FieldGroupReset>
|
|
421
440
|
<ComboboxContent data-slot="content" :class="ui.content({ class: props.ui?.content })" v-bind="contentProps">
|
|
422
|
-
<FocusScope
|
|
441
|
+
<FocusScope loop data-slot="focusScope" :class="ui.focusScope({ class: props.ui?.focusScope })" @mount-auto-focus="onMountAutoFocus" @unmount-auto-focus="onUnmountAutoFocus">
|
|
423
442
|
<slot name="content-top" />
|
|
424
443
|
|
|
425
444
|
<ComboboxInput v-if="!!props.searchInput" v-model="searchTerm" :display-value="() => searchTerm" as-child>
|
|
@@ -32,7 +32,7 @@ export type SelectMenuItem = SelectMenuValue | {
|
|
|
32
32
|
disabled?: boolean;
|
|
33
33
|
onSelect?: (e: Event) => void;
|
|
34
34
|
class?: any;
|
|
35
|
-
ui?: Pick<SelectMenu['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'
|
|
35
|
+
ui?: Partial<Pick<SelectMenu['slots'], 'label' | 'separator' | 'item' | 'itemLeadingIcon' | 'itemLeadingAvatarSize' | 'itemLeadingAvatar' | 'itemLeadingChipSize' | 'itemLeadingChip' | 'itemWrapper' | 'itemLabel' | 'itemDescription' | 'itemTrailing' | 'itemTrailingIcon'>>;
|
|
36
36
|
[key: string]: any;
|
|
37
37
|
};
|
|
38
38
|
type ExcludeItem = {
|
|
@@ -12,7 +12,7 @@ export interface SplitterItem extends Omit<SplitterPanelProps, 'as' | 'asChild'>
|
|
|
12
12
|
id?: string;
|
|
13
13
|
slot?: string;
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<Splitter['slots'], 'panel'
|
|
15
|
+
ui?: Partial<Pick<Splitter['slots'], 'panel'>>;
|
|
16
16
|
[key: string]: any;
|
|
17
17
|
}
|
|
18
18
|
export interface SplitterProps<T extends SplitterItem = SplitterItem> extends Pick<SplitterGroupProps, 'autoSaveId' | 'keyboardResizeBy' | 'storage'>, Pick<SplitterResizeHandleProps, 'hitAreaMargins'> {
|
|
@@ -12,7 +12,7 @@ export interface SplitterItem extends Omit<SplitterPanelProps, 'as' | 'asChild'>
|
|
|
12
12
|
id?: string;
|
|
13
13
|
slot?: string;
|
|
14
14
|
class?: any;
|
|
15
|
-
ui?: Pick<Splitter['slots'], 'panel'
|
|
15
|
+
ui?: Partial<Pick<Splitter['slots'], 'panel'>>;
|
|
16
16
|
[key: string]: any;
|
|
17
17
|
}
|
|
18
18
|
export interface SplitterProps<T extends SplitterItem = SplitterItem> extends Pick<SplitterGroupProps, 'autoSaveId' | 'keyboardResizeBy' | 'storage'>, Pick<SplitterResizeHandleProps, 'hitAreaMargins'> {
|