@humanonlyweb/ui 0.0.0-stage → 0.2.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 +21 -0
- package/README.md +45 -2
- package/dist/components/accordion/Accordion.js +60 -0
- package/dist/components/accordion/Accordion.vue.d.ts +28 -0
- package/dist/components/accordion/AccordionItem.js +102 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +33 -0
- package/dist/components/avatar/Avatar.js +52 -0
- package/dist/components/avatar/Avatar.vue.d.ts +26 -0
- package/dist/components/avatar/AvatarGroup.js +48 -0
- package/dist/components/avatar/AvatarGroup.vue.d.ts +16 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js +59 -0
- package/dist/components/breadcrumbs/Breadcrumbs.vue.d.ts +14 -0
- package/dist/components/button/Button.js +95 -0
- package/dist/components/button/Button.vue.d.ts +74 -0
- package/dist/components/button/IconButton.js +47 -0
- package/dist/components/button/IconButton.vue.d.ts +115 -0
- package/dist/components/checkbox/Checkbox.js +93 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts +43 -0
- package/dist/components/checkbox-group/CheckboxGroup.js +89 -0
- package/dist/components/checkbox-group/CheckboxGroup.vue.d.ts +43 -0
- package/dist/components/combobox/Combobox.js +294 -0
- package/dist/components/combobox/Combobox.vue.d.ts +80 -0
- package/dist/components/context-menu/ContextMenu.js +170 -0
- package/dist/components/context-menu/ContextMenu.vue.d.ts +38 -0
- package/dist/components/dialog/ConfirmDialog.js +103 -0
- package/dist/components/dialog/ConfirmDialog.vue.d.ts +46 -0
- package/dist/components/dialog/Dialog.js +160 -0
- package/dist/components/dialog/Dialog.vue.d.ts +54 -0
- package/dist/components/field/FieldMessage.js +31 -0
- package/dist/components/fieldset/Fieldset.js +59 -0
- package/dist/components/fieldset/Fieldset.vue.d.ts +29 -0
- package/dist/components/input/Input.js +111 -0
- package/dist/components/input/Input.vue.d.ts +50 -0
- package/dist/components/kbd/Kbd.js +48 -0
- package/dist/components/kbd/Kbd.vue.d.ts +24 -0
- package/dist/components/menu/Menu.js +124 -0
- package/dist/components/menu/Menu.vue.d.ts +41 -0
- package/dist/components/otp-input/OtpInput.js +179 -0
- package/dist/components/otp-input/OtpInput.vue.d.ts +48 -0
- package/dist/components/pagination/Pagination.js +128 -0
- package/dist/components/pagination/Pagination.vue.d.ts +24 -0
- package/dist/components/password-input/PasswordInput.js +151 -0
- package/dist/components/password-input/PasswordInput.vue.d.ts +32 -0
- package/dist/components/popover/Popover.js +83 -0
- package/dist/components/popover/Popover.vue.d.ts +37 -0
- package/dist/components/progress/Progress.js +52 -0
- package/dist/components/progress/Progress.vue.d.ts +17 -0
- package/dist/components/radio-group/RadioGroup.js +125 -0
- package/dist/components/radio-group/RadioGroup.vue.d.ts +45 -0
- package/dist/components/segmented/Segmented.js +110 -0
- package/dist/components/segmented/Segmented.vue.d.ts +41 -0
- package/dist/components/select/Select.js +231 -0
- package/dist/components/select/Select.vue.d.ts +59 -0
- package/dist/components/slider/Slider.js +196 -0
- package/dist/components/slider/Slider.vue.d.ts +49 -0
- package/dist/components/spin-button/SpinButton.js +231 -0
- package/dist/components/spin-button/SpinButton.vue.d.ts +48 -0
- package/dist/components/split-button/SplitButton.js +69 -0
- package/dist/components/split-button/SplitButton.vue.d.ts +38 -0
- package/dist/components/switch/Switch.js +95 -0
- package/dist/components/switch/Switch.vue.d.ts +42 -0
- package/dist/components/table/Table.js +173 -0
- package/dist/components/table/Table.vue.d.ts +45 -0
- package/dist/components/tabs/Tabs.js +103 -0
- package/dist/components/tabs/Tabs.vue.d.ts +39 -0
- package/dist/components/tag-input/TagInput.js +186 -0
- package/dist/components/tag-input/TagInput.vue.d.ts +36 -0
- package/dist/components/textarea/Textarea.js +118 -0
- package/dist/components/textarea/Textarea.vue.d.ts +34 -0
- package/dist/components/toast/ToastItem.js +91 -0
- package/dist/components/toast/ToastItem.vue.d.ts +29 -0
- package/dist/components/toast/ToastViewport.js +56 -0
- package/dist/components/toast/ToastViewport.vue.d.ts +25 -0
- package/dist/components/toolbar/Toolbar.js +91 -0
- package/dist/components/toolbar/Toolbar.vue.d.ts +21 -0
- package/dist/components/tooltip/Tooltip.js +85 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +25 -0
- package/dist/components/visually-hidden/VisuallyHidden.js +16 -0
- package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +19 -0
- package/dist/composables/internal/env.js +5 -0
- package/dist/composables/internal/is-equal.js +14 -0
- package/dist/composables/internal/on-click-outside.js +18 -0
- package/dist/composables/internal/standard-schema.d.ts +38 -0
- package/dist/composables/internal/use-document-visibility.js +16 -0
- package/dist/composables/internal/use-event-listener.js +24 -0
- package/dist/composables/internal/use-interval-fn.js +21 -0
- package/dist/composables/internal/use-resize-observer.js +21 -0
- package/dist/composables/internal/use-timeout-fn.js +25 -0
- package/dist/composables/use-accordion.d.ts +9 -0
- package/dist/composables/use-accordion.js +10 -0
- package/dist/composables/use-combobox.d.ts +44 -0
- package/dist/composables/use-combobox.js +185 -0
- package/dist/composables/use-field.d.ts +17 -0
- package/dist/composables/use-field.js +27 -0
- package/dist/composables/use-form.d.ts +44 -0
- package/dist/composables/use-form.js +146 -0
- package/dist/composables/use-menu.d.ts +26 -0
- package/dist/composables/use-menu.js +117 -0
- package/dist/composables/use-platform.d.ts +17 -0
- package/dist/composables/use-platform.js +126 -0
- package/dist/composables/use-popover.d.ts +35 -0
- package/dist/composables/use-popover.js +49 -0
- package/dist/composables/use-roving-selection.d.ts +22 -0
- package/dist/composables/use-roving-selection.js +65 -0
- package/dist/composables/use-select.d.ts +31 -0
- package/dist/composables/use-select.js +169 -0
- package/dist/composables/use-slide-indicator.d.ts +24 -0
- package/dist/composables/use-slide-indicator.js +52 -0
- package/dist/composables/use-toast.d.ts +23 -0
- package/dist/composables/use-toast.js +51 -0
- package/dist/config.d.ts +40 -0
- package/dist/config.js +35 -0
- package/dist/docs/README.md +52 -0
- package/dist/docs/changelog.md +21 -0
- package/dist/docs/components/accordion.md +100 -0
- package/dist/docs/components/avatar-group.md +58 -0
- package/dist/docs/components/avatar.md +40 -0
- package/dist/docs/components/breadcrumbs.md +81 -0
- package/dist/docs/components/button.md +109 -0
- package/dist/docs/components/checkbox-group.md +118 -0
- package/dist/docs/components/checkbox.md +123 -0
- package/dist/docs/components/combobox.md +207 -0
- package/dist/docs/components/confirm-dialog.md +107 -0
- package/dist/docs/components/context-menu.md +98 -0
- package/dist/docs/components/dialog.md +127 -0
- package/dist/docs/components/fieldset.md +65 -0
- package/dist/docs/components/icon-button.md +47 -0
- package/dist/docs/components/input.md +89 -0
- package/dist/docs/components/kbd.md +41 -0
- package/dist/docs/components/menu.md +112 -0
- package/dist/docs/components/otp-input.md +92 -0
- package/dist/docs/components/pagination.md +62 -0
- package/dist/docs/components/password-input.md +55 -0
- package/dist/docs/components/popover.md +72 -0
- package/dist/docs/components/progress.md +56 -0
- package/dist/docs/components/radio-group.md +114 -0
- package/dist/docs/components/segmented.md +96 -0
- package/dist/docs/components/select.md +129 -0
- package/dist/docs/components/slider.md +105 -0
- package/dist/docs/components/spin-button.md +73 -0
- package/dist/docs/components/split-button.md +64 -0
- package/dist/docs/components/switch.md +71 -0
- package/dist/docs/components/table.md +241 -0
- package/dist/docs/components/tabs.md +106 -0
- package/dist/docs/components/tag-input.md +88 -0
- package/dist/docs/components/textarea.md +46 -0
- package/dist/docs/components/toast.md +135 -0
- package/dist/docs/components/toolbar.md +71 -0
- package/dist/docs/components/tooltip.md +57 -0
- package/dist/docs/components/visually-hidden.md +53 -0
- package/dist/docs/forms.md +182 -0
- package/dist/docs/index.md +11 -0
- package/dist/docs/installation.md +71 -0
- package/dist/docs/localisation.md +42 -0
- package/dist/docs/ssr.md +24 -0
- package/dist/docs/styling.md +82 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +56 -0
- package/dist/nuxt/module.d.ts +15 -0
- package/dist/nuxt/module.js +80 -0
- package/dist/nuxt/runtime/plugin.d.ts +4 -0
- package/dist/nuxt/runtime/plugin.js +24 -0
- package/dist/package.js +4 -0
- package/dist/styles/core.css +310 -0
- package/dist/translations.d.ts +85 -0
- package/dist/translations.js +62 -0
- package/dist/types.d.ts +69 -0
- package/package.json +93 -4
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { useTranslations } from "../../config.js";
|
|
2
|
+
import { useField } from "../../composables/use-field.js";
|
|
3
|
+
import _sfc_main$1 from "../field/FieldMessage.js";
|
|
4
|
+
import { useCombobox } from "../../composables/use-combobox.js";
|
|
5
|
+
import { useAnchor } from "../../composables/use-popover.js";
|
|
6
|
+
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, normalizeStyle, openBlock, renderList, renderSlot, toDisplayString, unref, useModel, useTemplateRef, vModelText, withDirectives, withModifiers } from "vue";
|
|
7
|
+
//#region src/components/combobox/Combobox.vue
|
|
8
|
+
const _hoisted_1 = ["data-field-error", "data-field-name"];
|
|
9
|
+
const _hoisted_2 = ["for"];
|
|
10
|
+
const _hoisted_3 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
"data-part": "field-optional"
|
|
13
|
+
};
|
|
14
|
+
const _hoisted_4 = ["data-combobox-open", "data-combobox-disabled"];
|
|
15
|
+
const _hoisted_5 = { "data-part": "combobox-chip-label" };
|
|
16
|
+
const _hoisted_6 = [
|
|
17
|
+
"aria-label",
|
|
18
|
+
"disabled",
|
|
19
|
+
"onClick"
|
|
20
|
+
];
|
|
21
|
+
const _hoisted_7 = [
|
|
22
|
+
"id",
|
|
23
|
+
"aria-expanded",
|
|
24
|
+
"aria-controls",
|
|
25
|
+
"aria-activedescendant",
|
|
26
|
+
"aria-invalid",
|
|
27
|
+
"aria-describedby",
|
|
28
|
+
"placeholder",
|
|
29
|
+
"disabled"
|
|
30
|
+
];
|
|
31
|
+
const _hoisted_8 = [
|
|
32
|
+
"id",
|
|
33
|
+
"aria-multiselectable",
|
|
34
|
+
"aria-busy",
|
|
35
|
+
"aria-label"
|
|
36
|
+
];
|
|
37
|
+
const _hoisted_9 = [
|
|
38
|
+
"id",
|
|
39
|
+
"aria-selected",
|
|
40
|
+
"aria-disabled",
|
|
41
|
+
"data-combobox-active",
|
|
42
|
+
"onClick",
|
|
43
|
+
"onPointermove"
|
|
44
|
+
];
|
|
45
|
+
const _hoisted_10 = { "data-part": "combobox-option-label" };
|
|
46
|
+
const _hoisted_11 = {
|
|
47
|
+
key: 0,
|
|
48
|
+
"data-part": "combobox-loading"
|
|
49
|
+
};
|
|
50
|
+
const _hoisted_12 = {
|
|
51
|
+
key: 1,
|
|
52
|
+
"data-part": "combobox-create"
|
|
53
|
+
};
|
|
54
|
+
const _hoisted_13 = {
|
|
55
|
+
key: 2,
|
|
56
|
+
"data-part": "combobox-empty"
|
|
57
|
+
};
|
|
58
|
+
const _hoisted_14 = ["id"];
|
|
59
|
+
const _hoisted_15 = ["name", "value"];
|
|
60
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
61
|
+
inheritAttrs: false,
|
|
62
|
+
__name: "Combobox",
|
|
63
|
+
props: /*@__PURE__*/ mergeModels({
|
|
64
|
+
options: { default: () => [] },
|
|
65
|
+
label: {},
|
|
66
|
+
hint: {},
|
|
67
|
+
error: { type: [String, Boolean] },
|
|
68
|
+
placeholder: {},
|
|
69
|
+
multiple: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
creatable: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
optional: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: false
|
|
80
|
+
},
|
|
81
|
+
disabled: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
filter: { type: Function },
|
|
86
|
+
ignoreFilter: {
|
|
87
|
+
type: Boolean,
|
|
88
|
+
default: false
|
|
89
|
+
},
|
|
90
|
+
loading: {
|
|
91
|
+
type: Boolean,
|
|
92
|
+
default: false
|
|
93
|
+
},
|
|
94
|
+
name: {},
|
|
95
|
+
id: {}
|
|
96
|
+
}, {
|
|
97
|
+
"modelValue": {},
|
|
98
|
+
"modelModifiers": {},
|
|
99
|
+
"query": { default: "" },
|
|
100
|
+
"queryModifiers": {}
|
|
101
|
+
}),
|
|
102
|
+
emits: /*@__PURE__*/ mergeModels(["create"], ["update:modelValue", "update:query"]),
|
|
103
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
104
|
+
const emit = __emit;
|
|
105
|
+
/** The selected value, or values with `multiple`. */
|
|
106
|
+
const model = useModel(__props, "modelValue");
|
|
107
|
+
const submittedValues = computed(() => {
|
|
108
|
+
const value = model.value;
|
|
109
|
+
if (value == null) return [];
|
|
110
|
+
return Array.isArray(value) ? value : [value];
|
|
111
|
+
});
|
|
112
|
+
/** The input's text. Bind it to fetch options as the user types. */
|
|
113
|
+
const query = useModel(__props, "query");
|
|
114
|
+
const { id, hintId, errorId, isError, errorMessage, describedBy } = useField({
|
|
115
|
+
error: () => __props.error,
|
|
116
|
+
id: () => __props.id,
|
|
117
|
+
hint: () => __props.hint
|
|
118
|
+
});
|
|
119
|
+
const listboxId = computed(() => `${id.value}-listbox`);
|
|
120
|
+
const { anchorStyle, panelStyle } = useAnchor();
|
|
121
|
+
const inputRef = useTemplateRef("input");
|
|
122
|
+
const controlRef = useTemplateRef("control");
|
|
123
|
+
const popupRef = useTemplateRef("popup");
|
|
124
|
+
const { isOpen, activeIndex, activeId, optionId, results, selectedOptions, isSelected, canCreate, open, setActive, selectOption, remove, onInput, onKeydown } = useCombobox({
|
|
125
|
+
options: () => __props.options,
|
|
126
|
+
model,
|
|
127
|
+
query,
|
|
128
|
+
multiple: () => __props.multiple,
|
|
129
|
+
disabled: () => __props.disabled,
|
|
130
|
+
filter: () => __props.filter,
|
|
131
|
+
ignoreFilter: () => __props.ignoreFilter,
|
|
132
|
+
creatable: () => __props.creatable,
|
|
133
|
+
onCreate: (text) => emit("create", text),
|
|
134
|
+
baseId: () => id.value,
|
|
135
|
+
input: inputRef,
|
|
136
|
+
control: controlRef,
|
|
137
|
+
listbox: popupRef
|
|
138
|
+
});
|
|
139
|
+
const translations = useTranslations();
|
|
140
|
+
const selectedId = computed(() => `${id.value}-selected`);
|
|
141
|
+
const selectedText = computed(() => __props.multiple && selectedOptions.value.length ? translations.value.selectedItems(selectedOptions.value.map((option) => option.label)) : "");
|
|
142
|
+
const describedByAll = computed(() => [describedBy.value, selectedText.value ? selectedId.value : void 0].filter(Boolean).join(" ") || void 0);
|
|
143
|
+
const status = computed(() => {
|
|
144
|
+
const text = query.value.trim();
|
|
145
|
+
if (!isOpen.value || !text) return "";
|
|
146
|
+
if (__props.loading) return translations.value.loading;
|
|
147
|
+
if (results.value.length) return translations.value.resultCount(results.value.length);
|
|
148
|
+
return canCreate.value ? translations.value.createOption(text) : translations.value.noResults;
|
|
149
|
+
});
|
|
150
|
+
const visuallyHidden = {
|
|
151
|
+
position: "absolute",
|
|
152
|
+
width: "1px",
|
|
153
|
+
height: "1px",
|
|
154
|
+
overflow: "hidden",
|
|
155
|
+
clipPath: "inset(50%)",
|
|
156
|
+
whiteSpace: "nowrap"
|
|
157
|
+
};
|
|
158
|
+
__expose({ focus: () => inputRef.value?.focus() });
|
|
159
|
+
return (_ctx, _cache) => {
|
|
160
|
+
return openBlock(), createElementBlock("div", {
|
|
161
|
+
"data-part": "field",
|
|
162
|
+
"data-field-error": unref(isError) || void 0,
|
|
163
|
+
"data-field-name": __props.name
|
|
164
|
+
}, [
|
|
165
|
+
__props.label ? (openBlock(), createElementBlock("label", {
|
|
166
|
+
key: 0,
|
|
167
|
+
for: unref(id),
|
|
168
|
+
"data-part": "field-label"
|
|
169
|
+
}, [createTextVNode(toDisplayString(__props.label), 1), __props.optional ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(` ${unref(translations).optional}`), 1)) : createCommentVNode("v-if", true)], 8, _hoisted_2)) : createCommentVNode("v-if", true),
|
|
170
|
+
createElementVNode("div", {
|
|
171
|
+
ref: "control",
|
|
172
|
+
"data-part": "combobox-control",
|
|
173
|
+
"data-combobox-open": unref(isOpen) || void 0,
|
|
174
|
+
"data-combobox-disabled": __props.disabled || void 0,
|
|
175
|
+
style: normalizeStyle(unref(anchorStyle)),
|
|
176
|
+
onClick: _cache[4] || (_cache[4] = ($event) => inputRef.value?.focus())
|
|
177
|
+
}, [__props.multiple ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(selectedOptions), (option) => {
|
|
178
|
+
return openBlock(), createElementBlock("span", {
|
|
179
|
+
key: option.value,
|
|
180
|
+
"data-part": "combobox-chip"
|
|
181
|
+
}, [renderSlot(_ctx.$slots, "chip", {
|
|
182
|
+
option,
|
|
183
|
+
remove: () => unref(remove)(option.value)
|
|
184
|
+
}, () => [
|
|
185
|
+
createElementVNode("span", _hoisted_5, toDisplayString(option.label), 1),
|
|
186
|
+
createCommentVNode(" Out of the tab order: Backspace in the input removes chips by keyboard. "),
|
|
187
|
+
createElementVNode("button", {
|
|
188
|
+
type: "button",
|
|
189
|
+
tabindex: "-1",
|
|
190
|
+
"data-part": "combobox-chip-remove",
|
|
191
|
+
"aria-label": unref(translations).removeItem(option.label),
|
|
192
|
+
disabled: __props.disabled,
|
|
193
|
+
onClick: withModifiers(($event) => unref(remove)(option.value), ["stop"])
|
|
194
|
+
}, [..._cache[6] || (_cache[6] = [createElementVNode("svg", {
|
|
195
|
+
viewBox: "0 0 16 16",
|
|
196
|
+
width: "12",
|
|
197
|
+
height: "12",
|
|
198
|
+
"aria-hidden": "true",
|
|
199
|
+
focusable: "false"
|
|
200
|
+
}, [createElementVNode("path", {
|
|
201
|
+
d: "M4 4l8 8M12 4l-8 8",
|
|
202
|
+
stroke: "currentColor",
|
|
203
|
+
"stroke-width": "1.5",
|
|
204
|
+
"stroke-linecap": "round"
|
|
205
|
+
})], -1)])], 8, _hoisted_6)
|
|
206
|
+
])]);
|
|
207
|
+
}), 128)) : createCommentVNode("v-if", true), withDirectives(createElementVNode("input", mergeProps({
|
|
208
|
+
id: unref(id),
|
|
209
|
+
ref: "input",
|
|
210
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => query.value = $event),
|
|
211
|
+
type: "text",
|
|
212
|
+
role: "combobox",
|
|
213
|
+
autocomplete: "off",
|
|
214
|
+
spellcheck: "false",
|
|
215
|
+
"aria-autocomplete": "list",
|
|
216
|
+
"aria-expanded": unref(isOpen),
|
|
217
|
+
"aria-controls": listboxId.value,
|
|
218
|
+
"aria-activedescendant": unref(activeId),
|
|
219
|
+
"aria-invalid": unref(isError) || void 0,
|
|
220
|
+
"aria-describedby": describedByAll.value,
|
|
221
|
+
placeholder: __props.multiple && unref(selectedOptions).length ? void 0 : __props.placeholder,
|
|
222
|
+
disabled: __props.disabled,
|
|
223
|
+
"data-part": "combobox-input"
|
|
224
|
+
}, _ctx.$attrs, {
|
|
225
|
+
onInput: _cache[1] || (_cache[1] = (...args) => unref(onInput) && unref(onInput)(...args)),
|
|
226
|
+
onKeydown: _cache[2] || (_cache[2] = (...args) => unref(onKeydown) && unref(onKeydown)(...args)),
|
|
227
|
+
onClick: _cache[3] || (_cache[3] = (...args) => unref(open) && unref(open)(...args))
|
|
228
|
+
}), null, 16, _hoisted_7), [[vModelText, query.value]])], 12, _hoisted_4),
|
|
229
|
+
createElementVNode("div", {
|
|
230
|
+
ref: "popup",
|
|
231
|
+
popover: "manual",
|
|
232
|
+
"data-part": "combobox-popup",
|
|
233
|
+
style: normalizeStyle(unref(panelStyle)),
|
|
234
|
+
onPointerdown: _cache[5] || (_cache[5] = withModifiers(() => {}, ["prevent"]))
|
|
235
|
+
}, [createElementVNode("ul", {
|
|
236
|
+
id: listboxId.value,
|
|
237
|
+
role: "listbox",
|
|
238
|
+
"data-part": "combobox-listbox",
|
|
239
|
+
"aria-multiselectable": __props.multiple || void 0,
|
|
240
|
+
"aria-busy": __props.loading || void 0,
|
|
241
|
+
"aria-label": __props.label
|
|
242
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(results), (option, i) => {
|
|
243
|
+
return openBlock(), createElementBlock("li", {
|
|
244
|
+
id: unref(optionId)(i),
|
|
245
|
+
key: option.value,
|
|
246
|
+
role: "option",
|
|
247
|
+
"data-part": "combobox-option",
|
|
248
|
+
"aria-selected": unref(isSelected)(option.value),
|
|
249
|
+
"aria-disabled": option.disabled || void 0,
|
|
250
|
+
"data-combobox-active": i === unref(activeIndex) || void 0,
|
|
251
|
+
onClick: ($event) => unref(selectOption)(option),
|
|
252
|
+
onPointermove: ($event) => !option.disabled && unref(setActive)(i)
|
|
253
|
+
}, [renderSlot(_ctx.$slots, "option", {
|
|
254
|
+
option,
|
|
255
|
+
selected: unref(isSelected)(option.value),
|
|
256
|
+
active: i === unref(activeIndex)
|
|
257
|
+
}, () => [createElementVNode("span", _hoisted_10, toDisplayString(option.label), 1)])], 40, _hoisted_9);
|
|
258
|
+
}), 128))], 8, _hoisted_8), __props.loading ? (openBlock(), createElementBlock("p", _hoisted_11, [renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(unref(translations).loading), 1)])])) : unref(canCreate) && !unref(results).length ? (openBlock(), createElementBlock("p", _hoisted_12, [renderSlot(_ctx.$slots, "create", { query: query.value.trim() }, () => [createTextVNode(toDisplayString(unref(translations).createOption(query.value.trim())), 1)])])) : !unref(results).length ? (openBlock(), createElementBlock("p", _hoisted_13, [renderSlot(_ctx.$slots, "empty", { query: query.value }, () => [createTextVNode(toDisplayString(unref(translations).noResults), 1)])])) : createCommentVNode("v-if", true)], 36),
|
|
259
|
+
createElementVNode("span", {
|
|
260
|
+
role: "status",
|
|
261
|
+
"data-part": "combobox-status",
|
|
262
|
+
style: visuallyHidden
|
|
263
|
+
}, toDisplayString(status.value), 1),
|
|
264
|
+
selectedText.value ? (openBlock(), createElementBlock("span", {
|
|
265
|
+
key: 1,
|
|
266
|
+
id: selectedId.value,
|
|
267
|
+
style: visuallyHidden
|
|
268
|
+
}, toDisplayString(selectedText.value), 9, _hoisted_14)) : createCommentVNode("v-if", true),
|
|
269
|
+
createCommentVNode(" Buttons don't submit values, so the form gets hidden inputs instead. "),
|
|
270
|
+
__props.name ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(submittedValues.value, (value) => {
|
|
271
|
+
return openBlock(), createElementBlock("input", {
|
|
272
|
+
key: value,
|
|
273
|
+
type: "hidden",
|
|
274
|
+
name: __props.name,
|
|
275
|
+
value
|
|
276
|
+
}, null, 8, _hoisted_15);
|
|
277
|
+
}), 128)) : createCommentVNode("v-if", true),
|
|
278
|
+
createVNode(_sfc_main$1, {
|
|
279
|
+
"error-id": unref(errorId),
|
|
280
|
+
"hint-id": unref(hintId),
|
|
281
|
+
"error-message": unref(errorMessage),
|
|
282
|
+
hint: __props.hint
|
|
283
|
+
}, null, 8, [
|
|
284
|
+
"error-id",
|
|
285
|
+
"hint-id",
|
|
286
|
+
"error-message",
|
|
287
|
+
"hint"
|
|
288
|
+
])
|
|
289
|
+
], 8, _hoisted_1);
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
//#endregion
|
|
294
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { SelectOption } from "../../types.js";
|
|
2
|
+
import { ComboboxFilter } from "../../composables/use-combobox.js";
|
|
3
|
+
//#region src/components/combobox/Combobox.vue.d.ts
|
|
4
|
+
declare const __VLS_export: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
5
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
6
|
+
/** Options to choose from. */
|
|
7
|
+
options?: SelectOption<T>[];
|
|
8
|
+
/** Visible label, linked to the input. */
|
|
9
|
+
label?: string;
|
|
10
|
+
/** Help text under the control, announced as its description. */
|
|
11
|
+
hint?: string;
|
|
12
|
+
/** `true` marks the control invalid; a string also shows it as the message, replacing the hint. */
|
|
13
|
+
error?: string | boolean;
|
|
14
|
+
/** Input placeholder. */
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/** Pick several; `v-model` becomes an array, shown as chips. Backspace removes the last one. */
|
|
17
|
+
multiple?: boolean;
|
|
18
|
+
/** Enter on text matching no option emits `create` with it. */
|
|
19
|
+
creatable?: boolean;
|
|
20
|
+
/** Appends the `optional` translation to the label. */
|
|
21
|
+
optional?: boolean;
|
|
22
|
+
/** Disables the control. */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Custom match for each option against the lower-cased query. By default, labels are ranked exact, then prefix, then substring. */
|
|
25
|
+
filter?: ComboboxFilter<T>;
|
|
26
|
+
/** Show `options` as given, without filtering, e.g. results from a search request. */
|
|
27
|
+
ignoreFilter?: boolean;
|
|
28
|
+
/** Options are being fetched: shows the `loading` translation and marks the list busy. */
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
/** Form field name: submits the value with a native form, via hidden inputs. */
|
|
31
|
+
name?: string;
|
|
32
|
+
/** Id for the input; generated with `useId()` when omitted. */
|
|
33
|
+
id?: string;
|
|
34
|
+
} & {
|
|
35
|
+
/** The selected value, or values with `multiple`. */
|
|
36
|
+
modelValue?: T | T[];
|
|
37
|
+
/** The input's text. Bind it to fetch options as the user types. */
|
|
38
|
+
query?: string;
|
|
39
|
+
}) & {
|
|
40
|
+
"onUpdate:modelValue"?: ((value: T | T[] | undefined) => any) | undefined;
|
|
41
|
+
onCreate?: ((query: string) => any) | undefined;
|
|
42
|
+
"onUpdate:query"?: ((value: string) => any) | undefined;
|
|
43
|
+
}> & (typeof globalThis extends {
|
|
44
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
45
|
+
} ? P : {});
|
|
46
|
+
expose: (exposed: import("vue").ShallowUnwrapRef<{
|
|
47
|
+
focus: () => void | undefined;
|
|
48
|
+
}>) => void;
|
|
49
|
+
attrs: any;
|
|
50
|
+
slots: {
|
|
51
|
+
/** Option content. */
|
|
52
|
+
option?(props: {
|
|
53
|
+
option: SelectOption<T>;
|
|
54
|
+
selected: boolean;
|
|
55
|
+
active: boolean;
|
|
56
|
+
}): unknown;
|
|
57
|
+
/** Each selected value in `multiple` mode. Call `remove` to deselect it. */
|
|
58
|
+
chip?(props: {
|
|
59
|
+
option: SelectOption<T>;
|
|
60
|
+
remove: () => void;
|
|
61
|
+
}): unknown;
|
|
62
|
+
/** Shown when nothing matches. */
|
|
63
|
+
empty?(props: {
|
|
64
|
+
query: string;
|
|
65
|
+
}): unknown;
|
|
66
|
+
/** Shown with `creatable` when Enter would create the typed value. */
|
|
67
|
+
create?(props: {
|
|
68
|
+
query: string;
|
|
69
|
+
}): unknown;
|
|
70
|
+
/** Shown while `loading`. */
|
|
71
|
+
loading?(): unknown;
|
|
72
|
+
};
|
|
73
|
+
emit: ((evt: "create", query: string) => void) & (((event: "update:modelValue", value: T | T[] | undefined) => void) & ((event: "update:query", value: string) => void));
|
|
74
|
+
}>) => import("vue").VNode & {
|
|
75
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
76
|
+
};
|
|
77
|
+
declare const _default: typeof __VLS_export;
|
|
78
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { _default as default };
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { useTranslations } from "../../config.js";
|
|
2
|
+
import { onClickOutside } from "../../composables/internal/on-click-outside.js";
|
|
3
|
+
import { useAnchor } from "../../composables/use-popover.js";
|
|
4
|
+
import { useTimeoutFn } from "../../composables/internal/use-timeout-fn.js";
|
|
5
|
+
import { isMenuSeparator, useMenu } from "../../composables/use-menu.js";
|
|
6
|
+
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, normalizeStyle, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, useTemplateRef } from "vue";
|
|
7
|
+
//#region src/components/context-menu/ContextMenu.vue
|
|
8
|
+
const _hoisted_1 = ["data-context-menu-open"];
|
|
9
|
+
const _hoisted_2 = ["id", "aria-label"];
|
|
10
|
+
const _hoisted_3 = {
|
|
11
|
+
key: 0,
|
|
12
|
+
role: "separator",
|
|
13
|
+
"data-part": "menu-separator"
|
|
14
|
+
};
|
|
15
|
+
const _hoisted_4 = [
|
|
16
|
+
"data-menu-index",
|
|
17
|
+
"disabled",
|
|
18
|
+
"data-menu-active",
|
|
19
|
+
"onClick",
|
|
20
|
+
"onPointermove"
|
|
21
|
+
];
|
|
22
|
+
const _hoisted_5 = { "data-part": "menu-item-label" };
|
|
23
|
+
const _hoisted_6 = {
|
|
24
|
+
key: 0,
|
|
25
|
+
"data-part": "menu-item-hint",
|
|
26
|
+
"aria-hidden": "true"
|
|
27
|
+
};
|
|
28
|
+
const LONG_PRESS = 500;
|
|
29
|
+
const SLOP = 10;
|
|
30
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
31
|
+
__name: "ContextMenu",
|
|
32
|
+
props: /*@__PURE__*/ mergeModels({
|
|
33
|
+
items: { default: () => [] },
|
|
34
|
+
label: {},
|
|
35
|
+
disabled: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
"open": {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
"openModifiers": {}
|
|
45
|
+
}),
|
|
46
|
+
emits: /*@__PURE__*/ mergeModels(["select"], ["update:open"]),
|
|
47
|
+
setup(__props, { emit: __emit }) {
|
|
48
|
+
const emit = __emit;
|
|
49
|
+
/** Whether the menu is open. */
|
|
50
|
+
const open = useModel(__props, "open");
|
|
51
|
+
const menuId = useId();
|
|
52
|
+
const translations = useTranslations();
|
|
53
|
+
const panelRef = useTemplateRef("panel");
|
|
54
|
+
const { anchorStyle, panelStyle } = useAnchor();
|
|
55
|
+
const point = ref({
|
|
56
|
+
x: 0,
|
|
57
|
+
y: 0
|
|
58
|
+
});
|
|
59
|
+
let returnFocus = null;
|
|
60
|
+
const { activeIndex, setActive, activate, close, onMenuKeydown } = useMenu({
|
|
61
|
+
trigger: () => returnFocus,
|
|
62
|
+
panel: panelRef,
|
|
63
|
+
open,
|
|
64
|
+
itemCount: () => __props.items.length,
|
|
65
|
+
isDisabled: (i) => {
|
|
66
|
+
const item = __props.items[i];
|
|
67
|
+
return isMenuSeparator(item) || Boolean(item?.disabled);
|
|
68
|
+
},
|
|
69
|
+
labelAt: (i) => {
|
|
70
|
+
const item = __props.items[i];
|
|
71
|
+
return isMenuSeparator(item) ? void 0 : item?.label;
|
|
72
|
+
},
|
|
73
|
+
onActivate: (i) => {
|
|
74
|
+
const item = __props.items[i];
|
|
75
|
+
if (item && !isMenuSeparator(item)) emit("select", item.value);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
onClickOutside(panelRef, () => close(false), { active: () => open.value });
|
|
79
|
+
function openAt(x, y) {
|
|
80
|
+
if (__props.disabled || !__props.items.length) return;
|
|
81
|
+
const active = document.activeElement;
|
|
82
|
+
returnFocus = active instanceof HTMLElement && active !== document.body ? active : null;
|
|
83
|
+
point.value = {
|
|
84
|
+
x,
|
|
85
|
+
y
|
|
86
|
+
};
|
|
87
|
+
open.value = true;
|
|
88
|
+
}
|
|
89
|
+
function onContextmenu(event) {
|
|
90
|
+
if (__props.disabled) return;
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
if (event.clientX === 0 && event.clientY === 0 && event.target instanceof Element) {
|
|
93
|
+
const rect = event.target.getBoundingClientRect();
|
|
94
|
+
openAt(rect.left, rect.bottom);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
openAt(event.clientX, event.clientY);
|
|
98
|
+
}
|
|
99
|
+
let pressStart = null;
|
|
100
|
+
const press = useTimeoutFn(() => {
|
|
101
|
+
if (pressStart) openAt(pressStart.x, pressStart.y);
|
|
102
|
+
pressStart = null;
|
|
103
|
+
}, LONG_PRESS);
|
|
104
|
+
function onPointerdown(event) {
|
|
105
|
+
if (event.pointerType !== "touch" || __props.disabled) return;
|
|
106
|
+
pressStart = {
|
|
107
|
+
x: event.clientX,
|
|
108
|
+
y: event.clientY
|
|
109
|
+
};
|
|
110
|
+
press.start();
|
|
111
|
+
}
|
|
112
|
+
function onPointermove(event) {
|
|
113
|
+
if (!pressStart) return;
|
|
114
|
+
if (Math.hypot(event.clientX - pressStart.x, event.clientY - pressStart.y) > SLOP) cancelPress();
|
|
115
|
+
}
|
|
116
|
+
function cancelPress() {
|
|
117
|
+
pressStart = null;
|
|
118
|
+
press.stop();
|
|
119
|
+
}
|
|
120
|
+
return (_ctx, _cache) => {
|
|
121
|
+
return openBlock(), createElementBlock("div", {
|
|
122
|
+
"data-part": "context-menu",
|
|
123
|
+
"data-context-menu-open": open.value || void 0,
|
|
124
|
+
onContextmenu,
|
|
125
|
+
onPointerdown,
|
|
126
|
+
onPointermove,
|
|
127
|
+
onPointerup: cancelPress,
|
|
128
|
+
onPointercancel: cancelPress
|
|
129
|
+
}, [
|
|
130
|
+
renderSlot(_ctx.$slots, "default"),
|
|
131
|
+
createElementVNode("span", {
|
|
132
|
+
"data-part": "context-menu-anchor",
|
|
133
|
+
"aria-hidden": "true",
|
|
134
|
+
style: normalizeStyle([unref(anchorStyle), {
|
|
135
|
+
left: `${point.value.x}px`,
|
|
136
|
+
top: `${point.value.y}px`
|
|
137
|
+
}])
|
|
138
|
+
}, null, 4),
|
|
139
|
+
createElementVNode("div", {
|
|
140
|
+
id: unref(menuId),
|
|
141
|
+
ref: "panel",
|
|
142
|
+
role: "menu",
|
|
143
|
+
popover: "manual",
|
|
144
|
+
"data-part": "menu-list",
|
|
145
|
+
"aria-label": __props.label ?? unref(translations).contextMenu,
|
|
146
|
+
style: normalizeStyle(unref(panelStyle)),
|
|
147
|
+
onKeydown: _cache[0] || (_cache[0] = (...args) => unref(onMenuKeydown) && unref(onMenuKeydown)(...args))
|
|
148
|
+
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, i) => {
|
|
149
|
+
return openBlock(), createElementBlock(Fragment, { key: unref(isMenuSeparator)(item) ? `separator-${i}` : item.value }, [unref(isMenuSeparator)(item) ? (openBlock(), createElementBlock("div", _hoisted_3)) : (openBlock(), createElementBlock("button", {
|
|
150
|
+
key: 1,
|
|
151
|
+
type: "button",
|
|
152
|
+
role: "menuitem",
|
|
153
|
+
"data-part": "menu-item",
|
|
154
|
+
tabindex: "-1",
|
|
155
|
+
"data-menu-index": i,
|
|
156
|
+
disabled: item.disabled,
|
|
157
|
+
"data-menu-active": i === unref(activeIndex) || void 0,
|
|
158
|
+
onClick: ($event) => unref(activate)(i),
|
|
159
|
+
onPointermove: ($event) => !item.disabled && i !== unref(activeIndex) && unref(setActive)(i)
|
|
160
|
+
}, [renderSlot(_ctx.$slots, "item", {
|
|
161
|
+
item,
|
|
162
|
+
active: i === unref(activeIndex)
|
|
163
|
+
}, () => [createElementVNode("span", _hoisted_5, toDisplayString(item.label), 1), item.hint ? (openBlock(), createElementBlock("span", _hoisted_6, toDisplayString(item.hint), 1)) : createCommentVNode("v-if", true)])], 40, _hoisted_4))], 64);
|
|
164
|
+
}), 128))], 44, _hoisted_2)
|
|
165
|
+
], 40, _hoisted_1);
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
//#endregion
|
|
170
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { MenuEntry, MenuItem } from "../../types.js";
|
|
2
|
+
//#region src/components/context-menu/ContextMenu.vue.d.ts
|
|
3
|
+
declare const __VLS_export: <T extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
5
|
+
/** Menu items in order; `{ separator: true }` draws a line between groups. */
|
|
6
|
+
items?: MenuEntry<T>[];
|
|
7
|
+
/** Accessible name for the menu. Defaults to the `contextMenu` translation. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Leaves the browser's own context menu in place. */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
} & {
|
|
12
|
+
/** Whether the menu is open. */
|
|
13
|
+
open?: boolean;
|
|
14
|
+
}) & {
|
|
15
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
16
|
+
onSelect?: ((value: T) => any) | undefined;
|
|
17
|
+
}> & (typeof globalThis extends {
|
|
18
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
19
|
+
} ? P : {});
|
|
20
|
+
expose: (exposed: {}) => void;
|
|
21
|
+
attrs: any;
|
|
22
|
+
slots: {
|
|
23
|
+
/** The area that opens the menu on right-click, long-press, or Shift+F10. */
|
|
24
|
+
default?(): unknown;
|
|
25
|
+
/** Item content. */
|
|
26
|
+
item?(props: {
|
|
27
|
+
item: MenuItem<T>;
|
|
28
|
+
active: boolean;
|
|
29
|
+
}): unknown;
|
|
30
|
+
};
|
|
31
|
+
emit: ((evt: "select", value: T) => void) & ((event: "update:open", value: boolean) => void);
|
|
32
|
+
}>) => import("vue").VNode & {
|
|
33
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
34
|
+
};
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
37
|
+
//#endregion
|
|
38
|
+
export { _default as default };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { useTranslations } from "../../config.js";
|
|
2
|
+
import _sfc_main$1 from "../button/Button.js";
|
|
3
|
+
import _sfc_main$2 from "./Dialog.js";
|
|
4
|
+
import { createBlock, createSlots, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, renderSlot, toDisplayString, unref, useModel, useSlots, watch, withCtx } from "vue";
|
|
5
|
+
//#region src/components/dialog/ConfirmDialog.vue
|
|
6
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
|
+
__name: "ConfirmDialog",
|
|
8
|
+
props: /*@__PURE__*/ mergeModels({
|
|
9
|
+
title: {},
|
|
10
|
+
description: {},
|
|
11
|
+
confirmText: {},
|
|
12
|
+
cancelText: {},
|
|
13
|
+
danger: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false
|
|
16
|
+
},
|
|
17
|
+
loading: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
keepOpen: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
"open": {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
"openModifiers": {}
|
|
31
|
+
}),
|
|
32
|
+
emits: /*@__PURE__*/ mergeModels(["confirm", "cancel"], ["update:open"]),
|
|
33
|
+
setup(__props, { emit: __emit }) {
|
|
34
|
+
const slots = useSlots();
|
|
35
|
+
/** Whether the dialog is open. */
|
|
36
|
+
const open = useModel(__props, "open");
|
|
37
|
+
const emit = __emit;
|
|
38
|
+
const translations = useTranslations();
|
|
39
|
+
let decided = false;
|
|
40
|
+
function decide(outcome) {
|
|
41
|
+
if (__props.loading) return;
|
|
42
|
+
decided = true;
|
|
43
|
+
if (outcome === "cancel") emit("cancel");
|
|
44
|
+
else emit("confirm");
|
|
45
|
+
if (outcome === "cancel" || !__props.keepOpen) open.value = false;
|
|
46
|
+
}
|
|
47
|
+
watch(() => __props.loading, (isLoading, wasLoading) => {
|
|
48
|
+
if (wasLoading && !isLoading && open.value) decided = false;
|
|
49
|
+
});
|
|
50
|
+
function onClose() {
|
|
51
|
+
if (!decided) emit("cancel");
|
|
52
|
+
decided = false;
|
|
53
|
+
}
|
|
54
|
+
return (_ctx, _cache) => {
|
|
55
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
56
|
+
open: open.value,
|
|
57
|
+
"onUpdate:open": _cache[2] || (_cache[2] = ($event) => open.value = $event),
|
|
58
|
+
role: "alertdialog",
|
|
59
|
+
title: __props.title,
|
|
60
|
+
description: __props.description,
|
|
61
|
+
"close-on-backdrop": false,
|
|
62
|
+
"show-close-button": false,
|
|
63
|
+
dismissible: !__props.loading,
|
|
64
|
+
onClose
|
|
65
|
+
}, {
|
|
66
|
+
footer: withCtx(() => [createVNode(_sfc_main$1, {
|
|
67
|
+
variant: "ghost",
|
|
68
|
+
autofocus: __props.danger,
|
|
69
|
+
disabled: __props.loading,
|
|
70
|
+
onClick: _cache[0] || (_cache[0] = ($event) => decide("cancel"))
|
|
71
|
+
}, {
|
|
72
|
+
default: withCtx(() => [createTextVNode(toDisplayString(__props.cancelText ?? unref(translations).cancel), 1)]),
|
|
73
|
+
_: 1
|
|
74
|
+
}, 8, ["autofocus", "disabled"]), createVNode(_sfc_main$1, {
|
|
75
|
+
variant: __props.danger ? "danger" : "primary",
|
|
76
|
+
autofocus: !__props.danger,
|
|
77
|
+
loading: __props.loading,
|
|
78
|
+
onClick: _cache[1] || (_cache[1] = ($event) => decide("confirm"))
|
|
79
|
+
}, createSlots({
|
|
80
|
+
default: withCtx(() => [createTextVNode(" " + toDisplayString(__props.confirmText ?? unref(translations).confirm), 1)]),
|
|
81
|
+
_: 2
|
|
82
|
+
}, [slots.spinner ? {
|
|
83
|
+
name: "spinner",
|
|
84
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "spinner")]),
|
|
85
|
+
key: "0"
|
|
86
|
+
} : void 0]), 1032, [
|
|
87
|
+
"variant",
|
|
88
|
+
"autofocus",
|
|
89
|
+
"loading"
|
|
90
|
+
])]),
|
|
91
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
92
|
+
_: 3
|
|
93
|
+
}, 8, [
|
|
94
|
+
"open",
|
|
95
|
+
"title",
|
|
96
|
+
"description",
|
|
97
|
+
"dismissible"
|
|
98
|
+
]);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
//#endregion
|
|
103
|
+
export { _sfc_main as default };
|