@owodesign/owoui 0.1.1 → 0.1.2
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 +24 -5
- package/dist/index.d.ts +61 -3
- package/dist/index.min.js +1 -1
- package/dist/storybook/catalog.js +31 -1
- package/dist/storybook/catalog.json +31 -1
- package/dist/storybook/index.min.js +9 -8
- package/dist/storybook-static/app.css +4100 -0
- package/dist/storybook-static/assets/main.js +97 -0
- package/dist/storybook-static/index.html +14 -0
- package/dist/tokens.d.ts +4 -2
- package/dist/tokens.min.js +1 -1
- package/package.json +24 -14
- package/src/preset-default.css +27 -0
- package/src/preset-elevated.css +27 -0
- package/src/preset-flat.css +27 -0
- package/src/preset-glass.css +27 -0
- package/src/style.css +3 -0
- package/src/styles/tokens.css +132 -73
- package/src/styles/ui/collapsible.css +13 -0
- package/src/styles/ui/tabs.css +33 -0
- package/src/styles/ui/textarea.css +8 -0
- package/src/theme-dark.css +87 -0
- package/src/theme-light.css +41 -0
- package/src/dark.css +0 -70
- package/src/elevated.css +0 -20
- package/src/flat.css +0 -1
- package/src/glass.css +0 -17
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/
|
|
40
|
-
- `@owodesign/owoui/flat.css`:
|
|
41
|
-
- `@owodesign/owoui/elevated.css`:
|
|
42
|
-
- `@owodesign/owoui/glass.css`:
|
|
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,8 @@ 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
|
+
|
|
60
79
|
## Release Checks
|
|
61
80
|
|
|
62
81
|
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;
|
|
@@ -207,10 +228,10 @@ type InputBaseProps = {
|
|
|
207
228
|
type TextInputProps = InputBaseProps & InputHTMLAttributes<HTMLInputElement> & {
|
|
208
229
|
as?: 'input';
|
|
209
230
|
};
|
|
210
|
-
type TextareaProps = InputBaseProps & TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
231
|
+
type TextareaProps$1 = InputBaseProps & TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
211
232
|
as: 'textarea';
|
|
212
233
|
};
|
|
213
|
-
type InputProps = TextInputProps | TextareaProps;
|
|
234
|
+
type InputProps = TextInputProps | TextareaProps$1;
|
|
214
235
|
declare function Input(props: InputProps): react_jsx_runtime.JSX.Element;
|
|
215
236
|
|
|
216
237
|
type PanelVariant = 'default' | 'subtle' | 'raised';
|
|
@@ -314,6 +335,43 @@ interface SwitchProps {
|
|
|
314
335
|
}
|
|
315
336
|
declare function Switch({ checked, onChange, size, disabled, className, ariaLabel, }: SwitchProps): react_jsx_runtime.JSX.Element;
|
|
316
337
|
|
|
338
|
+
interface TabsRootProps extends HTMLAttributes<HTMLDivElement> {
|
|
339
|
+
children: ReactNode;
|
|
340
|
+
value?: string;
|
|
341
|
+
defaultValue?: string;
|
|
342
|
+
onValueChange?: (value: string) => void;
|
|
343
|
+
}
|
|
344
|
+
declare function TabsRoot({ children, value, defaultValue, onValueChange, className, ...props }: TabsRootProps): react_jsx_runtime.JSX.Element;
|
|
345
|
+
interface TabsListProps extends HTMLAttributes<HTMLDivElement> {
|
|
346
|
+
children: ReactNode;
|
|
347
|
+
ariaLabel?: string;
|
|
348
|
+
}
|
|
349
|
+
declare function TabsList({ children, className, ariaLabel, ...props }: TabsListProps): react_jsx_runtime.JSX.Element;
|
|
350
|
+
interface TabsTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
351
|
+
children: ReactNode;
|
|
352
|
+
value: string;
|
|
353
|
+
}
|
|
354
|
+
declare function TabsTrigger({ children, className, value, disabled, onClick, onKeyDown, ...props }: TabsTriggerProps): react_jsx_runtime.JSX.Element;
|
|
355
|
+
interface TabsContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
356
|
+
children: ReactNode;
|
|
357
|
+
value: string;
|
|
358
|
+
}
|
|
359
|
+
declare function TabsContent({ children, className, value, ...props }: TabsContentProps): react_jsx_runtime.JSX.Element | null;
|
|
360
|
+
declare const Tabs: typeof TabsRoot & {
|
|
361
|
+
Root: typeof TabsRoot;
|
|
362
|
+
List: typeof TabsList;
|
|
363
|
+
Trigger: typeof TabsTrigger;
|
|
364
|
+
Content: typeof TabsContent;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'children'> {
|
|
368
|
+
className?: string;
|
|
369
|
+
tone?: 'default' | 'warning';
|
|
370
|
+
resize?: 'none' | 'vertical' | 'both';
|
|
371
|
+
autoResize?: boolean;
|
|
372
|
+
}
|
|
373
|
+
declare function Textarea({ className, tone, resize, autoResize, style, onInput, rows, ...props }: TextareaProps): react_jsx_runtime.JSX.Element;
|
|
374
|
+
|
|
317
375
|
type ToastTone = 'success' | 'warning' | 'danger' | 'info';
|
|
318
376
|
interface ToastInput {
|
|
319
377
|
title?: string;
|
|
@@ -361,4 +419,4 @@ interface TooltipProps {
|
|
|
361
419
|
}
|
|
362
420
|
declare function Tooltip({ content, placement: preferredPlacement, density, showDelay, hideDelay, arrow, renderArrow, className, children, }: TooltipProps): react_jsx_runtime.JSX.Element;
|
|
363
421
|
|
|
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 };
|
|
422
|
+
export { Avatar, Badge, type BadgeProps, Button, type ButtonProps, Collapsible, CollapsibleContent, type CollapsibleContentProps, CollapsibleRoot, type CollapsibleRootProps, CollapsibleTrigger, type CollapsibleTriggerProps, ConfirmProvider, Dialog, Drawer, DropdownMenu, type DropdownMenuAlign, type DropdownMenuContentProps, type DropdownMenuItemProps, type DropdownMenuProps, type DropdownMenuRole, type DropdownMenuSide, type DropdownMenuTriggerProps, EmptyState, type EmptyStateProps, Field, IconButton, type IconButtonProps, Input, type InputProps, Panel, PanelBody, PanelFooter, PanelHeader, SegmentedControl, type SegmentedOption, Select, type SelectOption, type SelectRenderOptionArgs, type SelectRenderValueArgs, Skeleton, type SkeletonAnimation, type SkeletonSpeed, type SkeletonTone, Spinner, StatusNotice, type StatusNoticeProps, Switch, Tabs, TabsContent, type TabsContentProps, TabsList, type TabsListProps, TabsRoot, type TabsRootProps, TabsTrigger, type TabsTriggerProps, Textarea, type TextareaProps, type ToastInput, ToastProvider, type ToastRenderArgs, Tooltip, buttonClassName, useConfirm, useToast };
|
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 jt}from"clsx";import{useState as Qt}from"react";import{jsx as Ce}from"react/jsx-runtime";var en={xs:"h-6 w-6 text-[10px]",sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-14 w-14 text-lg"};function tn(e){let t=e.trim().split(/\s+/);return t.length>=2?(t[0][0]+t[t.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function We({src:e,alt:t,name:n,size:o="md",tone:r="neutral",className:s}){let[i,u]=Qt(!1),l=e&&!i,a=n?tn(n):"?";return Ce("span",{"data-tone":r,className:jt("ui-avatar inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium select-none",en[o],s),children:l?Ce("img",{src:e,alt:t??n??"",className:"h-full w-full object-cover",onError:()=>u(!0)}):Ce("span",{"aria-label":t??n,children:a})})}import{clsx as nn}from"clsx";import{jsx as on}from"react/jsx-runtime";function Ke({tone:e="neutral",variant:t="soft",size:n="xs",className:o,children:r,...s}){return on("span",{"data-tone":e,"data-variant":t,"data-size":n,className:nn("ui-badge inline-flex items-center rounded-full border text-[var(--badge-text)]",n==="xs"?"px-2.5 py-1 text-[11px]":"px-3 py-1 text-xs font-medium",o),...s,children:r})}import{clsx as hn}from"clsx";import{clsx as rn}from"clsx";import{jsx as M,jsxs as q}from"react/jsx-runtime";var sn={xs:12,sm:14,md:16,lg:24};function an({px:e}){let n=Math.PI*2*9;return q("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[M("circle",{cx:"12",cy:"12",r:9,stroke:"currentColor",strokeWidth:"3",opacity:"0.2"}),M("circle",{cx:"12",cy:"12",r:9,stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:`${n*.28} ${n*.72}`})]})}function ln({px:e}){return q("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",children:[M("path",{d:"M12 2a10 10 0 0 1 10 10",opacity:"0.9"}),M("path",{d:"M12 2a10 10 0 0 0-7.07 2.93",opacity:"0.2"}),M("path",{d:"M4.93 4.93A10 10 0 0 0 2 12",opacity:"0.2"}),M("path",{d:"M2 12a10 10 0 0 0 2.93 7.07",opacity:"0.2"}),M("path",{d:"M4.93 19.07A10 10 0 0 0 12 22",opacity:"0.2"}),M("path",{d:"M12 22a10 10 0 0 0 7.07-2.93",opacity:"0.2"}),M("path",{d:"M19.07 19.07A10 10 0 0 0 22 12",opacity:"0.2"})]})}function un({px:e}){return M("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[0,1,2,3,4,5,6,7].map(n=>{let o=n/8*360,r=.15+n/8*.85;return M("circle",{cx:"12",cy:"3.5",r:"1.8",fill:"currentColor",opacity:r,transform:`rotate(${o} 12 12)`},n)})})}function cn({px:e}){return M("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[0,1,2,3].map(t=>q("rect",{x:3+t*5.5,y:"4",width:"3",height:"16",rx:"1.5",fill:"currentColor",opacity:"0.3",children:[M("animate",{attributeName:"opacity",values:"0.3;1;0.3",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"}),M("animate",{attributeName:"height",values:"16;8;16",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"}),M("animate",{attributeName:"y",values:"4;8;4",dur:"1s",begin:`${t*.15}s`,repeatCount:"indefinite"})]},t))})}function dn({px:e}){let t=e*.14,n=e*.33,o=e/2-n,r=e/2,s=e/2+n,i=e/2;return M("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[o,r,s].map((u,l)=>q("circle",{cx:u,cy:i,r:t,fill:"currentColor",opacity:"0.4",children:[M("animate",{attributeName:"cy",values:`${i};${i-e*.25};${i}`,dur:"0.6s",begin:`${l*.12}s`,repeatCount:"indefinite",calcMode:"spline",keySplines:"0.4 0 0.2 1;0.4 0 0.2 1"}),M("animate",{attributeName:"opacity",values:"0.4;1;0.4",dur:"0.6s",begin:`${l*.12}s`,repeatCount:"indefinite"})]},l))})}function pn({px:e}){return q("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[q("circle",{cx:"12",cy:"12",r:"0",fill:"currentColor",opacity:"0",children:[M("animate",{attributeName:"r",values:"4;10;4",dur:"1.2s",repeatCount:"indefinite"}),M("animate",{attributeName:"opacity",values:"0.8;0.1;0.8",dur:"1.2s",repeatCount:"indefinite"})]}),M("circle",{cx:"12",cy:"12",r:"3.5",fill:"currentColor",opacity:"0.7"})]})}function fn({px:e}){return q("svg",{width:e,height:e,viewBox:"0 0 24 24",children:[M("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeWidth:"1.5",fill:"none",opacity:"0.15"}),M("circle",{cx:"12",cy:"4",r:"2.2",fill:"currentColor",children:M("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"360 12 12",dur:"0.9s",repeatCount:"indefinite"})}),M("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor",opacity:"0.5",children:M("animateTransform",{attributeName:"transform",type:"rotate",from:"0 12 12",to:"-360 12 12",dur:"0.9s",repeatCount:"indefinite"})})]})}function mn({px:e}){let t=e*.14,n=e*.33,o=e/2-n,r=e/2,s=e/2+n,i=e/2;return M("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[o,r,s].map((u,l)=>M("circle",{cx:u,cy:i,r:t,fill:"currentColor",opacity:"0.25",children:M("animate",{attributeName:"opacity",values:"0.25;1;0.25",dur:"0.9s",begin:`${l*.2}s`,repeatCount:"indefinite"})},l))})}var gn={ring:an,arc:ln,dots:un,bars:cn,bounce:dn,pulse:pn,orbit:fn,flow:mn},bn=new Set(["ring","arc","dots"]);function de({variant:e="ring",size:t="md",className:n,label:o}){let r=typeof t=="number"?t:sn[t],s=gn[e];return M("span",{"aria-hidden":!o,"aria-label":o,role:o?"img":void 0,className:rn("ui-spinner inline-flex",bn.has(e)&&"motion-safe:animate-spin",n),children:M(s,{px:r})})}import{Fragment as vn,jsx as G,jsxs as xn}from"react/jsx-runtime";function Ue({variant:e="secondary",size:t="md",loading:n=!1,className:o}){return hn("ui-button","inline-flex items-center justify-center gap-2 rounded-md border font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-[var(--button-disabled-opacity)]",t==="sm"?"min-h-8 px-3 text-xs":"min-h-9 px-4 text-sm",n&&"pointer-events-none cursor-wait",o)}function ee(e){let{variant:t="secondary",size:n="md",loading:o=!1,leadingIcon:r,trailingIcon:s,className:i,children:u,...l}=e,a=xn(vn,{children:[o?G("span",{className:"shrink-0",children:G(de,{size:n==="sm"?"sm":"md"})}):r?G("span",{className:"shrink-0",children:r}):null,G("span",{children:u}),!o&&s?G("span",{className:"shrink-0",children:s}):null]}),d=Ue({variant:t,size:n,loading:o,className:i});if("href"in e&&e.href){let{href:p,...f}=l;return G("a",{href:p,"data-variant":t,"data-size":n,"data-loading":o?"true":void 0,"aria-disabled":o||void 0,tabIndex:o?-1:void 0,className:d,onClick:o?m=>m.preventDefault():void 0,...f,children:a})}let c=l;return G("button",{type:c.type??"button","data-variant":t,"data-size":n,"data-loading":o?"true":void 0,disabled:c.disabled||o,className:d,...c,children:a})}import{clsx as Ee}from"clsx";import{createContext as Tn,useContext as wn,useEffect as yn,useId as Mn,useMemo as Pn,useRef as qe,useState as Ge}from"react";import{jsx as te}from"react/jsx-runtime";var Xe=Tn(null);function Ye(e){let t=wn(Xe);if(!t)throw new Error(`${e} must be used within Collapsible.Root`);return t}function Rn({open:e,defaultOpen:t,onOpenChange:n}){let[o,r]=Ge(t??!1),s=e!==void 0,i=s?e:o;function u(l){s||r(l),n?.(l)}return[i,u]}function Se({children:e,open:t,defaultOpen:n,onOpenChange:o,className:r,...s}){let[i,u]=Rn({open:t,defaultOpen:n,onOpenChange:o}),l=Mn(),a=Pn(()=>({open:i,setOpen:u,contentId:l}),[l,i,u]);return te(Xe.Provider,{value:a,children:te("div",{"data-state":i?"open":"closed",className:Ee("ui-collapsible",r),...s,children:e})})}function Ze({children:e,className:t,onClick:n,...o}){let{open:r,setOpen:s,contentId:i}=Ye("Collapsible.Trigger");return te("button",{type:"button","aria-expanded":r,"aria-controls":i,"data-state":r?"open":"closed",className:Ee("ui-collapsible__trigger",t),onClick:u=>{n?.(u),u.defaultPrevented||s(!r)},...o,children:e})}function Je({children:e,className:t,...n}){let{open:o,contentId:r}=Ye("Collapsible.Content"),[s,i]=Ge(o),u=qe(null),l=qe(null);return yn(()=>{let a=u.current,d=l.current;if(!a||!d)return;let c=0,p=0,f=()=>{a.style.height="auto",a.style.overflow="visible"};if(o&&i(!0),!s&&!o)return;let m=h=>{h.target!==a||h.propertyName!=="height"||(a.removeEventListener("transitionend",m),o?f():i(!1))};return(()=>{let h=d.scrollHeight;if(a.style.overflow="hidden",o){a.style.height="0px",c=window.requestAnimationFrame(()=>{a.addEventListener("transitionend",m),a.style.height=`${h}px`}),p=window.setTimeout(f,240);return}a.style.height=`${h}px`,c=window.requestAnimationFrame(()=>{a.addEventListener("transitionend",m),a.style.height="0px"}),p=window.setTimeout(()=>i(!1),240)})(),()=>{window.cancelAnimationFrame(c),window.clearTimeout(p),a.removeEventListener("transitionend",m)}},[o,s]),!s&&!o?null:te("div",{id:r,ref:u,"data-state":o?"open":"closed","aria-hidden":!o,className:Ee("ui-collapsible__content",t),...n,children:te("div",{ref:l,className:"ui-collapsible__content-inner",children:e})})}var Cn=Object.assign(Se,{Root:Se,Trigger:Ze,Content:Je}),Sn=Cn;import{createContext as Hn,useCallback as Qe,useContext as An,useRef as Bn,useState as _n}from"react";import{clsx as ne}from"clsx";import{useEffect as En,useRef as je,useCallback as Ln}from"react";import{jsx as oe,jsxs as kn}from"react/jsx-runtime";function Nn({className:e,children:t,...n}){return oe("div",{className:ne("ui-dialog__header px-5 pt-5 pb-1 text-base font-semibold",e),...n,children:t})}function In({className:e,children:t,...n}){return oe("div",{className:ne("ui-dialog__body px-5 py-3 text-sm",e),...n,children:t})}function Dn({className:e,children:t,...n}){return oe("div",{className:ne("ui-dialog__footer flex items-center justify-end gap-2 px-5 pt-3 pb-5",e),...n,children:t})}function V({open:e,onClose:t,size:n="sm",children:o,className:r,overlayClassName:s,panelClassName:i,...u}){let l=je(null),a=je(null),d=Ln(c=>{c.key==="Escape"&&(c.stopPropagation(),t())},[t]);return En(()=>(e?(a.current=document.activeElement,document.body.style.overflow="hidden",requestAnimationFrame(()=>{let c=l.current;if(!c)return;let p=c.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');p?p.focus():c.focus()}),document.addEventListener("keydown",d)):(document.body.style.overflow="",a.current?.focus()),()=>{document.removeEventListener("keydown",d),document.body.style.overflow=""}),[e,d]),e?kn("div",{"data-state":"open",className:"ui-dialog-overlay fixed inset-0 z-50 flex items-center justify-center",children:[oe("button",{type:"button","aria-label":"Close dialog","data-state":"open",className:ne("ui-dialog-backdrop absolute inset-0 bg-black/30",s),onClick:t}),oe("div",{ref:l,role:"dialog","aria-modal":"true",tabIndex:-1,"data-state":"open","data-size":n,className:ne("ui-dialog relative z-10 w-full rounded-xl shadow-xl","animate-[dialog-in_0.2s_var(--ease-standard)]",n==="sm"?"max-w-[26rem]":"max-w-[32rem]",i,r),...u,children:o})]}):null}V.Header=Nn;V.Body=In;V.Footer=Dn;import{Fragment as Fn,jsx as J,jsxs as Le}from"react/jsx-runtime";var et=Hn(null);function On(){let e=An(et);if(!e)throw new Error("useConfirm must be used within <ConfirmProvider>");return e}function Vn({children:e}){let[t,n]=_n(null),o=Bn(null),r=Qe(i=>(o.current&&o.current.resolve(!1),new Promise(u=>{let l={options:i,resolve:u};o.current=l,n(l)})),[]),s=Qe(i=>{o.current&&(o.current.resolve(i),o.current=null),n(null)},[]);return Le(et.Provider,{value:r,children:[e,J(V,{open:t!==null,onClose:()=>s(!1),children:t&&Le(Fn,{children:[J(V.Header,{children:t.options.title}),J(V.Body,{children:typeof t.options.description=="string"?J("p",{className:"whitespace-pre-wrap",children:t.options.description}):t.options.description}),Le(V.Footer,{children:[J(ee,{variant:"ghost",size:"sm",onClick:()=>s(!1),children:t.options.cancelLabel??"\u53D6\u6D88"}),J(ee,{variant:t.options.variant??"primary",size:"sm",onClick:()=>s(!0),children:t.options.confirmLabel??"\u786E\u8BA4"})]})]})})]})}import{clsx as K}from"clsx";import{Children as zn,cloneElement as $n,createContext as tt,isValidElement as Wn,useCallback as H,useContext as Ne,useEffect as X,useId as pe,useLayoutEffect as Kn,useMemo as me,useRef as W,useState as re}from"react";import{createPortal as Un}from"react-dom";import{jsx as B,jsxs as it}from"react/jsx-runtime";var nt=tt(null),Ie=tt(null);function De(e){let t=Ne(nt);if(!t)throw new Error(`${e} must be used within DropdownMenu.`);return t}function ot(e){let t=Ne(Ie);if(!t)throw new Error(`${e} must be used within DropdownMenu.Content.`);return t}function j(e,t){return n=>{e?.(n),t(n)}}function rt(...e){return t=>{for(let n of e)n&&(typeof n=="function"?n(t):n.current=t)}}function fe(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(fe).join(" "):!e||typeof e=="boolean"?"":Wn(e)?fe(e.props.children):""}function qn(e){return[...e].sort((t,n)=>{let o=t.ref.current,r=n.ref.current;if(!o||!r)return 0;let s=o.compareDocumentPosition(r);return s&Node.DOCUMENT_POSITION_FOLLOWING?-1:s&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Gn(e){let{anchorRect:t,contentRect:n,sideOffset:o,alignOffset:r,collisionPadding:s}=e,i=window.innerWidth,u=window.innerHeight;function l(h,b){let y=0,v=0;return h==="bottom"?(y=t.bottom+o,b==="start"?v=t.left+r:b==="end"?v=t.right-n.width+r:v=t.left+(t.width-n.width)/2+r):h==="top"?(y=t.top-n.height-o,b==="start"?v=t.left+r:b==="end"?v=t.right-n.width+r:v=t.left+(t.width-n.width)/2+r):h==="right"?(v=t.right+o,b==="start"?y=t.top+r:b==="end"?y=t.bottom-n.height+r:y=t.top+(t.height-n.height)/2+r):(v=t.left-n.width-o,b==="start"?y=t.top+r:b==="end"?y=t.bottom-n.height+r:y=t.top+(t.height-n.height)/2+r),{top:y,left:v}}let a={top:"bottom",bottom:"top",left:"right",right:"left"},d=e.side,c=e.align,p=l(d,c);if(p.left<s||p.top<s||p.left+n.width>i-s||p.top+n.height>u-s){let h=l(a[d],c);h.left>=s&&h.top>=s&&h.left+n.width<=i-s&&h.top+n.height<=u-s&&(d=a[d],p=h)}let m=i-n.width-s,x=u-n.height-s;return p.left=Math.max(s,Math.min(p.left,m)),p.top=Math.max(s,Math.min(p.top,x)),{top:p.top,left:p.left,side:d,align:c}}function st({open:e,defaultOpen:t=!1,onOpenChange:n,side:o="bottom",align:r="start",sideOffset:s=8,alignOffset:i=0,collisionPadding:u=8,portal:l=!0,contentRole:a="menu",children:d}){let c=Ne(Ie),[p,f]=re(t),m=e!==void 0,x=m?e:p,h=W(null),b=W(null),y=W("selected"),v=pe(),S=pe(),w=H(R=>{m||f(R),n?.(R)},[m,n]),L=H(()=>{w(!1)},[w]),N=H(()=>{w(!1),c?.closeTree()},[c,w]),D=H(()=>{w(!x)},[x,w]),C=H(()=>{h.current?.focus()},[]),g=me(()=>({open:x,setOpen:w,toggleOpen:D,triggerRef:h,contentRef:b,side:o,align:r,sideOffset:s,alignOffset:i,collisionPadding:u,portal:l,contentRole:a,triggerId:v,contentId:S,focusIntentRef:y,parentList:c,isSubmenu:!!c,closeSelf:L,closeTree:N,focusTrigger:C}),[x,r,i,L,N,u,a,c,l,w,o,s,D,v,S,C]);return B(nt.Provider,{value:g,children:d})}function Xn({asChild:e=!1,disabled:t=!1,className:n,children:o}){let{open:r,setOpen:s,toggleOpen:i,triggerRef:u,contentRole:l,triggerId:a,contentId:d,focusIntentRef:c,isSubmenu:p}=De("DropdownMenu.Trigger"),f=zn.only(o),m=f.props??{},x=typeof m.className=="string"?m.className:void 0,h={id:a,"data-state":r?"open":"closed","aria-expanded":r,"aria-haspopup":l,"aria-controls":r?d:void 0,onClick:j(m.onClick,b=>{if(t){b.preventDefault();return}c.current="selected",i()}),onKeyDown:j(m.onKeyDown,b=>{t||(b.key==="ArrowDown"?(b.preventDefault(),c.current="first",s(!0)):b.key==="ArrowUp"?(b.preventDefault(),c.current="last",s(!0)):!p&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),c.current="selected",i()))})};return e?$n(f,{...h,ref:rt(u,m.ref),className:K(n,x),type:f.type==="button"?m.type??"button":m.type}):B("button",{ref:u,disabled:t,type:"button",className:K("ui-dropdown-menu__trigger",n),...h,children:f})}function Yn({className:e,children:t,style:n,matchTriggerWidth:o=!1,maxHeight:r=320,...s}){let{open:i,setOpen:u,triggerRef:l,contentRef:a,side:d,align:c,sideOffset:p,alignOffset:f,collisionPadding:m,portal:x,contentRole:h,triggerId:b,contentId:y,focusIntentRef:v,parentList:S,isSubmenu:w,closeSelf:L,closeTree:N,focusTrigger:D}=De("DropdownMenu.Content"),C=W([]),[g,R]=re(null),[A,U]=re(null),[ce,Xt]=re(null),[Me,Yt]=re(!1),Pe=W(""),Y=W(null),Ve=H(T=>(C.current=[...C.current.filter(E=>E.id!==T.id),T],()=>{C.current=C.current.filter(E=>E.id!==T.id)}),[]),_=H(()=>qn(C.current),[]),Fe=H(T=>{v.current=T},[v]);X(()=>{Yt(!0)},[]);let Zt=me(()=>({role:h,highlightedId:g,setHighlightedId:R,registerItem:Ve,getItems:_,requestFocusIntent:Fe,closeTree:N,closeSelf:L,focusTrigger:D,activeSubmenuId:A,setActiveSubmenuId:U,contentRef:a}),[A,L,N,a,h,D,_,g,Ve,Fe]),Z=H(()=>{if(!l.current||!a.current)return;let T=l.current.getBoundingClientRect(),E=a.current.getBoundingClientRect();Xt(Gn({anchorRect:T,contentRect:E,side:d,align:c,sideOffset:p,alignOffset:f,collisionPadding:m}))},[c,f,m,a,d,p,l]);Kn(()=>{if(!(!i||!Me))return Z(),window.addEventListener("resize",Z),window.addEventListener("scroll",Z,!0),()=>{window.removeEventListener("resize",Z),window.removeEventListener("scroll",Z,!0)}},[Me,i,Z]),X(()=>{if(!i){R(null),U(null);return}let T=_().filter(P=>!P.disabled);if(T.length===0)return;let E=T[0];v.current==="last"?E=T[T.length-1]:v.current==="selected"&&(E=T.find(P=>P.selected)??T[0]),R(E.id),requestAnimationFrame(()=>{a.current?.focus(),E.ref.current?.scrollIntoView({block:"nearest"})})},[a,v,_,i]),X(()=>{if(!i)return;function T(E){let P=E.target,k=l.current?.contains(P),F=a.current?.contains(P);if(!k&&!F){let O=S?.contentRef.current?.contains(P);if(w&&O){L(),S?.setActiveSubmenuId(null);return}N()}}return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[L,N,a,w,i,S,l]),X(()=>{if(i)return()=>{Y.current&&clearTimeout(Y.current)}},[i]);let $=H(T=>{if(R(T),!T){U(null);return}_().find(P=>P.id===T)?.submenu||U(null)},[_]),Re=H((T,E="first")=>{let P=_().filter(z=>!z.disabled);if(P.length===0)return;let k=P.findIndex(z=>z.id===g);if(k===-1){$(E==="last"?P[P.length-1].id:P[0].id);return}let F=(k+T+P.length)%P.length,O=P[F];$(O.id),O.ref.current?.scrollIntoView({block:"nearest"})},[_,g,$]),ze=H(T=>{let E=T.length===1?T.toLowerCase():"";if(!E)return;Y.current&&clearTimeout(Y.current),Pe.current+=E,Y.current=setTimeout(()=>{Pe.current="",Y.current=null},350);let P=_().filter(z=>!z.disabled);if(P.length===0)return;let k=P.findIndex(z=>z.id===g),O=(k>=0?[...P.slice(k+1),...P.slice(0,k+1)]:P).find(z=>z.textValue.toLowerCase().startsWith(Pe.current));O&&($(O.id),O.ref.current?.scrollIntoView({block:"nearest"}))},[_,g,$]),Jt=H(T=>{let E=_(),P=E.find(k=>k.id===g)??null;switch(T.key){case"ArrowDown":T.preventDefault(),Re(1);break;case"ArrowUp":T.preventDefault(),Re(-1,"last");break;case"Home":T.preventDefault();{let k=E.find(F=>!F.disabled);k&&$(k.id)}break;case"End":T.preventDefault();{let k=E.filter(O=>!O.disabled),F=k[k.length-1];F&&$(F.id)}break;case"Enter":case" ":P&&!P.disabled&&(T.preventDefault(),P.click());break;case"ArrowRight":P?.submenu&&(T.preventDefault(),P.openSubmenu?.());break;case"ArrowLeft":w&&(T.preventDefault(),L(),D(),S?.setActiveSubmenuId(null));break;case"Tab":N();break;case"Escape":T.preventDefault(),L(),D(),w&&S?.setActiveSubmenuId(null);break;default:ze(T.key)}},[L,N,D,_,ze,g,$,w,Re,S]);if(!i||!Me)return null;let $e=B(Ie.Provider,{value:Zt,children:B("div",{ref:a,id:y,role:h,tabIndex:-1,"aria-labelledby":h==="menu"?b:void 0,"data-state":"open","data-side":ce?.side??d,"data-align":ce?.align??c,className:K("ui-dropdown-menu__content",w&&"ui-dropdown-menu__content--submenu",e),style:{...n,position:"fixed",top:ce?.top??0,left:ce?.left??0,maxHeight:r,minWidth:o?l.current?.getBoundingClientRect().width:void 0},onKeyDown:Jt,...s,children:t})});return x?Un($e,document.body):$e}function Zn({className:e,children:t,...n}){return B("div",{className:K("ui-dropdown-menu__group",e),...n,children:t})}function Jn({className:e,children:t,...n}){return B("div",{className:K("ui-dropdown-menu__label",e),...n,children:t})}function jn({className:e,...t}){return B("div",{role:"separator",className:K("ui-dropdown-menu__separator",e),...t})}function Qn({className:e,children:t,inset:n=!1,disabled:o=!1,selected:r=!1,destructive:s=!1,closeOnSelect:i=!0,shortcut:u,indicator:l,onSelect:a,onMouseEnter:d,onClick:c,...p}){let f=pe(),m=W(null),{role:x,highlightedId:h,setHighlightedId:b,registerItem:y,closeTree:v,setActiveSubmenuId:S}=ot("DropdownMenu.Item"),w=me(()=>fe(t),[t]),L=h===f,N=H(()=>{o||(a?.(),i&&v())},[i,v,o,a]);return X(()=>y({id:f,ref:m,disabled:o,submenu:!1,selected:r,textValue:w,closeOnSelect:i,click:N}),[i,o,N,f,y,r,w]),it("button",{ref:m,id:f,type:"button",role:x==="listbox"?"option":"menuitem",tabIndex:-1,disabled:o,"aria-selected":x==="listbox"?r:void 0,"data-highlighted":L||void 0,"data-selected":r||void 0,"data-disabled":o||void 0,"data-destructive":s||void 0,className:K("ui-dropdown-menu__item",n&&"ui-dropdown-menu__item--inset",e),onMouseEnter:j(d,()=>{o||(b(f),S(null))}),onClick:j(c,D=>{D.preventDefault(),N()}),...p,children:[B("span",{className:"ui-dropdown-menu__item-main",children:t}),u?B("span",{className:"ui-dropdown-menu__shortcut",children:u}):null,r?B("span",{className:"ui-dropdown-menu__indicator",children:l??"\u2713"}):null]})}function eo(e){return B(st,{side:"right",align:"start",sideOffset:6,...e,contentRole:"menu"})}function to({className:e,children:t,inset:n=!1,disabled:o=!1,destructive:r=!1,shortcut:s,onSelect:i,onMouseEnter:u,onClick:l,...a}){let d=pe(),c=W(null),p=De("DropdownMenu.SubTrigger"),{highlightedId:f,setHighlightedId:m,registerItem:x,setActiveSubmenuId:h,activeSubmenuId:b}=ot("DropdownMenu.SubTrigger"),y=me(()=>fe(t),[t]),v=f===d,S=p.open&&b===d,w=H(()=>{o||(p.focusIntentRef.current="first",m(d),h(d),p.setOpen(!0))},[o,d,h,m,p]);return X(()=>x({id:d,ref:c,disabled:o,submenu:!0,selected:!1,textValue:y,closeOnSelect:!1,click:w,openSubmenu:w}),[o,d,w,x,y]),X(()=>{b!==d&&p.open&&p.setOpen(!1)},[b,d,p]),it("button",{ref:rt(c,p.triggerRef),id:p.triggerId,type:"button",role:"menuitem",tabIndex:-1,"aria-haspopup":"menu","aria-expanded":p.open,"aria-controls":p.open?p.contentId:void 0,"data-highlighted":v||void 0,"data-state":S?"open":"closed","data-disabled":o||void 0,"data-destructive":r||void 0,className:K("ui-dropdown-menu__item ui-dropdown-menu__sub-trigger",n&&"ui-dropdown-menu__item--inset",e),onMouseEnter:j(u,()=>{w()}),onClick:j(l,L=>{L.preventDefault(),w(),i?.()}),...a,children:[B("span",{className:"ui-dropdown-menu__item-main",children:t}),s?B("span",{className:"ui-dropdown-menu__shortcut",children:s}):null,B("span",{className:"ui-dropdown-menu__submenu-indicator","aria-hidden":"true",children:"\u203A"})]})}var no=Object.assign(st,{Trigger:Xn,Content:Yn,Group:Zn,Label:Jn,Item:Qn,Separator:jn,Submenu:eo,SubTrigger:to}),oo=no;import{clsx as at}from"clsx";import{Fragment as ro,jsx as lt,jsxs as so}from"react/jsx-runtime";function ut({as:e="aside",open:t,children:n,side:o="right",position:r="fixed",showBackdrop:s=!0,onClose:i,closeLabel:u="\u5173\u95ED\u62BD\u5C49",backdropClassName:l,className:a,...d}){let c=o==="left"?"-translate-x-full":"translate-x-full",p=o==="left"?"left-0 top-0":"right-0 top-0",f=r==="fixed"?"fixed":"absolute";return so(ro,{children:[s&&t&&i&<("button",{type:"button","aria-label":u,"data-state":"open",className:at("ui-drawer-backdrop inset-0 z-10",f,l),onClick:i}),lt(e,{"aria-hidden":!t,"data-state":t?"open":"closed","data-side":o,className:at("ui-drawer",f,p,"z-20 flex max-w-full transform flex-col transition-transform duration-200 ease-in-out",t?"pointer-events-auto visible translate-x-0":`pointer-events-none invisible ${c}`,a),...d,children:n})]})}import{clsx as io}from"clsx";import{jsx as se,jsxs as ao}from"react/jsx-runtime";function ct({tone:e="neutral",icon:t,title:n,description:o,action:r,className:s,children:i,...u}){let l=t||n||o||r;return se("div",{"data-tone":e,className:io("ui-empty-state rounded-lg border px-4 py-3 text-sm",s),...u,children:l?ao("div",{className:"flex flex-col items-center gap-2 py-4 text-center",children:[t&&se("div",{className:"ui-empty-state__icon text-lg",children:t}),n&&se("div",{className:"ui-empty-state__title font-medium",children:n}),o&&se("div",{className:"ui-empty-state__description",children:o}),r&&se("div",{className:"mt-2",children:r})]}):i})}import{clsx as lo}from"clsx";import{jsx as dt,jsxs as uo}from"react/jsx-runtime";function pt({label:e,help:t,htmlFor:n,children:o,className:r,...s}){return uo("div",{className:lo("ui-field block",r),...s,children:[dt("label",{htmlFor:n,className:"ui-field__label mb-1 block text-xs",children:e}),o,t?dt("span",{className:"ui-field__help mt-1 block text-xs",children:t}):null]})}import{clsx as co}from"clsx";import{jsx as ft}from"react/jsx-runtime";function mt({variant:e="ghost",size:t="md",label:n,icon:o,className:r,...s}){let i=co("ui-icon-button","inline-flex items-center justify-center rounded-md transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",t==="sm"?"h-7 w-7":"h-8 w-8",r);if("href"in s&&s.href){let{href:l,...a}=s;return ft("a",{href:l,"aria-label":n,title:a.title??n,"data-variant":e,"data-size":t,className:i,...a,children:o})}let u=s;return ft("button",{type:u.type??"button","aria-label":n,title:u.title??n,"data-variant":e,"data-size":t,className:i,...u,children:o})}import{clsx as po}from"clsx";import{jsx as gt}from"react/jsx-runtime";function ge(e){return po("ui-input w-full rounded-lg px-3 py-2 text-sm placeholder:text-[var(--field-placeholder)] focus:outline-none focus:ring-1",e)}function bt(e){let{className:t,tone:n="default",...o}=e;return e.as==="textarea"?gt("textarea",{"data-tone":n,className:ge(t),...o}):gt("input",{"data-tone":n,className:ge(t),...o})}import{clsx as be}from"clsx";import{jsx as he}from"react/jsx-runtime";function fo(e){switch(e){case"none":return"";case"sm":return"p-4";case"lg":return"p-6";default:return"p-5"}}function ht({as:e="section",variant:t="default",padding:n="none",className:o,children:r,...s}){return he(e,{"data-variant":t,className:be("ui-panel rounded-lg border",fo(n),o),...s,children:r})}function mo({className:e,children:t,...n}){return he("div",{className:be("ui-panel-header border-b px-6 py-5",e),...n,children:t})}function go({className:e,children:t,...n}){return he("div",{className:be("px-6 py-5",e),...n,children:t})}function bo({className:e,children:t,...n}){return he("div",{className:be("ui-panel-footer border-t px-6 py-4",e),...n,children:t})}import{clsx as vt}from"clsx";import{jsx as xt}from"react/jsx-runtime";function Tt({value:e,onChange:t,options:n,size:o="sm",className:r,ariaLabel:s}){return xt("div",{role:"tablist","aria-label":s,className:vt("ui-segmented-control inline-flex rounded-md p-0.5 ring-1",o==="sm"?"text-xs":"text-sm",r),children:n.map(i=>{let u=i.value===e;return xt("button",{type:"button",role:"tab","aria-selected":u,disabled:i.disabled,"data-active":u?"true":void 0,className:vt("ui-segmented-control__item rounded font-medium transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",o==="sm"?"px-2.5 py-1":"px-3 py-1.5"),onClick:()=>t(i.value),children:i.label},i.value)})})}import{clsx as Q}from"clsx";import{useCallback as ke,useEffect as wt,useId as ho,useMemo as vo,useRef as yt,useState as Mt}from"react";import{jsx as ie,jsxs as Pt}from"react/jsx-runtime";function Rt({value:e,onChange:t,options:n,placeholder:o="Select\u2026",size:r="md",tone:s="default",disabled:i=!1,className:u,ariaLabel:l,renderValue:a,renderOption:d}){let[c,p]=Mt(!1),[f,m]=Mt(-1),x=yt(null),h=yt(null),b=ho(),y=n.find(g=>g.value===e),v=vo(()=>n.reduce((g,R,A)=>(R.disabled||g.push(A),g),[]),[n]),S=ke(()=>{if(i||n.length===0)return;p(!0);let g=n.findIndex(R=>R.value===e);m(g>=0?g:v[0]??-1)},[i,n,e,v]),w=ke(()=>{p(!1),m(-1)},[]),L=ke(g=>{g.disabled||(t(g.value),w())},[t,w]);wt(()=>{if(!c)return;function g(R){x.current&&!x.current.contains(R.target)&&w()}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[c,w]),wt(()=>{if(!c||f<0)return;h.current?.children[f]?.scrollIntoView({block:"nearest"})},[c,f]);function N(g){if(!i)switch(g.key){case"Enter":case" ":{g.preventDefault(),c?f>=0&&n[f]&&!n[f].disabled&&L(n[f]):S();break}case"ArrowDown":{if(g.preventDefault(),!c)S();else{let R=v.indexOf(f),A=v[R+1];A!==void 0&&m(A)}break}case"ArrowUp":{if(g.preventDefault(),!c)S();else{let R=v.indexOf(f),A=v[R-1];A!==void 0&&m(A)}break}case"Escape":{c&&(g.preventDefault(),w());break}case"Tab":{c&&w();break}}}let D=e!==""&&y,C=a?a({open:c,placeholder:o,selectedOption:y}):ie("span",{className:Q("truncate",!D&&"ui-select__placeholder"),children:D?y.label:o});return Pt("div",{ref:x,"data-state":c?"open":"closed","data-disabled":i||void 0,"data-size":r,"data-tone":s,className:Q("ui-select relative inline-block",u),children:[Pt("button",{type:"button",role:"combobox","aria-expanded":c,"aria-haspopup":"listbox","aria-controls":b,"aria-label":l,"aria-activedescendant":c&&f>=0?`${b}-opt-${f}`:void 0,"data-state":c?"open":"closed","data-disabled":i||void 0,"data-tone":s,"data-size":r,"data-open":c||void 0,"data-has-value":D||void 0,disabled:i,className:Q("ui-select__trigger flex w-full items-center justify-between gap-2 rounded-lg text-left transition-colors focus:outline-none focus:ring-1",r==="sm"?"min-h-7 px-2 py-1 text-xs":"min-h-9 px-3 py-2 text-sm"),onClick:()=>c?w():S(),onKeyDown:N,children:[C,ie("svg",{"aria-hidden":"true",className:Q("ui-select__chevron h-3.5 w-3.5 shrink-0 transition-transform",c&&"rotate-180"),viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:ie("path",{d:"M4 6l4 4 4-4"})})]}),c&&ie("ul",{ref:h,id:b,role:"listbox","aria-label":l,"data-state":"open",className:Q("ui-select__dropdown absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg py-1 ring-1",r==="sm"?"text-xs":"text-sm"),children:n.map((g,R)=>ie("li",{id:`${b}-opt-${R}`,role:"option","aria-selected":g.value===e,"aria-disabled":g.disabled||void 0,"data-state":g.value===e?"selected":R===f?"highlighted":"idle","data-focused":R===f||void 0,"data-selected":g.value===e||void 0,"data-disabled":g.disabled||void 0,"data-highlighted":R===f||void 0,className:Q("ui-select__option cursor-default select-none px-3 py-1.5 transition-colors",g.disabled&&"cursor-not-allowed opacity-50"),onClick:()=>L(g),onMouseEnter:()=>!g.disabled&&m(R),children:d?d({option:g,index:R,selected:g.value===e,highlighted:R===f}):g.label},g.value))})]})}import{clsx as xo}from"clsx";import{jsx as wo}from"react/jsx-runtime";var To={slow:"4s",default:"3s",fast:"2s"};function Ct({className:e,animation:t="scan",tone:n="default",speed:o="default",style:r,...s}){let i=n==="warm"?"emphasis":n,u={...r,"--ui-skeleton-scan-duration":To[o]};return wo("div",{className:xo("ui-skeleton rounded",e),"data-animation":t,"data-tone":i,"aria-hidden":"true",style:u,...s})}import{clsx as yo}from"clsx";import{Fragment as Mo,jsx as He,jsxs as Po}from"react/jsx-runtime";function St({tone:e="neutral",icon:t,className:n,children:o,...r}){return He("div",{"data-tone":e,className:yo("ui-status-notice rounded-md border px-4 py-3 text-sm",t&&"ui-status-notice--with-icon grid grid-cols-[auto_minmax(0,1fr)] gap-3",n),...r,children:t?Po(Mo,{children:[He("span",{className:"ui-status-notice__icon mt-0.5 shrink-0","aria-hidden":"true",children:t}),He("div",{className:"min-w-0",children:o})]}):o})}import{clsx as Et}from"clsx";import{jsx as Lt}from"react/jsx-runtime";var Ro={sm:"h-5 w-9",md:"h-6 w-11"},Co={sm:"h-3.5 w-3.5",md:"h-4.5 w-4.5"},So={sm:"translate-x-4",md:"translate-x-5"};function Nt({checked:e,onChange:t,size:n="md",disabled:o=!1,className:r,ariaLabel:s}){return Lt("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,disabled:o,"data-size":n,className:Et("ui-switch relative inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",Ro[n],o&&"cursor-not-allowed opacity-50",r),onClick:()=>t(!e),children:Lt("span",{"aria-hidden":"true",className:Et("ui-switch__thumb pointer-events-none inline-block rounded-full bg-white shadow transition-transform",Co[n],e?So[n]:"translate-x-0.5")})})}import{clsx as xe}from"clsx";import{createContext as Eo,useContext as Lo,useId as No,useMemo as Io,useState as Do}from"react";import{jsx as ae}from"react/jsx-runtime";var It=Eo(null);function Dt(e){let t=Lo(It);if(!t)throw new Error(`${e} must be used within Tabs.Root`);return t}function ve(e){return e.replace(/[^a-zA-Z0-9_-]+/g,"-")}function ko({value:e,defaultValue:t,onValueChange:n}){let[o,r]=Do(t??""),s=e!==void 0,i=s?e:o;function u(l){s||r(l),n?.(l)}return[i,u]}function Ae({children:e,value:t,defaultValue:n,onValueChange:o,className:r,...s}){let[i,u]=ko({value:t,defaultValue:n,onValueChange:o}),l=No(),a=Io(()=>({value:i,setValue:u,baseId:l}),[l,i,u]);return ae(It.Provider,{value:a,children:ae("div",{className:xe("ui-tabs",r),...s,children:e})})}function kt({children:e,className:t,ariaLabel:n,...o}){return ae("div",{role:"tablist","aria-label":n,className:xe("ui-tabs__list flex items-end gap-1 border-b",t),...o,children:e})}function Ht({children:e,className:t,value:n,disabled:o,onClick:r,onKeyDown:s,...i}){let{value:u,setValue:l,baseId:a}=Dt("Tabs.Trigger"),d=u===n,c=`${a}-trigger-${ve(n)}`,p=`${a}-panel-${ve(n)}`;function f(m,x){let h=m.closest('[role="tablist"]');if(!h)return;let b=Array.from(h.querySelectorAll('[role="tab"]:not([disabled])')),y=b.indexOf(m);if(y<0)return;let v;x==="first"&&(v=b[0]),x==="last"&&(v=b[b.length-1]),x==="next"&&(v=b[(y+1)%b.length]),x==="prev"&&(v=b[(y-1+b.length)%b.length]),v&&(v.focus(),v.click())}return ae("button",{type:"button",id:c,role:"tab","aria-selected":d,"aria-controls":p,tabIndex:d?0:-1,"data-state":d?"active":"inactive",disabled:o,className:xe("ui-tabs__trigger relative -mb-px inline-flex min-h-9 items-center justify-center rounded-t-md border-b-2 px-3 py-2 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset disabled:cursor-not-allowed disabled:opacity-50",t),onClick:m=>{r?.(m),!m.defaultPrevented&&!o&&l(n)},onKeyDown:m=>{if(s?.(m),m.defaultPrevented||o)return;let x=m.currentTarget;switch(m.key){case"ArrowRight":m.preventDefault(),f(x,"next");break;case"ArrowLeft":m.preventDefault(),f(x,"prev");break;case"Home":m.preventDefault(),f(x,"first");break;case"End":m.preventDefault(),f(x,"last");break}},...i,children:e})}function At({children:e,className:t,value:n,...o}){let{value:r,baseId:s}=Dt("Tabs.Content"),i=r===n,u=`${s}-trigger-${ve(n)}`,l=`${s}-panel-${ve(n)}`;return i?ae("div",{id:l,role:"tabpanel","aria-labelledby":u,"data-state":"active",className:xe("ui-tabs__content pt-4",t),...o,children:e}):null}var Ho=Object.assign(Ae,{Root:Ae,List:kt,Trigger:Ht,Content:At}),Ao=Ho;import{useCallback as Bo,useEffect as _o,useRef as Oo}from"react";import{jsx as Vo}from"react/jsx-runtime";function Bt({className:e,tone:t="default",resize:n="vertical",autoResize:o=!1,style:r,onInput:s,rows:i=3,...u}){let l=Oo(null),a=s,d=Bo(()=>{if(!o||!l.current)return;let f=l.current;f.style.height="auto",f.style.height=`${f.scrollHeight}px`},[o]);_o(()=>{d()},[d,u.value,u.defaultValue,i]);function c(f){d(),a?.(f)}let p={...r,resize:o?"none":n};return Vo("textarea",{...u,ref:l,rows:i,"data-tone":t,"data-auto-resize":o||void 0,className:ge(`ui-textarea ${e??""}`),style:p,onInput:c})}import{clsx as _t}from"clsx";import{createContext as Fo,useCallback as Ot,useContext as zo,useMemo as $o,useRef as Vt,useState as Wo}from"react";import{jsx as I,jsxs as le}from"react/jsx-runtime";var zt=Fo(null),Be=5,Ft=4e3;function Ko(){let e=zo(zt);if(!e)throw new Error("useToast must be used within <ToastProvider>");return e}function Uo({tone:e}){let t={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"success":return I("svg",{...t,children:I("path",{d:"M3.5 8.5l3 3 6-7"})});case"warning":return le("svg",{...t,children:[I("path",{d:"M8 5v4"}),I("circle",{cx:"8",cy:"11.5",r:"0.5",fill:"currentColor",stroke:"none"})]});case"danger":return I("svg",{...t,children:I("path",{d:"M4.5 4.5l7 7M11.5 4.5l-7 7"})});case"info":return le("svg",{...t,children:[I("circle",{cx:"8",cy:"3.5",r:"1.2",fill:"currentColor",stroke:"none"}),I("path",{d:"M8 7v5.5"})]})}}function qo(e,t){return typeof e=="string"?{message:e,duration:t??Ft}:{title:e.title,message:e.message,duration:e.duration??t??Ft}}function Go({item:e,onDismiss:t,renderToast:n}){let o=()=>t(e.id),r=I(Uo,{tone:e.tone});return n?I("div",{role:"status","aria-live":"polite","data-state":"open","data-tone":e.tone,className:_t("ui-toast pointer-events-auto rounded-lg border text-sm backdrop-blur-sm","animate-[toast-in_0.25s_var(--ease-standard)]"),children:n({item:e,dismiss:o,icon:r})}):le("div",{role:"status","aria-live":"polite","data-state":"open","data-tone":e.tone,className:_t("ui-toast pointer-events-auto flex items-start gap-2 rounded-lg border px-4 py-3 text-sm backdrop-blur-sm","animate-[toast-in_0.25s_var(--ease-standard)]"),children:[I("span",{className:"ui-toast__icon mt-0.5 shrink-0","aria-hidden":"true",children:r}),le("span",{className:"min-w-0 flex-1",children:[e.title?I("span",{className:"ui-toast__title block font-medium",children:e.title}):null,I("span",{className:"block",children:e.message})]}),I("button",{type:"button",onClick:o,className:"ui-toast__close -mr-1 -mt-0.5 shrink-0 rounded p-0.5 text-current opacity-50 transition-opacity hover:opacity-100","aria-label":"Dismiss",children:I("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:I("path",{d:"M4 4l8 8M12 4l-8 8"})})})]})}function Xo({children:e,renderToast:t}){let[n,o]=Wo([]),r=Vt(0),s=Vt(new Map),i=Ot(a=>{let d=s.current.get(a);d&&clearTimeout(d),s.current.delete(a),o(c=>c.filter(p=>p.id!==a))},[]),u=Ot((a,d,c)=>{let p=r.current++,f=qo(d,c),m={id:p,tone:a,...f};o(x=>{let h=[...x,m];if(h.length>Be){let b=h.slice(0,h.length-Be);for(let y of b){let v=s.current.get(y.id);v&&clearTimeout(v),s.current.delete(y.id)}return h.slice(-Be)}return h}),m.duration>0&&s.current.set(p,setTimeout(()=>i(p),m.duration))},[i]),l=$o(()=>({success:(a,d)=>u("success",a,d),warning:(a,d)=>u("warning",a,d),danger:(a,d)=>u("danger",a,d),info:(a,d)=>u("info",a,d)}),[u]);return le(zt.Provider,{value:l,children:[e,I("div",{"aria-label":"Notifications","data-state":n.length>0?"open":"closed",className:"pointer-events-none fixed bottom-4 right-4 z-[9999] flex flex-col-reverse gap-2",children:n.map(a=>I(Go,{item:a,onDismiss:i,renderToast:t},a.id))})]})}import{clsx as Yo}from"clsx";import{cloneElement as Zo,isValidElement as Jo,useCallback as Te,useEffect as $t,useId as jo,useLayoutEffect as Qo,useRef as we,useState as _e}from"react";import{createPortal as er}from"react-dom";import{Fragment as ir,jsx as Oe,jsxs as qt}from"react/jsx-runtime";var ue=6,Wt=8,ye=4,tr={top:"bottom",bottom:"top",left:"right",right:"left"},nr={top:{left:"50%",top:"100%",transform:"translateX(-50%)"},bottom:{left:"50%",top:-ue,transform:"translateX(-50%) rotate(180deg)"},left:{top:"50%",left:"100%",transform:"translateY(-50%) rotate(-90deg)"},right:{top:"50%",left:-ue,transform:"translateY(-50%) rotate(90deg)"}};function Kt(e,t,n,o){switch(e){case"top":return{top:t.top-n.height-o,left:t.left+t.width/2-n.width/2};case"bottom":return{top:t.bottom+o,left:t.left+t.width/2-n.width/2};case"left":return{top:t.top+t.height/2-n.height/2,left:t.left-n.width-o};case"right":return{top:t.top+t.height/2-n.height/2,left:t.right+o}}}function Ut(e,t){let n=window.innerWidth,o=window.innerHeight;return e.top>=0&&e.left>=0&&e.top+t.height<=o&&e.left+t.width<=n}function or(e,t,n,o){let r=o?Wt+ue:Wt,s=Kt(n,e,t,r),i=n,u=s;if(!Ut(s,t)){let p=tr[n],f=Kt(p,e,t,r);Ut(f,t)&&(i=p,u=f)}let l=window.innerWidth,a=window.innerHeight,d=Math.max(ye,Math.min(u.left,l-t.width-ye)),c=Math.max(ye,Math.min(u.top,a-t.height-ye));return{placement:i,top:c,left:d}}function rr(e,t){return n=>{e.current=n;let o=t.props.ref;typeof o=="function"?o(n):o&&typeof o=="object"&&"current"in o&&(o.current=n)}}var sr={compact:"px-2 py-1 text-[11px] max-w-[200px]",default:"px-3 py-2 text-xs max-w-xs"};function Gt({content:e,placement:t="top",density:n="default",showDelay:o=300,hideDelay:r=150,arrow:s=!0,renderArrow:i,className:u,children:l}){let[a,d]=_e(!1),[c,p]=_e(null),[f,m]=_e(t),x=we(null),h=we(null),b=we(void 0),y=we(void 0),v=jo(),S=Te(()=>{clearTimeout(b.current),clearTimeout(y.current)},[]),w=Te(()=>{S(),b.current=setTimeout(()=>d(!0),o)},[S,o]),L=Te(()=>{S(),y.current=setTimeout(()=>d(!1),r)},[S,r]),N=Te(C=>{C.key==="Escape"&&a&&d(!1)},[a]);if(Qo(()=>{if(!a||!x.current||!h.current)return;function C(){if(!x.current||!h.current)return;let g=x.current.getBoundingClientRect(),R=h.current.getBoundingClientRect(),A=or(g,R,t,s),U=document.body.getBoundingClientRect();p({top:A.top+window.scrollY-U.top,left:A.left+window.scrollX-U.left}),m(A.placement)}return C(),window.addEventListener("scroll",C,!0),window.addEventListener("resize",C),()=>{window.removeEventListener("scroll",C,!0),window.removeEventListener("resize",C)}},[a,t,s]),$t(()=>{if(a)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[a,N]),$t(()=>S,[S]),!Jo(l))return l;let D=Zo(l,{ref:rr(x,l),"data-state":a?"open":"closed",onMouseEnter:C=>{w();let g=l.props.onMouseEnter;g?.(C)},onMouseLeave:C=>{L();let g=l.props.onMouseLeave;g?.(C)},onFocus:C=>{w();let g=l.props.onFocus;g?.(C)},onBlur:C=>{L();let g=l.props.onBlur;g?.(C)},"aria-describedby":a?v:void 0});return qt(ir,{children:[D,a&&er(qt("div",{ref:h,id:v,role:"tooltip","data-state":a?"open":"closed","data-placement":f,"data-density":n,className:Yo("ui-tooltip absolute z-[9999] rounded-lg leading-relaxed",sr[n],"animate-[tooltip-in_0.15s_var(--ease-standard)]",u),style:c?{top:c.top,left:c.left}:{position:"fixed",visibility:"hidden"},onMouseEnter:w,onMouseLeave:L,children:[e,s&&Oe("span",{className:"ui-tooltip__arrow absolute",style:nr[f],children:i?i({placement:f}):Oe("svg",{width:ue*2,height:ue,viewBox:"0 0 12 6",children:Oe("path",{d:"M0 0l6 6 6-6z",fill:"currentColor"})})})]}),document.body)]})}export{We as Avatar,Ke as Badge,ee as Button,Sn as Collapsible,Je as CollapsibleContent,Se as CollapsibleRoot,Ze as CollapsibleTrigger,Vn as ConfirmProvider,V as Dialog,ut as Drawer,oo as DropdownMenu,ct as EmptyState,pt as Field,mt as IconButton,bt as Input,ht as Panel,go as PanelBody,bo as PanelFooter,mo as PanelHeader,Tt as SegmentedControl,Rt as Select,Ct as Skeleton,de as Spinner,St as StatusNotice,Nt as Switch,Ao as Tabs,At as TabsContent,kt as TabsList,Ae as TabsRoot,Ht as TabsTrigger,Bt as Textarea,Xo as ToastProvider,Gt as Tooltip,Ue as buttonClassName,On as useConfirm,Ko as useToast};
|
|
@@ -32,7 +32,7 @@ const catalog = {
|
|
|
32
32
|
"group": "forms",
|
|
33
33
|
"componentId": "input",
|
|
34
34
|
"componentName": "Input",
|
|
35
|
-
"description": "
|
|
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
|
},
|
|
@@ -172,6 +190,18 @@ const catalog = {
|
|
|
172
190
|
"group": "forms",
|
|
173
191
|
"componentId": "switch"
|
|
174
192
|
},
|
|
193
|
+
{
|
|
194
|
+
"group": "forms",
|
|
195
|
+
"componentId": "textarea"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"group": "forms",
|
|
199
|
+
"componentId": "collapsible"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"group": "forms",
|
|
203
|
+
"componentId": "tabs"
|
|
204
|
+
},
|
|
175
205
|
{
|
|
176
206
|
"group": "feedback",
|
|
177
207
|
"componentId": "badge"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"group": "forms",
|
|
33
33
|
"componentId": "input",
|
|
34
34
|
"componentName": "Input",
|
|
35
|
-
"description": "
|
|
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
|
},
|
|
@@ -172,6 +190,18 @@
|
|
|
172
190
|
"group": "forms",
|
|
173
191
|
"componentId": "switch"
|
|
174
192
|
},
|
|
193
|
+
{
|
|
194
|
+
"group": "forms",
|
|
195
|
+
"componentId": "textarea"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"group": "forms",
|
|
199
|
+
"componentId": "collapsible"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"group": "forms",
|
|
203
|
+
"componentId": "tabs"
|
|
204
|
+
},
|
|
175
205
|
{
|
|
176
206
|
"group": "feedback",
|
|
177
207
|
"componentId": "badge"
|