@owodesign/owoui 0.1.1 → 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
@@ -9,6 +9,16 @@ import '@owodesign/owoui/style.css';
9
9
  import { Button, Dialog, Select } from '@owodesign/owoui';
10
10
  ```
11
11
 
12
+ `style.css` ships the component bundle and defaults to the same token values as `theme-light + preset-default`.
13
+
14
+ To opt into another combination:
15
+
16
+ ```tsx
17
+ import '@owodesign/owoui/style.css';
18
+ import '@owodesign/owoui/theme-dark.css';
19
+ import '@owodesign/owoui/preset-glass.css';
20
+ ```
21
+
12
22
  This package ships:
13
23
 
14
24
  - reusable React UI primitives
@@ -31,15 +41,22 @@ import '@owodesign/owoui/tokens.css';
31
41
  For programmatic token metadata:
32
42
 
33
43
  ```ts
34
- import { tokenGroups, semanticTokenKeys, presetNames } from '@owodesign/owoui/tokens';
44
+ import { tokenGroups, semanticTokenKeys, themeNames, presetNames } from '@owodesign/owoui/tokens';
35
45
  ```
36
46
 
47
+ ## Themes
48
+
49
+ - `@owodesign/owoui/theme-light.css`
50
+ - `@owodesign/owoui/theme-dark.css`
51
+
37
52
  ## Presets
38
53
 
39
- - `@owodesign/owoui/style.css`: default preset
40
- - `@owodesign/owoui/flat.css`: explicit flat preset alias
41
- - `@owodesign/owoui/elevated.css`: elevated preset with stronger surfaces and shadows
42
- - `@owodesign/owoui/glass.css`: glass preset with translucent surfaces and stronger blur
54
+ - `@owodesign/owoui/preset-default.css`: Signature Look based on qblog's current default preset qualities
55
+ - `@owodesign/owoui/preset-flat.css`: low-depth preset with minimal shadows
56
+ - `@owodesign/owoui/preset-elevated.css`: stronger depth and larger radii
57
+ - `@owodesign/owoui/preset-glass.css`: translucent surfaces with blur
58
+
59
+ There is no backward-compat alias layer for the previous `dark.css` / `flat.css` / `elevated.css` / `glass.css` entrypoints.
43
60
 
44
61
  ## Storybook Artifact
45
62
 
@@ -57,6 +74,16 @@ For host apps that prefer a static navigation/catalog artifact, `owoui` also shi
57
74
  import storybookCatalog from '@owodesign/owoui/storybook/catalog';
58
75
  ```
59
76
 
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
+
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
+
60
87
  ## Release Checks
61
88
 
62
89
  From the repo root:
package/dist/index.d.ts CHANGED
@@ -45,6 +45,27 @@ type ButtonProps = ButtonElementProps | LinkElementProps;
45
45
  declare function buttonClassName({ variant, size, loading, className, }: Pick<ButtonProps, 'variant' | 'size' | 'loading' | 'className'>): string;
46
46
  declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
47
47
 
48
+ interface CollapsibleRootProps extends HTMLAttributes<HTMLDivElement> {
49
+ children: ReactNode;
50
+ open?: boolean;
51
+ defaultOpen?: boolean;
52
+ onOpenChange?: (open: boolean) => void;
53
+ }
54
+ declare function CollapsibleRoot({ children, open, defaultOpen, onOpenChange, className, ...props }: CollapsibleRootProps): react_jsx_runtime.JSX.Element;
55
+ interface CollapsibleTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
56
+ children: ReactNode;
57
+ }
58
+ declare function CollapsibleTrigger({ children, className, onClick, ...props }: CollapsibleTriggerProps): react_jsx_runtime.JSX.Element;
59
+ interface CollapsibleContentProps extends HTMLAttributes<HTMLDivElement> {
60
+ children: ReactNode;
61
+ }
62
+ declare function CollapsibleContent({ children, className, ...props }: CollapsibleContentProps): react_jsx_runtime.JSX.Element | null;
63
+ declare const Collapsible: typeof CollapsibleRoot & {
64
+ Root: typeof CollapsibleRoot;
65
+ Trigger: typeof CollapsibleTrigger;
66
+ Content: typeof CollapsibleContent;
67
+ };
68
+
48
69
  type ConfirmVariant = 'primary' | 'danger';
49
70
  interface ConfirmOptions {
50
71
  title: string;
@@ -163,17 +184,6 @@ interface DrawerProps extends HTMLAttributes<HTMLElement> {
163
184
  }
164
185
  declare function Drawer({ as: Component, open, children, side, position, showBackdrop, onClose, closeLabel, backdropClassName, className, ...props }: DrawerProps): react_jsx_runtime.JSX.Element;
165
186
 
166
- type EmptyStateTone = 'neutral' | 'notice' | 'warning';
167
- interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
168
- tone?: EmptyStateTone;
169
- icon?: ReactNode;
170
- title?: ReactNode;
171
- description?: ReactNode;
172
- action?: ReactNode;
173
- children?: ReactNode;
174
- }
175
- declare function EmptyState({ tone, icon, title, description, action, className, children, ...props }: EmptyStateProps): react_jsx_runtime.JSX.Element;
176
-
177
187
  interface FieldProps extends HTMLAttributes<HTMLDivElement> {
178
188
  label: ReactNode;
179
189
  help?: ReactNode;
@@ -207,10 +217,10 @@ type InputBaseProps = {
207
217
  type TextInputProps = InputBaseProps & InputHTMLAttributes<HTMLInputElement> & {
208
218
  as?: 'input';
209
219
  };
210
- type TextareaProps = InputBaseProps & TextareaHTMLAttributes<HTMLTextAreaElement> & {
220
+ type TextareaProps$1 = InputBaseProps & TextareaHTMLAttributes<HTMLTextAreaElement> & {
211
221
  as: 'textarea';
212
222
  };
213
- type InputProps = TextInputProps | TextareaProps;
223
+ type InputProps = TextInputProps | TextareaProps$1;
214
224
  declare function Input(props: InputProps): react_jsx_runtime.JSX.Element;
215
225
 
216
226
  type PanelVariant = 'default' | 'subtle' | 'raised';
@@ -296,12 +306,17 @@ interface SpinnerProps {
296
306
  declare function Spinner({ variant, size, className, label }: SpinnerProps): react_jsx_runtime.JSX.Element;
297
307
 
298
308
  type StatusNoticeTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
299
- interface StatusNoticeProps extends HTMLAttributes<HTMLDivElement> {
309
+ type StatusNoticeLayout = 'horizontal' | 'vertical';
310
+ interface StatusNoticeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
300
311
  tone?: StatusNoticeTone;
312
+ layout?: StatusNoticeLayout;
301
313
  icon?: ReactNode;
302
- children: ReactNode;
314
+ title?: ReactNode;
315
+ description?: ReactNode;
316
+ action?: ReactNode;
317
+ children?: ReactNode;
303
318
  }
304
- 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;
305
320
 
306
321
  type SwitchSize = 'sm' | 'md';
307
322
  interface SwitchProps {
@@ -314,6 +329,43 @@ interface SwitchProps {
314
329
  }
315
330
  declare function Switch({ checked, onChange, size, disabled, className, ariaLabel, }: SwitchProps): react_jsx_runtime.JSX.Element;
316
331
 
332
+ interface TabsRootProps extends HTMLAttributes<HTMLDivElement> {
333
+ children: ReactNode;
334
+ value?: string;
335
+ defaultValue?: string;
336
+ onValueChange?: (value: string) => void;
337
+ }
338
+ declare function TabsRoot({ children, value, defaultValue, onValueChange, className, ...props }: TabsRootProps): react_jsx_runtime.JSX.Element;
339
+ interface TabsListProps extends HTMLAttributes<HTMLDivElement> {
340
+ children: ReactNode;
341
+ ariaLabel?: string;
342
+ }
343
+ declare function TabsList({ children, className, ariaLabel, ...props }: TabsListProps): react_jsx_runtime.JSX.Element;
344
+ interface TabsTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
345
+ children: ReactNode;
346
+ value: string;
347
+ }
348
+ declare function TabsTrigger({ children, className, value, disabled, onClick, onKeyDown, ...props }: TabsTriggerProps): react_jsx_runtime.JSX.Element;
349
+ interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {
350
+ children: ReactNode;
351
+ value: string;
352
+ }
353
+ declare function TabsContent({ children, className, value, ...props }: TabsContentProps): react_jsx_runtime.JSX.Element | null;
354
+ declare const Tabs: typeof TabsRoot & {
355
+ Root: typeof TabsRoot;
356
+ List: typeof TabsList;
357
+ Trigger: typeof TabsTrigger;
358
+ Content: typeof TabsContent;
359
+ };
360
+
361
+ interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'children'> {
362
+ className?: string;
363
+ tone?: 'default' | 'warning';
364
+ resize?: 'none' | 'vertical' | 'both';
365
+ autoResize?: boolean;
366
+ }
367
+ declare function Textarea({ className, tone, resize, autoResize, style, onInput, rows, ...props }: TextareaProps): react_jsx_runtime.JSX.Element;
368
+
317
369
  type ToastTone = 'success' | 'warning' | 'danger' | 'info';
318
370
  interface ToastInput {
319
371
  title?: string;
@@ -344,21 +396,21 @@ declare function ToastProvider({ children, renderToast, }: {
344
396
  renderToast?: (args: ToastRenderArgs) => ReactNode;
345
397
  }): react_jsx_runtime.JSX.Element;
346
398
 
347
- type Placement = 'top' | 'bottom' | 'left' | 'right';
399
+ type TooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
348
400
  type TooltipDensity = 'compact' | 'default';
349
401
  interface TooltipProps {
350
402
  content: ReactNode;
351
- placement?: Placement;
403
+ placement?: TooltipPlacement;
352
404
  density?: TooltipDensity;
353
405
  showDelay?: number;
354
406
  hideDelay?: number;
355
407
  arrow?: boolean;
356
408
  renderArrow?: (args: {
357
- placement: Placement;
409
+ placement: TooltipPlacement;
358
410
  }) => ReactNode;
359
411
  className?: string;
360
- children: ReactElement;
412
+ children: ReactNode;
361
413
  }
362
414
  declare function Tooltip({ content, placement: preferredPlacement, density, showDelay, hideDelay, arrow, renderArrow, className, children, }: TooltipProps): react_jsx_runtime.JSX.Element;
363
415
 
364
- export { Avatar, Badge, type BadgeProps, Button, type ButtonProps, 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, 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 kt}from"clsx";import{useState as At}from"react";import{jsx as ye}from"react/jsx-runtime";var Ht={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 Bt(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 He({src:e,alt:t,name:n,size:o="md",tone:r="neutral",className:i}){let[s,c]=At(!1),u=e&&!s,a=n?Bt(n):"?";return ye("span",{"data-tone":r,className:kt("ui-avatar inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium select-none",Ht[o],i),children:u?ye("img",{src:e,alt:t??n??"",className:"h-full w-full object-cover",onError:()=>c(!0)}):ye("span",{"aria-label":t??n,children:a})})}import{clsx as _t}from"clsx";import{jsx as Ot}from"react/jsx-runtime";function Be({tone:e="neutral",variant:t="soft",size:n="xs",className:o,children:r,...i}){return Ot("span",{"data-tone":e,"data-variant":t,"data-size":n,className:_t("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),...i,children:r})}import{clsx as Zt}from"clsx";import{clsx as zt}from"clsx";import{jsx as y,jsxs as G}from"react/jsx-runtime";var Ft={xs:12,sm:14,md:16,lg:24};function Vt({px:e}){let n=Math.PI*2*9;return G("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[y("circle",{cx:"12",cy:"12",r:9,stroke:"currentColor",strokeWidth:"3",opacity:"0.2"}),y("circle",{cx:"12",cy:"12",r:9,stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:`${n*.28} ${n*.72}`})]})}function $t({px:e}){return G("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[y("path",{d:"M12 2a10 10 0 0 1 10 10",opacity:"0.9"}),y("path",{d:"M12 2a10 10 0 0 0-7.07 2.93",opacity:"0.2"}),y("path",{d:"M4.93 4.93A10 10 0 0 0 2 12",opacity:"0.2"}),y("path",{d:"M2 12a10 10 0 0 0 2.93 7.07",opacity:"0.2"}),y("path",{d:"M4.93 19.07A10 10 0 0 0 12 22",opacity:"0.2"}),y("path",{d:"M12 22a10 10 0 0 0 7.07-2.93",opacity:"0.2"}),y("path",{d:"M19.07 19.07A10 10 0 0 0 22 12",opacity:"0.2"})]})}function Wt({px:e}){return y("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 y("circle",{cx:"12",cy:"3.5",r:"1.8",fill:"currentColor",opacity:r,transform:`rotate(${o} 12 12)`},n)})})}function Kt({px:e}){return y("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[0,1,2,3].map(t=>G("rect",{x:3+t*5.5,y:"4",width:"3",height:"16",rx:"1.5",fill:"currentColor",opacity:"0.3",children:[y("animate",{attributeName:"opacity",values:"0.3;1;0.3",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"}),y("animate",{attributeName:"height",values:"16;8;16",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"}),y("animate",{attributeName:"y",values:"4;8;4",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"})]},t))})}function Ut({px:e}){let t=e*.14,n=e*.33,o=e/2-n,r=e/2,i=e/2+n,s=e/2;return y("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[o,r,i].map((c,u)=>G("circle",{cx:c,cy:s,r:t,fill:"currentColor",opacity:"0.4",children:[y("animate",{attributeName:"cy",values:`${s};${s-e*.25};${s}`,dur:"0.6s",begin:`${u*.12}s`,repeatCount:"indefinite",calcMode:"spline",keySplines:"0.4 0 0.2 1;0.4 0 0.2 1"}),y("animate",{attributeName:"opacity",values:"0.4;1;0.4",dur:"0.6s",begin:`${u*.12}s`,repeatCount:"indefinite"})]},u))})}function Gt({px:e}){return G("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[G("circle",{cx:"12",cy:"12",r:"0",fill:"currentColor",opacity:"0",children:[y("animate",{attributeName:"r",values:"4;10;4",dur:"1.2s",repeatCount:"indefinite"}),y("animate",{attributeName:"opacity",values:"0.8;0.1;0.8",dur:"1.2s",repeatCount:"indefinite"})]}),y("circle",{cx:"12",cy:"12",r:"3.5",fill:"currentColor",opacity:"0.7"})]})}function qt({px:e}){return G("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[y("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"none",opacity:"0.15"}),y("circle",{cx:"12",cy:"4",r:"2.2",fill:"currentColor",children:y("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"0.9s",repeatCount:"indefinite"})}),y("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor",opacity:"0.5",children:y("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"-360 12 12",dur:"0.9s",repeatCount:"indefinite"})})]})}function Xt({px:e}){let t=e*.14,n=e*.33,o=e/2-n,r=e/2,i=e/2+n,s=e/2;return y("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[o,r,i].map((c,u)=>y("circle",{cx:c,cy:s,r:t,fill:"currentColor",opacity:"0.25",children:y("animate",{attributeName:"opacity",values:"0.25;1;0.25",dur:"0.9s",begin:`${u*.2}s`,repeatCount:"indefinite"})},u))})}var Yt={ring:Vt,arc:$t,dots:Wt,bars:Kt,bounce:Ut,pulse:Gt,orbit:qt,flow:Xt},Jt=new Set(["ring","arc","dots"]);function ue({variant:e="ring",size:t="md",className:n,label:o}){let r=typeof t=="number"?t:Ft[t],i=Yt[e];return y("span",{"aria-hidden":!o,"aria-label":o,role:o?"img":void 0,className:zt("ui-spinner inline-flex",Jt.has(e)&&"motion-safe:animate-spin",n),children:y(i,{px:r})})}import{Fragment as jt,jsx as q,jsxs as Qt}from"react/jsx-runtime";function _e({variant:e="secondary",size:t="md",loading:n=!1,className:o}){return Zt("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:i,className:s,children:c,...u}=e,a=Qt(jt,{children:[o?q("span",{className:"shrink-0",children:q(ue,{size:n==="sm"?"sm":"md"})}):r?q("span",{className:"shrink-0",children:r}):null,q("span",{children:c}),!o&&i?q("span",{className:"shrink-0",children:i}):null]}),d=_e({variant:t,size:n,loading:o,className:s});if("href"in e&&e.href){let{href:p,...m}=u;return q("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?h=>h.preventDefault():void 0,...m,children:a})}let l=u;return q("button",{type:l.type??"button","data-variant":t,"data-size":n,"data-loading":o?"true":void 0,disabled:l.disabled||o,className:d,...l,children:a})}import{createContext as an,useCallback as ze,useContext as ln,useRef as un,useState as dn}from"react";import{clsx as te}from"clsx";import{useEffect as en,useRef as Oe,useCallback as tn}from"react";import{jsx as ne,jsxs as sn}from"react/jsx-runtime";function nn({className:e,children:t,...n}){return ne("div",{className:te("ui-dialog__header px-5 pt-5 pb-1 text-base font-semibold",e),...n,children:t})}function on({className:e,children:t,...n}){return ne("div",{className:te("ui-dialog__body px-5 py-3 text-sm",e),...n,children:t})}function rn({className:e,children:t,...n}){return ne("div",{className:te("ui-dialog__footer flex items-center justify-end gap-2 px-5 pt-3 pb-5",e),...n,children:t})}function z({open:e,onClose:t,size:n="sm",children:o,className:r,overlayClassName:i,panelClassName:s,...c}){let u=Oe(null),a=Oe(null),d=tn(l=>{l.key==="Escape"&&(l.stopPropagation(),t())},[t]);return en(()=>(e?(a.current=document.activeElement,document.body.style.overflow="hidden",requestAnimationFrame(()=>{let l=u.current;if(!l)return;let p=l.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');p?p.focus():l.focus()}),document.addEventListener("keydown",d)):(document.body.style.overflow="",a.current?.focus()),()=>{document.removeEventListener("keydown",d),document.body.style.overflow=""}),[e,d]),e?sn("div",{"data-state":"open",className:"ui-dialog-overlay fixed inset-0 z-50 flex items-center justify-center",children:[ne("button",{type:"button","aria-label":"Close dialog","data-state":"open",className:te("ui-dialog-backdrop absolute inset-0 bg-black/30",i),onClick:t}),ne("div",{ref:u,role:"dialog","aria-modal":"true",tabIndex:-1,"data-state":"open","data-size":n,className:te("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]",s,r),...c,children:o})]}):null}z.Header=nn;z.Body=on;z.Footer=rn;import{Fragment as fn,jsx as Z,jsxs as Te}from"react/jsx-runtime";var Fe=an(null);function cn(){let e=ln(Fe);if(!e)throw new Error("useConfirm must be used within <ConfirmProvider>");return e}function pn({children:e}){let[t,n]=dn(null),o=un(null),r=ze(s=>(o.current&&o.current.resolve(!1),new Promise(c=>{let u={options:s,resolve:c};o.current=u,n(u)})),[]),i=ze(s=>{o.current&&(o.current.resolve(s),o.current=null),n(null)},[]);return Te(Fe.Provider,{value:r,children:[e,Z(z,{open:t!==null,onClose:()=>i(!1),children:t&&Te(fn,{children:[Z(z.Header,{children:t.options.title}),Z(z.Body,{children:typeof t.options.description=="string"?Z("p",{className:"whitespace-pre-wrap",children:t.options.description}):t.options.description}),Te(z.Footer,{children:[Z(ee,{variant:"ghost",size:"sm",onClick:()=>i(!1),children:t.options.cancelLabel??"\u53D6\u6D88"}),Z(ee,{variant:t.options.variant??"primary",size:"sm",onClick:()=>i(!0),children:t.options.confirmLabel??"\u786E\u8BA4"})]})]})})]})}import{clsx as K}from"clsx";import{Children as mn,cloneElement as gn,createContext as Ve,isValidElement as bn,useCallback as A,useContext as Me,useEffect as X,useId as de,useLayoutEffect as hn,useMemo as pe,useRef as W,useState as oe}from"react";import{createPortal as vn}from"react-dom";import{jsx as B,jsxs as Ge}from"react/jsx-runtime";var $e=Ve(null),Se=Ve(null);function Re(e){let t=Me($e);if(!t)throw new Error(`${e} must be used within DropdownMenu.`);return t}function We(e){let t=Me(Se);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 Ke(...e){return t=>{for(let n of e)n&&(typeof n=="function"?n(t):n.current=t)}}function ce(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(ce).join(" "):!e||typeof e=="boolean"?"":bn(e)?ce(e.props.children):""}function wn(e){return[...e].sort((t,n)=>{let o=t.ref.current,r=n.ref.current;if(!o||!r)return 0;let i=o.compareDocumentPosition(r);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function xn(e){let{anchorRect:t,contentRect:n,sideOffset:o,alignOffset:r,collisionPadding:i}=e,s=window.innerWidth,c=window.innerHeight;function u(g,b){let M=0,w=0;return g==="bottom"?(M=t.bottom+o,b==="start"?w=t.left+r:b==="end"?w=t.right-n.width+r:w=t.left+(t.width-n.width)/2+r):g==="top"?(M=t.top-n.height-o,b==="start"?w=t.left+r:b==="end"?w=t.right-n.width+r:w=t.left+(t.width-n.width)/2+r):g==="right"?(w=t.right+o,b==="start"?M=t.top+r:b==="end"?M=t.bottom-n.height+r:M=t.top+(t.height-n.height)/2+r):(w=t.left-n.width-o,b==="start"?M=t.top+r:b==="end"?M=t.bottom-n.height+r:M=t.top+(t.height-n.height)/2+r),{top:M,left:w}}let a={top:"bottom",bottom:"top",left:"right",right:"left"},d=e.side,l=e.align,p=u(d,l);if(p.left<i||p.top<i||p.left+n.width>s-i||p.top+n.height>c-i){let g=u(a[d],l);g.left>=i&&g.top>=i&&g.left+n.width<=s-i&&g.top+n.height<=c-i&&(d=a[d],p=g)}let h=s-n.width-i,R=c-n.height-i;return p.left=Math.max(i,Math.min(p.left,h)),p.top=Math.max(i,Math.min(p.top,R)),{top:p.top,left:p.left,side:d,align:l}}function Ue({open:e,defaultOpen:t=!1,onOpenChange:n,side:o="bottom",align:r="start",sideOffset:i=8,alignOffset:s=0,collisionPadding:c=8,portal:u=!0,contentRole:a="menu",children:d}){let l=Me(Se),[p,m]=oe(t),h=e!==void 0,R=h?e:p,g=W(null),b=W(null),M=W("selected"),w=de(),N=de(),x=A(S=>{h||m(S),n?.(S)},[h,n]),D=A(()=>{x(!1)},[x]),I=A(()=>{x(!1),l?.closeTree()},[l,x]),C=A(()=>{x(!R)},[R,x]),P=A(()=>{g.current?.focus()},[]),f=pe(()=>({open:R,setOpen:x,toggleOpen:C,triggerRef:g,contentRef:b,side:o,align:r,sideOffset:i,alignOffset:s,collisionPadding:c,portal:u,contentRole:a,triggerId:w,contentId:N,focusIntentRef:M,parentList:l,isSubmenu:!!l,closeSelf:D,closeTree:I,focusTrigger:P}),[R,r,s,D,I,c,a,l,u,x,o,i,C,w,N,P]);return B($e.Provider,{value:f,children:d})}function yn({asChild:e=!1,disabled:t=!1,className:n,children:o}){let{open:r,setOpen:i,toggleOpen:s,triggerRef:c,contentRole:u,triggerId:a,contentId:d,focusIntentRef:l,isSubmenu:p}=Re("DropdownMenu.Trigger"),m=mn.only(o),h=m.props??{},R=typeof h.className=="string"?h.className:void 0,g={id:a,"data-state":r?"open":"closed","aria-expanded":r,"aria-haspopup":u,"aria-controls":r?d:void 0,onClick:j(h.onClick,b=>{if(t){b.preventDefault();return}l.current="selected",s()}),onKeyDown:j(h.onKeyDown,b=>{t||(b.key==="ArrowDown"?(b.preventDefault(),l.current="first",i(!0)):b.key==="ArrowUp"?(b.preventDefault(),l.current="last",i(!0)):!p&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),l.current="selected",s()))})};return e?gn(m,{...g,ref:Ke(c,h.ref),className:K(n,R),type:m.type==="button"?h.type??"button":h.type}):B("button",{ref:c,disabled:t,type:"button",className:K("ui-dropdown-menu__trigger",n),...g,children:m})}function Tn({className:e,children:t,style:n,matchTriggerWidth:o=!1,maxHeight:r=320,...i}){let{open:s,setOpen:c,triggerRef:u,contentRef:a,side:d,align:l,sideOffset:p,alignOffset:m,collisionPadding:h,portal:R,contentRole:g,triggerId:b,contentId:M,focusIntentRef:w,parentList:N,isSubmenu:x,closeSelf:D,closeTree:I,focusTrigger:C}=Re("DropdownMenu.Content"),P=W([]),[f,S]=oe(null),[H,U]=oe(null),[le,Dt]=oe(null),[ve,It]=oe(!1),we=W(""),Y=W(null),Le=A(v=>(P.current=[...P.current.filter(E=>E.id!==v.id),v],()=>{P.current=P.current.filter(E=>E.id!==v.id)}),[]),_=A(()=>wn(P.current),[]),Ce=A(v=>{w.current=v},[w]);X(()=>{It(!0)},[]);let Lt=pe(()=>({role:g,highlightedId:f,setHighlightedId:S,registerItem:Le,getItems:_,requestFocusIntent:Ce,closeTree:I,closeSelf:D,focusTrigger:C,activeSubmenuId:H,setActiveSubmenuId:U,contentRef:a}),[H,D,I,a,g,C,_,f,Le,Ce]),J=A(()=>{if(!u.current||!a.current)return;let v=u.current.getBoundingClientRect(),E=a.current.getBoundingClientRect();Dt(xn({anchorRect:v,contentRect:E,side:d,align:l,sideOffset:p,alignOffset:m,collisionPadding:h}))},[l,m,h,a,d,p,u]);hn(()=>{if(!(!s||!ve))return J(),window.addEventListener("resize",J),window.addEventListener("scroll",J,!0),()=>{window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0)}},[ve,s,J]),X(()=>{if(!s){S(null),U(null);return}let v=_().filter(T=>!T.disabled);if(v.length===0)return;let E=v[0];w.current==="last"?E=v[v.length-1]:w.current==="selected"&&(E=v.find(T=>T.selected)??v[0]),S(E.id),requestAnimationFrame(()=>{a.current?.focus(),E.ref.current?.scrollIntoView({block:"nearest"})})},[a,w,_,s]),X(()=>{if(!s)return;function v(E){let T=E.target,k=u.current?.contains(T),F=a.current?.contains(T);if(!k&&!F){let O=N?.contentRef.current?.contains(T);if(x&&O){D(),N?.setActiveSubmenuId(null);return}I()}}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[D,I,a,x,s,N,u]),X(()=>{if(s)return()=>{Y.current&&clearTimeout(Y.current)}},[s]);let $=A(v=>{if(S(v),!v){U(null);return}_().find(T=>T.id===v)?.submenu||U(null)},[_]),xe=A((v,E="first")=>{let T=_().filter(V=>!V.disabled);if(T.length===0)return;let k=T.findIndex(V=>V.id===f);if(k===-1){$(E==="last"?T[T.length-1].id:T[0].id);return}let F=(k+v+T.length)%T.length,O=T[F];$(O.id),O.ref.current?.scrollIntoView({block:"nearest"})},[_,f,$]),ke=A(v=>{let E=v.length===1?v.toLowerCase():"";if(!E)return;Y.current&&clearTimeout(Y.current),we.current+=E,Y.current=setTimeout(()=>{we.current="",Y.current=null},350);let T=_().filter(V=>!V.disabled);if(T.length===0)return;let k=T.findIndex(V=>V.id===f),O=(k>=0?[...T.slice(k+1),...T.slice(0,k+1)]:T).find(V=>V.textValue.toLowerCase().startsWith(we.current));O&&($(O.id),O.ref.current?.scrollIntoView({block:"nearest"}))},[_,f,$]),Ct=A(v=>{let E=_(),T=E.find(k=>k.id===f)??null;switch(v.key){case"ArrowDown":v.preventDefault(),xe(1);break;case"ArrowUp":v.preventDefault(),xe(-1,"last");break;case"Home":v.preventDefault();{let k=E.find(F=>!F.disabled);k&&$(k.id)}break;case"End":v.preventDefault();{let k=E.filter(O=>!O.disabled),F=k[k.length-1];F&&$(F.id)}break;case"Enter":case" ":T&&!T.disabled&&(v.preventDefault(),T.click());break;case"ArrowRight":T?.submenu&&(v.preventDefault(),T.openSubmenu?.());break;case"ArrowLeft":x&&(v.preventDefault(),D(),C(),N?.setActiveSubmenuId(null));break;case"Tab":I();break;case"Escape":v.preventDefault(),D(),C(),x&&N?.setActiveSubmenuId(null);break;default:ke(v.key)}},[D,I,C,_,ke,f,$,x,xe,N]);if(!s||!ve)return null;let Ae=B(Se.Provider,{value:Lt,children:B("div",{ref:a,id:M,role:g,tabIndex:-1,"aria-labelledby":g==="menu"?b:void 0,"data-state":"open","data-side":le?.side??d,"data-align":le?.align??l,className:K("ui-dropdown-menu__content",x&&"ui-dropdown-menu__content--submenu",e),style:{...n,position:"fixed",top:le?.top??0,left:le?.left??0,maxHeight:r,minWidth:o?u.current?.getBoundingClientRect().width:void 0},onKeyDown:Ct,...i,children:t})});return R?vn(Ae,document.body):Ae}function Mn({className:e,children:t,...n}){return B("div",{className:K("ui-dropdown-menu__group",e),...n,children:t})}function Sn({className:e,children:t,...n}){return B("div",{className:K("ui-dropdown-menu__label",e),...n,children:t})}function Rn({className:e,...t}){return B("div",{role:"separator",className:K("ui-dropdown-menu__separator",e),...t})}function Pn({className:e,children:t,inset:n=!1,disabled:o=!1,selected:r=!1,destructive:i=!1,closeOnSelect:s=!0,shortcut:c,indicator:u,onSelect:a,onMouseEnter:d,onClick:l,...p}){let m=de(),h=W(null),{role:R,highlightedId:g,setHighlightedId:b,registerItem:M,closeTree:w,setActiveSubmenuId:N}=We("DropdownMenu.Item"),x=pe(()=>ce(t),[t]),D=g===m,I=A(()=>{o||(a?.(),s&&w())},[s,w,o,a]);return X(()=>M({id:m,ref:h,disabled:o,submenu:!1,selected:r,textValue:x,closeOnSelect:s,click:I}),[s,o,I,m,M,r,x]),Ge("button",{ref:h,id:m,type:"button",role:R==="listbox"?"option":"menuitem",tabIndex:-1,disabled:o,"aria-selected":R==="listbox"?r:void 0,"data-highlighted":D||void 0,"data-selected":r||void 0,"data-disabled":o||void 0,"data-destructive":i||void 0,className:K("ui-dropdown-menu__item",n&&"ui-dropdown-menu__item--inset",e),onMouseEnter:j(d,()=>{o||(b(m),N(null))}),onClick:j(l,C=>{C.preventDefault(),I()}),...p,children:[B("span",{className:"ui-dropdown-menu__item-main",children:t}),c?B("span",{className:"ui-dropdown-menu__shortcut",children:c}):null,r?B("span",{className:"ui-dropdown-menu__indicator",children:u??"\u2713"}):null]})}function Nn(e){return B(Ue,{side:"right",align:"start",sideOffset:6,...e,contentRole:"menu"})}function En({className:e,children:t,inset:n=!1,disabled:o=!1,destructive:r=!1,shortcut:i,onSelect:s,onMouseEnter:c,onClick:u,...a}){let d=de(),l=W(null),p=Re("DropdownMenu.SubTrigger"),{highlightedId:m,setHighlightedId:h,registerItem:R,setActiveSubmenuId:g,activeSubmenuId:b}=We("DropdownMenu.SubTrigger"),M=pe(()=>ce(t),[t]),w=m===d,N=p.open&&b===d,x=A(()=>{o||(p.focusIntentRef.current="first",h(d),g(d),p.setOpen(!0))},[o,d,g,h,p]);return X(()=>R({id:d,ref:l,disabled:o,submenu:!0,selected:!1,textValue:M,closeOnSelect:!1,click:x,openSubmenu:x}),[o,d,x,R,M]),X(()=>{b!==d&&p.open&&p.setOpen(!1)},[b,d,p]),Ge("button",{ref:Ke(l,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":w||void 0,"data-state":N?"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(c,()=>{x()}),onClick:j(u,D=>{D.preventDefault(),x(),s?.()}),...a,children:[B("span",{className:"ui-dropdown-menu__item-main",children:t}),i?B("span",{className:"ui-dropdown-menu__shortcut",children:i}):null,B("span",{className:"ui-dropdown-menu__submenu-indicator","aria-hidden":"true",children:"\u203A"})]})}var Dn=Object.assign(Ue,{Trigger:yn,Content:Tn,Group:Mn,Label:Sn,Item:Pn,Separator:Rn,Submenu:Nn,SubTrigger:En}),In=Dn;import{clsx as qe}from"clsx";import{Fragment as Ln,jsx as Xe,jsxs as Cn}from"react/jsx-runtime";function Ye({as:e="aside",open:t,children:n,side:o="right",position:r="fixed",showBackdrop:i=!0,onClose:s,closeLabel:c="\u5173\u95ED\u62BD\u5C49",backdropClassName:u,className:a,...d}){let l=o==="left"?"-translate-x-full":"translate-x-full",p=o==="left"?"left-0 top-0":"right-0 top-0",m=r==="fixed"?"fixed":"absolute";return Cn(Ln,{children:[i&&t&&s&&Xe("button",{type:"button","aria-label":c,"data-state":"open",className:qe("ui-drawer-backdrop inset-0 z-10",m,u),onClick:s}),Xe(e,{"aria-hidden":!t,"data-state":t?"open":"closed","data-side":o,className:qe("ui-drawer",m,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 ${l}`,a),...d,children:n})]})}import{clsx as kn}from"clsx";import{jsx as re,jsxs as An}from"react/jsx-runtime";function Je({tone:e="neutral",icon:t,title:n,description:o,action:r,className:i,children:s,...c}){let u=t||n||o||r;return re("div",{"data-tone":e,className:kn("ui-empty-state rounded-lg border px-4 py-3 text-sm",i),...c,children:u?An("div",{className:"flex flex-col items-center gap-2 py-4 text-center",children:[t&&re("div",{className:"ui-empty-state__icon text-lg",children:t}),n&&re("div",{className:"ui-empty-state__title font-medium",children:n}),o&&re("div",{className:"ui-empty-state__description",children:o}),r&&re("div",{className:"mt-2",children:r})]}):s})}import{clsx as Hn}from"clsx";import{jsx as Ze,jsxs as Bn}from"react/jsx-runtime";function je({label:e,help:t,htmlFor:n,children:o,className:r,...i}){return Bn("div",{className:Hn("ui-field block",r),...i,children:[Ze("label",{htmlFor:n,className:"ui-field__label mb-1 block text-xs",children:e}),o,t?Ze("span",{className:"ui-field__help mt-1 block text-xs",children:t}):null]})}import{clsx as _n}from"clsx";import{jsx as Qe}from"react/jsx-runtime";function et({variant:e="ghost",size:t="md",label:n,icon:o,className:r,...i}){let s=_n("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 i&&i.href){let{href:u,...a}=i;return Qe("a",{href:u,"aria-label":n,title:a.title??n,"data-variant":e,"data-size":t,className:s,...a,children:o})}let c=i;return Qe("button",{type:c.type??"button","aria-label":n,title:c.title??n,"data-variant":e,"data-size":t,className:s,...c,children:o})}import{clsx as On}from"clsx";import{jsx as nt}from"react/jsx-runtime";function tt(e){return On("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 ot(e){let{className:t,tone:n="default",...o}=e;return e.as==="textarea"?nt("textarea",{"data-tone":n,className:tt(t),...o}):nt("input",{"data-tone":n,className:tt(t),...o})}import{clsx as fe}from"clsx";import{jsx as me}from"react/jsx-runtime";function zn(e){switch(e){case"none":return"";case"sm":return"p-4";case"lg":return"p-6";default:return"p-5"}}function rt({as:e="section",variant:t="default",padding:n="none",className:o,children:r,...i}){return me(e,{"data-variant":t,className:fe("ui-panel rounded-lg border",zn(n),o),...i,children:r})}function Fn({className:e,children:t,...n}){return me("div",{className:fe("ui-panel-header border-b px-6 py-5",e),...n,children:t})}function Vn({className:e,children:t,...n}){return me("div",{className:fe("px-6 py-5",e),...n,children:t})}function $n({className:e,children:t,...n}){return me("div",{className:fe("ui-panel-footer border-t px-6 py-4",e),...n,children:t})}import{clsx as it}from"clsx";import{jsx as st}from"react/jsx-runtime";function at({value:e,onChange:t,options:n,size:o="sm",className:r,ariaLabel:i}){return st("div",{role:"tablist","aria-label":i,className:it("ui-segmented-control inline-flex rounded-md p-0.5 ring-1",o==="sm"?"text-xs":"text-sm",r),children:n.map(s=>{let c=s.value===e;return st("button",{type:"button",role:"tab","aria-selected":c,disabled:s.disabled,"data-active":c?"true":void 0,className:it("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(s.value),children:s.label},s.value)})})}import{clsx as Q}from"clsx";import{useCallback as Pe,useEffect as lt,useId as Wn,useMemo as Kn,useRef as ut,useState as dt}from"react";import{jsx as ie,jsxs as ct}from"react/jsx-runtime";function pt({value:e,onChange:t,options:n,placeholder:o="Select\u2026",size:r="md",tone:i="default",disabled:s=!1,className:c,ariaLabel:u,renderValue:a,renderOption:d}){let[l,p]=dt(!1),[m,h]=dt(-1),R=ut(null),g=ut(null),b=Wn(),M=n.find(f=>f.value===e),w=Kn(()=>n.reduce((f,S,H)=>(S.disabled||f.push(H),f),[]),[n]),N=Pe(()=>{if(s||n.length===0)return;p(!0);let f=n.findIndex(S=>S.value===e);h(f>=0?f:w[0]??-1)},[s,n,e,w]),x=Pe(()=>{p(!1),h(-1)},[]),D=Pe(f=>{f.disabled||(t(f.value),x())},[t,x]);lt(()=>{if(!l)return;function f(S){R.current&&!R.current.contains(S.target)&&x()}return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[l,x]),lt(()=>{if(!l||m<0)return;g.current?.children[m]?.scrollIntoView({block:"nearest"})},[l,m]);function I(f){if(!s)switch(f.key){case"Enter":case" ":{f.preventDefault(),l?m>=0&&n[m]&&!n[m].disabled&&D(n[m]):N();break}case"ArrowDown":{if(f.preventDefault(),!l)N();else{let S=w.indexOf(m),H=w[S+1];H!==void 0&&h(H)}break}case"ArrowUp":{if(f.preventDefault(),!l)N();else{let S=w.indexOf(m),H=w[S-1];H!==void 0&&h(H)}break}case"Escape":{l&&(f.preventDefault(),x());break}case"Tab":{l&&x();break}}}let C=e!==""&&M,P=a?a({open:l,placeholder:o,selectedOption:M}):ie("span",{className:Q("truncate",!C&&"ui-select__placeholder"),children:C?M.label:o});return ct("div",{ref:R,"data-state":l?"open":"closed","data-disabled":s||void 0,"data-size":r,"data-tone":i,className:Q("ui-select relative inline-block",c),children:[ct("button",{type:"button",role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-controls":b,"aria-label":u,"aria-activedescendant":l&&m>=0?`${b}-opt-${m}`:void 0,"data-state":l?"open":"closed","data-disabled":s||void 0,"data-tone":i,"data-size":r,"data-open":l||void 0,"data-has-value":C||void 0,disabled:s,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:()=>l?x():N(),onKeyDown:I,children:[P,ie("svg",{"aria-hidden":"true",className:Q("ui-select__chevron h-3.5 w-3.5 shrink-0 transition-transform",l&&"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"})})]}),l&&ie("ul",{ref:g,id:b,role:"listbox","aria-label":u,"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((f,S)=>ie("li",{id:`${b}-opt-${S}`,role:"option","aria-selected":f.value===e,"aria-disabled":f.disabled||void 0,"data-state":f.value===e?"selected":S===m?"highlighted":"idle","data-focused":S===m||void 0,"data-selected":f.value===e||void 0,"data-disabled":f.disabled||void 0,"data-highlighted":S===m||void 0,className:Q("ui-select__option cursor-default select-none px-3 py-1.5 transition-colors",f.disabled&&"cursor-not-allowed opacity-50"),onClick:()=>D(f),onMouseEnter:()=>!f.disabled&&h(S),children:d?d({option:f,index:S,selected:f.value===e,highlighted:S===m}):f.label},f.value))})]})}import{clsx as Un}from"clsx";import{jsx as qn}from"react/jsx-runtime";var Gn={slow:"4s",default:"3s",fast:"2s"};function ft({className:e,animation:t="scan",tone:n="default",speed:o="default",style:r,...i}){let s=n==="warm"?"emphasis":n,c={...r,"--ui-skeleton-scan-duration":Gn[o]};return qn("div",{className:Un("ui-skeleton rounded",e),"data-animation":t,"data-tone":s,"aria-hidden":"true",style:c,...i})}import{clsx as Xn}from"clsx";import{Fragment as Yn,jsx as Ne,jsxs as Jn}from"react/jsx-runtime";function mt({tone:e="neutral",icon:t,className:n,children:o,...r}){return Ne("div",{"data-tone":e,className:Xn("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?Jn(Yn,{children:[Ne("span",{className:"ui-status-notice__icon mt-0.5 shrink-0","aria-hidden":"true",children:t}),Ne("div",{className:"min-w-0",children:o})]}):o})}import{clsx as gt}from"clsx";import{jsx as bt}from"react/jsx-runtime";var Zn={sm:"h-5 w-9",md:"h-6 w-11"},jn={sm:"h-3.5 w-3.5",md:"h-4.5 w-4.5"},Qn={sm:"translate-x-4",md:"translate-x-5"};function ht({checked:e,onChange:t,size:n="md",disabled:o=!1,className:r,ariaLabel:i}){return bt("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,disabled:o,"data-size":n,className:gt("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",Zn[n],o&&"cursor-not-allowed opacity-50",r),onClick:()=>t(!e),children:bt("span",{"aria-hidden":"true",className:gt("ui-switch__thumb pointer-events-none inline-block rounded-full bg-white shadow transition-transform",jn[n],e?Qn[n]:"translate-x-0.5")})})}import{clsx as vt}from"clsx";import{createContext as eo,useCallback as wt,useContext as to,useMemo as no,useRef as xt,useState as oo}from"react";import{jsx as L,jsxs as se}from"react/jsx-runtime";var Tt=eo(null),Ee=5,yt=4e3;function ro(){let e=to(Tt);if(!e)throw new Error("useToast must be used within <ToastProvider>");return e}function io({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 L("svg",{...t,children:L("path",{d:"M3.5 8.5l3 3 6-7"})});case"warning":return se("svg",{...t,children:[L("path",{d:"M8 5v4"}),L("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor",stroke:"none"})]});case"danger":return L("svg",{...t,children:L("path",{d:"M4.5 4.5l7 7M11.5 4.5l-7 7"})});case"info":return se("svg",{...t,children:[L("circle",{cx:"8",cy:"3.5",r:"1.2",fill:"currentColor",stroke:"none"}),L("path",{d:"M8 7v5.5"})]})}}function so(e,t){return typeof e=="string"?{message:e,duration:t??yt}:{title:e.title,message:e.message,duration:e.duration??t??yt}}function ao({item:e,onDismiss:t,renderToast:n}){let o=()=>t(e.id),r=L(io,{tone:e.tone});return n?L("div",{role:"status","aria-live":"polite","data-state":"open","data-tone":e.tone,className:vt("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})}):se("div",{role:"status","aria-live":"polite","data-state":"open","data-tone":e.tone,className:vt("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:[L("span",{className:"ui-toast__icon mt-0.5 shrink-0","aria-hidden":"true",children:r}),se("span",{className:"min-w-0 flex-1",children:[e.title?L("span",{className:"ui-toast__title block font-medium",children:e.title}):null,L("span",{className:"block",children:e.message})]}),L("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:L("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:L("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function lo({children:e,renderToast:t}){let[n,o]=oo([]),r=xt(0),i=xt(new Map),s=wt(a=>{let d=i.current.get(a);d&&clearTimeout(d),i.current.delete(a),o(l=>l.filter(p=>p.id!==a))},[]),c=wt((a,d,l)=>{let p=r.current++,m=so(d,l),h={id:p,tone:a,...m};o(R=>{let g=[...R,h];if(g.length>Ee){let b=g.slice(0,g.length-Ee);for(let M of b){let w=i.current.get(M.id);w&&clearTimeout(w),i.current.delete(M.id)}return g.slice(-Ee)}return g}),h.duration>0&&i.current.set(p,setTimeout(()=>s(p),h.duration))},[s]),u=no(()=>({success:(a,d)=>c("success",a,d),warning:(a,d)=>c("warning",a,d),danger:(a,d)=>c("danger",a,d),info:(a,d)=>c("info",a,d)}),[c]);return se(Tt.Provider,{value:u,children:[e,L("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=>L(ao,{item:a,onDismiss:s,renderToast:t},a.id))})]})}import{clsx as uo}from"clsx";import{cloneElement as co,isValidElement as po,useCallback as ge,useEffect as Mt,useId as fo,useLayoutEffect as mo,useRef as be,useState as De}from"react";import{createPortal as go}from"react-dom";import{Fragment as yo,jsx as Ie,jsxs as Nt}from"react/jsx-runtime";var ae=6,St=8,he=4,bo={top:"bottom",bottom:"top",left:"right",right:"left"},ho={top:{left:"50%",top:"100%",transform:"translateX(-50%)"},bottom:{left:"50%",top:-ae,transform:"translateX(-50%) rotate(180deg)"},left:{top:"50%",left:"100%",transform:"translateY(-50%) rotate(-90deg)"},right:{top:"50%",left:-ae,transform:"translateY(-50%) rotate(90deg)"}};function Rt(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 Pt(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 vo(e,t,n,o){let r=o?St+ae:St,i=Rt(n,e,t,r),s=n,c=i;if(!Pt(i,t)){let p=bo[n],m=Rt(p,e,t,r);Pt(m,t)&&(s=p,c=m)}let u=window.innerWidth,a=window.innerHeight,d=Math.max(he,Math.min(c.left,u-t.width-he)),l=Math.max(he,Math.min(c.top,a-t.height-he));return{placement:s,top:l,left:d}}function wo(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 xo={compact:"px-2 py-1 text-[11px] max-w-[200px]",default:"px-3 py-2 text-xs max-w-xs"};function Et({content:e,placement:t="top",density:n="default",showDelay:o=300,hideDelay:r=150,arrow:i=!0,renderArrow:s,className:c,children:u}){let[a,d]=De(!1),[l,p]=De(null),[m,h]=De(t),R=be(null),g=be(null),b=be(void 0),M=be(void 0),w=fo(),N=ge(()=>{clearTimeout(b.current),clearTimeout(M.current)},[]),x=ge(()=>{N(),b.current=setTimeout(()=>d(!0),o)},[N,o]),D=ge(()=>{N(),M.current=setTimeout(()=>d(!1),r)},[N,r]),I=ge(P=>{P.key==="Escape"&&a&&d(!1)},[a]);if(mo(()=>{if(!a||!R.current||!g.current)return;function P(){if(!R.current||!g.current)return;let f=R.current.getBoundingClientRect(),S=g.current.getBoundingClientRect(),H=vo(f,S,t,i),U=document.body.getBoundingClientRect();p({top:H.top+window.scrollY-U.top,left:H.left+window.scrollX-U.left}),h(H.placement)}return P(),window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[a,t,i]),Mt(()=>{if(a)return document.addEventListener("keydown",I),()=>document.removeEventListener("keydown",I)},[a,I]),Mt(()=>N,[N]),!po(u))return u;let C=co(u,{ref:wo(R,u),"data-state":a?"open":"closed",onMouseEnter:P=>{x();let f=u.props.onMouseEnter;f?.(P)},onMouseLeave:P=>{D();let f=u.props.onMouseLeave;f?.(P)},onFocus:P=>{x();let f=u.props.onFocus;f?.(P)},onBlur:P=>{D();let f=u.props.onBlur;f?.(P)},"aria-describedby":a?w:void 0});return Nt(yo,{children:[C,a&&go(Nt("div",{ref:g,id:w,role:"tooltip","data-state":a?"open":"closed","data-placement":m,"data-density":n,className:uo("ui-tooltip absolute z-[9999] rounded-lg leading-relaxed",xo[n],"animate-[tooltip-in_0.15s_var(--ease-standard)]",c),style:l?{top:l.top,left:l.left}:{position:"fixed",visibility:"hidden"},onMouseEnter:x,onMouseLeave:D,children:[e,i&&Ie("span",{className:"ui-tooltip__arrow absolute",style:ho[m],children:s?s({placement:m}):Ie("svg",{width:ae*2,height:ae,viewBox:"0 0 12 6",children:Ie("path",{d:"M0 0l6 6 6-6z",fill:"currentColor"})})})]}),document.body)]})}export{He as Avatar,Be as Badge,ee as Button,pn as ConfirmProvider,z as Dialog,Ye as Drawer,In as DropdownMenu,Je as EmptyState,je as Field,et as IconButton,ot as Input,rt as Panel,Vn as PanelBody,$n as PanelFooter,Fn as PanelHeader,at as SegmentedControl,pt as Select,ft as Skeleton,ue as Spinner,mt as StatusNotice,ht as Switch,lo as ToastProvider,Et as Tooltip,_e as buttonClassName,cn as useConfirm,ro 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};
@@ -32,7 +32,7 @@ const catalog = {
32
32
  "group": "forms",
33
33
  "componentId": "input",
34
34
  "componentName": "Input",
35
- "description": "Unified input element. Renders as input or textarea via the `as` prop. For dropdown selection, use the Select component."
35
+ "description": "Single-line text input. Legacy `as=\"textarea\"` support remains available, but new multiline usage should prefer the dedicated Textarea primitive."
36
36
  },
37
37
  {
38
38
  "group": "forms",
@@ -57,6 +57,24 @@ const catalog = {
57
57
  "componentId": "switch",
58
58
  "componentName": "Switch",
59
59
  "description": "Toggle switch for boolean settings."
60
+ },
61
+ {
62
+ "group": "forms",
63
+ "componentId": "textarea",
64
+ "componentName": "Textarea",
65
+ "description": "Dedicated multiline text input that matches the Input token contract while supporting resize and auto-resize behavior."
66
+ },
67
+ {
68
+ "group": "forms",
69
+ "componentId": "collapsible",
70
+ "componentName": "Collapsible",
71
+ "description": "Composable primitive for disclosure sections, reasoning panels, and settings details blocks."
72
+ },
73
+ {
74
+ "group": "forms",
75
+ "componentId": "tabs",
76
+ "componentName": "Tabs",
77
+ "description": "Navigation-grade tab primitive with keyboard support and linked tab panels."
60
78
  }
61
79
  ]
62
80
  },
@@ -74,13 +92,7 @@ const catalog = {
74
92
  "group": "feedback",
75
93
  "componentId": "status-notice",
76
94
  "componentName": "StatusNotice",
77
- "description": "Block-level feedback banner. Supports neutral plus semantic tones, with optional icon slot."
78
- },
79
- {
80
- "group": "feedback",
81
- "componentId": "empty-state",
82
- "componentName": "EmptyState",
83
- "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."
84
96
  },
85
97
  {
86
98
  "group": "feedback",
@@ -172,6 +184,18 @@ const catalog = {
172
184
  "group": "forms",
173
185
  "componentId": "switch"
174
186
  },
187
+ {
188
+ "group": "forms",
189
+ "componentId": "textarea"
190
+ },
191
+ {
192
+ "group": "forms",
193
+ "componentId": "collapsible"
194
+ },
195
+ {
196
+ "group": "forms",
197
+ "componentId": "tabs"
198
+ },
175
199
  {
176
200
  "group": "feedback",
177
201
  "componentId": "badge"
@@ -32,7 +32,7 @@
32
32
  "group": "forms",
33
33
  "componentId": "input",
34
34
  "componentName": "Input",
35
- "description": "Unified input element. Renders as input or textarea via the `as` prop. For dropdown selection, use the Select component."
35
+ "description": "Single-line text input. Legacy `as=\"textarea\"` support remains available, but new multiline usage should prefer the dedicated Textarea primitive."
36
36
  },
37
37
  {
38
38
  "group": "forms",
@@ -57,6 +57,24 @@
57
57
  "componentId": "switch",
58
58
  "componentName": "Switch",
59
59
  "description": "Toggle switch for boolean settings."
60
+ },
61
+ {
62
+ "group": "forms",
63
+ "componentId": "textarea",
64
+ "componentName": "Textarea",
65
+ "description": "Dedicated multiline text input that matches the Input token contract while supporting resize and auto-resize behavior."
66
+ },
67
+ {
68
+ "group": "forms",
69
+ "componentId": "collapsible",
70
+ "componentName": "Collapsible",
71
+ "description": "Composable primitive for disclosure sections, reasoning panels, and settings details blocks."
72
+ },
73
+ {
74
+ "group": "forms",
75
+ "componentId": "tabs",
76
+ "componentName": "Tabs",
77
+ "description": "Navigation-grade tab primitive with keyboard support and linked tab panels."
60
78
  }
61
79
  ]
62
80
  },
@@ -74,13 +92,7 @@
74
92
  "group": "feedback",
75
93
  "componentId": "status-notice",
76
94
  "componentName": "StatusNotice",
77
- "description": "Block-level feedback banner. Supports neutral plus semantic tones, with optional icon slot."
78
- },
79
- {
80
- "group": "feedback",
81
- "componentId": "empty-state",
82
- "componentName": "EmptyState",
83
- "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."
84
96
  },
85
97
  {
86
98
  "group": "feedback",
@@ -172,6 +184,18 @@
172
184
  "group": "forms",
173
185
  "componentId": "switch"
174
186
  },
187
+ {
188
+ "group": "forms",
189
+ "componentId": "textarea"
190
+ },
191
+ {
192
+ "group": "forms",
193
+ "componentId": "collapsible"
194
+ },
195
+ {
196
+ "group": "forms",
197
+ "componentId": "tabs"
198
+ },
175
199
  {
176
200
  "group": "feedback",
177
201
  "componentId": "badge"
@@ -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
  }