import { TrashIcon } from '@heroicons/react/outline';
import type { FormikHelpers } from 'formik';
import { Form, Formik, useFormikContext } from 'formik';
import { useState } from 'react';
import tw from 'twin.macro';
import { array, boolean, object, string } from 'yup';
import deleteEggVariable from '@/api/admin/eggs/deleteEggVariable';
import updateEggVariables from '@/api/admin/eggs/updateEggVariables';
import { NoItems } from '@/components/admin/AdminTable';
import ConfirmationModal from '@/components/elements/ConfirmationModal';
import type { EggVariable } from '@/api/admin/egg';
import { useEggFromRoute } from '@/api/admin/egg';
import NewVariableButton from '@/components/admin/nests/eggs/NewVariableButton';
import AdminBox from '@/components/admin/AdminBox';
import Button from '@/components/elements/Button';
import Checkbox from '@/components/elements/Checkbox';
import Field, { FieldRow, TextareaField } from '@/components/elements/Field';
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
import useFlash from '@/plugins/useFlash';
export const validationSchema = object().shape({
name: string().required().min(1).max(191),
description: string(),
environmentVariable: string().required().min(1).max(191),
defaultValue: string(),
isUserViewable: boolean().required(),
isUserEditable: boolean().required(),
rules: string().required(),
});
export function EggVariableForm({ prefix }: { prefix: string }) {
return (
<>