UNPKG

@scalar/api-client

Version:

the open source API testing client

89 lines (88 loc) 2.94 kB
import { defineComponent as V, ref as c, watch as x, createBlock as b, openBlock as k, unref as C, withCtx as s, createVNode as o, createElementVNode as m, createTextVNode as l } from "vue"; import { ScalarModal as g } from "@scalar/components"; import { useToasts as N } from "@scalar/use-toasts"; import S from "../../components/CommandPalette/CommandActionForm.vue.js"; import i from "../../components/CommandPalette/CommandActionInput.vue.js"; const U = { class: "flex h-8 items-start gap-2 text-sm" }, $ = { class: "flex h-8 items-start gap-2 text-sm" }, w = { class: "flex h-8 items-start gap-2 text-sm" }, y = /* @__PURE__ */ V({ __name: "CookieModal", props: { state: {} }, emits: ["cancel", "submit"], setup(n, { emit: f }) { const u = n, d = f, a = c({ name: "", value: "", domain: "" }), { toast: p } = N(), v = () => { if (!a.value.name || !a.value.value) { p("Please fill in all fields before adding a cookie.", "error"); return; } d("submit", a.value), u.state.hide(); }; return x( () => u.state.open, (r) => { r && (a.value = { name: "", value: "", domain: "" }); } ), (r, e) => (k(), b(C(g), { size: "xs", state: n.state, title: "Add Cookie" }, { default: s(() => [ o(S, { disabled: !a.value.name || !a.value.value, onCancel: e[3] || (e[3] = (t) => d("cancel")), onSubmit: v }, { submit: s(() => [...e[7] || (e[7] = [ l("Add Cookie", -1) ])]), default: s(() => [ m("div", U, [ e[4] || (e[4] = l(" Name: ", -1)), o(i, { modelValue: a.value.name, "onUpdate:modelValue": e[0] || (e[0] = (t) => a.value.name = t), autofocus: "", class: "!p-0", placeholder: "session_id" }, null, 8, ["modelValue"]) ]), m("div", $, [ e[5] || (e[5] = l(" Value: ", -1)), o(i, { modelValue: a.value.value, "onUpdate:modelValue": e[1] || (e[1] = (t) => a.value.value = t), autofocus: "", class: "!p-0", placeholder: "my-cookie-session-id" }, null, 8, ["modelValue"]) ]), m("div", w, [ e[6] || (e[6] = l(" Domain: ", -1)), o(i, { modelValue: a.value.domain, "onUpdate:modelValue": e[2] || (e[2] = (t) => a.value.domain = t), autofocus: "", class: "!p-0", placeholder: "example.com" }, null, 8, ["modelValue"]) ]) ]), _: 1 }, 8, ["disabled"]) ]), _: 1 }, 8, ["state"])); } }); export { y as default };