@owodesign/owoui 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -76,6 +76,14 @@ import storybookCatalog from '@owodesign/owoui/storybook/catalog';
76
76
 
77
77
  It also builds a standalone static storybook site into `dist/storybook-static/`, which can be deployed directly or mounted by a host app as static files.
78
78
 
79
+ For package-local development with HMR, run:
80
+
81
+ ```bash
82
+ npm -w packages/owoui run dev:storybook
83
+ ```
84
+
85
+ The dev host lives inside `packages/owoui` itself (`vite.config.ts`, `postcss.config.mjs`, `index.html`) so the package can move into its own repo later without depending on qblog's app shell.
86
+
79
87
  ## Release Checks
80
88
 
81
89
  From the repo root:
package/dist/index.d.ts CHANGED
@@ -184,17 +184,6 @@ interface DrawerProps extends HTMLAttributes<HTMLElement> {
184
184
  }
185
185
  declare function Drawer({ as: Component, open, children, side, position, showBackdrop, onClose, closeLabel, backdropClassName, className, ...props }: DrawerProps): react_jsx_runtime.JSX.Element;
186
186
 
187
- type EmptyStateTone = 'neutral' | 'notice' | 'warning';
188
- interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
189
- tone?: EmptyStateTone;
190
- icon?: ReactNode;
191
- title?: ReactNode;
192
- description?: ReactNode;
193
- action?: ReactNode;
194
- children?: ReactNode;
195
- }
196
- declare function EmptyState({ tone, icon, title, description, action, className, children, ...props }: EmptyStateProps): react_jsx_runtime.JSX.Element;
197
-
198
187
  interface FieldProps extends HTMLAttributes<HTMLDivElement> {
199
188
  label: ReactNode;
200
189
  help?: ReactNode;
@@ -317,12 +306,17 @@ interface SpinnerProps {
317
306
  declare function Spinner({ variant, size, className, label }: SpinnerProps): react_jsx_runtime.JSX.Element;
318
307
 
319
308
  type StatusNoticeTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
320
- interface StatusNoticeProps extends HTMLAttributes<HTMLDivElement> {
309
+ type StatusNoticeLayout = 'horizontal' | 'vertical';
310
+ interface StatusNoticeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
321
311
  tone?: StatusNoticeTone;
312
+ layout?: StatusNoticeLayout;
322
313
  icon?: ReactNode;
323
- children: ReactNode;
314
+ title?: ReactNode;
315
+ description?: ReactNode;
316
+ action?: ReactNode;
317
+ children?: ReactNode;
324
318
  }
325
- declare function StatusNotice({ tone, icon, className, children, ...props }: StatusNoticeProps): react_jsx_runtime.JSX.Element;
319
+ declare function StatusNotice({ tone, layout, icon, title, description, action, className, children, ...props }: StatusNoticeProps): react_jsx_runtime.JSX.Element;
326
320
 
327
321
  type SwitchSize = 'sm' | 'md';
328
322
  interface SwitchProps {
@@ -402,21 +396,21 @@ declare function ToastProvider({ children, renderToast, }: {
402
396
  renderToast?: (args: ToastRenderArgs) => ReactNode;
403
397
  }): react_jsx_runtime.JSX.Element;
404
398
 
405
- type Placement = 'top' | 'bottom' | 'left' | 'right';
399
+ type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
406
400
  type TooltipDensity = 'compact' | 'default';
407
401
  interface TooltipProps {
408
402
  content: ReactNode;
409
- placement?: Placement;
403
+ placement?: TooltipPlacement;
410
404
  density?: TooltipDensity;
411
405
  showDelay?: number;
412
406
  hideDelay?: number;
413
407
  arrow?: boolean;
414
408
  renderArrow?: (args: {
415
- placement: Placement;
409
+ placement: TooltipPlacement;
416
410
  }) => ReactNode;
417
411
  className?: string;
418
- children: ReactElement;
412
+ children: ReactNode;
419
413
  }
420
414
  declare function Tooltip({ content, placement: preferredPlacement, density, showDelay, hideDelay, arrow, renderArrow, className, children, }: TooltipProps): react_jsx_runtime.JSX.Element;
421
415
 
422
- export { Avatar, Badge, type BadgeProps, Button, type ButtonProps, Collapsible, CollapsibleContent, type CollapsibleContentProps, CollapsibleRoot, type CollapsibleRootProps, CollapsibleTrigger, type CollapsibleTriggerProps, ConfirmProvider, Dialog, Drawer, DropdownMenu, type DropdownMenuAlign, type DropdownMenuContentProps, type DropdownMenuItemProps, type DropdownMenuProps, type DropdownMenuRole, type DropdownMenuSide, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, Field, IconButton, type IconButtonProps, Input, type InputProps, Panel, PanelBody, PanelFooter, PanelHeader, SegmentedControl, type SegmentedOption, Select, type SelectOption, type SelectRenderOptionArgs, type SelectRenderValueArgs, Skeleton, type SkeletonAnimation, type SkeletonSpeed, type SkeletonTone, Spinner, StatusNotice, type StatusNoticeProps, Switch, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, TabsRoot, type TabsRootProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastInput, ToastProvider, type ToastRenderArgs, Tooltip, buttonClassName, useConfirm, useToast };
416
+ export { Avatar, Badge, type BadgeProps, Button, type ButtonProps, Collapsible, CollapsibleContent, type CollapsibleContentProps, CollapsibleRoot, type CollapsibleRootProps, CollapsibleTrigger, type CollapsibleTriggerProps, ConfirmProvider, Dialog, Drawer, DropdownMenu, type DropdownMenuAlign, type DropdownMenuContentProps, type DropdownMenuItemProps, type DropdownMenuProps, type DropdownMenuRole, type DropdownMenuSide, type DropdownMenuTriggerProps, Field, IconButton, type IconButtonProps, Input, type InputProps, Panel, PanelBody, PanelFooter, PanelHeader, SegmentedControl, type SegmentedOption, Select, type SelectOption, type SelectRenderOptionArgs, type SelectRenderValueArgs, Skeleton, type SkeletonAnimation, type SkeletonSpeed, type SkeletonTone, Spinner, StatusNotice, type StatusNoticeProps, Switch, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, TabsRoot, type TabsRootProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastInput, ToastProvider, type ToastRenderArgs, Tooltip, buttonClassName, useConfirm, useToast };
package/dist/index.min.js CHANGED
@@ -1 +1 @@
1
- import{clsx as jt}from"clsx";import{useState as Qt}from"react";import{jsx as Ce}from"react/jsx-runtime";var en={xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-14 w-14 text-lg"};function tn(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function We({src:e,alt:t,name:n,size:o="md",tone:r="neutral",className:s}){let[i,u]=Qt(!1),l=e&&!i,a=n?tn(n):"?";return Ce("span",{"data-tone":r,className:jt("ui-avatar inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium select-none",en[o],s),children:l?Ce("img",{src:e,alt:t??n??"",className:"h-full w-full object-cover",onError:()=>u(!0)}):Ce("span",{"aria-label":t??n,children:a})})}import{clsx as nn}from"clsx";import{jsx as on}from"react/jsx-runtime";function Ke({tone:e="neutral",variant:t="soft",size:n="xs",className:o,children:r,...s}){return on("span",{"data-tone":e,"data-variant":t,"data-size":n,className:nn("ui-badge inline-flex items-center rounded-full border text-[var(--badge-text)]",n==="xs"?"px-2.5 py-1 text-[11px]":"px-3 py-1 text-xs font-medium",o),...s,children:r})}import{clsx as hn}from"clsx";import{clsx as rn}from"clsx";import{jsx as M,jsxs as q}from"react/jsx-runtime";var sn={xs:12,sm:14,md:16,lg:24};function an({px:e}){let n=Math.PI*2*9;return q("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[M("circle",{cx:"12",cy:"12",r:9,stroke:"currentColor",strokeWidth:"3",opacity:"0.2"}),M("circle",{cx:"12",cy:"12",r:9,stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:`${n*.28} ${n*.72}`})]})}function ln({px:e}){return q("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[M("path",{d:"M12 2a10 10 0 0 1 10 10",opacity:"0.9"}),M("path",{d:"M12 2a10 10 0 0 0-7.07 2.93",opacity:"0.2"}),M("path",{d:"M4.93 4.93A10 10 0 0 0 2 12",opacity:"0.2"}),M("path",{d:"M2 12a10 10 0 0 0 2.93 7.07",opacity:"0.2"}),M("path",{d:"M4.93 19.07A10 10 0 0 0 12 22",opacity:"0.2"}),M("path",{d:"M12 22a10 10 0 0 0 7.07-2.93",opacity:"0.2"}),M("path",{d:"M19.07 19.07A10 10 0 0 0 22 12",opacity:"0.2"})]})}function un({px:e}){return M("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[0,1,2,3,4,5,6,7].map(n=>{let o=n/8*360,r=.15+n/8*.85;return M("circle",{cx:"12",cy:"3.5",r:"1.8",fill:"currentColor",opacity:r,transform:`rotate(${o} 12 12)`},n)})})}function cn({px:e}){return M("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[0,1,2,3].map(t=>q("rect",{x:3+t*5.5,y:"4",width:"3",height:"16",rx:"1.5",fill:"currentColor",opacity:"0.3",children:[M("animate",{attributeName:"opacity",values:"0.3;1;0.3",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"}),M("animate",{attributeName:"height",values:"16;8;16",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"}),M("animate",{attributeName:"y",values:"4;8;4",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"})]},t))})}function dn({px:e}){let t=e*.14,n=e*.33,o=e/2-n,r=e/2,s=e/2+n,i=e/2;return M("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[o,r,s].map((u,l)=>q("circle",{cx:u,cy:i,r:t,fill:"currentColor",opacity:"0.4",children:[M("animate",{attributeName:"cy",values:`${i};${i-e*.25};${i}`,dur:"0.6s",begin:`${l*.12}s`,repeatCount:"indefinite",calcMode:"spline",keySplines:"0.4 0 0.2 1;0.4 0 0.2 1"}),M("animate",{attributeName:"opacity",values:"0.4;1;0.4",dur:"0.6s",begin:`${l*.12}s`,repeatCount:"indefinite"})]},l))})}function pn({px:e}){return q("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[q("circle",{cx:"12",cy:"12",r:"0",fill:"currentColor",opacity:"0",children:[M("animate",{attributeName:"r",values:"4;10;4",dur:"1.2s",repeatCount:"indefinite"}),M("animate",{attributeName:"opacity",values:"0.8;0.1;0.8",dur:"1.2s",repeatCount:"indefinite"})]}),M("circle",{cx:"12",cy:"12",r:"3.5",fill:"currentColor",opacity:"0.7"})]})}function fn({px:e}){return q("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[M("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"none",opacity:"0.15"}),M("circle",{cx:"12",cy:"4",r:"2.2",fill:"currentColor",children:M("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"0.9s",repeatCount:"indefinite"})}),M("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor",opacity:"0.5",children:M("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"-360 12 12",dur:"0.9s",repeatCount:"indefinite"})})]})}function mn({px:e}){let t=e*.14,n=e*.33,o=e/2-n,r=e/2,s=e/2+n,i=e/2;return M("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[o,r,s].map((u,l)=>M("circle",{cx:u,cy:i,r:t,fill:"currentColor",opacity:"0.25",children:M("animate",{attributeName:"opacity",values:"0.25;1;0.25",dur:"0.9s",begin:`${l*.2}s`,repeatCount:"indefinite"})},l))})}var gn={ring:an,arc:ln,dots:un,bars:cn,bounce:dn,pulse:pn,orbit:fn,flow:mn},bn=new Set(["ring","arc","dots"]);function de({variant:e="ring",size:t="md",className:n,label:o}){let r=typeof t=="number"?t:sn[t],s=gn[e];return M("span",{"aria-hidden":!o,"aria-label":o,role:o?"img":void 0,className:rn("ui-spinner inline-flex",bn.has(e)&&"motion-safe:animate-spin",n),children:M(s,{px:r})})}import{Fragment as vn,jsx as G,jsxs as xn}from"react/jsx-runtime";function Ue({variant:e="secondary",size:t="md",loading:n=!1,className:o}){return hn("ui-button","inline-flex items-center justify-center gap-2 rounded-md border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-[var(--button-disabled-opacity)]",t==="sm"?"min-h-8 px-3 text-xs":"min-h-9 px-4 text-sm",n&&"pointer-events-none cursor-wait",o)}function ee(e){let{variant:t="secondary",size:n="md",loading:o=!1,leadingIcon:r,trailingIcon:s,className:i,children:u,...l}=e,a=xn(vn,{children:[o?G("span",{className:"shrink-0",children:G(de,{size:n==="sm"?"sm":"md"})}):r?G("span",{className:"shrink-0",children:r}):null,G("span",{children:u}),!o&&s?G("span",{className:"shrink-0",children:s}):null]}),d=Ue({variant:t,size:n,loading:o,className:i});if("href"in e&&e.href){let{href:p,...f}=l;return G("a",{href:p,"data-variant":t,"data-size":n,"data-loading":o?"true":void 0,"aria-disabled":o||void 0,tabIndex:o?-1:void 0,className:d,onClick:o?m=>m.preventDefault():void 0,...f,children:a})}let c=l;return G("button",{type:c.type??"button","data-variant":t,"data-size":n,"data-loading":o?"true":void 0,disabled:c.disabled||o,className:d,...c,children:a})}import{clsx as Ee}from"clsx";import{createContext as Tn,useContext as wn,useEffect as yn,useId as Mn,useMemo as Pn,useRef as qe,useState as Ge}from"react";import{jsx as te}from"react/jsx-runtime";var Xe=Tn(null);function Ye(e){let t=wn(Xe);if(!t)throw new Error(`${e} must be used within Collapsible.Root`);return t}function Rn({open:e,defaultOpen:t,onOpenChange:n}){let[o,r]=Ge(t??!1),s=e!==void 0,i=s?e:o;function u(l){s||r(l),n?.(l)}return[i,u]}function Se({children:e,open:t,defaultOpen:n,onOpenChange:o,className:r,...s}){let[i,u]=Rn({open:t,defaultOpen:n,onOpenChange:o}),l=Mn(),a=Pn(()=>({open:i,setOpen:u,contentId:l}),[l,i,u]);return te(Xe.Provider,{value:a,children:te("div",{"data-state":i?"open":"closed",className:Ee("ui-collapsible",r),...s,children:e})})}function Ze({children:e,className:t,onClick:n,...o}){let{open:r,setOpen:s,contentId:i}=Ye("Collapsible.Trigger");return te("button",{type:"button","aria-expanded":r,"aria-controls":i,"data-state":r?"open":"closed",className:Ee("ui-collapsible__trigger",t),onClick:u=>{n?.(u),u.defaultPrevented||s(!r)},...o,children:e})}function Je({children:e,className:t,...n}){let{open:o,contentId:r}=Ye("Collapsible.Content"),[s,i]=Ge(o),u=qe(null),l=qe(null);return yn(()=>{let a=u.current,d=l.current;if(!a||!d)return;let c=0,p=0,f=()=>{a.style.height="auto",a.style.overflow="visible"};if(o&&i(!0),!s&&!o)return;let m=h=>{h.target!==a||h.propertyName!=="height"||(a.removeEventListener("transitionend",m),o?f():i(!1))};return(()=>{let h=d.scrollHeight;if(a.style.overflow="hidden",o){a.style.height="0px",c=window.requestAnimationFrame(()=>{a.addEventListener("transitionend",m),a.style.height=`${h}px`}),p=window.setTimeout(f,240);return}a.style.height=`${h}px`,c=window.requestAnimationFrame(()=>{a.addEventListener("transitionend",m),a.style.height="0px"}),p=window.setTimeout(()=>i(!1),240)})(),()=>{window.cancelAnimationFrame(c),window.clearTimeout(p),a.removeEventListener("transitionend",m)}},[o,s]),!s&&!o?null:te("div",{id:r,ref:u,"data-state":o?"open":"closed","aria-hidden":!o,className:Ee("ui-collapsible__content",t),...n,children:te("div",{ref:l,className:"ui-collapsible__content-inner",children:e})})}var Cn=Object.assign(Se,{Root:Se,Trigger:Ze,Content:Je}),Sn=Cn;import{createContext as Hn,useCallback as Qe,useContext as An,useRef as Bn,useState as _n}from"react";import{clsx as ne}from"clsx";import{useEffect as En,useRef as je,useCallback as Ln}from"react";import{jsx as oe,jsxs as kn}from"react/jsx-runtime";function Nn({className:e,children:t,...n}){return oe("div",{className:ne("ui-dialog__header px-5 pt-5 pb-1 text-base font-semibold",e),...n,children:t})}function In({className:e,children:t,...n}){return oe("div",{className:ne("ui-dialog__body px-5 py-3 text-sm",e),...n,children:t})}function Dn({className:e,children:t,...n}){return oe("div",{className:ne("ui-dialog__footer flex items-center justify-end gap-2 px-5 pt-3 pb-5",e),...n,children:t})}function V({open:e,onClose:t,size:n="sm",children:o,className:r,overlayClassName:s,panelClassName:i,...u}){let l=je(null),a=je(null),d=Ln(c=>{c.key==="Escape"&&(c.stopPropagation(),t())},[t]);return En(()=>(e?(a.current=document.activeElement,document.body.style.overflow="hidden",requestAnimationFrame(()=>{let c=l.current;if(!c)return;let p=c.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');p?p.focus():c.focus()}),document.addEventListener("keydown",d)):(document.body.style.overflow="",a.current?.focus()),()=>{document.removeEventListener("keydown",d),document.body.style.overflow=""}),[e,d]),e?kn("div",{"data-state":"open",className:"ui-dialog-overlay fixed inset-0 z-50 flex items-center justify-center",children:[oe("button",{type:"button","aria-label":"Close dialog","data-state":"open",className:ne("ui-dialog-backdrop absolute inset-0 bg-black/30",s),onClick:t}),oe("div",{ref:l,role:"dialog","aria-modal":"true",tabIndex:-1,"data-state":"open","data-size":n,className:ne("ui-dialog relative z-10 w-full rounded-xl shadow-xl","animate-[dialog-in_0.2s_var(--ease-standard)]",n==="sm"?"max-w-[26rem]":"max-w-[32rem]",i,r),...u,children:o})]}):null}V.Header=Nn;V.Body=In;V.Footer=Dn;import{Fragment as Fn,jsx as J,jsxs as Le}from"react/jsx-runtime";var et=Hn(null);function On(){let e=An(et);if(!e)throw new Error("useConfirm must be used within <ConfirmProvider>");return e}function Vn({children:e}){let[t,n]=_n(null),o=Bn(null),r=Qe(i=>(o.current&&o.current.resolve(!1),new Promise(u=>{let l={options:i,resolve:u};o.current=l,n(l)})),[]),s=Qe(i=>{o.current&&(o.current.resolve(i),o.current=null),n(null)},[]);return Le(et.Provider,{value:r,children:[e,J(V,{open:t!==null,onClose:()=>s(!1),children:t&&Le(Fn,{children:[J(V.Header,{children:t.options.title}),J(V.Body,{children:typeof t.options.description=="string"?J("p",{className:"whitespace-pre-wrap",children:t.options.description}):t.options.description}),Le(V.Footer,{children:[J(ee,{variant:"ghost",size:"sm",onClick:()=>s(!1),children:t.options.cancelLabel??"\u53D6\u6D88"}),J(ee,{variant:t.options.variant??"primary",size:"sm",onClick:()=>s(!0),children:t.options.confirmLabel??"\u786E\u8BA4"})]})]})})]})}import{clsx as K}from"clsx";import{Children as zn,cloneElement as $n,createContext as tt,isValidElement as Wn,useCallback as H,useContext as Ne,useEffect as X,useId as pe,useLayoutEffect as Kn,useMemo as me,useRef as W,useState as re}from"react";import{createPortal as Un}from"react-dom";import{jsx as B,jsxs as it}from"react/jsx-runtime";var nt=tt(null),Ie=tt(null);function De(e){let t=Ne(nt);if(!t)throw new Error(`${e} must be used within DropdownMenu.`);return t}function ot(e){let t=Ne(Ie);if(!t)throw new Error(`${e} must be used within DropdownMenu.Content.`);return t}function j(e,t){return n=>{e?.(n),t(n)}}function rt(...e){return t=>{for(let n of e)n&&(typeof n=="function"?n(t):n.current=t)}}function fe(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(fe).join(" "):!e||typeof e=="boolean"?"":Wn(e)?fe(e.props.children):""}function qn(e){return[...e].sort((t,n)=>{let o=t.ref.current,r=n.ref.current;if(!o||!r)return 0;let s=o.compareDocumentPosition(r);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Gn(e){let{anchorRect:t,contentRect:n,sideOffset:o,alignOffset:r,collisionPadding:s}=e,i=window.innerWidth,u=window.innerHeight;function l(h,b){let y=0,v=0;return h==="bottom"?(y=t.bottom+o,b==="start"?v=t.left+r:b==="end"?v=t.right-n.width+r:v=t.left+(t.width-n.width)/2+r):h==="top"?(y=t.top-n.height-o,b==="start"?v=t.left+r:b==="end"?v=t.right-n.width+r:v=t.left+(t.width-n.width)/2+r):h==="right"?(v=t.right+o,b==="start"?y=t.top+r:b==="end"?y=t.bottom-n.height+r:y=t.top+(t.height-n.height)/2+r):(v=t.left-n.width-o,b==="start"?y=t.top+r:b==="end"?y=t.bottom-n.height+r:y=t.top+(t.height-n.height)/2+r),{top:y,left:v}}let a={top:"bottom",bottom:"top",left:"right",right:"left"},d=e.side,c=e.align,p=l(d,c);if(p.left<s||p.top<s||p.left+n.width>i-s||p.top+n.height>u-s){let h=l(a[d],c);h.left>=s&&h.top>=s&&h.left+n.width<=i-s&&h.top+n.height<=u-s&&(d=a[d],p=h)}let m=i-n.width-s,x=u-n.height-s;return p.left=Math.max(s,Math.min(p.left,m)),p.top=Math.max(s,Math.min(p.top,x)),{top:p.top,left:p.left,side:d,align:c}}function st({open:e,defaultOpen:t=!1,onOpenChange:n,side:o="bottom",align:r="start",sideOffset:s=8,alignOffset:i=0,collisionPadding:u=8,portal:l=!0,contentRole:a="menu",children:d}){let c=Ne(Ie),[p,f]=re(t),m=e!==void 0,x=m?e:p,h=W(null),b=W(null),y=W("selected"),v=pe(),S=pe(),w=H(R=>{m||f(R),n?.(R)},[m,n]),L=H(()=>{w(!1)},[w]),N=H(()=>{w(!1),c?.closeTree()},[c,w]),D=H(()=>{w(!x)},[x,w]),C=H(()=>{h.current?.focus()},[]),g=me(()=>({open:x,setOpen:w,toggleOpen:D,triggerRef:h,contentRef:b,side:o,align:r,sideOffset:s,alignOffset:i,collisionPadding:u,portal:l,contentRole:a,triggerId:v,contentId:S,focusIntentRef:y,parentList:c,isSubmenu:!!c,closeSelf:L,closeTree:N,focusTrigger:C}),[x,r,i,L,N,u,a,c,l,w,o,s,D,v,S,C]);return B(nt.Provider,{value:g,children:d})}function Xn({asChild:e=!1,disabled:t=!1,className:n,children:o}){let{open:r,setOpen:s,toggleOpen:i,triggerRef:u,contentRole:l,triggerId:a,contentId:d,focusIntentRef:c,isSubmenu:p}=De("DropdownMenu.Trigger"),f=zn.only(o),m=f.props??{},x=typeof m.className=="string"?m.className:void 0,h={id:a,"data-state":r?"open":"closed","aria-expanded":r,"aria-haspopup":l,"aria-controls":r?d:void 0,onClick:j(m.onClick,b=>{if(t){b.preventDefault();return}c.current="selected",i()}),onKeyDown:j(m.onKeyDown,b=>{t||(b.key==="ArrowDown"?(b.preventDefault(),c.current="first",s(!0)):b.key==="ArrowUp"?(b.preventDefault(),c.current="last",s(!0)):!p&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c.current="selected",i()))})};return e?$n(f,{...h,ref:rt(u,m.ref),className:K(n,x),type:f.type==="button"?m.type??"button":m.type}):B("button",{ref:u,disabled:t,type:"button",className:K("ui-dropdown-menu__trigger",n),...h,children:f})}function Yn({className:e,children:t,style:n,matchTriggerWidth:o=!1,maxHeight:r=320,...s}){let{open:i,setOpen:u,triggerRef:l,contentRef:a,side:d,align:c,sideOffset:p,alignOffset:f,collisionPadding:m,portal:x,contentRole:h,triggerId:b,contentId:y,focusIntentRef:v,parentList:S,isSubmenu:w,closeSelf:L,closeTree:N,focusTrigger:D}=De("DropdownMenu.Content"),C=W([]),[g,R]=re(null),[A,U]=re(null),[ce,Xt]=re(null),[Me,Yt]=re(!1),Pe=W(""),Y=W(null),Ve=H(T=>(C.current=[...C.current.filter(E=>E.id!==T.id),T],()=>{C.current=C.current.filter(E=>E.id!==T.id)}),[]),_=H(()=>qn(C.current),[]),Fe=H(T=>{v.current=T},[v]);X(()=>{Yt(!0)},[]);let Zt=me(()=>({role:h,highlightedId:g,setHighlightedId:R,registerItem:Ve,getItems:_,requestFocusIntent:Fe,closeTree:N,closeSelf:L,focusTrigger:D,activeSubmenuId:A,setActiveSubmenuId:U,contentRef:a}),[A,L,N,a,h,D,_,g,Ve,Fe]),Z=H(()=>{if(!l.current||!a.current)return;let T=l.current.getBoundingClientRect(),E=a.current.getBoundingClientRect();Xt(Gn({anchorRect:T,contentRect:E,side:d,align:c,sideOffset:p,alignOffset:f,collisionPadding:m}))},[c,f,m,a,d,p,l]);Kn(()=>{if(!(!i||!Me))return Z(),window.addEventListener("resize",Z),window.addEventListener("scroll",Z,!0),()=>{window.removeEventListener("resize",Z),window.removeEventListener("scroll",Z,!0)}},[Me,i,Z]),X(()=>{if(!i){R(null),U(null);return}let T=_().filter(P=>!P.disabled);if(T.length===0)return;let E=T[0];v.current==="last"?E=T[T.length-1]:v.current==="selected"&&(E=T.find(P=>P.selected)??T[0]),R(E.id),requestAnimationFrame(()=>{a.current?.focus(),E.ref.current?.scrollIntoView({block:"nearest"})})},[a,v,_,i]),X(()=>{if(!i)return;function T(E){let P=E.target,k=l.current?.contains(P),F=a.current?.contains(P);if(!k&&!F){let O=S?.contentRef.current?.contains(P);if(w&&O){L(),S?.setActiveSubmenuId(null);return}N()}}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[L,N,a,w,i,S,l]),X(()=>{if(i)return()=>{Y.current&&clearTimeout(Y.current)}},[i]);let $=H(T=>{if(R(T),!T){U(null);return}_().find(P=>P.id===T)?.submenu||U(null)},[_]),Re=H((T,E="first")=>{let P=_().filter(z=>!z.disabled);if(P.length===0)return;let k=P.findIndex(z=>z.id===g);if(k===-1){$(E==="last"?P[P.length-1].id:P[0].id);return}let F=(k+T+P.length)%P.length,O=P[F];$(O.id),O.ref.current?.scrollIntoView({block:"nearest"})},[_,g,$]),ze=H(T=>{let E=T.length===1?T.toLowerCase():"";if(!E)return;Y.current&&clearTimeout(Y.current),Pe.current+=E,Y.current=setTimeout(()=>{Pe.current="",Y.current=null},350);let P=_().filter(z=>!z.disabled);if(P.length===0)return;let k=P.findIndex(z=>z.id===g),O=(k>=0?[...P.slice(k+1),...P.slice(0,k+1)]:P).find(z=>z.textValue.toLowerCase().startsWith(Pe.current));O&&($(O.id),O.ref.current?.scrollIntoView({block:"nearest"}))},[_,g,$]),Jt=H(T=>{let E=_(),P=E.find(k=>k.id===g)??null;switch(T.key){case"ArrowDown":T.preventDefault(),Re(1);break;case"ArrowUp":T.preventDefault(),Re(-1,"last");break;case"Home":T.preventDefault();{let k=E.find(F=>!F.disabled);k&&$(k.id)}break;case"End":T.preventDefault();{let k=E.filter(O=>!O.disabled),F=k[k.length-1];F&&$(F.id)}break;case"Enter":case" ":P&&!P.disabled&&(T.preventDefault(),P.click());break;case"ArrowRight":P?.submenu&&(T.preventDefault(),P.openSubmenu?.());break;case"ArrowLeft":w&&(T.preventDefault(),L(),D(),S?.setActiveSubmenuId(null));break;case"Tab":N();break;case"Escape":T.preventDefault(),L(),D(),w&&S?.setActiveSubmenuId(null);break;default:ze(T.key)}},[L,N,D,_,ze,g,$,w,Re,S]);if(!i||!Me)return null;let $e=B(Ie.Provider,{value:Zt,children:B("div",{ref:a,id:y,role:h,tabIndex:-1,"aria-labelledby":h==="menu"?b:void 0,"data-state":"open","data-side":ce?.side??d,"data-align":ce?.align??c,className:K("ui-dropdown-menu__content",w&&"ui-dropdown-menu__content--submenu",e),style:{...n,position:"fixed",top:ce?.top??0,left:ce?.left??0,maxHeight:r,minWidth:o?l.current?.getBoundingClientRect().width:void 0},onKeyDown:Jt,...s,children:t})});return x?Un($e,document.body):$e}function Zn({className:e,children:t,...n}){return B("div",{className:K("ui-dropdown-menu__group",e),...n,children:t})}function Jn({className:e,children:t,...n}){return B("div",{className:K("ui-dropdown-menu__label",e),...n,children:t})}function jn({className:e,...t}){return B("div",{role:"separator",className:K("ui-dropdown-menu__separator",e),...t})}function Qn({className:e,children:t,inset:n=!1,disabled:o=!1,selected:r=!1,destructive:s=!1,closeOnSelect:i=!0,shortcut:u,indicator:l,onSelect:a,onMouseEnter:d,onClick:c,...p}){let f=pe(),m=W(null),{role:x,highlightedId:h,setHighlightedId:b,registerItem:y,closeTree:v,setActiveSubmenuId:S}=ot("DropdownMenu.Item"),w=me(()=>fe(t),[t]),L=h===f,N=H(()=>{o||(a?.(),i&&v())},[i,v,o,a]);return X(()=>y({id:f,ref:m,disabled:o,submenu:!1,selected:r,textValue:w,closeOnSelect:i,click:N}),[i,o,N,f,y,r,w]),it("button",{ref:m,id:f,type:"button",role:x==="listbox"?"option":"menuitem",tabIndex:-1,disabled:o,"aria-selected":x==="listbox"?r:void 0,"data-highlighted":L||void 0,"data-selected":r||void 0,"data-disabled":o||void 0,"data-destructive":s||void 0,className:K("ui-dropdown-menu__item",n&&"ui-dropdown-menu__item--inset",e),onMouseEnter:j(d,()=>{o||(b(f),S(null))}),onClick:j(c,D=>{D.preventDefault(),N()}),...p,children:[B("span",{className:"ui-dropdown-menu__item-main",children:t}),u?B("span",{className:"ui-dropdown-menu__shortcut",children:u}):null,r?B("span",{className:"ui-dropdown-menu__indicator",children:l??"\u2713"}):null]})}function eo(e){return B(st,{side:"right",align:"start",sideOffset:6,...e,contentRole:"menu"})}function to({className:e,children:t,inset:n=!1,disabled:o=!1,destructive:r=!1,shortcut:s,onSelect:i,onMouseEnter:u,onClick:l,...a}){let d=pe(),c=W(null),p=De("DropdownMenu.SubTrigger"),{highlightedId:f,setHighlightedId:m,registerItem:x,setActiveSubmenuId:h,activeSubmenuId:b}=ot("DropdownMenu.SubTrigger"),y=me(()=>fe(t),[t]),v=f===d,S=p.open&&b===d,w=H(()=>{o||(p.focusIntentRef.current="first",m(d),h(d),p.setOpen(!0))},[o,d,h,m,p]);return X(()=>x({id:d,ref:c,disabled:o,submenu:!0,selected:!1,textValue:y,closeOnSelect:!1,click:w,openSubmenu:w}),[o,d,w,x,y]),X(()=>{b!==d&&p.open&&p.setOpen(!1)},[b,d,p]),it("button",{ref:rt(c,p.triggerRef),id:p.triggerId,type:"button",role:"menuitem",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":p.open,"aria-controls":p.open?p.contentId:void 0,"data-highlighted":v||void 0,"data-state":S?"open":"closed","data-disabled":o||void 0,"data-destructive":r||void 0,className:K("ui-dropdown-menu__item ui-dropdown-menu__sub-trigger",n&&"ui-dropdown-menu__item--inset",e),onMouseEnter:j(u,()=>{w()}),onClick:j(l,L=>{L.preventDefault(),w(),i?.()}),...a,children:[B("span",{className:"ui-dropdown-menu__item-main",children:t}),s?B("span",{className:"ui-dropdown-menu__shortcut",children:s}):null,B("span",{className:"ui-dropdown-menu__submenu-indicator","aria-hidden":"true",children:"\u203A"})]})}var no=Object.assign(st,{Trigger:Xn,Content:Yn,Group:Zn,Label:Jn,Item:Qn,Separator:jn,Submenu:eo,SubTrigger:to}),oo=no;import{clsx as at}from"clsx";import{Fragment as ro,jsx as lt,jsxs as so}from"react/jsx-runtime";function ut({as:e="aside",open:t,children:n,side:o="right",position:r="fixed",showBackdrop:s=!0,onClose:i,closeLabel:u="\u5173\u95ED\u62BD\u5C49",backdropClassName:l,className:a,...d}){let c=o==="left"?"-translate-x-full":"translate-x-full",p=o==="left"?"left-0 top-0":"right-0 top-0",f=r==="fixed"?"fixed":"absolute";return so(ro,{children:[s&&t&&i&&lt("button",{type:"button","aria-label":u,"data-state":"open",className:at("ui-drawer-backdrop inset-0 z-10",f,l),onClick:i}),lt(e,{"aria-hidden":!t,"data-state":t?"open":"closed","data-side":o,className:at("ui-drawer",f,p,"z-20 flex max-w-full transform flex-col transition-transform duration-200 ease-in-out",t?"pointer-events-auto visible translate-x-0":`pointer-events-none invisible ${c}`,a),...d,children:n})]})}import{clsx as io}from"clsx";import{jsx as se,jsxs as ao}from"react/jsx-runtime";function ct({tone:e="neutral",icon:t,title:n,description:o,action:r,className:s,children:i,...u}){let l=t||n||o||r;return se("div",{"data-tone":e,className:io("ui-empty-state rounded-lg border px-4 py-3 text-sm",s),...u,children:l?ao("div",{className:"flex flex-col items-center gap-2 py-4 text-center",children:[t&&se("div",{className:"ui-empty-state__icon text-lg",children:t}),n&&se("div",{className:"ui-empty-state__title font-medium",children:n}),o&&se("div",{className:"ui-empty-state__description",children:o}),r&&se("div",{className:"mt-2",children:r})]}):i})}import{clsx as lo}from"clsx";import{jsx as dt,jsxs as uo}from"react/jsx-runtime";function pt({label:e,help:t,htmlFor:n,children:o,className:r,...s}){return uo("div",{className:lo("ui-field block",r),...s,children:[dt("label",{htmlFor:n,className:"ui-field__label mb-1 block text-xs",children:e}),o,t?dt("span",{className:"ui-field__help mt-1 block text-xs",children:t}):null]})}import{clsx as co}from"clsx";import{jsx as ft}from"react/jsx-runtime";function mt({variant:e="ghost",size:t="md",label:n,icon:o,className:r,...s}){let i=co("ui-icon-button","inline-flex items-center justify-center rounded-md transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",t==="sm"?"h-7 w-7":"h-8 w-8",r);if("href"in s&&s.href){let{href:l,...a}=s;return ft("a",{href:l,"aria-label":n,title:a.title??n,"data-variant":e,"data-size":t,className:i,...a,children:o})}let u=s;return ft("button",{type:u.type??"button","aria-label":n,title:u.title??n,"data-variant":e,"data-size":t,className:i,...u,children:o})}import{clsx as po}from"clsx";import{jsx as gt}from"react/jsx-runtime";function ge(e){return po("ui-input w-full rounded-lg px-3 py-2 text-sm placeholder:text-[var(--field-placeholder)] focus:outline-none focus:ring-1",e)}function bt(e){let{className:t,tone:n="default",...o}=e;return e.as==="textarea"?gt("textarea",{"data-tone":n,className:ge(t),...o}):gt("input",{"data-tone":n,className:ge(t),...o})}import{clsx as be}from"clsx";import{jsx as he}from"react/jsx-runtime";function fo(e){switch(e){case"none":return"";case"sm":return"p-4";case"lg":return"p-6";default:return"p-5"}}function ht({as:e="section",variant:t="default",padding:n="none",className:o,children:r,...s}){return he(e,{"data-variant":t,className:be("ui-panel rounded-lg border",fo(n),o),...s,children:r})}function mo({className:e,children:t,...n}){return he("div",{className:be("ui-panel-header border-b px-6 py-5",e),...n,children:t})}function go({className:e,children:t,...n}){return he("div",{className:be("px-6 py-5",e),...n,children:t})}function bo({className:e,children:t,...n}){return he("div",{className:be("ui-panel-footer border-t px-6 py-4",e),...n,children:t})}import{clsx as vt}from"clsx";import{jsx as xt}from"react/jsx-runtime";function Tt({value:e,onChange:t,options:n,size:o="sm",className:r,ariaLabel:s}){return xt("div",{role:"tablist","aria-label":s,className:vt("ui-segmented-control inline-flex rounded-md p-0.5 ring-1",o==="sm"?"text-xs":"text-sm",r),children:n.map(i=>{let u=i.value===e;return xt("button",{type:"button",role:"tab","aria-selected":u,disabled:i.disabled,"data-active":u?"true":void 0,className:vt("ui-segmented-control__item rounded font-medium transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",o==="sm"?"px-2.5 py-1":"px-3 py-1.5"),onClick:()=>t(i.value),children:i.label},i.value)})})}import{clsx as Q}from"clsx";import{useCallback as ke,useEffect as wt,useId as ho,useMemo as vo,useRef as yt,useState as Mt}from"react";import{jsx as ie,jsxs as Pt}from"react/jsx-runtime";function Rt({value:e,onChange:t,options:n,placeholder:o="Select\u2026",size:r="md",tone:s="default",disabled:i=!1,className:u,ariaLabel:l,renderValue:a,renderOption:d}){let[c,p]=Mt(!1),[f,m]=Mt(-1),x=yt(null),h=yt(null),b=ho(),y=n.find(g=>g.value===e),v=vo(()=>n.reduce((g,R,A)=>(R.disabled||g.push(A),g),[]),[n]),S=ke(()=>{if(i||n.length===0)return;p(!0);let g=n.findIndex(R=>R.value===e);m(g>=0?g:v[0]??-1)},[i,n,e,v]),w=ke(()=>{p(!1),m(-1)},[]),L=ke(g=>{g.disabled||(t(g.value),w())},[t,w]);wt(()=>{if(!c)return;function g(R){x.current&&!x.current.contains(R.target)&&w()}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c,w]),wt(()=>{if(!c||f<0)return;h.current?.children[f]?.scrollIntoView({block:"nearest"})},[c,f]);function N(g){if(!i)switch(g.key){case"Enter":case" ":{g.preventDefault(),c?f>=0&&n[f]&&!n[f].disabled&&L(n[f]):S();break}case"ArrowDown":{if(g.preventDefault(),!c)S();else{let R=v.indexOf(f),A=v[R+1];A!==void 0&&m(A)}break}case"ArrowUp":{if(g.preventDefault(),!c)S();else{let R=v.indexOf(f),A=v[R-1];A!==void 0&&m(A)}break}case"Escape":{c&&(g.preventDefault(),w());break}case"Tab":{c&&w();break}}}let D=e!==""&&y,C=a?a({open:c,placeholder:o,selectedOption:y}):ie("span",{className:Q("truncate",!D&&"ui-select__placeholder"),children:D?y.label:o});return Pt("div",{ref:x,"data-state":c?"open":"closed","data-disabled":i||void 0,"data-size":r,"data-tone":s,className:Q("ui-select relative inline-block",u),children:[Pt("button",{type:"button",role:"combobox","aria-expanded":c,"aria-haspopup":"listbox","aria-controls":b,"aria-label":l,"aria-activedescendant":c&&f>=0?`${b}-opt-${f}`:void 0,"data-state":c?"open":"closed","data-disabled":i||void 0,"data-tone":s,"data-size":r,"data-open":c||void 0,"data-has-value":D||void 0,disabled:i,className:Q("ui-select__trigger flex w-full items-center justify-between gap-2 rounded-lg text-left transition-colors focus:outline-none focus:ring-1",r==="sm"?"min-h-7 px-2 py-1 text-xs":"min-h-9 px-3 py-2 text-sm"),onClick:()=>c?w():S(),onKeyDown:N,children:[C,ie("svg",{"aria-hidden":"true",className:Q("ui-select__chevron h-3.5 w-3.5 shrink-0 transition-transform",c&&"rotate-180"),viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:ie("path",{d:"M4 6l4 4 4-4"})})]}),c&&ie("ul",{ref:h,id:b,role:"listbox","aria-label":l,"data-state":"open",className:Q("ui-select__dropdown absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg py-1 ring-1",r==="sm"?"text-xs":"text-sm"),children:n.map((g,R)=>ie("li",{id:`${b}-opt-${R}`,role:"option","aria-selected":g.value===e,"aria-disabled":g.disabled||void 0,"data-state":g.value===e?"selected":R===f?"highlighted":"idle","data-focused":R===f||void 0,"data-selected":g.value===e||void 0,"data-disabled":g.disabled||void 0,"data-highlighted":R===f||void 0,className:Q("ui-select__option cursor-default select-none px-3 py-1.5 transition-colors",g.disabled&&"cursor-not-allowed opacity-50"),onClick:()=>L(g),onMouseEnter:()=>!g.disabled&&m(R),children:d?d({option:g,index:R,selected:g.value===e,highlighted:R===f}):g.label},g.value))})]})}import{clsx as xo}from"clsx";import{jsx as wo}from"react/jsx-runtime";var To={slow:"4s",default:"3s",fast:"2s"};function Ct({className:e,animation:t="scan",tone:n="default",speed:o="default",style:r,...s}){let i=n==="warm"?"emphasis":n,u={...r,"--ui-skeleton-scan-duration":To[o]};return wo("div",{className:xo("ui-skeleton rounded",e),"data-animation":t,"data-tone":i,"aria-hidden":"true",style:u,...s})}import{clsx as yo}from"clsx";import{Fragment as Mo,jsx as He,jsxs as Po}from"react/jsx-runtime";function St({tone:e="neutral",icon:t,className:n,children:o,...r}){return He("div",{"data-tone":e,className:yo("ui-status-notice rounded-md border px-4 py-3 text-sm",t&&"ui-status-notice--with-icon grid grid-cols-[auto_minmax(0,1fr)] gap-3",n),...r,children:t?Po(Mo,{children:[He("span",{className:"ui-status-notice__icon mt-0.5 shrink-0","aria-hidden":"true",children:t}),He("div",{className:"min-w-0",children:o})]}):o})}import{clsx as Et}from"clsx";import{jsx as Lt}from"react/jsx-runtime";var Ro={sm:"h-5 w-9",md:"h-6 w-11"},Co={sm:"h-3.5 w-3.5",md:"h-4.5 w-4.5"},So={sm:"translate-x-4",md:"translate-x-5"};function Nt({checked:e,onChange:t,size:n="md",disabled:o=!1,className:r,ariaLabel:s}){return Lt("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,disabled:o,"data-size":n,className:Et("ui-switch relative inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",Ro[n],o&&"cursor-not-allowed opacity-50",r),onClick:()=>t(!e),children:Lt("span",{"aria-hidden":"true",className:Et("ui-switch__thumb pointer-events-none inline-block rounded-full bg-white shadow transition-transform",Co[n],e?So[n]:"translate-x-0.5")})})}import{clsx as xe}from"clsx";import{createContext as Eo,useContext as Lo,useId as No,useMemo as Io,useState as Do}from"react";import{jsx as ae}from"react/jsx-runtime";var It=Eo(null);function Dt(e){let t=Lo(It);if(!t)throw new Error(`${e} must be used within Tabs.Root`);return t}function ve(e){return e.replace(/[^a-zA-Z0-9_-]+/g,"-")}function ko({value:e,defaultValue:t,onValueChange:n}){let[o,r]=Do(t??""),s=e!==void 0,i=s?e:o;function u(l){s||r(l),n?.(l)}return[i,u]}function Ae({children:e,value:t,defaultValue:n,onValueChange:o,className:r,...s}){let[i,u]=ko({value:t,defaultValue:n,onValueChange:o}),l=No(),a=Io(()=>({value:i,setValue:u,baseId:l}),[l,i,u]);return ae(It.Provider,{value:a,children:ae("div",{className:xe("ui-tabs",r),...s,children:e})})}function kt({children:e,className:t,ariaLabel:n,...o}){return ae("div",{role:"tablist","aria-label":n,className:xe("ui-tabs__list flex items-end gap-1 border-b",t),...o,children:e})}function Ht({children:e,className:t,value:n,disabled:o,onClick:r,onKeyDown:s,...i}){let{value:u,setValue:l,baseId:a}=Dt("Tabs.Trigger"),d=u===n,c=`${a}-trigger-${ve(n)}`,p=`${a}-panel-${ve(n)}`;function f(m,x){let h=m.closest('[role="tablist"]');if(!h)return;let b=Array.from(h.querySelectorAll('[role="tab"]:not([disabled])')),y=b.indexOf(m);if(y<0)return;let v;x==="first"&&(v=b[0]),x==="last"&&(v=b[b.length-1]),x==="next"&&(v=b[(y+1)%b.length]),x==="prev"&&(v=b[(y-1+b.length)%b.length]),v&&(v.focus(),v.click())}return ae("button",{type:"button",id:c,role:"tab","aria-selected":d,"aria-controls":p,tabIndex:d?0:-1,"data-state":d?"active":"inactive",disabled:o,className:xe("ui-tabs__trigger relative -mb-px inline-flex min-h-9 items-center justify-center rounded-t-md border-b-2 px-3 py-2 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",t),onClick:m=>{r?.(m),!m.defaultPrevented&&!o&&l(n)},onKeyDown:m=>{if(s?.(m),m.defaultPrevented||o)return;let x=m.currentTarget;switch(m.key){case"ArrowRight":m.preventDefault(),f(x,"next");break;case"ArrowLeft":m.preventDefault(),f(x,"prev");break;case"Home":m.preventDefault(),f(x,"first");break;case"End":m.preventDefault(),f(x,"last");break}},...i,children:e})}function At({children:e,className:t,value:n,...o}){let{value:r,baseId:s}=Dt("Tabs.Content"),i=r===n,u=`${s}-trigger-${ve(n)}`,l=`${s}-panel-${ve(n)}`;return i?ae("div",{id:l,role:"tabpanel","aria-labelledby":u,"data-state":"active",className:xe("ui-tabs__content pt-4",t),...o,children:e}):null}var Ho=Object.assign(Ae,{Root:Ae,List:kt,Trigger:Ht,Content:At}),Ao=Ho;import{useCallback as Bo,useEffect as _o,useRef as Oo}from"react";import{jsx as Vo}from"react/jsx-runtime";function Bt({className:e,tone:t="default",resize:n="vertical",autoResize:o=!1,style:r,onInput:s,rows:i=3,...u}){let l=Oo(null),a=s,d=Bo(()=>{if(!o||!l.current)return;let f=l.current;f.style.height="auto",f.style.height=`${f.scrollHeight}px`},[o]);_o(()=>{d()},[d,u.value,u.defaultValue,i]);function c(f){d(),a?.(f)}let p={...r,resize:o?"none":n};return Vo("textarea",{...u,ref:l,rows:i,"data-tone":t,"data-auto-resize":o||void 0,className:ge(`ui-textarea ${e??""}`),style:p,onInput:c})}import{clsx as _t}from"clsx";import{createContext as Fo,useCallback as Ot,useContext as zo,useMemo as $o,useRef as Vt,useState as Wo}from"react";import{jsx as I,jsxs as le}from"react/jsx-runtime";var zt=Fo(null),Be=5,Ft=4e3;function Ko(){let e=zo(zt);if(!e)throw new Error("useToast must be used within <ToastProvider>");return e}function Uo({tone:e}){let t={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"success":return I("svg",{...t,children:I("path",{d:"M3.5 8.5l3 3 6-7"})});case"warning":return le("svg",{...t,children:[I("path",{d:"M8 5v4"}),I("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor",stroke:"none"})]});case"danger":return I("svg",{...t,children:I("path",{d:"M4.5 4.5l7 7M11.5 4.5l-7 7"})});case"info":return le("svg",{...t,children:[I("circle",{cx:"8",cy:"3.5",r:"1.2",fill:"currentColor",stroke:"none"}),I("path",{d:"M8 7v5.5"})]})}}function qo(e,t){return typeof e=="string"?{message:e,duration:t??Ft}:{title:e.title,message:e.message,duration:e.duration??t??Ft}}function Go({item:e,onDismiss:t,renderToast:n}){let o=()=>t(e.id),r=I(Uo,{tone:e.tone});return n?I("div",{role:"status","aria-live":"polite","data-state":"open","data-tone":e.tone,className:_t("ui-toast pointer-events-auto rounded-lg border text-sm backdrop-blur-sm","animate-[toast-in_0.25s_var(--ease-standard)]"),children:n({item:e,dismiss:o,icon:r})}):le("div",{role:"status","aria-live":"polite","data-state":"open","data-tone":e.tone,className:_t("ui-toast pointer-events-auto flex items-start gap-2 rounded-lg border px-4 py-3 text-sm backdrop-blur-sm","animate-[toast-in_0.25s_var(--ease-standard)]"),children:[I("span",{className:"ui-toast__icon mt-0.5 shrink-0","aria-hidden":"true",children:r}),le("span",{className:"min-w-0 flex-1",children:[e.title?I("span",{className:"ui-toast__title block font-medium",children:e.title}):null,I("span",{className:"block",children:e.message})]}),I("button",{type:"button",onClick:o,className:"ui-toast__close -mr-1 -mt-0.5 shrink-0 rounded p-0.5 text-current opacity-50 transition-opacity hover:opacity-100","aria-label":"Dismiss",children:I("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:I("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function Xo({children:e,renderToast:t}){let[n,o]=Wo([]),r=Vt(0),s=Vt(new Map),i=Ot(a=>{let d=s.current.get(a);d&&clearTimeout(d),s.current.delete(a),o(c=>c.filter(p=>p.id!==a))},[]),u=Ot((a,d,c)=>{let p=r.current++,f=qo(d,c),m={id:p,tone:a,...f};o(x=>{let h=[...x,m];if(h.length>Be){let b=h.slice(0,h.length-Be);for(let y of b){let v=s.current.get(y.id);v&&clearTimeout(v),s.current.delete(y.id)}return h.slice(-Be)}return h}),m.duration>0&&s.current.set(p,setTimeout(()=>i(p),m.duration))},[i]),l=$o(()=>({success:(a,d)=>u("success",a,d),warning:(a,d)=>u("warning",a,d),danger:(a,d)=>u("danger",a,d),info:(a,d)=>u("info",a,d)}),[u]);return le(zt.Provider,{value:l,children:[e,I("div",{"aria-label":"Notifications","data-state":n.length>0?"open":"closed",className:"pointer-events-none fixed bottom-4 right-4 z-[9999] flex flex-col-reverse gap-2",children:n.map(a=>I(Go,{item:a,onDismiss:i,renderToast:t},a.id))})]})}import{clsx as Yo}from"clsx";import{cloneElement as Zo,isValidElement as Jo,useCallback as Te,useEffect as $t,useId as jo,useLayoutEffect as Qo,useRef as we,useState as _e}from"react";import{createPortal as er}from"react-dom";import{Fragment as ir,jsx as Oe,jsxs as qt}from"react/jsx-runtime";var ue=6,Wt=8,ye=4,tr={top:"bottom",bottom:"top",left:"right",right:"left"},nr={top:{left:"50%",top:"100%",transform:"translateX(-50%)"},bottom:{left:"50%",top:-ue,transform:"translateX(-50%) rotate(180deg)"},left:{top:"50%",left:"100%",transform:"translateY(-50%) rotate(-90deg)"},right:{top:"50%",left:-ue,transform:"translateY(-50%) rotate(90deg)"}};function Kt(e,t,n,o){switch(e){case"top":return{top:t.top-n.height-o,left:t.left+t.width/2-n.width/2};case"bottom":return{top:t.bottom+o,left:t.left+t.width/2-n.width/2};case"left":return{top:t.top+t.height/2-n.height/2,left:t.left-n.width-o};case"right":return{top:t.top+t.height/2-n.height/2,left:t.right+o}}}function Ut(e,t){let n=window.innerWidth,o=window.innerHeight;return e.top>=0&&e.left>=0&&e.top+t.height<=o&&e.left+t.width<=n}function or(e,t,n,o){let r=o?Wt+ue:Wt,s=Kt(n,e,t,r),i=n,u=s;if(!Ut(s,t)){let p=tr[n],f=Kt(p,e,t,r);Ut(f,t)&&(i=p,u=f)}let l=window.innerWidth,a=window.innerHeight,d=Math.max(ye,Math.min(u.left,l-t.width-ye)),c=Math.max(ye,Math.min(u.top,a-t.height-ye));return{placement:i,top:c,left:d}}function rr(e,t){return n=>{e.current=n;let o=t.props.ref;typeof o=="function"?o(n):o&&typeof o=="object"&&"current"in o&&(o.current=n)}}var sr={compact:"px-2 py-1 text-[11px] max-w-[200px]",default:"px-3 py-2 text-xs max-w-xs"};function Gt({content:e,placement:t="top",density:n="default",showDelay:o=300,hideDelay:r=150,arrow:s=!0,renderArrow:i,className:u,children:l}){let[a,d]=_e(!1),[c,p]=_e(null),[f,m]=_e(t),x=we(null),h=we(null),b=we(void 0),y=we(void 0),v=jo(),S=Te(()=>{clearTimeout(b.current),clearTimeout(y.current)},[]),w=Te(()=>{S(),b.current=setTimeout(()=>d(!0),o)},[S,o]),L=Te(()=>{S(),y.current=setTimeout(()=>d(!1),r)},[S,r]),N=Te(C=>{C.key==="Escape"&&a&&d(!1)},[a]);if(Qo(()=>{if(!a||!x.current||!h.current)return;function C(){if(!x.current||!h.current)return;let g=x.current.getBoundingClientRect(),R=h.current.getBoundingClientRect(),A=or(g,R,t,s),U=document.body.getBoundingClientRect();p({top:A.top+window.scrollY-U.top,left:A.left+window.scrollX-U.left}),m(A.placement)}return C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[a,t,s]),$t(()=>{if(a)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[a,N]),$t(()=>S,[S]),!Jo(l))return l;let D=Zo(l,{ref:rr(x,l),"data-state":a?"open":"closed",onMouseEnter:C=>{w();let g=l.props.onMouseEnter;g?.(C)},onMouseLeave:C=>{L();let g=l.props.onMouseLeave;g?.(C)},onFocus:C=>{w();let g=l.props.onFocus;g?.(C)},onBlur:C=>{L();let g=l.props.onBlur;g?.(C)},"aria-describedby":a?v:void 0});return qt(ir,{children:[D,a&&er(qt("div",{ref:h,id:v,role:"tooltip","data-state":a?"open":"closed","data-placement":f,"data-density":n,className:Yo("ui-tooltip absolute z-[9999] rounded-lg leading-relaxed",sr[n],"animate-[tooltip-in_0.15s_var(--ease-standard)]",u),style:c?{top:c.top,left:c.left}:{position:"fixed",visibility:"hidden"},onMouseEnter:w,onMouseLeave:L,children:[e,s&&Oe("span",{className:"ui-tooltip__arrow absolute",style:nr[f],children:i?i({placement:f}):Oe("svg",{width:ue*2,height:ue,viewBox:"0 0 12 6",children:Oe("path",{d:"M0 0l6 6 6-6z",fill:"currentColor"})})})]}),document.body)]})}export{We as Avatar,Ke as Badge,ee as Button,Sn as Collapsible,Je as CollapsibleContent,Se as CollapsibleRoot,Ze as CollapsibleTrigger,Vn as ConfirmProvider,V as Dialog,ut as Drawer,oo as DropdownMenu,ct as EmptyState,pt as Field,mt as IconButton,bt as Input,ht as Panel,go as PanelBody,bo as PanelFooter,mo as PanelHeader,Tt as SegmentedControl,Rt as Select,Ct as Skeleton,de as Spinner,St as StatusNotice,Nt as Switch,Ao as Tabs,At as TabsContent,kt as TabsList,Ae as TabsRoot,Ht as TabsTrigger,Bt as Textarea,Xo as ToastProvider,Gt as Tooltip,Ue as buttonClassName,On as useConfirm,Ko as useToast};
1
+ import{clsx as Yt}from"clsx";import{useState as Qt}from"react";import{jsx as Le}from"react/jsx-runtime";var jt={xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-14 w-14 text-lg"};function en(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function Ke({src:e,alt:t,name:n,size:o="md",tone:a="neutral",className:s}){let[r,l]=Qt(!1),u=e&&!r,i=n?en(n):"?";return Le("span",{"data-tone":a,className:Yt("ui-avatar inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium select-none",jt[o],s),children:u?Le("img",{src:e,alt:t??n??"",className:"h-full w-full object-cover",onError:()=>l(!0)}):Le("span",{"aria-label":t??n,children:i})})}import{clsx as tn}from"clsx";import{jsx as nn}from"react/jsx-runtime";function Ue({tone:e="neutral",variant:t="soft",size:n="xs",className:o,children:a,...s}){return nn("span",{"data-tone":e,"data-variant":t,"data-size":n,className:tn("ui-badge inline-flex items-center rounded-full border text-[var(--badge-text)]",n==="xs"?"px-2.5 py-1 text-[11px]":"px-3 py-1 text-xs font-medium",o),...s,children:a})}import{clsx as bn}from"clsx";import{clsx as on}from"clsx";import{jsx as M,jsxs as Y}from"react/jsx-runtime";var rn={xs:12,sm:14,md:16,lg:24};function sn({px:e}){let n=Math.PI*2*9;return Y("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[M("circle",{cx:"12",cy:"12",r:9,stroke:"currentColor",strokeWidth:"3",opacity:"0.2"}),M("circle",{cx:"12",cy:"12",r:9,stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:`${n*.28} ${n*.72}`})]})}function an({px:e}){return Y("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[M("path",{d:"M12 2a10 10 0 0 1 10 10",opacity:"0.9"}),M("path",{d:"M12 2a10 10 0 0 0-7.07 2.93",opacity:"0.2"}),M("path",{d:"M4.93 4.93A10 10 0 0 0 2 12",opacity:"0.2"}),M("path",{d:"M2 12a10 10 0 0 0 2.93 7.07",opacity:"0.2"}),M("path",{d:"M4.93 19.07A10 10 0 0 0 12 22",opacity:"0.2"}),M("path",{d:"M12 22a10 10 0 0 0 7.07-2.93",opacity:"0.2"}),M("path",{d:"M19.07 19.07A10 10 0 0 0 22 12",opacity:"0.2"})]})}function ln({px:e}){return M("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[0,1,2,3,4,5,6,7].map(n=>{let o=n/8*360,a=.15+n/8*.85;return M("circle",{cx:"12",cy:"3.5",r:"1.8",fill:"currentColor",opacity:a,transform:`rotate(${o} 12 12)`},n)})})}function un({px:e}){return M("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[0,1,2,3].map(t=>Y("rect",{x:3+t*5.5,y:"4",width:"3",height:"16",rx:"1.5",fill:"currentColor",opacity:"0.3",children:[M("animate",{attributeName:"opacity",values:"0.3;1;0.3",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"}),M("animate",{attributeName:"height",values:"16;8;16",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"}),M("animate",{attributeName:"y",values:"4;8;4",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"})]},t))})}function cn({px:e}){let t=e*.14,n=e*.33,o=e/2-n,a=e/2,s=e/2+n,r=e/2;return M("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[o,a,s].map((l,u)=>Y("circle",{cx:l,cy:r,r:t,fill:"currentColor",opacity:"0.4",children:[M("animate",{attributeName:"cy",values:`${r};${r-e*.25};${r}`,dur:"0.6s",begin:`${u*.12}s`,repeatCount:"indefinite",calcMode:"spline",keySplines:"0.4 0 0.2 1;0.4 0 0.2 1"}),M("animate",{attributeName:"opacity",values:"0.4;1;0.4",dur:"0.6s",begin:`${u*.12}s`,repeatCount:"indefinite"})]},u))})}function dn({px:e}){return Y("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[Y("circle",{cx:"12",cy:"12",r:"0",fill:"currentColor",opacity:"0",children:[M("animate",{attributeName:"r",values:"4;10;4",dur:"1.2s",repeatCount:"indefinite"}),M("animate",{attributeName:"opacity",values:"0.8;0.1;0.8",dur:"1.2s",repeatCount:"indefinite"})]}),M("circle",{cx:"12",cy:"12",r:"3.5",fill:"currentColor",opacity:"0.7"})]})}function pn({px:e}){return Y("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[M("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"none",opacity:"0.15"}),M("circle",{cx:"12",cy:"4",r:"2.2",fill:"currentColor",children:M("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"0.9s",repeatCount:"indefinite"})}),M("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor",opacity:"0.5",children:M("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"-360 12 12",dur:"0.9s",repeatCount:"indefinite"})})]})}function fn({px:e}){let t=e*.14,n=e*.33,o=e/2-n,a=e/2,s=e/2+n,r=e/2;return M("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[o,a,s].map((l,u)=>M("circle",{cx:l,cy:r,r:t,fill:"currentColor",opacity:"0.25",children:M("animate",{attributeName:"opacity",values:"0.25;1;0.25",dur:"0.9s",begin:`${u*.2}s`,repeatCount:"indefinite"})},u))})}var mn={ring:sn,arc:an,dots:ln,bars:un,bounce:cn,pulse:dn,orbit:pn,flow:fn},gn=new Set(["ring","arc","dots"]);function be({variant:e="ring",size:t="md",className:n,label:o}){let a=typeof t=="number"?t:rn[t],s=mn[e];return M("span",{"aria-hidden":!o,"aria-label":o,role:o?"img":void 0,className:on("ui-spinner inline-flex",gn.has(e)&&"animate-spin",n),children:M(s,{px:a})})}import{Fragment as vn,jsx as Q,jsxs as xn}from"react/jsx-runtime";function We({variant:e="secondary",size:t="md",loading:n=!1,className:o}){return bn("ui-button","inline-flex items-center justify-center gap-2 rounded-md border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-[var(--button-disabled-opacity)]",t==="sm"?"min-h-8 px-3 text-xs":"min-h-9 px-4 text-sm",n&&"pointer-events-none cursor-wait",o)}function se(e){let{variant:t="secondary",size:n="md",loading:o=!1,leadingIcon:a,trailingIcon:s,className:r,children:l,...u}=e,i=xn(vn,{children:[o?Q("span",{className:"shrink-0",children:Q(be,{size:n==="sm"?"sm":"md"})}):a?Q("span",{className:"shrink-0",children:a}):null,Q("span",{children:l}),!o&&s?Q("span",{className:"shrink-0",children:s}):null]}),d=We({variant:t,size:n,loading:o,className:r});if("href"in e&&e.href){let{href:g,...p}=u;return Q("a",{href:g,"data-variant":t,"data-size":n,"data-loading":o?"true":void 0,"aria-disabled":o||void 0,tabIndex:o?-1:void 0,className:d,onClick:o?f=>f.preventDefault():void 0,...p,children:i})}let c=u;return Q("button",{type:c.type??"button","data-variant":t,"data-size":n,"data-loading":o?"true":void 0,disabled:c.disabled||o,className:d,...c,children:i})}import{clsx as Ee}from"clsx";import{createContext as hn,useContext as Tn,useEffect as yn,useId as wn,useMemo as Mn,useRef as qe,useState as Ge}from"react";import{jsx as ie}from"react/jsx-runtime";var Xe=hn(null);function Ze(e){let t=Tn(Xe);if(!t)throw new Error(`${e} must be used within Collapsible.Root`);return t}function Pn({open:e,defaultOpen:t,onOpenChange:n}){let[o,a]=Ge(t??!1),s=e!==void 0,r=s?e:o;function l(u){s||a(u),n?.(u)}return[r,l]}function Ie({children:e,open:t,defaultOpen:n,onOpenChange:o,className:a,...s}){let[r,l]=Pn({open:t,defaultOpen:n,onOpenChange:o}),u=wn(),i=Mn(()=>({open:r,setOpen:l,contentId:u}),[u,r,l]);return ie(Xe.Provider,{value:i,children:ie("div",{"data-state":r?"open":"closed",className:Ee("ui-collapsible",a),...s,children:e})})}function Je({children:e,className:t,onClick:n,...o}){let{open:a,setOpen:s,contentId:r}=Ze("Collapsible.Trigger");return ie("button",{type:"button","aria-expanded":a,"aria-controls":r,"data-state":a?"open":"closed",className:Ee("ui-collapsible__trigger",t),onClick:l=>{n?.(l),l.defaultPrevented||s(!a)},...o,children:e})}function Ye({children:e,className:t,...n}){let{open:o,contentId:a}=Ze("Collapsible.Content"),[s,r]=Ge(o),l=qe(null),u=qe(null);return yn(()=>{let i=l.current,d=u.current;if(!i||!d)return;let c=0,g=0,p=()=>{i.style.height="auto",i.style.overflow="visible"};if(o&&r(!0),!s&&!o)return;let f=x=>{x.target!==i||x.propertyName!=="height"||(i.removeEventListener("transitionend",f),o?p():r(!1))};return(()=>{let x=d.scrollHeight;if(i.style.overflow="hidden",o){i.style.height="0px",c=window.requestAnimationFrame(()=>{i.addEventListener("transitionend",f),i.style.height=`${x}px`}),g=window.setTimeout(p,240);return}i.style.height=`${x}px`,c=window.requestAnimationFrame(()=>{i.addEventListener("transitionend",f),i.style.height="0px"}),g=window.setTimeout(()=>r(!1),240)})(),()=>{window.cancelAnimationFrame(c),window.clearTimeout(g),i.removeEventListener("transitionend",f)}},[o,s]),!s&&!o?null:ie("div",{id:a,ref:l,"data-state":o?"open":"closed","aria-hidden":!o,className:Ee("ui-collapsible__content",t),...n,children:ie("div",{ref:u,className:"ui-collapsible__content-inner",children:e})})}var Cn=Object.assign(Ie,{Root:Ie,Trigger:Je,Content:Ye}),Sn=Cn;import{createContext as kn,useCallback as je,useContext as Hn,useRef as An,useState as _n}from"react";import{clsx as ae}from"clsx";import{useEffect as Nn,useRef as Qe,useCallback as Rn}from"react";import{jsx as le,jsxs as Dn}from"react/jsx-runtime";function Ln({className:e,children:t,...n}){return le("div",{className:ae("ui-dialog__header px-5 pt-5 pb-1 text-base font-semibold",e),...n,children:t})}function In({className:e,children:t,...n}){return le("div",{className:ae("ui-dialog__body px-5 py-3 text-sm",e),...n,children:t})}function En({className:e,children:t,...n}){return le("div",{className:ae("ui-dialog__footer flex items-center justify-end gap-2 px-5 pt-3 pb-5",e),...n,children:t})}function $({open:e,onClose:t,size:n="sm",children:o,className:a,overlayClassName:s,panelClassName:r,...l}){let u=Qe(null),i=Qe(null),d=Rn(c=>{c.key==="Escape"&&(c.stopPropagation(),t())},[t]);return Nn(()=>(e?(i.current=document.activeElement,document.body.style.overflow="hidden",requestAnimationFrame(()=>{let c=u.current;if(!c)return;let g=c.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');g?g.focus():c.focus()}),document.addEventListener("keydown",d)):(document.body.style.overflow="",i.current?.focus()),()=>{document.removeEventListener("keydown",d),document.body.style.overflow=""}),[e,d]),e?Dn("div",{"data-state":"open",className:"ui-dialog-overlay fixed inset-0 z-50 flex items-center justify-center",children:[le("button",{type:"button","aria-label":"Close dialog","data-state":"open",className:ae("ui-dialog-backdrop absolute inset-0 bg-black/30",s),onClick:t}),le("div",{ref:u,role:"dialog","aria-modal":"true",tabIndex:-1,"data-state":"open","data-size":n,className:ae("ui-dialog relative z-10 w-full rounded-xl shadow-xl","animate-[dialog-in_0.2s_var(--ease-standard)]",n==="sm"?"max-w-[26rem]":"max-w-[32rem]",r,a),...l,children:o})]}):null}$.Header=Ln;$.Body=In;$.Footer=En;import{Fragment as Vn,jsx as te,jsxs as De}from"react/jsx-runtime";var et=kn(null);function Bn(){let e=Hn(et);if(!e)throw new Error("useConfirm must be used within <ConfirmProvider>");return e}function On({children:e}){let[t,n]=_n(null),o=An(null),a=je(r=>(o.current&&o.current.resolve(!1),new Promise(l=>{let u={options:r,resolve:l};o.current=u,n(u)})),[]),s=je(r=>{o.current&&(o.current.resolve(r),o.current=null),n(null)},[]);return De(et.Provider,{value:a,children:[e,te($,{open:t!==null,onClose:()=>s(!1),children:t&&De(Vn,{children:[te($.Header,{children:t.options.title}),te($.Body,{children:typeof t.options.description=="string"?te("p",{className:"whitespace-pre-wrap",children:t.options.description}):t.options.description}),De($.Footer,{children:[te(se,{variant:"ghost",size:"sm",onClick:()=>s(!1),children:t.options.cancelLabel??"\u53D6\u6D88"}),te(se,{variant:t.options.variant??"primary",size:"sm",onClick:()=>s(!0),children:t.options.confirmLabel??"\u786E\u8BA4"})]})]})})]})}import{clsx as J}from"clsx";import{autoUpdate as Fn,computePosition as zn,flip as $n,offset as Kn,shift as Un}from"@floating-ui/dom";import{Children as Wn,cloneElement as qn,createContext as tt,isValidElement as Gn,useCallback as A,useContext as ke,useEffect as j,useId as ve,useLayoutEffect as Xn,useMemo as he,useRef as Z,useState as ue}from"react";import{createPortal as Zn}from"react-dom";import{jsx as _,jsxs as it}from"react/jsx-runtime";var nt=tt(null),He=tt(null);function Ae(e){let t=ke(nt);if(!t)throw new Error(`${e} must be used within DropdownMenu.`);return t}function ot(e){let t=ke(He);if(!t)throw new Error(`${e} must be used within DropdownMenu.Content.`);return t}function ne(e,t){return n=>{e?.(n),t(n)}}function rt(...e){return t=>{for(let n of e)n&&(typeof n=="function"?n(t):n.current=t)}}function xe(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(xe).join(" "):!e||typeof e=="boolean"?"":Gn(e)?xe(e.props.children):""}function Jn(e){return[...e].sort((t,n)=>{let o=t.ref.current,a=n.ref.current;if(!o||!a)return 0;let s=o.compareDocumentPosition(a);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Yn(e,t){return t==="center"?e:`${e}-${t}`}function Qn(e){let t=e.split("-");return{side:t[0],align:t[1]??"center"}}function st({open:e,defaultOpen:t=!1,onOpenChange:n,side:o="bottom",align:a="start",sideOffset:s=8,alignOffset:r=0,collisionPadding:l=8,portal:u=!0,contentRole:i="menu",children:d}){let c=ke(He),[g,p]=ue(t),f=e!==void 0,y=f?e:g,x=Z(null),b=Z(null),C=Z("selected"),h=ve(),R=ve(),T=A(P=>{f||p(P),n?.(P)},[f,n]),L=A(()=>{T(!1)},[T]),S=A(()=>{T(!1),c?.closeTree()},[c,T]),I=A(()=>{T(!y)},[y,T]),H=A(()=>{x.current?.focus()},[]),m=he(()=>({open:y,setOpen:T,toggleOpen:I,triggerRef:x,contentRef:b,side:o,align:a,sideOffset:s,alignOffset:r,collisionPadding:l,portal:u,contentRole:i,triggerId:h,contentId:R,focusIntentRef:C,parentList:c,isSubmenu:!!c,closeSelf:L,closeTree:S,focusTrigger:H}),[y,a,r,L,S,l,i,c,u,T,o,s,I,h,R,H]);return _(nt.Provider,{value:m,children:d})}function jn({asChild:e=!1,disabled:t=!1,className:n,children:o}){let{open:a,setOpen:s,toggleOpen:r,triggerRef:l,contentRole:u,triggerId:i,contentId:d,focusIntentRef:c,isSubmenu:g}=Ae("DropdownMenu.Trigger"),p=Wn.only(o),f=p.props??{},y=typeof f.className=="string"?f.className:void 0,x={id:i,"data-state":a?"open":"closed","aria-expanded":a,"aria-haspopup":u,"aria-controls":a?d:void 0,onClick:ne(f.onClick,b=>{if(t){b.preventDefault();return}c.current="selected",r()}),onKeyDown:ne(f.onKeyDown,b=>{t||(b.key==="ArrowDown"?(b.preventDefault(),c.current="first",s(!0)):b.key==="ArrowUp"?(b.preventDefault(),c.current="last",s(!0)):!g&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c.current="selected",r()))})};return e?qn(p,{...x,ref:rt(l,f.ref),className:J(n,y),type:p.type==="button"?f.type??"button":f.type}):_("button",{ref:l,disabled:t,type:"button",className:J("ui-dropdown-menu__trigger",n),...x,children:p})}function eo({className:e,children:t,style:n,matchTriggerWidth:o=!1,maxHeight:a=320,...s}){let{open:r,setOpen:l,triggerRef:u,contentRef:i,side:d,align:c,sideOffset:g,alignOffset:p,collisionPadding:f,portal:y,contentRole:x,triggerId:b,contentId:C,focusIntentRef:h,parentList:R,isSubmenu:T,closeSelf:L,closeTree:S,focusTrigger:I}=Ae("DropdownMenu.Content"),H=Z([]),[m,P]=ue(null),[B,W]=ue(null),[O,q]=ue(null),[V,Ve]=ue(!1),re=Z(""),G=Z(null),ge=A(v=>(H.current=[...H.current.filter(N=>N.id!==v.id),v],()=>{H.current=H.current.filter(N=>N.id!==v.id)}),[]),k=A(()=>Jn(H.current),[]),Fe=A(v=>{h.current=v},[h]);j(()=>{Ve(!0)},[]);let Zt=he(()=>({role:x,highlightedId:m,setHighlightedId:P,registerItem:ge,getItems:k,requestFocusIntent:Fe,closeTree:S,closeSelf:L,focusTrigger:I,activeSubmenuId:B,setActiveSubmenuId:W,contentRef:i}),[B,L,S,i,x,I,k,m,ge,Fe]);Xn(()=>!r||!V||!u.current||!i.current?void 0:Fn(u.current,i.current,()=>{!u.current||!i.current||zn(u.current,i.current,{placement:Yn(d,c),strategy:"fixed",middleware:[Kn({mainAxis:g,crossAxis:p}),$n({padding:f}),Un({padding:f})]}).then(({x:N,y:w,placement:E})=>{let F=Qn(E);q({top:w,left:N,side:F.side,align:F.align})})}),[c,p,f,i,V,r,d,g,u]),j(()=>{if(!r){P(null),W(null);return}let v=k().filter(w=>!w.disabled);if(v.length===0)return;let N=v[0];h.current==="last"?N=v[v.length-1]:h.current==="selected"&&(N=v.find(w=>w.selected)??v[0]),P(N.id),requestAnimationFrame(()=>{i.current?.focus(),N.ref.current?.scrollIntoView({block:"nearest"})})},[i,h,k,r]),j(()=>{if(!r)return;function v(N){let w=N.target,E=u.current?.contains(w),F=i.current?.contains(w);if(!E&&!F){let z=R?.contentRef.current?.contains(w);if(T&&z){L(),R?.setActiveSubmenuId(null);return}S()}}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[L,S,i,T,r,R,u]),j(()=>{if(r)return()=>{G.current&&clearTimeout(G.current)}},[r]);let X=A(v=>{if(P(v),!v){W(null);return}k().find(w=>w.id===v)?.submenu||W(null)},[k]),Re=A((v,N="first")=>{let w=k().filter(K=>!K.disabled);if(w.length===0)return;let E=w.findIndex(K=>K.id===m);if(E===-1){X(N==="last"?w[w.length-1].id:w[0].id);return}let F=(E+v+w.length)%w.length,z=w[F];X(z.id),z.ref.current?.scrollIntoView({block:"nearest"})},[k,m,X]),ze=A(v=>{let N=v.length===1?v.toLowerCase():"";if(!N)return;G.current&&clearTimeout(G.current),re.current+=N,G.current=setTimeout(()=>{re.current="",G.current=null},350);let w=k().filter(K=>!K.disabled);if(w.length===0)return;let E=w.findIndex(K=>K.id===m),z=(E>=0?[...w.slice(E+1),...w.slice(0,E+1)]:w).find(K=>K.textValue.toLowerCase().startsWith(re.current));z&&(X(z.id),z.ref.current?.scrollIntoView({block:"nearest"}))},[k,m,X]),Jt=A(v=>{let N=k(),w=N.find(E=>E.id===m)??null;switch(v.key){case"ArrowDown":v.preventDefault(),Re(1);break;case"ArrowUp":v.preventDefault(),Re(-1,"last");break;case"Home":v.preventDefault();{let E=N.find(F=>!F.disabled);E&&X(E.id)}break;case"End":v.preventDefault();{let E=N.filter(z=>!z.disabled),F=E[E.length-1];F&&X(F.id)}break;case"Enter":case" ":w&&!w.disabled&&(v.preventDefault(),w.click());break;case"ArrowRight":w?.submenu&&(v.preventDefault(),w.openSubmenu?.());break;case"ArrowLeft":T&&(v.preventDefault(),L(),I(),R?.setActiveSubmenuId(null));break;case"Tab":S();break;case"Escape":v.preventDefault(),L(),I(),T&&R?.setActiveSubmenuId(null);break;default:ze(v.key)}},[L,S,I,k,ze,m,X,T,Re,R]);if(!r||!V)return null;let $e=_(He.Provider,{value:Zt,children:_("div",{ref:i,id:C,role:x,tabIndex:-1,"aria-labelledby":x==="menu"?b:void 0,"data-state":"open","data-side":O?.side??d,"data-align":O?.align??c,className:J("ui-dropdown-menu__content",T&&"ui-dropdown-menu__content--submenu",e),style:{...n,position:"fixed",top:O?.top??0,left:O?.left??0,maxHeight:a,minWidth:o?u.current?.getBoundingClientRect().width:void 0},onKeyDown:Jt,...s,children:t})});return y?Zn($e,document.body):$e}function to({className:e,children:t,...n}){return _("div",{className:J("ui-dropdown-menu__group",e),...n,children:t})}function no({className:e,children:t,...n}){return _("div",{className:J("ui-dropdown-menu__label",e),...n,children:t})}function oo({className:e,...t}){return _("div",{role:"separator",className:J("ui-dropdown-menu__separator",e),...t})}function ro({className:e,children:t,inset:n=!1,disabled:o=!1,selected:a=!1,destructive:s=!1,closeOnSelect:r=!0,shortcut:l,indicator:u,onSelect:i,onMouseEnter:d,onClick:c,...g}){let p=ve(),f=Z(null),{role:y,highlightedId:x,setHighlightedId:b,registerItem:C,closeTree:h,setActiveSubmenuId:R}=ot("DropdownMenu.Item"),T=he(()=>xe(t),[t]),L=x===p,S=A(()=>{o||(i?.(),r&&h())},[r,h,o,i]);return j(()=>C({id:p,ref:f,disabled:o,submenu:!1,selected:a,textValue:T,closeOnSelect:r,click:S}),[r,o,S,p,C,a,T]),it("button",{ref:f,id:p,type:"button",role:y==="listbox"?"option":"menuitem",tabIndex:-1,disabled:o,"aria-selected":y==="listbox"?a:void 0,"data-highlighted":L||void 0,"data-selected":a||void 0,"data-disabled":o||void 0,"data-destructive":s||void 0,className:J("ui-dropdown-menu__item",n&&"ui-dropdown-menu__item--inset",e),onMouseEnter:ne(d,()=>{o||(b(p),R(null))}),onClick:ne(c,I=>{I.preventDefault(),S()}),...g,children:[_("span",{className:"ui-dropdown-menu__item-main",children:t}),l?_("span",{className:"ui-dropdown-menu__shortcut",children:l}):null,a?_("span",{className:"ui-dropdown-menu__indicator",children:u??"\u2713"}):null]})}function so(e){return _(st,{side:"right",align:"start",sideOffset:6,...e,contentRole:"menu"})}function io({className:e,children:t,inset:n=!1,disabled:o=!1,destructive:a=!1,shortcut:s,onSelect:r,onMouseEnter:l,onClick:u,...i}){let d=ve(),c=Z(null),g=Ae("DropdownMenu.SubTrigger"),{highlightedId:p,setHighlightedId:f,registerItem:y,setActiveSubmenuId:x,activeSubmenuId:b}=ot("DropdownMenu.SubTrigger"),C=he(()=>xe(t),[t]),h=p===d,R=g.open&&b===d,T=A(()=>{o||(g.focusIntentRef.current="first",f(d),x(d),g.setOpen(!0))},[o,d,x,f,g]);return j(()=>y({id:d,ref:c,disabled:o,submenu:!0,selected:!1,textValue:C,closeOnSelect:!1,click:T,openSubmenu:T}),[o,d,T,y,C]),j(()=>{b!==d&&g.open&&g.setOpen(!1)},[b,d,g]),it("button",{ref:rt(c,g.triggerRef),id:g.triggerId,type:"button",role:"menuitem",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":g.open,"aria-controls":g.open?g.contentId:void 0,"data-highlighted":h||void 0,"data-state":R?"open":"closed","data-disabled":o||void 0,"data-destructive":a||void 0,className:J("ui-dropdown-menu__item ui-dropdown-menu__sub-trigger",n&&"ui-dropdown-menu__item--inset",e),onMouseEnter:ne(l,()=>{T()}),onClick:ne(u,L=>{L.preventDefault(),T(),r?.()}),...i,children:[_("span",{className:"ui-dropdown-menu__item-main",children:t}),s?_("span",{className:"ui-dropdown-menu__shortcut",children:s}):null,_("span",{className:"ui-dropdown-menu__submenu-indicator","aria-hidden":"true",children:"\u203A"})]})}var ao=Object.assign(st,{Trigger:jn,Content:eo,Group:to,Label:no,Item:ro,Separator:oo,Submenu:so,SubTrigger:io}),lo=ao;import{clsx as at}from"clsx";import{Fragment as uo,jsx as lt,jsxs as co}from"react/jsx-runtime";function ut({as:e="aside",open:t,children:n,side:o="right",position:a="fixed",showBackdrop:s=!0,onClose:r,closeLabel:l="\u5173\u95ED\u62BD\u5C49",backdropClassName:u,className:i,...d}){let c=o==="left"?"-translate-x-full":"translate-x-full",g=o==="left"?"left-0 top-0":"right-0 top-0",p=a==="fixed"?"fixed":"absolute";return co(uo,{children:[s&&t&&r&&lt("button",{type:"button","aria-label":l,"data-state":"open",className:at("ui-drawer-backdrop inset-0 z-10",p,u),onClick:r}),lt(e,{"aria-hidden":!t,"data-state":t?"open":"closed","data-side":o,className:at("ui-drawer",p,g,"z-20 flex max-w-full transform flex-col transition-transform duration-200 ease-in-out",t?"pointer-events-auto visible translate-x-0":`pointer-events-none invisible ${c}`,i),...d,children:n})]})}import{clsx as po}from"clsx";import{jsx as ct,jsxs as fo}from"react/jsx-runtime";function dt({label:e,help:t,htmlFor:n,children:o,className:a,...s}){return fo("div",{className:po("ui-field block",a),...s,children:[ct("label",{htmlFor:n,className:"ui-field__label mb-1 block text-xs",children:e}),o,t?ct("span",{className:"ui-field__help mt-1 block text-xs",children:t}):null]})}import{clsx as mo}from"clsx";import{jsx as pt}from"react/jsx-runtime";function ft({variant:e="ghost",size:t="md",label:n,icon:o,className:a,...s}){let r=mo("ui-icon-button","inline-flex items-center justify-center rounded-md transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",t==="sm"?"h-7 w-7":"h-8 w-8",a);if("href"in s&&s.href){let{href:u,...i}=s;return pt("a",{href:u,"aria-label":n,title:i.title??n,"data-variant":e,"data-size":t,className:r,...i,children:o})}let l=s;return pt("button",{type:l.type??"button","aria-label":n,title:l.title??n,"data-variant":e,"data-size":t,className:r,...l,children:o})}import{clsx as go}from"clsx";import{jsx as mt}from"react/jsx-runtime";function Te(e){return go("ui-input w-full rounded-lg px-3 py-2 text-sm placeholder:text-[var(--field-placeholder)] focus:outline-none focus:ring-1",e)}function gt(e){let{className:t,tone:n="default",...o}=e;return e.as==="textarea"?mt("textarea",{"data-tone":n,className:Te(t),...o}):mt("input",{"data-tone":n,className:Te(t),...o})}import{clsx as ye}from"clsx";import{jsx as we}from"react/jsx-runtime";function bo(e){switch(e){case"none":return"";case"sm":return"p-4";case"lg":return"p-6";default:return"p-5"}}function bt({as:e="section",variant:t="default",padding:n="none",className:o,children:a,...s}){return we(e,{"data-variant":t,className:ye("ui-panel rounded-lg border",bo(n),o),...s,children:a})}function vo({className:e,children:t,...n}){return we("div",{className:ye("ui-panel-header border-b px-6 py-5",e),...n,children:t})}function xo({className:e,children:t,...n}){return we("div",{className:ye("px-6 py-5",e),...n,children:t})}function ho({className:e,children:t,...n}){return we("div",{className:ye("ui-panel-footer border-t px-6 py-4",e),...n,children:t})}import{clsx as vt}from"clsx";import{jsx as xt}from"react/jsx-runtime";function ht({value:e,onChange:t,options:n,size:o="sm",className:a,ariaLabel:s}){return xt("div",{role:"tablist","aria-label":s,className:vt("ui-segmented-control inline-flex rounded-md p-0.5 ring-1",o==="sm"?"text-xs":"text-sm",a),children:n.map(r=>{let l=r.value===e;return xt("button",{type:"button",role:"tab","aria-selected":l,disabled:r.disabled,"data-active":l?"true":void 0,className:vt("ui-segmented-control__item rounded font-medium transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",o==="sm"?"px-2.5 py-1":"px-3 py-1.5"),onClick:()=>t(r.value),children:r.label},r.value)})})}import{clsx as oe}from"clsx";import{useCallback as _e,useEffect as Tt,useId as To,useMemo as yo,useRef as yt,useState as wt}from"react";import{jsx as ce,jsxs as Mt}from"react/jsx-runtime";function Pt({value:e,onChange:t,options:n,placeholder:o="Select\u2026",size:a="md",tone:s="default",disabled:r=!1,className:l,ariaLabel:u,renderValue:i,renderOption:d}){let[c,g]=wt(!1),[p,f]=wt(-1),y=yt(null),x=yt(null),b=To(),C=n.find(m=>m.value===e),h=yo(()=>n.reduce((m,P,B)=>(P.disabled||m.push(B),m),[]),[n]),R=_e(()=>{if(r||n.length===0)return;g(!0);let m=n.findIndex(P=>P.value===e);f(m>=0?m:h[0]??-1)},[r,n,e,h]),T=_e(()=>{g(!1),f(-1)},[]),L=_e(m=>{m.disabled||(t(m.value),T())},[t,T]);Tt(()=>{if(!c)return;function m(P){y.current&&!y.current.contains(P.target)&&T()}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[c,T]),Tt(()=>{if(!c||p<0)return;x.current?.children[p]?.scrollIntoView({block:"nearest"})},[c,p]);function S(m){if(!r)switch(m.key){case"Enter":case" ":{m.preventDefault(),c?p>=0&&n[p]&&!n[p].disabled&&L(n[p]):R();break}case"ArrowDown":{if(m.preventDefault(),!c)R();else{let P=h.indexOf(p),B=h[P+1];B!==void 0&&f(B)}break}case"ArrowUp":{if(m.preventDefault(),!c)R();else{let P=h.indexOf(p),B=h[P-1];B!==void 0&&f(B)}break}case"Escape":{c&&(m.preventDefault(),T());break}case"Tab":{c&&T();break}}}let I=e!==""&&C,H=i?i({open:c,placeholder:o,selectedOption:C}):ce("span",{className:oe("truncate",!I&&"ui-select__placeholder"),children:I?C.label:o});return Mt("div",{ref:y,"data-state":c?"open":"closed","data-disabled":r||void 0,"data-size":a,"data-tone":s,className:oe("ui-select relative inline-block",l),children:[Mt("button",{type:"button",role:"combobox","aria-expanded":c,"aria-haspopup":"listbox","aria-controls":b,"aria-label":u,"aria-activedescendant":c&&p>=0?`${b}-opt-${p}`:void 0,"data-state":c?"open":"closed","data-disabled":r||void 0,"data-tone":s,"data-size":a,"data-open":c||void 0,"data-has-value":I||void 0,disabled:r,className:oe("ui-select__trigger flex w-full items-center justify-between gap-2 rounded-lg text-left transition-colors focus:outline-none",a==="sm"?"min-h-7 px-2 py-1 text-xs":"min-h-9 px-3 py-2 text-sm"),onClick:()=>c?T():R(),onKeyDown:S,children:[H,ce("svg",{"aria-hidden":"true",className:oe("ui-select__chevron h-3.5 w-3.5 shrink-0 transition-transform",c&&"rotate-180"),viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:ce("path",{d:"M4 6l4 4 4-4"})})]}),c&&ce("ul",{ref:x,id:b,role:"listbox","aria-label":u,"data-state":"open",className:oe("ui-select__dropdown absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg py-1 ring-1",a==="sm"?"text-xs":"text-sm"),children:n.map((m,P)=>ce("li",{id:`${b}-opt-${P}`,role:"option","aria-selected":m.value===e,"aria-disabled":m.disabled||void 0,"data-state":m.value===e?"selected":P===p?"highlighted":"idle","data-focused":P===p||void 0,"data-selected":m.value===e||void 0,"data-disabled":m.disabled||void 0,"data-highlighted":P===p||void 0,className:oe("ui-select__option cursor-default select-none px-3 py-1.5 transition-colors",m.disabled&&"cursor-not-allowed opacity-50"),onClick:()=>L(m),onMouseEnter:()=>!m.disabled&&f(P),children:d?d({option:m,index:P,selected:m.value===e,highlighted:P===p}):m.label},m.value))})]})}import{clsx as wo}from"clsx";import{jsx as Po}from"react/jsx-runtime";var Mo={slow:"4s",default:"3s",fast:"2s"};function Ct({className:e,animation:t="scan",tone:n="default",speed:o="default",style:a,...s}){let r=n==="warm"?"emphasis":n,l={...a,"--ui-skeleton-scan-duration":Mo[o]};return Po("div",{className:wo("ui-skeleton rounded",e),"data-animation":t,"data-tone":r,"aria-hidden":"true",style:l,...s})}import{clsx as St}from"clsx";import{Fragment as Nt,jsx as U,jsxs as Me}from"react/jsx-runtime";function Rt({tone:e="neutral",layout:t="horizontal",icon:n,title:o,description:a,action:s,className:r,children:l,...u}){if(t==="vertical"){let i=n||o||a||s;return U("div",{"data-tone":e,"data-layout":"vertical",className:St("ui-status-notice rounded-lg border px-4 py-3 text-sm",r),...u,children:i?Me("div",{className:"flex flex-col items-center gap-2 py-4 text-center",children:[n&&U("div",{className:"ui-status-notice__icon text-lg",children:n}),o&&U("div",{className:"ui-status-notice__title font-medium",children:o}),a&&U("div",{className:"ui-status-notice__description",children:a}),s&&U("div",{className:"mt-2",children:s})]}):l})}return U("div",{"data-tone":e,className:St("ui-status-notice rounded-md border px-4 py-3 text-sm",n&&"ui-status-notice--with-icon grid grid-cols-[auto_minmax(0,1fr)] gap-3",r),...u,children:n?Me(Nt,{children:[U("span",{className:"ui-status-notice__icon mt-0.5 shrink-0","aria-hidden":"true",children:n}),Me("div",{className:"min-w-0",children:[o&&U("div",{className:"ui-status-notice__title font-medium",children:o}),l]})]}):Me(Nt,{children:[o&&U("div",{className:"ui-status-notice__title font-medium",children:o}),l]})})}import{clsx as Lt}from"clsx";import{jsx as It}from"react/jsx-runtime";var Co={sm:"h-5 w-9",md:"h-6 w-11"},So={sm:"h-3.5 w-3.5",md:"h-4.5 w-4.5"},No={sm:"translate-x-4",md:"translate-x-5"};function Et({checked:e,onChange:t,size:n="md",disabled:o=!1,className:a,ariaLabel:s}){return It("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,disabled:o,"data-size":n,className:Lt("ui-switch relative inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",Co[n],o&&"cursor-not-allowed opacity-50",a),onClick:()=>t(!e),children:It("span",{"aria-hidden":"true",className:Lt("ui-switch__thumb pointer-events-none inline-block rounded-full bg-white shadow transition-transform",So[n],e?No[n]:"translate-x-0.5")})})}import{clsx as Ce}from"clsx";import{createContext as Ro,useContext as Lo,useId as Io,useMemo as Eo,useState as Do}from"react";import{jsx as de}from"react/jsx-runtime";var Dt=Ro(null);function kt(e){let t=Lo(Dt);if(!t)throw new Error(`${e} must be used within Tabs.Root`);return t}function Pe(e){return e.replace(/[^a-zA-Z0-9_-]+/g,"-")}function ko({value:e,defaultValue:t,onValueChange:n}){let[o,a]=Do(t??""),s=e!==void 0,r=s?e:o;function l(u){s||a(u),n?.(u)}return[r,l]}function Be({children:e,value:t,defaultValue:n,onValueChange:o,className:a,...s}){let[r,l]=ko({value:t,defaultValue:n,onValueChange:o}),u=Io(),i=Eo(()=>({value:r,setValue:l,baseId:u}),[u,r,l]);return de(Dt.Provider,{value:i,children:de("div",{className:Ce("ui-tabs",a),...s,children:e})})}function Ht({children:e,className:t,ariaLabel:n,...o}){return de("div",{role:"tablist","aria-label":n,className:Ce("ui-tabs__list flex items-end gap-1 border-b",t),...o,children:e})}function At({children:e,className:t,value:n,disabled:o,onClick:a,onKeyDown:s,...r}){let{value:l,setValue:u,baseId:i}=kt("Tabs.Trigger"),d=l===n,c=`${i}-trigger-${Pe(n)}`,g=`${i}-panel-${Pe(n)}`;function p(f,y){let x=f.closest('[role="tablist"]');if(!x)return;let b=Array.from(x.querySelectorAll('[role="tab"]:not([disabled])')),C=b.indexOf(f);if(C<0)return;let h;y==="first"&&(h=b[0]),y==="last"&&(h=b[b.length-1]),y==="next"&&(h=b[(C+1)%b.length]),y==="prev"&&(h=b[(C-1+b.length)%b.length]),h&&(h.focus(),h.click())}return de("button",{type:"button",id:c,role:"tab","aria-selected":d,"aria-controls":g,tabIndex:d?0:-1,"data-state":d?"active":"inactive",disabled:o,className:Ce("ui-tabs__trigger relative -mb-px inline-flex min-h-9 items-center justify-center rounded-t-md border-b-2 px-3 py-2 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",t),onClick:f=>{a?.(f),!f.defaultPrevented&&!o&&u(n)},onKeyDown:f=>{if(s?.(f),f.defaultPrevented||o)return;let y=f.currentTarget;switch(f.key){case"ArrowRight":f.preventDefault(),p(y,"next");break;case"ArrowLeft":f.preventDefault(),p(y,"prev");break;case"Home":f.preventDefault(),p(y,"first");break;case"End":f.preventDefault(),p(y,"last");break}},...r,children:e})}function _t({children:e,className:t,value:n,...o}){let{value:a,baseId:s}=kt("Tabs.Content"),r=a===n,l=`${s}-trigger-${Pe(n)}`,u=`${s}-panel-${Pe(n)}`;return r?de("div",{id:u,role:"tabpanel","aria-labelledby":l,"data-state":"active",className:Ce("ui-tabs__content pt-4",t),...o,children:e}):null}var Ho=Object.assign(Be,{Root:Be,List:Ht,Trigger:At,Content:_t}),Ao=Ho;import{useCallback as _o,useEffect as Bo,useRef as Oo}from"react";import{jsx as Vo}from"react/jsx-runtime";function Bt({className:e,tone:t="default",resize:n="vertical",autoResize:o=!1,style:a,onInput:s,rows:r=3,...l}){let u=Oo(null),i=s,d=_o(()=>{if(!o||!u.current)return;let p=u.current;p.style.height="auto",p.style.height=`${p.scrollHeight}px`},[o]);Bo(()=>{d()},[d,l.value,l.defaultValue,r]);function c(p){d(),i?.(p)}let g={...a,resize:o?"none":n};return Vo("textarea",{...l,ref:u,rows:r,"data-tone":t,"data-auto-resize":o||void 0,className:Te(`ui-textarea ${e??""}`),style:g,onInput:c})}import{clsx as Ot}from"clsx";import{createContext as Fo,useCallback as Vt,useContext as zo,useMemo as $o,useRef as Ft,useState as Ko}from"react";import{jsx as D,jsxs as pe}from"react/jsx-runtime";var $t=Fo(null),Oe=5,zt=4e3;function Uo(){let e=zo($t);if(!e)throw new Error("useToast must be used within <ToastProvider>");return e}function Wo({tone:e}){let t={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"success":return D("svg",{...t,children:D("path",{d:"M3.5 8.5l3 3 6-7"})});case"warning":return pe("svg",{...t,children:[D("path",{d:"M8 5v4"}),D("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor",stroke:"none"})]});case"danger":return D("svg",{...t,children:D("path",{d:"M4.5 4.5l7 7M11.5 4.5l-7 7"})});case"info":return pe("svg",{...t,children:[D("circle",{cx:"8",cy:"3.5",r:"1.2",fill:"currentColor",stroke:"none"}),D("path",{d:"M8 7v5.5"})]})}}function qo(e,t){return typeof e=="string"?{message:e,duration:t??zt}:{title:e.title,message:e.message,duration:e.duration??t??zt}}function Go({item:e,onDismiss:t,renderToast:n}){let o=()=>t(e.id),a=D(Wo,{tone:e.tone});return n?D("div",{role:"status","aria-live":"polite","data-state":"open","data-tone":e.tone,className:Ot("ui-toast pointer-events-auto rounded-lg border text-sm backdrop-blur-sm","animate-[toast-in_0.25s_var(--ease-standard)]"),children:n({item:e,dismiss:o,icon:a})}):pe("div",{role:"status","aria-live":"polite","data-state":"open","data-tone":e.tone,className:Ot("ui-toast pointer-events-auto flex items-start gap-2 rounded-lg border px-4 py-3 text-sm backdrop-blur-sm","animate-[toast-in_0.25s_var(--ease-standard)]"),children:[D("span",{className:"ui-toast__icon mt-0.5 shrink-0","aria-hidden":"true",children:a}),pe("span",{className:"min-w-0 flex-1",children:[e.title?D("span",{className:"ui-toast__title block font-medium",children:e.title}):null,D("span",{className:"block",children:e.message})]}),D("button",{type:"button",onClick:o,className:"ui-toast__close -mr-1 -mt-0.5 shrink-0 rounded p-0.5 text-current opacity-50 transition-opacity hover:opacity-100","aria-label":"Dismiss",children:D("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:D("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function Xo({children:e,renderToast:t}){let[n,o]=Ko([]),a=Ft(0),s=Ft(new Map),r=Vt(i=>{let d=s.current.get(i);d&&clearTimeout(d),s.current.delete(i),o(c=>c.filter(g=>g.id!==i))},[]),l=Vt((i,d,c)=>{let g=a.current++,p=qo(d,c),f={id:g,tone:i,...p};o(y=>{let x=[...y,f];if(x.length>Oe){let b=x.slice(0,x.length-Oe);for(let C of b){let h=s.current.get(C.id);h&&clearTimeout(h),s.current.delete(C.id)}return x.slice(-Oe)}return x}),f.duration>0&&s.current.set(g,setTimeout(()=>r(g),f.duration))},[r]),u=$o(()=>({success:(i,d)=>l("success",i,d),warning:(i,d)=>l("warning",i,d),danger:(i,d)=>l("danger",i,d),info:(i,d)=>l("info",i,d)}),[l]);return pe($t.Provider,{value:u,children:[e,D("div",{"aria-label":"Notifications","data-state":n.length>0?"open":"closed",className:"pointer-events-none fixed bottom-4 right-4 z-[9999] flex flex-col-reverse gap-2",children:n.map(i=>D(Go,{item:i,onDismiss:r,renderToast:t},i.id))})]})}import{clsx as Zo}from"clsx";import{autoUpdate as Jo,computePosition as Yo,flip as Qo,offset as jo,shift as er,arrow as tr}from"@floating-ui/dom";import{useCallback as ee,useEffect as Kt,useId as nr,useLayoutEffect as or,useRef as fe,useState as Se}from"react";import{createPortal as rr}from"react-dom";import{Fragment as ar,jsx as Ne,jsxs as Gt}from"react/jsx-runtime";var me=6,Ut=8,Wt=4,sr={compact:"px-2 py-1 text-[11px] max-w-[200px]",default:"px-3 py-2 text-xs max-w-xs"};function ir(e){return e.split("-")[0]}var qt={top:"",bottom:"rotate(180deg)",left:"rotate(-90deg)",right:"rotate(90deg)"};function Xt({content:e,placement:t="top",density:n="default",showDelay:o=300,hideDelay:a=150,arrow:s=!0,renderArrow:r,className:l,children:u}){let[i,d]=Se(!1),[c,g]=Se(null),[p,f]=Se(t),[y,x]=Se({}),b=fe(null),C=fe(null),h=fe(null),R=fe(void 0),T=fe(void 0),L=nr(),S=ee(()=>{clearTimeout(R.current),clearTimeout(T.current)},[]),I=ee(()=>{S(),R.current=setTimeout(()=>d(!0),o)},[S,o]),H=ee(()=>{S(),d(!0)},[S]),m=ee(()=>{S(),T.current=setTimeout(()=>d(!1),a)},[S,a]),P=ee(V=>{if(V.target===b.current){I();return}H()},[I,H]),B=ee(V=>{V.pointerType!=="mouse"&&H()},[H]),W=ee(V=>{V.key==="Escape"&&i&&d(!1)},[i]);or(()=>{if(!i||!b.current||!C.current)return;let V=[jo(s?Ut+me:Ut),Qo({padding:Wt}),er({padding:Wt})];return s&&h.current&&V.push(tr({element:h.current})),Jo(b.current,C.current,()=>{!b.current||!C.current||Yo(b.current,C.current,{placement:t,strategy:"fixed",middleware:V}).then(({x:re,y:G,placement:ge,middlewareData:k})=>{g({top:G,left:re}),f(ir(ge)),k.arrow&&x({x:k.arrow.x,y:k.arrow.y})})})},[i,t,s]),Kt(()=>{if(i)return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[i,W]),Kt(()=>S,[S]);let O={position:"absolute"},q=p;return q==="top"||q==="bottom"?(O.left=y.x??0,O[q==="top"?"bottom":"top"]=-me,O.transform=qt[q]||void 0):(O.top=y.y??0,O[q==="left"?"right":"left"]=-me,O.transform=qt[q]),Gt(ar,{children:[Ne("span",{ref:b,"data-state":i?"open":"closed",className:"ui-tooltip-trigger inline-flex",onMouseEnter:I,onMouseLeave:m,onFocus:P,onBlur:m,onPointerDown:B,"aria-describedby":i?L:void 0,children:u}),i&&rr(Gt("div",{ref:C,id:L,role:"tooltip","data-state":i?"open":"closed","data-placement":p,"data-density":n,className:Zo("ui-tooltip fixed z-[9999] rounded-lg leading-relaxed",sr[n],"animate-[tooltip-in_0.15s_var(--ease-standard)]",l),style:c?{top:c.top,left:c.left}:{visibility:"hidden"},onMouseEnter:I,onMouseLeave:m,children:[e,s&&Ne("span",{ref:h,className:"ui-tooltip__arrow absolute",style:O,children:r?r({placement:p}):Ne("svg",{width:me*2,height:me,viewBox:"0 0 12 6",children:Ne("path",{d:"M0 0l6 6 6-6z",fill:"currentColor"})})})]}),document.body)]})}export{Ke as Avatar,Ue as Badge,se as Button,Sn as Collapsible,Ye as CollapsibleContent,Ie as CollapsibleRoot,Je as CollapsibleTrigger,On as ConfirmProvider,$ as Dialog,ut as Drawer,lo as DropdownMenu,dt as Field,ft as IconButton,gt as Input,bt as Panel,xo as PanelBody,ho as PanelFooter,vo as PanelHeader,ht as SegmentedControl,Pt as Select,Ct as Skeleton,be as Spinner,Rt as StatusNotice,Et as Switch,Ao as Tabs,_t as TabsContent,Ht as TabsList,Be as TabsRoot,At as TabsTrigger,Bt as Textarea,Xo as ToastProvider,Xt as Tooltip,We as buttonClassName,Bn as useConfirm,Uo as useToast};
@@ -92,13 +92,7 @@ const catalog = {
92
92
  "group": "feedback",
93
93
  "componentId": "status-notice",
94
94
  "componentName": "StatusNotice",
95
- "description": "Block-level feedback banner. Supports neutral plus semantic tones, with optional icon slot."
96
- },
97
- {
98
- "group": "feedback",
99
- "componentId": "empty-state",
100
- "componentName": "EmptyState",
101
- "description": "Placeholder for empty lists or missing content. Token-driven: --empty-state-bg, --empty-state-border, --empty-state-title, --empty-state-text, --empty-state-icon."
95
+ "description": "Block-level feedback banner. Supports horizontal (default) and vertical layouts, with optional icon, title, description, and action slots."
102
96
  },
103
97
  {
104
98
  "group": "feedback",
@@ -92,13 +92,7 @@
92
92
  "group": "feedback",
93
93
  "componentId": "status-notice",
94
94
  "componentName": "StatusNotice",
95
- "description": "Block-level feedback banner. Supports neutral plus semantic tones, with optional icon slot."
96
- },
97
- {
98
- "group": "feedback",
99
- "componentId": "empty-state",
100
- "componentName": "EmptyState",
101
- "description": "Placeholder for empty lists or missing content. Token-driven: --empty-state-bg, --empty-state-border, --empty-state-title, --empty-state-text, --empty-state-icon."
95
+ "description": "Block-level feedback banner. Supports horizontal (default) and vertical layouts, with optional icon, title, description, and action slots."
102
96
  },
103
97
  {
104
98
  "group": "feedback",
@@ -20,6 +20,7 @@ interface ComponentStoriesDefinition {
20
20
  componentName: string;
21
21
  description?: string;
22
22
  props?: PropSummary[];
23
+ defaultScale?: number;
23
24
  renderPlayground?: (props: Record<string, unknown>, update: (name: string, value: unknown) => void) => ReactNode;
24
25
  stories: StoryDefinition[];
25
26
  }