import{jsxs as t,jsx as e}from"react/jsx-runtime";import{I as l}from"./input-error-BbsDx4-P.js";import{L as f}from"./loading-button-B_LaGOAp.js";import{H as C,J as y,K as x,N,aO as b,L as s,I as m,T as D,as as S,at as T,au as I,av as L,aw as c,B as j}from"./ui-components-B24mpb8o.js";import{useForm as w}from"@inertiajs/react";import{useState as P}from"react";import"lucide-react";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";const de=({projectId:d,triggerHandler:g})=>{const[u,p]=P(!1),{data:i,setData:a,post:h,processing:n,errors:o,reset:v}=w({title:"",url:"",type:"inner",description:"",project_id:d});return t(C,{open:u,onOpenChange:p,children:[e(y,{asChild:!0,children:g}),t(x,{className:"max-w-xl p-4 md:p-6",children:[e(N,{children:"Create New Page"}),e(b,{children:"Add a new page to your project"}),t("form",{className:"space-y-5",onSubmit:r=>{r.preventDefault(),h(route("pages.store"),{onSuccess:()=>{v(),p(!1)}})},children:[t("div",{className:"grid gap-2",children:[e(s,{htmlFor:"title",children:"Page Title"}),e(m,{id:"title",type:"text",required:!0,autoFocus:!0,value:i.title,onChange:r=>a("title",r.target.value),placeholder:"Enter page title (e.g., Home, About, Contact)"}),e(l,{message:o.title})]}),t("div",{className:"grid gap-2",children:[e(s,{htmlFor:"description",children:"Description (Optional)"}),e(D,{id:"description",rows:4,value:i.description,onChange:r=>a("description",r.target.value),placeholder:"Brief description of this page",className:"min-h-[100px]"}),e(l,{message:o.description})]}),t("div",{className:"grid gap-2",children:[e(s,{children:"URL"}),e(m,{required:!0,type:"text",value:i.url,onChange:r=>a("url",r.target.value),placeholder:"Enter page URL"}),e(l,{message:o.url})]}),t("div",{className:"grid gap-2",children:[e(s,{children:"Page Type"}),t(S,{value:i.type,onValueChange:r=>a("type",r),disabled:n,children:[e(T,{children:e(I,{placeholder:"Select page type"})}),t(L,{children:[e(c,{value:"home",children:"Home"}),e(c,{value:"inner",children:"Inner"})]})]}),e(l,{message:o.type})]}),t("div",{className:"flex items-center justify-end gap-4 pt-4",children:[e(j,{type:"button",variant:"outline",disabled:n,onClick:()=>p(!1),children:"Cancel"}),e(f,{loading:n,type:"submit",children:"Create Page"})]})]})]})]})};export{de as default};
