@scalar/api-client
Version:
the open source API testing client
77 lines (76 loc) • 2.48 kB
JavaScript
import { defineComponent as f, ref as v, watch as x, createBlock as V, openBlock as b, unref as S, withCtx as o, createVNode as l, createElementVNode as m, createTextVNode as n } from "vue";
import { ScalarModal as A } from "@scalar/components";
import { useToasts as N } from "@scalar/use-toasts";
import g from "../../../../components/CommandPalette/CommandActionForm.vue.js";
import r from "../../../../components/CommandPalette/CommandActionInput.vue.js";
const C = { class: "flex h-8 items-start gap-2 text-sm" }, $ = { class: "flex h-8 items-start gap-2 text-sm" }, T = /* @__PURE__ */ f({
__name: "OAuthScopesAddModal",
props: {
state: {},
scopes: {}
},
emits: ["cancel", "submit"],
setup(a, { emit: u }) {
const d = u, t = v({
name: "",
description: ""
}), { toast: p } = N(), c = () => {
if (!t.value.name) {
p("Please fill in the name before adding a scope.", "error");
return;
}
d("submit", t.value), a.state.hide();
};
return x(
() => a.state.open,
(i) => {
i && (t.value = {
name: "",
description: ""
});
}
), (i, e) => (b(), V(S(A), {
size: "xs",
state: a.state,
title: "Add Scope"
}, {
default: o(() => [
l(g, {
disabled: !t.value.name || a.scopes.includes(t.value.name),
onCancel: e[2] || (e[2] = (s) => d("cancel")),
onSubmit: c
}, {
submit: o(() => [...e[5] || (e[5] = [
n("Add Scope", -1)
])]),
default: o(() => [
m("div", C, [
e[3] || (e[3] = n(" Name: ", -1)),
l(r, {
modelValue: t.value.name,
"onUpdate:modelValue": e[0] || (e[0] = (s) => t.value.name = s),
autofocus: "",
class: "!p-0",
placeholder: "read:user"
}, null, 8, ["modelValue"])
]),
m("div", $, [
e[4] || (e[4] = n(" Description: ", -1)),
l(r, {
modelValue: t.value.description,
"onUpdate:modelValue": e[1] || (e[1] = (s) => t.value.description = s),
class: "!p-0",
placeholder: "Read user data"
}, null, 8, ["modelValue"])
])
]),
_: 1
}, 8, ["disabled"])
]),
_: 1
}, 8, ["state"]));
}
});
export {
T as default
};