miniflare
Version:
Fun, full-featured, fully-local simulator for Cloudflare Workers
1 lines • 3.79 kB
JavaScript
import{c as e,s as t,z as n}from"./useRouterState-DkU0JPAO.js";import{At as r,Et as i,G as a,Lt as o,Nt as s,Ot as c,P as l,Q as u,Vt as d,X as f,ct as p,dt as m,ht as h,i as g,tt as _,xt as v,y}from"./button-cdxnqcgzwko8ooha-DW4HgSd6.js";import{r as b}from"./input-group-lxdd09p60cf27pe1-FmDFsFZv.js";import{t as x}from"./skeleton-line-epxenksfesr2fkcv-coLjV5E9.js";import{Nt as S,Pt as C}from"./index-CkemaNd1.js";var w=e(),T=n(t(),1);function E(e){if(typeof e!=`object`||!e||Array.isArray(e)||`$$typeof`in e||e instanceof Promise)return!1;let t=e;return`label`in t&&t.label!==void 0}function D(e){return Array.isArray(e)?e:Object.entries(e).map(([e,t])=>({value:e,label:E(t)?t.label:t}))}function O(e){let t=D(e),n=new Map;if(!Array.isArray(e))for(let[t,r]of Object.entries(e))E(r)&&n.set(t,{disabled:r.disabled});return t.filter(e=>e.value!==null).map((e,t)=>{let r=typeof e.value==`string`?e.value:`option-${t}`,i=typeof e.value==`string`?n.get(e.value):void 0;return(0,w.jsx)(A,{value:e.value,disabled:i?.disabled,children:e.label},r)})}function k({children:e,className:t,renderValue:n,label:r,hideLabel:s,placeholder:f,loading:m,labelTooltip:_,description:y,error:S,required:E,container:k,...A}){let j=(0,T.useId)(),M=o(),N=k??M??void 0,P=A,F=P[`aria-label`],I=P[`aria-labelledby`],L=typeof r==`string`?r:f,R=r&&s!==!0,z=R?void 0:I??(r?j:void 0),B=F??(z?void 0:L),V=A.items?D(A.items):void 0,H=e??(A.items?O(A.items):null),{items:U,...W}=A,G=(0,w.jsxs)(l,{...W,items:V,disabled:m||A.disabled,children:[(0,w.jsxs)(u,{className:d(g(),`justify-between font-normal`,`focus:opacity-100 focus-visible:ring-1 focus-visible:ring-kumo-hairline *:in-focus:opacity-100`,A.disabled&&`cursor-not-allowed opacity-50`,t),"aria-label":B,"aria-labelledby":z,children:[m?(0,w.jsx)(x,{className:`w-32`}):(0,w.jsx)(i,{placeholder:f,className:`min-w-0 truncate`,children:n}),(0,w.jsx)(h,{className:`flex shrink-0 items-center`,children:(0,w.jsx)(C,{})})]}),(0,w.jsx)(v,{container:N,children:(0,w.jsx)(a,{children:(0,w.jsx)(p,{className:d(`flex flex-col`,`max-h-[var(--available-height)] bg-kumo-base text-kumo-default`,`rounded-lg shadow-lg ring ring-kumo-hairline`,`min-w-[calc(var(--anchor-width)+3px)] py-1.5`),children:(0,w.jsx)(c,{className:d(`min-h-0 flex-1 overflow-y-auto overscroll-none scroll-pt-2 scroll-pb-2`),children:H})})})})]});if(R)return(0,w.jsx)(b,{label:r,required:E,labelTooltip:_,description:y,error:S?typeof S==`string`?{message:S,match:!0}:S:void 0,children:G});let K=S?typeof S==`string`?{message:S}:S:void 0;return(0,w.jsxs)(`div`,{className:`grid gap-2`,children:[r&&(0,w.jsx)(`span`,{id:j,className:`sr-only`,children:r}),G,K?(0,w.jsx)(`span`,{className:`text-sm text-kumo-danger`,children:K.message}):y&&(0,w.jsx)(`span`,{className:`text-sm leading-snug text-kumo-subtle`,children:y})]})}function A({children:e,value:t,disabled:n,className:r}){return(0,w.jsxs)(f,{value:t,disabled:n,className:d(`group mx-1.5 flex cursor-pointer items-center justify-between gap-2 rounded px-2 py-1.5 text-base data-highlighted:bg-kumo-tint`,`data-[disabled]:pointer-events-none data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,r),children:[(0,w.jsx)(m,{children:e}),(0,w.jsx)(_,{children:(0,w.jsx)(S,{})})]})}var j=(0,T.forwardRef)(({children:e,className:t},n)=>(0,w.jsx)(r,{ref:n,className:d(t),children:e}));j.displayName=`Select.Group`;var M=(0,T.forwardRef)(({children:e,className:t},n)=>(0,w.jsx)(s,{ref:n,className:d(`px-3.5 py-1.5 text-sm font-semibold text-kumo-subtle`,t),children:e}));M.displayName=`Select.GroupLabel`;var N=(0,T.forwardRef)(({className:e},t)=>(0,w.jsx)(y,{ref:t,className:d(`-mx-1 my-1 h-px bg-kumo-line`,e)}));N.displayName=`Select.Separator`,k.Option=A,k.Group=j,k.GroupLabel=M,k.Separator=N,k.Option.displayName=`Select.Option`;export{k as t};