@commandable/mcp 0.0.6 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -31
- package/dist/app/nitro.json +15 -0
- package/dist/app/public/_fonts/57NSSoFy1VLVs2gqly8Ls9awBnZMFyXGrefpmqvdqmc-zJfbBtpgM4cDmcXBsqZNW79_kFnlpPd62b48glgdydA.woff2 +0 -0
- package/dist/app/public/_fonts/8VR2wSMN-3U4NbWAVYXlkRV6hA0jFBXP-0RtL3X7fko-x2gYI4qfmkRdxyQQUPaBZdZdgl1TeVrquF_TxHeM4lM.woff2 +0 -0
- package/dist/app/public/_fonts/GsKUclqeNLJ96g5AU593ug6yanivOiwjW_7zESNPChw-jHA4tBeM1bjF7LATGUpfBuSTyomIFrWBTzjF7txVYfg.woff2 +0 -0
- package/dist/app/public/_fonts/Ld1FnTo3yTIwDyGfTQ5-Fws9AWsCbKfMvgxduXr7JcY-W25bL8NF1fjpLRSOgJb7RoZPHqGQNwMTM7S9tHVoxx8.woff2 +0 -0
- package/dist/app/public/_fonts/NdzqRASp2bovDUhQT1IRE_EMqKJ2KYQdTCfFcBvL8yw-KhwZiS86o3fErOe5GGMExHUemmI_dBfaEFxjISZrBd0.woff2 +0 -0
- package/dist/app/public/_fonts/iTkrULNFJJkTvihIg1Vqi5IODRH_9btXCioVF5l98I8-AndUyau2HR2felA_ra8V2mutQgschhasE5FD1dXGJX8.woff2 +0 -0
- package/dist/app/public/_nuxt/-tOYwuj2.js +30 -0
- package/dist/app/public/_nuxt/BdctKXor.js +1 -0
- package/dist/app/public/_nuxt/BlP7Uu-5.js +1 -0
- package/dist/app/public/_nuxt/CsbkV5Bd.js +1 -0
- package/dist/app/public/_nuxt/D-43HurL.js +59 -0
- package/dist/app/public/_nuxt/DU1mG77A.js +1 -0
- package/dist/app/public/_nuxt/_id_.BKAjWkoP.css +1 -0
- package/dist/app/public/_nuxt/builds/latest.json +1 -0
- package/dist/app/public/_nuxt/builds/meta/ceae497c-21d6-4278-8cc9-3c2c80f03dca.json +1 -0
- package/dist/app/public/_nuxt/entry.Y3mA4bzA.css +1 -0
- package/dist/app/public/_nuxt/error-404.C7fg894-.css +1 -0
- package/dist/app/public/_nuxt/error-500.DjUK_N2Y.css +1 -0
- package/dist/app/public/_nuxt/uS7FY2am.js +1 -0
- package/dist/app/public/favicon.ico +0 -0
- package/dist/app/server/chunks/_/error-500.mjs +19 -0
- package/dist/app/server/chunks/_/error-500.mjs.map +1 -0
- package/dist/app/server/chunks/_/icons.mjs +5933 -0
- package/dist/app/server/chunks/_/icons.mjs.map +1 -0
- package/dist/app/server/chunks/_/icons2.mjs +11338 -0
- package/dist/app/server/chunks/_/icons2.mjs.map +1 -0
- package/dist/app/server/chunks/build/IntegrationCredentials-styles.CULcCK6_.mjs +8 -0
- package/dist/app/server/chunks/build/IntegrationCredentials-styles.CULcCK6_.mjs.map +1 -0
- package/dist/app/server/chunks/build/_id_-DBwSV4AY.mjs +1354 -0
- package/dist/app/server/chunks/build/_id_-DBwSV4AY.mjs.map +1 -0
- package/dist/app/server/chunks/build/client.precomputed.mjs +4 -0
- package/dist/app/server/chunks/build/client.precomputed.mjs.map +1 -0
- package/dist/app/server/chunks/build/error-404-D2QibUBT.mjs +121 -0
- package/dist/app/server/chunks/build/error-404-D2QibUBT.mjs.map +1 -0
- package/dist/app/server/chunks/build/error-404-styles.Bvxdxqjk.mjs +8 -0
- package/dist/app/server/chunks/build/error-404-styles.Bvxdxqjk.mjs.map +1 -0
- package/dist/app/server/chunks/build/error-500-DYvawybF.mjs +104 -0
- package/dist/app/server/chunks/build/error-500-DYvawybF.mjs.map +1 -0
- package/dist/app/server/chunks/build/error-500-styles.BnYAAXSg.mjs +8 -0
- package/dist/app/server/chunks/build/error-500-styles.BnYAAXSg.mjs.map +1 -0
- package/dist/app/server/chunks/build/fetch-ZbqIFhDG.mjs +2851 -0
- package/dist/app/server/chunks/build/fetch-ZbqIFhDG.mjs.map +1 -0
- package/dist/app/server/chunks/build/index-5H-nmhph.mjs +68 -0
- package/dist/app/server/chunks/build/index-5H-nmhph.mjs.map +1 -0
- package/dist/app/server/chunks/build/index-C8flTcKI.mjs +720 -0
- package/dist/app/server/chunks/build/index-C8flTcKI.mjs.map +1 -0
- package/dist/app/server/chunks/build/server.mjs +8736 -0
- package/dist/app/server/chunks/build/server.mjs.map +1 -0
- package/dist/app/server/chunks/build/styles.mjs +12 -0
- package/dist/app/server/chunks/build/styles.mjs.map +1 -0
- package/dist/app/server/chunks/nitro/nitro.mjs +9359 -0
- package/dist/app/server/chunks/nitro/nitro.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/_commandable/status.get.mjs +59 -0
- package/dist/app/server/chunks/routes/api/_commandable/status.get.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/catalog/_type/tools.get.mjs +40 -0
- package/dist/app/server/chunks/routes/api/catalog/_type/tools.get.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/catalog/_type/toolsets.get.mjs +41 -0
- package/dist/app/server/chunks/routes/api/catalog/_type/toolsets.get.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/catalog.get.mjs +46 -0
- package/dist/app/server/chunks/routes/api/catalog.get.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/index.get.mjs +39 -0
- package/dist/app/server/chunks/routes/api/index.get.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/index.post.mjs +60 -0
- package/dist/app/server/chunks/routes/api/index.post.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/credentials-config.get.mjs +63 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/credentials-config.get.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/credentials-status.get.mjs +70 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/credentials-status.get.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/credentials.delete.mjs +61 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/credentials.delete.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/credentials.post.mjs +94 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/credentials.post.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/permissions.post.mjs +54 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/permissions.post.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/toolsets.post.mjs +53 -0
- package/dist/app/server/chunks/routes/api/integrations/_id/toolsets.post.mjs.map +1 -0
- package/dist/app/server/chunks/routes/api/integrations/_id_.delete.mjs +44 -0
- package/dist/app/server/chunks/routes/api/integrations/_id_.delete.mjs.map +1 -0
- package/dist/app/server/chunks/routes/health.get.mjs +37 -0
- package/dist/app/server/chunks/routes/health.get.mjs.map +1 -0
- package/dist/app/server/chunks/routes/mcp/create.mjs +56 -0
- package/dist/app/server/chunks/routes/mcp/create.mjs.map +1 -0
- package/dist/app/server/chunks/routes/mcp.mjs +56 -0
- package/dist/app/server/chunks/routes/mcp.mjs.map +1 -0
- package/dist/app/server/chunks/routes/renderer.mjs +492 -0
- package/dist/app/server/chunks/routes/renderer.mjs.map +1 -0
- package/dist/app/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
- package/dist/app/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
- package/dist/app/server/index.mjs +31 -0
- package/dist/app/server/index.mjs.map +1 -0
- package/dist/app/server/migrations/pg/0000_initial.sql +74 -0
- package/dist/app/server/migrations/pg/meta/_journal.json +13 -0
- package/dist/app/server/migrations/sqlite/0000_initial.sql +74 -0
- package/dist/app/server/migrations/sqlite/meta/_journal.json +13 -0
- package/dist/app/server/package.json +108 -0
- package/dist/cli/credentialManager.d.ts.map +1 -1
- package/dist/cli/credentialManager.js +5 -4
- package/dist/cli/credentialManager.js.map +1 -1
- package/dist/cli/index.d.ts +15 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +656 -17
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +172 -36
- package/dist/cli/setup.js.map +1 -1
- package/dist/config/configApply.d.ts.map +1 -1
- package/dist/config/configApply.js +4 -1
- package/dist/config/configApply.js.map +1 -1
- package/dist/config/configSchema.d.ts +18 -2
- package/dist/config/configSchema.d.ts.map +1 -1
- package/dist/config/configSchema.js +7 -1
- package/dist/config/configSchema.js.map +1 -1
- package/dist/db/client.d.ts +3 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js.map +1 -1
- package/dist/db/credentialStore.d.ts +2 -0
- package/dist/db/credentialStore.d.ts.map +1 -1
- package/dist/db/credentialStore.js +15 -16
- package/dist/db/credentialStore.js.map +1 -1
- package/dist/db/integrationStore.d.ts +7 -0
- package/dist/db/integrationStore.d.ts.map +1 -1
- package/dist/db/integrationStore.js +64 -21
- package/dist/db/integrationStore.js.map +1 -1
- package/dist/db/integrationTypeConfigStore.d.ts +6 -0
- package/dist/db/integrationTypeConfigStore.d.ts.map +1 -0
- package/dist/db/integrationTypeConfigStore.js +94 -0
- package/dist/db/integrationTypeConfigStore.js.map +1 -0
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +8 -87
- package/dist/db/migrate.js.map +1 -1
- package/dist/db/migrations/pg/0000_initial.sql +74 -0
- package/dist/db/migrations/pg/meta/_journal.json +13 -0
- package/dist/db/migrations/sqlite/0000_initial.sql +74 -0
- package/dist/db/migrations/sqlite/meta/_journal.json +13 -0
- package/dist/db/schema.d.ts +1049 -133
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +61 -3
- package/dist/db/schema.js.map +1 -1
- package/dist/db/toolDefinitionStore.d.ts +6 -0
- package/dist/db/toolDefinitionStore.d.ts.map +1 -0
- package/dist/db/toolDefinitionStore.js +95 -0
- package/dist/db/toolDefinitionStore.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/actionsFactory.d.ts +5 -1
- package/dist/integrations/actionsFactory.d.ts.map +1 -1
- package/dist/integrations/actionsFactory.js +46 -16
- package/dist/integrations/actionsFactory.js.map +1 -1
- package/dist/integrations/customToolFactory.d.ts +13 -0
- package/dist/integrations/customToolFactory.d.ts.map +1 -0
- package/dist/integrations/customToolFactory.js +31 -0
- package/dist/integrations/customToolFactory.js.map +1 -0
- package/dist/integrations/dataLoader.d.ts +2 -2
- package/dist/integrations/dataLoader.d.ts.map +1 -1
- package/dist/integrations/dataLoader.js +1 -1
- package/dist/integrations/dataLoader.js.map +1 -1
- package/dist/integrations/fileIntegrationTypeConfigStore.d.ts +7 -0
- package/dist/integrations/fileIntegrationTypeConfigStore.d.ts.map +1 -0
- package/dist/integrations/fileIntegrationTypeConfigStore.js +34 -0
- package/dist/integrations/fileIntegrationTypeConfigStore.js.map +1 -0
- package/dist/integrations/getIntegration.d.ts +4 -1
- package/dist/integrations/getIntegration.d.ts.map +1 -1
- package/dist/integrations/getIntegration.js +12 -4
- package/dist/integrations/getIntegration.js.map +1 -1
- package/dist/integrations/health.d.ts +20 -0
- package/dist/integrations/health.d.ts.map +1 -0
- package/dist/integrations/health.js +43 -0
- package/dist/integrations/health.js.map +1 -0
- package/dist/integrations/integrationTypeConfigLookup.d.ts +12 -0
- package/dist/integrations/integrationTypeConfigLookup.d.ts.map +1 -0
- package/dist/integrations/integrationTypeConfigLookup.js +11 -0
- package/dist/integrations/integrationTypeConfigLookup.js.map +1 -0
- package/dist/integrations/providerRegistry.d.ts.map +1 -1
- package/dist/integrations/providerRegistry.js +22 -8
- package/dist/integrations/providerRegistry.js.map +1 -1
- package/dist/integrations/proxy.d.ts +4 -1
- package/dist/integrations/proxy.d.ts.map +1 -1
- package/dist/integrations/proxy.js +109 -94
- package/dist/integrations/proxy.js.map +1 -1
- package/dist/integrations/sandbox.d.ts +2 -1
- package/dist/integrations/sandbox.d.ts.map +1 -1
- package/dist/integrations/sandbox.js +13 -2
- package/dist/integrations/sandbox.js.map +1 -1
- package/dist/integrations/sandboxUtils.d.ts +15 -0
- package/dist/integrations/sandboxUtils.d.ts.map +1 -0
- package/dist/integrations/sandboxUtils.js +489 -0
- package/dist/integrations/sandboxUtils.js.map +1 -0
- package/dist/mcp/abilityCatalog.d.ts +46 -0
- package/dist/mcp/abilityCatalog.d.ts.map +1 -0
- package/dist/mcp/abilityCatalog.js +275 -0
- package/dist/mcp/abilityCatalog.js.map +1 -0
- package/dist/mcp/builder_guide.md +441 -0
- package/dist/mcp/commandable_readme.md +29 -0
- package/dist/mcp/handlers.d.ts +10 -1
- package/dist/mcp/handlers.d.ts.map +1 -1
- package/dist/mcp/handlers.js +51 -4
- package/dist/mcp/handlers.js.map +1 -1
- package/dist/mcp/metaTools.d.ts +77 -0
- package/dist/mcp/metaTools.d.ts.map +1 -0
- package/dist/mcp/metaTools.js +753 -0
- package/dist/mcp/metaTools.js.map +1 -0
- package/dist/mcp/server.d.ts +10 -0
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/sessionState.d.ts +18 -0
- package/dist/mcp/sessionState.d.ts.map +1 -0
- package/dist/mcp/sessionState.js +65 -0
- package/dist/mcp/sessionState.js.map +1 -0
- package/dist/mcp/toolAdapter.d.ts +17 -0
- package/dist/mcp/toolAdapter.d.ts.map +1 -1
- package/dist/mcp/toolAdapter.js +7 -1
- package/dist/mcp/toolAdapter.js.map +1 -1
- package/dist/types.d.ts +66 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +13 -9
|
@@ -0,0 +1,2851 @@
|
|
|
1
|
+
import { computed, toValue, reactive, useSlots, unref, mergeProps, withCtx, renderSlot, openBlock, createBlock, createCommentVNode, toDisplayString, useModel, useId, useAttrs, Fragment, createVNode, createTextVNode, mergeModels, defineComponent, ref, inject, watch, provide, toRef, useTemplateRef, renderList, useSSRContext } from 'vue';
|
|
2
|
+
import { ssrRenderComponent, ssrRenderSlot, ssrRenderClass, ssrInterpolate, ssrRenderAttrs, ssrRenderList, ssrRenderAttr } from 'vue/server-renderer';
|
|
3
|
+
import { Primitive, useForwardProps, SwitchRoot, SwitchThumb, Label, useForwardPropsEmits, SelectRoot, SelectTrigger, SelectPortal, SelectContent, SelectGroup, SelectLabel, SelectSeparator, SelectItem, SelectItemText, SelectItemIndicator, SelectArrow } from 'reka-ui';
|
|
4
|
+
import { A as fetchDefaults, B as useAsyncData, b as useAppConfig, c as useComponentUI, e as useFieldGroup, f as useComponentIcons, t as tv, g as _sfc_main$m, h as _sfc_main$k, d as useFormField, o as useNuxtApp, p as formErrorsInjectionKey, q as formInputsInjectionKey, r as inputIdInjectionKey, s as formFieldInjectionKey, v as usePortal, w as isArrayOfArray, x as get, y as _sfc_main$l, l as looseToNumber, z as getDisplayValue } from './server.mjs';
|
|
5
|
+
import { a0 as hash, J as defu } from '../nitro/nitro.mjs';
|
|
6
|
+
import { reactivePick } from '@vueuse/core';
|
|
7
|
+
import { isPlainObject } from '@vue/shared';
|
|
8
|
+
|
|
9
|
+
function useRequestEvent(nuxtApp) {
|
|
10
|
+
nuxtApp ||= useNuxtApp();
|
|
11
|
+
return nuxtApp.ssrContext?.event;
|
|
12
|
+
}
|
|
13
|
+
function useRequestFetch() {
|
|
14
|
+
return useRequestEvent()?.$fetch || globalThis.$fetch;
|
|
15
|
+
}
|
|
16
|
+
const theme$3 = {
|
|
17
|
+
"slots": {
|
|
18
|
+
"base": "font-medium inline-flex items-center",
|
|
19
|
+
"label": "truncate",
|
|
20
|
+
"leadingIcon": "shrink-0",
|
|
21
|
+
"leadingAvatar": "shrink-0",
|
|
22
|
+
"leadingAvatarSize": "",
|
|
23
|
+
"trailingIcon": "shrink-0"
|
|
24
|
+
},
|
|
25
|
+
"variants": {
|
|
26
|
+
"fieldGroup": {
|
|
27
|
+
"horizontal": "not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]",
|
|
28
|
+
"vertical": "not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]"
|
|
29
|
+
},
|
|
30
|
+
"color": {
|
|
31
|
+
"primary": "",
|
|
32
|
+
"secondary": "",
|
|
33
|
+
"success": "",
|
|
34
|
+
"info": "",
|
|
35
|
+
"warning": "",
|
|
36
|
+
"error": "",
|
|
37
|
+
"neutral": ""
|
|
38
|
+
},
|
|
39
|
+
"variant": {
|
|
40
|
+
"solid": "",
|
|
41
|
+
"outline": "",
|
|
42
|
+
"soft": "",
|
|
43
|
+
"subtle": ""
|
|
44
|
+
},
|
|
45
|
+
"size": {
|
|
46
|
+
"xs": {
|
|
47
|
+
"base": "text-[8px]/3 px-1 py-0.5 gap-1 rounded-sm",
|
|
48
|
+
"leadingIcon": "size-3",
|
|
49
|
+
"leadingAvatarSize": "3xs",
|
|
50
|
+
"trailingIcon": "size-3"
|
|
51
|
+
},
|
|
52
|
+
"sm": {
|
|
53
|
+
"base": "text-[10px]/3 px-1.5 py-1 gap-1 rounded-sm",
|
|
54
|
+
"leadingIcon": "size-3",
|
|
55
|
+
"leadingAvatarSize": "3xs",
|
|
56
|
+
"trailingIcon": "size-3"
|
|
57
|
+
},
|
|
58
|
+
"md": {
|
|
59
|
+
"base": "text-xs px-2 py-1 gap-1 rounded-md",
|
|
60
|
+
"leadingIcon": "size-4",
|
|
61
|
+
"leadingAvatarSize": "3xs",
|
|
62
|
+
"trailingIcon": "size-4"
|
|
63
|
+
},
|
|
64
|
+
"lg": {
|
|
65
|
+
"base": "text-sm px-2 py-1 gap-1.5 rounded-md",
|
|
66
|
+
"leadingIcon": "size-5",
|
|
67
|
+
"leadingAvatarSize": "2xs",
|
|
68
|
+
"trailingIcon": "size-5"
|
|
69
|
+
},
|
|
70
|
+
"xl": {
|
|
71
|
+
"base": "text-base px-2.5 py-1 gap-1.5 rounded-md",
|
|
72
|
+
"leadingIcon": "size-6",
|
|
73
|
+
"leadingAvatarSize": "2xs",
|
|
74
|
+
"trailingIcon": "size-6"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"square": {
|
|
78
|
+
"true": ""
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"compoundVariants": [
|
|
82
|
+
{
|
|
83
|
+
"color": "primary",
|
|
84
|
+
"variant": "solid",
|
|
85
|
+
"class": "bg-primary text-inverted"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"color": "secondary",
|
|
89
|
+
"variant": "solid",
|
|
90
|
+
"class": "bg-secondary text-inverted"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"color": "success",
|
|
94
|
+
"variant": "solid",
|
|
95
|
+
"class": "bg-success text-inverted"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"color": "info",
|
|
99
|
+
"variant": "solid",
|
|
100
|
+
"class": "bg-info text-inverted"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"color": "warning",
|
|
104
|
+
"variant": "solid",
|
|
105
|
+
"class": "bg-warning text-inverted"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"color": "error",
|
|
109
|
+
"variant": "solid",
|
|
110
|
+
"class": "bg-error text-inverted"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"color": "primary",
|
|
114
|
+
"variant": "outline",
|
|
115
|
+
"class": "text-primary ring ring-inset ring-primary/50"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"color": "secondary",
|
|
119
|
+
"variant": "outline",
|
|
120
|
+
"class": "text-secondary ring ring-inset ring-secondary/50"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"color": "success",
|
|
124
|
+
"variant": "outline",
|
|
125
|
+
"class": "text-success ring ring-inset ring-success/50"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"color": "info",
|
|
129
|
+
"variant": "outline",
|
|
130
|
+
"class": "text-info ring ring-inset ring-info/50"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"color": "warning",
|
|
134
|
+
"variant": "outline",
|
|
135
|
+
"class": "text-warning ring ring-inset ring-warning/50"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"color": "error",
|
|
139
|
+
"variant": "outline",
|
|
140
|
+
"class": "text-error ring ring-inset ring-error/50"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"color": "primary",
|
|
144
|
+
"variant": "soft",
|
|
145
|
+
"class": "bg-primary/10 text-primary"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"color": "secondary",
|
|
149
|
+
"variant": "soft",
|
|
150
|
+
"class": "bg-secondary/10 text-secondary"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"color": "success",
|
|
154
|
+
"variant": "soft",
|
|
155
|
+
"class": "bg-success/10 text-success"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"color": "info",
|
|
159
|
+
"variant": "soft",
|
|
160
|
+
"class": "bg-info/10 text-info"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"color": "warning",
|
|
164
|
+
"variant": "soft",
|
|
165
|
+
"class": "bg-warning/10 text-warning"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"color": "error",
|
|
169
|
+
"variant": "soft",
|
|
170
|
+
"class": "bg-error/10 text-error"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"color": "primary",
|
|
174
|
+
"variant": "subtle",
|
|
175
|
+
"class": "bg-primary/10 text-primary ring ring-inset ring-primary/25"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"color": "secondary",
|
|
179
|
+
"variant": "subtle",
|
|
180
|
+
"class": "bg-secondary/10 text-secondary ring ring-inset ring-secondary/25"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"color": "success",
|
|
184
|
+
"variant": "subtle",
|
|
185
|
+
"class": "bg-success/10 text-success ring ring-inset ring-success/25"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"color": "info",
|
|
189
|
+
"variant": "subtle",
|
|
190
|
+
"class": "bg-info/10 text-info ring ring-inset ring-info/25"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"color": "warning",
|
|
194
|
+
"variant": "subtle",
|
|
195
|
+
"class": "bg-warning/10 text-warning ring ring-inset ring-warning/25"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"color": "error",
|
|
199
|
+
"variant": "subtle",
|
|
200
|
+
"class": "bg-error/10 text-error ring ring-inset ring-error/25"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"color": "neutral",
|
|
204
|
+
"variant": "solid",
|
|
205
|
+
"class": "text-inverted bg-inverted"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"color": "neutral",
|
|
209
|
+
"variant": "outline",
|
|
210
|
+
"class": "ring ring-inset ring-accented text-default bg-default"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"color": "neutral",
|
|
214
|
+
"variant": "soft",
|
|
215
|
+
"class": "text-default bg-elevated"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"color": "neutral",
|
|
219
|
+
"variant": "subtle",
|
|
220
|
+
"class": "ring ring-inset ring-accented text-default bg-elevated"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"size": "xs",
|
|
224
|
+
"square": true,
|
|
225
|
+
"class": "p-0.5"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"size": "sm",
|
|
229
|
+
"square": true,
|
|
230
|
+
"class": "p-1"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"size": "md",
|
|
234
|
+
"square": true,
|
|
235
|
+
"class": "p-1"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"size": "lg",
|
|
239
|
+
"square": true,
|
|
240
|
+
"class": "p-1"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"size": "xl",
|
|
244
|
+
"square": true,
|
|
245
|
+
"class": "p-1"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"defaultVariants": {
|
|
249
|
+
"color": "primary",
|
|
250
|
+
"variant": "solid",
|
|
251
|
+
"size": "md"
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
const _sfc_main$4 = {
|
|
255
|
+
__name: "UBadge",
|
|
256
|
+
__ssrInlineRender: true,
|
|
257
|
+
props: {
|
|
258
|
+
as: { type: null, required: false, default: "span" },
|
|
259
|
+
label: { type: [String, Number], required: false },
|
|
260
|
+
color: { type: null, required: false },
|
|
261
|
+
variant: { type: null, required: false },
|
|
262
|
+
size: { type: null, required: false },
|
|
263
|
+
square: { type: Boolean, required: false },
|
|
264
|
+
class: { type: null, required: false },
|
|
265
|
+
ui: { type: Object, required: false },
|
|
266
|
+
icon: { type: null, required: false },
|
|
267
|
+
avatar: { type: Object, required: false },
|
|
268
|
+
leading: { type: Boolean, required: false },
|
|
269
|
+
leadingIcon: { type: null, required: false },
|
|
270
|
+
trailing: { type: Boolean, required: false },
|
|
271
|
+
trailingIcon: { type: null, required: false }
|
|
272
|
+
},
|
|
273
|
+
setup(__props) {
|
|
274
|
+
const props = __props;
|
|
275
|
+
const slots = useSlots();
|
|
276
|
+
const appConfig = useAppConfig();
|
|
277
|
+
const uiProp = useComponentUI("badge", props);
|
|
278
|
+
const { orientation, size: fieldGroupSize } = useFieldGroup(props);
|
|
279
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
|
|
280
|
+
const ui = computed(() => tv({ extend: tv(theme$3), ...appConfig.ui?.badge || {} })({
|
|
281
|
+
color: props.color,
|
|
282
|
+
variant: props.variant,
|
|
283
|
+
size: fieldGroupSize.value || props.size,
|
|
284
|
+
square: props.square || !slots.default && !props.label,
|
|
285
|
+
fieldGroup: orientation.value
|
|
286
|
+
}));
|
|
287
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
288
|
+
_push(ssrRenderComponent(unref(Primitive), mergeProps({
|
|
289
|
+
as: __props.as,
|
|
290
|
+
"data-slot": "base",
|
|
291
|
+
class: ui.value.base({ class: [unref(uiProp)?.base, props.class] })
|
|
292
|
+
}, _attrs), {
|
|
293
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
294
|
+
if (_push2) {
|
|
295
|
+
ssrRenderSlot(_ctx.$slots, "leading", { ui: ui.value }, () => {
|
|
296
|
+
if (unref(isLeading) && unref(leadingIconName)) {
|
|
297
|
+
_push2(ssrRenderComponent(_sfc_main$m, {
|
|
298
|
+
name: unref(leadingIconName),
|
|
299
|
+
"data-slot": "leadingIcon",
|
|
300
|
+
class: ui.value.leadingIcon({ class: unref(uiProp)?.leadingIcon })
|
|
301
|
+
}, null, _parent2, _scopeId));
|
|
302
|
+
} else if (!!__props.avatar) {
|
|
303
|
+
_push2(ssrRenderComponent(_sfc_main$k, mergeProps({
|
|
304
|
+
size: unref(uiProp)?.leadingAvatarSize || ui.value.leadingAvatarSize()
|
|
305
|
+
}, __props.avatar, {
|
|
306
|
+
"data-slot": "leadingAvatar",
|
|
307
|
+
class: ui.value.leadingAvatar({ class: unref(uiProp)?.leadingAvatar })
|
|
308
|
+
}), null, _parent2, _scopeId));
|
|
309
|
+
} else {
|
|
310
|
+
_push2(`<!---->`);
|
|
311
|
+
}
|
|
312
|
+
}, _push2, _parent2, _scopeId);
|
|
313
|
+
ssrRenderSlot(_ctx.$slots, "default", { ui: ui.value }, () => {
|
|
314
|
+
if (__props.label !== void 0 && __props.label !== null) {
|
|
315
|
+
_push2(`<span data-slot="label" class="${ssrRenderClass(ui.value.label({ class: unref(uiProp)?.label }))}"${_scopeId}>${ssrInterpolate(__props.label)}</span>`);
|
|
316
|
+
} else {
|
|
317
|
+
_push2(`<!---->`);
|
|
318
|
+
}
|
|
319
|
+
}, _push2, _parent2, _scopeId);
|
|
320
|
+
ssrRenderSlot(_ctx.$slots, "trailing", { ui: ui.value }, () => {
|
|
321
|
+
if (unref(isTrailing) && unref(trailingIconName)) {
|
|
322
|
+
_push2(ssrRenderComponent(_sfc_main$m, {
|
|
323
|
+
name: unref(trailingIconName),
|
|
324
|
+
"data-slot": "trailingIcon",
|
|
325
|
+
class: ui.value.trailingIcon({ class: unref(uiProp)?.trailingIcon })
|
|
326
|
+
}, null, _parent2, _scopeId));
|
|
327
|
+
} else {
|
|
328
|
+
_push2(`<!---->`);
|
|
329
|
+
}
|
|
330
|
+
}, _push2, _parent2, _scopeId);
|
|
331
|
+
} else {
|
|
332
|
+
return [
|
|
333
|
+
renderSlot(_ctx.$slots, "leading", { ui: ui.value }, () => [
|
|
334
|
+
unref(isLeading) && unref(leadingIconName) ? (openBlock(), createBlock(_sfc_main$m, {
|
|
335
|
+
key: 0,
|
|
336
|
+
name: unref(leadingIconName),
|
|
337
|
+
"data-slot": "leadingIcon",
|
|
338
|
+
class: ui.value.leadingIcon({ class: unref(uiProp)?.leadingIcon })
|
|
339
|
+
}, null, 8, ["name", "class"])) : !!__props.avatar ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
340
|
+
key: 1,
|
|
341
|
+
size: unref(uiProp)?.leadingAvatarSize || ui.value.leadingAvatarSize()
|
|
342
|
+
}, __props.avatar, {
|
|
343
|
+
"data-slot": "leadingAvatar",
|
|
344
|
+
class: ui.value.leadingAvatar({ class: unref(uiProp)?.leadingAvatar })
|
|
345
|
+
}), null, 16, ["size", "class"])) : createCommentVNode("", true)
|
|
346
|
+
]),
|
|
347
|
+
renderSlot(_ctx.$slots, "default", { ui: ui.value }, () => [
|
|
348
|
+
__props.label !== void 0 && __props.label !== null ? (openBlock(), createBlock("span", {
|
|
349
|
+
key: 0,
|
|
350
|
+
"data-slot": "label",
|
|
351
|
+
class: ui.value.label({ class: unref(uiProp)?.label })
|
|
352
|
+
}, toDisplayString(__props.label), 3)) : createCommentVNode("", true)
|
|
353
|
+
]),
|
|
354
|
+
renderSlot(_ctx.$slots, "trailing", { ui: ui.value }, () => [
|
|
355
|
+
unref(isTrailing) && unref(trailingIconName) ? (openBlock(), createBlock(_sfc_main$m, {
|
|
356
|
+
key: 0,
|
|
357
|
+
name: unref(trailingIconName),
|
|
358
|
+
"data-slot": "trailingIcon",
|
|
359
|
+
class: ui.value.trailingIcon({ class: unref(uiProp)?.trailingIcon })
|
|
360
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true)
|
|
361
|
+
])
|
|
362
|
+
];
|
|
363
|
+
}
|
|
364
|
+
}),
|
|
365
|
+
_: 3
|
|
366
|
+
}, _parent));
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
const _sfc_setup$4 = _sfc_main$4.setup;
|
|
371
|
+
_sfc_main$4.setup = (props, ctx) => {
|
|
372
|
+
const ssrContext = useSSRContext();
|
|
373
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("../../node_modules/@nuxt/ui/dist/runtime/components/Badge.vue");
|
|
374
|
+
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
|
|
375
|
+
};
|
|
376
|
+
const theme$2 = {
|
|
377
|
+
"slots": {
|
|
378
|
+
"root": "relative flex items-start",
|
|
379
|
+
"base": [
|
|
380
|
+
"inline-flex items-center shrink-0 rounded-full border-2 border-transparent focus-visible:outline-2 focus-visible:outline-offset-2 data-[state=unchecked]:bg-accented",
|
|
381
|
+
"transition-[background] duration-200"
|
|
382
|
+
],
|
|
383
|
+
"container": "flex items-center",
|
|
384
|
+
"thumb": "group pointer-events-none rounded-full bg-default shadow-lg ring-0 transition-transform duration-200 data-[state=unchecked]:translate-x-0 data-[state=unchecked]:rtl:-translate-x-0 flex items-center justify-center",
|
|
385
|
+
"icon": [
|
|
386
|
+
"absolute shrink-0 group-data-[state=unchecked]:text-dimmed opacity-0 size-10/12",
|
|
387
|
+
"transition-[color,opacity] duration-200"
|
|
388
|
+
],
|
|
389
|
+
"wrapper": "ms-2",
|
|
390
|
+
"label": "block font-medium text-default",
|
|
391
|
+
"description": "text-muted"
|
|
392
|
+
},
|
|
393
|
+
"variants": {
|
|
394
|
+
"color": {
|
|
395
|
+
"primary": {
|
|
396
|
+
"base": "data-[state=checked]:bg-primary focus-visible:outline-primary",
|
|
397
|
+
"icon": "group-data-[state=checked]:text-primary"
|
|
398
|
+
},
|
|
399
|
+
"secondary": {
|
|
400
|
+
"base": "data-[state=checked]:bg-secondary focus-visible:outline-secondary",
|
|
401
|
+
"icon": "group-data-[state=checked]:text-secondary"
|
|
402
|
+
},
|
|
403
|
+
"success": {
|
|
404
|
+
"base": "data-[state=checked]:bg-success focus-visible:outline-success",
|
|
405
|
+
"icon": "group-data-[state=checked]:text-success"
|
|
406
|
+
},
|
|
407
|
+
"info": {
|
|
408
|
+
"base": "data-[state=checked]:bg-info focus-visible:outline-info",
|
|
409
|
+
"icon": "group-data-[state=checked]:text-info"
|
|
410
|
+
},
|
|
411
|
+
"warning": {
|
|
412
|
+
"base": "data-[state=checked]:bg-warning focus-visible:outline-warning",
|
|
413
|
+
"icon": "group-data-[state=checked]:text-warning"
|
|
414
|
+
},
|
|
415
|
+
"error": {
|
|
416
|
+
"base": "data-[state=checked]:bg-error focus-visible:outline-error",
|
|
417
|
+
"icon": "group-data-[state=checked]:text-error"
|
|
418
|
+
},
|
|
419
|
+
"neutral": {
|
|
420
|
+
"base": "data-[state=checked]:bg-inverted focus-visible:outline-inverted",
|
|
421
|
+
"icon": "group-data-[state=checked]:text-highlighted"
|
|
422
|
+
}
|
|
423
|
+
},
|
|
424
|
+
"size": {
|
|
425
|
+
"xs": {
|
|
426
|
+
"base": "w-7",
|
|
427
|
+
"container": "h-4",
|
|
428
|
+
"thumb": "size-3 data-[state=checked]:translate-x-3 data-[state=checked]:rtl:-translate-x-3",
|
|
429
|
+
"wrapper": "text-xs"
|
|
430
|
+
},
|
|
431
|
+
"sm": {
|
|
432
|
+
"base": "w-8",
|
|
433
|
+
"container": "h-4",
|
|
434
|
+
"thumb": "size-3.5 data-[state=checked]:translate-x-3.5 data-[state=checked]:rtl:-translate-x-3.5",
|
|
435
|
+
"wrapper": "text-xs"
|
|
436
|
+
},
|
|
437
|
+
"md": {
|
|
438
|
+
"base": "w-9",
|
|
439
|
+
"container": "h-5",
|
|
440
|
+
"thumb": "size-4 data-[state=checked]:translate-x-4 data-[state=checked]:rtl:-translate-x-4",
|
|
441
|
+
"wrapper": "text-sm"
|
|
442
|
+
},
|
|
443
|
+
"lg": {
|
|
444
|
+
"base": "w-10",
|
|
445
|
+
"container": "h-5",
|
|
446
|
+
"thumb": "size-4.5 data-[state=checked]:translate-x-4.5 data-[state=checked]:rtl:-translate-x-4.5",
|
|
447
|
+
"wrapper": "text-sm"
|
|
448
|
+
},
|
|
449
|
+
"xl": {
|
|
450
|
+
"base": "w-11",
|
|
451
|
+
"container": "h-6",
|
|
452
|
+
"thumb": "size-5 data-[state=checked]:translate-x-5 data-[state=checked]:rtl:-translate-x-5",
|
|
453
|
+
"wrapper": "text-base"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
"checked": {
|
|
457
|
+
"true": {
|
|
458
|
+
"icon": "group-data-[state=checked]:opacity-100"
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
"unchecked": {
|
|
462
|
+
"true": {
|
|
463
|
+
"icon": "group-data-[state=unchecked]:opacity-100"
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
"loading": {
|
|
467
|
+
"true": {
|
|
468
|
+
"icon": "animate-spin"
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
"required": {
|
|
472
|
+
"true": {
|
|
473
|
+
"label": "after:content-['*'] after:ms-0.5 after:text-error"
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
"disabled": {
|
|
477
|
+
"true": {
|
|
478
|
+
"root": "opacity-75",
|
|
479
|
+
"base": "cursor-not-allowed",
|
|
480
|
+
"label": "cursor-not-allowed",
|
|
481
|
+
"description": "cursor-not-allowed"
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
"defaultVariants": {
|
|
486
|
+
"color": "primary",
|
|
487
|
+
"size": "md"
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
const _sfc_main$3 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
491
|
+
__name: "USwitch",
|
|
492
|
+
__ssrInlineRender: true,
|
|
493
|
+
props: /* @__PURE__ */ mergeModels({
|
|
494
|
+
as: { type: null, required: false },
|
|
495
|
+
color: { type: null, required: false },
|
|
496
|
+
size: { type: null, required: false },
|
|
497
|
+
loading: { type: Boolean, required: false },
|
|
498
|
+
loadingIcon: { type: null, required: false },
|
|
499
|
+
checkedIcon: { type: null, required: false },
|
|
500
|
+
uncheckedIcon: { type: null, required: false },
|
|
501
|
+
label: { type: String, required: false },
|
|
502
|
+
description: { type: String, required: false },
|
|
503
|
+
class: { type: null, required: false },
|
|
504
|
+
ui: { type: Object, required: false },
|
|
505
|
+
disabled: { type: Boolean, required: false },
|
|
506
|
+
id: { type: String, required: false },
|
|
507
|
+
name: { type: String, required: false },
|
|
508
|
+
required: { type: Boolean, required: false },
|
|
509
|
+
value: { type: String, required: false },
|
|
510
|
+
defaultValue: { type: Boolean, required: false }
|
|
511
|
+
}, {
|
|
512
|
+
"modelValue": { type: Boolean, ...{ default: void 0 } },
|
|
513
|
+
"modelModifiers": {}
|
|
514
|
+
}),
|
|
515
|
+
emits: /* @__PURE__ */ mergeModels(["change"], ["update:modelValue"]),
|
|
516
|
+
setup(__props, { emit: __emit }) {
|
|
517
|
+
const props = __props;
|
|
518
|
+
const slots = useSlots();
|
|
519
|
+
const emits = __emit;
|
|
520
|
+
const modelValue = useModel(__props, "modelValue", { type: Boolean, ...{ default: void 0 } });
|
|
521
|
+
const appConfig = useAppConfig();
|
|
522
|
+
const uiProp = useComponentUI("switch", props);
|
|
523
|
+
const rootProps = useForwardProps(reactivePick(props, "required", "value", "defaultValue"));
|
|
524
|
+
const { id: _id, emitFormChange, emitFormInput, size, color, name, disabled, ariaAttrs } = useFormField(props);
|
|
525
|
+
const id = _id.value ?? useId();
|
|
526
|
+
const attrs = useAttrs();
|
|
527
|
+
const forwardedAttrs = computed(() => {
|
|
528
|
+
const { "data-state": _, ...rest } = attrs;
|
|
529
|
+
return rest;
|
|
530
|
+
});
|
|
531
|
+
const ui = computed(() => tv({ extend: tv(theme$2), ...appConfig.ui?.switch || {} })({
|
|
532
|
+
size: size.value,
|
|
533
|
+
color: color.value,
|
|
534
|
+
required: props.required,
|
|
535
|
+
loading: props.loading,
|
|
536
|
+
disabled: disabled.value || props.loading
|
|
537
|
+
}));
|
|
538
|
+
function onUpdate(value) {
|
|
539
|
+
const event = new Event("change", { target: { value } });
|
|
540
|
+
emits("change", event);
|
|
541
|
+
emitFormChange();
|
|
542
|
+
emitFormInput();
|
|
543
|
+
}
|
|
544
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
545
|
+
_push(ssrRenderComponent(unref(Primitive), mergeProps({
|
|
546
|
+
as: __props.as,
|
|
547
|
+
"data-slot": "root",
|
|
548
|
+
class: ui.value.root({ class: [unref(uiProp)?.root, props.class] })
|
|
549
|
+
}, _attrs), {
|
|
550
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
551
|
+
if (_push2) {
|
|
552
|
+
_push2(`<div data-slot="container" class="${ssrRenderClass(ui.value.container({ class: unref(uiProp)?.container }))}"${_scopeId}>`);
|
|
553
|
+
_push2(ssrRenderComponent(unref(SwitchRoot), mergeProps({ id: unref(id) }, { ...unref(rootProps), ...forwardedAttrs.value, ...unref(ariaAttrs) }, {
|
|
554
|
+
modelValue: modelValue.value,
|
|
555
|
+
"onUpdate:modelValue": [($event) => modelValue.value = $event, onUpdate],
|
|
556
|
+
name: unref(name),
|
|
557
|
+
disabled: unref(disabled) || __props.loading,
|
|
558
|
+
"data-slot": "base",
|
|
559
|
+
class: ui.value.base({ class: unref(uiProp)?.base })
|
|
560
|
+
}), {
|
|
561
|
+
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
562
|
+
if (_push3) {
|
|
563
|
+
_push3(ssrRenderComponent(unref(SwitchThumb), {
|
|
564
|
+
"data-slot": "thumb",
|
|
565
|
+
class: ui.value.thumb({ class: unref(uiProp)?.thumb })
|
|
566
|
+
}, {
|
|
567
|
+
default: withCtx((_3, _push4, _parent4, _scopeId3) => {
|
|
568
|
+
if (_push4) {
|
|
569
|
+
if (__props.loading) {
|
|
570
|
+
_push4(ssrRenderComponent(_sfc_main$m, {
|
|
571
|
+
name: __props.loadingIcon || unref(appConfig).ui.icons.loading,
|
|
572
|
+
"data-slot": "icon",
|
|
573
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, checked: true, unchecked: true })
|
|
574
|
+
}, null, _parent4, _scopeId3));
|
|
575
|
+
} else {
|
|
576
|
+
_push4(`<!--[-->`);
|
|
577
|
+
if (__props.checkedIcon) {
|
|
578
|
+
_push4(ssrRenderComponent(_sfc_main$m, {
|
|
579
|
+
name: __props.checkedIcon,
|
|
580
|
+
"data-slot": "icon",
|
|
581
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, checked: true })
|
|
582
|
+
}, null, _parent4, _scopeId3));
|
|
583
|
+
} else {
|
|
584
|
+
_push4(`<!---->`);
|
|
585
|
+
}
|
|
586
|
+
if (__props.uncheckedIcon) {
|
|
587
|
+
_push4(ssrRenderComponent(_sfc_main$m, {
|
|
588
|
+
name: __props.uncheckedIcon,
|
|
589
|
+
"data-slot": "icon",
|
|
590
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, unchecked: true })
|
|
591
|
+
}, null, _parent4, _scopeId3));
|
|
592
|
+
} else {
|
|
593
|
+
_push4(`<!---->`);
|
|
594
|
+
}
|
|
595
|
+
_push4(`<!--]-->`);
|
|
596
|
+
}
|
|
597
|
+
} else {
|
|
598
|
+
return [
|
|
599
|
+
__props.loading ? (openBlock(), createBlock(_sfc_main$m, {
|
|
600
|
+
key: 0,
|
|
601
|
+
name: __props.loadingIcon || unref(appConfig).ui.icons.loading,
|
|
602
|
+
"data-slot": "icon",
|
|
603
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, checked: true, unchecked: true })
|
|
604
|
+
}, null, 8, ["name", "class"])) : (openBlock(), createBlock(Fragment, { key: 1 }, [
|
|
605
|
+
__props.checkedIcon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
606
|
+
key: 0,
|
|
607
|
+
name: __props.checkedIcon,
|
|
608
|
+
"data-slot": "icon",
|
|
609
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, checked: true })
|
|
610
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true),
|
|
611
|
+
__props.uncheckedIcon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
612
|
+
key: 1,
|
|
613
|
+
name: __props.uncheckedIcon,
|
|
614
|
+
"data-slot": "icon",
|
|
615
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, unchecked: true })
|
|
616
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true)
|
|
617
|
+
], 64))
|
|
618
|
+
];
|
|
619
|
+
}
|
|
620
|
+
}),
|
|
621
|
+
_: 1
|
|
622
|
+
}, _parent3, _scopeId2));
|
|
623
|
+
} else {
|
|
624
|
+
return [
|
|
625
|
+
createVNode(unref(SwitchThumb), {
|
|
626
|
+
"data-slot": "thumb",
|
|
627
|
+
class: ui.value.thumb({ class: unref(uiProp)?.thumb })
|
|
628
|
+
}, {
|
|
629
|
+
default: withCtx(() => [
|
|
630
|
+
__props.loading ? (openBlock(), createBlock(_sfc_main$m, {
|
|
631
|
+
key: 0,
|
|
632
|
+
name: __props.loadingIcon || unref(appConfig).ui.icons.loading,
|
|
633
|
+
"data-slot": "icon",
|
|
634
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, checked: true, unchecked: true })
|
|
635
|
+
}, null, 8, ["name", "class"])) : (openBlock(), createBlock(Fragment, { key: 1 }, [
|
|
636
|
+
__props.checkedIcon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
637
|
+
key: 0,
|
|
638
|
+
name: __props.checkedIcon,
|
|
639
|
+
"data-slot": "icon",
|
|
640
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, checked: true })
|
|
641
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true),
|
|
642
|
+
__props.uncheckedIcon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
643
|
+
key: 1,
|
|
644
|
+
name: __props.uncheckedIcon,
|
|
645
|
+
"data-slot": "icon",
|
|
646
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, unchecked: true })
|
|
647
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true)
|
|
648
|
+
], 64))
|
|
649
|
+
]),
|
|
650
|
+
_: 1
|
|
651
|
+
}, 8, ["class"])
|
|
652
|
+
];
|
|
653
|
+
}
|
|
654
|
+
}),
|
|
655
|
+
_: 1
|
|
656
|
+
}, _parent2, _scopeId));
|
|
657
|
+
_push2(`</div>`);
|
|
658
|
+
if (__props.label || !!slots.label || (__props.description || !!slots.description)) {
|
|
659
|
+
_push2(`<div data-slot="wrapper" class="${ssrRenderClass(ui.value.wrapper({ class: unref(uiProp)?.wrapper }))}"${_scopeId}>`);
|
|
660
|
+
if (__props.label || !!slots.label) {
|
|
661
|
+
_push2(ssrRenderComponent(unref(Label), {
|
|
662
|
+
for: unref(id),
|
|
663
|
+
"data-slot": "label",
|
|
664
|
+
class: ui.value.label({ class: unref(uiProp)?.label })
|
|
665
|
+
}, {
|
|
666
|
+
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
667
|
+
if (_push3) {
|
|
668
|
+
ssrRenderSlot(_ctx.$slots, "label", { label: __props.label }, () => {
|
|
669
|
+
_push3(`${ssrInterpolate(__props.label)}`);
|
|
670
|
+
}, _push3, _parent3, _scopeId2);
|
|
671
|
+
} else {
|
|
672
|
+
return [
|
|
673
|
+
renderSlot(_ctx.$slots, "label", { label: __props.label }, () => [
|
|
674
|
+
createTextVNode(toDisplayString(__props.label), 1)
|
|
675
|
+
])
|
|
676
|
+
];
|
|
677
|
+
}
|
|
678
|
+
}),
|
|
679
|
+
_: 3
|
|
680
|
+
}, _parent2, _scopeId));
|
|
681
|
+
} else {
|
|
682
|
+
_push2(`<!---->`);
|
|
683
|
+
}
|
|
684
|
+
if (__props.description || !!slots.description) {
|
|
685
|
+
_push2(`<p data-slot="description" class="${ssrRenderClass(ui.value.description({ class: unref(uiProp)?.description }))}"${_scopeId}>`);
|
|
686
|
+
ssrRenderSlot(_ctx.$slots, "description", { description: __props.description }, () => {
|
|
687
|
+
_push2(`${ssrInterpolate(__props.description)}`);
|
|
688
|
+
}, _push2, _parent2, _scopeId);
|
|
689
|
+
_push2(`</p>`);
|
|
690
|
+
} else {
|
|
691
|
+
_push2(`<!---->`);
|
|
692
|
+
}
|
|
693
|
+
_push2(`</div>`);
|
|
694
|
+
} else {
|
|
695
|
+
_push2(`<!---->`);
|
|
696
|
+
}
|
|
697
|
+
} else {
|
|
698
|
+
return [
|
|
699
|
+
createVNode("div", {
|
|
700
|
+
"data-slot": "container",
|
|
701
|
+
class: ui.value.container({ class: unref(uiProp)?.container })
|
|
702
|
+
}, [
|
|
703
|
+
createVNode(unref(SwitchRoot), mergeProps({ id: unref(id) }, { ...unref(rootProps), ...forwardedAttrs.value, ...unref(ariaAttrs) }, {
|
|
704
|
+
modelValue: modelValue.value,
|
|
705
|
+
"onUpdate:modelValue": [($event) => modelValue.value = $event, onUpdate],
|
|
706
|
+
name: unref(name),
|
|
707
|
+
disabled: unref(disabled) || __props.loading,
|
|
708
|
+
"data-slot": "base",
|
|
709
|
+
class: ui.value.base({ class: unref(uiProp)?.base })
|
|
710
|
+
}), {
|
|
711
|
+
default: withCtx(() => [
|
|
712
|
+
createVNode(unref(SwitchThumb), {
|
|
713
|
+
"data-slot": "thumb",
|
|
714
|
+
class: ui.value.thumb({ class: unref(uiProp)?.thumb })
|
|
715
|
+
}, {
|
|
716
|
+
default: withCtx(() => [
|
|
717
|
+
__props.loading ? (openBlock(), createBlock(_sfc_main$m, {
|
|
718
|
+
key: 0,
|
|
719
|
+
name: __props.loadingIcon || unref(appConfig).ui.icons.loading,
|
|
720
|
+
"data-slot": "icon",
|
|
721
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, checked: true, unchecked: true })
|
|
722
|
+
}, null, 8, ["name", "class"])) : (openBlock(), createBlock(Fragment, { key: 1 }, [
|
|
723
|
+
__props.checkedIcon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
724
|
+
key: 0,
|
|
725
|
+
name: __props.checkedIcon,
|
|
726
|
+
"data-slot": "icon",
|
|
727
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, checked: true })
|
|
728
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true),
|
|
729
|
+
__props.uncheckedIcon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
730
|
+
key: 1,
|
|
731
|
+
name: __props.uncheckedIcon,
|
|
732
|
+
"data-slot": "icon",
|
|
733
|
+
class: ui.value.icon({ class: unref(uiProp)?.icon, unchecked: true })
|
|
734
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true)
|
|
735
|
+
], 64))
|
|
736
|
+
]),
|
|
737
|
+
_: 1
|
|
738
|
+
}, 8, ["class"])
|
|
739
|
+
]),
|
|
740
|
+
_: 1
|
|
741
|
+
}, 16, ["id", "modelValue", "onUpdate:modelValue", "name", "disabled", "class"])
|
|
742
|
+
], 2),
|
|
743
|
+
__props.label || !!slots.label || (__props.description || !!slots.description) ? (openBlock(), createBlock("div", {
|
|
744
|
+
key: 0,
|
|
745
|
+
"data-slot": "wrapper",
|
|
746
|
+
class: ui.value.wrapper({ class: unref(uiProp)?.wrapper })
|
|
747
|
+
}, [
|
|
748
|
+
__props.label || !!slots.label ? (openBlock(), createBlock(unref(Label), {
|
|
749
|
+
key: 0,
|
|
750
|
+
for: unref(id),
|
|
751
|
+
"data-slot": "label",
|
|
752
|
+
class: ui.value.label({ class: unref(uiProp)?.label })
|
|
753
|
+
}, {
|
|
754
|
+
default: withCtx(() => [
|
|
755
|
+
renderSlot(_ctx.$slots, "label", { label: __props.label }, () => [
|
|
756
|
+
createTextVNode(toDisplayString(__props.label), 1)
|
|
757
|
+
])
|
|
758
|
+
]),
|
|
759
|
+
_: 3
|
|
760
|
+
}, 8, ["for", "class"])) : createCommentVNode("", true),
|
|
761
|
+
__props.description || !!slots.description ? (openBlock(), createBlock("p", {
|
|
762
|
+
key: 1,
|
|
763
|
+
"data-slot": "description",
|
|
764
|
+
class: ui.value.description({ class: unref(uiProp)?.description })
|
|
765
|
+
}, [
|
|
766
|
+
renderSlot(_ctx.$slots, "description", { description: __props.description }, () => [
|
|
767
|
+
createTextVNode(toDisplayString(__props.description), 1)
|
|
768
|
+
])
|
|
769
|
+
], 2)) : createCommentVNode("", true)
|
|
770
|
+
], 2)) : createCommentVNode("", true)
|
|
771
|
+
];
|
|
772
|
+
}
|
|
773
|
+
}),
|
|
774
|
+
_: 3
|
|
775
|
+
}, _parent));
|
|
776
|
+
};
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
const _sfc_setup$3 = _sfc_main$3.setup;
|
|
780
|
+
_sfc_main$3.setup = (props, ctx) => {
|
|
781
|
+
const ssrContext = useSSRContext();
|
|
782
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("../../node_modules/@nuxt/ui/dist/runtime/components/Switch.vue");
|
|
783
|
+
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
|
|
784
|
+
};
|
|
785
|
+
const theme$1 = {
|
|
786
|
+
"slots": {
|
|
787
|
+
"root": "",
|
|
788
|
+
"wrapper": "",
|
|
789
|
+
"labelWrapper": "flex content-center items-center justify-between gap-1",
|
|
790
|
+
"label": "block font-medium text-default",
|
|
791
|
+
"container": "relative",
|
|
792
|
+
"description": "text-muted",
|
|
793
|
+
"error": "mt-2 text-error",
|
|
794
|
+
"hint": "text-muted",
|
|
795
|
+
"help": "mt-2 text-muted"
|
|
796
|
+
},
|
|
797
|
+
"variants": {
|
|
798
|
+
"size": {
|
|
799
|
+
"xs": {
|
|
800
|
+
"root": "text-xs"
|
|
801
|
+
},
|
|
802
|
+
"sm": {
|
|
803
|
+
"root": "text-xs"
|
|
804
|
+
},
|
|
805
|
+
"md": {
|
|
806
|
+
"root": "text-sm"
|
|
807
|
+
},
|
|
808
|
+
"lg": {
|
|
809
|
+
"root": "text-sm"
|
|
810
|
+
},
|
|
811
|
+
"xl": {
|
|
812
|
+
"root": "text-base"
|
|
813
|
+
}
|
|
814
|
+
},
|
|
815
|
+
"required": {
|
|
816
|
+
"true": {
|
|
817
|
+
"label": "after:content-['*'] after:ms-0.5 after:text-error"
|
|
818
|
+
}
|
|
819
|
+
},
|
|
820
|
+
"orientation": {
|
|
821
|
+
"vertical": {
|
|
822
|
+
"container": "mt-1"
|
|
823
|
+
},
|
|
824
|
+
"horizontal": {
|
|
825
|
+
"root": "flex justify-between place-items-baseline gap-2"
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
},
|
|
829
|
+
"defaultVariants": {
|
|
830
|
+
"size": "md",
|
|
831
|
+
"orientation": "vertical"
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
const _sfc_main$2 = {
|
|
835
|
+
__name: "UFormField",
|
|
836
|
+
__ssrInlineRender: true,
|
|
837
|
+
props: {
|
|
838
|
+
as: { type: null, required: false },
|
|
839
|
+
name: { type: String, required: false },
|
|
840
|
+
errorPattern: { type: null, required: false },
|
|
841
|
+
label: { type: String, required: false },
|
|
842
|
+
description: { type: String, required: false },
|
|
843
|
+
help: { type: String, required: false },
|
|
844
|
+
error: { type: [Boolean, String], required: false, default: void 0 },
|
|
845
|
+
hint: { type: String, required: false },
|
|
846
|
+
size: { type: null, required: false },
|
|
847
|
+
required: { type: Boolean, required: false },
|
|
848
|
+
eagerValidation: { type: Boolean, required: false },
|
|
849
|
+
validateOnInputDelay: { type: Number, required: false },
|
|
850
|
+
orientation: { type: null, required: false },
|
|
851
|
+
class: { type: null, required: false },
|
|
852
|
+
ui: { type: Object, required: false }
|
|
853
|
+
},
|
|
854
|
+
setup(__props) {
|
|
855
|
+
const props = __props;
|
|
856
|
+
const slots = useSlots();
|
|
857
|
+
const appConfig = useAppConfig();
|
|
858
|
+
const uiProp = useComponentUI("formField", props);
|
|
859
|
+
const ui = computed(() => tv({ extend: tv(theme$1), ...appConfig.ui?.formField || {} })({
|
|
860
|
+
size: props.size,
|
|
861
|
+
required: props.required,
|
|
862
|
+
orientation: props.orientation
|
|
863
|
+
}));
|
|
864
|
+
const formErrors = inject(formErrorsInjectionKey, null);
|
|
865
|
+
const error = computed(() => props.error || formErrors?.value?.find((error2) => error2.name === props.name || props.errorPattern && error2.name?.match(props.errorPattern))?.message);
|
|
866
|
+
const id = ref(useId());
|
|
867
|
+
const ariaId = id.value;
|
|
868
|
+
const formInputs = inject(formInputsInjectionKey, void 0);
|
|
869
|
+
watch(id, () => {
|
|
870
|
+
if (formInputs && props.name) {
|
|
871
|
+
formInputs.value[props.name] = { id: id.value, pattern: props.errorPattern };
|
|
872
|
+
}
|
|
873
|
+
}, { immediate: true });
|
|
874
|
+
provide(inputIdInjectionKey, id);
|
|
875
|
+
provide(formFieldInjectionKey, computed(() => ({
|
|
876
|
+
error: error.value,
|
|
877
|
+
name: props.name,
|
|
878
|
+
size: props.size,
|
|
879
|
+
eagerValidation: props.eagerValidation,
|
|
880
|
+
validateOnInputDelay: props.validateOnInputDelay,
|
|
881
|
+
errorPattern: props.errorPattern,
|
|
882
|
+
hint: props.hint,
|
|
883
|
+
description: props.description,
|
|
884
|
+
help: props.help,
|
|
885
|
+
ariaId
|
|
886
|
+
})));
|
|
887
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
888
|
+
_push(ssrRenderComponent(unref(Primitive), mergeProps({
|
|
889
|
+
as: __props.as,
|
|
890
|
+
"data-orientation": __props.orientation,
|
|
891
|
+
"data-slot": "root",
|
|
892
|
+
class: ui.value.root({ class: [unref(uiProp)?.root, props.class] })
|
|
893
|
+
}, _attrs), {
|
|
894
|
+
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
895
|
+
if (_push2) {
|
|
896
|
+
_push2(`<div data-slot="wrapper" class="${ssrRenderClass(ui.value.wrapper({ class: unref(uiProp)?.wrapper }))}"${_scopeId}>`);
|
|
897
|
+
if (__props.label || !!slots.label) {
|
|
898
|
+
_push2(`<div data-slot="labelWrapper" class="${ssrRenderClass(ui.value.labelWrapper({ class: unref(uiProp)?.labelWrapper }))}"${_scopeId}>`);
|
|
899
|
+
_push2(ssrRenderComponent(unref(Label), {
|
|
900
|
+
for: id.value,
|
|
901
|
+
"data-slot": "label",
|
|
902
|
+
class: ui.value.label({ class: unref(uiProp)?.label })
|
|
903
|
+
}, {
|
|
904
|
+
default: withCtx((_2, _push3, _parent3, _scopeId2) => {
|
|
905
|
+
if (_push3) {
|
|
906
|
+
ssrRenderSlot(_ctx.$slots, "label", { label: __props.label }, () => {
|
|
907
|
+
_push3(`${ssrInterpolate(__props.label)}`);
|
|
908
|
+
}, _push3, _parent3, _scopeId2);
|
|
909
|
+
} else {
|
|
910
|
+
return [
|
|
911
|
+
renderSlot(_ctx.$slots, "label", { label: __props.label }, () => [
|
|
912
|
+
createTextVNode(toDisplayString(__props.label), 1)
|
|
913
|
+
])
|
|
914
|
+
];
|
|
915
|
+
}
|
|
916
|
+
}),
|
|
917
|
+
_: 3
|
|
918
|
+
}, _parent2, _scopeId));
|
|
919
|
+
if (__props.hint || !!slots.hint) {
|
|
920
|
+
_push2(`<span${ssrRenderAttr("id", `${unref(ariaId)}-hint`)} data-slot="hint" class="${ssrRenderClass(ui.value.hint({ class: unref(uiProp)?.hint }))}"${_scopeId}>`);
|
|
921
|
+
ssrRenderSlot(_ctx.$slots, "hint", { hint: __props.hint }, () => {
|
|
922
|
+
_push2(`${ssrInterpolate(__props.hint)}`);
|
|
923
|
+
}, _push2, _parent2, _scopeId);
|
|
924
|
+
_push2(`</span>`);
|
|
925
|
+
} else {
|
|
926
|
+
_push2(`<!---->`);
|
|
927
|
+
}
|
|
928
|
+
_push2(`</div>`);
|
|
929
|
+
} else {
|
|
930
|
+
_push2(`<!---->`);
|
|
931
|
+
}
|
|
932
|
+
if (__props.description || !!slots.description) {
|
|
933
|
+
_push2(`<p${ssrRenderAttr("id", `${unref(ariaId)}-description`)} data-slot="description" class="${ssrRenderClass(ui.value.description({ class: unref(uiProp)?.description }))}"${_scopeId}>`);
|
|
934
|
+
ssrRenderSlot(_ctx.$slots, "description", { description: __props.description }, () => {
|
|
935
|
+
_push2(`${ssrInterpolate(__props.description)}`);
|
|
936
|
+
}, _push2, _parent2, _scopeId);
|
|
937
|
+
_push2(`</p>`);
|
|
938
|
+
} else {
|
|
939
|
+
_push2(`<!---->`);
|
|
940
|
+
}
|
|
941
|
+
_push2(`</div><div class="${ssrRenderClass([(__props.label || !!slots.label || __props.description || !!slots.description) && ui.value.container({ class: unref(uiProp)?.container })])}"${_scopeId}>`);
|
|
942
|
+
ssrRenderSlot(_ctx.$slots, "default", { error: error.value }, null, _push2, _parent2, _scopeId);
|
|
943
|
+
if (props.error !== false && (typeof error.value === "string" && error.value || !!slots.error)) {
|
|
944
|
+
_push2(`<div${ssrRenderAttr("id", `${unref(ariaId)}-error`)} data-slot="error" class="${ssrRenderClass(ui.value.error({ class: unref(uiProp)?.error }))}"${_scopeId}>`);
|
|
945
|
+
ssrRenderSlot(_ctx.$slots, "error", { error: error.value }, () => {
|
|
946
|
+
_push2(`${ssrInterpolate(error.value)}`);
|
|
947
|
+
}, _push2, _parent2, _scopeId);
|
|
948
|
+
_push2(`</div>`);
|
|
949
|
+
} else if (__props.help || !!slots.help) {
|
|
950
|
+
_push2(`<div${ssrRenderAttr("id", `${unref(ariaId)}-help`)} data-slot="help" class="${ssrRenderClass(ui.value.help({ class: unref(uiProp)?.help }))}"${_scopeId}>`);
|
|
951
|
+
ssrRenderSlot(_ctx.$slots, "help", { help: __props.help }, () => {
|
|
952
|
+
_push2(`${ssrInterpolate(__props.help)}`);
|
|
953
|
+
}, _push2, _parent2, _scopeId);
|
|
954
|
+
_push2(`</div>`);
|
|
955
|
+
} else {
|
|
956
|
+
_push2(`<!---->`);
|
|
957
|
+
}
|
|
958
|
+
_push2(`</div>`);
|
|
959
|
+
} else {
|
|
960
|
+
return [
|
|
961
|
+
createVNode("div", {
|
|
962
|
+
"data-slot": "wrapper",
|
|
963
|
+
class: ui.value.wrapper({ class: unref(uiProp)?.wrapper })
|
|
964
|
+
}, [
|
|
965
|
+
__props.label || !!slots.label ? (openBlock(), createBlock("div", {
|
|
966
|
+
key: 0,
|
|
967
|
+
"data-slot": "labelWrapper",
|
|
968
|
+
class: ui.value.labelWrapper({ class: unref(uiProp)?.labelWrapper })
|
|
969
|
+
}, [
|
|
970
|
+
createVNode(unref(Label), {
|
|
971
|
+
for: id.value,
|
|
972
|
+
"data-slot": "label",
|
|
973
|
+
class: ui.value.label({ class: unref(uiProp)?.label })
|
|
974
|
+
}, {
|
|
975
|
+
default: withCtx(() => [
|
|
976
|
+
renderSlot(_ctx.$slots, "label", { label: __props.label }, () => [
|
|
977
|
+
createTextVNode(toDisplayString(__props.label), 1)
|
|
978
|
+
])
|
|
979
|
+
]),
|
|
980
|
+
_: 3
|
|
981
|
+
}, 8, ["for", "class"]),
|
|
982
|
+
__props.hint || !!slots.hint ? (openBlock(), createBlock("span", {
|
|
983
|
+
key: 0,
|
|
984
|
+
id: `${unref(ariaId)}-hint`,
|
|
985
|
+
"data-slot": "hint",
|
|
986
|
+
class: ui.value.hint({ class: unref(uiProp)?.hint })
|
|
987
|
+
}, [
|
|
988
|
+
renderSlot(_ctx.$slots, "hint", { hint: __props.hint }, () => [
|
|
989
|
+
createTextVNode(toDisplayString(__props.hint), 1)
|
|
990
|
+
])
|
|
991
|
+
], 10, ["id"])) : createCommentVNode("", true)
|
|
992
|
+
], 2)) : createCommentVNode("", true),
|
|
993
|
+
__props.description || !!slots.description ? (openBlock(), createBlock("p", {
|
|
994
|
+
key: 1,
|
|
995
|
+
id: `${unref(ariaId)}-description`,
|
|
996
|
+
"data-slot": "description",
|
|
997
|
+
class: ui.value.description({ class: unref(uiProp)?.description })
|
|
998
|
+
}, [
|
|
999
|
+
renderSlot(_ctx.$slots, "description", { description: __props.description }, () => [
|
|
1000
|
+
createTextVNode(toDisplayString(__props.description), 1)
|
|
1001
|
+
])
|
|
1002
|
+
], 10, ["id"])) : createCommentVNode("", true)
|
|
1003
|
+
], 2),
|
|
1004
|
+
createVNode("div", {
|
|
1005
|
+
class: [(__props.label || !!slots.label || __props.description || !!slots.description) && ui.value.container({ class: unref(uiProp)?.container })]
|
|
1006
|
+
}, [
|
|
1007
|
+
renderSlot(_ctx.$slots, "default", { error: error.value }),
|
|
1008
|
+
props.error !== false && (typeof error.value === "string" && error.value || !!slots.error) ? (openBlock(), createBlock("div", {
|
|
1009
|
+
key: 0,
|
|
1010
|
+
id: `${unref(ariaId)}-error`,
|
|
1011
|
+
"data-slot": "error",
|
|
1012
|
+
class: ui.value.error({ class: unref(uiProp)?.error })
|
|
1013
|
+
}, [
|
|
1014
|
+
renderSlot(_ctx.$slots, "error", { error: error.value }, () => [
|
|
1015
|
+
createTextVNode(toDisplayString(error.value), 1)
|
|
1016
|
+
])
|
|
1017
|
+
], 10, ["id"])) : __props.help || !!slots.help ? (openBlock(), createBlock("div", {
|
|
1018
|
+
key: 1,
|
|
1019
|
+
id: `${unref(ariaId)}-help`,
|
|
1020
|
+
"data-slot": "help",
|
|
1021
|
+
class: ui.value.help({ class: unref(uiProp)?.help })
|
|
1022
|
+
}, [
|
|
1023
|
+
renderSlot(_ctx.$slots, "help", { help: __props.help }, () => [
|
|
1024
|
+
createTextVNode(toDisplayString(__props.help), 1)
|
|
1025
|
+
])
|
|
1026
|
+
], 10, ["id"])) : createCommentVNode("", true)
|
|
1027
|
+
], 2)
|
|
1028
|
+
];
|
|
1029
|
+
}
|
|
1030
|
+
}),
|
|
1031
|
+
_: 3
|
|
1032
|
+
}, _parent));
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
1037
|
+
_sfc_main$2.setup = (props, ctx) => {
|
|
1038
|
+
const ssrContext = useSSRContext();
|
|
1039
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("../../node_modules/@nuxt/ui/dist/runtime/components/FormField.vue");
|
|
1040
|
+
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
1041
|
+
};
|
|
1042
|
+
const theme = {
|
|
1043
|
+
"slots": {
|
|
1044
|
+
"base": [
|
|
1045
|
+
"relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75",
|
|
1046
|
+
"transition-colors"
|
|
1047
|
+
],
|
|
1048
|
+
"leading": "absolute inset-y-0 start-0 flex items-center",
|
|
1049
|
+
"leadingIcon": "shrink-0 text-dimmed",
|
|
1050
|
+
"leadingAvatar": "shrink-0",
|
|
1051
|
+
"leadingAvatarSize": "",
|
|
1052
|
+
"trailing": "absolute inset-y-0 end-0 flex items-center",
|
|
1053
|
+
"trailingIcon": "shrink-0 text-dimmed",
|
|
1054
|
+
"value": "truncate pointer-events-none",
|
|
1055
|
+
"placeholder": "truncate text-dimmed",
|
|
1056
|
+
"arrow": "fill-default",
|
|
1057
|
+
"content": "max-h-60 w-(--reka-select-trigger-width) bg-default shadow-lg rounded-md ring ring-default overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--reka-select-content-transform-origin) pointer-events-auto flex flex-col",
|
|
1058
|
+
"viewport": "relative divide-y divide-default scroll-py-1 overflow-y-auto flex-1",
|
|
1059
|
+
"group": "p-1 isolate",
|
|
1060
|
+
"empty": "text-center text-muted",
|
|
1061
|
+
"label": "font-semibold text-highlighted",
|
|
1062
|
+
"separator": "-mx-1 my-1 h-px bg-border",
|
|
1063
|
+
"item": [
|
|
1064
|
+
"group relative w-full flex items-start select-none outline-none before:absolute before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75 text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-data-disabled:before:bg-elevated/50",
|
|
1065
|
+
"transition-colors before:transition-colors"
|
|
1066
|
+
],
|
|
1067
|
+
"itemLeadingIcon": [
|
|
1068
|
+
"shrink-0 text-dimmed group-data-highlighted:not-group-data-disabled:text-default",
|
|
1069
|
+
"transition-colors"
|
|
1070
|
+
],
|
|
1071
|
+
"itemLeadingAvatar": "shrink-0",
|
|
1072
|
+
"itemLeadingAvatarSize": "",
|
|
1073
|
+
"itemLeadingChip": "shrink-0",
|
|
1074
|
+
"itemLeadingChipSize": "",
|
|
1075
|
+
"itemTrailing": "ms-auto inline-flex gap-1.5 items-center",
|
|
1076
|
+
"itemTrailingIcon": "shrink-0",
|
|
1077
|
+
"itemWrapper": "flex-1 flex flex-col min-w-0",
|
|
1078
|
+
"itemLabel": "truncate",
|
|
1079
|
+
"itemDescription": "truncate text-muted"
|
|
1080
|
+
},
|
|
1081
|
+
"variants": {
|
|
1082
|
+
"fieldGroup": {
|
|
1083
|
+
"horizontal": "not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]",
|
|
1084
|
+
"vertical": "not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]"
|
|
1085
|
+
},
|
|
1086
|
+
"size": {
|
|
1087
|
+
"xs": {
|
|
1088
|
+
"base": "px-2 py-1 text-xs gap-1",
|
|
1089
|
+
"leading": "ps-2",
|
|
1090
|
+
"trailing": "pe-2",
|
|
1091
|
+
"leadingIcon": "size-4",
|
|
1092
|
+
"leadingAvatarSize": "3xs",
|
|
1093
|
+
"trailingIcon": "size-4",
|
|
1094
|
+
"label": "p-1 text-[10px]/3 gap-1",
|
|
1095
|
+
"item": "p-1 text-xs gap-1",
|
|
1096
|
+
"itemLeadingIcon": "size-4",
|
|
1097
|
+
"itemLeadingAvatarSize": "3xs",
|
|
1098
|
+
"itemLeadingChip": "size-4",
|
|
1099
|
+
"itemLeadingChipSize": "sm",
|
|
1100
|
+
"itemTrailingIcon": "size-4",
|
|
1101
|
+
"empty": "p-1 text-xs"
|
|
1102
|
+
},
|
|
1103
|
+
"sm": {
|
|
1104
|
+
"base": "px-2.5 py-1.5 text-xs gap-1.5",
|
|
1105
|
+
"leading": "ps-2.5",
|
|
1106
|
+
"trailing": "pe-2.5",
|
|
1107
|
+
"leadingIcon": "size-4",
|
|
1108
|
+
"leadingAvatarSize": "3xs",
|
|
1109
|
+
"trailingIcon": "size-4",
|
|
1110
|
+
"label": "p-1.5 text-[10px]/3 gap-1.5",
|
|
1111
|
+
"item": "p-1.5 text-xs gap-1.5",
|
|
1112
|
+
"itemLeadingIcon": "size-4",
|
|
1113
|
+
"itemLeadingAvatarSize": "3xs",
|
|
1114
|
+
"itemLeadingChip": "size-4",
|
|
1115
|
+
"itemLeadingChipSize": "sm",
|
|
1116
|
+
"itemTrailingIcon": "size-4",
|
|
1117
|
+
"empty": "p-1.5 text-xs"
|
|
1118
|
+
},
|
|
1119
|
+
"md": {
|
|
1120
|
+
"base": "px-2.5 py-1.5 text-sm gap-1.5",
|
|
1121
|
+
"leading": "ps-2.5",
|
|
1122
|
+
"trailing": "pe-2.5",
|
|
1123
|
+
"leadingIcon": "size-5",
|
|
1124
|
+
"leadingAvatarSize": "2xs",
|
|
1125
|
+
"trailingIcon": "size-5",
|
|
1126
|
+
"label": "p-1.5 text-xs gap-1.5",
|
|
1127
|
+
"item": "p-1.5 text-sm gap-1.5",
|
|
1128
|
+
"itemLeadingIcon": "size-5",
|
|
1129
|
+
"itemLeadingAvatarSize": "2xs",
|
|
1130
|
+
"itemLeadingChip": "size-5",
|
|
1131
|
+
"itemLeadingChipSize": "md",
|
|
1132
|
+
"itemTrailingIcon": "size-5",
|
|
1133
|
+
"empty": "p-1.5 text-sm"
|
|
1134
|
+
},
|
|
1135
|
+
"lg": {
|
|
1136
|
+
"base": "px-3 py-2 text-sm gap-2",
|
|
1137
|
+
"leading": "ps-3",
|
|
1138
|
+
"trailing": "pe-3",
|
|
1139
|
+
"leadingIcon": "size-5",
|
|
1140
|
+
"leadingAvatarSize": "2xs",
|
|
1141
|
+
"trailingIcon": "size-5",
|
|
1142
|
+
"label": "p-2 text-xs gap-2",
|
|
1143
|
+
"item": "p-2 text-sm gap-2",
|
|
1144
|
+
"itemLeadingIcon": "size-5",
|
|
1145
|
+
"itemLeadingAvatarSize": "2xs",
|
|
1146
|
+
"itemLeadingChip": "size-5",
|
|
1147
|
+
"itemLeadingChipSize": "md",
|
|
1148
|
+
"itemTrailingIcon": "size-5",
|
|
1149
|
+
"empty": "p-2 text-sm"
|
|
1150
|
+
},
|
|
1151
|
+
"xl": {
|
|
1152
|
+
"base": "px-3 py-2 text-base gap-2",
|
|
1153
|
+
"leading": "ps-3",
|
|
1154
|
+
"trailing": "pe-3",
|
|
1155
|
+
"leadingIcon": "size-6",
|
|
1156
|
+
"leadingAvatarSize": "xs",
|
|
1157
|
+
"trailingIcon": "size-6",
|
|
1158
|
+
"label": "p-2 text-sm gap-2",
|
|
1159
|
+
"item": "p-2 text-base gap-2",
|
|
1160
|
+
"itemLeadingIcon": "size-6",
|
|
1161
|
+
"itemLeadingAvatarSize": "xs",
|
|
1162
|
+
"itemLeadingChip": "size-6",
|
|
1163
|
+
"itemLeadingChipSize": "lg",
|
|
1164
|
+
"itemTrailingIcon": "size-6",
|
|
1165
|
+
"empty": "p-2 text-base"
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
"variant": {
|
|
1169
|
+
"outline": "text-highlighted bg-default ring ring-inset ring-accented hover:bg-elevated disabled:bg-default",
|
|
1170
|
+
"soft": "text-highlighted bg-elevated/50 hover:bg-elevated focus:bg-elevated disabled:bg-elevated/50",
|
|
1171
|
+
"subtle": "text-highlighted bg-elevated ring ring-inset ring-accented hover:bg-accented/75 disabled:bg-elevated",
|
|
1172
|
+
"ghost": "text-highlighted bg-transparent hover:bg-elevated focus:bg-elevated disabled:bg-transparent dark:disabled:bg-transparent",
|
|
1173
|
+
"none": "text-highlighted bg-transparent"
|
|
1174
|
+
},
|
|
1175
|
+
"color": {
|
|
1176
|
+
"primary": "",
|
|
1177
|
+
"secondary": "",
|
|
1178
|
+
"success": "",
|
|
1179
|
+
"info": "",
|
|
1180
|
+
"warning": "",
|
|
1181
|
+
"error": "",
|
|
1182
|
+
"neutral": ""
|
|
1183
|
+
},
|
|
1184
|
+
"leading": {
|
|
1185
|
+
"true": ""
|
|
1186
|
+
},
|
|
1187
|
+
"trailing": {
|
|
1188
|
+
"true": ""
|
|
1189
|
+
},
|
|
1190
|
+
"loading": {
|
|
1191
|
+
"true": ""
|
|
1192
|
+
},
|
|
1193
|
+
"highlight": {
|
|
1194
|
+
"true": ""
|
|
1195
|
+
},
|
|
1196
|
+
"fixed": {
|
|
1197
|
+
"false": ""
|
|
1198
|
+
},
|
|
1199
|
+
"type": {
|
|
1200
|
+
"file": "file:me-1.5 file:font-medium file:text-muted file:outline-none"
|
|
1201
|
+
}
|
|
1202
|
+
},
|
|
1203
|
+
"compoundVariants": [
|
|
1204
|
+
{
|
|
1205
|
+
"color": "primary",
|
|
1206
|
+
"variant": [
|
|
1207
|
+
"outline",
|
|
1208
|
+
"subtle"
|
|
1209
|
+
],
|
|
1210
|
+
"class": "focus:ring-2 focus:ring-inset focus:ring-primary"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
"color": "secondary",
|
|
1214
|
+
"variant": [
|
|
1215
|
+
"outline",
|
|
1216
|
+
"subtle"
|
|
1217
|
+
],
|
|
1218
|
+
"class": "focus:ring-2 focus:ring-inset focus:ring-secondary"
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
"color": "success",
|
|
1222
|
+
"variant": [
|
|
1223
|
+
"outline",
|
|
1224
|
+
"subtle"
|
|
1225
|
+
],
|
|
1226
|
+
"class": "focus:ring-2 focus:ring-inset focus:ring-success"
|
|
1227
|
+
},
|
|
1228
|
+
{
|
|
1229
|
+
"color": "info",
|
|
1230
|
+
"variant": [
|
|
1231
|
+
"outline",
|
|
1232
|
+
"subtle"
|
|
1233
|
+
],
|
|
1234
|
+
"class": "focus:ring-2 focus:ring-inset focus:ring-info"
|
|
1235
|
+
},
|
|
1236
|
+
{
|
|
1237
|
+
"color": "warning",
|
|
1238
|
+
"variant": [
|
|
1239
|
+
"outline",
|
|
1240
|
+
"subtle"
|
|
1241
|
+
],
|
|
1242
|
+
"class": "focus:ring-2 focus:ring-inset focus:ring-warning"
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
"color": "error",
|
|
1246
|
+
"variant": [
|
|
1247
|
+
"outline",
|
|
1248
|
+
"subtle"
|
|
1249
|
+
],
|
|
1250
|
+
"class": "focus:ring-2 focus:ring-inset focus:ring-error"
|
|
1251
|
+
},
|
|
1252
|
+
{
|
|
1253
|
+
"color": "primary",
|
|
1254
|
+
"highlight": true,
|
|
1255
|
+
"class": "ring ring-inset ring-primary"
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
"color": "secondary",
|
|
1259
|
+
"highlight": true,
|
|
1260
|
+
"class": "ring ring-inset ring-secondary"
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
"color": "success",
|
|
1264
|
+
"highlight": true,
|
|
1265
|
+
"class": "ring ring-inset ring-success"
|
|
1266
|
+
},
|
|
1267
|
+
{
|
|
1268
|
+
"color": "info",
|
|
1269
|
+
"highlight": true,
|
|
1270
|
+
"class": "ring ring-inset ring-info"
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
"color": "warning",
|
|
1274
|
+
"highlight": true,
|
|
1275
|
+
"class": "ring ring-inset ring-warning"
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
"color": "error",
|
|
1279
|
+
"highlight": true,
|
|
1280
|
+
"class": "ring ring-inset ring-error"
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
"color": "neutral",
|
|
1284
|
+
"variant": [
|
|
1285
|
+
"outline",
|
|
1286
|
+
"subtle"
|
|
1287
|
+
],
|
|
1288
|
+
"class": "focus:ring-2 focus:ring-inset focus:ring-inverted"
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
"color": "neutral",
|
|
1292
|
+
"highlight": true,
|
|
1293
|
+
"class": "ring ring-inset ring-inverted"
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
"leading": true,
|
|
1297
|
+
"size": "xs",
|
|
1298
|
+
"class": "ps-7"
|
|
1299
|
+
},
|
|
1300
|
+
{
|
|
1301
|
+
"leading": true,
|
|
1302
|
+
"size": "sm",
|
|
1303
|
+
"class": "ps-8"
|
|
1304
|
+
},
|
|
1305
|
+
{
|
|
1306
|
+
"leading": true,
|
|
1307
|
+
"size": "md",
|
|
1308
|
+
"class": "ps-9"
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
"leading": true,
|
|
1312
|
+
"size": "lg",
|
|
1313
|
+
"class": "ps-10"
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
"leading": true,
|
|
1317
|
+
"size": "xl",
|
|
1318
|
+
"class": "ps-11"
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
"trailing": true,
|
|
1322
|
+
"size": "xs",
|
|
1323
|
+
"class": "pe-7"
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
"trailing": true,
|
|
1327
|
+
"size": "sm",
|
|
1328
|
+
"class": "pe-8"
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
"trailing": true,
|
|
1332
|
+
"size": "md",
|
|
1333
|
+
"class": "pe-9"
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
"trailing": true,
|
|
1337
|
+
"size": "lg",
|
|
1338
|
+
"class": "pe-10"
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
"trailing": true,
|
|
1342
|
+
"size": "xl",
|
|
1343
|
+
"class": "pe-11"
|
|
1344
|
+
},
|
|
1345
|
+
{
|
|
1346
|
+
"loading": true,
|
|
1347
|
+
"leading": true,
|
|
1348
|
+
"class": {
|
|
1349
|
+
"leadingIcon": "animate-spin"
|
|
1350
|
+
}
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
"loading": true,
|
|
1354
|
+
"leading": false,
|
|
1355
|
+
"trailing": true,
|
|
1356
|
+
"class": {
|
|
1357
|
+
"trailingIcon": "animate-spin"
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
"fixed": false,
|
|
1362
|
+
"size": "xs",
|
|
1363
|
+
"class": "md:text-xs"
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
"fixed": false,
|
|
1367
|
+
"size": "sm",
|
|
1368
|
+
"class": "md:text-xs"
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
"fixed": false,
|
|
1372
|
+
"size": "md",
|
|
1373
|
+
"class": "md:text-sm"
|
|
1374
|
+
},
|
|
1375
|
+
{
|
|
1376
|
+
"fixed": false,
|
|
1377
|
+
"size": "lg",
|
|
1378
|
+
"class": "md:text-sm"
|
|
1379
|
+
}
|
|
1380
|
+
],
|
|
1381
|
+
"defaultVariants": {
|
|
1382
|
+
"size": "md",
|
|
1383
|
+
"color": "primary",
|
|
1384
|
+
"variant": "outline"
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
const _sfc_main$1 = /* @__PURE__ */ Object.assign({ inheritAttrs: false }, {
|
|
1388
|
+
__name: "USelect",
|
|
1389
|
+
__ssrInlineRender: true,
|
|
1390
|
+
props: {
|
|
1391
|
+
id: { type: String, required: false },
|
|
1392
|
+
placeholder: { type: String, required: false },
|
|
1393
|
+
color: { type: null, required: false },
|
|
1394
|
+
variant: { type: null, required: false },
|
|
1395
|
+
size: { type: null, required: false },
|
|
1396
|
+
trailingIcon: { type: null, required: false },
|
|
1397
|
+
selectedIcon: { type: null, required: false },
|
|
1398
|
+
content: { type: Object, required: false },
|
|
1399
|
+
arrow: { type: [Boolean, Object], required: false },
|
|
1400
|
+
portal: { type: [Boolean, String], required: false, skipCheck: true, default: true },
|
|
1401
|
+
valueKey: { type: null, required: false, default: "value" },
|
|
1402
|
+
labelKey: { type: null, required: false, default: "label" },
|
|
1403
|
+
descriptionKey: { type: null, required: false, default: "description" },
|
|
1404
|
+
items: { type: null, required: false },
|
|
1405
|
+
defaultValue: { type: null, required: false },
|
|
1406
|
+
modelValue: { type: null, required: false },
|
|
1407
|
+
modelModifiers: { type: null, required: false },
|
|
1408
|
+
multiple: { type: Boolean, required: false },
|
|
1409
|
+
highlight: { type: Boolean, required: false },
|
|
1410
|
+
autofocus: { type: Boolean, required: false },
|
|
1411
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
1412
|
+
class: { type: null, required: false },
|
|
1413
|
+
ui: { type: Object, required: false },
|
|
1414
|
+
open: { type: Boolean, required: false },
|
|
1415
|
+
defaultOpen: { type: Boolean, required: false },
|
|
1416
|
+
autocomplete: { type: String, required: false },
|
|
1417
|
+
disabled: { type: Boolean, required: false },
|
|
1418
|
+
name: { type: String, required: false },
|
|
1419
|
+
required: { type: Boolean, required: false },
|
|
1420
|
+
icon: { type: null, required: false },
|
|
1421
|
+
avatar: { type: Object, required: false },
|
|
1422
|
+
leading: { type: Boolean, required: false },
|
|
1423
|
+
leadingIcon: { type: null, required: false },
|
|
1424
|
+
trailing: { type: Boolean, required: false },
|
|
1425
|
+
loading: { type: Boolean, required: false },
|
|
1426
|
+
loadingIcon: { type: null, required: false }
|
|
1427
|
+
},
|
|
1428
|
+
emits: ["change", "blur", "focus", "update:modelValue", "update:open"],
|
|
1429
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1430
|
+
const props = __props;
|
|
1431
|
+
const emits = __emit;
|
|
1432
|
+
const slots = useSlots();
|
|
1433
|
+
const appConfig = useAppConfig();
|
|
1434
|
+
const uiProp = useComponentUI("select", props);
|
|
1435
|
+
const rootProps = useForwardPropsEmits(reactivePick(props, "open", "defaultOpen", "disabled", "autocomplete", "required", "multiple"), emits);
|
|
1436
|
+
const portalProps = usePortal(toRef(() => props.portal));
|
|
1437
|
+
const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
|
|
1438
|
+
const arrowProps = toRef(() => props.arrow);
|
|
1439
|
+
const { emitFormChange, emitFormInput, emitFormBlur, emitFormFocus, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
|
|
1440
|
+
const { orientation, size: fieldGroupSize } = useFieldGroup(props);
|
|
1441
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: appConfig.ui.icons.chevronDown })));
|
|
1442
|
+
const selectSize = computed(() => fieldGroupSize.value || formGroupSize.value);
|
|
1443
|
+
const ui = computed(() => tv({ extend: tv(theme), ...appConfig.ui?.select || {} })({
|
|
1444
|
+
color: color.value,
|
|
1445
|
+
variant: props.variant,
|
|
1446
|
+
size: selectSize?.value,
|
|
1447
|
+
loading: props.loading,
|
|
1448
|
+
highlight: highlight.value,
|
|
1449
|
+
leading: isLeading.value || !!props.avatar || !!slots.leading,
|
|
1450
|
+
trailing: isTrailing.value || !!slots.trailing,
|
|
1451
|
+
fieldGroup: orientation.value
|
|
1452
|
+
}));
|
|
1453
|
+
const groups = computed(
|
|
1454
|
+
() => props.items?.length ? isArrayOfArray(props.items) ? props.items : [props.items] : []
|
|
1455
|
+
);
|
|
1456
|
+
const items = computed(() => groups.value.flatMap((group) => group));
|
|
1457
|
+
function displayValue(value) {
|
|
1458
|
+
if (props.multiple && Array.isArray(value)) {
|
|
1459
|
+
const displayedValues = value.map((item) => getDisplayValue(items.value, item, {
|
|
1460
|
+
labelKey: props.labelKey,
|
|
1461
|
+
valueKey: props.valueKey
|
|
1462
|
+
})).filter((v) => v != null && v !== "");
|
|
1463
|
+
return displayedValues.length > 0 ? displayedValues.join(", ") : void 0;
|
|
1464
|
+
}
|
|
1465
|
+
return getDisplayValue(items.value, value, {
|
|
1466
|
+
labelKey: props.labelKey,
|
|
1467
|
+
valueKey: props.valueKey
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
const triggerRef = useTemplateRef("triggerRef");
|
|
1471
|
+
function onUpdate(value) {
|
|
1472
|
+
if (props.modelModifiers?.trim && (typeof value === "string" || value === null || value === void 0)) {
|
|
1473
|
+
value = value?.trim() ?? null;
|
|
1474
|
+
}
|
|
1475
|
+
if (props.modelModifiers?.number) {
|
|
1476
|
+
value = looseToNumber(value);
|
|
1477
|
+
}
|
|
1478
|
+
if (props.modelModifiers?.nullable) {
|
|
1479
|
+
value ??= null;
|
|
1480
|
+
}
|
|
1481
|
+
if (props.modelModifiers?.optional && !props.modelModifiers?.nullable && value !== null) {
|
|
1482
|
+
value ??= void 0;
|
|
1483
|
+
}
|
|
1484
|
+
const event = new Event("change", { target: { value } });
|
|
1485
|
+
emits("change", event);
|
|
1486
|
+
emitFormChange();
|
|
1487
|
+
emitFormInput();
|
|
1488
|
+
}
|
|
1489
|
+
function onUpdateOpen(value) {
|
|
1490
|
+
if (!value) {
|
|
1491
|
+
const event = new FocusEvent("blur");
|
|
1492
|
+
emits("blur", event);
|
|
1493
|
+
emitFormBlur();
|
|
1494
|
+
} else {
|
|
1495
|
+
const event = new FocusEvent("focus");
|
|
1496
|
+
emits("focus", event);
|
|
1497
|
+
emitFormFocus();
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function isSelectItem(item) {
|
|
1501
|
+
return typeof item === "object" && item !== null;
|
|
1502
|
+
}
|
|
1503
|
+
const viewportRef = useTemplateRef("viewportRef");
|
|
1504
|
+
__expose({
|
|
1505
|
+
triggerRef: toRef(() => triggerRef.value?.$el),
|
|
1506
|
+
viewportRef: toRef(() => viewportRef.value)
|
|
1507
|
+
});
|
|
1508
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
1509
|
+
_push(ssrRenderComponent(unref(SelectRoot), mergeProps({ name: unref(name) }, unref(rootProps), {
|
|
1510
|
+
autocomplete: __props.autocomplete,
|
|
1511
|
+
disabled: unref(disabled),
|
|
1512
|
+
"default-value": __props.defaultValue,
|
|
1513
|
+
"model-value": __props.modelValue,
|
|
1514
|
+
"onUpdate:modelValue": onUpdate,
|
|
1515
|
+
"onUpdate:open": onUpdateOpen
|
|
1516
|
+
}, _attrs), {
|
|
1517
|
+
default: withCtx(({ modelValue, open }, _push2, _parent2, _scopeId) => {
|
|
1518
|
+
if (_push2) {
|
|
1519
|
+
_push2(ssrRenderComponent(unref(SelectTrigger), mergeProps({
|
|
1520
|
+
id: unref(id),
|
|
1521
|
+
ref_key: "triggerRef",
|
|
1522
|
+
ref: triggerRef,
|
|
1523
|
+
"data-slot": "base",
|
|
1524
|
+
class: ui.value.base({ class: [unref(uiProp)?.base, props.class] })
|
|
1525
|
+
}, { ..._ctx.$attrs, ...unref(ariaAttrs) }), {
|
|
1526
|
+
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
1527
|
+
if (_push3) {
|
|
1528
|
+
if (unref(isLeading) || !!__props.avatar || !!slots.leading) {
|
|
1529
|
+
_push3(`<span data-slot="leading" class="${ssrRenderClass(ui.value.leading({ class: unref(uiProp)?.leading }))}"${_scopeId2}>`);
|
|
1530
|
+
ssrRenderSlot(_ctx.$slots, "leading", {
|
|
1531
|
+
modelValue,
|
|
1532
|
+
open,
|
|
1533
|
+
ui: ui.value
|
|
1534
|
+
}, () => {
|
|
1535
|
+
if (unref(isLeading) && unref(leadingIconName)) {
|
|
1536
|
+
_push3(ssrRenderComponent(_sfc_main$m, {
|
|
1537
|
+
name: unref(leadingIconName),
|
|
1538
|
+
"data-slot": "leadingIcon",
|
|
1539
|
+
class: ui.value.leadingIcon({ class: unref(uiProp)?.leadingIcon })
|
|
1540
|
+
}, null, _parent3, _scopeId2));
|
|
1541
|
+
} else if (!!__props.avatar) {
|
|
1542
|
+
_push3(ssrRenderComponent(_sfc_main$k, mergeProps({
|
|
1543
|
+
size: unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
1544
|
+
}, __props.avatar, {
|
|
1545
|
+
"data-slot": "itemLeadingAvatar",
|
|
1546
|
+
class: ui.value.itemLeadingAvatar({ class: unref(uiProp)?.itemLeadingAvatar })
|
|
1547
|
+
}), null, _parent3, _scopeId2));
|
|
1548
|
+
} else {
|
|
1549
|
+
_push3(`<!---->`);
|
|
1550
|
+
}
|
|
1551
|
+
}, _push3, _parent3, _scopeId2);
|
|
1552
|
+
_push3(`</span>`);
|
|
1553
|
+
} else {
|
|
1554
|
+
_push3(`<!---->`);
|
|
1555
|
+
}
|
|
1556
|
+
ssrRenderSlot(_ctx.$slots, "default", {
|
|
1557
|
+
modelValue,
|
|
1558
|
+
open,
|
|
1559
|
+
ui: ui.value
|
|
1560
|
+
}, () => {
|
|
1561
|
+
_push3(`<!--[-->`);
|
|
1562
|
+
ssrRenderList([displayValue(modelValue)], (displayedModelValue) => {
|
|
1563
|
+
_push3(`<!--[-->`);
|
|
1564
|
+
if (displayedModelValue !== void 0 && displayedModelValue !== null) {
|
|
1565
|
+
_push3(`<span data-slot="value" class="${ssrRenderClass(ui.value.value({ class: unref(uiProp)?.value }))}"${_scopeId2}>${ssrInterpolate(displayedModelValue)}</span>`);
|
|
1566
|
+
} else {
|
|
1567
|
+
_push3(`<span data-slot="placeholder" class="${ssrRenderClass(ui.value.placeholder({ class: unref(uiProp)?.placeholder }))}"${_scopeId2}>${ssrInterpolate(__props.placeholder ?? " ")}</span>`);
|
|
1568
|
+
}
|
|
1569
|
+
_push3(`<!--]-->`);
|
|
1570
|
+
});
|
|
1571
|
+
_push3(`<!--]-->`);
|
|
1572
|
+
}, _push3, _parent3, _scopeId2);
|
|
1573
|
+
if (unref(isTrailing) || !!slots.trailing) {
|
|
1574
|
+
_push3(`<span data-slot="trailing" class="${ssrRenderClass(ui.value.trailing({ class: unref(uiProp)?.trailing }))}"${_scopeId2}>`);
|
|
1575
|
+
ssrRenderSlot(_ctx.$slots, "trailing", {
|
|
1576
|
+
modelValue,
|
|
1577
|
+
open,
|
|
1578
|
+
ui: ui.value
|
|
1579
|
+
}, () => {
|
|
1580
|
+
if (unref(trailingIconName)) {
|
|
1581
|
+
_push3(ssrRenderComponent(_sfc_main$m, {
|
|
1582
|
+
name: unref(trailingIconName),
|
|
1583
|
+
"data-slot": "trailingIcon",
|
|
1584
|
+
class: ui.value.trailingIcon({ class: unref(uiProp)?.trailingIcon })
|
|
1585
|
+
}, null, _parent3, _scopeId2));
|
|
1586
|
+
} else {
|
|
1587
|
+
_push3(`<!---->`);
|
|
1588
|
+
}
|
|
1589
|
+
}, _push3, _parent3, _scopeId2);
|
|
1590
|
+
_push3(`</span>`);
|
|
1591
|
+
} else {
|
|
1592
|
+
_push3(`<!---->`);
|
|
1593
|
+
}
|
|
1594
|
+
} else {
|
|
1595
|
+
return [
|
|
1596
|
+
unref(isLeading) || !!__props.avatar || !!slots.leading ? (openBlock(), createBlock("span", {
|
|
1597
|
+
key: 0,
|
|
1598
|
+
"data-slot": "leading",
|
|
1599
|
+
class: ui.value.leading({ class: unref(uiProp)?.leading })
|
|
1600
|
+
}, [
|
|
1601
|
+
renderSlot(_ctx.$slots, "leading", {
|
|
1602
|
+
modelValue,
|
|
1603
|
+
open,
|
|
1604
|
+
ui: ui.value
|
|
1605
|
+
}, () => [
|
|
1606
|
+
unref(isLeading) && unref(leadingIconName) ? (openBlock(), createBlock(_sfc_main$m, {
|
|
1607
|
+
key: 0,
|
|
1608
|
+
name: unref(leadingIconName),
|
|
1609
|
+
"data-slot": "leadingIcon",
|
|
1610
|
+
class: ui.value.leadingIcon({ class: unref(uiProp)?.leadingIcon })
|
|
1611
|
+
}, null, 8, ["name", "class"])) : !!__props.avatar ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
1612
|
+
key: 1,
|
|
1613
|
+
size: unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
1614
|
+
}, __props.avatar, {
|
|
1615
|
+
"data-slot": "itemLeadingAvatar",
|
|
1616
|
+
class: ui.value.itemLeadingAvatar({ class: unref(uiProp)?.itemLeadingAvatar })
|
|
1617
|
+
}), null, 16, ["size", "class"])) : createCommentVNode("", true)
|
|
1618
|
+
])
|
|
1619
|
+
], 2)) : createCommentVNode("", true),
|
|
1620
|
+
renderSlot(_ctx.$slots, "default", {
|
|
1621
|
+
modelValue,
|
|
1622
|
+
open,
|
|
1623
|
+
ui: ui.value
|
|
1624
|
+
}, () => [
|
|
1625
|
+
(openBlock(true), createBlock(Fragment, null, renderList([displayValue(modelValue)], (displayedModelValue) => {
|
|
1626
|
+
return openBlock(), createBlock(Fragment, { key: displayedModelValue }, [
|
|
1627
|
+
displayedModelValue !== void 0 && displayedModelValue !== null ? (openBlock(), createBlock("span", {
|
|
1628
|
+
key: 0,
|
|
1629
|
+
"data-slot": "value",
|
|
1630
|
+
class: ui.value.value({ class: unref(uiProp)?.value })
|
|
1631
|
+
}, toDisplayString(displayedModelValue), 3)) : (openBlock(), createBlock("span", {
|
|
1632
|
+
key: 1,
|
|
1633
|
+
"data-slot": "placeholder",
|
|
1634
|
+
class: ui.value.placeholder({ class: unref(uiProp)?.placeholder })
|
|
1635
|
+
}, toDisplayString(__props.placeholder ?? " "), 3))
|
|
1636
|
+
], 64);
|
|
1637
|
+
}), 128))
|
|
1638
|
+
]),
|
|
1639
|
+
unref(isTrailing) || !!slots.trailing ? (openBlock(), createBlock("span", {
|
|
1640
|
+
key: 1,
|
|
1641
|
+
"data-slot": "trailing",
|
|
1642
|
+
class: ui.value.trailing({ class: unref(uiProp)?.trailing })
|
|
1643
|
+
}, [
|
|
1644
|
+
renderSlot(_ctx.$slots, "trailing", {
|
|
1645
|
+
modelValue,
|
|
1646
|
+
open,
|
|
1647
|
+
ui: ui.value
|
|
1648
|
+
}, () => [
|
|
1649
|
+
unref(trailingIconName) ? (openBlock(), createBlock(_sfc_main$m, {
|
|
1650
|
+
key: 0,
|
|
1651
|
+
name: unref(trailingIconName),
|
|
1652
|
+
"data-slot": "trailingIcon",
|
|
1653
|
+
class: ui.value.trailingIcon({ class: unref(uiProp)?.trailingIcon })
|
|
1654
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true)
|
|
1655
|
+
])
|
|
1656
|
+
], 2)) : createCommentVNode("", true)
|
|
1657
|
+
];
|
|
1658
|
+
}
|
|
1659
|
+
}),
|
|
1660
|
+
_: 2
|
|
1661
|
+
}, _parent2, _scopeId));
|
|
1662
|
+
_push2(ssrRenderComponent(unref(SelectPortal), unref(portalProps), {
|
|
1663
|
+
default: withCtx((_, _push3, _parent3, _scopeId2) => {
|
|
1664
|
+
if (_push3) {
|
|
1665
|
+
_push3(ssrRenderComponent(unref(SelectContent), mergeProps({
|
|
1666
|
+
"data-slot": "content",
|
|
1667
|
+
class: ui.value.content({ class: unref(uiProp)?.content })
|
|
1668
|
+
}, contentProps.value), {
|
|
1669
|
+
default: withCtx((_2, _push4, _parent4, _scopeId3) => {
|
|
1670
|
+
if (_push4) {
|
|
1671
|
+
ssrRenderSlot(_ctx.$slots, "content-top", {}, null, _push4, _parent4, _scopeId3);
|
|
1672
|
+
_push4(`<div role="presentation" data-slot="viewport" class="${ssrRenderClass(ui.value.viewport({ class: unref(uiProp)?.viewport }))}"${_scopeId3}><!--[-->`);
|
|
1673
|
+
ssrRenderList(groups.value, (group, groupIndex) => {
|
|
1674
|
+
_push4(ssrRenderComponent(unref(SelectGroup), {
|
|
1675
|
+
key: `group-${groupIndex}`,
|
|
1676
|
+
"data-slot": "group",
|
|
1677
|
+
class: ui.value.group({ class: unref(uiProp)?.group })
|
|
1678
|
+
}, {
|
|
1679
|
+
default: withCtx((_3, _push5, _parent5, _scopeId4) => {
|
|
1680
|
+
if (_push5) {
|
|
1681
|
+
_push5(`<!--[-->`);
|
|
1682
|
+
ssrRenderList(group, (item, index) => {
|
|
1683
|
+
_push5(`<!--[-->`);
|
|
1684
|
+
if (isSelectItem(item) && item.type === "label") {
|
|
1685
|
+
_push5(ssrRenderComponent(unref(SelectLabel), {
|
|
1686
|
+
"data-slot": "label",
|
|
1687
|
+
class: ui.value.label({ class: [unref(uiProp)?.label, item.ui?.label, item.class] })
|
|
1688
|
+
}, {
|
|
1689
|
+
default: withCtx((_4, _push6, _parent6, _scopeId5) => {
|
|
1690
|
+
if (_push6) {
|
|
1691
|
+
_push6(`${ssrInterpolate(unref(get)(item, props.labelKey))}`);
|
|
1692
|
+
} else {
|
|
1693
|
+
return [
|
|
1694
|
+
createTextVNode(toDisplayString(unref(get)(item, props.labelKey)), 1)
|
|
1695
|
+
];
|
|
1696
|
+
}
|
|
1697
|
+
}),
|
|
1698
|
+
_: 2
|
|
1699
|
+
}, _parent5, _scopeId4));
|
|
1700
|
+
} else if (isSelectItem(item) && item.type === "separator") {
|
|
1701
|
+
_push5(ssrRenderComponent(unref(SelectSeparator), {
|
|
1702
|
+
"data-slot": "separator",
|
|
1703
|
+
class: ui.value.separator({ class: [unref(uiProp)?.separator, item.ui?.separator, item.class] })
|
|
1704
|
+
}, null, _parent5, _scopeId4));
|
|
1705
|
+
} else {
|
|
1706
|
+
_push5(ssrRenderComponent(unref(SelectItem), {
|
|
1707
|
+
"data-slot": "item",
|
|
1708
|
+
class: ui.value.item({ class: [unref(uiProp)?.item, isSelectItem(item) && item.ui?.item, isSelectItem(item) && item.class] }),
|
|
1709
|
+
disabled: isSelectItem(item) && item.disabled,
|
|
1710
|
+
value: isSelectItem(item) ? unref(get)(item, props.valueKey) : item,
|
|
1711
|
+
onSelect: ($event) => isSelectItem(item) && item.onSelect?.($event)
|
|
1712
|
+
}, {
|
|
1713
|
+
default: withCtx((_4, _push6, _parent6, _scopeId5) => {
|
|
1714
|
+
if (_push6) {
|
|
1715
|
+
ssrRenderSlot(_ctx.$slots, "item", {
|
|
1716
|
+
item,
|
|
1717
|
+
index,
|
|
1718
|
+
ui: ui.value
|
|
1719
|
+
}, () => {
|
|
1720
|
+
ssrRenderSlot(_ctx.$slots, "item-leading", {
|
|
1721
|
+
item,
|
|
1722
|
+
index,
|
|
1723
|
+
ui: ui.value
|
|
1724
|
+
}, () => {
|
|
1725
|
+
if (isSelectItem(item) && item.icon) {
|
|
1726
|
+
_push6(ssrRenderComponent(_sfc_main$m, {
|
|
1727
|
+
name: item.icon,
|
|
1728
|
+
"data-slot": "itemLeadingIcon",
|
|
1729
|
+
class: ui.value.itemLeadingIcon({ class: [unref(uiProp)?.itemLeadingIcon, item.ui?.itemLeadingIcon] })
|
|
1730
|
+
}, null, _parent6, _scopeId5));
|
|
1731
|
+
} else if (isSelectItem(item) && item.avatar) {
|
|
1732
|
+
_push6(ssrRenderComponent(_sfc_main$k, mergeProps({
|
|
1733
|
+
size: item.ui?.itemLeadingAvatarSize || unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
1734
|
+
}, { ref_for: true }, item.avatar, {
|
|
1735
|
+
"data-slot": "itemLeadingAvatar",
|
|
1736
|
+
class: ui.value.itemLeadingAvatar({ class: [unref(uiProp)?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })
|
|
1737
|
+
}), null, _parent6, _scopeId5));
|
|
1738
|
+
} else if (isSelectItem(item) && item.chip) {
|
|
1739
|
+
_push6(ssrRenderComponent(_sfc_main$l, mergeProps({
|
|
1740
|
+
size: item.ui?.itemLeadingChipSize || unref(uiProp)?.itemLeadingChipSize || ui.value.itemLeadingChipSize(),
|
|
1741
|
+
inset: "",
|
|
1742
|
+
standalone: ""
|
|
1743
|
+
}, { ref_for: true }, item.chip, {
|
|
1744
|
+
"data-slot": "itemLeadingChip",
|
|
1745
|
+
class: ui.value.itemLeadingChip({ class: [unref(uiProp)?.itemLeadingChip, item.ui?.itemLeadingChip] })
|
|
1746
|
+
}), null, _parent6, _scopeId5));
|
|
1747
|
+
} else {
|
|
1748
|
+
_push6(`<!---->`);
|
|
1749
|
+
}
|
|
1750
|
+
}, _push6, _parent6, _scopeId5);
|
|
1751
|
+
_push6(`<span data-slot="itemWrapper" class="${ssrRenderClass(ui.value.itemWrapper({ class: [unref(uiProp)?.itemWrapper, isSelectItem(item) && item.ui?.itemWrapper] }))}"${_scopeId5}>`);
|
|
1752
|
+
_push6(ssrRenderComponent(unref(SelectItemText), {
|
|
1753
|
+
"data-slot": "itemLabel",
|
|
1754
|
+
class: ui.value.itemLabel({ class: [unref(uiProp)?.itemLabel, isSelectItem(item) && item.ui?.itemLabel] })
|
|
1755
|
+
}, {
|
|
1756
|
+
default: withCtx((_5, _push7, _parent7, _scopeId6) => {
|
|
1757
|
+
if (_push7) {
|
|
1758
|
+
ssrRenderSlot(_ctx.$slots, "item-label", {
|
|
1759
|
+
item,
|
|
1760
|
+
index
|
|
1761
|
+
}, () => {
|
|
1762
|
+
_push7(`${ssrInterpolate(isSelectItem(item) ? unref(get)(item, props.labelKey) : item)}`);
|
|
1763
|
+
}, _push7, _parent7, _scopeId6);
|
|
1764
|
+
} else {
|
|
1765
|
+
return [
|
|
1766
|
+
renderSlot(_ctx.$slots, "item-label", {
|
|
1767
|
+
item,
|
|
1768
|
+
index
|
|
1769
|
+
}, () => [
|
|
1770
|
+
createTextVNode(toDisplayString(isSelectItem(item) ? unref(get)(item, props.labelKey) : item), 1)
|
|
1771
|
+
])
|
|
1772
|
+
];
|
|
1773
|
+
}
|
|
1774
|
+
}),
|
|
1775
|
+
_: 2
|
|
1776
|
+
}, _parent6, _scopeId5));
|
|
1777
|
+
if (isSelectItem(item) && (unref(get)(item, props.descriptionKey) || !!slots["item-description"])) {
|
|
1778
|
+
_push6(`<span data-slot="itemDescription" class="${ssrRenderClass(ui.value.itemDescription({ class: [unref(uiProp)?.itemDescription, isSelectItem(item) && item.ui?.itemDescription] }))}"${_scopeId5}>`);
|
|
1779
|
+
ssrRenderSlot(_ctx.$slots, "item-description", {
|
|
1780
|
+
item,
|
|
1781
|
+
index
|
|
1782
|
+
}, () => {
|
|
1783
|
+
_push6(`${ssrInterpolate(unref(get)(item, props.descriptionKey))}`);
|
|
1784
|
+
}, _push6, _parent6, _scopeId5);
|
|
1785
|
+
_push6(`</span>`);
|
|
1786
|
+
} else {
|
|
1787
|
+
_push6(`<!---->`);
|
|
1788
|
+
}
|
|
1789
|
+
_push6(`</span><span data-slot="itemTrailing" class="${ssrRenderClass(ui.value.itemTrailing({ class: [unref(uiProp)?.itemTrailing, isSelectItem(item) && item.ui?.itemTrailing] }))}"${_scopeId5}>`);
|
|
1790
|
+
ssrRenderSlot(_ctx.$slots, "item-trailing", {
|
|
1791
|
+
item,
|
|
1792
|
+
index,
|
|
1793
|
+
ui: ui.value
|
|
1794
|
+
}, null, _push6, _parent6, _scopeId5);
|
|
1795
|
+
_push6(ssrRenderComponent(unref(SelectItemIndicator), { "as-child": "" }, {
|
|
1796
|
+
default: withCtx((_5, _push7, _parent7, _scopeId6) => {
|
|
1797
|
+
if (_push7) {
|
|
1798
|
+
_push7(ssrRenderComponent(_sfc_main$m, {
|
|
1799
|
+
name: __props.selectedIcon || unref(appConfig).ui.icons.check,
|
|
1800
|
+
"data-slot": "itemTrailingIcon",
|
|
1801
|
+
class: ui.value.itemTrailingIcon({ class: [unref(uiProp)?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })
|
|
1802
|
+
}, null, _parent7, _scopeId6));
|
|
1803
|
+
} else {
|
|
1804
|
+
return [
|
|
1805
|
+
createVNode(_sfc_main$m, {
|
|
1806
|
+
name: __props.selectedIcon || unref(appConfig).ui.icons.check,
|
|
1807
|
+
"data-slot": "itemTrailingIcon",
|
|
1808
|
+
class: ui.value.itemTrailingIcon({ class: [unref(uiProp)?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })
|
|
1809
|
+
}, null, 8, ["name", "class"])
|
|
1810
|
+
];
|
|
1811
|
+
}
|
|
1812
|
+
}),
|
|
1813
|
+
_: 2
|
|
1814
|
+
}, _parent6, _scopeId5));
|
|
1815
|
+
_push6(`</span>`);
|
|
1816
|
+
}, _push6, _parent6, _scopeId5);
|
|
1817
|
+
} else {
|
|
1818
|
+
return [
|
|
1819
|
+
renderSlot(_ctx.$slots, "item", {
|
|
1820
|
+
item,
|
|
1821
|
+
index,
|
|
1822
|
+
ui: ui.value
|
|
1823
|
+
}, () => [
|
|
1824
|
+
renderSlot(_ctx.$slots, "item-leading", {
|
|
1825
|
+
item,
|
|
1826
|
+
index,
|
|
1827
|
+
ui: ui.value
|
|
1828
|
+
}, () => [
|
|
1829
|
+
isSelectItem(item) && item.icon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
1830
|
+
key: 0,
|
|
1831
|
+
name: item.icon,
|
|
1832
|
+
"data-slot": "itemLeadingIcon",
|
|
1833
|
+
class: ui.value.itemLeadingIcon({ class: [unref(uiProp)?.itemLeadingIcon, item.ui?.itemLeadingIcon] })
|
|
1834
|
+
}, null, 8, ["name", "class"])) : isSelectItem(item) && item.avatar ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
1835
|
+
key: 1,
|
|
1836
|
+
size: item.ui?.itemLeadingAvatarSize || unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
1837
|
+
}, { ref_for: true }, item.avatar, {
|
|
1838
|
+
"data-slot": "itemLeadingAvatar",
|
|
1839
|
+
class: ui.value.itemLeadingAvatar({ class: [unref(uiProp)?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })
|
|
1840
|
+
}), null, 16, ["size", "class"])) : isSelectItem(item) && item.chip ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
1841
|
+
key: 2,
|
|
1842
|
+
size: item.ui?.itemLeadingChipSize || unref(uiProp)?.itemLeadingChipSize || ui.value.itemLeadingChipSize(),
|
|
1843
|
+
inset: "",
|
|
1844
|
+
standalone: ""
|
|
1845
|
+
}, { ref_for: true }, item.chip, {
|
|
1846
|
+
"data-slot": "itemLeadingChip",
|
|
1847
|
+
class: ui.value.itemLeadingChip({ class: [unref(uiProp)?.itemLeadingChip, item.ui?.itemLeadingChip] })
|
|
1848
|
+
}), null, 16, ["size", "class"])) : createCommentVNode("", true)
|
|
1849
|
+
]),
|
|
1850
|
+
createVNode("span", {
|
|
1851
|
+
"data-slot": "itemWrapper",
|
|
1852
|
+
class: ui.value.itemWrapper({ class: [unref(uiProp)?.itemWrapper, isSelectItem(item) && item.ui?.itemWrapper] })
|
|
1853
|
+
}, [
|
|
1854
|
+
createVNode(unref(SelectItemText), {
|
|
1855
|
+
"data-slot": "itemLabel",
|
|
1856
|
+
class: ui.value.itemLabel({ class: [unref(uiProp)?.itemLabel, isSelectItem(item) && item.ui?.itemLabel] })
|
|
1857
|
+
}, {
|
|
1858
|
+
default: withCtx(() => [
|
|
1859
|
+
renderSlot(_ctx.$slots, "item-label", {
|
|
1860
|
+
item,
|
|
1861
|
+
index
|
|
1862
|
+
}, () => [
|
|
1863
|
+
createTextVNode(toDisplayString(isSelectItem(item) ? unref(get)(item, props.labelKey) : item), 1)
|
|
1864
|
+
])
|
|
1865
|
+
]),
|
|
1866
|
+
_: 2
|
|
1867
|
+
}, 1032, ["class"]),
|
|
1868
|
+
isSelectItem(item) && (unref(get)(item, props.descriptionKey) || !!slots["item-description"]) ? (openBlock(), createBlock("span", {
|
|
1869
|
+
key: 0,
|
|
1870
|
+
"data-slot": "itemDescription",
|
|
1871
|
+
class: ui.value.itemDescription({ class: [unref(uiProp)?.itemDescription, isSelectItem(item) && item.ui?.itemDescription] })
|
|
1872
|
+
}, [
|
|
1873
|
+
renderSlot(_ctx.$slots, "item-description", {
|
|
1874
|
+
item,
|
|
1875
|
+
index
|
|
1876
|
+
}, () => [
|
|
1877
|
+
createTextVNode(toDisplayString(unref(get)(item, props.descriptionKey)), 1)
|
|
1878
|
+
])
|
|
1879
|
+
], 2)) : createCommentVNode("", true)
|
|
1880
|
+
], 2),
|
|
1881
|
+
createVNode("span", {
|
|
1882
|
+
"data-slot": "itemTrailing",
|
|
1883
|
+
class: ui.value.itemTrailing({ class: [unref(uiProp)?.itemTrailing, isSelectItem(item) && item.ui?.itemTrailing] })
|
|
1884
|
+
}, [
|
|
1885
|
+
renderSlot(_ctx.$slots, "item-trailing", {
|
|
1886
|
+
item,
|
|
1887
|
+
index,
|
|
1888
|
+
ui: ui.value
|
|
1889
|
+
}),
|
|
1890
|
+
createVNode(unref(SelectItemIndicator), { "as-child": "" }, {
|
|
1891
|
+
default: withCtx(() => [
|
|
1892
|
+
createVNode(_sfc_main$m, {
|
|
1893
|
+
name: __props.selectedIcon || unref(appConfig).ui.icons.check,
|
|
1894
|
+
"data-slot": "itemTrailingIcon",
|
|
1895
|
+
class: ui.value.itemTrailingIcon({ class: [unref(uiProp)?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })
|
|
1896
|
+
}, null, 8, ["name", "class"])
|
|
1897
|
+
]),
|
|
1898
|
+
_: 2
|
|
1899
|
+
}, 1024)
|
|
1900
|
+
], 2)
|
|
1901
|
+
])
|
|
1902
|
+
];
|
|
1903
|
+
}
|
|
1904
|
+
}),
|
|
1905
|
+
_: 2
|
|
1906
|
+
}, _parent5, _scopeId4));
|
|
1907
|
+
}
|
|
1908
|
+
_push5(`<!--]-->`);
|
|
1909
|
+
});
|
|
1910
|
+
_push5(`<!--]-->`);
|
|
1911
|
+
} else {
|
|
1912
|
+
return [
|
|
1913
|
+
(openBlock(true), createBlock(Fragment, null, renderList(group, (item, index) => {
|
|
1914
|
+
return openBlock(), createBlock(Fragment, {
|
|
1915
|
+
key: `group-${groupIndex}-${index}`
|
|
1916
|
+
}, [
|
|
1917
|
+
isSelectItem(item) && item.type === "label" ? (openBlock(), createBlock(unref(SelectLabel), {
|
|
1918
|
+
key: 0,
|
|
1919
|
+
"data-slot": "label",
|
|
1920
|
+
class: ui.value.label({ class: [unref(uiProp)?.label, item.ui?.label, item.class] })
|
|
1921
|
+
}, {
|
|
1922
|
+
default: withCtx(() => [
|
|
1923
|
+
createTextVNode(toDisplayString(unref(get)(item, props.labelKey)), 1)
|
|
1924
|
+
]),
|
|
1925
|
+
_: 2
|
|
1926
|
+
}, 1032, ["class"])) : isSelectItem(item) && item.type === "separator" ? (openBlock(), createBlock(unref(SelectSeparator), {
|
|
1927
|
+
key: 1,
|
|
1928
|
+
"data-slot": "separator",
|
|
1929
|
+
class: ui.value.separator({ class: [unref(uiProp)?.separator, item.ui?.separator, item.class] })
|
|
1930
|
+
}, null, 8, ["class"])) : (openBlock(), createBlock(unref(SelectItem), {
|
|
1931
|
+
key: 2,
|
|
1932
|
+
"data-slot": "item",
|
|
1933
|
+
class: ui.value.item({ class: [unref(uiProp)?.item, isSelectItem(item) && item.ui?.item, isSelectItem(item) && item.class] }),
|
|
1934
|
+
disabled: isSelectItem(item) && item.disabled,
|
|
1935
|
+
value: isSelectItem(item) ? unref(get)(item, props.valueKey) : item,
|
|
1936
|
+
onSelect: ($event) => isSelectItem(item) && item.onSelect?.($event)
|
|
1937
|
+
}, {
|
|
1938
|
+
default: withCtx(() => [
|
|
1939
|
+
renderSlot(_ctx.$slots, "item", {
|
|
1940
|
+
item,
|
|
1941
|
+
index,
|
|
1942
|
+
ui: ui.value
|
|
1943
|
+
}, () => [
|
|
1944
|
+
renderSlot(_ctx.$slots, "item-leading", {
|
|
1945
|
+
item,
|
|
1946
|
+
index,
|
|
1947
|
+
ui: ui.value
|
|
1948
|
+
}, () => [
|
|
1949
|
+
isSelectItem(item) && item.icon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
1950
|
+
key: 0,
|
|
1951
|
+
name: item.icon,
|
|
1952
|
+
"data-slot": "itemLeadingIcon",
|
|
1953
|
+
class: ui.value.itemLeadingIcon({ class: [unref(uiProp)?.itemLeadingIcon, item.ui?.itemLeadingIcon] })
|
|
1954
|
+
}, null, 8, ["name", "class"])) : isSelectItem(item) && item.avatar ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
1955
|
+
key: 1,
|
|
1956
|
+
size: item.ui?.itemLeadingAvatarSize || unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
1957
|
+
}, { ref_for: true }, item.avatar, {
|
|
1958
|
+
"data-slot": "itemLeadingAvatar",
|
|
1959
|
+
class: ui.value.itemLeadingAvatar({ class: [unref(uiProp)?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })
|
|
1960
|
+
}), null, 16, ["size", "class"])) : isSelectItem(item) && item.chip ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
1961
|
+
key: 2,
|
|
1962
|
+
size: item.ui?.itemLeadingChipSize || unref(uiProp)?.itemLeadingChipSize || ui.value.itemLeadingChipSize(),
|
|
1963
|
+
inset: "",
|
|
1964
|
+
standalone: ""
|
|
1965
|
+
}, { ref_for: true }, item.chip, {
|
|
1966
|
+
"data-slot": "itemLeadingChip",
|
|
1967
|
+
class: ui.value.itemLeadingChip({ class: [unref(uiProp)?.itemLeadingChip, item.ui?.itemLeadingChip] })
|
|
1968
|
+
}), null, 16, ["size", "class"])) : createCommentVNode("", true)
|
|
1969
|
+
]),
|
|
1970
|
+
createVNode("span", {
|
|
1971
|
+
"data-slot": "itemWrapper",
|
|
1972
|
+
class: ui.value.itemWrapper({ class: [unref(uiProp)?.itemWrapper, isSelectItem(item) && item.ui?.itemWrapper] })
|
|
1973
|
+
}, [
|
|
1974
|
+
createVNode(unref(SelectItemText), {
|
|
1975
|
+
"data-slot": "itemLabel",
|
|
1976
|
+
class: ui.value.itemLabel({ class: [unref(uiProp)?.itemLabel, isSelectItem(item) && item.ui?.itemLabel] })
|
|
1977
|
+
}, {
|
|
1978
|
+
default: withCtx(() => [
|
|
1979
|
+
renderSlot(_ctx.$slots, "item-label", {
|
|
1980
|
+
item,
|
|
1981
|
+
index
|
|
1982
|
+
}, () => [
|
|
1983
|
+
createTextVNode(toDisplayString(isSelectItem(item) ? unref(get)(item, props.labelKey) : item), 1)
|
|
1984
|
+
])
|
|
1985
|
+
]),
|
|
1986
|
+
_: 2
|
|
1987
|
+
}, 1032, ["class"]),
|
|
1988
|
+
isSelectItem(item) && (unref(get)(item, props.descriptionKey) || !!slots["item-description"]) ? (openBlock(), createBlock("span", {
|
|
1989
|
+
key: 0,
|
|
1990
|
+
"data-slot": "itemDescription",
|
|
1991
|
+
class: ui.value.itemDescription({ class: [unref(uiProp)?.itemDescription, isSelectItem(item) && item.ui?.itemDescription] })
|
|
1992
|
+
}, [
|
|
1993
|
+
renderSlot(_ctx.$slots, "item-description", {
|
|
1994
|
+
item,
|
|
1995
|
+
index
|
|
1996
|
+
}, () => [
|
|
1997
|
+
createTextVNode(toDisplayString(unref(get)(item, props.descriptionKey)), 1)
|
|
1998
|
+
])
|
|
1999
|
+
], 2)) : createCommentVNode("", true)
|
|
2000
|
+
], 2),
|
|
2001
|
+
createVNode("span", {
|
|
2002
|
+
"data-slot": "itemTrailing",
|
|
2003
|
+
class: ui.value.itemTrailing({ class: [unref(uiProp)?.itemTrailing, isSelectItem(item) && item.ui?.itemTrailing] })
|
|
2004
|
+
}, [
|
|
2005
|
+
renderSlot(_ctx.$slots, "item-trailing", {
|
|
2006
|
+
item,
|
|
2007
|
+
index,
|
|
2008
|
+
ui: ui.value
|
|
2009
|
+
}),
|
|
2010
|
+
createVNode(unref(SelectItemIndicator), { "as-child": "" }, {
|
|
2011
|
+
default: withCtx(() => [
|
|
2012
|
+
createVNode(_sfc_main$m, {
|
|
2013
|
+
name: __props.selectedIcon || unref(appConfig).ui.icons.check,
|
|
2014
|
+
"data-slot": "itemTrailingIcon",
|
|
2015
|
+
class: ui.value.itemTrailingIcon({ class: [unref(uiProp)?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })
|
|
2016
|
+
}, null, 8, ["name", "class"])
|
|
2017
|
+
]),
|
|
2018
|
+
_: 2
|
|
2019
|
+
}, 1024)
|
|
2020
|
+
], 2)
|
|
2021
|
+
])
|
|
2022
|
+
]),
|
|
2023
|
+
_: 2
|
|
2024
|
+
}, 1032, ["class", "disabled", "value", "onSelect"]))
|
|
2025
|
+
], 64);
|
|
2026
|
+
}), 128))
|
|
2027
|
+
];
|
|
2028
|
+
}
|
|
2029
|
+
}),
|
|
2030
|
+
_: 2
|
|
2031
|
+
}, _parent4, _scopeId3));
|
|
2032
|
+
});
|
|
2033
|
+
_push4(`<!--]--></div>`);
|
|
2034
|
+
ssrRenderSlot(_ctx.$slots, "content-bottom", {}, null, _push4, _parent4, _scopeId3);
|
|
2035
|
+
if (!!__props.arrow) {
|
|
2036
|
+
_push4(ssrRenderComponent(unref(SelectArrow), mergeProps(arrowProps.value, {
|
|
2037
|
+
"data-slot": "arrow",
|
|
2038
|
+
class: ui.value.arrow({ class: unref(uiProp)?.arrow })
|
|
2039
|
+
}), null, _parent4, _scopeId3));
|
|
2040
|
+
} else {
|
|
2041
|
+
_push4(`<!---->`);
|
|
2042
|
+
}
|
|
2043
|
+
} else {
|
|
2044
|
+
return [
|
|
2045
|
+
renderSlot(_ctx.$slots, "content-top"),
|
|
2046
|
+
createVNode("div", {
|
|
2047
|
+
ref_key: "viewportRef",
|
|
2048
|
+
ref: viewportRef,
|
|
2049
|
+
role: "presentation",
|
|
2050
|
+
"data-slot": "viewport",
|
|
2051
|
+
class: ui.value.viewport({ class: unref(uiProp)?.viewport })
|
|
2052
|
+
}, [
|
|
2053
|
+
(openBlock(true), createBlock(Fragment, null, renderList(groups.value, (group, groupIndex) => {
|
|
2054
|
+
return openBlock(), createBlock(unref(SelectGroup), {
|
|
2055
|
+
key: `group-${groupIndex}`,
|
|
2056
|
+
"data-slot": "group",
|
|
2057
|
+
class: ui.value.group({ class: unref(uiProp)?.group })
|
|
2058
|
+
}, {
|
|
2059
|
+
default: withCtx(() => [
|
|
2060
|
+
(openBlock(true), createBlock(Fragment, null, renderList(group, (item, index) => {
|
|
2061
|
+
return openBlock(), createBlock(Fragment, {
|
|
2062
|
+
key: `group-${groupIndex}-${index}`
|
|
2063
|
+
}, [
|
|
2064
|
+
isSelectItem(item) && item.type === "label" ? (openBlock(), createBlock(unref(SelectLabel), {
|
|
2065
|
+
key: 0,
|
|
2066
|
+
"data-slot": "label",
|
|
2067
|
+
class: ui.value.label({ class: [unref(uiProp)?.label, item.ui?.label, item.class] })
|
|
2068
|
+
}, {
|
|
2069
|
+
default: withCtx(() => [
|
|
2070
|
+
createTextVNode(toDisplayString(unref(get)(item, props.labelKey)), 1)
|
|
2071
|
+
]),
|
|
2072
|
+
_: 2
|
|
2073
|
+
}, 1032, ["class"])) : isSelectItem(item) && item.type === "separator" ? (openBlock(), createBlock(unref(SelectSeparator), {
|
|
2074
|
+
key: 1,
|
|
2075
|
+
"data-slot": "separator",
|
|
2076
|
+
class: ui.value.separator({ class: [unref(uiProp)?.separator, item.ui?.separator, item.class] })
|
|
2077
|
+
}, null, 8, ["class"])) : (openBlock(), createBlock(unref(SelectItem), {
|
|
2078
|
+
key: 2,
|
|
2079
|
+
"data-slot": "item",
|
|
2080
|
+
class: ui.value.item({ class: [unref(uiProp)?.item, isSelectItem(item) && item.ui?.item, isSelectItem(item) && item.class] }),
|
|
2081
|
+
disabled: isSelectItem(item) && item.disabled,
|
|
2082
|
+
value: isSelectItem(item) ? unref(get)(item, props.valueKey) : item,
|
|
2083
|
+
onSelect: ($event) => isSelectItem(item) && item.onSelect?.($event)
|
|
2084
|
+
}, {
|
|
2085
|
+
default: withCtx(() => [
|
|
2086
|
+
renderSlot(_ctx.$slots, "item", {
|
|
2087
|
+
item,
|
|
2088
|
+
index,
|
|
2089
|
+
ui: ui.value
|
|
2090
|
+
}, () => [
|
|
2091
|
+
renderSlot(_ctx.$slots, "item-leading", {
|
|
2092
|
+
item,
|
|
2093
|
+
index,
|
|
2094
|
+
ui: ui.value
|
|
2095
|
+
}, () => [
|
|
2096
|
+
isSelectItem(item) && item.icon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
2097
|
+
key: 0,
|
|
2098
|
+
name: item.icon,
|
|
2099
|
+
"data-slot": "itemLeadingIcon",
|
|
2100
|
+
class: ui.value.itemLeadingIcon({ class: [unref(uiProp)?.itemLeadingIcon, item.ui?.itemLeadingIcon] })
|
|
2101
|
+
}, null, 8, ["name", "class"])) : isSelectItem(item) && item.avatar ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
2102
|
+
key: 1,
|
|
2103
|
+
size: item.ui?.itemLeadingAvatarSize || unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
2104
|
+
}, { ref_for: true }, item.avatar, {
|
|
2105
|
+
"data-slot": "itemLeadingAvatar",
|
|
2106
|
+
class: ui.value.itemLeadingAvatar({ class: [unref(uiProp)?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })
|
|
2107
|
+
}), null, 16, ["size", "class"])) : isSelectItem(item) && item.chip ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2108
|
+
key: 2,
|
|
2109
|
+
size: item.ui?.itemLeadingChipSize || unref(uiProp)?.itemLeadingChipSize || ui.value.itemLeadingChipSize(),
|
|
2110
|
+
inset: "",
|
|
2111
|
+
standalone: ""
|
|
2112
|
+
}, { ref_for: true }, item.chip, {
|
|
2113
|
+
"data-slot": "itemLeadingChip",
|
|
2114
|
+
class: ui.value.itemLeadingChip({ class: [unref(uiProp)?.itemLeadingChip, item.ui?.itemLeadingChip] })
|
|
2115
|
+
}), null, 16, ["size", "class"])) : createCommentVNode("", true)
|
|
2116
|
+
]),
|
|
2117
|
+
createVNode("span", {
|
|
2118
|
+
"data-slot": "itemWrapper",
|
|
2119
|
+
class: ui.value.itemWrapper({ class: [unref(uiProp)?.itemWrapper, isSelectItem(item) && item.ui?.itemWrapper] })
|
|
2120
|
+
}, [
|
|
2121
|
+
createVNode(unref(SelectItemText), {
|
|
2122
|
+
"data-slot": "itemLabel",
|
|
2123
|
+
class: ui.value.itemLabel({ class: [unref(uiProp)?.itemLabel, isSelectItem(item) && item.ui?.itemLabel] })
|
|
2124
|
+
}, {
|
|
2125
|
+
default: withCtx(() => [
|
|
2126
|
+
renderSlot(_ctx.$slots, "item-label", {
|
|
2127
|
+
item,
|
|
2128
|
+
index
|
|
2129
|
+
}, () => [
|
|
2130
|
+
createTextVNode(toDisplayString(isSelectItem(item) ? unref(get)(item, props.labelKey) : item), 1)
|
|
2131
|
+
])
|
|
2132
|
+
]),
|
|
2133
|
+
_: 2
|
|
2134
|
+
}, 1032, ["class"]),
|
|
2135
|
+
isSelectItem(item) && (unref(get)(item, props.descriptionKey) || !!slots["item-description"]) ? (openBlock(), createBlock("span", {
|
|
2136
|
+
key: 0,
|
|
2137
|
+
"data-slot": "itemDescription",
|
|
2138
|
+
class: ui.value.itemDescription({ class: [unref(uiProp)?.itemDescription, isSelectItem(item) && item.ui?.itemDescription] })
|
|
2139
|
+
}, [
|
|
2140
|
+
renderSlot(_ctx.$slots, "item-description", {
|
|
2141
|
+
item,
|
|
2142
|
+
index
|
|
2143
|
+
}, () => [
|
|
2144
|
+
createTextVNode(toDisplayString(unref(get)(item, props.descriptionKey)), 1)
|
|
2145
|
+
])
|
|
2146
|
+
], 2)) : createCommentVNode("", true)
|
|
2147
|
+
], 2),
|
|
2148
|
+
createVNode("span", {
|
|
2149
|
+
"data-slot": "itemTrailing",
|
|
2150
|
+
class: ui.value.itemTrailing({ class: [unref(uiProp)?.itemTrailing, isSelectItem(item) && item.ui?.itemTrailing] })
|
|
2151
|
+
}, [
|
|
2152
|
+
renderSlot(_ctx.$slots, "item-trailing", {
|
|
2153
|
+
item,
|
|
2154
|
+
index,
|
|
2155
|
+
ui: ui.value
|
|
2156
|
+
}),
|
|
2157
|
+
createVNode(unref(SelectItemIndicator), { "as-child": "" }, {
|
|
2158
|
+
default: withCtx(() => [
|
|
2159
|
+
createVNode(_sfc_main$m, {
|
|
2160
|
+
name: __props.selectedIcon || unref(appConfig).ui.icons.check,
|
|
2161
|
+
"data-slot": "itemTrailingIcon",
|
|
2162
|
+
class: ui.value.itemTrailingIcon({ class: [unref(uiProp)?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })
|
|
2163
|
+
}, null, 8, ["name", "class"])
|
|
2164
|
+
]),
|
|
2165
|
+
_: 2
|
|
2166
|
+
}, 1024)
|
|
2167
|
+
], 2)
|
|
2168
|
+
])
|
|
2169
|
+
]),
|
|
2170
|
+
_: 2
|
|
2171
|
+
}, 1032, ["class", "disabled", "value", "onSelect"]))
|
|
2172
|
+
], 64);
|
|
2173
|
+
}), 128))
|
|
2174
|
+
]),
|
|
2175
|
+
_: 2
|
|
2176
|
+
}, 1032, ["class"]);
|
|
2177
|
+
}), 128))
|
|
2178
|
+
], 2),
|
|
2179
|
+
renderSlot(_ctx.$slots, "content-bottom"),
|
|
2180
|
+
!!__props.arrow ? (openBlock(), createBlock(unref(SelectArrow), mergeProps({ key: 0 }, arrowProps.value, {
|
|
2181
|
+
"data-slot": "arrow",
|
|
2182
|
+
class: ui.value.arrow({ class: unref(uiProp)?.arrow })
|
|
2183
|
+
}), null, 16, ["class"])) : createCommentVNode("", true)
|
|
2184
|
+
];
|
|
2185
|
+
}
|
|
2186
|
+
}),
|
|
2187
|
+
_: 2
|
|
2188
|
+
}, _parent3, _scopeId2));
|
|
2189
|
+
} else {
|
|
2190
|
+
return [
|
|
2191
|
+
createVNode(unref(SelectContent), mergeProps({
|
|
2192
|
+
"data-slot": "content",
|
|
2193
|
+
class: ui.value.content({ class: unref(uiProp)?.content })
|
|
2194
|
+
}, contentProps.value), {
|
|
2195
|
+
default: withCtx(() => [
|
|
2196
|
+
renderSlot(_ctx.$slots, "content-top"),
|
|
2197
|
+
createVNode("div", {
|
|
2198
|
+
ref_key: "viewportRef",
|
|
2199
|
+
ref: viewportRef,
|
|
2200
|
+
role: "presentation",
|
|
2201
|
+
"data-slot": "viewport",
|
|
2202
|
+
class: ui.value.viewport({ class: unref(uiProp)?.viewport })
|
|
2203
|
+
}, [
|
|
2204
|
+
(openBlock(true), createBlock(Fragment, null, renderList(groups.value, (group, groupIndex) => {
|
|
2205
|
+
return openBlock(), createBlock(unref(SelectGroup), {
|
|
2206
|
+
key: `group-${groupIndex}`,
|
|
2207
|
+
"data-slot": "group",
|
|
2208
|
+
class: ui.value.group({ class: unref(uiProp)?.group })
|
|
2209
|
+
}, {
|
|
2210
|
+
default: withCtx(() => [
|
|
2211
|
+
(openBlock(true), createBlock(Fragment, null, renderList(group, (item, index) => {
|
|
2212
|
+
return openBlock(), createBlock(Fragment, {
|
|
2213
|
+
key: `group-${groupIndex}-${index}`
|
|
2214
|
+
}, [
|
|
2215
|
+
isSelectItem(item) && item.type === "label" ? (openBlock(), createBlock(unref(SelectLabel), {
|
|
2216
|
+
key: 0,
|
|
2217
|
+
"data-slot": "label",
|
|
2218
|
+
class: ui.value.label({ class: [unref(uiProp)?.label, item.ui?.label, item.class] })
|
|
2219
|
+
}, {
|
|
2220
|
+
default: withCtx(() => [
|
|
2221
|
+
createTextVNode(toDisplayString(unref(get)(item, props.labelKey)), 1)
|
|
2222
|
+
]),
|
|
2223
|
+
_: 2
|
|
2224
|
+
}, 1032, ["class"])) : isSelectItem(item) && item.type === "separator" ? (openBlock(), createBlock(unref(SelectSeparator), {
|
|
2225
|
+
key: 1,
|
|
2226
|
+
"data-slot": "separator",
|
|
2227
|
+
class: ui.value.separator({ class: [unref(uiProp)?.separator, item.ui?.separator, item.class] })
|
|
2228
|
+
}, null, 8, ["class"])) : (openBlock(), createBlock(unref(SelectItem), {
|
|
2229
|
+
key: 2,
|
|
2230
|
+
"data-slot": "item",
|
|
2231
|
+
class: ui.value.item({ class: [unref(uiProp)?.item, isSelectItem(item) && item.ui?.item, isSelectItem(item) && item.class] }),
|
|
2232
|
+
disabled: isSelectItem(item) && item.disabled,
|
|
2233
|
+
value: isSelectItem(item) ? unref(get)(item, props.valueKey) : item,
|
|
2234
|
+
onSelect: ($event) => isSelectItem(item) && item.onSelect?.($event)
|
|
2235
|
+
}, {
|
|
2236
|
+
default: withCtx(() => [
|
|
2237
|
+
renderSlot(_ctx.$slots, "item", {
|
|
2238
|
+
item,
|
|
2239
|
+
index,
|
|
2240
|
+
ui: ui.value
|
|
2241
|
+
}, () => [
|
|
2242
|
+
renderSlot(_ctx.$slots, "item-leading", {
|
|
2243
|
+
item,
|
|
2244
|
+
index,
|
|
2245
|
+
ui: ui.value
|
|
2246
|
+
}, () => [
|
|
2247
|
+
isSelectItem(item) && item.icon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
2248
|
+
key: 0,
|
|
2249
|
+
name: item.icon,
|
|
2250
|
+
"data-slot": "itemLeadingIcon",
|
|
2251
|
+
class: ui.value.itemLeadingIcon({ class: [unref(uiProp)?.itemLeadingIcon, item.ui?.itemLeadingIcon] })
|
|
2252
|
+
}, null, 8, ["name", "class"])) : isSelectItem(item) && item.avatar ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
2253
|
+
key: 1,
|
|
2254
|
+
size: item.ui?.itemLeadingAvatarSize || unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
2255
|
+
}, { ref_for: true }, item.avatar, {
|
|
2256
|
+
"data-slot": "itemLeadingAvatar",
|
|
2257
|
+
class: ui.value.itemLeadingAvatar({ class: [unref(uiProp)?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })
|
|
2258
|
+
}), null, 16, ["size", "class"])) : isSelectItem(item) && item.chip ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2259
|
+
key: 2,
|
|
2260
|
+
size: item.ui?.itemLeadingChipSize || unref(uiProp)?.itemLeadingChipSize || ui.value.itemLeadingChipSize(),
|
|
2261
|
+
inset: "",
|
|
2262
|
+
standalone: ""
|
|
2263
|
+
}, { ref_for: true }, item.chip, {
|
|
2264
|
+
"data-slot": "itemLeadingChip",
|
|
2265
|
+
class: ui.value.itemLeadingChip({ class: [unref(uiProp)?.itemLeadingChip, item.ui?.itemLeadingChip] })
|
|
2266
|
+
}), null, 16, ["size", "class"])) : createCommentVNode("", true)
|
|
2267
|
+
]),
|
|
2268
|
+
createVNode("span", {
|
|
2269
|
+
"data-slot": "itemWrapper",
|
|
2270
|
+
class: ui.value.itemWrapper({ class: [unref(uiProp)?.itemWrapper, isSelectItem(item) && item.ui?.itemWrapper] })
|
|
2271
|
+
}, [
|
|
2272
|
+
createVNode(unref(SelectItemText), {
|
|
2273
|
+
"data-slot": "itemLabel",
|
|
2274
|
+
class: ui.value.itemLabel({ class: [unref(uiProp)?.itemLabel, isSelectItem(item) && item.ui?.itemLabel] })
|
|
2275
|
+
}, {
|
|
2276
|
+
default: withCtx(() => [
|
|
2277
|
+
renderSlot(_ctx.$slots, "item-label", {
|
|
2278
|
+
item,
|
|
2279
|
+
index
|
|
2280
|
+
}, () => [
|
|
2281
|
+
createTextVNode(toDisplayString(isSelectItem(item) ? unref(get)(item, props.labelKey) : item), 1)
|
|
2282
|
+
])
|
|
2283
|
+
]),
|
|
2284
|
+
_: 2
|
|
2285
|
+
}, 1032, ["class"]),
|
|
2286
|
+
isSelectItem(item) && (unref(get)(item, props.descriptionKey) || !!slots["item-description"]) ? (openBlock(), createBlock("span", {
|
|
2287
|
+
key: 0,
|
|
2288
|
+
"data-slot": "itemDescription",
|
|
2289
|
+
class: ui.value.itemDescription({ class: [unref(uiProp)?.itemDescription, isSelectItem(item) && item.ui?.itemDescription] })
|
|
2290
|
+
}, [
|
|
2291
|
+
renderSlot(_ctx.$slots, "item-description", {
|
|
2292
|
+
item,
|
|
2293
|
+
index
|
|
2294
|
+
}, () => [
|
|
2295
|
+
createTextVNode(toDisplayString(unref(get)(item, props.descriptionKey)), 1)
|
|
2296
|
+
])
|
|
2297
|
+
], 2)) : createCommentVNode("", true)
|
|
2298
|
+
], 2),
|
|
2299
|
+
createVNode("span", {
|
|
2300
|
+
"data-slot": "itemTrailing",
|
|
2301
|
+
class: ui.value.itemTrailing({ class: [unref(uiProp)?.itemTrailing, isSelectItem(item) && item.ui?.itemTrailing] })
|
|
2302
|
+
}, [
|
|
2303
|
+
renderSlot(_ctx.$slots, "item-trailing", {
|
|
2304
|
+
item,
|
|
2305
|
+
index,
|
|
2306
|
+
ui: ui.value
|
|
2307
|
+
}),
|
|
2308
|
+
createVNode(unref(SelectItemIndicator), { "as-child": "" }, {
|
|
2309
|
+
default: withCtx(() => [
|
|
2310
|
+
createVNode(_sfc_main$m, {
|
|
2311
|
+
name: __props.selectedIcon || unref(appConfig).ui.icons.check,
|
|
2312
|
+
"data-slot": "itemTrailingIcon",
|
|
2313
|
+
class: ui.value.itemTrailingIcon({ class: [unref(uiProp)?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })
|
|
2314
|
+
}, null, 8, ["name", "class"])
|
|
2315
|
+
]),
|
|
2316
|
+
_: 2
|
|
2317
|
+
}, 1024)
|
|
2318
|
+
], 2)
|
|
2319
|
+
])
|
|
2320
|
+
]),
|
|
2321
|
+
_: 2
|
|
2322
|
+
}, 1032, ["class", "disabled", "value", "onSelect"]))
|
|
2323
|
+
], 64);
|
|
2324
|
+
}), 128))
|
|
2325
|
+
]),
|
|
2326
|
+
_: 2
|
|
2327
|
+
}, 1032, ["class"]);
|
|
2328
|
+
}), 128))
|
|
2329
|
+
], 2),
|
|
2330
|
+
renderSlot(_ctx.$slots, "content-bottom"),
|
|
2331
|
+
!!__props.arrow ? (openBlock(), createBlock(unref(SelectArrow), mergeProps({ key: 0 }, arrowProps.value, {
|
|
2332
|
+
"data-slot": "arrow",
|
|
2333
|
+
class: ui.value.arrow({ class: unref(uiProp)?.arrow })
|
|
2334
|
+
}), null, 16, ["class"])) : createCommentVNode("", true)
|
|
2335
|
+
]),
|
|
2336
|
+
_: 3
|
|
2337
|
+
}, 16, ["class"])
|
|
2338
|
+
];
|
|
2339
|
+
}
|
|
2340
|
+
}),
|
|
2341
|
+
_: 2
|
|
2342
|
+
}, _parent2, _scopeId));
|
|
2343
|
+
} else {
|
|
2344
|
+
return [
|
|
2345
|
+
createVNode(unref(SelectTrigger), mergeProps({
|
|
2346
|
+
id: unref(id),
|
|
2347
|
+
ref_key: "triggerRef",
|
|
2348
|
+
ref: triggerRef,
|
|
2349
|
+
"data-slot": "base",
|
|
2350
|
+
class: ui.value.base({ class: [unref(uiProp)?.base, props.class] })
|
|
2351
|
+
}, { ..._ctx.$attrs, ...unref(ariaAttrs) }), {
|
|
2352
|
+
default: withCtx(() => [
|
|
2353
|
+
unref(isLeading) || !!__props.avatar || !!slots.leading ? (openBlock(), createBlock("span", {
|
|
2354
|
+
key: 0,
|
|
2355
|
+
"data-slot": "leading",
|
|
2356
|
+
class: ui.value.leading({ class: unref(uiProp)?.leading })
|
|
2357
|
+
}, [
|
|
2358
|
+
renderSlot(_ctx.$slots, "leading", {
|
|
2359
|
+
modelValue,
|
|
2360
|
+
open,
|
|
2361
|
+
ui: ui.value
|
|
2362
|
+
}, () => [
|
|
2363
|
+
unref(isLeading) && unref(leadingIconName) ? (openBlock(), createBlock(_sfc_main$m, {
|
|
2364
|
+
key: 0,
|
|
2365
|
+
name: unref(leadingIconName),
|
|
2366
|
+
"data-slot": "leadingIcon",
|
|
2367
|
+
class: ui.value.leadingIcon({ class: unref(uiProp)?.leadingIcon })
|
|
2368
|
+
}, null, 8, ["name", "class"])) : !!__props.avatar ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
2369
|
+
key: 1,
|
|
2370
|
+
size: unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
2371
|
+
}, __props.avatar, {
|
|
2372
|
+
"data-slot": "itemLeadingAvatar",
|
|
2373
|
+
class: ui.value.itemLeadingAvatar({ class: unref(uiProp)?.itemLeadingAvatar })
|
|
2374
|
+
}), null, 16, ["size", "class"])) : createCommentVNode("", true)
|
|
2375
|
+
])
|
|
2376
|
+
], 2)) : createCommentVNode("", true),
|
|
2377
|
+
renderSlot(_ctx.$slots, "default", {
|
|
2378
|
+
modelValue,
|
|
2379
|
+
open,
|
|
2380
|
+
ui: ui.value
|
|
2381
|
+
}, () => [
|
|
2382
|
+
(openBlock(true), createBlock(Fragment, null, renderList([displayValue(modelValue)], (displayedModelValue) => {
|
|
2383
|
+
return openBlock(), createBlock(Fragment, { key: displayedModelValue }, [
|
|
2384
|
+
displayedModelValue !== void 0 && displayedModelValue !== null ? (openBlock(), createBlock("span", {
|
|
2385
|
+
key: 0,
|
|
2386
|
+
"data-slot": "value",
|
|
2387
|
+
class: ui.value.value({ class: unref(uiProp)?.value })
|
|
2388
|
+
}, toDisplayString(displayedModelValue), 3)) : (openBlock(), createBlock("span", {
|
|
2389
|
+
key: 1,
|
|
2390
|
+
"data-slot": "placeholder",
|
|
2391
|
+
class: ui.value.placeholder({ class: unref(uiProp)?.placeholder })
|
|
2392
|
+
}, toDisplayString(__props.placeholder ?? " "), 3))
|
|
2393
|
+
], 64);
|
|
2394
|
+
}), 128))
|
|
2395
|
+
]),
|
|
2396
|
+
unref(isTrailing) || !!slots.trailing ? (openBlock(), createBlock("span", {
|
|
2397
|
+
key: 1,
|
|
2398
|
+
"data-slot": "trailing",
|
|
2399
|
+
class: ui.value.trailing({ class: unref(uiProp)?.trailing })
|
|
2400
|
+
}, [
|
|
2401
|
+
renderSlot(_ctx.$slots, "trailing", {
|
|
2402
|
+
modelValue,
|
|
2403
|
+
open,
|
|
2404
|
+
ui: ui.value
|
|
2405
|
+
}, () => [
|
|
2406
|
+
unref(trailingIconName) ? (openBlock(), createBlock(_sfc_main$m, {
|
|
2407
|
+
key: 0,
|
|
2408
|
+
name: unref(trailingIconName),
|
|
2409
|
+
"data-slot": "trailingIcon",
|
|
2410
|
+
class: ui.value.trailingIcon({ class: unref(uiProp)?.trailingIcon })
|
|
2411
|
+
}, null, 8, ["name", "class"])) : createCommentVNode("", true)
|
|
2412
|
+
])
|
|
2413
|
+
], 2)) : createCommentVNode("", true)
|
|
2414
|
+
]),
|
|
2415
|
+
_: 2
|
|
2416
|
+
}, 1040, ["id", "class"]),
|
|
2417
|
+
createVNode(unref(SelectPortal), unref(portalProps), {
|
|
2418
|
+
default: withCtx(() => [
|
|
2419
|
+
createVNode(unref(SelectContent), mergeProps({
|
|
2420
|
+
"data-slot": "content",
|
|
2421
|
+
class: ui.value.content({ class: unref(uiProp)?.content })
|
|
2422
|
+
}, contentProps.value), {
|
|
2423
|
+
default: withCtx(() => [
|
|
2424
|
+
renderSlot(_ctx.$slots, "content-top"),
|
|
2425
|
+
createVNode("div", {
|
|
2426
|
+
ref_key: "viewportRef",
|
|
2427
|
+
ref: viewportRef,
|
|
2428
|
+
role: "presentation",
|
|
2429
|
+
"data-slot": "viewport",
|
|
2430
|
+
class: ui.value.viewport({ class: unref(uiProp)?.viewport })
|
|
2431
|
+
}, [
|
|
2432
|
+
(openBlock(true), createBlock(Fragment, null, renderList(groups.value, (group, groupIndex) => {
|
|
2433
|
+
return openBlock(), createBlock(unref(SelectGroup), {
|
|
2434
|
+
key: `group-${groupIndex}`,
|
|
2435
|
+
"data-slot": "group",
|
|
2436
|
+
class: ui.value.group({ class: unref(uiProp)?.group })
|
|
2437
|
+
}, {
|
|
2438
|
+
default: withCtx(() => [
|
|
2439
|
+
(openBlock(true), createBlock(Fragment, null, renderList(group, (item, index) => {
|
|
2440
|
+
return openBlock(), createBlock(Fragment, {
|
|
2441
|
+
key: `group-${groupIndex}-${index}`
|
|
2442
|
+
}, [
|
|
2443
|
+
isSelectItem(item) && item.type === "label" ? (openBlock(), createBlock(unref(SelectLabel), {
|
|
2444
|
+
key: 0,
|
|
2445
|
+
"data-slot": "label",
|
|
2446
|
+
class: ui.value.label({ class: [unref(uiProp)?.label, item.ui?.label, item.class] })
|
|
2447
|
+
}, {
|
|
2448
|
+
default: withCtx(() => [
|
|
2449
|
+
createTextVNode(toDisplayString(unref(get)(item, props.labelKey)), 1)
|
|
2450
|
+
]),
|
|
2451
|
+
_: 2
|
|
2452
|
+
}, 1032, ["class"])) : isSelectItem(item) && item.type === "separator" ? (openBlock(), createBlock(unref(SelectSeparator), {
|
|
2453
|
+
key: 1,
|
|
2454
|
+
"data-slot": "separator",
|
|
2455
|
+
class: ui.value.separator({ class: [unref(uiProp)?.separator, item.ui?.separator, item.class] })
|
|
2456
|
+
}, null, 8, ["class"])) : (openBlock(), createBlock(unref(SelectItem), {
|
|
2457
|
+
key: 2,
|
|
2458
|
+
"data-slot": "item",
|
|
2459
|
+
class: ui.value.item({ class: [unref(uiProp)?.item, isSelectItem(item) && item.ui?.item, isSelectItem(item) && item.class] }),
|
|
2460
|
+
disabled: isSelectItem(item) && item.disabled,
|
|
2461
|
+
value: isSelectItem(item) ? unref(get)(item, props.valueKey) : item,
|
|
2462
|
+
onSelect: ($event) => isSelectItem(item) && item.onSelect?.($event)
|
|
2463
|
+
}, {
|
|
2464
|
+
default: withCtx(() => [
|
|
2465
|
+
renderSlot(_ctx.$slots, "item", {
|
|
2466
|
+
item,
|
|
2467
|
+
index,
|
|
2468
|
+
ui: ui.value
|
|
2469
|
+
}, () => [
|
|
2470
|
+
renderSlot(_ctx.$slots, "item-leading", {
|
|
2471
|
+
item,
|
|
2472
|
+
index,
|
|
2473
|
+
ui: ui.value
|
|
2474
|
+
}, () => [
|
|
2475
|
+
isSelectItem(item) && item.icon ? (openBlock(), createBlock(_sfc_main$m, {
|
|
2476
|
+
key: 0,
|
|
2477
|
+
name: item.icon,
|
|
2478
|
+
"data-slot": "itemLeadingIcon",
|
|
2479
|
+
class: ui.value.itemLeadingIcon({ class: [unref(uiProp)?.itemLeadingIcon, item.ui?.itemLeadingIcon] })
|
|
2480
|
+
}, null, 8, ["name", "class"])) : isSelectItem(item) && item.avatar ? (openBlock(), createBlock(_sfc_main$k, mergeProps({
|
|
2481
|
+
key: 1,
|
|
2482
|
+
size: item.ui?.itemLeadingAvatarSize || unref(uiProp)?.itemLeadingAvatarSize || ui.value.itemLeadingAvatarSize()
|
|
2483
|
+
}, { ref_for: true }, item.avatar, {
|
|
2484
|
+
"data-slot": "itemLeadingAvatar",
|
|
2485
|
+
class: ui.value.itemLeadingAvatar({ class: [unref(uiProp)?.itemLeadingAvatar, item.ui?.itemLeadingAvatar] })
|
|
2486
|
+
}), null, 16, ["size", "class"])) : isSelectItem(item) && item.chip ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
2487
|
+
key: 2,
|
|
2488
|
+
size: item.ui?.itemLeadingChipSize || unref(uiProp)?.itemLeadingChipSize || ui.value.itemLeadingChipSize(),
|
|
2489
|
+
inset: "",
|
|
2490
|
+
standalone: ""
|
|
2491
|
+
}, { ref_for: true }, item.chip, {
|
|
2492
|
+
"data-slot": "itemLeadingChip",
|
|
2493
|
+
class: ui.value.itemLeadingChip({ class: [unref(uiProp)?.itemLeadingChip, item.ui?.itemLeadingChip] })
|
|
2494
|
+
}), null, 16, ["size", "class"])) : createCommentVNode("", true)
|
|
2495
|
+
]),
|
|
2496
|
+
createVNode("span", {
|
|
2497
|
+
"data-slot": "itemWrapper",
|
|
2498
|
+
class: ui.value.itemWrapper({ class: [unref(uiProp)?.itemWrapper, isSelectItem(item) && item.ui?.itemWrapper] })
|
|
2499
|
+
}, [
|
|
2500
|
+
createVNode(unref(SelectItemText), {
|
|
2501
|
+
"data-slot": "itemLabel",
|
|
2502
|
+
class: ui.value.itemLabel({ class: [unref(uiProp)?.itemLabel, isSelectItem(item) && item.ui?.itemLabel] })
|
|
2503
|
+
}, {
|
|
2504
|
+
default: withCtx(() => [
|
|
2505
|
+
renderSlot(_ctx.$slots, "item-label", {
|
|
2506
|
+
item,
|
|
2507
|
+
index
|
|
2508
|
+
}, () => [
|
|
2509
|
+
createTextVNode(toDisplayString(isSelectItem(item) ? unref(get)(item, props.labelKey) : item), 1)
|
|
2510
|
+
])
|
|
2511
|
+
]),
|
|
2512
|
+
_: 2
|
|
2513
|
+
}, 1032, ["class"]),
|
|
2514
|
+
isSelectItem(item) && (unref(get)(item, props.descriptionKey) || !!slots["item-description"]) ? (openBlock(), createBlock("span", {
|
|
2515
|
+
key: 0,
|
|
2516
|
+
"data-slot": "itemDescription",
|
|
2517
|
+
class: ui.value.itemDescription({ class: [unref(uiProp)?.itemDescription, isSelectItem(item) && item.ui?.itemDescription] })
|
|
2518
|
+
}, [
|
|
2519
|
+
renderSlot(_ctx.$slots, "item-description", {
|
|
2520
|
+
item,
|
|
2521
|
+
index
|
|
2522
|
+
}, () => [
|
|
2523
|
+
createTextVNode(toDisplayString(unref(get)(item, props.descriptionKey)), 1)
|
|
2524
|
+
])
|
|
2525
|
+
], 2)) : createCommentVNode("", true)
|
|
2526
|
+
], 2),
|
|
2527
|
+
createVNode("span", {
|
|
2528
|
+
"data-slot": "itemTrailing",
|
|
2529
|
+
class: ui.value.itemTrailing({ class: [unref(uiProp)?.itemTrailing, isSelectItem(item) && item.ui?.itemTrailing] })
|
|
2530
|
+
}, [
|
|
2531
|
+
renderSlot(_ctx.$slots, "item-trailing", {
|
|
2532
|
+
item,
|
|
2533
|
+
index,
|
|
2534
|
+
ui: ui.value
|
|
2535
|
+
}),
|
|
2536
|
+
createVNode(unref(SelectItemIndicator), { "as-child": "" }, {
|
|
2537
|
+
default: withCtx(() => [
|
|
2538
|
+
createVNode(_sfc_main$m, {
|
|
2539
|
+
name: __props.selectedIcon || unref(appConfig).ui.icons.check,
|
|
2540
|
+
"data-slot": "itemTrailingIcon",
|
|
2541
|
+
class: ui.value.itemTrailingIcon({ class: [unref(uiProp)?.itemTrailingIcon, isSelectItem(item) && item.ui?.itemTrailingIcon] })
|
|
2542
|
+
}, null, 8, ["name", "class"])
|
|
2543
|
+
]),
|
|
2544
|
+
_: 2
|
|
2545
|
+
}, 1024)
|
|
2546
|
+
], 2)
|
|
2547
|
+
])
|
|
2548
|
+
]),
|
|
2549
|
+
_: 2
|
|
2550
|
+
}, 1032, ["class", "disabled", "value", "onSelect"]))
|
|
2551
|
+
], 64);
|
|
2552
|
+
}), 128))
|
|
2553
|
+
]),
|
|
2554
|
+
_: 2
|
|
2555
|
+
}, 1032, ["class"]);
|
|
2556
|
+
}), 128))
|
|
2557
|
+
], 2),
|
|
2558
|
+
renderSlot(_ctx.$slots, "content-bottom"),
|
|
2559
|
+
!!__props.arrow ? (openBlock(), createBlock(unref(SelectArrow), mergeProps({ key: 0 }, arrowProps.value, {
|
|
2560
|
+
"data-slot": "arrow",
|
|
2561
|
+
class: ui.value.arrow({ class: unref(uiProp)?.arrow })
|
|
2562
|
+
}), null, 16, ["class"])) : createCommentVNode("", true)
|
|
2563
|
+
]),
|
|
2564
|
+
_: 3
|
|
2565
|
+
}, 16, ["class"])
|
|
2566
|
+
]),
|
|
2567
|
+
_: 3
|
|
2568
|
+
}, 16)
|
|
2569
|
+
];
|
|
2570
|
+
}
|
|
2571
|
+
}),
|
|
2572
|
+
_: 3
|
|
2573
|
+
}, _parent));
|
|
2574
|
+
};
|
|
2575
|
+
}
|
|
2576
|
+
});
|
|
2577
|
+
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
2578
|
+
_sfc_main$1.setup = (props, ctx) => {
|
|
2579
|
+
const ssrContext = useSSRContext();
|
|
2580
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("../../node_modules/@nuxt/ui/dist/runtime/components/Select.vue");
|
|
2581
|
+
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
2582
|
+
};
|
|
2583
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
2584
|
+
__name: "IntegrationToolsTree",
|
|
2585
|
+
__ssrInlineRender: true,
|
|
2586
|
+
props: {
|
|
2587
|
+
integrationType: {},
|
|
2588
|
+
maxScope: {},
|
|
2589
|
+
enabledToolsets: {},
|
|
2590
|
+
disabledTools: {}
|
|
2591
|
+
},
|
|
2592
|
+
emits: ["update:enabledToolsets", "update:disabledTools"],
|
|
2593
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
2594
|
+
const props = __props;
|
|
2595
|
+
const emit = __emit;
|
|
2596
|
+
const toolsets = ref([]);
|
|
2597
|
+
const tools = ref([]);
|
|
2598
|
+
const loading = ref(true);
|
|
2599
|
+
const loadError = ref(false);
|
|
2600
|
+
const expanded = ref(/* @__PURE__ */ new Set());
|
|
2601
|
+
const effectiveToolsets = computed(() => {
|
|
2602
|
+
if (toolsets.value.length)
|
|
2603
|
+
return toolsets.value;
|
|
2604
|
+
const discovered = Array.from(new Set(
|
|
2605
|
+
tools.value.map((tool) => tool.toolset).filter((key) => !!key)
|
|
2606
|
+
)).sort((a, b) => a.localeCompare(b));
|
|
2607
|
+
if (!discovered.length && tools.value.length) {
|
|
2608
|
+
return [{ key: "__all__", label: "All tools", description: "" }];
|
|
2609
|
+
}
|
|
2610
|
+
return discovered.map((key) => ({ key, label: key, description: "" }));
|
|
2611
|
+
});
|
|
2612
|
+
function scopeClass(scope) {
|
|
2613
|
+
if (scope === "read") return "bg-blue-50 text-blue-600 dark:bg-blue-950 dark:text-blue-400";
|
|
2614
|
+
if (scope === "write") return "bg-amber-50 text-amber-600 dark:bg-amber-950 dark:text-amber-400";
|
|
2615
|
+
return "bg-red-50 text-red-600 dark:bg-red-950 dark:text-red-400";
|
|
2616
|
+
}
|
|
2617
|
+
function isToolsetEnabled(key) {
|
|
2618
|
+
if (key === "__all__") {
|
|
2619
|
+
return getToolsInSet("__all__").some((t) => !props.disabledTools.includes(t.name));
|
|
2620
|
+
}
|
|
2621
|
+
return props.enabledToolsets.includes(key);
|
|
2622
|
+
}
|
|
2623
|
+
function isToolEnabled(name) {
|
|
2624
|
+
return !props.disabledTools.includes(name);
|
|
2625
|
+
}
|
|
2626
|
+
function isToolGreyed(tool) {
|
|
2627
|
+
return props.maxScope === "read" && tool.scope !== "read";
|
|
2628
|
+
}
|
|
2629
|
+
function getToolsInSet(key) {
|
|
2630
|
+
if (key === "__all__") return tools.value;
|
|
2631
|
+
return tools.value.filter((t) => t.toolset === key);
|
|
2632
|
+
}
|
|
2633
|
+
function getActiveCount(key) {
|
|
2634
|
+
return getToolsInSet(key).filter((t) => {
|
|
2635
|
+
if (isToolGreyed(t)) return false;
|
|
2636
|
+
if (props.disabledTools.includes(t.name)) return false;
|
|
2637
|
+
return true;
|
|
2638
|
+
}).length;
|
|
2639
|
+
}
|
|
2640
|
+
function toggleToolset(key, enabled) {
|
|
2641
|
+
if (key === "__all__") {
|
|
2642
|
+
const allNames = getToolsInSet("__all__").map((t) => t.name);
|
|
2643
|
+
const current2 = props.disabledTools.filter((n) => !allNames.includes(n));
|
|
2644
|
+
emit("update:disabledTools", enabled ? current2 : [...current2, ...allNames]);
|
|
2645
|
+
return;
|
|
2646
|
+
}
|
|
2647
|
+
const current = [...props.enabledToolsets];
|
|
2648
|
+
if (enabled) {
|
|
2649
|
+
if (!current.includes(key)) current.push(key);
|
|
2650
|
+
} else {
|
|
2651
|
+
if (current.length > 1) {
|
|
2652
|
+
const idx = current.indexOf(key);
|
|
2653
|
+
if (idx >= 0) current.splice(idx, 1);
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
emit("update:enabledToolsets", current);
|
|
2657
|
+
}
|
|
2658
|
+
function toggleTool(name, enabled) {
|
|
2659
|
+
const current = [...props.disabledTools];
|
|
2660
|
+
if (enabled) {
|
|
2661
|
+
const idx = current.indexOf(name);
|
|
2662
|
+
if (idx >= 0) current.splice(idx, 1);
|
|
2663
|
+
} else {
|
|
2664
|
+
if (!current.includes(name)) current.push(name);
|
|
2665
|
+
}
|
|
2666
|
+
emit("update:disabledTools", current);
|
|
2667
|
+
}
|
|
2668
|
+
async function load() {
|
|
2669
|
+
loading.value = true;
|
|
2670
|
+
loadError.value = false;
|
|
2671
|
+
try {
|
|
2672
|
+
const [tsData, toolData] = await Promise.all([
|
|
2673
|
+
$fetch(`/api/catalog/${props.integrationType}/toolsets`),
|
|
2674
|
+
$fetch(`/api/catalog/${props.integrationType}/tools`)
|
|
2675
|
+
]);
|
|
2676
|
+
toolsets.value = Object.entries(tsData || {}).map(([key, value]) => ({ key, label: value.label, description: value.description })).sort((a, b) => a.key.localeCompare(b.key));
|
|
2677
|
+
tools.value = toolData || [];
|
|
2678
|
+
if (effectiveToolsets.value.length)
|
|
2679
|
+
expanded.value = /* @__PURE__ */ new Set([effectiveToolsets.value[0].key]);
|
|
2680
|
+
} catch {
|
|
2681
|
+
loadError.value = true;
|
|
2682
|
+
} finally {
|
|
2683
|
+
loading.value = false;
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
__expose({ toolsets: effectiveToolsets });
|
|
2687
|
+
load();
|
|
2688
|
+
return (_ctx, _push, _parent, _attrs) => {
|
|
2689
|
+
const _component_USwitch = _sfc_main$3;
|
|
2690
|
+
const _component_UIcon = _sfc_main$m;
|
|
2691
|
+
_push(`<div${ssrRenderAttrs(mergeProps({ class: "space-y-2" }, _attrs))}>`);
|
|
2692
|
+
if (unref(loading)) {
|
|
2693
|
+
_push(`<div class="text-sm text-muted py-2"> Loading tools… </div>`);
|
|
2694
|
+
} else if (unref(loadError)) {
|
|
2695
|
+
_push(`<div class="text-sm text-red-600 py-2"> Failed to load tools. </div>`);
|
|
2696
|
+
} else if (!unref(effectiveToolsets).length) {
|
|
2697
|
+
_push(`<div class="text-sm text-muted py-2"> No tools available for this integration. </div>`);
|
|
2698
|
+
} else {
|
|
2699
|
+
_push(`<!--[-->`);
|
|
2700
|
+
ssrRenderList(unref(effectiveToolsets), (ts) => {
|
|
2701
|
+
_push(`<div class="${ssrRenderClass([!isToolsetEnabled(ts.key) ? "opacity-50" : "", "rounded-lg overflow-hidden border border-[var(--ui-border)]"])}"><div class="${ssrRenderClass([isToolsetEnabled(ts.key) ? "border-l-primary" : "border-l-transparent", "flex items-center gap-3 px-3 py-2.5 bg-[var(--ui-bg-elevated)] border-l-4"])}">`);
|
|
2702
|
+
_push(ssrRenderComponent(_component_USwitch, {
|
|
2703
|
+
"model-value": isToolsetEnabled(ts.key),
|
|
2704
|
+
size: "sm",
|
|
2705
|
+
"onUpdate:modelValue": ($event) => toggleToolset(ts.key, $event)
|
|
2706
|
+
}, null, _parent));
|
|
2707
|
+
_push(`<button type="button" class="flex-1 flex items-center justify-between min-w-0 text-left"><div class="min-w-0"><span class="text-sm font-semibold">${ssrInterpolate(ts.label)}</span><span class="text-xs text-muted ml-2 font-normal">${ssrInterpolate(getActiveCount(ts.key))}/${ssrInterpolate(getToolsInSet(ts.key).length)} active </span>`);
|
|
2708
|
+
if (ts.description) {
|
|
2709
|
+
_push(`<span class="block text-xs text-muted mt-0.5">${ssrInterpolate(ts.description)}</span>`);
|
|
2710
|
+
} else {
|
|
2711
|
+
_push(`<!---->`);
|
|
2712
|
+
}
|
|
2713
|
+
_push(`</div>`);
|
|
2714
|
+
_push(ssrRenderComponent(_component_UIcon, {
|
|
2715
|
+
name: unref(expanded).has(ts.key) ? "i-lucide-chevron-up" : "i-lucide-chevron-down",
|
|
2716
|
+
class: "text-muted shrink-0 ml-2"
|
|
2717
|
+
}, null, _parent));
|
|
2718
|
+
_push(`</button></div>`);
|
|
2719
|
+
if (unref(expanded).has(ts.key)) {
|
|
2720
|
+
_push(`<div class="border-t border-[var(--ui-border)]"><div class="ml-4 border-l-2 border-[var(--ui-border)]"><!--[-->`);
|
|
2721
|
+
ssrRenderList(getToolsInSet(ts.key), (tool) => {
|
|
2722
|
+
_push(`<div class="${ssrRenderClass([isToolGreyed(tool) ? "opacity-40" : "", "flex items-start gap-3 px-4 py-2.5 border-b border-[var(--ui-border)] last:border-b-0"])}">`);
|
|
2723
|
+
_push(ssrRenderComponent(_component_USwitch, {
|
|
2724
|
+
"model-value": isToolEnabled(tool.name),
|
|
2725
|
+
disabled: isToolGreyed(tool) || !isToolsetEnabled(ts.key),
|
|
2726
|
+
size: "xs",
|
|
2727
|
+
class: "mt-0.5 shrink-0",
|
|
2728
|
+
"onUpdate:modelValue": ($event) => toggleTool(tool.name, $event)
|
|
2729
|
+
}, null, _parent));
|
|
2730
|
+
_push(`<div class="min-w-0 flex-1"><div class="flex items-center gap-2 flex-wrap"><span class="text-sm font-medium">${ssrInterpolate(tool.displayName)}</span><span class="${ssrRenderClass([scopeClass(tool.scope), "text-[10px] px-1.5 py-0.5 rounded font-medium leading-tight"])}">${ssrInterpolate(tool.scope)}</span>`);
|
|
2731
|
+
if (isToolGreyed(tool)) {
|
|
2732
|
+
_push(`<span class="text-[10px] text-muted italic"> hidden by read-only </span>`);
|
|
2733
|
+
} else {
|
|
2734
|
+
_push(`<!---->`);
|
|
2735
|
+
}
|
|
2736
|
+
_push(`</div><p class="text-xs text-muted mt-0.5 leading-snug">${ssrInterpolate(tool.description)}</p><p class="text-[10px] font-mono text-muted/60 mt-0.5">${ssrInterpolate(tool.name)}</p></div></div>`);
|
|
2737
|
+
});
|
|
2738
|
+
_push(`<!--]--></div></div>`);
|
|
2739
|
+
} else {
|
|
2740
|
+
_push(`<!---->`);
|
|
2741
|
+
}
|
|
2742
|
+
_push(`</div>`);
|
|
2743
|
+
});
|
|
2744
|
+
_push(`<!--]-->`);
|
|
2745
|
+
}
|
|
2746
|
+
_push(`</div>`);
|
|
2747
|
+
};
|
|
2748
|
+
}
|
|
2749
|
+
});
|
|
2750
|
+
const _sfc_setup = _sfc_main.setup;
|
|
2751
|
+
_sfc_main.setup = (props, ctx) => {
|
|
2752
|
+
const ssrContext = useSSRContext();
|
|
2753
|
+
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/IntegrationToolsTree.vue");
|
|
2754
|
+
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
2755
|
+
};
|
|
2756
|
+
const __nuxt_component_3 = Object.assign(_sfc_main, { __name: "IntegrationToolsTree" });
|
|
2757
|
+
function useFetch(request, arg1, arg2) {
|
|
2758
|
+
const [opts = {}, autoKey] = typeof arg1 === "string" ? [{}, arg1] : [arg1, arg2];
|
|
2759
|
+
const _request = computed(() => toValue(request));
|
|
2760
|
+
const key = computed(() => toValue(opts.key) || "$f" + hash([autoKey, typeof _request.value === "string" ? _request.value : "", ...generateOptionSegments(opts)]));
|
|
2761
|
+
if (!opts.baseURL && typeof _request.value === "string" && (_request.value[0] === "/" && _request.value[1] === "/")) {
|
|
2762
|
+
throw new Error('[nuxt] [useFetch] the request URL must not start with "//".');
|
|
2763
|
+
}
|
|
2764
|
+
const {
|
|
2765
|
+
server,
|
|
2766
|
+
lazy,
|
|
2767
|
+
default: defaultFn,
|
|
2768
|
+
transform,
|
|
2769
|
+
pick,
|
|
2770
|
+
watch: watchSources,
|
|
2771
|
+
immediate,
|
|
2772
|
+
getCachedData,
|
|
2773
|
+
deep,
|
|
2774
|
+
dedupe,
|
|
2775
|
+
timeout,
|
|
2776
|
+
...fetchOptions
|
|
2777
|
+
} = opts;
|
|
2778
|
+
const _fetchOptions = reactive({
|
|
2779
|
+
...fetchDefaults,
|
|
2780
|
+
...fetchOptions,
|
|
2781
|
+
cache: typeof opts.cache === "boolean" ? void 0 : opts.cache
|
|
2782
|
+
});
|
|
2783
|
+
const _asyncDataOptions = {
|
|
2784
|
+
server,
|
|
2785
|
+
lazy,
|
|
2786
|
+
default: defaultFn,
|
|
2787
|
+
transform,
|
|
2788
|
+
pick,
|
|
2789
|
+
immediate,
|
|
2790
|
+
getCachedData,
|
|
2791
|
+
deep,
|
|
2792
|
+
dedupe,
|
|
2793
|
+
timeout,
|
|
2794
|
+
watch: watchSources === false ? [] : [...watchSources || [], _fetchOptions]
|
|
2795
|
+
};
|
|
2796
|
+
const asyncData = useAsyncData(watchSources === false ? key.value : key, (_, { signal }) => {
|
|
2797
|
+
let _$fetch = opts.$fetch || globalThis.$fetch;
|
|
2798
|
+
if (!opts.$fetch) {
|
|
2799
|
+
const isLocalFetch = typeof _request.value === "string" && _request.value[0] === "/" && (!toValue(opts.baseURL) || toValue(opts.baseURL)[0] === "/");
|
|
2800
|
+
if (isLocalFetch) {
|
|
2801
|
+
_$fetch = useRequestFetch();
|
|
2802
|
+
}
|
|
2803
|
+
}
|
|
2804
|
+
return _$fetch(_request.value, { signal, ..._fetchOptions });
|
|
2805
|
+
}, _asyncDataOptions);
|
|
2806
|
+
return asyncData;
|
|
2807
|
+
}
|
|
2808
|
+
function generateOptionSegments(opts) {
|
|
2809
|
+
const segments = [
|
|
2810
|
+
toValue(opts.method)?.toUpperCase() || "GET",
|
|
2811
|
+
toValue(opts.baseURL)
|
|
2812
|
+
];
|
|
2813
|
+
for (const _obj of [opts.query || opts.params]) {
|
|
2814
|
+
const obj = toValue(_obj);
|
|
2815
|
+
if (!obj) {
|
|
2816
|
+
continue;
|
|
2817
|
+
}
|
|
2818
|
+
const unwrapped = {};
|
|
2819
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
2820
|
+
unwrapped[toValue(key)] = toValue(value);
|
|
2821
|
+
}
|
|
2822
|
+
segments.push(unwrapped);
|
|
2823
|
+
}
|
|
2824
|
+
if (opts.body) {
|
|
2825
|
+
const value = toValue(opts.body);
|
|
2826
|
+
if (!value) {
|
|
2827
|
+
segments.push(hash(value));
|
|
2828
|
+
} else if (value instanceof ArrayBuffer) {
|
|
2829
|
+
segments.push(hash(Object.fromEntries([...new Uint8Array(value).entries()].map(([k, v]) => [k, v.toString()]))));
|
|
2830
|
+
} else if (value instanceof FormData) {
|
|
2831
|
+
const obj = {};
|
|
2832
|
+
for (const entry of value.entries()) {
|
|
2833
|
+
const [key, val] = entry;
|
|
2834
|
+
obj[key] = val instanceof File ? val.name : val;
|
|
2835
|
+
}
|
|
2836
|
+
segments.push(hash(obj));
|
|
2837
|
+
} else if (isPlainObject(value)) {
|
|
2838
|
+
segments.push(hash(reactive(value)));
|
|
2839
|
+
} else {
|
|
2840
|
+
try {
|
|
2841
|
+
segments.push(hash(value));
|
|
2842
|
+
} catch {
|
|
2843
|
+
console.warn("[useFetch] Failed to hash body", value);
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
return segments;
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
export { _sfc_main$4 as _, _sfc_main$3 as a, __nuxt_component_3 as b, _sfc_main$2 as c, _sfc_main$1 as d, useFetch as u };
|
|
2851
|
+
//# sourceMappingURL=fetch-ZbqIFhDG.mjs.map
|