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