@deck9/ui 0.9.18 → 0.10.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/dist/{src/Button → Button}/Button.vue.d.ts +0 -0
- package/dist/{src/Button → Button}/index.d.ts +0 -0
- package/dist/{src/Checkbox → Checkbox}/Checkbox.vue.d.ts +0 -0
- package/dist/{src/Checkbox → Checkbox}/index.d.ts +0 -0
- package/dist/{src/Icon → Icon}/Icon.vue.d.ts +0 -0
- package/dist/{src/Icon → Icon}/index.d.ts +0 -0
- package/dist/{src/Icon → Icon}/registerIcons.d.ts +0 -0
- package/dist/{src/Input → Input}/Input.vue.d.ts +0 -0
- package/dist/{src/Input → Input}/index.d.ts +0 -0
- package/dist/{src/Label → Label}/Label.vue.d.ts +0 -0
- package/dist/{src/Label → Label}/index.d.ts +0 -0
- package/dist/{src/Menu → Menu}/MenuContainer.vue.d.ts +41 -28
- package/dist/{src/Menu → Menu}/MenuLink.vue.d.ts +11 -5
- package/dist/{src/Menu → Menu}/index.d.ts +0 -0
- package/dist/{src/Select → Select}/Select.vue.d.ts +0 -0
- package/dist/{src/Select → Select}/index.d.ts +0 -0
- package/dist/{src/Skeleton → Skeleton}/Skeleton.vue.d.ts +0 -0
- package/dist/{src/Skeleton → Skeleton}/index.d.ts +0 -0
- package/dist/{src/Spinner → Spinner}/Spinner.vue.d.ts +0 -0
- package/dist/{src/Spinner → Spinner}/index.d.ts +0 -0
- package/dist/{src/Switch → Switch}/Switch.vue.d.ts +32 -15
- package/dist/{src/Switch → Switch}/index.d.ts +0 -0
- package/dist/{src/Textarea → Textarea}/Textarea.vue.d.ts +0 -0
- package/dist/{src/Textarea → Textarea}/index.d.ts +0 -0
- package/dist/{src/env.d.ts → env.d.ts} +0 -0
- package/dist/{src/index.d.ts → index.d.ts} +0 -0
- package/dist/src/index.es.js +829 -2115
- package/dist/src/index.umd.js +6 -7
- package/dist/{src/types.d.ts → types.d.ts} +0 -0
- package/dist/{src/utils → utils}/useFormClasses.d.ts +0 -0
- package/dist/{src/utils → utils}/usePopper.d.ts +0 -0
- package/package.json +37 -37
package/dist/src/index.es.js
CHANGED
|
@@ -5,24 +5,36 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
7
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (
|
|
9
|
-
for (var prop in
|
|
10
|
-
if (__hasOwnProp.call(
|
|
11
|
-
__defNormalProp(
|
|
8
|
+
var __spreadValues = (a2, b2) => {
|
|
9
|
+
for (var prop in b2 || (b2 = {}))
|
|
10
|
+
if (__hasOwnProp.call(b2, prop))
|
|
11
|
+
__defNormalProp(a2, prop, b2[prop]);
|
|
12
12
|
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(
|
|
14
|
-
if (__propIsEnum.call(
|
|
15
|
-
__defNormalProp(
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b2)) {
|
|
14
|
+
if (__propIsEnum.call(b2, prop))
|
|
15
|
+
__defNormalProp(a2, prop, b2[prop]);
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return a2;
|
|
18
18
|
};
|
|
19
|
-
var __spreadProps = (
|
|
20
|
-
|
|
19
|
+
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import { defineComponent, computed as computed$2, unref, openBlock, createBlock, mergeProps, createCommentVNode, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createVNode, ref, cloneVNode, h as h$2, inject, provide, onMounted, watchEffect, onUnmounted, Fragment, watch, nextTick, toRaw as toRaw$1, withCtx, renderSlot, Teleport, Transition, normalizeProps, guardReactiveProps, isRef, renderList, createTextVNode } from "vue";
|
|
21
33
|
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
22
34
|
import { library } from "@fortawesome/fontawesome-svg-core";
|
|
23
35
|
import * as fasIcons from "@fortawesome/free-solid-svg-icons";
|
|
24
36
|
/*!
|
|
25
|
-
* Font Awesome Free 6.
|
|
37
|
+
* Font Awesome Free 6.1.1 by @fontawesome - https://fontawesome.com
|
|
26
38
|
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
|
27
39
|
* Copyright 2022 Fonticons, Inc.
|
|
28
40
|
*/
|
|
@@ -51,10 +63,11 @@ var faTwitter = {
|
|
|
51
63
|
iconName: "twitter",
|
|
52
64
|
icon: [512, 512, [], "f099", "M459.4 151.7c.325 4.548 .325 9.097 .325 13.65 0 138.7-105.6 298.6-298.6 298.6-59.45 0-114.7-17.22-161.1-47.11 8.447 .974 16.57 1.299 25.34 1.299 49.06 0 94.21-16.57 130.3-44.83-46.13-.975-84.79-31.19-98.11-72.77 6.498 .974 12.99 1.624 19.82 1.624 9.421 0 18.84-1.3 27.61-3.573-48.08-9.747-84.14-51.98-84.14-102.1v-1.299c13.97 7.797 30.21 12.67 47.43 13.32-28.26-18.84-46.78-51.01-46.78-87.39 0-19.49 5.197-37.36 14.29-52.95 51.65 63.67 129.3 105.3 216.4 109.8-1.624-7.797-2.599-15.92-2.599-24.04 0-57.83 46.78-104.9 104.9-104.9 30.21 0 57.5 12.67 76.67 33.14 23.72-4.548 46.46-13.32 66.6-25.34-7.798 24.37-24.37 44.83-46.13 57.83 21.12-2.273 41.58-8.122 60.43-16.24-14.29 20.79-32.16 39.31-52.63 54.25z"]
|
|
53
65
|
};
|
|
54
|
-
library.add(fasIcons.faAt, fasIcons.faBold, fasIcons.faCalendar, fasIcons.faChartPie, fasIcons.faCheck, fasIcons.faCheckCircle, fasIcons.faChevronDown, fasIcons.faChevronLeft, fasIcons.faChevronRight, fasIcons.faChevronUp, fasIcons.faCircleCheck, fasIcons.faCircleNotch, fasIcons.faClipboard, fasIcons.faCog, fasIcons.faDoorOpen, fasIcons.faDotCircle, fasIcons.faEllipsis, fasIcons.faEllipsisVertical, fasIcons.faEnvelope, fasIcons.faExclamationTriangle, fasIcons.faEyeDropper, fasIcons.faFileLines, fasIcons.faFileUpload, fasIcons.faFingerprint, fasIcons.faGlobe, fasIcons.faGripHorizontal, fasIcons.faGripVertical, fasIcons.faHandPointRight, fasIcons.faHashtag, fasIcons.faInfoCircle, fasIcons.faItalic, fasIcons.faLink, fasIcons.faMedal, fasIcons.faPencilAlt, fasIcons.faPenToSquare, fasIcons.faPhone, fasIcons.faPlayCircle, fasIcons.faPlus, fasIcons.faPlusCircle, fasIcons.faReply, fasIcons.faReplyAll, fasIcons.faRobot, fasIcons.faSave, fasIcons.faShield, fasIcons.faSignature, fasIcons.faSquareCheck, fasIcons.faStar, fasIcons.faTimes, fasIcons.faTrash, fasIcons.faTrophy, fasIcons.faTurnDown, fasIcons.faUpload, fasIcons.faUser, fasIcons.faUserShield, faTwitter, faInstagram, faGithub, faLinkedin, faFacebook);
|
|
66
|
+
library.add(fasIcons.faAt, fasIcons.faBold, fasIcons.faCalendar, fasIcons.faChartPie, fasIcons.faCheck, fasIcons.faCheckCircle, fasIcons.faChevronDown, fasIcons.faChevronLeft, fasIcons.faChevronRight, fasIcons.faChevronUp, fasIcons.faCircleCheck, fasIcons.faCircleNotch, fasIcons.faClipboard, fasIcons.faCloudDownload, fasIcons.faCloudUpload, fasIcons.faCog, fasIcons.faDoorOpen, fasIcons.faDotCircle, fasIcons.faEllipsis, fasIcons.faEllipsisVertical, fasIcons.faEnvelope, fasIcons.faExclamationTriangle, fasIcons.faExternalLink, fasIcons.faEyeDropper, fasIcons.faFileLines, fasIcons.faFileUpload, fasIcons.faFingerprint, fasIcons.faGlobe, fasIcons.faGripHorizontal, fasIcons.faGripVertical, fasIcons.faHandPointRight, fasIcons.faHashtag, fasIcons.faInfoCircle, fasIcons.faItalic, fasIcons.faLink, fasIcons.faMedal, fasIcons.faMessage, fasIcons.faPencilAlt, fasIcons.faPenToSquare, fasIcons.faPhone, fasIcons.faPlayCircle, fasIcons.faPlus, fasIcons.faPlusCircle, fasIcons.faReply, fasIcons.faReplyAll, fasIcons.faRobot, fasIcons.faSave, fasIcons.faShield, fasIcons.faSignature, fasIcons.faSquareCheck, fasIcons.faStar, fasIcons.faTimes, fasIcons.faTrash, fasIcons.faTrophy, fasIcons.faTurnDown, fasIcons.faUpload, fasIcons.faUser, fasIcons.faUserShield, faTwitter, faInstagram, faGithub, faLinkedin, faFacebook);
|
|
55
67
|
var icons = [...Object.keys(library.definitions.fas)].sort();
|
|
56
68
|
const brands = [...Object.keys(library.definitions.fab)].sort();
|
|
57
69
|
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
70
|
+
__name: "Icon",
|
|
58
71
|
props: {
|
|
59
72
|
name: { default: "user" }
|
|
60
73
|
},
|
|
@@ -75,9 +88,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
75
88
|
}
|
|
76
89
|
});
|
|
77
90
|
return (_ctx, _cache) => {
|
|
78
|
-
return unref
|
|
91
|
+
return unref(isIconAvailable) ? (openBlock(), createBlock(unref(FontAwesomeIcon), mergeProps({
|
|
79
92
|
key: 0,
|
|
80
|
-
icon: [unref
|
|
93
|
+
icon: [unref(iconBag), __props.name]
|
|
81
94
|
}, _ctx.$attrs), null, 16, ["icon"])) : createCommentVNode("", true);
|
|
82
95
|
};
|
|
83
96
|
}
|
|
@@ -88,6 +101,7 @@ const _hoisted_2$6 = {
|
|
|
88
101
|
class: "absolute inset-0 flex items-center justify-center"
|
|
89
102
|
};
|
|
90
103
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
104
|
+
__name: "Button",
|
|
91
105
|
props: {
|
|
92
106
|
label: null,
|
|
93
107
|
size: { default: "medium" },
|
|
@@ -140,7 +154,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
140
154
|
}
|
|
141
155
|
return (_ctx, _cache) => {
|
|
142
156
|
return openBlock(), createElementBlock("button", {
|
|
143
|
-
class: normalizeClass(["relative inline-flex items-center focus:outline-none focus:ring active:ring transition duration-150 ease-in-out", unref
|
|
157
|
+
class: normalizeClass(["relative inline-flex items-center focus:outline-none focus:ring active:ring transition duration-150 ease-in-out", unref(buttonClasses)]),
|
|
144
158
|
type: "button",
|
|
145
159
|
"aria-label": __props.label,
|
|
146
160
|
tabindex: __props.isDisabled ? "-1" : void 0,
|
|
@@ -152,13 +166,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
152
166
|
__props.icon && __props.iconPosition === "left" ? (openBlock(), createBlock(_sfc_main$b, {
|
|
153
167
|
key: 0,
|
|
154
168
|
name: __props.icon,
|
|
155
|
-
class: normalizeClass(unref
|
|
169
|
+
class: normalizeClass(unref(iconClasses))
|
|
156
170
|
}, null, 8, ["name", "class"])) : createCommentVNode("", true),
|
|
157
171
|
createElementVNode("span", null, toDisplayString(__props.label), 1),
|
|
158
172
|
__props.icon && __props.iconPosition === "right" ? (openBlock(), createBlock(_sfc_main$b, {
|
|
159
173
|
key: 1,
|
|
160
174
|
name: __props.icon,
|
|
161
|
-
class: normalizeClass(unref
|
|
175
|
+
class: normalizeClass(unref(iconClasses))
|
|
162
176
|
}, null, 8, ["name", "class"])) : createCommentVNode("", true)
|
|
163
177
|
], 2),
|
|
164
178
|
__props.isLoading ? (openBlock(), createElementBlock("span", _hoisted_2$6, [
|
|
@@ -187,8 +201,8 @@ function validate(uuid) {
|
|
|
187
201
|
return typeof uuid === "string" && REGEX.test(uuid);
|
|
188
202
|
}
|
|
189
203
|
var byteToHex = [];
|
|
190
|
-
for (var i = 0; i < 256; ++i) {
|
|
191
|
-
byteToHex.push((i + 256).toString(16).substr(1));
|
|
204
|
+
for (var i$1 = 0; i$1 < 256; ++i$1) {
|
|
205
|
+
byteToHex.push((i$1 + 256).toString(16).substr(1));
|
|
192
206
|
}
|
|
193
207
|
function stringify(arr) {
|
|
194
208
|
var offset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
@@ -205,8 +219,8 @@ function v4(options, buf, offset) {
|
|
|
205
219
|
rnds[8] = rnds[8] & 63 | 128;
|
|
206
220
|
if (buf) {
|
|
207
221
|
offset = offset || 0;
|
|
208
|
-
for (var
|
|
209
|
-
buf[offset +
|
|
222
|
+
for (var i2 = 0; i2 < 16; ++i2) {
|
|
223
|
+
buf[offset + i2] = rnds[i2];
|
|
210
224
|
}
|
|
211
225
|
return buf;
|
|
212
226
|
}
|
|
@@ -222,6 +236,7 @@ const _hoisted_6$1 = {
|
|
|
222
236
|
class: "block text-xs text-grey-400 font-normal mono-0 casual-60"
|
|
223
237
|
};
|
|
224
238
|
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
239
|
+
__name: "Checkbox",
|
|
225
240
|
props: {
|
|
226
241
|
id: { default: v4() },
|
|
227
242
|
label: null,
|
|
@@ -255,37 +270,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
255
270
|
};
|
|
256
271
|
}
|
|
257
272
|
});
|
|
258
|
-
const EMPTY_OBJ = {};
|
|
259
273
|
const NOOP = () => {
|
|
260
274
|
};
|
|
261
|
-
const
|
|
262
|
-
const remove = (arr, el) => {
|
|
263
|
-
const i = arr.indexOf(el);
|
|
264
|
-
if (i > -1) {
|
|
265
|
-
arr.splice(i, 1);
|
|
266
|
-
}
|
|
267
|
-
};
|
|
275
|
+
const NO = () => false;
|
|
268
276
|
const isArray = Array.isArray;
|
|
269
|
-
const isMap = (val) => toTypeString(val) === "[object Map]";
|
|
270
|
-
const isSet = (val) => toTypeString(val) === "[object Set]";
|
|
271
277
|
const isFunction = (val) => typeof val === "function";
|
|
272
|
-
const isString = (val) => typeof val === "string";
|
|
273
|
-
const isSymbol = (val) => typeof val === "symbol";
|
|
274
|
-
const isObject = (val) => val !== null && typeof val === "object";
|
|
275
|
-
const isPromise = (val) => {
|
|
276
|
-
return isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
277
|
-
};
|
|
278
|
-
const objectToString = Object.prototype.toString;
|
|
279
|
-
const toTypeString = (value) => objectToString.call(value);
|
|
280
|
-
const isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
281
|
-
const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
282
|
-
const def = (obj, key, value) => {
|
|
283
|
-
Object.defineProperty(obj, key, {
|
|
284
|
-
configurable: true,
|
|
285
|
-
enumerable: false,
|
|
286
|
-
value
|
|
287
|
-
});
|
|
288
|
-
};
|
|
289
278
|
let activeEffectScope;
|
|
290
279
|
function recordEffectScope(effect2, scope = activeEffectScope) {
|
|
291
280
|
if (scope && scope.active) {
|
|
@@ -302,8 +291,8 @@ const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
|
|
|
302
291
|
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
|
|
303
292
|
const initDepMarkers = ({ deps }) => {
|
|
304
293
|
if (deps.length) {
|
|
305
|
-
for (let
|
|
306
|
-
deps[
|
|
294
|
+
for (let i2 = 0; i2 < deps.length; i2++) {
|
|
295
|
+
deps[i2].w |= trackOpBit;
|
|
307
296
|
}
|
|
308
297
|
}
|
|
309
298
|
};
|
|
@@ -311,8 +300,8 @@ const finalizeDepMarkers = (effect2) => {
|
|
|
311
300
|
const { deps } = effect2;
|
|
312
301
|
if (deps.length) {
|
|
313
302
|
let ptr = 0;
|
|
314
|
-
for (let
|
|
315
|
-
const dep = deps[
|
|
303
|
+
for (let i2 = 0; i2 < deps.length; i2++) {
|
|
304
|
+
const dep = deps[i2];
|
|
316
305
|
if (wasTracked(dep) && !newTracked(dep)) {
|
|
317
306
|
dep.delete(effect2);
|
|
318
307
|
} else {
|
|
@@ -368,10 +357,15 @@ class ReactiveEffect {
|
|
|
368
357
|
activeEffect = this.parent;
|
|
369
358
|
shouldTrack = lastShouldTrack;
|
|
370
359
|
this.parent = void 0;
|
|
360
|
+
if (this.deferStop) {
|
|
361
|
+
this.stop();
|
|
362
|
+
}
|
|
371
363
|
}
|
|
372
364
|
}
|
|
373
365
|
stop() {
|
|
374
|
-
if (this
|
|
366
|
+
if (activeEffect === this) {
|
|
367
|
+
this.deferStop = true;
|
|
368
|
+
} else if (this.active) {
|
|
375
369
|
cleanupEffect(this);
|
|
376
370
|
if (this.onStop) {
|
|
377
371
|
this.onStop();
|
|
@@ -383,8 +377,8 @@ class ReactiveEffect {
|
|
|
383
377
|
function cleanupEffect(effect2) {
|
|
384
378
|
const { deps } = effect2;
|
|
385
379
|
if (deps.length) {
|
|
386
|
-
for (let
|
|
387
|
-
deps[
|
|
380
|
+
for (let i2 = 0; i2 < deps.length; i2++) {
|
|
381
|
+
deps[i2].delete(effect2);
|
|
388
382
|
}
|
|
389
383
|
deps.length = 0;
|
|
390
384
|
}
|
|
@@ -406,37 +400,31 @@ function trackEffects(dep, debuggerEventExtraInfo) {
|
|
|
406
400
|
}
|
|
407
401
|
}
|
|
408
402
|
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
} else {
|
|
414
|
-
effect2.run();
|
|
415
|
-
}
|
|
403
|
+
const effects = isArray(dep) ? dep : [...dep];
|
|
404
|
+
for (const effect2 of effects) {
|
|
405
|
+
if (effect2.computed) {
|
|
406
|
+
triggerEffect(effect2);
|
|
416
407
|
}
|
|
417
408
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
return isReactive(value["__v_raw"]);
|
|
409
|
+
for (const effect2 of effects) {
|
|
410
|
+
if (!effect2.computed) {
|
|
411
|
+
triggerEffect(effect2);
|
|
412
|
+
}
|
|
423
413
|
}
|
|
424
|
-
return !!(value && value["__v_isReactive"]);
|
|
425
414
|
}
|
|
426
|
-
function
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
415
|
+
function triggerEffect(effect2, debuggerEventExtraInfo) {
|
|
416
|
+
if (effect2 !== activeEffect || effect2.allowRecurse) {
|
|
417
|
+
if (effect2.scheduler) {
|
|
418
|
+
effect2.scheduler();
|
|
419
|
+
} else {
|
|
420
|
+
effect2.run();
|
|
421
|
+
}
|
|
422
|
+
}
|
|
431
423
|
}
|
|
432
424
|
function toRaw(observed) {
|
|
433
425
|
const raw = observed && observed["__v_raw"];
|
|
434
426
|
return raw ? toRaw(raw) : observed;
|
|
435
427
|
}
|
|
436
|
-
function markRaw(value) {
|
|
437
|
-
def(value, "__v_skip", true);
|
|
438
|
-
return value;
|
|
439
|
-
}
|
|
440
428
|
function trackRefValue(ref2) {
|
|
441
429
|
if (shouldTrack && activeEffect) {
|
|
442
430
|
ref2 = toRaw(ref2);
|
|
@@ -453,29 +441,8 @@ function triggerRefValue(ref2, newVal) {
|
|
|
453
441
|
}
|
|
454
442
|
}
|
|
455
443
|
}
|
|
456
|
-
function isRef(r) {
|
|
457
|
-
return !!(r && r.__v_isRef === true);
|
|
458
|
-
}
|
|
459
|
-
function unref(ref2) {
|
|
460
|
-
return isRef(ref2) ? ref2.value : ref2;
|
|
461
|
-
}
|
|
462
|
-
const shallowUnwrapHandlers = {
|
|
463
|
-
get: (target, key, receiver) => unref(Reflect.get(target, key, receiver)),
|
|
464
|
-
set: (target, key, value, receiver) => {
|
|
465
|
-
const oldValue = target[key];
|
|
466
|
-
if (isRef(oldValue) && !isRef(value)) {
|
|
467
|
-
oldValue.value = value;
|
|
468
|
-
return true;
|
|
469
|
-
} else {
|
|
470
|
-
return Reflect.set(target, key, value, receiver);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
function proxyRefs(objectWithRefs) {
|
|
475
|
-
return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
476
|
-
}
|
|
477
444
|
class ComputedRefImpl {
|
|
478
|
-
constructor(getter, _setter,
|
|
445
|
+
constructor(getter, _setter, isReadonly, isSSR) {
|
|
479
446
|
this._setter = _setter;
|
|
480
447
|
this.dep = void 0;
|
|
481
448
|
this.__v_isRef = true;
|
|
@@ -488,7 +455,7 @@ class ComputedRefImpl {
|
|
|
488
455
|
});
|
|
489
456
|
this.effect.computed = this;
|
|
490
457
|
this.effect.active = this._cacheable = !isSSR;
|
|
491
|
-
this["__v_isReadonly"] =
|
|
458
|
+
this["__v_isReadonly"] = isReadonly;
|
|
492
459
|
}
|
|
493
460
|
get value() {
|
|
494
461
|
const self = toRaw(this);
|
|
@@ -517,511 +484,29 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
|
517
484
|
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
518
485
|
return cRef;
|
|
519
486
|
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
const values = [];
|
|
541
|
-
for (let i = 0; i < fn2.length; i++) {
|
|
542
|
-
values.push(callWithAsyncErrorHandling(fn2[i], instance, type, args));
|
|
543
|
-
}
|
|
544
|
-
return values;
|
|
545
|
-
}
|
|
546
|
-
function handleError(err, instance, type, throwInDev = true) {
|
|
547
|
-
const contextVNode = instance ? instance.vnode : null;
|
|
548
|
-
if (instance) {
|
|
549
|
-
let cur = instance.parent;
|
|
550
|
-
const exposedInstance = instance.proxy;
|
|
551
|
-
const errorInfo = type;
|
|
552
|
-
while (cur) {
|
|
553
|
-
const errorCapturedHooks = cur.ec;
|
|
554
|
-
if (errorCapturedHooks) {
|
|
555
|
-
for (let i = 0; i < errorCapturedHooks.length; i++) {
|
|
556
|
-
if (errorCapturedHooks[i](err, exposedInstance, errorInfo) === false) {
|
|
557
|
-
return;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
cur = cur.parent;
|
|
562
|
-
}
|
|
563
|
-
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
564
|
-
if (appErrorHandler) {
|
|
565
|
-
callWithErrorHandling(appErrorHandler, null, 10, [err, exposedInstance, errorInfo]);
|
|
566
|
-
return;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
logError(err, type, contextVNode, throwInDev);
|
|
570
|
-
}
|
|
571
|
-
function logError(err, type, contextVNode, throwInDev = true) {
|
|
572
|
-
{
|
|
573
|
-
console.error(err);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
let isFlushing = false;
|
|
577
|
-
let isFlushPending = false;
|
|
578
|
-
const queue = [];
|
|
579
|
-
let flushIndex = 0;
|
|
580
|
-
const pendingPreFlushCbs = [];
|
|
581
|
-
let activePreFlushCbs = null;
|
|
582
|
-
let preFlushIndex = 0;
|
|
583
|
-
const pendingPostFlushCbs = [];
|
|
584
|
-
let activePostFlushCbs = null;
|
|
585
|
-
let postFlushIndex = 0;
|
|
586
|
-
const resolvedPromise = Promise.resolve();
|
|
587
|
-
let currentFlushPromise = null;
|
|
588
|
-
let currentPreFlushParentJob = null;
|
|
589
|
-
function nextTick(fn2) {
|
|
590
|
-
const p = currentFlushPromise || resolvedPromise;
|
|
591
|
-
return fn2 ? p.then(this ? fn2.bind(this) : fn2) : p;
|
|
592
|
-
}
|
|
593
|
-
function findInsertionIndex(id2) {
|
|
594
|
-
let start2 = flushIndex + 1;
|
|
595
|
-
let end2 = queue.length;
|
|
596
|
-
while (start2 < end2) {
|
|
597
|
-
const middle = start2 + end2 >>> 1;
|
|
598
|
-
const middleJobId = getId(queue[middle]);
|
|
599
|
-
middleJobId < id2 ? start2 = middle + 1 : end2 = middle;
|
|
600
|
-
}
|
|
601
|
-
return start2;
|
|
602
|
-
}
|
|
603
|
-
function queueJob(job) {
|
|
604
|
-
if ((!queue.length || !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) && job !== currentPreFlushParentJob) {
|
|
605
|
-
if (job.id == null) {
|
|
606
|
-
queue.push(job);
|
|
607
|
-
} else {
|
|
608
|
-
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
609
|
-
}
|
|
610
|
-
queueFlush();
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
function queueFlush() {
|
|
614
|
-
if (!isFlushing && !isFlushPending) {
|
|
615
|
-
isFlushPending = true;
|
|
616
|
-
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
function queueCb(cb, activeQueue, pendingQueue, index) {
|
|
620
|
-
if (!isArray(cb)) {
|
|
621
|
-
if (!activeQueue || !activeQueue.includes(cb, cb.allowRecurse ? index + 1 : index)) {
|
|
622
|
-
pendingQueue.push(cb);
|
|
623
|
-
}
|
|
624
|
-
} else {
|
|
625
|
-
pendingQueue.push(...cb);
|
|
626
|
-
}
|
|
627
|
-
queueFlush();
|
|
628
|
-
}
|
|
629
|
-
function queuePreFlushCb(cb) {
|
|
630
|
-
queueCb(cb, activePreFlushCbs, pendingPreFlushCbs, preFlushIndex);
|
|
631
|
-
}
|
|
632
|
-
function queuePostFlushCb(cb) {
|
|
633
|
-
queueCb(cb, activePostFlushCbs, pendingPostFlushCbs, postFlushIndex);
|
|
634
|
-
}
|
|
635
|
-
function flushPreFlushCbs(seen, parentJob = null) {
|
|
636
|
-
if (pendingPreFlushCbs.length) {
|
|
637
|
-
currentPreFlushParentJob = parentJob;
|
|
638
|
-
activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
|
|
639
|
-
pendingPreFlushCbs.length = 0;
|
|
640
|
-
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
|
641
|
-
activePreFlushCbs[preFlushIndex]();
|
|
642
|
-
}
|
|
643
|
-
activePreFlushCbs = null;
|
|
644
|
-
preFlushIndex = 0;
|
|
645
|
-
currentPreFlushParentJob = null;
|
|
646
|
-
flushPreFlushCbs(seen, parentJob);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
function flushPostFlushCbs(seen) {
|
|
650
|
-
if (pendingPostFlushCbs.length) {
|
|
651
|
-
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
652
|
-
pendingPostFlushCbs.length = 0;
|
|
653
|
-
if (activePostFlushCbs) {
|
|
654
|
-
activePostFlushCbs.push(...deduped);
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
activePostFlushCbs = deduped;
|
|
658
|
-
activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
|
|
659
|
-
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
660
|
-
activePostFlushCbs[postFlushIndex]();
|
|
661
|
-
}
|
|
662
|
-
activePostFlushCbs = null;
|
|
663
|
-
postFlushIndex = 0;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
667
|
-
function flushJobs(seen) {
|
|
668
|
-
isFlushPending = false;
|
|
669
|
-
isFlushing = true;
|
|
670
|
-
flushPreFlushCbs(seen);
|
|
671
|
-
queue.sort((a, b) => getId(a) - getId(b));
|
|
672
|
-
const check = NOOP;
|
|
673
|
-
try {
|
|
674
|
-
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
675
|
-
const job = queue[flushIndex];
|
|
676
|
-
if (job && job.active !== false) {
|
|
677
|
-
if (false)
|
|
678
|
-
;
|
|
679
|
-
callWithErrorHandling(job, null, 14);
|
|
680
|
-
}
|
|
681
|
-
}
|
|
682
|
-
} finally {
|
|
683
|
-
flushIndex = 0;
|
|
684
|
-
queue.length = 0;
|
|
685
|
-
flushPostFlushCbs();
|
|
686
|
-
isFlushing = false;
|
|
687
|
-
currentFlushPromise = null;
|
|
688
|
-
if (queue.length || pendingPreFlushCbs.length || pendingPostFlushCbs.length) {
|
|
689
|
-
flushJobs(seen);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
function queueEffectWithSuspense(fn2, suspense) {
|
|
694
|
-
if (suspense && suspense.pendingBranch) {
|
|
695
|
-
if (isArray(fn2)) {
|
|
696
|
-
suspense.effects.push(...fn2);
|
|
697
|
-
} else {
|
|
698
|
-
suspense.effects.push(fn2);
|
|
699
|
-
}
|
|
700
|
-
} else {
|
|
701
|
-
queuePostFlushCb(fn2);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
const INITIAL_WATCHER_VALUE = {};
|
|
705
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
706
|
-
const instance = currentInstance;
|
|
707
|
-
let getter;
|
|
708
|
-
let forceTrigger = false;
|
|
709
|
-
let isMultiSource = false;
|
|
710
|
-
if (isRef(source)) {
|
|
711
|
-
getter = () => source.value;
|
|
712
|
-
forceTrigger = isShallow(source);
|
|
713
|
-
} else if (isReactive(source)) {
|
|
714
|
-
getter = () => source;
|
|
715
|
-
deep = true;
|
|
716
|
-
} else if (isArray(source)) {
|
|
717
|
-
isMultiSource = true;
|
|
718
|
-
forceTrigger = source.some(isReactive);
|
|
719
|
-
getter = () => source.map((s) => {
|
|
720
|
-
if (isRef(s)) {
|
|
721
|
-
return s.value;
|
|
722
|
-
} else if (isReactive(s)) {
|
|
723
|
-
return traverse(s);
|
|
724
|
-
} else if (isFunction(s)) {
|
|
725
|
-
return callWithErrorHandling(s, instance, 2);
|
|
726
|
-
} else
|
|
727
|
-
;
|
|
728
|
-
});
|
|
729
|
-
} else if (isFunction(source)) {
|
|
730
|
-
if (cb) {
|
|
731
|
-
getter = () => callWithErrorHandling(source, instance, 2);
|
|
732
|
-
} else {
|
|
733
|
-
getter = () => {
|
|
734
|
-
if (instance && instance.isUnmounted) {
|
|
735
|
-
return;
|
|
736
|
-
}
|
|
737
|
-
if (cleanup) {
|
|
738
|
-
cleanup();
|
|
739
|
-
}
|
|
740
|
-
return callWithAsyncErrorHandling(source, instance, 3, [onCleanup]);
|
|
741
|
-
};
|
|
742
|
-
}
|
|
743
|
-
} else {
|
|
744
|
-
getter = NOOP;
|
|
745
|
-
}
|
|
746
|
-
if (cb && deep) {
|
|
747
|
-
const baseGetter = getter;
|
|
748
|
-
getter = () => traverse(baseGetter());
|
|
749
|
-
}
|
|
750
|
-
let cleanup;
|
|
751
|
-
let onCleanup = (fn2) => {
|
|
752
|
-
cleanup = effect2.onStop = () => {
|
|
753
|
-
callWithErrorHandling(fn2, instance, 4);
|
|
754
|
-
};
|
|
755
|
-
};
|
|
756
|
-
let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
|
757
|
-
const job = () => {
|
|
758
|
-
if (!effect2.active) {
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
if (cb) {
|
|
762
|
-
const newValue = effect2.run();
|
|
763
|
-
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue)) || false) {
|
|
764
|
-
if (cleanup) {
|
|
765
|
-
cleanup();
|
|
766
|
-
}
|
|
767
|
-
callWithAsyncErrorHandling(cb, instance, 3, [
|
|
768
|
-
newValue,
|
|
769
|
-
oldValue === INITIAL_WATCHER_VALUE ? void 0 : oldValue,
|
|
770
|
-
onCleanup
|
|
771
|
-
]);
|
|
772
|
-
oldValue = newValue;
|
|
773
|
-
}
|
|
774
|
-
} else {
|
|
775
|
-
effect2.run();
|
|
776
|
-
}
|
|
777
|
-
};
|
|
778
|
-
job.allowRecurse = !!cb;
|
|
779
|
-
let scheduler;
|
|
780
|
-
if (flush === "sync") {
|
|
781
|
-
scheduler = job;
|
|
782
|
-
} else if (flush === "post") {
|
|
783
|
-
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
784
|
-
} else {
|
|
785
|
-
scheduler = () => {
|
|
786
|
-
if (!instance || instance.isMounted) {
|
|
787
|
-
queuePreFlushCb(job);
|
|
788
|
-
} else {
|
|
789
|
-
job();
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
const effect2 = new ReactiveEffect(getter, scheduler);
|
|
794
|
-
if (cb) {
|
|
795
|
-
if (immediate) {
|
|
796
|
-
job();
|
|
797
|
-
} else {
|
|
798
|
-
oldValue = effect2.run();
|
|
799
|
-
}
|
|
800
|
-
} else if (flush === "post") {
|
|
801
|
-
queuePostRenderEffect(effect2.run.bind(effect2), instance && instance.suspense);
|
|
802
|
-
} else {
|
|
803
|
-
effect2.run();
|
|
804
|
-
}
|
|
805
|
-
return () => {
|
|
806
|
-
effect2.stop();
|
|
807
|
-
if (instance && instance.scope) {
|
|
808
|
-
remove(instance.scope.effects, effect2);
|
|
809
|
-
}
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
function instanceWatch(source, value, options) {
|
|
813
|
-
const publicThis = this.proxy;
|
|
814
|
-
const getter = isString(source) ? source.includes(".") ? createPathGetter(publicThis, source) : () => publicThis[source] : source.bind(publicThis, publicThis);
|
|
815
|
-
let cb;
|
|
816
|
-
if (isFunction(value)) {
|
|
817
|
-
cb = value;
|
|
818
|
-
} else {
|
|
819
|
-
cb = value.handler;
|
|
820
|
-
options = value;
|
|
821
|
-
}
|
|
822
|
-
const cur = currentInstance;
|
|
823
|
-
setCurrentInstance(this);
|
|
824
|
-
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
825
|
-
if (cur) {
|
|
826
|
-
setCurrentInstance(cur);
|
|
827
|
-
} else {
|
|
828
|
-
unsetCurrentInstance();
|
|
829
|
-
}
|
|
830
|
-
return res;
|
|
831
|
-
}
|
|
832
|
-
function createPathGetter(ctx, path) {
|
|
833
|
-
const segments = path.split(".");
|
|
834
|
-
return () => {
|
|
835
|
-
let cur = ctx;
|
|
836
|
-
for (let i = 0; i < segments.length && cur; i++) {
|
|
837
|
-
cur = cur[segments[i]];
|
|
838
|
-
}
|
|
839
|
-
return cur;
|
|
840
|
-
};
|
|
841
|
-
}
|
|
842
|
-
function traverse(value, seen) {
|
|
843
|
-
if (!isObject(value) || value["__v_skip"]) {
|
|
844
|
-
return value;
|
|
845
|
-
}
|
|
846
|
-
seen = seen || /* @__PURE__ */ new Set();
|
|
847
|
-
if (seen.has(value)) {
|
|
848
|
-
return value;
|
|
849
|
-
}
|
|
850
|
-
seen.add(value);
|
|
851
|
-
if (isRef(value)) {
|
|
852
|
-
traverse(value.value, seen);
|
|
853
|
-
} else if (isArray(value)) {
|
|
854
|
-
for (let i = 0; i < value.length; i++) {
|
|
855
|
-
traverse(value[i], seen);
|
|
856
|
-
}
|
|
857
|
-
} else if (isSet(value) || isMap(value)) {
|
|
858
|
-
value.forEach((v) => {
|
|
859
|
-
traverse(v, seen);
|
|
860
|
-
});
|
|
861
|
-
} else if (isPlainObject(value)) {
|
|
862
|
-
for (const key in value) {
|
|
863
|
-
traverse(value[key], seen);
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
return value;
|
|
867
|
-
}
|
|
868
|
-
function resolveMergedOptions(instance) {
|
|
869
|
-
const base = instance.type;
|
|
870
|
-
const { mixins, extends: extendsOptions } = base;
|
|
871
|
-
const { mixins: globalMixins, optionsCache: cache, config: { optionMergeStrategies } } = instance.appContext;
|
|
872
|
-
const cached = cache.get(base);
|
|
873
|
-
let resolved;
|
|
874
|
-
if (cached) {
|
|
875
|
-
resolved = cached;
|
|
876
|
-
} else if (!globalMixins.length && !mixins && !extendsOptions) {
|
|
877
|
-
{
|
|
878
|
-
resolved = base;
|
|
879
|
-
}
|
|
880
|
-
} else {
|
|
881
|
-
resolved = {};
|
|
882
|
-
if (globalMixins.length) {
|
|
883
|
-
globalMixins.forEach((m) => mergeOptions(resolved, m, optionMergeStrategies, true));
|
|
884
|
-
}
|
|
885
|
-
mergeOptions(resolved, base, optionMergeStrategies);
|
|
886
|
-
}
|
|
887
|
-
cache.set(base, resolved);
|
|
888
|
-
return resolved;
|
|
889
|
-
}
|
|
890
|
-
function mergeOptions(to, from, strats, asMixin = false) {
|
|
891
|
-
const { mixins, extends: extendsOptions } = from;
|
|
892
|
-
if (extendsOptions) {
|
|
893
|
-
mergeOptions(to, extendsOptions, strats, true);
|
|
894
|
-
}
|
|
895
|
-
if (mixins) {
|
|
896
|
-
mixins.forEach((m) => mergeOptions(to, m, strats, true));
|
|
897
|
-
}
|
|
898
|
-
for (const key in from) {
|
|
899
|
-
if (asMixin && key === "expose")
|
|
900
|
-
;
|
|
901
|
-
else {
|
|
902
|
-
const strat = internalOptionMergeStrats[key] || strats && strats[key];
|
|
903
|
-
to[key] = strat ? strat(to[key], from[key]) : from[key];
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
return to;
|
|
907
|
-
}
|
|
908
|
-
const internalOptionMergeStrats = {
|
|
909
|
-
data: mergeDataFn,
|
|
910
|
-
props: mergeObjectOptions,
|
|
911
|
-
emits: mergeObjectOptions,
|
|
912
|
-
methods: mergeObjectOptions,
|
|
913
|
-
computed: mergeObjectOptions,
|
|
914
|
-
beforeCreate: mergeAsArray,
|
|
915
|
-
created: mergeAsArray,
|
|
916
|
-
beforeMount: mergeAsArray,
|
|
917
|
-
mounted: mergeAsArray,
|
|
918
|
-
beforeUpdate: mergeAsArray,
|
|
919
|
-
updated: mergeAsArray,
|
|
920
|
-
beforeDestroy: mergeAsArray,
|
|
921
|
-
beforeUnmount: mergeAsArray,
|
|
922
|
-
destroyed: mergeAsArray,
|
|
923
|
-
unmounted: mergeAsArray,
|
|
924
|
-
activated: mergeAsArray,
|
|
925
|
-
deactivated: mergeAsArray,
|
|
926
|
-
errorCaptured: mergeAsArray,
|
|
927
|
-
serverPrefetch: mergeAsArray,
|
|
928
|
-
components: mergeObjectOptions,
|
|
929
|
-
directives: mergeObjectOptions,
|
|
930
|
-
watch: mergeWatchOptions,
|
|
931
|
-
provide: mergeDataFn,
|
|
932
|
-
inject: mergeInject
|
|
933
|
-
};
|
|
934
|
-
function mergeDataFn(to, from) {
|
|
935
|
-
if (!from) {
|
|
936
|
-
return to;
|
|
937
|
-
}
|
|
938
|
-
if (!to) {
|
|
939
|
-
return from;
|
|
940
|
-
}
|
|
941
|
-
return function mergedDataFn() {
|
|
942
|
-
return extend(isFunction(to) ? to.call(this, this) : to, isFunction(from) ? from.call(this, this) : from);
|
|
487
|
+
function createAppContext() {
|
|
488
|
+
return {
|
|
489
|
+
app: null,
|
|
490
|
+
config: {
|
|
491
|
+
isNativeTag: NO,
|
|
492
|
+
performance: false,
|
|
493
|
+
globalProperties: {},
|
|
494
|
+
optionMergeStrategies: {},
|
|
495
|
+
errorHandler: void 0,
|
|
496
|
+
warnHandler: void 0,
|
|
497
|
+
compilerOptions: {}
|
|
498
|
+
},
|
|
499
|
+
mixins: [],
|
|
500
|
+
components: {},
|
|
501
|
+
directives: {},
|
|
502
|
+
provides: /* @__PURE__ */ Object.create(null),
|
|
503
|
+
optionsCache: /* @__PURE__ */ new WeakMap(),
|
|
504
|
+
propsCache: /* @__PURE__ */ new WeakMap(),
|
|
505
|
+
emitsCache: /* @__PURE__ */ new WeakMap()
|
|
943
506
|
};
|
|
944
507
|
}
|
|
945
|
-
|
|
946
|
-
return mergeObjectOptions(normalizeInject(to), normalizeInject(from));
|
|
947
|
-
}
|
|
948
|
-
function normalizeInject(raw) {
|
|
949
|
-
if (isArray(raw)) {
|
|
950
|
-
const res = {};
|
|
951
|
-
for (let i = 0; i < raw.length; i++) {
|
|
952
|
-
res[raw[i]] = raw[i];
|
|
953
|
-
}
|
|
954
|
-
return res;
|
|
955
|
-
}
|
|
956
|
-
return raw;
|
|
957
|
-
}
|
|
958
|
-
function mergeAsArray(to, from) {
|
|
959
|
-
return to ? [...new Set([].concat(to, from))] : from;
|
|
960
|
-
}
|
|
961
|
-
function mergeObjectOptions(to, from) {
|
|
962
|
-
return to ? extend(extend(/* @__PURE__ */ Object.create(null), to), from) : from;
|
|
963
|
-
}
|
|
964
|
-
function mergeWatchOptions(to, from) {
|
|
965
|
-
if (!to)
|
|
966
|
-
return from;
|
|
967
|
-
if (!from)
|
|
968
|
-
return to;
|
|
969
|
-
const merged = extend(/* @__PURE__ */ Object.create(null), to);
|
|
970
|
-
for (const key in from) {
|
|
971
|
-
merged[key] = mergeAsArray(to[key], from[key]);
|
|
972
|
-
}
|
|
973
|
-
return merged;
|
|
974
|
-
}
|
|
975
|
-
const queuePostRenderEffect = queueEffectWithSuspense;
|
|
976
|
-
const getPublicInstance = (i) => {
|
|
977
|
-
if (!i)
|
|
978
|
-
return null;
|
|
979
|
-
if (isStatefulComponent(i))
|
|
980
|
-
return getExposeProxy(i) || i.proxy;
|
|
981
|
-
return getPublicInstance(i.parent);
|
|
982
|
-
};
|
|
983
|
-
const publicPropertiesMap = extend(/* @__PURE__ */ Object.create(null), {
|
|
984
|
-
$: (i) => i,
|
|
985
|
-
$el: (i) => i.vnode.el,
|
|
986
|
-
$data: (i) => i.data,
|
|
987
|
-
$props: (i) => i.props,
|
|
988
|
-
$attrs: (i) => i.attrs,
|
|
989
|
-
$slots: (i) => i.slots,
|
|
990
|
-
$refs: (i) => i.refs,
|
|
991
|
-
$parent: (i) => getPublicInstance(i.parent),
|
|
992
|
-
$root: (i) => getPublicInstance(i.root),
|
|
993
|
-
$emit: (i) => i.emit,
|
|
994
|
-
$options: (i) => resolveMergedOptions(i),
|
|
995
|
-
$forceUpdate: (i) => () => queueJob(i.update),
|
|
996
|
-
$nextTick: (i) => nextTick.bind(i.proxy),
|
|
997
|
-
$watch: (i) => instanceWatch.bind(i)
|
|
998
|
-
});
|
|
999
|
-
let currentInstance = null;
|
|
1000
|
-
const setCurrentInstance = (instance) => {
|
|
1001
|
-
currentInstance = instance;
|
|
1002
|
-
instance.scope.on();
|
|
1003
|
-
};
|
|
1004
|
-
const unsetCurrentInstance = () => {
|
|
1005
|
-
currentInstance && currentInstance.scope.off();
|
|
1006
|
-
currentInstance = null;
|
|
1007
|
-
};
|
|
1008
|
-
function isStatefulComponent(instance) {
|
|
1009
|
-
return instance.vnode.shapeFlag & 4;
|
|
1010
|
-
}
|
|
508
|
+
createAppContext();
|
|
1011
509
|
let isInSSRComponentSetup = false;
|
|
1012
|
-
function getExposeProxy(instance) {
|
|
1013
|
-
if (instance.exposed) {
|
|
1014
|
-
return instance.exposeProxy || (instance.exposeProxy = new Proxy(proxyRefs(markRaw(instance.exposed)), {
|
|
1015
|
-
get(target, key) {
|
|
1016
|
-
if (key in target) {
|
|
1017
|
-
return target[key];
|
|
1018
|
-
} else if (key in publicPropertiesMap) {
|
|
1019
|
-
return publicPropertiesMap[key](instance);
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
}));
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
510
|
const computed = (getterOrOptions, debugOptions) => {
|
|
1026
511
|
return computed$1(getterOrOptions, debugOptions, isInSSRComponentSetup);
|
|
1027
512
|
};
|
|
@@ -1060,6 +545,7 @@ const __default__$1 = {
|
|
|
1060
545
|
inheritAttrs: false
|
|
1061
546
|
};
|
|
1062
547
|
const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
|
|
548
|
+
__name: "Input",
|
|
1063
549
|
props: {
|
|
1064
550
|
modelValue: null,
|
|
1065
551
|
type: { default: "text" },
|
|
@@ -1088,7 +574,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
1088
574
|
return (_ctx, _cache) => {
|
|
1089
575
|
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
1090
576
|
createElementVNode("input", mergeProps({
|
|
1091
|
-
class: ["mono-50 bg-white text-grey-800 placeholder:text-grey-400 placeholder:font-normal border-grey-300 dark:bg-grey-800 dark:text-grey-100 dark:placeholder:text-grey-500 dark:border-grey-700 focus:border-blue-400 focus:ring-blue-400 dark:focus:border-blue-800 dark:focus:ring-blue-800 rounded", [unref
|
|
577
|
+
class: ["mono-50 bg-white text-grey-800 placeholder:text-grey-400 placeholder:font-normal border-grey-300 dark:bg-grey-800 dark:text-grey-100 dark:placeholder:text-grey-500 dark:border-grey-700 focus:border-blue-400 focus:ring-blue-400 dark:focus:border-blue-800 dark:focus:ring-blue-800 rounded", [unref(inputClasses), unref(textSizeClasses), unref(disabledClasses)]],
|
|
1092
578
|
placeholder: __props.placeholder,
|
|
1093
579
|
type: __props.type,
|
|
1094
580
|
tabindex: __props.isDisabled ? "-1" : void 0,
|
|
@@ -1100,7 +586,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
|
|
|
1100
586
|
}), null, 16, _hoisted_2$4),
|
|
1101
587
|
__props.icon ? (openBlock(), createElementBlock("span", {
|
|
1102
588
|
key: 0,
|
|
1103
|
-
class: normalizeClass(["absolute left-0 inset-y-0 inline-flex items-center justify-center text-grey-700 dark:text-grey-100 px-4", unref
|
|
589
|
+
class: normalizeClass(["absolute left-0 inset-y-0 inline-flex items-center justify-center text-grey-700 dark:text-grey-100 px-4", unref(textSizeClasses)])
|
|
1104
590
|
}, [
|
|
1105
591
|
createVNode(_sfc_main$b, { name: __props.icon }, null, 8, ["name"])
|
|
1106
592
|
], 2)) : createCommentVNode("", true)
|
|
@@ -1115,6 +601,7 @@ const _hoisted_3$2 = {
|
|
|
1115
601
|
class: "block text-xs text-grey-400 font-normal mono-0 casual-60"
|
|
1116
602
|
};
|
|
1117
603
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
604
|
+
__name: "Label",
|
|
1118
605
|
props: {
|
|
1119
606
|
id: null,
|
|
1120
607
|
label: null,
|
|
@@ -1129,1520 +616,737 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
1129
616
|
};
|
|
1130
617
|
}
|
|
1131
618
|
});
|
|
1132
|
-
function
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
619
|
+
function u$2(r2, n2, ...a2) {
|
|
620
|
+
if (r2 in n2) {
|
|
621
|
+
let e2 = n2[r2];
|
|
622
|
+
return typeof e2 == "function" ? e2(...a2) : e2;
|
|
623
|
+
}
|
|
624
|
+
let t2 = new Error(`Tried to handle "${r2}" but there is no handler defined. Only defined handlers are: ${Object.keys(n2).map((e2) => `"${e2}"`).join(", ")}.`);
|
|
625
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t2, u$2), t2;
|
|
626
|
+
}
|
|
627
|
+
var h$1 = ((t2) => (t2[t2.None = 0] = "None", t2[t2.RenderStrategy = 1] = "RenderStrategy", t2[t2.Static = 2] = "Static", t2))(h$1 || {}), b$2 = ((e2) => (e2[e2.Unmount = 0] = "Unmount", e2[e2.Hidden = 1] = "Hidden", e2))(b$2 || {});
|
|
628
|
+
function k(_a) {
|
|
629
|
+
var _b = _a, { visible: n2 = true, features: r2 = 0 } = _b, e2 = __objRest(_b, ["visible", "features"]);
|
|
630
|
+
var t2;
|
|
631
|
+
if (n2 || r2 & 2 && e2.props.static)
|
|
632
|
+
return i(e2);
|
|
633
|
+
if (r2 & 1) {
|
|
634
|
+
let a2 = (t2 = e2.props.unmount) == null || t2 ? 0 : 1;
|
|
635
|
+
return u$2(a2, { [0]() {
|
|
636
|
+
return null;
|
|
637
|
+
}, [1]() {
|
|
638
|
+
return i(__spreadProps(__spreadValues({}, e2), { props: __spreadProps(__spreadValues({}, e2.props), { hidden: true, style: { display: "none" } }) }));
|
|
639
|
+
} });
|
|
640
|
+
}
|
|
641
|
+
return i(e2);
|
|
642
|
+
}
|
|
643
|
+
function i({ props: n2, attrs: r2, slots: e2, slot: t2, name: a2 }) {
|
|
644
|
+
var c2;
|
|
645
|
+
let _a = R(n2, ["unmount", "static"]), { as: d } = _a, s2 = __objRest(_a, ["as"]), o2 = (c2 = e2.default) == null ? void 0 : c2.call(e2, t2), u2 = {};
|
|
646
|
+
if (d === "template") {
|
|
647
|
+
if (Object.keys(s2).length > 0 || Object.keys(r2).length > 0) {
|
|
648
|
+
let [p2, ...f2] = o2 != null ? o2 : [];
|
|
649
|
+
if (!j(p2) || f2.length > 0)
|
|
650
|
+
throw new Error(['Passing props on "template"!', "", `The current component <${a2} /> is rendering a "template".`, "However we need to passthrough the following props:", Object.keys(s2).concat(Object.keys(r2)).map((l2) => ` - ${l2}`).join(`
|
|
651
|
+
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".', "Render a single element as the child so that we can forward the props onto that element."].map((l2) => ` - ${l2}`).join(`
|
|
652
|
+
`)].join(`
|
|
653
|
+
`));
|
|
654
|
+
return cloneVNode(p2, Object.assign({}, s2, u2));
|
|
655
|
+
}
|
|
656
|
+
return Array.isArray(o2) && o2.length === 1 ? o2[0] : o2;
|
|
657
|
+
}
|
|
658
|
+
return h$2(d, Object.assign({}, s2, u2), o2);
|
|
659
|
+
}
|
|
660
|
+
function S$1(n2) {
|
|
661
|
+
let r2 = Object.assign({}, n2);
|
|
662
|
+
for (let e2 in r2)
|
|
663
|
+
r2[e2] === void 0 && delete r2[e2];
|
|
664
|
+
return r2;
|
|
665
|
+
}
|
|
666
|
+
function R(n2, r2 = []) {
|
|
667
|
+
let e2 = Object.assign({}, n2);
|
|
668
|
+
for (let t2 of r2)
|
|
669
|
+
t2 in e2 && delete e2[t2];
|
|
670
|
+
return e2;
|
|
671
|
+
}
|
|
672
|
+
function j(n2) {
|
|
673
|
+
return n2 == null ? false : typeof n2.type == "string" || typeof n2.type == "object" || typeof n2.type == "function";
|
|
674
|
+
}
|
|
675
|
+
let e$2 = 0;
|
|
676
|
+
function n$1() {
|
|
677
|
+
return ++e$2;
|
|
678
|
+
}
|
|
679
|
+
function t$2() {
|
|
680
|
+
return n$1();
|
|
681
|
+
}
|
|
682
|
+
var o = ((r2) => (r2.Space = " ", r2.Enter = "Enter", r2.Escape = "Escape", r2.Backspace = "Backspace", r2.Delete = "Delete", r2.ArrowLeft = "ArrowLeft", r2.ArrowUp = "ArrowUp", r2.ArrowRight = "ArrowRight", r2.ArrowDown = "ArrowDown", r2.Home = "Home", r2.End = "End", r2.PageUp = "PageUp", r2.PageDown = "PageDown", r2.Tab = "Tab", r2))(o || {});
|
|
683
|
+
function f$1(r2) {
|
|
684
|
+
throw new Error("Unexpected object: " + r2);
|
|
685
|
+
}
|
|
686
|
+
var a$2 = ((e2) => (e2[e2.First = 0] = "First", e2[e2.Previous = 1] = "Previous", e2[e2.Next = 2] = "Next", e2[e2.Last = 3] = "Last", e2[e2.Specific = 4] = "Specific", e2[e2.Nothing = 5] = "Nothing", e2))(a$2 || {});
|
|
687
|
+
function x(r2, n2) {
|
|
688
|
+
let t2 = n2.resolveItems();
|
|
689
|
+
if (t2.length <= 0)
|
|
690
|
+
return null;
|
|
691
|
+
let l2 = n2.resolveActiveIndex(), s2 = l2 != null ? l2 : -1, d = (() => {
|
|
692
|
+
switch (r2.focus) {
|
|
693
|
+
case 0:
|
|
694
|
+
return t2.findIndex((e2) => !n2.resolveDisabled(e2));
|
|
695
|
+
case 1: {
|
|
696
|
+
let e2 = t2.slice().reverse().findIndex((i2, c2, u2) => s2 !== -1 && u2.length - c2 - 1 >= s2 ? false : !n2.resolveDisabled(i2));
|
|
697
|
+
return e2 === -1 ? e2 : t2.length - 1 - e2;
|
|
698
|
+
}
|
|
699
|
+
case 2:
|
|
700
|
+
return t2.findIndex((e2, i2) => i2 <= s2 ? false : !n2.resolveDisabled(e2));
|
|
701
|
+
case 3: {
|
|
702
|
+
let e2 = t2.slice().reverse().findIndex((i2) => !n2.resolveDisabled(i2));
|
|
703
|
+
return e2 === -1 ? e2 : t2.length - 1 - e2;
|
|
1140
704
|
}
|
|
705
|
+
case 4:
|
|
706
|
+
return t2.findIndex((e2) => n2.resolveId(e2) === r2.id);
|
|
707
|
+
case 5:
|
|
708
|
+
return null;
|
|
709
|
+
default:
|
|
710
|
+
f$1(r2);
|
|
1141
711
|
}
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
return _extends.apply(this, arguments);
|
|
712
|
+
})();
|
|
713
|
+
return d === -1 ? l2 : d;
|
|
1145
714
|
}
|
|
1146
|
-
function
|
|
1147
|
-
|
|
1148
|
-
return {};
|
|
1149
|
-
var target = {};
|
|
1150
|
-
var sourceKeys = Object.keys(source);
|
|
1151
|
-
var key, i;
|
|
1152
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
1153
|
-
key = sourceKeys[i];
|
|
1154
|
-
if (excluded.indexOf(key) >= 0)
|
|
1155
|
-
continue;
|
|
1156
|
-
target[key] = source[key];
|
|
1157
|
-
}
|
|
1158
|
-
return target;
|
|
715
|
+
function t$1(l2) {
|
|
716
|
+
return l2 == null || l2.value == null ? null : "$el" in l2.value ? l2.value.$el : l2.value;
|
|
1159
717
|
}
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
n = o.constructor.name;
|
|
1168
|
-
if (n === "Map" || n === "Set")
|
|
1169
|
-
return Array.from(o);
|
|
1170
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
1171
|
-
return _arrayLikeToArray(o, minLen);
|
|
1172
|
-
}
|
|
1173
|
-
function _arrayLikeToArray(arr, len) {
|
|
1174
|
-
if (len == null || len > arr.length)
|
|
1175
|
-
len = arr.length;
|
|
1176
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
1177
|
-
arr2[i] = arr[i];
|
|
1178
|
-
return arr2;
|
|
1179
|
-
}
|
|
1180
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
1181
|
-
var it;
|
|
1182
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
1183
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
1184
|
-
if (it)
|
|
1185
|
-
o = it;
|
|
1186
|
-
var i = 0;
|
|
1187
|
-
return function() {
|
|
1188
|
-
if (i >= o.length)
|
|
1189
|
-
return {
|
|
1190
|
-
done: true
|
|
1191
|
-
};
|
|
1192
|
-
return {
|
|
1193
|
-
done: false,
|
|
1194
|
-
value: o[i++]
|
|
1195
|
-
};
|
|
1196
|
-
};
|
|
1197
|
-
}
|
|
1198
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1199
|
-
}
|
|
1200
|
-
it = o[Symbol.iterator]();
|
|
1201
|
-
return it.next.bind(it);
|
|
718
|
+
let n = Symbol("Context");
|
|
719
|
+
var l = ((e2) => (e2[e2.Open = 0] = "Open", e2[e2.Closed = 1] = "Closed", e2))(l || {});
|
|
720
|
+
function p$2() {
|
|
721
|
+
return inject(n, null);
|
|
722
|
+
}
|
|
723
|
+
function c$1(o2) {
|
|
724
|
+
provide(n, o2);
|
|
1202
725
|
}
|
|
1203
|
-
function
|
|
1204
|
-
if (
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
726
|
+
function r(t2, e2) {
|
|
727
|
+
if (t2)
|
|
728
|
+
return t2;
|
|
729
|
+
let n2 = e2 != null ? e2 : "button";
|
|
730
|
+
if (typeof n2 == "string" && n2.toLowerCase() === "button")
|
|
731
|
+
return "button";
|
|
732
|
+
}
|
|
733
|
+
function b$1(t2, e2) {
|
|
734
|
+
let n2 = ref(r(t2.value.type, t2.value.as));
|
|
735
|
+
return onMounted(() => {
|
|
736
|
+
n2.value = r(t2.value.type, t2.value.as);
|
|
737
|
+
}), watchEffect(() => {
|
|
738
|
+
var o2;
|
|
739
|
+
n2.value || !t$1(e2) || t$1(e2) instanceof HTMLButtonElement && !((o2 = t$1(e2)) != null && o2.hasAttribute("type")) && (n2.value = "button");
|
|
740
|
+
}), n2;
|
|
741
|
+
}
|
|
742
|
+
function e$1(n2) {
|
|
743
|
+
if (typeof window == "undefined")
|
|
744
|
+
return null;
|
|
745
|
+
if (n2 instanceof Node)
|
|
746
|
+
return n2.ownerDocument;
|
|
747
|
+
if (n2 != null && n2.hasOwnProperty("value")) {
|
|
748
|
+
let o2 = t$1(n2);
|
|
749
|
+
if (o2)
|
|
750
|
+
return o2.ownerDocument;
|
|
751
|
+
}
|
|
752
|
+
return document;
|
|
753
|
+
}
|
|
754
|
+
function p$1({ container: e2, accept: t2, walk: d, enabled: o2 }) {
|
|
755
|
+
watchEffect(() => {
|
|
756
|
+
let r2 = e2.value;
|
|
757
|
+
if (!r2 || o2 !== void 0 && !o2.value)
|
|
758
|
+
return;
|
|
759
|
+
let l2 = e$1(e2);
|
|
760
|
+
if (!l2)
|
|
761
|
+
return;
|
|
762
|
+
let c2 = Object.assign((f2) => t2(f2), { acceptNode: t2 }), n2 = l2.createTreeWalker(r2, NodeFilter.SHOW_ELEMENT, c2, false);
|
|
763
|
+
for (; n2.nextNode(); )
|
|
764
|
+
d(n2.currentNode);
|
|
765
|
+
});
|
|
766
|
+
}
|
|
767
|
+
let c = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e2) => `${e2}:not([tabindex='-1'])`).join(",");
|
|
768
|
+
var L = ((o2) => (o2[o2.First = 1] = "First", o2[o2.Previous = 2] = "Previous", o2[o2.Next = 4] = "Next", o2[o2.Last = 8] = "Last", o2[o2.WrapAround = 16] = "WrapAround", o2[o2.NoScroll = 32] = "NoScroll", o2))(L || {}), N = ((n2) => (n2[n2.Error = 0] = "Error", n2[n2.Overflow = 1] = "Overflow", n2[n2.Success = 2] = "Success", n2[n2.Underflow = 3] = "Underflow", n2))(N || {}), T$1 = ((t2) => (t2[t2.Previous = -1] = "Previous", t2[t2.Next = 1] = "Next", t2))(T$1 || {});
|
|
769
|
+
var M = ((t2) => (t2[t2.Strict = 0] = "Strict", t2[t2.Loose = 1] = "Loose", t2))(M || {});
|
|
770
|
+
function F(e2, r2 = 0) {
|
|
771
|
+
var t2;
|
|
772
|
+
return e2 === ((t2 = e$1(e2)) == null ? void 0 : t2.body) ? false : u$2(r2, { [0]() {
|
|
773
|
+
return e2.matches(c);
|
|
774
|
+
}, [1]() {
|
|
775
|
+
let l2 = e2;
|
|
776
|
+
for (; l2 !== null; ) {
|
|
777
|
+
if (l2.matches(c))
|
|
778
|
+
return true;
|
|
779
|
+
l2 = l2.parentElement;
|
|
1208
780
|
}
|
|
1209
|
-
return
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
}));
|
|
1251
|
-
}, _match));
|
|
1252
|
-
}
|
|
1253
|
-
return _render(main2);
|
|
1254
|
-
}
|
|
1255
|
-
function _render(_ref2) {
|
|
1256
|
-
var props = _ref2.props, attrs = _ref2.attrs, slots = _ref2.slots, slot = _ref2.slot, name = _ref2.name;
|
|
1257
|
-
var _omit = omit(props, ["unmount", "static"]), as = _omit.as, passThroughProps = _objectWithoutPropertiesLoose(_omit, ["as"]);
|
|
1258
|
-
var children = slots["default"] == null ? void 0 : slots["default"](slot);
|
|
1259
|
-
if (as === "template") {
|
|
1260
|
-
if (Object.keys(passThroughProps).length > 0 || Object.keys(attrs).length > 0) {
|
|
1261
|
-
var _ref3 = children != null ? children : [], firstChild = _ref3[0], other = _ref3.slice(1);
|
|
1262
|
-
if (!isValidElement(firstChild) || other.length > 0) {
|
|
1263
|
-
throw new Error(['Passing props on "template"!', "", "The current component <" + name + ' /> is rendering a "template".', "However we need to passthrough the following props:", Object.keys(passThroughProps).concat(Object.keys(attrs)).map(function(line) {
|
|
1264
|
-
return " - " + line;
|
|
1265
|
-
}).join("\n"), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".', "Render a single element as the child so that we can forward the props onto that element."].map(function(line) {
|
|
1266
|
-
return " - " + line;
|
|
1267
|
-
}).join("\n")].join("\n"));
|
|
1268
|
-
}
|
|
1269
|
-
return cloneVNode(firstChild, passThroughProps);
|
|
781
|
+
return false;
|
|
782
|
+
} });
|
|
783
|
+
}
|
|
784
|
+
function w$2(e2, r2 = (t2) => t2) {
|
|
785
|
+
return e2.slice().sort((t2, l2) => {
|
|
786
|
+
let n2 = r2(t2), i2 = r2(l2);
|
|
787
|
+
if (n2 === null || i2 === null)
|
|
788
|
+
return 0;
|
|
789
|
+
let o2 = n2.compareDocumentPosition(i2);
|
|
790
|
+
return o2 & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : o2 & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
function w$1(e2, n2, t2) {
|
|
794
|
+
typeof window != "undefined" && watchEffect((o2) => {
|
|
795
|
+
window.addEventListener(e2, n2, t2), o2(() => window.removeEventListener(e2, n2, t2));
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
function t(e2) {
|
|
799
|
+
typeof queueMicrotask == "function" ? queueMicrotask(e2) : Promise.resolve().then(e2).catch((o2) => setTimeout(() => {
|
|
800
|
+
throw o2;
|
|
801
|
+
}));
|
|
802
|
+
}
|
|
803
|
+
var s$1 = ((n2) => (n2[n2.None = 1] = "None", n2[n2.IgnoreScrollbars = 2] = "IgnoreScrollbars", n2))(s$1 || {});
|
|
804
|
+
function w(f2, a2, n2 = 1) {
|
|
805
|
+
let i2 = false;
|
|
806
|
+
function l2(r2) {
|
|
807
|
+
if (i2)
|
|
808
|
+
return;
|
|
809
|
+
i2 = true, t(() => {
|
|
810
|
+
i2 = false;
|
|
811
|
+
});
|
|
812
|
+
let o2 = r2.target;
|
|
813
|
+
if (!o2.ownerDocument.documentElement.contains(o2))
|
|
814
|
+
return;
|
|
815
|
+
let c2 = function t2(e2) {
|
|
816
|
+
return typeof e2 == "function" ? t2(e2()) : Array.isArray(e2) || e2 instanceof Set ? e2 : [e2];
|
|
817
|
+
}(f2);
|
|
818
|
+
if ((n2 & 2) === 2) {
|
|
819
|
+
let t2 = 20, e2 = o2.ownerDocument.documentElement;
|
|
820
|
+
if (r2.clientX > e2.clientWidth - t2 || r2.clientX < t2 || r2.clientY > e2.clientHeight - t2 || r2.clientY < t2)
|
|
821
|
+
return;
|
|
1270
822
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
823
|
+
for (let t2 of c2) {
|
|
824
|
+
if (t2 === null)
|
|
825
|
+
continue;
|
|
826
|
+
let e2 = t2 instanceof HTMLElement ? t2 : t$1(t2);
|
|
827
|
+
if (e2 != null && e2.contains(o2))
|
|
828
|
+
return;
|
|
1273
829
|
}
|
|
1274
|
-
|
|
830
|
+
a2(r2, o2);
|
|
1275
831
|
}
|
|
1276
|
-
|
|
832
|
+
w$1("pointerdown", l2), w$1("mousedown", l2);
|
|
1277
833
|
}
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
834
|
+
var a$1 = ((e2) => (e2[e2.None = 1] = "None", e2[e2.Focusable = 2] = "Focusable", e2[e2.Hidden = 4] = "Hidden", e2))(a$1 || {});
|
|
835
|
+
let m = defineComponent({ name: "Hidden", props: { as: { type: [Object, String], default: "div" }, features: { type: Number, default: 1 } }, setup(r2, { slots: t2, attrs: o2 }) {
|
|
836
|
+
return () => {
|
|
837
|
+
let _a = r2, { features: e2 } = _a, d = __objRest(_a, ["features"]), n2 = { "aria-hidden": (e2 & 2) === 2 ? true : void 0, style: __spreadValues({ position: "absolute", width: 1, height: 1, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" }, (e2 & 4) === 4 && (e2 & 2) !== 2 && { display: "none" }) };
|
|
838
|
+
return k({ props: __spreadValues(__spreadValues({}, d), n2), slot: {}, attrs: o2, slots: t2, name: "Hidden" });
|
|
839
|
+
};
|
|
840
|
+
} });
|
|
841
|
+
function e(n2 = {}, r2 = null, t2 = []) {
|
|
842
|
+
for (let [i2, o2] of Object.entries(n2))
|
|
843
|
+
f(t2, s(r2, i2), o2);
|
|
844
|
+
return t2;
|
|
845
|
+
}
|
|
846
|
+
function s(n2, r2) {
|
|
847
|
+
return n2 ? n2 + "[" + r2 + "]" : r2;
|
|
848
|
+
}
|
|
849
|
+
function f(n2, r2, t2) {
|
|
850
|
+
if (Array.isArray(t2))
|
|
851
|
+
for (let [i2, o2] of t2.entries())
|
|
852
|
+
f(n2, s(r2, i2.toString()), o2);
|
|
853
|
+
else
|
|
854
|
+
t2 instanceof Date ? n2.push([r2, t2.toISOString()]) : typeof t2 == "boolean" ? n2.push([r2, t2 ? "1" : "0"]) : typeof t2 == "string" ? n2.push([r2, t2]) : typeof t2 == "number" ? n2.push([r2, `${t2}`]) : t2 == null ? n2.push([r2, ""]) : e(t2, r2, n2);
|
|
855
|
+
}
|
|
856
|
+
function p(n2) {
|
|
857
|
+
var t2;
|
|
858
|
+
let r2 = (t2 = n2 == null ? void 0 : n2.form) != null ? t2 : n2.closest("form");
|
|
859
|
+
if (!!r2) {
|
|
860
|
+
for (let i2 of r2.elements)
|
|
861
|
+
if (i2.tagName === "INPUT" && i2.type === "submit" || i2.tagName === "BUTTON" && i2.type === "submit" || i2.nodeName === "INPUT" && i2.type === "image") {
|
|
862
|
+
i2.click();
|
|
863
|
+
return;
|
|
864
|
+
}
|
|
1287
865
|
}
|
|
1288
|
-
return clone;
|
|
1289
866
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
if (
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
return true;
|
|
1297
|
-
if (typeof input.type === "function")
|
|
1298
|
-
return true;
|
|
1299
|
-
return false;
|
|
1300
|
-
}
|
|
1301
|
-
var Keys;
|
|
1302
|
-
(function(Keys2) {
|
|
1303
|
-
Keys2["Space"] = " ";
|
|
1304
|
-
Keys2["Enter"] = "Enter";
|
|
1305
|
-
Keys2["Escape"] = "Escape";
|
|
1306
|
-
Keys2["Backspace"] = "Backspace";
|
|
1307
|
-
Keys2["ArrowLeft"] = "ArrowLeft";
|
|
1308
|
-
Keys2["ArrowUp"] = "ArrowUp";
|
|
1309
|
-
Keys2["ArrowRight"] = "ArrowRight";
|
|
1310
|
-
Keys2["ArrowDown"] = "ArrowDown";
|
|
1311
|
-
Keys2["Home"] = "Home";
|
|
1312
|
-
Keys2["End"] = "End";
|
|
1313
|
-
Keys2["PageUp"] = "PageUp";
|
|
1314
|
-
Keys2["PageDown"] = "PageDown";
|
|
1315
|
-
Keys2["Tab"] = "Tab";
|
|
1316
|
-
})(Keys || (Keys = {}));
|
|
1317
|
-
var id = 0;
|
|
1318
|
-
function generateId() {
|
|
1319
|
-
return ++id;
|
|
1320
|
-
}
|
|
1321
|
-
function useId() {
|
|
1322
|
-
return generateId();
|
|
1323
|
-
}
|
|
1324
|
-
function useWindowEvent(type, listener, options) {
|
|
1325
|
-
if (typeof window === "undefined")
|
|
1326
|
-
return;
|
|
1327
|
-
watchEffect(function(onInvalidate) {
|
|
1328
|
-
window.addEventListener(type, listener, options);
|
|
1329
|
-
onInvalidate(function() {
|
|
1330
|
-
window.removeEventListener(type, listener, options);
|
|
1331
|
-
});
|
|
1332
|
-
});
|
|
867
|
+
let u$1 = Symbol("DescriptionContext");
|
|
868
|
+
function h() {
|
|
869
|
+
let n2 = inject(u$1, null);
|
|
870
|
+
if (n2 === null)
|
|
871
|
+
throw new Error("Missing parent");
|
|
872
|
+
return n2;
|
|
1333
873
|
}
|
|
1334
|
-
function
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
return
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
var State;
|
|
1344
|
-
(function(State2) {
|
|
1345
|
-
State2[State2["Open"] = 0] = "Open";
|
|
1346
|
-
State2[State2["Closed"] = 1] = "Closed";
|
|
1347
|
-
})(State || (State = {}));
|
|
1348
|
-
function useOpenClosed() {
|
|
1349
|
-
return inject(Context, null);
|
|
1350
|
-
}
|
|
1351
|
-
function useOpenClosedProvider(value) {
|
|
1352
|
-
provide(Context, value);
|
|
1353
|
-
}
|
|
1354
|
-
function resolveType(type, as) {
|
|
1355
|
-
if (type)
|
|
1356
|
-
return type;
|
|
1357
|
-
var tag = as != null ? as : "button";
|
|
1358
|
-
if (typeof tag === "string" && tag.toLowerCase() === "button")
|
|
1359
|
-
return "button";
|
|
1360
|
-
return void 0;
|
|
874
|
+
function P$1({ slot: n2 = ref({}), name: o2 = "Description", props: s2 = {} } = {}) {
|
|
875
|
+
let e2 = ref([]);
|
|
876
|
+
function t2(r2) {
|
|
877
|
+
return e2.value.push(r2), () => {
|
|
878
|
+
let i2 = e2.value.indexOf(r2);
|
|
879
|
+
i2 !== -1 && e2.value.splice(i2, 1);
|
|
880
|
+
};
|
|
881
|
+
}
|
|
882
|
+
return provide(u$1, { register: t2, slot: n2, name: o2, props: s2 }), computed$2(() => e2.value.length > 0 ? e2.value.join(" ") : void 0);
|
|
1361
883
|
}
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
onMounted(
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
884
|
+
let S = defineComponent({ name: "Description", props: { as: { type: [Object, String], default: "p" } }, setup(n2, { attrs: o2, slots: s2 }) {
|
|
885
|
+
let e2 = h(), t2 = `headlessui-description-${t$2()}`;
|
|
886
|
+
return onMounted(() => onUnmounted(e2.register(t2))), () => {
|
|
887
|
+
let { name: r2 = "Description", slot: i2 = ref({}), props: c2 = {} } = e2, l2 = n2, d = __spreadProps(__spreadValues({}, Object.entries(c2).reduce((f2, [a2, g]) => Object.assign(f2, { [a2]: unref(g) }), {})), { id: t2 });
|
|
888
|
+
return k({ props: __spreadValues(__spreadValues({}, l2), d), slot: i2.value, attrs: o2, slots: s2, name: r2 });
|
|
889
|
+
};
|
|
890
|
+
} });
|
|
891
|
+
var le = ((n2) => (n2[n2.Open = 0] = "Open", n2[n2.Closed = 1] = "Closed", n2))(le || {}), ne = ((n2) => (n2[n2.Single = 0] = "Single", n2[n2.Multi = 1] = "Multi", n2))(ne || {}), ue = ((n2) => (n2[n2.Pointer = 0] = "Pointer", n2[n2.Other = 1] = "Other", n2))(ue || {});
|
|
892
|
+
function re(i2) {
|
|
893
|
+
requestAnimationFrame(() => requestAnimationFrame(i2));
|
|
894
|
+
}
|
|
895
|
+
let H = Symbol("ListboxContext");
|
|
896
|
+
function P(i2) {
|
|
897
|
+
let x2 = inject(H, null);
|
|
898
|
+
if (x2 === null) {
|
|
899
|
+
let n2 = new Error(`<${i2} /> is missing a parent <Listbox /> component.`);
|
|
900
|
+
throw Error.captureStackTrace && Error.captureStackTrace(n2, P), n2;
|
|
901
|
+
}
|
|
902
|
+
return x2;
|
|
903
|
+
}
|
|
904
|
+
let we = defineComponent({ name: "Listbox", emits: { "update:modelValue": (i2) => true }, props: { as: { type: [Object, String], default: "template" }, disabled: { type: [Boolean], default: false }, horizontal: { type: [Boolean], default: false }, modelValue: { type: [Object, String, Number, Boolean] }, name: { type: String, optional: true }, multiple: { type: [Boolean], default: false } }, inheritAttrs: false, setup(i2, { slots: x$1, attrs: n2, emit: S2 }) {
|
|
905
|
+
let e$12 = ref(1), p2 = ref(null), d = ref(null), m$1 = ref(null), s2 = ref([]), O = ref(""), t2 = ref(null), l$1 = ref(1);
|
|
906
|
+
function w$12(o2 = (a2) => a2) {
|
|
907
|
+
let a2 = t2.value !== null ? s2.value[t2.value] : null, u2 = w$2(o2(s2.value.slice()), (g) => t$1(g.dataRef.domRef)), f2 = a2 ? u2.indexOf(a2) : null;
|
|
908
|
+
return f2 === -1 && (f2 = null), { options: u2, activeOptionIndex: f2 };
|
|
909
|
+
}
|
|
910
|
+
let y = computed$2(() => i2.modelValue), T2 = computed$2(() => i2.multiple ? 1 : 0), r2 = { listboxState: e$12, value: y, mode: T2, compare(o2, a2) {
|
|
911
|
+
return o2 === a2;
|
|
912
|
+
}, orientation: computed$2(() => i2.horizontal ? "horizontal" : "vertical"), labelRef: p2, buttonRef: d, optionsRef: m$1, disabled: computed$2(() => i2.disabled), options: s2, searchQuery: O, activeOptionIndex: t2, activationTrigger: l$1, closeListbox() {
|
|
913
|
+
i2.disabled || e$12.value !== 1 && (e$12.value = 1, t2.value = null);
|
|
914
|
+
}, openListbox() {
|
|
915
|
+
i2.disabled || e$12.value !== 0 && (e$12.value = 0);
|
|
916
|
+
}, goToOption(o2, a2, u2) {
|
|
917
|
+
if (i2.disabled || e$12.value === 1)
|
|
1370
918
|
return;
|
|
1371
|
-
|
|
919
|
+
let f2 = w$12(), g = x(o2 === a$2.Specific ? { focus: a$2.Specific, id: a2 } : { focus: o2 }, { resolveItems: () => f2.options, resolveActiveIndex: () => f2.activeOptionIndex, resolveId: (h2) => h2.id, resolveDisabled: (h2) => h2.dataRef.disabled });
|
|
920
|
+
O.value = "", t2.value = g, l$1.value = u2 != null ? u2 : 1, s2.value = f2.options;
|
|
921
|
+
}, search(o2) {
|
|
922
|
+
if (i2.disabled || e$12.value === 1)
|
|
1372
923
|
return;
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
(
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
924
|
+
let u2 = O.value !== "" ? 0 : 1;
|
|
925
|
+
O.value += o2.toLowerCase();
|
|
926
|
+
let g = (t2.value !== null ? s2.value.slice(t2.value + u2).concat(s2.value.slice(0, t2.value + u2)) : s2.value).find((V) => V.dataRef.textValue.startsWith(O.value) && !V.dataRef.disabled), h2 = g ? s2.value.indexOf(g) : -1;
|
|
927
|
+
h2 === -1 || h2 === t2.value || (t2.value = h2, l$1.value = 1);
|
|
928
|
+
}, clearSearch() {
|
|
929
|
+
i2.disabled || e$12.value !== 1 && O.value !== "" && (O.value = "");
|
|
930
|
+
}, registerOption(o2, a2) {
|
|
931
|
+
let u2 = w$12((f2) => [...f2, { id: o2, dataRef: a2 }]);
|
|
932
|
+
s2.value = u2.options, t2.value = u2.activeOptionIndex;
|
|
933
|
+
}, unregisterOption(o2) {
|
|
934
|
+
let a2 = w$12((u2) => {
|
|
935
|
+
let f2 = u2.findIndex((g) => g.id === o2);
|
|
936
|
+
return f2 !== -1 && u2.splice(f2, 1), u2;
|
|
937
|
+
});
|
|
938
|
+
s2.value = a2.options, t2.value = a2.activeOptionIndex, l$1.value = 1;
|
|
939
|
+
}, select(o2) {
|
|
940
|
+
i2.disabled || S2("update:modelValue", u$2(T2.value, { [0]: () => o2, [1]: () => {
|
|
941
|
+
let a2 = toRaw$1(r2.value.value).slice(), u2 = toRaw$1(o2), f2 = a2.findIndex((g) => r2.compare(u2, toRaw$1(g)));
|
|
942
|
+
return f2 === -1 ? a2.push(u2) : a2.splice(f2, 1), a2;
|
|
943
|
+
} }));
|
|
944
|
+
} };
|
|
945
|
+
return w([d, m$1], (o2, a2) => {
|
|
946
|
+
var u2;
|
|
947
|
+
e$12.value === 0 && (r2.closeListbox(), F(a2, M.Loose) || (o2.preventDefault(), (u2 = t$1(d)) == null || u2.focus()));
|
|
948
|
+
}), provide(H, r2), c$1(computed$2(() => u$2(e$12.value, { [0]: l.Open, [1]: l.Closed }))), () => {
|
|
949
|
+
let _a = i2, { name: o2, modelValue: a2, disabled: u2 } = _a, f2 = __objRest(_a, ["name", "modelValue", "disabled"]), g = { open: e$12.value === 0, disabled: u2 };
|
|
950
|
+
return h$2(Fragment, [...o2 != null && a2 != null ? e({ [o2]: a2 }).map(([h2, V]) => h$2(m, S$1({ features: a$1.Hidden, key: h2, as: "input", type: "hidden", hidden: true, readOnly: true, name: h2, value: V }))) : [], k({ props: __spreadValues(__spreadValues({}, n2), R(f2, ["onUpdate:modelValue", "horizontal", "multiple", "by"])), slot: g, slots: x$1, attrs: n2, name: "Listbox" })]);
|
|
951
|
+
};
|
|
952
|
+
} });
|
|
953
|
+
defineComponent({ name: "ListboxLabel", props: { as: { type: [Object, String], default: "label" } }, setup(i2, { attrs: x2, slots: n2 }) {
|
|
954
|
+
let S2 = P("ListboxLabel"), e2 = `headlessui-listbox-label-${t$2()}`;
|
|
955
|
+
function p2() {
|
|
956
|
+
var d;
|
|
957
|
+
(d = t$1(S2.buttonRef)) == null || d.focus({ preventScroll: true });
|
|
958
|
+
}
|
|
959
|
+
return () => {
|
|
960
|
+
let d = { open: S2.listboxState.value === 0, disabled: S2.disabled.value }, m2 = { id: e2, ref: S2.labelRef, onClick: p2 };
|
|
961
|
+
return k({ props: __spreadValues(__spreadValues({}, i2), m2), slot: d, attrs: x2, slots: n2, name: "ListboxLabel" });
|
|
962
|
+
};
|
|
963
|
+
} });
|
|
964
|
+
let ke = defineComponent({ name: "ListboxButton", props: { as: { type: [Object, String], default: "button" } }, setup(i2, { attrs: x2, slots: n2, expose: S2 }) {
|
|
965
|
+
let e2 = P("ListboxButton"), p2 = `headlessui-listbox-button-${t$2()}`;
|
|
966
|
+
S2({ el: e2.buttonRef, $el: e2.buttonRef });
|
|
967
|
+
function d(t2) {
|
|
968
|
+
switch (t2.key) {
|
|
969
|
+
case o.Space:
|
|
970
|
+
case o.Enter:
|
|
971
|
+
case o.ArrowDown:
|
|
972
|
+
t2.preventDefault(), e2.openListbox(), nextTick(() => {
|
|
973
|
+
var l2;
|
|
974
|
+
(l2 = t$1(e2.optionsRef)) == null || l2.focus({ preventScroll: true }), e2.value.value || e2.goToOption(a$2.First);
|
|
1418
975
|
});
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
976
|
+
break;
|
|
977
|
+
case o.ArrowUp:
|
|
978
|
+
t2.preventDefault(), e2.openListbox(), nextTick(() => {
|
|
979
|
+
var l2;
|
|
980
|
+
(l2 = t$1(e2.optionsRef)) == null || l2.focus({ preventScroll: true }), e2.value.value || e2.goToOption(a$2.Last);
|
|
1422
981
|
});
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
982
|
+
break;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
function m2(t2) {
|
|
986
|
+
switch (t2.key) {
|
|
987
|
+
case o.Space:
|
|
988
|
+
t2.preventDefault();
|
|
989
|
+
break;
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
function s2(t2) {
|
|
993
|
+
e2.disabled.value || (e2.listboxState.value === 0 ? (e2.closeListbox(), nextTick(() => {
|
|
994
|
+
var l2;
|
|
995
|
+
return (l2 = t$1(e2.buttonRef)) == null ? void 0 : l2.focus({ preventScroll: true });
|
|
996
|
+
})) : (t2.preventDefault(), e2.openListbox(), re(() => {
|
|
997
|
+
var l2;
|
|
998
|
+
return (l2 = t$1(e2.optionsRef)) == null ? void 0 : l2.focus({ preventScroll: true });
|
|
999
|
+
})));
|
|
1000
|
+
}
|
|
1001
|
+
let O = b$1(computed$2(() => ({ as: i2.as, type: x2.type })), e2.buttonRef);
|
|
1002
|
+
return () => {
|
|
1003
|
+
var w2, y;
|
|
1004
|
+
let t2 = { open: e2.listboxState.value === 0, disabled: e2.disabled.value }, l2 = { ref: e2.buttonRef, id: p2, type: O.value, "aria-haspopup": true, "aria-controls": (w2 = t$1(e2.optionsRef)) == null ? void 0 : w2.id, "aria-expanded": e2.disabled.value ? void 0 : e2.listboxState.value === 0, "aria-labelledby": e2.labelRef.value ? [(y = t$1(e2.labelRef)) == null ? void 0 : y.id, p2].join(" ") : void 0, disabled: e2.disabled.value === true ? true : void 0, onKeydown: d, onKeyup: m2, onClick: s2 };
|
|
1005
|
+
return k({ props: __spreadValues(__spreadValues({}, i2), l2), slot: t2, attrs: x2, slots: n2, name: "ListboxButton" });
|
|
1006
|
+
};
|
|
1007
|
+
} }), Ce = defineComponent({ name: "ListboxOptions", props: { as: { type: [Object, String], default: "ul" }, static: { type: Boolean, default: false }, unmount: { type: Boolean, default: true } }, setup(i2, { attrs: x2, slots: n2, expose: S2 }) {
|
|
1008
|
+
let e2 = P("ListboxOptions"), p2 = `headlessui-listbox-options-${t$2()}`, d = ref(null);
|
|
1009
|
+
S2({ el: e2.optionsRef, $el: e2.optionsRef });
|
|
1010
|
+
function m2(t2) {
|
|
1011
|
+
switch (d.value && clearTimeout(d.value), t2.key) {
|
|
1012
|
+
case o.Space:
|
|
1013
|
+
if (e2.searchQuery.value !== "")
|
|
1014
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.search(t2.key);
|
|
1015
|
+
case o.Enter:
|
|
1016
|
+
if (t2.preventDefault(), t2.stopPropagation(), e2.activeOptionIndex.value !== null) {
|
|
1017
|
+
let l2 = e2.options.value[e2.activeOptionIndex.value];
|
|
1018
|
+
e2.select(l2.dataRef.value);
|
|
1019
|
+
}
|
|
1020
|
+
e2.mode.value === 0 && (e2.closeListbox(), nextTick(() => {
|
|
1021
|
+
var l2;
|
|
1022
|
+
return (l2 = t$1(e2.buttonRef)) == null ? void 0 : l2.focus({ preventScroll: true });
|
|
1023
|
+
}));
|
|
1024
|
+
break;
|
|
1025
|
+
case u$2(e2.orientation.value, { vertical: o.ArrowDown, horizontal: o.ArrowRight }):
|
|
1026
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.goToOption(a$2.Next);
|
|
1027
|
+
case u$2(e2.orientation.value, { vertical: o.ArrowUp, horizontal: o.ArrowLeft }):
|
|
1028
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.goToOption(a$2.Previous);
|
|
1029
|
+
case o.Home:
|
|
1030
|
+
case o.PageUp:
|
|
1031
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.goToOption(a$2.First);
|
|
1032
|
+
case o.End:
|
|
1033
|
+
case o.PageDown:
|
|
1034
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.goToOption(a$2.Last);
|
|
1035
|
+
case o.Escape:
|
|
1036
|
+
t2.preventDefault(), t2.stopPropagation(), e2.closeListbox(), nextTick(() => {
|
|
1037
|
+
var l2;
|
|
1038
|
+
return (l2 = t$1(e2.buttonRef)) == null ? void 0 : l2.focus({ preventScroll: true });
|
|
1430
1039
|
});
|
|
1431
|
-
|
|
1432
|
-
|
|
1040
|
+
break;
|
|
1041
|
+
case o.Tab:
|
|
1042
|
+
t2.preventDefault(), t2.stopPropagation();
|
|
1043
|
+
break;
|
|
1433
1044
|
default:
|
|
1434
|
-
|
|
1045
|
+
t2.key.length === 1 && (e2.search(t2.key), d.value = setTimeout(() => e2.clearSearch(), 350));
|
|
1046
|
+
break;
|
|
1435
1047
|
}
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
var
|
|
1440
|
-
(
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
})
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1048
|
+
}
|
|
1049
|
+
let s2 = p$2(), O = computed$2(() => s2 !== null ? s2.value === l.Open : e2.listboxState.value === 0);
|
|
1050
|
+
return () => {
|
|
1051
|
+
var y, T2, r2, o2;
|
|
1052
|
+
let t2 = { open: e2.listboxState.value === 0 }, l2 = { "aria-activedescendant": e2.activeOptionIndex.value === null || (y = e2.options.value[e2.activeOptionIndex.value]) == null ? void 0 : y.id, "aria-multiselectable": e2.mode.value === 1 ? true : void 0, "aria-labelledby": (o2 = (T2 = t$1(e2.labelRef)) == null ? void 0 : T2.id) != null ? o2 : (r2 = t$1(e2.buttonRef)) == null ? void 0 : r2.id, "aria-orientation": e2.orientation.value, id: p2, onKeydown: m2, role: "listbox", tabIndex: 0, ref: e2.optionsRef };
|
|
1053
|
+
return k({ props: __spreadValues(__spreadValues({}, i2), l2), slot: t2, attrs: x2, slots: n2, features: h$1.RenderStrategy | h$1.Static, visible: O.value, name: "ListboxOptions" });
|
|
1054
|
+
};
|
|
1055
|
+
} }), Me = defineComponent({ name: "ListboxOption", props: { as: { type: [Object, String], default: "li" }, value: { type: [Object, String, Number, Boolean] }, disabled: { type: Boolean, default: false } }, setup(i2, { slots: x2, attrs: n2, expose: S2 }) {
|
|
1056
|
+
let e2 = P("ListboxOption"), p2 = `headlessui-listbox-option-${t$2()}`, d = ref(null);
|
|
1057
|
+
S2({ el: d, $el: d });
|
|
1058
|
+
let m2 = computed$2(() => e2.activeOptionIndex.value !== null ? e2.options.value[e2.activeOptionIndex.value].id === p2 : false), s2 = computed$2(() => u$2(e2.mode.value, { [0]: () => e2.compare(toRaw$1(e2.value.value), toRaw$1(i2.value)), [1]: () => toRaw$1(e2.value.value).some((r2) => e2.compare(toRaw$1(r2), toRaw$1(i2.value))) })), O = computed$2(() => u$2(e2.mode.value, { [1]: () => {
|
|
1059
|
+
var o2;
|
|
1060
|
+
let r2 = toRaw$1(e2.value.value);
|
|
1061
|
+
return ((o2 = e2.options.value.find((a2) => r2.some((u2) => e2.compare(toRaw$1(u2), toRaw$1(a2.dataRef.value))))) == null ? void 0 : o2.id) === p2;
|
|
1062
|
+
}, [0]: () => s2.value })), t2 = computed$2(() => ({ disabled: i2.disabled, value: i2.value, textValue: "", domRef: d }));
|
|
1063
|
+
onMounted(() => {
|
|
1064
|
+
var o2, a2;
|
|
1065
|
+
let r2 = (a2 = (o2 = t$1(d)) == null ? void 0 : o2.textContent) == null ? void 0 : a2.toLowerCase().trim();
|
|
1066
|
+
r2 !== void 0 && (t2.value.textValue = r2);
|
|
1067
|
+
}), onMounted(() => e2.registerOption(p2, t2)), onUnmounted(() => e2.unregisterOption(p2)), onMounted(() => {
|
|
1068
|
+
watch([e2.listboxState, s2], () => {
|
|
1069
|
+
e2.listboxState.value === 0 && (!s2.value || u$2(e2.mode.value, { [1]: () => {
|
|
1070
|
+
O.value && e2.goToOption(a$2.Specific, p2);
|
|
1071
|
+
}, [0]: () => {
|
|
1072
|
+
e2.goToOption(a$2.Specific, p2);
|
|
1073
|
+
} }));
|
|
1074
|
+
}, { immediate: true });
|
|
1075
|
+
}), watchEffect(() => {
|
|
1076
|
+
e2.listboxState.value === 0 && (!m2.value || e2.activationTrigger.value !== 0 && nextTick(() => {
|
|
1077
|
+
var r2, o2;
|
|
1078
|
+
return (o2 = (r2 = t$1(d)) == null ? void 0 : r2.scrollIntoView) == null ? void 0 : o2.call(r2, { block: "nearest" });
|
|
1079
|
+
}));
|
|
1447
1080
|
});
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1081
|
+
function l2(r2) {
|
|
1082
|
+
if (i2.disabled)
|
|
1083
|
+
return r2.preventDefault();
|
|
1084
|
+
e2.select(i2.value), e2.mode.value === 0 && (e2.closeListbox(), nextTick(() => {
|
|
1085
|
+
var o2;
|
|
1086
|
+
return (o2 = t$1(e2.buttonRef)) == null ? void 0 : o2.focus({ preventScroll: true });
|
|
1087
|
+
}));
|
|
1088
|
+
}
|
|
1089
|
+
function w2() {
|
|
1090
|
+
if (i2.disabled)
|
|
1091
|
+
return e2.goToOption(a$2.Nothing);
|
|
1092
|
+
e2.goToOption(a$2.Specific, p2);
|
|
1093
|
+
}
|
|
1094
|
+
function y() {
|
|
1095
|
+
i2.disabled || m2.value || e2.goToOption(a$2.Specific, p2, 0);
|
|
1096
|
+
}
|
|
1097
|
+
function T2() {
|
|
1098
|
+
i2.disabled || !m2.value || e2.goToOption(a$2.Nothing);
|
|
1099
|
+
}
|
|
1100
|
+
return () => {
|
|
1101
|
+
let { disabled: r2 } = i2, o2 = { active: m2.value, selected: s2.value, disabled: r2 }, a2 = { id: p2, ref: d, role: "option", tabIndex: r2 === true ? void 0 : -1, "aria-disabled": r2 === true ? true : void 0, "aria-selected": s2.value === true ? s2.value : void 0, disabled: void 0, onClick: l2, onFocus: w2, onPointermove: y, onMousemove: y, onPointerleave: T2, onMouseleave: T2 };
|
|
1102
|
+
return k({ props: __spreadValues(__spreadValues({}, R(i2, ["value", "disabled"])), a2), slot: o2, attrs: n2, slots: x2, name: "ListboxOption" });
|
|
1103
|
+
};
|
|
1104
|
+
} });
|
|
1105
|
+
var W = ((i2) => (i2[i2.Open = 0] = "Open", i2[i2.Closed = 1] = "Closed", i2))(W || {}), J = ((i2) => (i2[i2.Pointer = 0] = "Pointer", i2[i2.Other = 1] = "Other", i2))(J || {});
|
|
1106
|
+
function z(o2) {
|
|
1107
|
+
requestAnimationFrame(() => requestAnimationFrame(o2));
|
|
1108
|
+
}
|
|
1109
|
+
let E = Symbol("MenuContext");
|
|
1110
|
+
function D(o2) {
|
|
1111
|
+
let S2 = inject(E, null);
|
|
1112
|
+
if (S2 === null) {
|
|
1113
|
+
let i2 = new Error(`<${o2} /> is missing a parent <Menu /> component.`);
|
|
1114
|
+
throw Error.captureStackTrace && Error.captureStackTrace(i2, D), i2;
|
|
1115
|
+
}
|
|
1116
|
+
return S2;
|
|
1117
|
+
}
|
|
1118
|
+
let fe = defineComponent({ name: "Menu", props: { as: { type: [Object, String], default: "template" } }, setup(o2, { slots: S2, attrs: i2 }) {
|
|
1119
|
+
let v = ref(1), e2 = ref(null), p2 = ref(null), r2 = ref([]), f2 = ref(""), d = ref(null), I = ref(1);
|
|
1120
|
+
function l$1(u2 = (n2) => n2) {
|
|
1121
|
+
let n2 = d.value !== null ? r2.value[d.value] : null, a2 = w$2(u2(r2.value.slice()), (R2) => t$1(R2.dataRef.domRef)), s2 = n2 ? a2.indexOf(n2) : null;
|
|
1122
|
+
return s2 === -1 && (s2 = null), { items: a2, activeItemIndex: s2 };
|
|
1123
|
+
}
|
|
1124
|
+
let t2 = { menuState: v, buttonRef: e2, itemsRef: p2, items: r2, searchQuery: f2, activeItemIndex: d, activationTrigger: I, closeMenu: () => {
|
|
1125
|
+
v.value = 1, d.value = null;
|
|
1126
|
+
}, openMenu: () => v.value = 0, goToItem(u2, n2, a2) {
|
|
1127
|
+
let s2 = l$1(), R2 = x(u2 === a$2.Specific ? { focus: a$2.Specific, id: n2 } : { focus: u2 }, { resolveItems: () => s2.items, resolveActiveIndex: () => s2.activeItemIndex, resolveId: (M2) => M2.id, resolveDisabled: (M2) => M2.dataRef.disabled });
|
|
1128
|
+
f2.value = "", d.value = R2, I.value = a2 != null ? a2 : 1, r2.value = s2.items;
|
|
1129
|
+
}, search(u2) {
|
|
1130
|
+
let a2 = f2.value !== "" ? 0 : 1;
|
|
1131
|
+
f2.value += u2.toLowerCase();
|
|
1132
|
+
let R2 = (d.value !== null ? r2.value.slice(d.value + a2).concat(r2.value.slice(0, d.value + a2)) : r2.value).find((k2) => k2.dataRef.textValue.startsWith(f2.value) && !k2.dataRef.disabled), M2 = R2 ? r2.value.indexOf(R2) : -1;
|
|
1133
|
+
M2 === -1 || M2 === d.value || (d.value = M2, I.value = 1);
|
|
1134
|
+
}, clearSearch() {
|
|
1135
|
+
f2.value = "";
|
|
1136
|
+
}, registerItem(u2, n2) {
|
|
1137
|
+
let a2 = l$1((s2) => [...s2, { id: u2, dataRef: n2 }]);
|
|
1138
|
+
r2.value = a2.items, d.value = a2.activeItemIndex, I.value = 1;
|
|
1139
|
+
}, unregisterItem(u2) {
|
|
1140
|
+
let n2 = l$1((a2) => {
|
|
1141
|
+
let s2 = a2.findIndex((R2) => R2.id === u2);
|
|
1142
|
+
return s2 !== -1 && a2.splice(s2, 1), a2;
|
|
1143
|
+
});
|
|
1144
|
+
r2.value = n2.items, d.value = n2.activeItemIndex, I.value = 1;
|
|
1145
|
+
} };
|
|
1146
|
+
return w([e2, p2], (u2, n2) => {
|
|
1147
|
+
var a2;
|
|
1148
|
+
v.value === 0 && (t2.closeMenu(), F(n2, M.Loose) || (u2.preventDefault(), (a2 = t$1(e2)) == null || a2.focus()));
|
|
1149
|
+
}), provide(E, t2), c$1(computed$2(() => u$2(v.value, { [0]: l.Open, [1]: l.Closed }))), () => {
|
|
1150
|
+
let u2 = { open: v.value === 0 };
|
|
1151
|
+
return k({ props: o2, slot: u2, slots: S2, attrs: i2, name: "Menu" });
|
|
1152
|
+
};
|
|
1153
|
+
} }), me = defineComponent({ name: "MenuButton", props: { disabled: { type: Boolean, default: false }, as: { type: [Object, String], default: "button" } }, setup(o$1, { attrs: S2, slots: i2, expose: v }) {
|
|
1154
|
+
let e2 = D("MenuButton"), p2 = `headlessui-menu-button-${t$2()}`;
|
|
1155
|
+
v({ el: e2.buttonRef, $el: e2.buttonRef });
|
|
1156
|
+
function r2(l2) {
|
|
1157
|
+
switch (l2.key) {
|
|
1158
|
+
case o.Space:
|
|
1159
|
+
case o.Enter:
|
|
1160
|
+
case o.ArrowDown:
|
|
1161
|
+
l2.preventDefault(), l2.stopPropagation(), e2.openMenu(), nextTick(() => {
|
|
1162
|
+
var t2;
|
|
1163
|
+
(t2 = t$1(e2.itemsRef)) == null || t2.focus({ preventScroll: true }), e2.goToItem(a$2.First);
|
|
1164
|
+
});
|
|
1165
|
+
break;
|
|
1166
|
+
case o.ArrowUp:
|
|
1167
|
+
l2.preventDefault(), l2.stopPropagation(), e2.openMenu(), nextTick(() => {
|
|
1168
|
+
var t2;
|
|
1169
|
+
(t2 = t$1(e2.itemsRef)) == null || t2.focus({ preventScroll: true }), e2.goToItem(a$2.Last);
|
|
1170
|
+
});
|
|
1171
|
+
break;
|
|
1465
1172
|
}
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
disabled: {
|
|
1473
|
-
type: [Boolean],
|
|
1474
|
-
"default": false
|
|
1475
|
-
},
|
|
1476
|
-
horizontal: {
|
|
1477
|
-
type: [Boolean],
|
|
1478
|
-
"default": false
|
|
1479
|
-
},
|
|
1480
|
-
modelValue: {
|
|
1481
|
-
type: [Object, String, Number, Boolean]
|
|
1173
|
+
}
|
|
1174
|
+
function f2(l2) {
|
|
1175
|
+
switch (l2.key) {
|
|
1176
|
+
case o.Space:
|
|
1177
|
+
l2.preventDefault();
|
|
1178
|
+
break;
|
|
1482
1179
|
}
|
|
1483
|
-
},
|
|
1484
|
-
setup: function setup(props, _ref) {
|
|
1485
|
-
var slots = _ref.slots, attrs = _ref.attrs, emit = _ref.emit;
|
|
1486
|
-
var listboxState = ref(ListboxStates.Closed);
|
|
1487
|
-
var labelRef = ref(null);
|
|
1488
|
-
var buttonRef = ref(null);
|
|
1489
|
-
var optionsRef = ref(null);
|
|
1490
|
-
var options = ref([]);
|
|
1491
|
-
var searchQuery = ref("");
|
|
1492
|
-
var activeOptionIndex = ref(null);
|
|
1493
|
-
var value = computed$2(function() {
|
|
1494
|
-
return props.modelValue;
|
|
1495
|
-
});
|
|
1496
|
-
var api = {
|
|
1497
|
-
listboxState,
|
|
1498
|
-
value,
|
|
1499
|
-
orientation: computed$2(function() {
|
|
1500
|
-
return props.horizontal ? "horizontal" : "vertical";
|
|
1501
|
-
}),
|
|
1502
|
-
labelRef,
|
|
1503
|
-
buttonRef,
|
|
1504
|
-
optionsRef,
|
|
1505
|
-
disabled: computed$2(function() {
|
|
1506
|
-
return props.disabled;
|
|
1507
|
-
}),
|
|
1508
|
-
options,
|
|
1509
|
-
searchQuery,
|
|
1510
|
-
activeOptionIndex,
|
|
1511
|
-
closeListbox: function closeListbox() {
|
|
1512
|
-
if (props.disabled)
|
|
1513
|
-
return;
|
|
1514
|
-
if (listboxState.value === ListboxStates.Closed)
|
|
1515
|
-
return;
|
|
1516
|
-
listboxState.value = ListboxStates.Closed;
|
|
1517
|
-
activeOptionIndex.value = null;
|
|
1518
|
-
},
|
|
1519
|
-
openListbox: function openListbox() {
|
|
1520
|
-
if (props.disabled)
|
|
1521
|
-
return;
|
|
1522
|
-
if (listboxState.value === ListboxStates.Open)
|
|
1523
|
-
return;
|
|
1524
|
-
listboxState.value = ListboxStates.Open;
|
|
1525
|
-
},
|
|
1526
|
-
goToOption: function goToOption(focus, id2) {
|
|
1527
|
-
if (props.disabled)
|
|
1528
|
-
return;
|
|
1529
|
-
if (listboxState.value === ListboxStates.Closed)
|
|
1530
|
-
return;
|
|
1531
|
-
var nextActiveOptionIndex = calculateActiveIndex(focus === Focus.Specific ? {
|
|
1532
|
-
focus: Focus.Specific,
|
|
1533
|
-
id: id2
|
|
1534
|
-
} : {
|
|
1535
|
-
focus
|
|
1536
|
-
}, {
|
|
1537
|
-
resolveItems: function resolveItems() {
|
|
1538
|
-
return options.value;
|
|
1539
|
-
},
|
|
1540
|
-
resolveActiveIndex: function resolveActiveIndex() {
|
|
1541
|
-
return activeOptionIndex.value;
|
|
1542
|
-
},
|
|
1543
|
-
resolveId: function resolveId(option) {
|
|
1544
|
-
return option.id;
|
|
1545
|
-
},
|
|
1546
|
-
resolveDisabled: function resolveDisabled(option) {
|
|
1547
|
-
return option.dataRef.disabled;
|
|
1548
|
-
}
|
|
1549
|
-
});
|
|
1550
|
-
if (searchQuery.value === "" && activeOptionIndex.value === nextActiveOptionIndex)
|
|
1551
|
-
return;
|
|
1552
|
-
searchQuery.value = "";
|
|
1553
|
-
activeOptionIndex.value = nextActiveOptionIndex;
|
|
1554
|
-
},
|
|
1555
|
-
search: function search(value2) {
|
|
1556
|
-
if (props.disabled)
|
|
1557
|
-
return;
|
|
1558
|
-
if (listboxState.value === ListboxStates.Closed)
|
|
1559
|
-
return;
|
|
1560
|
-
searchQuery.value += value2.toLowerCase();
|
|
1561
|
-
var match2 = options.value.findIndex(function(option) {
|
|
1562
|
-
return !option.dataRef.disabled && option.dataRef.textValue.startsWith(searchQuery.value);
|
|
1563
|
-
});
|
|
1564
|
-
if (match2 === -1 || match2 === activeOptionIndex.value)
|
|
1565
|
-
return;
|
|
1566
|
-
activeOptionIndex.value = match2;
|
|
1567
|
-
},
|
|
1568
|
-
clearSearch: function clearSearch() {
|
|
1569
|
-
if (props.disabled)
|
|
1570
|
-
return;
|
|
1571
|
-
if (listboxState.value === ListboxStates.Closed)
|
|
1572
|
-
return;
|
|
1573
|
-
if (searchQuery.value === "")
|
|
1574
|
-
return;
|
|
1575
|
-
searchQuery.value = "";
|
|
1576
|
-
},
|
|
1577
|
-
registerOption: function registerOption(id2, dataRef) {
|
|
1578
|
-
options.value.push({
|
|
1579
|
-
id: id2,
|
|
1580
|
-
dataRef
|
|
1581
|
-
});
|
|
1582
|
-
},
|
|
1583
|
-
unregisterOption: function unregisterOption(id2) {
|
|
1584
|
-
var nextOptions = options.value.slice();
|
|
1585
|
-
var currentActiveOption = activeOptionIndex.value !== null ? nextOptions[activeOptionIndex.value] : null;
|
|
1586
|
-
var idx = nextOptions.findIndex(function(a) {
|
|
1587
|
-
return a.id === id2;
|
|
1588
|
-
});
|
|
1589
|
-
if (idx !== -1)
|
|
1590
|
-
nextOptions.splice(idx, 1);
|
|
1591
|
-
options.value = nextOptions;
|
|
1592
|
-
activeOptionIndex.value = function() {
|
|
1593
|
-
if (idx === activeOptionIndex.value)
|
|
1594
|
-
return null;
|
|
1595
|
-
if (currentActiveOption === null)
|
|
1596
|
-
return null;
|
|
1597
|
-
return nextOptions.indexOf(currentActiveOption);
|
|
1598
|
-
}();
|
|
1599
|
-
},
|
|
1600
|
-
select: function select(value2) {
|
|
1601
|
-
if (props.disabled)
|
|
1602
|
-
return;
|
|
1603
|
-
emit("update:modelValue", value2);
|
|
1604
|
-
}
|
|
1605
|
-
};
|
|
1606
|
-
useWindowEvent("mousedown", function(event) {
|
|
1607
|
-
var _dom, _dom2, _dom3;
|
|
1608
|
-
var target = event.target;
|
|
1609
|
-
var active = document.activeElement;
|
|
1610
|
-
if (listboxState.value !== ListboxStates.Open)
|
|
1611
|
-
return;
|
|
1612
|
-
if ((_dom = dom(buttonRef)) == null ? void 0 : _dom.contains(target))
|
|
1613
|
-
return;
|
|
1614
|
-
if (!((_dom2 = dom(optionsRef)) == null ? void 0 : _dom2.contains(target)))
|
|
1615
|
-
api.closeListbox();
|
|
1616
|
-
if (active !== document.body && (active == null ? void 0 : active.contains(target)))
|
|
1617
|
-
return;
|
|
1618
|
-
if (!event.defaultPrevented)
|
|
1619
|
-
(_dom3 = dom(buttonRef)) == null ? void 0 : _dom3.focus({
|
|
1620
|
-
preventScroll: true
|
|
1621
|
-
});
|
|
1622
|
-
});
|
|
1623
|
-
provide(ListboxContext, api);
|
|
1624
|
-
useOpenClosedProvider(computed$2(function() {
|
|
1625
|
-
var _match;
|
|
1626
|
-
return match(listboxState.value, (_match = {}, _match[ListboxStates.Open] = State.Open, _match[ListboxStates.Closed] = State.Closed, _match));
|
|
1627
|
-
}));
|
|
1628
|
-
return function() {
|
|
1629
|
-
var slot = {
|
|
1630
|
-
open: listboxState.value === ListboxStates.Open,
|
|
1631
|
-
disabled: props.disabled
|
|
1632
|
-
};
|
|
1633
|
-
return render({
|
|
1634
|
-
props: omit(props, ["modelValue", "onUpdate:modelValue", "disabled", "horizontal"]),
|
|
1635
|
-
slot,
|
|
1636
|
-
slots,
|
|
1637
|
-
attrs,
|
|
1638
|
-
name: "Listbox"
|
|
1639
|
-
});
|
|
1640
|
-
};
|
|
1641
|
-
}
|
|
1642
|
-
});
|
|
1643
|
-
var ListboxButton = /* @__PURE__ */ defineComponent({
|
|
1644
|
-
name: "ListboxButton",
|
|
1645
|
-
props: {
|
|
1646
|
-
as: {
|
|
1647
|
-
type: [Object, String],
|
|
1648
|
-
"default": "button"
|
|
1649
|
-
}
|
|
1650
|
-
},
|
|
1651
|
-
render: function render$1() {
|
|
1652
|
-
var _dom5, _dom6;
|
|
1653
|
-
var api = useListboxContext("ListboxButton");
|
|
1654
|
-
var slot = {
|
|
1655
|
-
open: api.listboxState.value === ListboxStates.Open,
|
|
1656
|
-
disabled: api.disabled.value
|
|
1657
|
-
};
|
|
1658
|
-
var propsWeControl = {
|
|
1659
|
-
ref: "el",
|
|
1660
|
-
id: this.id,
|
|
1661
|
-
type: this.type,
|
|
1662
|
-
"aria-haspopup": true,
|
|
1663
|
-
"aria-controls": (_dom5 = dom(api.optionsRef)) == null ? void 0 : _dom5.id,
|
|
1664
|
-
"aria-expanded": api.disabled.value ? void 0 : api.listboxState.value === ListboxStates.Open,
|
|
1665
|
-
"aria-labelledby": api.labelRef.value ? [(_dom6 = dom(api.labelRef)) == null ? void 0 : _dom6.id, this.id].join(" ") : void 0,
|
|
1666
|
-
disabled: api.disabled.value === true ? true : void 0,
|
|
1667
|
-
onKeydown: this.handleKeyDown,
|
|
1668
|
-
onKeyup: this.handleKeyUp,
|
|
1669
|
-
onClick: this.handleClick
|
|
1670
|
-
};
|
|
1671
|
-
return render({
|
|
1672
|
-
props: _extends({}, this.$props, propsWeControl),
|
|
1673
|
-
slot,
|
|
1674
|
-
attrs: this.$attrs,
|
|
1675
|
-
slots: this.$slots,
|
|
1676
|
-
name: "ListboxButton"
|
|
1677
|
-
});
|
|
1678
|
-
},
|
|
1679
|
-
setup: function setup2(props, _ref2) {
|
|
1680
|
-
var attrs = _ref2.attrs;
|
|
1681
|
-
var api = useListboxContext("ListboxButton");
|
|
1682
|
-
var id2 = "headlessui-listbox-button-" + useId();
|
|
1683
|
-
function handleKeyDown(event) {
|
|
1684
|
-
switch (event.key) {
|
|
1685
|
-
case Keys.Space:
|
|
1686
|
-
case Keys.Enter:
|
|
1687
|
-
case Keys.ArrowDown:
|
|
1688
|
-
event.preventDefault();
|
|
1689
|
-
api.openListbox();
|
|
1690
|
-
nextTick$1(function() {
|
|
1691
|
-
var _dom7;
|
|
1692
|
-
(_dom7 = dom(api.optionsRef)) == null ? void 0 : _dom7.focus({
|
|
1693
|
-
preventScroll: true
|
|
1694
|
-
});
|
|
1695
|
-
if (!api.value.value)
|
|
1696
|
-
api.goToOption(Focus.First);
|
|
1697
|
-
});
|
|
1698
|
-
break;
|
|
1699
|
-
case Keys.ArrowUp:
|
|
1700
|
-
event.preventDefault();
|
|
1701
|
-
api.openListbox();
|
|
1702
|
-
nextTick$1(function() {
|
|
1703
|
-
var _dom8;
|
|
1704
|
-
(_dom8 = dom(api.optionsRef)) == null ? void 0 : _dom8.focus({
|
|
1705
|
-
preventScroll: true
|
|
1706
|
-
});
|
|
1707
|
-
if (!api.value.value)
|
|
1708
|
-
api.goToOption(Focus.Last);
|
|
1709
|
-
});
|
|
1710
|
-
break;
|
|
1711
|
-
}
|
|
1712
|
-
}
|
|
1713
|
-
function handleKeyUp(event) {
|
|
1714
|
-
switch (event.key) {
|
|
1715
|
-
case Keys.Space:
|
|
1716
|
-
event.preventDefault();
|
|
1717
|
-
break;
|
|
1718
|
-
}
|
|
1719
|
-
}
|
|
1720
|
-
function handleClick(event) {
|
|
1721
|
-
if (api.disabled.value)
|
|
1722
|
-
return;
|
|
1723
|
-
if (api.listboxState.value === ListboxStates.Open) {
|
|
1724
|
-
api.closeListbox();
|
|
1725
|
-
nextTick$1(function() {
|
|
1726
|
-
var _dom9;
|
|
1727
|
-
return (_dom9 = dom(api.buttonRef)) == null ? void 0 : _dom9.focus({
|
|
1728
|
-
preventScroll: true
|
|
1729
|
-
});
|
|
1730
|
-
});
|
|
1731
|
-
} else {
|
|
1732
|
-
event.preventDefault();
|
|
1733
|
-
api.openListbox();
|
|
1734
|
-
nextFrame$1(function() {
|
|
1735
|
-
var _dom10;
|
|
1736
|
-
return (_dom10 = dom(api.optionsRef)) == null ? void 0 : _dom10.focus({
|
|
1737
|
-
preventScroll: true
|
|
1738
|
-
});
|
|
1739
|
-
});
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
return {
|
|
1743
|
-
id: id2,
|
|
1744
|
-
el: api.buttonRef,
|
|
1745
|
-
type: useResolveButtonType(computed$2(function() {
|
|
1746
|
-
return {
|
|
1747
|
-
as: props.as,
|
|
1748
|
-
type: attrs.type
|
|
1749
|
-
};
|
|
1750
|
-
}), api.buttonRef),
|
|
1751
|
-
handleKeyDown,
|
|
1752
|
-
handleKeyUp,
|
|
1753
|
-
handleClick
|
|
1754
|
-
};
|
|
1755
1180
|
}
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
}
|
|
1764
|
-
"static": {
|
|
1765
|
-
type: Boolean,
|
|
1766
|
-
"default": false
|
|
1767
|
-
},
|
|
1768
|
-
unmount: {
|
|
1769
|
-
type: Boolean,
|
|
1770
|
-
"default": true
|
|
1771
|
-
}
|
|
1772
|
-
},
|
|
1773
|
-
render: function render$12() {
|
|
1774
|
-
var _api$options$value$ap, _dom$id, _dom11, _dom12;
|
|
1775
|
-
var api = useListboxContext("ListboxOptions");
|
|
1776
|
-
var slot = {
|
|
1777
|
-
open: api.listboxState.value === ListboxStates.Open
|
|
1778
|
-
};
|
|
1779
|
-
var propsWeControl = {
|
|
1780
|
-
"aria-activedescendant": api.activeOptionIndex.value === null ? void 0 : (_api$options$value$ap = api.options.value[api.activeOptionIndex.value]) == null ? void 0 : _api$options$value$ap.id,
|
|
1781
|
-
"aria-labelledby": (_dom$id = (_dom11 = dom(api.labelRef)) == null ? void 0 : _dom11.id) != null ? _dom$id : (_dom12 = dom(api.buttonRef)) == null ? void 0 : _dom12.id,
|
|
1782
|
-
"aria-orientation": api.orientation.value,
|
|
1783
|
-
id: this.id,
|
|
1784
|
-
onKeydown: this.handleKeyDown,
|
|
1785
|
-
role: "listbox",
|
|
1786
|
-
tabIndex: 0,
|
|
1787
|
-
ref: "el"
|
|
1788
|
-
};
|
|
1789
|
-
var passThroughProps = this.$props;
|
|
1790
|
-
return render({
|
|
1791
|
-
props: _extends({}, passThroughProps, propsWeControl),
|
|
1792
|
-
slot,
|
|
1793
|
-
attrs: this.$attrs,
|
|
1794
|
-
slots: this.$slots,
|
|
1795
|
-
features: Features.RenderStrategy | Features.Static,
|
|
1796
|
-
visible: this.visible,
|
|
1797
|
-
name: "ListboxOptions"
|
|
1798
|
-
});
|
|
1799
|
-
},
|
|
1800
|
-
setup: function setup3() {
|
|
1801
|
-
var api = useListboxContext("ListboxOptions");
|
|
1802
|
-
var id2 = "headlessui-listbox-options-" + useId();
|
|
1803
|
-
var searchDebounce = ref(null);
|
|
1804
|
-
function handleKeyDown(event) {
|
|
1805
|
-
if (searchDebounce.value)
|
|
1806
|
-
clearTimeout(searchDebounce.value);
|
|
1807
|
-
switch (event.key) {
|
|
1808
|
-
case Keys.Space:
|
|
1809
|
-
if (api.searchQuery.value !== "") {
|
|
1810
|
-
event.preventDefault();
|
|
1811
|
-
event.stopPropagation();
|
|
1812
|
-
return api.search(event.key);
|
|
1813
|
-
}
|
|
1814
|
-
case Keys.Enter:
|
|
1815
|
-
event.preventDefault();
|
|
1816
|
-
event.stopPropagation();
|
|
1817
|
-
if (api.activeOptionIndex.value !== null) {
|
|
1818
|
-
var dataRef = api.options.value[api.activeOptionIndex.value].dataRef;
|
|
1819
|
-
api.select(dataRef.value);
|
|
1820
|
-
}
|
|
1821
|
-
api.closeListbox();
|
|
1822
|
-
nextTick$1(function() {
|
|
1823
|
-
var _dom13;
|
|
1824
|
-
return (_dom13 = dom(api.buttonRef)) == null ? void 0 : _dom13.focus({
|
|
1825
|
-
preventScroll: true
|
|
1826
|
-
});
|
|
1827
|
-
});
|
|
1828
|
-
break;
|
|
1829
|
-
case match(api.orientation.value, {
|
|
1830
|
-
vertical: Keys.ArrowDown,
|
|
1831
|
-
horizontal: Keys.ArrowRight
|
|
1832
|
-
}):
|
|
1833
|
-
event.preventDefault();
|
|
1834
|
-
event.stopPropagation();
|
|
1835
|
-
return api.goToOption(Focus.Next);
|
|
1836
|
-
case match(api.orientation.value, {
|
|
1837
|
-
vertical: Keys.ArrowUp,
|
|
1838
|
-
horizontal: Keys.ArrowLeft
|
|
1839
|
-
}):
|
|
1840
|
-
event.preventDefault();
|
|
1841
|
-
event.stopPropagation();
|
|
1842
|
-
return api.goToOption(Focus.Previous);
|
|
1843
|
-
case Keys.Home:
|
|
1844
|
-
case Keys.PageUp:
|
|
1845
|
-
event.preventDefault();
|
|
1846
|
-
event.stopPropagation();
|
|
1847
|
-
return api.goToOption(Focus.First);
|
|
1848
|
-
case Keys.End:
|
|
1849
|
-
case Keys.PageDown:
|
|
1850
|
-
event.preventDefault();
|
|
1851
|
-
event.stopPropagation();
|
|
1852
|
-
return api.goToOption(Focus.Last);
|
|
1853
|
-
case Keys.Escape:
|
|
1854
|
-
event.preventDefault();
|
|
1855
|
-
event.stopPropagation();
|
|
1856
|
-
api.closeListbox();
|
|
1857
|
-
nextTick$1(function() {
|
|
1858
|
-
var _dom14;
|
|
1859
|
-
return (_dom14 = dom(api.buttonRef)) == null ? void 0 : _dom14.focus({
|
|
1860
|
-
preventScroll: true
|
|
1861
|
-
});
|
|
1862
|
-
});
|
|
1863
|
-
break;
|
|
1864
|
-
case Keys.Tab:
|
|
1865
|
-
event.preventDefault();
|
|
1866
|
-
event.stopPropagation();
|
|
1867
|
-
break;
|
|
1868
|
-
default:
|
|
1869
|
-
if (event.key.length === 1) {
|
|
1870
|
-
api.search(event.key);
|
|
1871
|
-
searchDebounce.value = setTimeout(function() {
|
|
1872
|
-
return api.clearSearch();
|
|
1873
|
-
}, 350);
|
|
1874
|
-
}
|
|
1875
|
-
break;
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
var usesOpenClosedState = useOpenClosed();
|
|
1879
|
-
var visible = computed$2(function() {
|
|
1880
|
-
if (usesOpenClosedState !== null) {
|
|
1881
|
-
return usesOpenClosedState.value === State.Open;
|
|
1882
|
-
}
|
|
1883
|
-
return api.listboxState.value === ListboxStates.Open;
|
|
1884
|
-
});
|
|
1885
|
-
return {
|
|
1886
|
-
id: id2,
|
|
1887
|
-
el: api.optionsRef,
|
|
1888
|
-
handleKeyDown,
|
|
1889
|
-
visible
|
|
1890
|
-
};
|
|
1181
|
+
function d(l2) {
|
|
1182
|
+
o$1.disabled || (e2.menuState.value === 0 ? (e2.closeMenu(), nextTick(() => {
|
|
1183
|
+
var t2;
|
|
1184
|
+
return (t2 = t$1(e2.buttonRef)) == null ? void 0 : t2.focus({ preventScroll: true });
|
|
1185
|
+
})) : (l2.preventDefault(), l2.stopPropagation(), e2.openMenu(), z(() => {
|
|
1186
|
+
var t2;
|
|
1187
|
+
return (t2 = t$1(e2.itemsRef)) == null ? void 0 : t2.focus({ preventScroll: true });
|
|
1188
|
+
})));
|
|
1891
1189
|
}
|
|
1892
|
-
});
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
disabled: props.disabled,
|
|
1920
|
-
value: props.value,
|
|
1921
|
-
textValue: ""
|
|
1922
|
-
});
|
|
1923
|
-
onMounted(function() {
|
|
1924
|
-
var _document$getElementB, _document$getElementB2;
|
|
1925
|
-
var textValue = (_document$getElementB = document.getElementById(id2)) == null ? void 0 : (_document$getElementB2 = _document$getElementB.textContent) == null ? void 0 : _document$getElementB2.toLowerCase().trim();
|
|
1926
|
-
if (textValue !== void 0)
|
|
1927
|
-
dataRef.value.textValue = textValue;
|
|
1928
|
-
});
|
|
1929
|
-
onMounted(function() {
|
|
1930
|
-
return api.registerOption(id2, dataRef);
|
|
1931
|
-
});
|
|
1932
|
-
onUnmounted(function() {
|
|
1933
|
-
return api.unregisterOption(id2);
|
|
1934
|
-
});
|
|
1935
|
-
onMounted(function() {
|
|
1936
|
-
watch([api.listboxState, selected], function() {
|
|
1937
|
-
var _document$getElementB3;
|
|
1938
|
-
if (api.listboxState.value !== ListboxStates.Open)
|
|
1939
|
-
return;
|
|
1940
|
-
if (!selected.value)
|
|
1941
|
-
return;
|
|
1942
|
-
api.goToOption(Focus.Specific, id2);
|
|
1943
|
-
(_document$getElementB3 = document.getElementById(id2)) == null ? void 0 : _document$getElementB3.focus == null ? void 0 : _document$getElementB3.focus();
|
|
1944
|
-
}, {
|
|
1945
|
-
immediate: true
|
|
1946
|
-
});
|
|
1947
|
-
});
|
|
1948
|
-
watchEffect(function() {
|
|
1949
|
-
if (api.listboxState.value !== ListboxStates.Open)
|
|
1950
|
-
return;
|
|
1951
|
-
if (!active.value)
|
|
1952
|
-
return;
|
|
1953
|
-
nextTick$1(function() {
|
|
1954
|
-
var _document$getElementB4;
|
|
1955
|
-
return (_document$getElementB4 = document.getElementById(id2)) == null ? void 0 : _document$getElementB4.scrollIntoView == null ? void 0 : _document$getElementB4.scrollIntoView({
|
|
1956
|
-
block: "nearest"
|
|
1190
|
+
let I = b$1(computed$2(() => ({ as: o$1.as, type: S2.type })), e2.buttonRef);
|
|
1191
|
+
return () => {
|
|
1192
|
+
var u2;
|
|
1193
|
+
let l2 = { open: e2.menuState.value === 0 }, t2 = { ref: e2.buttonRef, id: p2, type: I.value, "aria-haspopup": true, "aria-controls": (u2 = t$1(e2.itemsRef)) == null ? void 0 : u2.id, "aria-expanded": o$1.disabled ? void 0 : e2.menuState.value === 0, onKeydown: r2, onKeyup: f2, onClick: d };
|
|
1194
|
+
return k({ props: __spreadValues(__spreadValues({}, o$1), t2), slot: l2, attrs: S2, slots: i2, name: "MenuButton" });
|
|
1195
|
+
};
|
|
1196
|
+
} }), pe = defineComponent({ name: "MenuItems", props: { as: { type: [Object, String], default: "div" }, static: { type: Boolean, default: false }, unmount: { type: Boolean, default: true } }, setup(o$1, { attrs: S2, slots: i2, expose: v }) {
|
|
1197
|
+
let e2 = D("MenuItems"), p2 = `headlessui-menu-items-${t$2()}`, r2 = ref(null);
|
|
1198
|
+
v({ el: e2.itemsRef, $el: e2.itemsRef }), p$1({ container: computed$2(() => t$1(e2.itemsRef)), enabled: computed$2(() => e2.menuState.value === 0), accept(t2) {
|
|
1199
|
+
return t2.getAttribute("role") === "menuitem" ? NodeFilter.FILTER_REJECT : t2.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT;
|
|
1200
|
+
}, walk(t2) {
|
|
1201
|
+
t2.setAttribute("role", "none");
|
|
1202
|
+
} });
|
|
1203
|
+
function f2(t2) {
|
|
1204
|
+
var u2;
|
|
1205
|
+
switch (r2.value && clearTimeout(r2.value), t2.key) {
|
|
1206
|
+
case o.Space:
|
|
1207
|
+
if (e2.searchQuery.value !== "")
|
|
1208
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.search(t2.key);
|
|
1209
|
+
case o.Enter:
|
|
1210
|
+
if (t2.preventDefault(), t2.stopPropagation(), e2.activeItemIndex.value !== null) {
|
|
1211
|
+
let a2 = e2.items.value[e2.activeItemIndex.value];
|
|
1212
|
+
(u2 = t$1(a2.dataRef.domRef)) == null || u2.click();
|
|
1213
|
+
}
|
|
1214
|
+
e2.closeMenu(), nextTick(() => {
|
|
1215
|
+
var n2;
|
|
1216
|
+
return (n2 = t$1(e2.buttonRef)) == null ? void 0 : n2.focus({ preventScroll: true });
|
|
1957
1217
|
});
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
return
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1218
|
+
break;
|
|
1219
|
+
case o.ArrowDown:
|
|
1220
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.goToItem(a$2.Next);
|
|
1221
|
+
case o.ArrowUp:
|
|
1222
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.goToItem(a$2.Previous);
|
|
1223
|
+
case o.Home:
|
|
1224
|
+
case o.PageUp:
|
|
1225
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.goToItem(a$2.First);
|
|
1226
|
+
case o.End:
|
|
1227
|
+
case o.PageDown:
|
|
1228
|
+
return t2.preventDefault(), t2.stopPropagation(), e2.goToItem(a$2.Last);
|
|
1229
|
+
case o.Escape:
|
|
1230
|
+
t2.preventDefault(), t2.stopPropagation(), e2.closeMenu(), nextTick(() => {
|
|
1231
|
+
var n2;
|
|
1232
|
+
return (n2 = t$1(e2.buttonRef)) == null ? void 0 : n2.focus({ preventScroll: true });
|
|
1969
1233
|
});
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
function handleMove() {
|
|
1978
|
-
if (props.disabled)
|
|
1979
|
-
return;
|
|
1980
|
-
if (active.value)
|
|
1981
|
-
return;
|
|
1982
|
-
api.goToOption(Focus.Specific, id2);
|
|
1983
|
-
}
|
|
1984
|
-
function handleLeave() {
|
|
1985
|
-
if (props.disabled)
|
|
1986
|
-
return;
|
|
1987
|
-
if (!active.value)
|
|
1988
|
-
return;
|
|
1989
|
-
api.goToOption(Focus.Nothing);
|
|
1234
|
+
break;
|
|
1235
|
+
case o.Tab:
|
|
1236
|
+
t2.preventDefault(), t2.stopPropagation();
|
|
1237
|
+
break;
|
|
1238
|
+
default:
|
|
1239
|
+
t2.key.length === 1 && (e2.search(t2.key), r2.value = setTimeout(() => e2.clearSearch(), 350));
|
|
1240
|
+
break;
|
|
1990
1241
|
}
|
|
1991
|
-
return function() {
|
|
1992
|
-
var disabled = props.disabled;
|
|
1993
|
-
var slot = {
|
|
1994
|
-
active: active.value,
|
|
1995
|
-
selected: selected.value,
|
|
1996
|
-
disabled
|
|
1997
|
-
};
|
|
1998
|
-
var propsWeControl = {
|
|
1999
|
-
id: id2,
|
|
2000
|
-
role: "option",
|
|
2001
|
-
tabIndex: disabled === true ? void 0 : -1,
|
|
2002
|
-
"aria-disabled": disabled === true ? true : void 0,
|
|
2003
|
-
"aria-selected": selected.value === true ? selected.value : void 0,
|
|
2004
|
-
disabled: void 0,
|
|
2005
|
-
onClick: handleClick,
|
|
2006
|
-
onFocus: handleFocus,
|
|
2007
|
-
onPointermove: handleMove,
|
|
2008
|
-
onMousemove: handleMove,
|
|
2009
|
-
onPointerleave: handleLeave,
|
|
2010
|
-
onMouseleave: handleLeave
|
|
2011
|
-
};
|
|
2012
|
-
return render({
|
|
2013
|
-
props: _extends({}, props, propsWeControl),
|
|
2014
|
-
slot,
|
|
2015
|
-
attrs,
|
|
2016
|
-
slots,
|
|
2017
|
-
name: "ListboxOption"
|
|
2018
|
-
});
|
|
2019
|
-
};
|
|
2020
1242
|
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
if (!root)
|
|
2027
|
-
return;
|
|
2028
|
-
if (enabled !== void 0 && !enabled.value)
|
|
2029
|
-
return;
|
|
2030
|
-
var acceptNode = Object.assign(function(node) {
|
|
2031
|
-
return accept(node);
|
|
2032
|
-
}, {
|
|
2033
|
-
acceptNode: accept
|
|
2034
|
-
});
|
|
2035
|
-
var walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT, acceptNode, false);
|
|
2036
|
-
while (walker.nextNode()) {
|
|
2037
|
-
walk(walker.currentNode);
|
|
1243
|
+
function d(t2) {
|
|
1244
|
+
switch (t2.key) {
|
|
1245
|
+
case o.Space:
|
|
1246
|
+
t2.preventDefault();
|
|
1247
|
+
break;
|
|
2038
1248
|
}
|
|
2039
|
-
});
|
|
2040
|
-
}
|
|
2041
|
-
var MenuStates;
|
|
2042
|
-
(function(MenuStates2) {
|
|
2043
|
-
MenuStates2[MenuStates2["Open"] = 0] = "Open";
|
|
2044
|
-
MenuStates2[MenuStates2["Closed"] = 1] = "Closed";
|
|
2045
|
-
})(MenuStates || (MenuStates = {}));
|
|
2046
|
-
function nextFrame(cb) {
|
|
2047
|
-
requestAnimationFrame(function() {
|
|
2048
|
-
return requestAnimationFrame(cb);
|
|
2049
|
-
});
|
|
2050
|
-
}
|
|
2051
|
-
var MenuContext = /* @__PURE__ */ Symbol("MenuContext");
|
|
2052
|
-
function useMenuContext(component) {
|
|
2053
|
-
var context = inject(MenuContext, null);
|
|
2054
|
-
if (context === null) {
|
|
2055
|
-
var err = new Error("<" + component + " /> is missing a parent <Menu /> component.");
|
|
2056
|
-
if (Error.captureStackTrace)
|
|
2057
|
-
Error.captureStackTrace(err, useMenuContext);
|
|
2058
|
-
throw err;
|
|
2059
1249
|
}
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
var
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
}
|
|
2070
|
-
|
|
2071
|
-
var
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
var api = {
|
|
2079
|
-
menuState,
|
|
2080
|
-
buttonRef,
|
|
2081
|
-
itemsRef,
|
|
2082
|
-
items,
|
|
2083
|
-
searchQuery,
|
|
2084
|
-
activeItemIndex,
|
|
2085
|
-
closeMenu: function closeMenu() {
|
|
2086
|
-
menuState.value = MenuStates.Closed;
|
|
2087
|
-
activeItemIndex.value = null;
|
|
2088
|
-
},
|
|
2089
|
-
openMenu: function openMenu() {
|
|
2090
|
-
return menuState.value = MenuStates.Open;
|
|
2091
|
-
},
|
|
2092
|
-
goToItem: function goToItem(focus, id2) {
|
|
2093
|
-
var nextActiveItemIndex = calculateActiveIndex(focus === Focus.Specific ? {
|
|
2094
|
-
focus: Focus.Specific,
|
|
2095
|
-
id: id2
|
|
2096
|
-
} : {
|
|
2097
|
-
focus
|
|
2098
|
-
}, {
|
|
2099
|
-
resolveItems: function resolveItems() {
|
|
2100
|
-
return items.value;
|
|
2101
|
-
},
|
|
2102
|
-
resolveActiveIndex: function resolveActiveIndex() {
|
|
2103
|
-
return activeItemIndex.value;
|
|
2104
|
-
},
|
|
2105
|
-
resolveId: function resolveId(item) {
|
|
2106
|
-
return item.id;
|
|
2107
|
-
},
|
|
2108
|
-
resolveDisabled: function resolveDisabled(item) {
|
|
2109
|
-
return item.dataRef.disabled;
|
|
2110
|
-
}
|
|
2111
|
-
});
|
|
2112
|
-
if (searchQuery.value === "" && activeItemIndex.value === nextActiveItemIndex)
|
|
2113
|
-
return;
|
|
2114
|
-
searchQuery.value = "";
|
|
2115
|
-
activeItemIndex.value = nextActiveItemIndex;
|
|
2116
|
-
},
|
|
2117
|
-
search: function search(value) {
|
|
2118
|
-
searchQuery.value += value.toLowerCase();
|
|
2119
|
-
var match2 = items.value.findIndex(function(item) {
|
|
2120
|
-
return item.dataRef.textValue.startsWith(searchQuery.value) && !item.dataRef.disabled;
|
|
2121
|
-
});
|
|
2122
|
-
if (match2 === -1 || match2 === activeItemIndex.value)
|
|
2123
|
-
return;
|
|
2124
|
-
activeItemIndex.value = match2;
|
|
2125
|
-
},
|
|
2126
|
-
clearSearch: function clearSearch() {
|
|
2127
|
-
searchQuery.value = "";
|
|
2128
|
-
},
|
|
2129
|
-
registerItem: function registerItem(id2, dataRef) {
|
|
2130
|
-
items.value.push({
|
|
2131
|
-
id: id2,
|
|
2132
|
-
dataRef
|
|
2133
|
-
});
|
|
2134
|
-
},
|
|
2135
|
-
unregisterItem: function unregisterItem(id2) {
|
|
2136
|
-
var nextItems = items.value.slice();
|
|
2137
|
-
var currentActiveItem = activeItemIndex.value !== null ? nextItems[activeItemIndex.value] : null;
|
|
2138
|
-
var idx = nextItems.findIndex(function(a) {
|
|
2139
|
-
return a.id === id2;
|
|
2140
|
-
});
|
|
2141
|
-
if (idx !== -1)
|
|
2142
|
-
nextItems.splice(idx, 1);
|
|
2143
|
-
items.value = nextItems;
|
|
2144
|
-
activeItemIndex.value = function() {
|
|
2145
|
-
if (idx === activeItemIndex.value)
|
|
2146
|
-
return null;
|
|
2147
|
-
if (currentActiveItem === null)
|
|
2148
|
-
return null;
|
|
2149
|
-
return nextItems.indexOf(currentActiveItem);
|
|
2150
|
-
}();
|
|
2151
|
-
}
|
|
2152
|
-
};
|
|
2153
|
-
useWindowEvent("mousedown", function(event) {
|
|
2154
|
-
var _dom, _dom2, _dom3;
|
|
2155
|
-
var target = event.target;
|
|
2156
|
-
var active = document.activeElement;
|
|
2157
|
-
if (menuState.value !== MenuStates.Open)
|
|
2158
|
-
return;
|
|
2159
|
-
if ((_dom = dom(buttonRef)) == null ? void 0 : _dom.contains(target))
|
|
2160
|
-
return;
|
|
2161
|
-
if (!((_dom2 = dom(itemsRef)) == null ? void 0 : _dom2.contains(target)))
|
|
2162
|
-
api.closeMenu();
|
|
2163
|
-
if (active !== document.body && (active == null ? void 0 : active.contains(target)))
|
|
2164
|
-
return;
|
|
2165
|
-
if (!event.defaultPrevented)
|
|
2166
|
-
(_dom3 = dom(buttonRef)) == null ? void 0 : _dom3.focus({
|
|
2167
|
-
preventScroll: true
|
|
2168
|
-
});
|
|
2169
|
-
});
|
|
2170
|
-
provide(MenuContext, api);
|
|
2171
|
-
useOpenClosedProvider(computed$2(function() {
|
|
2172
|
-
var _match;
|
|
2173
|
-
return match(menuState.value, (_match = {}, _match[MenuStates.Open] = State.Open, _match[MenuStates.Closed] = State.Closed, _match));
|
|
1250
|
+
let I = p$2(), l$1 = computed$2(() => I !== null ? I.value === l.Open : e2.menuState.value === 0);
|
|
1251
|
+
return () => {
|
|
1252
|
+
var a2, s2;
|
|
1253
|
+
let t2 = { open: e2.menuState.value === 0 }, u2 = { "aria-activedescendant": e2.activeItemIndex.value === null || (a2 = e2.items.value[e2.activeItemIndex.value]) == null ? void 0 : a2.id, "aria-labelledby": (s2 = t$1(e2.buttonRef)) == null ? void 0 : s2.id, id: p2, onKeydown: f2, onKeyup: d, role: "menu", tabIndex: 0, ref: e2.itemsRef };
|
|
1254
|
+
return k({ props: __spreadValues(__spreadValues({}, o$1), u2), slot: t2, attrs: S2, slots: i2, features: h$1.RenderStrategy | h$1.Static, visible: l$1.value, name: "MenuItems" });
|
|
1255
|
+
};
|
|
1256
|
+
} }), ve = defineComponent({ name: "MenuItem", props: { as: { type: [Object, String], default: "template" }, disabled: { type: Boolean, default: false } }, setup(o2, { slots: S2, attrs: i2, expose: v }) {
|
|
1257
|
+
let e2 = D("MenuItem"), p2 = `headlessui-menu-item-${t$2()}`, r2 = ref(null);
|
|
1258
|
+
v({ el: r2, $el: r2 });
|
|
1259
|
+
let f2 = computed$2(() => e2.activeItemIndex.value !== null ? e2.items.value[e2.activeItemIndex.value].id === p2 : false), d = computed$2(() => ({ disabled: o2.disabled, textValue: "", domRef: r2 }));
|
|
1260
|
+
onMounted(() => {
|
|
1261
|
+
var a2, s2;
|
|
1262
|
+
let n2 = (s2 = (a2 = t$1(r2)) == null ? void 0 : a2.textContent) == null ? void 0 : s2.toLowerCase().trim();
|
|
1263
|
+
n2 !== void 0 && (d.value.textValue = n2);
|
|
1264
|
+
}), onMounted(() => e2.registerItem(p2, d)), onUnmounted(() => e2.unregisterItem(p2)), watchEffect(() => {
|
|
1265
|
+
e2.menuState.value === 0 && (!f2.value || e2.activationTrigger.value !== 0 && nextTick(() => {
|
|
1266
|
+
var n2, a2;
|
|
1267
|
+
return (a2 = (n2 = t$1(r2)) == null ? void 0 : n2.scrollIntoView) == null ? void 0 : a2.call(n2, { block: "nearest" });
|
|
2174
1268
|
}));
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
slots,
|
|
2183
|
-
attrs,
|
|
2184
|
-
name: "Menu"
|
|
2185
|
-
});
|
|
2186
|
-
};
|
|
2187
|
-
}
|
|
2188
|
-
});
|
|
2189
|
-
var MenuButton = /* @__PURE__ */ defineComponent({
|
|
2190
|
-
name: "MenuButton",
|
|
2191
|
-
props: {
|
|
2192
|
-
disabled: {
|
|
2193
|
-
type: Boolean,
|
|
2194
|
-
"default": false
|
|
2195
|
-
},
|
|
2196
|
-
as: {
|
|
2197
|
-
type: [Object, String],
|
|
2198
|
-
"default": "button"
|
|
2199
|
-
}
|
|
2200
|
-
},
|
|
2201
|
-
render: function render$13() {
|
|
2202
|
-
var _dom4;
|
|
2203
|
-
var api = useMenuContext("MenuButton");
|
|
2204
|
-
var slot = {
|
|
2205
|
-
open: api.menuState.value === MenuStates.Open
|
|
2206
|
-
};
|
|
2207
|
-
var propsWeControl = {
|
|
2208
|
-
ref: "el",
|
|
2209
|
-
id: this.id,
|
|
2210
|
-
type: this.type,
|
|
2211
|
-
"aria-haspopup": true,
|
|
2212
|
-
"aria-controls": (_dom4 = dom(api.itemsRef)) == null ? void 0 : _dom4.id,
|
|
2213
|
-
"aria-expanded": this.$props.disabled ? void 0 : api.menuState.value === MenuStates.Open,
|
|
2214
|
-
onKeydown: this.handleKeyDown,
|
|
2215
|
-
onKeyup: this.handleKeyUp,
|
|
2216
|
-
onClick: this.handleClick
|
|
2217
|
-
};
|
|
2218
|
-
return render({
|
|
2219
|
-
props: _extends({}, this.$props, propsWeControl),
|
|
2220
|
-
slot,
|
|
2221
|
-
attrs: this.$attrs,
|
|
2222
|
-
slots: this.$slots,
|
|
2223
|
-
name: "MenuButton"
|
|
1269
|
+
});
|
|
1270
|
+
function I(n2) {
|
|
1271
|
+
if (o2.disabled)
|
|
1272
|
+
return n2.preventDefault();
|
|
1273
|
+
e2.closeMenu(), nextTick(() => {
|
|
1274
|
+
var a2;
|
|
1275
|
+
return (a2 = t$1(e2.buttonRef)) == null ? void 0 : a2.focus({ preventScroll: true });
|
|
2224
1276
|
});
|
|
2225
|
-
},
|
|
2226
|
-
setup: function setup6(props, _ref2) {
|
|
2227
|
-
var attrs = _ref2.attrs;
|
|
2228
|
-
var api = useMenuContext("MenuButton");
|
|
2229
|
-
var id2 = "headlessui-menu-button-" + useId();
|
|
2230
|
-
function handleKeyDown(event) {
|
|
2231
|
-
switch (event.key) {
|
|
2232
|
-
case Keys.Space:
|
|
2233
|
-
case Keys.Enter:
|
|
2234
|
-
case Keys.ArrowDown:
|
|
2235
|
-
event.preventDefault();
|
|
2236
|
-
event.stopPropagation();
|
|
2237
|
-
api.openMenu();
|
|
2238
|
-
nextTick$1(function() {
|
|
2239
|
-
var _dom5;
|
|
2240
|
-
(_dom5 = dom(api.itemsRef)) == null ? void 0 : _dom5.focus({
|
|
2241
|
-
preventScroll: true
|
|
2242
|
-
});
|
|
2243
|
-
api.goToItem(Focus.First);
|
|
2244
|
-
});
|
|
2245
|
-
break;
|
|
2246
|
-
case Keys.ArrowUp:
|
|
2247
|
-
event.preventDefault();
|
|
2248
|
-
event.stopPropagation();
|
|
2249
|
-
api.openMenu();
|
|
2250
|
-
nextTick$1(function() {
|
|
2251
|
-
var _dom6;
|
|
2252
|
-
(_dom6 = dom(api.itemsRef)) == null ? void 0 : _dom6.focus({
|
|
2253
|
-
preventScroll: true
|
|
2254
|
-
});
|
|
2255
|
-
api.goToItem(Focus.Last);
|
|
2256
|
-
});
|
|
2257
|
-
break;
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
function handleKeyUp(event) {
|
|
2261
|
-
switch (event.key) {
|
|
2262
|
-
case Keys.Space:
|
|
2263
|
-
event.preventDefault();
|
|
2264
|
-
break;
|
|
2265
|
-
}
|
|
2266
|
-
}
|
|
2267
|
-
function handleClick(event) {
|
|
2268
|
-
if (props.disabled)
|
|
2269
|
-
return;
|
|
2270
|
-
if (api.menuState.value === MenuStates.Open) {
|
|
2271
|
-
api.closeMenu();
|
|
2272
|
-
nextTick$1(function() {
|
|
2273
|
-
var _dom7;
|
|
2274
|
-
return (_dom7 = dom(api.buttonRef)) == null ? void 0 : _dom7.focus({
|
|
2275
|
-
preventScroll: true
|
|
2276
|
-
});
|
|
2277
|
-
});
|
|
2278
|
-
} else {
|
|
2279
|
-
event.preventDefault();
|
|
2280
|
-
event.stopPropagation();
|
|
2281
|
-
api.openMenu();
|
|
2282
|
-
nextFrame(function() {
|
|
2283
|
-
var _dom8;
|
|
2284
|
-
return (_dom8 = dom(api.itemsRef)) == null ? void 0 : _dom8.focus({
|
|
2285
|
-
preventScroll: true
|
|
2286
|
-
});
|
|
2287
|
-
});
|
|
2288
|
-
}
|
|
2289
|
-
}
|
|
2290
|
-
return {
|
|
2291
|
-
id: id2,
|
|
2292
|
-
el: api.buttonRef,
|
|
2293
|
-
type: useResolveButtonType(computed$2(function() {
|
|
2294
|
-
return {
|
|
2295
|
-
as: props.as,
|
|
2296
|
-
type: attrs.type
|
|
2297
|
-
};
|
|
2298
|
-
}), api.buttonRef),
|
|
2299
|
-
handleKeyDown,
|
|
2300
|
-
handleKeyUp,
|
|
2301
|
-
handleClick
|
|
2302
|
-
};
|
|
2303
1277
|
}
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
as: {
|
|
2309
|
-
type: [Object, String],
|
|
2310
|
-
"default": "div"
|
|
2311
|
-
},
|
|
2312
|
-
"static": {
|
|
2313
|
-
type: Boolean,
|
|
2314
|
-
"default": false
|
|
2315
|
-
},
|
|
2316
|
-
unmount: {
|
|
2317
|
-
type: Boolean,
|
|
2318
|
-
"default": true
|
|
2319
|
-
}
|
|
2320
|
-
},
|
|
2321
|
-
render: function render$14() {
|
|
2322
|
-
var _api$items$value$api$, _dom9;
|
|
2323
|
-
var api = useMenuContext("MenuItems");
|
|
2324
|
-
var slot = {
|
|
2325
|
-
open: api.menuState.value === MenuStates.Open
|
|
2326
|
-
};
|
|
2327
|
-
var propsWeControl = {
|
|
2328
|
-
"aria-activedescendant": api.activeItemIndex.value === null ? void 0 : (_api$items$value$api$ = api.items.value[api.activeItemIndex.value]) == null ? void 0 : _api$items$value$api$.id,
|
|
2329
|
-
"aria-labelledby": (_dom9 = dom(api.buttonRef)) == null ? void 0 : _dom9.id,
|
|
2330
|
-
id: this.id,
|
|
2331
|
-
onKeydown: this.handleKeyDown,
|
|
2332
|
-
onKeyup: this.handleKeyUp,
|
|
2333
|
-
role: "menu",
|
|
2334
|
-
tabIndex: 0,
|
|
2335
|
-
ref: "el"
|
|
2336
|
-
};
|
|
2337
|
-
var passThroughProps = this.$props;
|
|
2338
|
-
return render({
|
|
2339
|
-
props: _extends({}, passThroughProps, propsWeControl),
|
|
2340
|
-
slot,
|
|
2341
|
-
attrs: this.$attrs,
|
|
2342
|
-
slots: this.$slots,
|
|
2343
|
-
features: Features.RenderStrategy | Features.Static,
|
|
2344
|
-
visible: this.visible,
|
|
2345
|
-
name: "MenuItems"
|
|
2346
|
-
});
|
|
2347
|
-
},
|
|
2348
|
-
setup: function setup7() {
|
|
2349
|
-
var api = useMenuContext("MenuItems");
|
|
2350
|
-
var id2 = "headlessui-menu-items-" + useId();
|
|
2351
|
-
var searchDebounce = ref(null);
|
|
2352
|
-
useTreeWalker({
|
|
2353
|
-
container: computed$2(function() {
|
|
2354
|
-
return dom(api.itemsRef);
|
|
2355
|
-
}),
|
|
2356
|
-
enabled: computed$2(function() {
|
|
2357
|
-
return api.menuState.value === MenuStates.Open;
|
|
2358
|
-
}),
|
|
2359
|
-
accept: function accept(node) {
|
|
2360
|
-
if (node.getAttribute("role") === "menuitem")
|
|
2361
|
-
return NodeFilter.FILTER_REJECT;
|
|
2362
|
-
if (node.hasAttribute("role"))
|
|
2363
|
-
return NodeFilter.FILTER_SKIP;
|
|
2364
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
2365
|
-
},
|
|
2366
|
-
walk: function walk(node) {
|
|
2367
|
-
node.setAttribute("role", "none");
|
|
2368
|
-
}
|
|
2369
|
-
});
|
|
2370
|
-
function handleKeyDown(event) {
|
|
2371
|
-
if (searchDebounce.value)
|
|
2372
|
-
clearTimeout(searchDebounce.value);
|
|
2373
|
-
switch (event.key) {
|
|
2374
|
-
case Keys.Space:
|
|
2375
|
-
if (api.searchQuery.value !== "") {
|
|
2376
|
-
event.preventDefault();
|
|
2377
|
-
event.stopPropagation();
|
|
2378
|
-
return api.search(event.key);
|
|
2379
|
-
}
|
|
2380
|
-
case Keys.Enter:
|
|
2381
|
-
event.preventDefault();
|
|
2382
|
-
event.stopPropagation();
|
|
2383
|
-
if (api.activeItemIndex.value !== null) {
|
|
2384
|
-
var _document$getElementB;
|
|
2385
|
-
var _id = api.items.value[api.activeItemIndex.value].id;
|
|
2386
|
-
(_document$getElementB = document.getElementById(_id)) == null ? void 0 : _document$getElementB.click();
|
|
2387
|
-
}
|
|
2388
|
-
api.closeMenu();
|
|
2389
|
-
nextTick$1(function() {
|
|
2390
|
-
var _dom10;
|
|
2391
|
-
return (_dom10 = dom(api.buttonRef)) == null ? void 0 : _dom10.focus({
|
|
2392
|
-
preventScroll: true
|
|
2393
|
-
});
|
|
2394
|
-
});
|
|
2395
|
-
break;
|
|
2396
|
-
case Keys.ArrowDown:
|
|
2397
|
-
event.preventDefault();
|
|
2398
|
-
event.stopPropagation();
|
|
2399
|
-
return api.goToItem(Focus.Next);
|
|
2400
|
-
case Keys.ArrowUp:
|
|
2401
|
-
event.preventDefault();
|
|
2402
|
-
event.stopPropagation();
|
|
2403
|
-
return api.goToItem(Focus.Previous);
|
|
2404
|
-
case Keys.Home:
|
|
2405
|
-
case Keys.PageUp:
|
|
2406
|
-
event.preventDefault();
|
|
2407
|
-
event.stopPropagation();
|
|
2408
|
-
return api.goToItem(Focus.First);
|
|
2409
|
-
case Keys.End:
|
|
2410
|
-
case Keys.PageDown:
|
|
2411
|
-
event.preventDefault();
|
|
2412
|
-
event.stopPropagation();
|
|
2413
|
-
return api.goToItem(Focus.Last);
|
|
2414
|
-
case Keys.Escape:
|
|
2415
|
-
event.preventDefault();
|
|
2416
|
-
event.stopPropagation();
|
|
2417
|
-
api.closeMenu();
|
|
2418
|
-
nextTick$1(function() {
|
|
2419
|
-
var _dom11;
|
|
2420
|
-
return (_dom11 = dom(api.buttonRef)) == null ? void 0 : _dom11.focus({
|
|
2421
|
-
preventScroll: true
|
|
2422
|
-
});
|
|
2423
|
-
});
|
|
2424
|
-
break;
|
|
2425
|
-
case Keys.Tab:
|
|
2426
|
-
event.preventDefault();
|
|
2427
|
-
event.stopPropagation();
|
|
2428
|
-
break;
|
|
2429
|
-
default:
|
|
2430
|
-
if (event.key.length === 1) {
|
|
2431
|
-
api.search(event.key);
|
|
2432
|
-
searchDebounce.value = setTimeout(function() {
|
|
2433
|
-
return api.clearSearch();
|
|
2434
|
-
}, 350);
|
|
2435
|
-
}
|
|
2436
|
-
break;
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
function handleKeyUp(event) {
|
|
2440
|
-
switch (event.key) {
|
|
2441
|
-
case Keys.Space:
|
|
2442
|
-
event.preventDefault();
|
|
2443
|
-
break;
|
|
2444
|
-
}
|
|
2445
|
-
}
|
|
2446
|
-
var usesOpenClosedState = useOpenClosed();
|
|
2447
|
-
var visible = computed$2(function() {
|
|
2448
|
-
if (usesOpenClosedState !== null) {
|
|
2449
|
-
return usesOpenClosedState.value === State.Open;
|
|
2450
|
-
}
|
|
2451
|
-
return api.menuState.value === MenuStates.Open;
|
|
2452
|
-
});
|
|
2453
|
-
return {
|
|
2454
|
-
id: id2,
|
|
2455
|
-
el: api.itemsRef,
|
|
2456
|
-
handleKeyDown,
|
|
2457
|
-
handleKeyUp,
|
|
2458
|
-
visible
|
|
2459
|
-
};
|
|
1278
|
+
function l2() {
|
|
1279
|
+
if (o2.disabled)
|
|
1280
|
+
return e2.goToItem(a$2.Nothing);
|
|
1281
|
+
e2.goToItem(a$2.Specific, p2);
|
|
2460
1282
|
}
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
name: "MenuItem",
|
|
2464
|
-
props: {
|
|
2465
|
-
as: {
|
|
2466
|
-
type: [Object, String],
|
|
2467
|
-
"default": "template"
|
|
2468
|
-
},
|
|
2469
|
-
disabled: {
|
|
2470
|
-
type: Boolean,
|
|
2471
|
-
"default": false
|
|
2472
|
-
}
|
|
2473
|
-
},
|
|
2474
|
-
setup: function setup8(props, _ref3) {
|
|
2475
|
-
var slots = _ref3.slots, attrs = _ref3.attrs;
|
|
2476
|
-
var api = useMenuContext("MenuItem");
|
|
2477
|
-
var id2 = "headlessui-menu-item-" + useId();
|
|
2478
|
-
var active = computed$2(function() {
|
|
2479
|
-
return api.activeItemIndex.value !== null ? api.items.value[api.activeItemIndex.value].id === id2 : false;
|
|
2480
|
-
});
|
|
2481
|
-
var dataRef = ref({
|
|
2482
|
-
disabled: props.disabled,
|
|
2483
|
-
textValue: ""
|
|
2484
|
-
});
|
|
2485
|
-
onMounted(function() {
|
|
2486
|
-
var _document$getElementB2, _document$getElementB3;
|
|
2487
|
-
var textValue = (_document$getElementB2 = document.getElementById(id2)) == null ? void 0 : (_document$getElementB3 = _document$getElementB2.textContent) == null ? void 0 : _document$getElementB3.toLowerCase().trim();
|
|
2488
|
-
if (textValue !== void 0)
|
|
2489
|
-
dataRef.value.textValue = textValue;
|
|
2490
|
-
});
|
|
2491
|
-
onMounted(function() {
|
|
2492
|
-
return api.registerItem(id2, dataRef);
|
|
2493
|
-
});
|
|
2494
|
-
onUnmounted(function() {
|
|
2495
|
-
return api.unregisterItem(id2);
|
|
2496
|
-
});
|
|
2497
|
-
watchEffect(function() {
|
|
2498
|
-
if (api.menuState.value !== MenuStates.Open)
|
|
2499
|
-
return;
|
|
2500
|
-
if (!active.value)
|
|
2501
|
-
return;
|
|
2502
|
-
nextTick$1(function() {
|
|
2503
|
-
var _document$getElementB4;
|
|
2504
|
-
return (_document$getElementB4 = document.getElementById(id2)) == null ? void 0 : _document$getElementB4.scrollIntoView == null ? void 0 : _document$getElementB4.scrollIntoView({
|
|
2505
|
-
block: "nearest"
|
|
2506
|
-
});
|
|
2507
|
-
});
|
|
2508
|
-
});
|
|
2509
|
-
function handleClick(event) {
|
|
2510
|
-
if (props.disabled)
|
|
2511
|
-
return event.preventDefault();
|
|
2512
|
-
api.closeMenu();
|
|
2513
|
-
nextTick$1(function() {
|
|
2514
|
-
var _dom12;
|
|
2515
|
-
return (_dom12 = dom(api.buttonRef)) == null ? void 0 : _dom12.focus({
|
|
2516
|
-
preventScroll: true
|
|
2517
|
-
});
|
|
2518
|
-
});
|
|
2519
|
-
}
|
|
2520
|
-
function handleFocus() {
|
|
2521
|
-
if (props.disabled)
|
|
2522
|
-
return api.goToItem(Focus.Nothing);
|
|
2523
|
-
api.goToItem(Focus.Specific, id2);
|
|
2524
|
-
}
|
|
2525
|
-
function handleMove() {
|
|
2526
|
-
if (props.disabled)
|
|
2527
|
-
return;
|
|
2528
|
-
if (active.value)
|
|
2529
|
-
return;
|
|
2530
|
-
api.goToItem(Focus.Specific, id2);
|
|
2531
|
-
}
|
|
2532
|
-
function handleLeave() {
|
|
2533
|
-
if (props.disabled)
|
|
2534
|
-
return;
|
|
2535
|
-
if (!active.value)
|
|
2536
|
-
return;
|
|
2537
|
-
api.goToItem(Focus.Nothing);
|
|
2538
|
-
}
|
|
2539
|
-
return function() {
|
|
2540
|
-
var disabled = props.disabled;
|
|
2541
|
-
var slot = {
|
|
2542
|
-
active: active.value,
|
|
2543
|
-
disabled
|
|
2544
|
-
};
|
|
2545
|
-
var propsWeControl = {
|
|
2546
|
-
id: id2,
|
|
2547
|
-
role: "menuitem",
|
|
2548
|
-
tabIndex: disabled === true ? void 0 : -1,
|
|
2549
|
-
"aria-disabled": disabled === true ? true : void 0,
|
|
2550
|
-
onClick: handleClick,
|
|
2551
|
-
onFocus: handleFocus,
|
|
2552
|
-
onPointermove: handleMove,
|
|
2553
|
-
onMousemove: handleMove,
|
|
2554
|
-
onPointerleave: handleLeave,
|
|
2555
|
-
onMouseleave: handleLeave
|
|
2556
|
-
};
|
|
2557
|
-
return render({
|
|
2558
|
-
props: _extends({}, props, propsWeControl),
|
|
2559
|
-
slot,
|
|
2560
|
-
attrs,
|
|
2561
|
-
slots,
|
|
2562
|
-
name: "MenuItem"
|
|
2563
|
-
});
|
|
2564
|
-
};
|
|
1283
|
+
function t2() {
|
|
1284
|
+
o2.disabled || f2.value || e2.goToItem(a$2.Specific, p2, 0);
|
|
2565
1285
|
}
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
"
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
var propsWeControl = {
|
|
2590
|
-
id: this.id,
|
|
2591
|
-
ref: "el",
|
|
2592
|
-
role: "switch",
|
|
2593
|
-
type: this.type,
|
|
2594
|
-
tabIndex: 0,
|
|
2595
|
-
"aria-checked": this.$props.modelValue,
|
|
2596
|
-
"aria-labelledby": this.labelledby,
|
|
2597
|
-
"aria-describedby": this.describedby,
|
|
2598
|
-
onClick: this.handleClick,
|
|
2599
|
-
onKeyup: this.handleKeyUp,
|
|
2600
|
-
onKeypress: this.handleKeyPress
|
|
2601
|
-
};
|
|
2602
|
-
return render({
|
|
2603
|
-
props: _extends({}, this.$props, propsWeControl),
|
|
2604
|
-
slot,
|
|
2605
|
-
attrs: this.$attrs,
|
|
2606
|
-
slots: this.$slots,
|
|
2607
|
-
name: "Switch"
|
|
2608
|
-
});
|
|
2609
|
-
},
|
|
2610
|
-
setup: function setup9(props, _ref2) {
|
|
2611
|
-
var emit = _ref2.emit, attrs = _ref2.attrs;
|
|
2612
|
-
var api = inject(GroupContext, null);
|
|
2613
|
-
var id2 = "headlessui-switch-" + useId();
|
|
2614
|
-
function toggle() {
|
|
2615
|
-
emit("update:modelValue", !props.modelValue);
|
|
2616
|
-
}
|
|
2617
|
-
var internalSwitchRef = ref(null);
|
|
2618
|
-
var switchRef = api === null ? internalSwitchRef : api.switchRef;
|
|
2619
|
-
return {
|
|
2620
|
-
id: id2,
|
|
2621
|
-
el: switchRef,
|
|
2622
|
-
type: useResolveButtonType(computed$2(function() {
|
|
2623
|
-
return {
|
|
2624
|
-
as: props.as,
|
|
2625
|
-
type: attrs.type
|
|
2626
|
-
};
|
|
2627
|
-
}), switchRef),
|
|
2628
|
-
labelledby: api == null ? void 0 : api.labelledby,
|
|
2629
|
-
describedby: api == null ? void 0 : api.describedby,
|
|
2630
|
-
handleClick: function handleClick(event) {
|
|
2631
|
-
event.preventDefault();
|
|
2632
|
-
toggle();
|
|
2633
|
-
},
|
|
2634
|
-
handleKeyUp: function handleKeyUp(event) {
|
|
2635
|
-
if (event.key !== Keys.Tab)
|
|
2636
|
-
event.preventDefault();
|
|
2637
|
-
if (event.key === Keys.Space)
|
|
2638
|
-
toggle();
|
|
2639
|
-
},
|
|
2640
|
-
handleKeyPress: function handleKeyPress(event) {
|
|
2641
|
-
event.preventDefault();
|
|
2642
|
-
}
|
|
1286
|
+
function u2() {
|
|
1287
|
+
o2.disabled || !f2.value || e2.goToItem(a$2.Nothing);
|
|
1288
|
+
}
|
|
1289
|
+
return () => {
|
|
1290
|
+
let { disabled: n2 } = o2, a2 = { active: f2.value, disabled: n2 };
|
|
1291
|
+
return k({ props: __spreadValues(__spreadValues({}, o2), { id: p2, ref: r2, role: "menuitem", tabIndex: n2 === true ? void 0 : -1, "aria-disabled": n2 === true ? true : void 0, onClick: I, onFocus: l2, onPointermove: t2, onMousemove: t2, onPointerleave: u2, onMouseleave: u2 }), slot: a2, attrs: i2, slots: S2, name: "MenuItem" });
|
|
1292
|
+
};
|
|
1293
|
+
} });
|
|
1294
|
+
let u = Symbol("LabelContext");
|
|
1295
|
+
function a() {
|
|
1296
|
+
let t2 = inject(u, null);
|
|
1297
|
+
if (t2 === null) {
|
|
1298
|
+
let n2 = new Error("You used a <Label /> component, but it is not inside a parent.");
|
|
1299
|
+
throw Error.captureStackTrace && Error.captureStackTrace(n2, a), n2;
|
|
1300
|
+
}
|
|
1301
|
+
return t2;
|
|
1302
|
+
}
|
|
1303
|
+
function K({ slot: t2 = {}, name: n2 = "Label", props: i2 = {} } = {}) {
|
|
1304
|
+
let e2 = ref([]);
|
|
1305
|
+
function r2(o2) {
|
|
1306
|
+
return e2.value.push(o2), () => {
|
|
1307
|
+
let l2 = e2.value.indexOf(o2);
|
|
1308
|
+
l2 !== -1 && e2.value.splice(l2, 1);
|
|
2643
1309
|
};
|
|
2644
1310
|
}
|
|
2645
|
-
});
|
|
1311
|
+
return provide(u, { register: r2, slot: t2, name: n2, props: i2 }), computed$2(() => e2.value.length > 0 ? e2.value.join(" ") : void 0);
|
|
1312
|
+
}
|
|
1313
|
+
let T = defineComponent({ name: "Label", props: { as: { type: [Object, String], default: "label" }, passive: { type: [Boolean], default: false } }, setup(t2, { slots: n2, attrs: i2 }) {
|
|
1314
|
+
let e2 = a(), r2 = `headlessui-label-${t$2()}`;
|
|
1315
|
+
return onMounted(() => onUnmounted(e2.register(r2))), () => {
|
|
1316
|
+
let { name: o2 = "Label", slot: l2 = {}, props: p2 = {} } = e2, _a = t2, { passive: d } = _a, c2 = __objRest(_a, ["passive"]), f2 = __spreadProps(__spreadValues({}, Object.entries(p2).reduce((m2, [b2, g]) => Object.assign(m2, { [b2]: unref(g) }), {})), { id: r2 }), s2 = __spreadValues(__spreadValues({}, c2), f2);
|
|
1317
|
+
return d && delete s2.onClick, k({ props: s2, slot: l2, attrs: i2, slots: n2, name: o2 });
|
|
1318
|
+
};
|
|
1319
|
+
} });
|
|
1320
|
+
let b = Symbol("GroupContext");
|
|
1321
|
+
defineComponent({ name: "SwitchGroup", props: { as: { type: [Object, String], default: "template" } }, setup(l2, { slots: a2, attrs: i2 }) {
|
|
1322
|
+
let n2 = ref(null), u2 = K({ name: "SwitchLabel", props: { onClick() {
|
|
1323
|
+
!n2.value || (n2.value.click(), n2.value.focus({ preventScroll: true }));
|
|
1324
|
+
} } }), t2 = P$1({ name: "SwitchDescription" });
|
|
1325
|
+
return provide(b, { switchRef: n2, labelledby: u2, describedby: t2 }), () => k({ props: l2, slot: {}, slots: a2, attrs: i2, name: "SwitchGroup" });
|
|
1326
|
+
} });
|
|
1327
|
+
let Y = defineComponent({ name: "Switch", emits: { "update:modelValue": (l2) => true }, props: { as: { type: [Object, String], default: "button" }, modelValue: { type: Boolean, default: false }, name: { type: String, optional: true }, value: { type: String, optional: true } }, inheritAttrs: false, setup(l2, { emit: a2, attrs: i2, slots: n2, expose: u2 }) {
|
|
1328
|
+
let t2 = inject(b, null), p$12 = `headlessui-switch-${t$2()}`;
|
|
1329
|
+
function c2() {
|
|
1330
|
+
a2("update:modelValue", !l2.modelValue);
|
|
1331
|
+
}
|
|
1332
|
+
let h2 = ref(null), r2 = t2 === null ? h2 : t2.switchRef, S2 = b$1(computed$2(() => ({ as: l2.as, type: i2.type })), r2);
|
|
1333
|
+
u2({ el: r2, $el: r2 });
|
|
1334
|
+
function w2(e2) {
|
|
1335
|
+
e2.preventDefault(), c2();
|
|
1336
|
+
}
|
|
1337
|
+
function v(e2) {
|
|
1338
|
+
e2.key === o.Space ? (e2.preventDefault(), c2()) : e2.key === o.Enter && p(e2.currentTarget);
|
|
1339
|
+
}
|
|
1340
|
+
function g(e2) {
|
|
1341
|
+
e2.preventDefault();
|
|
1342
|
+
}
|
|
1343
|
+
return () => {
|
|
1344
|
+
let _a = l2, { name: e2, value: R2, modelValue: o2 } = _a, k$1 = __objRest(_a, ["name", "value", "modelValue"]), D2 = { checked: o2 }, K2 = { id: p$12, ref: r2, role: "switch", type: S2.value, tabIndex: 0, "aria-checked": o2, "aria-labelledby": t2 == null ? void 0 : t2.labelledby.value, "aria-describedby": t2 == null ? void 0 : t2.describedby.value, onClick: w2, onKeyup: v, onKeypress: g };
|
|
1345
|
+
return h$2(Fragment, [e2 != null && o2 != null ? h$2(m, S$1({ features: a$1.Hidden, as: "input", type: "checkbox", hidden: true, readOnly: true, checked: o2, name: e2, value: R2 })) : null, k({ props: __spreadValues(__spreadValues(__spreadValues({}, i2), k$1), K2), slot: D2, attrs: i2, slots: n2, name: "Switch" })]);
|
|
1346
|
+
};
|
|
1347
|
+
} });
|
|
1348
|
+
T;
|
|
1349
|
+
S;
|
|
2646
1350
|
function getWindow(node) {
|
|
2647
1351
|
if (node == null) {
|
|
2648
1352
|
return window;
|
|
@@ -2839,6 +1543,9 @@ function getContainingBlock(element) {
|
|
|
2839
1543
|
}
|
|
2840
1544
|
}
|
|
2841
1545
|
var currentNode = getParentNode(element);
|
|
1546
|
+
if (isShadowRoot(currentNode)) {
|
|
1547
|
+
currentNode = currentNode.host;
|
|
1548
|
+
}
|
|
2842
1549
|
while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
|
|
2843
1550
|
var css = getComputedStyle(currentNode);
|
|
2844
1551
|
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
|
|
@@ -3046,8 +1753,8 @@ function popperGenerator(generatorOptions) {
|
|
|
3046
1753
|
popper: listScrollParents(popper)
|
|
3047
1754
|
};
|
|
3048
1755
|
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
|
|
3049
|
-
state.orderedModifiers = orderedModifiers.filter(function(
|
|
3050
|
-
return
|
|
1756
|
+
state.orderedModifiers = orderedModifiers.filter(function(m2) {
|
|
1757
|
+
return m2.enabled;
|
|
3051
1758
|
});
|
|
3052
1759
|
runModifierEffects();
|
|
3053
1760
|
return instance.update();
|
|
@@ -3189,26 +1896,26 @@ var unsetSides = {
|
|
|
3189
1896
|
left: "auto"
|
|
3190
1897
|
};
|
|
3191
1898
|
function roundOffsetsByDPR(_ref) {
|
|
3192
|
-
var
|
|
1899
|
+
var x2 = _ref.x, y = _ref.y;
|
|
3193
1900
|
var win = window;
|
|
3194
1901
|
var dpr = win.devicePixelRatio || 1;
|
|
3195
1902
|
return {
|
|
3196
|
-
x: round(
|
|
1903
|
+
x: round(x2 * dpr) / dpr || 0,
|
|
3197
1904
|
y: round(y * dpr) / dpr || 0
|
|
3198
1905
|
};
|
|
3199
1906
|
}
|
|
3200
1907
|
function mapToStyles(_ref2) {
|
|
3201
1908
|
var _Object$assign2;
|
|
3202
1909
|
var popper = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
|
|
3203
|
-
var _offsets$x = offsets.x,
|
|
1910
|
+
var _offsets$x = offsets.x, x2 = _offsets$x === void 0 ? 0 : _offsets$x, _offsets$y = offsets.y, y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
3204
1911
|
var _ref3 = typeof roundOffsets === "function" ? roundOffsets({
|
|
3205
|
-
x,
|
|
1912
|
+
x: x2,
|
|
3206
1913
|
y
|
|
3207
1914
|
}) : {
|
|
3208
|
-
x,
|
|
1915
|
+
x: x2,
|
|
3209
1916
|
y
|
|
3210
1917
|
};
|
|
3211
|
-
|
|
1918
|
+
x2 = _ref3.x;
|
|
3212
1919
|
y = _ref3.y;
|
|
3213
1920
|
var hasX = offsets.hasOwnProperty("x");
|
|
3214
1921
|
var hasY = offsets.hasOwnProperty("y");
|
|
@@ -3229,34 +1936,34 @@ function mapToStyles(_ref2) {
|
|
|
3229
1936
|
offsetParent = offsetParent;
|
|
3230
1937
|
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
3231
1938
|
sideY = bottom;
|
|
3232
|
-
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
|
|
1939
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : offsetParent[heightProp];
|
|
3233
1940
|
y -= offsetY - popperRect.height;
|
|
3234
1941
|
y *= gpuAcceleration ? 1 : -1;
|
|
3235
1942
|
}
|
|
3236
1943
|
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
3237
1944
|
sideX = right;
|
|
3238
|
-
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
|
|
3239
|
-
|
|
3240
|
-
|
|
1945
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : offsetParent[widthProp];
|
|
1946
|
+
x2 -= offsetX - popperRect.width;
|
|
1947
|
+
x2 *= gpuAcceleration ? 1 : -1;
|
|
3241
1948
|
}
|
|
3242
1949
|
}
|
|
3243
1950
|
var commonStyles = Object.assign({
|
|
3244
1951
|
position
|
|
3245
1952
|
}, adaptive && unsetSides);
|
|
3246
1953
|
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
3247
|
-
x,
|
|
1954
|
+
x: x2,
|
|
3248
1955
|
y
|
|
3249
1956
|
}) : {
|
|
3250
|
-
x,
|
|
1957
|
+
x: x2,
|
|
3251
1958
|
y
|
|
3252
1959
|
};
|
|
3253
|
-
|
|
1960
|
+
x2 = _ref4.x;
|
|
3254
1961
|
y = _ref4.y;
|
|
3255
1962
|
if (gpuAcceleration) {
|
|
3256
1963
|
var _Object$assign;
|
|
3257
|
-
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" +
|
|
1964
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x2 + "px, " + y + "px)" : "translate3d(" + x2 + "px, " + y + "px, 0)", _Object$assign));
|
|
3258
1965
|
}
|
|
3259
|
-
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ?
|
|
1966
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x2 + "px" : "", _Object$assign2.transform = "", _Object$assign2));
|
|
3260
1967
|
}
|
|
3261
1968
|
function computeStyles(_ref5) {
|
|
3262
1969
|
var state = _ref5.state, options = _ref5.options;
|
|
@@ -3388,6 +2095,7 @@ function usePopper(options) {
|
|
|
3388
2095
|
return [reference, popper];
|
|
3389
2096
|
}
|
|
3390
2097
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
2098
|
+
__name: "MenuContainer",
|
|
3391
2099
|
props: {
|
|
3392
2100
|
position: { default: "left" },
|
|
3393
2101
|
usePortal: { type: [Boolean, String], default: false }
|
|
@@ -3397,19 +2105,19 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3397
2105
|
const placement = props.position === "left" ? "bottom-end" : "bottom-start";
|
|
3398
2106
|
const [button, container] = usePopper({ placement });
|
|
3399
2107
|
return (_ctx, _cache) => {
|
|
3400
|
-
return openBlock(), createBlock(unref
|
|
2108
|
+
return openBlock(), createBlock(unref(fe), {
|
|
3401
2109
|
as: "div",
|
|
3402
2110
|
class: "relative inline-block text-left"
|
|
3403
2111
|
}, {
|
|
3404
2112
|
default: withCtx(() => [
|
|
3405
|
-
createVNode(unref
|
|
2113
|
+
createVNode(unref(me), {
|
|
3406
2114
|
class: "focus:outline-none",
|
|
3407
2115
|
ref_key: "button",
|
|
3408
2116
|
ref: button
|
|
3409
2117
|
}, {
|
|
3410
2118
|
default: withCtx(() => [
|
|
3411
2119
|
renderSlot(_ctx.$slots, "button", {}, () => [
|
|
3412
|
-
createVNode(unref
|
|
2120
|
+
createVNode(unref(_sfc_main$b), {
|
|
3413
2121
|
class: "fill-current",
|
|
3414
2122
|
name: "ellipsis-h"
|
|
3415
2123
|
})
|
|
@@ -3435,7 +2143,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
3435
2143
|
"leave-to-class": "transform -translate-y-2 opacity-0"
|
|
3436
2144
|
}, {
|
|
3437
2145
|
default: withCtx(() => [
|
|
3438
|
-
createVNode(unref
|
|
2146
|
+
createVNode(unref(pe), {
|
|
3439
2147
|
class: normalizeClass([
|
|
3440
2148
|
{
|
|
3441
2149
|
"absolute left-0 origin-top-left": !__props.usePortal && __props.position === "right",
|
|
@@ -3465,6 +2173,7 @@ const _hoisted_1$4 = {
|
|
|
3465
2173
|
class: "bg-grey-300 px-2 rounded-lg max-w-[66px] truncate"
|
|
3466
2174
|
};
|
|
3467
2175
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
2176
|
+
__name: "MenuLink",
|
|
3468
2177
|
props: {
|
|
3469
2178
|
label: null,
|
|
3470
2179
|
meta: null,
|
|
@@ -3472,7 +2181,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
3472
2181
|
},
|
|
3473
2182
|
setup(__props) {
|
|
3474
2183
|
return (_ctx, _cache) => {
|
|
3475
|
-
return openBlock(), createBlock(unref
|
|
2184
|
+
return openBlock(), createBlock(unref(ve), normalizeProps(guardReactiveProps({ disabled: __props.disabled })), {
|
|
3476
2185
|
default: withCtx(({ active }) => [
|
|
3477
2186
|
createElementVNode("span", mergeProps({
|
|
3478
2187
|
class: ["flex items-center justify-between px-4 py-2 text-xs leading-5 transition-colors duration-100 rounded-lg", [
|
|
@@ -3504,6 +2213,7 @@ const _hoisted_4$1 = {
|
|
|
3504
2213
|
};
|
|
3505
2214
|
const _hoisted_5$1 = { class: "absolute right-0 inset-y-0 inline-flex items-center justify-center text-grey-700 dark:text-grey-100 px-4 pointer-events-none" };
|
|
3506
2215
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2216
|
+
__name: "Select",
|
|
3507
2217
|
props: {
|
|
3508
2218
|
modelValue: null,
|
|
3509
2219
|
size: { default: "medium" },
|
|
@@ -3515,7 +2225,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3515
2225
|
emits: ["update:modelValue"],
|
|
3516
2226
|
setup(__props, { emit }) {
|
|
3517
2227
|
const props = __props;
|
|
3518
|
-
const selected = props.modelValue ? ref(props.modelValue) : ref(
|
|
2228
|
+
const selected = props.modelValue ? ref(props.modelValue) : ref(void 0);
|
|
3519
2229
|
const { inputClasses, disabledClasses, textSizeClasses } = useFormClasses(props);
|
|
3520
2230
|
watch(() => props.modelValue, (value) => {
|
|
3521
2231
|
var _a;
|
|
@@ -3531,26 +2241,26 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3531
2241
|
}
|
|
3532
2242
|
});
|
|
3533
2243
|
return (_ctx, _cache) => {
|
|
3534
|
-
return openBlock(), createBlock(unref
|
|
2244
|
+
return openBlock(), createBlock(unref(we), {
|
|
3535
2245
|
as: "div",
|
|
3536
|
-
modelValue: unref
|
|
3537
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef
|
|
2246
|
+
modelValue: unref(selected),
|
|
2247
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(selected) ? selected.value = $event : null),
|
|
3538
2248
|
disabled: __props.isDisabled
|
|
3539
2249
|
}, {
|
|
3540
2250
|
default: withCtx(() => [
|
|
3541
2251
|
createElementVNode("div", _hoisted_1$3, [
|
|
3542
|
-
createVNode(unref
|
|
3543
|
-
class: normalizeClass(["w-full mono-50 bg-white text-grey-800 placeholder-grey-600 border border-grey-300 dark:bg-grey-800 dark:text-grey-100 dark:placeholder-grey-400 dark:border-grey-700 focus:ring-2 focus:border-blue-400 focus:ring-blue-400 focus:outline-none dark:focus:border-blue-800 dark:focus:ring-blue-800 cursor-default rounded font-normal text-left", [unref
|
|
2252
|
+
createVNode(unref(ke), {
|
|
2253
|
+
class: normalizeClass(["w-full mono-50 bg-white text-grey-800 placeholder-grey-600 border border-grey-300 dark:bg-grey-800 dark:text-grey-100 dark:placeholder-grey-400 dark:border-grey-700 focus:ring-2 focus:border-blue-400 focus:ring-blue-400 focus:outline-none dark:focus:border-blue-800 dark:focus:ring-blue-800 cursor-default rounded font-normal text-left", [unref(inputClasses), unref(textSizeClasses), unref(disabledClasses)]])
|
|
3544
2254
|
}, {
|
|
3545
2255
|
default: withCtx(() => {
|
|
3546
2256
|
var _a, _b;
|
|
3547
2257
|
return [
|
|
3548
2258
|
__props.icon ? (openBlock(), createElementBlock("span", _hoisted_2$2, [
|
|
3549
2259
|
createVNode(_sfc_main$b, {
|
|
3550
|
-
name: (_b = (_a = unref
|
|
2260
|
+
name: (_b = (_a = unref(selected)) == null ? void 0 : _a.icon) != null ? _b : __props.icon
|
|
3551
2261
|
}, null, 8, ["name"])
|
|
3552
2262
|
])) : createCommentVNode("", true),
|
|
3553
|
-
unref
|
|
2263
|
+
unref(selected) ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(unref(selected).label), 1)) : (openBlock(), createElementBlock("span", _hoisted_4$1, toDisplayString(__props.placeholder), 1)),
|
|
3554
2264
|
createElementVNode("span", _hoisted_5$1, [
|
|
3555
2265
|
createVNode(_sfc_main$b, {
|
|
3556
2266
|
class: "text-grey-400",
|
|
@@ -3568,10 +2278,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
3568
2278
|
"leave-to-class": "opacity-0"
|
|
3569
2279
|
}, {
|
|
3570
2280
|
default: withCtx(() => [
|
|
3571
|
-
createVNode(unref
|
|
2281
|
+
createVNode(unref(Ce), { class: "absolute z-10 mt-1 w-full bg-white dark:bg-grey-700 dark:text-grey-50 shadow-lg max-h-60 rounded-md py-1 text-base ring-1 ring-black ring-opacity-5 overflow-auto focus:outline-none sm:text-sm" }, {
|
|
3572
2282
|
default: withCtx(() => [
|
|
3573
2283
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item) => {
|
|
3574
|
-
return openBlock(), createBlock(unref
|
|
2284
|
+
return openBlock(), createBlock(unref(Me), {
|
|
3575
2285
|
as: "template",
|
|
3576
2286
|
key: item.id,
|
|
3577
2287
|
value: item
|
|
@@ -3646,6 +2356,7 @@ const _hoisted_6 = {
|
|
|
3646
2356
|
class: "w-1/3 h-10 mt-6 bg-current rounded-lg"
|
|
3647
2357
|
};
|
|
3648
2358
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2359
|
+
__name: "Skeleton",
|
|
3649
2360
|
props: {
|
|
3650
2361
|
avatar: { type: Boolean, default: false },
|
|
3651
2362
|
title: { type: Boolean, default: true },
|
|
@@ -3668,7 +2379,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3668
2379
|
__props.title ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("", true)
|
|
3669
2380
|
]),
|
|
3670
2381
|
__props.lines > 0 ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
3671
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(unref
|
|
2382
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(lineSettings), (setting, index) => {
|
|
3672
2383
|
return openBlock(), createElementBlock("div", {
|
|
3673
2384
|
class: normalizeClass(["h-4 bg-current rounded-lg", setting.margin]),
|
|
3674
2385
|
key: index
|
|
@@ -3681,9 +2392,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
3681
2392
|
}
|
|
3682
2393
|
});
|
|
3683
2394
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2395
|
+
__name: "Spinner",
|
|
3684
2396
|
setup(__props) {
|
|
3685
2397
|
return (_ctx, _cache) => {
|
|
3686
|
-
return openBlock(), createBlock(unref
|
|
2398
|
+
return openBlock(), createBlock(unref(_sfc_main$b), {
|
|
3687
2399
|
class: "animate-spin",
|
|
3688
2400
|
name: "circle-notch"
|
|
3689
2401
|
});
|
|
@@ -3692,6 +2404,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
3692
2404
|
});
|
|
3693
2405
|
const _hoisted_1$1 = { class: "sr-only" };
|
|
3694
2406
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
2407
|
+
__name: "Switch",
|
|
3695
2408
|
props: {
|
|
3696
2409
|
id: { default: v4() },
|
|
3697
2410
|
label: null,
|
|
@@ -3707,7 +2420,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
3707
2420
|
emits("change", newValue);
|
|
3708
2421
|
};
|
|
3709
2422
|
return (_ctx, _cache) => {
|
|
3710
|
-
return openBlock(), createBlock(unref
|
|
2423
|
+
return openBlock(), createBlock(unref(Y), {
|
|
3711
2424
|
modelValue: __props.modelValue,
|
|
3712
2425
|
label: __props.label,
|
|
3713
2426
|
class: normalizeClass([__props.modelValue ? "bg-blue-700" : "bg-grey-700", "relative inline-flex items-center h-6 transition rounded-full w-14 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-grey-900 focus:ring-blue-300"]),
|
|
@@ -3733,6 +2446,7 @@ const __default__ = {
|
|
|
3733
2446
|
inheritAttrs: false
|
|
3734
2447
|
};
|
|
3735
2448
|
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
|
|
2449
|
+
__name: "Textarea",
|
|
3736
2450
|
props: {
|
|
3737
2451
|
modelValue: null,
|
|
3738
2452
|
size: { default: "medium" },
|
|
@@ -3759,7 +2473,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
|
|
|
3759
2473
|
var _a;
|
|
3760
2474
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
3761
2475
|
createElementVNode("textarea", mergeProps({
|
|
3762
|
-
class: ["mono-50 bg-white text-grey-800 placeholder:text-grey-400 placeholder:font-normal border-grey-300 dark:bg-grey-800 dark:text-grey-100 dark:placeholder:text-grey-500 dark:border-grey-700 focus:border-blue-400 focus:ring-blue-400 dark:focus:border-blue-800 dark:focus:ring-blue-800 rounded", [unref
|
|
2476
|
+
class: ["mono-50 bg-white text-grey-800 placeholder:text-grey-400 placeholder:font-normal border-grey-300 dark:bg-grey-800 dark:text-grey-100 dark:placeholder:text-grey-500 dark:border-grey-700 focus:border-blue-400 focus:ring-blue-400 dark:focus:border-blue-800 dark:focus:ring-blue-800 rounded", [unref(inputClasses), unref(textSizeClasses), unref(disabledClasses)]],
|
|
3763
2477
|
tabindex: __props.isDisabled ? "-1" : void 0,
|
|
3764
2478
|
value: (_a = __props.modelValue) != null ? _a : ""
|
|
3765
2479
|
}, _ctx.$attrs, {
|