@daren/button
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -7,4 +7,5 @@ import * as React from 'react'; | ||
size?: 'small' | 'medium' | 'large'; | ||
disabled?: boolean; | ||
}; | ||
declare function Button({ children, size, variant, className, ...props }: ButtonProps & JSX.IntrinsicElements['button']): JSX.Element; | ||
declare function Button({ children, size, variant, className, disabled, ...props }: ButtonProps & JSX.IntrinsicElements['button']): JSX.Element; | ||
declare function LinkButton({ className, underlined, ...buttonProps }: { | ||
@@ -15,2 +16,11 @@ underlined?: boolean; | ||
declare function DeleteConfirmButton({ children, confirmString, title, message, confirmButtonLabel, cancelButtonLabel, onConfirm, ...props }: React.ComponentPropsWithRef<typeof Button> & { | ||
onConfirm: () => void; | ||
confirmString: string; | ||
message?: string; | ||
title?: string; | ||
confirmButtonLabel?: string; | ||
cancelButtonLabel?: string; | ||
}): JSX.Element; | ||
declare type LinkProps = React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement> & { | ||
@@ -25,2 +35,2 @@ disabled?: boolean; | ||
export { Button, ButtonLink, ButtonProps, Link, LinkButton, LinkProps }; | ||
export { Button, ButtonLink, ButtonProps, DeleteConfirmButton, Link, LinkButton, LinkProps }; |
@@ -1,2 +0,5 @@ | ||
"use strict";var L=Object.create;var i=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var w=(n,e)=>{for(var t in e)i(n,t,{get:e[t],enumerable:!0})},p=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of B(e))!N.call(n,o)&&o!==t&&i(n,o,{get:()=>e[o],enumerable:!(s=R(e,o))||s.enumerable});return n};var d=(n,e,t)=>(t=n!=null?L(P(n)):{},p(e||!n||!n.__esModule?i(t,"default",{value:n,enumerable:!0}):t,n)),E=n=>p(i({},"__esModule",{value:!0}),n);var M={};w(M,{Button:()=>T,ButtonLink:()=>H,Link:()=>u,LinkButton:()=>v});module.exports=E(M);var a=require("@daren/utils"),f=d(require("react"));var m=d(require("react")),b=require("react/jsx-runtime"),u=m.forwardRef(function(e,t){let{disabled:s,external:o,onClick:c,className:l,as:x="a",...h}=e;return(0,b.jsx)(x,{ref:t,className:l,tabIndex:s?-1:void 0,"aria-disabled":s,onClick:s?k=>k.preventDefault():c,...o?{target:"_blank",rel:"noopener noreferrer"}:null,...h})});var r=require("react/jsx-runtime");function g(n){return(0,a.cx)("group relative inline-flex text-base font-semibold !no-underline opacity-100 transition focus:outline-none disabled:opacity-50",n)}function y({children:n,variant:e="primary",size:t="medium"}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:(0,a.cx)("absolute inset-0 rounded-md border-2 opacity-100 transition disabled:opacity-50",{"border-daren bg-daren group-hover:brightness-110 group-focus:brightness-90":e==="primary","border-gray-400":e==="secondary","border-red-400 bg-red-400 group-hover:border-red-500 group-focus:brightness-90":e==="danger","border-green-500 bg-green-500 group-hover:bg-green-600 group-focus:brightness-90":e==="success"})}),(0,r.jsx)("div",{className:(0,a.cx)("relative flex h-full w-full items-center justify-center whitespace-nowrap",{"!text-inverse":e==="primary","!text-gray-600":e==="secondary","!text-white":e==="danger"||e==="success","h-9 space-x-3 py-2 px-4 text-sm":t==="small","h-12 space-x-3 py-4 px-6 text-sm":t==="medium","h-18 space-x-5 py-6 px-11":t==="large"}),children:n})]})}function T({children:n,size:e,variant:t,className:s,...o}){return(0,r.jsx)("button",{...o,className:g(s),children:(0,r.jsx)(y,{variant:t,size:e,children:n})})}function v({className:n,underlined:e,...t}){return(0,r.jsx)("button",{...t,className:(0,a.cx)(n,e?"underlined whitespace-nowrap focus:outline-none":"underline","inline-block text-primary")})}var H=f.forwardRef(function({children:e,className:t,variant:s="primary",size:o,...c},l){return(0,r.jsx)(u,{ref:l,className:g(t),...c,children:(0,r.jsx)(y,{variant:s,size:o,children:e})})});0&&(module.exports={Button,ButtonLink,Link,LinkButton}); | ||
"use strict";var xr=Object.create;var Pe=Object.defineProperty;var gr=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,Nr=Object.prototype.hasOwnProperty;var Er=(e,t)=>{for(var r in t)Pe(e,r,{get:t[r],enumerable:!0})},gt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of yr(t))!Nr.call(e,a)&&a!==r&&Pe(e,a,{get:()=>t[a],enumerable:!(n=gr(t,a))||n.enumerable});return e};var P=(e,t,r)=>(r=e!=null?xr(wr(e)):{},gt(t||!e||!e.__esModule?Pe(r,"default",{value:e,enumerable:!0}):r,e)),Rr=e=>gt(Pe({},"__esModule",{value:!0}),e);var lo={};Er(lo,{Button:()=>we,ButtonLink:()=>Sr,DeleteConfirmButton:()=>io,Link:()=>$e,LinkButton:()=>Or});module.exports=Rr(lo);var Cr=require("react"),wt=P(require("react"),1);function yt(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=yt(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function ye(){for(var e=0,t,r,n="";e<arguments.length;)(t=arguments[e++])&&(r=yt(t))&&(n&&(n+=" "),n+=r);return n}var Rt=P(require("react"));var Nt=P(require("react")),Et=require("react/jsx-runtime"),$e=Nt.forwardRef(function(t,r){let{disabled:n,external:a,onClick:o,className:s,as:l="a",...i}=t;return(0,Et.jsx)(l,{ref:r,className:s,tabIndex:n?-1:void 0,"aria-disabled":n,onClick:n?c=>c.preventDefault():o,...a?{target:"_blank",rel:"noopener noreferrer"}:null,...i})});var Z=require("react/jsx-runtime");function Ct(e){return ye("group relative inline-flex text-base font-semibold !no-underline opacity-100 transition focus:outline-none disabled:cursor-not-allowed",e)}function Ot({children:e,variant:t="primary",size:r="medium",disabled:n}){return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)("div",{className:ye("absolute inset-0 rounded-md border-2 opacity-100 transition",{"border-gray-200 bg-gray-200 opacity-50":n,"border-daren bg-daren group-hover:brightness-110 group-focus:brightness-90":t==="primary"&&!n,"border-gray-400":t==="secondary","border-red-200 bg-red-200 group-hover:border-red-300 group-hover:bg-red-300 group-focus:brightness-90":t==="danger"&&!n,"border-green-200 bg-green-200 group-hover:border-green-300 group-hover:bg-green-300 group-focus:brightness-90":t==="success"&&!n})}),(0,Z.jsx)("div",{className:ye("relative flex h-full w-full items-center justify-center whitespace-nowrap",{"text-gray-800":n,"!text-inverse":t==="primary"&&!n,"!text-gray-600":t==="secondary"&&!n,"!text-red-700":t==="danger"&&!n,"!text-green-700":t==="success"&&!n,"h-9 space-x-3 py-2 px-4 text-sm":r==="small","h-12 space-x-3 py-4 px-6 text-sm":r==="medium","h-18 space-x-5 py-6 px-11":r==="large"}),children:e})]})}function we({children:e,size:t,variant:r,className:n,disabled:a,...o}){return(0,Z.jsx)("button",{disabled:a,...o,className:Ct(n),children:(0,Z.jsx)(Ot,{variant:r,size:t,disabled:a,children:e})})}function Or({className:e,underlined:t,...r}){return(0,Z.jsx)("button",{...r,className:ye(e,t?"underlined whitespace-nowrap focus:outline-none":"underline","inline-block text-primary")})}var Sr=Rt.forwardRef(function({children:t,className:r,variant:n="primary",size:a,disabled:o,...s},l){return(0,Z.jsx)($e,{ref:l,className:Ct(r),...s,children:(0,Z.jsx)(Ot,{disabled:o,variant:n,size:a,children:t})})});var Tr=require("react"),vo=require("react"),ce=P(require("react"),1),de=P(require("react"),1),pe=P(require("react"),1),fe=P(require("react"),1),me=P(require("react"),1),ve=P(require("react"),1),jt=P(require("react"),1),W=require("react/jsx-runtime"),Ze=P(require("react"),1),Mt=require("react/jsx-runtime"),$=require("react/jsx-runtime"),Ur=P(require("react"),1),f=P(require("react"),1),Fe=require("react"),qe=P(require("react"),1),Ae=require("react"),Ce=require("react"),Ht=require("react"),Bt=require("react"),be=require("react"),ee=require("react"),_t=require("react"),Ut=require("react"),he=P(require("react"),1),Wt=require("react"),Se=require("react"),Qt=require("react"),X=P(require("react"),1),C=P(require("react"),1),se=require("react"),K=P(require("react"),1),k=P(require("react"),1),y=P(require("react"),1),re=P(require("react"),1),O=require("react/jsx-runtime"),ht=require("react/jsx-runtime"),V=require("react/jsx-runtime"),ke=P(require("react"),1),m=require("react/jsx-runtime"),dr=require("react/jsx-runtime");function Ft(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=Ft(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function U(){for(var e=0,t,r,n="";e<arguments.length;)(t=arguments[e++])&&(r=Ft(t))&&(n&&(n+=" "),n+=r);return n}function At(e=new Date){return new Date(Math.round(e.getTime()/9e5)*9e5)}function kr({title:e,titleId:t,...r},n){return ce.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":t},r),e?ce.createElement("title",{id:t},e):null,ce.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z",clipRule:"evenodd"}))}var Pr=ce.forwardRef(kr),Ir=Pr;function Lr({title:e,titleId:t,...r},n){return de.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":t},r),e?de.createElement("title",{id:t},e):null,de.createElement("path",{fillRule:"evenodd",d:"M19.916 4.626a.75.75 0 01.208 1.04l-9 13.5a.75.75 0 01-1.154.114l-6-6a.75.75 0 011.06-1.06l5.353 5.353 8.493-12.739a.75.75 0 011.04-.208z",clipRule:"evenodd"}))}var Fr=de.forwardRef(Lr),Dt=Fr;function Ar({title:e,titleId:t,...r},n){return pe.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":t},r),e?pe.createElement("title",{id:t},e):null,pe.createElement("path",{fillRule:"evenodd",d:"M11.47 4.72a.75.75 0 011.06 0l3.75 3.75a.75.75 0 01-1.06 1.06L12 6.31 8.78 9.53a.75.75 0 01-1.06-1.06l3.75-3.75zm-3.75 9.75a.75.75 0 011.06 0L12 17.69l3.22-3.22a.75.75 0 111.06 1.06l-3.75 3.75a.75.75 0 01-1.06 0l-3.75-3.75a.75.75 0 010-1.06z",clipRule:"evenodd"}))}var Dr=pe.forwardRef(Ar),jr=Dr;function Mr({title:e,titleId:t,...r},n){return fe.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":t},r),e?fe.createElement("title",{id:t},e):null,fe.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25zM12.75 6a.75.75 0 00-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 000-1.5h-3.75V6z",clipRule:"evenodd"}))}var Hr=fe.forwardRef(Mr),Br=Hr;function zr({title:e,titleId:t,...r},n){return me.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":t},r),e?me.createElement("title",{id:t},e):null,me.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"}))}var $r=me.forwardRef(zr),Ye=$r;function _r({title:e,titleId:t,...r},n){return ve.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",ref:n,"aria-labelledby":t},r),e?ve.createElement("title",{id:t},e):null,ve.createElement("path",{fillRule:"evenodd",d:"M12 3.75a.75.75 0 01.75.75v6.75h6.75a.75.75 0 010 1.5h-6.75v6.75a.75.75 0 01-1.5 0v-6.75H4.5a.75.75 0 010-1.5h6.75V4.5a.75.75 0 01.75-.75z",clipRule:"evenodd"}))}var bo=ve.forwardRef(_r);function Vr({className:e,variant:t="sm",bgClassName:r="text-success",textClassName:n="text-white",icon:a=Dt,...o}){return(0,W.jsxs)("label",{className:U(e,r,"flex relative justify-center items-center rounded-full focus:scale-75",{"w-6 h-6":t==="sm","w-8 h-8":t==="md","w-10 h-10":t==="lg"}),children:[(0,W.jsx)("input",{...o,className:"peer sr-only",type:"checkbox"}),(0,W.jsx)("span",{className:"inline-block w-full h-full text-current rounded-full border-2 border-primary-100 peer-checked:border-transparent dark:border-primary-300 transition-all duration-300 peer-checked:animate-check cursor-pointer focus-ring"}),(0,W.jsx)(a,{className:U(n,"absolute inset-0 p-1 w-full h-full opacity-0 transition-opacity peer-checked:animate-fade-in-up pointer-events-none")})]})}var ho=jt.forwardRef(function({error:e,name:t,label:r,id:n,className:a,defaultValue:o,...s},l){let i=n??t,u=`${i}-error`;return(0,W.jsxs)("div",{className:U(a,"group w-full"),children:[(0,W.jsxs)("div",{className:"flex relative items-start",children:[(0,W.jsx)("div",{className:"flex items-center h-5",children:(0,W.jsx)(Vr,{ref:l,id:i,name:t,...s})}),(0,W.jsx)("div",{className:"ml-3 text-base",children:(0,W.jsx)("label",{htmlFor:i,className:"text-primary",children:r})})]}),e&&(0,W.jsx)("p",{className:"mt-2 text-sm text-red-600",id:u,children:e})]})});function Qe({className:e,htmlFor:t,...r}){return(0,Mt.jsx)("label",{htmlFor:t,className:U("block text-sm font-medium text-secondary",e),...r})}function et(e,t,r="md"){return U(e,"w-full group font-bold placeholder:text-gray-500 disabled:text-gray-400 rounded-lg text-md focus-ring",{"bg-primary-600 text-primary-500":!t,"!text-red-500 bg-primary-700":t,"py-1 px-2 text-sm":r==="sm","py-3 px-4 text-base":r==="md","py-5 px-8 text-lg":r==="lg"})}var tt=Ze.forwardRef(function(e,t){let{type:r,hasError:n,inputSize:a,icon:o,...s}=e,l=et(e.className,n,a);return r==="textarea"?(0,$.jsxs)("div",{className:"relative w-full flex-items-center",children:[o&&(0,$.jsx)(o,{width:"20px",height:"20px",className:U("flex absolute top-0 left-5 z-10 justify-center items-center p-0 h-full",{"text-red-500":n})}),(0,$.jsx)("textarea",{...s,"aria-invalid":n,className:U("h-36",l,{"pl-14":!!o})})]}):(0,$.jsxs)("div",{className:"relative w-full shadow-sm",children:[(0,$.jsx)("input",{type:r,...s,className:U(l,{"pr-14":!!o}),ref:t}),o&&!n&&(0,$.jsx)(o,{width:"20px",height:"20px",className:U("flex absolute top-0 right-5 z-10 justify-center items-center p-0 h-full",{"text-gray-300":!n,"text-red-500":n})}),n&&(0,$.jsx)("div",{className:"flex absolute top-0 right-5 z-10 justify-center items-center p-0 h-full",children:(0,$.jsx)(Ye,{className:"w-5 h-5 text-red-500","aria-hidden":"true"})})]})});var xo=Ze.forwardRef(function({defaultValue:e,error:t,name:r,label:n,className:a,description:o,id:s,...l},i){let u=s??r,c=`${u}-error`,d=`${u}-description`;return(0,$.jsxs)("div",{className:"w-full",children:[n&&(0,$.jsxs)("div",{className:"flex justify-between",children:[(0,$.jsx)(Qe,{htmlFor:u,className:"mb-2",children:n}),o&&(0,$.jsx)("span",{className:"text-sm text-slate-400",id:d,children:o})]}),(0,$.jsx)(tt,{hasError:!!t,...l,ref:i,name:r,id:u,autoComplete:r,required:!0,defaultValue:e,"aria-describedby":t?c:o?d:void 0}),t&&(0,$.jsx)("p",{className:"mt-2 text-sm text-red-600",id:c,children:t})]})});function ue(){let e=[],t=[],r={enqueue(n){t.push(n)},addEventListener(n,a,o,s){return n.addEventListener(a,o,s),r.add(()=>n.removeEventListener(a,o,s))},requestAnimationFrame(...n){let a=requestAnimationFrame(...n);return r.add(()=>cancelAnimationFrame(a))},nextFrame(...n){return r.requestAnimationFrame(()=>r.requestAnimationFrame(...n))},setTimeout(...n){let a=setTimeout(...n);return r.add(()=>clearTimeout(a))},add(n){return e.push(n),()=>{let a=e.indexOf(n);if(a>=0){let[o]=e.splice(a,1);o()}}},dispose(){for(let n of e.splice(0))n()},async workQueue(){for(let n of t.splice(0))await n()}};return r}function rt(){let[e]=(0,Fe.useState)(ue);return(0,Fe.useEffect)(()=>()=>e.dispose(),[e]),e}var S=typeof window<"u"?Ae.useLayoutEffect:Ae.useEffect,_e={serverHandoffComplete:!1};function nt(){let[e,t]=(0,Ce.useState)(_e.serverHandoffComplete);return(0,Ce.useEffect)(()=>{e!==!0&&t(!0)},[e]),(0,Ce.useEffect)(()=>{_e.serverHandoffComplete===!1&&(_e.serverHandoffComplete=!0)},[]),e}var St,Gr=0;function Tt(){return++Gr}var te=(St=qe.default.useId)!=null?St:function(){let e=nt(),[t,r]=qe.default.useState(e?Tt:null);return S(()=>{t===null&&r(Tt())},[t]),t!=null?""+t:void 0};function q(e){let t=(0,Bt.useRef)(e);return S(()=>{t.current=e},[e]),t}function ot(e,t){let[r,n]=(0,Ht.useState)(e),a=q(e);return S(()=>n(a.current),[a,n,...t]),r}var Wr=Symbol();function Q(...e){let t=(0,be.useRef)(e);(0,be.useEffect)(()=>{t.current=e},[e]);let r=(0,be.useCallback)(n=>{for(let a of t.current)a!=null&&(typeof a=="function"?a(n):a.current=n)},[t]);return e.every(n=>n==null||(n==null?void 0:n[Wr]))?void 0:r}function M(e,t,...r){if(e in t){let a=t[e];return typeof a=="function"?a(...r):a}let n=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(a=>`"${a}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,M),n}var Le=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Le||{}),oe=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(oe||{});function _({ourProps:e,theirProps:t,slot:r,defaultTag:n,features:a,visible:o=!0,name:s}){let l=zt(t,e);if(o)return Ie(l,r,n,s);let i=a??0;if(i&2){let{static:u=!1,...c}=l;if(u)return Ie(c,r,n,s)}if(i&1){let{unmount:u=!0,...c}=l;return M(u?0:1,{[0](){return null},[1](){return Ie({...c,hidden:!0,style:{display:"none"}},r,n,s)}})}return Ie(l,r,n,s)}function Ie(e,t={},r,n){let{as:a=r,children:o,refName:s="ref",...l}=Ve(e,["unmount","static"]),i=e.ref!==void 0?{[s]:e.ref}:{},u=typeof o=="function"?o(t):o;if(l.className&&typeof l.className=="function"&&(l.className=l.className(t)),a===ee.Fragment&&Object.keys(Oe(l)).length>0){if(!(0,ee.isValidElement)(u)||Array.isArray(u)&&u.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${n} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(c=>` - ${c}`).join(` | ||
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(c=>` - ${c}`).join(` | ||
`)].join(` | ||
`));return(0,ee.cloneElement)(u,Object.assign({},zt(u.props,Oe(Ve(l,["ref"]))),i))}return(0,ee.createElement)(a,Object.assign({},Ve(l,["ref"]),a!==ee.Fragment&&i),u)}function zt(...e){var t;if(e.length===0)return{};if(e.length===1)return e[0];let r={},n={};for(let a of e)for(let o in a)o.startsWith("on")&&typeof a[o]=="function"?((t=n[o])!=null||(n[o]=[]),n[o].push(a[o])):r[o]=a[o];if(r.disabled||r["aria-disabled"])return Object.assign(r,Object.fromEntries(Object.keys(n).map(a=>[a,void 0])));for(let a in n)Object.assign(r,{[a](o){let s=n[a];for(let l of s){if(o.defaultPrevented)return;l(o)}}});return r}function G(e){var t;return Object.assign((0,ee.forwardRef)(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Oe(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function Ve(e,t=[]){let r=Object.assign({},e);for(let n of t)n in r&&delete r[n];return r}var F=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(F||{});function qr(e){throw new Error("Unexpected object: "+e)}var B=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(B||{});function Xr(e,t){let r=t.resolveItems();if(r.length<=0)return null;let n=t.resolveActiveIndex(),a=n??-1,o=(()=>{switch(e.focus){case 0:return r.findIndex(s=>!t.resolveDisabled(s));case 1:{let s=r.slice().reverse().findIndex((l,i,u)=>a!==-1&&u.length-i-1>=a?!1:!t.resolveDisabled(l));return s===-1?s:r.length-1-s}case 2:return r.findIndex((s,l)=>l<=a?!1:!t.resolveDisabled(s));case 3:{let s=r.slice().reverse().findIndex(l=>!t.resolveDisabled(l));return s===-1?s:r.length-1-s}case 4:return r.findIndex(s=>t.resolveId(s)===e.id);case 5:return null;default:qr(e)}})();return o===-1?n:o}function $t(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let n=(t==null?void 0:t.getAttribute("disabled"))==="";return n&&Kr(r)?!1:n}function Kr(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function Vt(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function kt(e,t,r){let n=q(t);(0,Ut.useEffect)(()=>{function a(o){n.current(o)}return window.addEventListener(e,a,r),()=>window.removeEventListener(e,a,r)},[e,r])}var Jr=(e=>(e[e.None=1]="None",e[e.IgnoreScrollbars=2]="IgnoreScrollbars",e))(Jr||{});function Yr(e,t,r=1){let n=(0,_t.useRef)(!1),a=q(o=>{if(n.current)return;n.current=!0,Vt(()=>{n.current=!1});let s=function i(u){return typeof u=="function"?i(u()):Array.isArray(u)||u instanceof Set?u:[u]}(e),l=o.target;if(l.ownerDocument.documentElement.contains(l)){if((r&2)===2){let i=20,u=l.ownerDocument.documentElement;if(o.clientX>u.clientWidth-i||o.clientX<i||o.clientY>u.clientHeight-i||o.clientY<i)return}for(let i of s){if(i===null)continue;let u=i instanceof HTMLElement?i:i.current;if(u!=null&&u.contains(l))return}return t(o,l)}});kt("pointerdown",(...o)=>a.current(...o)),kt("mousedown",(...o)=>a.current(...o))}var at=(0,he.createContext)(null);at.displayName="OpenClosedContext";var ie=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ie||{});function it(){return(0,he.useContext)(at)}function Gt({value:e,children:t}){return he.default.createElement(at.Provider,{value:e},t)}function Pt(e){var t;if(e.type)return e.type;let r=(t=e.as)!=null?t:"button";if(typeof r=="string"&&r.toLowerCase()==="button")return"button"}function qt(e,t){let[r,n]=(0,Wt.useState)(()=>Pt(e));return S(()=>{n(Pt(e))},[e.type,e.as]),S(()=>{r||!t.current||t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&n("button")},[r,t]),r}function Xt(e){return typeof window>"u"?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}function Kt({container:e,accept:t,walk:r,enabled:n=!0}){let a=(0,Se.useRef)(t),o=(0,Se.useRef)(r);(0,Se.useEffect)(()=>{a.current=t,o.current=r},[t,r]),S(()=>{if(!e||!n)return;let s=Xt(e);if(!s)return;let l=a.current,i=o.current,u=Object.assign(d=>l(d),{acceptNode:l}),c=s.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;c.nextNode();)i(c.currentNode)},[e,n,a,o])}var Zr=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),Ee=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(Ee||{}),Xe=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Xe||{}),Qr=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Qr||{});function en(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Zr))}var tn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(tn||{}),rn=["textarea","input"].join(",");function nn(e){var t,r;return(r=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,rn))!=null?r:!1}function lt(e,t=r=>r){return e.slice().sort((r,n)=>{let a=t(r),o=t(n);if(a===null||o===null)return 0;let s=a.compareDocumentPosition(o);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function It(e,t){let r=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,n=Array.isArray(e)?lt(e):en(e),a=r.activeElement,o=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),s=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,n.indexOf(a))-1;if(t&4)return Math.max(0,n.indexOf(a))+1;if(t&8)return n.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},i=0,u=n.length,c;do{if(i>=u||i+u<=0)return 0;let d=s+i;if(t&16)d=(d+u)%u;else{if(d<0)return 3;if(d>=u)return 1}c=n[d],c==null||c.focus(l),i+=o}while(c!==r.activeElement);return t&6&&nn(c)&&c.select(),c.hasAttribute("tabindex")||c.setAttribute("tabindex","0"),2}var on="div",st=G(function(e,t){return _({ourProps:{ref:t,style:{position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",display:"none"}},theirProps:e,slot:{},defaultTag:on,name:"VisuallyHidden"})});function ut(e={},t=null,r=[]){for(let[n,a]of Object.entries(e))Yt(r,Jt(t,n),a);return r}function Jt(e,t){return e?e+"["+t+"]":t}function Yt(e,t,r){if(Array.isArray(r))for(let[n,a]of r.entries())Yt(e,Jt(t,n.toString()),a);else r instanceof Date?e.push([t,r.toISOString()]):typeof r=="boolean"?e.push([t,r?"1":"0"]):typeof r=="string"?e.push([t,r]):typeof r=="number"?e.push([t,`${r}`]):r==null?e.push([t,""]):ut(r,t,e)}function Zt(e){var t;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let n of r.elements)if(n.tagName==="INPUT"&&n.type==="submit"||n.tagName==="BUTTON"&&n.type==="submit"||n.nodeName==="INPUT"&&n.type==="image"){n.click();return}}}var an=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(an||{}),ln=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(ln||{}),sn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(sn||{}),un=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.SetDisabled=2]="SetDisabled",e[e.GoToOption=3]="GoToOption",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e))(un||{});function Ue(e,t=r=>r){let r=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,n=lt(t(e.options.slice()),o=>o.dataRef.current.domRef.current),a=r?n.indexOf(r):null;return a===-1&&(a=null),{options:n,activeOptionIndex:a}}var cn={[1](e){return e.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},[0](e){if(e.disabled||e.comboboxState===0)return e;let t=e.activeOptionIndex,{value:r,mode:n}=e.comboboxPropsRef.current,a=e.options.findIndex(o=>{let s=o.dataRef.current.value;return M(n,{[1]:()=>r.includes(s),[0]:()=>r===s})});return a!==-1&&(t=a),{...e,comboboxState:0,activeOptionIndex:t}},[2](e,t){return e.disabled===t.disabled?e:{...e,disabled:t.disabled}},[3](e,t){var r;if(e.disabled||e.optionsRef.current&&!e.optionsPropsRef.current.static&&e.comboboxState===1)return e;let n=Ue(e);if(n.activeOptionIndex===null){let o=n.options.findIndex(s=>!s.dataRef.current.disabled);o!==-1&&(n.activeOptionIndex=o)}let a=Xr(t,{resolveItems:()=>n.options,resolveActiveIndex:()=>n.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return{...e,...n,activeOptionIndex:a,activationTrigger:(r=t.trigger)!=null?r:1}},[4]:(e,t)=>{let r={id:t.id,dataRef:t.dataRef},n=Ue(e,o=>[...o,r]);if(e.activeOptionIndex===null){let{value:o,mode:s}=e.comboboxPropsRef.current,l=t.dataRef.current.value;M(s,{[1]:()=>o.includes(l),[0]:()=>o===l})&&(n.activeOptionIndex=n.options.indexOf(r))}let a={...e,...n,activationTrigger:1};return e.comboboxPropsRef.current.__demoMode&&e.comboboxPropsRef.current.value===void 0&&(a.activeOptionIndex=0),a},[5]:(e,t)=>{let r=Ue(e,n=>{let a=n.findIndex(o=>o.id===t.id);return a!==-1&&n.splice(a,1),n});return{...e,...r,activationTrigger:1}}},ct=(0,f.createContext)(null);ct.displayName="ComboboxContext";function xe(e){let t=(0,f.useContext)(ct);if(t===null){let r=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,xe),r}return t}var dt=(0,f.createContext)(null);dt.displayName="ComboboxActions";function De(){let e=(0,f.useContext)(dt);if(e===null){let t=new Error("ComboboxActions is missing a parent <Combobox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,De),t}return e}var pt=(0,f.createContext)(null);pt.displayName="ComboboxData";function Te(){let e=(0,f.useContext)(pt);if(e===null){let t=new Error("ComboboxData is missing a parent <Combobox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Te),t}return e}function dn(e,t){return M(t.type,cn,e,t)}var pn=f.Fragment,fn=G(function(e,t){let{name:r,value:n,onChange:a,disabled:o=!1,__demoMode:s=!1,nullable:l=!1,multiple:i=!1,...u}=e,c=(0,f.useRef)(!1),d=(0,f.useRef)({value:n,mode:i?1:0,onChange:a,nullable:l,__demoMode:s});d.current.value=n,d.current.mode=i?1:0,d.current.nullable=l;let x=(0,f.useRef)({static:!1,hold:!1}),w=(0,f.useRef)({displayValue:void 0}),N=(0,f.useReducer)(dn,{comboboxState:s?0:1,comboboxPropsRef:d,optionsPropsRef:x,inputPropsRef:w,labelRef:(0,f.createRef)(),inputRef:(0,f.createRef)(),buttonRef:(0,f.createRef)(),optionsRef:(0,f.createRef)(),disabled:o,options:[],activeOptionIndex:null,activationTrigger:1}),[{comboboxState:p,options:v,activeOptionIndex:E,optionsRef:A,inputRef:g,buttonRef:H},b]=N,R=(0,f.useMemo)(()=>({value:n,mode:i?1:0,get activeOptionIndex(){if(c.current&&E===null&&v.length>0){let T=v.findIndex(D=>!D.dataRef.current.disabled);if(T!==-1)return T}return E}}),[n,E,v]),h=R.activeOptionIndex;S(()=>{d.current.onChange=T=>M(R.mode,{[0](){return a(T)},[1](){let D=R.value.slice(),ne=D.indexOf(T);return ne===-1?D.push(T):D.splice(ne,1),a(D)}})},[R,a,d,R]),S(()=>b({type:2,disabled:o}),[o]),Yr([H,g,A],()=>{p===0&&b({type:1})});let z=h===null?null:v[h].dataRef.current.value,I=(0,f.useMemo)(()=>({open:p===0,disabled:o,activeIndex:h,activeOption:z}),[p,o,v,h]),j=(0,f.useCallback)(()=>{var T;if(!g.current)return;let D=w.current.displayValue;typeof D=="function"?g.current.value=(T=D(n))!=null?T:"":typeof n=="string"?g.current.value=n:g.current.value=""},[n,g,w]),L=(0,f.useCallback)(T=>{let D=v.find(ze=>ze.id===T);if(!D)return;let{dataRef:ne}=D;d.current.onChange(ne.current.value),j()},[v,d,g]),Y=(0,f.useCallback)(()=>{if(h!==null){let{dataRef:T,id:D}=v[h];d.current.onChange(T.current.value),j(),b({type:3,focus:B.Specific,id:D})}},[h,v,d,g]),ge=(0,f.useMemo)(()=>({selectOption:L,selectActiveOption:Y,openCombobox(){b({type:0}),c.current=!0},closeCombobox(){b({type:1}),c.current=!1},goToOption(T,D,ne){return c.current=!1,T===B.Specific?b({type:3,focus:B.Specific,id:D,trigger:ne}):b({type:3,focus:T,trigger:ne})},registerOption(T,D){return b({type:4,id:T,dataRef:D}),()=>b({type:5,id:T})}}),[L,Y,b]);S(()=>{p===1&&j()},[j,p]),S(j,[j]);let ae=t===null?{}:{ref:t};return f.default.createElement(dt.Provider,{value:ge},f.default.createElement(pt.Provider,{value:R},f.default.createElement(ct.Provider,{value:N},f.default.createElement(Gt,{value:M(p,{[0]:ie.Open,[1]:ie.Closed})},r!=null&&n!=null&&ut({[r]:n}).map(([T,D])=>f.default.createElement(st,{...Oe({key:T,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:T,value:D})})),_({ourProps:ae,theirProps:u,slot:I,defaultTag:pn,name:"Combobox"})))))}),mn="input",vn=G(function(e,t){var r,n;let{value:a,onChange:o,displayValue:s,...l}=e,[i]=xe("Combobox.Input"),u=Te(),c=De(),d=Q(i.inputRef,t),x=i.inputPropsRef,w=`headlessui-combobox-input-${te()}`,N=rt(),p=q(o);S(()=>{x.current.displayValue=s},[s,x]);let v=(0,f.useCallback)(b=>{switch(b.key){case F.Backspace:case F.Delete:if(u.mode!==0||!i.comboboxPropsRef.current.nullable)return;let R=b.currentTarget;N.requestAnimationFrame(()=>{R.value===""&&(i.comboboxPropsRef.current.onChange(null),i.optionsRef.current&&(i.optionsRef.current.scrollTop=0),c.goToOption(B.Nothing))});break;case F.Enter:if(i.comboboxState!==0)return;if(b.preventDefault(),b.stopPropagation(),u.activeOptionIndex===null){c.closeCombobox();return}c.selectActiveOption(),u.mode===0&&c.closeCombobox();break;case F.ArrowDown:return b.preventDefault(),b.stopPropagation(),M(i.comboboxState,{[0]:()=>{c.goToOption(B.Next)},[1]:()=>{c.openCombobox(),N.nextFrame(()=>{u.value||c.goToOption(B.Next)})}});case F.ArrowUp:return b.preventDefault(),b.stopPropagation(),M(i.comboboxState,{[0]:()=>{c.goToOption(B.Previous)},[1]:()=>{c.openCombobox(),N.nextFrame(()=>{u.value||c.goToOption(B.Last)})}});case F.Home:case F.PageUp:return b.preventDefault(),b.stopPropagation(),c.goToOption(B.First);case F.End:case F.PageDown:return b.preventDefault(),b.stopPropagation(),c.goToOption(B.Last);case F.Escape:return b.preventDefault(),i.optionsRef.current&&!i.optionsPropsRef.current.static&&b.stopPropagation(),c.closeCombobox();case F.Tab:c.selectActiveOption(),c.closeCombobox();break}},[N,i,c,u]),E=(0,f.useCallback)(b=>{var R;c.openCombobox(),(R=p.current)==null||R.call(p,b)},[c,p]),A=ot(()=>{if(i.labelRef.current)return[i.labelRef.current.id].join(" ")},[i.labelRef.current]),g=(0,f.useMemo)(()=>({open:i.comboboxState===0,disabled:i.disabled}),[i]),H={ref:d,id:w,role:"combobox",type:"text","aria-controls":(r=i.optionsRef.current)==null?void 0:r.id,"aria-expanded":i.disabled?void 0:i.comboboxState===0,"aria-activedescendant":u.activeOptionIndex===null||(n=i.options[u.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":u.mode===1?!0:void 0,"aria-labelledby":A,disabled:i.disabled,onKeyDown:v,onChange:E};return _({ourProps:H,theirProps:l,slot:g,defaultTag:mn,name:"Combobox.Input"})}),bn="button",hn=G(function(e,t){var r;let[n]=xe("Combobox.Button"),a=Te(),o=De(),s=Q(n.buttonRef,t),l=`headlessui-combobox-button-${te()}`,i=rt(),u=(0,f.useCallback)(p=>{switch(p.key){case F.ArrowDown:return p.preventDefault(),p.stopPropagation(),n.comboboxState===1&&(o.openCombobox(),i.nextFrame(()=>{a.value||o.goToOption(B.First)})),i.nextFrame(()=>{var v;return(v=n.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case F.ArrowUp:return p.preventDefault(),p.stopPropagation(),n.comboboxState===1&&(o.openCombobox(),i.nextFrame(()=>{a.value||o.goToOption(B.Last)})),i.nextFrame(()=>{var v;return(v=n.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case F.Escape:return p.preventDefault(),n.optionsRef.current&&!n.optionsPropsRef.current.static&&p.stopPropagation(),o.closeCombobox(),i.nextFrame(()=>{var v;return(v=n.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});default:return}},[i,n,o,a]),c=(0,f.useCallback)(p=>{if($t(p.currentTarget))return p.preventDefault();n.comboboxState===0?o.closeCombobox():(p.preventDefault(),o.openCombobox()),i.nextFrame(()=>{var v;return(v=n.inputRef.current)==null?void 0:v.focus({preventScroll:!0})})},[o,i,n]),d=ot(()=>{if(n.labelRef.current)return[n.labelRef.current.id,l].join(" ")},[n.labelRef.current,l]),x=(0,f.useMemo)(()=>({open:n.comboboxState===0,disabled:n.disabled}),[n]),w=e,N={ref:s,id:l,type:qt(e,n.buttonRef),tabIndex:-1,"aria-haspopup":!0,"aria-controls":(r=n.optionsRef.current)==null?void 0:r.id,"aria-expanded":n.disabled?void 0:n.comboboxState===0,"aria-labelledby":d,disabled:n.disabled,onClick:c,onKeyDown:u};return _({ourProps:N,theirProps:w,slot:x,defaultTag:bn,name:"Combobox.Button"})}),xn="label",gn=G(function(e,t){let[r]=xe("Combobox.Label"),n=`headlessui-combobox-label-${te()}`,a=Q(r.labelRef,t),o=(0,f.useCallback)(()=>{var l;return(l=r.inputRef.current)==null?void 0:l.focus({preventScroll:!0})},[r.inputRef]),s=(0,f.useMemo)(()=>({open:r.comboboxState===0,disabled:r.disabled}),[r]);return _({ourProps:{ref:a,id:n,onClick:o},theirProps:e,slot:s,defaultTag:xn,name:"Combobox.Label"})}),yn="ul",wn=Le.RenderStrategy|Le.Static,Nn=G(function(e,t){var r;let{hold:n=!1,...a}=e,[o]=xe("Combobox.Options"),s=Te(),{optionsPropsRef:l}=o,i=Q(o.optionsRef,t),u=`headlessui-combobox-options-${te()}`,c=it(),d=(()=>c!==null?c===ie.Open:o.comboboxState===0)();S(()=>{var p;l.current.static=(p=e.static)!=null?p:!1},[l,e.static]),S(()=>{l.current.hold=n},[n,l]),Kt({container:o.optionsRef.current,enabled:o.comboboxState===0,accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none")}});let x=ot(()=>{var p,v,E;return(E=(p=o.labelRef.current)==null?void 0:p.id)!=null?E:(v=o.buttonRef.current)==null?void 0:v.id},[o.labelRef.current,o.buttonRef.current]),w=(0,f.useMemo)(()=>({open:o.comboboxState===0}),[o]),N={"aria-activedescendant":s.activeOptionIndex===null||(r=o.options[s.activeOptionIndex])==null?void 0:r.id,"aria-labelledby":x,role:"listbox",id:u,ref:i};return _({ourProps:N,theirProps:a,slot:w,defaultTag:yn,features:wn,visible:d,name:"Combobox.Options"})}),En="li",Rn=G(function(e,t){let{disabled:r=!1,value:n,...a}=e,[o]=xe("Combobox.Option"),s=Te(),l=De(),i=`headlessui-combobox-option-${te()}`,u=s.activeOptionIndex!==null?o.options[s.activeOptionIndex].id===i:!1,c=M(s.mode,{[1]:()=>s.value.includes(n),[0]:()=>s.value===n}),d=(0,f.useRef)(null),x=(0,f.useRef)({disabled:r,value:n,domRef:d}),w=Q(t,d);S(()=>{x.current.disabled=r},[x,r]),S(()=>{x.current.value=n},[x,n]),S(()=>{var b,R;x.current.textValue=(R=(b=d.current)==null?void 0:b.textContent)==null?void 0:R.toLowerCase()},[x,d]);let N=(0,f.useCallback)(()=>l.selectOption(i),[l,i]);S(()=>l.registerOption(i,x),[x,i]);let p=(0,f.useRef)(!o.comboboxPropsRef.current.__demoMode);S(()=>{if(!o.comboboxPropsRef.current.__demoMode)return;let b=ue();return b.requestAnimationFrame(()=>{p.current=!0}),b.dispose},[]),S(()=>{if(o.comboboxState!==0||!u||!p.current||o.activationTrigger===0)return;let b=ue();return b.requestAnimationFrame(()=>{var R,h;(h=(R=d.current)==null?void 0:R.scrollIntoView)==null||h.call(R,{block:"nearest"})}),b.dispose},[d,u,o.comboboxState,o.activationTrigger,s.activeOptionIndex]);let v=(0,f.useCallback)(b=>{if(r)return b.preventDefault();N(),s.mode===0&&(l.closeCombobox(),ue().nextFrame(()=>{var R;return(R=o.inputRef.current)==null?void 0:R.focus({preventScroll:!0})}))},[l,o.inputRef,r,N]),E=(0,f.useCallback)(()=>{if(r)return l.goToOption(B.Nothing);l.goToOption(B.Specific,i)},[r,i,l]),A=(0,f.useCallback)(()=>{r||u||l.goToOption(B.Specific,i,0)},[r,u,i,l]),g=(0,f.useCallback)(()=>{r||!u||o.optionsPropsRef.current.hold||l.goToOption(B.Nothing)},[r,u,l,o.comboboxState,o.comboboxPropsRef]),H=(0,f.useMemo)(()=>({active:u,selected:c,disabled:r}),[u,c,r]);return _({ourProps:{id:i,ref:w,role:"option",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-selected":c===!0?!0:void 0,disabled:void 0,onClick:v,onFocus:E,onPointerMove:A,onMouseMove:A,onPointerLeave:g,onMouseLeave:g},theirProps:a,slot:H,defaultTag:En,name:"Combobox.Option"})}),Ne=Object.assign(fn,{Input:vn,Button:hn,Label:gn,Options:Nn,Option:Rn});function er(){let e=(0,Qt.useRef)(!1);return S(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var tr=(0,X.createContext)(null);function rr(){let e=(0,X.useContext)(tr);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,rr),t}return e}function ft(){let[e,t]=(0,X.useState)([]);return[e.length>0?e.join(" "):void 0,(0,X.useMemo)(()=>function(r){let n=(0,X.useCallback)(o=>(t(s=>[...s,o]),()=>t(s=>{let l=s.slice(),i=l.indexOf(o);return i!==-1&&l.splice(i,1),l})),[]),a=(0,X.useMemo)(()=>({register:n,slot:r.slot,name:r.name,props:r.props}),[n,r.slot,r.name,r.props]);return X.default.createElement(tr.Provider,{value:a},r.children)},[t])]}var Cn="p",nr=G(function(e,t){let r=rr(),n=`headlessui-description-${te()}`,a=Q(t);S(()=>r.register(n),[n,r.register]);let o=e,s={ref:a,...r.props,id:n};return _({ourProps:s,theirProps:o,slot:r.slot||{},defaultTag:Cn,name:r.name||"Description"})});function On(e=0){let[t,r]=(0,se.useState)(e),n=(0,se.useCallback)(l=>r(i=>i|l),[r]),a=(0,se.useCallback)(l=>Boolean(t&l),[t]),o=(0,se.useCallback)(l=>r(i=>i&~l),[r]),s=(0,se.useCallback)(l=>r(i=>i^l),[r]);return{addFlag:n,hasFlag:a,removeFlag:o,toggleFlag:s}}var or=(0,K.createContext)(null);function ar(){let e=(0,K.useContext)(or);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,ar),t}return e}function mt(){let[e,t]=(0,K.useState)([]);return[e.length>0?e.join(" "):void 0,(0,K.useMemo)(()=>function(r){let n=(0,K.useCallback)(o=>(t(s=>[...s,o]),()=>t(s=>{let l=s.slice(),i=l.indexOf(o);return i!==-1&&l.splice(i,1),l})),[]),a=(0,K.useMemo)(()=>({register:n,slot:r.slot,name:r.name,props:r.props}),[n,r.slot,r.name,r.props]);return K.default.createElement(or.Provider,{value:a},r.children)},[t])]}var Sn="label",ir=G(function(e,t){let{passive:r=!1,...n}=e,a=ar(),o=`headlessui-label-${te()}`,s=Q(t);S(()=>a.register(o),[o,a.register]);let l={ref:s,...a.props,id:o};return r&&("onClick"in l&&delete l.onClick,"onClick"in n&&delete n.onClick),_({ourProps:l,theirProps:n,slot:a.slot||{},defaultTag:Sn,name:a.name||"Label"})}),Tn=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(Tn||{}),kn={[0](e,t){let r=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:lt(r,n=>n.element.current)}},[1](e,t){let r=e.options.slice(),n=e.options.findIndex(a=>a.id===t.id);return n===-1?e:(r.splice(n,1),{...e,options:r})}},vt=(0,C.createContext)(null);vt.displayName="RadioGroupContext";function lr(e){let t=(0,C.useContext)(vt);if(t===null){let r=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,lr),r}return t}function Pn(e,t){return M(t.type,kn,e,t)}var In="div",Ln=G(function(e,t){let{value:r,name:n,onChange:a,disabled:o=!1,...s}=e,[{options:l},i]=(0,C.useReducer)(Pn,{options:[]}),[u,c]=mt(),[d,x]=ft(),w=`headlessui-radiogroup-${te()}`,N=(0,C.useRef)(null),p=Q(N,t),v=(0,C.useMemo)(()=>l.find(h=>!h.propsRef.current.disabled),[l]),E=(0,C.useMemo)(()=>l.some(h=>h.propsRef.current.value===r),[l,r]),A=(0,C.useCallback)(h=>{var z;if(o||h===r)return!1;let I=(z=l.find(j=>j.propsRef.current.value===h))==null?void 0:z.propsRef.current;return I!=null&&I.disabled?!1:(a(h),!0)},[a,r,o,l]);Kt({container:N.current,accept(h){return h.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:h.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(h){h.setAttribute("role","none")}});let g=(0,C.useCallback)(h=>{let z=N.current;if(!z)return;let I=Xt(z),j=l.filter(L=>L.propsRef.current.disabled===!1).map(L=>L.element.current);switch(h.key){case F.Enter:Zt(h.currentTarget);break;case F.ArrowLeft:case F.ArrowUp:if(h.preventDefault(),h.stopPropagation(),It(j,Ee.Previous|Ee.WrapAround)===Xe.Success){let L=l.find(Y=>Y.element.current===(I==null?void 0:I.activeElement));L&&A(L.propsRef.current.value)}break;case F.ArrowRight:case F.ArrowDown:if(h.preventDefault(),h.stopPropagation(),It(j,Ee.Next|Ee.WrapAround)===Xe.Success){let L=l.find(Y=>Y.element.current===(I==null?void 0:I.activeElement));L&&A(L.propsRef.current.value)}break;case F.Space:{h.preventDefault(),h.stopPropagation();let L=l.find(Y=>Y.element.current===(I==null?void 0:I.activeElement));L&&A(L.propsRef.current.value)}break}},[N,l,A]),H=(0,C.useCallback)(h=>(i({type:0,...h}),()=>i({type:1,id:h.id})),[i]),b=(0,C.useMemo)(()=>({registerOption:H,firstOption:v,containsCheckedOption:E,change:A,disabled:o,value:r}),[H,v,E,A,o,r]),R={ref:p,id:w,role:"radiogroup","aria-labelledby":u,"aria-describedby":d,onKeyDown:g};return C.default.createElement(x,{name:"RadioGroup.Description"},C.default.createElement(c,{name:"RadioGroup.Label"},C.default.createElement(vt.Provider,{value:b},n!=null&&r!=null&&ut({[n]:r}).map(([h,z])=>C.default.createElement(st,{...Oe({key:h,as:"input",type:"radio",checked:z!=null,hidden:!0,readOnly:!0,name:h,value:z})})),_({ourProps:R,theirProps:s,defaultTag:In,name:"RadioGroup"}))))}),Fn=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(Fn||{}),An="div",Dn=G(function(e,t){let r=(0,C.useRef)(null),n=Q(r,t),a=`headlessui-radiogroup-option-${te()}`,[o,s]=mt(),[l,i]=ft(),{addFlag:u,removeFlag:c,hasFlag:d}=On(1),{value:x,disabled:w=!1,...N}=e,p=(0,C.useRef)({value:x,disabled:w});S(()=>{p.current.value=x},[x,p]),S(()=>{p.current.disabled=w},[w,p]);let{registerOption:v,disabled:E,change:A,firstOption:g,containsCheckedOption:H,value:b}=lr("RadioGroup.Option");S(()=>v({id:a,element:r,propsRef:p}),[a,v,r,e]);let R=(0,C.useCallback)(()=>{var ae;!A(x)||(u(2),(ae=r.current)==null||ae.focus())},[u,A,x]),h=(0,C.useCallback)(()=>u(2),[u]),z=(0,C.useCallback)(()=>c(2),[c]),I=(g==null?void 0:g.id)===a,j=E||w,L=b===x,Y={ref:n,id:a,role:"radio","aria-checked":L?"true":"false","aria-labelledby":o,"aria-describedby":l,"aria-disabled":j?!0:void 0,tabIndex:(()=>j?-1:L||!H&&I?0:-1)(),onClick:j?void 0:R,onFocus:j?void 0:h,onBlur:j?void 0:z},ge=(0,C.useMemo)(()=>({checked:L,disabled:j,active:d(2)}),[L,j,d]);return C.default.createElement(i,{name:"RadioGroup.Description"},C.default.createElement(s,{name:"RadioGroup.Label"},_({ourProps:Y,theirProps:N,slot:ge,defaultTag:An,name:"RadioGroup.Option"})))}),Re=Object.assign(Ln,{Option:Dn,Label:ir,Description:nr}),bt=(0,k.createContext)(null);bt.displayName="GroupContext";var jn=k.Fragment;function Mn(e){let[t,r]=(0,k.useState)(null),[n,a]=mt(),[o,s]=ft(),l=(0,k.useMemo)(()=>({switch:t,setSwitch:r,labelledby:n,describedby:o}),[t,r,n,o]),i={},u=e;return k.default.createElement(s,{name:"Switch.Description"},k.default.createElement(a,{name:"Switch.Label",props:{onClick(){!t||(t.click(),t.focus({preventScroll:!0}))}}},k.default.createElement(bt.Provider,{value:l},_({ourProps:i,theirProps:u,defaultTag:jn,name:"Switch.Group"}))))}var Hn="button",Bn=G(function(e,t){let{checked:r,onChange:n,name:a,value:o,...s}=e,l=`headlessui-switch-${te()}`,i=(0,k.useContext)(bt),u=(0,k.useRef)(null),c=Q(u,t,i===null?null:i.setSwitch),d=(0,k.useCallback)(()=>n(!r),[n,r]),x=(0,k.useCallback)(E=>{if($t(E.currentTarget))return E.preventDefault();E.preventDefault(),d()},[d]),w=(0,k.useCallback)(E=>{E.key===F.Space?(E.preventDefault(),d()):E.key===F.Enter&&Zt(E.currentTarget)},[d]),N=(0,k.useCallback)(E=>E.preventDefault(),[]),p=(0,k.useMemo)(()=>({checked:r}),[r]),v={id:l,ref:c,role:"switch",type:qt(e,u),tabIndex:0,"aria-checked":r,"aria-labelledby":i==null?void 0:i.labelledby,"aria-describedby":i==null?void 0:i.describedby,onClick:x,onKeyUp:w,onKeyPress:N};return k.default.createElement(k.default.Fragment,null,a!=null&&r&&k.default.createElement(st,{...Oe({as:"input",type:"checkbox",hidden:!0,readOnly:!0,checked:r,name:a,value:o})}),_({ourProps:v,theirProps:s,slot:p,defaultTag:Hn,name:"Switch"}))}),go=Object.assign(Bn,{Group:Mn,Label:ir,Description:nr});function zn(e){let t={called:!1};return(...r)=>{if(!t.called)return t.called=!0,e(...r)}}function Ge(e,...t){e&&t.length>0&&e.classList.add(...t)}function We(e,...t){e&&t.length>0&&e.classList.remove(...t)}var Ke=(e=>(e.Ended="ended",e.Cancelled="cancelled",e))(Ke||{});function $n(e,t){let r=ue();if(!e)return r.dispose;let{transitionDuration:n,transitionDelay:a}=getComputedStyle(e),[o,s]=[n,a].map(l=>{let[i=0]=l.split(",").filter(Boolean).map(u=>u.includes("ms")?parseFloat(u):parseFloat(u)*1e3).sort((u,c)=>c-u);return i});if(o+s!==0){let l=[];l.push(r.addEventListener(e,"transitionrun",()=>{l.splice(0).forEach(i=>i()),l.push(r.addEventListener(e,"transitionend",()=>{t("ended"),l.splice(0).forEach(i=>i())},{once:!0}),r.addEventListener(e,"transitioncancel",()=>{t("cancelled"),l.splice(0).forEach(i=>i())},{once:!0}))},{once:!0}))}else t("ended");return r.add(()=>t("cancelled")),r.dispose}function _n(e,t,r,n){let a=r?"enter":"leave",o=ue(),s=n!==void 0?zn(n):()=>{},l=M(a,{enter:()=>t.enter,leave:()=>t.leave}),i=M(a,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=M(a,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return We(e,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),Ge(e,...l,...u),o.nextFrame(()=>{We(e,...u),Ge(e,...i),$n(e,c=>(c==="ended"&&(We(e,...l),Ge(e,...t.entered)),s(c)))}),o.dispose}function Vn({container:e,direction:t,classes:r,events:n,onStart:a,onStop:o}){let s=er(),l=rt(),i=q(t),u=q(()=>M(i.current,{enter:()=>n.current.beforeEnter(),leave:()=>n.current.beforeLeave(),idle:()=>{}})),c=q(()=>M(i.current,{enter:()=>n.current.afterEnter(),leave:()=>n.current.afterLeave(),idle:()=>{}}));S(()=>{let d=ue();l.add(d.dispose);let x=e.current;if(!!x&&i.current!=="idle"&&!!s.current)return d.dispose(),u.current(),a.current(i.current),d.add(_n(x,r.current,i.current==="enter",w=>{d.dispose(),M(w,{[Ke.Ended](){c.current(),o.current(i.current)},[Ke.Cancelled]:()=>{}})})),d.dispose},[t])}function le(e=""){return e.split(" ").filter(t=>t.trim().length>1)}var je=(0,y.createContext)(null);je.displayName="TransitionContext";var Un=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Un||{});function Gn(){let e=(0,y.useContext)(je);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Wn(){let e=(0,y.useContext)(Me);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}var Me=(0,y.createContext)(null);Me.displayName="NestingContext";function He(e){return"children"in e?He(e.children):e.current.filter(({state:t})=>t==="visible").length>0}function sr(e){let t=q(e),r=(0,y.useRef)([]),n=er(),a=q((s,l=oe.Hidden)=>{let i=r.current.findIndex(({id:u})=>u===s);i!==-1&&(M(l,{[oe.Unmount](){r.current.splice(i,1)},[oe.Hidden](){r.current[i].state="hidden"}}),Vt(()=>{var u;!He(r)&&n.current&&((u=t.current)==null||u.call(t))}))}),o=q(s=>{let l=r.current.find(({id:i})=>i===s);return l?l.state!=="visible"&&(l.state="visible"):r.current.push({id:s,state:"visible"}),()=>a.current(s,oe.Unmount)});return(0,y.useMemo)(()=>({children:r,register:o,unregister:a}),[o,a,r])}function qn(){}var Xn=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Lt(e){var t;let r={};for(let n of Xn)r[n]=(t=e[n])!=null?t:qn;return r}function Kn(e){let t=(0,y.useRef)(Lt(e));return(0,y.useEffect)(()=>{t.current=Lt(e)},[e]),t}var Jn="div",ur=Le.RenderStrategy,cr=G(function(e,t){let{beforeEnter:r,afterEnter:n,beforeLeave:a,afterLeave:o,enter:s,enterFrom:l,enterTo:i,entered:u,leave:c,leaveFrom:d,leaveTo:x,...w}=e,N=(0,y.useRef)(null),p=Q(N,t),[v,E]=(0,y.useState)("visible"),A=w.unmount?oe.Unmount:oe.Hidden,{show:g,appear:H,initial:b}=Gn(),{register:R,unregister:h}=Wn(),z=(0,y.useRef)(null),I=te(),j=(0,y.useRef)(!1),L=sr(()=>{j.current||(E("hidden"),h.current(I))});(0,y.useEffect)(()=>{if(I)return R.current(I)},[R,I]),(0,y.useEffect)(()=>{if(A===oe.Hidden&&!!I){if(g&&v!=="visible"){E("visible");return}M(v,{hidden:()=>h.current(I),visible:()=>R.current(I)})}},[v,I,R,h,g,A]);let Y=q({enter:le(s),enterFrom:le(l),enterTo:le(i),entered:le(u),leave:le(c),leaveFrom:le(d),leaveTo:le(x)}),ge=Kn({beforeEnter:r,afterEnter:n,beforeLeave:a,afterLeave:o}),ae=nt();(0,y.useEffect)(()=>{if(ae&&v==="visible"&&N.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[N,v,ae]);let T=b&&!H,D=(()=>!ae||T||z.current===g?"idle":g?"enter":"leave")();Vn({container:N,classes:Y,events:ge,direction:D,onStart:q(()=>{}),onStop:q(hr=>{hr==="leave"&&!He(L)&&(E("hidden"),h.current(I))})}),(0,y.useEffect)(()=>{!T||(A===oe.Hidden?z.current=null:z.current=g)},[g,T,v]);let ne=w,ze={ref:p};return y.default.createElement(Me.Provider,{value:L},y.default.createElement(Gt,{value:M(v,{visible:ie.Open,hidden:ie.Closed})},_({ourProps:ze,theirProps:ne,defaultTag:Jn,features:ur,visible:v==="visible",name:"Transition.Child"})))}),Je=G(function(e,t){let{show:r,appear:n=!1,unmount:a,...o}=e,s=Q(t);nt();let l=it();if(r===void 0&&l!==null&&(r=M(l,{[ie.Open]:!0,[ie.Closed]:!1})),![!0,!1].includes(r))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[i,u]=(0,y.useState)(r?"visible":"hidden"),c=sr(()=>{u("hidden")}),[d,x]=(0,y.useState)(!0),w=(0,y.useRef)([r]);S(()=>{d!==!1&&w.current[w.current.length-1]!==r&&(w.current.push(r),x(!1))},[w,r]);let N=(0,y.useMemo)(()=>({show:r,appear:n,initial:d}),[r,n,d]);(0,y.useEffect)(()=>{r?u("visible"):He(c)||u("hidden")},[r,c]);let p={unmount:a};return y.default.createElement(Me.Provider,{value:c},y.default.createElement(je.Provider,{value:N},_({ourProps:{...p,as:y.Fragment,children:y.default.createElement(cr,{ref:s,...p,...o})},theirProps:{},defaultTag:y.Fragment,features:ur,visible:i==="visible",name:"Transition"})))});function Yn(e){let t=(0,y.useContext)(je)!==null,r=it()!==null;return y.default.createElement(y.default.Fragment,null,!t&&r?y.default.createElement(Je,{...e}):y.default.createElement(cr,{...e}))}var Zn=Object.assign(Je,{Child:Yn,Root:Je}),Qn=re.forwardRef(function(e,t){let{id:r,items:n,name:a,onChange:o,hasError:s,defaultValue:l,disabled:i,inputSize:u,icon:c=jr,...d}=e,x=n.find(({value:g})=>g===l),[w,N]=re.useState(x),[p,v]=re.useState(""),E=p===""?n:n.filter(g=>g.label.toLowerCase().replace(/\s+/g,"").includes(p.toLowerCase().replace(/\s+/g,""))),A=re.useCallback(g=>{N(g),o&&o(g==null?void 0:g.value)},[o]);return(0,O.jsx)("div",{className:"w-full",children:(0,O.jsxs)(Ne,{value:w,disabled:i,onChange:A,children:[(0,O.jsx)("input",{...d,disabled:i,type:"hidden",ref:t,name:a,value:w==null?void 0:w.value}),(0,O.jsxs)("div",{className:"relative",children:[(0,O.jsxs)("div",{className:"relative",children:[(0,O.jsx)(Ne.Input,{"aria-disabled":i,disabled:i,className:et(e.className,s,u),displayValue:g=>g==null?void 0:g.label,onChange:g=>v(g.target.value)}),(0,O.jsx)(Ne.Button,{className:"flex absolute inset-y-0 right-0 items-center pr-5",children:s?(0,O.jsx)(Ye,{className:"w-5 h-5 text-red-500","aria-hidden":"true"}):(0,O.jsx)(c,{width:"20px",height:"20px",className:"w-5 h-5 text-gray-300","aria-hidden":"true"})})]}),(0,O.jsx)(Zn,{as:re.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",afterLeave:()=>v(""),children:(0,O.jsx)(Ne.Options,{className:"overflow-auto absolute z-20 py-1 mt-1 w-full max-h-60 text-base bg-white rounded-md focus:outline-none ring-1 ring-slate-200 shadow-lg sm:text-sm",children:E.length===0&&p!==""?(0,O.jsx)("div",{className:"relative py-2 px-4 text-gray-700 cursor-default select-none",children:"Nothing found."}):E.map(g=>(0,O.jsx)(Ne.Option,{className:({active:H})=>`cursor-default select-none relative py-2 pl-10 pr-4 ${H?"text-primary-500 bg-gray-100":"text-primary-500"}`,value:g,children:({selected:H,active:b})=>(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("span",{className:`block truncate ${H?"font-medium":"font-normal"}`,children:g.label}),H?(0,O.jsx)("span",{className:`absolute inset-y-0 left-0 flex items-center pl-3 ${b?"text-white":"text-teal-600"}`,children:(0,O.jsx)(Dt,{className:"w-5 h-5","aria-hidden":"true"})}):null]})},g.id??g.value))})})]})]})})}),yo=re.forwardRef(function({error:e,name:t,label:r,description:n,id:a,className:o,defaultValue:s,items:l,...i},u){let c=a??t,d=`${c}-error`,x=`${c}-description`;return(0,O.jsxs)("div",{className:U(o,"w-full"),children:[r&&(0,O.jsxs)("div",{className:"flex justify-between",children:[(0,O.jsx)(Qe,{htmlFor:c,className:"mb-2",children:r}),n&&(0,O.jsx)("span",{className:"text-sm text-slate-400",id:x,children:n})]}),(0,O.jsx)(Qn,{hasError:!!e,...i,ref:u,name:t,id:c,defaultValue:s,items:l,"aria-describedby":e?d:n?x:void 0}),e&&(0,O.jsx)("p",{className:"mt-2 text-sm text-red-600",id:d,children:e})]})});function eo({value:e,label:t,description:r,className:n,...a}){return(0,V.jsx)(Re.Option,{value:e,...a,className:({active:o,checked:s})=>U(n,"relative rounded-lg shadow-md px-5 py-4 cursor-pointer flex focus:outline-none group",s?"bg-inverse text-inverse":"bg-secondary text-primary",{"ring-2 ring-offset-2 ring-inverse ring-inverse ring-opacity-60":o}),children:({checked:o})=>(0,V.jsxs)("div",{className:"flex justify-between items-center w-full",children:[(0,V.jsx)("div",{className:"flex items-center",children:(0,V.jsxs)("div",{className:"text-sm",children:[(0,V.jsx)(Re.Label,{as:"p",className:`font-medium ${o?"text-invserse":"text-primary"}`,children:t}),r&&(0,V.jsx)(Re.Description,{as:"span",className:`inline ${o?"text-slate-500":"text-slate-400"}`,children:r})]})}),o&&(0,V.jsx)("div",{className:"shrink-0 text-inverse",children:(0,V.jsx)(Ir,{className:"w-6 h-6"})})]})})}function to({name:e,value:t,label:r,onChange:n,children:a}){return(0,V.jsxs)(Re,{value:t,onChange:n,children:[(0,V.jsx)("input",{name:e,value:t,type:"hidden"}),r&&(0,V.jsx)(Re.Label,{className:"sr-only",children:r}),(0,V.jsx)("div",{className:"space-y-2",children:a})]})}to.Option=eo;var ro=ke.forwardRef(function(e,t){let{value:r,defaultValue:n,hasError:a,inputSize:o,icon:s=Br,...l}=e,[i,u]=ke.useState((r==null?void 0:r.toString())||(n==null?void 0:n.toString())||At(new Date).toISOString()),c=et(e.className,a,o);function d(w){let N=w.target.value,p=new Date(i);p.setHours(parseInt(N,10)),u(p.toISOString())}function x(w){let N=w.target.value,p=new Date(i);p.setMinutes(parseInt(N,10)),u(p.toISOString())}return(0,m.jsxs)("div",{className:"relative shadow-sm",children:[(0,m.jsx)("input",{...l,value:i,ref:t,type:"hidden"}),(0,m.jsx)("div",{className:U(c,{"pr-14":!!s}),children:(0,m.jsxs)("div",{className:"flex",children:[(0,m.jsxs)("div",{className:"flex relative justify-center items-center text-center z-1",children:[(0,m.jsx)("div",{className:"hidden group-hover:block absolute -inset-1 group-hover:bg-white rounded-md shadow-md"}),(0,m.jsxs)("select",{name:"hours",onChange:d,className:"z-10 text-xl text-center bg-transparent outline-none appearance-none cursor-pointer",defaultValue:new Date(i).getHours().toString(),children:[(0,m.jsx)("option",{value:"0",children:"00"}),(0,m.jsx)("option",{value:"1",children:"01"}),(0,m.jsx)("option",{value:"2",children:"02"}),(0,m.jsx)("option",{value:"3",children:"03"}),(0,m.jsx)("option",{value:"4",children:"04"}),(0,m.jsx)("option",{value:"5",children:"05"}),(0,m.jsx)("option",{value:"6",children:"06"}),(0,m.jsx)("option",{value:"7",children:"07"}),(0,m.jsx)("option",{value:"8",children:"08"}),(0,m.jsx)("option",{value:"9",children:"09"}),(0,m.jsx)("option",{value:"10",children:"10"}),(0,m.jsx)("option",{value:"11",children:"10"}),(0,m.jsx)("option",{value:"12",children:"12"}),(0,m.jsx)("option",{value:"13",children:"13"}),(0,m.jsx)("option",{value:"14",children:"14"}),(0,m.jsx)("option",{value:"15",children:"15"}),(0,m.jsx)("option",{value:"16",children:"16"}),(0,m.jsx)("option",{value:"17",children:"17"}),(0,m.jsx)("option",{value:"18",children:"18"}),(0,m.jsx)("option",{value:"19",children:"19"}),(0,m.jsx)("option",{value:"20",children:"20"}),(0,m.jsx)("option",{value:"21",children:"21"}),(0,m.jsx)("option",{value:"22",children:"22"}),(0,m.jsx)("option",{value:"23",children:"23"})]})]}),(0,m.jsx)("span",{className:"mx-2 text-xl",children:":"}),(0,m.jsxs)("div",{className:"flex relative justify-center items-center text-center z-1",children:[(0,m.jsx)("div",{className:"hidden group-hover:block absolute -inset-1 group-hover:bg-white rounded-md shadow-md"}),(0,m.jsxs)("select",{name:"minutes",className:"z-10 text-xl text-center bg-transparent outline-none appearance-none cursor-pointer",onChange:x,defaultValue:new Date(i).getMinutes().toString(),children:[(0,m.jsx)("option",{value:"0",children:"00"}),(0,m.jsx)("option",{value:"15",children:"15"}),(0,m.jsx)("option",{value:"30",children:"30"}),(0,m.jsx)("option",{value:"45",children:"45"})]})]})]})}),!a&&(0,m.jsx)(s,{width:"20px",height:"20px",className:U("flex absolute top-0 right-5 z-10 justify-center items-center p-0 h-full",{"text-gray-300":!a,"text-red-500":a})}),a&&(0,m.jsx)("div",{className:"flex absolute top-0 right-5 z-10 justify-center items-center p-0 h-full",children:(0,m.jsx)(Ye,{className:"w-5 h-5 text-red-500","aria-hidden":"true"})})]})}),wo=ke.forwardRef(function({error:e,name:t,label:r,description:n,id:a,className:o,defaultValue:s,...l},i){let u=a??t,c=`${u}-error`,d=`${u}-description`;return(0,m.jsxs)("div",{className:U(o,"w-full"),children:[r&&(0,m.jsxs)("div",{className:"flex justify-between",children:[(0,m.jsx)(Qe,{htmlFor:u,className:"mb-2",children:r}),n&&(0,m.jsx)("span",{className:"text-sm text-slate-400",id:d,children:n})]}),(0,m.jsx)(ro,{hasError:!!e,...l,ref:i,name:t,id:u,defaultValue:s||At(new Date).toISOString(),"aria-describedby":e?c:n?d:void 0}),e&&(0,m.jsx)("p",{className:"mt-2 text-sm text-red-600",id:c,children:e})]})});var Eo=require("react"),Co=require("react"),Be=require("react/jsx-runtime"),vr=P(require("react"),1);function pr(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(r=pr(e[t]))&&(n&&(n+=" "),n+=r);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function fr(){for(var e=0,t,r,n="";e<arguments.length;)(t=arguments[e++])&&(r=pr(t))&&(n&&(n+=" "),n+=r);return n}var no={h1:"leading-tight text-4xl md:text-5xl",h2:"leading-tight text-3xl md:text-4xl",h3:"text-2xl font-bold md:text-3xl",h4:"text-xl font-bold md:text-2xl",h5:"text-lg font-bold md:text-xl",h6:"text-lg font-bold"},oo={primary:"text-primary",secondary:"text-secondary"};function ao({variant:e="primary",size:t,as:r,className:n,...a}){return(0,Be.jsx)(r??t,{className:fr(no[t],oo[e],n),...a})}function mr(e){return(0,Be.jsx)(ao,{...e,size:"h4"})}function br({className:e,prose:t=!0,as:r="p",textColorClassName:n="text-secondary",...a}){return vr.createElement(r,{className:fr("max-w-full text-lg",e,{"prose prose-light dark:prose-invert":t,[n]:!t}),...a})}var xt=P(require("react"));var J=require("react/jsx-runtime");function io({children:e,confirmString:t,title:r="Are you sure?",message:n=`If yes, type in the app name ${t} below`,confirmButtonLabel:a="Yes, Delete it",cancelButtonLabel:o="Cancel",onConfirm:s,...l}){let[i,u]=xt.useState(!1),[c,d]=xt.useState("");function x(){u(!1),s()}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(we,{variant:"danger",...l,onClick:()=>u(!i),children:e}),i&&(0,J.jsxs)("div",{className:"p-4 mt-4 space-y-2 rounded-md border",children:[(0,J.jsx)(mr,{children:r}),(0,J.jsx)(br,{dangerouslySetInnerHTML:{__html:n.replace(t,`<strong>${t}</strong>`)}}),(0,J.jsxs)("div",{className:"flex space-x-2 w-full",children:[(0,J.jsx)(tt,{className:"w-full",placeholder:"App Name",onChange:w=>d(w.target.value)}),(0,J.jsx)(we,{onClick:x,variant:"danger",disabled:c!==t,children:a}),(0,J.jsx)(we,{variant:"secondary",onClick:()=>u(!1),children:o})]})]})]})}0&&(module.exports={Button,ButtonLink,DeleteConfirmButton,Link,LinkButton}); | ||
//# sourceMappingURL=index.js.map |
export * from './button' | ||
export * from './delete-confirm-button' | ||
export * from './link' |
{ | ||
"name": "@daren/button", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"repository": { | ||
@@ -42,7 +42,9 @@ "type": "git", | ||
"dependencies": { | ||
"@daren/utils": "^1.3.3", | ||
"@heroicons/react": "^1.0.5" | ||
"react": "^17.0.2" | ||
}, | ||
"devDependencies": { | ||
"react": "^17.0.2" | ||
"@daren/form-elements": "^1.8.4", | ||
"@daren/typography": "^1.4.4", | ||
"@daren/utils": "^1.5.3", | ||
"@heroicons/react": "^2.0.11" | ||
}, | ||
@@ -55,3 +57,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "ef2acaf405dc3a223b114dc559b91320786ca7c7" | ||
"gitHead": "27cf193252f613ac14fdcd8daea14925d0fc6a39" | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
746048
2
13
961
4
1
+ Addedreact@^17.0.2
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedreact@17.0.2(transitive)
- Removed@daren/utils@^1.3.3
- Removed@heroicons/react@^1.0.5
- Removed@daren/utils@1.9.7(transitive)
- Removed@heroicons/react@1.0.6(transitive)
- Removedclsx@1.2.1(transitive)
- Removedreact@19.0.0(transitive)
- Removedtailwind-merge@1.14.0(transitive)